ath9k: remove virtual wiphy support - it was only experimental anyway and it is not...
[openwrt.git] / package / mac80211 / patches / 541-ath9k_remove_virtual_support.patch
1 --- a/drivers/net/wireless/ath/ath9k/recv.c
2 +++ b/drivers/net/wireless/ath/ath9k/recv.c
3 @@ -34,27 +34,6 @@ static inline bool ath9k_check_auto_slee
4 (sc->sc_ah->caps.hw_caps & ATH9K_HW_CAP_AUTOSLEEP);
5 }
6
7 -static struct ieee80211_hw * ath_get_virt_hw(struct ath_softc *sc,
8 - struct ieee80211_hdr *hdr)
9 -{
10 - struct ieee80211_hw *hw = sc->pri_wiphy->hw;
11 - int i;
12 -
13 - spin_lock_bh(&sc->wiphy_lock);
14 - for (i = 0; i < sc->num_sec_wiphy; i++) {
15 - struct ath_wiphy *aphy = sc->sec_wiphy[i];
16 - if (aphy == NULL)
17 - continue;
18 - if (compare_ether_addr(hdr->addr1, aphy->hw->wiphy->perm_addr)
19 - == 0) {
20 - hw = aphy->hw;
21 - break;
22 - }
23 - }
24 - spin_unlock_bh(&sc->wiphy_lock);
25 - return hw;
26 -}
27 -
28 /*
29 * Setup and link descriptors.
30 *
31 @@ -463,8 +442,7 @@ u32 ath_calcrxfilter(struct ath_softc *s
32 if (conf_is_ht(&sc->hw->conf))
33 rfilt |= ATH9K_RX_FILTER_COMP_BAR;
34
35 - if (sc->sec_wiphy || (sc->nvifs > 1) ||
36 - (sc->rx.rxfilter & FIF_OTHER_BSS)) {
37 + if (sc->nvifs > 1 || (sc->rx.rxfilter & FIF_OTHER_BSS)) {
38 /* The following may also be needed for other older chips */
39 if (sc->sc_ah->hw_version.macVersion == AR_SREV_VERSION_9160)
40 rfilt |= ATH9K_RX_FILTER_PROM;
41 @@ -668,37 +646,6 @@ static void ath_rx_ps(struct ath_softc *
42 }
43 }
44
45 -static void ath_rx_send_to_mac80211(struct ieee80211_hw *hw,
46 - struct ath_softc *sc, struct sk_buff *skb)
47 -{
48 - struct ieee80211_hdr *hdr;
49 -
50 - hdr = (struct ieee80211_hdr *)skb->data;
51 -
52 - /* Send the frame to mac80211 */
53 - if (is_multicast_ether_addr(hdr->addr1)) {
54 - int i;
55 - /*
56 - * Deliver broadcast/multicast frames to all suitable
57 - * virtual wiphys.
58 - */
59 - /* TODO: filter based on channel configuration */
60 - for (i = 0; i < sc->num_sec_wiphy; i++) {
61 - struct ath_wiphy *aphy = sc->sec_wiphy[i];
62 - struct sk_buff *nskb;
63 - if (aphy == NULL)
64 - continue;
65 - nskb = skb_copy(skb, GFP_ATOMIC);
66 - if (!nskb)
67 - continue;
68 - ieee80211_rx(aphy->hw, nskb);
69 - }
70 - ieee80211_rx(sc->hw, skb);
71 - } else
72 - /* Deliver unicast frames based on receiver address */
73 - ieee80211_rx(hw, skb);
74 -}
75 -
76 static bool ath_edma_get_buffers(struct ath_softc *sc,
77 enum ath9k_rx_qtype qtype)
78 {
79 @@ -1644,7 +1591,7 @@ int ath_rx_tasklet(struct ath_softc *sc,
80 * virtual wiphy so to account for that we iterate over the active
81 * wiphys and find the appropriate wiphy and therefore hw.
82 */
83 - struct ieee80211_hw *hw = NULL;
84 + struct ieee80211_hw *hw = sc->hw;
85 struct ieee80211_hdr *hdr;
86 int retval;
87 bool decrypt_error = false;
88 @@ -1689,8 +1636,6 @@ int ath_rx_tasklet(struct ath_softc *sc,
89 hdr = (struct ieee80211_hdr *) (skb->data + rx_status_len);
90 rxs = IEEE80211_SKB_RXCB(skb);
91
92 - hw = ath_get_virt_hw(sc, hdr);
93 -
94 ath_debug_stat_rx(sc, &rs);
95
96 /*
97 @@ -1748,7 +1693,7 @@ int ath_rx_tasklet(struct ath_softc *sc,
98 bf->bf_mpdu = NULL;
99 bf->bf_buf_addr = 0;
100 ath_err(common, "dma_mapping_error() on RX\n");
101 - ath_rx_send_to_mac80211(hw, sc, skb);
102 + ieee80211_rx(hw, skb);
103 break;
104 }
105
106 @@ -1775,7 +1720,7 @@ int ath_rx_tasklet(struct ath_softc *sc,
107 if (ah->caps.hw_caps & ATH9K_HW_CAP_ANT_DIV_COMB)
108 ath_ant_comb_scan(sc, &rs);
109
110 - ath_rx_send_to_mac80211(hw, sc, skb);
111 + ieee80211_rx(hw, skb);
112
113 requeue:
114 if (edma) {
115 --- a/drivers/net/wireless/ath/ath9k/main.c
116 +++ b/drivers/net/wireless/ath/ath9k/main.c
117 @@ -1076,29 +1076,7 @@ static int ath9k_start(struct ieee80211_
118
119 mutex_lock(&sc->mutex);
120
121 - if (ath9k_wiphy_started(sc)) {
122 - if (sc->chan_idx == curchan->hw_value) {
123 - /*
124 - * Already on the operational channel, the new wiphy
125 - * can be marked active.
126 - */
127 - aphy->state = ATH_WIPHY_ACTIVE;
128 - ieee80211_wake_queues(hw);
129 - } else {
130 - /*
131 - * Another wiphy is on another channel, start the new
132 - * wiphy in paused state.
133 - */
134 - aphy->state = ATH_WIPHY_PAUSED;
135 - ieee80211_stop_queues(hw);
136 - }
137 - mutex_unlock(&sc->mutex);
138 - return 0;
139 - }
140 - aphy->state = ATH_WIPHY_ACTIVE;
141 -
142 /* setup initial channel */
143 -
144 sc->chan_idx = curchan->hw_value;
145
146 init_channel = ath_get_curchannel(sc, hw);
147 @@ -1208,13 +1186,6 @@ static int ath9k_tx(struct ieee80211_hw
148 struct ath_tx_control txctl;
149 struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) skb->data;
150
151 - if (aphy->state != ATH_WIPHY_ACTIVE && aphy->state != ATH_WIPHY_SCAN) {
152 - ath_dbg(common, ATH_DBG_XMIT,
153 - "ath9k: %s: TX in unexpected wiphy state %d\n",
154 - wiphy_name(hw->wiphy), aphy->state);
155 - goto exit;
156 - }
157 -
158 if (sc->ps_enabled) {
159 /*
160 * mac80211 does not set PM field for normal data frames, so we
161 @@ -1277,37 +1248,19 @@ static void ath9k_stop(struct ieee80211_
162 struct ath_softc *sc = aphy->sc;
163 struct ath_hw *ah = sc->sc_ah;
164 struct ath_common *common = ath9k_hw_common(ah);
165 - int i;
166
167 mutex_lock(&sc->mutex);
168
169 - aphy->state = ATH_WIPHY_INACTIVE;
170 -
171 cancel_delayed_work_sync(&sc->tx_complete_work);
172 cancel_work_sync(&sc->paprd_work);
173 cancel_work_sync(&sc->hw_check_work);
174
175 - for (i = 0; i < sc->num_sec_wiphy; i++) {
176 - if (sc->sec_wiphy[i])
177 - break;
178 - }
179 -
180 - if (i == sc->num_sec_wiphy) {
181 - cancel_delayed_work_sync(&sc->wiphy_work);
182 - cancel_work_sync(&sc->chan_work);
183 - }
184 -
185 if (sc->sc_flags & SC_OP_INVALID) {
186 ath_dbg(common, ATH_DBG_ANY, "Device not present\n");
187 mutex_unlock(&sc->mutex);
188 return;
189 }
190
191 - if (ath9k_wiphy_started(sc)) {
192 - mutex_unlock(&sc->mutex);
193 - return; /* another wiphy still in use */
194 - }
195 -
196 /* Ensure HW is awake when we try to shut it down. */
197 ath9k_ps_wakeup(sc);
198
199 @@ -1339,7 +1292,6 @@ static void ath9k_stop(struct ieee80211_
200 ath9k_ps_restore(sc);
201
202 sc->ps_idle = true;
203 - ath9k_set_wiphy_idle(aphy, true);
204 ath_radio_disable(sc, hw);
205
206 sc->sc_flags |= SC_OP_INVALID;
207 @@ -1429,7 +1381,6 @@ void ath9k_calculate_iter_data(struct ie
208 struct ath_softc *sc = aphy->sc;
209 struct ath_hw *ah = sc->sc_ah;
210 struct ath_common *common = ath9k_hw_common(ah);
211 - int i;
212
213 /*
214 * Use the hardware MAC address as reference, the hardware uses it
215 @@ -1443,16 +1394,8 @@ void ath9k_calculate_iter_data(struct ie
216 ath9k_vif_iter(iter_data, vif->addr, vif);
217
218 /* Get list of all active MAC addresses */
219 - spin_lock_bh(&sc->wiphy_lock);
220 ieee80211_iterate_active_interfaces_atomic(sc->hw, ath9k_vif_iter,
221 iter_data);
222 - for (i = 0; i < sc->num_sec_wiphy; i++) {
223 - if (sc->sec_wiphy[i] == NULL)
224 - continue;
225 - ieee80211_iterate_active_interfaces_atomic(
226 - sc->sec_wiphy[i]->hw, ath9k_vif_iter, iter_data);
227 - }
228 - spin_unlock_bh(&sc->wiphy_lock);
229 }
230
231 /* Called with sc->mutex held. */
232 @@ -1706,7 +1649,7 @@ static int ath9k_config(struct ieee80211
233 struct ath_hw *ah = sc->sc_ah;
234 struct ath_common *common = ath9k_hw_common(ah);
235 struct ieee80211_conf *conf = &hw->conf;
236 - bool disable_radio;
237 + bool disable_radio = false;
238
239 mutex_lock(&sc->mutex);
240
241 @@ -1717,29 +1660,13 @@ static int ath9k_config(struct ieee80211
242 * the end.
243 */
244 if (changed & IEEE80211_CONF_CHANGE_IDLE) {
245 - bool enable_radio;
246 - bool all_wiphys_idle;
247 - bool idle = !!(conf->flags & IEEE80211_CONF_IDLE);
248 -
249 - spin_lock_bh(&sc->wiphy_lock);
250 - all_wiphys_idle = ath9k_all_wiphys_idle(sc);
251 - ath9k_set_wiphy_idle(aphy, idle);
252 -
253 - enable_radio = (!idle && all_wiphys_idle);
254 -
255 - /*
256 - * After we unlock here its possible another wiphy
257 - * can be re-renabled so to account for that we will
258 - * only disable the radio toward the end of this routine
259 - * if by then all wiphys are still idle.
260 - */
261 - spin_unlock_bh(&sc->wiphy_lock);
262 -
263 - if (enable_radio) {
264 - sc->ps_idle = false;
265 + sc->ps_idle = !!(conf->flags & IEEE80211_CONF_IDLE);
266 + if (!sc->ps_idle) {
267 ath_radio_enable(sc, hw);
268 ath_dbg(common, ATH_DBG_CONFIG,
269 "not-idle: enabling radio\n");
270 + } else {
271 + disable_radio = true;
272 }
273 }
274
275 @@ -1780,24 +1707,11 @@ static int ath9k_config(struct ieee80211
276 if (ah->curchan)
277 old_pos = ah->curchan - &ah->channels[0];
278
279 - aphy->chan_idx = pos;
280 - aphy->chan_is_ht = conf_is_ht(conf);
281 if (hw->conf.flags & IEEE80211_CONF_OFFCHANNEL)
282 sc->sc_flags |= SC_OP_OFFCHANNEL;
283 else
284 sc->sc_flags &= ~SC_OP_OFFCHANNEL;
285
286 - if (aphy->state == ATH_WIPHY_SCAN ||
287 - aphy->state == ATH_WIPHY_ACTIVE)
288 - ath9k_wiphy_pause_all_forced(sc, aphy);
289 - else {
290 - /*
291 - * Do not change operational channel based on a paused
292 - * wiphy changes.
293 - */
294 - goto skip_chan_change;
295 - }
296 -
297 ath_dbg(common, ATH_DBG_CONFIG, "Set channel: %d MHz\n",
298 curchan->center_freq);
299
300 @@ -1844,19 +1758,13 @@ static int ath9k_config(struct ieee80211
301 ath_update_survey_nf(sc, old_pos);
302 }
303
304 -skip_chan_change:
305 if (changed & IEEE80211_CONF_CHANGE_POWER) {
306 sc->config.txpowlimit = 2 * conf->power_level;
307 ath_update_txpow(sc);
308 }
309
310 - spin_lock_bh(&sc->wiphy_lock);
311 - disable_radio = ath9k_all_wiphys_idle(sc);
312 - spin_unlock_bh(&sc->wiphy_lock);
313 -
314 if (disable_radio) {
315 ath_dbg(common, ATH_DBG_CONFIG, "idle: disabling radio\n");
316 - sc->ps_idle = true;
317 ath_radio_disable(sc, hw);
318 }
319
320 @@ -2247,43 +2155,6 @@ static int ath9k_get_survey(struct ieee8
321 return 0;
322 }
323
324 -static void ath9k_sw_scan_start(struct ieee80211_hw *hw)
325 -{
326 - struct ath_wiphy *aphy = hw->priv;
327 - struct ath_softc *sc = aphy->sc;
328 -
329 - mutex_lock(&sc->mutex);
330 - if (ath9k_wiphy_scanning(sc)) {
331 - /*
332 - * There is a race here in mac80211 but fixing it requires
333 - * we revisit how we handle the scan complete callback.
334 - * After mac80211 fixes we will not have configured hardware
335 - * to the home channel nor would we have configured the RX
336 - * filter yet.
337 - */
338 - mutex_unlock(&sc->mutex);
339 - return;
340 - }
341 -
342 - aphy->state = ATH_WIPHY_SCAN;
343 - ath9k_wiphy_pause_all_forced(sc, aphy);
344 - mutex_unlock(&sc->mutex);
345 -}
346 -
347 -/*
348 - * XXX: this requires a revisit after the driver
349 - * scan_complete gets moved to another place/removed in mac80211.
350 - */
351 -static void ath9k_sw_scan_complete(struct ieee80211_hw *hw)
352 -{
353 - struct ath_wiphy *aphy = hw->priv;
354 - struct ath_softc *sc = aphy->sc;
355 -
356 - mutex_lock(&sc->mutex);
357 - aphy->state = ATH_WIPHY_ACTIVE;
358 - mutex_unlock(&sc->mutex);
359 -}
360 -
361 static void ath9k_set_coverage_class(struct ieee80211_hw *hw, u8 coverage_class)
362 {
363 struct ath_wiphy *aphy = hw->priv;
364 @@ -2315,8 +2186,6 @@ struct ieee80211_ops ath9k_ops = {
365 .reset_tsf = ath9k_reset_tsf,
366 .ampdu_action = ath9k_ampdu_action,
367 .get_survey = ath9k_get_survey,
368 - .sw_scan_start = ath9k_sw_scan_start,
369 - .sw_scan_complete = ath9k_sw_scan_complete,
370 .rfkill_poll = ath9k_rfkill_poll_state,
371 .set_coverage_class = ath9k_set_coverage_class,
372 };
373 --- a/drivers/net/wireless/ath/ath9k/ath9k.h
374 +++ b/drivers/net/wireless/ath/ath9k/ath9k.h
375 @@ -381,7 +381,6 @@ struct ath_beacon {
376 u32 ast_be_xmit;
377 u64 bc_tstamp;
378 struct ieee80211_vif *bslot[ATH_BCBUF];
379 - struct ath_wiphy *bslot_aphy[ATH_BCBUF];
380 int slottime;
381 int slotupdate;
382 struct ath9k_tx_queue_info beacon_qi;
383 @@ -572,20 +571,8 @@ struct ath_softc {
384 struct ieee80211_hw *hw;
385 struct device *dev;
386
387 - spinlock_t wiphy_lock; /* spinlock to protect ath_wiphy data */
388 - struct ath_wiphy *pri_wiphy;
389 - struct ath_wiphy **sec_wiphy; /* secondary wiphys (virtual radios); may
390 - * have NULL entries */
391 - int num_sec_wiphy; /* number of sec_wiphy pointers in the array */
392 int chan_idx;
393 int chan_is_ht;
394 - struct ath_wiphy *next_wiphy;
395 - struct work_struct chan_work;
396 - int wiphy_select_failures;
397 - unsigned long wiphy_select_first_fail;
398 - struct delayed_work wiphy_work;
399 - unsigned long wiphy_scheduler_int;
400 - int wiphy_scheduler_index;
401 struct survey_info *cur_survey;
402 struct survey_info survey[ATH9K_NUM_CHANNELS];
403
404 @@ -645,16 +632,6 @@ struct ath_wiphy {
405 struct ath_softc *sc; /* shared for all virtual wiphys */
406 struct ieee80211_hw *hw;
407 struct ath9k_hw_cal_data caldata;
408 - enum ath_wiphy_state {
409 - ATH_WIPHY_INACTIVE,
410 - ATH_WIPHY_ACTIVE,
411 - ATH_WIPHY_PAUSING,
412 - ATH_WIPHY_PAUSED,
413 - ATH_WIPHY_SCAN,
414 - } state;
415 - bool idle;
416 - int chan_idx;
417 - int chan_is_ht;
418 int last_rssi;
419 };
420
421 @@ -711,24 +688,6 @@ void ath9k_ps_restore(struct ath_softc *
422 u8 ath_txchainmask_reduction(struct ath_softc *sc, u8 chainmask, u32 rate);
423
424 void ath9k_set_bssid_mask(struct ieee80211_hw *hw, struct ieee80211_vif *vif);
425 -int ath9k_wiphy_add(struct ath_softc *sc);
426 -int ath9k_wiphy_del(struct ath_wiphy *aphy);
427 -void ath9k_tx_status(struct ieee80211_hw *hw, struct sk_buff *skb, int ftype);
428 -int ath9k_wiphy_pause(struct ath_wiphy *aphy);
429 -int ath9k_wiphy_unpause(struct ath_wiphy *aphy);
430 -int ath9k_wiphy_select(struct ath_wiphy *aphy);
431 -void ath9k_wiphy_set_scheduler(struct ath_softc *sc, unsigned int msec_int);
432 -void ath9k_wiphy_chan_work(struct work_struct *work);
433 -bool ath9k_wiphy_started(struct ath_softc *sc);
434 -void ath9k_wiphy_pause_all_forced(struct ath_softc *sc,
435 - struct ath_wiphy *selected);
436 -bool ath9k_wiphy_scanning(struct ath_softc *sc);
437 -void ath9k_wiphy_work(struct work_struct *work);
438 -bool ath9k_all_wiphys_idle(struct ath_softc *sc);
439 -void ath9k_set_wiphy_idle(struct ath_wiphy *aphy, bool idle);
440 -
441 -void ath_mac80211_stop_queue(struct ath_softc *sc, u16 skb_queue);
442 -bool ath_mac80211_start_queue(struct ath_softc *sc, u16 skb_queue);
443
444 void ath_start_rfkill_poll(struct ath_softc *sc);
445 extern void ath9k_rfkill_poll_state(struct ieee80211_hw *hw);
446 --- a/drivers/net/wireless/ath/ath9k/virtual.c
447 +++ /dev/null
448 @@ -1,669 +0,0 @@
449 -/*
450 - * Copyright (c) 2008-2009 Atheros Communications Inc.
451 - *
452 - * Permission to use, copy, modify, and/or distribute this software for any
453 - * purpose with or without fee is hereby granted, provided that the above
454 - * copyright notice and this permission notice appear in all copies.
455 - *
456 - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
457 - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
458 - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
459 - * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
460 - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
461 - * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
462 - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
463 - */
464 -
465 -#include <linux/slab.h>
466 -
467 -#include "ath9k.h"
468 -
469 -int ath9k_wiphy_add(struct ath_softc *sc)
470 -{
471 - int i, error;
472 - struct ath_wiphy *aphy;
473 - struct ath_common *common = ath9k_hw_common(sc->sc_ah);
474 - struct ieee80211_hw *hw;
475 - u8 addr[ETH_ALEN];
476 -
477 - hw = ieee80211_alloc_hw(sizeof(struct ath_wiphy), &ath9k_ops);
478 - if (hw == NULL)
479 - return -ENOMEM;
480 -
481 - spin_lock_bh(&sc->wiphy_lock);
482 - for (i = 0; i < sc->num_sec_wiphy; i++) {
483 - if (sc->sec_wiphy[i] == NULL)
484 - break;
485 - }
486 -
487 - if (i == sc->num_sec_wiphy) {
488 - /* No empty slot available; increase array length */
489 - struct ath_wiphy **n;
490 - n = krealloc(sc->sec_wiphy,
491 - (sc->num_sec_wiphy + 1) *
492 - sizeof(struct ath_wiphy *),
493 - GFP_ATOMIC);
494 - if (n == NULL) {
495 - spin_unlock_bh(&sc->wiphy_lock);
496 - ieee80211_free_hw(hw);
497 - return -ENOMEM;
498 - }
499 - n[i] = NULL;
500 - sc->sec_wiphy = n;
501 - sc->num_sec_wiphy++;
502 - }
503 -
504 - SET_IEEE80211_DEV(hw, sc->dev);
505 -
506 - aphy = hw->priv;
507 - aphy->sc = sc;
508 - aphy->hw = hw;
509 - sc->sec_wiphy[i] = aphy;
510 - aphy->last_rssi = ATH_RSSI_DUMMY_MARKER;
511 - spin_unlock_bh(&sc->wiphy_lock);
512 -
513 - memcpy(addr, common->macaddr, ETH_ALEN);
514 - addr[0] |= 0x02; /* Locally managed address */
515 - /*
516 - * XOR virtual wiphy index into the least significant bits to generate
517 - * a different MAC address for each virtual wiphy.
518 - */
519 - addr[5] ^= i & 0xff;
520 - addr[4] ^= (i & 0xff00) >> 8;
521 - addr[3] ^= (i & 0xff0000) >> 16;
522 -
523 - SET_IEEE80211_PERM_ADDR(hw, addr);
524 -
525 - ath9k_set_hw_capab(sc, hw);
526 -
527 - error = ieee80211_register_hw(hw);
528 -
529 - if (error == 0) {
530 - /* Make sure wiphy scheduler is started (if enabled) */
531 - ath9k_wiphy_set_scheduler(sc, sc->wiphy_scheduler_int);
532 - }
533 -
534 - return error;
535 -}
536 -
537 -int ath9k_wiphy_del(struct ath_wiphy *aphy)
538 -{
539 - struct ath_softc *sc = aphy->sc;
540 - int i;
541 -
542 - spin_lock_bh(&sc->wiphy_lock);
543 - for (i = 0; i < sc->num_sec_wiphy; i++) {
544 - if (aphy == sc->sec_wiphy[i]) {
545 - sc->sec_wiphy[i] = NULL;
546 - spin_unlock_bh(&sc->wiphy_lock);
547 - ieee80211_unregister_hw(aphy->hw);
548 - ieee80211_free_hw(aphy->hw);
549 - return 0;
550 - }
551 - }
552 - spin_unlock_bh(&sc->wiphy_lock);
553 - return -ENOENT;
554 -}
555 -
556 -static int ath9k_send_nullfunc(struct ath_wiphy *aphy,
557 - struct ieee80211_vif *vif, const u8 *bssid,
558 - int ps)
559 -{
560 - struct ath_softc *sc = aphy->sc;
561 - struct ath_tx_control txctl;
562 - struct sk_buff *skb;
563 - struct ieee80211_hdr *hdr;
564 - __le16 fc;
565 - struct ieee80211_tx_info *info;
566 -
567 - skb = dev_alloc_skb(24);
568 - if (skb == NULL)
569 - return -ENOMEM;
570 - hdr = (struct ieee80211_hdr *) skb_put(skb, 24);
571 - memset(hdr, 0, 24);
572 - fc = cpu_to_le16(IEEE80211_FTYPE_DATA | IEEE80211_STYPE_NULLFUNC |
573 - IEEE80211_FCTL_TODS);
574 - if (ps)
575 - fc |= cpu_to_le16(IEEE80211_FCTL_PM);
576 - hdr->frame_control = fc;
577 - memcpy(hdr->addr1, bssid, ETH_ALEN);
578 - memcpy(hdr->addr2, aphy->hw->wiphy->perm_addr, ETH_ALEN);
579 - memcpy(hdr->addr3, bssid, ETH_ALEN);
580 -
581 - info = IEEE80211_SKB_CB(skb);
582 - memset(info, 0, sizeof(*info));
583 - info->flags = IEEE80211_TX_CTL_REQ_TX_STATUS;
584 - info->control.vif = vif;
585 - info->control.rates[0].idx = 0;
586 - info->control.rates[0].count = 4;
587 - info->control.rates[1].idx = -1;
588 -
589 - memset(&txctl, 0, sizeof(struct ath_tx_control));
590 - txctl.txq = sc->tx.txq_map[WME_AC_VO];
591 - txctl.frame_type = ps ? ATH9K_IFT_PAUSE : ATH9K_IFT_UNPAUSE;
592 -
593 - if (ath_tx_start(aphy->hw, skb, &txctl) != 0)
594 - goto exit;
595 -
596 - return 0;
597 -exit:
598 - dev_kfree_skb_any(skb);
599 - return -1;
600 -}
601 -
602 -static bool __ath9k_wiphy_pausing(struct ath_softc *sc)
603 -{
604 - int i;
605 - if (sc->pri_wiphy->state == ATH_WIPHY_PAUSING)
606 - return true;
607 - for (i = 0; i < sc->num_sec_wiphy; i++) {
608 - if (sc->sec_wiphy[i] &&
609 - sc->sec_wiphy[i]->state == ATH_WIPHY_PAUSING)
610 - return true;
611 - }
612 - return false;
613 -}
614 -
615 -static bool ath9k_wiphy_pausing(struct ath_softc *sc)
616 -{
617 - bool ret;
618 - spin_lock_bh(&sc->wiphy_lock);
619 - ret = __ath9k_wiphy_pausing(sc);
620 - spin_unlock_bh(&sc->wiphy_lock);
621 - return ret;
622 -}
623 -
624 -static bool __ath9k_wiphy_scanning(struct ath_softc *sc)
625 -{
626 - int i;
627 - if (sc->pri_wiphy->state == ATH_WIPHY_SCAN)
628 - return true;
629 - for (i = 0; i < sc->num_sec_wiphy; i++) {
630 - if (sc->sec_wiphy[i] &&
631 - sc->sec_wiphy[i]->state == ATH_WIPHY_SCAN)
632 - return true;
633 - }
634 - return false;
635 -}
636 -
637 -bool ath9k_wiphy_scanning(struct ath_softc *sc)
638 -{
639 - bool ret;
640 - spin_lock_bh(&sc->wiphy_lock);
641 - ret = __ath9k_wiphy_scanning(sc);
642 - spin_unlock_bh(&sc->wiphy_lock);
643 - return ret;
644 -}
645 -
646 -static int __ath9k_wiphy_unpause(struct ath_wiphy *aphy);
647 -
648 -/* caller must hold wiphy_lock */
649 -static void __ath9k_wiphy_unpause_ch(struct ath_wiphy *aphy)
650 -{
651 - if (aphy == NULL)
652 - return;
653 - if (aphy->chan_idx != aphy->sc->chan_idx)
654 - return; /* wiphy not on the selected channel */
655 - __ath9k_wiphy_unpause(aphy);
656 -}
657 -
658 -static void ath9k_wiphy_unpause_channel(struct ath_softc *sc)
659 -{
660 - int i;
661 - spin_lock_bh(&sc->wiphy_lock);
662 - __ath9k_wiphy_unpause_ch(sc->pri_wiphy);
663 - for (i = 0; i < sc->num_sec_wiphy; i++)
664 - __ath9k_wiphy_unpause_ch(sc->sec_wiphy[i]);
665 - spin_unlock_bh(&sc->wiphy_lock);
666 -}
667 -
668 -void ath9k_wiphy_chan_work(struct work_struct *work)
669 -{
670 - struct ath_softc *sc = container_of(work, struct ath_softc, chan_work);
671 - struct ath_common *common = ath9k_hw_common(sc->sc_ah);
672 - struct ath_wiphy *aphy = sc->next_wiphy;
673 -
674 - if (aphy == NULL)
675 - return;
676 -
677 - /*
678 - * All pending interfaces paused; ready to change
679 - * channels.
680 - */
681 -
682 - /* Change channels */
683 - mutex_lock(&sc->mutex);
684 - /* XXX: remove me eventually */
685 - ath9k_update_ichannel(sc, aphy->hw,
686 - &sc->sc_ah->channels[sc->chan_idx]);
687 -
688 - /* sync hw configuration for hw code */
689 - common->hw = aphy->hw;
690 -
691 - if (ath_set_channel(sc, aphy->hw,
692 - &sc->sc_ah->channels[sc->chan_idx]) < 0) {
693 - printk(KERN_DEBUG "ath9k: Failed to set channel for new "
694 - "virtual wiphy\n");
695 - mutex_unlock(&sc->mutex);
696 - return;
697 - }
698 - mutex_unlock(&sc->mutex);
699 -
700 - ath9k_wiphy_unpause_channel(sc);
701 -}
702 -
703 -/*
704 - * ath9k version of ieee80211_tx_status() for TX frames that are generated
705 - * internally in the driver.
706 - */
707 -void ath9k_tx_status(struct ieee80211_hw *hw, struct sk_buff *skb, int ftype)
708 -{
709 - struct ath_wiphy *aphy = hw->priv;
710 - struct ieee80211_tx_info *tx_info = IEEE80211_SKB_CB(skb);
711 -
712 - if (ftype == ATH9K_IFT_PAUSE && aphy->state == ATH_WIPHY_PAUSING) {
713 - if (!(tx_info->flags & IEEE80211_TX_STAT_ACK)) {
714 - printk(KERN_DEBUG "ath9k: %s: no ACK for pause "
715 - "frame\n", wiphy_name(hw->wiphy));
716 - /*
717 - * The AP did not reply; ignore this to allow us to
718 - * continue.
719 - */
720 - }
721 - aphy->state = ATH_WIPHY_PAUSED;
722 - if (!ath9k_wiphy_pausing(aphy->sc)) {
723 - /*
724 - * Drop from tasklet to work to allow mutex for channel
725 - * change.
726 - */
727 - ieee80211_queue_work(aphy->sc->hw,
728 - &aphy->sc->chan_work);
729 - }
730 - }
731 -
732 - dev_kfree_skb(skb);
733 -}
734 -
735 -static void ath9k_mark_paused(struct ath_wiphy *aphy)
736 -{
737 - struct ath_softc *sc = aphy->sc;
738 - aphy->state = ATH_WIPHY_PAUSED;
739 - if (!__ath9k_wiphy_pausing(sc))
740 - ieee80211_queue_work(sc->hw, &sc->chan_work);
741 -}
742 -
743 -static void ath9k_pause_iter(void *data, u8 *mac, struct ieee80211_vif *vif)
744 -{
745 - struct ath_wiphy *aphy = data;
746 - struct ath_vif *avp = (void *) vif->drv_priv;
747 -
748 - switch (vif->type) {
749 - case NL80211_IFTYPE_STATION:
750 - if (!vif->bss_conf.assoc) {
751 - ath9k_mark_paused(aphy);
752 - break;
753 - }
754 - /* TODO: could avoid this if already in PS mode */
755 - if (ath9k_send_nullfunc(aphy, vif, avp->bssid, 1)) {
756 - printk(KERN_DEBUG "%s: failed to send PS nullfunc\n",
757 - __func__);
758 - ath9k_mark_paused(aphy);
759 - }
760 - break;
761 - case NL80211_IFTYPE_AP:
762 - /* Beacon transmission is paused by aphy->state change */
763 - ath9k_mark_paused(aphy);
764 - break;
765 - default:
766 - break;
767 - }
768 -}
769 -
770 -/* caller must hold wiphy_lock */
771 -static int __ath9k_wiphy_pause(struct ath_wiphy *aphy)
772 -{
773 - ieee80211_stop_queues(aphy->hw);
774 - aphy->state = ATH_WIPHY_PAUSING;
775 - /*
776 - * TODO: handle PAUSING->PAUSED for the case where there are multiple
777 - * active vifs (now we do it on the first vif getting ready; should be
778 - * on the last)
779 - */
780 - ieee80211_iterate_active_interfaces_atomic(aphy->hw, ath9k_pause_iter,
781 - aphy);
782 - return 0;
783 -}
784 -
785 -int ath9k_wiphy_pause(struct ath_wiphy *aphy)
786 -{
787 - int ret;
788 - spin_lock_bh(&aphy->sc->wiphy_lock);
789 - ret = __ath9k_wiphy_pause(aphy);
790 - spin_unlock_bh(&aphy->sc->wiphy_lock);
791 - return ret;
792 -}
793 -
794 -static void ath9k_unpause_iter(void *data, u8 *mac, struct ieee80211_vif *vif)
795 -{
796 - struct ath_wiphy *aphy = data;
797 - struct ath_vif *avp = (void *) vif->drv_priv;
798 -
799 - switch (vif->type) {
800 - case NL80211_IFTYPE_STATION:
801 - if (!vif->bss_conf.assoc)
802 - break;
803 - ath9k_send_nullfunc(aphy, vif, avp->bssid, 0);
804 - break;
805 - case NL80211_IFTYPE_AP:
806 - /* Beacon transmission is re-enabled by aphy->state change */
807 - break;
808 - default:
809 - break;
810 - }
811 -}
812 -
813 -/* caller must hold wiphy_lock */
814 -static int __ath9k_wiphy_unpause(struct ath_wiphy *aphy)
815 -{
816 - ieee80211_iterate_active_interfaces_atomic(aphy->hw,
817 - ath9k_unpause_iter, aphy);
818 - aphy->state = ATH_WIPHY_ACTIVE;
819 - ieee80211_wake_queues(aphy->hw);
820 - return 0;
821 -}
822 -
823 -int ath9k_wiphy_unpause(struct ath_wiphy *aphy)
824 -{
825 - int ret;
826 - spin_lock_bh(&aphy->sc->wiphy_lock);
827 - ret = __ath9k_wiphy_unpause(aphy);
828 - spin_unlock_bh(&aphy->sc->wiphy_lock);
829 - return ret;
830 -}
831 -
832 -static void __ath9k_wiphy_mark_all_paused(struct ath_softc *sc)
833 -{
834 - int i;
835 - if (sc->pri_wiphy->state != ATH_WIPHY_INACTIVE)
836 - sc->pri_wiphy->state = ATH_WIPHY_PAUSED;
837 - for (i = 0; i < sc->num_sec_wiphy; i++) {
838 - if (sc->sec_wiphy[i] &&
839 - sc->sec_wiphy[i]->state != ATH_WIPHY_INACTIVE)
840 - sc->sec_wiphy[i]->state = ATH_WIPHY_PAUSED;
841 - }
842 -}
843 -
844 -/* caller must hold wiphy_lock */
845 -static void __ath9k_wiphy_pause_all(struct ath_softc *sc)
846 -{
847 - int i;
848 - if (sc->pri_wiphy->state == ATH_WIPHY_ACTIVE)
849 - __ath9k_wiphy_pause(sc->pri_wiphy);
850 - for (i = 0; i < sc->num_sec_wiphy; i++) {
851 - if (sc->sec_wiphy[i] &&
852 - sc->sec_wiphy[i]->state == ATH_WIPHY_ACTIVE)
853 - __ath9k_wiphy_pause(sc->sec_wiphy[i]);
854 - }
855 -}
856 -
857 -int ath9k_wiphy_select(struct ath_wiphy *aphy)
858 -{
859 - struct ath_softc *sc = aphy->sc;
860 - bool now;
861 -
862 - spin_lock_bh(&sc->wiphy_lock);
863 - if (__ath9k_wiphy_scanning(sc)) {
864 - /*
865 - * For now, we are using mac80211 sw scan and it expects to
866 - * have full control over channel changes, so avoid wiphy
867 - * scheduling during a scan. This could be optimized if the
868 - * scanning control were moved into the driver.
869 - */
870 - spin_unlock_bh(&sc->wiphy_lock);
871 - return -EBUSY;
872 - }
873 - if (__ath9k_wiphy_pausing(sc)) {
874 - if (sc->wiphy_select_failures == 0)
875 - sc->wiphy_select_first_fail = jiffies;
876 - sc->wiphy_select_failures++;
877 - if (time_after(jiffies, sc->wiphy_select_first_fail + HZ / 2))
878 - {
879 - printk(KERN_DEBUG "ath9k: Previous wiphy select timed "
880 - "out; disable/enable hw to recover\n");
881 - __ath9k_wiphy_mark_all_paused(sc);
882 - /*
883 - * TODO: this workaround to fix hardware is unlikely to
884 - * be specific to virtual wiphy changes. It can happen
885 - * on normal channel change, too, and as such, this
886 - * should really be made more generic. For example,
887 - * tricker radio disable/enable on GTT interrupt burst
888 - * (say, 10 GTT interrupts received without any TX
889 - * frame being completed)
890 - */
891 - spin_unlock_bh(&sc->wiphy_lock);
892 - ath_radio_disable(sc, aphy->hw);
893 - ath_radio_enable(sc, aphy->hw);
894 - /* Only the primary wiphy hw is used for queuing work */
895 - ieee80211_queue_work(aphy->sc->hw,
896 - &aphy->sc->chan_work);
897 - return -EBUSY; /* previous select still in progress */
898 - }
899 - spin_unlock_bh(&sc->wiphy_lock);
900 - return -EBUSY; /* previous select still in progress */
901 - }
902 - sc->wiphy_select_failures = 0;
903 -
904 - /* Store the new channel */
905 - sc->chan_idx = aphy->chan_idx;
906 - sc->chan_is_ht = aphy->chan_is_ht;
907 - sc->next_wiphy = aphy;
908 -
909 - __ath9k_wiphy_pause_all(sc);
910 - now = !__ath9k_wiphy_pausing(aphy->sc);
911 - spin_unlock_bh(&sc->wiphy_lock);
912 -
913 - if (now) {
914 - /* Ready to request channel change immediately */
915 - ieee80211_queue_work(aphy->sc->hw, &aphy->sc->chan_work);
916 - }
917 -
918 - /*
919 - * wiphys will be unpaused in ath9k_tx_status() once channel has been
920 - * changed if any wiphy needs time to become paused.
921 - */
922 -
923 - return 0;
924 -}
925 -
926 -bool ath9k_wiphy_started(struct ath_softc *sc)
927 -{
928 - int i;
929 - spin_lock_bh(&sc->wiphy_lock);
930 - if (sc->pri_wiphy->state != ATH_WIPHY_INACTIVE) {
931 - spin_unlock_bh(&sc->wiphy_lock);
932 - return true;
933 - }
934 - for (i = 0; i < sc->num_sec_wiphy; i++) {
935 - if (sc->sec_wiphy[i] &&
936 - sc->sec_wiphy[i]->state != ATH_WIPHY_INACTIVE) {
937 - spin_unlock_bh(&sc->wiphy_lock);
938 - return true;
939 - }
940 - }
941 - spin_unlock_bh(&sc->wiphy_lock);
942 - return false;
943 -}
944 -
945 -static void ath9k_wiphy_pause_chan(struct ath_wiphy *aphy,
946 - struct ath_wiphy *selected)
947 -{
948 - if (selected->state == ATH_WIPHY_SCAN) {
949 - if (aphy == selected)
950 - return;
951 - /*
952 - * Pause all other wiphys for the duration of the scan even if
953 - * they are on the current channel now.
954 - */
955 - } else if (aphy->chan_idx == selected->chan_idx)
956 - return;
957 - aphy->state = ATH_WIPHY_PAUSED;
958 - ieee80211_stop_queues(aphy->hw);
959 -}
960 -
961 -void ath9k_wiphy_pause_all_forced(struct ath_softc *sc,
962 - struct ath_wiphy *selected)
963 -{
964 - int i;
965 - spin_lock_bh(&sc->wiphy_lock);
966 - if (sc->pri_wiphy->state == ATH_WIPHY_ACTIVE)
967 - ath9k_wiphy_pause_chan(sc->pri_wiphy, selected);
968 - for (i = 0; i < sc->num_sec_wiphy; i++) {
969 - if (sc->sec_wiphy[i] &&
970 - sc->sec_wiphy[i]->state == ATH_WIPHY_ACTIVE)
971 - ath9k_wiphy_pause_chan(sc->sec_wiphy[i], selected);
972 - }
973 - spin_unlock_bh(&sc->wiphy_lock);
974 -}
975 -
976 -void ath9k_wiphy_work(struct work_struct *work)
977 -{
978 - struct ath_softc *sc = container_of(work, struct ath_softc,
979 - wiphy_work.work);
980 - struct ath_wiphy *aphy = NULL;
981 - bool first = true;
982 -
983 - spin_lock_bh(&sc->wiphy_lock);
984 -
985 - if (sc->wiphy_scheduler_int == 0) {
986 - /* wiphy scheduler is disabled */
987 - spin_unlock_bh(&sc->wiphy_lock);
988 - return;
989 - }
990 -
991 -try_again:
992 - sc->wiphy_scheduler_index++;
993 - while (sc->wiphy_scheduler_index <= sc->num_sec_wiphy) {
994 - aphy = sc->sec_wiphy[sc->wiphy_scheduler_index - 1];
995 - if (aphy && aphy->state != ATH_WIPHY_INACTIVE)
996 - break;
997 -
998 - sc->wiphy_scheduler_index++;
999 - aphy = NULL;
1000 - }
1001 - if (aphy == NULL) {
1002 - sc->wiphy_scheduler_index = 0;
1003 - if (sc->pri_wiphy->state == ATH_WIPHY_INACTIVE) {
1004 - if (first) {
1005 - first = false;
1006 - goto try_again;
1007 - }
1008 - /* No wiphy is ready to be scheduled */
1009 - } else
1010 - aphy = sc->pri_wiphy;
1011 - }
1012 -
1013 - spin_unlock_bh(&sc->wiphy_lock);
1014 -
1015 - if (aphy &&
1016 - aphy->state != ATH_WIPHY_ACTIVE && aphy->state != ATH_WIPHY_SCAN &&
1017 - ath9k_wiphy_select(aphy)) {
1018 - printk(KERN_DEBUG "ath9k: Failed to schedule virtual wiphy "
1019 - "change\n");
1020 - }
1021 -
1022 - ieee80211_queue_delayed_work(sc->hw,
1023 - &sc->wiphy_work,
1024 - sc->wiphy_scheduler_int);
1025 -}
1026 -
1027 -void ath9k_wiphy_set_scheduler(struct ath_softc *sc, unsigned int msec_int)
1028 -{
1029 - cancel_delayed_work_sync(&sc->wiphy_work);
1030 - sc->wiphy_scheduler_int = msecs_to_jiffies(msec_int);
1031 - if (sc->wiphy_scheduler_int)
1032 - ieee80211_queue_delayed_work(sc->hw, &sc->wiphy_work,
1033 - sc->wiphy_scheduler_int);
1034 -}
1035 -
1036 -/* caller must hold wiphy_lock */
1037 -bool ath9k_all_wiphys_idle(struct ath_softc *sc)
1038 -{
1039 - unsigned int i;
1040 - if (!sc->pri_wiphy->idle)
1041 - return false;
1042 - for (i = 0; i < sc->num_sec_wiphy; i++) {
1043 - struct ath_wiphy *aphy = sc->sec_wiphy[i];
1044 - if (!aphy)
1045 - continue;
1046 - if (!aphy->idle)
1047 - return false;
1048 - }
1049 - return true;
1050 -}
1051 -
1052 -/* caller must hold wiphy_lock */
1053 -void ath9k_set_wiphy_idle(struct ath_wiphy *aphy, bool idle)
1054 -{
1055 - struct ath_softc *sc = aphy->sc;
1056 -
1057 - aphy->idle = idle;
1058 - ath_dbg(ath9k_hw_common(sc->sc_ah), ATH_DBG_CONFIG,
1059 - "Marking %s as %sidle\n",
1060 - wiphy_name(aphy->hw->wiphy), idle ? "" : "not-");
1061 -}
1062 -/* Only bother starting a queue on an active virtual wiphy */
1063 -bool ath_mac80211_start_queue(struct ath_softc *sc, u16 skb_queue)
1064 -{
1065 - struct ieee80211_hw *hw = sc->pri_wiphy->hw;
1066 - unsigned int i;
1067 - bool txq_started = false;
1068 -
1069 - spin_lock_bh(&sc->wiphy_lock);
1070 -
1071 - /* Start the primary wiphy */
1072 - if (sc->pri_wiphy->state == ATH_WIPHY_ACTIVE) {
1073 - ieee80211_wake_queue(hw, skb_queue);
1074 - txq_started = true;
1075 - goto unlock;
1076 - }
1077 -
1078 - /* Now start the secondary wiphy queues */
1079 - for (i = 0; i < sc->num_sec_wiphy; i++) {
1080 - struct ath_wiphy *aphy = sc->sec_wiphy[i];
1081 - if (!aphy)
1082 - continue;
1083 - if (aphy->state != ATH_WIPHY_ACTIVE)
1084 - continue;
1085 -
1086 - hw = aphy->hw;
1087 - ieee80211_wake_queue(hw, skb_queue);
1088 - txq_started = true;
1089 - break;
1090 - }
1091 -
1092 -unlock:
1093 - spin_unlock_bh(&sc->wiphy_lock);
1094 - return txq_started;
1095 -}
1096 -
1097 -/* Go ahead and propagate information to all virtual wiphys, it won't hurt */
1098 -void ath_mac80211_stop_queue(struct ath_softc *sc, u16 skb_queue)
1099 -{
1100 - struct ieee80211_hw *hw = sc->pri_wiphy->hw;
1101 - unsigned int i;
1102 -
1103 - spin_lock_bh(&sc->wiphy_lock);
1104 -
1105 - /* Stop the primary wiphy */
1106 - ieee80211_stop_queue(hw, skb_queue);
1107 -
1108 - /* Now stop the secondary wiphy queues */
1109 - for (i = 0; i < sc->num_sec_wiphy; i++) {
1110 - struct ath_wiphy *aphy = sc->sec_wiphy[i];
1111 - if (!aphy)
1112 - continue;
1113 - hw = aphy->hw;
1114 - ieee80211_stop_queue(hw, skb_queue);
1115 - }
1116 - spin_unlock_bh(&sc->wiphy_lock);
1117 -}
1118 --- a/drivers/net/wireless/ath/ath9k/xmit.c
1119 +++ b/drivers/net/wireless/ath/ath9k/xmit.c
1120 @@ -1816,7 +1816,7 @@ int ath_tx_start(struct ieee80211_hw *hw
1121 spin_lock_bh(&txq->axq_lock);
1122 if (txq == sc->tx.txq_map[q] &&
1123 ++txq->pending_frames > ATH_MAX_QDEPTH && !txq->stopped) {
1124 - ath_mac80211_stop_queue(sc, q);
1125 + ieee80211_stop_queue(sc->hw, q);
1126 txq->stopped = 1;
1127 }
1128 spin_unlock_bh(&txq->axq_lock);
1129 @@ -1874,24 +1874,20 @@ static void ath_tx_complete(struct ath_s
1130 PS_WAIT_FOR_TX_ACK));
1131 }
1132
1133 - if (unlikely(ftype))
1134 - ath9k_tx_status(hw, skb, ftype);
1135 - else {
1136 - q = skb_get_queue_mapping(skb);
1137 - if (txq == sc->tx.txq_map[q]) {
1138 - spin_lock_bh(&txq->axq_lock);
1139 - if (WARN_ON(--txq->pending_frames < 0))
1140 - txq->pending_frames = 0;
1141 + q = skb_get_queue_mapping(skb);
1142 + if (txq == sc->tx.txq_map[q]) {
1143 + spin_lock_bh(&txq->axq_lock);
1144 + if (WARN_ON(--txq->pending_frames < 0))
1145 + txq->pending_frames = 0;
1146
1147 - if (txq->stopped && txq->pending_frames < ATH_MAX_QDEPTH) {
1148 - if (ath_mac80211_start_queue(sc, q))
1149 - txq->stopped = 0;
1150 - }
1151 - spin_unlock_bh(&txq->axq_lock);
1152 + if (txq->stopped && txq->pending_frames < ATH_MAX_QDEPTH) {
1153 + ieee80211_wake_queue(sc->hw, q);
1154 + txq->stopped = 0;
1155 }
1156 -
1157 - ieee80211_tx_status(hw, skb);
1158 + spin_unlock_bh(&txq->axq_lock);
1159 }
1160 +
1161 + ieee80211_tx_status(hw, skb);
1162 }
1163
1164 static void ath_tx_complete_buf(struct ath_softc *sc, struct ath_buf *bf,
1165 --- a/drivers/net/wireless/ath/ath9k/Makefile
1166 +++ b/drivers/net/wireless/ath/ath9k/Makefile
1167 @@ -4,7 +4,6 @@ ath9k-y += beacon.o \
1168 main.o \
1169 recv.o \
1170 xmit.o \
1171 - virtual.o \
1172
1173 ath9k-$(CONFIG_ATH9K_RATE_CONTROL) += rc.o
1174 ath9k-$(CONFIG_PCI) += pci.o
1175 --- a/drivers/net/wireless/ath/ath9k/init.c
1176 +++ b/drivers/net/wireless/ath/ath9k/init.c
1177 @@ -532,10 +532,8 @@ static void ath9k_init_misc(struct ath_s
1178
1179 sc->beacon.slottime = ATH9K_SLOT_TIME_9;
1180
1181 - for (i = 0; i < ARRAY_SIZE(sc->beacon.bslot); i++) {
1182 + for (i = 0; i < ARRAY_SIZE(sc->beacon.bslot); i++)
1183 sc->beacon.bslot[i] = NULL;
1184 - sc->beacon.bslot_aphy[i] = NULL;
1185 - }
1186
1187 if (sc->sc_ah->caps.hw_caps & ATH9K_HW_CAP_ANT_DIV_COMB)
1188 sc->ant_comb.count = ATH_ANT_DIV_COMB_INIT_COUNT;
1189 @@ -577,7 +575,6 @@ static int ath9k_init_softc(u16 devid, s
1190 common->btcoex_enabled = ath9k_btcoex_enable == 1;
1191 spin_lock_init(&common->cc_lock);
1192
1193 - spin_lock_init(&sc->wiphy_lock);
1194 spin_lock_init(&sc->sc_serial_rw);
1195 spin_lock_init(&sc->sc_pm_lock);
1196 mutex_init(&sc->mutex);
1197 @@ -789,9 +786,6 @@ int ath9k_init_device(u16 devid, struct
1198
1199 INIT_WORK(&sc->hw_check_work, ath_hw_check);
1200 INIT_WORK(&sc->paprd_work, ath_paprd_calibrate);
1201 - INIT_WORK(&sc->chan_work, ath9k_wiphy_chan_work);
1202 - INIT_DELAYED_WORK(&sc->wiphy_work, ath9k_wiphy_work);
1203 - sc->wiphy_scheduler_int = msecs_to_jiffies(500);
1204 aphy->last_rssi = ATH_RSSI_DUMMY_MARKER;
1205
1206 ath_init_leds(sc);
1207 @@ -850,28 +844,17 @@ static void ath9k_deinit_softc(struct at
1208 void ath9k_deinit_device(struct ath_softc *sc)
1209 {
1210 struct ieee80211_hw *hw = sc->hw;
1211 - int i = 0;
1212
1213 ath9k_ps_wakeup(sc);
1214
1215 wiphy_rfkill_stop_polling(sc->hw->wiphy);
1216 ath_deinit_leds(sc);
1217
1218 - for (i = 0; i < sc->num_sec_wiphy; i++) {
1219 - struct ath_wiphy *aphy = sc->sec_wiphy[i];
1220 - if (aphy == NULL)
1221 - continue;
1222 - sc->sec_wiphy[i] = NULL;
1223 - ieee80211_unregister_hw(aphy->hw);
1224 - ieee80211_free_hw(aphy->hw);
1225 - }
1226 -
1227 ieee80211_unregister_hw(hw);
1228 pm_qos_remove_request(&sc->pm_qos_req);
1229 ath_rx_cleanup(sc);
1230 ath_tx_cleanup(sc);
1231 ath9k_deinit_softc(sc);
1232 - kfree(sc->sec_wiphy);
1233 }
1234
1235 void ath_descdma_cleanup(struct ath_softc *sc,
1236 --- a/drivers/net/wireless/ath/ath9k/pci.c
1237 +++ b/drivers/net/wireless/ath/ath9k/pci.c
1238 @@ -213,7 +213,6 @@ static int ath_pci_probe(struct pci_dev
1239 sc = (struct ath_softc *) (aphy + 1);
1240 aphy->sc = sc;
1241 aphy->hw = hw;
1242 - sc->pri_wiphy = aphy;
1243 sc->hw = hw;
1244 sc->dev = &pdev->dev;
1245 sc->mem = mem;
1246 @@ -320,7 +319,6 @@ static int ath_pci_resume(struct device
1247 ath9k_ps_restore(sc);
1248
1249 sc->ps_idle = true;
1250 - ath9k_set_wiphy_idle(aphy, true);
1251 ath_radio_disable(sc, hw);
1252
1253 return 0;
1254 --- a/drivers/net/wireless/ath/ath9k/ahb.c
1255 +++ b/drivers/net/wireless/ath/ath9k/ahb.c
1256 @@ -107,7 +107,6 @@ static int ath_ahb_probe(struct platform
1257 sc = (struct ath_softc *) (aphy + 1);
1258 aphy->sc = sc;
1259 aphy->hw = hw;
1260 - sc->pri_wiphy = aphy;
1261 sc->hw = hw;
1262 sc->dev = &pdev->dev;
1263 sc->mem = mem;
1264 --- a/drivers/net/wireless/ath/ath9k/beacon.c
1265 +++ b/drivers/net/wireless/ath/ath9k/beacon.c
1266 @@ -142,9 +142,6 @@ static struct ath_buf *ath_beacon_genera
1267 struct ieee80211_tx_info *info;
1268 int cabq_depth;
1269
1270 - if (aphy->state != ATH_WIPHY_ACTIVE)
1271 - return NULL;
1272 -
1273 avp = (void *)vif->drv_priv;
1274 cabq = sc->beacon.cabq;
1275
1276 @@ -261,7 +258,6 @@ int ath_beacon_alloc(struct ath_wiphy *a
1277 }
1278 BUG_ON(sc->beacon.bslot[avp->av_bslot] != NULL);
1279 sc->beacon.bslot[avp->av_bslot] = vif;
1280 - sc->beacon.bslot_aphy[avp->av_bslot] = aphy;
1281 sc->nbcnvifs++;
1282 }
1283 }
1284 @@ -332,7 +328,6 @@ void ath_beacon_return(struct ath_softc
1285
1286 if (avp->av_bslot != -1) {
1287 sc->beacon.bslot[avp->av_bslot] = NULL;
1288 - sc->beacon.bslot_aphy[avp->av_bslot] = NULL;
1289 sc->nbcnvifs--;
1290 }
1291
1292 @@ -358,7 +353,6 @@ void ath_beacon_tasklet(unsigned long da
1293 struct ath_common *common = ath9k_hw_common(ah);
1294 struct ath_buf *bf = NULL;
1295 struct ieee80211_vif *vif;
1296 - struct ath_wiphy *aphy;
1297 int slot;
1298 u32 bfaddr, bc = 0, tsftu;
1299 u64 tsf;
1300 @@ -416,7 +410,6 @@ void ath_beacon_tasklet(unsigned long da
1301 */
1302 slot = ATH_BCBUF - slot - 1;
1303 vif = sc->beacon.bslot[slot];
1304 - aphy = sc->beacon.bslot_aphy[slot];
1305
1306 ath_dbg(common, ATH_DBG_BEACON,
1307 "slot %d [tsf %llu tsftu %u intval %u] vif %p\n",
1308 @@ -424,7 +417,7 @@ void ath_beacon_tasklet(unsigned long da
1309
1310 bfaddr = 0;
1311 if (vif) {
1312 - bf = ath_beacon_generate(aphy->hw, vif);
1313 + bf = ath_beacon_generate(sc->hw, vif);
1314 if (bf != NULL) {
1315 bfaddr = bf->bf_daddr;
1316 bc = 1;
This page took 0.097752 seconds and 5 git commands to generate.