ath9k: remove the queue wake optimization, it may be unreliable in some cases
[openwrt.git] / package / mac80211 / patches / 300-pending_work.patch
1 --- a/drivers/net/wireless/ath/ath9k/ar9003_mac.c
2 +++ b/drivers/net/wireless/ath/ath9k/ar9003_mac.c
3 @@ -326,7 +326,6 @@ static bool ar9003_hw_get_isr(struct ath
4 static int ar9003_hw_proc_txdesc(struct ath_hw *ah, void *ds,
5 struct ath_tx_status *ts)
6 {
7 - struct ar9003_txc *txc = (struct ar9003_txc *) ds;
8 struct ar9003_txs *ads;
9 u32 status;
10
11 @@ -336,11 +335,7 @@ static int ar9003_hw_proc_txdesc(struct
12 if ((status & AR_TxDone) == 0)
13 return -EINPROGRESS;
14
15 - ts->qid = MS(ads->ds_info, AR_TxQcuNum);
16 - if (!txc || (MS(txc->info, AR_TxQcuNum) == ts->qid))
17 - ah->ts_tail = (ah->ts_tail + 1) % ah->ts_size;
18 - else
19 - return -ENOENT;
20 + ah->ts_tail = (ah->ts_tail + 1) % ah->ts_size;
21
22 if ((MS(ads->ds_info, AR_DescId) != ATHEROS_VENDOR_ID) ||
23 (MS(ads->ds_info, AR_TxRxDesc) != 1)) {
24 @@ -354,6 +349,7 @@ static int ar9003_hw_proc_txdesc(struct
25 ts->ts_seqnum = MS(status, AR_SeqNum);
26 ts->tid = MS(status, AR_TxTid);
27
28 + ts->qid = MS(ads->ds_info, AR_TxQcuNum);
29 ts->desc_id = MS(ads->status1, AR_TxDescId);
30 ts->ts_tstamp = ads->status4;
31 ts->ts_status = 0;
32 @@ -440,20 +436,14 @@ int ath9k_hw_process_rxdesc_edma(struct
33 struct ar9003_rxs *rxsp = (struct ar9003_rxs *) buf_addr;
34 unsigned int phyerr;
35
36 - /* TODO: byte swap on big endian for ar9300_10 */
37 -
38 - if (!rxs) {
39 - if ((rxsp->status11 & AR_RxDone) == 0)
40 - return -EINPROGRESS;
41 -
42 - if (MS(rxsp->ds_info, AR_DescId) != 0x168c)
43 - return -EINVAL;
44 + if ((rxsp->status11 & AR_RxDone) == 0)
45 + return -EINPROGRESS;
46
47 - if ((rxsp->ds_info & (AR_TxRxDesc | AR_CtrlStat)) != 0)
48 - return -EINPROGRESS;
49 + if (MS(rxsp->ds_info, AR_DescId) != 0x168c)
50 + return -EINVAL;
51
52 - return 0;
53 - }
54 + if ((rxsp->ds_info & (AR_TxRxDesc | AR_CtrlStat)) != 0)
55 + return -EINPROGRESS;
56
57 rxs->rs_status = 0;
58 rxs->rs_flags = 0;
59 @@ -510,7 +500,11 @@ int ath9k_hw_process_rxdesc_edma(struct
60 */
61 if (rxsp->status11 & AR_CRCErr)
62 rxs->rs_status |= ATH9K_RXERR_CRC;
63 - else if (rxsp->status11 & AR_PHYErr) {
64 + else if (rxsp->status11 & AR_DecryptCRCErr)
65 + rxs->rs_status |= ATH9K_RXERR_DECRYPT;
66 + else if (rxsp->status11 & AR_MichaelErr)
67 + rxs->rs_status |= ATH9K_RXERR_MIC;
68 + if (rxsp->status11 & AR_PHYErr) {
69 phyerr = MS(rxsp->status11, AR_PHYErrCode);
70 /*
71 * If we reach a point here where AR_PostDelimCRCErr is
72 @@ -532,11 +526,7 @@ int ath9k_hw_process_rxdesc_edma(struct
73 rxs->rs_status |= ATH9K_RXERR_PHY;
74 rxs->rs_phyerr = phyerr;
75 }
76 -
77 - } else if (rxsp->status11 & AR_DecryptCRCErr)
78 - rxs->rs_status |= ATH9K_RXERR_DECRYPT;
79 - else if (rxsp->status11 & AR_MichaelErr)
80 - rxs->rs_status |= ATH9K_RXERR_MIC;
81 + };
82 }
83
84 if (rxsp->status11 & AR_KeyMiss)
85 --- a/drivers/net/wireless/ath/carl9170/tx.c
86 +++ b/drivers/net/wireless/ath/carl9170/tx.c
87 @@ -1236,6 +1236,7 @@ static bool carl9170_tx_ps_drop(struct a
88 {
89 struct ieee80211_sta *sta;
90 struct carl9170_sta_info *sta_info;
91 + struct ieee80211_tx_info *tx_info;
92
93 rcu_read_lock();
94 sta = __carl9170_get_tx_sta(ar, skb);
95 @@ -1243,12 +1244,13 @@ static bool carl9170_tx_ps_drop(struct a
96 goto out_rcu;
97
98 sta_info = (void *) sta->drv_priv;
99 - if (unlikely(sta_info->sleeping)) {
100 - struct ieee80211_tx_info *tx_info;
101 + tx_info = IEEE80211_SKB_CB(skb);
102
103 + if (unlikely(sta_info->sleeping) &&
104 + !(tx_info->flags & (IEEE80211_TX_CTL_NO_PS_BUFFER |
105 + IEEE80211_TX_CTL_CLEAR_PS_FILT))) {
106 rcu_read_unlock();
107
108 - tx_info = IEEE80211_SKB_CB(skb);
109 if (tx_info->flags & IEEE80211_TX_CTL_AMPDU)
110 atomic_dec(&ar->tx_ampdu_upload);
111
112 --- a/drivers/net/wireless/iwlegacy/4965-mac.c
113 +++ b/drivers/net/wireless/iwlegacy/4965-mac.c
114 @@ -1694,7 +1694,7 @@ il4965_tx_skb(struct il_priv *il, struct
115 sta_priv = (void *)sta->drv_priv;
116
117 if (sta_priv && sta_priv->asleep &&
118 - (info->flags & IEEE80211_TX_CTL_POLL_RESPONSE)) {
119 + (info->flags & IEEE80211_TX_CTL_NO_PS_BUFFER)) {
120 /*
121 * This sends an asynchronous command to the device,
122 * but we can rely on it being processed before the
123 --- a/drivers/net/wireless/iwlwifi/iwl-agn-tx.c
124 +++ b/drivers/net/wireless/iwlwifi/iwl-agn-tx.c
125 @@ -322,7 +322,7 @@ int iwlagn_tx_skb(struct iwl_priv *priv,
126 sta_priv = (void *)info->control.sta->drv_priv;
127
128 if (sta_priv && sta_priv->asleep &&
129 - (info->flags & IEEE80211_TX_CTL_POLL_RESPONSE)) {
130 + (info->flags & IEEE80211_TX_CTL_NO_PS_BUFFER)) {
131 /*
132 * This sends an asynchronous command to the device,
133 * but we can rely on it being processed before the
134 @@ -331,6 +331,10 @@ int iwlagn_tx_skb(struct iwl_priv *priv,
135 * counter.
136 * For now set the counter to just 1 since we do not
137 * support uAPSD yet.
138 + *
139 + * FIXME: If we get two non-bufferable frames one
140 + * after the other, we might only send out one of
141 + * them because this is racy.
142 */
143 iwl_sta_modify_sleep_tx_count(priv, sta_id, 1);
144 }
145 --- a/drivers/net/wireless/p54/txrx.c
146 +++ b/drivers/net/wireless/p54/txrx.c
147 @@ -690,7 +690,7 @@ static void p54_tx_80211_header(struct p
148 if (!(info->flags & IEEE80211_TX_CTL_ASSIGN_SEQ))
149 *flags |= P54_HDR_FLAG_DATA_OUT_SEQNR;
150
151 - if (info->flags & IEEE80211_TX_CTL_POLL_RESPONSE)
152 + if (info->flags & IEEE80211_TX_CTL_NO_PS_BUFFER)
153 *flags |= P54_HDR_FLAG_DATA_OUT_NOCANCEL;
154
155 if (info->flags & IEEE80211_TX_CTL_CLEAR_PS_FILT)
156 --- a/include/net/mac80211.h
157 +++ b/include/net/mac80211.h
158 @@ -341,9 +341,9 @@ struct ieee80211_bss_conf {
159 * used to indicate that a frame was already retried due to PS
160 * @IEEE80211_TX_INTFL_DONT_ENCRYPT: completely internal to mac80211,
161 * used to indicate frame should not be encrypted
162 - * @IEEE80211_TX_CTL_POLL_RESPONSE: This frame is a response to a poll
163 - * frame (PS-Poll or uAPSD) and should be sent although the station
164 - * is in powersave mode.
165 + * @IEEE80211_TX_CTL_NO_PS_BUFFER: This frame is a response to a poll
166 + * frame (PS-Poll or uAPSD) or a non-bufferable MMPDU and must
167 + * be sent although the station is in powersave mode.
168 * @IEEE80211_TX_CTL_MORE_FRAMES: More frames will be passed to the
169 * transmit function after the current frame, this can be used
170 * by drivers to kick the DMA queue only if unset or when the
171 @@ -399,7 +399,7 @@ enum mac80211_tx_control_flags {
172 IEEE80211_TX_INTFL_NEED_TXPROCESSING = BIT(14),
173 IEEE80211_TX_INTFL_RETRIED = BIT(15),
174 IEEE80211_TX_INTFL_DONT_ENCRYPT = BIT(16),
175 - IEEE80211_TX_CTL_POLL_RESPONSE = BIT(17),
176 + IEEE80211_TX_CTL_NO_PS_BUFFER = BIT(17),
177 IEEE80211_TX_CTL_MORE_FRAMES = BIT(18),
178 IEEE80211_TX_INTFL_RETRANSMISSION = BIT(19),
179 /* hole at 20, use later */
180 @@ -425,7 +425,7 @@ enum mac80211_tx_control_flags {
181 IEEE80211_TX_CTL_SEND_AFTER_DTIM | IEEE80211_TX_CTL_AMPDU | \
182 IEEE80211_TX_STAT_TX_FILTERED | IEEE80211_TX_STAT_ACK | \
183 IEEE80211_TX_STAT_AMPDU | IEEE80211_TX_STAT_AMPDU_NO_BACK | \
184 - IEEE80211_TX_CTL_RATE_CTRL_PROBE | IEEE80211_TX_CTL_POLL_RESPONSE | \
185 + IEEE80211_TX_CTL_RATE_CTRL_PROBE | IEEE80211_TX_CTL_NO_PS_BUFFER | \
186 IEEE80211_TX_CTL_MORE_FRAMES | IEEE80211_TX_CTL_LDPC | \
187 IEEE80211_TX_CTL_STBC | IEEE80211_TX_STATUS_EOSP)
188
189 @@ -659,6 +659,8 @@ ieee80211_tx_info_clear_status(struct ie
190 * @RX_FLAG_HT: HT MCS was used and rate_idx is MCS index
191 * @RX_FLAG_40MHZ: HT40 (40 MHz) was used
192 * @RX_FLAG_SHORT_GI: Short guard interval was used
193 + * @RX_FLAG_NO_SIGNAL_VAL: The signal strength value is not present.
194 + * Valid only for data frames (mainly A-MPDU)
195 */
196 enum mac80211_rx_flags {
197 RX_FLAG_MMIC_ERROR = 1<<0,
198 @@ -672,6 +674,7 @@ enum mac80211_rx_flags {
199 RX_FLAG_HT = 1<<9,
200 RX_FLAG_40MHZ = 1<<10,
201 RX_FLAG_SHORT_GI = 1<<11,
202 + RX_FLAG_NO_SIGNAL_VAL = 1<<12,
203 };
204
205 /**
206 @@ -1634,7 +1637,7 @@ void ieee80211_free_txskb(struct ieee802
207 * the station sends a PS-Poll or a uAPSD trigger frame, mac80211
208 * will inform the driver of this with the @allow_buffered_frames
209 * callback; this callback is optional. mac80211 will then transmit
210 - * the frames as usual and set the %IEEE80211_TX_CTL_POLL_RESPONSE
211 + * the frames as usual and set the %IEEE80211_TX_CTL_NO_PS_BUFFER
212 * on each frame. The last frame in the service period (or the only
213 * response to a PS-Poll) also has %IEEE80211_TX_STATUS_EOSP set to
214 * indicate that it ends the service period; as this frame must have
215 @@ -1642,6 +1645,9 @@ void ieee80211_free_txskb(struct ieee802
216 * When TX status is reported for this frame, the service period is
217 * marked has having ended and a new one can be started by the peer.
218 *
219 + * Additionally, non-bufferable MMPDUs can also be transmitted by
220 + * mac80211 with the %IEEE80211_TX_CTL_NO_PS_BUFFER set in them.
221 + *
222 * Another race condition can happen on some devices like iwlwifi
223 * when there are frames queued for the station and it wakes up
224 * or polls; the frames that are already queued could end up being
225 @@ -2140,7 +2146,7 @@ enum ieee80211_frame_release_type {
226 * @allow_buffered_frames: Prepare device to allow the given number of frames
227 * to go out to the given station. The frames will be sent by mac80211
228 * via the usual TX path after this call. The TX information for frames
229 - * released will also have the %IEEE80211_TX_CTL_POLL_RESPONSE flag set
230 + * released will also have the %IEEE80211_TX_CTL_NO_PS_BUFFER flag set
231 * and the last one will also have %IEEE80211_TX_STATUS_EOSP set. In case
232 * frames from multiple TIDs are released and the driver might reorder
233 * them between the TIDs, it must set the %IEEE80211_TX_STATUS_EOSP flag
234 --- a/net/mac80211/agg-rx.c
235 +++ b/net/mac80211/agg-rx.c
236 @@ -187,6 +187,8 @@ static void ieee80211_send_addba_resp(st
237 memcpy(mgmt->bssid, sdata->u.mgd.bssid, ETH_ALEN);
238 else if (sdata->vif.type == NL80211_IFTYPE_ADHOC)
239 memcpy(mgmt->bssid, sdata->u.ibss.bssid, ETH_ALEN);
240 + else if (sdata->vif.type == NL80211_IFTYPE_WDS)
241 + memcpy(mgmt->bssid, da, ETH_ALEN);
242
243 mgmt->frame_control = cpu_to_le16(IEEE80211_FTYPE_MGMT |
244 IEEE80211_STYPE_ACTION);
245 --- a/net/mac80211/agg-tx.c
246 +++ b/net/mac80211/agg-tx.c
247 @@ -81,7 +81,8 @@ static void ieee80211_send_addba_request
248 memcpy(mgmt->sa, sdata->vif.addr, ETH_ALEN);
249 if (sdata->vif.type == NL80211_IFTYPE_AP ||
250 sdata->vif.type == NL80211_IFTYPE_AP_VLAN ||
251 - sdata->vif.type == NL80211_IFTYPE_MESH_POINT)
252 + sdata->vif.type == NL80211_IFTYPE_MESH_POINT ||
253 + sdata->vif.type == NL80211_IFTYPE_WDS)
254 memcpy(mgmt->bssid, sdata->vif.addr, ETH_ALEN);
255 else if (sdata->vif.type == NL80211_IFTYPE_STATION)
256 memcpy(mgmt->bssid, sdata->u.mgd.bssid, ETH_ALEN);
257 @@ -471,6 +472,7 @@ int ieee80211_start_tx_ba_session(struct
258 sdata->vif.type != NL80211_IFTYPE_MESH_POINT &&
259 sdata->vif.type != NL80211_IFTYPE_AP_VLAN &&
260 sdata->vif.type != NL80211_IFTYPE_AP &&
261 + sdata->vif.type != NL80211_IFTYPE_WDS &&
262 sdata->vif.type != NL80211_IFTYPE_ADHOC)
263 return -EINVAL;
264
265 --- a/net/mac80211/debugfs_sta.c
266 +++ b/net/mac80211/debugfs_sta.c
267 @@ -63,11 +63,11 @@ static ssize_t sta_flags_read(struct fil
268 test_sta_flag(sta, WLAN_STA_##flg) ? #flg "\n" : ""
269
270 int res = scnprintf(buf, sizeof(buf),
271 - "%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s",
272 + "%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s",
273 TEST(AUTH), TEST(ASSOC), TEST(PS_STA),
274 TEST(PS_DRIVER), TEST(AUTHORIZED),
275 TEST(SHORT_PREAMBLE),
276 - TEST(WME), TEST(WDS), TEST(CLEAR_PS_FILT),
277 + TEST(WME), TEST(CLEAR_PS_FILT),
278 TEST(MFP), TEST(BLOCK_BA), TEST(PSPOLL),
279 TEST(UAPSD), TEST(SP), TEST(TDLS_PEER),
280 TEST(TDLS_PEER_AUTH), TEST(4ADDR_EVENT),
281 --- a/net/mac80211/iface.c
282 +++ b/net/mac80211/iface.c
283 @@ -178,7 +178,6 @@ static int ieee80211_do_open(struct net_
284 {
285 struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev);
286 struct ieee80211_local *local = sdata->local;
287 - struct sta_info *sta;
288 u32 changed = 0;
289 int res;
290 u32 hw_reconf_flags = 0;
291 @@ -309,28 +308,6 @@ static int ieee80211_do_open(struct net_
292
293 set_bit(SDATA_STATE_RUNNING, &sdata->state);
294
295 - if (sdata->vif.type == NL80211_IFTYPE_WDS) {
296 - /* Create STA entry for the WDS peer */
297 - sta = sta_info_alloc(sdata, sdata->u.wds.remote_addr,
298 - GFP_KERNEL);
299 - if (!sta) {
300 - res = -ENOMEM;
301 - goto err_del_interface;
302 - }
303 -
304 - sta_info_pre_move_state(sta, IEEE80211_STA_AUTH);
305 - sta_info_pre_move_state(sta, IEEE80211_STA_ASSOC);
306 - sta_info_pre_move_state(sta, IEEE80211_STA_AUTHORIZED);
307 -
308 - res = sta_info_insert(sta);
309 - if (res) {
310 - /* STA has been freed */
311 - goto err_del_interface;
312 - }
313 -
314 - rate_control_rate_init(sta);
315 - }
316 -
317 /*
318 * set_multicast_list will be invoked by the networking core
319 * which will check whether any increments here were done in
320 @@ -357,8 +334,7 @@ static int ieee80211_do_open(struct net_
321 netif_tx_start_all_queues(dev);
322
323 return 0;
324 - err_del_interface:
325 - drv_remove_interface(local, sdata);
326 +
327 err_stop:
328 if (!local->open_count)
329 drv_stop(local);
330 @@ -722,6 +698,70 @@ static void ieee80211_if_setup(struct ne
331 dev->destructor = free_netdev;
332 }
333
334 +static void ieee80211_wds_rx_queued_mgmt(struct ieee80211_sub_if_data *sdata,
335 + struct sk_buff *skb)
336 +{
337 + struct ieee80211_local *local = sdata->local;
338 + struct ieee80211_rx_status *rx_status;
339 + struct ieee802_11_elems elems;
340 + struct ieee80211_mgmt *mgmt;
341 + struct sta_info *sta;
342 + size_t baselen;
343 + u32 rates = 0;
344 + u16 stype;
345 + bool new = false;
346 + enum ieee80211_band band = local->hw.conf.channel->band;
347 + struct ieee80211_supported_band *sband = local->hw.wiphy->bands[band];
348 +
349 + rx_status = IEEE80211_SKB_RXCB(skb);
350 + mgmt = (struct ieee80211_mgmt *) skb->data;
351 + stype = le16_to_cpu(mgmt->frame_control) & IEEE80211_FCTL_STYPE;
352 +
353 + if (stype != IEEE80211_STYPE_BEACON)
354 + return;
355 +
356 + baselen = (u8 *) mgmt->u.probe_resp.variable - (u8 *) mgmt;
357 + if (baselen > skb->len)
358 + return;
359 +
360 + ieee802_11_parse_elems(mgmt->u.probe_resp.variable,
361 + skb->len - baselen, &elems);
362 +
363 + rates = ieee80211_sta_get_rates(local, &elems, band);
364 +
365 + rcu_read_lock();
366 +
367 + sta = sta_info_get(sdata, sdata->u.wds.remote_addr);
368 +
369 + if (!sta) {
370 + rcu_read_unlock();
371 + sta = sta_info_alloc(sdata, sdata->u.wds.remote_addr,
372 + GFP_KERNEL);
373 + if (!sta)
374 + return;
375 +
376 + new = true;
377 + }
378 +
379 + sta->last_rx = jiffies;
380 + sta->sta.supp_rates[local->hw.conf.channel->band] = rates;
381 +
382 + if (elems.ht_cap_elem)
383 + ieee80211_ht_cap_ie_to_sta_ht_cap(sdata, sband,
384 + elems.ht_cap_elem, &sta->sta.ht_cap);
385 +
386 + if (elems.wmm_param)
387 + set_sta_flag(sta, WLAN_STA_WME);
388 +
389 + if (new) {
390 + set_sta_flag(sta, WLAN_STA_AUTHORIZED);
391 + rate_control_rate_init(sta);
392 + sta_info_insert_rcu(sta);
393 + }
394 +
395 + rcu_read_unlock();
396 +}
397 +
398 static void ieee80211_iface_work(struct work_struct *work)
399 {
400 struct ieee80211_sub_if_data *sdata =
401 @@ -826,6 +866,9 @@ static void ieee80211_iface_work(struct
402 break;
403 ieee80211_mesh_rx_queued_mgmt(sdata, skb);
404 break;
405 + case NL80211_IFTYPE_WDS:
406 + ieee80211_wds_rx_queued_mgmt(sdata, skb);
407 + break;
408 default:
409 WARN(1, "frame for unexpected interface type");
410 break;
411 --- a/net/mac80211/rx.c
412 +++ b/net/mac80211/rx.c
413 @@ -177,7 +177,8 @@ ieee80211_add_rx_radiotap_header(struct
414 pos += 2;
415
416 /* IEEE80211_RADIOTAP_DBM_ANTSIGNAL */
417 - if (local->hw.flags & IEEE80211_HW_SIGNAL_DBM) {
418 + if (local->hw.flags & IEEE80211_HW_SIGNAL_DBM &&
419 + !(status->flag & RX_FLAG_NO_SIGNAL_VAL)) {
420 *pos = status->signal;
421 rthdr->it_present |=
422 cpu_to_le32(1 << IEEE80211_RADIOTAP_DBM_ANTSIGNAL);
423 @@ -489,12 +490,12 @@ ieee80211_rx_mesh_check(struct ieee80211
424 if (ieee80211_has_tods(hdr->frame_control) ||
425 !ieee80211_has_fromds(hdr->frame_control))
426 return RX_DROP_MONITOR;
427 - if (memcmp(hdr->addr3, dev_addr, ETH_ALEN) == 0)
428 + if (compare_ether_addr(hdr->addr3, dev_addr) == 0)
429 return RX_DROP_MONITOR;
430 } else {
431 if (!ieee80211_has_a4(hdr->frame_control))
432 return RX_DROP_MONITOR;
433 - if (memcmp(hdr->addr4, dev_addr, ETH_ALEN) == 0)
434 + if (compare_ether_addr(hdr->addr4, dev_addr) == 0)
435 return RX_DROP_MONITOR;
436 }
437 }
438 @@ -1309,8 +1310,10 @@ ieee80211_rx_h_sta_process(struct ieee80
439
440 sta->rx_fragments++;
441 sta->rx_bytes += rx->skb->len;
442 - sta->last_signal = status->signal;
443 - ewma_add(&sta->avg_signal, -status->signal);
444 + if (!(status->flag & RX_FLAG_NO_SIGNAL_VAL)) {
445 + sta->last_signal = status->signal;
446 + ewma_add(&sta->avg_signal, -status->signal);
447 + }
448
449 /*
450 * Change STA power saving mode only at the end of a frame
451 @@ -2282,6 +2285,7 @@ ieee80211_rx_h_action(struct ieee80211_r
452 sdata->vif.type != NL80211_IFTYPE_MESH_POINT &&
453 sdata->vif.type != NL80211_IFTYPE_AP_VLAN &&
454 sdata->vif.type != NL80211_IFTYPE_AP &&
455 + sdata->vif.type != NL80211_IFTYPE_WDS &&
456 sdata->vif.type != NL80211_IFTYPE_ADHOC)
457 break;
458
459 @@ -2336,7 +2340,7 @@ ieee80211_rx_h_action(struct ieee80211_r
460 if (sdata->vif.type != NL80211_IFTYPE_STATION)
461 break;
462
463 - if (memcmp(mgmt->bssid, sdata->u.mgd.bssid, ETH_ALEN))
464 + if (compare_ether_addr(mgmt->bssid, sdata->u.mgd.bssid))
465 break;
466
467 goto queue;
468 @@ -2492,14 +2496,15 @@ ieee80211_rx_h_mgmt(struct ieee80211_rx_
469
470 if (!ieee80211_vif_is_mesh(&sdata->vif) &&
471 sdata->vif.type != NL80211_IFTYPE_ADHOC &&
472 - sdata->vif.type != NL80211_IFTYPE_STATION)
473 + sdata->vif.type != NL80211_IFTYPE_STATION &&
474 + sdata->vif.type != NL80211_IFTYPE_WDS)
475 return RX_DROP_MONITOR;
476
477 switch (stype) {
478 case cpu_to_le16(IEEE80211_STYPE_AUTH):
479 case cpu_to_le16(IEEE80211_STYPE_BEACON):
480 case cpu_to_le16(IEEE80211_STYPE_PROBE_RESP):
481 - /* process for all: mesh, mlme, ibss */
482 + /* process for all: mesh, mlme, ibss, wds */
483 break;
484 case cpu_to_le16(IEEE80211_STYPE_ASSOC_RESP):
485 case cpu_to_le16(IEEE80211_STYPE_REASSOC_RESP):
486 @@ -2853,10 +2858,16 @@ static int prepare_for_handlers(struct i
487 }
488 break;
489 case NL80211_IFTYPE_WDS:
490 - if (bssid || !ieee80211_is_data(hdr->frame_control))
491 - return 0;
492 if (compare_ether_addr(sdata->u.wds.remote_addr, hdr->addr2))
493 return 0;
494 +
495 + if (ieee80211_is_data(hdr->frame_control) ||
496 + ieee80211_is_action(hdr->frame_control)) {
497 + if (compare_ether_addr(sdata->vif.addr, hdr->addr1))
498 + return 0;
499 + } else if (!ieee80211_is_beacon(hdr->frame_control))
500 + return 0;
501 +
502 break;
503 default:
504 /* should never get here */
505 --- a/net/mac80211/sta_info.c
506 +++ b/net/mac80211/sta_info.c
507 @@ -9,6 +9,7 @@
508
509 #include <linux/module.h>
510 #include <linux/init.h>
511 +#include <linux/etherdevice.h>
512 #include <linux/netdevice.h>
513 #include <linux/types.h>
514 #include <linux/slab.h>
515 @@ -101,7 +102,7 @@ struct sta_info *sta_info_get(struct iee
516 lockdep_is_held(&local->sta_mtx));
517 while (sta) {
518 if (sta->sdata == sdata &&
519 - memcmp(sta->sta.addr, addr, ETH_ALEN) == 0)
520 + compare_ether_addr(sta->sta.addr, addr) == 0)
521 break;
522 sta = rcu_dereference_check(sta->hnext,
523 lockdep_is_held(&local->sta_mtx));
524 @@ -124,7 +125,7 @@ struct sta_info *sta_info_get_bss(struct
525 while (sta) {
526 if ((sta->sdata == sdata ||
527 (sta->sdata->bss && sta->sdata->bss == sdata->bss)) &&
528 - memcmp(sta->sta.addr, addr, ETH_ALEN) == 0)
529 + compare_ether_addr(sta->sta.addr, addr) == 0)
530 break;
531 sta = rcu_dereference_check(sta->hnext,
532 lockdep_is_held(&local->sta_mtx));
533 @@ -1050,7 +1051,7 @@ static void ieee80211_send_null_response
534 * exchange. Also set EOSP to indicate this packet
535 * ends the poll/service period.
536 */
537 - info->flags |= IEEE80211_TX_CTL_POLL_RESPONSE |
538 + info->flags |= IEEE80211_TX_CTL_NO_PS_BUFFER |
539 IEEE80211_TX_STATUS_EOSP |
540 IEEE80211_TX_CTL_REQ_TX_STATUS;
541
542 @@ -1177,7 +1178,7 @@ ieee80211_sta_ps_deliver_response(struct
543 * STA may still remain is PS mode after this frame
544 * exchange.
545 */
546 - info->flags |= IEEE80211_TX_CTL_POLL_RESPONSE;
547 + info->flags |= IEEE80211_TX_CTL_NO_PS_BUFFER;
548
549 /*
550 * Use MoreData flag to indicate whether there are
551 --- a/net/mac80211/sta_info.h
552 +++ b/net/mac80211/sta_info.h
553 @@ -14,6 +14,7 @@
554 #include <linux/if_ether.h>
555 #include <linux/workqueue.h>
556 #include <linux/average.h>
557 +#include <linux/etherdevice.h>
558 #include "key.h"
559
560 /**
561 @@ -31,7 +32,6 @@
562 * @WLAN_STA_SHORT_PREAMBLE: Station is capable of receiving short-preamble
563 * frames.
564 * @WLAN_STA_WME: Station is a QoS-STA.
565 - * @WLAN_STA_WDS: Station is one of our WDS peers.
566 * @WLAN_STA_CLEAR_PS_FILT: Clear PS filter in hardware (using the
567 * IEEE80211_TX_CTL_CLEAR_PS_FILT control flag) when the next
568 * frame to this station is transmitted.
569 @@ -62,7 +62,6 @@ enum ieee80211_sta_info_flags {
570 WLAN_STA_AUTHORIZED,
571 WLAN_STA_SHORT_PREAMBLE,
572 WLAN_STA_WME,
573 - WLAN_STA_WDS,
574 WLAN_STA_CLEAR_PS_FILT,
575 WLAN_STA_MFP,
576 WLAN_STA_BLOCK_BA,
577 @@ -489,7 +488,7 @@ void for_each_sta_info_type_check(struct
578 nxt = _sta ? rcu_dereference(_sta->hnext) : NULL \
579 ) \
580 /* compare address and run code only if it matches */ \
581 - if (memcmp(_sta->sta.addr, (_addr), ETH_ALEN) == 0)
582 + if (compare_ether_addr(_sta->sta.addr, (_addr)) == 0)
583
584 /*
585 * Get STA info by index, BROKEN!
586 --- a/net/mac80211/tx.c
587 +++ b/net/mac80211/tx.c
588 @@ -448,18 +448,23 @@ ieee80211_tx_h_unicast_ps_buf(struct iee
589 struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)tx->skb->data;
590 struct ieee80211_local *local = tx->local;
591
592 - if (unlikely(!sta ||
593 - ieee80211_is_probe_resp(hdr->frame_control) ||
594 - ieee80211_is_auth(hdr->frame_control) ||
595 - ieee80211_is_assoc_resp(hdr->frame_control) ||
596 - ieee80211_is_reassoc_resp(hdr->frame_control)))
597 + if (unlikely(!sta))
598 return TX_CONTINUE;
599
600 if (unlikely((test_sta_flag(sta, WLAN_STA_PS_STA) ||
601 test_sta_flag(sta, WLAN_STA_PS_DRIVER)) &&
602 - !(info->flags & IEEE80211_TX_CTL_POLL_RESPONSE))) {
603 + !(info->flags & IEEE80211_TX_CTL_NO_PS_BUFFER))) {
604 int ac = skb_get_queue_mapping(tx->skb);
605
606 + /* only deauth, disassoc and action are bufferable MMPDUs */
607 + if (ieee80211_is_mgmt(hdr->frame_control) &&
608 + !ieee80211_is_deauth(hdr->frame_control) &&
609 + !ieee80211_is_disassoc(hdr->frame_control) &&
610 + !ieee80211_is_action(hdr->frame_control)) {
611 + info->flags |= IEEE80211_TX_CTL_NO_PS_BUFFER;
612 + return TX_CONTINUE;
613 + }
614 +
615 #ifdef CONFIG_MAC80211_VERBOSE_PS_DEBUG
616 printk(KERN_DEBUG "STA %pM aid %d: PS buffer for AC %d\n",
617 sta->sta.addr, sta->sta.aid, ac);
618 @@ -1060,6 +1065,7 @@ static bool ieee80211_tx_prep_agg(struct
619 {
620 bool queued = false;
621 bool reset_agg_timer = false;
622 + struct sk_buff *purge_skb = NULL;
623
624 if (test_bit(HT_AGG_STATE_OPERATIONAL, &tid_tx->state)) {
625 info->flags |= IEEE80211_TX_CTL_AMPDU;
626 @@ -1101,8 +1107,13 @@ static bool ieee80211_tx_prep_agg(struct
627 info->control.vif = &tx->sdata->vif;
628 info->flags |= IEEE80211_TX_INTFL_NEED_TXPROCESSING;
629 __skb_queue_tail(&tid_tx->pending, skb);
630 + if (skb_queue_len(&tid_tx->pending) > STA_MAX_TX_BUFFER)
631 + purge_skb = __skb_dequeue(&tid_tx->pending);
632 }
633 spin_unlock(&tx->sta->lock);
634 +
635 + if (purge_skb)
636 + dev_kfree_skb(purge_skb);
637 }
638
639 /* reset session timer */
640 --- a/net/mac80211/ieee80211_i.h
641 +++ b/net/mac80211/ieee80211_i.h
642 @@ -480,7 +480,7 @@ struct ieee80211_if_ibss {
643
644 bool control_port;
645
646 - u8 bssid[ETH_ALEN];
647 + u8 bssid[ETH_ALEN] __aligned(2);
648 u8 ssid[IEEE80211_MAX_SSID_LEN];
649 u8 ssid_len, ie_len;
650 u8 *ie;
651 --- a/net/mac80211/ibss.c
652 +++ b/net/mac80211/ibss.c
653 @@ -66,7 +66,7 @@ static void __ieee80211_sta_join_ibss(st
654 skb_reset_tail_pointer(skb);
655 skb_reserve(skb, sdata->local->hw.extra_tx_headroom);
656
657 - if (memcmp(ifibss->bssid, bssid, ETH_ALEN))
658 + if (compare_ether_addr(ifibss->bssid, bssid))
659 sta_info_flush(sdata->local, sdata);
660
661 /* if merging, indicate to driver that we leave the old IBSS */
662 @@ -403,7 +403,7 @@ static void ieee80211_rx_bss_info(struct
663 return;
664
665 if (sdata->vif.type == NL80211_IFTYPE_ADHOC &&
666 - memcmp(mgmt->bssid, sdata->u.ibss.bssid, ETH_ALEN) == 0) {
667 + compare_ether_addr(mgmt->bssid, sdata->u.ibss.bssid) == 0) {
668
669 rcu_read_lock();
670 sta = sta_info_get(sdata, mgmt->sa);
671 @@ -508,7 +508,7 @@ static void ieee80211_rx_bss_info(struct
672 goto put_bss;
673
674 /* same BSSID */
675 - if (memcmp(cbss->bssid, sdata->u.ibss.bssid, ETH_ALEN) == 0)
676 + if (compare_ether_addr(cbss->bssid, sdata->u.ibss.bssid) == 0)
677 goto put_bss;
678
679 if (rx_status->flag & RX_FLAG_MACTIME_MPDU) {
680 @@ -831,8 +831,8 @@ static void ieee80211_rx_mgmt_probe_req(
681 if (!tx_last_beacon && is_multicast_ether_addr(mgmt->da))
682 return;
683
684 - if (memcmp(mgmt->bssid, ifibss->bssid, ETH_ALEN) != 0 &&
685 - memcmp(mgmt->bssid, "\xff\xff\xff\xff\xff\xff", ETH_ALEN) != 0)
686 + if (compare_ether_addr(mgmt->bssid, ifibss->bssid) != 0 &&
687 + !is_broadcast_ether_addr(mgmt->bssid))
688 return;
689
690 end = ((u8 *) mgmt) + len;
691 --- a/net/mac80211/mesh.c
692 +++ b/net/mac80211/mesh.c
693 @@ -204,7 +204,7 @@ int mesh_rmc_check(u8 *sa, struct ieee80
694 kmem_cache_free(rm_cache, p);
695 --entries;
696 } else if ((seqnum == p->seqnum) &&
697 - (memcmp(sa, p->sa, ETH_ALEN) == 0))
698 + (compare_ether_addr(sa, p->sa) == 0))
699 return -1;
700 }
701
702 --- a/net/mac80211/mesh_hwmp.c
703 +++ b/net/mac80211/mesh_hwmp.c
704 @@ -8,6 +8,7 @@
705 */
706
707 #include <linux/slab.h>
708 +#include <linux/etherdevice.h>
709 #include <asm/unaligned.h>
710 #include "wme.h"
711 #include "mesh.h"
712 @@ -419,7 +420,7 @@ static u32 hwmp_route_info_get(struct ie
713 new_metric = MAX_METRIC;
714 exp_time = TU_TO_EXP_TIME(orig_lifetime);
715
716 - if (memcmp(orig_addr, sdata->vif.addr, ETH_ALEN) == 0) {
717 + if (compare_ether_addr(orig_addr, sdata->vif.addr) == 0) {
718 /* This MP is the originator, we are not interested in this
719 * frame, except for updating transmitter's path info.
720 */
721 @@ -469,7 +470,7 @@ static u32 hwmp_route_info_get(struct ie
722
723 /* Update and check transmitter routing info */
724 ta = mgmt->sa;
725 - if (memcmp(orig_addr, ta, ETH_ALEN) == 0)
726 + if (compare_ether_addr(orig_addr, ta) == 0)
727 fresh_info = false;
728 else {
729 fresh_info = true;
730 @@ -529,7 +530,7 @@ static void hwmp_preq_frame_process(stru
731
732 mhwmp_dbg("received PREQ from %pM", orig_addr);
733
734 - if (memcmp(target_addr, sdata->vif.addr, ETH_ALEN) == 0) {
735 + if (compare_ether_addr(target_addr, sdata->vif.addr) == 0) {
736 mhwmp_dbg("PREQ is for us");
737 forward = false;
738 reply = true;
739 @@ -624,7 +625,7 @@ static void hwmp_prep_frame_process(stru
740 mhwmp_dbg("received PREP from %pM", PREP_IE_ORIG_ADDR(prep_elem));
741
742 orig_addr = PREP_IE_ORIG_ADDR(prep_elem);
743 - if (memcmp(orig_addr, sdata->vif.addr, ETH_ALEN) == 0)
744 + if (compare_ether_addr(orig_addr, sdata->vif.addr) == 0)
745 /* destination, no forwarding required */
746 return;
747
748 @@ -694,10 +695,12 @@ static void hwmp_perr_frame_process(stru
749 rcu_read_lock();
750 mpath = mesh_path_lookup(target_addr, sdata);
751 if (mpath) {
752 + struct sta_info *sta;
753 +
754 spin_lock_bh(&mpath->state_lock);
755 + sta = next_hop_deref_protected(mpath);
756 if (mpath->flags & MESH_PATH_ACTIVE &&
757 - memcmp(ta, next_hop_deref_protected(mpath)->sta.addr,
758 - ETH_ALEN) == 0 &&
759 + compare_ether_addr(ta, sta->sta.addr) == 0 &&
760 (!(mpath->flags & MESH_PATH_SN_VALID) ||
761 SN_GT(target_sn, mpath->sn))) {
762 mpath->flags &= ~MESH_PATH_ACTIVE;
763 @@ -739,7 +742,7 @@ static void hwmp_rann_frame_process(stru
764 metric = rann->rann_metric;
765
766 /* Ignore our own RANNs */
767 - if (memcmp(orig_addr, sdata->vif.addr, ETH_ALEN) == 0)
768 + if (compare_ether_addr(orig_addr, sdata->vif.addr) == 0)
769 return;
770
771 mhwmp_dbg("received RANN from %pM (is_gate=%d)", orig_addr,
772 @@ -1064,7 +1067,7 @@ int mesh_nexthop_lookup(struct sk_buff *
773 if (time_after(jiffies,
774 mpath->exp_time -
775 msecs_to_jiffies(sdata->u.mesh.mshcfg.path_refresh_time)) &&
776 - !memcmp(sdata->vif.addr, hdr->addr4, ETH_ALEN) &&
777 + !compare_ether_addr(sdata->vif.addr, hdr->addr4) &&
778 !(mpath->flags & MESH_PATH_RESOLVING) &&
779 !(mpath->flags & MESH_PATH_FIXED))
780 mesh_queue_preq(mpath, PREQ_Q_F_START | PREQ_Q_F_REFRESH);
781 --- a/net/mac80211/mesh_pathtbl.c
782 +++ b/net/mac80211/mesh_pathtbl.c
783 @@ -350,7 +350,7 @@ static struct mesh_path *mpath_lookup(st
784 hlist_for_each_entry_rcu(node, n, bucket, list) {
785 mpath = node->mpath;
786 if (mpath->sdata == sdata &&
787 - memcmp(dst, mpath->dst, ETH_ALEN) == 0) {
788 + compare_ether_addr(dst, mpath->dst) == 0) {
789 if (MPATH_EXPIRED(mpath)) {
790 spin_lock_bh(&mpath->state_lock);
791 mpath->flags &= ~MESH_PATH_ACTIVE;
792 @@ -525,7 +525,7 @@ int mesh_path_add(u8 *dst, struct ieee80
793 int err = 0;
794 u32 hash_idx;
795
796 - if (memcmp(dst, sdata->vif.addr, ETH_ALEN) == 0)
797 + if (compare_ether_addr(dst, sdata->vif.addr) == 0)
798 /* never add ourselves as neighbours */
799 return -ENOTSUPP;
800
801 @@ -566,7 +566,8 @@ int mesh_path_add(u8 *dst, struct ieee80
802 err = -EEXIST;
803 hlist_for_each_entry(node, n, bucket, list) {
804 mpath = node->mpath;
805 - if (mpath->sdata == sdata && memcmp(dst, mpath->dst, ETH_ALEN) == 0)
806 + if (mpath->sdata == sdata &&
807 + compare_ether_addr(dst, mpath->dst) == 0)
808 goto err_exists;
809 }
810
811 @@ -657,7 +658,7 @@ int mpp_path_add(u8 *dst, u8 *mpp, struc
812 int err = 0;
813 u32 hash_idx;
814
815 - if (memcmp(dst, sdata->vif.addr, ETH_ALEN) == 0)
816 + if (compare_ether_addr(dst, sdata->vif.addr) == 0)
817 /* never add ourselves as neighbours */
818 return -ENOTSUPP;
819
820 @@ -694,7 +695,8 @@ int mpp_path_add(u8 *dst, u8 *mpp, struc
821 err = -EEXIST;
822 hlist_for_each_entry(node, n, bucket, list) {
823 mpath = node->mpath;
824 - if (mpath->sdata == sdata && memcmp(dst, mpath->dst, ETH_ALEN) == 0)
825 + if (mpath->sdata == sdata &&
826 + compare_ether_addr(dst, mpath->dst) == 0)
827 goto err_exists;
828 }
829
830 @@ -887,7 +889,7 @@ int mesh_path_del(u8 *addr, struct ieee8
831 hlist_for_each_entry(node, n, bucket, list) {
832 mpath = node->mpath;
833 if (mpath->sdata == sdata &&
834 - memcmp(addr, mpath->dst, ETH_ALEN) == 0) {
835 + compare_ether_addr(addr, mpath->dst) == 0) {
836 __mesh_path_del(tbl, node);
837 goto enddel;
838 }
839 --- a/net/mac80211/mlme.c
840 +++ b/net/mac80211/mlme.c
841 @@ -1812,7 +1812,7 @@ ieee80211_rx_mgmt_auth(struct ieee80211_
842
843 memcpy(bssid, ifmgd->auth_data->bss->bssid, ETH_ALEN);
844
845 - if (memcmp(bssid, mgmt->bssid, ETH_ALEN))
846 + if (compare_ether_addr(bssid, mgmt->bssid))
847 return RX_MGMT_NONE;
848
849 auth_alg = le16_to_cpu(mgmt->u.auth.auth_alg);
850 @@ -1893,7 +1893,7 @@ ieee80211_rx_mgmt_deauth(struct ieee8021
851 return RX_MGMT_NONE;
852
853 if (!ifmgd->associated ||
854 - memcmp(mgmt->bssid, ifmgd->associated->bssid, ETH_ALEN))
855 + compare_ether_addr(mgmt->bssid, ifmgd->associated->bssid))
856 return RX_MGMT_NONE;
857
858 bssid = ifmgd->associated->bssid;
859 @@ -1925,7 +1925,7 @@ ieee80211_rx_mgmt_disassoc(struct ieee80
860 return RX_MGMT_NONE;
861
862 if (!ifmgd->associated ||
863 - memcmp(mgmt->bssid, ifmgd->associated->bssid, ETH_ALEN))
864 + compare_ether_addr(mgmt->bssid, ifmgd->associated->bssid))
865 return RX_MGMT_NONE;
866
867 reason_code = le16_to_cpu(mgmt->u.disassoc.reason_code);
868 @@ -2190,7 +2190,7 @@ ieee80211_rx_mgmt_assoc_resp(struct ieee
869
870 if (!assoc_data)
871 return RX_MGMT_NONE;
872 - if (memcmp(assoc_data->bss->bssid, mgmt->bssid, ETH_ALEN))
873 + if (compare_ether_addr(assoc_data->bss->bssid, mgmt->bssid))
874 return RX_MGMT_NONE;
875
876 /*
877 @@ -2278,8 +2278,8 @@ static void ieee80211_rx_bss_info(struct
878 bool need_ps = false;
879
880 if (sdata->u.mgd.associated &&
881 - memcmp(mgmt->bssid, sdata->u.mgd.associated->bssid,
882 - ETH_ALEN) == 0) {
883 + compare_ether_addr(mgmt->bssid, sdata->u.mgd.associated->bssid)
884 + == 0) {
885 bss = (void *)sdata->u.mgd.associated->priv;
886 /* not previously set so we may need to recalc */
887 need_ps = !bss->dtim_period;
888 @@ -2334,7 +2334,7 @@ static void ieee80211_rx_mgmt_probe_resp
889
890 ASSERT_MGD_MTX(ifmgd);
891
892 - if (memcmp(mgmt->da, sdata->vif.addr, ETH_ALEN))
893 + if (compare_ether_addr(mgmt->da, sdata->vif.addr))
894 return; /* ignore ProbeResp to foreign address */
895
896 baselen = (u8 *) mgmt->u.probe_resp.variable - (u8 *) mgmt;
897 @@ -2347,11 +2347,12 @@ static void ieee80211_rx_mgmt_probe_resp
898 ieee80211_rx_bss_info(sdata, mgmt, len, rx_status, &elems, false);
899
900 if (ifmgd->associated &&
901 - memcmp(mgmt->bssid, ifmgd->associated->bssid, ETH_ALEN) == 0)
902 + compare_ether_addr(mgmt->bssid, ifmgd->associated->bssid) == 0)
903 ieee80211_reset_ap_probe(sdata);
904
905 if (ifmgd->auth_data && !ifmgd->auth_data->bss->proberesp_ies &&
906 - memcmp(mgmt->bssid, ifmgd->auth_data->bss->bssid, ETH_ALEN) == 0) {
907 + compare_ether_addr(mgmt->bssid, ifmgd->auth_data->bss->bssid)
908 + == 0) {
909 /* got probe response, continue with auth */
910 printk(KERN_DEBUG "%s: direct probe responded\n", sdata->name);
911 ifmgd->auth_data->tries = 0;
912 @@ -2408,7 +2409,8 @@ static void ieee80211_rx_mgmt_beacon(str
913 return;
914
915 if (ifmgd->assoc_data && !ifmgd->assoc_data->have_beacon &&
916 - memcmp(mgmt->bssid, ifmgd->assoc_data->bss->bssid, ETH_ALEN) == 0) {
917 + compare_ether_addr(mgmt->bssid, ifmgd->assoc_data->bss->bssid)
918 + == 0) {
919 ieee802_11_parse_elems(mgmt->u.beacon.variable,
920 len - baselen, &elems);
921
922 @@ -2423,7 +2425,7 @@ static void ieee80211_rx_mgmt_beacon(str
923 }
924
925 if (!ifmgd->associated ||
926 - memcmp(mgmt->bssid, ifmgd->associated->bssid, ETH_ALEN))
927 + compare_ether_addr(mgmt->bssid, ifmgd->associated->bssid))
928 return;
929 bssid = ifmgd->associated->bssid;
930
931 @@ -3285,7 +3287,7 @@ int ieee80211_mgd_assoc(struct ieee80211
932 bool match;
933
934 /* keep sta info, bssid if matching */
935 - match = memcmp(ifmgd->bssid, req->bss->bssid, ETH_ALEN) == 0;
936 + match = compare_ether_addr(ifmgd->bssid, req->bss->bssid) == 0;
937 ieee80211_destroy_auth_data(sdata, match);
938 }
939
940 @@ -3407,7 +3409,7 @@ int ieee80211_mgd_assoc(struct ieee80211
941 goto err_clear;
942 }
943 } else
944 - WARN_ON_ONCE(memcmp(ifmgd->bssid, req->bss->bssid, ETH_ALEN));
945 + WARN_ON_ONCE(compare_ether_addr(ifmgd->bssid, req->bss->bssid));
946
947 if (!bss->dtim_period &&
948 sdata->local->hw.flags & IEEE80211_HW_NEED_DTIM_PERIOD) {
949 @@ -3448,7 +3450,7 @@ int ieee80211_mgd_deauth(struct ieee8021
950 mutex_lock(&ifmgd->mtx);
951
952 if (ifmgd->associated &&
953 - memcmp(ifmgd->associated->bssid, req->bssid, ETH_ALEN) == 0) {
954 + compare_ether_addr(ifmgd->associated->bssid, req->bssid) == 0) {
955 ieee80211_set_disassoc(sdata, false, true);
956 assoc_bss = true;
957 } else if (ifmgd->auth_data) {
958 --- a/net/mac80211/status.c
959 +++ b/net/mac80211/status.c
960 @@ -10,6 +10,7 @@
961 */
962
963 #include <linux/export.h>
964 +#include <linux/etherdevice.h>
965 #include <net/mac80211.h>
966 #include <asm/unaligned.h>
967 #include "ieee80211_i.h"
968 @@ -377,7 +378,7 @@ void ieee80211_tx_status(struct ieee8021
969
970 for_each_sta_info(local, hdr->addr1, sta, tmp) {
971 /* skip wrong virtual interface */
972 - if (memcmp(hdr->addr2, sta->sdata->vif.addr, ETH_ALEN))
973 + if (compare_ether_addr(hdr->addr2, sta->sdata->vif.addr))
974 continue;
975
976 if (info->flags & IEEE80211_TX_STATUS_EOSP)
977 --- a/net/wireless/mlme.c
978 +++ b/net/wireless/mlme.c
979 @@ -6,6 +6,7 @@
980
981 #include <linux/kernel.h>
982 #include <linux/module.h>
983 +#include <linux/etherdevice.h>
984 #include <linux/netdevice.h>
985 #include <linux/nl80211.h>
986 #include <linux/slab.h>
987 @@ -100,7 +101,7 @@ void __cfg80211_send_deauth(struct net_d
988 ASSERT_WDEV_LOCK(wdev);
989
990 if (wdev->current_bss &&
991 - memcmp(wdev->current_bss->pub.bssid, bssid, ETH_ALEN) == 0) {
992 + compare_ether_addr(wdev->current_bss->pub.bssid, bssid) == 0) {
993 cfg80211_unhold_bss(wdev->current_bss);
994 cfg80211_put_bss(&wdev->current_bss->pub);
995 wdev->current_bss = NULL;
996 @@ -115,7 +116,7 @@ void __cfg80211_send_deauth(struct net_d
997
998 reason_code = le16_to_cpu(mgmt->u.deauth.reason_code);
999
1000 - from_ap = memcmp(mgmt->sa, dev->dev_addr, ETH_ALEN) != 0;
1001 + from_ap = compare_ether_addr(mgmt->sa, dev->dev_addr) != 0;
1002 __cfg80211_disconnected(dev, NULL, 0, reason_code, from_ap);
1003 } else if (wdev->sme_state == CFG80211_SME_CONNECTING) {
1004 __cfg80211_connect_result(dev, mgmt->bssid, NULL, 0, NULL, 0,
1005 @@ -154,7 +155,7 @@ void __cfg80211_send_disassoc(struct net
1006 return;
1007
1008 if (wdev->current_bss &&
1009 - memcmp(wdev->current_bss->pub.bssid, bssid, ETH_ALEN) == 0) {
1010 + compare_ether_addr(wdev->current_bss->pub.bssid, bssid) == 0) {
1011 cfg80211_sme_disassoc(dev, wdev->current_bss);
1012 cfg80211_unhold_bss(wdev->current_bss);
1013 cfg80211_put_bss(&wdev->current_bss->pub);
1014 @@ -165,7 +166,7 @@ void __cfg80211_send_disassoc(struct net
1015
1016 reason_code = le16_to_cpu(mgmt->u.disassoc.reason_code);
1017
1018 - from_ap = memcmp(mgmt->sa, dev->dev_addr, ETH_ALEN) != 0;
1019 + from_ap = compare_ether_addr(mgmt->sa, dev->dev_addr) != 0;
1020 __cfg80211_disconnected(dev, NULL, 0, reason_code, from_ap);
1021 }
1022 EXPORT_SYMBOL(__cfg80211_send_disassoc);
1023 @@ -285,7 +286,7 @@ int __cfg80211_mlme_auth(struct cfg80211
1024 return -EINVAL;
1025
1026 if (wdev->current_bss &&
1027 - memcmp(bssid, wdev->current_bss->pub.bssid, ETH_ALEN) == 0)
1028 + compare_ether_addr(bssid, wdev->current_bss->pub.bssid) == 0)
1029 return -EALREADY;
1030
1031 memset(&req, 0, sizeof(req));
1032 @@ -362,7 +363,7 @@ int __cfg80211_mlme_assoc(struct cfg8021
1033 memset(&req, 0, sizeof(req));
1034
1035 if (wdev->current_bss && prev_bssid &&
1036 - memcmp(wdev->current_bss->pub.bssid, prev_bssid, ETH_ALEN) == 0) {
1037 + compare_ether_addr(wdev->current_bss->pub.bssid, prev_bssid) == 0) {
1038 /*
1039 * Trying to reassociate: Allow this to proceed and let the old
1040 * association to be dropped when the new one is completed.
1041 @@ -446,7 +447,8 @@ int __cfg80211_mlme_deauth(struct cfg802
1042
1043 if (local_state_change) {
1044 if (wdev->current_bss &&
1045 - memcmp(wdev->current_bss->pub.bssid, bssid, ETH_ALEN) == 0) {
1046 + compare_ether_addr(wdev->current_bss->pub.bssid, bssid)
1047 + == 0) {
1048 cfg80211_unhold_bss(wdev->current_bss);
1049 cfg80211_put_bss(&wdev->current_bss->pub);
1050 wdev->current_bss = NULL;
1051 @@ -495,7 +497,7 @@ static int __cfg80211_mlme_disassoc(stru
1052 req.local_state_change = local_state_change;
1053 req.ie = ie;
1054 req.ie_len = ie_len;
1055 - if (memcmp(wdev->current_bss->pub.bssid, bssid, ETH_ALEN) == 0)
1056 + if (compare_ether_addr(wdev->current_bss->pub.bssid, bssid) == 0)
1057 req.bss = &wdev->current_bss->pub;
1058 else
1059 return -ENOTCONN;
1060 @@ -758,8 +760,8 @@ int cfg80211_mlme_mgmt_tx(struct cfg8021
1061 break;
1062 }
1063
1064 - if (memcmp(wdev->current_bss->pub.bssid,
1065 - mgmt->bssid, ETH_ALEN)) {
1066 + if (compare_ether_addr(wdev->current_bss->pub.bssid,
1067 + mgmt->bssid)) {
1068 err = -ENOTCONN;
1069 break;
1070 }
1071 @@ -772,8 +774,8 @@ int cfg80211_mlme_mgmt_tx(struct cfg8021
1072 break;
1073
1074 /* for station, check that DA is the AP */
1075 - if (memcmp(wdev->current_bss->pub.bssid,
1076 - mgmt->da, ETH_ALEN)) {
1077 + if (compare_ether_addr(wdev->current_bss->pub.bssid,
1078 + mgmt->da)) {
1079 err = -ENOTCONN;
1080 break;
1081 }
1082 @@ -781,11 +783,11 @@ int cfg80211_mlme_mgmt_tx(struct cfg8021
1083 case NL80211_IFTYPE_AP:
1084 case NL80211_IFTYPE_P2P_GO:
1085 case NL80211_IFTYPE_AP_VLAN:
1086 - if (memcmp(mgmt->bssid, dev->dev_addr, ETH_ALEN))
1087 + if (compare_ether_addr(mgmt->bssid, dev->dev_addr))
1088 err = -EINVAL;
1089 break;
1090 case NL80211_IFTYPE_MESH_POINT:
1091 - if (memcmp(mgmt->sa, mgmt->bssid, ETH_ALEN)) {
1092 + if (compare_ether_addr(mgmt->sa, mgmt->bssid)) {
1093 err = -EINVAL;
1094 break;
1095 }
1096 @@ -804,7 +806,7 @@ int cfg80211_mlme_mgmt_tx(struct cfg8021
1097 return err;
1098 }
1099
1100 - if (memcmp(mgmt->sa, dev->dev_addr, ETH_ALEN) != 0)
1101 + if (compare_ether_addr(mgmt->sa, dev->dev_addr) != 0)
1102 return -EINVAL;
1103
1104 /* Transmit the Action frame as requested by user space */
1105 --- a/net/wireless/scan.c
1106 +++ b/net/wireless/scan.c
1107 @@ -378,7 +378,7 @@ static int cmp_bss_core(struct cfg80211_
1108 b->len_information_elements);
1109 }
1110
1111 - return memcmp(a->bssid, b->bssid, ETH_ALEN);
1112 + return compare_ether_addr(a->bssid, b->bssid);
1113 }
1114
1115 static int cmp_bss(struct cfg80211_bss *a,
1116 --- a/drivers/net/wireless/ath/ath9k/Kconfig
1117 +++ b/drivers/net/wireless/ath/ath9k/Kconfig
1118 @@ -81,6 +81,14 @@ config ATH9K_DFS_CERTIFIED
1119 developed. At this point enabling this option won't do anything
1120 except increase code size.
1121
1122 +config ATH9K_MAC_DEBUG
1123 + bool "Atheros MAC statistics"
1124 + depends on ATH9K_DEBUGFS
1125 + default y
1126 + ---help---
1127 + This option enables collection of statistics for Rx/Tx status
1128 + data and some other MAC related statistics
1129 +
1130 config ATH9K_RATE_CONTROL
1131 bool "Atheros ath9k rate control"
1132 depends on ATH9K
1133 --- a/drivers/net/wireless/ath/ath9k/debug.c
1134 +++ b/drivers/net/wireless/ath/ath9k/debug.c
1135 @@ -818,6 +818,7 @@ void ath_debug_stat_tx(struct ath_softc
1136 if (ts->ts_flags & ATH9K_TX_DELIM_UNDERRUN)
1137 TX_STAT_INC(qnum, delim_underrun);
1138
1139 +#ifdef CONFIG_ATH9K_MAC_DEBUG
1140 spin_lock(&sc->debug.samp_lock);
1141 TX_SAMP_DBG(jiffies) = jiffies;
1142 TX_SAMP_DBG(rssi_ctl0) = ts->ts_rssi_ctl0;
1143 @@ -844,6 +845,7 @@ void ath_debug_stat_tx(struct ath_softc
1144
1145 sc->debug.tsidx = (sc->debug.tsidx + 1) % ATH_DBG_MAX_SAMPLES;
1146 spin_unlock(&sc->debug.samp_lock);
1147 +#endif
1148
1149 #undef TX_SAMP_DBG
1150 }
1151 @@ -942,27 +944,6 @@ static ssize_t read_file_recv(struct fil
1152 PHY_ERR("HT-RATE ERR", ATH9K_PHYERR_HT_RATE_ILLEGAL);
1153
1154 len += snprintf(buf + len, size - len,
1155 - "%22s : %10d\n", "RSSI-CTL0",
1156 - sc->debug.stats.rxstats.rs_rssi_ctl0);
1157 - len += snprintf(buf + len, size - len,
1158 - "%22s : %10d\n", "RSSI-CTL1",
1159 - sc->debug.stats.rxstats.rs_rssi_ctl1);
1160 - len += snprintf(buf + len, size - len,
1161 - "%22s : %10d\n", "RSSI-CTL2",
1162 - sc->debug.stats.rxstats.rs_rssi_ctl2);
1163 - len += snprintf(buf + len, size - len,
1164 - "%22s : %10d\n", "RSSI-EXT0",
1165 - sc->debug.stats.rxstats.rs_rssi_ext0);
1166 - len += snprintf(buf + len, size - len,
1167 - "%22s : %10d\n", "RSSI-EXT1",
1168 - sc->debug.stats.rxstats.rs_rssi_ext1);
1169 - len += snprintf(buf + len, size - len,
1170 - "%22s : %10d\n", "RSSI-EXT2",
1171 - sc->debug.stats.rxstats.rs_rssi_ext2);
1172 - len += snprintf(buf + len, size - len,
1173 - "%22s : %10d\n", "Rx Antenna",
1174 - sc->debug.stats.rxstats.rs_antenna);
1175 - len += snprintf(buf + len, size - len,
1176 "%22s : %10u\n", "RX-Pkts-All",
1177 sc->debug.stats.rxstats.rx_pkts_all);
1178 len += snprintf(buf + len, size - len,
1179 @@ -1009,16 +990,7 @@ void ath_debug_stat_rx(struct ath_softc
1180 RX_PHY_ERR_INC(rs->rs_phyerr);
1181 }
1182
1183 - sc->debug.stats.rxstats.rs_rssi_ctl0 = rs->rs_rssi_ctl0;
1184 - sc->debug.stats.rxstats.rs_rssi_ctl1 = rs->rs_rssi_ctl1;
1185 - sc->debug.stats.rxstats.rs_rssi_ctl2 = rs->rs_rssi_ctl2;
1186 -
1187 - sc->debug.stats.rxstats.rs_rssi_ext0 = rs->rs_rssi_ext0;
1188 - sc->debug.stats.rxstats.rs_rssi_ext1 = rs->rs_rssi_ext1;
1189 - sc->debug.stats.rxstats.rs_rssi_ext2 = rs->rs_rssi_ext2;
1190 -
1191 - sc->debug.stats.rxstats.rs_antenna = rs->rs_antenna;
1192 -
1193 +#ifdef CONFIG_ATH9K_MAC_DEBUG
1194 spin_lock(&sc->debug.samp_lock);
1195 RX_SAMP_DBG(jiffies) = jiffies;
1196 RX_SAMP_DBG(rssi_ctl0) = rs->rs_rssi_ctl0;
1197 @@ -1035,6 +1007,8 @@ void ath_debug_stat_rx(struct ath_softc
1198 sc->debug.rsidx = (sc->debug.rsidx + 1) % ATH_DBG_MAX_SAMPLES;
1199 spin_unlock(&sc->debug.samp_lock);
1200
1201 +#endif
1202 +
1203 #undef RX_STAT_INC
1204 #undef RX_PHY_ERR_INC
1205 #undef RX_SAMP_DBG
1206 @@ -1278,6 +1252,8 @@ static const struct file_operations fops
1207 .llseek = default_llseek,
1208 };
1209
1210 +#ifdef CONFIG_ATH9K_MAC_DEBUG
1211 +
1212 void ath9k_debug_samp_bb_mac(struct ath_softc *sc)
1213 {
1214 #define ATH_SAMP_DBG(c) (sc->debug.bb_mac_samp[sc->debug.sampidx].c)
1215 @@ -1551,6 +1527,7 @@ static const struct file_operations fops
1216 .llseek = default_llseek,
1217 };
1218
1219 +#endif
1220
1221 int ath9k_init_debug(struct ath_hw *ah)
1222 {
1223 @@ -1604,8 +1581,10 @@ int ath9k_init_debug(struct ath_hw *ah)
1224 &fops_base_eeprom);
1225 debugfs_create_file("modal_eeprom", S_IRUSR, sc->debug.debugfs_phy, sc,
1226 &fops_modal_eeprom);
1227 +#ifdef CONFIG_ATH9K_MAC_DEBUG
1228 debugfs_create_file("samples", S_IRUSR, sc->debug.debugfs_phy, sc,
1229 &fops_samps);
1230 +#endif
1231
1232 debugfs_create_u32("gpio_mask", S_IRUSR | S_IWUSR,
1233 sc->debug.debugfs_phy, &sc->sc_ah->gpio_mask);
1234 --- a/drivers/net/wireless/ath/ath9k/debug.h
1235 +++ b/drivers/net/wireless/ath/ath9k/debug.h
1236 @@ -165,13 +165,6 @@ struct ath_rx_stats {
1237 u32 post_delim_crc_err;
1238 u32 decrypt_busy_err;
1239 u32 phy_err_stats[ATH9K_PHYERR_MAX];
1240 - int8_t rs_rssi_ctl0;
1241 - int8_t rs_rssi_ctl1;
1242 - int8_t rs_rssi_ctl2;
1243 - int8_t rs_rssi_ext0;
1244 - int8_t rs_rssi_ext1;
1245 - int8_t rs_rssi_ext2;
1246 - u8 rs_antenna;
1247 };
1248
1249 enum ath_reset_type {
1250 @@ -235,16 +228,17 @@ struct ath9k_debug {
1251 struct dentry *debugfs_phy;
1252 u32 regidx;
1253 struct ath_stats stats;
1254 +#ifdef CONFIG_ATH9K_MAC_DEBUG
1255 spinlock_t samp_lock;
1256 struct ath_dbg_bb_mac_samp bb_mac_samp[ATH_DBG_MAX_SAMPLES];
1257 u8 sampidx;
1258 u8 tsidx;
1259 u8 rsidx;
1260 +#endif
1261 };
1262
1263 int ath9k_init_debug(struct ath_hw *ah);
1264
1265 -void ath9k_debug_samp_bb_mac(struct ath_softc *sc);
1266 void ath_debug_stat_interrupt(struct ath_softc *sc, enum ath9k_int status);
1267 void ath_debug_stat_tx(struct ath_softc *sc, struct ath_buf *bf,
1268 struct ath_tx_status *ts, struct ath_txq *txq,
1269 @@ -258,10 +252,6 @@ static inline int ath9k_init_debug(struc
1270 return 0;
1271 }
1272
1273 -static inline void ath9k_debug_samp_bb_mac(struct ath_softc *sc)
1274 -{
1275 -}
1276 -
1277 static inline void ath_debug_stat_interrupt(struct ath_softc *sc,
1278 enum ath9k_int status)
1279 {
1280 @@ -282,4 +272,17 @@ static inline void ath_debug_stat_rx(str
1281
1282 #endif /* CONFIG_ATH9K_DEBUGFS */
1283
1284 +#ifdef CONFIG_ATH9K_MAC_DEBUG
1285 +
1286 +void ath9k_debug_samp_bb_mac(struct ath_softc *sc);
1287 +
1288 +#else
1289 +
1290 +static inline void ath9k_debug_samp_bb_mac(struct ath_softc *sc)
1291 +{
1292 +}
1293 +
1294 +#endif
1295 +
1296 +
1297 #endif /* DEBUG_H */
1298 --- a/drivers/net/wireless/ath/ath9k/init.c
1299 +++ b/drivers/net/wireless/ath/ath9k/init.c
1300 @@ -555,9 +555,11 @@ static int ath9k_init_softc(u16 devid, s
1301 mutex_init(&sc->mutex);
1302 #ifdef CONFIG_ATH9K_DEBUGFS
1303 spin_lock_init(&sc->nodes_lock);
1304 - spin_lock_init(&sc->debug.samp_lock);
1305 INIT_LIST_HEAD(&sc->nodes);
1306 #endif
1307 +#ifdef CONFIG_ATH9K_MAC_DEBUG
1308 + spin_lock_init(&sc->debug.samp_lock);
1309 +#endif
1310 tasklet_init(&sc->intr_tq, ath9k_tasklet, (unsigned long)sc);
1311 tasklet_init(&sc->bcon_tasklet, ath_beacon_tasklet,
1312 (unsigned long)sc);
1313 --- a/drivers/net/wireless/ath/ath9k/hw.c
1314 +++ b/drivers/net/wireless/ath/ath9k/hw.c
1315 @@ -1386,10 +1386,16 @@ static bool ath9k_hw_set_reset_reg(struc
1316 static bool ath9k_hw_chip_reset(struct ath_hw *ah,
1317 struct ath9k_channel *chan)
1318 {
1319 - if (AR_SREV_9280(ah) && ah->eep_ops->get_eeprom(ah, EEP_OL_PWRCTRL)) {
1320 - if (!ath9k_hw_set_reset_reg(ah, ATH9K_RESET_POWER_ON))
1321 - return false;
1322 - } else if (!ath9k_hw_set_reset_reg(ah, ATH9K_RESET_WARM))
1323 + int reset_type = ATH9K_RESET_WARM;
1324 +
1325 + if (AR_SREV_9280(ah)) {
1326 + if (ah->eep_ops->get_eeprom(ah, EEP_OL_PWRCTRL))
1327 + reset_type = ATH9K_RESET_POWER_ON;
1328 + else
1329 + reset_type = ATH9K_RESET_COLD;
1330 + }
1331 +
1332 + if (!ath9k_hw_set_reset_reg(ah, reset_type))
1333 return false;
1334
1335 if (!ath9k_hw_setpower(ah, ATH9K_PM_AWAKE))
1336 --- a/drivers/net/wireless/ath/ath5k/base.c
1337 +++ b/drivers/net/wireless/ath/ath5k/base.c
1338 @@ -2330,15 +2330,6 @@ ath5k_calibrate_work(struct work_struct
1339 "got new rfgain, resetting\n");
1340 ieee80211_queue_work(ah->hw, &ah->reset_work);
1341 }
1342 -
1343 - /* TODO: On full calibration we should stop TX here,
1344 - * so that it doesn't interfere (mostly due to gain_f
1345 - * calibration that messes with tx packets -see phy.c).
1346 - *
1347 - * NOTE: Stopping the queues from above is not enough
1348 - * to stop TX but saves us from disconecting (at least
1349 - * we don't lose packets). */
1350 - ieee80211_stop_queues(ah->hw);
1351 } else
1352 ah->ah_cal_mask |= AR5K_CALIBRATION_SHORT;
1353
1354 @@ -2353,10 +2344,9 @@ ath5k_calibrate_work(struct work_struct
1355 ah->curchan->center_freq));
1356
1357 /* Clear calibration flags */
1358 - if (ah->ah_cal_mask & AR5K_CALIBRATION_FULL) {
1359 - ieee80211_wake_queues(ah->hw);
1360 + if (ah->ah_cal_mask & AR5K_CALIBRATION_FULL)
1361 ah->ah_cal_mask &= ~AR5K_CALIBRATION_FULL;
1362 - } else if (ah->ah_cal_mask & AR5K_CALIBRATION_SHORT)
1363 + else if (ah->ah_cal_mask & AR5K_CALIBRATION_SHORT)
1364 ah->ah_cal_mask &= ~AR5K_CALIBRATION_SHORT;
1365 }
1366
1367 --- a/drivers/net/wireless/ath/ath5k/phy.c
1368 +++ b/drivers/net/wireless/ath/ath5k/phy.c
1369 @@ -1871,31 +1871,15 @@ ath5k_hw_phy_calibrate(struct ath5k_hw *
1370 ret = 0;
1371 }
1372
1373 - /* On full calibration do an AGC calibration and
1374 - * request a PAPD probe for gainf calibration if
1375 - * needed */
1376 - if (ah->ah_cal_mask & AR5K_CALIBRATION_FULL) {
1377 + /* On full calibration request a PAPD probe for
1378 + * gainf calibration if needed */
1379 + if ((ah->ah_cal_mask & AR5K_CALIBRATION_FULL) &&
1380 + (ah->ah_radio == AR5K_RF5111 ||
1381 + ah->ah_radio == AR5K_RF5112) &&
1382 + channel->hw_value != AR5K_MODE_11B)
1383 + ath5k_hw_request_rfgain_probe(ah);
1384
1385 - AR5K_REG_ENABLE_BITS(ah, AR5K_PHY_AGCCTL,
1386 - AR5K_PHY_AGCCTL_CAL);
1387 -
1388 - ret = ath5k_hw_register_timeout(ah, AR5K_PHY_AGCCTL,
1389 - AR5K_PHY_AGCCTL_CAL | AR5K_PHY_AGCCTL_NF,
1390 - 0, false);
1391 - if (ret) {
1392 - ATH5K_ERR(ah,
1393 - "gain calibration timeout (%uMHz)\n",
1394 - channel->center_freq);
1395 - }
1396 -
1397 - if ((ah->ah_radio == AR5K_RF5111 ||
1398 - ah->ah_radio == AR5K_RF5112)
1399 - && (channel->hw_value != AR5K_MODE_11B))
1400 - ath5k_hw_request_rfgain_probe(ah);
1401 - }
1402 -
1403 - /* Update noise floor
1404 - * XXX: Only do this after AGC calibration */
1405 + /* Update noise floor */
1406 if (!(ah->ah_cal_mask & AR5K_CALIBRATION_NF))
1407 ath5k_hw_update_noise_floor(ah);
1408
1409 --- a/drivers/net/wireless/ath/ath9k/recv.c
1410 +++ b/drivers/net/wireless/ath/ath9k/recv.c
1411 @@ -232,7 +232,6 @@ static void ath_rx_edma_cleanup(struct a
1412 static void ath_rx_edma_init_queue(struct ath_rx_edma *rx_edma, int size)
1413 {
1414 skb_queue_head_init(&rx_edma->rx_fifo);
1415 - skb_queue_head_init(&rx_edma->rx_buffers);
1416 rx_edma->rx_fifo_hwsize = size;
1417 }
1418
1419 @@ -658,7 +657,9 @@ static void ath_rx_ps(struct ath_softc *
1420 }
1421
1422 static bool ath_edma_get_buffers(struct ath_softc *sc,
1423 - enum ath9k_rx_qtype qtype)
1424 + enum ath9k_rx_qtype qtype,
1425 + struct ath_rx_status *rs,
1426 + struct ath_buf **dest)
1427 {
1428 struct ath_rx_edma *rx_edma = &sc->rx.rx_edma[qtype];
1429 struct ath_hw *ah = sc->sc_ah;
1430 @@ -677,7 +678,7 @@ static bool ath_edma_get_buffers(struct
1431 dma_sync_single_for_cpu(sc->dev, bf->bf_buf_addr,
1432 common->rx_bufsize, DMA_FROM_DEVICE);
1433
1434 - ret = ath9k_hw_process_rxdesc_edma(ah, NULL, skb->data);
1435 + ret = ath9k_hw_process_rxdesc_edma(ah, rs, skb->data);
1436 if (ret == -EINPROGRESS) {
1437 /*let device gain the buffer again*/
1438 dma_sync_single_for_device(sc->dev, bf->bf_buf_addr,
1439 @@ -690,20 +691,21 @@ static bool ath_edma_get_buffers(struct
1440 /* corrupt descriptor, skip this one and the following one */
1441 list_add_tail(&bf->list, &sc->rx.rxbuf);
1442 ath_rx_edma_buf_link(sc, qtype);
1443 - skb = skb_peek(&rx_edma->rx_fifo);
1444 - if (!skb)
1445 - return true;
1446
1447 - bf = SKB_CB_ATHBUF(skb);
1448 - BUG_ON(!bf);
1449 + skb = skb_peek(&rx_edma->rx_fifo);
1450 + if (skb) {
1451 + bf = SKB_CB_ATHBUF(skb);
1452 + BUG_ON(!bf);
1453
1454 - __skb_unlink(skb, &rx_edma->rx_fifo);
1455 - list_add_tail(&bf->list, &sc->rx.rxbuf);
1456 - ath_rx_edma_buf_link(sc, qtype);
1457 - return true;
1458 + __skb_unlink(skb, &rx_edma->rx_fifo);
1459 + list_add_tail(&bf->list, &sc->rx.rxbuf);
1460 + ath_rx_edma_buf_link(sc, qtype);
1461 + } else {
1462 + bf = NULL;
1463 + }
1464 }
1465 - skb_queue_tail(&rx_edma->rx_buffers, skb);
1466
1467 + *dest = bf;
1468 return true;
1469 }
1470
1471 @@ -711,18 +713,15 @@ static struct ath_buf *ath_edma_get_next
1472 struct ath_rx_status *rs,
1473 enum ath9k_rx_qtype qtype)
1474 {
1475 - struct ath_rx_edma *rx_edma = &sc->rx.rx_edma[qtype];
1476 - struct sk_buff *skb;
1477 - struct ath_buf *bf;
1478 + struct ath_buf *bf = NULL;
1479
1480 - while (ath_edma_get_buffers(sc, qtype));
1481 - skb = __skb_dequeue(&rx_edma->rx_buffers);
1482 - if (!skb)
1483 - return NULL;
1484 + while (ath_edma_get_buffers(sc, qtype, rs, &bf)) {
1485 + if (!bf)
1486 + continue;
1487
1488 - bf = SKB_CB_ATHBUF(skb);
1489 - ath9k_hw_process_rxdesc_edma(sc->sc_ah, rs, skb->data);
1490 - return bf;
1491 + return bf;
1492 + }
1493 + return NULL;
1494 }
1495
1496 static struct ath_buf *ath_get_next_rx_buf(struct ath_softc *sc,
1497 @@ -954,6 +953,7 @@ static void ath9k_process_rssi(struct at
1498 struct ath_softc *sc = hw->priv;
1499 struct ath_hw *ah = common->ah;
1500 int last_rssi;
1501 + int rssi = rx_stats->rs_rssi;
1502
1503 if (!rx_stats->is_mybeacon ||
1504 ((ah->opmode != NL80211_IFTYPE_STATION) &&
1505 @@ -965,13 +965,12 @@ static void ath9k_process_rssi(struct at
1506
1507 last_rssi = sc->last_rssi;
1508 if (likely(last_rssi != ATH_RSSI_DUMMY_MARKER))
1509 - rx_stats->rs_rssi = ATH_EP_RND(last_rssi,
1510 - ATH_RSSI_EP_MULTIPLIER);
1511 - if (rx_stats->rs_rssi < 0)
1512 - rx_stats->rs_rssi = 0;
1513 + rssi = ATH_EP_RND(last_rssi, ATH_RSSI_EP_MULTIPLIER);
1514 + if (rssi < 0)
1515 + rssi = 0;
1516
1517 /* Update Beacon RSSI, this is used by ANI. */
1518 - ah->stats.avgbrssi = rx_stats->rs_rssi;
1519 + ah->stats.avgbrssi = rssi;
1520 }
1521
1522 /*
1523 @@ -988,8 +987,6 @@ static int ath9k_rx_skb_preprocess(struc
1524 {
1525 struct ath_hw *ah = common->ah;
1526
1527 - memset(rx_status, 0, sizeof(struct ieee80211_rx_status));
1528 -
1529 /*
1530 * everything but the rate is checked here, the rate check is done
1531 * separately to avoid doing two lookups for a rate for each frame.
1532 @@ -1011,6 +1008,8 @@ static int ath9k_rx_skb_preprocess(struc
1533 rx_status->signal = ah->noise + rx_stats->rs_rssi;
1534 rx_status->antenna = rx_stats->rs_antenna;
1535 rx_status->flag |= RX_FLAG_MACTIME_MPDU;
1536 + if (rx_stats->rs_moreaggr)
1537 + rx_status->flag |= RX_FLAG_NO_SIGNAL_VAL;
1538
1539 return 0;
1540 }
1541 @@ -1845,6 +1844,8 @@ int ath_rx_tasklet(struct ath_softc *sc,
1542 if (sc->sc_flags & SC_OP_RXFLUSH)
1543 goto requeue_drop_frag;
1544
1545 + memset(rxs, 0, sizeof(struct ieee80211_rx_status));
1546 +
1547 rxs->mactime = (tsf & ~0xffffffffULL) | rs.rs_tstamp;
1548 if (rs.rs_tstamp > tsf_lower &&
1549 unlikely(rs.rs_tstamp - tsf_lower > 0x10000000))
1550 --- a/drivers/net/wireless/ath/ath9k/beacon.c
1551 +++ b/drivers/net/wireless/ath/ath9k/beacon.c
1552 @@ -91,7 +91,7 @@ static void ath_beacon_setup(struct ath_
1553 info.txpower = MAX_RATE_POWER;
1554 info.keyix = ATH9K_TXKEYIX_INVALID;
1555 info.keytype = ATH9K_KEY_TYPE_CLEAR;
1556 - info.flags = ATH9K_TXDESC_NOACK;
1557 + info.flags = ATH9K_TXDESC_NOACK | ATH9K_TXDESC_INTREQ;
1558
1559 info.buf_addr[0] = bf->bf_buf_addr;
1560 info.buf_len[0] = roundup(skb->len, 4);
1561 @@ -355,7 +355,6 @@ void ath_beacon_tasklet(unsigned long da
1562 struct ath_common *common = ath9k_hw_common(ah);
1563 struct ath_buf *bf = NULL;
1564 struct ieee80211_vif *vif;
1565 - struct ath_tx_status ts;
1566 bool edma = !!(ah->caps.hw_caps & ATH9K_HW_CAP_EDMA);
1567 int slot;
1568 u32 bfaddr, bc = 0;
1569 @@ -462,11 +461,6 @@ void ath_beacon_tasklet(unsigned long da
1570 ath9k_hw_txstart(ah, sc->beacon.beaconq);
1571
1572 sc->beacon.ast_be_xmit += bc; /* XXX per-vif? */
1573 - if (edma) {
1574 - spin_lock_bh(&sc->sc_pcu_lock);
1575 - ath9k_hw_txprocdesc(ah, bf->bf_desc, (void *)&ts);
1576 - spin_unlock_bh(&sc->sc_pcu_lock);
1577 - }
1578 }
1579 }
1580
1581 --- a/drivers/net/wireless/ath/ath9k/mac.c
1582 +++ b/drivers/net/wireless/ath/ath9k/mac.c
1583 @@ -745,7 +745,11 @@ int ath9k_hw_beaconq_setup(struct ath_hw
1584 qi.tqi_aifs = 1;
1585 qi.tqi_cwmin = 0;
1586 qi.tqi_cwmax = 0;
1587 - /* NB: don't enable any interrupts */
1588 +
1589 + if (ah->caps.hw_caps & ATH9K_HW_CAP_EDMA)
1590 + qi.tqi_qflags = TXQ_FLAG_TXOKINT_ENABLE |
1591 + TXQ_FLAG_TXERRINT_ENABLE;
1592 +
1593 return ath9k_hw_setuptxqueue(ah, ATH9K_TX_QUEUE_BEACON, &qi);
1594 }
1595 EXPORT_SYMBOL(ath9k_hw_beaconq_setup);
1596 --- a/drivers/net/wireless/ath/ath9k/main.c
1597 +++ b/drivers/net/wireless/ath/ath9k/main.c
1598 @@ -118,13 +118,15 @@ void ath9k_ps_restore(struct ath_softc *
1599 if (--sc->ps_usecount != 0)
1600 goto unlock;
1601
1602 - if (sc->ps_idle && (sc->ps_flags & PS_WAIT_FOR_TX_ACK))
1603 + if (sc->ps_flags & PS_WAIT_FOR_TX_ACK)
1604 + goto unlock;
1605 +
1606 + if (sc->ps_idle)
1607 mode = ATH9K_PM_FULL_SLEEP;
1608 else if (sc->ps_enabled &&
1609 !(sc->ps_flags & (PS_WAIT_FOR_BEACON |
1610 PS_WAIT_FOR_CAB |
1611 - PS_WAIT_FOR_PSPOLL_DATA |
1612 - PS_WAIT_FOR_TX_ACK)))
1613 + PS_WAIT_FOR_PSPOLL_DATA)))
1614 mode = ATH9K_PM_NETWORK_SLEEP;
1615 else
1616 goto unlock;
1617 @@ -1955,6 +1957,7 @@ static void ath9k_config_bss(struct ath_
1618 sc->sc_flags &= ~SC_OP_ANI_RUN;
1619 del_timer_sync(&common->ani.timer);
1620 memset(&sc->caldata, 0, sizeof(sc->caldata));
1621 + ath9k_hw_ani_init(sc->sc_ah);
1622 }
1623 }
1624
1625 @@ -2300,6 +2303,7 @@ static int ath9k_tx_last_beacon(struct i
1626 struct ath_vif *avp;
1627 struct ath_buf *bf;
1628 struct ath_tx_status ts;
1629 + bool edma = !!(ah->caps.hw_caps & ATH9K_HW_CAP_EDMA);
1630 int status;
1631
1632 vif = sc->beacon.bslot[0];
1633 @@ -2310,7 +2314,7 @@ static int ath9k_tx_last_beacon(struct i
1634 if (!avp->is_bslot_active)
1635 return 0;
1636
1637 - if (!sc->beacon.tx_processed) {
1638 + if (!sc->beacon.tx_processed && !edma) {
1639 tasklet_disable(&sc->bcon_tasklet);
1640
1641 bf = avp->av_bcbuf;
1642 --- a/drivers/net/wireless/ath/ath9k/xmit.c
1643 +++ b/drivers/net/wireless/ath/ath9k/xmit.c
1644 @@ -2296,9 +2296,12 @@ void ath_tx_edma_tasklet(struct ath_soft
1645 break;
1646 }
1647
1648 - /* Skip beacon completions */
1649 - if (ts.qid == sc->beacon.beaconq)
1650 + /* Process beacon completions separately */
1651 + if (ts.qid == sc->beacon.beaconq) {
1652 + sc->beacon.tx_processed = true;
1653 + sc->beacon.tx_last = !(ts.ts_status & ATH9K_TXERR_MASK);
1654 continue;
1655 + }
1656
1657 txq = &sc->tx.txq[ts.qid];
1658
1659 --- a/drivers/net/wireless/ath/ath9k/ath9k.h
1660 +++ b/drivers/net/wireless/ath/ath9k/ath9k.h
1661 @@ -299,7 +299,6 @@ struct ath_tx {
1662
1663 struct ath_rx_edma {
1664 struct sk_buff_head rx_fifo;
1665 - struct sk_buff_head rx_buffers;
1666 u32 rx_fifo_hwsize;
1667 };
1668
1669 --- a/drivers/net/wireless/ath/ath9k/ani.c
1670 +++ b/drivers/net/wireless/ath/ath9k/ani.c
1671 @@ -46,8 +46,8 @@ static const struct ani_ofdm_level_entry
1672 { 5, 4, 1 }, /* lvl 5 */
1673 { 6, 5, 1 }, /* lvl 6 */
1674 { 7, 6, 1 }, /* lvl 7 */
1675 - { 7, 7, 1 }, /* lvl 8 */
1676 - { 7, 8, 0 } /* lvl 9 */
1677 + { 7, 6, 0 }, /* lvl 8 */
1678 + { 7, 7, 0 } /* lvl 9 */
1679 };
1680 #define ATH9K_ANI_OFDM_NUM_LEVEL \
1681 ARRAY_SIZE(ofdm_level_table)
1682 @@ -91,8 +91,8 @@ static const struct ani_cck_level_entry
1683 { 4, 0 }, /* lvl 4 */
1684 { 5, 0 }, /* lvl 5 */
1685 { 6, 0 }, /* lvl 6 */
1686 - { 7, 0 }, /* lvl 7 (only for high rssi) */
1687 - { 8, 0 } /* lvl 8 (only for high rssi) */
1688 + { 6, 0 }, /* lvl 7 (only for high rssi) */
1689 + { 7, 0 } /* lvl 8 (only for high rssi) */
1690 };
1691
1692 #define ATH9K_ANI_CCK_NUM_LEVEL \
1693 @@ -290,16 +290,9 @@ static void ath9k_hw_set_ofdm_nil(struct
1694 ATH9K_ANI_FIRSTEP_LEVEL,
1695 entry_ofdm->fir_step_level);
1696
1697 - if ((ah->opmode != NL80211_IFTYPE_STATION &&
1698 - ah->opmode != NL80211_IFTYPE_ADHOC) ||
1699 - aniState->noiseFloor <= aniState->rssiThrHigh) {
1700 - if (aniState->ofdmWeakSigDetectOff)
1701 - /* force on ofdm weak sig detect */
1702 - ath9k_hw_ani_control(ah,
1703 - ATH9K_ANI_OFDM_WEAK_SIGNAL_DETECTION,
1704 - true);
1705 - else if (aniState->ofdmWeakSigDetectOff ==
1706 - entry_ofdm->ofdm_weak_signal_on)
1707 + if ((aniState->noiseFloor >= aniState->rssiThrHigh) &&
1708 + (aniState->ofdmWeakSigDetectOff !=
1709 + entry_ofdm->ofdm_weak_signal_on)) {
1710 ath9k_hw_ani_control(ah,
1711 ATH9K_ANI_OFDM_WEAK_SIGNAL_DETECTION,
1712 entry_ofdm->ofdm_weak_signal_on);
1713 @@ -717,26 +710,30 @@ void ath9k_hw_ani_monitor(struct ath_hw
1714 ofdmPhyErrRate, aniState->cckNoiseImmunityLevel,
1715 cckPhyErrRate, aniState->ofdmsTurn);
1716
1717 - if (aniState->listenTime > 5 * ah->aniperiod) {
1718 - if (ofdmPhyErrRate <= ah->config.ofdm_trig_low &&
1719 - cckPhyErrRate <= ah->config.cck_trig_low) {
1720 + if (aniState->listenTime > ah->aniperiod) {
1721 + if (cckPhyErrRate < ah->config.cck_trig_low &&
1722 + ((ofdmPhyErrRate < ah->config.ofdm_trig_low &&
1723 + aniState->ofdmNoiseImmunityLevel <
1724 + ATH9K_ANI_OFDM_DEF_LEVEL) ||
1725 + (ofdmPhyErrRate < ATH9K_ANI_OFDM_TRIG_LOW_ABOVE_INI &&
1726 + aniState->ofdmNoiseImmunityLevel >=
1727 + ATH9K_ANI_OFDM_DEF_LEVEL))) {
1728 ath9k_hw_ani_lower_immunity(ah);
1729 aniState->ofdmsTurn = !aniState->ofdmsTurn;
1730 - }
1731 - ath9k_ani_restart(ah);
1732 - } else if (aniState->listenTime > ah->aniperiod) {
1733 - /* check to see if need to raise immunity */
1734 - if (ofdmPhyErrRate > ah->config.ofdm_trig_high &&
1735 - (cckPhyErrRate <= ah->config.cck_trig_high ||
1736 - aniState->ofdmsTurn)) {
1737 + } else if ((ofdmPhyErrRate > ah->config.ofdm_trig_high &&
1738 + aniState->ofdmNoiseImmunityLevel >=
1739 + ATH9K_ANI_OFDM_DEF_LEVEL) ||
1740 + (ofdmPhyErrRate >
1741 + ATH9K_ANI_OFDM_TRIG_HIGH_BELOW_INI &&
1742 + aniState->ofdmNoiseImmunityLevel <
1743 + ATH9K_ANI_OFDM_DEF_LEVEL)) {
1744 ath9k_hw_ani_ofdm_err_trigger(ah);
1745 - ath9k_ani_restart(ah);
1746 aniState->ofdmsTurn = false;
1747 } else if (cckPhyErrRate > ah->config.cck_trig_high) {
1748 ath9k_hw_ani_cck_err_trigger(ah);
1749 - ath9k_ani_restart(ah);
1750 aniState->ofdmsTurn = true;
1751 }
1752 + ath9k_ani_restart(ah);
1753 }
1754 }
1755 EXPORT_SYMBOL(ath9k_hw_ani_monitor);
1756 @@ -911,3 +908,4 @@ void ath9k_hw_ani_init(struct ath_hw *ah
1757 ath9k_ani_restart(ah);
1758 ath9k_enable_mib_counters(ah);
1759 }
1760 +EXPORT_SYMBOL(ath9k_hw_ani_init);
1761 --- a/drivers/net/wireless/ath/ath9k/ani.h
1762 +++ b/drivers/net/wireless/ath/ath9k/ani.h
1763 @@ -25,11 +25,13 @@
1764
1765 /* units are errors per second */
1766 #define ATH9K_ANI_OFDM_TRIG_HIGH_OLD 500
1767 -#define ATH9K_ANI_OFDM_TRIG_HIGH_NEW 1000
1768 +#define ATH9K_ANI_OFDM_TRIG_HIGH_NEW 3500
1769 +#define ATH9K_ANI_OFDM_TRIG_HIGH_BELOW_INI 1000
1770
1771 /* units are errors per second */
1772 #define ATH9K_ANI_OFDM_TRIG_LOW_OLD 200
1773 #define ATH9K_ANI_OFDM_TRIG_LOW_NEW 400
1774 +#define ATH9K_ANI_OFDM_TRIG_LOW_ABOVE_INI 900
1775
1776 /* units are errors per second */
1777 #define ATH9K_ANI_CCK_TRIG_HIGH_OLD 200
1778 @@ -53,7 +55,7 @@
1779 #define ATH9K_ANI_RSSI_THR_LOW 7
1780
1781 #define ATH9K_ANI_PERIOD_OLD 100
1782 -#define ATH9K_ANI_PERIOD_NEW 1000
1783 +#define ATH9K_ANI_PERIOD_NEW 300
1784
1785 /* in ms */
1786 #define ATH9K_ANI_POLLINTERVAL_OLD 100
1787 --- a/drivers/net/wireless/ath/ath9k/ar5008_phy.c
1788 +++ b/drivers/net/wireless/ath/ath9k/ar5008_phy.c
1789 @@ -1056,46 +1056,8 @@ static bool ar5008_hw_ani_control_old(st
1790 break;
1791 }
1792 case ATH9K_ANI_OFDM_WEAK_SIGNAL_DETECTION:{
1793 - static const int m1ThreshLow[] = { 127, 50 };
1794 - static const int m2ThreshLow[] = { 127, 40 };
1795 - static const int m1Thresh[] = { 127, 0x4d };
1796 - static const int m2Thresh[] = { 127, 0x40 };
1797 - static const int m2CountThr[] = { 31, 16 };
1798 - static const int m2CountThrLow[] = { 63, 48 };
1799 u32 on = param ? 1 : 0;
1800
1801 - REG_RMW_FIELD(ah, AR_PHY_SFCORR_LOW,
1802 - AR_PHY_SFCORR_LOW_M1_THRESH_LOW,
1803 - m1ThreshLow[on]);
1804 - REG_RMW_FIELD(ah, AR_PHY_SFCORR_LOW,
1805 - AR_PHY_SFCORR_LOW_M2_THRESH_LOW,
1806 - m2ThreshLow[on]);
1807 - REG_RMW_FIELD(ah, AR_PHY_SFCORR,
1808 - AR_PHY_SFCORR_M1_THRESH,
1809 - m1Thresh[on]);
1810 - REG_RMW_FIELD(ah, AR_PHY_SFCORR,
1811 - AR_PHY_SFCORR_M2_THRESH,
1812 - m2Thresh[on]);
1813 - REG_RMW_FIELD(ah, AR_PHY_SFCORR,
1814 - AR_PHY_SFCORR_M2COUNT_THR,
1815 - m2CountThr[on]);
1816 - REG_RMW_FIELD(ah, AR_PHY_SFCORR_LOW,
1817 - AR_PHY_SFCORR_LOW_M2COUNT_THR_LOW,
1818 - m2CountThrLow[on]);
1819 -
1820 - REG_RMW_FIELD(ah, AR_PHY_SFCORR_EXT,
1821 - AR_PHY_SFCORR_EXT_M1_THRESH_LOW,
1822 - m1ThreshLow[on]);
1823 - REG_RMW_FIELD(ah, AR_PHY_SFCORR_EXT,
1824 - AR_PHY_SFCORR_EXT_M2_THRESH_LOW,
1825 - m2ThreshLow[on]);
1826 - REG_RMW_FIELD(ah, AR_PHY_SFCORR_EXT,
1827 - AR_PHY_SFCORR_EXT_M1_THRESH,
1828 - m1Thresh[on]);
1829 - REG_RMW_FIELD(ah, AR_PHY_SFCORR_EXT,
1830 - AR_PHY_SFCORR_EXT_M2_THRESH,
1831 - m2Thresh[on]);
1832 -
1833 if (on)
1834 REG_SET_BIT(ah, AR_PHY_SFCORR_LOW,
1835 AR_PHY_SFCORR_LOW_USE_SELF_CORR_LOW);
1836 --- a/drivers/net/wireless/ath/ath9k/ar9003_phy.c
1837 +++ b/drivers/net/wireless/ath/ath9k/ar9003_phy.c
1838 @@ -824,55 +824,6 @@ static bool ar9003_hw_ani_control(struct
1839 * on == 0 means more noise imm
1840 */
1841 u32 on = param ? 1 : 0;
1842 - /*
1843 - * make register setting for default
1844 - * (weak sig detect ON) come from INI file
1845 - */
1846 - int m1ThreshLow = on ?
1847 - aniState->iniDef.m1ThreshLow : m1ThreshLow_off;
1848 - int m2ThreshLow = on ?
1849 - aniState->iniDef.m2ThreshLow : m2ThreshLow_off;
1850 - int m1Thresh = on ?
1851 - aniState->iniDef.m1Thresh : m1Thresh_off;
1852 - int m2Thresh = on ?
1853 - aniState->iniDef.m2Thresh : m2Thresh_off;
1854 - int m2CountThr = on ?
1855 - aniState->iniDef.m2CountThr : m2CountThr_off;
1856 - int m2CountThrLow = on ?
1857 - aniState->iniDef.m2CountThrLow : m2CountThrLow_off;
1858 - int m1ThreshLowExt = on ?
1859 - aniState->iniDef.m1ThreshLowExt : m1ThreshLowExt_off;
1860 - int m2ThreshLowExt = on ?
1861 - aniState->iniDef.m2ThreshLowExt : m2ThreshLowExt_off;
1862 - int m1ThreshExt = on ?
1863 - aniState->iniDef.m1ThreshExt : m1ThreshExt_off;
1864 - int m2ThreshExt = on ?
1865 - aniState->iniDef.m2ThreshExt : m2ThreshExt_off;
1866 -
1867 - REG_RMW_FIELD(ah, AR_PHY_SFCORR_LOW,
1868 - AR_PHY_SFCORR_LOW_M1_THRESH_LOW,
1869 - m1ThreshLow);
1870 - REG_RMW_FIELD(ah, AR_PHY_SFCORR_LOW,
1871 - AR_PHY_SFCORR_LOW_M2_THRESH_LOW,
1872 - m2ThreshLow);
1873 - REG_RMW_FIELD(ah, AR_PHY_SFCORR,
1874 - AR_PHY_SFCORR_M1_THRESH, m1Thresh);
1875 - REG_RMW_FIELD(ah, AR_PHY_SFCORR,
1876 - AR_PHY_SFCORR_M2_THRESH, m2Thresh);
1877 - REG_RMW_FIELD(ah, AR_PHY_SFCORR,
1878 - AR_PHY_SFCORR_M2COUNT_THR, m2CountThr);
1879 - REG_RMW_FIELD(ah, AR_PHY_SFCORR_LOW,
1880 - AR_PHY_SFCORR_LOW_M2COUNT_THR_LOW,
1881 - m2CountThrLow);
1882 -
1883 - REG_RMW_FIELD(ah, AR_PHY_SFCORR_EXT,
1884 - AR_PHY_SFCORR_EXT_M1_THRESH_LOW, m1ThreshLowExt);
1885 - REG_RMW_FIELD(ah, AR_PHY_SFCORR_EXT,
1886 - AR_PHY_SFCORR_EXT_M2_THRESH_LOW, m2ThreshLowExt);
1887 - REG_RMW_FIELD(ah, AR_PHY_SFCORR_EXT,
1888 - AR_PHY_SFCORR_EXT_M1_THRESH, m1ThreshExt);
1889 - REG_RMW_FIELD(ah, AR_PHY_SFCORR_EXT,
1890 - AR_PHY_SFCORR_EXT_M2_THRESH, m2ThreshExt);
1891
1892 if (on)
1893 REG_SET_BIT(ah, AR_PHY_SFCORR_LOW,
1894 --- a/drivers/net/wireless/rt2x00/rt2x00dev.c
1895 +++ b/drivers/net/wireless/rt2x00/rt2x00dev.c
1896 @@ -430,10 +430,14 @@ void rt2x00lib_txdone(struct queue_entry
1897 /*
1898 * If the data queue was below the threshold before the txdone
1899 * handler we must make sure the packet queue in the mac80211 stack
1900 - * is reenabled when the txdone handler has finished.
1901 + * is reenabled when the txdone handler has finished. This has to be
1902 + * serialized with rt2x00mac_tx(), otherwise we can wake up queue
1903 + * before it was stopped.
1904 */
1905 + spin_lock_bh(&entry->queue->tx_lock);
1906 if (!rt2x00queue_threshold(entry->queue))
1907 rt2x00queue_unpause_queue(entry->queue);
1908 + spin_unlock_bh(&entry->queue->tx_lock);
1909 }
1910 EXPORT_SYMBOL_GPL(rt2x00lib_txdone);
1911
1912 --- a/drivers/net/wireless/rt2x00/rt2x00mac.c
1913 +++ b/drivers/net/wireless/rt2x00/rt2x00mac.c
1914 @@ -152,13 +152,22 @@ void rt2x00mac_tx(struct ieee80211_hw *h
1915 if (unlikely(rt2x00queue_write_tx_frame(queue, skb, false)))
1916 goto exit_fail;
1917
1918 + /*
1919 + * Pausing queue has to be serialized with rt2x00lib_txdone(). Note
1920 + * we should not use spin_lock_bh variant as bottom halve was already
1921 + * disabled before ieee80211_xmit() call.
1922 + */
1923 + spin_lock(&queue->tx_lock);
1924 if (rt2x00queue_threshold(queue))
1925 rt2x00queue_pause_queue(queue);
1926 + spin_unlock(&queue->tx_lock);
1927
1928 return;
1929
1930 exit_fail:
1931 + spin_lock(&queue->tx_lock);
1932 rt2x00queue_pause_queue(queue);
1933 + spin_unlock(&queue->tx_lock);
1934 exit_free_skb:
1935 ieee80211_free_txskb(hw, skb);
1936 }
1937 --- a/drivers/net/wireless/rt2x00/rt2x00queue.c
1938 +++ b/drivers/net/wireless/rt2x00/rt2x00queue.c
1939 @@ -619,6 +619,9 @@ int rt2x00queue_write_tx_frame(struct da
1940 else if (test_bit(REQUIRE_DMA, &queue->rt2x00dev->cap_flags))
1941 rt2x00queue_align_frame(skb);
1942
1943 + /*
1944 + * That function must be called with bh disabled.
1945 + */
1946 spin_lock(&queue->tx_lock);
1947
1948 if (unlikely(rt2x00queue_full(queue))) {
This page took 0.127322 seconds and 5 git commands to generate.