diff options
Diffstat (limited to 'drivers/net/wireless/ath/ath5k/mac80211-ops.c')
-rw-r--r-- | drivers/net/wireless/ath/ath5k/mac80211-ops.c | 257 |
1 files changed, 119 insertions, 138 deletions
diff --git a/drivers/net/wireless/ath/ath5k/mac80211-ops.c b/drivers/net/wireless/ath/ath5k/mac80211-ops.c index 0d5ab3428be5..2a715ca0c5e4 100644 --- a/drivers/net/wireless/ath/ath5k/mac80211-ops.c +++ b/drivers/net/wireless/ath/ath5k/mac80211-ops.c | |||
@@ -53,44 +53,30 @@ | |||
53 | static void | 53 | static void |
54 | ath5k_tx(struct ieee80211_hw *hw, struct sk_buff *skb) | 54 | ath5k_tx(struct ieee80211_hw *hw, struct sk_buff *skb) |
55 | { | 55 | { |
56 | struct ath5k_softc *sc = hw->priv; | 56 | struct ath5k_hw *ah = hw->priv; |
57 | u16 qnum = skb_get_queue_mapping(skb); | 57 | u16 qnum = skb_get_queue_mapping(skb); |
58 | 58 | ||
59 | if (WARN_ON(qnum >= sc->ah->ah_capabilities.cap_queues.q_tx_num)) { | 59 | if (WARN_ON(qnum >= ah->ah_capabilities.cap_queues.q_tx_num)) { |
60 | dev_kfree_skb_any(skb); | 60 | dev_kfree_skb_any(skb); |
61 | return; | 61 | return; |
62 | } | 62 | } |
63 | 63 | ||
64 | ath5k_tx_queue(hw, skb, &sc->txqs[qnum]); | 64 | ath5k_tx_queue(hw, skb, &ah->txqs[qnum]); |
65 | } | ||
66 | |||
67 | |||
68 | static int | ||
69 | ath5k_start(struct ieee80211_hw *hw) | ||
70 | { | ||
71 | return ath5k_init_hw(hw->priv); | ||
72 | } | ||
73 | |||
74 | |||
75 | static void | ||
76 | ath5k_stop(struct ieee80211_hw *hw) | ||
77 | { | ||
78 | ath5k_stop_hw(hw->priv); | ||
79 | } | 65 | } |
80 | 66 | ||
81 | 67 | ||
82 | static int | 68 | static int |
83 | ath5k_add_interface(struct ieee80211_hw *hw, struct ieee80211_vif *vif) | 69 | ath5k_add_interface(struct ieee80211_hw *hw, struct ieee80211_vif *vif) |
84 | { | 70 | { |
85 | struct ath5k_softc *sc = hw->priv; | 71 | struct ath5k_hw *ah = hw->priv; |
86 | int ret; | 72 | int ret; |
87 | struct ath5k_vif *avf = (void *)vif->drv_priv; | 73 | struct ath5k_vif *avf = (void *)vif->drv_priv; |
88 | 74 | ||
89 | mutex_lock(&sc->lock); | 75 | mutex_lock(&ah->lock); |
90 | 76 | ||
91 | if ((vif->type == NL80211_IFTYPE_AP || | 77 | if ((vif->type == NL80211_IFTYPE_AP || |
92 | vif->type == NL80211_IFTYPE_ADHOC) | 78 | vif->type == NL80211_IFTYPE_ADHOC) |
93 | && (sc->num_ap_vifs + sc->num_adhoc_vifs) >= ATH_BCBUF) { | 79 | && (ah->num_ap_vifs + ah->num_adhoc_vifs) >= ATH_BCBUF) { |
94 | ret = -ELNRNG; | 80 | ret = -ELNRNG; |
95 | goto end; | 81 | goto end; |
96 | } | 82 | } |
@@ -100,9 +86,9 @@ ath5k_add_interface(struct ieee80211_hw *hw, struct ieee80211_vif *vif) | |||
100 | * We would need to operate the HW in ad-hoc mode to allow TSF updates | 86 | * We would need to operate the HW in ad-hoc mode to allow TSF updates |
101 | * for the IBSS, but this breaks with additional AP or STA interfaces | 87 | * for the IBSS, but this breaks with additional AP or STA interfaces |
102 | * at the moment. */ | 88 | * at the moment. */ |
103 | if (sc->num_adhoc_vifs || | 89 | if (ah->num_adhoc_vifs || |
104 | (sc->nvifs && vif->type == NL80211_IFTYPE_ADHOC)) { | 90 | (ah->nvifs && vif->type == NL80211_IFTYPE_ADHOC)) { |
105 | ATH5K_ERR(sc, "Only one single ad-hoc interface is allowed.\n"); | 91 | ATH5K_ERR(ah, "Only one single ad-hoc interface is allowed.\n"); |
106 | ret = -ELNRNG; | 92 | ret = -ELNRNG; |
107 | goto end; | 93 | goto end; |
108 | } | 94 | } |
@@ -119,8 +105,8 @@ ath5k_add_interface(struct ieee80211_hw *hw, struct ieee80211_vif *vif) | |||
119 | goto end; | 105 | goto end; |
120 | } | 106 | } |
121 | 107 | ||
122 | sc->nvifs++; | 108 | ah->nvifs++; |
123 | ATH5K_DBG(sc, ATH5K_DEBUG_MODE, "add interface mode %d\n", avf->opmode); | 109 | ATH5K_DBG(ah, ATH5K_DEBUG_MODE, "add interface mode %d\n", avf->opmode); |
124 | 110 | ||
125 | /* Assign the vap/adhoc to a beacon xmit slot. */ | 111 | /* Assign the vap/adhoc to a beacon xmit slot. */ |
126 | if ((avf->opmode == NL80211_IFTYPE_AP) || | 112 | if ((avf->opmode == NL80211_IFTYPE_AP) || |
@@ -128,38 +114,38 @@ ath5k_add_interface(struct ieee80211_hw *hw, struct ieee80211_vif *vif) | |||
128 | (avf->opmode == NL80211_IFTYPE_MESH_POINT)) { | 114 | (avf->opmode == NL80211_IFTYPE_MESH_POINT)) { |
129 | int slot; | 115 | int slot; |
130 | 116 | ||
131 | WARN_ON(list_empty(&sc->bcbuf)); | 117 | WARN_ON(list_empty(&ah->bcbuf)); |
132 | avf->bbuf = list_first_entry(&sc->bcbuf, struct ath5k_buf, | 118 | avf->bbuf = list_first_entry(&ah->bcbuf, struct ath5k_buf, |
133 | list); | 119 | list); |
134 | list_del(&avf->bbuf->list); | 120 | list_del(&avf->bbuf->list); |
135 | 121 | ||
136 | avf->bslot = 0; | 122 | avf->bslot = 0; |
137 | for (slot = 0; slot < ATH_BCBUF; slot++) { | 123 | for (slot = 0; slot < ATH_BCBUF; slot++) { |
138 | if (!sc->bslot[slot]) { | 124 | if (!ah->bslot[slot]) { |
139 | avf->bslot = slot; | 125 | avf->bslot = slot; |
140 | break; | 126 | break; |
141 | } | 127 | } |
142 | } | 128 | } |
143 | BUG_ON(sc->bslot[avf->bslot] != NULL); | 129 | BUG_ON(ah->bslot[avf->bslot] != NULL); |
144 | sc->bslot[avf->bslot] = vif; | 130 | ah->bslot[avf->bslot] = vif; |
145 | if (avf->opmode == NL80211_IFTYPE_AP) | 131 | if (avf->opmode == NL80211_IFTYPE_AP) |
146 | sc->num_ap_vifs++; | 132 | ah->num_ap_vifs++; |
147 | else if (avf->opmode == NL80211_IFTYPE_ADHOC) | 133 | else if (avf->opmode == NL80211_IFTYPE_ADHOC) |
148 | sc->num_adhoc_vifs++; | 134 | ah->num_adhoc_vifs++; |
149 | } | 135 | } |
150 | 136 | ||
151 | /* Any MAC address is fine, all others are included through the | 137 | /* Any MAC address is fine, all others are included through the |
152 | * filter. | 138 | * filter. |
153 | */ | 139 | */ |
154 | memcpy(&sc->lladdr, vif->addr, ETH_ALEN); | 140 | memcpy(&ah->lladdr, vif->addr, ETH_ALEN); |
155 | ath5k_hw_set_lladdr(sc->ah, vif->addr); | 141 | ath5k_hw_set_lladdr(ah, vif->addr); |
156 | 142 | ||
157 | memcpy(&avf->lladdr, vif->addr, ETH_ALEN); | 143 | memcpy(&avf->lladdr, vif->addr, ETH_ALEN); |
158 | 144 | ||
159 | ath5k_update_bssid_mask_and_opmode(sc, vif); | 145 | ath5k_update_bssid_mask_and_opmode(ah, vif); |
160 | ret = 0; | 146 | ret = 0; |
161 | end: | 147 | end: |
162 | mutex_unlock(&sc->lock); | 148 | mutex_unlock(&ah->lock); |
163 | return ret; | 149 | return ret; |
164 | } | 150 | } |
165 | 151 | ||
@@ -168,31 +154,31 @@ static void | |||
168 | ath5k_remove_interface(struct ieee80211_hw *hw, | 154 | ath5k_remove_interface(struct ieee80211_hw *hw, |
169 | struct ieee80211_vif *vif) | 155 | struct ieee80211_vif *vif) |
170 | { | 156 | { |
171 | struct ath5k_softc *sc = hw->priv; | 157 | struct ath5k_hw *ah = hw->priv; |
172 | struct ath5k_vif *avf = (void *)vif->drv_priv; | 158 | struct ath5k_vif *avf = (void *)vif->drv_priv; |
173 | unsigned int i; | 159 | unsigned int i; |
174 | 160 | ||
175 | mutex_lock(&sc->lock); | 161 | mutex_lock(&ah->lock); |
176 | sc->nvifs--; | 162 | ah->nvifs--; |
177 | 163 | ||
178 | if (avf->bbuf) { | 164 | if (avf->bbuf) { |
179 | ath5k_txbuf_free_skb(sc, avf->bbuf); | 165 | ath5k_txbuf_free_skb(ah, avf->bbuf); |
180 | list_add_tail(&avf->bbuf->list, &sc->bcbuf); | 166 | list_add_tail(&avf->bbuf->list, &ah->bcbuf); |
181 | for (i = 0; i < ATH_BCBUF; i++) { | 167 | for (i = 0; i < ATH_BCBUF; i++) { |
182 | if (sc->bslot[i] == vif) { | 168 | if (ah->bslot[i] == vif) { |
183 | sc->bslot[i] = NULL; | 169 | ah->bslot[i] = NULL; |
184 | break; | 170 | break; |
185 | } | 171 | } |
186 | } | 172 | } |
187 | avf->bbuf = NULL; | 173 | avf->bbuf = NULL; |
188 | } | 174 | } |
189 | if (avf->opmode == NL80211_IFTYPE_AP) | 175 | if (avf->opmode == NL80211_IFTYPE_AP) |
190 | sc->num_ap_vifs--; | 176 | ah->num_ap_vifs--; |
191 | else if (avf->opmode == NL80211_IFTYPE_ADHOC) | 177 | else if (avf->opmode == NL80211_IFTYPE_ADHOC) |
192 | sc->num_adhoc_vifs--; | 178 | ah->num_adhoc_vifs--; |
193 | 179 | ||
194 | ath5k_update_bssid_mask_and_opmode(sc, NULL); | 180 | ath5k_update_bssid_mask_and_opmode(ah, NULL); |
195 | mutex_unlock(&sc->lock); | 181 | mutex_unlock(&ah->lock); |
196 | } | 182 | } |
197 | 183 | ||
198 | 184 | ||
@@ -202,23 +188,22 @@ ath5k_remove_interface(struct ieee80211_hw *hw, | |||
202 | static int | 188 | static int |
203 | ath5k_config(struct ieee80211_hw *hw, u32 changed) | 189 | ath5k_config(struct ieee80211_hw *hw, u32 changed) |
204 | { | 190 | { |
205 | struct ath5k_softc *sc = hw->priv; | 191 | struct ath5k_hw *ah = hw->priv; |
206 | struct ath5k_hw *ah = sc->ah; | ||
207 | struct ieee80211_conf *conf = &hw->conf; | 192 | struct ieee80211_conf *conf = &hw->conf; |
208 | int ret = 0; | 193 | int ret = 0; |
209 | int i; | 194 | int i; |
210 | 195 | ||
211 | mutex_lock(&sc->lock); | 196 | mutex_lock(&ah->lock); |
212 | 197 | ||
213 | if (changed & IEEE80211_CONF_CHANGE_CHANNEL) { | 198 | if (changed & IEEE80211_CONF_CHANGE_CHANNEL) { |
214 | ret = ath5k_chan_set(sc, conf->channel); | 199 | ret = ath5k_chan_set(ah, conf->channel); |
215 | if (ret < 0) | 200 | if (ret < 0) |
216 | goto unlock; | 201 | goto unlock; |
217 | } | 202 | } |
218 | 203 | ||
219 | if ((changed & IEEE80211_CONF_CHANGE_POWER) && | 204 | if ((changed & IEEE80211_CONF_CHANGE_POWER) && |
220 | (sc->power_level != conf->power_level)) { | 205 | (ah->power_level != conf->power_level)) { |
221 | sc->power_level = conf->power_level; | 206 | ah->power_level = conf->power_level; |
222 | 207 | ||
223 | /* Half dB steps */ | 208 | /* Half dB steps */ |
224 | ath5k_hw_set_txpower_limit(ah, (conf->power_level * 2)); | 209 | ath5k_hw_set_txpower_limit(ah, (conf->power_level * 2)); |
@@ -252,7 +237,7 @@ ath5k_config(struct ieee80211_hw *hw, u32 changed) | |||
252 | ath5k_hw_set_antenna_mode(ah, ah->ah_ant_mode); | 237 | ath5k_hw_set_antenna_mode(ah, ah->ah_ant_mode); |
253 | 238 | ||
254 | unlock: | 239 | unlock: |
255 | mutex_unlock(&sc->lock); | 240 | mutex_unlock(&ah->lock); |
256 | return ret; | 241 | return ret; |
257 | } | 242 | } |
258 | 243 | ||
@@ -262,12 +247,11 @@ ath5k_bss_info_changed(struct ieee80211_hw *hw, struct ieee80211_vif *vif, | |||
262 | struct ieee80211_bss_conf *bss_conf, u32 changes) | 247 | struct ieee80211_bss_conf *bss_conf, u32 changes) |
263 | { | 248 | { |
264 | struct ath5k_vif *avf = (void *)vif->drv_priv; | 249 | struct ath5k_vif *avf = (void *)vif->drv_priv; |
265 | struct ath5k_softc *sc = hw->priv; | 250 | struct ath5k_hw *ah = hw->priv; |
266 | struct ath5k_hw *ah = sc->ah; | ||
267 | struct ath_common *common = ath5k_hw_common(ah); | 251 | struct ath_common *common = ath5k_hw_common(ah); |
268 | unsigned long flags; | 252 | unsigned long flags; |
269 | 253 | ||
270 | mutex_lock(&sc->lock); | 254 | mutex_lock(&ah->lock); |
271 | 255 | ||
272 | if (changes & BSS_CHANGED_BSSID) { | 256 | if (changes & BSS_CHANGED_BSSID) { |
273 | /* Cache for later use during resets */ | 257 | /* Cache for later use during resets */ |
@@ -278,7 +262,7 @@ ath5k_bss_info_changed(struct ieee80211_hw *hw, struct ieee80211_vif *vif, | |||
278 | } | 262 | } |
279 | 263 | ||
280 | if (changes & BSS_CHANGED_BEACON_INT) | 264 | if (changes & BSS_CHANGED_BEACON_INT) |
281 | sc->bintval = bss_conf->beacon_int; | 265 | ah->bintval = bss_conf->beacon_int; |
282 | 266 | ||
283 | if (changes & BSS_CHANGED_ERP_SLOT) { | 267 | if (changes & BSS_CHANGED_ERP_SLOT) { |
284 | int slot_time; | 268 | int slot_time; |
@@ -292,16 +276,16 @@ ath5k_bss_info_changed(struct ieee80211_hw *hw, struct ieee80211_vif *vif, | |||
292 | if (changes & BSS_CHANGED_ASSOC) { | 276 | if (changes & BSS_CHANGED_ASSOC) { |
293 | avf->assoc = bss_conf->assoc; | 277 | avf->assoc = bss_conf->assoc; |
294 | if (bss_conf->assoc) | 278 | if (bss_conf->assoc) |
295 | sc->assoc = bss_conf->assoc; | 279 | ah->assoc = bss_conf->assoc; |
296 | else | 280 | else |
297 | sc->assoc = ath5k_any_vif_assoc(sc); | 281 | ah->assoc = ath5k_any_vif_assoc(ah); |
298 | 282 | ||
299 | if (sc->opmode == NL80211_IFTYPE_STATION) | 283 | if (ah->opmode == NL80211_IFTYPE_STATION) |
300 | ath5k_set_beacon_filter(hw, sc->assoc); | 284 | ath5k_set_beacon_filter(hw, ah->assoc); |
301 | ath5k_hw_set_ledstate(sc->ah, sc->assoc ? | 285 | ath5k_hw_set_ledstate(ah, ah->assoc ? |
302 | AR5K_LED_ASSOC : AR5K_LED_INIT); | 286 | AR5K_LED_ASSOC : AR5K_LED_INIT); |
303 | if (bss_conf->assoc) { | 287 | if (bss_conf->assoc) { |
304 | ATH5K_DBG(sc, ATH5K_DEBUG_ANY, | 288 | ATH5K_DBG(ah, ATH5K_DEBUG_ANY, |
305 | "Bss Info ASSOC %d, bssid: %pM\n", | 289 | "Bss Info ASSOC %d, bssid: %pM\n", |
306 | bss_conf->aid, common->curbssid); | 290 | bss_conf->aid, common->curbssid); |
307 | common->curaid = bss_conf->aid; | 291 | common->curaid = bss_conf->aid; |
@@ -311,19 +295,19 @@ ath5k_bss_info_changed(struct ieee80211_hw *hw, struct ieee80211_vif *vif, | |||
311 | } | 295 | } |
312 | 296 | ||
313 | if (changes & BSS_CHANGED_BEACON) { | 297 | if (changes & BSS_CHANGED_BEACON) { |
314 | spin_lock_irqsave(&sc->block, flags); | 298 | spin_lock_irqsave(&ah->block, flags); |
315 | ath5k_beacon_update(hw, vif); | 299 | ath5k_beacon_update(hw, vif); |
316 | spin_unlock_irqrestore(&sc->block, flags); | 300 | spin_unlock_irqrestore(&ah->block, flags); |
317 | } | 301 | } |
318 | 302 | ||
319 | if (changes & BSS_CHANGED_BEACON_ENABLED) | 303 | if (changes & BSS_CHANGED_BEACON_ENABLED) |
320 | sc->enable_beacon = bss_conf->enable_beacon; | 304 | ah->enable_beacon = bss_conf->enable_beacon; |
321 | 305 | ||
322 | if (changes & (BSS_CHANGED_BEACON | BSS_CHANGED_BEACON_ENABLED | | 306 | if (changes & (BSS_CHANGED_BEACON | BSS_CHANGED_BEACON_ENABLED | |
323 | BSS_CHANGED_BEACON_INT)) | 307 | BSS_CHANGED_BEACON_INT)) |
324 | ath5k_beacon_config(sc); | 308 | ath5k_beacon_config(ah); |
325 | 309 | ||
326 | mutex_unlock(&sc->lock); | 310 | mutex_unlock(&ah->lock); |
327 | } | 311 | } |
328 | 312 | ||
329 | 313 | ||
@@ -384,12 +368,11 @@ ath5k_configure_filter(struct ieee80211_hw *hw, unsigned int changed_flags, | |||
384 | FIF_PLCPFAIL | FIF_CONTROL | FIF_OTHER_BSS | \ | 368 | FIF_PLCPFAIL | FIF_CONTROL | FIF_OTHER_BSS | \ |
385 | FIF_BCN_PRBRESP_PROMISC) | 369 | FIF_BCN_PRBRESP_PROMISC) |
386 | 370 | ||
387 | struct ath5k_softc *sc = hw->priv; | 371 | struct ath5k_hw *ah = hw->priv; |
388 | struct ath5k_hw *ah = sc->ah; | ||
389 | u32 mfilt[2], rfilt; | 372 | u32 mfilt[2], rfilt; |
390 | struct ath5k_vif_iter_data iter_data; /* to count STA interfaces */ | 373 | struct ath5k_vif_iter_data iter_data; /* to count STA interfaces */ |
391 | 374 | ||
392 | mutex_lock(&sc->lock); | 375 | mutex_lock(&ah->lock); |
393 | 376 | ||
394 | mfilt[0] = multicast; | 377 | mfilt[0] = multicast; |
395 | mfilt[1] = multicast >> 32; | 378 | mfilt[1] = multicast >> 32; |
@@ -407,12 +390,12 @@ ath5k_configure_filter(struct ieee80211_hw *hw, unsigned int changed_flags, | |||
407 | 390 | ||
408 | if (changed_flags & (FIF_PROMISC_IN_BSS | FIF_OTHER_BSS)) { | 391 | if (changed_flags & (FIF_PROMISC_IN_BSS | FIF_OTHER_BSS)) { |
409 | if (*new_flags & FIF_PROMISC_IN_BSS) | 392 | if (*new_flags & FIF_PROMISC_IN_BSS) |
410 | __set_bit(ATH_STAT_PROMISC, sc->status); | 393 | __set_bit(ATH_STAT_PROMISC, ah->status); |
411 | else | 394 | else |
412 | __clear_bit(ATH_STAT_PROMISC, sc->status); | 395 | __clear_bit(ATH_STAT_PROMISC, ah->status); |
413 | } | 396 | } |
414 | 397 | ||
415 | if (test_bit(ATH_STAT_PROMISC, sc->status)) | 398 | if (test_bit(ATH_STAT_PROMISC, ah->status)) |
416 | rfilt |= AR5K_RX_FILTER_PROM; | 399 | rfilt |= AR5K_RX_FILTER_PROM; |
417 | 400 | ||
418 | /* Note, AR5K_RX_FILTER_MCAST is already enabled */ | 401 | /* Note, AR5K_RX_FILTER_MCAST is already enabled */ |
@@ -427,7 +410,7 @@ ath5k_configure_filter(struct ieee80211_hw *hw, unsigned int changed_flags, | |||
427 | 410 | ||
428 | /* FIF_BCN_PRBRESP_PROMISC really means to enable beacons | 411 | /* FIF_BCN_PRBRESP_PROMISC really means to enable beacons |
429 | * and probes for any BSSID */ | 412 | * and probes for any BSSID */ |
430 | if ((*new_flags & FIF_BCN_PRBRESP_PROMISC) || (sc->nvifs > 1)) | 413 | if ((*new_flags & FIF_BCN_PRBRESP_PROMISC) || (ah->nvifs > 1)) |
431 | rfilt |= AR5K_RX_FILTER_BEACON; | 414 | rfilt |= AR5K_RX_FILTER_BEACON; |
432 | 415 | ||
433 | /* FIF_CONTROL doc says that if FIF_PROMISC_IN_BSS is not | 416 | /* FIF_CONTROL doc says that if FIF_PROMISC_IN_BSS is not |
@@ -442,7 +425,7 @@ ath5k_configure_filter(struct ieee80211_hw *hw, unsigned int changed_flags, | |||
442 | 425 | ||
443 | /* XXX move these to mac80211, and add a beacon IFF flag to mac80211 */ | 426 | /* XXX move these to mac80211, and add a beacon IFF flag to mac80211 */ |
444 | 427 | ||
445 | switch (sc->opmode) { | 428 | switch (ah->opmode) { |
446 | case NL80211_IFTYPE_MESH_POINT: | 429 | case NL80211_IFTYPE_MESH_POINT: |
447 | rfilt |= AR5K_RX_FILTER_CONTROL | | 430 | rfilt |= AR5K_RX_FILTER_CONTROL | |
448 | AR5K_RX_FILTER_BEACON | | 431 | AR5K_RX_FILTER_BEACON | |
@@ -455,7 +438,7 @@ ath5k_configure_filter(struct ieee80211_hw *hw, unsigned int changed_flags, | |||
455 | AR5K_RX_FILTER_BEACON; | 438 | AR5K_RX_FILTER_BEACON; |
456 | break; | 439 | break; |
457 | case NL80211_IFTYPE_STATION: | 440 | case NL80211_IFTYPE_STATION: |
458 | if (sc->assoc) | 441 | if (ah->assoc) |
459 | rfilt |= AR5K_RX_FILTER_BEACON; | 442 | rfilt |= AR5K_RX_FILTER_BEACON; |
460 | default: | 443 | default: |
461 | break; | 444 | break; |
@@ -464,7 +447,7 @@ ath5k_configure_filter(struct ieee80211_hw *hw, unsigned int changed_flags, | |||
464 | iter_data.hw_macaddr = NULL; | 447 | iter_data.hw_macaddr = NULL; |
465 | iter_data.n_stas = 0; | 448 | iter_data.n_stas = 0; |
466 | iter_data.need_set_hw_addr = false; | 449 | iter_data.need_set_hw_addr = false; |
467 | ieee80211_iterate_active_interfaces_atomic(sc->hw, ath5k_vif_iter, | 450 | ieee80211_iterate_active_interfaces_atomic(ah->hw, ath5k_vif_iter, |
468 | &iter_data); | 451 | &iter_data); |
469 | 452 | ||
470 | /* Set up RX Filter */ | 453 | /* Set up RX Filter */ |
@@ -483,9 +466,9 @@ ath5k_configure_filter(struct ieee80211_hw *hw, unsigned int changed_flags, | |||
483 | ath5k_hw_set_mcast_filter(ah, mfilt[0], mfilt[1]); | 466 | ath5k_hw_set_mcast_filter(ah, mfilt[0], mfilt[1]); |
484 | /* Set the cached hw filter flags, this will later actually | 467 | /* Set the cached hw filter flags, this will later actually |
485 | * be set in HW */ | 468 | * be set in HW */ |
486 | sc->filter_flags = rfilt; | 469 | ah->filter_flags = rfilt; |
487 | 470 | ||
488 | mutex_unlock(&sc->lock); | 471 | mutex_unlock(&ah->lock); |
489 | } | 472 | } |
490 | 473 | ||
491 | 474 | ||
@@ -494,8 +477,7 @@ ath5k_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd, | |||
494 | struct ieee80211_vif *vif, struct ieee80211_sta *sta, | 477 | struct ieee80211_vif *vif, struct ieee80211_sta *sta, |
495 | struct ieee80211_key_conf *key) | 478 | struct ieee80211_key_conf *key) |
496 | { | 479 | { |
497 | struct ath5k_softc *sc = hw->priv; | 480 | struct ath5k_hw *ah = hw->priv; |
498 | struct ath5k_hw *ah = sc->ah; | ||
499 | struct ath_common *common = ath5k_hw_common(ah); | 481 | struct ath_common *common = ath5k_hw_common(ah); |
500 | int ret = 0; | 482 | int ret = 0; |
501 | 483 | ||
@@ -516,7 +498,7 @@ ath5k_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd, | |||
516 | return -EINVAL; | 498 | return -EINVAL; |
517 | } | 499 | } |
518 | 500 | ||
519 | mutex_lock(&sc->lock); | 501 | mutex_lock(&ah->lock); |
520 | 502 | ||
521 | switch (cmd) { | 503 | switch (cmd) { |
522 | case SET_KEY: | 504 | case SET_KEY: |
@@ -540,7 +522,7 @@ ath5k_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd, | |||
540 | } | 522 | } |
541 | 523 | ||
542 | mmiowb(); | 524 | mmiowb(); |
543 | mutex_unlock(&sc->lock); | 525 | mutex_unlock(&ah->lock); |
544 | return ret; | 526 | return ret; |
545 | } | 527 | } |
546 | 528 | ||
@@ -548,17 +530,17 @@ ath5k_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd, | |||
548 | static void | 530 | static void |
549 | ath5k_sw_scan_start(struct ieee80211_hw *hw) | 531 | ath5k_sw_scan_start(struct ieee80211_hw *hw) |
550 | { | 532 | { |
551 | struct ath5k_softc *sc = hw->priv; | 533 | struct ath5k_hw *ah = hw->priv; |
552 | if (!sc->assoc) | 534 | if (!ah->assoc) |
553 | ath5k_hw_set_ledstate(sc->ah, AR5K_LED_SCAN); | 535 | ath5k_hw_set_ledstate(ah, AR5K_LED_SCAN); |
554 | } | 536 | } |
555 | 537 | ||
556 | 538 | ||
557 | static void | 539 | static void |
558 | ath5k_sw_scan_complete(struct ieee80211_hw *hw) | 540 | ath5k_sw_scan_complete(struct ieee80211_hw *hw) |
559 | { | 541 | { |
560 | struct ath5k_softc *sc = hw->priv; | 542 | struct ath5k_hw *ah = hw->priv; |
561 | ath5k_hw_set_ledstate(sc->ah, sc->assoc ? | 543 | ath5k_hw_set_ledstate(ah, ah->assoc ? |
562 | AR5K_LED_ASSOC : AR5K_LED_INIT); | 544 | AR5K_LED_ASSOC : AR5K_LED_INIT); |
563 | } | 545 | } |
564 | 546 | ||
@@ -567,15 +549,15 @@ static int | |||
567 | ath5k_get_stats(struct ieee80211_hw *hw, | 549 | ath5k_get_stats(struct ieee80211_hw *hw, |
568 | struct ieee80211_low_level_stats *stats) | 550 | struct ieee80211_low_level_stats *stats) |
569 | { | 551 | { |
570 | struct ath5k_softc *sc = hw->priv; | 552 | struct ath5k_hw *ah = hw->priv; |
571 | 553 | ||
572 | /* Force update */ | 554 | /* Force update */ |
573 | ath5k_hw_update_mib_counters(sc->ah); | 555 | ath5k_hw_update_mib_counters(ah); |
574 | 556 | ||
575 | stats->dot11ACKFailureCount = sc->stats.ack_fail; | 557 | stats->dot11ACKFailureCount = ah->stats.ack_fail; |
576 | stats->dot11RTSFailureCount = sc->stats.rts_fail; | 558 | stats->dot11RTSFailureCount = ah->stats.rts_fail; |
577 | stats->dot11RTSSuccessCount = sc->stats.rts_ok; | 559 | stats->dot11RTSSuccessCount = ah->stats.rts_ok; |
578 | stats->dot11FCSErrorCount = sc->stats.fcs_error; | 560 | stats->dot11FCSErrorCount = ah->stats.fcs_error; |
579 | 561 | ||
580 | return 0; | 562 | return 0; |
581 | } | 563 | } |
@@ -585,15 +567,14 @@ static int | |||
585 | ath5k_conf_tx(struct ieee80211_hw *hw, u16 queue, | 567 | ath5k_conf_tx(struct ieee80211_hw *hw, u16 queue, |
586 | const struct ieee80211_tx_queue_params *params) | 568 | const struct ieee80211_tx_queue_params *params) |
587 | { | 569 | { |
588 | struct ath5k_softc *sc = hw->priv; | 570 | struct ath5k_hw *ah = hw->priv; |
589 | struct ath5k_hw *ah = sc->ah; | ||
590 | struct ath5k_txq_info qi; | 571 | struct ath5k_txq_info qi; |
591 | int ret = 0; | 572 | int ret = 0; |
592 | 573 | ||
593 | if (queue >= ah->ah_capabilities.cap_queues.q_tx_num) | 574 | if (queue >= ah->ah_capabilities.cap_queues.q_tx_num) |
594 | return 0; | 575 | return 0; |
595 | 576 | ||
596 | mutex_lock(&sc->lock); | 577 | mutex_lock(&ah->lock); |
597 | 578 | ||
598 | ath5k_hw_get_tx_queueprops(ah, queue, &qi); | 579 | ath5k_hw_get_tx_queueprops(ah, queue, &qi); |
599 | 580 | ||
@@ -602,20 +583,20 @@ ath5k_conf_tx(struct ieee80211_hw *hw, u16 queue, | |||
602 | qi.tqi_cw_max = params->cw_max; | 583 | qi.tqi_cw_max = params->cw_max; |
603 | qi.tqi_burst_time = params->txop; | 584 | qi.tqi_burst_time = params->txop; |
604 | 585 | ||
605 | ATH5K_DBG(sc, ATH5K_DEBUG_ANY, | 586 | ATH5K_DBG(ah, ATH5K_DEBUG_ANY, |
606 | "Configure tx [queue %d], " | 587 | "Configure tx [queue %d], " |
607 | "aifs: %d, cw_min: %d, cw_max: %d, txop: %d\n", | 588 | "aifs: %d, cw_min: %d, cw_max: %d, txop: %d\n", |
608 | queue, params->aifs, params->cw_min, | 589 | queue, params->aifs, params->cw_min, |
609 | params->cw_max, params->txop); | 590 | params->cw_max, params->txop); |
610 | 591 | ||
611 | if (ath5k_hw_set_tx_queueprops(ah, queue, &qi)) { | 592 | if (ath5k_hw_set_tx_queueprops(ah, queue, &qi)) { |
612 | ATH5K_ERR(sc, | 593 | ATH5K_ERR(ah, |
613 | "Unable to update hardware queue %u!\n", queue); | 594 | "Unable to update hardware queue %u!\n", queue); |
614 | ret = -EIO; | 595 | ret = -EIO; |
615 | } else | 596 | } else |
616 | ath5k_hw_reset_tx_queue(ah, queue); | 597 | ath5k_hw_reset_tx_queue(ah, queue); |
617 | 598 | ||
618 | mutex_unlock(&sc->lock); | 599 | mutex_unlock(&ah->lock); |
619 | 600 | ||
620 | return ret; | 601 | return ret; |
621 | } | 602 | } |
@@ -624,43 +605,43 @@ ath5k_conf_tx(struct ieee80211_hw *hw, u16 queue, | |||
624 | static u64 | 605 | static u64 |
625 | ath5k_get_tsf(struct ieee80211_hw *hw) | 606 | ath5k_get_tsf(struct ieee80211_hw *hw) |
626 | { | 607 | { |
627 | struct ath5k_softc *sc = hw->priv; | 608 | struct ath5k_hw *ah = hw->priv; |
628 | 609 | ||
629 | return ath5k_hw_get_tsf64(sc->ah); | 610 | return ath5k_hw_get_tsf64(ah); |
630 | } | 611 | } |
631 | 612 | ||
632 | 613 | ||
633 | static void | 614 | static void |
634 | ath5k_set_tsf(struct ieee80211_hw *hw, u64 tsf) | 615 | ath5k_set_tsf(struct ieee80211_hw *hw, u64 tsf) |
635 | { | 616 | { |
636 | struct ath5k_softc *sc = hw->priv; | 617 | struct ath5k_hw *ah = hw->priv; |
637 | 618 | ||
638 | ath5k_hw_set_tsf64(sc->ah, tsf); | 619 | ath5k_hw_set_tsf64(ah, tsf); |
639 | } | 620 | } |
640 | 621 | ||
641 | 622 | ||
642 | static void | 623 | static void |
643 | ath5k_reset_tsf(struct ieee80211_hw *hw) | 624 | ath5k_reset_tsf(struct ieee80211_hw *hw) |
644 | { | 625 | { |
645 | struct ath5k_softc *sc = hw->priv; | 626 | struct ath5k_hw *ah = hw->priv; |
646 | 627 | ||
647 | /* | 628 | /* |
648 | * in IBSS mode we need to update the beacon timers too. | 629 | * in IBSS mode we need to update the beacon timers too. |
649 | * this will also reset the TSF if we call it with 0 | 630 | * this will also reset the TSF if we call it with 0 |
650 | */ | 631 | */ |
651 | if (sc->opmode == NL80211_IFTYPE_ADHOC) | 632 | if (ah->opmode == NL80211_IFTYPE_ADHOC) |
652 | ath5k_beacon_update_timers(sc, 0); | 633 | ath5k_beacon_update_timers(ah, 0); |
653 | else | 634 | else |
654 | ath5k_hw_reset_tsf(sc->ah); | 635 | ath5k_hw_reset_tsf(ah); |
655 | } | 636 | } |
656 | 637 | ||
657 | 638 | ||
658 | static int | 639 | static int |
659 | ath5k_get_survey(struct ieee80211_hw *hw, int idx, struct survey_info *survey) | 640 | ath5k_get_survey(struct ieee80211_hw *hw, int idx, struct survey_info *survey) |
660 | { | 641 | { |
661 | struct ath5k_softc *sc = hw->priv; | 642 | struct ath5k_hw *ah = hw->priv; |
662 | struct ieee80211_conf *conf = &hw->conf; | 643 | struct ieee80211_conf *conf = &hw->conf; |
663 | struct ath_common *common = ath5k_hw_common(sc->ah); | 644 | struct ath_common *common = ath5k_hw_common(ah); |
664 | struct ath_cycle_counters *cc = &common->cc_survey; | 645 | struct ath_cycle_counters *cc = &common->cc_survey; |
665 | unsigned int div = common->clockrate * 1000; | 646 | unsigned int div = common->clockrate * 1000; |
666 | 647 | ||
@@ -670,18 +651,18 @@ ath5k_get_survey(struct ieee80211_hw *hw, int idx, struct survey_info *survey) | |||
670 | spin_lock_bh(&common->cc_lock); | 651 | spin_lock_bh(&common->cc_lock); |
671 | ath_hw_cycle_counters_update(common); | 652 | ath_hw_cycle_counters_update(common); |
672 | if (cc->cycles > 0) { | 653 | if (cc->cycles > 0) { |
673 | sc->survey.channel_time += cc->cycles / div; | 654 | ah->survey.channel_time += cc->cycles / div; |
674 | sc->survey.channel_time_busy += cc->rx_busy / div; | 655 | ah->survey.channel_time_busy += cc->rx_busy / div; |
675 | sc->survey.channel_time_rx += cc->rx_frame / div; | 656 | ah->survey.channel_time_rx += cc->rx_frame / div; |
676 | sc->survey.channel_time_tx += cc->tx_frame / div; | 657 | ah->survey.channel_time_tx += cc->tx_frame / div; |
677 | } | 658 | } |
678 | memset(cc, 0, sizeof(*cc)); | 659 | memset(cc, 0, sizeof(*cc)); |
679 | spin_unlock_bh(&common->cc_lock); | 660 | spin_unlock_bh(&common->cc_lock); |
680 | 661 | ||
681 | memcpy(survey, &sc->survey, sizeof(*survey)); | 662 | memcpy(survey, &ah->survey, sizeof(*survey)); |
682 | 663 | ||
683 | survey->channel = conf->channel; | 664 | survey->channel = conf->channel; |
684 | survey->noise = sc->ah->ah_noise_floor; | 665 | survey->noise = ah->ah_noise_floor; |
685 | survey->filled = SURVEY_INFO_NOISE_DBM | | 666 | survey->filled = SURVEY_INFO_NOISE_DBM | |
686 | SURVEY_INFO_CHANNEL_TIME | | 667 | SURVEY_INFO_CHANNEL_TIME | |
687 | SURVEY_INFO_CHANNEL_TIME_BUSY | | 668 | SURVEY_INFO_CHANNEL_TIME_BUSY | |
@@ -705,25 +686,25 @@ ath5k_get_survey(struct ieee80211_hw *hw, int idx, struct survey_info *survey) | |||
705 | static void | 686 | static void |
706 | ath5k_set_coverage_class(struct ieee80211_hw *hw, u8 coverage_class) | 687 | ath5k_set_coverage_class(struct ieee80211_hw *hw, u8 coverage_class) |
707 | { | 688 | { |
708 | struct ath5k_softc *sc = hw->priv; | 689 | struct ath5k_hw *ah = hw->priv; |
709 | 690 | ||
710 | mutex_lock(&sc->lock); | 691 | mutex_lock(&ah->lock); |
711 | ath5k_hw_set_coverage_class(sc->ah, coverage_class); | 692 | ath5k_hw_set_coverage_class(ah, coverage_class); |
712 | mutex_unlock(&sc->lock); | 693 | mutex_unlock(&ah->lock); |
713 | } | 694 | } |
714 | 695 | ||
715 | 696 | ||
716 | static int | 697 | static int |
717 | ath5k_set_antenna(struct ieee80211_hw *hw, u32 tx_ant, u32 rx_ant) | 698 | ath5k_set_antenna(struct ieee80211_hw *hw, u32 tx_ant, u32 rx_ant) |
718 | { | 699 | { |
719 | struct ath5k_softc *sc = hw->priv; | 700 | struct ath5k_hw *ah = hw->priv; |
720 | 701 | ||
721 | if (tx_ant == 1 && rx_ant == 1) | 702 | if (tx_ant == 1 && rx_ant == 1) |
722 | ath5k_hw_set_antenna_mode(sc->ah, AR5K_ANTMODE_FIXED_A); | 703 | ath5k_hw_set_antenna_mode(ah, AR5K_ANTMODE_FIXED_A); |
723 | else if (tx_ant == 2 && rx_ant == 2) | 704 | else if (tx_ant == 2 && rx_ant == 2) |
724 | ath5k_hw_set_antenna_mode(sc->ah, AR5K_ANTMODE_FIXED_B); | 705 | ath5k_hw_set_antenna_mode(ah, AR5K_ANTMODE_FIXED_B); |
725 | else if ((tx_ant & 3) == 3 && (rx_ant & 3) == 3) | 706 | else if ((tx_ant & 3) == 3 && (rx_ant & 3) == 3) |
726 | ath5k_hw_set_antenna_mode(sc->ah, AR5K_ANTMODE_DEFAULT); | 707 | ath5k_hw_set_antenna_mode(ah, AR5K_ANTMODE_DEFAULT); |
727 | else | 708 | else |
728 | return -EINVAL; | 709 | return -EINVAL; |
729 | return 0; | 710 | return 0; |
@@ -733,9 +714,9 @@ ath5k_set_antenna(struct ieee80211_hw *hw, u32 tx_ant, u32 rx_ant) | |||
733 | static int | 714 | static int |
734 | ath5k_get_antenna(struct ieee80211_hw *hw, u32 *tx_ant, u32 *rx_ant) | 715 | ath5k_get_antenna(struct ieee80211_hw *hw, u32 *tx_ant, u32 *rx_ant) |
735 | { | 716 | { |
736 | struct ath5k_softc *sc = hw->priv; | 717 | struct ath5k_hw *ah = hw->priv; |
737 | 718 | ||
738 | switch (sc->ah->ah_ant_mode) { | 719 | switch (ah->ah_ant_mode) { |
739 | case AR5K_ANTMODE_FIXED_A: | 720 | case AR5K_ANTMODE_FIXED_A: |
740 | *tx_ant = 1; *rx_ant = 1; break; | 721 | *tx_ant = 1; *rx_ant = 1; break; |
741 | case AR5K_ANTMODE_FIXED_B: | 722 | case AR5K_ANTMODE_FIXED_B: |
@@ -750,9 +731,9 @@ ath5k_get_antenna(struct ieee80211_hw *hw, u32 *tx_ant, u32 *rx_ant) | |||
750 | static void ath5k_get_ringparam(struct ieee80211_hw *hw, | 731 | static void ath5k_get_ringparam(struct ieee80211_hw *hw, |
751 | u32 *tx, u32 *tx_max, u32 *rx, u32 *rx_max) | 732 | u32 *tx, u32 *tx_max, u32 *rx, u32 *rx_max) |
752 | { | 733 | { |
753 | struct ath5k_softc *sc = hw->priv; | 734 | struct ath5k_hw *ah = hw->priv; |
754 | 735 | ||
755 | *tx = sc->txqs[AR5K_TX_QUEUE_ID_DATA_MIN].txq_max; | 736 | *tx = ah->txqs[AR5K_TX_QUEUE_ID_DATA_MIN].txq_max; |
756 | 737 | ||
757 | *tx_max = ATH5K_TXQ_LEN_MAX; | 738 | *tx_max = ATH5K_TXQ_LEN_MAX; |
758 | *rx = *rx_max = ATH_RXBUF; | 739 | *rx = *rx_max = ATH_RXBUF; |
@@ -761,7 +742,7 @@ static void ath5k_get_ringparam(struct ieee80211_hw *hw, | |||
761 | 742 | ||
762 | static int ath5k_set_ringparam(struct ieee80211_hw *hw, u32 tx, u32 rx) | 743 | static int ath5k_set_ringparam(struct ieee80211_hw *hw, u32 tx, u32 rx) |
763 | { | 744 | { |
764 | struct ath5k_softc *sc = hw->priv; | 745 | struct ath5k_hw *ah = hw->priv; |
765 | u16 qnum; | 746 | u16 qnum; |
766 | 747 | ||
767 | /* only support setting tx ring size for now */ | 748 | /* only support setting tx ring size for now */ |
@@ -772,16 +753,16 @@ static int ath5k_set_ringparam(struct ieee80211_hw *hw, u32 tx, u32 rx) | |||
772 | if (!tx || tx > ATH5K_TXQ_LEN_MAX) | 753 | if (!tx || tx > ATH5K_TXQ_LEN_MAX) |
773 | return -EINVAL; | 754 | return -EINVAL; |
774 | 755 | ||
775 | for (qnum = 0; qnum < ARRAY_SIZE(sc->txqs); qnum++) { | 756 | for (qnum = 0; qnum < ARRAY_SIZE(ah->txqs); qnum++) { |
776 | if (!sc->txqs[qnum].setup) | 757 | if (!ah->txqs[qnum].setup) |
777 | continue; | 758 | continue; |
778 | if (sc->txqs[qnum].qnum < AR5K_TX_QUEUE_ID_DATA_MIN || | 759 | if (ah->txqs[qnum].qnum < AR5K_TX_QUEUE_ID_DATA_MIN || |
779 | sc->txqs[qnum].qnum > AR5K_TX_QUEUE_ID_DATA_MAX) | 760 | ah->txqs[qnum].qnum > AR5K_TX_QUEUE_ID_DATA_MAX) |
780 | continue; | 761 | continue; |
781 | 762 | ||
782 | sc->txqs[qnum].txq_max = tx; | 763 | ah->txqs[qnum].txq_max = tx; |
783 | if (sc->txqs[qnum].txq_len >= sc->txqs[qnum].txq_max) | 764 | if (ah->txqs[qnum].txq_len >= ah->txqs[qnum].txq_max) |
784 | ieee80211_stop_queue(hw, sc->txqs[qnum].qnum); | 765 | ieee80211_stop_queue(hw, ah->txqs[qnum].qnum); |
785 | } | 766 | } |
786 | 767 | ||
787 | return 0; | 768 | return 0; |