diff options
author | Luis R. Rodriguez <lrodriguez@atheros.com> | 2009-09-10 13:51:33 -0400 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2009-10-07 16:39:26 -0400 |
commit | 954fecea5d1df4d1dc7bf9a822a2fad308e8588e (patch) | |
tree | 73f5cbc16292f0a85f3672af701e83bba74dbb77 | |
parent | 8c727e70860dab0cf34a68591cd3f2043a9b9757 (diff) |
ath5k: use common curbssid, bssidmask and macaddr
The ah_sta_id was really being used as the macaddr.
ath5k still does not use the association ID now passed
up by mac80211, that can be fixed later.
Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
-rw-r--r-- | drivers/net/wireless/ath/ath5k/ath5k.h | 9 | ||||
-rw-r--r-- | drivers/net/wireless/ath/ath5k/attach.c | 7 | ||||
-rw-r--r-- | drivers/net/wireless/ath/ath5k/base.c | 8 | ||||
-rw-r--r-- | drivers/net/wireless/ath/ath5k/pcu.c | 38 | ||||
-rw-r--r-- | drivers/net/wireless/ath/ath5k/reset.c | 13 |
5 files changed, 28 insertions, 47 deletions
diff --git a/drivers/net/wireless/ath/ath5k/ath5k.h b/drivers/net/wireless/ath/ath5k/ath5k.h index 93a9c1f93f69..f46a92e78b32 100644 --- a/drivers/net/wireless/ath/ath5k/ath5k.h +++ b/drivers/net/wireless/ath/ath5k/ath5k.h | |||
@@ -1060,14 +1060,6 @@ struct ath5k_hw { | |||
1060 | u8 ah_def_ant; | 1060 | u8 ah_def_ant; |
1061 | bool ah_software_retry; | 1061 | bool ah_software_retry; |
1062 | 1062 | ||
1063 | u8 ah_sta_id[ETH_ALEN]; | ||
1064 | |||
1065 | /* Current BSSID we are trying to assoc to / create. | ||
1066 | * This is passed by mac80211 on config_interface() and cached here for | ||
1067 | * use in resets */ | ||
1068 | u8 ah_bssid[ETH_ALEN]; | ||
1069 | u8 ah_bssid_mask[ETH_ALEN]; | ||
1070 | |||
1071 | int ah_gpio_npins; | 1063 | int ah_gpio_npins; |
1072 | 1064 | ||
1073 | struct ath5k_capabilities ah_capabilities; | 1065 | struct ath5k_capabilities ah_capabilities; |
@@ -1196,7 +1188,6 @@ extern bool ath5k_eeprom_is_hb63(struct ath5k_hw *ah); | |||
1196 | /* Protocol Control Unit Functions */ | 1188 | /* Protocol Control Unit Functions */ |
1197 | extern int ath5k_hw_set_opmode(struct ath5k_hw *ah); | 1189 | extern int ath5k_hw_set_opmode(struct ath5k_hw *ah); |
1198 | /* BSSID Functions */ | 1190 | /* BSSID Functions */ |
1199 | extern void ath5k_hw_get_lladdr(struct ath5k_hw *ah, u8 *mac); | ||
1200 | extern int ath5k_hw_set_lladdr(struct ath5k_hw *ah, const u8 *mac); | 1191 | extern int ath5k_hw_set_lladdr(struct ath5k_hw *ah, const u8 *mac); |
1201 | extern void ath5k_hw_set_associd(struct ath5k_hw *ah, const u8 *bssid, u16 assoc_id); | 1192 | extern void ath5k_hw_set_associd(struct ath5k_hw *ah, const u8 *bssid, u16 assoc_id); |
1202 | extern int ath5k_hw_set_bssid_mask(struct ath5k_hw *ah, const u8 *mask); | 1193 | extern int ath5k_hw_set_bssid_mask(struct ath5k_hw *ah, const u8 *mask); |
diff --git a/drivers/net/wireless/ath/ath5k/attach.c b/drivers/net/wireless/ath/ath5k/attach.c index 9a009a78a046..2d262c7d9061 100644 --- a/drivers/net/wireless/ath/ath5k/attach.c +++ b/drivers/net/wireless/ath/ath5k/attach.c | |||
@@ -104,6 +104,7 @@ static int ath5k_hw_post(struct ath5k_hw *ah) | |||
104 | struct ath5k_hw *ath5k_hw_attach(struct ath5k_softc *sc) | 104 | struct ath5k_hw *ath5k_hw_attach(struct ath5k_softc *sc) |
105 | { | 105 | { |
106 | struct ath5k_hw *ah; | 106 | struct ath5k_hw *ah; |
107 | struct ath_common *common; | ||
107 | struct pci_dev *pdev = sc->pdev; | 108 | struct pci_dev *pdev = sc->pdev; |
108 | struct ath5k_eeprom_info *ee; | 109 | struct ath5k_eeprom_info *ee; |
109 | int ret; | 110 | int ret; |
@@ -118,7 +119,9 @@ struct ath5k_hw *ath5k_hw_attach(struct ath5k_softc *sc) | |||
118 | } | 119 | } |
119 | 120 | ||
120 | ah->ah_sc = sc; | 121 | ah->ah_sc = sc; |
122 | ah->ah_sc->ah = ah; | ||
121 | ah->ah_iobase = sc->iobase; | 123 | ah->ah_iobase = sc->iobase; |
124 | common = ath5k_hw_common(ah); | ||
122 | 125 | ||
123 | /* | 126 | /* |
124 | * HW information | 127 | * HW information |
@@ -336,8 +339,8 @@ struct ath5k_hw *ath5k_hw_attach(struct ath5k_softc *sc) | |||
336 | ath5k_hw_set_lladdr(ah, (u8[ETH_ALEN]){}); | 339 | ath5k_hw_set_lladdr(ah, (u8[ETH_ALEN]){}); |
337 | 340 | ||
338 | /* Set BSSID to bcast address: ff:ff:ff:ff:ff:ff for now */ | 341 | /* Set BSSID to bcast address: ff:ff:ff:ff:ff:ff for now */ |
339 | memcpy(ah->ah_bssid, ath_bcast_mac, ETH_ALEN); | 342 | memcpy(common->curbssid, ath_bcast_mac, ETH_ALEN); |
340 | ath5k_hw_set_associd(ah, ah->ah_bssid, 0); | 343 | ath5k_hw_set_associd(ah, common->curbssid, 0); |
341 | ath5k_hw_set_opmode(ah); | 344 | ath5k_hw_set_opmode(ah); |
342 | 345 | ||
343 | ath5k_hw_rfgain_opt_init(ah); | 346 | ath5k_hw_rfgain_opt_init(ah); |
diff --git a/drivers/net/wireless/ath/ath5k/base.c b/drivers/net/wireless/ath/ath5k/base.c index a28d79555dfc..efee68c8b1ab 100644 --- a/drivers/net/wireless/ath/ath5k/base.c +++ b/drivers/net/wireless/ath/ath5k/base.c | |||
@@ -1685,13 +1685,14 @@ static void | |||
1685 | ath5k_check_ibss_tsf(struct ath5k_softc *sc, struct sk_buff *skb, | 1685 | ath5k_check_ibss_tsf(struct ath5k_softc *sc, struct sk_buff *skb, |
1686 | struct ieee80211_rx_status *rxs) | 1686 | struct ieee80211_rx_status *rxs) |
1687 | { | 1687 | { |
1688 | struct ath_common *common = ath5k_hw_common(sc->ah); | ||
1688 | u64 tsf, bc_tstamp; | 1689 | u64 tsf, bc_tstamp; |
1689 | u32 hw_tu; | 1690 | u32 hw_tu; |
1690 | struct ieee80211_mgmt *mgmt = (struct ieee80211_mgmt *)skb->data; | 1691 | struct ieee80211_mgmt *mgmt = (struct ieee80211_mgmt *)skb->data; |
1691 | 1692 | ||
1692 | if (ieee80211_is_beacon(mgmt->frame_control) && | 1693 | if (ieee80211_is_beacon(mgmt->frame_control) && |
1693 | le16_to_cpu(mgmt->u.beacon.capab_info) & WLAN_CAPABILITY_IBSS && | 1694 | le16_to_cpu(mgmt->u.beacon.capab_info) & WLAN_CAPABILITY_IBSS && |
1694 | memcmp(mgmt->bssid, sc->ah->ah_bssid, ETH_ALEN) == 0) { | 1695 | memcmp(mgmt->bssid, common->curbssid, ETH_ALEN) == 0) { |
1695 | /* | 1696 | /* |
1696 | * Received an IBSS beacon with the same BSSID. Hardware *must* | 1697 | * Received an IBSS beacon with the same BSSID. Hardware *must* |
1697 | * have updated the local TSF. We have to work around various | 1698 | * have updated the local TSF. We have to work around various |
@@ -3177,6 +3178,7 @@ static void ath5k_bss_info_changed(struct ieee80211_hw *hw, | |||
3177 | { | 3178 | { |
3178 | struct ath5k_softc *sc = hw->priv; | 3179 | struct ath5k_softc *sc = hw->priv; |
3179 | struct ath5k_hw *ah = sc->ah; | 3180 | struct ath5k_hw *ah = sc->ah; |
3181 | struct ath_common *common = ath5k_hw_common(ah); | ||
3180 | unsigned long flags; | 3182 | unsigned long flags; |
3181 | 3183 | ||
3182 | mutex_lock(&sc->lock); | 3184 | mutex_lock(&sc->lock); |
@@ -3185,10 +3187,10 @@ static void ath5k_bss_info_changed(struct ieee80211_hw *hw, | |||
3185 | 3187 | ||
3186 | if (changes & BSS_CHANGED_BSSID) { | 3188 | if (changes & BSS_CHANGED_BSSID) { |
3187 | /* Cache for later use during resets */ | 3189 | /* Cache for later use during resets */ |
3188 | memcpy(ah->ah_bssid, bss_conf->bssid, ETH_ALEN); | 3190 | memcpy(common->curbssid, bss_conf->bssid, ETH_ALEN); |
3189 | /* XXX: assoc id is set to 0 for now, mac80211 doesn't have | 3191 | /* XXX: assoc id is set to 0 for now, mac80211 doesn't have |
3190 | * a clean way of letting us retrieve this yet. */ | 3192 | * a clean way of letting us retrieve this yet. */ |
3191 | ath5k_hw_set_associd(ah, ah->ah_bssid, 0); | 3193 | ath5k_hw_set_associd(ah, common->curbssid, 0); |
3192 | mmiowb(); | 3194 | mmiowb(); |
3193 | } | 3195 | } |
3194 | 3196 | ||
diff --git a/drivers/net/wireless/ath/ath5k/pcu.c b/drivers/net/wireless/ath/ath5k/pcu.c index 7bbcfe4fe34b..f03c06d583e6 100644 --- a/drivers/net/wireless/ath/ath5k/pcu.c +++ b/drivers/net/wireless/ath/ath5k/pcu.c | |||
@@ -46,6 +46,7 @@ | |||
46 | */ | 46 | */ |
47 | int ath5k_hw_set_opmode(struct ath5k_hw *ah) | 47 | int ath5k_hw_set_opmode(struct ath5k_hw *ah) |
48 | { | 48 | { |
49 | struct ath_common *common = ath5k_hw_common(ah); | ||
49 | u32 pcu_reg, beacon_reg, low_id, high_id; | 50 | u32 pcu_reg, beacon_reg, low_id, high_id; |
50 | 51 | ||
51 | 52 | ||
@@ -97,8 +98,8 @@ int ath5k_hw_set_opmode(struct ath5k_hw *ah) | |||
97 | /* | 98 | /* |
98 | * Set PCU registers | 99 | * Set PCU registers |
99 | */ | 100 | */ |
100 | low_id = get_unaligned_le32(ah->ah_sta_id); | 101 | low_id = get_unaligned_le32(common->macaddr); |
101 | high_id = get_unaligned_le16(ah->ah_sta_id + 4); | 102 | high_id = get_unaligned_le16(common->macaddr + 4); |
102 | ath5k_hw_reg_write(ah, low_id, AR5K_STA_ID0); | 103 | ath5k_hw_reg_write(ah, low_id, AR5K_STA_ID0); |
103 | ath5k_hw_reg_write(ah, pcu_reg | high_id, AR5K_STA_ID1); | 104 | ath5k_hw_reg_write(ah, pcu_reg | high_id, AR5K_STA_ID1); |
104 | 105 | ||
@@ -240,28 +241,6 @@ int ath5k_hw_set_cts_timeout(struct ath5k_hw *ah, unsigned int timeout) | |||
240 | return 0; | 241 | return 0; |
241 | } | 242 | } |
242 | 243 | ||
243 | |||
244 | /****************\ | ||
245 | * BSSID handling * | ||
246 | \****************/ | ||
247 | |||
248 | /** | ||
249 | * ath5k_hw_get_lladdr - Get station id | ||
250 | * | ||
251 | * @ah: The &struct ath5k_hw | ||
252 | * @mac: The card's mac address | ||
253 | * | ||
254 | * Initialize ah->ah_sta_id using the mac address provided | ||
255 | * (just a memcpy). | ||
256 | * | ||
257 | * TODO: Remove it once we merge ath5k_softc and ath5k_hw | ||
258 | */ | ||
259 | void ath5k_hw_get_lladdr(struct ath5k_hw *ah, u8 *mac) | ||
260 | { | ||
261 | ATH5K_TRACE(ah->ah_sc); | ||
262 | memcpy(mac, ah->ah_sta_id, ETH_ALEN); | ||
263 | } | ||
264 | |||
265 | /** | 244 | /** |
266 | * ath5k_hw_set_lladdr - Set station id | 245 | * ath5k_hw_set_lladdr - Set station id |
267 | * | 246 | * |
@@ -272,12 +251,13 @@ void ath5k_hw_get_lladdr(struct ath5k_hw *ah, u8 *mac) | |||
272 | */ | 251 | */ |
273 | int ath5k_hw_set_lladdr(struct ath5k_hw *ah, const u8 *mac) | 252 | int ath5k_hw_set_lladdr(struct ath5k_hw *ah, const u8 *mac) |
274 | { | 253 | { |
254 | struct ath_common *common = ath5k_hw_common(ah); | ||
275 | u32 low_id, high_id; | 255 | u32 low_id, high_id; |
276 | u32 pcu_reg; | 256 | u32 pcu_reg; |
277 | 257 | ||
278 | ATH5K_TRACE(ah->ah_sc); | 258 | ATH5K_TRACE(ah->ah_sc); |
279 | /* Set new station ID */ | 259 | /* Set new station ID */ |
280 | memcpy(ah->ah_sta_id, mac, ETH_ALEN); | 260 | memcpy(common->macaddr, mac, ETH_ALEN); |
281 | 261 | ||
282 | pcu_reg = ath5k_hw_reg_read(ah, AR5K_STA_ID1) & 0xffff0000; | 262 | pcu_reg = ath5k_hw_reg_read(ah, AR5K_STA_ID1) & 0xffff0000; |
283 | 263 | ||
@@ -301,6 +281,7 @@ int ath5k_hw_set_lladdr(struct ath5k_hw *ah, const u8 *mac) | |||
301 | */ | 281 | */ |
302 | void ath5k_hw_set_associd(struct ath5k_hw *ah, const u8 *bssid, u16 assoc_id) | 282 | void ath5k_hw_set_associd(struct ath5k_hw *ah, const u8 *bssid, u16 assoc_id) |
303 | { | 283 | { |
284 | struct ath_common *common = ath5k_hw_common(ah); | ||
304 | u32 low_id, high_id; | 285 | u32 low_id, high_id; |
305 | u16 tim_offset = 0; | 286 | u16 tim_offset = 0; |
306 | 287 | ||
@@ -308,10 +289,10 @@ void ath5k_hw_set_associd(struct ath5k_hw *ah, const u8 *bssid, u16 assoc_id) | |||
308 | * Set simple BSSID mask on 5212 | 289 | * Set simple BSSID mask on 5212 |
309 | */ | 290 | */ |
310 | if (ah->ah_version == AR5K_AR5212) { | 291 | if (ah->ah_version == AR5K_AR5212) { |
311 | ath5k_hw_reg_write(ah, get_unaligned_le32(ah->ah_bssid_mask), | 292 | ath5k_hw_reg_write(ah, get_unaligned_le32(common->bssidmask), |
312 | AR5K_BSS_IDM0); | 293 | AR5K_BSS_IDM0); |
313 | ath5k_hw_reg_write(ah, | 294 | ath5k_hw_reg_write(ah, |
314 | get_unaligned_le16(ah->ah_bssid_mask + 4), | 295 | get_unaligned_le16(common->curbssid + 4), |
315 | AR5K_BSS_IDM1); | 296 | AR5K_BSS_IDM1); |
316 | } | 297 | } |
317 | 298 | ||
@@ -433,12 +414,13 @@ void ath5k_hw_set_associd(struct ath5k_hw *ah, const u8 *bssid, u16 assoc_id) | |||
433 | */ | 414 | */ |
434 | int ath5k_hw_set_bssid_mask(struct ath5k_hw *ah, const u8 *mask) | 415 | int ath5k_hw_set_bssid_mask(struct ath5k_hw *ah, const u8 *mask) |
435 | { | 416 | { |
417 | struct ath_common *common = ath5k_hw_common(ah); | ||
436 | u32 low_id, high_id; | 418 | u32 low_id, high_id; |
437 | ATH5K_TRACE(ah->ah_sc); | 419 | ATH5K_TRACE(ah->ah_sc); |
438 | 420 | ||
439 | /* Cache bssid mask so that we can restore it | 421 | /* Cache bssid mask so that we can restore it |
440 | * on reset */ | 422 | * on reset */ |
441 | memcpy(ah->ah_bssid_mask, mask, ETH_ALEN); | 423 | memcpy(common->bssidmask, mask, ETH_ALEN); |
442 | if (ah->ah_version == AR5K_AR5212) { | 424 | if (ah->ah_version == AR5K_AR5212) { |
443 | low_id = get_unaligned_le32(mask); | 425 | low_id = get_unaligned_le32(mask); |
444 | high_id = get_unaligned_le16(mask + 4); | 426 | high_id = get_unaligned_le16(mask + 4); |
diff --git a/drivers/net/wireless/ath/ath5k/reset.c b/drivers/net/wireless/ath/ath5k/reset.c index 3454dacc2af8..51aff7652c4b 100644 --- a/drivers/net/wireless/ath/ath5k/reset.c +++ b/drivers/net/wireless/ath/ath5k/reset.c | |||
@@ -872,6 +872,7 @@ static void ath5k_hw_commit_eeprom_settings(struct ath5k_hw *ah, | |||
872 | int ath5k_hw_reset(struct ath5k_hw *ah, enum nl80211_iftype op_mode, | 872 | int ath5k_hw_reset(struct ath5k_hw *ah, enum nl80211_iftype op_mode, |
873 | struct ieee80211_channel *channel, bool change_channel) | 873 | struct ieee80211_channel *channel, bool change_channel) |
874 | { | 874 | { |
875 | struct ath_common *common = ath5k_hw_common(ah); | ||
875 | u32 s_seq[10], s_ant, s_led[3], staid1_flags, tsf_up, tsf_lo; | 876 | u32 s_seq[10], s_ant, s_led[3], staid1_flags, tsf_up, tsf_lo; |
876 | u32 phy_tst1; | 877 | u32 phy_tst1; |
877 | u8 mode, freq, ee_mode, ant[2]; | 878 | u8 mode, freq, ee_mode, ant[2]; |
@@ -1173,10 +1174,12 @@ int ath5k_hw_reset(struct ath5k_hw *ah, enum nl80211_iftype op_mode, | |||
1173 | ath5k_hw_reg_write(ah, s_led[2], AR5K_GPIODO); | 1174 | ath5k_hw_reg_write(ah, s_led[2], AR5K_GPIODO); |
1174 | 1175 | ||
1175 | /* Restore sta_id flags and preserve our mac address*/ | 1176 | /* Restore sta_id flags and preserve our mac address*/ |
1176 | ath5k_hw_reg_write(ah, get_unaligned_le32(ah->ah_sta_id), | 1177 | ath5k_hw_reg_write(ah, |
1177 | AR5K_STA_ID0); | 1178 | get_unaligned_le32(common->macaddr), |
1178 | ath5k_hw_reg_write(ah, staid1_flags | get_unaligned_le16(ah->ah_sta_id), | 1179 | AR5K_STA_ID0); |
1179 | AR5K_STA_ID1); | 1180 | ath5k_hw_reg_write(ah, |
1181 | staid1_flags | get_unaligned_le16(common->macaddr), | ||
1182 | AR5K_STA_ID1); | ||
1180 | 1183 | ||
1181 | 1184 | ||
1182 | /* | 1185 | /* |
@@ -1185,7 +1188,7 @@ int ath5k_hw_reset(struct ath5k_hw *ah, enum nl80211_iftype op_mode, | |||
1185 | 1188 | ||
1186 | /* Restore bssid and bssid mask */ | 1189 | /* Restore bssid and bssid mask */ |
1187 | /* XXX: add ah->aid once mac80211 gives this to us */ | 1190 | /* XXX: add ah->aid once mac80211 gives this to us */ |
1188 | ath5k_hw_set_associd(ah, ah->ah_bssid, 0); | 1191 | ath5k_hw_set_associd(ah, common->curbssid, 0); |
1189 | 1192 | ||
1190 | /* Set PCU config */ | 1193 | /* Set PCU config */ |
1191 | ath5k_hw_set_opmode(ah); | 1194 | ath5k_hw_set_opmode(ah); |