diff options
author | sam <sam@FreeBSD.org> | 2009-03-29 17:59:14 +0000 |
---|---|---|
committer | sam <sam@FreeBSD.org> | 2009-03-29 17:59:14 +0000 |
commit | 7edd0aa8efc500847d789aedf8904ab96a6fe234 (patch) | |
tree | 8bb42581e6c46229c54ff76ee3fd9dd1e507f939 /sys/dev/ral | |
parent | cb768e2631a7f373d03c4b3c7fb251e76badc6a7 (diff) | |
download | FreeBSD-src-7edd0aa8efc500847d789aedf8904ab96a6fe234.zip FreeBSD-src-7edd0aa8efc500847d789aedf8904ab96a6fe234.tar.gz |
Eliminate ic_myaddr so changing the mac address of a device works correctly:
o remove ic_myaddr from ieee80211com
o change ieee80211_ifattach to take the mac address of the physical device
and use that to setup the lladdr.
o replace all references to ic_myaddr in drivers by IF_LLADDR
o related cleanups (e.g. kill dead code)
PR: kern/133178
Reviewed by: thompsa, rpaulo
Diffstat (limited to 'sys/dev/ral')
-rw-r--r-- | sys/dev/ral/rt2560.c | 8 | ||||
-rw-r--r-- | sys/dev/ral/rt2661.c | 24 |
2 files changed, 16 insertions, 16 deletions
diff --git a/sys/dev/ral/rt2560.c b/sys/dev/ral/rt2560.c index a0b06a3..d9378fa3 100644 --- a/sys/dev/ral/rt2560.c +++ b/sys/dev/ral/rt2560.c @@ -202,6 +202,7 @@ rt2560_attach(device_t dev, int id) struct ifnet *ifp; int error; uint8_t bands; + uint8_t macaddr[IEEE80211_ADDR_LEN]; sc->sc_dev = dev; @@ -260,7 +261,7 @@ rt2560_attach(device_t dev, int id) ic = ifp->if_l2com; /* retrieve MAC address */ - rt2560_get_macaddr(sc, ic->ic_myaddr); + rt2560_get_macaddr(sc, macaddr); ifp->if_softc = sc; if_initname(ifp, device_get_name(dev), device_get_unit(dev)); @@ -300,7 +301,7 @@ rt2560_attach(device_t dev, int id) setbit(&bands, IEEE80211_MODE_11A); ieee80211_init_channels(ic, NULL, &bands); - ieee80211_ifattach(ic); + ieee80211_ifattach(ic, macaddr); ic->ic_newassoc = rt2560_newassoc; ic->ic_raw_xmit = rt2560_raw_xmit; ic->ic_updateslot = rt2560_update_slot; @@ -2683,8 +2684,7 @@ rt2560_init_locked(struct rt2560_softc *sc) for (i = 0; i < N(rt2560_def_mac); i++) RAL_WRITE(sc, rt2560_def_mac[i].reg, rt2560_def_mac[i].val); - IEEE80211_ADDR_COPY(ic->ic_myaddr, IF_LLADDR(ifp)); - rt2560_set_macaddr(sc, ic->ic_myaddr); + rt2560_set_macaddr(sc, IF_LLADDR(ifp)); /* set basic rate set (will be updated later) */ RAL_WRITE(sc, RT2560_ARSP_PLCP_1, 0x153); diff --git a/sys/dev/ral/rt2661.c b/sys/dev/ral/rt2661.c index 215a1b7..3ceeb46 100644 --- a/sys/dev/ral/rt2661.c +++ b/sys/dev/ral/rt2661.c @@ -155,7 +155,7 @@ static int rt2661_wme_update(struct ieee80211com *) __unused; static void rt2661_update_slot(struct ifnet *); static const char *rt2661_get_rf(int); static void rt2661_read_eeprom(struct rt2661_softc *, - struct ieee80211com *); + uint8_t macaddr[IEEE80211_ADDR_LEN]); static int rt2661_bbp_init(struct rt2661_softc *); static void rt2661_init_locked(struct rt2661_softc *); static void rt2661_init(void *); @@ -204,6 +204,7 @@ rt2661_attach(device_t dev, int id) uint32_t val; int error, ac, ntries; uint8_t bands; + uint8_t macaddr[IEEE80211_ADDR_LEN]; sc->sc_id = id; sc->sc_dev = dev; @@ -234,7 +235,7 @@ rt2661_attach(device_t dev, int id) } /* retrieve RF rev. no and various other things from EEPROM */ - rt2661_read_eeprom(sc, ic); + rt2661_read_eeprom(sc, macaddr); device_printf(dev, "MAC/BBP RT%X, RF %s\n", val, rt2661_get_rf(sc->rf_rev)); @@ -303,7 +304,7 @@ rt2661_attach(device_t dev, int id) setbit(&bands, IEEE80211_MODE_11A); ieee80211_init_channels(ic, NULL, &bands); - ieee80211_ifattach(ic); + ieee80211_ifattach(ic, macaddr); ic->ic_newassoc = rt2661_newassoc; ic->ic_node_alloc = rt2661_node_alloc; #if 0 @@ -2219,23 +2220,23 @@ rt2661_get_rf(int rev) } static void -rt2661_read_eeprom(struct rt2661_softc *sc, struct ieee80211com *ic) +rt2661_read_eeprom(struct rt2661_softc *sc, uint8_t macaddr[IEEE80211_ADDR_LEN]) { uint16_t val; int i; /* read MAC address */ val = rt2661_eeprom_read(sc, RT2661_EEPROM_MAC01); - ic->ic_myaddr[0] = val & 0xff; - ic->ic_myaddr[1] = val >> 8; + macaddr[0] = val & 0xff; + macaddr[1] = val >> 8; val = rt2661_eeprom_read(sc, RT2661_EEPROM_MAC23); - ic->ic_myaddr[2] = val & 0xff; - ic->ic_myaddr[3] = val >> 8; + macaddr[2] = val & 0xff; + macaddr[3] = val >> 8; val = rt2661_eeprom_read(sc, RT2661_EEPROM_MAC45); - ic->ic_myaddr[4] = val & 0xff; - ic->ic_myaddr[5] = val >> 8; + macaddr[4] = val & 0xff; + macaddr[5] = val >> 8; val = rt2661_eeprom_read(sc, RT2661_EEPROM_ANTENNA); /* XXX: test if different from 0xffff? */ @@ -2413,8 +2414,7 @@ rt2661_init_locked(struct rt2661_softc *sc) for (i = 0; i < N(rt2661_def_mac); i++) RAL_WRITE(sc, rt2661_def_mac[i].reg, rt2661_def_mac[i].val); - IEEE80211_ADDR_COPY(ic->ic_myaddr, IF_LLADDR(ifp)); - rt2661_set_macaddr(sc, ic->ic_myaddr); + rt2661_set_macaddr(sc, IF_LLADDR(ifp)); /* set host ready */ RAL_WRITE(sc, RT2661_MAC_CSR1, 3); |