mac80211: backport a few upstream fixes
[openwrt/svn-archive/archive.git] / package / mac80211 / patches / 300-pending_work.patch
1 --- a/net/mac80211/agg-rx.c
2 +++ b/net/mac80211/agg-rx.c
3 @@ -204,6 +204,8 @@ static void ieee80211_send_addba_resp(st
4 memcpy(mgmt->bssid, sdata->u.mgd.bssid, ETH_ALEN);
5 else if (sdata->vif.type == NL80211_IFTYPE_ADHOC)
6 memcpy(mgmt->bssid, sdata->u.ibss.bssid, ETH_ALEN);
7 + else if (sdata->vif.type == NL80211_IFTYPE_WDS)
8 + memcpy(mgmt->bssid, da, ETH_ALEN);
9
10 mgmt->frame_control = cpu_to_le16(IEEE80211_FTYPE_MGMT |
11 IEEE80211_STYPE_ACTION);
12 --- a/net/mac80211/agg-tx.c
13 +++ b/net/mac80211/agg-tx.c
14 @@ -81,7 +81,8 @@ static void ieee80211_send_addba_request
15 memcpy(mgmt->sa, sdata->vif.addr, ETH_ALEN);
16 if (sdata->vif.type == NL80211_IFTYPE_AP ||
17 sdata->vif.type == NL80211_IFTYPE_AP_VLAN ||
18 - sdata->vif.type == NL80211_IFTYPE_MESH_POINT)
19 + sdata->vif.type == NL80211_IFTYPE_MESH_POINT ||
20 + sdata->vif.type == NL80211_IFTYPE_WDS)
21 memcpy(mgmt->bssid, sdata->vif.addr, ETH_ALEN);
22 else if (sdata->vif.type == NL80211_IFTYPE_STATION)
23 memcpy(mgmt->bssid, sdata->u.mgd.bssid, ETH_ALEN);
24 @@ -527,6 +528,7 @@ int ieee80211_start_tx_ba_session(struct
25 sdata->vif.type != NL80211_IFTYPE_MESH_POINT &&
26 sdata->vif.type != NL80211_IFTYPE_AP_VLAN &&
27 sdata->vif.type != NL80211_IFTYPE_AP &&
28 + sdata->vif.type != NL80211_IFTYPE_WDS &&
29 sdata->vif.type != NL80211_IFTYPE_ADHOC)
30 return -EINVAL;
31
32 --- a/net/mac80211/debugfs_sta.c
33 +++ b/net/mac80211/debugfs_sta.c
34 @@ -66,11 +66,11 @@ static ssize_t sta_flags_read(struct fil
35 test_sta_flag(sta, WLAN_STA_##flg) ? #flg "\n" : ""
36
37 int res = scnprintf(buf, sizeof(buf),
38 - "%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s",
39 + "%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s",
40 TEST(AUTH), TEST(ASSOC), TEST(PS_STA),
41 TEST(PS_DRIVER), TEST(AUTHORIZED),
42 TEST(SHORT_PREAMBLE),
43 - TEST(WME), TEST(WDS), TEST(CLEAR_PS_FILT),
44 + TEST(WME), TEST(CLEAR_PS_FILT),
45 TEST(MFP), TEST(BLOCK_BA), TEST(PSPOLL),
46 TEST(UAPSD), TEST(SP), TEST(TDLS_PEER),
47 TEST(TDLS_PEER_AUTH), TEST(4ADDR_EVENT),
48 --- a/net/mac80211/iface.c
49 +++ b/net/mac80211/iface.c
50 @@ -463,7 +463,6 @@ int ieee80211_do_open(struct wireless_de
51 struct ieee80211_sub_if_data *sdata = IEEE80211_WDEV_TO_SUB_IF(wdev);
52 struct net_device *dev = wdev->netdev;
53 struct ieee80211_local *local = sdata->local;
54 - struct sta_info *sta;
55 u32 changed = 0;
56 int res;
57 u32 hw_reconf_flags = 0;
58 @@ -629,30 +628,8 @@ int ieee80211_do_open(struct wireless_de
59
60 set_bit(SDATA_STATE_RUNNING, &sdata->state);
61
62 - if (sdata->vif.type == NL80211_IFTYPE_WDS) {
63 - /* Create STA entry for the WDS peer */
64 - sta = sta_info_alloc(sdata, sdata->u.wds.remote_addr,
65 - GFP_KERNEL);
66 - if (!sta) {
67 - res = -ENOMEM;
68 - goto err_del_interface;
69 - }
70 -
71 - sta_info_pre_move_state(sta, IEEE80211_STA_AUTH);
72 - sta_info_pre_move_state(sta, IEEE80211_STA_ASSOC);
73 - sta_info_pre_move_state(sta, IEEE80211_STA_AUTHORIZED);
74 -
75 - res = sta_info_insert(sta);
76 - if (res) {
77 - /* STA has been freed */
78 - goto err_del_interface;
79 - }
80 -
81 - rate_control_rate_init(sta);
82 - netif_carrier_on(dev);
83 - } else if (sdata->vif.type == NL80211_IFTYPE_P2P_DEVICE) {
84 + if (sdata->vif.type == NL80211_IFTYPE_P2P_DEVICE)
85 rcu_assign_pointer(local->p2p_sdata, sdata);
86 - }
87
88 /*
89 * set_multicast_list will be invoked by the networking core
90 @@ -1116,6 +1093,74 @@ static void ieee80211_if_setup(struct ne
91 dev->destructor = free_netdev;
92 }
93
94 +static void ieee80211_wds_rx_queued_mgmt(struct ieee80211_sub_if_data *sdata,
95 + struct sk_buff *skb)
96 +{
97 + struct ieee80211_local *local = sdata->local;
98 + struct ieee80211_rx_status *rx_status;
99 + struct ieee802_11_elems elems;
100 + struct ieee80211_mgmt *mgmt;
101 + struct sta_info *sta;
102 + size_t baselen;
103 + u32 rates = 0;
104 + u16 stype;
105 + bool new = false;
106 + enum ieee80211_band band;
107 + struct ieee80211_supported_band *sband;
108 +
109 + rx_status = IEEE80211_SKB_RXCB(skb);
110 + band = rx_status->band;
111 + sband = local->hw.wiphy->bands[band];
112 + mgmt = (struct ieee80211_mgmt *) skb->data;
113 + stype = le16_to_cpu(mgmt->frame_control) & IEEE80211_FCTL_STYPE;
114 +
115 + if (stype != IEEE80211_STYPE_BEACON)
116 + return;
117 +
118 + baselen = (u8 *) mgmt->u.probe_resp.variable - (u8 *) mgmt;
119 + if (baselen > skb->len)
120 + return;
121 +
122 + ieee802_11_parse_elems(mgmt->u.probe_resp.variable,
123 + skb->len - baselen, false, &elems);
124 +
125 + rates = ieee80211_sta_get_rates(local, &elems, band, NULL);
126 +
127 + rcu_read_lock();
128 +
129 + sta = sta_info_get(sdata, sdata->u.wds.remote_addr);
130 +
131 + if (!sta) {
132 + rcu_read_unlock();
133 + sta = sta_info_alloc(sdata, sdata->u.wds.remote_addr,
134 + GFP_KERNEL);
135 + if (!sta)
136 + return;
137 +
138 + new = true;
139 + }
140 +
141 + sta->last_rx = jiffies;
142 + sta->sta.supp_rates[band] = rates;
143 +
144 + if (elems.ht_cap_elem)
145 + ieee80211_ht_cap_ie_to_sta_ht_cap(sdata, sband,
146 + elems.ht_cap_elem, sta);
147 +
148 + if (elems.wmm_param)
149 + set_sta_flag(sta, WLAN_STA_WME);
150 +
151 + if (new) {
152 + sta_info_pre_move_state(sta, IEEE80211_STA_AUTH);
153 + sta_info_pre_move_state(sta, IEEE80211_STA_ASSOC);
154 + sta_info_pre_move_state(sta, IEEE80211_STA_AUTHORIZED);
155 + rate_control_rate_init(sta);
156 + sta_info_insert_rcu(sta);
157 + }
158 +
159 + rcu_read_unlock();
160 +}
161 +
162 static void ieee80211_iface_work(struct work_struct *work)
163 {
164 struct ieee80211_sub_if_data *sdata =
165 @@ -1220,6 +1265,9 @@ static void ieee80211_iface_work(struct
166 break;
167 ieee80211_mesh_rx_queued_mgmt(sdata, skb);
168 break;
169 + case NL80211_IFTYPE_WDS:
170 + ieee80211_wds_rx_queued_mgmt(sdata, skb);
171 + break;
172 default:
173 WARN(1, "frame for unexpected interface type");
174 break;
175 --- a/net/mac80211/rc80211_minstrel_ht.c
176 +++ b/net/mac80211/rc80211_minstrel_ht.c
177 @@ -804,10 +804,18 @@ minstrel_ht_get_rate(void *priv, struct
178
179 sample_group = &minstrel_mcs_groups[sample_idx / MCS_GROUP_RATES];
180 info->flags |= IEEE80211_TX_CTL_RATE_CTRL_PROBE;
181 + rate->count = 1;
182 +
183 + if (sample_idx / MCS_GROUP_RATES == MINSTREL_CCK_GROUP) {
184 + int idx = sample_idx % ARRAY_SIZE(mp->cck_rates);
185 + rate->idx = mp->cck_rates[idx];
186 + rate->flags = 0;
187 + return;
188 + }
189 +
190 rate->idx = sample_idx % MCS_GROUP_RATES +
191 (sample_group->streams - 1) * MCS_GROUP_RATES;
192 rate->flags = IEEE80211_TX_RC_MCS | sample_group->flags;
193 - rate->count = 1;
194 }
195
196 static void
197 --- a/net/mac80211/rx.c
198 +++ b/net/mac80211/rx.c
199 @@ -936,8 +936,14 @@ ieee80211_rx_h_check(struct ieee80211_rx
200 struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)rx->skb->data;
201 struct ieee80211_rx_status *status = IEEE80211_SKB_RXCB(rx->skb);
202
203 - /* Drop duplicate 802.11 retransmissions (IEEE 802.11 Chap. 9.2.9) */
204 - if (rx->sta && !is_multicast_ether_addr(hdr->addr1)) {
205 + /*
206 + * Drop duplicate 802.11 retransmissions
207 + * (IEEE 802.11-2012: 9.3.2.10 "Duplicate detection and recovery")
208 + */
209 + if (rx->skb->len >= 24 && rx->sta &&
210 + !ieee80211_is_ctl(hdr->frame_control) &&
211 + !ieee80211_is_qos_nullfunc(hdr->frame_control) &&
212 + !is_multicast_ether_addr(hdr->addr1)) {
213 if (unlikely(ieee80211_has_retry(hdr->frame_control) &&
214 rx->sta->last_seq_ctrl[rx->seqno_idx] ==
215 hdr->seq_ctrl)) {
216 @@ -2369,6 +2375,7 @@ ieee80211_rx_h_action(struct ieee80211_r
217 sdata->vif.type != NL80211_IFTYPE_MESH_POINT &&
218 sdata->vif.type != NL80211_IFTYPE_AP_VLAN &&
219 sdata->vif.type != NL80211_IFTYPE_AP &&
220 + sdata->vif.type != NL80211_IFTYPE_WDS &&
221 sdata->vif.type != NL80211_IFTYPE_ADHOC)
222 break;
223
224 @@ -2720,14 +2727,15 @@ ieee80211_rx_h_mgmt(struct ieee80211_rx_
225
226 if (!ieee80211_vif_is_mesh(&sdata->vif) &&
227 sdata->vif.type != NL80211_IFTYPE_ADHOC &&
228 - sdata->vif.type != NL80211_IFTYPE_STATION)
229 + sdata->vif.type != NL80211_IFTYPE_STATION &&
230 + sdata->vif.type != NL80211_IFTYPE_WDS)
231 return RX_DROP_MONITOR;
232
233 switch (stype) {
234 case cpu_to_le16(IEEE80211_STYPE_AUTH):
235 case cpu_to_le16(IEEE80211_STYPE_BEACON):
236 case cpu_to_le16(IEEE80211_STYPE_PROBE_RESP):
237 - /* process for all: mesh, mlme, ibss */
238 + /* process for all: mesh, mlme, ibss, wds */
239 break;
240 case cpu_to_le16(IEEE80211_STYPE_ASSOC_RESP):
241 case cpu_to_le16(IEEE80211_STYPE_REASSOC_RESP):
242 @@ -3059,10 +3067,16 @@ static int prepare_for_handlers(struct i
243 }
244 break;
245 case NL80211_IFTYPE_WDS:
246 - if (bssid || !ieee80211_is_data(hdr->frame_control))
247 - return 0;
248 if (!ether_addr_equal(sdata->u.wds.remote_addr, hdr->addr2))
249 return 0;
250 +
251 + if (ieee80211_is_data(hdr->frame_control) ||
252 + ieee80211_is_action(hdr->frame_control)) {
253 + if (compare_ether_addr(sdata->vif.addr, hdr->addr1))
254 + return 0;
255 + } else if (!ieee80211_is_beacon(hdr->frame_control))
256 + return 0;
257 +
258 break;
259 case NL80211_IFTYPE_P2P_DEVICE:
260 if (!ieee80211_is_public_action(hdr, skb->len) &&
261 --- a/net/mac80211/sta_info.h
262 +++ b/net/mac80211/sta_info.h
263 @@ -32,7 +32,6 @@
264 * @WLAN_STA_SHORT_PREAMBLE: Station is capable of receiving short-preamble
265 * frames.
266 * @WLAN_STA_WME: Station is a QoS-STA.
267 - * @WLAN_STA_WDS: Station is one of our WDS peers.
268 * @WLAN_STA_CLEAR_PS_FILT: Clear PS filter in hardware (using the
269 * IEEE80211_TX_CTL_CLEAR_PS_FILT control flag) when the next
270 * frame to this station is transmitted.
271 @@ -66,7 +65,6 @@ enum ieee80211_sta_info_flags {
272 WLAN_STA_AUTHORIZED,
273 WLAN_STA_SHORT_PREAMBLE,
274 WLAN_STA_WME,
275 - WLAN_STA_WDS,
276 WLAN_STA_CLEAR_PS_FILT,
277 WLAN_STA_MFP,
278 WLAN_STA_BLOCK_BA,
279 --- a/drivers/net/wireless/ath/ath9k/xmit.c
280 +++ b/drivers/net/wireless/ath/ath9k/xmit.c
281 @@ -146,6 +146,28 @@ static void ath_set_rates(struct ieee802
282 ARRAY_SIZE(bf->rates));
283 }
284
285 +static void ath_txq_skb_done(struct ath_softc *sc, struct ath_txq *txq,
286 + struct sk_buff *skb)
287 +{
288 + int q;
289 +
290 + q = skb_get_queue_mapping(skb);
291 + if (txq == sc->tx.uapsdq)
292 + txq = sc->tx.txq_map[q];
293 +
294 + if (txq != sc->tx.txq_map[q])
295 + return;
296 +
297 + if (WARN_ON(--txq->pending_frames < 0))
298 + txq->pending_frames = 0;
299 +
300 + if (txq->stopped &&
301 + txq->pending_frames < sc->tx.txq_max_pending[q]) {
302 + ieee80211_wake_queue(sc->hw, q);
303 + txq->stopped = false;
304 + }
305 +}
306 +
307 static void ath_tx_flush_tid(struct ath_softc *sc, struct ath_atx_tid *tid)
308 {
309 struct ath_txq *txq = tid->ac->txq;
310 @@ -167,6 +189,7 @@ static void ath_tx_flush_tid(struct ath_
311 if (!bf) {
312 bf = ath_tx_setup_buffer(sc, txq, tid, skb);
313 if (!bf) {
314 + ath_txq_skb_done(sc, txq, skb);
315 ieee80211_free_txskb(sc->hw, skb);
316 continue;
317 }
318 @@ -811,6 +834,7 @@ ath_tx_get_tid_subframe(struct ath_softc
319
320 if (!bf) {
321 __skb_unlink(skb, &tid->buf_q);
322 + ath_txq_skb_done(sc, txq, skb);
323 ieee80211_free_txskb(sc->hw, skb);
324 continue;
325 }
326 @@ -1824,6 +1848,7 @@ static void ath_tx_send_ampdu(struct ath
327
328 bf = ath_tx_setup_buffer(sc, txq, tid, skb);
329 if (!bf) {
330 + ath_txq_skb_done(sc, txq, skb);
331 ieee80211_free_txskb(sc->hw, skb);
332 return;
333 }
334 @@ -2090,6 +2115,7 @@ int ath_tx_start(struct ieee80211_hw *hw
335
336 bf = ath_tx_setup_buffer(sc, txq, tid, skb);
337 if (!bf) {
338 + ath_txq_skb_done(sc, txq, skb);
339 if (txctl->paprd)
340 dev_kfree_skb_any(skb);
341 else
342 @@ -2189,7 +2215,7 @@ static void ath_tx_complete(struct ath_s
343 struct ieee80211_tx_info *tx_info = IEEE80211_SKB_CB(skb);
344 struct ath_common *common = ath9k_hw_common(sc->sc_ah);
345 struct ieee80211_hdr * hdr = (struct ieee80211_hdr *)skb->data;
346 - int q, padpos, padsize;
347 + int padpos, padsize;
348 unsigned long flags;
349
350 ath_dbg(common, XMIT, "TX complete: skb: %p\n", skb);
351 @@ -2225,21 +2251,7 @@ static void ath_tx_complete(struct ath_s
352 spin_unlock_irqrestore(&sc->sc_pm_lock, flags);
353
354 __skb_queue_tail(&txq->complete_q, skb);
355 -
356 - q = skb_get_queue_mapping(skb);
357 - if (txq == sc->tx.uapsdq)
358 - txq = sc->tx.txq_map[q];
359 -
360 - if (txq == sc->tx.txq_map[q]) {
361 - if (WARN_ON(--txq->pending_frames < 0))
362 - txq->pending_frames = 0;
363 -
364 - if (txq->stopped &&
365 - txq->pending_frames < sc->tx.txq_max_pending[q]) {
366 - ieee80211_wake_queue(sc->hw, q);
367 - txq->stopped = false;
368 - }
369 - }
370 + ath_txq_skb_done(sc, txq, skb);
371 }
372
373 static void ath_tx_complete_buf(struct ath_softc *sc, struct ath_buf *bf,
374 --- a/drivers/net/wireless/ath/ath9k/main.c
375 +++ b/drivers/net/wireless/ath/ath9k/main.c
376 @@ -2094,7 +2094,7 @@ static void ath9k_wow_add_pattern(struct
377 {
378 struct ath_hw *ah = sc->sc_ah;
379 struct ath9k_wow_pattern *wow_pattern = NULL;
380 - struct cfg80211_wowlan_trig_pkt_pattern *patterns = wowlan->patterns;
381 + struct cfg80211_pkt_pattern *patterns = wowlan->patterns;
382 int mask_len;
383 s8 i = 0;
384
385 --- a/drivers/net/wireless/mwifiex/cfg80211.c
386 +++ b/drivers/net/wireless/mwifiex/cfg80211.c
387 @@ -2298,8 +2298,7 @@ EXPORT_SYMBOL_GPL(mwifiex_del_virtual_in
388
389 #ifdef CONFIG_PM
390 static bool
391 -mwifiex_is_pattern_supported(struct cfg80211_wowlan_trig_pkt_pattern *pat,
392 - s8 *byte_seq)
393 +mwifiex_is_pattern_supported(struct cfg80211_pkt_pattern *pat, s8 *byte_seq)
394 {
395 int j, k, valid_byte_cnt = 0;
396 bool dont_care_byte = false;
397 --- a/drivers/net/wireless/ti/wlcore/main.c
398 +++ b/drivers/net/wireless/ti/wlcore/main.c
399 @@ -1315,7 +1315,7 @@ static struct sk_buff *wl12xx_alloc_dumm
400
401 #ifdef CONFIG_PM
402 static int
403 -wl1271_validate_wowlan_pattern(struct cfg80211_wowlan_trig_pkt_pattern *p)
404 +wl1271_validate_wowlan_pattern(struct cfg80211_pkt_pattern *p)
405 {
406 int num_fields = 0, in_field = 0, fields_size = 0;
407 int i, pattern_len = 0;
408 @@ -1458,9 +1458,9 @@ void wl1271_rx_filter_flatten_fields(str
409 * Allocates an RX filter returned through f
410 * which needs to be freed using rx_filter_free()
411 */
412 -static int wl1271_convert_wowlan_pattern_to_rx_filter(
413 - struct cfg80211_wowlan_trig_pkt_pattern *p,
414 - struct wl12xx_rx_filter **f)
415 +static int
416 +wl1271_convert_wowlan_pattern_to_rx_filter(struct cfg80211_pkt_pattern *p,
417 + struct wl12xx_rx_filter **f)
418 {
419 int i, j, ret = 0;
420 struct wl12xx_rx_filter *filter;
421 @@ -1562,7 +1562,7 @@ static int wl1271_configure_wowlan(struc
422
423 /* Translate WoWLAN patterns into filters */
424 for (i = 0; i < wow->n_patterns; i++) {
425 - struct cfg80211_wowlan_trig_pkt_pattern *p;
426 + struct cfg80211_pkt_pattern *p;
427 struct wl12xx_rx_filter *filter = NULL;
428
429 p = &wow->patterns[i];
430 --- a/include/net/cfg80211.h
431 +++ b/include/net/cfg80211.h
432 @@ -1698,7 +1698,7 @@ struct cfg80211_pmksa {
433 };
434
435 /**
436 - * struct cfg80211_wowlan_trig_pkt_pattern - packet pattern
437 + * struct cfg80211_pkt_pattern - packet pattern
438 * @mask: bitmask where to match pattern and where to ignore bytes,
439 * one bit per byte, in same format as nl80211
440 * @pattern: bytes to match where bitmask is 1
441 @@ -1708,7 +1708,7 @@ struct cfg80211_pmksa {
442 * Internal note: @mask and @pattern are allocated in one chunk of
443 * memory, free @mask only!
444 */
445 -struct cfg80211_wowlan_trig_pkt_pattern {
446 +struct cfg80211_pkt_pattern {
447 u8 *mask, *pattern;
448 int pattern_len;
449 int pkt_offset;
450 @@ -1770,7 +1770,7 @@ struct cfg80211_wowlan {
451 bool any, disconnect, magic_pkt, gtk_rekey_failure,
452 eap_identity_req, four_way_handshake,
453 rfkill_release;
454 - struct cfg80211_wowlan_trig_pkt_pattern *patterns;
455 + struct cfg80211_pkt_pattern *patterns;
456 struct cfg80211_wowlan_tcp *tcp;
457 int n_patterns;
458 };
459 --- a/include/uapi/linux/nl80211.h
460 +++ b/include/uapi/linux/nl80211.h
461 @@ -3060,11 +3060,11 @@ enum nl80211_tx_power_setting {
462 };
463
464 /**
465 - * enum nl80211_wowlan_packet_pattern_attr - WoWLAN packet pattern attribute
466 - * @__NL80211_WOWLAN_PKTPAT_INVALID: invalid number for nested attribute
467 - * @NL80211_WOWLAN_PKTPAT_PATTERN: the pattern, values where the mask has
468 + * enum nl80211_packet_pattern_attr - packet pattern attribute
469 + * @__NL80211_PKTPAT_INVALID: invalid number for nested attribute
470 + * @NL80211_PKTPAT_PATTERN: the pattern, values where the mask has
471 * a zero bit are ignored
472 - * @NL80211_WOWLAN_PKTPAT_MASK: pattern mask, must be long enough to have
473 + * @NL80211_PKTPAT_MASK: pattern mask, must be long enough to have
474 * a bit for each byte in the pattern. The lowest-order bit corresponds
475 * to the first byte of the pattern, but the bytes of the pattern are
476 * in a little-endian-like format, i.e. the 9th byte of the pattern
477 @@ -3075,23 +3075,23 @@ enum nl80211_tx_power_setting {
478 * Note that the pattern matching is done as though frames were not
479 * 802.11 frames but 802.3 frames, i.e. the frame is fully unpacked
480 * first (including SNAP header unpacking) and then matched.
481 - * @NL80211_WOWLAN_PKTPAT_OFFSET: packet offset, pattern is matched after
482 + * @NL80211_PKTPAT_OFFSET: packet offset, pattern is matched after
483 * these fixed number of bytes of received packet
484 - * @NUM_NL80211_WOWLAN_PKTPAT: number of attributes
485 - * @MAX_NL80211_WOWLAN_PKTPAT: max attribute number
486 + * @NUM_NL80211_PKTPAT: number of attributes
487 + * @MAX_NL80211_PKTPAT: max attribute number
488 */
489 -enum nl80211_wowlan_packet_pattern_attr {
490 - __NL80211_WOWLAN_PKTPAT_INVALID,
491 - NL80211_WOWLAN_PKTPAT_MASK,
492 - NL80211_WOWLAN_PKTPAT_PATTERN,
493 - NL80211_WOWLAN_PKTPAT_OFFSET,
494 +enum nl80211_packet_pattern_attr {
495 + __NL80211_PKTPAT_INVALID,
496 + NL80211_PKTPAT_MASK,
497 + NL80211_PKTPAT_PATTERN,
498 + NL80211_PKTPAT_OFFSET,
499
500 - NUM_NL80211_WOWLAN_PKTPAT,
501 - MAX_NL80211_WOWLAN_PKTPAT = NUM_NL80211_WOWLAN_PKTPAT - 1,
502 + NUM_NL80211_PKTPAT,
503 + MAX_NL80211_PKTPAT = NUM_NL80211_PKTPAT - 1,
504 };
505
506 /**
507 - * struct nl80211_wowlan_pattern_support - pattern support information
508 + * struct nl80211_pattern_support - packet pattern support information
509 * @max_patterns: maximum number of patterns supported
510 * @min_pattern_len: minimum length of each pattern
511 * @max_pattern_len: maximum length of each pattern
512 @@ -3101,13 +3101,22 @@ enum nl80211_wowlan_packet_pattern_attr
513 * that is part of %NL80211_ATTR_WOWLAN_TRIGGERS_SUPPORTED in the
514 * capability information given by the kernel to userspace.
515 */
516 -struct nl80211_wowlan_pattern_support {
517 +struct nl80211_pattern_support {
518 __u32 max_patterns;
519 __u32 min_pattern_len;
520 __u32 max_pattern_len;
521 __u32 max_pkt_offset;
522 } __attribute__((packed));
523
524 +/* only for backward compatibility */
525 +#define __NL80211_WOWLAN_PKTPAT_INVALID __NL80211_PKTPAT_INVALID
526 +#define NL80211_WOWLAN_PKTPAT_MASK NL80211_PKTPAT_MASK
527 +#define NL80211_WOWLAN_PKTPAT_PATTERN NL80211_PKTPAT_PATTERN
528 +#define NL80211_WOWLAN_PKTPAT_OFFSET NL80211_PKTPAT_OFFSET
529 +#define NUM_NL80211_WOWLAN_PKTPAT NUM_NL80211_PKTPAT
530 +#define MAX_NL80211_WOWLAN_PKTPAT MAX_NL80211_PKTPAT
531 +#define nl80211_wowlan_pattern_support nl80211_pattern_support
532 +
533 /**
534 * enum nl80211_wowlan_triggers - WoWLAN trigger definitions
535 * @__NL80211_WOWLAN_TRIG_INVALID: invalid number for nested attributes
536 @@ -3127,7 +3136,7 @@ struct nl80211_wowlan_pattern_support {
537 * pattern matching is done after the packet is converted to the MSDU.
538 *
539 * In %NL80211_ATTR_WOWLAN_TRIGGERS_SUPPORTED, it is a binary attribute
540 - * carrying a &struct nl80211_wowlan_pattern_support.
541 + * carrying a &struct nl80211_pattern_support.
542 *
543 * When reporting wakeup. it is a u32 attribute containing the 0-based
544 * index of the pattern that caused the wakeup, in the patterns passed
545 @@ -3284,7 +3293,7 @@ struct nl80211_wowlan_tcp_data_token_fea
546 * @NL80211_WOWLAN_TCP_WAKE_PAYLOAD: wake packet payload, for advertising a
547 * u32 attribute holding the maximum length
548 * @NL80211_WOWLAN_TCP_WAKE_MASK: Wake packet payload mask, not used for
549 - * feature advertising. The mask works like @NL80211_WOWLAN_PKTPAT_MASK
550 + * feature advertising. The mask works like @NL80211_PKTPAT_MASK
551 * but on the TCP payload only.
552 * @NUM_NL80211_WOWLAN_TCP: number of TCP attributes
553 * @MAX_NL80211_WOWLAN_TCP: highest attribute number
554 --- a/net/mac80211/mesh_ps.c
555 +++ b/net/mac80211/mesh_ps.c
556 @@ -229,6 +229,10 @@ void ieee80211_mps_sta_status_update(str
557 enum nl80211_mesh_power_mode pm;
558 bool do_buffer;
559
560 + /* For non-assoc STA, prevent buffering or frame transmission */
561 + if (sta->sta_state < IEEE80211_STA_ASSOC)
562 + return;
563 +
564 /*
565 * use peer-specific power mode if peering is established and the
566 * peer's power mode is known
567 --- a/net/wireless/nl80211.c
568 +++ b/net/wireless/nl80211.c
569 @@ -441,10 +441,12 @@ static int nl80211_prepare_wdev_dump(str
570 goto out_unlock;
571 }
572 *rdev = wiphy_to_dev((*wdev)->wiphy);
573 - cb->args[0] = (*rdev)->wiphy_idx;
574 + /* 0 is the first index - add 1 to parse only once */
575 + cb->args[0] = (*rdev)->wiphy_idx + 1;
576 cb->args[1] = (*wdev)->identifier;
577 } else {
578 - struct wiphy *wiphy = wiphy_idx_to_wiphy(cb->args[0]);
579 + /* subtract the 1 again here */
580 + struct wiphy *wiphy = wiphy_idx_to_wiphy(cb->args[0] - 1);
581 struct wireless_dev *tmp;
582
583 if (!wiphy) {
584 @@ -974,7 +976,7 @@ static int nl80211_send_wowlan(struct sk
585 return -ENOBUFS;
586
587 if (dev->wiphy.wowlan->n_patterns) {
588 - struct nl80211_wowlan_pattern_support pat = {
589 + struct nl80211_pattern_support pat = {
590 .max_patterns = dev->wiphy.wowlan->n_patterns,
591 .min_pattern_len = dev->wiphy.wowlan->pattern_min_len,
592 .max_pattern_len = dev->wiphy.wowlan->pattern_max_len,
593 @@ -1568,8 +1570,10 @@ static int nl80211_dump_wiphy(struct sk_
594 rtnl_lock();
595 if (!state) {
596 state = kzalloc(sizeof(*state), GFP_KERNEL);
597 - if (!state)
598 + if (!state) {
599 + rtnl_unlock();
600 return -ENOMEM;
601 + }
602 state->filter_wiphy = -1;
603 ret = nl80211_dump_wiphy_parse(skb, cb, state);
604 if (ret) {
605 @@ -6615,12 +6619,14 @@ EXPORT_SYMBOL(cfg80211_testmode_alloc_ev
606
607 void cfg80211_testmode_event(struct sk_buff *skb, gfp_t gfp)
608 {
609 + struct cfg80211_registered_device *rdev = ((void **)skb->cb)[0];
610 void *hdr = ((void **)skb->cb)[1];
611 struct nlattr *data = ((void **)skb->cb)[2];
612
613 nla_nest_end(skb, data);
614 genlmsg_end(skb, hdr);
615 - genlmsg_multicast(skb, 0, nl80211_testmode_mcgrp.id, gfp);
616 + genlmsg_multicast_netns(wiphy_net(&rdev->wiphy), skb, 0,
617 + nl80211_testmode_mcgrp.id, gfp);
618 }
619 EXPORT_SYMBOL(cfg80211_testmode_event);
620 #endif
621 @@ -7593,12 +7599,11 @@ static int nl80211_send_wowlan_patterns(
622 if (!nl_pat)
623 return -ENOBUFS;
624 pat_len = wowlan->patterns[i].pattern_len;
625 - if (nla_put(msg, NL80211_WOWLAN_PKTPAT_MASK,
626 - DIV_ROUND_UP(pat_len, 8),
627 + if (nla_put(msg, NL80211_PKTPAT_MASK, DIV_ROUND_UP(pat_len, 8),
628 wowlan->patterns[i].mask) ||
629 - nla_put(msg, NL80211_WOWLAN_PKTPAT_PATTERN,
630 - pat_len, wowlan->patterns[i].pattern) ||
631 - nla_put_u32(msg, NL80211_WOWLAN_PKTPAT_OFFSET,
632 + nla_put(msg, NL80211_PKTPAT_PATTERN, pat_len,
633 + wowlan->patterns[i].pattern) ||
634 + nla_put_u32(msg, NL80211_PKTPAT_OFFSET,
635 wowlan->patterns[i].pkt_offset))
636 return -ENOBUFS;
637 nla_nest_end(msg, nl_pat);
638 @@ -7939,7 +7944,7 @@ static int nl80211_set_wowlan(struct sk_
639 struct nlattr *pat;
640 int n_patterns = 0;
641 int rem, pat_len, mask_len, pkt_offset;
642 - struct nlattr *pat_tb[NUM_NL80211_WOWLAN_PKTPAT];
643 + struct nlattr *pat_tb[NUM_NL80211_PKTPAT];
644
645 nla_for_each_nested(pat, tb[NL80211_WOWLAN_TRIG_PKT_PATTERN],
646 rem)
647 @@ -7958,26 +7963,25 @@ static int nl80211_set_wowlan(struct sk_
648
649 nla_for_each_nested(pat, tb[NL80211_WOWLAN_TRIG_PKT_PATTERN],
650 rem) {
651 - nla_parse(pat_tb, MAX_NL80211_WOWLAN_PKTPAT,
652 - nla_data(pat), nla_len(pat), NULL);
653 + nla_parse(pat_tb, MAX_NL80211_PKTPAT, nla_data(pat),
654 + nla_len(pat), NULL);
655 err = -EINVAL;
656 - if (!pat_tb[NL80211_WOWLAN_PKTPAT_MASK] ||
657 - !pat_tb[NL80211_WOWLAN_PKTPAT_PATTERN])
658 + if (!pat_tb[NL80211_PKTPAT_MASK] ||
659 + !pat_tb[NL80211_PKTPAT_PATTERN])
660 goto error;
661 - pat_len = nla_len(pat_tb[NL80211_WOWLAN_PKTPAT_PATTERN]);
662 + pat_len = nla_len(pat_tb[NL80211_PKTPAT_PATTERN]);
663 mask_len = DIV_ROUND_UP(pat_len, 8);
664 - if (nla_len(pat_tb[NL80211_WOWLAN_PKTPAT_MASK]) !=
665 - mask_len)
666 + if (nla_len(pat_tb[NL80211_PKTPAT_MASK]) != mask_len)
667 goto error;
668 if (pat_len > wowlan->pattern_max_len ||
669 pat_len < wowlan->pattern_min_len)
670 goto error;
671
672 - if (!pat_tb[NL80211_WOWLAN_PKTPAT_OFFSET])
673 + if (!pat_tb[NL80211_PKTPAT_OFFSET])
674 pkt_offset = 0;
675 else
676 pkt_offset = nla_get_u32(
677 - pat_tb[NL80211_WOWLAN_PKTPAT_OFFSET]);
678 + pat_tb[NL80211_PKTPAT_OFFSET]);
679 if (pkt_offset > wowlan->max_pkt_offset)
680 goto error;
681 new_triggers.patterns[i].pkt_offset = pkt_offset;
682 @@ -7991,11 +7995,11 @@ static int nl80211_set_wowlan(struct sk_
683 new_triggers.patterns[i].pattern =
684 new_triggers.patterns[i].mask + mask_len;
685 memcpy(new_triggers.patterns[i].mask,
686 - nla_data(pat_tb[NL80211_WOWLAN_PKTPAT_MASK]),
687 + nla_data(pat_tb[NL80211_PKTPAT_MASK]),
688 mask_len);
689 new_triggers.patterns[i].pattern_len = pat_len;
690 memcpy(new_triggers.patterns[i].pattern,
691 - nla_data(pat_tb[NL80211_WOWLAN_PKTPAT_PATTERN]),
692 + nla_data(pat_tb[NL80211_PKTPAT_PATTERN]),
693 pat_len);
694 i++;
695 }
696 @@ -10066,7 +10070,8 @@ void cfg80211_mgmt_tx_status(struct wire
697
698 genlmsg_end(msg, hdr);
699
700 - genlmsg_multicast(msg, 0, nl80211_mlme_mcgrp.id, gfp);
701 + genlmsg_multicast_netns(wiphy_net(&rdev->wiphy), msg, 0,
702 + nl80211_mlme_mcgrp.id, gfp);
703 return;
704
705 nla_put_failure:
706 --- a/net/wireless/reg.c
707 +++ b/net/wireless/reg.c
708 @@ -2247,10 +2247,13 @@ int reg_device_uevent(struct device *dev
709
710 void wiphy_regulatory_register(struct wiphy *wiphy)
711 {
712 + struct regulatory_request *lr;
713 +
714 if (!reg_dev_ignore_cell_hint(wiphy))
715 reg_num_devs_support_basehint++;
716
717 - wiphy_update_regulatory(wiphy, NL80211_REGDOM_SET_BY_CORE);
718 + lr = get_last_request();
719 + wiphy_update_regulatory(wiphy, lr->initiator);
720 }
721
722 void wiphy_regulatory_deregister(struct wiphy *wiphy)
723 @@ -2279,7 +2282,9 @@ void wiphy_regulatory_deregister(struct
724 static void reg_timeout_work(struct work_struct *work)
725 {
726 REG_DBG_PRINT("Timeout while waiting for CRDA to reply, restoring regulatory settings\n");
727 + rtnl_lock();
728 restore_regulatory_settings(true);
729 + rtnl_unlock();
730 }
731
732 int __init regulatory_init(void)
733 --- a/net/wireless/sme.c
734 +++ b/net/wireless/sme.c
735 @@ -34,8 +34,10 @@ struct cfg80211_conn {
736 CFG80211_CONN_SCAN_AGAIN,
737 CFG80211_CONN_AUTHENTICATE_NEXT,
738 CFG80211_CONN_AUTHENTICATING,
739 + CFG80211_CONN_AUTH_FAILED,
740 CFG80211_CONN_ASSOCIATE_NEXT,
741 CFG80211_CONN_ASSOCIATING,
742 + CFG80211_CONN_ASSOC_FAILED,
743 CFG80211_CONN_DEAUTH,
744 CFG80211_CONN_CONNECTED,
745 } state;
746 @@ -164,6 +166,8 @@ static int cfg80211_conn_do_work(struct
747 NULL, 0,
748 params->key, params->key_len,
749 params->key_idx, NULL, 0);
750 + case CFG80211_CONN_AUTH_FAILED:
751 + return -ENOTCONN;
752 case CFG80211_CONN_ASSOCIATE_NEXT:
753 BUG_ON(!rdev->ops->assoc);
754 wdev->conn->state = CFG80211_CONN_ASSOCIATING;
755 @@ -188,10 +192,17 @@ static int cfg80211_conn_do_work(struct
756 WLAN_REASON_DEAUTH_LEAVING,
757 false);
758 return err;
759 + case CFG80211_CONN_ASSOC_FAILED:
760 + cfg80211_mlme_deauth(rdev, wdev->netdev, params->bssid,
761 + NULL, 0,
762 + WLAN_REASON_DEAUTH_LEAVING, false);
763 + return -ENOTCONN;
764 case CFG80211_CONN_DEAUTH:
765 cfg80211_mlme_deauth(rdev, wdev->netdev, params->bssid,
766 NULL, 0,
767 WLAN_REASON_DEAUTH_LEAVING, false);
768 + /* free directly, disconnected event already sent */
769 + cfg80211_sme_free(wdev);
770 return 0;
771 default:
772 return 0;
773 @@ -371,7 +382,7 @@ bool cfg80211_sme_rx_assoc_resp(struct w
774 return true;
775 }
776
777 - wdev->conn->state = CFG80211_CONN_DEAUTH;
778 + wdev->conn->state = CFG80211_CONN_ASSOC_FAILED;
779 schedule_work(&rdev->conn_work);
780 return false;
781 }
782 @@ -383,7 +394,13 @@ void cfg80211_sme_deauth(struct wireless
783
784 void cfg80211_sme_auth_timeout(struct wireless_dev *wdev)
785 {
786 - cfg80211_sme_free(wdev);
787 + struct cfg80211_registered_device *rdev = wiphy_to_dev(wdev->wiphy);
788 +
789 + if (!wdev->conn)
790 + return;
791 +
792 + wdev->conn->state = CFG80211_CONN_AUTH_FAILED;
793 + schedule_work(&rdev->conn_work);
794 }
795
796 void cfg80211_sme_disassoc(struct wireless_dev *wdev)
797 @@ -399,7 +416,13 @@ void cfg80211_sme_disassoc(struct wirele
798
799 void cfg80211_sme_assoc_timeout(struct wireless_dev *wdev)
800 {
801 - cfg80211_sme_disassoc(wdev);
802 + struct cfg80211_registered_device *rdev = wiphy_to_dev(wdev->wiphy);
803 +
804 + if (!wdev->conn)
805 + return;
806 +
807 + wdev->conn->state = CFG80211_CONN_ASSOC_FAILED;
808 + schedule_work(&rdev->conn_work);
809 }
810
811 static int cfg80211_sme_connect(struct wireless_dev *wdev,
812 --- a/net/mac80211/rc80211_minstrel.c
813 +++ b/net/mac80211/rc80211_minstrel.c
814 @@ -290,7 +290,7 @@ minstrel_get_rate(void *priv, struct iee
815 struct minstrel_rate *msr, *mr;
816 unsigned int ndx;
817 bool mrr_capable;
818 - bool prev_sample = mi->prev_sample;
819 + bool prev_sample;
820 int delta;
821 int sampling_ratio;
822
823 @@ -314,6 +314,7 @@ minstrel_get_rate(void *priv, struct iee
824 (mi->sample_count + mi->sample_deferred / 2);
825
826 /* delta < 0: no sampling required */
827 + prev_sample = mi->prev_sample;
828 mi->prev_sample = false;
829 if (delta < 0 || (!mrr_capable && prev_sample))
830 return;
831 --- a/drivers/net/wireless/rt2x00/rt2x00queue.c
832 +++ b/drivers/net/wireless/rt2x00/rt2x00queue.c
833 @@ -936,13 +936,8 @@ void rt2x00queue_index_inc(struct queue_
834 spin_unlock_irqrestore(&queue->index_lock, irqflags);
835 }
836
837 -void rt2x00queue_pause_queue(struct data_queue *queue)
838 +void rt2x00queue_pause_queue_nocheck(struct data_queue *queue)
839 {
840 - if (!test_bit(DEVICE_STATE_PRESENT, &queue->rt2x00dev->flags) ||
841 - !test_bit(QUEUE_STARTED, &queue->flags) ||
842 - test_and_set_bit(QUEUE_PAUSED, &queue->flags))
843 - return;
844 -
845 switch (queue->qid) {
846 case QID_AC_VO:
847 case QID_AC_VI:
848 @@ -958,6 +953,15 @@ void rt2x00queue_pause_queue(struct data
849 break;
850 }
851 }
852 +void rt2x00queue_pause_queue(struct data_queue *queue)
853 +{
854 + if (!test_bit(DEVICE_STATE_PRESENT, &queue->rt2x00dev->flags) ||
855 + !test_bit(QUEUE_STARTED, &queue->flags) ||
856 + test_and_set_bit(QUEUE_PAUSED, &queue->flags))
857 + return;
858 +
859 + rt2x00queue_pause_queue_nocheck(queue);
860 +}
861 EXPORT_SYMBOL_GPL(rt2x00queue_pause_queue);
862
863 void rt2x00queue_unpause_queue(struct data_queue *queue)
864 @@ -1019,7 +1023,7 @@ void rt2x00queue_stop_queue(struct data_
865 return;
866 }
867
868 - rt2x00queue_pause_queue(queue);
869 + rt2x00queue_pause_queue_nocheck(queue);
870
871 queue->rt2x00dev->ops->lib->stop_queue(queue);
872
873 --- a/net/mac80211/mlme.c
874 +++ b/net/mac80211/mlme.c
875 @@ -31,10 +31,12 @@
876 #include "led.h"
877
878 #define IEEE80211_AUTH_TIMEOUT (HZ / 5)
879 +#define IEEE80211_AUTH_TIMEOUT_LONG (HZ / 2)
880 #define IEEE80211_AUTH_TIMEOUT_SHORT (HZ / 10)
881 #define IEEE80211_AUTH_MAX_TRIES 3
882 #define IEEE80211_AUTH_WAIT_ASSOC (HZ * 5)
883 #define IEEE80211_ASSOC_TIMEOUT (HZ / 5)
884 +#define IEEE80211_ASSOC_TIMEOUT_LONG (HZ / 2)
885 #define IEEE80211_ASSOC_TIMEOUT_SHORT (HZ / 10)
886 #define IEEE80211_ASSOC_MAX_TRIES 3
887
888 @@ -209,8 +211,9 @@ ieee80211_determine_chantype(struct ieee
889 struct ieee80211_channel *channel,
890 const struct ieee80211_ht_operation *ht_oper,
891 const struct ieee80211_vht_operation *vht_oper,
892 - struct cfg80211_chan_def *chandef, bool verbose)
893 + struct cfg80211_chan_def *chandef, bool tracking)
894 {
895 + struct ieee80211_if_managed *ifmgd = &sdata->u.mgd;
896 struct cfg80211_chan_def vht_chandef;
897 u32 ht_cfreq, ret;
898
899 @@ -229,7 +232,7 @@ ieee80211_determine_chantype(struct ieee
900 ht_cfreq = ieee80211_channel_to_frequency(ht_oper->primary_chan,
901 channel->band);
902 /* check that channel matches the right operating channel */
903 - if (channel->center_freq != ht_cfreq) {
904 + if (!tracking && channel->center_freq != ht_cfreq) {
905 /*
906 * It's possible that some APs are confused here;
907 * Netgear WNDR3700 sometimes reports 4 higher than
908 @@ -237,11 +240,10 @@ ieee80211_determine_chantype(struct ieee
909 * since we look at probe response/beacon data here
910 * it should be OK.
911 */
912 - if (verbose)
913 - sdata_info(sdata,
914 - "Wrong control channel: center-freq: %d ht-cfreq: %d ht->primary_chan: %d band: %d - Disabling HT\n",
915 - channel->center_freq, ht_cfreq,
916 - ht_oper->primary_chan, channel->band);
917 + sdata_info(sdata,
918 + "Wrong control channel: center-freq: %d ht-cfreq: %d ht->primary_chan: %d band: %d - Disabling HT\n",
919 + channel->center_freq, ht_cfreq,
920 + ht_oper->primary_chan, channel->band);
921 ret = IEEE80211_STA_DISABLE_HT | IEEE80211_STA_DISABLE_VHT;
922 goto out;
923 }
924 @@ -295,7 +297,7 @@ ieee80211_determine_chantype(struct ieee
925 channel->band);
926 break;
927 default:
928 - if (verbose)
929 + if (!(ifmgd->flags & IEEE80211_STA_DISABLE_VHT))
930 sdata_info(sdata,
931 "AP VHT operation IE has invalid channel width (%d), disable VHT\n",
932 vht_oper->chan_width);
933 @@ -304,7 +306,7 @@ ieee80211_determine_chantype(struct ieee
934 }
935
936 if (!cfg80211_chandef_valid(&vht_chandef)) {
937 - if (verbose)
938 + if (!(ifmgd->flags & IEEE80211_STA_DISABLE_VHT))
939 sdata_info(sdata,
940 "AP VHT information is invalid, disable VHT\n");
941 ret = IEEE80211_STA_DISABLE_VHT;
942 @@ -317,7 +319,7 @@ ieee80211_determine_chantype(struct ieee
943 }
944
945 if (!cfg80211_chandef_compatible(chandef, &vht_chandef)) {
946 - if (verbose)
947 + if (!(ifmgd->flags & IEEE80211_STA_DISABLE_VHT))
948 sdata_info(sdata,
949 "AP VHT information doesn't match HT, disable VHT\n");
950 ret = IEEE80211_STA_DISABLE_VHT;
951 @@ -333,18 +335,27 @@ out:
952 if (ret & IEEE80211_STA_DISABLE_VHT)
953 vht_chandef = *chandef;
954
955 + /*
956 + * Ignore the DISABLED flag when we're already connected and only
957 + * tracking the APs beacon for bandwidth changes - otherwise we
958 + * might get disconnected here if we connect to an AP, update our
959 + * regulatory information based on the AP's country IE and the
960 + * information we have is wrong/outdated and disables the channel
961 + * that we're actually using for the connection to the AP.
962 + */
963 while (!cfg80211_chandef_usable(sdata->local->hw.wiphy, chandef,
964 - IEEE80211_CHAN_DISABLED)) {
965 + tracking ? 0 :
966 + IEEE80211_CHAN_DISABLED)) {
967 if (WARN_ON(chandef->width == NL80211_CHAN_WIDTH_20_NOHT)) {
968 ret = IEEE80211_STA_DISABLE_HT |
969 IEEE80211_STA_DISABLE_VHT;
970 - goto out;
971 + break;
972 }
973
974 ret |= chandef_downgrade(chandef);
975 }
976
977 - if (chandef->width != vht_chandef.width && verbose)
978 + if (chandef->width != vht_chandef.width && !tracking)
979 sdata_info(sdata,
980 "capabilities/regulatory prevented using AP HT/VHT configuration, downgraded\n");
981
982 @@ -384,7 +395,7 @@ static int ieee80211_config_bw(struct ie
983
984 /* calculate new channel (type) based on HT/VHT operation IEs */
985 flags = ieee80211_determine_chantype(sdata, sband, chan, ht_oper,
986 - vht_oper, &chandef, false);
987 + vht_oper, &chandef, true);
988
989 /*
990 * Downgrade the new channel if we associated with restricted
991 @@ -3394,10 +3405,13 @@ static int ieee80211_probe_auth(struct i
992
993 if (tx_flags == 0) {
994 auth_data->timeout = jiffies + IEEE80211_AUTH_TIMEOUT;
995 - ifmgd->auth_data->timeout_started = true;
996 + auth_data->timeout_started = true;
997 run_again(sdata, auth_data->timeout);
998 } else {
999 - auth_data->timeout_started = false;
1000 + auth_data->timeout =
1001 + round_jiffies_up(jiffies + IEEE80211_AUTH_TIMEOUT_LONG);
1002 + auth_data->timeout_started = true;
1003 + run_again(sdata, auth_data->timeout);
1004 }
1005
1006 return 0;
1007 @@ -3434,7 +3448,11 @@ static int ieee80211_do_assoc(struct iee
1008 assoc_data->timeout_started = true;
1009 run_again(sdata, assoc_data->timeout);
1010 } else {
1011 - assoc_data->timeout_started = false;
1012 + assoc_data->timeout =
1013 + round_jiffies_up(jiffies +
1014 + IEEE80211_ASSOC_TIMEOUT_LONG);
1015 + assoc_data->timeout_started = true;
1016 + run_again(sdata, assoc_data->timeout);
1017 }
1018
1019 return 0;
1020 @@ -3829,7 +3847,7 @@ static int ieee80211_prep_channel(struct
1021 ifmgd->flags |= ieee80211_determine_chantype(sdata, sband,
1022 cbss->channel,
1023 ht_oper, vht_oper,
1024 - &chandef, true);
1025 + &chandef, false);
1026
1027 sdata->needed_rx_chains = min(ieee80211_ht_vht_rx_chains(sdata, cbss),
1028 local->rx_chains);
1029 --- a/net/wireless/core.c
1030 +++ b/net/wireless/core.c
1031 @@ -772,6 +772,7 @@ void cfg80211_leave(struct cfg80211_regi
1032 cfg80211_leave_mesh(rdev, dev);
1033 break;
1034 case NL80211_IFTYPE_AP:
1035 + case NL80211_IFTYPE_P2P_GO:
1036 cfg80211_stop_ap(rdev, dev);
1037 break;
1038 default: