aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBob Copeland <me@bobcopeland.com>2008-11-17 23:40:38 -0500
committerJohn W. Linville <linville@tuxdriver.com>2008-11-26 09:47:35 -0500
commit0e149cf5a1b1900484f4b808d59a5f246cd720be (patch)
tree1392d353012242c9fc313ae67b881a8dccb9040c
parent8f93b8b337763a58fcdf23333ffe752db6c93bae (diff)
ath5k: set mac address in add_interface
Configure the mac address in add_interface and clear it in remove_interface so that users can change the mac address to something other than the one in the eeprom. Also avoid setting it at attach time so that we won't ack packets until fully set up. Signed-off-by: Bob Copeland <me@bobcopeland.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
-rw-r--r--drivers/net/wireless/ath5k/attach.c12
-rw-r--r--drivers/net/wireless/ath5k/base.c13
2 files changed, 14 insertions, 11 deletions
diff --git a/drivers/net/wireless/ath5k/attach.c b/drivers/net/wireless/ath5k/attach.c
index 51d569883cdd..49d82d79d3fc 100644
--- a/drivers/net/wireless/ath5k/attach.c
+++ b/drivers/net/wireless/ath5k/attach.c
@@ -106,7 +106,7 @@ struct ath5k_hw *ath5k_hw_attach(struct ath5k_softc *sc, u8 mac_version)
106{ 106{
107 struct ath5k_hw *ah; 107 struct ath5k_hw *ah;
108 struct pci_dev *pdev = sc->pdev; 108 struct pci_dev *pdev = sc->pdev;
109 u8 mac[ETH_ALEN]; 109 u8 mac[ETH_ALEN] = {};
110 int ret; 110 int ret;
111 u32 srev; 111 u32 srev;
112 112
@@ -317,15 +317,9 @@ struct ath5k_hw *ath5k_hw_attach(struct ath5k_softc *sc, u8 mac_version)
317 goto err_free; 317 goto err_free;
318 } 318 }
319 319
320 /* Set MAC address */ 320 /* MAC address is cleared until add_interface */
321 ret = ath5k_eeprom_read_mac(ah, mac);
322 if (ret) {
323 ATH5K_ERR(sc, "unable to read address from EEPROM: 0x%04x\n",
324 sc->pdev->device);
325 goto err_free;
326 }
327
328 ath5k_hw_set_lladdr(ah, mac); 321 ath5k_hw_set_lladdr(ah, mac);
322
329 /* Set BSSID to bcast address: ff:ff:ff:ff:ff:ff for now */ 323 /* Set BSSID to bcast address: ff:ff:ff:ff:ff:ff for now */
330 memset(ah->ah_bssid, 0xff, ETH_ALEN); 324 memset(ah->ah_bssid, 0xff, ETH_ALEN);
331 ath5k_hw_set_associd(ah, ah->ah_bssid, 0); 325 ath5k_hw_set_associd(ah, ah->ah_bssid, 0);
diff --git a/drivers/net/wireless/ath5k/base.c b/drivers/net/wireless/ath5k/base.c
index 7fdb59c813ca..4bcea5a9d70b 100644
--- a/drivers/net/wireless/ath5k/base.c
+++ b/drivers/net/wireless/ath5k/base.c
@@ -707,7 +707,7 @@ ath5k_attach(struct pci_dev *pdev, struct ieee80211_hw *hw)
707{ 707{
708 struct ath5k_softc *sc = hw->priv; 708 struct ath5k_softc *sc = hw->priv;
709 struct ath5k_hw *ah = sc->ah; 709 struct ath5k_hw *ah = sc->ah;
710 u8 mac[ETH_ALEN]; 710 u8 mac[ETH_ALEN] = {};
711 int ret; 711 int ret;
712 712
713 ATH5K_DBG(sc, ATH5K_DEBUG_ANY, "devid 0x%x\n", pdev->device); 713 ATH5K_DBG(sc, ATH5K_DEBUG_ANY, "devid 0x%x\n", pdev->device);
@@ -777,7 +777,13 @@ ath5k_attach(struct pci_dev *pdev, struct ieee80211_hw *hw)
777 tasklet_init(&sc->restq, ath5k_tasklet_reset, (unsigned long)sc); 777 tasklet_init(&sc->restq, ath5k_tasklet_reset, (unsigned long)sc);
778 setup_timer(&sc->calib_tim, ath5k_calibrate, (unsigned long)sc); 778 setup_timer(&sc->calib_tim, ath5k_calibrate, (unsigned long)sc);
779 779
780 ath5k_hw_get_lladdr(ah, mac); 780 ret = ath5k_eeprom_read_mac(ah, mac);
781 if (ret) {
782 ATH5K_ERR(sc, "unable to read address from EEPROM: 0x%04x\n",
783 sc->pdev->device);
784 goto err_queues;
785 }
786
781 SET_IEEE80211_PERM_ADDR(hw, mac); 787 SET_IEEE80211_PERM_ADDR(hw, mac);
782 /* All MAC address bits matter for ACKs */ 788 /* All MAC address bits matter for ACKs */
783 memset(sc->bssidmask, 0xff, ETH_ALEN); 789 memset(sc->bssidmask, 0xff, ETH_ALEN);
@@ -2765,6 +2771,7 @@ static int ath5k_add_interface(struct ieee80211_hw *hw,
2765 /* Set to a reasonable value. Note that this will 2771 /* Set to a reasonable value. Note that this will
2766 * be set to mac80211's value at ath5k_config(). */ 2772 * be set to mac80211's value at ath5k_config(). */
2767 sc->bintval = 1000; 2773 sc->bintval = 1000;
2774 ath5k_hw_set_lladdr(sc->ah, conf->mac_addr);
2768 2775
2769 ret = 0; 2776 ret = 0;
2770end: 2777end:
@@ -2777,11 +2784,13 @@ ath5k_remove_interface(struct ieee80211_hw *hw,
2777 struct ieee80211_if_init_conf *conf) 2784 struct ieee80211_if_init_conf *conf)
2778{ 2785{
2779 struct ath5k_softc *sc = hw->priv; 2786 struct ath5k_softc *sc = hw->priv;
2787 u8 mac[ETH_ALEN] = {};
2780 2788
2781 mutex_lock(&sc->lock); 2789 mutex_lock(&sc->lock);
2782 if (sc->vif != conf->vif) 2790 if (sc->vif != conf->vif)
2783 goto end; 2791 goto end;
2784 2792
2793 ath5k_hw_set_lladdr(sc->ah, mac);
2785 sc->vif = NULL; 2794 sc->vif = NULL;
2786end: 2795end:
2787 mutex_unlock(&sc->lock); 2796 mutex_unlock(&sc->lock);