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