mac80211: fix channel context related warnings when using wds ap mode (fixes #12585)
[openwrt/svn-archive/archive.git] / package / mac80211 / patches / 300-pending_work.patch
1 --- a/drivers/net/wireless/rt2x00/rt2800lib.c
2 +++ b/drivers/net/wireless/rt2x00/rt2800lib.c
3 @@ -5090,7 +5090,8 @@ static int rt2800_probe_hw_mode(struct r
4 IEEE80211_HW_SUPPORTS_PS |
5 IEEE80211_HW_PS_NULLFUNC_STACK |
6 IEEE80211_HW_AMPDU_AGGREGATION |
7 - IEEE80211_HW_REPORTS_TX_ACK_STATUS;
8 + IEEE80211_HW_REPORTS_TX_ACK_STATUS |
9 + IEEE80211_HW_TEARDOWN_AGGR_ON_BAR_FAIL;
10
11 /*
12 * Don't set IEEE80211_HW_HOST_BROADCAST_PS_BUFFERING for USB devices
13 --- a/drivers/net/wireless/rt2x00/rt2x00dev.c
14 +++ b/drivers/net/wireless/rt2x00/rt2x00dev.c
15 @@ -392,10 +392,9 @@ void rt2x00lib_txdone(struct queue_entry
16 tx_info->flags |= IEEE80211_TX_STAT_AMPDU;
17 tx_info->status.ampdu_len = 1;
18 tx_info->status.ampdu_ack_len = success ? 1 : 0;
19 - /*
20 - * TODO: Need to tear down BA session here
21 - * if not successful.
22 - */
23 +
24 + if (!success)
25 + tx_info->flags |= IEEE80211_TX_STAT_AMPDU_NO_BACK;
26 }
27
28 if (rate_flags & IEEE80211_TX_RC_USE_RTS_CTS) {
29 --- a/include/net/mac80211.h
30 +++ b/include/net/mac80211.h
31 @@ -1369,6 +1369,10 @@ struct ieee80211_tx_control {
32 * @IEEE80211_HW_P2P_DEV_ADDR_FOR_INTF: Use the P2P Device address for any
33 * P2P Interface. This will be honoured even if more than one interface
34 * is supported.
35 + *
36 + * @IEEE80211_HW_TEARDOWN_AGGR_ON_BAR_FAIL: On this hardware TX BA session
37 + * should be tear down once BAR frame will not be acked.
38 + *
39 */
40 enum ieee80211_hw_flags {
41 IEEE80211_HW_HAS_RATE_CONTROL = 1<<0,
42 @@ -1397,6 +1401,7 @@ enum ieee80211_hw_flags {
43 IEEE80211_HW_TX_AMPDU_SETUP_IN_HW = 1<<23,
44 IEEE80211_HW_SCAN_WHILE_IDLE = 1<<24,
45 IEEE80211_HW_P2P_DEV_ADDR_FOR_INTF = 1<<25,
46 + IEEE80211_HW_TEARDOWN_AGGR_ON_BAR_FAIL = 1<<26,
47 };
48
49 /**
50 --- a/net/mac80211/agg-rx.c
51 +++ b/net/mac80211/agg-rx.c
52 @@ -203,6 +203,8 @@ static void ieee80211_send_addba_resp(st
53 memcpy(mgmt->bssid, sdata->u.mgd.bssid, ETH_ALEN);
54 else if (sdata->vif.type == NL80211_IFTYPE_ADHOC)
55 memcpy(mgmt->bssid, sdata->u.ibss.bssid, ETH_ALEN);
56 + else if (sdata->vif.type == NL80211_IFTYPE_WDS)
57 + memcpy(mgmt->bssid, da, ETH_ALEN);
58
59 mgmt->frame_control = cpu_to_le16(IEEE80211_FTYPE_MGMT |
60 IEEE80211_STYPE_ACTION);
61 --- a/net/mac80211/agg-tx.c
62 +++ b/net/mac80211/agg-tx.c
63 @@ -81,7 +81,8 @@ static void ieee80211_send_addba_request
64 memcpy(mgmt->sa, sdata->vif.addr, ETH_ALEN);
65 if (sdata->vif.type == NL80211_IFTYPE_AP ||
66 sdata->vif.type == NL80211_IFTYPE_AP_VLAN ||
67 - sdata->vif.type == NL80211_IFTYPE_MESH_POINT)
68 + sdata->vif.type == NL80211_IFTYPE_MESH_POINT ||
69 + sdata->vif.type == NL80211_IFTYPE_WDS)
70 memcpy(mgmt->bssid, sdata->vif.addr, ETH_ALEN);
71 else if (sdata->vif.type == NL80211_IFTYPE_STATION)
72 memcpy(mgmt->bssid, sdata->u.mgd.bssid, ETH_ALEN);
73 @@ -460,6 +461,7 @@ int ieee80211_start_tx_ba_session(struct
74 sdata->vif.type != NL80211_IFTYPE_MESH_POINT &&
75 sdata->vif.type != NL80211_IFTYPE_AP_VLAN &&
76 sdata->vif.type != NL80211_IFTYPE_AP &&
77 + sdata->vif.type != NL80211_IFTYPE_WDS &&
78 sdata->vif.type != NL80211_IFTYPE_ADHOC)
79 return -EINVAL;
80
81 --- a/net/mac80211/debugfs_sta.c
82 +++ b/net/mac80211/debugfs_sta.c
83 @@ -65,11 +65,11 @@ static ssize_t sta_flags_read(struct fil
84 test_sta_flag(sta, WLAN_STA_##flg) ? #flg "\n" : ""
85
86 int res = scnprintf(buf, sizeof(buf),
87 - "%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s",
88 + "%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s",
89 TEST(AUTH), TEST(ASSOC), TEST(PS_STA),
90 TEST(PS_DRIVER), TEST(AUTHORIZED),
91 TEST(SHORT_PREAMBLE),
92 - TEST(WME), TEST(WDS), TEST(CLEAR_PS_FILT),
93 + TEST(WME), TEST(CLEAR_PS_FILT),
94 TEST(MFP), TEST(BLOCK_BA), TEST(PSPOLL),
95 TEST(UAPSD), TEST(SP), TEST(TDLS_PEER),
96 TEST(TDLS_PEER_AUTH), TEST(4ADDR_EVENT),
97 --- a/net/mac80211/ibss.c
98 +++ b/net/mac80211/ibss.c
99 @@ -201,6 +201,20 @@ static void __ieee80211_sta_join_ibss(st
100 bss_change |= BSS_CHANGED_BASIC_RATES;
101 bss_change |= BSS_CHANGED_HT;
102 bss_change |= BSS_CHANGED_IBSS;
103 +
104 + /*
105 + * In 5 GHz/802.11a, we can always use short slot time.
106 + * (IEEE 802.11-2012 18.3.8.7)
107 + *
108 + * In 2.4GHz, we must always use long slots in IBSS for compatibility
109 + * reasons.
110 + * (IEEE 802.11-2012 19.4.5)
111 + *
112 + * HT follows these specifications (IEEE 802.11-2012 20.3.18)
113 + */
114 + sdata->vif.bss_conf.use_short_slot = chan->band == IEEE80211_BAND_5GHZ;
115 + bss_change |= BSS_CHANGED_ERP_SLOT;
116 +
117 sdata->vif.bss_conf.ibss_joined = true;
118 sdata->vif.bss_conf.ibss_creator = creator;
119 ieee80211_bss_info_change_notify(sdata, bss_change);
120 --- a/net/mac80211/iface.c
121 +++ b/net/mac80211/iface.c
122 @@ -508,9 +508,9 @@ static void ieee80211_del_virtual_monito
123 int ieee80211_do_open(struct wireless_dev *wdev, bool coming_up)
124 {
125 struct ieee80211_sub_if_data *sdata = IEEE80211_WDEV_TO_SUB_IF(wdev);
126 + struct ieee80211_sub_if_data *ap_sdata;
127 struct net_device *dev = wdev->netdev;
128 struct ieee80211_local *local = sdata->local;
129 - struct sta_info *sta;
130 u32 changed = 0;
131 int res;
132 u32 hw_reconf_flags = 0;
133 @@ -587,10 +587,14 @@ int ieee80211_do_open(struct wireless_de
134 switch (sdata->vif.type) {
135 case NL80211_IFTYPE_AP_VLAN:
136 /* no need to tell driver, but set carrier */
137 - if (rtnl_dereference(sdata->bss->beacon))
138 - netif_carrier_on(dev);
139 - else
140 + if (!rtnl_dereference(sdata->bss->beacon)) {
141 netif_carrier_off(dev);
142 + break;
143 + }
144 +
145 + ap_sdata = get_bss_sdata(sdata);
146 + ieee80211_vif_copy_channel(sdata, ap_sdata);
147 + netif_carrier_on(dev);
148 break;
149 case NL80211_IFTYPE_MONITOR:
150 if (sdata->u.mntr_flags & MONITOR_FLAG_COOK_FRAMES) {
151 @@ -665,30 +669,8 @@ int ieee80211_do_open(struct wireless_de
152
153 set_bit(SDATA_STATE_RUNNING, &sdata->state);
154
155 - if (sdata->vif.type == NL80211_IFTYPE_WDS) {
156 - /* Create STA entry for the WDS peer */
157 - sta = sta_info_alloc(sdata, sdata->u.wds.remote_addr,
158 - GFP_KERNEL);
159 - if (!sta) {
160 - res = -ENOMEM;
161 - goto err_del_interface;
162 - }
163 -
164 - sta_info_pre_move_state(sta, IEEE80211_STA_AUTH);
165 - sta_info_pre_move_state(sta, IEEE80211_STA_ASSOC);
166 - sta_info_pre_move_state(sta, IEEE80211_STA_AUTHORIZED);
167 -
168 - res = sta_info_insert(sta);
169 - if (res) {
170 - /* STA has been freed */
171 - goto err_del_interface;
172 - }
173 -
174 - rate_control_rate_init(sta);
175 - netif_carrier_on(dev);
176 - } else if (sdata->vif.type == NL80211_IFTYPE_P2P_DEVICE) {
177 + if (sdata->vif.type == NL80211_IFTYPE_P2P_DEVICE)
178 rcu_assign_pointer(local->p2p_sdata, sdata);
179 - }
180
181 /*
182 * set_multicast_list will be invoked by the networking core
183 @@ -844,6 +826,8 @@ static void ieee80211_do_stop(struct iee
184 switch (sdata->vif.type) {
185 case NL80211_IFTYPE_AP_VLAN:
186 list_del(&sdata->u.vlan.list);
187 + netif_carrier_off(sdata->dev);
188 + ieee80211_vif_release_channel(sdata);
189 /* no need to tell driver */
190 break;
191 case NL80211_IFTYPE_MONITOR:
192 @@ -1072,6 +1056,72 @@ static void ieee80211_if_setup(struct ne
193 dev->destructor = free_netdev;
194 }
195
196 +static void ieee80211_wds_rx_queued_mgmt(struct ieee80211_sub_if_data *sdata,
197 + struct sk_buff *skb)
198 +{
199 + struct ieee80211_local *local = sdata->local;
200 + struct ieee80211_rx_status *rx_status;
201 + struct ieee802_11_elems elems;
202 + struct ieee80211_mgmt *mgmt;
203 + struct sta_info *sta;
204 + size_t baselen;
205 + u32 rates = 0;
206 + u16 stype;
207 + bool new = false;
208 + enum ieee80211_band band = local->hw.conf.channel->band;
209 + struct ieee80211_supported_band *sband = local->hw.wiphy->bands[band];
210 +
211 + rx_status = IEEE80211_SKB_RXCB(skb);
212 + mgmt = (struct ieee80211_mgmt *) skb->data;
213 + stype = le16_to_cpu(mgmt->frame_control) & IEEE80211_FCTL_STYPE;
214 +
215 + if (stype != IEEE80211_STYPE_BEACON)
216 + return;
217 +
218 + baselen = (u8 *) mgmt->u.probe_resp.variable - (u8 *) mgmt;
219 + if (baselen > skb->len)
220 + return;
221 +
222 + ieee802_11_parse_elems(mgmt->u.probe_resp.variable,
223 + skb->len - baselen, &elems);
224 +
225 + rates = ieee80211_sta_get_rates(local, &elems, band, NULL);
226 +
227 + rcu_read_lock();
228 +
229 + sta = sta_info_get(sdata, sdata->u.wds.remote_addr);
230 +
231 + if (!sta) {
232 + rcu_read_unlock();
233 + sta = sta_info_alloc(sdata, sdata->u.wds.remote_addr,
234 + GFP_KERNEL);
235 + if (!sta)
236 + return;
237 +
238 + new = true;
239 + }
240 +
241 + sta->last_rx = jiffies;
242 + sta->sta.supp_rates[local->hw.conf.channel->band] = rates;
243 +
244 + if (elems.ht_cap_elem)
245 + ieee80211_ht_cap_ie_to_sta_ht_cap(sdata, sband,
246 + elems.ht_cap_elem, &sta->sta.ht_cap);
247 +
248 + if (elems.wmm_param)
249 + set_sta_flag(sta, WLAN_STA_WME);
250 +
251 + if (new) {
252 + sta_info_pre_move_state(sta, IEEE80211_STA_AUTH);
253 + sta_info_pre_move_state(sta, IEEE80211_STA_ASSOC);
254 + sta_info_pre_move_state(sta, IEEE80211_STA_AUTHORIZED);
255 + rate_control_rate_init(sta);
256 + sta_info_insert_rcu(sta);
257 + }
258 +
259 + rcu_read_unlock();
260 +}
261 +
262 static void ieee80211_iface_work(struct work_struct *work)
263 {
264 struct ieee80211_sub_if_data *sdata =
265 @@ -1176,6 +1226,9 @@ static void ieee80211_iface_work(struct
266 break;
267 ieee80211_mesh_rx_queued_mgmt(sdata, skb);
268 break;
269 + case NL80211_IFTYPE_WDS:
270 + ieee80211_wds_rx_queued_mgmt(sdata, skb);
271 + break;
272 default:
273 WARN(1, "frame for unexpected interface type");
274 break;
275 --- a/net/mac80211/rx.c
276 +++ b/net/mac80211/rx.c
277 @@ -378,9 +378,6 @@ ieee80211_rx_monitor(struct ieee80211_lo
278 * the SKB because it has a bad FCS/PLCP checksum.
279 */
280
281 - /* room for the radiotap header based on driver features */
282 - needed_headroom = ieee80211_rx_radiotap_space(local, status);
283 -
284 if (local->hw.flags & IEEE80211_HW_RX_INCLUDES_FCS)
285 present_fcs_len = FCS_LEN;
286
287 @@ -399,6 +396,9 @@ ieee80211_rx_monitor(struct ieee80211_lo
288 return remove_monitor_info(local, origskb);
289 }
290
291 + /* room for the radiotap header based on driver features */
292 + needed_headroom = ieee80211_rx_radiotap_space(local, status);
293 +
294 if (should_drop_frame(origskb, present_fcs_len)) {
295 /* only need to expand headroom if necessary */
296 skb = origskb;
297 @@ -2333,7 +2333,8 @@ ieee80211_rx_h_action(struct ieee80211_r
298 if (len < IEEE80211_MIN_ACTION_SIZE)
299 return RX_DROP_UNUSABLE;
300
301 - if (!rx->sta && mgmt->u.action.category != WLAN_CATEGORY_PUBLIC)
302 + if (!rx->sta && mgmt->u.action.category != WLAN_CATEGORY_PUBLIC &&
303 + mgmt->u.action.category != WLAN_CATEGORY_SELF_PROTECTED)
304 return RX_DROP_UNUSABLE;
305
306 if (!(status->rx_flags & IEEE80211_RX_RA_MATCH))
307 @@ -2349,6 +2350,7 @@ ieee80211_rx_h_action(struct ieee80211_r
308 sdata->vif.type != NL80211_IFTYPE_MESH_POINT &&
309 sdata->vif.type != NL80211_IFTYPE_AP_VLAN &&
310 sdata->vif.type != NL80211_IFTYPE_AP &&
311 + sdata->vif.type != NL80211_IFTYPE_WDS &&
312 sdata->vif.type != NL80211_IFTYPE_ADHOC)
313 break;
314
315 @@ -2625,14 +2627,15 @@ ieee80211_rx_h_mgmt(struct ieee80211_rx_
316
317 if (!ieee80211_vif_is_mesh(&sdata->vif) &&
318 sdata->vif.type != NL80211_IFTYPE_ADHOC &&
319 - sdata->vif.type != NL80211_IFTYPE_STATION)
320 + sdata->vif.type != NL80211_IFTYPE_STATION &&
321 + sdata->vif.type != NL80211_IFTYPE_WDS)
322 return RX_DROP_MONITOR;
323
324 switch (stype) {
325 case cpu_to_le16(IEEE80211_STYPE_AUTH):
326 case cpu_to_le16(IEEE80211_STYPE_BEACON):
327 case cpu_to_le16(IEEE80211_STYPE_PROBE_RESP):
328 - /* process for all: mesh, mlme, ibss */
329 + /* process for all: mesh, mlme, ibss, wds */
330 break;
331 case cpu_to_le16(IEEE80211_STYPE_ASSOC_RESP):
332 case cpu_to_le16(IEEE80211_STYPE_REASSOC_RESP):
333 @@ -2957,10 +2960,16 @@ static int prepare_for_handlers(struct i
334 }
335 break;
336 case NL80211_IFTYPE_WDS:
337 - if (bssid || !ieee80211_is_data(hdr->frame_control))
338 - return 0;
339 if (!ether_addr_equal(sdata->u.wds.remote_addr, hdr->addr2))
340 return 0;
341 +
342 + if (ieee80211_is_data(hdr->frame_control) ||
343 + ieee80211_is_action(hdr->frame_control)) {
344 + if (compare_ether_addr(sdata->vif.addr, hdr->addr1))
345 + return 0;
346 + } else if (!ieee80211_is_beacon(hdr->frame_control))
347 + return 0;
348 +
349 break;
350 case NL80211_IFTYPE_P2P_DEVICE:
351 if (!ieee80211_is_public_action(hdr, skb->len) &&
352 --- a/net/mac80211/sta_info.h
353 +++ b/net/mac80211/sta_info.h
354 @@ -32,7 +32,6 @@
355 * @WLAN_STA_SHORT_PREAMBLE: Station is capable of receiving short-preamble
356 * frames.
357 * @WLAN_STA_WME: Station is a QoS-STA.
358 - * @WLAN_STA_WDS: Station is one of our WDS peers.
359 * @WLAN_STA_CLEAR_PS_FILT: Clear PS filter in hardware (using the
360 * IEEE80211_TX_CTL_CLEAR_PS_FILT control flag) when the next
361 * frame to this station is transmitted.
362 @@ -64,7 +63,6 @@ enum ieee80211_sta_info_flags {
363 WLAN_STA_AUTHORIZED,
364 WLAN_STA_SHORT_PREAMBLE,
365 WLAN_STA_WME,
366 - WLAN_STA_WDS,
367 WLAN_STA_CLEAR_PS_FILT,
368 WLAN_STA_MFP,
369 WLAN_STA_BLOCK_BA,
370 --- a/net/mac80211/status.c
371 +++ b/net/mac80211/status.c
372 @@ -502,7 +502,11 @@ void ieee80211_tx_status(struct ieee8021
373 IEEE80211_BAR_CTRL_TID_INFO_MASK) >>
374 IEEE80211_BAR_CTRL_TID_INFO_SHIFT;
375
376 - ieee80211_set_bar_pending(sta, tid, ssn);
377 + if (local->hw.flags &
378 + IEEE80211_HW_TEARDOWN_AGGR_ON_BAR_FAIL)
379 + ieee80211_stop_tx_ba_session(&sta->sta, tid);
380 + else
381 + ieee80211_set_bar_pending(sta, tid, ssn);
382 }
383 }
384
385 --- a/drivers/net/wireless/ath/ath9k/ar9003_2p2_initvals.h
386 +++ b/drivers/net/wireless/ath/ath9k/ar9003_2p2_initvals.h
387 @@ -534,98 +534,98 @@ static const u32 ar9300_2p2_baseband_cor
388
389 static const u32 ar9300Modes_high_power_tx_gain_table_2p2[][5] = {
390 /* Addr 5G_HT20 5G_HT40 2G_HT40 2G_HT20 */
391 - {0x0000a2dc, 0x00033800, 0x00033800, 0x03aaa352, 0x03aaa352},
392 - {0x0000a2e0, 0x0003c000, 0x0003c000, 0x03ccc584, 0x03ccc584},
393 - {0x0000a2e4, 0x03fc0000, 0x03fc0000, 0x03f0f800, 0x03f0f800},
394 + {0x0000a2dc, 0x0380c7fc, 0x0380c7fc, 0x03aaa352, 0x03aaa352},
395 + {0x0000a2e0, 0x0000f800, 0x0000f800, 0x03ccc584, 0x03ccc584},
396 + {0x0000a2e4, 0x03ff0000, 0x03ff0000, 0x03f0f800, 0x03f0f800},
397 {0x0000a2e8, 0x00000000, 0x00000000, 0x03ff0000, 0x03ff0000},
398 - {0x0000a410, 0x000050d9, 0x000050d9, 0x000050d9, 0x000050d9},
399 - {0x0000a500, 0x00000000, 0x00000000, 0x00000000, 0x00000000},
400 - {0x0000a504, 0x06000003, 0x06000003, 0x04000002, 0x04000002},
401 - {0x0000a508, 0x0a000020, 0x0a000020, 0x08000004, 0x08000004},
402 - {0x0000a50c, 0x10000023, 0x10000023, 0x0b000200, 0x0b000200},
403 - {0x0000a510, 0x16000220, 0x16000220, 0x0f000202, 0x0f000202},
404 - {0x0000a514, 0x1c000223, 0x1c000223, 0x12000400, 0x12000400},
405 - {0x0000a518, 0x21002220, 0x21002220, 0x16000402, 0x16000402},
406 - {0x0000a51c, 0x27002223, 0x27002223, 0x19000404, 0x19000404},
407 - {0x0000a520, 0x2b022220, 0x2b022220, 0x1c000603, 0x1c000603},
408 - {0x0000a524, 0x2f022222, 0x2f022222, 0x21000a02, 0x21000a02},
409 - {0x0000a528, 0x34022225, 0x34022225, 0x25000a04, 0x25000a04},
410 - {0x0000a52c, 0x3a02222a, 0x3a02222a, 0x28000a20, 0x28000a20},
411 - {0x0000a530, 0x3e02222c, 0x3e02222c, 0x2c000e20, 0x2c000e20},
412 - {0x0000a534, 0x4202242a, 0x4202242a, 0x30000e22, 0x30000e22},
413 - {0x0000a538, 0x4702244a, 0x4702244a, 0x34000e24, 0x34000e24},
414 - {0x0000a53c, 0x4b02244c, 0x4b02244c, 0x38001640, 0x38001640},
415 - {0x0000a540, 0x4e02246c, 0x4e02246c, 0x3c001660, 0x3c001660},
416 - {0x0000a544, 0x52022470, 0x52022470, 0x3f001861, 0x3f001861},
417 - {0x0000a548, 0x55022490, 0x55022490, 0x43001a81, 0x43001a81},
418 - {0x0000a54c, 0x59022492, 0x59022492, 0x47001a83, 0x47001a83},
419 - {0x0000a550, 0x5d022692, 0x5d022692, 0x4a001c84, 0x4a001c84},
420 - {0x0000a554, 0x61022892, 0x61022892, 0x4e001ce3, 0x4e001ce3},
421 - {0x0000a558, 0x65024890, 0x65024890, 0x52001ce5, 0x52001ce5},
422 - {0x0000a55c, 0x69024892, 0x69024892, 0x56001ce9, 0x56001ce9},
423 - {0x0000a560, 0x6e024c92, 0x6e024c92, 0x5a001ceb, 0x5a001ceb},
424 - {0x0000a564, 0x74026e92, 0x74026e92, 0x5d001eec, 0x5d001eec},
425 - {0x0000a568, 0x74026e92, 0x74026e92, 0x5d001eec, 0x5d001eec},
426 - {0x0000a56c, 0x74026e92, 0x74026e92, 0x5d001eec, 0x5d001eec},
427 - {0x0000a570, 0x74026e92, 0x74026e92, 0x5d001eec, 0x5d001eec},
428 - {0x0000a574, 0x74026e92, 0x74026e92, 0x5d001eec, 0x5d001eec},
429 - {0x0000a578, 0x74026e92, 0x74026e92, 0x5d001eec, 0x5d001eec},
430 - {0x0000a57c, 0x74026e92, 0x74026e92, 0x5d001eec, 0x5d001eec},
431 - {0x0000a580, 0x00800000, 0x00800000, 0x00800000, 0x00800000},
432 - {0x0000a584, 0x06800003, 0x06800003, 0x04800002, 0x04800002},
433 - {0x0000a588, 0x0a800020, 0x0a800020, 0x08800004, 0x08800004},
434 - {0x0000a58c, 0x10800023, 0x10800023, 0x0b800200, 0x0b800200},
435 - {0x0000a590, 0x16800220, 0x16800220, 0x0f800202, 0x0f800202},
436 - {0x0000a594, 0x1c800223, 0x1c800223, 0x12800400, 0x12800400},
437 - {0x0000a598, 0x21802220, 0x21802220, 0x16800402, 0x16800402},
438 - {0x0000a59c, 0x27802223, 0x27802223, 0x19800404, 0x19800404},
439 - {0x0000a5a0, 0x2b822220, 0x2b822220, 0x1c800603, 0x1c800603},
440 - {0x0000a5a4, 0x2f822222, 0x2f822222, 0x21800a02, 0x21800a02},
441 - {0x0000a5a8, 0x34822225, 0x34822225, 0x25800a04, 0x25800a04},
442 - {0x0000a5ac, 0x3a82222a, 0x3a82222a, 0x28800a20, 0x28800a20},
443 - {0x0000a5b0, 0x3e82222c, 0x3e82222c, 0x2c800e20, 0x2c800e20},
444 - {0x0000a5b4, 0x4282242a, 0x4282242a, 0x30800e22, 0x30800e22},
445 - {0x0000a5b8, 0x4782244a, 0x4782244a, 0x34800e24, 0x34800e24},
446 - {0x0000a5bc, 0x4b82244c, 0x4b82244c, 0x38801640, 0x38801640},
447 - {0x0000a5c0, 0x4e82246c, 0x4e82246c, 0x3c801660, 0x3c801660},
448 - {0x0000a5c4, 0x52822470, 0x52822470, 0x3f801861, 0x3f801861},
449 - {0x0000a5c8, 0x55822490, 0x55822490, 0x43801a81, 0x43801a81},
450 - {0x0000a5cc, 0x59822492, 0x59822492, 0x47801a83, 0x47801a83},
451 - {0x0000a5d0, 0x5d822692, 0x5d822692, 0x4a801c84, 0x4a801c84},
452 - {0x0000a5d4, 0x61822892, 0x61822892, 0x4e801ce3, 0x4e801ce3},
453 - {0x0000a5d8, 0x65824890, 0x65824890, 0x52801ce5, 0x52801ce5},
454 - {0x0000a5dc, 0x69824892, 0x69824892, 0x56801ce9, 0x56801ce9},
455 - {0x0000a5e0, 0x6e824c92, 0x6e824c92, 0x5a801ceb, 0x5a801ceb},
456 - {0x0000a5e4, 0x74826e92, 0x74826e92, 0x5d801eec, 0x5d801eec},
457 - {0x0000a5e8, 0x74826e92, 0x74826e92, 0x5d801eec, 0x5d801eec},
458 - {0x0000a5ec, 0x74826e92, 0x74826e92, 0x5d801eec, 0x5d801eec},
459 - {0x0000a5f0, 0x74826e92, 0x74826e92, 0x5d801eec, 0x5d801eec},
460 - {0x0000a5f4, 0x74826e92, 0x74826e92, 0x5d801eec, 0x5d801eec},
461 - {0x0000a5f8, 0x74826e92, 0x74826e92, 0x5d801eec, 0x5d801eec},
462 - {0x0000a5fc, 0x74826e92, 0x74826e92, 0x5d801eec, 0x5d801eec},
463 + {0x0000a410, 0x000050d8, 0x000050d8, 0x000050d9, 0x000050d9},
464 + {0x0000a500, 0x00002220, 0x00002220, 0x00000000, 0x00000000},
465 + {0x0000a504, 0x04002222, 0x04002222, 0x04000002, 0x04000002},
466 + {0x0000a508, 0x09002421, 0x09002421, 0x08000004, 0x08000004},
467 + {0x0000a50c, 0x0d002621, 0x0d002621, 0x0b000200, 0x0b000200},
468 + {0x0000a510, 0x13004620, 0x13004620, 0x0f000202, 0x0f000202},
469 + {0x0000a514, 0x19004a20, 0x19004a20, 0x11000400, 0x11000400},
470 + {0x0000a518, 0x1d004e20, 0x1d004e20, 0x15000402, 0x15000402},
471 + {0x0000a51c, 0x21005420, 0x21005420, 0x19000404, 0x19000404},
472 + {0x0000a520, 0x26005e20, 0x26005e20, 0x1b000603, 0x1b000603},
473 + {0x0000a524, 0x2b005e40, 0x2b005e40, 0x1f000a02, 0x1f000a02},
474 + {0x0000a528, 0x2f005e42, 0x2f005e42, 0x23000a04, 0x23000a04},
475 + {0x0000a52c, 0x33005e44, 0x33005e44, 0x26000a20, 0x26000a20},
476 + {0x0000a530, 0x38005e65, 0x38005e65, 0x2a000e20, 0x2a000e20},
477 + {0x0000a534, 0x3c005e69, 0x3c005e69, 0x2e000e22, 0x2e000e22},
478 + {0x0000a538, 0x40005e6b, 0x40005e6b, 0x31000e24, 0x31000e24},
479 + {0x0000a53c, 0x44005e6d, 0x44005e6d, 0x34001640, 0x34001640},
480 + {0x0000a540, 0x49005e72, 0x49005e72, 0x38001660, 0x38001660},
481 + {0x0000a544, 0x4e005eb2, 0x4e005eb2, 0x3b001861, 0x3b001861},
482 + {0x0000a548, 0x53005f12, 0x53005f12, 0x3e001a81, 0x3e001a81},
483 + {0x0000a54c, 0x59025eb2, 0x59025eb2, 0x42001a83, 0x42001a83},
484 + {0x0000a550, 0x5e025f12, 0x5e025f12, 0x44001c84, 0x44001c84},
485 + {0x0000a554, 0x61027f12, 0x61027f12, 0x48001ce3, 0x48001ce3},
486 + {0x0000a558, 0x6702bf12, 0x6702bf12, 0x4c001ce5, 0x4c001ce5},
487 + {0x0000a55c, 0x6b02bf14, 0x6b02bf14, 0x50001ce9, 0x50001ce9},
488 + {0x0000a560, 0x6f02bf16, 0x6f02bf16, 0x54001ceb, 0x54001ceb},
489 + {0x0000a564, 0x6f02bf16, 0x6f02bf16, 0x56001eec, 0x56001eec},
490 + {0x0000a568, 0x6f02bf16, 0x6f02bf16, 0x56001eec, 0x56001eec},
491 + {0x0000a56c, 0x6f02bf16, 0x6f02bf16, 0x56001eec, 0x56001eec},
492 + {0x0000a570, 0x6f02bf16, 0x6f02bf16, 0x56001eec, 0x56001eec},
493 + {0x0000a574, 0x6f02bf16, 0x6f02bf16, 0x56001eec, 0x56001eec},
494 + {0x0000a578, 0x6f02bf16, 0x6f02bf16, 0x56001eec, 0x56001eec},
495 + {0x0000a57c, 0x6f02bf16, 0x6f02bf16, 0x56001eec, 0x56001eec},
496 + {0x0000a580, 0x00802220, 0x00802220, 0x00800000, 0x00800000},
497 + {0x0000a584, 0x04802222, 0x04802222, 0x04800002, 0x04800002},
498 + {0x0000a588, 0x09802421, 0x09802421, 0x08800004, 0x08800004},
499 + {0x0000a58c, 0x0d802621, 0x0d802621, 0x0b800200, 0x0b800200},
500 + {0x0000a590, 0x13804620, 0x13804620, 0x0f800202, 0x0f800202},
501 + {0x0000a594, 0x19804a20, 0x19804a20, 0x11800400, 0x11800400},
502 + {0x0000a598, 0x1d804e20, 0x1d804e20, 0x15800402, 0x15800402},
503 + {0x0000a59c, 0x21805420, 0x21805420, 0x19800404, 0x19800404},
504 + {0x0000a5a0, 0x26805e20, 0x26805e20, 0x1b800603, 0x1b800603},
505 + {0x0000a5a4, 0x2b805e40, 0x2b805e40, 0x1f800a02, 0x1f800a02},
506 + {0x0000a5a8, 0x2f805e42, 0x2f805e42, 0x23800a04, 0x23800a04},
507 + {0x0000a5ac, 0x33805e44, 0x33805e44, 0x26800a20, 0x26800a20},
508 + {0x0000a5b0, 0x38805e65, 0x38805e65, 0x2a800e20, 0x2a800e20},
509 + {0x0000a5b4, 0x3c805e69, 0x3c805e69, 0x2e800e22, 0x2e800e22},
510 + {0x0000a5b8, 0x40805e6b, 0x40805e6b, 0x31800e24, 0x31800e24},
511 + {0x0000a5bc, 0x44805e6d, 0x44805e6d, 0x34801640, 0x34801640},
512 + {0x0000a5c0, 0x49805e72, 0x49805e72, 0x38801660, 0x38801660},
513 + {0x0000a5c4, 0x4e805eb2, 0x4e805eb2, 0x3b801861, 0x3b801861},
514 + {0x0000a5c8, 0x53805f12, 0x53805f12, 0x3e801a81, 0x3e801a81},
515 + {0x0000a5cc, 0x59825eb2, 0x59825eb2, 0x42801a83, 0x42801a83},
516 + {0x0000a5d0, 0x5e825f12, 0x5e825f12, 0x44801c84, 0x44801c84},
517 + {0x0000a5d4, 0x61827f12, 0x61827f12, 0x48801ce3, 0x48801ce3},
518 + {0x0000a5d8, 0x6782bf12, 0x6782bf12, 0x4c801ce5, 0x4c801ce5},
519 + {0x0000a5dc, 0x6b82bf14, 0x6b82bf14, 0x50801ce9, 0x50801ce9},
520 + {0x0000a5e0, 0x6f82bf16, 0x6f82bf16, 0x54801ceb, 0x54801ceb},
521 + {0x0000a5e4, 0x6f82bf16, 0x6f82bf16, 0x56801eec, 0x56801eec},
522 + {0x0000a5e8, 0x6f82bf16, 0x6f82bf16, 0x56801eec, 0x56801eec},
523 + {0x0000a5ec, 0x6f82bf16, 0x6f82bf16, 0x56801eec, 0x56801eec},
524 + {0x0000a5f0, 0x6f82bf16, 0x6f82bf16, 0x56801eec, 0x56801eec},
525 + {0x0000a5f4, 0x6f82bf16, 0x6f82bf16, 0x56801eec, 0x56801eec},
526 + {0x0000a5f8, 0x6f82bf16, 0x6f82bf16, 0x56801eec, 0x56801eec},
527 + {0x0000a5fc, 0x6f82bf16, 0x6f82bf16, 0x56801eec, 0x56801eec},
528 {0x0000a600, 0x00000000, 0x00000000, 0x00000000, 0x00000000},
529 {0x0000a604, 0x00000000, 0x00000000, 0x00000000, 0x00000000},
530 {0x0000a608, 0x00000000, 0x00000000, 0x00000000, 0x00000000},
531 {0x0000a60c, 0x00000000, 0x00000000, 0x00000000, 0x00000000},
532 - {0x0000a610, 0x00000000, 0x00000000, 0x00000000, 0x00000000},
533 - {0x0000a614, 0x02004000, 0x02004000, 0x01404000, 0x01404000},
534 - {0x0000a618, 0x02004801, 0x02004801, 0x01404501, 0x01404501},
535 - {0x0000a61c, 0x02808a02, 0x02808a02, 0x02008501, 0x02008501},
536 - {0x0000a620, 0x0380ce03, 0x0380ce03, 0x0280ca03, 0x0280ca03},
537 - {0x0000a624, 0x04411104, 0x04411104, 0x03010c04, 0x03010c04},
538 - {0x0000a628, 0x04411104, 0x04411104, 0x04014c04, 0x04014c04},
539 - {0x0000a62c, 0x04411104, 0x04411104, 0x04015005, 0x04015005},
540 - {0x0000a630, 0x04411104, 0x04411104, 0x04015005, 0x04015005},
541 - {0x0000a634, 0x04411104, 0x04411104, 0x04015005, 0x04015005},
542 - {0x0000a638, 0x04411104, 0x04411104, 0x04015005, 0x04015005},
543 - {0x0000a63c, 0x04411104, 0x04411104, 0x04015005, 0x04015005},
544 - {0x0000b2dc, 0x00033800, 0x00033800, 0x03aaa352, 0x03aaa352},
545 - {0x0000b2e0, 0x0003c000, 0x0003c000, 0x03ccc584, 0x03ccc584},
546 - {0x0000b2e4, 0x03fc0000, 0x03fc0000, 0x03f0f800, 0x03f0f800},
547 + {0x0000a610, 0x00804000, 0x00804000, 0x00000000, 0x00000000},
548 + {0x0000a614, 0x00804201, 0x00804201, 0x01404000, 0x01404000},
549 + {0x0000a618, 0x0280c802, 0x0280c802, 0x01404501, 0x01404501},
550 + {0x0000a61c, 0x0280ca03, 0x0280ca03, 0x02008501, 0x02008501},
551 + {0x0000a620, 0x04c15104, 0x04c15104, 0x0280ca03, 0x0280ca03},
552 + {0x0000a624, 0x04c15305, 0x04c15305, 0x03010c04, 0x03010c04},
553 + {0x0000a628, 0x04c15305, 0x04c15305, 0x04014c04, 0x04014c04},
554 + {0x0000a62c, 0x04c15305, 0x04c15305, 0x04015005, 0x04015005},
555 + {0x0000a630, 0x04c15305, 0x04c15305, 0x04015005, 0x04015005},
556 + {0x0000a634, 0x04c15305, 0x04c15305, 0x04015005, 0x04015005},
557 + {0x0000a638, 0x04c15305, 0x04c15305, 0x04015005, 0x04015005},
558 + {0x0000a63c, 0x04c15305, 0x04c15305, 0x04015005, 0x04015005},
559 + {0x0000b2dc, 0x0380c7fc, 0x0380c7fc, 0x03aaa352, 0x03aaa352},
560 + {0x0000b2e0, 0x0000f800, 0x0000f800, 0x03ccc584, 0x03ccc584},
561 + {0x0000b2e4, 0x03ff0000, 0x03ff0000, 0x03f0f800, 0x03f0f800},
562 {0x0000b2e8, 0x00000000, 0x00000000, 0x03ff0000, 0x03ff0000},
563 - {0x0000c2dc, 0x00033800, 0x00033800, 0x03aaa352, 0x03aaa352},
564 - {0x0000c2e0, 0x0003c000, 0x0003c000, 0x03ccc584, 0x03ccc584},
565 - {0x0000c2e4, 0x03fc0000, 0x03fc0000, 0x03f0f800, 0x03f0f800},
566 + {0x0000c2dc, 0x0380c7fc, 0x0380c7fc, 0x03aaa352, 0x03aaa352},
567 + {0x0000c2e0, 0x0000f800, 0x0000f800, 0x03ccc584, 0x03ccc584},
568 + {0x0000c2e4, 0x03ff0000, 0x03ff0000, 0x03f0f800, 0x03f0f800},
569 {0x0000c2e8, 0x00000000, 0x00000000, 0x03ff0000, 0x03ff0000},
570 {0x00016044, 0x012492d4, 0x012492d4, 0x012492d4, 0x012492d4},
571 {0x00016048, 0x66480001, 0x66480001, 0x66480001, 0x66480001},
572 --- a/drivers/net/wireless/ath/ath9k/debug.h
573 +++ b/drivers/net/wireless/ath/ath9k/debug.h
574 @@ -242,7 +242,7 @@ struct ath_rx_stats {
575
576 struct ath_stats {
577 struct ath_interrupt_stats istats;
578 - struct ath_tx_stats txstats[IEEE80211_NUM_ACS];
579 + struct ath_tx_stats txstats[ATH9K_NUM_TX_QUEUES];
580 struct ath_rx_stats rxstats;
581 struct ath_dfs_stats dfs_stats;
582 u32 reset[__RESET_TYPE_MAX];
583 --- a/drivers/net/wireless/ath/carl9170/rx.c
584 +++ b/drivers/net/wireless/ath/carl9170/rx.c
585 @@ -684,7 +684,7 @@ static int carl9170_handle_mpdu(struct a
586 if (!skb)
587 return -ENOMEM;
588
589 - memcpy(IEEE80211_SKB_RXCB(skb), &status, sizeof(status));
590 + memcpy(IEEE80211_SKB_RXCB(skb), status, sizeof(*status));
591 ieee80211_rx(ar->hw, skb);
592 return 0;
593 }
594 --- a/drivers/net/wireless/ath/ath9k/calib.c
595 +++ b/drivers/net/wireless/ath/ath9k/calib.c
596 @@ -69,6 +69,7 @@ s16 ath9k_hw_getchan_noise(struct ath_hw
597
598 if (chan && chan->noisefloor) {
599 s8 delta = chan->noisefloor -
600 + ATH9K_NF_CAL_NOISE_THRESH -
601 ath9k_hw_get_default_nf(ah, chan);
602 if (delta > 0)
603 noise += delta;
604 --- a/drivers/net/wireless/ath/ath9k/calib.h
605 +++ b/drivers/net/wireless/ath/ath9k/calib.h
606 @@ -21,6 +21,9 @@
607
608 #define AR_PHY_CCA_FILTERWINDOW_LENGTH 5
609
610 +/* Internal noise floor can vary by about 6db depending on the frequency */
611 +#define ATH9K_NF_CAL_NOISE_THRESH 6
612 +
613 #define NUM_NF_READINGS 6
614 #define ATH9K_NF_CAL_HIST_MAX 5
615
616 --- a/drivers/net/wireless/ath/ath5k/base.c
617 +++ b/drivers/net/wireless/ath/ath5k/base.c
618 @@ -851,7 +851,7 @@ ath5k_txbuf_free_skb(struct ath5k_hw *ah
619 return;
620 dma_unmap_single(ah->dev, bf->skbaddr, bf->skb->len,
621 DMA_TO_DEVICE);
622 - dev_kfree_skb_any(bf->skb);
623 + ieee80211_free_txskb(ah->hw, bf->skb);
624 bf->skb = NULL;
625 bf->skbaddr = 0;
626 bf->desc->ds_data = 0;
627 @@ -1578,7 +1578,7 @@ ath5k_tx_queue(struct ieee80211_hw *hw,
628 return;
629
630 drop_packet:
631 - dev_kfree_skb_any(skb);
632 + ieee80211_free_txskb(hw, skb);
633 }
634
635 static void
636 --- a/drivers/net/wireless/ath/ath5k/mac80211-ops.c
637 +++ b/drivers/net/wireless/ath/ath5k/mac80211-ops.c
638 @@ -65,7 +65,7 @@ ath5k_tx(struct ieee80211_hw *hw, struct
639 u16 qnum = skb_get_queue_mapping(skb);
640
641 if (WARN_ON(qnum >= ah->ah_capabilities.cap_queues.q_tx_num)) {
642 - dev_kfree_skb_any(skb);
643 + ieee80211_free_txskb(hw, skb);
644 return;
645 }
646
647 --- a/drivers/net/wireless/b43/dma.c
648 +++ b/drivers/net/wireless/b43/dma.c
649 @@ -409,7 +409,10 @@ static inline
650 struct b43_dmadesc_meta *meta)
651 {
652 if (meta->skb) {
653 - dev_kfree_skb_any(meta->skb);
654 + if (ring->tx)
655 + ieee80211_free_txskb(ring->dev->wl->hw, meta->skb);
656 + else
657 + dev_kfree_skb_any(meta->skb);
658 meta->skb = NULL;
659 }
660 }
661 @@ -1454,7 +1457,7 @@ int b43_dma_tx(struct b43_wldev *dev, st
662 if (unlikely(err == -ENOKEY)) {
663 /* Drop this packet, as we don't have the encryption key
664 * anymore and must not transmit it unencrypted. */
665 - dev_kfree_skb_any(skb);
666 + ieee80211_free_txskb(dev->wl->hw, skb);
667 err = 0;
668 goto out;
669 }
670 --- a/drivers/net/wireless/b43/main.c
671 +++ b/drivers/net/wireless/b43/main.c
672 @@ -3397,7 +3397,7 @@ static void b43_tx_work(struct work_stru
673 break;
674 }
675 if (unlikely(err))
676 - dev_kfree_skb(skb); /* Drop it */
677 + ieee80211_free_txskb(wl->hw, skb);
678 err = 0;
679 }
680
681 @@ -3419,7 +3419,7 @@ static void b43_op_tx(struct ieee80211_h
682
683 if (unlikely(skb->len < 2 + 2 + 6)) {
684 /* Too short, this can't be a valid frame. */
685 - dev_kfree_skb_any(skb);
686 + ieee80211_free_txskb(hw, skb);
687 return;
688 }
689 B43_WARN_ON(skb_shinfo(skb)->nr_frags);
690 @@ -4234,8 +4234,12 @@ redo:
691
692 /* Drain all TX queues. */
693 for (queue_num = 0; queue_num < B43_QOS_QUEUE_NUM; queue_num++) {
694 - while (skb_queue_len(&wl->tx_queue[queue_num]))
695 - dev_kfree_skb(skb_dequeue(&wl->tx_queue[queue_num]));
696 + while (skb_queue_len(&wl->tx_queue[queue_num])) {
697 + struct sk_buff *skb;
698 +
699 + skb = skb_dequeue(&wl->tx_queue[queue_num]);
700 + ieee80211_free_txskb(wl->hw, skb);
701 + }
702 }
703
704 b43_mac_suspend(dev);
705 --- a/drivers/net/wireless/b43/pio.c
706 +++ b/drivers/net/wireless/b43/pio.c
707 @@ -196,7 +196,7 @@ static void b43_pio_cancel_tx_packets(st
708 for (i = 0; i < ARRAY_SIZE(q->packets); i++) {
709 pack = &(q->packets[i]);
710 if (pack->skb) {
711 - dev_kfree_skb_any(pack->skb);
712 + ieee80211_free_txskb(q->dev->wl->hw, pack->skb);
713 pack->skb = NULL;
714 }
715 }
716 @@ -552,7 +552,7 @@ int b43_pio_tx(struct b43_wldev *dev, st
717 if (unlikely(err == -ENOKEY)) {
718 /* Drop this packet, as we don't have the encryption key
719 * anymore and must not transmit it unencrypted. */
720 - dev_kfree_skb_any(skb);
721 + ieee80211_free_txskb(dev->wl->hw, skb);
722 err = 0;
723 goto out;
724 }
725 --- a/net/mac80211/cfg.c
726 +++ b/net/mac80211/cfg.c
727 @@ -915,6 +915,12 @@ static int ieee80211_start_ap(struct wip
728 if (err)
729 return err;
730
731 + list_for_each_entry(vlan, &sdata->u.ap.vlans, u.vlan.list) {
732 + err = ieee80211_vif_copy_channel(vlan, sdata);
733 + if (err)
734 + return err;
735 + }
736 +
737 /*
738 * Apply control port protocol, this allows us to
739 * not encrypt dynamic WEP control frames.
740 @@ -998,8 +1004,11 @@ static int ieee80211_stop_ap(struct wiph
741 old_probe_resp = rtnl_dereference(sdata->u.ap.probe_resp);
742
743 /* turn off carrier for this interface and dependent VLANs */
744 - list_for_each_entry(vlan, &sdata->u.ap.vlans, u.vlan.list)
745 + list_for_each_entry(vlan, &sdata->u.ap.vlans, u.vlan.list) {
746 + sta_info_flush(local, vlan);
747 netif_carrier_off(vlan->dev);
748 + ieee80211_vif_release_channel(vlan);
749 + }
750 netif_carrier_off(dev);
751
752 /* remove beacon and probe response */
753 --- a/net/mac80211/chan.c
754 +++ b/net/mac80211/chan.c
755 @@ -119,14 +119,17 @@ static int ieee80211_assign_vif_chanctx(
756
757 lockdep_assert_held(&local->chanctx_mtx);
758
759 - ret = drv_assign_vif_chanctx(local, sdata, ctx);
760 - if (ret)
761 - return ret;
762 + if (sdata->vif.type != NL80211_IFTYPE_AP_VLAN) {
763 + ret = drv_assign_vif_chanctx(local, sdata, ctx);
764 + if (ret)
765 + return ret;
766 + }
767
768 rcu_assign_pointer(sdata->vif.chanctx_conf, &ctx->conf);
769 ctx->refcount++;
770
771 - ieee80211_recalc_txpower(sdata);
772 + if (sdata->vif.type != NL80211_IFTYPE_AP_VLAN)
773 + ieee80211_recalc_txpower(sdata);
774
775 return 0;
776 }
777 @@ -174,7 +177,8 @@ static void ieee80211_unassign_vif_chanc
778 ctx->refcount--;
779 rcu_assign_pointer(sdata->vif.chanctx_conf, NULL);
780
781 - drv_unassign_vif_chanctx(local, sdata, ctx);
782 + if (sdata->vif.type != NL80211_IFTYPE_AP_VLAN)
783 + drv_unassign_vif_chanctx(local, sdata, ctx);
784
785 if (ctx->refcount > 0) {
786 ieee80211_recalc_chanctx_chantype(sdata->local, ctx);
787 @@ -285,6 +289,30 @@ void ieee80211_recalc_smps_chanctx(struc
788 drv_change_chanctx(local, chanctx, IEEE80211_CHANCTX_CHANGE_RX_CHAINS);
789 }
790
791 +int ieee80211_vif_copy_channel(struct ieee80211_sub_if_data *sdata,
792 + struct ieee80211_sub_if_data *parent)
793 +{
794 + struct ieee80211_local *local = sdata->local;
795 + struct ieee80211_chanctx_conf *conf;
796 + struct ieee80211_chanctx *ctx;
797 +
798 + int ret;
799 +
800 + mutex_lock(&local->chanctx_mtx);
801 + conf = rcu_dereference_protected(parent->vif.chanctx_conf,
802 + lockdep_is_held(&local->chanctx_mtx));
803 + if (!conf) {
804 + ret = -ENOENT;
805 + goto out;
806 + }
807 +
808 + ctx = container_of(conf, struct ieee80211_chanctx, conf);
809 + ret = ieee80211_assign_vif_chanctx(sdata, ctx);
810 +out:
811 + mutex_unlock(&local->chanctx_mtx);
812 + return ret;
813 +}
814 +
815 int ieee80211_vif_use_channel(struct ieee80211_sub_if_data *sdata,
816 const struct cfg80211_chan_def *chandef,
817 enum ieee80211_chanctx_mode mode)
818 --- a/net/mac80211/ieee80211_i.h
819 +++ b/net/mac80211/ieee80211_i.h
820 @@ -1633,6 +1633,8 @@ ieee80211_vif_use_channel(struct ieee802
821 const struct cfg80211_chan_def *chandef,
822 enum ieee80211_chanctx_mode mode);
823 void ieee80211_vif_release_channel(struct ieee80211_sub_if_data *sdata);
824 +int ieee80211_vif_copy_channel(struct ieee80211_sub_if_data *sdata,
825 + struct ieee80211_sub_if_data *parent);
826
827 void ieee80211_recalc_smps_chanctx(struct ieee80211_local *local,
828 struct ieee80211_chanctx *chanctx);