mac80211: fix sending probe requests in client mode, fixes connecting to hidden netwo...
[openwrt.git] / package / mac80211 / patches / 300-pending_work.patch
1 --- a/drivers/net/wireless/ath/ath9k/common.h
2 +++ b/drivers/net/wireless/ath/ath9k/common.h
3 @@ -27,7 +27,7 @@
4  #define WME_MAX_BA              WME_BA_BMP_SIZE
5  #define ATH_TID_MAX_BUFS        (2 * WME_MAX_BA)
6  
7 -#define ATH_RSSI_DUMMY_MARKER   0x127
8 +#define ATH_RSSI_DUMMY_MARKER   127
9  #define ATH_RSSI_LPF_LEN               10
10  #define RSSI_LPF_THRESHOLD             -20
11  #define ATH_RSSI_EP_MULTIPLIER     (1<<7)
12 --- a/drivers/net/wireless/ath/ath9k/htc_drv_txrx.c
13 +++ b/drivers/net/wireless/ath/ath9k/htc_drv_txrx.c
14 @@ -1067,15 +1067,19 @@ static bool ath9k_rx_prepare(struct ath9
15  
16         last_rssi = priv->rx.last_rssi;
17  
18 -       if (likely(last_rssi != ATH_RSSI_DUMMY_MARKER))
19 -               rxbuf->rxstatus.rs_rssi = ATH_EP_RND(last_rssi,
20 -                                                    ATH_RSSI_EP_MULTIPLIER);
21 +       if (ieee80211_is_beacon(hdr->frame_control) &&
22 +           !is_zero_ether_addr(common->curbssid) &&
23 +           ether_addr_equal(hdr->addr3, common->curbssid)) {
24 +               s8 rssi = rxbuf->rxstatus.rs_rssi;
25  
26 -       if (rxbuf->rxstatus.rs_rssi < 0)
27 -               rxbuf->rxstatus.rs_rssi = 0;
28 +               if (likely(last_rssi != ATH_RSSI_DUMMY_MARKER))
29 +                       rssi = ATH_EP_RND(last_rssi, ATH_RSSI_EP_MULTIPLIER);
30  
31 -       if (ieee80211_is_beacon(fc))
32 -               priv->ah->stats.avgbrssi = rxbuf->rxstatus.rs_rssi;
33 +               if (rssi < 0)
34 +                       rssi = 0;
35 +
36 +               priv->ah->stats.avgbrssi = rssi;
37 +       }
38  
39         rx_status->mactime = be64_to_cpu(rxbuf->rxstatus.rs_tstamp);
40         rx_status->band = hw->conf.channel->band;
41 --- a/include/linux/ieee80211.h
42 +++ b/include/linux/ieee80211.h
43 @@ -185,7 +185,7 @@ struct ieee80211_hdr {
44         u8 addr3[6];
45         __le16 seq_ctrl;
46         u8 addr4[6];
47 -} __packed;
48 +} __packed __aligned(2);
49  
50  struct ieee80211_hdr_3addr {
51         __le16 frame_control;
52 @@ -194,7 +194,7 @@ struct ieee80211_hdr_3addr {
53         u8 addr2[6];
54         u8 addr3[6];
55         __le16 seq_ctrl;
56 -} __packed;
57 +} __packed __aligned(2);
58  
59  struct ieee80211_qos_hdr {
60         __le16 frame_control;
61 @@ -204,7 +204,7 @@ struct ieee80211_qos_hdr {
62         u8 addr3[6];
63         __le16 seq_ctrl;
64         __le16 qos_ctrl;
65 -} __packed;
66 +} __packed __aligned(2);
67  
68  /**
69   * ieee80211_has_tods - check if IEEE80211_FCTL_TODS is set
70 @@ -581,7 +581,7 @@ struct ieee80211s_hdr {
71         __le32 seqnum;
72         u8 eaddr1[6];
73         u8 eaddr2[6];
74 -} __packed;
75 +} __packed __aligned(2);
76  
77  /* Mesh flags */
78  #define MESH_FLAGS_AE_A4       0x1
79 @@ -875,7 +875,7 @@ struct ieee80211_mgmt {
80                         } u;
81                 } __packed action;
82         } u;
83 -} __packed;
84 +} __packed __aligned(2);
85  
86  /* Supported Rates value encodings in 802.11n-2009 7.3.2.2 */
87  #define BSS_MEMBERSHIP_SELECTOR_HT_PHY 127
88 @@ -906,20 +906,20 @@ struct ieee80211_rts {
89         __le16 duration;
90         u8 ra[6];
91         u8 ta[6];
92 -} __packed;
93 +} __packed __aligned(2);
94  
95  struct ieee80211_cts {
96         __le16 frame_control;
97         __le16 duration;
98         u8 ra[6];
99 -} __packed;
100 +} __packed __aligned(2);
101  
102  struct ieee80211_pspoll {
103         __le16 frame_control;
104         __le16 aid;
105         u8 bssid[6];
106         u8 ta[6];
107 -} __packed;
108 +} __packed __aligned(2);
109  
110  /* TDLS */
111  
112 --- a/net/mac80211/agg-rx.c
113 +++ b/net/mac80211/agg-rx.c
114 @@ -204,6 +204,8 @@ static void ieee80211_send_addba_resp(st
115                 memcpy(mgmt->bssid, sdata->u.mgd.bssid, ETH_ALEN);
116         else if (sdata->vif.type == NL80211_IFTYPE_ADHOC)
117                 memcpy(mgmt->bssid, sdata->u.ibss.bssid, ETH_ALEN);
118 +       else if (sdata->vif.type == NL80211_IFTYPE_WDS)
119 +               memcpy(mgmt->bssid, da, ETH_ALEN);
120  
121         mgmt->frame_control = cpu_to_le16(IEEE80211_FTYPE_MGMT |
122                                           IEEE80211_STYPE_ACTION);
123 --- a/net/mac80211/agg-tx.c
124 +++ b/net/mac80211/agg-tx.c
125 @@ -81,7 +81,8 @@ static void ieee80211_send_addba_request
126         memcpy(mgmt->sa, sdata->vif.addr, ETH_ALEN);
127         if (sdata->vif.type == NL80211_IFTYPE_AP ||
128             sdata->vif.type == NL80211_IFTYPE_AP_VLAN ||
129 -           sdata->vif.type == NL80211_IFTYPE_MESH_POINT)
130 +           sdata->vif.type == NL80211_IFTYPE_MESH_POINT ||
131 +           sdata->vif.type == NL80211_IFTYPE_WDS)
132                 memcpy(mgmt->bssid, sdata->vif.addr, ETH_ALEN);
133         else if (sdata->vif.type == NL80211_IFTYPE_STATION)
134                 memcpy(mgmt->bssid, sdata->u.mgd.bssid, ETH_ALEN);
135 @@ -527,6 +528,7 @@ int ieee80211_start_tx_ba_session(struct
136             sdata->vif.type != NL80211_IFTYPE_MESH_POINT &&
137             sdata->vif.type != NL80211_IFTYPE_AP_VLAN &&
138             sdata->vif.type != NL80211_IFTYPE_AP &&
139 +           sdata->vif.type != NL80211_IFTYPE_WDS &&
140             sdata->vif.type != NL80211_IFTYPE_ADHOC)
141                 return -EINVAL;
142  
143 --- a/net/mac80211/debugfs_sta.c
144 +++ b/net/mac80211/debugfs_sta.c
145 @@ -65,11 +65,11 @@ static ssize_t sta_flags_read(struct fil
146         test_sta_flag(sta, WLAN_STA_##flg) ? #flg "\n" : ""
147  
148         int res = scnprintf(buf, sizeof(buf),
149 -                           "%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s",
150 +                           "%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s",
151                             TEST(AUTH), TEST(ASSOC), TEST(PS_STA),
152                             TEST(PS_DRIVER), TEST(AUTHORIZED),
153                             TEST(SHORT_PREAMBLE),
154 -                           TEST(WME), TEST(WDS), TEST(CLEAR_PS_FILT),
155 +                           TEST(WME), TEST(CLEAR_PS_FILT),
156                             TEST(MFP), TEST(BLOCK_BA), TEST(PSPOLL),
157                             TEST(UAPSD), TEST(SP), TEST(TDLS_PEER),
158                             TEST(TDLS_PEER_AUTH), TEST(4ADDR_EVENT),
159 --- a/net/mac80211/iface.c
160 +++ b/net/mac80211/iface.c
161 @@ -107,7 +107,7 @@ void ieee80211_recalc_idle(struct ieee80
162  
163         lockdep_assert_held(&local->mtx);
164  
165 -       active = !list_empty(&local->chanctx_list);
166 +       active = !list_empty(&local->chanctx_list) || local->monitors;
167  
168         if (!local->ops->remain_on_channel) {
169                 list_for_each_entry(roc, &local->roc_list, list) {
170 @@ -436,7 +436,6 @@ int ieee80211_do_open(struct wireless_de
171         struct ieee80211_sub_if_data *sdata = IEEE80211_WDEV_TO_SUB_IF(wdev);
172         struct net_device *dev = wdev->netdev;
173         struct ieee80211_local *local = sdata->local;
174 -       struct sta_info *sta;
175         u32 changed = 0;
176         int res;
177         u32 hw_reconf_flags = 0;
178 @@ -595,30 +594,8 @@ int ieee80211_do_open(struct wireless_de
179  
180         set_bit(SDATA_STATE_RUNNING, &sdata->state);
181  
182 -       if (sdata->vif.type == NL80211_IFTYPE_WDS) {
183 -               /* Create STA entry for the WDS peer */
184 -               sta = sta_info_alloc(sdata, sdata->u.wds.remote_addr,
185 -                                    GFP_KERNEL);
186 -               if (!sta) {
187 -                       res = -ENOMEM;
188 -                       goto err_del_interface;
189 -               }
190 -
191 -               sta_info_pre_move_state(sta, IEEE80211_STA_AUTH);
192 -               sta_info_pre_move_state(sta, IEEE80211_STA_ASSOC);
193 -               sta_info_pre_move_state(sta, IEEE80211_STA_AUTHORIZED);
194 -
195 -               res = sta_info_insert(sta);
196 -               if (res) {
197 -                       /* STA has been freed */
198 -                       goto err_del_interface;
199 -               }
200 -
201 -               rate_control_rate_init(sta);
202 -               netif_carrier_on(dev);
203 -       } else if (sdata->vif.type == NL80211_IFTYPE_P2P_DEVICE) {
204 +       if (sdata->vif.type == NL80211_IFTYPE_P2P_DEVICE)
205                 rcu_assign_pointer(local->p2p_sdata, sdata);
206 -       }
207  
208         /*
209          * set_multicast_list will be invoked by the networking core
210 @@ -1022,6 +999,72 @@ static void ieee80211_if_setup(struct ne
211         dev->destructor = free_netdev;
212  }
213  
214 +static void ieee80211_wds_rx_queued_mgmt(struct ieee80211_sub_if_data *sdata,
215 +                                        struct sk_buff *skb)
216 +{
217 +       struct ieee80211_local *local = sdata->local;
218 +       struct ieee80211_rx_status *rx_status;
219 +       struct ieee802_11_elems elems;
220 +       struct ieee80211_mgmt *mgmt;
221 +       struct sta_info *sta;
222 +       size_t baselen;
223 +       u32 rates = 0;
224 +       u16 stype;
225 +       bool new = false;
226 +       enum ieee80211_band band = local->hw.conf.channel->band;
227 +       struct ieee80211_supported_band *sband = local->hw.wiphy->bands[band];
228 +
229 +       rx_status = IEEE80211_SKB_RXCB(skb);
230 +       mgmt = (struct ieee80211_mgmt *) skb->data;
231 +       stype = le16_to_cpu(mgmt->frame_control) & IEEE80211_FCTL_STYPE;
232 +
233 +       if (stype != IEEE80211_STYPE_BEACON)
234 +               return;
235 +
236 +       baselen = (u8 *) mgmt->u.probe_resp.variable - (u8 *) mgmt;
237 +       if (baselen > skb->len)
238 +               return;
239 +
240 +       ieee802_11_parse_elems(mgmt->u.probe_resp.variable,
241 +                              skb->len - baselen, &elems);
242 +
243 +       rates = ieee80211_sta_get_rates(local, &elems, band, NULL);
244 +
245 +       rcu_read_lock();
246 +
247 +       sta = sta_info_get(sdata, sdata->u.wds.remote_addr);
248 +
249 +       if (!sta) {
250 +               rcu_read_unlock();
251 +               sta = sta_info_alloc(sdata, sdata->u.wds.remote_addr,
252 +                                    GFP_KERNEL);
253 +               if (!sta)
254 +                       return;
255 +
256 +               new = true;
257 +       }
258 +
259 +       sta->last_rx = jiffies;
260 +       sta->sta.supp_rates[local->hw.conf.channel->band] = rates;
261 +
262 +       if (elems.ht_cap_elem)
263 +               ieee80211_ht_cap_ie_to_sta_ht_cap(sdata, sband,
264 +                               elems.ht_cap_elem, sta);
265 +
266 +       if (elems.wmm_param)
267 +               set_sta_flag(sta, WLAN_STA_WME);
268 +
269 +       if (new) {
270 +               sta_info_pre_move_state(sta, IEEE80211_STA_AUTH);
271 +               sta_info_pre_move_state(sta, IEEE80211_STA_ASSOC);
272 +               sta_info_pre_move_state(sta, IEEE80211_STA_AUTHORIZED);
273 +               rate_control_rate_init(sta);
274 +               sta_info_insert_rcu(sta);
275 +       }
276 +
277 +       rcu_read_unlock();
278 +}
279 +
280  static void ieee80211_iface_work(struct work_struct *work)
281  {
282         struct ieee80211_sub_if_data *sdata =
283 @@ -1126,6 +1169,9 @@ static void ieee80211_iface_work(struct 
284                                 break;
285                         ieee80211_mesh_rx_queued_mgmt(sdata, skb);
286                         break;
287 +               case NL80211_IFTYPE_WDS:
288 +                       ieee80211_wds_rx_queued_mgmt(sdata, skb);
289 +                       break;
290                 default:
291                         WARN(1, "frame for unexpected interface type");
292                         break;
293 --- a/net/mac80211/rx.c
294 +++ b/net/mac80211/rx.c
295 @@ -2365,6 +2365,7 @@ ieee80211_rx_h_action(struct ieee80211_r
296                     sdata->vif.type != NL80211_IFTYPE_MESH_POINT &&
297                     sdata->vif.type != NL80211_IFTYPE_AP_VLAN &&
298                     sdata->vif.type != NL80211_IFTYPE_AP &&
299 +                   sdata->vif.type != NL80211_IFTYPE_WDS &&
300                     sdata->vif.type != NL80211_IFTYPE_ADHOC)
301                         break;
302  
303 @@ -2692,14 +2693,15 @@ ieee80211_rx_h_mgmt(struct ieee80211_rx_
304  
305         if (!ieee80211_vif_is_mesh(&sdata->vif) &&
306             sdata->vif.type != NL80211_IFTYPE_ADHOC &&
307 -           sdata->vif.type != NL80211_IFTYPE_STATION)
308 +           sdata->vif.type != NL80211_IFTYPE_STATION &&
309 +           sdata->vif.type != NL80211_IFTYPE_WDS)
310                 return RX_DROP_MONITOR;
311  
312         switch (stype) {
313         case cpu_to_le16(IEEE80211_STYPE_AUTH):
314         case cpu_to_le16(IEEE80211_STYPE_BEACON):
315         case cpu_to_le16(IEEE80211_STYPE_PROBE_RESP):
316 -               /* process for all: mesh, mlme, ibss */
317 +               /* process for all: mesh, mlme, ibss, wds */
318                 break;
319         case cpu_to_le16(IEEE80211_STYPE_ASSOC_RESP):
320         case cpu_to_le16(IEEE80211_STYPE_REASSOC_RESP):
321 @@ -3028,10 +3030,16 @@ static int prepare_for_handlers(struct i
322                 }
323                 break;
324         case NL80211_IFTYPE_WDS:
325 -               if (bssid || !ieee80211_is_data(hdr->frame_control))
326 -                       return 0;
327                 if (!ether_addr_equal(sdata->u.wds.remote_addr, hdr->addr2))
328                         return 0;
329 +
330 +               if (ieee80211_is_data(hdr->frame_control) ||
331 +                   ieee80211_is_action(hdr->frame_control)) {
332 +                       if (compare_ether_addr(sdata->vif.addr, hdr->addr1))
333 +                               return 0;
334 +               } else if (!ieee80211_is_beacon(hdr->frame_control))
335 +                       return 0;
336 +
337                 break;
338         case NL80211_IFTYPE_P2P_DEVICE:
339                 if (!ieee80211_is_public_action(hdr, skb->len) &&
340 --- a/net/mac80211/sta_info.h
341 +++ b/net/mac80211/sta_info.h
342 @@ -32,7 +32,6 @@
343   * @WLAN_STA_SHORT_PREAMBLE: Station is capable of receiving short-preamble
344   *     frames.
345   * @WLAN_STA_WME: Station is a QoS-STA.
346 - * @WLAN_STA_WDS: Station is one of our WDS peers.
347   * @WLAN_STA_CLEAR_PS_FILT: Clear PS filter in hardware (using the
348   *     IEEE80211_TX_CTL_CLEAR_PS_FILT control flag) when the next
349   *     frame to this station is transmitted.
350 @@ -66,7 +65,6 @@ enum ieee80211_sta_info_flags {
351         WLAN_STA_AUTHORIZED,
352         WLAN_STA_SHORT_PREAMBLE,
353         WLAN_STA_WME,
354 -       WLAN_STA_WDS,
355         WLAN_STA_CLEAR_PS_FILT,
356         WLAN_STA_MFP,
357         WLAN_STA_BLOCK_BA,
358 --- a/net/mac80211/tx.c
359 +++ b/net/mac80211/tx.c
360 @@ -1231,34 +1231,40 @@ static bool ieee80211_tx_frags(struct ie
361                 if (local->queue_stop_reasons[q] ||
362                     (!txpending && !skb_queue_empty(&local->pending[q]))) {
363                         if (unlikely(info->flags &
364 -                                       IEEE80211_TX_INTFL_OFFCHAN_TX_OK &&
365 -                                    local->queue_stop_reasons[q] &
366 -                                       ~BIT(IEEE80211_QUEUE_STOP_REASON_OFFCHANNEL))) {
367 +                                    IEEE80211_TX_INTFL_OFFCHAN_TX_OK)) {
368 +                               if (local->queue_stop_reasons[q] &
369 +                                   ~BIT(IEEE80211_QUEUE_STOP_REASON_OFFCHANNEL)) {
370 +                                       /*
371 +                                        * Drop off-channel frames if queues
372 +                                        * are stopped for any reason other
373 +                                        * than off-channel operation. Never
374 +                                        * queue them.
375 +                                        */
376 +                                       spin_unlock_irqrestore(
377 +                                               &local->queue_stop_reason_lock,
378 +                                               flags);
379 +                                       ieee80211_purge_tx_queue(&local->hw,
380 +                                                                skbs);
381 +                                       return true;
382 +                               }
383 +                       } else {
384 +
385                                 /*
386 -                                * Drop off-channel frames if queues are stopped
387 -                                * for any reason other than off-channel
388 -                                * operation. Never queue them.
389 +                                * Since queue is stopped, queue up frames for
390 +                                * later transmission from the tx-pending
391 +                                * tasklet when the queue is woken again.
392                                  */
393 -                               spin_unlock_irqrestore(
394 -                                       &local->queue_stop_reason_lock, flags);
395 -                               ieee80211_purge_tx_queue(&local->hw, skbs);
396 -                               return true;
397 +                               if (txpending)
398 +                                       skb_queue_splice_init(skbs,
399 +                                                             &local->pending[q]);
400 +                               else
401 +                                       skb_queue_splice_tail_init(skbs,
402 +                                                                  &local->pending[q]);
403 +
404 +                               spin_unlock_irqrestore(&local->queue_stop_reason_lock,
405 +                                                      flags);
406 +                               return false;
407                         }
408 -
409 -                       /*
410 -                        * Since queue is stopped, queue up frames for later
411 -                        * transmission from the tx-pending tasklet when the
412 -                        * queue is woken again.
413 -                        */
414 -                       if (txpending)
415 -                               skb_queue_splice_init(skbs, &local->pending[q]);
416 -                       else
417 -                               skb_queue_splice_tail_init(skbs,
418 -                                                          &local->pending[q]);
419 -
420 -                       spin_unlock_irqrestore(&local->queue_stop_reason_lock,
421 -                                              flags);
422 -                       return false;
423                 }
424                 spin_unlock_irqrestore(&local->queue_stop_reason_lock, flags);
425  
426 @@ -1848,9 +1854,24 @@ netdev_tx_t ieee80211_subif_start_xmit(s
427                 }
428  
429                 if (!is_multicast_ether_addr(skb->data)) {
430 +                       struct sta_info *next_hop;
431 +                       bool mpp_lookup = true;
432 +
433                         mpath = mesh_path_lookup(sdata, skb->data);
434 -                       if (!mpath)
435 +                       if (mpath) {
436 +                               mpp_lookup = false;
437 +                               next_hop = rcu_dereference(mpath->next_hop);
438 +                               if (!next_hop ||
439 +                                   !(mpath->flags & (MESH_PATH_ACTIVE |
440 +                                                     MESH_PATH_RESOLVING)))
441 +                                       mpp_lookup = true;
442 +                       }
443 +
444 +                       if (mpp_lookup)
445                                 mppath = mpp_path_lookup(sdata, skb->data);
446 +
447 +                       if (mppath && mpath)
448 +                               mesh_path_del(mpath->sdata, mpath->dst);
449                 }
450  
451                 /*
452 --- a/net/wireless/nl80211.c
453 +++ b/net/wireless/nl80211.c
454 @@ -554,16 +554,9 @@ static int nl80211_msg_put_channel(struc
455         if ((chan->flags & IEEE80211_CHAN_NO_IBSS) &&
456             nla_put_flag(msg, NL80211_FREQUENCY_ATTR_NO_IBSS))
457                 goto nla_put_failure;
458 -       if (chan->flags & IEEE80211_CHAN_RADAR) {
459 -               u32 time = elapsed_jiffies_msecs(chan->dfs_state_entered);
460 -               if (nla_put_flag(msg, NL80211_FREQUENCY_ATTR_RADAR))
461 -                       goto nla_put_failure;
462 -               if (nla_put_u32(msg, NL80211_FREQUENCY_ATTR_DFS_STATE,
463 -                               chan->dfs_state))
464 -                       goto nla_put_failure;
465 -               if (nla_put_u32(msg, NL80211_FREQUENCY_ATTR_DFS_TIME, time))
466 -                       goto nla_put_failure;
467 -       }
468 +       if ((chan->flags & IEEE80211_CHAN_RADAR) &&
469 +           nla_put_flag(msg, NL80211_FREQUENCY_ATTR_RADAR))
470 +               goto nla_put_failure;
471         if ((chan->flags & IEEE80211_CHAN_NO_HT40MINUS) &&
472             nla_put_flag(msg, NL80211_FREQUENCY_ATTR_NO_HT40_MINUS))
473                 goto nla_put_failure;
474 @@ -900,9 +893,6 @@ static int nl80211_put_iface_combination
475                     nla_put_u32(msg, NL80211_IFACE_COMB_MAXNUM,
476                                 c->max_interfaces))
477                         goto nla_put_failure;
478 -               if (nla_put_u32(msg, NL80211_IFACE_COMB_RADAR_DETECT_WIDTHS,
479 -                               c->radar_detect_widths))
480 -                       goto nla_put_failure;
481  
482                 nla_nest_end(msg, nl_combi);
483         }
484 @@ -914,48 +904,6 @@ nla_put_failure:
485         return -ENOBUFS;
486  }
487  
488 -#ifdef CONFIG_PM
489 -static int nl80211_send_wowlan_tcp_caps(struct cfg80211_registered_device *rdev,
490 -                                       struct sk_buff *msg)
491 -{
492 -       const struct wiphy_wowlan_tcp_support *tcp = rdev->wiphy.wowlan.tcp;
493 -       struct nlattr *nl_tcp;
494 -
495 -       if (!tcp)
496 -               return 0;
497 -
498 -       nl_tcp = nla_nest_start(msg, NL80211_WOWLAN_TRIG_TCP_CONNECTION);
499 -       if (!nl_tcp)
500 -               return -ENOBUFS;
501 -
502 -       if (nla_put_u32(msg, NL80211_WOWLAN_TCP_DATA_PAYLOAD,
503 -                       tcp->data_payload_max))
504 -               return -ENOBUFS;
505 -
506 -       if (nla_put_u32(msg, NL80211_WOWLAN_TCP_DATA_PAYLOAD,
507 -                       tcp->data_payload_max))
508 -               return -ENOBUFS;
509 -
510 -       if (tcp->seq && nla_put_flag(msg, NL80211_WOWLAN_TCP_DATA_PAYLOAD_SEQ))
511 -               return -ENOBUFS;
512 -
513 -       if (tcp->tok && nla_put(msg, NL80211_WOWLAN_TCP_DATA_PAYLOAD_TOKEN,
514 -                               sizeof(*tcp->tok), tcp->tok))
515 -               return -ENOBUFS;
516 -
517 -       if (nla_put_u32(msg, NL80211_WOWLAN_TCP_DATA_INTERVAL,
518 -                       tcp->data_interval_max))
519 -               return -ENOBUFS;
520 -
521 -       if (nla_put_u32(msg, NL80211_WOWLAN_TCP_WAKE_PAYLOAD,
522 -                       tcp->wake_payload_max))
523 -               return -ENOBUFS;
524 -
525 -       nla_nest_end(msg, nl_tcp);
526 -       return 0;
527 -}
528 -#endif
529 -
530  static int nl80211_send_wiphy(struct sk_buff *msg, u32 portid, u32 seq, int flags,
531                               struct cfg80211_registered_device *dev)
532  {
533 @@ -1330,9 +1278,6 @@ static int nl80211_send_wiphy(struct sk_
534                                 goto nla_put_failure;
535                 }
536  
537 -               if (nl80211_send_wowlan_tcp_caps(dev, msg))
538 -                       goto nla_put_failure;
539 -
540                 nla_nest_end(msg, nl_wowlan);
541         }
542  #endif
543 --- a/net/mac80211/cfg.c
544 +++ b/net/mac80211/cfg.c
545 @@ -3285,13 +3285,19 @@ static int ieee80211_cfg_get_channel(str
546                                      struct cfg80211_chan_def *chandef)
547  {
548         struct ieee80211_sub_if_data *sdata = IEEE80211_WDEV_TO_SUB_IF(wdev);
549 +       struct ieee80211_local *local = wiphy_priv(wiphy);
550         struct ieee80211_chanctx_conf *chanctx_conf;
551         int ret = -ENODATA;
552  
553         rcu_read_lock();
554 -       chanctx_conf = rcu_dereference(sdata->vif.chanctx_conf);
555 -       if (chanctx_conf) {
556 -               *chandef = chanctx_conf->def;
557 +       if (local->use_chanctx) {
558 +               chanctx_conf = rcu_dereference(sdata->vif.chanctx_conf);
559 +               if (chanctx_conf) {
560 +                       *chandef = chanctx_conf->def;
561 +                       ret = 0;
562 +               }
563 +       } else if (local->open_count == local->monitors) {
564 +               *chandef = local->monitor_chandef;
565                 ret = 0;
566         }
567         rcu_read_unlock();
568 --- a/drivers/net/wireless/ath/ath9k/hw.c
569 +++ b/drivers/net/wireless/ath/ath9k/hw.c
570 @@ -1463,7 +1463,9 @@ static bool ath9k_hw_chip_reset(struct a
571                         reset_type = ATH9K_RESET_POWER_ON;
572                 else
573                         reset_type = ATH9K_RESET_COLD;
574 -       }
575 +       } else if (ah->chip_fullsleep || REG_READ(ah, AR_Q_TXE) ||
576 +                  (REG_READ(ah, AR_CR) & AR_CR_RXE))
577 +               reset_type = ATH9K_RESET_COLD;
578  
579         if (!ath9k_hw_set_reset_reg(ah, reset_type))
580                 return false;
581 --- a/drivers/net/wireless/rt2x00/rt2x00dev.c
582 +++ b/drivers/net/wireless/rt2x00/rt2x00dev.c
583 @@ -1236,8 +1236,10 @@ static inline void rt2x00lib_set_if_comb
584          */
585         if_limit = &rt2x00dev->if_limits_ap;
586         if_limit->max = rt2x00dev->ops->max_ap_intf;
587 -       if_limit->types = BIT(NL80211_IFTYPE_AP) |
588 -                       BIT(NL80211_IFTYPE_MESH_POINT);
589 +       if_limit->types = BIT(NL80211_IFTYPE_AP);
590 +#ifdef CONFIG_MAC80211_MESH
591 +       if_limit->types |= BIT(NL80211_IFTYPE_MESH_POINT);
592 +#endif
593  
594         /*
595          * Build up AP interface combinations structure.
596 @@ -1309,7 +1311,9 @@ int rt2x00lib_probe_dev(struct rt2x00_de
597                 rt2x00dev->hw->wiphy->interface_modes |=
598                     BIT(NL80211_IFTYPE_ADHOC) |
599                     BIT(NL80211_IFTYPE_AP) |
600 +#ifdef CONFIG_MAC80211_MESH
601                     BIT(NL80211_IFTYPE_MESH_POINT) |
602 +#endif
603                     BIT(NL80211_IFTYPE_WDS);
604  
605         rt2x00dev->hw->wiphy->flags |= WIPHY_FLAG_IBSS_RSN;