Root/package/mac80211/patches/310-pending_work.patch

1--- a/drivers/net/wireless/ath/ath9k/Makefile
2+++ b/drivers/net/wireless/ath/ath9k/Makefile
3@@ -4,7 +4,6 @@ ath9k-y += beacon.o \
4         main.o \
5         recv.o \
6         xmit.o \
7- virtual.o \
8 
9 ath9k-$(CONFIG_ATH9K_RATE_CONTROL) += rc.o
10 ath9k-$(CONFIG_PCI) += pci.o
11--- a/drivers/net/wireless/ath/ath9k/ahb.c
12+++ b/drivers/net/wireless/ath/ath9k/ahb.c
13@@ -54,7 +54,6 @@ static struct ath_bus_ops ath_ahb_bus_op
14 static int ath_ahb_probe(struct platform_device *pdev)
15 {
16     void __iomem *mem;
17- struct ath_wiphy *aphy;
18     struct ath_softc *sc;
19     struct ieee80211_hw *hw;
20     struct resource *res;
21@@ -92,8 +91,7 @@ static int ath_ahb_probe(struct platform
22 
23     irq = res->start;
24 
25- hw = ieee80211_alloc_hw(sizeof(struct ath_wiphy) +
26- sizeof(struct ath_softc), &ath9k_ops);
27+ hw = ieee80211_alloc_hw(sizeof(struct ath_softc), &ath9k_ops);
28     if (hw == NULL) {
29         dev_err(&pdev->dev, "no memory for ieee80211_hw\n");
30         ret = -ENOMEM;
31@@ -103,11 +101,7 @@ static int ath_ahb_probe(struct platform
32     SET_IEEE80211_DEV(hw, &pdev->dev);
33     platform_set_drvdata(pdev, hw);
34 
35- aphy = hw->priv;
36- sc = (struct ath_softc *) (aphy + 1);
37- aphy->sc = sc;
38- aphy->hw = hw;
39- sc->pri_wiphy = aphy;
40+ sc = hw->priv;
41     sc->hw = hw;
42     sc->dev = &pdev->dev;
43     sc->mem = mem;
44@@ -151,8 +145,7 @@ static int ath_ahb_remove(struct platfor
45     struct ieee80211_hw *hw = platform_get_drvdata(pdev);
46 
47     if (hw) {
48- struct ath_wiphy *aphy = hw->priv;
49- struct ath_softc *sc = aphy->sc;
50+ struct ath_softc *sc = hw->priv;
51         void __iomem *mem = sc->mem;
52 
53         ath9k_deinit_device(sc);
54--- a/drivers/net/wireless/ath/ath9k/ath9k.h
55+++ b/drivers/net/wireless/ath/ath9k/ath9k.h
56@@ -234,7 +234,6 @@ struct ath_buf {
57     bool bf_stale;
58     u16 bf_flags;
59     struct ath_buf_state bf_state;
60- struct ath_wiphy *aphy;
61 };
62 
63 struct ath_atx_tid {
64@@ -389,7 +388,6 @@ struct ath_beacon {
65     u32 ast_be_xmit;
66     u64 bc_tstamp;
67     struct ieee80211_vif *bslot[ATH_BCBUF];
68- struct ath_wiphy *bslot_aphy[ATH_BCBUF];
69     int slottime;
70     int slotupdate;
71     struct ath9k_tx_queue_info beacon_qi;
72@@ -400,7 +398,7 @@ struct ath_beacon {
73 
74 void ath_beacon_tasklet(unsigned long data);
75 void ath_beacon_config(struct ath_softc *sc, struct ieee80211_vif *vif);
76-int ath_beacon_alloc(struct ath_wiphy *aphy, struct ieee80211_vif *vif);
77+int ath_beacon_alloc(struct ath_softc *sc, struct ieee80211_vif *vif);
78 void ath_beacon_return(struct ath_softc *sc, struct ath_vif *avp);
79 int ath_beaconq_config(struct ath_softc *sc);
80 
81@@ -565,7 +563,6 @@ struct ath_ant_comb {
82 #define PS_WAIT_FOR_TX_ACK BIT(3)
83 #define PS_BEACON_SYNC BIT(4)
84 
85-struct ath_wiphy;
86 struct ath_rate_table;
87 
88 struct ath9k_vif_iter_data {
89@@ -586,20 +583,8 @@ struct ath_softc {
90     struct ieee80211_hw *hw;
91     struct device *dev;
92 
93- spinlock_t wiphy_lock; /* spinlock to protect ath_wiphy data */
94- struct ath_wiphy *pri_wiphy;
95- struct ath_wiphy **sec_wiphy; /* secondary wiphys (virtual radios); may
96- * have NULL entries */
97- int num_sec_wiphy; /* number of sec_wiphy pointers in the array */
98     int chan_idx;
99     int chan_is_ht;
100- struct ath_wiphy *next_wiphy;
101- struct work_struct chan_work;
102- int wiphy_select_failures;
103- unsigned long wiphy_select_first_fail;
104- struct delayed_work wiphy_work;
105- unsigned long wiphy_scheduler_int;
106- int wiphy_scheduler_index;
107     struct survey_info *cur_survey;
108     struct survey_info survey[ATH9K_NUM_CHANNELS];
109 
110@@ -643,6 +628,9 @@ struct ath_softc {
111     int led_on_cnt;
112     int led_off_cnt;
113 
114+ struct ath9k_hw_cal_data caldata;
115+ int last_rssi;
116+
117     int beacon_interval;
118 
119 #ifdef CONFIG_ATH9K_DEBUGFS
120@@ -662,23 +650,6 @@ struct ath_softc {
121     struct pm_qos_request_list pm_qos_req;
122 };
123 
124-struct ath_wiphy {
125- struct ath_softc *sc; /* shared for all virtual wiphys */
126- struct ieee80211_hw *hw;
127- struct ath9k_hw_cal_data caldata;
128- enum ath_wiphy_state {
129- ATH_WIPHY_INACTIVE,
130- ATH_WIPHY_ACTIVE,
131- ATH_WIPHY_PAUSING,
132- ATH_WIPHY_PAUSED,
133- ATH_WIPHY_SCAN,
134- } state;
135- bool idle;
136- int chan_idx;
137- int chan_is_ht;
138- int last_rssi;
139-};
140-
141 void ath9k_tasklet(unsigned long data);
142 int ath_reset(struct ath_softc *sc, bool retry_tx);
143 int ath_cabq_update(struct ath_softc *);
144@@ -732,24 +703,6 @@ void ath9k_ps_restore(struct ath_softc *
145 u8 ath_txchainmask_reduction(struct ath_softc *sc, u8 chainmask, u32 rate);
146 
147 void ath9k_set_bssid_mask(struct ieee80211_hw *hw, struct ieee80211_vif *vif);
148-int ath9k_wiphy_add(struct ath_softc *sc);
149-int ath9k_wiphy_del(struct ath_wiphy *aphy);
150-void ath9k_tx_status(struct ieee80211_hw *hw, struct sk_buff *skb, int ftype);
151-int ath9k_wiphy_pause(struct ath_wiphy *aphy);
152-int ath9k_wiphy_unpause(struct ath_wiphy *aphy);
153-int ath9k_wiphy_select(struct ath_wiphy *aphy);
154-void ath9k_wiphy_set_scheduler(struct ath_softc *sc, unsigned int msec_int);
155-void ath9k_wiphy_chan_work(struct work_struct *work);
156-bool ath9k_wiphy_started(struct ath_softc *sc);
157-void ath9k_wiphy_pause_all_forced(struct ath_softc *sc,
158- struct ath_wiphy *selected);
159-bool ath9k_wiphy_scanning(struct ath_softc *sc);
160-void ath9k_wiphy_work(struct work_struct *work);
161-bool ath9k_all_wiphys_idle(struct ath_softc *sc);
162-void ath9k_set_wiphy_idle(struct ath_wiphy *aphy, bool idle);
163-
164-void ath_mac80211_stop_queue(struct ath_softc *sc, u16 skb_queue);
165-bool ath_mac80211_start_queue(struct ath_softc *sc, u16 skb_queue);
166 
167 void ath_start_rfkill_poll(struct ath_softc *sc);
168 extern void ath9k_rfkill_poll_state(struct ieee80211_hw *hw);
169--- a/drivers/net/wireless/ath/ath9k/beacon.c
170+++ b/drivers/net/wireless/ath/ath9k/beacon.c
171@@ -112,8 +112,7 @@ static void ath_beacon_setup(struct ath_
172 
173 static void ath_tx_cabq(struct ieee80211_hw *hw, struct sk_buff *skb)
174 {
175- struct ath_wiphy *aphy = hw->priv;
176- struct ath_softc *sc = aphy->sc;
177+ struct ath_softc *sc = hw->priv;
178     struct ath_common *common = ath9k_hw_common(sc->sc_ah);
179     struct ath_tx_control txctl;
180 
181@@ -132,8 +131,7 @@ static void ath_tx_cabq(struct ieee80211
182 static struct ath_buf *ath_beacon_generate(struct ieee80211_hw *hw,
183                        struct ieee80211_vif *vif)
184 {
185- struct ath_wiphy *aphy = hw->priv;
186- struct ath_softc *sc = aphy->sc;
187+ struct ath_softc *sc = hw->priv;
188     struct ath_common *common = ath9k_hw_common(sc->sc_ah);
189     struct ath_buf *bf;
190     struct ath_vif *avp;
191@@ -142,9 +140,6 @@ static struct ath_buf *ath_beacon_genera
192     struct ieee80211_tx_info *info;
193     int cabq_depth;
194 
195- if (aphy->state != ATH_WIPHY_ACTIVE)
196- return NULL;
197-
198     avp = (void *)vif->drv_priv;
199     cabq = sc->beacon.cabq;
200 
201@@ -225,9 +220,8 @@ static struct ath_buf *ath_beacon_genera
202     return bf;
203 }
204 
205-int ath_beacon_alloc(struct ath_wiphy *aphy, struct ieee80211_vif *vif)
206+int ath_beacon_alloc(struct ath_softc *sc, struct ieee80211_vif *vif)
207 {
208- struct ath_softc *sc = aphy->sc;
209     struct ath_common *common = ath9k_hw_common(sc->sc_ah);
210     struct ath_vif *avp;
211     struct ath_buf *bf;
212@@ -261,7 +255,6 @@ int ath_beacon_alloc(struct ath_wiphy *a
213                 }
214             BUG_ON(sc->beacon.bslot[avp->av_bslot] != NULL);
215             sc->beacon.bslot[avp->av_bslot] = vif;
216- sc->beacon.bslot_aphy[avp->av_bslot] = aphy;
217             sc->nbcnvifs++;
218         }
219     }
220@@ -332,7 +325,6 @@ void ath_beacon_return(struct ath_softc
221 
222         if (avp->av_bslot != -1) {
223             sc->beacon.bslot[avp->av_bslot] = NULL;
224- sc->beacon.bslot_aphy[avp->av_bslot] = NULL;
225             sc->nbcnvifs--;
226         }
227 
228@@ -358,7 +350,6 @@ void ath_beacon_tasklet(unsigned long da
229     struct ath_common *common = ath9k_hw_common(ah);
230     struct ath_buf *bf = NULL;
231     struct ieee80211_vif *vif;
232- struct ath_wiphy *aphy;
233     int slot;
234     u32 bfaddr, bc = 0, tsftu;
235     u64 tsf;
236@@ -416,7 +407,6 @@ void ath_beacon_tasklet(unsigned long da
237      */
238     slot = ATH_BCBUF - slot - 1;
239     vif = sc->beacon.bslot[slot];
240- aphy = sc->beacon.bslot_aphy[slot];
241 
242     ath_dbg(common, ATH_DBG_BEACON,
243         "slot %d [tsf %llu tsftu %u intval %u] vif %p\n",
244@@ -424,7 +414,7 @@ void ath_beacon_tasklet(unsigned long da
245 
246     bfaddr = 0;
247     if (vif) {
248- bf = ath_beacon_generate(aphy->hw, vif);
249+ bf = ath_beacon_generate(sc->hw, vif);
250         if (bf != NULL) {
251             bfaddr = bf->bf_daddr;
252             bc = 1;
253--- a/drivers/net/wireless/ath/ath9k/debug.c
254+++ b/drivers/net/wireless/ath/ath9k/debug.c
255@@ -381,41 +381,21 @@ static const struct file_operations fops
256     .llseek = default_llseek,
257 };
258 
259-static const char * ath_wiphy_state_str(enum ath_wiphy_state state)
260-{
261- switch (state) {
262- case ATH_WIPHY_INACTIVE:
263- return "INACTIVE";
264- case ATH_WIPHY_ACTIVE:
265- return "ACTIVE";
266- case ATH_WIPHY_PAUSING:
267- return "PAUSING";
268- case ATH_WIPHY_PAUSED:
269- return "PAUSED";
270- case ATH_WIPHY_SCAN:
271- return "SCAN";
272- }
273- return "?";
274-}
275-
276 static ssize_t read_file_wiphy(struct file *file, char __user *user_buf,
277                    size_t count, loff_t *ppos)
278 {
279     struct ath_softc *sc = file->private_data;
280- struct ath_wiphy *aphy = sc->pri_wiphy;
281- struct ieee80211_channel *chan = aphy->hw->conf.channel;
282+ struct ieee80211_channel *chan = sc->hw->conf.channel;
283     char buf[512];
284     unsigned int len = 0;
285- int i;
286     u8 addr[ETH_ALEN];
287     u32 tmp;
288 
289     len += snprintf(buf + len, sizeof(buf) - len,
290- "primary: %s (%s chan=%d ht=%d)\n",
291- wiphy_name(sc->pri_wiphy->hw->wiphy),
292- ath_wiphy_state_str(sc->pri_wiphy->state),
293+ "%s (chan=%d ht=%d)\n",
294+ wiphy_name(sc->hw->wiphy),
295             ieee80211_frequency_to_channel(chan->center_freq),
296- aphy->chan_is_ht);
297+ conf_is_ht(&sc->hw->conf));
298 
299     put_unaligned_le32(REG_READ_D(sc->sc_ah, AR_STA_ID0), addr);
300     put_unaligned_le16(REG_READ_D(sc->sc_ah, AR_STA_ID1) & 0xffff, addr + 4);
301@@ -457,123 +437,14 @@ static ssize_t read_file_wiphy(struct fi
302     else
303         len += snprintf(buf + len, sizeof(buf) - len, "\n");
304 
305- /* Put variable-length stuff down here, and check for overflows. */
306- for (i = 0; i < sc->num_sec_wiphy; i++) {
307- struct ath_wiphy *aphy_tmp = sc->sec_wiphy[i];
308- if (aphy_tmp == NULL)
309- continue;
310- chan = aphy_tmp->hw->conf.channel;
311- len += snprintf(buf + len, sizeof(buf) - len,
312- "secondary: %s (%s chan=%d ht=%d)\n",
313- wiphy_name(aphy_tmp->hw->wiphy),
314- ath_wiphy_state_str(aphy_tmp->state),
315- ieee80211_frequency_to_channel(chan->center_freq),
316- aphy_tmp->chan_is_ht);
317- }
318     if (len > sizeof(buf))
319         len = sizeof(buf);
320 
321     return simple_read_from_buffer(user_buf, count, ppos, buf, len);
322 }
323 
324-static struct ath_wiphy * get_wiphy(struct ath_softc *sc, const char *name)
325-{
326- int i;
327- if (strcmp(name, wiphy_name(sc->pri_wiphy->hw->wiphy)) == 0)
328- return sc->pri_wiphy;
329- for (i = 0; i < sc->num_sec_wiphy; i++) {
330- struct ath_wiphy *aphy = sc->sec_wiphy[i];
331- if (aphy && strcmp(name, wiphy_name(aphy->hw->wiphy)) == 0)
332- return aphy;
333- }
334- return NULL;
335-}
336-
337-static int del_wiphy(struct ath_softc *sc, const char *name)
338-{
339- struct ath_wiphy *aphy = get_wiphy(sc, name);
340- if (!aphy)
341- return -ENOENT;
342- return ath9k_wiphy_del(aphy);
343-}
344-
345-static int pause_wiphy(struct ath_softc *sc, const char *name)
346-{
347- struct ath_wiphy *aphy = get_wiphy(sc, name);
348- if (!aphy)
349- return -ENOENT;
350- return ath9k_wiphy_pause(aphy);
351-}
352-
353-static int unpause_wiphy(struct ath_softc *sc, const char *name)
354-{
355- struct ath_wiphy *aphy = get_wiphy(sc, name);
356- if (!aphy)
357- return -ENOENT;
358- return ath9k_wiphy_unpause(aphy);
359-}
360-
361-static int select_wiphy(struct ath_softc *sc, const char *name)
362-{
363- struct ath_wiphy *aphy = get_wiphy(sc, name);
364- if (!aphy)
365- return -ENOENT;
366- return ath9k_wiphy_select(aphy);
367-}
368-
369-static int schedule_wiphy(struct ath_softc *sc, const char *msec)
370-{
371- ath9k_wiphy_set_scheduler(sc, simple_strtoul(msec, NULL, 0));
372- return 0;
373-}
374-
375-static ssize_t write_file_wiphy(struct file *file, const char __user *user_buf,
376- size_t count, loff_t *ppos)
377-{
378- struct ath_softc *sc = file->private_data;
379- char buf[50];
380- size_t len;
381-
382- len = min(count, sizeof(buf) - 1);
383- if (copy_from_user(buf, user_buf, len))
384- return -EFAULT;
385- buf[len] = '\0';
386- if (len > 0 && buf[len - 1] == '\n')
387- buf[len - 1] = '\0';
388-
389- if (strncmp(buf, "add", 3) == 0) {
390- int res = ath9k_wiphy_add(sc);
391- if (res < 0)
392- return res;
393- } else if (strncmp(buf, "del=", 4) == 0) {
394- int res = del_wiphy(sc, buf + 4);
395- if (res < 0)
396- return res;
397- } else if (strncmp(buf, "pause=", 6) == 0) {
398- int res = pause_wiphy(sc, buf + 6);
399- if (res < 0)
400- return res;
401- } else if (strncmp(buf, "unpause=", 8) == 0) {
402- int res = unpause_wiphy(sc, buf + 8);
403- if (res < 0)
404- return res;
405- } else if (strncmp(buf, "select=", 7) == 0) {
406- int res = select_wiphy(sc, buf + 7);
407- if (res < 0)
408- return res;
409- } else if (strncmp(buf, "schedule=", 9) == 0) {
410- int res = schedule_wiphy(sc, buf + 9);
411- if (res < 0)
412- return res;
413- } else
414- return -EOPNOTSUPP;
415-
416- return count;
417-}
418-
419 static const struct file_operations fops_wiphy = {
420     .read = read_file_wiphy,
421- .write = write_file_wiphy,
422     .open = ath9k_debugfs_open,
423     .owner = THIS_MODULE,
424     .llseek = default_llseek,
425--- a/drivers/net/wireless/ath/ath9k/gpio.c
426+++ b/drivers/net/wireless/ath/ath9k/gpio.c
427@@ -201,8 +201,7 @@ static bool ath_is_rfkill_set(struct ath
428 
429 void ath9k_rfkill_poll_state(struct ieee80211_hw *hw)
430 {
431- struct ath_wiphy *aphy = hw->priv;
432- struct ath_softc *sc = aphy->sc;
433+ struct ath_softc *sc = hw->priv;
434     bool blocked = !!ath_is_rfkill_set(sc);
435 
436     wiphy_rfkill_set_hw_state(hw->wiphy, blocked);
437--- a/drivers/net/wireless/ath/ath9k/init.c
438+++ b/drivers/net/wireless/ath/ath9k/init.c
439@@ -254,8 +254,7 @@ static int ath9k_reg_notifier(struct wip
440                   struct regulatory_request *request)
441 {
442     struct ieee80211_hw *hw = wiphy_to_ieee80211_hw(wiphy);
443- struct ath_wiphy *aphy = hw->priv;
444- struct ath_softc *sc = aphy->sc;
445+ struct ath_softc *sc = hw->priv;
446     struct ath_regulatory *reg = ath9k_hw_regulatory(sc->sc_ah);
447 
448     return ath_reg_notifier_apply(wiphy, request, reg);
449@@ -517,10 +516,8 @@ static void ath9k_init_misc(struct ath_s
450 
451     sc->beacon.slottime = ATH9K_SLOT_TIME_9;
452 
453- for (i = 0; i < ARRAY_SIZE(sc->beacon.bslot); i++) {
454+ for (i = 0; i < ARRAY_SIZE(sc->beacon.bslot); i++)
455         sc->beacon.bslot[i] = NULL;
456- sc->beacon.bslot_aphy[i] = NULL;
457- }
458 
459     if (sc->sc_ah->caps.hw_caps & ATH9K_HW_CAP_ANT_DIV_COMB)
460         sc->ant_comb.count = ATH_ANT_DIV_COMB_INIT_COUNT;
461@@ -556,7 +553,6 @@ static int ath9k_init_softc(u16 devid, s
462     common->btcoex_enabled = ath9k_btcoex_enable == 1;
463     spin_lock_init(&common->cc_lock);
464 
465- spin_lock_init(&sc->wiphy_lock);
466     spin_lock_init(&sc->sc_serial_rw);
467     spin_lock_init(&sc->sc_pm_lock);
468     mutex_init(&sc->mutex);
469@@ -707,7 +703,6 @@ int ath9k_init_device(u16 devid, struct
470             const struct ath_bus_ops *bus_ops)
471 {
472     struct ieee80211_hw *hw = sc->hw;
473- struct ath_wiphy *aphy = hw->priv;
474     struct ath_common *common;
475     struct ath_hw *ah;
476     int error = 0;
477@@ -762,10 +757,7 @@ int ath9k_init_device(u16 devid, struct
478 
479     INIT_WORK(&sc->hw_check_work, ath_hw_check);
480     INIT_WORK(&sc->paprd_work, ath_paprd_calibrate);
481- INIT_WORK(&sc->chan_work, ath9k_wiphy_chan_work);
482- INIT_DELAYED_WORK(&sc->wiphy_work, ath9k_wiphy_work);
483- sc->wiphy_scheduler_int = msecs_to_jiffies(500);
484- aphy->last_rssi = ATH_RSSI_DUMMY_MARKER;
485+ sc->last_rssi = ATH_RSSI_DUMMY_MARKER;
486 
487     ath_init_leds(sc);
488     ath_start_rfkill_poll(sc);
489@@ -823,28 +815,17 @@ static void ath9k_deinit_softc(struct at
490 void ath9k_deinit_device(struct ath_softc *sc)
491 {
492     struct ieee80211_hw *hw = sc->hw;
493- int i = 0;
494 
495     ath9k_ps_wakeup(sc);
496 
497     wiphy_rfkill_stop_polling(sc->hw->wiphy);
498     ath_deinit_leds(sc);
499 
500- for (i = 0; i < sc->num_sec_wiphy; i++) {
501- struct ath_wiphy *aphy = sc->sec_wiphy[i];
502- if (aphy == NULL)
503- continue;
504- sc->sec_wiphy[i] = NULL;
505- ieee80211_unregister_hw(aphy->hw);
506- ieee80211_free_hw(aphy->hw);
507- }
508-
509     ieee80211_unregister_hw(hw);
510     pm_qos_remove_request(&sc->pm_qos_req);
511     ath_rx_cleanup(sc);
512     ath_tx_cleanup(sc);
513     ath9k_deinit_softc(sc);
514- kfree(sc->sec_wiphy);
515 }
516 
517 void ath_descdma_cleanup(struct ath_softc *sc,
518--- a/drivers/net/wireless/ath/ath9k/main.c
519+++ b/drivers/net/wireless/ath/ath9k/main.c
520@@ -215,7 +215,6 @@ static void ath_update_survey_stats(stru
521 int ath_set_channel(struct ath_softc *sc, struct ieee80211_hw *hw,
522             struct ath9k_channel *hchan)
523 {
524- struct ath_wiphy *aphy = hw->priv;
525     struct ath_hw *ah = sc->sc_ah;
526     struct ath_common *common = ath9k_hw_common(ah);
527     struct ieee80211_conf *conf = &common->hw->conf;
528@@ -262,7 +261,7 @@ int ath_set_channel(struct ath_softc *sc
529         fastcc = false;
530 
531     if (!(sc->sc_flags & SC_OP_OFFCHANNEL))
532- caldata = &aphy->caldata;
533+ caldata = &sc->caldata;
534 
535     ath_dbg(common, ATH_DBG_CONFIG,
536         "(%u MHz) -> (%u MHz), conf_is_ht40: %d fastcc: %d\n",
537@@ -295,6 +294,8 @@ int ath_set_channel(struct ath_softc *sc
538     }
539 
540  ps_restore:
541+ ieee80211_wake_queues(hw);
542+
543     spin_unlock_bh(&sc->sc_pcu_lock);
544 
545     ath9k_ps_restore(sc);
546@@ -850,7 +851,6 @@ static void ath9k_bss_assoc_info(struct
547                  struct ieee80211_vif *vif,
548                  struct ieee80211_bss_conf *bss_conf)
549 {
550- struct ath_wiphy *aphy = hw->priv;
551     struct ath_hw *ah = sc->sc_ah;
552     struct ath_common *common = ath9k_hw_common(ah);
553 
554@@ -874,7 +874,7 @@ static void ath9k_bss_assoc_info(struct
555         ath_beacon_config(sc, vif);
556 
557         /* Reset rssi stats */
558- aphy->last_rssi = ATH_RSSI_DUMMY_MARKER;
559+ sc->last_rssi = ATH_RSSI_DUMMY_MARKER;
560         sc->sc_ah->stats.avgbrssi = ATH_RSSI_DUMMY_MARKER;
561 
562         sc->sc_flags |= SC_OP_ANI_RUN;
563@@ -1073,8 +1073,7 @@ void ath9k_update_ichannel(struct ath_so
564 
565 static int ath9k_start(struct ieee80211_hw *hw)
566 {
567- struct ath_wiphy *aphy = hw->priv;
568- struct ath_softc *sc = aphy->sc;
569+ struct ath_softc *sc = hw->priv;
570     struct ath_hw *ah = sc->sc_ah;
571     struct ath_common *common = ath9k_hw_common(ah);
572     struct ieee80211_channel *curchan = hw->conf.channel;
573@@ -1087,29 +1086,7 @@ static int ath9k_start(struct ieee80211_
574 
575     mutex_lock(&sc->mutex);
576 
577- if (ath9k_wiphy_started(sc)) {
578- if (sc->chan_idx == curchan->hw_value) {
579- /*
580- * Already on the operational channel, the new wiphy
581- * can be marked active.
582- */
583- aphy->state = ATH_WIPHY_ACTIVE;
584- ieee80211_wake_queues(hw);
585- } else {
586- /*
587- * Another wiphy is on another channel, start the new
588- * wiphy in paused state.
589- */
590- aphy->state = ATH_WIPHY_PAUSED;
591- ieee80211_stop_queues(hw);
592- }
593- mutex_unlock(&sc->mutex);
594- return 0;
595- }
596- aphy->state = ATH_WIPHY_ACTIVE;
597-
598     /* setup initial channel */
599-
600     sc->chan_idx = curchan->hw_value;
601 
602     init_channel = ath_get_curchannel(sc, hw);
603@@ -1213,19 +1190,11 @@ mutex_unlock:
604 static int ath9k_tx(struct ieee80211_hw *hw,
605             struct sk_buff *skb)
606 {
607- struct ath_wiphy *aphy = hw->priv;
608- struct ath_softc *sc = aphy->sc;
609+ struct ath_softc *sc = hw->priv;
610     struct ath_common *common = ath9k_hw_common(sc->sc_ah);
611     struct ath_tx_control txctl;
612     struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) skb->data;
613 
614- if (aphy->state != ATH_WIPHY_ACTIVE && aphy->state != ATH_WIPHY_SCAN) {
615- ath_dbg(common, ATH_DBG_XMIT,
616- "ath9k: %s: TX in unexpected wiphy state %d\n",
617- wiphy_name(hw->wiphy), aphy->state);
618- goto exit;
619- }
620-
621     if (sc->ps_enabled) {
622         /*
623          * mac80211 does not set PM field for normal data frames, so we
624@@ -1284,16 +1253,12 @@ exit:
625 
626 static void ath9k_stop(struct ieee80211_hw *hw)
627 {
628- struct ath_wiphy *aphy = hw->priv;
629- struct ath_softc *sc = aphy->sc;
630+ struct ath_softc *sc = hw->priv;
631     struct ath_hw *ah = sc->sc_ah;
632     struct ath_common *common = ath9k_hw_common(ah);
633- int i;
634 
635     mutex_lock(&sc->mutex);
636 
637- aphy->state = ATH_WIPHY_INACTIVE;
638-
639     if (led_blink)
640         cancel_delayed_work_sync(&sc->ath_led_blink_work);
641 
642@@ -1301,27 +1266,12 @@ static void ath9k_stop(struct ieee80211_
643     cancel_work_sync(&sc->paprd_work);
644     cancel_work_sync(&sc->hw_check_work);
645 
646- for (i = 0; i < sc->num_sec_wiphy; i++) {
647- if (sc->sec_wiphy[i])
648- break;
649- }
650-
651- if (i == sc->num_sec_wiphy) {
652- cancel_delayed_work_sync(&sc->wiphy_work);
653- cancel_work_sync(&sc->chan_work);
654- }
655-
656     if (sc->sc_flags & SC_OP_INVALID) {
657         ath_dbg(common, ATH_DBG_ANY, "Device not present\n");
658         mutex_unlock(&sc->mutex);
659         return;
660     }
661 
662- if (ath9k_wiphy_started(sc)) {
663- mutex_unlock(&sc->mutex);
664- return; /* another wiphy still in use */
665- }
666-
667     /* Ensure HW is awake when we try to shut it down. */
668     ath9k_ps_wakeup(sc);
669 
670@@ -1353,7 +1303,6 @@ static void ath9k_stop(struct ieee80211_
671     ath9k_ps_restore(sc);
672 
673     sc->ps_idle = true;
674- ath9k_set_wiphy_idle(aphy, true);
675     ath_radio_disable(sc, hw);
676 
677     sc->sc_flags |= SC_OP_INVALID;
678@@ -1439,11 +1388,9 @@ void ath9k_calculate_iter_data(struct ie
679                    struct ieee80211_vif *vif,
680                    struct ath9k_vif_iter_data *iter_data)
681 {
682- struct ath_wiphy *aphy = hw->priv;
683- struct ath_softc *sc = aphy->sc;
684+ struct ath_softc *sc = hw->priv;
685     struct ath_hw *ah = sc->sc_ah;
686     struct ath_common *common = ath9k_hw_common(ah);
687- int i;
688 
689     /*
690      * Use the hardware MAC address as reference, the hardware uses it
691@@ -1457,24 +1404,15 @@ void ath9k_calculate_iter_data(struct ie
692         ath9k_vif_iter(iter_data, vif->addr, vif);
693 
694     /* Get list of all active MAC addresses */
695- spin_lock_bh(&sc->wiphy_lock);
696     ieee80211_iterate_active_interfaces_atomic(sc->hw, ath9k_vif_iter,
697                            iter_data);
698- for (i = 0; i < sc->num_sec_wiphy; i++) {
699- if (sc->sec_wiphy[i] == NULL)
700- continue;
701- ieee80211_iterate_active_interfaces_atomic(
702- sc->sec_wiphy[i]->hw, ath9k_vif_iter, iter_data);
703- }
704- spin_unlock_bh(&sc->wiphy_lock);
705 }
706 
707 /* Called with sc->mutex held. */
708 static void ath9k_calculate_summary_state(struct ieee80211_hw *hw,
709                       struct ieee80211_vif *vif)
710 {
711- struct ath_wiphy *aphy = hw->priv;
712- struct ath_softc *sc = aphy->sc;
713+ struct ath_softc *sc = hw->priv;
714     struct ath_hw *ah = sc->sc_ah;
715     struct ath_common *common = ath9k_hw_common(ah);
716     struct ath9k_vif_iter_data iter_data;
717@@ -1530,8 +1468,7 @@ static void ath9k_calculate_summary_stat
718 static void ath9k_do_vif_add_setup(struct ieee80211_hw *hw,
719                    struct ieee80211_vif *vif)
720 {
721- struct ath_wiphy *aphy = hw->priv;
722- struct ath_softc *sc = aphy->sc;
723+ struct ath_softc *sc = hw->priv;
724 
725     ath9k_calculate_summary_state(hw, vif);
726 
727@@ -1544,7 +1481,7 @@ static void ath9k_do_vif_add_setup(struc
728          * in the info_changed method and set up beacons properly
729          * there.
730          */
731- error = ath_beacon_alloc(aphy, vif);
732+ error = ath_beacon_alloc(sc, vif);
733         if (error)
734             ath9k_reclaim_beacon(sc, vif);
735         else
736@@ -1556,8 +1493,7 @@ static void ath9k_do_vif_add_setup(struc
737 static int ath9k_add_interface(struct ieee80211_hw *hw,
738                    struct ieee80211_vif *vif)
739 {
740- struct ath_wiphy *aphy = hw->priv;
741- struct ath_softc *sc = aphy->sc;
742+ struct ath_softc *sc = hw->priv;
743     struct ath_hw *ah = sc->sc_ah;
744     struct ath_common *common = ath9k_hw_common(ah);
745     struct ath_vif *avp = (void *)vif->drv_priv;
746@@ -1617,8 +1553,7 @@ static int ath9k_change_interface(struct
747                   enum nl80211_iftype new_type,
748                   bool p2p)
749 {
750- struct ath_wiphy *aphy = hw->priv;
751- struct ath_softc *sc = aphy->sc;
752+ struct ath_softc *sc = hw->priv;
753     struct ath_common *common = ath9k_hw_common(sc->sc_ah);
754     int ret = 0;
755 
756@@ -1660,8 +1595,7 @@ out:
757 static void ath9k_remove_interface(struct ieee80211_hw *hw,
758                    struct ieee80211_vif *vif)
759 {
760- struct ath_wiphy *aphy = hw->priv;
761- struct ath_softc *sc = aphy->sc;
762+ struct ath_softc *sc = hw->priv;
763     struct ath_common *common = ath9k_hw_common(sc->sc_ah);
764 
765     ath_dbg(common, ATH_DBG_CONFIG, "Detach Interface\n");
766@@ -1715,12 +1649,11 @@ static void ath9k_disable_ps(struct ath_
767 
768 static int ath9k_config(struct ieee80211_hw *hw, u32 changed)
769 {
770- struct ath_wiphy *aphy = hw->priv;
771- struct ath_softc *sc = aphy->sc;
772+ struct ath_softc *sc = hw->priv;
773     struct ath_hw *ah = sc->sc_ah;
774     struct ath_common *common = ath9k_hw_common(ah);
775     struct ieee80211_conf *conf = &hw->conf;
776- bool disable_radio;
777+ bool disable_radio = false;
778 
779     mutex_lock(&sc->mutex);
780 
781@@ -1731,29 +1664,13 @@ static int ath9k_config(struct ieee80211
782      * the end.
783      */
784     if (changed & IEEE80211_CONF_CHANGE_IDLE) {
785- bool enable_radio;
786- bool all_wiphys_idle;
787- bool idle = !!(conf->flags & IEEE80211_CONF_IDLE);
788-
789- spin_lock_bh(&sc->wiphy_lock);
790- all_wiphys_idle = ath9k_all_wiphys_idle(sc);
791- ath9k_set_wiphy_idle(aphy, idle);
792-
793- enable_radio = (!idle && all_wiphys_idle);
794-
795- /*
796- * After we unlock here its possible another wiphy
797- * can be re-renabled so to account for that we will
798- * only disable the radio toward the end of this routine
799- * if by then all wiphys are still idle.
800- */
801- spin_unlock_bh(&sc->wiphy_lock);
802-
803- if (enable_radio) {
804- sc->ps_idle = false;
805+ sc->ps_idle = !!(conf->flags & IEEE80211_CONF_IDLE);
806+ if (!sc->ps_idle) {
807             ath_radio_enable(sc, hw);
808             ath_dbg(common, ATH_DBG_CONFIG,
809                 "not-idle: enabling radio\n");
810+ } else {
811+ disable_radio = true;
812         }
813     }
814 
815@@ -1794,24 +1711,11 @@ static int ath9k_config(struct ieee80211
816         if (ah->curchan)
817             old_pos = ah->curchan - &ah->channels[0];
818 
819- aphy->chan_idx = pos;
820- aphy->chan_is_ht = conf_is_ht(conf);
821         if (hw->conf.flags & IEEE80211_CONF_OFFCHANNEL)
822             sc->sc_flags |= SC_OP_OFFCHANNEL;
823         else
824             sc->sc_flags &= ~SC_OP_OFFCHANNEL;
825 
826- if (aphy->state == ATH_WIPHY_SCAN ||
827- aphy->state == ATH_WIPHY_ACTIVE)
828- ath9k_wiphy_pause_all_forced(sc, aphy);
829- else {
830- /*
831- * Do not change operational channel based on a paused
832- * wiphy changes.
833- */
834- goto skip_chan_change;
835- }
836-
837         ath_dbg(common, ATH_DBG_CONFIG, "Set channel: %d MHz\n",
838             curchan->center_freq);
839 
840@@ -1858,7 +1762,6 @@ static int ath9k_config(struct ieee80211
841             ath_update_survey_nf(sc, old_pos);
842     }
843 
844-skip_chan_change:
845     if (changed & IEEE80211_CONF_CHANGE_POWER) {
846         sc->config.txpowlimit = 2 * conf->power_level;
847         ath9k_ps_wakeup(sc);
848@@ -1866,13 +1769,8 @@ skip_chan_change:
849         ath9k_ps_restore(sc);
850     }
851 
852- spin_lock_bh(&sc->wiphy_lock);
853- disable_radio = ath9k_all_wiphys_idle(sc);
854- spin_unlock_bh(&sc->wiphy_lock);
855-
856     if (disable_radio) {
857         ath_dbg(common, ATH_DBG_CONFIG, "idle: disabling radio\n");
858- sc->ps_idle = true;
859         ath_radio_disable(sc, hw);
860     }
861 
862@@ -1897,8 +1795,7 @@ static void ath9k_configure_filter(struc
863                    unsigned int *total_flags,
864                    u64 multicast)
865 {
866- struct ath_wiphy *aphy = hw->priv;
867- struct ath_softc *sc = aphy->sc;
868+ struct ath_softc *sc = hw->priv;
869     u32 rfilt;
870 
871     changed_flags &= SUPPORTED_FILTERS;
872@@ -1918,8 +1815,7 @@ static int ath9k_sta_add(struct ieee8021
873              struct ieee80211_vif *vif,
874              struct ieee80211_sta *sta)
875 {
876- struct ath_wiphy *aphy = hw->priv;
877- struct ath_softc *sc = aphy->sc;
878+ struct ath_softc *sc = hw->priv;
879 
880     ath_node_attach(sc, sta);
881 
882@@ -1930,8 +1826,7 @@ static int ath9k_sta_remove(struct ieee8
883                 struct ieee80211_vif *vif,
884                 struct ieee80211_sta *sta)
885 {
886- struct ath_wiphy *aphy = hw->priv;
887- struct ath_softc *sc = aphy->sc;
888+ struct ath_softc *sc = hw->priv;
889 
890     ath_node_detach(sc, sta);
891 
892@@ -1941,8 +1836,7 @@ static int ath9k_sta_remove(struct ieee8
893 static int ath9k_conf_tx(struct ieee80211_hw *hw, u16 queue,
894              const struct ieee80211_tx_queue_params *params)
895 {
896- struct ath_wiphy *aphy = hw->priv;
897- struct ath_softc *sc = aphy->sc;
898+ struct ath_softc *sc = hw->priv;
899     struct ath_common *common = ath9k_hw_common(sc->sc_ah);
900     struct ath_txq *txq;
901     struct ath9k_tx_queue_info qi;
902@@ -1986,8 +1880,7 @@ static int ath9k_set_key(struct ieee8021
903              struct ieee80211_sta *sta,
904              struct ieee80211_key_conf *key)
905 {
906- struct ath_wiphy *aphy = hw->priv;
907- struct ath_softc *sc = aphy->sc;
908+ struct ath_softc *sc = hw->priv;
909     struct ath_common *common = ath9k_hw_common(sc->sc_ah);
910     int ret = 0;
911 
912@@ -2031,8 +1924,7 @@ static void ath9k_bss_info_changed(struc
913                    struct ieee80211_bss_conf *bss_conf,
914                    u32 changed)
915 {
916- struct ath_wiphy *aphy = hw->priv;
917- struct ath_softc *sc = aphy->sc;
918+ struct ath_softc *sc = hw->priv;
919     struct ath_hw *ah = sc->sc_ah;
920     struct ath_common *common = ath9k_hw_common(ah);
921     struct ath_vif *avp = (void *)vif->drv_priv;
922@@ -2062,7 +1954,7 @@ static void ath9k_bss_info_changed(struc
923     if ((changed & BSS_CHANGED_BEACON) ||
924         ((changed & BSS_CHANGED_BEACON_ENABLED) && bss_conf->enable_beacon)) {
925         ath9k_hw_stoptxdma(sc->sc_ah, sc->beacon.beaconq);
926- error = ath_beacon_alloc(aphy, vif);
927+ error = ath_beacon_alloc(sc, vif);
928         if (!error)
929             ath_beacon_config(sc, vif);
930     }
931@@ -2099,7 +1991,7 @@ static void ath9k_bss_info_changed(struc
932         if (vif->type == NL80211_IFTYPE_AP) {
933             sc->sc_flags |= SC_OP_TSF_RESET;
934             ath9k_hw_stoptxdma(sc->sc_ah, sc->beacon.beaconq);
935- error = ath_beacon_alloc(aphy, vif);
936+ error = ath_beacon_alloc(sc, vif);
937             if (!error)
938                 ath_beacon_config(sc, vif);
939         } else {
940@@ -2137,9 +2029,8 @@ static void ath9k_bss_info_changed(struc
941 
942 static u64 ath9k_get_tsf(struct ieee80211_hw *hw)
943 {
944+ struct ath_softc *sc = hw->priv;
945     u64 tsf;
946- struct ath_wiphy *aphy = hw->priv;
947- struct ath_softc *sc = aphy->sc;
948 
949     mutex_lock(&sc->mutex);
950     ath9k_ps_wakeup(sc);
951@@ -2152,8 +2043,7 @@ static u64 ath9k_get_tsf(struct ieee8021
952 
953 static void ath9k_set_tsf(struct ieee80211_hw *hw, u64 tsf)
954 {
955- struct ath_wiphy *aphy = hw->priv;
956- struct ath_softc *sc = aphy->sc;
957+ struct ath_softc *sc = hw->priv;
958 
959     mutex_lock(&sc->mutex);
960     ath9k_ps_wakeup(sc);
961@@ -2164,8 +2054,7 @@ static void ath9k_set_tsf(struct ieee802
962 
963 static void ath9k_reset_tsf(struct ieee80211_hw *hw)
964 {
965- struct ath_wiphy *aphy = hw->priv;
966- struct ath_softc *sc = aphy->sc;
967+ struct ath_softc *sc = hw->priv;
968 
969     mutex_lock(&sc->mutex);
970 
971@@ -2182,8 +2071,7 @@ static int ath9k_ampdu_action(struct iee
972                   struct ieee80211_sta *sta,
973                   u16 tid, u16 *ssn, u8 buf_size)
974 {
975- struct ath_wiphy *aphy = hw->priv;
976- struct ath_softc *sc = aphy->sc;
977+ struct ath_softc *sc = hw->priv;
978     int ret = 0;
979 
980     local_bh_disable();
981@@ -2228,8 +2116,7 @@ static int ath9k_ampdu_action(struct iee
982 static int ath9k_get_survey(struct ieee80211_hw *hw, int idx,
983                  struct survey_info *survey)
984 {
985- struct ath_wiphy *aphy = hw->priv;
986- struct ath_softc *sc = aphy->sc;
987+ struct ath_softc *sc = hw->priv;
988     struct ath_common *common = ath9k_hw_common(sc->sc_ah);
989     struct ieee80211_supported_band *sband;
990     struct ieee80211_channel *chan;
991@@ -2263,47 +2150,9 @@ static int ath9k_get_survey(struct ieee8
992     return 0;
993 }
994 
995-static void ath9k_sw_scan_start(struct ieee80211_hw *hw)
996-{
997- struct ath_wiphy *aphy = hw->priv;
998- struct ath_softc *sc = aphy->sc;
999-
1000- mutex_lock(&sc->mutex);
1001- if (ath9k_wiphy_scanning(sc)) {
1002- /*
1003- * There is a race here in mac80211 but fixing it requires
1004- * we revisit how we handle the scan complete callback.
1005- * After mac80211 fixes we will not have configured hardware
1006- * to the home channel nor would we have configured the RX
1007- * filter yet.
1008- */
1009- mutex_unlock(&sc->mutex);
1010- return;
1011- }
1012-
1013- aphy->state = ATH_WIPHY_SCAN;
1014- ath9k_wiphy_pause_all_forced(sc, aphy);
1015- mutex_unlock(&sc->mutex);
1016-}
1017-
1018-/*
1019- * XXX: this requires a revisit after the driver
1020- * scan_complete gets moved to another place/removed in mac80211.
1021- */
1022-static void ath9k_sw_scan_complete(struct ieee80211_hw *hw)
1023-{
1024- struct ath_wiphy *aphy = hw->priv;
1025- struct ath_softc *sc = aphy->sc;
1026-
1027- mutex_lock(&sc->mutex);
1028- aphy->state = ATH_WIPHY_ACTIVE;
1029- mutex_unlock(&sc->mutex);
1030-}
1031-
1032 static void ath9k_set_coverage_class(struct ieee80211_hw *hw, u8 coverage_class)
1033 {
1034- struct ath_wiphy *aphy = hw->priv;
1035- struct ath_softc *sc = aphy->sc;
1036+ struct ath_softc *sc = hw->priv;
1037     struct ath_hw *ah = sc->sc_ah;
1038 
1039     mutex_lock(&sc->mutex);
1040@@ -2331,8 +2180,6 @@ struct ieee80211_ops ath9k_ops = {
1041     .reset_tsf = ath9k_reset_tsf,
1042     .ampdu_action = ath9k_ampdu_action,
1043     .get_survey = ath9k_get_survey,
1044- .sw_scan_start = ath9k_sw_scan_start,
1045- .sw_scan_complete = ath9k_sw_scan_complete,
1046     .rfkill_poll = ath9k_rfkill_poll_state,
1047     .set_coverage_class = ath9k_set_coverage_class,
1048 };
1049--- a/drivers/net/wireless/ath/ath9k/pci.c
1050+++ b/drivers/net/wireless/ath/ath9k/pci.c
1051@@ -126,7 +126,6 @@ static const struct ath_bus_ops ath_pci_
1052 static int ath_pci_probe(struct pci_dev *pdev, const struct pci_device_id *id)
1053 {
1054     void __iomem *mem;
1055- struct ath_wiphy *aphy;
1056     struct ath_softc *sc;
1057     struct ieee80211_hw *hw;
1058     u8 csz;
1059@@ -198,8 +197,7 @@ static int ath_pci_probe(struct pci_dev
1060         goto err_iomap;
1061     }
1062 
1063- hw = ieee80211_alloc_hw(sizeof(struct ath_wiphy) +
1064- sizeof(struct ath_softc), &ath9k_ops);
1065+ hw = ieee80211_alloc_hw(sizeof(struct ath_softc), &ath9k_ops);
1066     if (!hw) {
1067         dev_err(&pdev->dev, "No memory for ieee80211_hw\n");
1068         ret = -ENOMEM;
1069@@ -209,11 +207,7 @@ static int ath_pci_probe(struct pci_dev
1070     SET_IEEE80211_DEV(hw, &pdev->dev);
1071     pci_set_drvdata(pdev, hw);
1072 
1073- aphy = hw->priv;
1074- sc = (struct ath_softc *) (aphy + 1);
1075- aphy->sc = sc;
1076- aphy->hw = hw;
1077- sc->pri_wiphy = aphy;
1078+ sc = hw->priv;
1079     sc->hw = hw;
1080     sc->dev = &pdev->dev;
1081     sc->mem = mem;
1082@@ -260,8 +254,7 @@ err_dma:
1083 static void ath_pci_remove(struct pci_dev *pdev)
1084 {
1085     struct ieee80211_hw *hw = pci_get_drvdata(pdev);
1086- struct ath_wiphy *aphy = hw->priv;
1087- struct ath_softc *sc = aphy->sc;
1088+ struct ath_softc *sc = hw->priv;
1089     void __iomem *mem = sc->mem;
1090 
1091     if (!is_ath9k_unloaded)
1092@@ -281,8 +274,7 @@ static int ath_pci_suspend(struct device
1093 {
1094     struct pci_dev *pdev = to_pci_dev(device);
1095     struct ieee80211_hw *hw = pci_get_drvdata(pdev);
1096- struct ath_wiphy *aphy = hw->priv;
1097- struct ath_softc *sc = aphy->sc;
1098+ struct ath_softc *sc = hw->priv;
1099 
1100     ath9k_hw_set_gpio(sc->sc_ah, sc->sc_ah->led_pin, 1);
1101 
1102@@ -293,8 +285,7 @@ static int ath_pci_resume(struct device
1103 {
1104     struct pci_dev *pdev = to_pci_dev(device);
1105     struct ieee80211_hw *hw = pci_get_drvdata(pdev);
1106- struct ath_wiphy *aphy = hw->priv;
1107- struct ath_softc *sc = aphy->sc;
1108+ struct ath_softc *sc = hw->priv;
1109     u32 val;
1110 
1111     /*
1112@@ -320,7 +311,6 @@ static int ath_pci_resume(struct device
1113     ath9k_ps_restore(sc);
1114 
1115     sc->ps_idle = true;
1116- ath9k_set_wiphy_idle(aphy, true);
1117     ath_radio_disable(sc, hw);
1118 
1119     return 0;
1120--- a/drivers/net/wireless/ath/ath9k/rc.c
1121+++ b/drivers/net/wireless/ath/ath9k/rc.c
1122@@ -1560,8 +1560,7 @@ static void ath_rate_add_sta_debugfs(voi
1123 
1124 static void *ath_rate_alloc(struct ieee80211_hw *hw, struct dentry *debugfsdir)
1125 {
1126- struct ath_wiphy *aphy = hw->priv;
1127- return aphy->sc;
1128+ return hw->priv;
1129 }
1130 
1131 static void ath_rate_free(void *priv)
1132--- a/drivers/net/wireless/ath/ath9k/recv.c
1133+++ b/drivers/net/wireless/ath/ath9k/recv.c
1134@@ -34,27 +34,6 @@ static inline bool ath9k_check_auto_slee
1135            (sc->sc_ah->caps.hw_caps & ATH9K_HW_CAP_AUTOSLEEP);
1136 }
1137 
1138-static struct ieee80211_hw * ath_get_virt_hw(struct ath_softc *sc,
1139- struct ieee80211_hdr *hdr)
1140-{
1141- struct ieee80211_hw *hw = sc->pri_wiphy->hw;
1142- int i;
1143-
1144- spin_lock_bh(&sc->wiphy_lock);
1145- for (i = 0; i < sc->num_sec_wiphy; i++) {
1146- struct ath_wiphy *aphy = sc->sec_wiphy[i];
1147- if (aphy == NULL)
1148- continue;
1149- if (compare_ether_addr(hdr->addr1, aphy->hw->wiphy->perm_addr)
1150- == 0) {
1151- hw = aphy->hw;
1152- break;
1153- }
1154- }
1155- spin_unlock_bh(&sc->wiphy_lock);
1156- return hw;
1157-}
1158-
1159 /*
1160  * Setup and link descriptors.
1161  *
1162@@ -463,8 +442,7 @@ u32 ath_calcrxfilter(struct ath_softc *s
1163     if (conf_is_ht(&sc->hw->conf))
1164         rfilt |= ATH9K_RX_FILTER_COMP_BAR;
1165 
1166- if (sc->sec_wiphy || (sc->nvifs > 1) ||
1167- (sc->rx.rxfilter & FIF_OTHER_BSS)) {
1168+ if (sc->nvifs > 1 || (sc->rx.rxfilter & FIF_OTHER_BSS)) {
1169         /* The following may also be needed for other older chips */
1170         if (sc->sc_ah->hw_version.macVersion == AR_SREV_VERSION_9160)
1171             rfilt |= ATH9K_RX_FILTER_PROM;
1172@@ -668,37 +646,6 @@ static void ath_rx_ps(struct ath_softc *
1173     }
1174 }
1175 
1176-static void ath_rx_send_to_mac80211(struct ieee80211_hw *hw,
1177- struct ath_softc *sc, struct sk_buff *skb)
1178-{
1179- struct ieee80211_hdr *hdr;
1180-
1181- hdr = (struct ieee80211_hdr *)skb->data;
1182-
1183- /* Send the frame to mac80211 */
1184- if (is_multicast_ether_addr(hdr->addr1)) {
1185- int i;
1186- /*
1187- * Deliver broadcast/multicast frames to all suitable
1188- * virtual wiphys.
1189- */
1190- /* TODO: filter based on channel configuration */
1191- for (i = 0; i < sc->num_sec_wiphy; i++) {
1192- struct ath_wiphy *aphy = sc->sec_wiphy[i];
1193- struct sk_buff *nskb;
1194- if (aphy == NULL)
1195- continue;
1196- nskb = skb_copy(skb, GFP_ATOMIC);
1197- if (!nskb)
1198- continue;
1199- ieee80211_rx(aphy->hw, nskb);
1200- }
1201- ieee80211_rx(sc->hw, skb);
1202- } else
1203- /* Deliver unicast frames based on receiver address */
1204- ieee80211_rx(hw, skb);
1205-}
1206-
1207 static bool ath_edma_get_buffers(struct ath_softc *sc,
1208                  enum ath9k_rx_qtype qtype)
1209 {
1210@@ -980,7 +927,7 @@ static void ath9k_process_rssi(struct at
1211                    struct ieee80211_hdr *hdr,
1212                    struct ath_rx_status *rx_stats)
1213 {
1214- struct ath_wiphy *aphy = hw->priv;
1215+ struct ath_softc *sc = hw->priv;
1216     struct ath_hw *ah = common->ah;
1217     int last_rssi;
1218     __le16 fc;
1219@@ -1000,9 +947,9 @@ static void ath9k_process_rssi(struct at
1220     }
1221 
1222     if (rx_stats->rs_rssi != ATH9K_RSSI_BAD && !rx_stats->rs_moreaggr)
1223- ATH_RSSI_LPF(aphy->last_rssi, rx_stats->rs_rssi);
1224+ ATH_RSSI_LPF(sc->last_rssi, rx_stats->rs_rssi);
1225 
1226- last_rssi = aphy->last_rssi;
1227+ last_rssi = sc->last_rssi;
1228     if (likely(last_rssi != ATH_RSSI_DUMMY_MARKER))
1229         rx_stats->rs_rssi = ATH_EP_RND(last_rssi,
1230                           ATH_RSSI_EP_MULTIPLIER);
1231@@ -1644,7 +1591,7 @@ int ath_rx_tasklet(struct ath_softc *sc,
1232      * virtual wiphy so to account for that we iterate over the active
1233      * wiphys and find the appropriate wiphy and therefore hw.
1234      */
1235- struct ieee80211_hw *hw = NULL;
1236+ struct ieee80211_hw *hw = sc->hw;
1237     struct ieee80211_hdr *hdr;
1238     int retval;
1239     bool decrypt_error = false;
1240@@ -1689,8 +1636,6 @@ int ath_rx_tasklet(struct ath_softc *sc,
1241         hdr = (struct ieee80211_hdr *) (skb->data + rx_status_len);
1242         rxs = IEEE80211_SKB_RXCB(skb);
1243 
1244- hw = ath_get_virt_hw(sc, hdr);
1245-
1246         ath_debug_stat_rx(sc, &rs);
1247 
1248         /*
1249@@ -1748,7 +1693,7 @@ int ath_rx_tasklet(struct ath_softc *sc,
1250             bf->bf_mpdu = NULL;
1251             bf->bf_buf_addr = 0;
1252             ath_err(common, "dma_mapping_error() on RX\n");
1253- ath_rx_send_to_mac80211(hw, sc, skb);
1254+ ieee80211_rx(hw, skb);
1255             break;
1256         }
1257 
1258@@ -1775,7 +1720,7 @@ int ath_rx_tasklet(struct ath_softc *sc,
1259         if (ah->caps.hw_caps & ATH9K_HW_CAP_ANT_DIV_COMB)
1260             ath_ant_comb_scan(sc, &rs);
1261 
1262- ath_rx_send_to_mac80211(hw, sc, skb);
1263+ ieee80211_rx(hw, skb);
1264 
1265 requeue:
1266         if (edma) {
1267--- a/drivers/net/wireless/ath/ath9k/virtual.c
1268+++ /dev/null
1269@@ -1,669 +0,0 @@
1270-/*
1271- * Copyright (c) 2008-2009 Atheros Communications Inc.
1272- *
1273- * Permission to use, copy, modify, and/or distribute this software for any
1274- * purpose with or without fee is hereby granted, provided that the above
1275- * copyright notice and this permission notice appear in all copies.
1276- *
1277- * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
1278- * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
1279- * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
1280- * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
1281- * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
1282- * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
1283- * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
1284- */
1285-
1286-#include <linux/slab.h>
1287-
1288-#include "ath9k.h"
1289-
1290-int ath9k_wiphy_add(struct ath_softc *sc)
1291-{
1292- int i, error;
1293- struct ath_wiphy *aphy;
1294- struct ath_common *common = ath9k_hw_common(sc->sc_ah);
1295- struct ieee80211_hw *hw;
1296- u8 addr[ETH_ALEN];
1297-
1298- hw = ieee80211_alloc_hw(sizeof(struct ath_wiphy), &ath9k_ops);
1299- if (hw == NULL)
1300- return -ENOMEM;
1301-
1302- spin_lock_bh(&sc->wiphy_lock);
1303- for (i = 0; i < sc->num_sec_wiphy; i++) {
1304- if (sc->sec_wiphy[i] == NULL)
1305- break;
1306- }
1307-
1308- if (i == sc->num_sec_wiphy) {
1309- /* No empty slot available; increase array length */
1310- struct ath_wiphy **n;
1311- n = krealloc(sc->sec_wiphy,
1312- (sc->num_sec_wiphy + 1) *
1313- sizeof(struct ath_wiphy *),
1314- GFP_ATOMIC);
1315- if (n == NULL) {
1316- spin_unlock_bh(&sc->wiphy_lock);
1317- ieee80211_free_hw(hw);
1318- return -ENOMEM;
1319- }
1320- n[i] = NULL;
1321- sc->sec_wiphy = n;
1322- sc->num_sec_wiphy++;
1323- }
1324-
1325- SET_IEEE80211_DEV(hw, sc->dev);
1326-
1327- aphy = hw->priv;
1328- aphy->sc = sc;
1329- aphy->hw = hw;
1330- sc->sec_wiphy[i] = aphy;
1331- aphy->last_rssi = ATH_RSSI_DUMMY_MARKER;
1332- spin_unlock_bh(&sc->wiphy_lock);
1333-
1334- memcpy(addr, common->macaddr, ETH_ALEN);
1335- addr[0] |= 0x02; /* Locally managed address */
1336- /*
1337- * XOR virtual wiphy index into the least significant bits to generate
1338- * a different MAC address for each virtual wiphy.
1339- */
1340- addr[5] ^= i & 0xff;
1341- addr[4] ^= (i & 0xff00) >> 8;
1342- addr[3] ^= (i & 0xff0000) >> 16;
1343-
1344- SET_IEEE80211_PERM_ADDR(hw, addr);
1345-
1346- ath9k_set_hw_capab(sc, hw);
1347-
1348- error = ieee80211_register_hw(hw);
1349-
1350- if (error == 0) {
1351- /* Make sure wiphy scheduler is started (if enabled) */
1352- ath9k_wiphy_set_scheduler(sc, sc->wiphy_scheduler_int);
1353- }
1354-
1355- return error;
1356-}
1357-
1358-int ath9k_wiphy_del(struct ath_wiphy *aphy)
1359-{
1360- struct ath_softc *sc = aphy->sc;
1361- int i;
1362-
1363- spin_lock_bh(&sc->wiphy_lock);
1364- for (i = 0; i < sc->num_sec_wiphy; i++) {
1365- if (aphy == sc->sec_wiphy[i]) {
1366- sc->sec_wiphy[i] = NULL;
1367- spin_unlock_bh(&sc->wiphy_lock);
1368- ieee80211_unregister_hw(aphy->hw);
1369- ieee80211_free_hw(aphy->hw);
1370- return 0;
1371- }
1372- }
1373- spin_unlock_bh(&sc->wiphy_lock);
1374- return -ENOENT;
1375-}
1376-
1377-static int ath9k_send_nullfunc(struct ath_wiphy *aphy,
1378- struct ieee80211_vif *vif, const u8 *bssid,
1379- int ps)
1380-{
1381- struct ath_softc *sc = aphy->sc;
1382- struct ath_tx_control txctl;
1383- struct sk_buff *skb;
1384- struct ieee80211_hdr *hdr;
1385- __le16 fc;
1386- struct ieee80211_tx_info *info;
1387-
1388- skb = dev_alloc_skb(24);
1389- if (skb == NULL)
1390- return -ENOMEM;
1391- hdr = (struct ieee80211_hdr *) skb_put(skb, 24);
1392- memset(hdr, 0, 24);
1393- fc = cpu_to_le16(IEEE80211_FTYPE_DATA | IEEE80211_STYPE_NULLFUNC |
1394- IEEE80211_FCTL_TODS);
1395- if (ps)
1396- fc |= cpu_to_le16(IEEE80211_FCTL_PM);
1397- hdr->frame_control = fc;
1398- memcpy(hdr->addr1, bssid, ETH_ALEN);
1399- memcpy(hdr->addr2, aphy->hw->wiphy->perm_addr, ETH_ALEN);
1400- memcpy(hdr->addr3, bssid, ETH_ALEN);
1401-
1402- info = IEEE80211_SKB_CB(skb);
1403- memset(info, 0, sizeof(*info));
1404- info->flags = IEEE80211_TX_CTL_REQ_TX_STATUS;
1405- info->control.vif = vif;
1406- info->control.rates[0].idx = 0;
1407- info->control.rates[0].count = 4;
1408- info->control.rates[1].idx = -1;
1409-
1410- memset(&txctl, 0, sizeof(struct ath_tx_control));
1411- txctl.txq = sc->tx.txq_map[WME_AC_VO];
1412- txctl.frame_type = ps ? ATH9K_IFT_PAUSE : ATH9K_IFT_UNPAUSE;
1413-
1414- if (ath_tx_start(aphy->hw, skb, &txctl) != 0)
1415- goto exit;
1416-
1417- return 0;
1418-exit:
1419- dev_kfree_skb_any(skb);
1420- return -1;
1421-}
1422-
1423-static bool __ath9k_wiphy_pausing(struct ath_softc *sc)
1424-{
1425- int i;
1426- if (sc->pri_wiphy->state == ATH_WIPHY_PAUSING)
1427- return true;
1428- for (i = 0; i < sc->num_sec_wiphy; i++) {
1429- if (sc->sec_wiphy[i] &&
1430- sc->sec_wiphy[i]->state == ATH_WIPHY_PAUSING)
1431- return true;
1432- }
1433- return false;
1434-}
1435-
1436-static bool ath9k_wiphy_pausing(struct ath_softc *sc)
1437-{
1438- bool ret;
1439- spin_lock_bh(&sc->wiphy_lock);
1440- ret = __ath9k_wiphy_pausing(sc);
1441- spin_unlock_bh(&sc->wiphy_lock);
1442- return ret;
1443-}
1444-
1445-static bool __ath9k_wiphy_scanning(struct ath_softc *sc)
1446-{
1447- int i;
1448- if (sc->pri_wiphy->state == ATH_WIPHY_SCAN)
1449- return true;
1450- for (i = 0; i < sc->num_sec_wiphy; i++) {
1451- if (sc->sec_wiphy[i] &&
1452- sc->sec_wiphy[i]->state == ATH_WIPHY_SCAN)
1453- return true;
1454- }
1455- return false;
1456-}
1457-
1458-bool ath9k_wiphy_scanning(struct ath_softc *sc)
1459-{
1460- bool ret;
1461- spin_lock_bh(&sc->wiphy_lock);
1462- ret = __ath9k_wiphy_scanning(sc);
1463- spin_unlock_bh(&sc->wiphy_lock);
1464- return ret;
1465-}
1466-
1467-static int __ath9k_wiphy_unpause(struct ath_wiphy *aphy);
1468-
1469-/* caller must hold wiphy_lock */
1470-static void __ath9k_wiphy_unpause_ch(struct ath_wiphy *aphy)
1471-{
1472- if (aphy == NULL)
1473- return;
1474- if (aphy->chan_idx != aphy->sc->chan_idx)
1475- return; /* wiphy not on the selected channel */
1476- __ath9k_wiphy_unpause(aphy);
1477-}
1478-
1479-static void ath9k_wiphy_unpause_channel(struct ath_softc *sc)
1480-{
1481- int i;
1482- spin_lock_bh(&sc->wiphy_lock);
1483- __ath9k_wiphy_unpause_ch(sc->pri_wiphy);
1484- for (i = 0; i < sc->num_sec_wiphy; i++)
1485- __ath9k_wiphy_unpause_ch(sc->sec_wiphy[i]);
1486- spin_unlock_bh(&sc->wiphy_lock);
1487-}
1488-
1489-void ath9k_wiphy_chan_work(struct work_struct *work)
1490-{
1491- struct ath_softc *sc = container_of(work, struct ath_softc, chan_work);
1492- struct ath_common *common = ath9k_hw_common(sc->sc_ah);
1493- struct ath_wiphy *aphy = sc->next_wiphy;
1494-
1495- if (aphy == NULL)
1496- return;
1497-
1498- /*
1499- * All pending interfaces paused; ready to change
1500- * channels.
1501- */
1502-
1503- /* Change channels */
1504- mutex_lock(&sc->mutex);
1505- /* XXX: remove me eventually */
1506- ath9k_update_ichannel(sc, aphy->hw,
1507- &sc->sc_ah->channels[sc->chan_idx]);
1508-
1509- /* sync hw configuration for hw code */
1510- common->hw = aphy->hw;
1511-
1512- if (ath_set_channel(sc, aphy->hw,
1513- &sc->sc_ah->channels[sc->chan_idx]) < 0) {
1514- printk(KERN_DEBUG "ath9k: Failed to set channel for new "
1515- "virtual wiphy\n");
1516- mutex_unlock(&sc->mutex);
1517- return;
1518- }
1519- mutex_unlock(&sc->mutex);
1520-
1521- ath9k_wiphy_unpause_channel(sc);
1522-}
1523-
1524-/*
1525- * ath9k version of ieee80211_tx_status() for TX frames that are generated
1526- * internally in the driver.
1527- */
1528-void ath9k_tx_status(struct ieee80211_hw *hw, struct sk_buff *skb, int ftype)
1529-{
1530- struct ath_wiphy *aphy = hw->priv;
1531- struct ieee80211_tx_info *tx_info = IEEE80211_SKB_CB(skb);
1532-
1533- if (ftype == ATH9K_IFT_PAUSE && aphy->state == ATH_WIPHY_PAUSING) {
1534- if (!(tx_info->flags & IEEE80211_TX_STAT_ACK)) {
1535- printk(KERN_DEBUG "ath9k: %s: no ACK for pause "
1536- "frame\n", wiphy_name(hw->wiphy));
1537- /*
1538- * The AP did not reply; ignore this to allow us to
1539- * continue.
1540- */
1541- }
1542- aphy->state = ATH_WIPHY_PAUSED;
1543- if (!ath9k_wiphy_pausing(aphy->sc)) {
1544- /*
1545- * Drop from tasklet to work to allow mutex for channel
1546- * change.
1547- */
1548- ieee80211_queue_work(aphy->sc->hw,
1549- &aphy->sc->chan_work);
1550- }
1551- }
1552-
1553- dev_kfree_skb(skb);
1554-}
1555-
1556-static void ath9k_mark_paused(struct ath_wiphy *aphy)
1557-{
1558- struct ath_softc *sc = aphy->sc;
1559- aphy->state = ATH_WIPHY_PAUSED;
1560- if (!__ath9k_wiphy_pausing(sc))
1561- ieee80211_queue_work(sc->hw, &sc->chan_work);
1562-}
1563-
1564-static void ath9k_pause_iter(void *data, u8 *mac, struct ieee80211_vif *vif)
1565-{
1566- struct ath_wiphy *aphy = data;
1567- struct ath_vif *avp = (void *) vif->drv_priv;
1568-
1569- switch (vif->type) {
1570- case NL80211_IFTYPE_STATION:
1571- if (!vif->bss_conf.assoc) {
1572- ath9k_mark_paused(aphy);
1573- break;
1574- }
1575- /* TODO: could avoid this if already in PS mode */
1576- if (ath9k_send_nullfunc(aphy, vif, avp->bssid, 1)) {
1577- printk(KERN_DEBUG "%s: failed to send PS nullfunc\n",
1578- __func__);
1579- ath9k_mark_paused(aphy);
1580- }
1581- break;
1582- case NL80211_IFTYPE_AP:
1583- /* Beacon transmission is paused by aphy->state change */
1584- ath9k_mark_paused(aphy);
1585- break;
1586- default:
1587- break;
1588- }
1589-}
1590-
1591-/* caller must hold wiphy_lock */
1592-static int __ath9k_wiphy_pause(struct ath_wiphy *aphy)
1593-{
1594- ieee80211_stop_queues(aphy->hw);
1595- aphy->state = ATH_WIPHY_PAUSING;
1596- /*
1597- * TODO: handle PAUSING->PAUSED for the case where there are multiple
1598- * active vifs (now we do it on the first vif getting ready; should be
1599- * on the last)
1600- */
1601- ieee80211_iterate_active_interfaces_atomic(aphy->hw, ath9k_pause_iter,
1602- aphy);
1603- return 0;
1604-}
1605-
1606-int ath9k_wiphy_pause(struct ath_wiphy *aphy)
1607-{
1608- int ret;
1609- spin_lock_bh(&aphy->sc->wiphy_lock);
1610- ret = __ath9k_wiphy_pause(aphy);
1611- spin_unlock_bh(&aphy->sc->wiphy_lock);
1612- return ret;
1613-}
1614-
1615-static void ath9k_unpause_iter(void *data, u8 *mac, struct ieee80211_vif *vif)
1616-{
1617- struct ath_wiphy *aphy = data;
1618- struct ath_vif *avp = (void *) vif->drv_priv;
1619-
1620- switch (vif->type) {
1621- case NL80211_IFTYPE_STATION:
1622- if (!vif->bss_conf.assoc)
1623- break;
1624- ath9k_send_nullfunc(aphy, vif, avp->bssid, 0);
1625- break;
1626- case NL80211_IFTYPE_AP:
1627- /* Beacon transmission is re-enabled by aphy->state change */
1628- break;
1629- default:
1630- break;
1631- }
1632-}
1633-
1634-/* caller must hold wiphy_lock */
1635-static int __ath9k_wiphy_unpause(struct ath_wiphy *aphy)
1636-{
1637- ieee80211_iterate_active_interfaces_atomic(aphy->hw,
1638- ath9k_unpause_iter, aphy);
1639- aphy->state = ATH_WIPHY_ACTIVE;
1640- ieee80211_wake_queues(aphy->hw);
1641- return 0;
1642-}
1643-
1644-int ath9k_wiphy_unpause(struct ath_wiphy *aphy)
1645-{
1646- int ret;
1647- spin_lock_bh(&aphy->sc->wiphy_lock);
1648- ret = __ath9k_wiphy_unpause(aphy);
1649- spin_unlock_bh(&aphy->sc->wiphy_lock);
1650- return ret;
1651-}
1652-
1653-static void __ath9k_wiphy_mark_all_paused(struct ath_softc *sc)
1654-{
1655- int i;
1656- if (sc->pri_wiphy->state != ATH_WIPHY_INACTIVE)
1657- sc->pri_wiphy->state = ATH_WIPHY_PAUSED;
1658- for (i = 0; i < sc->num_sec_wiphy; i++) {
1659- if (sc->sec_wiphy[i] &&
1660- sc->sec_wiphy[i]->state != ATH_WIPHY_INACTIVE)
1661- sc->sec_wiphy[i]->state = ATH_WIPHY_PAUSED;
1662- }
1663-}
1664-
1665-/* caller must hold wiphy_lock */
1666-static void __ath9k_wiphy_pause_all(struct ath_softc *sc)
1667-{
1668- int i;
1669- if (sc->pri_wiphy->state == ATH_WIPHY_ACTIVE)
1670- __ath9k_wiphy_pause(sc->pri_wiphy);
1671- for (i = 0; i < sc->num_sec_wiphy; i++) {
1672- if (sc->sec_wiphy[i] &&
1673- sc->sec_wiphy[i]->state == ATH_WIPHY_ACTIVE)
1674- __ath9k_wiphy_pause(sc->sec_wiphy[i]);
1675- }
1676-}
1677-
1678-int ath9k_wiphy_select(struct ath_wiphy *aphy)
1679-{
1680- struct ath_softc *sc = aphy->sc;
1681- bool now;
1682-
1683- spin_lock_bh(&sc->wiphy_lock);
1684- if (__ath9k_wiphy_scanning(sc)) {
1685- /*
1686- * For now, we are using mac80211 sw scan and it expects to
1687- * have full control over channel changes, so avoid wiphy
1688- * scheduling during a scan. This could be optimized if the
1689- * scanning control were moved into the driver.
1690- */
1691- spin_unlock_bh(&sc->wiphy_lock);
1692- return -EBUSY;
1693- }
1694- if (__ath9k_wiphy_pausing(sc)) {
1695- if (sc->wiphy_select_failures == 0)
1696- sc->wiphy_select_first_fail = jiffies;
1697- sc->wiphy_select_failures++;
1698- if (time_after(jiffies, sc->wiphy_select_first_fail + HZ / 2))
1699- {
1700- printk(KERN_DEBUG "ath9k: Previous wiphy select timed "
1701- "out; disable/enable hw to recover\n");
1702- __ath9k_wiphy_mark_all_paused(sc);
1703- /*
1704- * TODO: this workaround to fix hardware is unlikely to
1705- * be specific to virtual wiphy changes. It can happen
1706- * on normal channel change, too, and as such, this
1707- * should really be made more generic. For example,
1708- * tricker radio disable/enable on GTT interrupt burst
1709- * (say, 10 GTT interrupts received without any TX
1710- * frame being completed)
1711- */
1712- spin_unlock_bh(&sc->wiphy_lock);
1713- ath_radio_disable(sc, aphy->hw);
1714- ath_radio_enable(sc, aphy->hw);
1715- /* Only the primary wiphy hw is used for queuing work */
1716- ieee80211_queue_work(aphy->sc->hw,
1717- &aphy->sc->chan_work);
1718- return -EBUSY; /* previous select still in progress */
1719- }
1720- spin_unlock_bh(&sc->wiphy_lock);
1721- return -EBUSY; /* previous select still in progress */
1722- }
1723- sc->wiphy_select_failures = 0;
1724-
1725- /* Store the new channel */
1726- sc->chan_idx = aphy->chan_idx;
1727- sc->chan_is_ht = aphy->chan_is_ht;
1728- sc->next_wiphy = aphy;
1729-
1730- __ath9k_wiphy_pause_all(sc);
1731- now = !__ath9k_wiphy_pausing(aphy->sc);
1732- spin_unlock_bh(&sc->wiphy_lock);
1733-
1734- if (now) {
1735- /* Ready to request channel change immediately */
1736- ieee80211_queue_work(aphy->sc->hw, &aphy->sc->chan_work);
1737- }
1738-
1739- /*
1740- * wiphys will be unpaused in ath9k_tx_status() once channel has been
1741- * changed if any wiphy needs time to become paused.
1742- */
1743-
1744- return 0;
1745-}
1746-
1747-bool ath9k_wiphy_started(struct ath_softc *sc)
1748-{
1749- int i;
1750- spin_lock_bh(&sc->wiphy_lock);
1751- if (sc->pri_wiphy->state != ATH_WIPHY_INACTIVE) {
1752- spin_unlock_bh(&sc->wiphy_lock);
1753- return true;
1754- }
1755- for (i = 0; i < sc->num_sec_wiphy; i++) {
1756- if (sc->sec_wiphy[i] &&
1757- sc->sec_wiphy[i]->state != ATH_WIPHY_INACTIVE) {
1758- spin_unlock_bh(&sc->wiphy_lock);
1759- return true;
1760- }
1761- }
1762- spin_unlock_bh(&sc->wiphy_lock);
1763- return false;
1764-}
1765-
1766-static void ath9k_wiphy_pause_chan(struct ath_wiphy *aphy,
1767- struct ath_wiphy *selected)
1768-{
1769- if (selected->state == ATH_WIPHY_SCAN) {
1770- if (aphy == selected)
1771- return;
1772- /*
1773- * Pause all other wiphys for the duration of the scan even if
1774- * they are on the current channel now.
1775- */
1776- } else if (aphy->chan_idx == selected->chan_idx)
1777- return;
1778- aphy->state = ATH_WIPHY_PAUSED;
1779- ieee80211_stop_queues(aphy->hw);
1780-}
1781-
1782-void ath9k_wiphy_pause_all_forced(struct ath_softc *sc,
1783- struct ath_wiphy *selected)
1784-{
1785- int i;
1786- spin_lock_bh(&sc->wiphy_lock);
1787- if (sc->pri_wiphy->state == ATH_WIPHY_ACTIVE)
1788- ath9k_wiphy_pause_chan(sc->pri_wiphy, selected);
1789- for (i = 0; i < sc->num_sec_wiphy; i++) {
1790- if (sc->sec_wiphy[i] &&
1791- sc->sec_wiphy[i]->state == ATH_WIPHY_ACTIVE)
1792- ath9k_wiphy_pause_chan(sc->sec_wiphy[i], selected);
1793- }
1794- spin_unlock_bh(&sc->wiphy_lock);
1795-}
1796-
1797-void ath9k_wiphy_work(struct work_struct *work)
1798-{
1799- struct ath_softc *sc = container_of(work, struct ath_softc,
1800- wiphy_work.work);
1801- struct ath_wiphy *aphy = NULL;
1802- bool first = true;
1803-
1804- spin_lock_bh(&sc->wiphy_lock);
1805-
1806- if (sc->wiphy_scheduler_int == 0) {
1807- /* wiphy scheduler is disabled */
1808- spin_unlock_bh(&sc->wiphy_lock);
1809- return;
1810- }
1811-
1812-try_again:
1813- sc->wiphy_scheduler_index++;
1814- while (sc->wiphy_scheduler_index <= sc->num_sec_wiphy) {
1815- aphy = sc->sec_wiphy[sc->wiphy_scheduler_index - 1];
1816- if (aphy && aphy->state != ATH_WIPHY_INACTIVE)
1817- break;
1818-
1819- sc->wiphy_scheduler_index++;
1820- aphy = NULL;
1821- }
1822- if (aphy == NULL) {
1823- sc->wiphy_scheduler_index = 0;
1824- if (sc->pri_wiphy->state == ATH_WIPHY_INACTIVE) {
1825- if (first) {
1826- first = false;
1827- goto try_again;
1828- }
1829- /* No wiphy is ready to be scheduled */
1830- } else
1831- aphy = sc->pri_wiphy;
1832- }
1833-
1834- spin_unlock_bh(&sc->wiphy_lock);
1835-
1836- if (aphy &&
1837- aphy->state != ATH_WIPHY_ACTIVE && aphy->state != ATH_WIPHY_SCAN &&
1838- ath9k_wiphy_select(aphy)) {
1839- printk(KERN_DEBUG "ath9k: Failed to schedule virtual wiphy "
1840- "change\n");
1841- }
1842-
1843- ieee80211_queue_delayed_work(sc->hw,
1844- &sc->wiphy_work,
1845- sc->wiphy_scheduler_int);
1846-}
1847-
1848-void ath9k_wiphy_set_scheduler(struct ath_softc *sc, unsigned int msec_int)
1849-{
1850- cancel_delayed_work_sync(&sc->wiphy_work);
1851- sc->wiphy_scheduler_int = msecs_to_jiffies(msec_int);
1852- if (sc->wiphy_scheduler_int)
1853- ieee80211_queue_delayed_work(sc->hw, &sc->wiphy_work,
1854- sc->wiphy_scheduler_int);
1855-}
1856-
1857-/* caller must hold wiphy_lock */
1858-bool ath9k_all_wiphys_idle(struct ath_softc *sc)
1859-{
1860- unsigned int i;
1861- if (!sc->pri_wiphy->idle)
1862- return false;
1863- for (i = 0; i < sc->num_sec_wiphy; i++) {
1864- struct ath_wiphy *aphy = sc->sec_wiphy[i];
1865- if (!aphy)
1866- continue;
1867- if (!aphy->idle)
1868- return false;
1869- }
1870- return true;
1871-}
1872-
1873-/* caller must hold wiphy_lock */
1874-void ath9k_set_wiphy_idle(struct ath_wiphy *aphy, bool idle)
1875-{
1876- struct ath_softc *sc = aphy->sc;
1877-
1878- aphy->idle = idle;
1879- ath_dbg(ath9k_hw_common(sc->sc_ah), ATH_DBG_CONFIG,
1880- "Marking %s as %sidle\n",
1881- wiphy_name(aphy->hw->wiphy), idle ? "" : "not-");
1882-}
1883-/* Only bother starting a queue on an active virtual wiphy */
1884-bool ath_mac80211_start_queue(struct ath_softc *sc, u16 skb_queue)
1885-{
1886- struct ieee80211_hw *hw = sc->pri_wiphy->hw;
1887- unsigned int i;
1888- bool txq_started = false;
1889-
1890- spin_lock_bh(&sc->wiphy_lock);
1891-
1892- /* Start the primary wiphy */
1893- if (sc->pri_wiphy->state == ATH_WIPHY_ACTIVE) {
1894- ieee80211_wake_queue(hw, skb_queue);
1895- txq_started = true;
1896- goto unlock;
1897- }
1898-
1899- /* Now start the secondary wiphy queues */
1900- for (i = 0; i < sc->num_sec_wiphy; i++) {
1901- struct ath_wiphy *aphy = sc->sec_wiphy[i];
1902- if (!aphy)
1903- continue;
1904- if (aphy->state != ATH_WIPHY_ACTIVE)
1905- continue;
1906-
1907- hw = aphy->hw;
1908- ieee80211_wake_queue(hw, skb_queue);
1909- txq_started = true;
1910- break;
1911- }
1912-
1913-unlock:
1914- spin_unlock_bh(&sc->wiphy_lock);
1915- return txq_started;
1916-}
1917-
1918-/* Go ahead and propagate information to all virtual wiphys, it won't hurt */
1919-void ath_mac80211_stop_queue(struct ath_softc *sc, u16 skb_queue)
1920-{
1921- struct ieee80211_hw *hw = sc->pri_wiphy->hw;
1922- unsigned int i;
1923-
1924- spin_lock_bh(&sc->wiphy_lock);
1925-
1926- /* Stop the primary wiphy */
1927- ieee80211_stop_queue(hw, skb_queue);
1928-
1929- /* Now stop the secondary wiphy queues */
1930- for (i = 0; i < sc->num_sec_wiphy; i++) {
1931- struct ath_wiphy *aphy = sc->sec_wiphy[i];
1932- if (!aphy)
1933- continue;
1934- hw = aphy->hw;
1935- ieee80211_stop_queue(hw, skb_queue);
1936- }
1937- spin_unlock_bh(&sc->wiphy_lock);
1938-}
1939--- a/drivers/net/wireless/ath/ath9k/xmit.c
1940+++ b/drivers/net/wireless/ath/ath9k/xmit.c
1941@@ -57,8 +57,9 @@ static void ath_tx_complete_buf(struct a
1942 static void ath_tx_txqaddbuf(struct ath_softc *sc, struct ath_txq *txq,
1943                  struct list_head *head);
1944 static void ath_buf_set_rate(struct ath_softc *sc, struct ath_buf *bf, int len);
1945-static void ath_tx_rc_status(struct ath_buf *bf, struct ath_tx_status *ts,
1946- int nframes, int nbad, int txok, bool update_rc);
1947+static void ath_tx_rc_status(struct ath_softc *sc, struct ath_buf *bf,
1948+ struct ath_tx_status *ts, int nframes, int nbad,
1949+ int txok, bool update_rc);
1950 static void ath_tx_update_baw(struct ath_softc *sc, struct ath_atx_tid *tid,
1951                   int seqno);
1952 
1953@@ -297,7 +298,6 @@ static struct ath_buf* ath_clone_txbuf(s
1954 
1955     ATH_TXBUF_RESET(tbf);
1956 
1957- tbf->aphy = bf->aphy;
1958     tbf->bf_mpdu = bf->bf_mpdu;
1959     tbf->bf_buf_addr = bf->bf_buf_addr;
1960     memcpy(tbf->bf_desc, bf->bf_desc, sc->sc_ah->caps.tx_desc_len);
1961@@ -345,7 +345,7 @@ static void ath_tx_complete_aggr(struct
1962     struct ath_node *an = NULL;
1963     struct sk_buff *skb;
1964     struct ieee80211_sta *sta;
1965- struct ieee80211_hw *hw;
1966+ struct ieee80211_hw *hw = sc->hw;
1967     struct ieee80211_hdr *hdr;
1968     struct ieee80211_tx_info *tx_info;
1969     struct ath_atx_tid *tid = NULL;
1970@@ -364,7 +364,6 @@ static void ath_tx_complete_aggr(struct
1971     hdr = (struct ieee80211_hdr *)skb->data;
1972 
1973     tx_info = IEEE80211_SKB_CB(skb);
1974- hw = bf->aphy->hw;
1975 
1976     memcpy(rates, tx_info->control.rates, sizeof(rates));
1977 
1978@@ -383,7 +382,7 @@ static void ath_tx_complete_aggr(struct
1979                 !bf->bf_stale || bf_next != NULL)
1980                 list_move_tail(&bf->list, &bf_head);
1981 
1982- ath_tx_rc_status(bf, ts, 1, 1, 0, false);
1983+ ath_tx_rc_status(sc, bf, ts, 1, 1, 0, false);
1984             ath_tx_complete_buf(sc, bf, txq, &bf_head, ts,
1985                 0, 0);
1986 
1987@@ -489,10 +488,10 @@ static void ath_tx_complete_aggr(struct
1988 
1989             if (rc_update && (acked_cnt == 1 || txfail_cnt == 1)) {
1990                 memcpy(tx_info->control.rates, rates, sizeof(rates));
1991- ath_tx_rc_status(bf, ts, nframes, nbad, txok, true);
1992+ ath_tx_rc_status(sc, bf, ts, nframes, nbad, txok, true);
1993                 rc_update = false;
1994             } else {
1995- ath_tx_rc_status(bf, ts, nframes, nbad, txok, false);
1996+ ath_tx_rc_status(sc, bf, ts, nframes, nbad, txok, false);
1997             }
1998 
1999             ath_tx_complete_buf(sc, bf, txq, &bf_head, ts,
2000@@ -516,7 +515,7 @@ static void ath_tx_complete_aggr(struct
2001 
2002                         bf->bf_state.bf_type |=
2003                             BUF_XRETRY;
2004- ath_tx_rc_status(bf, ts, nframes,
2005+ ath_tx_rc_status(sc, bf, ts, nframes,
2006                                 nbad, 0, false);
2007                         ath_tx_complete_buf(sc, bf, txq,
2008                                     &bf_head,
2009@@ -1209,8 +1208,17 @@ bool ath_drain_all_txq(struct ath_softc
2010         ath_err(common, "Failed to stop TX DMA!\n");
2011 
2012     for (i = 0; i < ATH9K_NUM_TX_QUEUES; i++) {
2013- if (ATH_TXQ_SETUP(sc, i))
2014- ath_draintxq(sc, &sc->tx.txq[i], retry_tx);
2015+ if (!ATH_TXQ_SETUP(sc, i))
2016+ continue;
2017+
2018+ /*
2019+ * The caller will resume queues with ieee80211_wake_queues.
2020+ * Mark the queue as not stopped to prevent ath_tx_complete
2021+ * from waking the queue too early.
2022+ */
2023+ txq = &sc->tx.txq[i];
2024+ txq->stopped = false;
2025+ ath_draintxq(sc, txq, retry_tx);
2026     }
2027 
2028     return !npend;
2029@@ -1318,6 +1326,7 @@ static void ath_tx_txqaddbuf(struct ath_
2030         INIT_LIST_HEAD(&txq->txq_fifo[txq->txq_headidx]);
2031         list_splice_init(head, &txq->txq_fifo[txq->txq_headidx]);
2032         INCR(txq->txq_headidx, ATH_TXFIFO_DEPTH);
2033+ TX_STAT_INC(txq->axq_qnum, puttxbuf);
2034         ath9k_hw_puttxbuf(ah, txq->axq_qnum, bf->bf_daddr);
2035         ath_dbg(common, ATH_DBG_XMIT, "TXDP[%u] = %llx (%p)\n",
2036             txq->axq_qnum, ito64(bf->bf_daddr), bf->bf_desc);
2037@@ -1325,6 +1334,7 @@ static void ath_tx_txqaddbuf(struct ath_
2038         list_splice_tail_init(head, &txq->axq_q);
2039 
2040         if (txq->axq_link == NULL) {
2041+ TX_STAT_INC(txq->axq_qnum, puttxbuf);
2042             ath9k_hw_puttxbuf(ah, txq->axq_qnum, bf->bf_daddr);
2043             ath_dbg(common, ATH_DBG_XMIT, "TXDP[%u] = %llx (%p)\n",
2044                 txq->axq_qnum, ito64(bf->bf_daddr),
2045@@ -1338,6 +1348,7 @@ static void ath_tx_txqaddbuf(struct ath_
2046         }
2047         ath9k_hw_get_desc_link(ah, bf->bf_lastbf->bf_desc,
2048                        &txq->axq_link);
2049+ TX_STAT_INC(txq->axq_qnum, txstart);
2050         ath9k_hw_txstart(ah, txq->axq_qnum);
2051     }
2052     txq->axq_depth++;
2053@@ -1434,8 +1445,7 @@ static enum ath9k_pkt_type get_hw_packet
2054 static void setup_frame_info(struct ieee80211_hw *hw, struct sk_buff *skb,
2055                  int framelen)
2056 {
2057- struct ath_wiphy *aphy = hw->priv;
2058- struct ath_softc *sc = aphy->sc;
2059+ struct ath_softc *sc = hw->priv;
2060     struct ieee80211_tx_info *tx_info = IEEE80211_SKB_CB(skb);
2061     struct ieee80211_sta *sta = tx_info->control.sta;
2062     struct ieee80211_key_conf *hw_key = tx_info->control.hw_key;
2063@@ -1653,8 +1663,7 @@ static struct ath_buf *ath_tx_setup_buff
2064                        struct ath_txq *txq,
2065                        struct sk_buff *skb)
2066 {
2067- struct ath_wiphy *aphy = hw->priv;
2068- struct ath_softc *sc = aphy->sc;
2069+ struct ath_softc *sc = hw->priv;
2070     struct ath_hw *ah = sc->sc_ah;
2071     struct ath_common *common = ath9k_hw_common(sc->sc_ah);
2072     struct ath_frame_info *fi = get_frame_info(skb);
2073@@ -1670,7 +1679,6 @@ static struct ath_buf *ath_tx_setup_buff
2074 
2075     ATH_TXBUF_RESET(bf);
2076 
2077- bf->aphy = aphy;
2078     bf->bf_flags = setup_tx_flags(skb);
2079     bf->bf_mpdu = skb;
2080 
2081@@ -1756,8 +1764,7 @@ int ath_tx_start(struct ieee80211_hw *hw
2082     struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) skb->data;
2083     struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
2084     struct ieee80211_sta *sta = info->control.sta;
2085- struct ath_wiphy *aphy = hw->priv;
2086- struct ath_softc *sc = aphy->sc;
2087+ struct ath_softc *sc = hw->priv;
2088     struct ath_txq *txq = txctl->txq;
2089     struct ath_buf *bf;
2090     int padpos, padsize;
2091@@ -1809,7 +1816,7 @@ int ath_tx_start(struct ieee80211_hw *hw
2092     spin_lock_bh(&txq->axq_lock);
2093     if (txq == sc->tx.txq_map[q] &&
2094         ++txq->pending_frames > ATH_MAX_QDEPTH && !txq->stopped) {
2095- ath_mac80211_stop_queue(sc, q);
2096+ ieee80211_stop_queue(sc->hw, q);
2097         txq->stopped = 1;
2098     }
2099     spin_unlock_bh(&txq->axq_lock);
2100@@ -1824,8 +1831,7 @@ int ath_tx_start(struct ieee80211_hw *hw
2101 /*****************/
2102 
2103 static void ath_tx_complete(struct ath_softc *sc, struct sk_buff *skb,
2104- struct ath_wiphy *aphy, int tx_flags, int ftype,
2105- struct ath_txq *txq)
2106+ int tx_flags, int ftype, struct ath_txq *txq)
2107 {
2108     struct ieee80211_hw *hw = sc->hw;
2109     struct ieee80211_tx_info *tx_info = IEEE80211_SKB_CB(skb);
2110@@ -1835,9 +1841,6 @@ static void ath_tx_complete(struct ath_s
2111 
2112     ath_dbg(common, ATH_DBG_XMIT, "TX complete: skb: %p\n", skb);
2113 
2114- if (aphy)
2115- hw = aphy->hw;
2116-
2117     if (tx_flags & ATH_TX_BAR)
2118         tx_info->flags |= IEEE80211_TX_STAT_AMPDU_NO_BACK;
2119 
2120@@ -1867,19 +1870,20 @@ static void ath_tx_complete(struct ath_s
2121                     PS_WAIT_FOR_TX_ACK));
2122     }
2123 
2124- if (unlikely(ftype))
2125- ath9k_tx_status(hw, skb, ftype);
2126- else {
2127- q = skb_get_queue_mapping(skb);
2128- if (txq == sc->tx.txq_map[q]) {
2129- spin_lock_bh(&txq->axq_lock);
2130- if (WARN_ON(--txq->pending_frames < 0))
2131- txq->pending_frames = 0;
2132- spin_unlock_bh(&txq->axq_lock);
2133- }
2134+ q = skb_get_queue_mapping(skb);
2135+ if (txq == sc->tx.txq_map[q]) {
2136+ spin_lock_bh(&txq->axq_lock);
2137+ if (WARN_ON(--txq->pending_frames < 0))
2138+ txq->pending_frames = 0;
2139 
2140- ieee80211_tx_status(hw, skb);
2141+ if (txq->stopped && txq->pending_frames < ATH_MAX_QDEPTH) {
2142+ ieee80211_wake_queue(sc->hw, q);
2143+ txq->stopped = 0;
2144+ }
2145+ spin_unlock_bh(&txq->axq_lock);
2146     }
2147+
2148+ ieee80211_tx_status(hw, skb);
2149 }
2150 
2151 static void ath_tx_complete_buf(struct ath_softc *sc, struct ath_buf *bf,
2152@@ -1910,7 +1914,7 @@ static void ath_tx_complete_buf(struct a
2153             complete(&sc->paprd_complete);
2154     } else {
2155         ath_debug_stat_tx(sc, bf, ts);
2156- ath_tx_complete(sc, skb, bf->aphy, tx_flags,
2157+ ath_tx_complete(sc, skb, tx_flags,
2158                 bf->bf_state.bfs_ftype, txq);
2159     }
2160     /* At this point, skb (bf->bf_mpdu) is consumed...make sure we don't
2161@@ -1926,14 +1930,14 @@ static void ath_tx_complete_buf(struct a
2162     spin_unlock_irqrestore(&sc->tx.txbuflock, flags);
2163 }
2164 
2165-static void ath_tx_rc_status(struct ath_buf *bf, struct ath_tx_status *ts,
2166- int nframes, int nbad, int txok, bool update_rc)
2167+static void ath_tx_rc_status(struct ath_softc *sc, struct ath_buf *bf,
2168+ struct ath_tx_status *ts, int nframes, int nbad,
2169+ int txok, bool update_rc)
2170 {
2171     struct sk_buff *skb = bf->bf_mpdu;
2172     struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data;
2173     struct ieee80211_tx_info *tx_info = IEEE80211_SKB_CB(skb);
2174- struct ieee80211_hw *hw = bf->aphy->hw;
2175- struct ath_softc *sc = bf->aphy->sc;
2176+ struct ieee80211_hw *hw = sc->hw;
2177     struct ath_hw *ah = sc->sc_ah;
2178     u8 i, tx_rateindex;
2179 
2180@@ -1984,18 +1988,6 @@ static void ath_tx_rc_status(struct ath_
2181     tx_info->status.rates[tx_rateindex].count = ts->ts_longretry + 1;
2182 }
2183 
2184-/* Has no locking. Must hold spin_lock_bh(&txq->axq_lock)
2185- * before calling this.
2186- */
2187-static void __ath_wake_mac80211_queue(struct ath_softc *sc, struct ath_txq *txq)
2188-{
2189- if (txq->mac80211_qnum >= 0 &&
2190- txq->stopped && txq->pending_frames < ATH_MAX_QDEPTH) {
2191- if (ath_mac80211_start_queue(sc, txq->mac80211_qnum))
2192- txq->stopped = 0;
2193- }
2194-}
2195-
2196 static void ath_tx_processq(struct ath_softc *sc, struct ath_txq *txq)
2197 {
2198     struct ath_hw *ah = sc->sc_ah;
2199@@ -2006,7 +1998,6 @@ static void ath_tx_processq(struct ath_s
2200     struct ath_tx_status ts;
2201     int txok;
2202     int status;
2203- int qnum;
2204 
2205     ath_dbg(common, ATH_DBG_QUEUE, "tx queue %d (%x), link %p\n",
2206         txq->axq_qnum, ath9k_hw_gettxbuf(sc->sc_ah, txq->axq_qnum),
2207@@ -2085,11 +2076,9 @@ static void ath_tx_processq(struct ath_s
2208              */
2209             if (ts.ts_status & ATH9K_TXERR_XRETRY)
2210                 bf->bf_state.bf_type |= BUF_XRETRY;
2211- ath_tx_rc_status(bf, &ts, 1, txok ? 0 : 1, txok, true);
2212+ ath_tx_rc_status(sc, bf, &ts, 1, txok ? 0 : 1, txok, true);
2213         }
2214 
2215- qnum = skb_get_queue_mapping(bf->bf_mpdu);
2216-
2217         if (bf_isampdu(bf))
2218             ath_tx_complete_aggr(sc, txq, bf, &bf_head, &ts, txok,
2219                          true);
2220@@ -2097,7 +2086,6 @@ static void ath_tx_processq(struct ath_s
2221             ath_tx_complete_buf(sc, bf, txq, &bf_head, &ts, txok, 0);
2222 
2223         spin_lock_bh(&txq->axq_lock);
2224- __ath_wake_mac80211_queue(sc, txq);
2225 
2226         if (sc->sc_flags & SC_OP_TXAGGR)
2227             ath_txq_schedule(sc, txq);
2228@@ -2153,7 +2141,6 @@ static void ath_tx_complete_poll_work(st
2229                         txq->pending_frames,
2230                         list_empty(&txq->axq_acq),
2231                         txq->stopped);
2232- __ath_wake_mac80211_queue(sc, txq);
2233                     ath_txq_schedule(sc, txq);
2234                 }
2235             }
2236@@ -2195,7 +2182,6 @@ void ath_tx_edma_tasklet(struct ath_soft
2237     struct list_head bf_head;
2238     int status;
2239     int txok;
2240- int qnum;
2241 
2242     for (;;) {
2243         status = ath9k_hw_txprocdesc(ah, NULL, (void *)&txs);
2244@@ -2238,11 +2224,9 @@ void ath_tx_edma_tasklet(struct ath_soft
2245         if (!bf_isampdu(bf)) {
2246             if (txs.ts_status & ATH9K_TXERR_XRETRY)
2247                 bf->bf_state.bf_type |= BUF_XRETRY;
2248- ath_tx_rc_status(bf, &txs, 1, txok ? 0 : 1, txok, true);
2249+ ath_tx_rc_status(sc, bf, &txs, 1, txok ? 0 : 1, txok, true);
2250         }
2251 
2252- qnum = skb_get_queue_mapping(bf->bf_mpdu);
2253-
2254         if (bf_isampdu(bf))
2255             ath_tx_complete_aggr(sc, txq, bf, &bf_head, &txs,
2256                          txok, true);
2257@@ -2251,7 +2235,6 @@ void ath_tx_edma_tasklet(struct ath_soft
2258                         &txs, txok, 0);
2259 
2260         spin_lock_bh(&txq->axq_lock);
2261- __ath_wake_mac80211_queue(sc, txq);
2262 
2263         if (!list_empty(&txq->txq_fifo_pending)) {
2264             INIT_LIST_HEAD(&bf_head);
2265--- a/drivers/net/wireless/ath/ath9k/mac.c
2266+++ b/drivers/net/wireless/ath/ath9k/mac.c
2267@@ -16,8 +16,6 @@
2268 
2269 #include "hw.h"
2270 #include "hw-ops.h"
2271-#include "debug.h"
2272-#include "ath9k.h"
2273 
2274 static void ath9k_hw_set_txq_interrupts(struct ath_hw *ah,
2275                     struct ath9k_tx_queue_info *qi)
2276@@ -52,18 +50,12 @@ EXPORT_SYMBOL(ath9k_hw_gettxbuf);
2277 
2278 void ath9k_hw_puttxbuf(struct ath_hw *ah, u32 q, u32 txdp)
2279 {
2280- struct ath_wiphy *aphy = ah->hw->priv;
2281- struct ath_softc *sc = aphy->sc;
2282- TX_STAT_INC(q, puttxbuf);
2283     REG_WRITE(ah, AR_QTXDP(q), txdp);
2284 }
2285 EXPORT_SYMBOL(ath9k_hw_puttxbuf);
2286 
2287 void ath9k_hw_txstart(struct ath_hw *ah, u32 q)
2288 {
2289- struct ath_wiphy *aphy = ah->hw->priv;
2290- struct ath_softc *sc = aphy->sc;
2291- TX_STAT_INC(q, txstart);
2292     ath_dbg(ath9k_hw_common(ah), ATH_DBG_QUEUE,
2293         "Enable TXE on queue: %u\n", q);
2294     REG_WRITE(ah, AR_Q_TXE, 1 << q);
2295

Archive Download this file



interactive