summaryrefslogtreecommitdiffstats
path: root/sys/dev
diff options
context:
space:
mode:
authorsam <sam@FreeBSD.org>2009-03-29 17:59:14 +0000
committersam <sam@FreeBSD.org>2009-03-29 17:59:14 +0000
commit7edd0aa8efc500847d789aedf8904ab96a6fe234 (patch)
tree8bb42581e6c46229c54ff76ee3fd9dd1e507f939 /sys/dev
parentcb768e2631a7f373d03c4b3c7fb251e76badc6a7 (diff)
downloadFreeBSD-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')
-rw-r--r--sys/dev/ath/if_ath.c18
-rw-r--r--sys/dev/if_ndis/if_ndis.c5
-rw-r--r--sys/dev/ipw/if_ipw.c15
-rw-r--r--sys/dev/iwi/if_iwi.c20
-rw-r--r--sys/dev/iwn/if_iwn.c22
-rw-r--r--sys/dev/malo/if_malo.c31
-rw-r--r--sys/dev/ral/rt2560.c8
-rw-r--r--sys/dev/ral/rt2661.c24
-rw-r--r--sys/dev/usb/wlan/if_rum.c6
-rw-r--r--sys/dev/usb/wlan/if_ural.c6
-rw-r--r--sys/dev/usb/wlan/if_zyd.c10
-rw-r--r--sys/dev/wi/if_wi.c13
-rw-r--r--sys/dev/wpi/if_wpi.c18
13 files changed, 77 insertions, 119 deletions
diff --git a/sys/dev/ath/if_ath.c b/sys/dev/ath/if_ath.c
index 551c47b..26794fc 100644
--- a/sys/dev/ath/if_ath.c
+++ b/sys/dev/ath/if_ath.c
@@ -353,6 +353,7 @@ ath_attach(u_int16_t devid, struct ath_softc *sc)
HAL_STATUS status;
int error = 0, i;
u_int wmodes;
+ uint8_t macaddr[IEEE80211_ADDR_LEN];
DPRINTF(sc, ATH_DEBUG_ANY, "%s: devid 0x%x\n", __func__, devid);
@@ -681,14 +682,14 @@ ath_attach(u_int16_t devid, struct ath_softc *sc)
sc->sc_hasveol = ath_hal_hasveol(ah);
/* get mac address from hardware */
- ath_hal_getmac(ah, ic->ic_myaddr);
+ ath_hal_getmac(ah, macaddr);
if (sc->sc_hasbmask)
ath_hal_getbssidmask(ah, sc->sc_hwbssidmask);
/* NB: used to size node table key mapping array */
ic->ic_max_keyix = sc->sc_keymax;
/* call MI attach routine. */
- ieee80211_ifattach(ic);
+ ieee80211_ifattach(ic, macaddr);
ic->ic_setregdomain = ath_setregdomain;
ic->ic_getradiocaps = ath_getradiocaps;
sc->sc_opmode = HAL_M_STA;
@@ -2755,7 +2756,6 @@ static void
ath_mode_init(struct ath_softc *sc)
{
struct ifnet *ifp = sc->sc_ifp;
- struct ieee80211com *ic = ifp->if_l2com;
struct ath_hal *ah = sc->sc_ah;
u_int32_t rfilt;
@@ -2766,16 +2766,8 @@ ath_mode_init(struct ath_softc *sc)
/* configure operational mode */
ath_hal_setopmode(ah);
- /*
- * Handle any link-level address change. Note that we only
- * need to force ic_myaddr; any other addresses are handled
- * as a byproduct of the ifnet code marking the interface
- * down then up.
- *
- * XXX should get from lladdr instead of arpcom but that's more work
- */
- IEEE80211_ADDR_COPY(ic->ic_myaddr, IF_LLADDR(ifp));
- ath_hal_setmac(ah, ic->ic_myaddr);
+ /* handle any link-level address change */
+ ath_hal_setmac(ah, IF_LLADDR(ifp));
/* calculate and install multicast filter */
ath_update_mcast(ifp);
diff --git a/sys/dev/if_ndis/if_ndis.c b/sys/dev/if_ndis/if_ndis.c
index 8cc2ede..b16bdb6 100644
--- a/sys/dev/if_ndis/if_ndis.c
+++ b/sys/dev/if_ndis/if_ndis.c
@@ -937,8 +937,7 @@ got_crypto:
if (r == 0)
ic->ic_caps |= IEEE80211_C_TXPMGT;
- bcopy(eaddr, &ic->ic_myaddr, sizeof(eaddr));
- ieee80211_ifattach(ic);
+ ieee80211_ifattach(ic, eaddr);
ic->ic_raw_xmit = ndis_raw_xmit;
ic->ic_scan_start = ndis_scan_start;
ic->ic_scan_end = ndis_scan_end;
@@ -2408,7 +2407,7 @@ ndis_setstate_80211(sc)
/* Set the BSSID to our value so the driver doesn't associate */
len = IEEE80211_ADDR_LEN;
- bcopy(ic->ic_myaddr, bssid, len);
+ bcopy(IF_LLADDR(ifp), bssid, len);
DPRINTF(("Setting BSSID to %6D\n", (uint8_t *)&bssid, ":"));
rval = ndis_set_info(sc, OID_802_11_BSSID, &bssid, &len);
if (rval)
diff --git a/sys/dev/ipw/if_ipw.c b/sys/dev/ipw/if_ipw.c
index b20d3f6..f7c3ea5 100644
--- a/sys/dev/ipw/if_ipw.c
+++ b/sys/dev/ipw/if_ipw.c
@@ -231,6 +231,7 @@ ipw_attach(device_t dev)
struct ieee80211_channel *c;
uint16_t val;
int error, i;
+ uint8_t macaddr[IEEE80211_ADDR_LEN];
sc->sc_dev = dev;
@@ -315,14 +316,14 @@ ipw_attach(device_t dev)
/* read MAC address from EEPROM */
val = ipw_read_prom_word(sc, IPW_EEPROM_MAC + 0);
- ic->ic_myaddr[0] = val >> 8;
- ic->ic_myaddr[1] = val & 0xff;
+ macaddr[0] = val >> 8;
+ macaddr[1] = val & 0xff;
val = ipw_read_prom_word(sc, IPW_EEPROM_MAC + 1);
- ic->ic_myaddr[2] = val >> 8;
- ic->ic_myaddr[3] = val & 0xff;
+ macaddr[2] = val >> 8;
+ macaddr[3] = val & 0xff;
val = ipw_read_prom_word(sc, IPW_EEPROM_MAC + 2);
- ic->ic_myaddr[4] = val >> 8;
- ic->ic_myaddr[5] = val & 0xff;
+ macaddr[4] = val >> 8;
+ macaddr[5] = val & 0xff;
/* set supported .11b channels (read from EEPROM) */
if ((val = ipw_read_prom_word(sc, IPW_EEPROM_CHANNEL_LIST)) == 0)
@@ -341,7 +342,7 @@ ipw_attach(device_t dev)
if (!(ipw_read_prom_word(sc, IPW_EEPROM_RADIO) & 8))
sc->flags |= IPW_FLAG_HAS_RADIO_SWITCH;
- ieee80211_ifattach(ic);
+ ieee80211_ifattach(ic, macaddr);
ic->ic_scan_start = ipw_scan_start;
ic->ic_scan_end = ipw_scan_end;
ic->ic_set_channel = ipw_set_channel;
diff --git a/sys/dev/iwi/if_iwi.c b/sys/dev/iwi/if_iwi.c
index 81e0220..ba4af2a 100644
--- a/sys/dev/iwi/if_iwi.c
+++ b/sys/dev/iwi/if_iwi.c
@@ -280,6 +280,7 @@ iwi_attach(device_t dev)
uint16_t val;
int i, error;
uint8_t bands;
+ uint8_t macaddr[IEEE80211_ADDR_LEN];
sc->sc_dev = dev;
@@ -403,14 +404,14 @@ iwi_attach(device_t dev)
/* read MAC address from EEPROM */
val = iwi_read_prom_word(sc, IWI_EEPROM_MAC + 0);
- ic->ic_myaddr[0] = val & 0xff;
- ic->ic_myaddr[1] = val >> 8;
+ macaddr[0] = val & 0xff;
+ macaddr[1] = val >> 8;
val = iwi_read_prom_word(sc, IWI_EEPROM_MAC + 1);
- ic->ic_myaddr[2] = val & 0xff;
- ic->ic_myaddr[3] = val >> 8;
+ macaddr[2] = val & 0xff;
+ macaddr[3] = val >> 8;
val = iwi_read_prom_word(sc, IWI_EEPROM_MAC + 2);
- ic->ic_myaddr[4] = val & 0xff;
- ic->ic_myaddr[5] = val >> 8;
+ macaddr[4] = val & 0xff;
+ macaddr[5] = val >> 8;
bands = 0;
setbit(&bands, IEEE80211_MODE_11B);
@@ -419,7 +420,7 @@ iwi_attach(device_t dev)
setbit(&bands, IEEE80211_MODE_11A);
ieee80211_init_channels(ic, NULL, &bands);
- ieee80211_ifattach(ic);
+ ieee80211_ifattach(ic, macaddr);
/* override default methods */
ic->ic_node_alloc = iwi_node_alloc;
sc->sc_node_free = ic->ic_node_free;
@@ -2568,9 +2569,8 @@ iwi_config(struct iwi_softc *sc)
IWI_LOCK_ASSERT(sc);
- IEEE80211_ADDR_COPY(ic->ic_myaddr, IF_LLADDR(ifp));
- DPRINTF(("Setting MAC address to %6D\n", ic->ic_myaddr, ":"));
- error = iwi_cmd(sc, IWI_CMD_SET_MAC_ADDRESS, ic->ic_myaddr,
+ DPRINTF(("Setting MAC address to %6D\n", IF_LLADDR(ifp), ":"));
+ error = iwi_cmd(sc, IWI_CMD_SET_MAC_ADDRESS, IF_LLADDR(ifp),
IEEE80211_ADDR_LEN);
if (error != 0)
return error;
diff --git a/sys/dev/iwn/if_iwn.c b/sys/dev/iwn/if_iwn.c
index 8ec705c..a91a55b 100644
--- a/sys/dev/iwn/if_iwn.c
+++ b/sys/dev/iwn/if_iwn.c
@@ -132,7 +132,8 @@ void iwn_cmd_intr(struct iwn_softc *, struct iwn_rx_desc *);
static void iwn_bmiss(void *, int);
void iwn_notif_intr(struct iwn_softc *);
void iwn_intr(void *);
-void iwn_read_eeprom(struct iwn_softc *);
+void iwn_read_eeprom(struct iwn_softc *,
+ uint8_t macaddr[IEEE80211_ADDR_LEN]);
static void iwn_read_eeprom_channels(struct iwn_softc *);
void iwn_print_power_group(struct iwn_softc *, int);
uint8_t iwn_plcp_signal(int);
@@ -254,6 +255,7 @@ iwn_attach(device_t dev)
struct ieee80211com *ic;
struct ifnet *ifp;
int i, error, result;
+ uint8_t macaddr[IEEE80211_ADDR_LEN];
sc->sc_dev = dev;
@@ -410,7 +412,7 @@ iwn_attach(device_t dev)
;
#endif
/* read supported channels and MAC address from EEPROM */
- iwn_read_eeprom(sc);
+ iwn_read_eeprom(sc, macaddr);
if_initname(ifp, device_get_name(dev), device_get_unit(dev));
ifp->if_softc = sc;
@@ -422,7 +424,7 @@ iwn_attach(device_t dev)
ifp->if_snd.ifq_drv_maxlen = IFQ_MAXLEN;
IFQ_SET_READY(&ifp->if_snd);
- ieee80211_ifattach(ic);
+ ieee80211_ifattach(ic, macaddr);
ic->ic_vap_create = iwn_vap_create;
ic->ic_vap_delete = iwn_vap_delete;
ic->ic_raw_xmit = iwn_raw_xmit;
@@ -2409,10 +2411,8 @@ iwn_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data)
}
void
-iwn_read_eeprom(struct iwn_softc *sc)
+iwn_read_eeprom(struct iwn_softc *sc, uint8_t macaddr[IEEE80211_ADDR_LEN])
{
- struct ifnet *ifp = sc->sc_ifp;
- struct ieee80211com *ic = ifp->if_l2com;
char domain[4];
uint16_t val;
int i, error;
@@ -2427,8 +2427,8 @@ iwn_read_eeprom(struct iwn_softc *sc)
device_printf(sc->sc_dev,"Reg Domain: %.4s", domain);
/* read and print MAC address */
- iwn_read_prom_data(sc, IWN_EEPROM_MAC, ic->ic_myaddr, 6);
- printf(", address %s\n", ether_sprintf(ic->ic_myaddr));
+ iwn_read_prom_data(sc, IWN_EEPROM_MAC, macaddr, 6);
+ printf(", address %6D\n", macaddr, ":");
/* read the list of authorized channels */
iwn_read_eeprom_channels(sc);
@@ -3754,7 +3754,7 @@ iwn_scan(struct iwn_softc *sc)
IEEE80211_FC0_SUBTYPE_PROBE_REQ;
wh->i_fc[1] = IEEE80211_FC1_DIR_NODS;
IEEE80211_ADDR_COPY(wh->i_addr1, ifp->if_broadcastaddr);
- IEEE80211_ADDR_COPY(wh->i_addr2, ic->ic_myaddr);
+ IEEE80211_ADDR_COPY(wh->i_addr2, IF_LLADDR(ifp));
IEEE80211_ADDR_COPY(wh->i_addr3, ifp->if_broadcastaddr);
*(u_int16_t *)&wh->i_dur[0] = 0; /* filled by h/w */
*(u_int16_t *)&wh->i_seq[0] = 0; /* filled by h/w */
@@ -3892,8 +3892,8 @@ iwn_config(struct iwn_softc *sc)
/* configure adapter */
memset(&sc->config, 0, sizeof (struct iwn_config));
- IEEE80211_ADDR_COPY(sc->config.myaddr, ic->ic_myaddr);
- IEEE80211_ADDR_COPY(sc->config.wlap, ic->ic_myaddr);
+ IEEE80211_ADDR_COPY(sc->config.myaddr, IF_LLADDR(ifp));
+ IEEE80211_ADDR_COPY(sc->config.wlap, IF_LLADDR(ifp));
/* set default channel */
sc->config.chan = htole16(ieee80211_chan2ieee(ic, ic->ic_curchan));
sc->config.flags = htole32(IWN_CONFIG_TSF);
diff --git a/sys/dev/malo/if_malo.c b/sys/dev/malo/if_malo.c
index 681c824..851b841 100644
--- a/sys/dev/malo/if_malo.c
+++ b/sys/dev/malo/if_malo.c
@@ -175,16 +175,10 @@ malo_bar0_write4(struct malo_softc *sc, bus_size_t off, uint32_t val)
bus_space_write_4(sc->malo_io0t, sc->malo_io0h, off, val);
}
-static uint8_t
-malo_bar1_read1(struct malo_softc *sc, bus_size_t off)
-{
- return bus_space_read_1(sc->malo_io1t, sc->malo_io1h, off);
-}
-
int
malo_attach(uint16_t devid, struct malo_softc *sc)
{
- int error, i;
+ int error;
struct ieee80211com *ic;
struct ifnet *ifp;
struct malo_hal *mh;
@@ -203,16 +197,6 @@ malo_attach(uint16_t devid, struct malo_softc *sc)
if_initname(ifp, device_get_name(sc->malo_dev),
device_get_unit(sc->malo_dev));
- /*
- * NB: get mac address from hardware directly here before we set DMAs
- * for HAL because we don't want to disturb operations of HAL at BAR 1.
- */
- for (i = 0; i < IEEE80211_ADDR_LEN; i++) {
- /* XXX remove a magic number but we don't have documents. */
- ic->ic_myaddr[i] = malo_bar1_read1(sc, 0xa528 + i);
- DELAY(1000);
- }
-
mh = malo_hal_attach(sc->malo_dev, devid,
sc->malo_io1h, sc->malo_io1t, sc->malo_dmat);
if (mh == NULL) {
@@ -319,11 +303,8 @@ malo_attach(uint16_t devid, struct malo_softc *sc)
ic->ic_headroom = sizeof(struct malo_txrec) -
sizeof(struct ieee80211_frame);
- /* get mac address from hardware */
- IEEE80211_ADDR_COPY(ic->ic_myaddr, sc->malo_hwspecs.macaddr);
-
/* call MI attach routine. */
- ieee80211_ifattach(ic);
+ ieee80211_ifattach(ic, sc->malo_hwspecs.macaddr);
/* override default methods */
ic->ic_vap_create = malo_vap_create;
ic->ic_vap_delete = malo_vap_delete;
@@ -1636,14 +1617,6 @@ malo_mode_init(struct malo_softc *sc)
struct malo_hal *mh = sc->malo_mh;
/*
- * Handle any link-level address change. Note that we only
- * need to force ic_myaddr; any other addresses are handled
- * as a byproduct of the ifnet code marking the interface
- * down then up.
- */
- IEEE80211_ADDR_COPY(ic->ic_myaddr, IF_LLADDR(ifp));
-
- /*
* NB: Ignore promisc in hostap mode; it's set by the
* bridge. This is wrong but we have no way to
* identify internal requests (from the bridge)
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);
diff --git a/sys/dev/usb/wlan/if_rum.c b/sys/dev/usb/wlan/if_rum.c
index 659010c..bfe38a1 100644
--- a/sys/dev/usb/wlan/if_rum.c
+++ b/sys/dev/usb/wlan/if_rum.c
@@ -494,7 +494,6 @@ rum_attach_post(struct usb2_proc_msg *pm)
ic->ic_ifp = ifp;
ic->ic_phytype = IEEE80211_T_OFDM; /* not only, but not used */
- IEEE80211_ADDR_COPY(ic->ic_myaddr, sc->sc_bssid);
/* set device capabilities */
ic->ic_caps =
@@ -516,7 +515,7 @@ rum_attach_post(struct usb2_proc_msg *pm)
setbit(&bands, IEEE80211_MODE_11A);
ieee80211_init_channels(ic, NULL, &bands);
- ieee80211_ifattach(ic);
+ ieee80211_ifattach(ic, sc->sc_bssid);
ic->ic_update_promisc = rum_update_promisc;
ic->ic_newassoc = rum_newassoc;
ic->ic_raw_xmit = rum_raw_xmit;
@@ -2064,8 +2063,7 @@ rum_init_task(struct usb2_proc_msg *pm)
/* clear STA registers */
rum_read_multi(sc, RT2573_STA_CSR0, sc->sta, sizeof sc->sta);
- IEEE80211_ADDR_COPY(ic->ic_myaddr, IF_LLADDR(ifp));
- rum_set_macaddr(sc, ic->ic_myaddr);
+ rum_set_macaddr(sc, IF_LLADDR(ifp));
/* initialize ASIC */
rum_write(sc, RT2573_MAC_CSR1, 4);
diff --git a/sys/dev/usb/wlan/if_ural.c b/sys/dev/usb/wlan/if_ural.c
index 2844f2c..83a517f 100644
--- a/sys/dev/usb/wlan/if_ural.c
+++ b/sys/dev/usb/wlan/if_ural.c
@@ -485,7 +485,6 @@ ural_attach_post(struct usb2_proc_msg *pm)
ic->ic_ifp = ifp;
ic->ic_phytype = IEEE80211_T_OFDM; /* not only, but not used */
- IEEE80211_ADDR_COPY(ic->ic_myaddr, sc->sc_bssid);
/* set device capabilities */
ic->ic_caps =
@@ -507,7 +506,7 @@ ural_attach_post(struct usb2_proc_msg *pm)
setbit(&bands, IEEE80211_MODE_11A);
ieee80211_init_channels(ic, NULL, &bands);
- ieee80211_ifattach(ic);
+ ieee80211_ifattach(ic, sc->sc_bssid);
ic->ic_update_promisc = ural_update_promisc;
ic->ic_newassoc = ural_newassoc;
ic->ic_raw_xmit = ural_raw_xmit;
@@ -2216,8 +2215,7 @@ ural_init_task(struct usb2_proc_msg *pm)
ural_set_txantenna(sc, sc->tx_ant);
ural_set_rxantenna(sc, sc->rx_ant);
- IEEE80211_ADDR_COPY(ic->ic_myaddr, IF_LLADDR(ifp));
- ural_set_macaddr(sc, ic->ic_myaddr);
+ ural_set_macaddr(sc, IF_LLADDR(ifp));
/*
* Allocate Tx and Rx xfer queues.
diff --git a/sys/dev/usb/wlan/if_zyd.c b/sys/dev/usb/wlan/if_zyd.c
index fa9580a..2317848 100644
--- a/sys/dev/usb/wlan/if_zyd.c
+++ b/sys/dev/usb/wlan/if_zyd.c
@@ -396,7 +396,6 @@ zyd_attach_post(struct usb2_proc_msg *pm)
ic->ic_ifp = ifp;
ic->ic_phytype = IEEE80211_T_OFDM; /* not only, but not used */
ic->ic_opmode = IEEE80211_M_STA;
- IEEE80211_ADDR_COPY(ic->ic_myaddr, sc->sc_bssid);
/* set device capabilities */
ic->ic_caps =
@@ -413,7 +412,7 @@ zyd_attach_post(struct usb2_proc_msg *pm)
setbit(&bands, IEEE80211_MODE_11G);
ieee80211_init_channels(ic, NULL, &bands);
- ieee80211_ifattach(ic);
+ ieee80211_ifattach(ic, sc->sc_bssid);
ic->ic_newassoc = zyd_newassoc;
ic->ic_raw_xmit = zyd_raw_xmit;
ic->ic_node_alloc = zyd_node_alloc;
@@ -2859,10 +2858,9 @@ zyd_init_task(struct usb2_proc_msg *pm)
if (ifp->if_drv_flags & IFF_DRV_RUNNING)
zyd_stop_task(pm);
- IEEE80211_ADDR_COPY(ic->ic_myaddr, IF_LLADDR(ifp));
- DPRINTF(sc, ZYD_DEBUG_INIT, "setting MAC address to %s\n",
- ether_sprintf(ic->ic_myaddr));
- error = zyd_set_macaddr(sc, ic->ic_myaddr);
+ DPRINTF(sc, ZYD_DEBUG_INIT, "setting MAC address to %6D\n",
+ IF_LLADDR(ifp), ":");
+ error = zyd_set_macaddr(sc, IF_LLADDR(ifp));
if (error != 0)
return;
diff --git a/sys/dev/wi/if_wi.c b/sys/dev/wi/if_wi.c
index 62b7114..10d65d3 100644
--- a/sys/dev/wi/if_wi.c
+++ b/sys/dev/wi/if_wi.c
@@ -245,6 +245,7 @@ wi_attach(device_t dev)
0x00, 0x00, 0x00, 0x00, 0x00, 0x00
};
int error;
+ uint8_t macaddr[IEEE80211_ADDR_LEN];
ifp = sc->sc_ifp = if_alloc(IFT_IEEE80211);
if (ifp == NULL) {
@@ -312,12 +313,12 @@ wi_attach(device_t dev)
* the probe to fail.
*/
buflen = IEEE80211_ADDR_LEN;
- error = wi_read_rid(sc, WI_RID_MAC_NODE, ic->ic_myaddr, &buflen);
+ error = wi_read_rid(sc, WI_RID_MAC_NODE, macaddr, &buflen);
if (error != 0) {
buflen = IEEE80211_ADDR_LEN;
- error = wi_read_rid(sc, WI_RID_MAC_NODE, ic->ic_myaddr, &buflen);
+ error = wi_read_rid(sc, WI_RID_MAC_NODE, macaddr, &buflen);
}
- if (error || IEEE80211_ADDR_EQ(ic->ic_myaddr, empty_macaddr)) {
+ if (error || IEEE80211_ADDR_EQ(macaddr, empty_macaddr)) {
if (error != 0)
device_printf(dev, "mac read failed %d\n", error);
else {
@@ -451,7 +452,7 @@ wi_attach(device_t dev)
sc->sc_portnum = WI_DEFAULT_PORT;
TASK_INIT(&sc->sc_oor_task, 0, wi_status_oor, ic);
- ieee80211_ifattach(ic);
+ ieee80211_ifattach(ic, macaddr);
ic->ic_raw_xmit = wi_raw_xmit;
ic->ic_scan_start = wi_scan_start;
ic->ic_scan_end = wi_scan_end;
@@ -690,7 +691,6 @@ static void
wi_init_locked(struct wi_softc *sc)
{
struct ifnet *ifp = sc->sc_ifp;
- struct ieee80211com *ic = ifp->if_l2com;
int wasenabled;
WI_LOCK_ASSERT(sc);
@@ -699,8 +699,7 @@ wi_init_locked(struct wi_softc *sc)
if (wasenabled)
wi_stop_locked(sc, 1);
- IEEE80211_ADDR_COPY(ic->ic_myaddr, IF_LLADDR(ifp));
- if (wi_setup_locked(sc, sc->sc_porttype, 3, ic->ic_myaddr) != 0) {
+ if (wi_setup_locked(sc, sc->sc_porttype, 3, IF_LLADDR(ifp)) != 0) {
if_printf(ifp, "interface not running\n");
wi_stop_locked(sc, 1);
return;
diff --git a/sys/dev/wpi/if_wpi.c b/sys/dev/wpi/if_wpi.c
index 70069bf..57615d8 100644
--- a/sys/dev/wpi/if_wpi.c
+++ b/sys/dev/wpi/if_wpi.c
@@ -211,7 +211,8 @@ static void wpi_set_channel(struct ieee80211com *);
static void wpi_scan_curchan(struct ieee80211_scan_state *, unsigned long);
static void wpi_scan_mindwell(struct ieee80211_scan_state *);
static int wpi_ioctl(struct ifnet *, u_long, caddr_t);
-static void wpi_read_eeprom(struct wpi_softc *);
+static void wpi_read_eeprom(struct wpi_softc *,
+ uint8_t macaddr[IEEE80211_ADDR_LEN]);
static void wpi_read_eeprom_channels(struct wpi_softc *, int);
static void wpi_read_eeprom_group(struct wpi_softc *, int);
static int wpi_cmd(struct wpi_softc *, int, const void *, int, int);
@@ -493,6 +494,7 @@ wpi_attach(device_t dev)
int ac, error, supportsa = 1;
uint32_t tmp;
const struct wpi_ident *ident;
+ uint8_t macaddr[IEEE80211_ADDR_LEN];
sc->sc_dev = dev;
@@ -650,7 +652,7 @@ wpi_attach(device_t dev)
* Read in the eeprom and also setup the channels for
* net80211. We don't set the rates as net80211 does this for us
*/
- wpi_read_eeprom(sc);
+ wpi_read_eeprom(sc, macaddr);
if (bootverbose || WPI_DEBUG_SET) {
device_printf(sc->sc_dev, "Regulatory Domain: %.4s\n", sc->domain);
@@ -675,7 +677,7 @@ wpi_attach(device_t dev)
ifp->if_snd.ifq_drv_maxlen = IFQ_MAXLEN;
IFQ_SET_READY(&ifp->if_snd);
- ieee80211_ifattach(ic);
+ ieee80211_ifattach(ic, macaddr);
/* override default methods */
ic->ic_node_alloc = wpi_node_alloc;
ic->ic_newassoc = wpi_newassoc;
@@ -2150,10 +2152,8 @@ wpi_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data)
* Extract various information from EEPROM.
*/
static void
-wpi_read_eeprom(struct wpi_softc *sc)
+wpi_read_eeprom(struct wpi_softc *sc, uint8_t macaddr[IEEE80211_ADDR_LEN])
{
- struct ifnet *ifp = sc->sc_ifp;
- struct ieee80211com *ic = ifp->if_l2com;
int i;
/* read the hardware capabilities, revision and SKU type */
@@ -2165,7 +2165,7 @@ wpi_read_eeprom(struct wpi_softc *sc)
wpi_read_prom_data(sc, WPI_EEPROM_DOMAIN, sc->domain, 4);
/* read in the hw MAC address */
- wpi_read_prom_data(sc, WPI_EEPROM_MAC, ic->ic_myaddr, 6);
+ wpi_read_prom_data(sc, WPI_EEPROM_MAC, macaddr, 6);
/* read the list of authorized channels */
for (i = 0; i < WPI_CHAN_BANDS_COUNT; i++)
@@ -2638,7 +2638,7 @@ wpi_scan(struct wpi_softc *sc)
IEEE80211_FC0_SUBTYPE_PROBE_REQ;
wh->i_fc[1] = IEEE80211_FC1_DIR_NODS;
IEEE80211_ADDR_COPY(wh->i_addr1, ifp->if_broadcastaddr);
- IEEE80211_ADDR_COPY(wh->i_addr2, ic->ic_myaddr);
+ IEEE80211_ADDR_COPY(wh->i_addr2, IF_LLADDR(ifp));
IEEE80211_ADDR_COPY(wh->i_addr3, ifp->if_broadcastaddr);
*(u_int16_t *)&wh->i_dur[0] = 0; /* filled by h/w */
*(u_int16_t *)&wh->i_seq[0] = 0; /* filled by h/w */
@@ -2810,7 +2810,7 @@ wpi_config(struct wpi_softc *sc)
/* configure adapter */
memset(&sc->config, 0, sizeof (struct wpi_config));
- IEEE80211_ADDR_COPY(sc->config.myaddr, ic->ic_myaddr);
+ IEEE80211_ADDR_COPY(sc->config.myaddr, IF_LLADDR(ifp));
/*set default channel*/
sc->config.chan = htole16(ieee80211_chan2ieee(ic, ic->ic_curchan));
sc->config.flags = htole32(WPI_CONFIG_TSF);
OpenPOWER on IntegriCloud