ath9k: merge a fix for a race condition on init
[oweals/openwrt.git] / package / kernel / mac80211 / patches / 300-pending_work.patch
1 commit 8c7ae357cc5b6bd037ad2d666e9f3789cf882925
2 Author: Rajkumar Manoharan <rmanohar@qti.qualcomm.com>
3 Date:   Wed Apr 23 15:07:57 2014 +0530
4
5     ath9k: fix race in setting ATH_OP_INVALID
6     
7     The commit "ath9k: move sc_flags to ath_common" moved setting
8     ATH_OP_INVALID flag below ieee80211_register_hw. This is causing
9     the flag never being cleared randomly as the drv_start is called
10     prior to setting flag. Fix this by setting the flag prior to
11     register_hw.
12     
13     Signed-off-by: Rajkumar Manoharan <rmanohar@qti.qualcomm.com>
14     Signed-off-by: John W. Linville <linville@tuxdriver.com>
15
16 commit c82552c5b0cb1735dbcbad78b1ffc6d3c212dc56
17 Author: Tim Harvey <tharvey@gateworks.com>
18 Date:   Mon Apr 21 16:14:57 2014 -0700
19
20     ath9k: add a recv budget
21     
22     Implement a recv budget so that in cases of high traffic we still allow other
23     taskets to get processed.
24     
25     Without this, we can encounter a host of issues during high wireless traffic
26     reception depending on system load including rcu stall's detected (ARM),
27     soft lockups, failure to service critical tasks such as watchdog resets,
28     and triggering of the tx stuck tasklet.
29     
30     The same thing was proposed previously by Ben:
31      http://www.spinics.net/lists/linux-wireless/msg112891.html
32     
33     The only difference here is that I make sure only processed packets are counted
34     in the budget by checking at the end of the rx loop.
35     
36     Signed-off-by: Tim Harvey <tharvey@gateworks.com>
37     Acked-by: Felix Fietkau <nbd@openwrt.org>
38     Signed-off-by: John W. Linville <linville@tuxdriver.com>
39
40 commit 3a758134e66ca74a9df792616b5288b2fa2cfd7f
41 Author: Tim Harvey <tharvey@gateworks.com>
42 Date:   Mon Apr 21 16:14:56 2014 -0700
43
44     ath9k: fix possible hang on flush
45     
46     If a flush is requested, make sure to clear the descriptor once we've
47     processed it.
48     
49     This resolves a hang that will occur if all RX descriptors are full when a
50     flush is requested.
51     
52     Signed-off-by: Tim Harvey <tharvey@gateworks.com>
53     Acked-by: Felix Fietkau <nbd@openwrt.org>
54     Signed-off-by: John W. Linville <linville@tuxdriver.com>
55
56 commit eefb1d6adc4c60d219182b8917e4567484ce07fc
57 Author: Felix Fietkau <nbd@openwrt.org>
58 Date:   Mon Apr 28 18:27:41 2014 +0200
59
60     ath9k: remove tid->paused flag
61     
62     There are some corner cases where the driver could get stuck with a full
63     tid queue that is paused, leading to a software tx queue hang.
64     
65     Since the tx queueing rework, pausing per-tid queues on aggregation
66     session setup is no longer necessary. The driver will assign sequence
67     numbers to buffered frames when a new session is established, in order
68     to get the correct starting sequence number.
69     
70     mac80211 prevents new frames from entering the queue during setup.
71     
72     Signed-off-by: Felix Fietkau <nbd@openwrt.org>
73
74 commit 98a713933d8495f4078f561c1e651b738dd5b531
75 Author: Felix Fietkau <nbd@openwrt.org>
76 Date:   Sun Apr 27 14:49:03 2014 +0200
77
78     ath9k_hw: do not lower ANI setting below default on AR913x
79     
80     When the amount of noise fluctuates strongly, low immunity settings
81     can sometimes disrupt signal detection on AR913x chips. When that
82     happens, no OFDM/CCK errors are reported anymore, and ANI tunes the
83     radio to the lowest immunity settings.
84     Usually rx/tx fails as well in that case.
85     
86     To fix this, keep noise immunity settings at or above ANI default level,
87     which will keep radio parameters at or above INI values.
88     
89     Signed-off-by: Felix Fietkau <nbd@openwrt.org>
90
91 commit 7cbb4c021bfd1e656f5b9953a947ab3c64e4e3b0
92 Author: Felix Fietkau <nbd@openwrt.org>
93 Date:   Thu Apr 10 10:49:01 2014 +0200
94
95     mac80211: exclude AP_VLAN interfaces from tx power calculation
96     
97     Their power value is initialized to zero. This patch fixes an issue
98     where the configured power drops to the minimum value when AP_VLAN
99     interfaces are created/removed.
100     
101     Cc: stable@vger.kernel.org
102     Signed-off-by: Felix Fietkau <nbd@openwrt.org>
103
104 commit 0ca13e26341733bf9577287fb04a3bef0d2f5cc9
105 Author: Felix Fietkau <nbd@openwrt.org>
106 Date:   Wed Apr 9 00:07:01 2014 +0200
107
108     mac80211: suppress BSS info change notifications for AP_VLAN
109     
110     Fixes warnings on tx power changes
111     
112     Signed-off-by: Felix Fietkau <nbd@openwrt.org>
113
114 commit ec998e5991781ecdaad0911dc64f1c8d3749c308
115 Author: Felix Fietkau <nbd@openwrt.org>
116 Date:   Tue Apr 8 23:42:17 2014 +0200
117
118     ath9k: fix a scheduling while atomic bug in CSA handling
119     
120     Commit "ath9k: prepare for multi-interface CSA support" added a call to
121     ieee80211_iterate_active_interfaces in atomic context (beacon tasklet),
122     which is crashing.
123     Use ieee80211_iterate_active_interfaces_atomic instead.
124     
125     Signed-off-by: Felix Fietkau <nbd@openwrt.org>
126
127 commit 93f310a38a1d81a4bc8fcd9bf29628bd721cf2ef
128 Author: Felix Fietkau <nbd@openwrt.org>
129 Date:   Sun Apr 6 23:35:28 2014 +0200
130
131     ath9k_hw: reduce ANI firstep range for older chips
132     
133     Use 0-8 instead of 0-16, which is closer to the old implementation.
134     Also drop the overwrite of the firstep_low parameter to improve
135     stability.
136     
137     Signed-off-by: Felix Fietkau <nbd@openwrt.org>
138
139
140 --- a/drivers/net/wireless/ath/ath9k/ar5008_phy.c
141 +++ b/drivers/net/wireless/ath/ath9k/ar5008_phy.c
142 @@ -1004,11 +1004,9 @@ static bool ar5008_hw_ani_control_new(st
143         case ATH9K_ANI_FIRSTEP_LEVEL:{
144                 u32 level = param;
145  
146 -               value = level * 2;
147 +               value = level;
148                 REG_RMW_FIELD(ah, AR_PHY_FIND_SIG,
149                               AR_PHY_FIND_SIG_FIRSTEP, value);
150 -               REG_RMW_FIELD(ah, AR_PHY_FIND_SIG_LOW,
151 -                             AR_PHY_FIND_SIG_FIRSTEP_LOW, value);
152  
153                 if (level != aniState->firstepLevel) {
154                         ath_dbg(common, ANI,
155 --- a/drivers/net/wireless/ath/ath9k/beacon.c
156 +++ b/drivers/net/wireless/ath/ath9k/beacon.c
157 @@ -312,10 +312,9 @@ static void ath9k_csa_update_vif(void *d
158  
159  void ath9k_csa_update(struct ath_softc *sc)
160  {
161 -       ieee80211_iterate_active_interfaces(sc->hw,
162 -                                           IEEE80211_IFACE_ITER_NORMAL,
163 -                                           ath9k_csa_update_vif,
164 -                                           sc);
165 +       ieee80211_iterate_active_interfaces_atomic(sc->hw,
166 +                                                  IEEE80211_IFACE_ITER_NORMAL,
167 +                                                  ath9k_csa_update_vif, sc);
168  }
169  
170  void ath9k_beacon_tasklet(unsigned long data)
171 --- a/net/mac80211/main.c
172 +++ b/net/mac80211/main.c
173 @@ -152,6 +152,8 @@ static u32 ieee80211_hw_conf_chan(struct
174         list_for_each_entry_rcu(sdata, &local->interfaces, list) {
175                 if (!rcu_access_pointer(sdata->vif.chanctx_conf))
176                         continue;
177 +               if (sdata->vif.type == NL80211_IFTYPE_AP_VLAN)
178 +                       continue;
179                 power = min(power, sdata->vif.bss_conf.txpower);
180         }
181         rcu_read_unlock();
182 @@ -203,7 +205,7 @@ void ieee80211_bss_info_change_notify(st
183  {
184         struct ieee80211_local *local = sdata->local;
185  
186 -       if (!changed)
187 +       if (!changed || sdata->vif.type == NL80211_IFTYPE_AP_VLAN)
188                 return;
189  
190         drv_bss_info_changed(local, sdata, &sdata->vif.bss_conf, changed);
191 --- a/drivers/net/wireless/ath/ath9k/ani.c
192 +++ b/drivers/net/wireless/ath/ath9k/ani.c
193 @@ -155,6 +155,9 @@ static void ath9k_hw_set_ofdm_nil(struct
194                 ATH9K_ANI_RSSI_THR_LOW,
195                 ATH9K_ANI_RSSI_THR_HIGH);
196  
197 +       if (AR_SREV_9100(ah) && immunityLevel < ATH9K_ANI_OFDM_DEF_LEVEL)
198 +               immunityLevel = ATH9K_ANI_OFDM_DEF_LEVEL;
199 +
200         if (!scan)
201                 aniState->ofdmNoiseImmunityLevel = immunityLevel;
202  
203 @@ -235,6 +238,9 @@ static void ath9k_hw_set_cck_nil(struct 
204                 BEACON_RSSI(ah), ATH9K_ANI_RSSI_THR_LOW,
205                 ATH9K_ANI_RSSI_THR_HIGH);
206  
207 +       if (AR_SREV_9100(ah) && immunityLevel < ATH9K_ANI_CCK_DEF_LEVEL)
208 +               immunityLevel = ATH9K_ANI_CCK_DEF_LEVEL;
209 +
210         if (ah->opmode == NL80211_IFTYPE_STATION &&
211             BEACON_RSSI(ah) <= ATH9K_ANI_RSSI_THR_LOW &&
212             immunityLevel > ATH9K_ANI_CCK_MAX_LEVEL_LOW_RSSI)
213 --- a/drivers/net/wireless/ath/ath9k/ath9k.h
214 +++ b/drivers/net/wireless/ath/ath9k/ath9k.h
215 @@ -251,7 +251,6 @@ struct ath_atx_tid {
216  
217         s8 bar_index;
218         bool sched;
219 -       bool paused;
220         bool active;
221  };
222  
223 --- a/drivers/net/wireless/ath/ath9k/xmit.c
224 +++ b/drivers/net/wireless/ath/ath9k/xmit.c
225 @@ -107,9 +107,6 @@ static void ath_tx_queue_tid(struct ath_
226  {
227         struct ath_atx_ac *ac = tid->ac;
228  
229 -       if (tid->paused)
230 -               return;
231 -
232         if (tid->sched)
233                 return;
234  
235 @@ -1407,7 +1404,6 @@ int ath_tx_aggr_start(struct ath_softc *
236         ath_tx_tid_change_state(sc, txtid);
237  
238         txtid->active = true;
239 -       txtid->paused = true;
240         *ssn = txtid->seq_start = txtid->seq_next;
241         txtid->bar_index = -1;
242  
243 @@ -1427,7 +1423,6 @@ void ath_tx_aggr_stop(struct ath_softc *
244  
245         ath_txq_lock(sc, txq);
246         txtid->active = false;
247 -       txtid->paused = false;
248         ath_tx_flush_tid(sc, txtid);
249         ath_tx_tid_change_state(sc, txtid);
250         ath_txq_unlock_complete(sc, txq);
251 @@ -1487,7 +1482,7 @@ void ath_tx_aggr_wakeup(struct ath_softc
252                 ath_txq_lock(sc, txq);
253                 ac->clear_ps_filter = true;
254  
255 -               if (!tid->paused && ath_tid_has_buffered(tid)) {
256 +               if (ath_tid_has_buffered(tid)) {
257                         ath_tx_queue_tid(txq, tid);
258                         ath_txq_schedule(sc, txq);
259                 }
260 @@ -1510,7 +1505,6 @@ void ath_tx_aggr_resume(struct ath_softc
261         ath_txq_lock(sc, txq);
262  
263         tid->baw_size = IEEE80211_MIN_AMPDU_BUF << sta->ht_cap.ampdu_factor;
264 -       tid->paused = false;
265  
266         if (ath_tid_has_buffered(tid)) {
267                 ath_tx_queue_tid(txq, tid);
268 @@ -1544,8 +1538,6 @@ void ath9k_release_buffered_frames(struc
269                         continue;
270  
271                 tid = ATH_AN_2_TID(an, i);
272 -               if (tid->paused)
273 -                       continue;
274  
275                 ath_txq_lock(sc, tid->ac->txq);
276                 while (nframes > 0) {
277 @@ -1844,9 +1836,6 @@ void ath_txq_schedule(struct ath_softc *
278                         list_del(&tid->list);
279                         tid->sched = false;
280  
281 -                       if (tid->paused)
282 -                               continue;
283 -
284                         if (ath_tx_sched_aggr(sc, txq, tid, &stop))
285                                 sent = true;
286  
287 @@ -2698,7 +2687,6 @@ void ath_tx_node_init(struct ath_softc *
288                 tid->baw_size  = WME_MAX_BA;
289                 tid->baw_head  = tid->baw_tail = 0;
290                 tid->sched     = false;
291 -               tid->paused    = false;
292                 tid->active        = false;
293                 __skb_queue_head_init(&tid->buf_q);
294                 __skb_queue_head_init(&tid->retry_q);
295 --- a/drivers/net/wireless/ath/ath9k/recv.c
296 +++ b/drivers/net/wireless/ath/ath9k/recv.c
297 @@ -975,6 +975,7 @@ int ath_rx_tasklet(struct ath_softc *sc,
298         u64 tsf = 0;
299         unsigned long flags;
300         dma_addr_t new_buf_addr;
301 +       unsigned int budget = 512;
302  
303         if (edma)
304                 dma_type = DMA_BIDIRECTIONAL;
305 @@ -1113,15 +1114,17 @@ requeue_drop_frag:
306                 }
307  requeue:
308                 list_add_tail(&bf->list, &sc->rx.rxbuf);
309 -               if (flush)
310 -                       continue;
311  
312                 if (edma) {
313                         ath_rx_edma_buf_link(sc, qtype);
314                 } else {
315                         ath_rx_buf_relink(sc, bf);
316 -                       ath9k_hw_rxena(ah);
317 +                       if (!flush)
318 +                               ath9k_hw_rxena(ah);
319                 }
320 +
321 +               if (!budget--)
322 +                       break;
323         } while (1);
324  
325         if (!(ah->imask & ATH9K_INT_RXEOL)) {
326 --- a/drivers/net/wireless/ath/ath9k/ahb.c
327 +++ b/drivers/net/wireless/ath/ath9k/ahb.c
328 @@ -86,7 +86,6 @@ static int ath_ahb_probe(struct platform
329         int irq;
330         int ret = 0;
331         struct ath_hw *ah;
332 -       struct ath_common *common;
333         char hw_name[64];
334  
335         if (!dev_get_platdata(&pdev->dev)) {
336 @@ -146,9 +145,6 @@ static int ath_ahb_probe(struct platform
337         wiphy_info(hw->wiphy, "%s mem=0x%lx, irq=%d\n",
338                    hw_name, (unsigned long)mem, irq);
339  
340 -       common = ath9k_hw_common(sc->sc_ah);
341 -       /* Will be cleared in ath9k_start() */
342 -       set_bit(ATH_OP_INVALID, &common->op_flags);
343         return 0;
344  
345   err_irq:
346 --- a/drivers/net/wireless/ath/ath9k/init.c
347 +++ b/drivers/net/wireless/ath/ath9k/init.c
348 @@ -781,6 +781,9 @@ int ath9k_init_device(u16 devid, struct 
349         common = ath9k_hw_common(ah);
350         ath9k_set_hw_capab(sc, hw);
351  
352 +       /* Will be cleared in ath9k_start() */
353 +       set_bit(ATH_OP_INVALID, &common->op_flags);
354 +
355         /* Initialize regulatory */
356         error = ath_regd_init(&common->regulatory, sc->hw->wiphy,
357                               ath9k_reg_notifier);
358 --- a/drivers/net/wireless/ath/ath9k/pci.c
359 +++ b/drivers/net/wireless/ath/ath9k/pci.c
360 @@ -784,7 +784,6 @@ static int ath_pci_probe(struct pci_dev 
361  {
362         struct ath_softc *sc;
363         struct ieee80211_hw *hw;
364 -       struct ath_common *common;
365         u8 csz;
366         u32 val;
367         int ret = 0;
368 @@ -877,10 +876,6 @@ static int ath_pci_probe(struct pci_dev 
369         wiphy_info(hw->wiphy, "%s mem=0x%lx, irq=%d\n",
370                    hw_name, (unsigned long)sc->mem, pdev->irq);
371  
372 -       /* Will be cleared in ath9k_start() */
373 -       common = ath9k_hw_common(sc->sc_ah);
374 -       set_bit(ATH_OP_INVALID, &common->op_flags);
375 -
376         return 0;
377  
378  err_init: