mac80211: reorganize patches, fold in patches that were merged upstream
[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 @@ -510,7 +506,11 @@ int ath9k_hw_process_rxdesc_edma(struct 
33                  */
34                 if (rxsp->status11 & AR_CRCErr)
35                         rxs->rs_status |= ATH9K_RXERR_CRC;
36 -               else if (rxsp->status11 & AR_PHYErr) {
37 +               else if (rxsp->status11 & AR_DecryptCRCErr)
38 +                       rxs->rs_status |= ATH9K_RXERR_DECRYPT;
39 +               else if (rxsp->status11 & AR_MichaelErr)
40 +                       rxs->rs_status |= ATH9K_RXERR_MIC;
41 +               if (rxsp->status11 & AR_PHYErr) {
42                         phyerr = MS(rxsp->status11, AR_PHYErrCode);
43                         /*
44                          * If we reach a point here where AR_PostDelimCRCErr is
45 @@ -532,11 +532,7 @@ int ath9k_hw_process_rxdesc_edma(struct 
46                                 rxs->rs_status |= ATH9K_RXERR_PHY;
47                                 rxs->rs_phyerr = phyerr;
48                         }
49 -
50 -               } else if (rxsp->status11 & AR_DecryptCRCErr)
51 -                       rxs->rs_status |= ATH9K_RXERR_DECRYPT;
52 -               else if (rxsp->status11 & AR_MichaelErr)
53 -                       rxs->rs_status |= ATH9K_RXERR_MIC;
54 +               };
55         }
56  
57         if (rxsp->status11 & AR_KeyMiss)
58 --- a/drivers/net/wireless/ath/carl9170/tx.c
59 +++ b/drivers/net/wireless/ath/carl9170/tx.c
60 @@ -1236,6 +1236,7 @@ static bool carl9170_tx_ps_drop(struct a
61  {
62         struct ieee80211_sta *sta;
63         struct carl9170_sta_info *sta_info;
64 +       struct ieee80211_tx_info *tx_info;
65  
66         rcu_read_lock();
67         sta = __carl9170_get_tx_sta(ar, skb);
68 @@ -1243,12 +1244,13 @@ static bool carl9170_tx_ps_drop(struct a
69                 goto out_rcu;
70  
71         sta_info = (void *) sta->drv_priv;
72 -       if (unlikely(sta_info->sleeping)) {
73 -               struct ieee80211_tx_info *tx_info;
74 +       tx_info = IEEE80211_SKB_CB(skb);
75  
76 +       if (unlikely(sta_info->sleeping) &&
77 +           !(tx_info->flags & (IEEE80211_TX_CTL_NO_PS_BUFFER |
78 +                               IEEE80211_TX_CTL_CLEAR_PS_FILT))) {
79                 rcu_read_unlock();
80  
81 -               tx_info = IEEE80211_SKB_CB(skb);
82                 if (tx_info->flags & IEEE80211_TX_CTL_AMPDU)
83                         atomic_dec(&ar->tx_ampdu_upload);
84  
85 --- a/drivers/net/wireless/iwlegacy/4965-mac.c
86 +++ b/drivers/net/wireless/iwlegacy/4965-mac.c
87 @@ -1694,7 +1694,7 @@ il4965_tx_skb(struct il_priv *il, struct
88                 sta_priv = (void *)sta->drv_priv;
89  
90         if (sta_priv && sta_priv->asleep &&
91 -           (info->flags & IEEE80211_TX_CTL_POLL_RESPONSE)) {
92 +           (info->flags & IEEE80211_TX_CTL_NO_PS_BUFFER)) {
93                 /*
94                  * This sends an asynchronous command to the device,
95                  * but we can rely on it being processed before the
96 --- a/drivers/net/wireless/iwlwifi/iwl-agn-tx.c
97 +++ b/drivers/net/wireless/iwlwifi/iwl-agn-tx.c
98 @@ -322,7 +322,7 @@ int iwlagn_tx_skb(struct iwl_priv *priv,
99                 sta_priv = (void *)info->control.sta->drv_priv;
100  
101         if (sta_priv && sta_priv->asleep &&
102 -           (info->flags & IEEE80211_TX_CTL_POLL_RESPONSE)) {
103 +           (info->flags & IEEE80211_TX_CTL_NO_PS_BUFFER)) {
104                 /*
105                  * This sends an asynchronous command to the device,
106                  * but we can rely on it being processed before the
107 @@ -331,6 +331,10 @@ int iwlagn_tx_skb(struct iwl_priv *priv,
108                  * counter.
109                  * For now set the counter to just 1 since we do not
110                  * support uAPSD yet.
111 +                *
112 +                * FIXME: If we get two non-bufferable frames one
113 +                * after the other, we might only send out one of
114 +                * them because this is racy.
115                  */
116                 iwl_sta_modify_sleep_tx_count(priv, sta_id, 1);
117         }
118 --- a/drivers/net/wireless/p54/txrx.c
119 +++ b/drivers/net/wireless/p54/txrx.c
120 @@ -690,7 +690,7 @@ static void p54_tx_80211_header(struct p
121         if (!(info->flags & IEEE80211_TX_CTL_ASSIGN_SEQ))
122                 *flags |= P54_HDR_FLAG_DATA_OUT_SEQNR;
123  
124 -       if (info->flags & IEEE80211_TX_CTL_POLL_RESPONSE)
125 +       if (info->flags & IEEE80211_TX_CTL_NO_PS_BUFFER)
126                 *flags |= P54_HDR_FLAG_DATA_OUT_NOCANCEL;
127  
128         if (info->flags & IEEE80211_TX_CTL_CLEAR_PS_FILT)
129 --- a/include/net/mac80211.h
130 +++ b/include/net/mac80211.h
131 @@ -341,9 +341,9 @@ struct ieee80211_bss_conf {
132   *     used to indicate that a frame was already retried due to PS
133   * @IEEE80211_TX_INTFL_DONT_ENCRYPT: completely internal to mac80211,
134   *     used to indicate frame should not be encrypted
135 - * @IEEE80211_TX_CTL_POLL_RESPONSE: This frame is a response to a poll
136 - *     frame (PS-Poll or uAPSD) and should be sent although the station
137 - *     is in powersave mode.
138 + * @IEEE80211_TX_CTL_NO_PS_BUFFER: This frame is a response to a poll
139 + *     frame (PS-Poll or uAPSD) or a non-bufferable MMPDU and must
140 + *     be sent although the station is in powersave mode.
141   * @IEEE80211_TX_CTL_MORE_FRAMES: More frames will be passed to the
142   *     transmit function after the current frame, this can be used
143   *     by drivers to kick the DMA queue only if unset or when the
144 @@ -399,7 +399,7 @@ enum mac80211_tx_control_flags {
145         IEEE80211_TX_INTFL_NEED_TXPROCESSING    = BIT(14),
146         IEEE80211_TX_INTFL_RETRIED              = BIT(15),
147         IEEE80211_TX_INTFL_DONT_ENCRYPT         = BIT(16),
148 -       IEEE80211_TX_CTL_POLL_RESPONSE          = BIT(17),
149 +       IEEE80211_TX_CTL_NO_PS_BUFFER           = BIT(17),
150         IEEE80211_TX_CTL_MORE_FRAMES            = BIT(18),
151         IEEE80211_TX_INTFL_RETRANSMISSION       = BIT(19),
152         /* hole at 20, use later */
153 @@ -425,7 +425,7 @@ enum mac80211_tx_control_flags {
154         IEEE80211_TX_CTL_SEND_AFTER_DTIM | IEEE80211_TX_CTL_AMPDU |           \
155         IEEE80211_TX_STAT_TX_FILTERED | IEEE80211_TX_STAT_ACK |               \
156         IEEE80211_TX_STAT_AMPDU | IEEE80211_TX_STAT_AMPDU_NO_BACK |           \
157 -       IEEE80211_TX_CTL_RATE_CTRL_PROBE | IEEE80211_TX_CTL_POLL_RESPONSE |   \
158 +       IEEE80211_TX_CTL_RATE_CTRL_PROBE | IEEE80211_TX_CTL_NO_PS_BUFFER |    \
159         IEEE80211_TX_CTL_MORE_FRAMES | IEEE80211_TX_CTL_LDPC |                \
160         IEEE80211_TX_CTL_STBC | IEEE80211_TX_STATUS_EOSP)
161  
162 @@ -659,6 +659,8 @@ ieee80211_tx_info_clear_status(struct ie
163   * @RX_FLAG_HT: HT MCS was used and rate_idx is MCS index
164   * @RX_FLAG_40MHZ: HT40 (40 MHz) was used
165   * @RX_FLAG_SHORT_GI: Short guard interval was used
166 + * @RX_FLAG_NO_SIGNAL_VAL: The signal strength value is not present.
167 + *     Valid only for data frames (mainly A-MPDU)
168   */
169  enum mac80211_rx_flags {
170         RX_FLAG_MMIC_ERROR      = 1<<0,
171 @@ -672,6 +674,7 @@ enum mac80211_rx_flags {
172         RX_FLAG_HT              = 1<<9,
173         RX_FLAG_40MHZ           = 1<<10,
174         RX_FLAG_SHORT_GI        = 1<<11,
175 +       RX_FLAG_NO_SIGNAL_VAL   = 1<<12,
176  };
177  
178  /**
179 @@ -1634,7 +1637,7 @@ void ieee80211_free_txskb(struct ieee802
180   * the station sends a PS-Poll or a uAPSD trigger frame, mac80211
181   * will inform the driver of this with the @allow_buffered_frames
182   * callback; this callback is optional. mac80211 will then transmit
183 - * the frames as usual and set the %IEEE80211_TX_CTL_POLL_RESPONSE
184 + * the frames as usual and set the %IEEE80211_TX_CTL_NO_PS_BUFFER
185   * on each frame. The last frame in the service period (or the only
186   * response to a PS-Poll) also has %IEEE80211_TX_STATUS_EOSP set to
187   * indicate that it ends the service period; as this frame must have
188 @@ -1642,6 +1645,9 @@ void ieee80211_free_txskb(struct ieee802
189   * When TX status is reported for this frame, the service period is
190   * marked has having ended and a new one can be started by the peer.
191   *
192 + * Additionally, non-bufferable MMPDUs can also be transmitted by
193 + * mac80211 with the %IEEE80211_TX_CTL_NO_PS_BUFFER set in them.
194 + *
195   * Another race condition can happen on some devices like iwlwifi
196   * when there are frames queued for the station and it wakes up
197   * or polls; the frames that are already queued could end up being
198 @@ -2140,7 +2146,7 @@ enum ieee80211_frame_release_type {
199   * @allow_buffered_frames: Prepare device to allow the given number of frames
200   *     to go out to the given station. The frames will be sent by mac80211
201   *     via the usual TX path after this call. The TX information for frames
202 - *     released will also have the %IEEE80211_TX_CTL_POLL_RESPONSE flag set
203 + *     released will also have the %IEEE80211_TX_CTL_NO_PS_BUFFER flag set
204   *     and the last one will also have %IEEE80211_TX_STATUS_EOSP set. In case
205   *     frames from multiple TIDs are released and the driver might reorder
206   *     them between the TIDs, it must set the %IEEE80211_TX_STATUS_EOSP flag
207 --- a/net/mac80211/agg-rx.c
208 +++ b/net/mac80211/agg-rx.c
209 @@ -187,6 +187,8 @@ static void ieee80211_send_addba_resp(st
210                 memcpy(mgmt->bssid, sdata->u.mgd.bssid, ETH_ALEN);
211         else if (sdata->vif.type == NL80211_IFTYPE_ADHOC)
212                 memcpy(mgmt->bssid, sdata->u.ibss.bssid, ETH_ALEN);
213 +       else if (sdata->vif.type == NL80211_IFTYPE_WDS)
214 +               memcpy(mgmt->bssid, da, ETH_ALEN);
215  
216         mgmt->frame_control = cpu_to_le16(IEEE80211_FTYPE_MGMT |
217                                           IEEE80211_STYPE_ACTION);
218 --- a/net/mac80211/agg-tx.c
219 +++ b/net/mac80211/agg-tx.c
220 @@ -81,7 +81,8 @@ static void ieee80211_send_addba_request
221         memcpy(mgmt->sa, sdata->vif.addr, ETH_ALEN);
222         if (sdata->vif.type == NL80211_IFTYPE_AP ||
223             sdata->vif.type == NL80211_IFTYPE_AP_VLAN ||
224 -           sdata->vif.type == NL80211_IFTYPE_MESH_POINT)
225 +           sdata->vif.type == NL80211_IFTYPE_MESH_POINT ||
226 +           sdata->vif.type == NL80211_IFTYPE_WDS)
227                 memcpy(mgmt->bssid, sdata->vif.addr, ETH_ALEN);
228         else if (sdata->vif.type == NL80211_IFTYPE_STATION)
229                 memcpy(mgmt->bssid, sdata->u.mgd.bssid, ETH_ALEN);
230 @@ -471,6 +472,7 @@ int ieee80211_start_tx_ba_session(struct
231             sdata->vif.type != NL80211_IFTYPE_MESH_POINT &&
232             sdata->vif.type != NL80211_IFTYPE_AP_VLAN &&
233             sdata->vif.type != NL80211_IFTYPE_AP &&
234 +           sdata->vif.type != NL80211_IFTYPE_WDS &&
235             sdata->vif.type != NL80211_IFTYPE_ADHOC)
236                 return -EINVAL;
237  
238 --- a/net/mac80211/debugfs_sta.c
239 +++ b/net/mac80211/debugfs_sta.c
240 @@ -63,11 +63,11 @@ static ssize_t sta_flags_read(struct fil
241         test_sta_flag(sta, WLAN_STA_##flg) ? #flg "\n" : ""
242  
243         int res = scnprintf(buf, sizeof(buf),
244 -                           "%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s",
245 +                           "%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s",
246                             TEST(AUTH), TEST(ASSOC), TEST(PS_STA),
247                             TEST(PS_DRIVER), TEST(AUTHORIZED),
248                             TEST(SHORT_PREAMBLE),
249 -                           TEST(WME), TEST(WDS), TEST(CLEAR_PS_FILT),
250 +                           TEST(WME), TEST(CLEAR_PS_FILT),
251                             TEST(MFP), TEST(BLOCK_BA), TEST(PSPOLL),
252                             TEST(UAPSD), TEST(SP), TEST(TDLS_PEER),
253                             TEST(TDLS_PEER_AUTH), TEST(4ADDR_EVENT),
254 --- a/net/mac80211/iface.c
255 +++ b/net/mac80211/iface.c
256 @@ -178,7 +178,6 @@ static int ieee80211_do_open(struct net_
257  {
258         struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev);
259         struct ieee80211_local *local = sdata->local;
260 -       struct sta_info *sta;
261         u32 changed = 0;
262         int res;
263         u32 hw_reconf_flags = 0;
264 @@ -309,28 +308,6 @@ static int ieee80211_do_open(struct net_
265  
266         set_bit(SDATA_STATE_RUNNING, &sdata->state);
267  
268 -       if (sdata->vif.type == NL80211_IFTYPE_WDS) {
269 -               /* Create STA entry for the WDS peer */
270 -               sta = sta_info_alloc(sdata, sdata->u.wds.remote_addr,
271 -                                    GFP_KERNEL);
272 -               if (!sta) {
273 -                       res = -ENOMEM;
274 -                       goto err_del_interface;
275 -               }
276 -
277 -               sta_info_pre_move_state(sta, IEEE80211_STA_AUTH);
278 -               sta_info_pre_move_state(sta, IEEE80211_STA_ASSOC);
279 -               sta_info_pre_move_state(sta, IEEE80211_STA_AUTHORIZED);
280 -
281 -               res = sta_info_insert(sta);
282 -               if (res) {
283 -                       /* STA has been freed */
284 -                       goto err_del_interface;
285 -               }
286 -
287 -               rate_control_rate_init(sta);
288 -       }
289 -
290         /*
291          * set_multicast_list will be invoked by the networking core
292          * which will check whether any increments here were done in
293 @@ -357,8 +334,7 @@ static int ieee80211_do_open(struct net_
294         netif_tx_start_all_queues(dev);
295  
296         return 0;
297 - err_del_interface:
298 -       drv_remove_interface(local, sdata);
299 +
300   err_stop:
301         if (!local->open_count)
302                 drv_stop(local);
303 @@ -722,6 +698,70 @@ static void ieee80211_if_setup(struct ne
304         dev->destructor = free_netdev;
305  }
306  
307 +static void ieee80211_wds_rx_queued_mgmt(struct ieee80211_sub_if_data *sdata,
308 +                                        struct sk_buff *skb)
309 +{
310 +       struct ieee80211_local *local = sdata->local;
311 +       struct ieee80211_rx_status *rx_status;
312 +       struct ieee802_11_elems elems;
313 +       struct ieee80211_mgmt *mgmt;
314 +       struct sta_info *sta;
315 +       size_t baselen;
316 +       u32 rates = 0;
317 +       u16 stype;
318 +       bool new = false;
319 +       enum ieee80211_band band = local->hw.conf.channel->band;
320 +       struct ieee80211_supported_band *sband = local->hw.wiphy->bands[band];
321 +
322 +       rx_status = IEEE80211_SKB_RXCB(skb);
323 +       mgmt = (struct ieee80211_mgmt *) skb->data;
324 +       stype = le16_to_cpu(mgmt->frame_control) & IEEE80211_FCTL_STYPE;
325 +
326 +       if (stype != IEEE80211_STYPE_BEACON)
327 +               return;
328 +
329 +       baselen = (u8 *) mgmt->u.probe_resp.variable - (u8 *) mgmt;
330 +       if (baselen > skb->len)
331 +               return;
332 +
333 +       ieee802_11_parse_elems(mgmt->u.probe_resp.variable,
334 +                              skb->len - baselen, &elems);
335 +
336 +       rates = ieee80211_sta_get_rates(local, &elems, band);
337 +
338 +       rcu_read_lock();
339 +
340 +       sta = sta_info_get(sdata, sdata->u.wds.remote_addr);
341 +
342 +       if (!sta) {
343 +               rcu_read_unlock();
344 +               sta = sta_info_alloc(sdata, sdata->u.wds.remote_addr,
345 +                                    GFP_KERNEL);
346 +               if (!sta)
347 +                       return;
348 +
349 +               new = true;
350 +       }
351 +
352 +       sta->last_rx = jiffies;
353 +       sta->sta.supp_rates[local->hw.conf.channel->band] = rates;
354 +
355 +       if (elems.ht_cap_elem)
356 +               ieee80211_ht_cap_ie_to_sta_ht_cap(sdata, sband,
357 +                               elems.ht_cap_elem, &sta->sta.ht_cap);
358 +
359 +       if (elems.wmm_param)
360 +               set_sta_flag(sta, WLAN_STA_WME);
361 +
362 +       if (new) {
363 +               set_sta_flag(sta, WLAN_STA_AUTHORIZED);
364 +               rate_control_rate_init(sta);
365 +               sta_info_insert_rcu(sta);
366 +       }
367 +
368 +       rcu_read_unlock();
369 +}
370 +
371  static void ieee80211_iface_work(struct work_struct *work)
372  {
373         struct ieee80211_sub_if_data *sdata =
374 @@ -826,6 +866,9 @@ static void ieee80211_iface_work(struct 
375                                 break;
376                         ieee80211_mesh_rx_queued_mgmt(sdata, skb);
377                         break;
378 +               case NL80211_IFTYPE_WDS:
379 +                       ieee80211_wds_rx_queued_mgmt(sdata, skb);
380 +                       break;
381                 default:
382                         WARN(1, "frame for unexpected interface type");
383                         break;
384 --- a/net/mac80211/rx.c
385 +++ b/net/mac80211/rx.c
386 @@ -177,7 +177,8 @@ ieee80211_add_rx_radiotap_header(struct 
387         pos += 2;
388  
389         /* IEEE80211_RADIOTAP_DBM_ANTSIGNAL */
390 -       if (local->hw.flags & IEEE80211_HW_SIGNAL_DBM) {
391 +       if (local->hw.flags & IEEE80211_HW_SIGNAL_DBM &&
392 +           !(status->flag & RX_FLAG_NO_SIGNAL_VAL)) {
393                 *pos = status->signal;
394                 rthdr->it_present |=
395                         cpu_to_le32(1 << IEEE80211_RADIOTAP_DBM_ANTSIGNAL);
396 @@ -489,12 +490,12 @@ ieee80211_rx_mesh_check(struct ieee80211
397                         if (ieee80211_has_tods(hdr->frame_control) ||
398                                 !ieee80211_has_fromds(hdr->frame_control))
399                                 return RX_DROP_MONITOR;
400 -                       if (memcmp(hdr->addr3, dev_addr, ETH_ALEN) == 0)
401 +                       if (compare_ether_addr(hdr->addr3, dev_addr) == 0)
402                                 return RX_DROP_MONITOR;
403                 } else {
404                         if (!ieee80211_has_a4(hdr->frame_control))
405                                 return RX_DROP_MONITOR;
406 -                       if (memcmp(hdr->addr4, dev_addr, ETH_ALEN) == 0)
407 +                       if (compare_ether_addr(hdr->addr4, dev_addr) == 0)
408                                 return RX_DROP_MONITOR;
409                 }
410         }
411 @@ -1309,8 +1310,10 @@ ieee80211_rx_h_sta_process(struct ieee80
412  
413         sta->rx_fragments++;
414         sta->rx_bytes += rx->skb->len;
415 -       sta->last_signal = status->signal;
416 -       ewma_add(&sta->avg_signal, -status->signal);
417 +       if (!(status->flag & RX_FLAG_NO_SIGNAL_VAL)) {
418 +               sta->last_signal = status->signal;
419 +               ewma_add(&sta->avg_signal, -status->signal);
420 +       }
421  
422         /*
423          * Change STA power saving mode only at the end of a frame
424 @@ -2282,6 +2285,7 @@ ieee80211_rx_h_action(struct ieee80211_r
425                     sdata->vif.type != NL80211_IFTYPE_MESH_POINT &&
426                     sdata->vif.type != NL80211_IFTYPE_AP_VLAN &&
427                     sdata->vif.type != NL80211_IFTYPE_AP &&
428 +                   sdata->vif.type != NL80211_IFTYPE_WDS &&
429                     sdata->vif.type != NL80211_IFTYPE_ADHOC)
430                         break;
431  
432 @@ -2336,7 +2340,7 @@ ieee80211_rx_h_action(struct ieee80211_r
433                         if (sdata->vif.type != NL80211_IFTYPE_STATION)
434                                 break;
435  
436 -                       if (memcmp(mgmt->bssid, sdata->u.mgd.bssid, ETH_ALEN))
437 +                       if (compare_ether_addr(mgmt->bssid, sdata->u.mgd.bssid))
438                                 break;
439  
440                         goto queue;
441 @@ -2492,14 +2496,15 @@ ieee80211_rx_h_mgmt(struct ieee80211_rx_
442  
443         if (!ieee80211_vif_is_mesh(&sdata->vif) &&
444             sdata->vif.type != NL80211_IFTYPE_ADHOC &&
445 -           sdata->vif.type != NL80211_IFTYPE_STATION)
446 +           sdata->vif.type != NL80211_IFTYPE_STATION &&
447 +           sdata->vif.type != NL80211_IFTYPE_WDS)
448                 return RX_DROP_MONITOR;
449  
450         switch (stype) {
451         case cpu_to_le16(IEEE80211_STYPE_AUTH):
452         case cpu_to_le16(IEEE80211_STYPE_BEACON):
453         case cpu_to_le16(IEEE80211_STYPE_PROBE_RESP):
454 -               /* process for all: mesh, mlme, ibss */
455 +               /* process for all: mesh, mlme, ibss, wds */
456                 break;
457         case cpu_to_le16(IEEE80211_STYPE_ASSOC_RESP):
458         case cpu_to_le16(IEEE80211_STYPE_REASSOC_RESP):
459 @@ -2853,10 +2858,16 @@ static int prepare_for_handlers(struct i
460                 }
461                 break;
462         case NL80211_IFTYPE_WDS:
463 -               if (bssid || !ieee80211_is_data(hdr->frame_control))
464 -                       return 0;
465                 if (compare_ether_addr(sdata->u.wds.remote_addr, hdr->addr2))
466                         return 0;
467 +
468 +               if (ieee80211_is_data(hdr->frame_control) ||
469 +                   ieee80211_is_action(hdr->frame_control)) {
470 +                       if (compare_ether_addr(sdata->vif.addr, hdr->addr1))
471 +                               return 0;
472 +               } else if (!ieee80211_is_beacon(hdr->frame_control))
473 +                       return 0;
474 +
475                 break;
476         default:
477                 /* should never get here */
478 --- a/net/mac80211/sta_info.c
479 +++ b/net/mac80211/sta_info.c
480 @@ -9,6 +9,7 @@
481  
482  #include <linux/module.h>
483  #include <linux/init.h>
484 +#include <linux/etherdevice.h>
485  #include <linux/netdevice.h>
486  #include <linux/types.h>
487  #include <linux/slab.h>
488 @@ -101,7 +102,7 @@ struct sta_info *sta_info_get(struct iee
489                                     lockdep_is_held(&local->sta_mtx));
490         while (sta) {
491                 if (sta->sdata == sdata &&
492 -                   memcmp(sta->sta.addr, addr, ETH_ALEN) == 0)
493 +                   compare_ether_addr(sta->sta.addr, addr) == 0)
494                         break;
495                 sta = rcu_dereference_check(sta->hnext,
496                                             lockdep_is_held(&local->sta_mtx));
497 @@ -124,7 +125,7 @@ struct sta_info *sta_info_get_bss(struct
498         while (sta) {
499                 if ((sta->sdata == sdata ||
500                      (sta->sdata->bss && sta->sdata->bss == sdata->bss)) &&
501 -                   memcmp(sta->sta.addr, addr, ETH_ALEN) == 0)
502 +                   compare_ether_addr(sta->sta.addr, addr) == 0)
503                         break;
504                 sta = rcu_dereference_check(sta->hnext,
505                                             lockdep_is_held(&local->sta_mtx));
506 @@ -1050,7 +1051,7 @@ static void ieee80211_send_null_response
507          * exchange. Also set EOSP to indicate this packet
508          * ends the poll/service period.
509          */
510 -       info->flags |= IEEE80211_TX_CTL_POLL_RESPONSE |
511 +       info->flags |= IEEE80211_TX_CTL_NO_PS_BUFFER |
512                        IEEE80211_TX_STATUS_EOSP |
513                        IEEE80211_TX_CTL_REQ_TX_STATUS;
514  
515 @@ -1177,7 +1178,7 @@ ieee80211_sta_ps_deliver_response(struct
516                          * STA may still remain is PS mode after this frame
517                          * exchange.
518                          */
519 -                       info->flags |= IEEE80211_TX_CTL_POLL_RESPONSE;
520 +                       info->flags |= IEEE80211_TX_CTL_NO_PS_BUFFER;
521  
522                         /*
523                          * Use MoreData flag to indicate whether there are
524 --- a/net/mac80211/sta_info.h
525 +++ b/net/mac80211/sta_info.h
526 @@ -14,6 +14,7 @@
527  #include <linux/if_ether.h>
528  #include <linux/workqueue.h>
529  #include <linux/average.h>
530 +#include <linux/etherdevice.h>
531  #include "key.h"
532  
533  /**
534 @@ -31,7 +32,6 @@
535   * @WLAN_STA_SHORT_PREAMBLE: Station is capable of receiving short-preamble
536   *     frames.
537   * @WLAN_STA_WME: Station is a QoS-STA.
538 - * @WLAN_STA_WDS: Station is one of our WDS peers.
539   * @WLAN_STA_CLEAR_PS_FILT: Clear PS filter in hardware (using the
540   *     IEEE80211_TX_CTL_CLEAR_PS_FILT control flag) when the next
541   *     frame to this station is transmitted.
542 @@ -62,7 +62,6 @@ enum ieee80211_sta_info_flags {
543         WLAN_STA_AUTHORIZED,
544         WLAN_STA_SHORT_PREAMBLE,
545         WLAN_STA_WME,
546 -       WLAN_STA_WDS,
547         WLAN_STA_CLEAR_PS_FILT,
548         WLAN_STA_MFP,
549         WLAN_STA_BLOCK_BA,
550 @@ -489,7 +488,7 @@ void for_each_sta_info_type_check(struct
551                 nxt = _sta ? rcu_dereference(_sta->hnext) : NULL        \
552              )                                                          \
553         /* compare address and run code only if it matches */           \
554 -       if (memcmp(_sta->sta.addr, (_addr), ETH_ALEN) == 0)
555 +       if (compare_ether_addr(_sta->sta.addr, (_addr)) == 0)
556  
557  /*
558   * Get STA info by index, BROKEN!
559 --- a/net/mac80211/tx.c
560 +++ b/net/mac80211/tx.c
561 @@ -448,18 +448,23 @@ ieee80211_tx_h_unicast_ps_buf(struct iee
562         struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)tx->skb->data;
563         struct ieee80211_local *local = tx->local;
564  
565 -       if (unlikely(!sta ||
566 -                    ieee80211_is_probe_resp(hdr->frame_control) ||
567 -                    ieee80211_is_auth(hdr->frame_control) ||
568 -                    ieee80211_is_assoc_resp(hdr->frame_control) ||
569 -                    ieee80211_is_reassoc_resp(hdr->frame_control)))
570 +       if (unlikely(!sta))
571                 return TX_CONTINUE;
572  
573         if (unlikely((test_sta_flag(sta, WLAN_STA_PS_STA) ||
574                       test_sta_flag(sta, WLAN_STA_PS_DRIVER)) &&
575 -                    !(info->flags & IEEE80211_TX_CTL_POLL_RESPONSE))) {
576 +                    !(info->flags & IEEE80211_TX_CTL_NO_PS_BUFFER))) {
577                 int ac = skb_get_queue_mapping(tx->skb);
578  
579 +               /* only deauth, disassoc and action are bufferable MMPDUs */
580 +               if (ieee80211_is_mgmt(hdr->frame_control) &&
581 +                   !ieee80211_is_deauth(hdr->frame_control) &&
582 +                   !ieee80211_is_disassoc(hdr->frame_control) &&
583 +                   !ieee80211_is_action(hdr->frame_control)) {
584 +                       info->flags |= IEEE80211_TX_CTL_NO_PS_BUFFER;
585 +                       return TX_CONTINUE;
586 +               }
587 +
588  #ifdef CONFIG_MAC80211_VERBOSE_PS_DEBUG
589                 printk(KERN_DEBUG "STA %pM aid %d: PS buffer for AC %d\n",
590                        sta->sta.addr, sta->sta.aid, ac);
591 --- a/net/mac80211/ieee80211_i.h
592 +++ b/net/mac80211/ieee80211_i.h
593 @@ -480,7 +480,7 @@ struct ieee80211_if_ibss {
594  
595         bool control_port;
596  
597 -       u8 bssid[ETH_ALEN];
598 +       u8 bssid[ETH_ALEN] __aligned(2);
599         u8 ssid[IEEE80211_MAX_SSID_LEN];
600         u8 ssid_len, ie_len;
601         u8 *ie;
602 --- a/net/mac80211/ibss.c
603 +++ b/net/mac80211/ibss.c
604 @@ -66,7 +66,7 @@ static void __ieee80211_sta_join_ibss(st
605         skb_reset_tail_pointer(skb);
606         skb_reserve(skb, sdata->local->hw.extra_tx_headroom);
607  
608 -       if (memcmp(ifibss->bssid, bssid, ETH_ALEN))
609 +       if (compare_ether_addr(ifibss->bssid, bssid))
610                 sta_info_flush(sdata->local, sdata);
611  
612         /* if merging, indicate to driver that we leave the old IBSS */
613 @@ -403,7 +403,7 @@ static void ieee80211_rx_bss_info(struct
614                 return;
615  
616         if (sdata->vif.type == NL80211_IFTYPE_ADHOC &&
617 -           memcmp(mgmt->bssid, sdata->u.ibss.bssid, ETH_ALEN) == 0) {
618 +           compare_ether_addr(mgmt->bssid, sdata->u.ibss.bssid) == 0) {
619  
620                 rcu_read_lock();
621                 sta = sta_info_get(sdata, mgmt->sa);
622 @@ -508,7 +508,7 @@ static void ieee80211_rx_bss_info(struct
623                 goto put_bss;
624  
625         /* same BSSID */
626 -       if (memcmp(cbss->bssid, sdata->u.ibss.bssid, ETH_ALEN) == 0)
627 +       if (compare_ether_addr(cbss->bssid, sdata->u.ibss.bssid) == 0)
628                 goto put_bss;
629  
630         if (rx_status->flag & RX_FLAG_MACTIME_MPDU) {
631 @@ -831,8 +831,8 @@ static void ieee80211_rx_mgmt_probe_req(
632         if (!tx_last_beacon && is_multicast_ether_addr(mgmt->da))
633                 return;
634  
635 -       if (memcmp(mgmt->bssid, ifibss->bssid, ETH_ALEN) != 0 &&
636 -           memcmp(mgmt->bssid, "\xff\xff\xff\xff\xff\xff", ETH_ALEN) != 0)
637 +       if (compare_ether_addr(mgmt->bssid, ifibss->bssid) != 0 &&
638 +           !is_broadcast_ether_addr(mgmt->bssid))
639                 return;
640  
641         end = ((u8 *) mgmt) + len;
642 --- a/net/mac80211/mesh.c
643 +++ b/net/mac80211/mesh.c
644 @@ -204,7 +204,7 @@ int mesh_rmc_check(u8 *sa, struct ieee80
645                         kmem_cache_free(rm_cache, p);
646                         --entries;
647                 } else if ((seqnum == p->seqnum) &&
648 -                          (memcmp(sa, p->sa, ETH_ALEN) == 0))
649 +                          (compare_ether_addr(sa, p->sa) == 0))
650                         return -1;
651         }
652  
653 --- a/net/mac80211/mesh_hwmp.c
654 +++ b/net/mac80211/mesh_hwmp.c
655 @@ -8,6 +8,7 @@
656   */
657  
658  #include <linux/slab.h>
659 +#include <linux/etherdevice.h>
660  #include <asm/unaligned.h>
661  #include "wme.h"
662  #include "mesh.h"
663 @@ -419,7 +420,7 @@ static u32 hwmp_route_info_get(struct ie
664                 new_metric = MAX_METRIC;
665         exp_time = TU_TO_EXP_TIME(orig_lifetime);
666  
667 -       if (memcmp(orig_addr, sdata->vif.addr, ETH_ALEN) == 0) {
668 +       if (compare_ether_addr(orig_addr, sdata->vif.addr) == 0) {
669                 /* This MP is the originator, we are not interested in this
670                  * frame, except for updating transmitter's path info.
671                  */
672 @@ -469,7 +470,7 @@ static u32 hwmp_route_info_get(struct ie
673  
674         /* Update and check transmitter routing info */
675         ta = mgmt->sa;
676 -       if (memcmp(orig_addr, ta, ETH_ALEN) == 0)
677 +       if (compare_ether_addr(orig_addr, ta) == 0)
678                 fresh_info = false;
679         else {
680                 fresh_info = true;
681 @@ -529,7 +530,7 @@ static void hwmp_preq_frame_process(stru
682  
683         mhwmp_dbg("received PREQ from %pM", orig_addr);
684  
685 -       if (memcmp(target_addr, sdata->vif.addr, ETH_ALEN) == 0) {
686 +       if (compare_ether_addr(target_addr, sdata->vif.addr) == 0) {
687                 mhwmp_dbg("PREQ is for us");
688                 forward = false;
689                 reply = true;
690 @@ -624,7 +625,7 @@ static void hwmp_prep_frame_process(stru
691         mhwmp_dbg("received PREP from %pM", PREP_IE_ORIG_ADDR(prep_elem));
692  
693         orig_addr = PREP_IE_ORIG_ADDR(prep_elem);
694 -       if (memcmp(orig_addr, sdata->vif.addr, ETH_ALEN) == 0)
695 +       if (compare_ether_addr(orig_addr, sdata->vif.addr) == 0)
696                 /* destination, no forwarding required */
697                 return;
698  
699 @@ -694,10 +695,12 @@ static void hwmp_perr_frame_process(stru
700         rcu_read_lock();
701         mpath = mesh_path_lookup(target_addr, sdata);
702         if (mpath) {
703 +               struct sta_info *sta;
704 +
705                 spin_lock_bh(&mpath->state_lock);
706 +               sta = next_hop_deref_protected(mpath);
707                 if (mpath->flags & MESH_PATH_ACTIVE &&
708 -                   memcmp(ta, next_hop_deref_protected(mpath)->sta.addr,
709 -                                                       ETH_ALEN) == 0 &&
710 +                   compare_ether_addr(ta, sta->sta.addr) == 0 &&
711                     (!(mpath->flags & MESH_PATH_SN_VALID) ||
712                     SN_GT(target_sn, mpath->sn))) {
713                         mpath->flags &= ~MESH_PATH_ACTIVE;
714 @@ -739,7 +742,7 @@ static void hwmp_rann_frame_process(stru
715         metric = rann->rann_metric;
716  
717         /*  Ignore our own RANNs */
718 -       if (memcmp(orig_addr, sdata->vif.addr, ETH_ALEN) == 0)
719 +       if (compare_ether_addr(orig_addr, sdata->vif.addr) == 0)
720                 return;
721  
722         mhwmp_dbg("received RANN from %pM (is_gate=%d)", orig_addr,
723 @@ -1064,7 +1067,7 @@ int mesh_nexthop_lookup(struct sk_buff *
724         if (time_after(jiffies,
725                        mpath->exp_time -
726                        msecs_to_jiffies(sdata->u.mesh.mshcfg.path_refresh_time)) &&
727 -           !memcmp(sdata->vif.addr, hdr->addr4, ETH_ALEN) &&
728 +           !compare_ether_addr(sdata->vif.addr, hdr->addr4) &&
729             !(mpath->flags & MESH_PATH_RESOLVING) &&
730             !(mpath->flags & MESH_PATH_FIXED))
731                 mesh_queue_preq(mpath, PREQ_Q_F_START | PREQ_Q_F_REFRESH);
732 --- a/net/mac80211/mesh_pathtbl.c
733 +++ b/net/mac80211/mesh_pathtbl.c
734 @@ -350,7 +350,7 @@ static struct mesh_path *mpath_lookup(st
735         hlist_for_each_entry_rcu(node, n, bucket, list) {
736                 mpath = node->mpath;
737                 if (mpath->sdata == sdata &&
738 -                               memcmp(dst, mpath->dst, ETH_ALEN) == 0) {
739 +                               compare_ether_addr(dst, mpath->dst) == 0) {
740                         if (MPATH_EXPIRED(mpath)) {
741                                 spin_lock_bh(&mpath->state_lock);
742                                 mpath->flags &= ~MESH_PATH_ACTIVE;
743 @@ -525,7 +525,7 @@ int mesh_path_add(u8 *dst, struct ieee80
744         int err = 0;
745         u32 hash_idx;
746  
747 -       if (memcmp(dst, sdata->vif.addr, ETH_ALEN) == 0)
748 +       if (compare_ether_addr(dst, sdata->vif.addr) == 0)
749                 /* never add ourselves as neighbours */
750                 return -ENOTSUPP;
751  
752 @@ -566,7 +566,8 @@ int mesh_path_add(u8 *dst, struct ieee80
753         err = -EEXIST;
754         hlist_for_each_entry(node, n, bucket, list) {
755                 mpath = node->mpath;
756 -               if (mpath->sdata == sdata && memcmp(dst, mpath->dst, ETH_ALEN) == 0)
757 +               if (mpath->sdata == sdata &&
758 +                   compare_ether_addr(dst, mpath->dst) == 0)
759                         goto err_exists;
760         }
761  
762 @@ -657,7 +658,7 @@ int mpp_path_add(u8 *dst, u8 *mpp, struc
763         int err = 0;
764         u32 hash_idx;
765  
766 -       if (memcmp(dst, sdata->vif.addr, ETH_ALEN) == 0)
767 +       if (compare_ether_addr(dst, sdata->vif.addr) == 0)
768                 /* never add ourselves as neighbours */
769                 return -ENOTSUPP;
770  
771 @@ -694,7 +695,8 @@ int mpp_path_add(u8 *dst, u8 *mpp, struc
772         err = -EEXIST;
773         hlist_for_each_entry(node, n, bucket, list) {
774                 mpath = node->mpath;
775 -               if (mpath->sdata == sdata && memcmp(dst, mpath->dst, ETH_ALEN) == 0)
776 +               if (mpath->sdata == sdata &&
777 +                   compare_ether_addr(dst, mpath->dst) == 0)
778                         goto err_exists;
779         }
780  
781 @@ -887,7 +889,7 @@ int mesh_path_del(u8 *addr, struct ieee8
782         hlist_for_each_entry(node, n, bucket, list) {
783                 mpath = node->mpath;
784                 if (mpath->sdata == sdata &&
785 -                   memcmp(addr, mpath->dst, ETH_ALEN) == 0) {
786 +                   compare_ether_addr(addr, mpath->dst) == 0) {
787                         __mesh_path_del(tbl, node);
788                         goto enddel;
789                 }
790 --- a/net/mac80211/mlme.c
791 +++ b/net/mac80211/mlme.c
792 @@ -1812,7 +1812,7 @@ ieee80211_rx_mgmt_auth(struct ieee80211_
793  
794         memcpy(bssid, ifmgd->auth_data->bss->bssid, ETH_ALEN);
795  
796 -       if (memcmp(bssid, mgmt->bssid, ETH_ALEN))
797 +       if (compare_ether_addr(bssid, mgmt->bssid))
798                 return RX_MGMT_NONE;
799  
800         auth_alg = le16_to_cpu(mgmt->u.auth.auth_alg);
801 @@ -1893,7 +1893,7 @@ ieee80211_rx_mgmt_deauth(struct ieee8021
802                 return RX_MGMT_NONE;
803  
804         if (!ifmgd->associated ||
805 -           memcmp(mgmt->bssid, ifmgd->associated->bssid, ETH_ALEN))
806 +           compare_ether_addr(mgmt->bssid, ifmgd->associated->bssid))
807                 return RX_MGMT_NONE;
808  
809         bssid = ifmgd->associated->bssid;
810 @@ -1925,7 +1925,7 @@ ieee80211_rx_mgmt_disassoc(struct ieee80
811                 return RX_MGMT_NONE;
812  
813         if (!ifmgd->associated ||
814 -           memcmp(mgmt->bssid, ifmgd->associated->bssid, ETH_ALEN))
815 +           compare_ether_addr(mgmt->bssid, ifmgd->associated->bssid))
816                 return RX_MGMT_NONE;
817  
818         reason_code = le16_to_cpu(mgmt->u.disassoc.reason_code);
819 @@ -2190,7 +2190,7 @@ ieee80211_rx_mgmt_assoc_resp(struct ieee
820  
821         if (!assoc_data)
822                 return RX_MGMT_NONE;
823 -       if (memcmp(assoc_data->bss->bssid, mgmt->bssid, ETH_ALEN))
824 +       if (compare_ether_addr(assoc_data->bss->bssid, mgmt->bssid))
825                 return RX_MGMT_NONE;
826  
827         /*
828 @@ -2278,8 +2278,8 @@ static void ieee80211_rx_bss_info(struct
829         bool need_ps = false;
830  
831         if (sdata->u.mgd.associated &&
832 -           memcmp(mgmt->bssid, sdata->u.mgd.associated->bssid,
833 -                  ETH_ALEN) == 0) {
834 +           compare_ether_addr(mgmt->bssid, sdata->u.mgd.associated->bssid)
835 +           == 0) {
836                 bss = (void *)sdata->u.mgd.associated->priv;
837                 /* not previously set so we may need to recalc */
838                 need_ps = !bss->dtim_period;
839 @@ -2334,7 +2334,7 @@ static void ieee80211_rx_mgmt_probe_resp
840  
841         ASSERT_MGD_MTX(ifmgd);
842  
843 -       if (memcmp(mgmt->da, sdata->vif.addr, ETH_ALEN))
844 +       if (compare_ether_addr(mgmt->da, sdata->vif.addr))
845                 return; /* ignore ProbeResp to foreign address */
846  
847         baselen = (u8 *) mgmt->u.probe_resp.variable - (u8 *) mgmt;
848 @@ -2347,11 +2347,12 @@ static void ieee80211_rx_mgmt_probe_resp
849         ieee80211_rx_bss_info(sdata, mgmt, len, rx_status, &elems, false);
850  
851         if (ifmgd->associated &&
852 -           memcmp(mgmt->bssid, ifmgd->associated->bssid, ETH_ALEN) == 0)
853 +           compare_ether_addr(mgmt->bssid, ifmgd->associated->bssid) == 0)
854                 ieee80211_reset_ap_probe(sdata);
855  
856         if (ifmgd->auth_data && !ifmgd->auth_data->bss->proberesp_ies &&
857 -           memcmp(mgmt->bssid, ifmgd->auth_data->bss->bssid, ETH_ALEN) == 0) {
858 +           compare_ether_addr(mgmt->bssid, ifmgd->auth_data->bss->bssid)
859 +           == 0) {
860                 /* got probe response, continue with auth */
861                 printk(KERN_DEBUG "%s: direct probe responded\n", sdata->name);
862                 ifmgd->auth_data->tries = 0;
863 @@ -2408,7 +2409,8 @@ static void ieee80211_rx_mgmt_beacon(str
864                 return;
865  
866         if (ifmgd->assoc_data && !ifmgd->assoc_data->have_beacon &&
867 -           memcmp(mgmt->bssid, ifmgd->assoc_data->bss->bssid, ETH_ALEN) == 0) {
868 +           compare_ether_addr(mgmt->bssid, ifmgd->assoc_data->bss->bssid)
869 +           == 0) {
870                 ieee802_11_parse_elems(mgmt->u.beacon.variable,
871                                        len - baselen, &elems);
872  
873 @@ -2423,7 +2425,7 @@ static void ieee80211_rx_mgmt_beacon(str
874         }
875  
876         if (!ifmgd->associated ||
877 -           memcmp(mgmt->bssid, ifmgd->associated->bssid, ETH_ALEN))
878 +           compare_ether_addr(mgmt->bssid, ifmgd->associated->bssid))
879                 return;
880         bssid = ifmgd->associated->bssid;
881  
882 @@ -3285,7 +3287,7 @@ int ieee80211_mgd_assoc(struct ieee80211
883                 bool match;
884  
885                 /* keep sta info, bssid if matching */
886 -               match = memcmp(ifmgd->bssid, req->bss->bssid, ETH_ALEN) == 0;
887 +               match = compare_ether_addr(ifmgd->bssid, req->bss->bssid) == 0;
888                 ieee80211_destroy_auth_data(sdata, match);
889         }
890  
891 @@ -3407,7 +3409,7 @@ int ieee80211_mgd_assoc(struct ieee80211
892                         goto err_clear;
893                 }
894         } else
895 -               WARN_ON_ONCE(memcmp(ifmgd->bssid, req->bss->bssid, ETH_ALEN));
896 +               WARN_ON_ONCE(compare_ether_addr(ifmgd->bssid, req->bss->bssid));
897  
898         if (!bss->dtim_period &&
899             sdata->local->hw.flags & IEEE80211_HW_NEED_DTIM_PERIOD) {
900 @@ -3448,7 +3450,7 @@ int ieee80211_mgd_deauth(struct ieee8021
901         mutex_lock(&ifmgd->mtx);
902  
903         if (ifmgd->associated &&
904 -           memcmp(ifmgd->associated->bssid, req->bssid, ETH_ALEN) == 0) {
905 +           compare_ether_addr(ifmgd->associated->bssid, req->bssid) == 0) {
906                 ieee80211_set_disassoc(sdata, false, true);
907                 assoc_bss = true;
908         } else if (ifmgd->auth_data) {
909 --- a/net/mac80211/status.c
910 +++ b/net/mac80211/status.c
911 @@ -10,6 +10,7 @@
912   */
913  
914  #include <linux/export.h>
915 +#include <linux/etherdevice.h>
916  #include <net/mac80211.h>
917  #include <asm/unaligned.h>
918  #include "ieee80211_i.h"
919 @@ -377,7 +378,7 @@ void ieee80211_tx_status(struct ieee8021
920  
921         for_each_sta_info(local, hdr->addr1, sta, tmp) {
922                 /* skip wrong virtual interface */
923 -               if (memcmp(hdr->addr2, sta->sdata->vif.addr, ETH_ALEN))
924 +               if (compare_ether_addr(hdr->addr2, sta->sdata->vif.addr))
925                         continue;
926  
927                 if (info->flags & IEEE80211_TX_STATUS_EOSP)
928 --- a/net/wireless/mlme.c
929 +++ b/net/wireless/mlme.c
930 @@ -6,6 +6,7 @@
931  
932  #include <linux/kernel.h>
933  #include <linux/module.h>
934 +#include <linux/etherdevice.h>
935  #include <linux/netdevice.h>
936  #include <linux/nl80211.h>
937  #include <linux/slab.h>
938 @@ -100,7 +101,7 @@ void __cfg80211_send_deauth(struct net_d
939         ASSERT_WDEV_LOCK(wdev);
940  
941         if (wdev->current_bss &&
942 -           memcmp(wdev->current_bss->pub.bssid, bssid, ETH_ALEN) == 0) {
943 +           compare_ether_addr(wdev->current_bss->pub.bssid, bssid) == 0) {
944                 cfg80211_unhold_bss(wdev->current_bss);
945                 cfg80211_put_bss(&wdev->current_bss->pub);
946                 wdev->current_bss = NULL;
947 @@ -115,7 +116,7 @@ void __cfg80211_send_deauth(struct net_d
948  
949                 reason_code = le16_to_cpu(mgmt->u.deauth.reason_code);
950  
951 -               from_ap = memcmp(mgmt->sa, dev->dev_addr, ETH_ALEN) != 0;
952 +               from_ap = compare_ether_addr(mgmt->sa, dev->dev_addr) != 0;
953                 __cfg80211_disconnected(dev, NULL, 0, reason_code, from_ap);
954         } else if (wdev->sme_state == CFG80211_SME_CONNECTING) {
955                 __cfg80211_connect_result(dev, mgmt->bssid, NULL, 0, NULL, 0,
956 @@ -154,7 +155,7 @@ void __cfg80211_send_disassoc(struct net
957                 return;
958  
959         if (wdev->current_bss &&
960 -           memcmp(wdev->current_bss->pub.bssid, bssid, ETH_ALEN) == 0) {
961 +           compare_ether_addr(wdev->current_bss->pub.bssid, bssid) == 0) {
962                 cfg80211_sme_disassoc(dev, wdev->current_bss);
963                 cfg80211_unhold_bss(wdev->current_bss);
964                 cfg80211_put_bss(&wdev->current_bss->pub);
965 @@ -165,7 +166,7 @@ void __cfg80211_send_disassoc(struct net
966  
967         reason_code = le16_to_cpu(mgmt->u.disassoc.reason_code);
968  
969 -       from_ap = memcmp(mgmt->sa, dev->dev_addr, ETH_ALEN) != 0;
970 +       from_ap = compare_ether_addr(mgmt->sa, dev->dev_addr) != 0;
971         __cfg80211_disconnected(dev, NULL, 0, reason_code, from_ap);
972  }
973  EXPORT_SYMBOL(__cfg80211_send_disassoc);
974 @@ -285,7 +286,7 @@ int __cfg80211_mlme_auth(struct cfg80211
975                         return -EINVAL;
976  
977         if (wdev->current_bss &&
978 -           memcmp(bssid, wdev->current_bss->pub.bssid, ETH_ALEN) == 0)
979 +           compare_ether_addr(bssid, wdev->current_bss->pub.bssid) == 0)
980                 return -EALREADY;
981  
982         memset(&req, 0, sizeof(req));
983 @@ -362,7 +363,7 @@ int __cfg80211_mlme_assoc(struct cfg8021
984         memset(&req, 0, sizeof(req));
985  
986         if (wdev->current_bss && prev_bssid &&
987 -           memcmp(wdev->current_bss->pub.bssid, prev_bssid, ETH_ALEN) == 0) {
988 +           compare_ether_addr(wdev->current_bss->pub.bssid, prev_bssid) == 0) {
989                 /*
990                  * Trying to reassociate: Allow this to proceed and let the old
991                  * association to be dropped when the new one is completed.
992 @@ -446,7 +447,8 @@ int __cfg80211_mlme_deauth(struct cfg802
993  
994         if (local_state_change) {
995                 if (wdev->current_bss &&
996 -                   memcmp(wdev->current_bss->pub.bssid, bssid, ETH_ALEN) == 0) {
997 +                   compare_ether_addr(wdev->current_bss->pub.bssid, bssid)
998 +                   == 0) {
999                         cfg80211_unhold_bss(wdev->current_bss);
1000                         cfg80211_put_bss(&wdev->current_bss->pub);
1001                         wdev->current_bss = NULL;
1002 @@ -495,7 +497,7 @@ static int __cfg80211_mlme_disassoc(stru
1003         req.local_state_change = local_state_change;
1004         req.ie = ie;
1005         req.ie_len = ie_len;
1006 -       if (memcmp(wdev->current_bss->pub.bssid, bssid, ETH_ALEN) == 0)
1007 +       if (compare_ether_addr(wdev->current_bss->pub.bssid, bssid) == 0)
1008                 req.bss = &wdev->current_bss->pub;
1009         else
1010                 return -ENOTCONN;
1011 @@ -758,8 +760,8 @@ int cfg80211_mlme_mgmt_tx(struct cfg8021
1012                                 break;
1013                         }
1014  
1015 -                       if (memcmp(wdev->current_bss->pub.bssid,
1016 -                                  mgmt->bssid, ETH_ALEN)) {
1017 +                       if (compare_ether_addr(wdev->current_bss->pub.bssid,
1018 +                                              mgmt->bssid)) {
1019                                 err = -ENOTCONN;
1020                                 break;
1021                         }
1022 @@ -772,8 +774,8 @@ int cfg80211_mlme_mgmt_tx(struct cfg8021
1023                                 break;
1024  
1025                         /* for station, check that DA is the AP */
1026 -                       if (memcmp(wdev->current_bss->pub.bssid,
1027 -                                  mgmt->da, ETH_ALEN)) {
1028 +                       if (compare_ether_addr(wdev->current_bss->pub.bssid,
1029 +                                              mgmt->da)) {
1030                                 err = -ENOTCONN;
1031                                 break;
1032                         }
1033 @@ -781,11 +783,11 @@ int cfg80211_mlme_mgmt_tx(struct cfg8021
1034                 case NL80211_IFTYPE_AP:
1035                 case NL80211_IFTYPE_P2P_GO:
1036                 case NL80211_IFTYPE_AP_VLAN:
1037 -                       if (memcmp(mgmt->bssid, dev->dev_addr, ETH_ALEN))
1038 +                       if (compare_ether_addr(mgmt->bssid, dev->dev_addr))
1039                                 err = -EINVAL;
1040                         break;
1041                 case NL80211_IFTYPE_MESH_POINT:
1042 -                       if (memcmp(mgmt->sa, mgmt->bssid, ETH_ALEN)) {
1043 +                       if (compare_ether_addr(mgmt->sa, mgmt->bssid)) {
1044                                 err = -EINVAL;
1045                                 break;
1046                         }
1047 @@ -804,7 +806,7 @@ int cfg80211_mlme_mgmt_tx(struct cfg8021
1048                         return err;
1049         }
1050  
1051 -       if (memcmp(mgmt->sa, dev->dev_addr, ETH_ALEN) != 0)
1052 +       if (compare_ether_addr(mgmt->sa, dev->dev_addr) != 0)
1053                 return -EINVAL;
1054  
1055         /* Transmit the Action frame as requested by user space */
1056 --- a/net/wireless/scan.c
1057 +++ b/net/wireless/scan.c
1058 @@ -378,7 +378,7 @@ static int cmp_bss_core(struct cfg80211_
1059                                b->len_information_elements);
1060         }
1061  
1062 -       return memcmp(a->bssid, b->bssid, ETH_ALEN);
1063 +       return compare_ether_addr(a->bssid, b->bssid);
1064  }
1065  
1066  static int cmp_bss(struct cfg80211_bss *a,
1067 --- a/drivers/net/wireless/ath/ath9k/Kconfig
1068 +++ b/drivers/net/wireless/ath/ath9k/Kconfig
1069 @@ -81,6 +81,14 @@ config ATH9K_DFS_CERTIFIED
1070           developed. At this point enabling this option won't do anything
1071           except increase code size.
1072  
1073 +config ATH9K_MAC_DEBUG
1074 +       bool "Atheros MAC statistics"
1075 +       depends on ATH9K_DEBUGFS
1076 +       default y
1077 +       ---help---
1078 +         This option enables collection of statistics for Rx/Tx status
1079 +         data and some other MAC related statistics
1080 +
1081  config ATH9K_RATE_CONTROL
1082         bool "Atheros ath9k rate control"
1083         depends on ATH9K
1084 --- a/drivers/net/wireless/ath/ath9k/debug.c
1085 +++ b/drivers/net/wireless/ath/ath9k/debug.c
1086 @@ -818,6 +818,7 @@ void ath_debug_stat_tx(struct ath_softc 
1087         if (ts->ts_flags & ATH9K_TX_DELIM_UNDERRUN)
1088                 TX_STAT_INC(qnum, delim_underrun);
1089  
1090 +#ifdef CONFIG_ATH9K_MAC_DEBUG
1091         spin_lock(&sc->debug.samp_lock);
1092         TX_SAMP_DBG(jiffies) = jiffies;
1093         TX_SAMP_DBG(rssi_ctl0) = ts->ts_rssi_ctl0;
1094 @@ -844,6 +845,7 @@ void ath_debug_stat_tx(struct ath_softc 
1095  
1096         sc->debug.tsidx = (sc->debug.tsidx + 1) % ATH_DBG_MAX_SAMPLES;
1097         spin_unlock(&sc->debug.samp_lock);
1098 +#endif
1099  
1100  #undef TX_SAMP_DBG
1101  }
1102 @@ -1019,6 +1021,7 @@ void ath_debug_stat_rx(struct ath_softc 
1103  
1104         sc->debug.stats.rxstats.rs_antenna = rs->rs_antenna;
1105  
1106 +#ifdef CONFIG_ATH9K_MAC_DEBUG
1107         spin_lock(&sc->debug.samp_lock);
1108         RX_SAMP_DBG(jiffies) = jiffies;
1109         RX_SAMP_DBG(rssi_ctl0) = rs->rs_rssi_ctl0;
1110 @@ -1035,6 +1038,8 @@ void ath_debug_stat_rx(struct ath_softc 
1111         sc->debug.rsidx = (sc->debug.rsidx + 1) % ATH_DBG_MAX_SAMPLES;
1112         spin_unlock(&sc->debug.samp_lock);
1113  
1114 +#endif
1115 +
1116  #undef RX_STAT_INC
1117  #undef RX_PHY_ERR_INC
1118  #undef RX_SAMP_DBG
1119 @@ -1278,6 +1283,8 @@ static const struct file_operations fops
1120         .llseek = default_llseek,
1121  };
1122  
1123 +#ifdef CONFIG_ATH9K_MAC_DEBUG
1124 +
1125  void ath9k_debug_samp_bb_mac(struct ath_softc *sc)
1126  {
1127  #define ATH_SAMP_DBG(c) (sc->debug.bb_mac_samp[sc->debug.sampidx].c)
1128 @@ -1551,6 +1558,7 @@ static const struct file_operations fops
1129         .llseek = default_llseek,
1130  };
1131  
1132 +#endif
1133  
1134  int ath9k_init_debug(struct ath_hw *ah)
1135  {
1136 @@ -1604,8 +1612,10 @@ int ath9k_init_debug(struct ath_hw *ah)
1137                             &fops_base_eeprom);
1138         debugfs_create_file("modal_eeprom", S_IRUSR, sc->debug.debugfs_phy, sc,
1139                             &fops_modal_eeprom);
1140 +#ifdef CONFIG_ATH9K_MAC_DEBUG
1141         debugfs_create_file("samples", S_IRUSR, sc->debug.debugfs_phy, sc,
1142                             &fops_samps);
1143 +#endif
1144  
1145         debugfs_create_u32("gpio_mask", S_IRUSR | S_IWUSR,
1146                            sc->debug.debugfs_phy, &sc->sc_ah->gpio_mask);
1147 --- a/drivers/net/wireless/ath/ath9k/debug.h
1148 +++ b/drivers/net/wireless/ath/ath9k/debug.h
1149 @@ -235,16 +235,17 @@ struct ath9k_debug {
1150         struct dentry *debugfs_phy;
1151         u32 regidx;
1152         struct ath_stats stats;
1153 +#ifdef CONFIG_ATH9K_MAC_DEBUG
1154         spinlock_t samp_lock;
1155         struct ath_dbg_bb_mac_samp bb_mac_samp[ATH_DBG_MAX_SAMPLES];
1156         u8 sampidx;
1157         u8 tsidx;
1158         u8 rsidx;
1159 +#endif
1160  };
1161  
1162  int ath9k_init_debug(struct ath_hw *ah);
1163  
1164 -void ath9k_debug_samp_bb_mac(struct ath_softc *sc);
1165  void ath_debug_stat_interrupt(struct ath_softc *sc, enum ath9k_int status);
1166  void ath_debug_stat_tx(struct ath_softc *sc, struct ath_buf *bf,
1167                        struct ath_tx_status *ts, struct ath_txq *txq,
1168 @@ -258,10 +259,6 @@ static inline int ath9k_init_debug(struc
1169         return 0;
1170  }
1171  
1172 -static inline void ath9k_debug_samp_bb_mac(struct ath_softc *sc)
1173 -{
1174 -}
1175 -
1176  static inline void ath_debug_stat_interrupt(struct ath_softc *sc,
1177                                             enum ath9k_int status)
1178  {
1179 @@ -282,4 +279,17 @@ static inline void ath_debug_stat_rx(str
1180  
1181  #endif /* CONFIG_ATH9K_DEBUGFS */
1182  
1183 +#ifdef CONFIG_ATH9K_MAC_DEBUG
1184 +
1185 +void ath9k_debug_samp_bb_mac(struct ath_softc *sc);
1186 +
1187 +#else
1188 +
1189 +static inline void ath9k_debug_samp_bb_mac(struct ath_softc *sc)
1190 +{
1191 +}
1192 +
1193 +#endif
1194 +
1195 +
1196  #endif /* DEBUG_H */
1197 --- a/drivers/net/wireless/ath/ath9k/init.c
1198 +++ b/drivers/net/wireless/ath/ath9k/init.c
1199 @@ -555,9 +555,11 @@ static int ath9k_init_softc(u16 devid, s
1200         mutex_init(&sc->mutex);
1201  #ifdef CONFIG_ATH9K_DEBUGFS
1202         spin_lock_init(&sc->nodes_lock);
1203 -       spin_lock_init(&sc->debug.samp_lock);
1204         INIT_LIST_HEAD(&sc->nodes);
1205  #endif
1206 +#ifdef CONFIG_ATH9K_MAC_DEBUG
1207 +       spin_lock_init(&sc->debug.samp_lock);
1208 +#endif
1209         tasklet_init(&sc->intr_tq, ath9k_tasklet, (unsigned long)sc);
1210         tasklet_init(&sc->bcon_tasklet, ath_beacon_tasklet,
1211                      (unsigned long)sc);
1212 --- a/drivers/net/wireless/ath/ath9k/hw.c
1213 +++ b/drivers/net/wireless/ath/ath9k/hw.c
1214 @@ -1386,10 +1386,16 @@ static bool ath9k_hw_set_reset_reg(struc
1215  static bool ath9k_hw_chip_reset(struct ath_hw *ah,
1216                                 struct ath9k_channel *chan)
1217  {
1218 -       if (AR_SREV_9280(ah) && ah->eep_ops->get_eeprom(ah, EEP_OL_PWRCTRL)) {
1219 -               if (!ath9k_hw_set_reset_reg(ah, ATH9K_RESET_POWER_ON))
1220 -                       return false;
1221 -       } else if (!ath9k_hw_set_reset_reg(ah, ATH9K_RESET_WARM))
1222 +       int reset_type = ATH9K_RESET_WARM;
1223 +
1224 +       if (AR_SREV_9280(ah)) {
1225 +               if (ah->eep_ops->get_eeprom(ah, EEP_OL_PWRCTRL))
1226 +                       reset_type = ATH9K_RESET_POWER_ON;
1227 +               else
1228 +                       reset_type = ATH9K_RESET_COLD;
1229 +       }
1230 +
1231 +       if (!ath9k_hw_set_reset_reg(ah, reset_type))
1232                 return false;
1233  
1234         if (!ath9k_hw_setpower(ah, ATH9K_PM_AWAKE))
1235 --- a/drivers/net/wireless/ath/ath5k/base.c
1236 +++ b/drivers/net/wireless/ath/ath5k/base.c
1237 @@ -2330,15 +2330,6 @@ ath5k_calibrate_work(struct work_struct 
1238                                         "got new rfgain, resetting\n");
1239                         ieee80211_queue_work(ah->hw, &ah->reset_work);
1240                 }
1241 -
1242 -               /* TODO: On full calibration we should stop TX here,
1243 -                * so that it doesn't interfere (mostly due to gain_f
1244 -                * calibration that messes with tx packets -see phy.c).
1245 -                *
1246 -                * NOTE: Stopping the queues from above is not enough
1247 -                * to stop TX but saves us from disconecting (at least
1248 -                * we don't lose packets). */
1249 -               ieee80211_stop_queues(ah->hw);
1250         } else
1251                 ah->ah_cal_mask |= AR5K_CALIBRATION_SHORT;
1252  
1253 @@ -2353,10 +2344,9 @@ ath5k_calibrate_work(struct work_struct 
1254                                 ah->curchan->center_freq));
1255  
1256         /* Clear calibration flags */
1257 -       if (ah->ah_cal_mask & AR5K_CALIBRATION_FULL) {
1258 -               ieee80211_wake_queues(ah->hw);
1259 +       if (ah->ah_cal_mask & AR5K_CALIBRATION_FULL)
1260                 ah->ah_cal_mask &= ~AR5K_CALIBRATION_FULL;
1261 -       } else if (ah->ah_cal_mask & AR5K_CALIBRATION_SHORT)
1262 +       else if (ah->ah_cal_mask & AR5K_CALIBRATION_SHORT)
1263                 ah->ah_cal_mask &= ~AR5K_CALIBRATION_SHORT;
1264  }
1265  
1266 --- a/drivers/net/wireless/ath/ath5k/phy.c
1267 +++ b/drivers/net/wireless/ath/ath5k/phy.c
1268 @@ -1871,31 +1871,15 @@ ath5k_hw_phy_calibrate(struct ath5k_hw *
1269                 ret = 0;
1270         }
1271  
1272 -       /* On full calibration do an AGC calibration and
1273 -        * request a PAPD probe for gainf calibration if
1274 -        * needed */
1275 -       if (ah->ah_cal_mask & AR5K_CALIBRATION_FULL) {
1276 +       /* On full calibration request a PAPD probe for
1277 +        * gainf calibration if needed */
1278 +       if ((ah->ah_cal_mask & AR5K_CALIBRATION_FULL) &&
1279 +           (ah->ah_radio == AR5K_RF5111 ||
1280 +            ah->ah_radio == AR5K_RF5112) &&
1281 +           channel->hw_value != AR5K_MODE_11B)
1282 +               ath5k_hw_request_rfgain_probe(ah);
1283  
1284 -               AR5K_REG_ENABLE_BITS(ah, AR5K_PHY_AGCCTL,
1285 -                                       AR5K_PHY_AGCCTL_CAL);
1286 -
1287 -               ret = ath5k_hw_register_timeout(ah, AR5K_PHY_AGCCTL,
1288 -                       AR5K_PHY_AGCCTL_CAL | AR5K_PHY_AGCCTL_NF,
1289 -                       0, false);
1290 -               if (ret) {
1291 -                       ATH5K_ERR(ah,
1292 -                               "gain calibration timeout (%uMHz)\n",
1293 -                               channel->center_freq);
1294 -               }
1295 -
1296 -               if ((ah->ah_radio == AR5K_RF5111 ||
1297 -                       ah->ah_radio == AR5K_RF5112)
1298 -                       && (channel->hw_value != AR5K_MODE_11B))
1299 -                       ath5k_hw_request_rfgain_probe(ah);
1300 -       }
1301 -
1302 -       /* Update noise floor
1303 -        * XXX: Only do this after AGC calibration */
1304 +       /* Update noise floor */
1305         if (!(ah->ah_cal_mask & AR5K_CALIBRATION_NF))
1306                 ath5k_hw_update_noise_floor(ah);
1307  
1308 --- a/drivers/net/wireless/ath/ath9k/recv.c
1309 +++ b/drivers/net/wireless/ath/ath9k/recv.c
1310 @@ -954,6 +954,7 @@ static void ath9k_process_rssi(struct at
1311         struct ath_softc *sc = hw->priv;
1312         struct ath_hw *ah = common->ah;
1313         int last_rssi;
1314 +       int rssi = rx_stats->rs_rssi;
1315  
1316         if (!rx_stats->is_mybeacon ||
1317             ((ah->opmode != NL80211_IFTYPE_STATION) &&
1318 @@ -965,13 +966,12 @@ static void ath9k_process_rssi(struct at
1319  
1320         last_rssi = sc->last_rssi;
1321         if (likely(last_rssi != ATH_RSSI_DUMMY_MARKER))
1322 -               rx_stats->rs_rssi = ATH_EP_RND(last_rssi,
1323 -                                             ATH_RSSI_EP_MULTIPLIER);
1324 -       if (rx_stats->rs_rssi < 0)
1325 -               rx_stats->rs_rssi = 0;
1326 +               rssi = ATH_EP_RND(last_rssi, ATH_RSSI_EP_MULTIPLIER);
1327 +       if (rssi < 0)
1328 +               rssi = 0;
1329  
1330         /* Update Beacon RSSI, this is used by ANI. */
1331 -       ah->stats.avgbrssi = rx_stats->rs_rssi;
1332 +       ah->stats.avgbrssi = rssi;
1333  }
1334  
1335  /*
1336 @@ -1011,6 +1011,8 @@ static int ath9k_rx_skb_preprocess(struc
1337         rx_status->signal = ah->noise + rx_stats->rs_rssi;
1338         rx_status->antenna = rx_stats->rs_antenna;
1339         rx_status->flag |= RX_FLAG_MACTIME_MPDU;
1340 +       if (rx_stats->rs_moreaggr)
1341 +               rx_status->flag |= RX_FLAG_NO_SIGNAL_VAL;
1342  
1343         return 0;
1344  }
1345 --- a/drivers/net/wireless/ath/ath9k/beacon.c
1346 +++ b/drivers/net/wireless/ath/ath9k/beacon.c
1347 @@ -91,7 +91,7 @@ static void ath_beacon_setup(struct ath_
1348         info.txpower = MAX_RATE_POWER;
1349         info.keyix = ATH9K_TXKEYIX_INVALID;
1350         info.keytype = ATH9K_KEY_TYPE_CLEAR;
1351 -       info.flags = ATH9K_TXDESC_NOACK;
1352 +       info.flags = ATH9K_TXDESC_NOACK | ATH9K_TXDESC_INTREQ;
1353  
1354         info.buf_addr[0] = bf->bf_buf_addr;
1355         info.buf_len[0] = roundup(skb->len, 4);
1356 @@ -355,7 +355,6 @@ void ath_beacon_tasklet(unsigned long da
1357         struct ath_common *common = ath9k_hw_common(ah);
1358         struct ath_buf *bf = NULL;
1359         struct ieee80211_vif *vif;
1360 -       struct ath_tx_status ts;
1361         bool edma = !!(ah->caps.hw_caps & ATH9K_HW_CAP_EDMA);
1362         int slot;
1363         u32 bfaddr, bc = 0;
1364 @@ -462,11 +461,6 @@ void ath_beacon_tasklet(unsigned long da
1365                         ath9k_hw_txstart(ah, sc->beacon.beaconq);
1366  
1367                 sc->beacon.ast_be_xmit += bc;     /* XXX per-vif? */
1368 -               if (edma) {
1369 -                       spin_lock_bh(&sc->sc_pcu_lock);
1370 -                       ath9k_hw_txprocdesc(ah, bf->bf_desc, (void *)&ts);
1371 -                       spin_unlock_bh(&sc->sc_pcu_lock);
1372 -               }
1373         }
1374  }
1375  
1376 --- a/drivers/net/wireless/ath/ath9k/mac.c
1377 +++ b/drivers/net/wireless/ath/ath9k/mac.c
1378 @@ -745,7 +745,11 @@ int ath9k_hw_beaconq_setup(struct ath_hw
1379         qi.tqi_aifs = 1;
1380         qi.tqi_cwmin = 0;
1381         qi.tqi_cwmax = 0;
1382 -       /* NB: don't enable any interrupts */
1383 +
1384 +       if (ah->caps.hw_caps & ATH9K_HW_CAP_EDMA)
1385 +               qi.tqi_qflags = TXQ_FLAG_TXOKINT_ENABLE |
1386 +                               TXQ_FLAG_TXERRINT_ENABLE;
1387 +
1388         return ath9k_hw_setuptxqueue(ah, ATH9K_TX_QUEUE_BEACON, &qi);
1389  }
1390  EXPORT_SYMBOL(ath9k_hw_beaconq_setup);
1391 --- a/drivers/net/wireless/ath/ath9k/main.c
1392 +++ b/drivers/net/wireless/ath/ath9k/main.c
1393 @@ -2300,6 +2300,7 @@ static int ath9k_tx_last_beacon(struct i
1394         struct ath_vif *avp;
1395         struct ath_buf *bf;
1396         struct ath_tx_status ts;
1397 +       bool edma = !!(ah->caps.hw_caps & ATH9K_HW_CAP_EDMA);
1398         int status;
1399  
1400         vif = sc->beacon.bslot[0];
1401 @@ -2310,7 +2311,7 @@ static int ath9k_tx_last_beacon(struct i
1402         if (!avp->is_bslot_active)
1403                 return 0;
1404  
1405 -       if (!sc->beacon.tx_processed) {
1406 +       if (!sc->beacon.tx_processed && !edma) {
1407                 tasklet_disable(&sc->bcon_tasklet);
1408  
1409                 bf = avp->av_bcbuf;
1410 --- a/drivers/net/wireless/ath/ath9k/xmit.c
1411 +++ b/drivers/net/wireless/ath/ath9k/xmit.c
1412 @@ -2296,9 +2296,12 @@ void ath_tx_edma_tasklet(struct ath_soft
1413                         break;
1414                 }
1415  
1416 -               /* Skip beacon completions */
1417 -               if (ts.qid == sc->beacon.beaconq)
1418 +               /* Process beacon completions separately */
1419 +               if (ts.qid == sc->beacon.beaconq) {
1420 +                       sc->beacon.tx_processed = true;
1421 +                       sc->beacon.tx_last = !(ts.ts_status & ATH9K_TXERR_MASK);
1422                         continue;
1423 +               }
1424  
1425                 txq = &sc->tx.txq[ts.qid];
1426