1 commit 38695a6e5a940e6a524523b88a33916b016fb2a1
2 Author: Felix Fietkau <nbd@openwrt.org>
3 Date: Fri Jul 11 12:06:18 2014 +0200
5 mac80211: fix crash on getting sta info with uninitialized rate control
7 If the expected throughput is queried before rate control has been
8 initialized, the minstrel op for it will crash while trying to access
10 Check for WLAN_STA_RATE_CONTROL before attempting to use the rate
13 Reported-by: Jean-Pierre Tosoni <jp.tosoni@acksys.fr>
14 Signed-off-by: Felix Fietkau <nbd@openwrt.org>
16 commit c0ee7fa4c0da824ccccc172bf175fb1f86540921
17 Author: Felix Fietkau <nbd@openwrt.org>
18 Date: Wed Jul 16 18:00:31 2014 +0200
20 ath9k: fix pending tx frames accounting
22 Packets originally buffered for the regular hardware tx queues can end
23 up being transmitted through the U-APSD queue (via PS-Poll or U-APSD).
24 When packets are dropped due to retransmit failures, the pending frames
25 counter is not always updated properly.
26 Fix this by keeping track of the queue that a frame was accounted for in
27 the ath_frame_info struct, and using that on completion to decide
28 whether the counter should be updated.
29 This fixes some spurious transmit queue hangs.
31 Cc: stable@vger.kernel.org
32 Signed-off-by: Felix Fietkau <nbd@openwrt.org>
34 commit edcdf0989410a05a6a4b8438df4010447eaa7d9a
35 Author: Felix Fietkau <nbd@openwrt.org>
36 Date: Sun Jun 22 13:36:20 2014 +0200
38 Revert "cfg80211: Use 5MHz bandwidth by default when checking usable channels"
40 It enables channels that are not supposed to be enabled according to the
43 This reverts commit 8eca1fb692cc9557f386eddce75c300a3855d11a.
45 commit 6e7341074823d2a45b81f2742cbf75f1da790031
46 Author: Rafał Miłecki <zajec5@gmail.com>
47 Date: Sat May 31 19:40:45 2014 +0200
49 b43: disable 5 GHz on G-PHY
51 This fixes regression introduced by adding some G-PHY devices to the
52 list of dual band devices. There is simply no support for 5 GHz on
53 G-PHY devices in b43. It results in:
54 WARNING: CPU: 0 PID: 79 at drivers/net/wireless/b43/phy_g.c:75 b43_gphy_channel_switch+0x125/0x130 [b43]()
55 b43-phy1 ERROR: PHY init: Channel switch to default failed
57 Regression was introduced by the following commit:
59 commit 773cfc508f4d64c14547ff8751b5cbd473124364
60 Author: Rafał Miłecki <zajec5@gmail.com>
61 Date: Mon May 19 23:18:55 2014 +0200
63 b43: add more devices to the bands database
65 Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
66 Signed-off-by: John W. Linville <linville@tuxdriver.com>
68 commit 1186edbef91f15722e5bdf56326ce0abc2935ce7
69 Author: Stanislaw Gruszka <sgruszka@redhat.com>
70 Date: Tue Jun 10 12:51:06 2014 +0200
72 rt2x00: disable TKIP on USB
74 On USB we can not get atomically TKIP key. We have to disable support
75 for TKIP acceleration on USB hardware to avoid bug as showed bellow.
77 [ 860.827243] BUG: scheduling while atomic: hostapd/3397/0x00000002
79 [ 860.827280] Call Trace:
80 [ 860.827282] [<ffffffff81682ea6>] dump_stack+0x4d/0x66
81 [ 860.827284] [<ffffffff8167eb9b>] __schedule_bug+0x47/0x55
82 [ 860.827285] [<ffffffff81685bb3>] __schedule+0x733/0x7b0
83 [ 860.827287] [<ffffffff81685c59>] schedule+0x29/0x70
84 [ 860.827289] [<ffffffff81684f8a>] schedule_timeout+0x15a/0x2b0
85 [ 860.827291] [<ffffffff8105ac50>] ? ftrace_raw_event_tick_stop+0xc0/0xc0
86 [ 860.827294] [<ffffffff810c13c2>] ? __module_text_address+0x12/0x70
87 [ 860.827296] [<ffffffff81686823>] wait_for_completion_timeout+0xb3/0x140
88 [ 860.827298] [<ffffffff81080fc0>] ? wake_up_state+0x20/0x20
89 [ 860.827301] [<ffffffff814d5b3d>] usb_start_wait_urb+0x7d/0x150
90 [ 860.827303] [<ffffffff814d5cd5>] usb_control_msg+0xc5/0x110
91 [ 860.827305] [<ffffffffa02fb0c6>] rt2x00usb_vendor_request+0xc6/0x160 [rt2x00usb]
92 [ 860.827307] [<ffffffffa02fb215>] rt2x00usb_vendor_req_buff_lock+0x75/0x150 [rt2x00usb]
93 [ 860.827309] [<ffffffffa02fb393>] rt2x00usb_vendor_request_buff+0xa3/0xe0 [rt2x00usb]
94 [ 860.827311] [<ffffffffa023d1a3>] rt2x00usb_register_multiread+0x33/0x40 [rt2800usb]
95 [ 860.827314] [<ffffffffa05805f9>] rt2800_get_tkip_seq+0x39/0x50 [rt2800lib]
96 [ 860.827321] [<ffffffffa0480f88>] ieee80211_get_key+0x218/0x2a0 [mac80211]
97 [ 860.827322] [<ffffffff815cc68c>] ? __nlmsg_put+0x6c/0x80
98 [ 860.827329] [<ffffffffa051b02e>] nl80211_get_key+0x22e/0x360 [cfg80211]
100 Cc: stable@vger.kernel.org
101 Reported-and-tested-by: Peter Wu <lekensteyn@gmail.com>
102 Reported-and-tested-by: Pontus Fuchs <pontus.fuchs@gmail.com>
103 Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com>
104 Signed-off-by: John W. Linville <linville@tuxdriver.com>
106 commit 5f313a15da92dda80ac4c9a137bc42d7d0b49adf
107 Author: Rafał Miłecki <zajec5@gmail.com>
108 Date: Thu Jun 12 09:28:38 2014 +0200
110 b43: fix frequency reported on G-PHY with /new/ firmware
112 commit d3a58df87a2e4c2301ac843604202d290a48440b
113 Author: Avraham Stern <avraham.stern@intel.com>
114 Date: Thu May 22 12:17:47 2014 +0300
116 mac80211: set new interfaces as idle upon init
118 Mark new interfaces as idle to allow operations that require that
119 interfaces are idle to take place. Interface types that are always
120 not idle (like AP interfaces) will be set as not idle when they are
121 assigned a channel context.
123 Signed-off-by: Avraham Stern <avraham.stern@intel.com>
124 Signed-off-by: Emmanuel Grumbach<emmanuel.grumbach@intel.com>
125 Signed-off-by: Johannes Berg <johannes.berg@intel.com>
127 commit 923eaf367206e01f22c97aee22300e332d071916
128 Author: Arik Nemtsov <arik@wizery.com>
129 Date: Mon May 26 14:40:51 2014 +0300
131 mac80211: don't check netdev state for debugfs read/write
133 Doing so will lead to an oops for a p2p-dev interface, since it has
136 Cc: stable@vger.kernel.org
137 Signed-off-by: Arik Nemtsov <arikx.nemtsov@intel.com>
138 Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
139 Signed-off-by: Johannes Berg <johannes.berg@intel.com>
141 commit a9fb54169b197f31aff24c8d6270dd1e56cde395
142 Author: chaitanya.mgit@gmail.com <chaitanya.mgit@gmail.com>
143 Date: Mon May 26 18:01:44 2014 +0530
145 regdb: Generalize the mW to dBm power conversion
147 Generalize the power conversion from mW to dBm
148 using log. This should fix the below compilation
149 error for country NO which adds a new power value
150 2000mW which is not handled earlier.
152 CC [M] net/wireless/wext-sme.o
153 CC [M] net/wireless/regdb.o
154 net/wireless/regdb.c:1130:1: error: Unknown undeclared here (not in
156 net/wireless/regdb.c:1130:9: error: expected } before power
157 make[2]: *** [net/wireless/regdb.o] Error 1
158 make[1]: *** [net/wireless] Error 2
159 make: *** [net] Error 2
161 Reported-By: John Walker <john@x109.net>
162 Signed-off-by: Chaitanya T K <chaitanya.mgit@gmail.com>
163 Acked-by: John W. Linville <linville@tuxdriver.com>
164 [remove unneeded parentheses, fix rounding by using %.0f]
165 Signed-off-by: Johannes Berg <johannes.berg@intel.com>
167 commit c7d37a66e345df2fdf1aa7b2c9a6d3d53846ca5b
168 Author: Krzysztof Hałasa <khalasa@piap.pl>
169 Date: Mon May 26 14:14:46 2014 +0200
171 mac80211: fix IBSS join by initializing last_scan_completed
173 Without this fix, freshly rebooted Linux creates a new IBSS
174 instead of joining an existing one. Only when jiffies counter
175 overflows after 5 minutes the IBSS can be successfully joined.
177 Signed-off-by: Krzysztof Hałasa <khalasa@piap.pl>
178 [edit commit message slightly]
179 Cc: stable@vger.kernel.org
180 Signed-off-by: Johannes Berg <johannes.berg@intel.com>
182 commit 34171dc0d623be2c1032416bf7d3819f388ed70d
183 Author: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
184 Date: Sun May 25 15:35:41 2014 +0300
186 mac80211: fix virtual monitor interface addition
188 Since the commit below, cfg80211_chandef_dfs_required()
189 will warn if it gets a an NL80211_IFTYPE_UNSPECIFIED iftype
190 as explicitely written in the commit log.
191 When an virtual monitor interface is added, its type is set
192 in ieee80211_sub_if_data.vif.type, but not in
193 ieee80211_sub_if_data.wdev.iftype which is passed to
194 cfg80211_chandef_dfs_required() hence resulting in the
197 WARNING: CPU: 1 PID: 21265 at net/wireless/chan.c:376 cfg80211_chandef_dfs_required+0xbc/0x130 [cfg80211]()
198 Modules linked in: [...]
199 CPU: 1 PID: 21265 Comm: ifconfig Tainted: G W O 3.13.11+ #12
200 Hardware name: Dell Inc. Latitude E6410/0667CC, BIOS A01 03/05/2010
201 0000000000000009 ffff88008f5fdb08 ffffffff817d4219 ffff88008f5fdb50
202 ffff88008f5fdb40 ffffffff8106f57d 0000000000000000 0000000000000000
203 ffff880081062fb8 ffff8800810604e0 0000000000000001 ffff88008f5fdba0
205 [<ffffffff817d4219>] dump_stack+0x4d/0x66
206 [<ffffffff8106f57d>] warn_slowpath_common+0x7d/0xa0
207 [<ffffffff8106f5ec>] warn_slowpath_fmt+0x4c/0x50
208 [<ffffffffa04ea4ec>] cfg80211_chandef_dfs_required+0xbc/0x130 [cfg80211]
209 [<ffffffffa06b1024>] ieee80211_vif_use_channel+0x94/0x500 [mac80211]
210 [<ffffffffa0684e6b>] ieee80211_add_virtual_monitor+0x1ab/0x5c0 [mac80211]
211 [<ffffffffa0686ae5>] ieee80211_do_open+0xe75/0x1580 [mac80211]
212 [<ffffffffa0687259>] ieee80211_open+0x69/0x70 [mac80211]
215 Fixes: 00ec75fc5a64 ("cfg80211: pass the actual iftype when calling cfg80211_chandef_dfs_required()")
216 Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
217 Acked-by: Luciano Coelho <luciano.coelho@intel.com>
218 Signed-off-by: Johannes Berg <johannes.berg@intel.com>
220 commit d93cc72b37b4e2c314e1c499e80e8801907c2fea
221 Author: Michal Kazior <michal.kazior@tieto.com>
222 Date: Thu Jun 5 14:21:37 2014 +0200
224 mac80211: use csa counter offsets instead of csa_active
226 vif->csa_active is protected by mutexes only. This
227 means it is unreliable to depend on it on codeflow
228 in non-sleepable beacon and CSA code. There was no
229 guarantee to have vif->csa_active update be
230 visible before beacons are updated on SMP systems.
232 Using csa counter offsets which are embedded in
233 beacon struct (and thus are protected with single
234 RCU assignment) is much safer.
236 Signed-off-by: Michal Kazior <michal.kazior@tieto.com>
237 Signed-off-by: Johannes Berg <johannes.berg@intel.com>
239 commit d2746694fcdef24e0a7a1947d8c70082cde81a26
240 Author: Michal Kazior <michal.kazior@tieto.com>
241 Date: Thu Jun 5 14:21:36 2014 +0200
243 mac80211: move csa counters from sdata to beacon/presp
245 Having csa counters part of beacon and probe_resp
246 structures makes it easier to get rid of possible
247 races between setting a beacon and updating
248 counters on SMP systems by guaranteeing counters
249 are always consistent against given beacon struct.
251 While at it relax WARN_ON into WARN_ON_ONCE to
252 prevent spamming logs and racing.
254 Signed-off-by: Michal Kazior <michal.kazior@tieto.com>
255 Signed-off-by: Johannes Berg <johannes.berg@intel.com>
257 commit 5dcb54f3a1a8cd7e0331e773487574f9743615db
258 Author: Janusz Dziedzic <janusz.dziedzic@tieto.com>
259 Date: Thu Jun 5 08:12:57 2014 +0200
261 mac80211: allow tx via monitor iface when DFS
263 Allow send frames using monitor interface
264 when DFS chandef and we pass CAC (beaconing
267 This fix problem when old kernel and new backports used,
268 in such case hostapd create/use also monitor interface.
269 Before this patch all frames hostapd send using monitor
270 iface were dropped when AP was configured on DFS channel.
272 Signed-off-by: Janusz Dziedzic <janusz.dziedzic@tieto.com>
273 Signed-off-by: Johannes Berg <johannes.berg@intel.com>
275 commit 6f09a1beb0d2007572248c986780562219bd206f
276 Author: Johannes Berg <johannes.berg@intel.com>
277 Date: Wed Jun 4 17:31:56 2014 +0200
279 cfg80211: make ethtool the driver's responsibility
281 Currently, cfg80211 tries to implement ethtool, but that doesn't
282 really scale well, with all the different operations. Make the
283 lower-level driver responsible for it, which currently only has
284 an effect on mac80211. It will similarly not scale well at that
285 level though, since mac80211 also has many drivers.
287 To cleanly implement this in mac80211, introduce a new file and
288 move some code to appropriate places.
290 Signed-off-by: Johannes Berg <johannes.berg@intel.com>
292 commit 6b0c6f133de8f90caeb1c4a902e6140567c5bf96
293 Author: Johannes Berg <johannes.berg@intel.com>
294 Date: Wed Jun 4 17:06:23 2014 +0200
296 mac80211: remove weak WEP IV accounting
298 Since WEP is practically dead, there seems very little
299 point in keeping WEP weak IV accounting.
301 Signed-off-by: Johannes Berg <johannes.berg@intel.com>
303 commit aecdc89fb4664c76baa4bbd46008f220532309ff
304 Author: Luciano Coelho <luciano.coelho@intel.com>
305 Date: Fri May 23 11:04:50 2014 +0300
307 ath9k/ath10k: remove unnecessary channel_switch_beacon callbacks
309 The channel_switch_beacon callback is optional, so it doesn't have to
310 be defined if it's not going to do anything useful with it. Both
311 ath9k and ath10k define the callback and just returns. This commit
314 Cc: Michal Kazior <michal.kazior@tieto.com>
315 Signed-off-by: Luciano Coelho <luciano.coelho@intel.com>
316 Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
318 commit 60ccc107c9b9fb732fdee1f76bb2dad44f0e1798
319 Author: Rajkumar Manoharan <rmanohar@qti.qualcomm.com>
320 Date: Tue May 27 16:58:02 2014 +0530
322 ath9k: Fix deadlock while updating p2p beacon timer
324 pm_lock is taken twice while syncing HW TSF of p2p vif.
325 Fix this by taking the lock at caller side.
327 Cc: Felix Fietkau <nbd@openwrt.org>
328 Signed-off-by: Rajkumar Manoharan <rmanohar@qti.qualcomm.com>
329 Signed-off-by: John W. Linville <linville@tuxdriver.com>
331 commit f3831a4e3903dbc1a57d5df56deb6a143fd001bc
332 Author: Stanislaw Gruszka <sgruszka@redhat.com>
333 Date: Thu Jun 5 13:52:27 2014 +0200
335 rt2x00: do not initialize BCN_OFFSET registers
337 We setup BCN_OFFSET{0,1} registers dynamically, don't have to
340 Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com>
342 commit e5c58ca7a48d4c82f282749a978052c47fd95998
343 Author: Stanislaw Gruszka <sgruszka@redhat.com>
344 Date: Thu Jun 5 13:52:26 2014 +0200
346 rt2x00: change order when stop beaconing
348 When no beaconing is needed, first stop beacon queue (disable beaconing
349 globally) to avoid possible sending of not prepared beacon on short
350 period after clearing beacon and before stop of BCN queue.
352 Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com>
354 commit 382c1b9e03f52d0cd741ef1d942cad0f649f0744
355 Author: Stanislaw Gruszka <sgruszka@redhat.com>
356 Date: Thu Jun 5 13:52:25 2014 +0200
358 rt2x00: change default MAC_BSSID_DW1_BSS_BCN_NUM
360 We setup MAC_BSSID_DW1_BSS_BCN_NUM dynamically when numbers of active
361 beacons increase. Change default to 0 to tell hardware that we want to
362 send only one beacon as default.
364 Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com>
366 commit 3b400571dd033e46fa7e76c5bb92a3ce8198afa9
367 Author: Stanislaw Gruszka <sgruszka@redhat.com>
368 Date: Thu Jun 5 13:52:24 2014 +0200
370 rt2x00: change beaconing setup on RT2800
372 As reported by Matthias, on 5572 chip, even if we clear up TXWI
373 of corresponding beacon, hardware still try to send it or do other
374 action that increase power consumption peak up to 1A.
376 To avoid the issue, setup beaconing dynamically by configuring offsets
377 of currently active beacons and MAC_BSSID_DW1_BSS_BCN_NUM variable,
378 which limit number of beacons that hardware will try to send.
380 Reported-by: Matthias Fend <Matthias.Fend@wolfvision.net>
381 Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com>
383 commit 916e591b2cc41f7e572992175ca56d866d7bc958
384 Author: Stanislaw Gruszka <sgruszka@redhat.com>
385 Date: Thu Jun 5 13:52:23 2014 +0200
387 rt2x00: change beaconing locking
389 This patch is needed for further changes to keep global variables
390 consistent when changing beaconing on diffrent vif's.
392 Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com>
394 commit 930b0dffd1731f3f418f9132faea720a23b7af61
395 Author: Johannes Berg <johannes.berg@intel.com>
396 Date: Tue Jun 3 11:18:47 2014 +0200
398 mac80211: fix station/driver powersave race
400 It is currently possible to have a race due to the station PS
401 unblock work like this:
402 * station goes to sleep with frames buffered in the driver
403 * driver blocks wakeup
404 * station wakes up again
405 * driver flushes/returns frames, and unblocks, which schedules
407 * unblock work starts to run, and checks that the station is
408 awake (i.e. that the WLAN_STA_PS_STA flag isn't set)
409 * we process a received frame with PM=1, setting the flag again
410 * ieee80211_sta_ps_deliver_wakeup() runs, delivering all frames
411 to the driver, and then clearing the WLAN_STA_PS_DRIVER and
412 WLAN_STA_PS_STA flags
414 In this scenario, mac80211 will think that the station is awake,
415 while it really is asleep, and any TX'ed frames should be filtered
416 by the device (it will know that the station is sleeping) but then
417 passed to mac80211 again, which will not buffer it either as it
418 thinks the station is awake, and eventually the packets will be
421 Fix this by moving the clearing of the flags to exactly where we
422 learn about the situation. This creates a problem of reordering,
423 so introduce another flag indicating that delivery is being done,
424 this new flag also queues frames and is cleared only while the
425 spinlock is held (which the queuing code also holds) so that any
426 concurrent delivery/TX is handled correctly.
428 Reported-by: Andrei Otcheretianski <andrei.otcheretianski@intel.com>
429 Signed-off-by: Johannes Berg <johannes.berg@intel.com>
431 commit 6df35206bc6c1c6aad1d8077df5786b4a7f77873
432 Author: Felix Fietkau <nbd@openwrt.org>
433 Date: Fri May 23 19:58:14 2014 +0200
435 mac80211: reduce packet loss notifications under load
437 During strong signal fluctuations under high throughput, few consecutive
438 failed A-MPDU transmissions can easily trigger packet loss notification,
439 and thus (in AP mode) client disconnection.
441 Reduce the number of false positives by checking the A-MPDU status flag
442 and treating a failed A-MPDU as a single packet.
444 Signed-off-by: Felix Fietkau <nbd@openwrt.org>
446 commit 7b7843a36fbcc568834404c7430ff895d8502131
447 Author: Felix Fietkau <nbd@openwrt.org>
448 Date: Fri May 23 19:26:32 2014 +0200
450 mac80211: fix a memory leak on sta rate selection table
452 Cc: stable@vger.kernel.org
453 Reported-by: Christophe Prévotaux <cprevotaux@nltinc.com>
454 Signed-off-by: Felix Fietkau <nbd@openwrt.org>
456 commit 96892d6aa0a153423070addf3070bc79578b3897
457 Author: Felix Fietkau <nbd@openwrt.org>
458 Date: Mon May 19 21:20:49 2014 +0200
460 ath9k: avoid passing buffers to the hardware during flush
462 The commit "ath9k: fix possible hang on flush" changed the receive code
463 to always link rx descriptors of processed frames, even when flushing.
464 In some cases, this leads to flushed rx buffers being passed to the
465 hardware while rx is already stopped.
467 Signed-off-by: Felix Fietkau <nbd@openwrt.org>
469 --- a/drivers/net/wireless/ath/ath9k/recv.c
470 +++ b/drivers/net/wireless/ath/ath9k/recv.c
471 @@ -34,7 +34,8 @@ static inline bool ath9k_check_auto_slee
472 * buffer (or rx fifo). This can incorrectly acknowledge packets
473 * to a sender if last desc is self-linked.
475 -static void ath_rx_buf_link(struct ath_softc *sc, struct ath_rxbuf *bf)
476 +static void ath_rx_buf_link(struct ath_softc *sc, struct ath_rxbuf *bf,
479 struct ath_hw *ah = sc->sc_ah;
480 struct ath_common *common = ath9k_hw_common(ah);
481 @@ -59,18 +60,19 @@ static void ath_rx_buf_link(struct ath_s
485 - if (sc->rx.rxlink == NULL)
486 - ath9k_hw_putrxbuf(ah, bf->bf_daddr);
489 *sc->rx.rxlink = bf->bf_daddr;
491 + ath9k_hw_putrxbuf(ah, bf->bf_daddr);
493 sc->rx.rxlink = &ds->ds_link;
496 -static void ath_rx_buf_relink(struct ath_softc *sc, struct ath_rxbuf *bf)
497 +static void ath_rx_buf_relink(struct ath_softc *sc, struct ath_rxbuf *bf,
501 - ath_rx_buf_link(sc, sc->rx.buf_hold);
502 + ath_rx_buf_link(sc, sc->rx.buf_hold, flush);
504 sc->rx.buf_hold = bf;
506 @@ -442,7 +444,7 @@ int ath_startrecv(struct ath_softc *sc)
507 sc->rx.buf_hold = NULL;
508 sc->rx.rxlink = NULL;
509 list_for_each_entry_safe(bf, tbf, &sc->rx.rxbuf, list) {
510 - ath_rx_buf_link(sc, bf);
511 + ath_rx_buf_link(sc, bf, false);
514 /* We could have deleted elements so the list may be empty now */
515 @@ -1118,12 +1120,12 @@ requeue_drop_frag:
517 list_add_tail(&bf->list, &sc->rx.rxbuf);
520 - ath_rx_edma_buf_link(sc, qtype);
522 - ath_rx_buf_relink(sc, bf);
524 + ath_rx_buf_relink(sc, bf, flush);
527 + } else if (!flush) {
528 + ath_rx_edma_buf_link(sc, qtype);
532 --- a/net/mac80211/sta_info.c
533 +++ b/net/mac80211/sta_info.c
534 @@ -100,7 +100,8 @@ static void __cleanup_single_sta(struct
537 if (test_sta_flag(sta, WLAN_STA_PS_STA) ||
538 - test_sta_flag(sta, WLAN_STA_PS_DRIVER)) {
539 + test_sta_flag(sta, WLAN_STA_PS_DRIVER) ||
540 + test_sta_flag(sta, WLAN_STA_PS_DELIVER)) {
541 if (sta->sdata->vif.type == NL80211_IFTYPE_AP ||
542 sta->sdata->vif.type == NL80211_IFTYPE_AP_VLAN)
543 ps = &sdata->bss->ps;
544 @@ -111,6 +112,7 @@ static void __cleanup_single_sta(struct
546 clear_sta_flag(sta, WLAN_STA_PS_STA);
547 clear_sta_flag(sta, WLAN_STA_PS_DRIVER);
548 + clear_sta_flag(sta, WLAN_STA_PS_DELIVER);
550 atomic_dec(&ps->num_sta_ps);
551 sta_info_recalc_tim(sta);
552 @@ -125,7 +127,7 @@ static void __cleanup_single_sta(struct
553 if (ieee80211_vif_is_mesh(&sdata->vif))
554 mesh_sta_cleanup(sta);
556 - cancel_work_sync(&sta->drv_unblock_wk);
557 + cancel_work_sync(&sta->drv_deliver_wk);
560 * Destroy aggregation state here. It would be nice to wait for the
561 @@ -227,6 +229,7 @@ struct sta_info *sta_info_get_by_idx(str
563 void sta_info_free(struct ieee80211_local *local, struct sta_info *sta)
565 + struct ieee80211_sta_rates *rates;
569 @@ -238,6 +241,10 @@ void sta_info_free(struct ieee80211_loca
573 + rates = rcu_dereference_protected(sta->sta.rates, true);
577 sta_dbg(sta->sdata, "Destroyed STA %pM\n", sta->sta.addr);
580 @@ -252,33 +259,23 @@ static void sta_info_hash_add(struct iee
581 rcu_assign_pointer(local->sta_hash[STA_HASH(sta->sta.addr)], sta);
584 -static void sta_unblock(struct work_struct *wk)
585 +static void sta_deliver_ps_frames(struct work_struct *wk)
587 struct sta_info *sta;
589 - sta = container_of(wk, struct sta_info, drv_unblock_wk);
590 + sta = container_of(wk, struct sta_info, drv_deliver_wk);
595 - if (!test_sta_flag(sta, WLAN_STA_PS_STA)) {
596 - local_bh_disable();
597 + local_bh_disable();
598 + if (!test_sta_flag(sta, WLAN_STA_PS_STA))
599 ieee80211_sta_ps_deliver_wakeup(sta);
601 - } else if (test_and_clear_sta_flag(sta, WLAN_STA_PSPOLL)) {
602 - clear_sta_flag(sta, WLAN_STA_PS_DRIVER);
604 - local_bh_disable();
605 + else if (test_and_clear_sta_flag(sta, WLAN_STA_PSPOLL))
606 ieee80211_sta_ps_deliver_poll_response(sta);
608 - } else if (test_and_clear_sta_flag(sta, WLAN_STA_UAPSD)) {
609 - clear_sta_flag(sta, WLAN_STA_PS_DRIVER);
611 - local_bh_disable();
612 + else if (test_and_clear_sta_flag(sta, WLAN_STA_UAPSD))
613 ieee80211_sta_ps_deliver_uapsd(sta);
616 - clear_sta_flag(sta, WLAN_STA_PS_DRIVER);
620 static int sta_prepare_rate_control(struct ieee80211_local *local,
621 @@ -340,7 +337,7 @@ struct sta_info *sta_info_alloc(struct i
623 spin_lock_init(&sta->lock);
624 spin_lock_init(&sta->ps_lock);
625 - INIT_WORK(&sta->drv_unblock_wk, sta_unblock);
626 + INIT_WORK(&sta->drv_deliver_wk, sta_deliver_ps_frames);
627 INIT_WORK(&sta->ampdu_mlme.work, ieee80211_ba_session_work);
628 mutex_init(&sta->ampdu_mlme.mtx);
629 #ifdef CPTCFG_MAC80211_MESH
630 @@ -1140,8 +1137,15 @@ void ieee80211_sta_ps_deliver_wakeup(str
633 ieee80211_add_pending_skbs(local, &pending);
634 - clear_sta_flag(sta, WLAN_STA_PS_DRIVER);
635 - clear_sta_flag(sta, WLAN_STA_PS_STA);
637 + /* now we're no longer in the deliver code */
638 + clear_sta_flag(sta, WLAN_STA_PS_DELIVER);
640 + /* The station might have polled and then woken up before we responded,
641 + * so clear these flags now to avoid them sticking around.
643 + clear_sta_flag(sta, WLAN_STA_PSPOLL);
644 + clear_sta_flag(sta, WLAN_STA_UAPSD);
645 spin_unlock(&sta->ps_lock);
647 atomic_dec(&ps->num_sta_ps);
648 @@ -1542,10 +1546,26 @@ void ieee80211_sta_block_awake(struct ie
650 trace_api_sta_block_awake(sta->local, pubsta, block);
654 set_sta_flag(sta, WLAN_STA_PS_DRIVER);
655 - else if (test_sta_flag(sta, WLAN_STA_PS_DRIVER))
656 - ieee80211_queue_work(hw, &sta->drv_unblock_wk);
660 + if (!test_sta_flag(sta, WLAN_STA_PS_DRIVER))
663 + if (!test_sta_flag(sta, WLAN_STA_PS_STA)) {
664 + set_sta_flag(sta, WLAN_STA_PS_DELIVER);
665 + clear_sta_flag(sta, WLAN_STA_PS_DRIVER);
666 + ieee80211_queue_work(hw, &sta->drv_deliver_wk);
667 + } else if (test_sta_flag(sta, WLAN_STA_PSPOLL) ||
668 + test_sta_flag(sta, WLAN_STA_UAPSD)) {
669 + /* must be asleep in this case */
670 + clear_sta_flag(sta, WLAN_STA_PS_DRIVER);
671 + ieee80211_queue_work(hw, &sta->drv_deliver_wk);
673 + clear_sta_flag(sta, WLAN_STA_PS_DRIVER);
676 EXPORT_SYMBOL(ieee80211_sta_block_awake);
678 @@ -1703,3 +1723,140 @@ u8 sta_info_tx_streams(struct sta_info *
679 return ((ht_cap->mcs.tx_params & IEEE80211_HT_MCS_TX_MAX_STREAMS_MASK)
680 >> IEEE80211_HT_MCS_TX_MAX_STREAMS_SHIFT) + 1;
683 +void sta_set_sinfo(struct sta_info *sta, struct station_info *sinfo)
685 + struct ieee80211_sub_if_data *sdata = sta->sdata;
686 + struct ieee80211_local *local = sdata->local;
687 + struct rate_control_ref *ref = NULL;
688 + struct timespec uptime;
693 + if (test_sta_flag(sta, WLAN_STA_RATE_CONTROL))
694 + ref = local->rate_ctrl;
696 + sinfo->generation = sdata->local->sta_generation;
698 + sinfo->filled = STATION_INFO_INACTIVE_TIME |
699 + STATION_INFO_RX_BYTES64 |
700 + STATION_INFO_TX_BYTES64 |
701 + STATION_INFO_RX_PACKETS |
702 + STATION_INFO_TX_PACKETS |
703 + STATION_INFO_TX_RETRIES |
704 + STATION_INFO_TX_FAILED |
705 + STATION_INFO_TX_BITRATE |
706 + STATION_INFO_RX_BITRATE |
707 + STATION_INFO_RX_DROP_MISC |
708 + STATION_INFO_BSS_PARAM |
709 + STATION_INFO_CONNECTED_TIME |
710 + STATION_INFO_STA_FLAGS |
711 + STATION_INFO_BEACON_LOSS_COUNT;
713 + do_posix_clock_monotonic_gettime(&uptime);
714 + sinfo->connected_time = uptime.tv_sec - sta->last_connected;
716 + sinfo->inactive_time = jiffies_to_msecs(jiffies - sta->last_rx);
717 + sinfo->tx_bytes = 0;
718 + for (ac = 0; ac < IEEE80211_NUM_ACS; ac++) {
719 + sinfo->tx_bytes += sta->tx_bytes[ac];
720 + packets += sta->tx_packets[ac];
722 + sinfo->tx_packets = packets;
723 + sinfo->rx_bytes = sta->rx_bytes;
724 + sinfo->rx_packets = sta->rx_packets;
725 + sinfo->tx_retries = sta->tx_retry_count;
726 + sinfo->tx_failed = sta->tx_retry_failed;
727 + sinfo->rx_dropped_misc = sta->rx_dropped;
728 + sinfo->beacon_loss_count = sta->beacon_loss_count;
730 + if ((sta->local->hw.flags & IEEE80211_HW_SIGNAL_DBM) ||
731 + (sta->local->hw.flags & IEEE80211_HW_SIGNAL_UNSPEC)) {
732 + sinfo->filled |= STATION_INFO_SIGNAL | STATION_INFO_SIGNAL_AVG;
733 + if (!local->ops->get_rssi ||
734 + drv_get_rssi(local, sdata, &sta->sta, &sinfo->signal))
735 + sinfo->signal = (s8)sta->last_signal;
736 + sinfo->signal_avg = (s8) -ewma_read(&sta->avg_signal);
739 + sinfo->filled |= STATION_INFO_CHAIN_SIGNAL |
740 + STATION_INFO_CHAIN_SIGNAL_AVG;
742 + sinfo->chains = sta->chains;
743 + for (i = 0; i < ARRAY_SIZE(sinfo->chain_signal); i++) {
744 + sinfo->chain_signal[i] = sta->chain_signal_last[i];
745 + sinfo->chain_signal_avg[i] =
746 + (s8) -ewma_read(&sta->chain_signal_avg[i]);
750 + sta_set_rate_info_tx(sta, &sta->last_tx_rate, &sinfo->txrate);
751 + sta_set_rate_info_rx(sta, &sinfo->rxrate);
753 + if (ieee80211_vif_is_mesh(&sdata->vif)) {
754 +#ifdef CPTCFG_MAC80211_MESH
755 + sinfo->filled |= STATION_INFO_LLID |
756 + STATION_INFO_PLID |
757 + STATION_INFO_PLINK_STATE |
758 + STATION_INFO_LOCAL_PM |
759 + STATION_INFO_PEER_PM |
760 + STATION_INFO_NONPEER_PM;
762 + sinfo->llid = sta->llid;
763 + sinfo->plid = sta->plid;
764 + sinfo->plink_state = sta->plink_state;
765 + if (test_sta_flag(sta, WLAN_STA_TOFFSET_KNOWN)) {
766 + sinfo->filled |= STATION_INFO_T_OFFSET;
767 + sinfo->t_offset = sta->t_offset;
769 + sinfo->local_pm = sta->local_pm;
770 + sinfo->peer_pm = sta->peer_pm;
771 + sinfo->nonpeer_pm = sta->nonpeer_pm;
775 + sinfo->bss_param.flags = 0;
776 + if (sdata->vif.bss_conf.use_cts_prot)
777 + sinfo->bss_param.flags |= BSS_PARAM_FLAGS_CTS_PROT;
778 + if (sdata->vif.bss_conf.use_short_preamble)
779 + sinfo->bss_param.flags |= BSS_PARAM_FLAGS_SHORT_PREAMBLE;
780 + if (sdata->vif.bss_conf.use_short_slot)
781 + sinfo->bss_param.flags |= BSS_PARAM_FLAGS_SHORT_SLOT_TIME;
782 + sinfo->bss_param.dtim_period = sdata->local->hw.conf.ps_dtim_period;
783 + sinfo->bss_param.beacon_interval = sdata->vif.bss_conf.beacon_int;
785 + sinfo->sta_flags.set = 0;
786 + sinfo->sta_flags.mask = BIT(NL80211_STA_FLAG_AUTHORIZED) |
787 + BIT(NL80211_STA_FLAG_SHORT_PREAMBLE) |
788 + BIT(NL80211_STA_FLAG_WME) |
789 + BIT(NL80211_STA_FLAG_MFP) |
790 + BIT(NL80211_STA_FLAG_AUTHENTICATED) |
791 + BIT(NL80211_STA_FLAG_ASSOCIATED) |
792 + BIT(NL80211_STA_FLAG_TDLS_PEER);
793 + if (test_sta_flag(sta, WLAN_STA_AUTHORIZED))
794 + sinfo->sta_flags.set |= BIT(NL80211_STA_FLAG_AUTHORIZED);
795 + if (test_sta_flag(sta, WLAN_STA_SHORT_PREAMBLE))
796 + sinfo->sta_flags.set |= BIT(NL80211_STA_FLAG_SHORT_PREAMBLE);
797 + if (test_sta_flag(sta, WLAN_STA_WME))
798 + sinfo->sta_flags.set |= BIT(NL80211_STA_FLAG_WME);
799 + if (test_sta_flag(sta, WLAN_STA_MFP))
800 + sinfo->sta_flags.set |= BIT(NL80211_STA_FLAG_MFP);
801 + if (test_sta_flag(sta, WLAN_STA_AUTH))
802 + sinfo->sta_flags.set |= BIT(NL80211_STA_FLAG_AUTHENTICATED);
803 + if (test_sta_flag(sta, WLAN_STA_ASSOC))
804 + sinfo->sta_flags.set |= BIT(NL80211_STA_FLAG_ASSOCIATED);
805 + if (test_sta_flag(sta, WLAN_STA_TDLS_PEER))
806 + sinfo->sta_flags.set |= BIT(NL80211_STA_FLAG_TDLS_PEER);
808 + /* check if the driver has a SW RC implementation */
809 + if (ref && ref->ops->get_expected_throughput)
810 + thr = ref->ops->get_expected_throughput(sta->rate_ctrl_priv);
812 + thr = drv_get_expected_throughput(local, &sta->sta);
815 + sinfo->filled |= STATION_INFO_EXPECTED_THROUGHPUT;
816 + sinfo->expected_throughput = thr;
819 --- a/net/mac80211/status.c
820 +++ b/net/mac80211/status.c
821 @@ -541,6 +541,23 @@ static void ieee80211_tx_latency_end_msr
823 #define STA_LOST_PKT_THRESHOLD 50
825 +static void ieee80211_lost_packet(struct sta_info *sta, struct sk_buff *skb)
827 + struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
829 + /* This packet was aggregated but doesn't carry status info */
830 + if ((info->flags & IEEE80211_TX_CTL_AMPDU) &&
831 + !(info->flags & IEEE80211_TX_STAT_AMPDU))
834 + if (++sta->lost_packets < STA_LOST_PKT_THRESHOLD)
837 + cfg80211_cqm_pktloss_notify(sta->sdata->dev, sta->sta.addr,
838 + sta->lost_packets, GFP_ATOMIC);
839 + sta->lost_packets = 0;
842 void ieee80211_tx_status(struct ieee80211_hw *hw, struct sk_buff *skb)
844 struct sk_buff *skb2;
845 @@ -680,12 +697,8 @@ void ieee80211_tx_status(struct ieee8021
846 if (info->flags & IEEE80211_TX_STAT_ACK) {
847 if (sta->lost_packets)
848 sta->lost_packets = 0;
849 - } else if (++sta->lost_packets >= STA_LOST_PKT_THRESHOLD) {
850 - cfg80211_cqm_pktloss_notify(sta->sdata->dev,
854 - sta->lost_packets = 0;
856 + ieee80211_lost_packet(sta, skb);
860 --- a/net/mac80211/rx.c
861 +++ b/net/mac80211/rx.c
862 @@ -1107,6 +1107,8 @@ static void sta_ps_end(struct sta_info *
866 + set_sta_flag(sta, WLAN_STA_PS_DELIVER);
867 + clear_sta_flag(sta, WLAN_STA_PS_STA);
868 ieee80211_sta_ps_deliver_wakeup(sta);
871 --- a/net/mac80211/sta_info.h
872 +++ b/net/mac80211/sta_info.h
873 @@ -82,6 +82,7 @@ enum ieee80211_sta_info_flags {
874 WLAN_STA_TOFFSET_KNOWN,
876 WLAN_STA_MPSP_RECIPIENT,
877 + WLAN_STA_PS_DELIVER,
880 #define ADDBA_RESP_INTERVAL HZ
881 @@ -265,7 +266,7 @@ struct ieee80211_tx_latency_stat {
882 * @last_rx_rate_vht_nss: rx status nss of last data packet
883 * @lock: used for locking all fields that require locking, see comments
884 * in the header file.
885 - * @drv_unblock_wk: used for driver PS unblocking
886 + * @drv_deliver_wk: used for delivering frames after driver PS unblocking
887 * @listen_interval: listen interval of this station, when we're acting as AP
888 * @_flags: STA flags, see &enum ieee80211_sta_info_flags, do not use directly
889 * @ps_lock: used for powersave (when mac80211 is the AP) related locking
890 @@ -278,7 +279,6 @@ struct ieee80211_tx_latency_stat {
891 * @driver_buffered_tids: bitmap of TIDs the driver has data buffered on
892 * @rx_packets: Number of MSDUs received from this STA
893 * @rx_bytes: Number of bytes received from this STA
894 - * @wep_weak_iv_count: number of weak WEP IVs received from this station
895 * @last_rx: time (in jiffies) when last frame was received from this STA
896 * @last_connected: time (in seconds) when a station got connected
897 * @num_duplicates: number of duplicate frames received from this STA
898 @@ -345,7 +345,7 @@ struct sta_info {
899 void *rate_ctrl_priv;
902 - struct work_struct drv_unblock_wk;
903 + struct work_struct drv_deliver_wk;
907 @@ -367,7 +367,6 @@ struct sta_info {
908 /* Updated from RX path only, no locking requirements */
909 unsigned long rx_packets;
911 - unsigned long wep_weak_iv_count;
912 unsigned long last_rx;
914 unsigned long num_duplicates;
915 @@ -628,6 +627,8 @@ void sta_set_rate_info_tx(struct sta_inf
916 struct rate_info *rinfo);
917 void sta_set_rate_info_rx(struct sta_info *sta,
918 struct rate_info *rinfo);
919 +void sta_set_sinfo(struct sta_info *sta, struct station_info *sinfo);
921 void ieee80211_sta_expire(struct ieee80211_sub_if_data *sdata,
922 unsigned long exp_time);
923 u8 sta_info_tx_streams(struct sta_info *sta);
924 --- a/net/mac80211/tx.c
925 +++ b/net/mac80211/tx.c
926 @@ -469,7 +469,8 @@ ieee80211_tx_h_unicast_ps_buf(struct iee
929 if (unlikely((test_sta_flag(sta, WLAN_STA_PS_STA) ||
930 - test_sta_flag(sta, WLAN_STA_PS_DRIVER)) &&
931 + test_sta_flag(sta, WLAN_STA_PS_DRIVER) ||
932 + test_sta_flag(sta, WLAN_STA_PS_DELIVER)) &&
933 !(info->flags & IEEE80211_TX_CTL_NO_PS_BUFFER))) {
934 int ac = skb_get_queue_mapping(tx->skb);
936 @@ -486,7 +487,8 @@ ieee80211_tx_h_unicast_ps_buf(struct iee
937 * ahead and Tx the packet.
939 if (!test_sta_flag(sta, WLAN_STA_PS_STA) &&
940 - !test_sta_flag(sta, WLAN_STA_PS_DRIVER)) {
941 + !test_sta_flag(sta, WLAN_STA_PS_DRIVER) &&
942 + !test_sta_flag(sta, WLAN_STA_PS_DELIVER)) {
943 spin_unlock(&sta->ps_lock);
946 @@ -1618,12 +1620,12 @@ netdev_tx_t ieee80211_monitor_start_xmit
948 struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr);
949 struct ieee80211_chanctx_conf *chanctx_conf;
950 - struct ieee80211_channel *chan;
951 struct ieee80211_radiotap_header *prthdr =
952 (struct ieee80211_radiotap_header *)skb->data;
953 struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
954 struct ieee80211_hdr *hdr;
955 struct ieee80211_sub_if_data *tmp_sdata, *sdata;
956 + struct cfg80211_chan_def *chandef;
960 @@ -1721,9 +1723,9 @@ netdev_tx_t ieee80211_monitor_start_xmit
964 - chan = chanctx_conf->def.chan;
965 + chandef = &chanctx_conf->def;
966 else if (!local->use_chanctx)
967 - chan = local->_oper_chandef.chan;
968 + chandef = &local->_oper_chandef;
972 @@ -1743,10 +1745,11 @@ netdev_tx_t ieee80211_monitor_start_xmit
973 * radar detection by itself. We can do that later by adding a
974 * monitor flag interfaces used for AP support.
976 - if ((chan->flags & (IEEE80211_CHAN_NO_IR | IEEE80211_CHAN_RADAR)))
977 + if (!cfg80211_reg_can_beacon(local->hw.wiphy, chandef,
981 - ieee80211_xmit(sdata, skb, chan->band);
982 + ieee80211_xmit(sdata, skb, chandef->chan->band);
986 @@ -2425,7 +2428,7 @@ static void ieee80211_set_csa(struct iee
988 size_t beacon_data_len;
990 - u8 count = sdata->csa_current_counter;
991 + u8 count = beacon->csa_current_counter;
993 switch (sdata->vif.type) {
994 case NL80211_IFTYPE_AP:
995 @@ -2444,46 +2447,54 @@ static void ieee80211_set_csa(struct iee
1000 for (i = 0; i < IEEE80211_MAX_CSA_COUNTERS_NUM; ++i) {
1001 - u16 counter_offset_beacon =
1002 - sdata->csa_counter_offset_beacon[i];
1003 - u16 counter_offset_presp = sdata->csa_counter_offset_presp[i];
1005 - if (counter_offset_beacon) {
1006 - if (WARN_ON(counter_offset_beacon >= beacon_data_len))
1009 - beacon_data[counter_offset_beacon] = count;
1012 - if (sdata->vif.type == NL80211_IFTYPE_AP &&
1013 - counter_offset_presp) {
1015 - resp = rcu_dereference(sdata->u.ap.probe_resp);
1016 + resp = rcu_dereference(sdata->u.ap.probe_resp);
1018 - /* If nl80211 accepted the offset, this should
1021 - if (WARN_ON(!resp)) {
1022 + if (beacon->csa_counter_offsets[i]) {
1023 + if (WARN_ON_ONCE(beacon->csa_counter_offsets[i] >=
1024 + beacon_data_len)) {
1028 - resp->data[counter_offset_presp] = count;
1029 - rcu_read_unlock();
1031 + beacon_data[beacon->csa_counter_offsets[i]] = count;
1034 + if (sdata->vif.type == NL80211_IFTYPE_AP && resp &&
1035 + resp->csa_counter_offsets)
1036 + resp->data[resp->csa_counter_offsets[i]] = count;
1038 + rcu_read_unlock();
1041 u8 ieee80211_csa_update_counter(struct ieee80211_vif *vif)
1043 struct ieee80211_sub_if_data *sdata = vif_to_sdata(vif);
1044 + struct beacon_data *beacon = NULL;
1049 + if (sdata->vif.type == NL80211_IFTYPE_AP)
1050 + beacon = rcu_dereference(sdata->u.ap.beacon);
1051 + else if (sdata->vif.type == NL80211_IFTYPE_ADHOC)
1052 + beacon = rcu_dereference(sdata->u.ibss.presp);
1053 + else if (ieee80211_vif_is_mesh(&sdata->vif))
1054 + beacon = rcu_dereference(sdata->u.mesh.beacon);
1059 - sdata->csa_current_counter--;
1060 + beacon->csa_current_counter--;
1062 /* the counter should never reach 0 */
1063 - WARN_ON(!sdata->csa_current_counter);
1064 + WARN_ON_ONCE(!beacon->csa_current_counter);
1065 + count = beacon->csa_current_counter;
1067 - return sdata->csa_current_counter;
1069 + rcu_read_unlock();
1072 EXPORT_SYMBOL(ieee80211_csa_update_counter);
1074 @@ -2493,7 +2504,6 @@ bool ieee80211_csa_is_complete(struct ie
1075 struct beacon_data *beacon = NULL;
1077 size_t beacon_data_len;
1078 - int counter_beacon = sdata->csa_counter_offset_beacon[0];
1081 if (!ieee80211_sdata_running(sdata))
1082 @@ -2531,10 +2541,13 @@ bool ieee80211_csa_is_complete(struct ie
1086 - if (WARN_ON(counter_beacon > beacon_data_len))
1087 + if (!beacon->csa_counter_offsets[0])
1090 + if (WARN_ON_ONCE(beacon->csa_counter_offsets[0] > beacon_data_len))
1093 - if (beacon_data[counter_beacon] == 1)
1094 + if (beacon_data[beacon->csa_counter_offsets[0]] == 1)
1098 @@ -2550,6 +2563,7 @@ __ieee80211_beacon_get(struct ieee80211_
1101 struct ieee80211_local *local = hw_to_local(hw);
1102 + struct beacon_data *beacon = NULL;
1103 struct sk_buff *skb = NULL;
1104 struct ieee80211_tx_info *info;
1105 struct ieee80211_sub_if_data *sdata = NULL;
1106 @@ -2571,10 +2585,10 @@ __ieee80211_beacon_get(struct ieee80211_
1108 if (sdata->vif.type == NL80211_IFTYPE_AP) {
1109 struct ieee80211_if_ap *ap = &sdata->u.ap;
1110 - struct beacon_data *beacon = rcu_dereference(ap->beacon);
1112 + beacon = rcu_dereference(ap->beacon);
1114 - if (sdata->vif.csa_active) {
1115 + if (beacon->csa_counter_offsets[0]) {
1117 ieee80211_csa_update_counter(vif);
1119 @@ -2615,37 +2629,37 @@ __ieee80211_beacon_get(struct ieee80211_
1120 } else if (sdata->vif.type == NL80211_IFTYPE_ADHOC) {
1121 struct ieee80211_if_ibss *ifibss = &sdata->u.ibss;
1122 struct ieee80211_hdr *hdr;
1123 - struct beacon_data *presp = rcu_dereference(ifibss->presp);
1126 + beacon = rcu_dereference(ifibss->presp);
1130 - if (sdata->vif.csa_active) {
1131 + if (beacon->csa_counter_offsets[0]) {
1133 ieee80211_csa_update_counter(vif);
1135 - ieee80211_set_csa(sdata, presp);
1136 + ieee80211_set_csa(sdata, beacon);
1139 - skb = dev_alloc_skb(local->tx_headroom + presp->head_len +
1140 + skb = dev_alloc_skb(local->tx_headroom + beacon->head_len +
1141 local->hw.extra_beacon_tailroom);
1144 skb_reserve(skb, local->tx_headroom);
1145 - memcpy(skb_put(skb, presp->head_len), presp->head,
1147 + memcpy(skb_put(skb, beacon->head_len), beacon->head,
1148 + beacon->head_len);
1150 hdr = (struct ieee80211_hdr *) skb->data;
1151 hdr->frame_control = cpu_to_le16(IEEE80211_FTYPE_MGMT |
1152 IEEE80211_STYPE_BEACON);
1153 } else if (ieee80211_vif_is_mesh(&sdata->vif)) {
1154 struct ieee80211_if_mesh *ifmsh = &sdata->u.mesh;
1155 - struct beacon_data *bcn = rcu_dereference(ifmsh->beacon);
1158 + beacon = rcu_dereference(ifmsh->beacon);
1162 - if (sdata->vif.csa_active) {
1163 + if (beacon->csa_counter_offsets[0]) {
1165 /* TODO: For mesh csa_counter is in TU, so
1166 * decrementing it by one isn't correct, but
1167 @@ -2654,40 +2668,42 @@ __ieee80211_beacon_get(struct ieee80211_
1169 ieee80211_csa_update_counter(vif);
1171 - ieee80211_set_csa(sdata, bcn);
1172 + ieee80211_set_csa(sdata, beacon);
1175 if (ifmsh->sync_ops)
1176 - ifmsh->sync_ops->adjust_tbtt(sdata, bcn);
1177 + ifmsh->sync_ops->adjust_tbtt(sdata, beacon);
1179 skb = dev_alloc_skb(local->tx_headroom +
1181 + beacon->head_len +
1184 + beacon->tail_len +
1185 local->hw.extra_beacon_tailroom);
1188 skb_reserve(skb, local->tx_headroom);
1189 - memcpy(skb_put(skb, bcn->head_len), bcn->head, bcn->head_len);
1190 + memcpy(skb_put(skb, beacon->head_len), beacon->head,
1191 + beacon->head_len);
1192 ieee80211_beacon_add_tim(sdata, &ifmsh->ps, skb, is_template);
1195 - offs->tim_offset = bcn->head_len;
1196 - offs->tim_length = skb->len - bcn->head_len;
1197 + offs->tim_offset = beacon->head_len;
1198 + offs->tim_length = skb->len - beacon->head_len;
1201 - memcpy(skb_put(skb, bcn->tail_len), bcn->tail, bcn->tail_len);
1202 + memcpy(skb_put(skb, beacon->tail_len), beacon->tail,
1203 + beacon->tail_len);
1211 + if (offs && beacon) {
1214 for (i = 0; i < IEEE80211_MAX_CSA_COUNTERS_NUM; i++) {
1215 - u16 csa_off = sdata->csa_counter_offset_beacon[i];
1216 + u16 csa_off = beacon->csa_counter_offsets[i];
1220 --- a/drivers/net/wireless/rt2x00/rt2800lib.c
1221 +++ b/drivers/net/wireless/rt2x00/rt2800lib.c
1222 @@ -947,6 +947,40 @@ static inline u8 rt2800_get_beacon_offse
1223 return BEACON_BASE_TO_OFFSET(rt2800_hw_beacon_base(rt2x00dev, index));
1226 +static void rt2800_update_beacons_setup(struct rt2x00_dev *rt2x00dev)
1228 + struct data_queue *queue = rt2x00dev->bcn;
1229 + struct queue_entry *entry;
1230 + int i, bcn_num = 0;
1235 + * Setup offsets of all active beacons in BCN_OFFSET{0,1} registers.
1237 + for (i = 0; i < queue->limit; i++) {
1238 + entry = &queue->entries[i];
1239 + if (!test_bit(ENTRY_BCN_ENABLED, &entry->flags))
1241 + off = rt2800_get_beacon_offset(rt2x00dev, entry->entry_idx);
1242 + reg |= off << (8 * bcn_num);
1246 + WARN_ON_ONCE(bcn_num != rt2x00dev->intf_beaconing);
1248 + rt2800_register_write(rt2x00dev, BCN_OFFSET0, (u32) reg);
1249 + rt2800_register_write(rt2x00dev, BCN_OFFSET1, (u32) (reg >> 32));
1252 + * H/W sends up to MAC_BSSID_DW1_BSS_BCN_NUM + 1 consecutive beacons.
1254 + rt2800_register_read(rt2x00dev, MAC_BSSID_DW1, &bssid_dw1);
1255 + rt2x00_set_field32(&bssid_dw1, MAC_BSSID_DW1_BSS_BCN_NUM,
1256 + bcn_num > 0 ? bcn_num - 1 : 0);
1257 + rt2800_register_write(rt2x00dev, MAC_BSSID_DW1, bssid_dw1);
1260 void rt2800_write_beacon(struct queue_entry *entry, struct txentry_desc *txdesc)
1262 struct rt2x00_dev *rt2x00dev = entry->queue->rt2x00dev;
1263 @@ -1003,6 +1037,12 @@ void rt2800_write_beacon(struct queue_en
1265 rt2800_register_multiwrite(rt2x00dev, beacon_base, entry->skb->data,
1266 entry->skb->len + padding_len);
1267 + __set_bit(ENTRY_BCN_ENABLED, &entry->flags);
1270 + * Change global beacons settings.
1272 + rt2800_update_beacons_setup(rt2x00dev);
1275 * Restore beaconing state.
1276 @@ -1053,8 +1093,13 @@ void rt2800_clear_beacon(struct queue_en
1279 rt2800_clear_beacon_register(rt2x00dev, entry->entry_idx);
1280 + __clear_bit(ENTRY_BCN_ENABLED, &entry->flags);
1283 + * Change global beacons settings.
1285 + rt2800_update_beacons_setup(rt2x00dev);
1287 * Restore beaconing state.
1289 rt2800_register_write(rt2x00dev, BCN_TIME_CFG, orig_reg);
1290 @@ -1556,7 +1601,7 @@ void rt2800_config_intf(struct rt2x00_de
1291 if (!is_zero_ether_addr((const u8 *)conf->bssid)) {
1292 reg = le32_to_cpu(conf->bssid[1]);
1293 rt2x00_set_field32(®, MAC_BSSID_DW1_BSS_ID_MASK, 3);
1294 - rt2x00_set_field32(®, MAC_BSSID_DW1_BSS_BCN_NUM, 7);
1295 + rt2x00_set_field32(®, MAC_BSSID_DW1_BSS_BCN_NUM, 0);
1296 conf->bssid[1] = cpu_to_le32(reg);
1299 @@ -4517,28 +4562,6 @@ static int rt2800_init_registers(struct
1303 - rt2800_register_read(rt2x00dev, BCN_OFFSET0, ®);
1304 - rt2x00_set_field32(®, BCN_OFFSET0_BCN0,
1305 - rt2800_get_beacon_offset(rt2x00dev, 0));
1306 - rt2x00_set_field32(®, BCN_OFFSET0_BCN1,
1307 - rt2800_get_beacon_offset(rt2x00dev, 1));
1308 - rt2x00_set_field32(®, BCN_OFFSET0_BCN2,
1309 - rt2800_get_beacon_offset(rt2x00dev, 2));
1310 - rt2x00_set_field32(®, BCN_OFFSET0_BCN3,
1311 - rt2800_get_beacon_offset(rt2x00dev, 3));
1312 - rt2800_register_write(rt2x00dev, BCN_OFFSET0, reg);
1314 - rt2800_register_read(rt2x00dev, BCN_OFFSET1, ®);
1315 - rt2x00_set_field32(®, BCN_OFFSET1_BCN4,
1316 - rt2800_get_beacon_offset(rt2x00dev, 4));
1317 - rt2x00_set_field32(®, BCN_OFFSET1_BCN5,
1318 - rt2800_get_beacon_offset(rt2x00dev, 5));
1319 - rt2x00_set_field32(®, BCN_OFFSET1_BCN6,
1320 - rt2800_get_beacon_offset(rt2x00dev, 6));
1321 - rt2x00_set_field32(®, BCN_OFFSET1_BCN7,
1322 - rt2800_get_beacon_offset(rt2x00dev, 7));
1323 - rt2800_register_write(rt2x00dev, BCN_OFFSET1, reg);
1325 rt2800_register_write(rt2x00dev, LEGACY_BASIC_RATE, 0x0000013f);
1326 rt2800_register_write(rt2x00dev, HT_BASIC_RATE, 0x00008003);
1328 --- a/drivers/net/wireless/rt2x00/rt2x00dev.c
1329 +++ b/drivers/net/wireless/rt2x00/rt2x00dev.c
1330 @@ -141,8 +141,11 @@ static void rt2x00lib_intf_scheduled_ite
1331 if (!test_bit(DEVICE_STATE_ENABLED_RADIO, &rt2x00dev->flags))
1334 - if (test_and_clear_bit(DELAYED_UPDATE_BEACON, &intf->delayed_flags))
1335 + if (test_and_clear_bit(DELAYED_UPDATE_BEACON, &intf->delayed_flags)) {
1336 + mutex_lock(&intf->beacon_skb_mutex);
1337 rt2x00queue_update_beacon(rt2x00dev, vif);
1338 + mutex_unlock(&intf->beacon_skb_mutex);
1342 static void rt2x00lib_intf_scheduled(struct work_struct *work)
1343 @@ -216,7 +219,7 @@ static void rt2x00lib_beaconupdate_iter(
1344 * never be called for USB devices.
1346 WARN_ON(rt2x00_is_usb(rt2x00dev));
1347 - rt2x00queue_update_beacon_locked(rt2x00dev, vif);
1348 + rt2x00queue_update_beacon(rt2x00dev, vif);
1351 void rt2x00lib_beacondone(struct rt2x00_dev *rt2x00dev)
1352 --- a/drivers/net/wireless/rt2x00/rt2x00mac.c
1353 +++ b/drivers/net/wireless/rt2x00/rt2x00mac.c
1354 @@ -487,6 +487,8 @@ int rt2x00mac_set_key(struct ieee80211_h
1355 crypto.cipher = rt2x00crypto_key_to_cipher(key);
1356 if (crypto.cipher == CIPHER_NONE)
1358 + if (crypto.cipher == CIPHER_TKIP && rt2x00_is_usb(rt2x00dev))
1359 + return -EOPNOTSUPP;
1363 @@ -624,25 +626,24 @@ void rt2x00mac_bss_info_changed(struct i
1364 * Start/stop beaconing.
1366 if (changes & BSS_CHANGED_BEACON_ENABLED) {
1367 + mutex_lock(&intf->beacon_skb_mutex);
1368 if (!bss_conf->enable_beacon && intf->enable_beacon) {
1369 rt2x00dev->intf_beaconing--;
1370 intf->enable_beacon = false;
1372 - * Clear beacon in the H/W for this vif. This is needed
1373 - * to disable beaconing on this particular interface
1374 - * and keep it running on other interfaces.
1376 - rt2x00queue_clear_beacon(rt2x00dev, vif);
1378 if (rt2x00dev->intf_beaconing == 0) {
1380 * Last beaconing interface disabled
1381 * -> stop beacon queue.
1383 - mutex_lock(&intf->beacon_skb_mutex);
1384 rt2x00queue_stop_queue(rt2x00dev->bcn);
1385 - mutex_unlock(&intf->beacon_skb_mutex);
1388 + * Clear beacon in the H/W for this vif. This is needed
1389 + * to disable beaconing on this particular interface
1390 + * and keep it running on other interfaces.
1392 + rt2x00queue_clear_beacon(rt2x00dev, vif);
1393 } else if (bss_conf->enable_beacon && !intf->enable_beacon) {
1394 rt2x00dev->intf_beaconing++;
1395 intf->enable_beacon = true;
1396 @@ -658,11 +659,10 @@ void rt2x00mac_bss_info_changed(struct i
1397 * First beaconing interface enabled
1398 * -> start beacon queue.
1400 - mutex_lock(&intf->beacon_skb_mutex);
1401 rt2x00queue_start_queue(rt2x00dev->bcn);
1402 - mutex_unlock(&intf->beacon_skb_mutex);
1405 + mutex_unlock(&intf->beacon_skb_mutex);
1409 --- a/drivers/net/wireless/rt2x00/rt2x00queue.c
1410 +++ b/drivers/net/wireless/rt2x00/rt2x00queue.c
1411 @@ -754,8 +754,6 @@ int rt2x00queue_clear_beacon(struct rt2x
1412 if (unlikely(!intf->beacon))
1415 - mutex_lock(&intf->beacon_skb_mutex);
1418 * Clean up the beacon skb.
1420 @@ -768,13 +766,11 @@ int rt2x00queue_clear_beacon(struct rt2x
1421 if (rt2x00dev->ops->lib->clear_beacon)
1422 rt2x00dev->ops->lib->clear_beacon(intf->beacon);
1424 - mutex_unlock(&intf->beacon_skb_mutex);
1429 -int rt2x00queue_update_beacon_locked(struct rt2x00_dev *rt2x00dev,
1430 - struct ieee80211_vif *vif)
1431 +int rt2x00queue_update_beacon(struct rt2x00_dev *rt2x00dev,
1432 + struct ieee80211_vif *vif)
1434 struct rt2x00_intf *intf = vif_to_intf(vif);
1435 struct skb_frame_desc *skbdesc;
1436 @@ -815,19 +811,6 @@ int rt2x00queue_update_beacon_locked(str
1440 -int rt2x00queue_update_beacon(struct rt2x00_dev *rt2x00dev,
1441 - struct ieee80211_vif *vif)
1443 - struct rt2x00_intf *intf = vif_to_intf(vif);
1446 - mutex_lock(&intf->beacon_skb_mutex);
1447 - ret = rt2x00queue_update_beacon_locked(rt2x00dev, vif);
1448 - mutex_unlock(&intf->beacon_skb_mutex);
1453 bool rt2x00queue_for_each_entry(struct data_queue *queue,
1454 enum queue_index start,
1455 enum queue_index end,
1456 --- a/drivers/net/wireless/rt2x00/rt2x00queue.h
1457 +++ b/drivers/net/wireless/rt2x00/rt2x00queue.h
1458 @@ -353,6 +353,7 @@ struct txentry_desc {
1460 enum queue_entry_flags {
1462 + ENTRY_BCN_ENABLED,
1463 ENTRY_OWNER_DEVICE_DATA,
1465 ENTRY_DATA_IO_FAILED,
1466 --- a/drivers/net/wireless/ath/ath9k/main.c
1467 +++ b/drivers/net/wireless/ath/ath9k/main.c
1468 @@ -1757,7 +1757,6 @@ out:
1469 void ath9k_update_p2p_ps(struct ath_softc *sc, struct ieee80211_vif *vif)
1471 struct ath_vif *avp = (void *)vif->drv_priv;
1472 - unsigned long flags;
1475 if (!sc->p2p_ps_timer)
1476 @@ -1767,14 +1766,9 @@ void ath9k_update_p2p_ps(struct ath_soft
1479 sc->p2p_ps_vif = avp;
1481 - spin_lock_irqsave(&sc->sc_pm_lock, flags);
1482 - if (!(sc->ps_flags & PS_BEACON_SYNC)) {
1483 - tsf = ath9k_hw_gettsf32(sc->sc_ah);
1484 - ieee80211_parse_p2p_noa(&vif->bss_conf.p2p_noa_attr, &avp->noa, tsf);
1485 - ath9k_update_p2p_ps_timer(sc, avp);
1487 - spin_unlock_irqrestore(&sc->sc_pm_lock, flags);
1488 + tsf = ath9k_hw_gettsf32(sc->sc_ah);
1489 + ieee80211_parse_p2p_noa(&vif->bss_conf.p2p_noa_attr, &avp->noa, tsf);
1490 + ath9k_update_p2p_ps_timer(sc, avp);
1493 static void ath9k_bss_info_changed(struct ieee80211_hw *hw,
1494 @@ -1791,6 +1785,7 @@ static void ath9k_bss_info_changed(struc
1495 struct ath_hw *ah = sc->sc_ah;
1496 struct ath_common *common = ath9k_hw_common(ah);
1497 struct ath_vif *avp = (void *)vif->drv_priv;
1498 + unsigned long flags;
1501 ath9k_ps_wakeup(sc);
1502 @@ -1853,7 +1848,10 @@ static void ath9k_bss_info_changed(struc
1504 if (changed & BSS_CHANGED_P2P_PS) {
1505 spin_lock_bh(&sc->sc_pcu_lock);
1506 - ath9k_update_p2p_ps(sc, vif);
1507 + spin_lock_irqsave(&sc->sc_pm_lock, flags);
1508 + if (!(sc->ps_flags & PS_BEACON_SYNC))
1509 + ath9k_update_p2p_ps(sc, vif);
1510 + spin_unlock_irqrestore(&sc->sc_pm_lock, flags);
1511 spin_unlock_bh(&sc->sc_pcu_lock);
1514 @@ -2232,14 +2230,6 @@ static void ath9k_sw_scan_complete(struc
1515 clear_bit(ATH_OP_SCANNING, &common->op_flags);
1518 -static void ath9k_channel_switch_beacon(struct ieee80211_hw *hw,
1519 - struct ieee80211_vif *vif,
1520 - struct cfg80211_chan_def *chandef)
1522 - /* depend on vif->csa_active only */
1526 struct ieee80211_ops ath9k_ops = {
1528 .start = ath9k_start,
1529 @@ -2287,5 +2277,4 @@ struct ieee80211_ops ath9k_ops = {
1531 .sw_scan_start = ath9k_sw_scan_start,
1532 .sw_scan_complete = ath9k_sw_scan_complete,
1533 - .channel_switch_beacon = ath9k_channel_switch_beacon,
1535 --- a/drivers/net/wireless/ath/ath10k/mac.c
1536 +++ b/drivers/net/wireless/ath/ath10k/mac.c
1537 @@ -4142,14 +4142,6 @@ static int ath10k_set_bitrate_mask(struc
1538 fixed_nss, force_sgi);
1541 -static void ath10k_channel_switch_beacon(struct ieee80211_hw *hw,
1542 - struct ieee80211_vif *vif,
1543 - struct cfg80211_chan_def *chandef)
1545 - /* there's no need to do anything here. vif->csa_active is enough */
1549 static void ath10k_sta_rc_update(struct ieee80211_hw *hw,
1550 struct ieee80211_vif *vif,
1551 struct ieee80211_sta *sta,
1552 @@ -4256,7 +4248,6 @@ static const struct ieee80211_ops ath10k
1553 .restart_complete = ath10k_restart_complete,
1554 .get_survey = ath10k_get_survey,
1555 .set_bitrate_mask = ath10k_set_bitrate_mask,
1556 - .channel_switch_beacon = ath10k_channel_switch_beacon,
1557 .sta_rc_update = ath10k_sta_rc_update,
1558 .get_tsf = ath10k_get_tsf,
1560 --- a/net/mac80211/cfg.c
1561 +++ b/net/mac80211/cfg.c
1562 @@ -468,327 +468,6 @@ void sta_set_rate_info_rx(struct sta_inf
1563 rinfo->flags |= RATE_INFO_FLAGS_160_MHZ_WIDTH;
1566 -static void sta_set_sinfo(struct sta_info *sta, struct station_info *sinfo)
1568 - struct ieee80211_sub_if_data *sdata = sta->sdata;
1569 - struct ieee80211_local *local = sdata->local;
1570 - struct rate_control_ref *ref = local->rate_ctrl;
1571 - struct timespec uptime;
1576 - sinfo->generation = sdata->local->sta_generation;
1578 - sinfo->filled = STATION_INFO_INACTIVE_TIME |
1579 - STATION_INFO_RX_BYTES64 |
1580 - STATION_INFO_TX_BYTES64 |
1581 - STATION_INFO_RX_PACKETS |
1582 - STATION_INFO_TX_PACKETS |
1583 - STATION_INFO_TX_RETRIES |
1584 - STATION_INFO_TX_FAILED |
1585 - STATION_INFO_TX_BITRATE |
1586 - STATION_INFO_RX_BITRATE |
1587 - STATION_INFO_RX_DROP_MISC |
1588 - STATION_INFO_BSS_PARAM |
1589 - STATION_INFO_CONNECTED_TIME |
1590 - STATION_INFO_STA_FLAGS |
1591 - STATION_INFO_BEACON_LOSS_COUNT;
1593 - do_posix_clock_monotonic_gettime(&uptime);
1594 - sinfo->connected_time = uptime.tv_sec - sta->last_connected;
1596 - sinfo->inactive_time = jiffies_to_msecs(jiffies - sta->last_rx);
1597 - sinfo->tx_bytes = 0;
1598 - for (ac = 0; ac < IEEE80211_NUM_ACS; ac++) {
1599 - sinfo->tx_bytes += sta->tx_bytes[ac];
1600 - packets += sta->tx_packets[ac];
1602 - sinfo->tx_packets = packets;
1603 - sinfo->rx_bytes = sta->rx_bytes;
1604 - sinfo->rx_packets = sta->rx_packets;
1605 - sinfo->tx_retries = sta->tx_retry_count;
1606 - sinfo->tx_failed = sta->tx_retry_failed;
1607 - sinfo->rx_dropped_misc = sta->rx_dropped;
1608 - sinfo->beacon_loss_count = sta->beacon_loss_count;
1610 - if ((sta->local->hw.flags & IEEE80211_HW_SIGNAL_DBM) ||
1611 - (sta->local->hw.flags & IEEE80211_HW_SIGNAL_UNSPEC)) {
1612 - sinfo->filled |= STATION_INFO_SIGNAL | STATION_INFO_SIGNAL_AVG;
1613 - if (!local->ops->get_rssi ||
1614 - drv_get_rssi(local, sdata, &sta->sta, &sinfo->signal))
1615 - sinfo->signal = (s8)sta->last_signal;
1616 - sinfo->signal_avg = (s8) -ewma_read(&sta->avg_signal);
1618 - if (sta->chains) {
1619 - sinfo->filled |= STATION_INFO_CHAIN_SIGNAL |
1620 - STATION_INFO_CHAIN_SIGNAL_AVG;
1622 - sinfo->chains = sta->chains;
1623 - for (i = 0; i < ARRAY_SIZE(sinfo->chain_signal); i++) {
1624 - sinfo->chain_signal[i] = sta->chain_signal_last[i];
1625 - sinfo->chain_signal_avg[i] =
1626 - (s8) -ewma_read(&sta->chain_signal_avg[i]);
1630 - sta_set_rate_info_tx(sta, &sta->last_tx_rate, &sinfo->txrate);
1631 - sta_set_rate_info_rx(sta, &sinfo->rxrate);
1633 - if (ieee80211_vif_is_mesh(&sdata->vif)) {
1634 -#ifdef CPTCFG_MAC80211_MESH
1635 - sinfo->filled |= STATION_INFO_LLID |
1636 - STATION_INFO_PLID |
1637 - STATION_INFO_PLINK_STATE |
1638 - STATION_INFO_LOCAL_PM |
1639 - STATION_INFO_PEER_PM |
1640 - STATION_INFO_NONPEER_PM;
1642 - sinfo->llid = sta->llid;
1643 - sinfo->plid = sta->plid;
1644 - sinfo->plink_state = sta->plink_state;
1645 - if (test_sta_flag(sta, WLAN_STA_TOFFSET_KNOWN)) {
1646 - sinfo->filled |= STATION_INFO_T_OFFSET;
1647 - sinfo->t_offset = sta->t_offset;
1649 - sinfo->local_pm = sta->local_pm;
1650 - sinfo->peer_pm = sta->peer_pm;
1651 - sinfo->nonpeer_pm = sta->nonpeer_pm;
1655 - sinfo->bss_param.flags = 0;
1656 - if (sdata->vif.bss_conf.use_cts_prot)
1657 - sinfo->bss_param.flags |= BSS_PARAM_FLAGS_CTS_PROT;
1658 - if (sdata->vif.bss_conf.use_short_preamble)
1659 - sinfo->bss_param.flags |= BSS_PARAM_FLAGS_SHORT_PREAMBLE;
1660 - if (sdata->vif.bss_conf.use_short_slot)
1661 - sinfo->bss_param.flags |= BSS_PARAM_FLAGS_SHORT_SLOT_TIME;
1662 - sinfo->bss_param.dtim_period = sdata->local->hw.conf.ps_dtim_period;
1663 - sinfo->bss_param.beacon_interval = sdata->vif.bss_conf.beacon_int;
1665 - sinfo->sta_flags.set = 0;
1666 - sinfo->sta_flags.mask = BIT(NL80211_STA_FLAG_AUTHORIZED) |
1667 - BIT(NL80211_STA_FLAG_SHORT_PREAMBLE) |
1668 - BIT(NL80211_STA_FLAG_WME) |
1669 - BIT(NL80211_STA_FLAG_MFP) |
1670 - BIT(NL80211_STA_FLAG_AUTHENTICATED) |
1671 - BIT(NL80211_STA_FLAG_ASSOCIATED) |
1672 - BIT(NL80211_STA_FLAG_TDLS_PEER);
1673 - if (test_sta_flag(sta, WLAN_STA_AUTHORIZED))
1674 - sinfo->sta_flags.set |= BIT(NL80211_STA_FLAG_AUTHORIZED);
1675 - if (test_sta_flag(sta, WLAN_STA_SHORT_PREAMBLE))
1676 - sinfo->sta_flags.set |= BIT(NL80211_STA_FLAG_SHORT_PREAMBLE);
1677 - if (test_sta_flag(sta, WLAN_STA_WME))
1678 - sinfo->sta_flags.set |= BIT(NL80211_STA_FLAG_WME);
1679 - if (test_sta_flag(sta, WLAN_STA_MFP))
1680 - sinfo->sta_flags.set |= BIT(NL80211_STA_FLAG_MFP);
1681 - if (test_sta_flag(sta, WLAN_STA_AUTH))
1682 - sinfo->sta_flags.set |= BIT(NL80211_STA_FLAG_AUTHENTICATED);
1683 - if (test_sta_flag(sta, WLAN_STA_ASSOC))
1684 - sinfo->sta_flags.set |= BIT(NL80211_STA_FLAG_ASSOCIATED);
1685 - if (test_sta_flag(sta, WLAN_STA_TDLS_PEER))
1686 - sinfo->sta_flags.set |= BIT(NL80211_STA_FLAG_TDLS_PEER);
1688 - /* check if the driver has a SW RC implementation */
1689 - if (ref && ref->ops->get_expected_throughput)
1690 - thr = ref->ops->get_expected_throughput(sta->rate_ctrl_priv);
1692 - thr = drv_get_expected_throughput(local, &sta->sta);
1695 - sinfo->filled |= STATION_INFO_EXPECTED_THROUGHPUT;
1696 - sinfo->expected_throughput = thr;
1700 -static const char ieee80211_gstrings_sta_stats[][ETH_GSTRING_LEN] = {
1701 - "rx_packets", "rx_bytes", "wep_weak_iv_count",
1702 - "rx_duplicates", "rx_fragments", "rx_dropped",
1703 - "tx_packets", "tx_bytes", "tx_fragments",
1704 - "tx_filtered", "tx_retry_failed", "tx_retries",
1705 - "beacon_loss", "sta_state", "txrate", "rxrate", "signal",
1706 - "channel", "noise", "ch_time", "ch_time_busy",
1707 - "ch_time_ext_busy", "ch_time_rx", "ch_time_tx"
1709 -#define STA_STATS_LEN ARRAY_SIZE(ieee80211_gstrings_sta_stats)
1711 -static int ieee80211_get_et_sset_count(struct wiphy *wiphy,
1712 - struct net_device *dev,
1715 - struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev);
1718 - if (sset == ETH_SS_STATS)
1719 - rv += STA_STATS_LEN;
1721 - rv += drv_get_et_sset_count(sdata, sset);
1724 - return -EOPNOTSUPP;
1728 -static void ieee80211_get_et_stats(struct wiphy *wiphy,
1729 - struct net_device *dev,
1730 - struct ethtool_stats *stats,
1733 - struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev);
1734 - struct ieee80211_chanctx_conf *chanctx_conf;
1735 - struct ieee80211_channel *channel;
1736 - struct sta_info *sta;
1737 - struct ieee80211_local *local = sdata->local;
1738 - struct station_info sinfo;
1739 - struct survey_info survey;
1741 -#define STA_STATS_SURVEY_LEN 7
1743 - memset(data, 0, sizeof(u64) * STA_STATS_LEN);
1745 -#define ADD_STA_STATS(sta) \
1747 - data[i++] += sta->rx_packets; \
1748 - data[i++] += sta->rx_bytes; \
1749 - data[i++] += sta->wep_weak_iv_count; \
1750 - data[i++] += sta->num_duplicates; \
1751 - data[i++] += sta->rx_fragments; \
1752 - data[i++] += sta->rx_dropped; \
1754 - data[i++] += sinfo.tx_packets; \
1755 - data[i++] += sinfo.tx_bytes; \
1756 - data[i++] += sta->tx_fragments; \
1757 - data[i++] += sta->tx_filtered_count; \
1758 - data[i++] += sta->tx_retry_failed; \
1759 - data[i++] += sta->tx_retry_count; \
1760 - data[i++] += sta->beacon_loss_count; \
1763 - /* For Managed stations, find the single station based on BSSID
1764 - * and use that. For interface types, iterate through all available
1765 - * stations and add stats for any station that is assigned to this
1769 - mutex_lock(&local->sta_mtx);
1771 - if (sdata->vif.type == NL80211_IFTYPE_STATION) {
1772 - sta = sta_info_get_bss(sdata, sdata->u.mgd.bssid);
1774 - if (!(sta && !WARN_ON(sta->sdata->dev != dev)))
1778 - sta_set_sinfo(sta, &sinfo);
1781 - ADD_STA_STATS(sta);
1783 - data[i++] = sta->sta_state;
1786 - if (sinfo.filled & STATION_INFO_TX_BITRATE)
1787 - data[i] = 100000 *
1788 - cfg80211_calculate_bitrate(&sinfo.txrate);
1790 - if (sinfo.filled & STATION_INFO_RX_BITRATE)
1791 - data[i] = 100000 *
1792 - cfg80211_calculate_bitrate(&sinfo.rxrate);
1795 - if (sinfo.filled & STATION_INFO_SIGNAL_AVG)
1796 - data[i] = (u8)sinfo.signal_avg;
1799 - list_for_each_entry(sta, &local->sta_list, list) {
1800 - /* Make sure this station belongs to the proper dev */
1801 - if (sta->sdata->dev != dev)
1805 - sta_set_sinfo(sta, &sinfo);
1807 - ADD_STA_STATS(sta);
1812 - i = STA_STATS_LEN - STA_STATS_SURVEY_LEN;
1813 - /* Get survey stats for current channel */
1814 - survey.filled = 0;
1817 - chanctx_conf = rcu_dereference(sdata->vif.chanctx_conf);
1819 - channel = chanctx_conf->def.chan;
1822 - rcu_read_unlock();
1827 - survey.filled = 0;
1828 - if (drv_get_survey(local, q, &survey) != 0) {
1829 - survey.filled = 0;
1833 - } while (channel != survey.channel);
1836 - if (survey.filled)
1837 - data[i++] = survey.channel->center_freq;
1840 - if (survey.filled & SURVEY_INFO_NOISE_DBM)
1841 - data[i++] = (u8)survey.noise;
1844 - if (survey.filled & SURVEY_INFO_CHANNEL_TIME)
1845 - data[i++] = survey.channel_time;
1848 - if (survey.filled & SURVEY_INFO_CHANNEL_TIME_BUSY)
1849 - data[i++] = survey.channel_time_busy;
1852 - if (survey.filled & SURVEY_INFO_CHANNEL_TIME_EXT_BUSY)
1853 - data[i++] = survey.channel_time_ext_busy;
1856 - if (survey.filled & SURVEY_INFO_CHANNEL_TIME_RX)
1857 - data[i++] = survey.channel_time_rx;
1860 - if (survey.filled & SURVEY_INFO_CHANNEL_TIME_TX)
1861 - data[i++] = survey.channel_time_tx;
1865 - mutex_unlock(&local->sta_mtx);
1867 - if (WARN_ON(i != STA_STATS_LEN))
1870 - drv_get_et_stats(sdata, stats, &(data[STA_STATS_LEN]));
1873 -static void ieee80211_get_et_strings(struct wiphy *wiphy,
1874 - struct net_device *dev,
1875 - u32 sset, u8 *data)
1877 - struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev);
1878 - int sz_sta_stats = 0;
1880 - if (sset == ETH_SS_STATS) {
1881 - sz_sta_stats = sizeof(ieee80211_gstrings_sta_stats);
1882 - memcpy(data, ieee80211_gstrings_sta_stats, sz_sta_stats);
1884 - drv_get_et_strings(sdata, sset, &(data[sz_sta_stats]));
1887 static int ieee80211_dump_station(struct wiphy *wiphy, struct net_device *dev,
1888 int idx, u8 *mac, struct station_info *sinfo)
1890 @@ -875,7 +554,8 @@ static int ieee80211_set_monitor_channel
1893 static int ieee80211_set_probe_resp(struct ieee80211_sub_if_data *sdata,
1894 - const u8 *resp, size_t resp_len)
1895 + const u8 *resp, size_t resp_len,
1896 + const struct ieee80211_csa_settings *csa)
1898 struct probe_resp *new, *old;
1900 @@ -891,6 +571,11 @@ static int ieee80211_set_probe_resp(stru
1901 new->len = resp_len;
1902 memcpy(new->data, resp, resp_len);
1905 + memcpy(new->csa_counter_offsets, csa->counter_offsets_presp,
1906 + csa->n_counter_offsets_presp *
1907 + sizeof(new->csa_counter_offsets[0]));
1909 rcu_assign_pointer(sdata->u.ap.probe_resp, new);
1911 kfree_rcu(old, rcu_head);
1912 @@ -899,7 +584,8 @@ static int ieee80211_set_probe_resp(stru
1915 static int ieee80211_assign_beacon(struct ieee80211_sub_if_data *sdata,
1916 - struct cfg80211_beacon_data *params)
1917 + struct cfg80211_beacon_data *params,
1918 + const struct ieee80211_csa_settings *csa)
1920 struct beacon_data *new, *old;
1921 int new_head_len, new_tail_len;
1922 @@ -943,6 +629,13 @@ static int ieee80211_assign_beacon(struc
1923 new->head_len = new_head_len;
1924 new->tail_len = new_tail_len;
1927 + new->csa_current_counter = csa->count;
1928 + memcpy(new->csa_counter_offsets, csa->counter_offsets_beacon,
1929 + csa->n_counter_offsets_beacon *
1930 + sizeof(new->csa_counter_offsets[0]));
1935 memcpy(new->head, params->head, new_head_len);
1936 @@ -957,7 +650,7 @@ static int ieee80211_assign_beacon(struc
1937 memcpy(new->tail, old->tail, new_tail_len);
1939 err = ieee80211_set_probe_resp(sdata, params->probe_resp,
1940 - params->probe_resp_len);
1941 + params->probe_resp_len, csa);
1945 @@ -1042,7 +735,7 @@ static int ieee80211_start_ap(struct wip
1946 sdata->vif.bss_conf.p2p_noa_attr.oppps_ctwindow |=
1947 IEEE80211_P2P_OPPPS_ENABLE_BIT;
1949 - err = ieee80211_assign_beacon(sdata, ¶ms->beacon);
1950 + err = ieee80211_assign_beacon(sdata, ¶ms->beacon, NULL);
1952 ieee80211_vif_release_channel(sdata);
1954 @@ -1090,7 +783,7 @@ static int ieee80211_change_beacon(struc
1958 - err = ieee80211_assign_beacon(sdata, params);
1959 + err = ieee80211_assign_beacon(sdata, params, NULL);
1962 ieee80211_bss_info_change_notify(sdata, err);
1963 @@ -3073,7 +2766,8 @@ static int ieee80211_set_after_csa_beaco
1965 switch (sdata->vif.type) {
1966 case NL80211_IFTYPE_AP:
1967 - err = ieee80211_assign_beacon(sdata, sdata->u.ap.next_beacon);
1968 + err = ieee80211_assign_beacon(sdata, sdata->u.ap.next_beacon,
1970 kfree(sdata->u.ap.next_beacon);
1971 sdata->u.ap.next_beacon = NULL;
1973 @@ -3176,6 +2870,7 @@ static int ieee80211_set_csa_beacon(stru
1974 struct cfg80211_csa_settings *params,
1977 + struct ieee80211_csa_settings csa = {};
1980 switch (sdata->vif.type) {
1981 @@ -3210,20 +2905,13 @@ static int ieee80211_set_csa_beacon(stru
1982 IEEE80211_MAX_CSA_COUNTERS_NUM))
1985 - /* make sure we don't have garbage in other counters */
1986 - memset(sdata->csa_counter_offset_beacon, 0,
1987 - sizeof(sdata->csa_counter_offset_beacon));
1988 - memset(sdata->csa_counter_offset_presp, 0,
1989 - sizeof(sdata->csa_counter_offset_presp));
1991 - memcpy(sdata->csa_counter_offset_beacon,
1992 - params->counter_offsets_beacon,
1993 - params->n_counter_offsets_beacon * sizeof(u16));
1994 - memcpy(sdata->csa_counter_offset_presp,
1995 - params->counter_offsets_presp,
1996 - params->n_counter_offsets_presp * sizeof(u16));
1997 + csa.counter_offsets_beacon = params->counter_offsets_beacon;
1998 + csa.counter_offsets_presp = params->counter_offsets_presp;
1999 + csa.n_counter_offsets_beacon = params->n_counter_offsets_beacon;
2000 + csa.n_counter_offsets_presp = params->n_counter_offsets_presp;
2001 + csa.count = params->count;
2003 - err = ieee80211_assign_beacon(sdata, ¶ms->beacon_csa);
2004 + err = ieee80211_assign_beacon(sdata, ¶ms->beacon_csa, &csa);
2006 kfree(sdata->u.ap.next_beacon);
2008 @@ -3367,7 +3055,6 @@ __ieee80211_channel_switch(struct wiphy
2009 sdata->csa_radar_required = params->radar_required;
2010 sdata->csa_chandef = params->chandef;
2011 sdata->csa_block_tx = params->block_tx;
2012 - sdata->csa_current_counter = params->count;
2013 sdata->vif.csa_active = true;
2015 if (sdata->csa_block_tx)
2016 @@ -3515,10 +3202,23 @@ static int ieee80211_mgmt_tx(struct wiph
2017 sdata->vif.type == NL80211_IFTYPE_ADHOC) &&
2018 params->n_csa_offsets) {
2020 - u8 c = sdata->csa_current_counter;
2021 + struct beacon_data *beacon = NULL;
2025 - for (i = 0; i < params->n_csa_offsets; i++)
2026 - data[params->csa_offsets[i]] = c;
2027 + if (sdata->vif.type == NL80211_IFTYPE_AP)
2028 + beacon = rcu_dereference(sdata->u.ap.beacon);
2029 + else if (sdata->vif.type == NL80211_IFTYPE_ADHOC)
2030 + beacon = rcu_dereference(sdata->u.ibss.presp);
2031 + else if (ieee80211_vif_is_mesh(&sdata->vif))
2032 + beacon = rcu_dereference(sdata->u.mesh.beacon);
2035 + for (i = 0; i < params->n_csa_offsets; i++)
2036 + data[params->csa_offsets[i]] =
2037 + beacon->csa_current_counter;
2039 + rcu_read_unlock();
2042 IEEE80211_SKB_CB(skb)->flags = flags;
2043 @@ -3598,21 +3298,6 @@ static int ieee80211_get_antenna(struct
2044 return drv_get_antenna(local, tx_ant, rx_ant);
2047 -static int ieee80211_set_ringparam(struct wiphy *wiphy, u32 tx, u32 rx)
2049 - struct ieee80211_local *local = wiphy_priv(wiphy);
2051 - return drv_set_ringparam(local, tx, rx);
2054 -static void ieee80211_get_ringparam(struct wiphy *wiphy,
2055 - u32 *tx, u32 *tx_max, u32 *rx, u32 *rx_max)
2057 - struct ieee80211_local *local = wiphy_priv(wiphy);
2059 - drv_get_ringparam(local, tx, tx_max, rx, rx_max);
2062 static int ieee80211_set_rekey_data(struct wiphy *wiphy,
2063 struct net_device *dev,
2064 struct cfg80211_gtk_rekey_data *data)
2065 @@ -3844,8 +3529,6 @@ const struct cfg80211_ops mac80211_confi
2066 .mgmt_frame_register = ieee80211_mgmt_frame_register,
2067 .set_antenna = ieee80211_set_antenna,
2068 .get_antenna = ieee80211_get_antenna,
2069 - .set_ringparam = ieee80211_set_ringparam,
2070 - .get_ringparam = ieee80211_get_ringparam,
2071 .set_rekey_data = ieee80211_set_rekey_data,
2072 .tdls_oper = ieee80211_tdls_oper,
2073 .tdls_mgmt = ieee80211_tdls_mgmt,
2074 @@ -3854,9 +3537,6 @@ const struct cfg80211_ops mac80211_confi
2076 .set_wakeup = ieee80211_set_wakeup,
2078 - .get_et_sset_count = ieee80211_get_et_sset_count,
2079 - .get_et_stats = ieee80211_get_et_stats,
2080 - .get_et_strings = ieee80211_get_et_strings,
2081 .get_channel = ieee80211_cfg_get_channel,
2082 .start_radar_detection = ieee80211_start_radar_detection,
2083 .channel_switch = ieee80211_channel_switch,
2084 --- a/net/mac80211/debugfs_sta.c
2085 +++ b/net/mac80211/debugfs_sta.c
2086 @@ -587,7 +587,6 @@ void ieee80211_sta_debugfs_add(struct st
2087 DEBUGFS_ADD_COUNTER(tx_filtered, tx_filtered_count);
2088 DEBUGFS_ADD_COUNTER(tx_retry_failed, tx_retry_failed);
2089 DEBUGFS_ADD_COUNTER(tx_retry_count, tx_retry_count);
2090 - DEBUGFS_ADD_COUNTER(wep_weak_iv_count, wep_weak_iv_count);
2092 if (sizeof(sta->driver_buffered_tids) == sizeof(u32))
2093 debugfs_create_x32("driver_buffered_tids", 0400,
2094 --- a/net/mac80211/wep.c
2095 +++ b/net/mac80211/wep.c
2096 @@ -271,22 +271,6 @@ static int ieee80211_wep_decrypt(struct
2101 -static bool ieee80211_wep_is_weak_iv(struct sk_buff *skb,
2102 - struct ieee80211_key *key)
2104 - struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data;
2105 - unsigned int hdrlen;
2109 - hdrlen = ieee80211_hdrlen(hdr->frame_control);
2110 - ivpos = skb->data + hdrlen;
2111 - iv = (ivpos[0] << 16) | (ivpos[1] << 8) | ivpos[2];
2113 - return ieee80211_wep_weak_iv(iv, key->conf.keylen);
2117 ieee80211_crypto_wep_decrypt(struct ieee80211_rx_data *rx)
2119 @@ -301,16 +285,12 @@ ieee80211_crypto_wep_decrypt(struct ieee
2120 if (!(status->flag & RX_FLAG_DECRYPTED)) {
2121 if (skb_linearize(rx->skb))
2122 return RX_DROP_UNUSABLE;
2123 - if (rx->sta && ieee80211_wep_is_weak_iv(rx->skb, rx->key))
2124 - rx->sta->wep_weak_iv_count++;
2125 if (ieee80211_wep_decrypt(rx->local, rx->skb, rx->key))
2126 return RX_DROP_UNUSABLE;
2127 } else if (!(status->flag & RX_FLAG_IV_STRIPPED)) {
2128 if (!pskb_may_pull(rx->skb, ieee80211_hdrlen(fc) +
2129 IEEE80211_WEP_IV_LEN))
2130 return RX_DROP_UNUSABLE;
2131 - if (rx->sta && ieee80211_wep_is_weak_iv(rx->skb, rx->key))
2132 - rx->sta->wep_weak_iv_count++;
2133 ieee80211_wep_remove_iv(rx->local, rx->skb, rx->key);
2135 if (pskb_trim(rx->skb, rx->skb->len - IEEE80211_WEP_ICV_LEN))
2136 --- a/include/net/cfg80211.h
2137 +++ b/include/net/cfg80211.h
2138 @@ -2278,16 +2278,6 @@ struct cfg80211_qos_map {
2140 * @set_noack_map: Set the NoAck Map for the TIDs.
2142 - * @get_et_sset_count: Ethtool API to get string-set count.
2143 - * See @ethtool_ops.get_sset_count
2145 - * @get_et_stats: Ethtool API to get a set of u64 stats.
2146 - * See @ethtool_ops.get_ethtool_stats
2148 - * @get_et_strings: Ethtool API to get a set of strings to describe stats
2149 - * and perhaps other supported types of ethtool data-sets.
2150 - * See @ethtool_ops.get_strings
2152 * @get_channel: Get the current operating channel for the virtual interface.
2153 * For monitor interfaces, it should return %NULL unless there's a single
2154 * current monitoring channel.
2155 @@ -2529,13 +2519,6 @@ struct cfg80211_ops {
2156 struct net_device *dev,
2159 - int (*get_et_sset_count)(struct wiphy *wiphy,
2160 - struct net_device *dev, int sset);
2161 - void (*get_et_stats)(struct wiphy *wiphy, struct net_device *dev,
2162 - struct ethtool_stats *stats, u64 *data);
2163 - void (*get_et_strings)(struct wiphy *wiphy, struct net_device *dev,
2164 - u32 sset, u8 *data);
2166 int (*get_channel)(struct wiphy *wiphy,
2167 struct wireless_dev *wdev,
2168 struct cfg80211_chan_def *chandef);
2169 @@ -4846,6 +4829,10 @@ void cfg80211_stop_iface(struct wiphy *w
2171 void cfg80211_shutdown_all_interfaces(struct wiphy *wiphy);
2174 +/* ethtool helper */
2175 +void cfg80211_get_drvinfo(struct net_device *dev, struct ethtool_drvinfo *info);
2177 /* Logging, debugging and troubleshooting/diagnostic helpers. */
2179 /* wiphy_printk helpers, similar to dev_printk */
2180 --- a/net/mac80211/Makefile
2181 +++ b/net/mac80211/Makefile
2182 @@ -17,6 +17,7 @@ mac80211-y := \
2190 --- a/net/mac80211/ieee80211_i.h
2191 +++ b/net/mac80211/ieee80211_i.h
2192 @@ -229,16 +229,29 @@ struct ieee80211_rx_data {
2196 +struct ieee80211_csa_settings {
2197 + const u16 *counter_offsets_beacon;
2198 + const u16 *counter_offsets_presp;
2200 + int n_counter_offsets_beacon;
2201 + int n_counter_offsets_presp;
2206 struct beacon_data {
2208 int head_len, tail_len;
2209 struct ieee80211_meshconf_ie *meshconf;
2210 + u16 csa_counter_offsets[IEEE80211_MAX_CSA_COUNTERS_NUM];
2211 + u8 csa_current_counter;
2212 struct rcu_head rcu_head;
2216 struct rcu_head rcu_head;
2218 + u16 csa_counter_offsets[IEEE80211_MAX_CSA_COUNTERS_NUM];
2222 @@ -754,8 +767,6 @@ struct ieee80211_sub_if_data {
2223 struct mac80211_qos_map __rcu *qos_map;
2225 struct work_struct csa_finalize_work;
2226 - u16 csa_counter_offset_beacon[IEEE80211_MAX_CSA_COUNTERS_NUM];
2227 - u16 csa_counter_offset_presp[IEEE80211_MAX_CSA_COUNTERS_NUM];
2228 bool csa_radar_required;
2229 bool csa_block_tx; /* write-protected by sdata_lock and local->mtx */
2230 struct cfg80211_chan_def csa_chandef;
2231 @@ -767,7 +778,6 @@ struct ieee80211_sub_if_data {
2232 struct ieee80211_chanctx *reserved_chanctx;
2233 struct cfg80211_chan_def reserved_chandef;
2234 bool reserved_radar_required;
2235 - u8 csa_current_counter;
2237 /* used to reconfigure hardware SM PS */
2238 struct work_struct recalc_smps;
2239 @@ -1850,6 +1860,8 @@ int ieee80211_tdls_oper(struct wiphy *wi
2240 const u8 *peer, enum nl80211_tdls_operation oper);
2243 +extern const struct ethtool_ops ieee80211_ethtool_ops;
2245 #ifdef CPTCFG_MAC80211_NOINLINE
2246 #define debug_noinline noinline
2248 --- a/net/mac80211/iface.c
2249 +++ b/net/mac80211/iface.c
2250 @@ -399,6 +399,7 @@ int ieee80211_add_virtual_monitor(struct
2251 sdata->vif.type = NL80211_IFTYPE_MONITOR;
2252 snprintf(sdata->name, IFNAMSIZ, "%s-monitor",
2253 wiphy_name(local->hw.wiphy));
2254 + sdata->wdev.iftype = NL80211_IFTYPE_MONITOR;
2256 sdata->encrypt_headroom = IEEE80211_ENCRYPT_HEADROOM;
2258 @@ -1303,6 +1304,7 @@ static void ieee80211_setup_sdata(struct
2259 sdata->control_port_protocol = cpu_to_be16(ETH_P_PAE);
2260 sdata->control_port_no_encrypt = false;
2261 sdata->encrypt_headroom = IEEE80211_ENCRYPT_HEADROOM;
2262 + sdata->vif.bss_conf.idle = true;
2264 sdata->noack_map = 0;
2266 @@ -1721,6 +1723,8 @@ int ieee80211_if_add(struct ieee80211_lo
2268 ndev->features |= local->hw.netdev_features;
2270 + netdev_set_default_ethtool_ops(ndev, &ieee80211_ethtool_ops);
2272 ret = register_netdevice(ndev);
2275 --- a/net/wireless/core.c
2276 +++ b/net/wireless/core.c
2279 #include "debugfs.h"
2280 #include "wext-compat.h"
2281 -#include "ethtool.h"
2282 #include "rdev-ops.h"
2284 /* name for sysfs, %d is appended */
2285 @@ -940,8 +939,6 @@ static int cfg80211_netdev_notifier_call
2286 /* allow mac80211 to determine the timeout */
2287 wdev->ps_timeout = -1;
2289 - netdev_set_default_ethtool_ops(dev, &cfg80211_ethtool_ops);
2291 if ((wdev->iftype == NL80211_IFTYPE_STATION ||
2292 wdev->iftype == NL80211_IFTYPE_P2P_CLIENT ||
2293 wdev->iftype == NL80211_IFTYPE_ADHOC) && !wdev->use_4addr)
2294 --- a/net/wireless/ethtool.c
2295 +++ b/net/wireless/ethtool.c
2297 #include <linux/utsname.h>
2298 #include <net/cfg80211.h>
2300 -#include "ethtool.h"
2301 #include "rdev-ops.h"
2303 -static void cfg80211_get_drvinfo(struct net_device *dev,
2304 - struct ethtool_drvinfo *info)
2305 +void cfg80211_get_drvinfo(struct net_device *dev, struct ethtool_drvinfo *info)
2307 struct wireless_dev *wdev = dev->ieee80211_ptr;
2309 @@ -23,84 +21,4 @@ static void cfg80211_get_drvinfo(struct
2310 strlcpy(info->bus_info, dev_name(wiphy_dev(wdev->wiphy)),
2311 sizeof(info->bus_info));
2314 -static int cfg80211_get_regs_len(struct net_device *dev)
2316 - /* For now, return 0... */
2320 -static void cfg80211_get_regs(struct net_device *dev, struct ethtool_regs *regs,
2323 - struct wireless_dev *wdev = dev->ieee80211_ptr;
2325 - regs->version = wdev->wiphy->hw_version;
2329 -static void cfg80211_get_ringparam(struct net_device *dev,
2330 - struct ethtool_ringparam *rp)
2332 - struct wireless_dev *wdev = dev->ieee80211_ptr;
2333 - struct cfg80211_registered_device *rdev = wiphy_to_rdev(wdev->wiphy);
2335 - memset(rp, 0, sizeof(*rp));
2337 - if (rdev->ops->get_ringparam)
2338 - rdev_get_ringparam(rdev, &rp->tx_pending, &rp->tx_max_pending,
2339 - &rp->rx_pending, &rp->rx_max_pending);
2342 -static int cfg80211_set_ringparam(struct net_device *dev,
2343 - struct ethtool_ringparam *rp)
2345 - struct wireless_dev *wdev = dev->ieee80211_ptr;
2346 - struct cfg80211_registered_device *rdev = wiphy_to_rdev(wdev->wiphy);
2348 - if (rp->rx_mini_pending != 0 || rp->rx_jumbo_pending != 0)
2351 - if (rdev->ops->set_ringparam)
2352 - return rdev_set_ringparam(rdev, rp->tx_pending, rp->rx_pending);
2357 -static int cfg80211_get_sset_count(struct net_device *dev, int sset)
2359 - struct wireless_dev *wdev = dev->ieee80211_ptr;
2360 - struct cfg80211_registered_device *rdev = wiphy_to_rdev(wdev->wiphy);
2361 - if (rdev->ops->get_et_sset_count)
2362 - return rdev_get_et_sset_count(rdev, dev, sset);
2363 - return -EOPNOTSUPP;
2366 -static void cfg80211_get_stats(struct net_device *dev,
2367 - struct ethtool_stats *stats, u64 *data)
2369 - struct wireless_dev *wdev = dev->ieee80211_ptr;
2370 - struct cfg80211_registered_device *rdev = wiphy_to_rdev(wdev->wiphy);
2371 - if (rdev->ops->get_et_stats)
2372 - rdev_get_et_stats(rdev, dev, stats, data);
2375 -static void cfg80211_get_strings(struct net_device *dev, u32 sset, u8 *data)
2377 - struct wireless_dev *wdev = dev->ieee80211_ptr;
2378 - struct cfg80211_registered_device *rdev = wiphy_to_rdev(wdev->wiphy);
2379 - if (rdev->ops->get_et_strings)
2380 - rdev_get_et_strings(rdev, dev, sset, data);
2383 -const struct ethtool_ops cfg80211_ethtool_ops = {
2384 - .get_drvinfo = cfg80211_get_drvinfo,
2385 - .get_regs_len = cfg80211_get_regs_len,
2386 - .get_regs = cfg80211_get_regs,
2387 - .get_link = ethtool_op_get_link,
2388 - .get_ringparam = cfg80211_get_ringparam,
2389 - .set_ringparam = cfg80211_set_ringparam,
2390 - .get_strings = cfg80211_get_strings,
2391 - .get_ethtool_stats = cfg80211_get_stats,
2392 - .get_sset_count = cfg80211_get_sset_count,
2394 +EXPORT_SYMBOL(cfg80211_get_drvinfo);
2395 --- a/net/wireless/ethtool.h
2398 -#ifndef __CFG80211_ETHTOOL__
2399 -#define __CFG80211_ETHTOOL__
2401 -extern const struct ethtool_ops cfg80211_ethtool_ops;
2403 -#endif /* __CFG80211_ETHTOOL__ */
2404 --- a/net/wireless/rdev-ops.h
2405 +++ b/net/wireless/rdev-ops.h
2406 @@ -714,25 +714,6 @@ static inline int rdev_get_antenna(struc
2410 -static inline int rdev_set_ringparam(struct cfg80211_registered_device *rdev,
2414 - trace_rdev_set_ringparam(&rdev->wiphy, tx, rx);
2415 - ret = rdev->ops->set_ringparam(&rdev->wiphy, tx, rx);
2416 - trace_rdev_return_int(&rdev->wiphy, ret);
2420 -static inline void rdev_get_ringparam(struct cfg80211_registered_device *rdev,
2421 - u32 *tx, u32 *tx_max, u32 *rx,
2424 - trace_rdev_get_ringparam(&rdev->wiphy);
2425 - rdev->ops->get_ringparam(&rdev->wiphy, tx, tx_max, rx, rx_max);
2426 - trace_rdev_return_void_tx_rx(&rdev->wiphy, *tx, *tx_max, *rx, *rx_max);
2430 rdev_sched_scan_start(struct cfg80211_registered_device *rdev,
2431 struct net_device *dev,
2432 @@ -816,35 +797,6 @@ static inline int rdev_set_noack_map(str
2436 -rdev_get_et_sset_count(struct cfg80211_registered_device *rdev,
2437 - struct net_device *dev, int sset)
2440 - trace_rdev_get_et_sset_count(&rdev->wiphy, dev, sset);
2441 - ret = rdev->ops->get_et_sset_count(&rdev->wiphy, dev, sset);
2442 - trace_rdev_return_int(&rdev->wiphy, ret);
2446 -static inline void rdev_get_et_stats(struct cfg80211_registered_device *rdev,
2447 - struct net_device *dev,
2448 - struct ethtool_stats *stats, u64 *data)
2450 - trace_rdev_get_et_stats(&rdev->wiphy, dev);
2451 - rdev->ops->get_et_stats(&rdev->wiphy, dev, stats, data);
2452 - trace_rdev_return_void(&rdev->wiphy);
2455 -static inline void rdev_get_et_strings(struct cfg80211_registered_device *rdev,
2456 - struct net_device *dev, u32 sset,
2459 - trace_rdev_get_et_strings(&rdev->wiphy, dev, sset);
2460 - rdev->ops->get_et_strings(&rdev->wiphy, dev, sset, data);
2461 - trace_rdev_return_void(&rdev->wiphy);
2465 rdev_get_channel(struct cfg80211_registered_device *rdev,
2466 struct wireless_dev *wdev,
2467 struct cfg80211_chan_def *chandef)
2468 --- a/net/wireless/trace.h
2469 +++ b/net/wireless/trace.h
2470 @@ -298,11 +298,6 @@ DEFINE_EVENT(wiphy_only_evt, rdev_return
2474 -DEFINE_EVENT(wiphy_only_evt, rdev_get_ringparam,
2475 - TP_PROTO(struct wiphy *wiphy),
2479 DEFINE_EVENT(wiphy_only_evt, rdev_get_antenna,
2480 TP_PROTO(struct wiphy *wiphy),
2482 @@ -580,11 +575,6 @@ DEFINE_EVENT(wiphy_netdev_evt, rdev_stop
2483 TP_ARGS(wiphy, netdev)
2486 -DEFINE_EVENT(wiphy_netdev_evt, rdev_get_et_stats,
2487 - TP_PROTO(struct wiphy *wiphy, struct net_device *netdev),
2488 - TP_ARGS(wiphy, netdev)
2491 DEFINE_EVENT(wiphy_netdev_evt, rdev_sched_scan_stop,
2492 TP_PROTO(struct wiphy *wiphy, struct net_device *netdev),
2493 TP_ARGS(wiphy, netdev)
2494 @@ -1439,11 +1429,6 @@ DECLARE_EVENT_CLASS(tx_rx_evt,
2495 WIPHY_PR_ARG, __entry->tx, __entry->rx)
2498 -DEFINE_EVENT(tx_rx_evt, rdev_set_ringparam,
2499 - TP_PROTO(struct wiphy *wiphy, u32 tx, u32 rx),
2500 - TP_ARGS(wiphy, rx, tx)
2503 DEFINE_EVENT(tx_rx_evt, rdev_set_antenna,
2504 TP_PROTO(struct wiphy *wiphy, u32 tx, u32 rx),
2505 TP_ARGS(wiphy, rx, tx)
2506 @@ -1725,40 +1710,6 @@ TRACE_EVENT(rdev_set_noack_map,
2507 WIPHY_PR_ARG, NETDEV_PR_ARG, __entry->noack_map)
2510 -TRACE_EVENT(rdev_get_et_sset_count,
2511 - TP_PROTO(struct wiphy *wiphy, struct net_device *netdev, int sset),
2512 - TP_ARGS(wiphy, netdev, sset),
2516 - __field(int, sset)
2521 - __entry->sset = sset;
2523 - TP_printk(WIPHY_PR_FMT ", " NETDEV_PR_FMT ", sset: %d",
2524 - WIPHY_PR_ARG, NETDEV_PR_ARG, __entry->sset)
2527 -TRACE_EVENT(rdev_get_et_strings,
2528 - TP_PROTO(struct wiphy *wiphy, struct net_device *netdev, u32 sset),
2529 - TP_ARGS(wiphy, netdev, sset),
2533 - __field(u32, sset)
2538 - __entry->sset = sset;
2540 - TP_printk(WIPHY_PR_FMT ", " NETDEV_PR_FMT ", sset: %u",
2541 - WIPHY_PR_ARG, NETDEV_PR_ARG, __entry->sset)
2544 DEFINE_EVENT(wiphy_wdev_evt, rdev_get_channel,
2545 TP_PROTO(struct wiphy *wiphy, struct wireless_dev *wdev),
2546 TP_ARGS(wiphy, wdev)
2548 +++ b/net/mac80211/ethtool.c
2551 + * mac80211 ethtool hooks for cfg80211
2553 + * Copied from cfg.c - originally
2554 + * Copyright 2006-2010 Johannes Berg <johannes@sipsolutions.net>
2555 + * Copyright 2014 Intel Corporation (Author: Johannes Berg)
2557 + * This file is GPLv2 as found in COPYING.
2559 +#include <linux/types.h>
2560 +#include <net/cfg80211.h>
2561 +#include "ieee80211_i.h"
2562 +#include "sta_info.h"
2563 +#include "driver-ops.h"
2565 +static int ieee80211_set_ringparam(struct net_device *dev,
2566 + struct ethtool_ringparam *rp)
2568 + struct ieee80211_local *local = wiphy_priv(dev->ieee80211_ptr->wiphy);
2570 + if (rp->rx_mini_pending != 0 || rp->rx_jumbo_pending != 0)
2573 + return drv_set_ringparam(local, rp->tx_pending, rp->rx_pending);
2576 +static void ieee80211_get_ringparam(struct net_device *dev,
2577 + struct ethtool_ringparam *rp)
2579 + struct ieee80211_local *local = wiphy_priv(dev->ieee80211_ptr->wiphy);
2581 + memset(rp, 0, sizeof(*rp));
2583 + drv_get_ringparam(local, &rp->tx_pending, &rp->tx_max_pending,
2584 + &rp->rx_pending, &rp->rx_max_pending);
2587 +static const char ieee80211_gstrings_sta_stats[][ETH_GSTRING_LEN] = {
2588 + "rx_packets", "rx_bytes",
2589 + "rx_duplicates", "rx_fragments", "rx_dropped",
2590 + "tx_packets", "tx_bytes", "tx_fragments",
2591 + "tx_filtered", "tx_retry_failed", "tx_retries",
2592 + "beacon_loss", "sta_state", "txrate", "rxrate", "signal",
2593 + "channel", "noise", "ch_time", "ch_time_busy",
2594 + "ch_time_ext_busy", "ch_time_rx", "ch_time_tx"
2596 +#define STA_STATS_LEN ARRAY_SIZE(ieee80211_gstrings_sta_stats)
2598 +static int ieee80211_get_sset_count(struct net_device *dev, int sset)
2600 + struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev);
2603 + if (sset == ETH_SS_STATS)
2604 + rv += STA_STATS_LEN;
2606 + rv += drv_get_et_sset_count(sdata, sset);
2609 + return -EOPNOTSUPP;
2613 +static void ieee80211_get_stats(struct net_device *dev,
2614 + struct ethtool_stats *stats,
2617 + struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev);
2618 + struct ieee80211_chanctx_conf *chanctx_conf;
2619 + struct ieee80211_channel *channel;
2620 + struct sta_info *sta;
2621 + struct ieee80211_local *local = sdata->local;
2622 + struct station_info sinfo;
2623 + struct survey_info survey;
2625 +#define STA_STATS_SURVEY_LEN 7
2627 + memset(data, 0, sizeof(u64) * STA_STATS_LEN);
2629 +#define ADD_STA_STATS(sta) \
2631 + data[i++] += sta->rx_packets; \
2632 + data[i++] += sta->rx_bytes; \
2633 + data[i++] += sta->num_duplicates; \
2634 + data[i++] += sta->rx_fragments; \
2635 + data[i++] += sta->rx_dropped; \
2637 + data[i++] += sinfo.tx_packets; \
2638 + data[i++] += sinfo.tx_bytes; \
2639 + data[i++] += sta->tx_fragments; \
2640 + data[i++] += sta->tx_filtered_count; \
2641 + data[i++] += sta->tx_retry_failed; \
2642 + data[i++] += sta->tx_retry_count; \
2643 + data[i++] += sta->beacon_loss_count; \
2646 + /* For Managed stations, find the single station based on BSSID
2647 + * and use that. For interface types, iterate through all available
2648 + * stations and add stats for any station that is assigned to this
2652 + mutex_lock(&local->sta_mtx);
2654 + if (sdata->vif.type == NL80211_IFTYPE_STATION) {
2655 + sta = sta_info_get_bss(sdata, sdata->u.mgd.bssid);
2657 + if (!(sta && !WARN_ON(sta->sdata->dev != dev)))
2661 + sta_set_sinfo(sta, &sinfo);
2664 + ADD_STA_STATS(sta);
2666 + data[i++] = sta->sta_state;
2669 + if (sinfo.filled & STATION_INFO_TX_BITRATE)
2670 + data[i] = 100000 *
2671 + cfg80211_calculate_bitrate(&sinfo.txrate);
2673 + if (sinfo.filled & STATION_INFO_RX_BITRATE)
2674 + data[i] = 100000 *
2675 + cfg80211_calculate_bitrate(&sinfo.rxrate);
2678 + if (sinfo.filled & STATION_INFO_SIGNAL_AVG)
2679 + data[i] = (u8)sinfo.signal_avg;
2682 + list_for_each_entry(sta, &local->sta_list, list) {
2683 + /* Make sure this station belongs to the proper dev */
2684 + if (sta->sdata->dev != dev)
2688 + sta_set_sinfo(sta, &sinfo);
2690 + ADD_STA_STATS(sta);
2695 + i = STA_STATS_LEN - STA_STATS_SURVEY_LEN;
2696 + /* Get survey stats for current channel */
2697 + survey.filled = 0;
2700 + chanctx_conf = rcu_dereference(sdata->vif.chanctx_conf);
2702 + channel = chanctx_conf->def.chan;
2705 + rcu_read_unlock();
2710 + survey.filled = 0;
2711 + if (drv_get_survey(local, q, &survey) != 0) {
2712 + survey.filled = 0;
2716 + } while (channel != survey.channel);
2719 + if (survey.filled)
2720 + data[i++] = survey.channel->center_freq;
2723 + if (survey.filled & SURVEY_INFO_NOISE_DBM)
2724 + data[i++] = (u8)survey.noise;
2727 + if (survey.filled & SURVEY_INFO_CHANNEL_TIME)
2728 + data[i++] = survey.channel_time;
2731 + if (survey.filled & SURVEY_INFO_CHANNEL_TIME_BUSY)
2732 + data[i++] = survey.channel_time_busy;
2735 + if (survey.filled & SURVEY_INFO_CHANNEL_TIME_EXT_BUSY)
2736 + data[i++] = survey.channel_time_ext_busy;
2739 + if (survey.filled & SURVEY_INFO_CHANNEL_TIME_RX)
2740 + data[i++] = survey.channel_time_rx;
2743 + if (survey.filled & SURVEY_INFO_CHANNEL_TIME_TX)
2744 + data[i++] = survey.channel_time_tx;
2748 + mutex_unlock(&local->sta_mtx);
2750 + if (WARN_ON(i != STA_STATS_LEN))
2753 + drv_get_et_stats(sdata, stats, &(data[STA_STATS_LEN]));
2756 +static void ieee80211_get_strings(struct net_device *dev, u32 sset, u8 *data)
2758 + struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev);
2759 + int sz_sta_stats = 0;
2761 + if (sset == ETH_SS_STATS) {
2762 + sz_sta_stats = sizeof(ieee80211_gstrings_sta_stats);
2763 + memcpy(data, ieee80211_gstrings_sta_stats, sz_sta_stats);
2765 + drv_get_et_strings(sdata, sset, &(data[sz_sta_stats]));
2768 +static int ieee80211_get_regs_len(struct net_device *dev)
2773 +static void ieee80211_get_regs(struct net_device *dev,
2774 + struct ethtool_regs *regs,
2777 + struct wireless_dev *wdev = dev->ieee80211_ptr;
2779 + regs->version = wdev->wiphy->hw_version;
2783 +const struct ethtool_ops ieee80211_ethtool_ops = {
2784 + .get_drvinfo = cfg80211_get_drvinfo,
2785 + .get_regs_len = ieee80211_get_regs_len,
2786 + .get_regs = ieee80211_get_regs,
2787 + .get_link = ethtool_op_get_link,
2788 + .get_ringparam = ieee80211_get_ringparam,
2789 + .set_ringparam = ieee80211_set_ringparam,
2790 + .get_strings = ieee80211_get_strings,
2791 + .get_ethtool_stats = ieee80211_get_stats,
2792 + .get_sset_count = ieee80211_get_sset_count,
2794 --- a/net/mac80211/ibss.c
2795 +++ b/net/mac80211/ibss.c
2796 @@ -143,7 +143,7 @@ ieee80211_ibss_build_presp(struct ieee80
2797 *pos++ = csa_settings->block_tx ? 1 : 0;
2798 *pos++ = ieee80211_frequency_to_channel(
2799 csa_settings->chandef.chan->center_freq);
2800 - sdata->csa_counter_offset_beacon[0] = (pos - presp->head);
2801 + presp->csa_counter_offsets[0] = (pos - presp->head);
2802 *pos++ = csa_settings->count;
2805 @@ -1677,6 +1677,7 @@ int ieee80211_ibss_join(struct ieee80211
2806 sdata->u.ibss.control_port = params->control_port;
2807 sdata->u.ibss.userspace_handles_dfs = params->userspace_handles_dfs;
2808 sdata->u.ibss.basic_rates = params->basic_rates;
2809 + sdata->u.ibss.last_scan_completed = jiffies;
2811 /* fix basic_rates if channel does not support these rates */
2812 rate_flags = ieee80211_chandef_rate_flags(¶ms->chandef);
2813 --- a/net/mac80211/mesh.c
2814 +++ b/net/mac80211/mesh.c
2815 @@ -679,7 +679,7 @@ ieee80211_mesh_build_beacon(struct ieee8
2817 *pos++ = ieee80211_frequency_to_channel(
2818 csa->settings.chandef.chan->center_freq);
2819 - sdata->csa_counter_offset_beacon[0] = hdr_len + 6;
2820 + bcn->csa_counter_offsets[0] = hdr_len + 6;
2821 *pos++ = csa->settings.count;
2822 *pos++ = WLAN_EID_CHAN_SWITCH_PARAM;
2824 --- a/net/wireless/genregdb.awk
2825 +++ b/net/wireless/genregdb.awk
2826 @@ -65,17 +65,7 @@ function parse_reg_rule()
2829 if (units == "mW") {
2830 - if (power == 100) {
2832 - } else if (power == 200) {
2834 - } else if (power == 500) {
2836 - } else if (power == 1000) {
2839 - print "Unknown power value in database!"
2841 + power = 10 * log(power)/log(10)
2845 @@ -114,7 +104,7 @@ function parse_reg_rule()
2849 - printf "\t\tREG_RULE_EXT(%d, %d, %d, %d, %d, %d, %s),\n", start, end, bw, gain, power, dfs_cac, flags
2850 + printf "\t\tREG_RULE_EXT(%d, %d, %d, %d, %.0f, %d, %s),\n", start, end, bw, gain, power, dfs_cac, flags
2854 --- a/net/mac80211/debugfs_netdev.c
2855 +++ b/net/mac80211/debugfs_netdev.c
2856 @@ -34,8 +34,7 @@ static ssize_t ieee80211_if_read(
2857 ssize_t ret = -EINVAL;
2859 read_lock(&dev_base_lock);
2860 - if (sdata->dev->reg_state == NETREG_REGISTERED)
2861 - ret = (*format)(sdata, buf, sizeof(buf));
2862 + ret = (*format)(sdata, buf, sizeof(buf));
2863 read_unlock(&dev_base_lock);
2866 @@ -62,8 +61,7 @@ static ssize_t ieee80211_if_write(
2870 - if (sdata->dev->reg_state == NETREG_REGISTERED)
2871 - ret = (*write)(sdata, buf, count);
2872 + ret = (*write)(sdata, buf, count);
2876 --- a/drivers/net/wireless/b43/xmit.c
2877 +++ b/drivers/net/wireless/b43/xmit.c
2878 @@ -811,9 +811,13 @@ void b43_rx(struct b43_wldev *dev, struc
2881 status.band = IEEE80211_BAND_2GHZ;
2882 - /* chanid is the radio channel cookie value as used
2883 - * to tune the radio. */
2884 - status.freq = chanid + 2400;
2885 + /* Somewhere between 478.104 and 508.1084 firmware for G-PHY
2886 + * has been modified to be compatible with N-PHY and others.
2888 + if (dev->fw.rev >= 508)
2889 + status.freq = ieee80211_channel_to_frequency(chanid, status.band);
2891 + status.freq = chanid + 2400;
2894 case B43_PHYTYPE_LP:
2895 --- a/drivers/net/wireless/b43/main.c
2896 +++ b/drivers/net/wireless/b43/main.c
2897 @@ -5216,6 +5216,7 @@ static int b43_wireless_core_attach(stru
2898 /* We don't support 5 GHz on some PHYs yet */
2899 switch (dev->phy.type) {
2901 + case B43_PHYTYPE_G:
2903 case B43_PHYTYPE_LP:
2904 case B43_PHYTYPE_HT:
2905 --- a/net/wireless/reg.c
2906 +++ b/net/wireless/reg.c
2907 @@ -935,7 +935,7 @@ freq_reg_info_regd(struct wiphy *wiphy,
2908 if (!band_rule_found)
2909 band_rule_found = freq_in_rule_band(fr, center_freq);
2911 - bw_fits = reg_does_bw_fit(fr, center_freq, MHZ_TO_KHZ(5));
2912 + bw_fits = reg_does_bw_fit(fr, center_freq, MHZ_TO_KHZ(20));
2914 if (band_rule_found && bw_fits)
2916 @@ -1019,10 +1019,10 @@ static void chan_reg_rule_print_dbg(cons
2920 -/* Find an ieee80211_reg_rule such that a 5MHz channel with frequency
2921 - * chan->center_freq fits there.
2922 - * If there is no such reg_rule, disable the channel, otherwise set the
2923 - * flags corresponding to the bandwidths allowed in the particular reg_rule
2925 + * Note that right now we assume the desired channel bandwidth
2926 + * is always 20 MHz for each individual channel (HT40 uses 20 MHz
2927 + * per channel, the primary and the extension channel).
2929 static void handle_channel(struct wiphy *wiphy,
2930 enum nl80211_reg_initiator initiator,
2931 @@ -1083,12 +1083,8 @@ static void handle_channel(struct wiphy
2932 if (reg_rule->flags & NL80211_RRF_AUTO_BW)
2933 max_bandwidth_khz = reg_get_max_bandwidth(regd, reg_rule);
2935 - if (max_bandwidth_khz < MHZ_TO_KHZ(10))
2936 - bw_flags = IEEE80211_CHAN_NO_10MHZ;
2937 - if (max_bandwidth_khz < MHZ_TO_KHZ(20))
2938 - bw_flags |= IEEE80211_CHAN_NO_20MHZ;
2939 if (max_bandwidth_khz < MHZ_TO_KHZ(40))
2940 - bw_flags |= IEEE80211_CHAN_NO_HT40;
2941 + bw_flags = IEEE80211_CHAN_NO_HT40;
2942 if (max_bandwidth_khz < MHZ_TO_KHZ(80))
2943 bw_flags |= IEEE80211_CHAN_NO_80MHZ;
2944 if (max_bandwidth_khz < MHZ_TO_KHZ(160))
2945 @@ -1522,12 +1518,8 @@ static void handle_channel_custom(struct
2946 if (reg_rule->flags & NL80211_RRF_AUTO_BW)
2947 max_bandwidth_khz = reg_get_max_bandwidth(regd, reg_rule);
2949 - if (max_bandwidth_khz < MHZ_TO_KHZ(10))
2950 - bw_flags = IEEE80211_CHAN_NO_10MHZ;
2951 - if (max_bandwidth_khz < MHZ_TO_KHZ(20))
2952 - bw_flags |= IEEE80211_CHAN_NO_20MHZ;
2953 if (max_bandwidth_khz < MHZ_TO_KHZ(40))
2954 - bw_flags |= IEEE80211_CHAN_NO_HT40;
2955 + bw_flags = IEEE80211_CHAN_NO_HT40;
2956 if (max_bandwidth_khz < MHZ_TO_KHZ(80))
2957 bw_flags |= IEEE80211_CHAN_NO_80MHZ;
2958 if (max_bandwidth_khz < MHZ_TO_KHZ(160))
2959 --- a/drivers/net/wireless/ath/ath9k/ath9k.h
2960 +++ b/drivers/net/wireless/ath/ath9k/ath9k.h
2961 @@ -185,7 +185,8 @@ struct ath_atx_ac {
2963 struct ath_frame_info {
2968 enum ath9k_key_type keytype;
2971 --- a/drivers/net/wireless/ath/ath9k/xmit.c
2972 +++ b/drivers/net/wireless/ath/ath9k/xmit.c
2973 @@ -147,15 +147,13 @@ static void ath_set_rates(struct ieee802
2974 static void ath_txq_skb_done(struct ath_softc *sc, struct ath_txq *txq,
2975 struct sk_buff *skb)
2979 - q = skb_get_queue_mapping(skb);
2980 - if (txq == sc->tx.uapsdq)
2981 - txq = sc->tx.txq_map[q];
2982 + struct ath_frame_info *fi = get_frame_info(skb);
2985 - if (txq != sc->tx.txq_map[q])
2989 + txq = sc->tx.txq_map[q];
2990 if (WARN_ON(--txq->pending_frames < 0))
2991 txq->pending_frames = 0;
2993 @@ -1999,6 +1997,7 @@ static void setup_frame_info(struct ieee
2994 an = (struct ath_node *) sta->drv_priv;
2996 memset(fi, 0, sizeof(*fi));
2999 fi->keyix = hw_key->hw_key_idx;
3000 else if (an && ieee80211_is_data(hdr->frame_control) && an->ps_key > 0)
3001 @@ -2150,6 +2149,7 @@ int ath_tx_start(struct ieee80211_hw *hw
3002 struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
3003 struct ieee80211_sta *sta = txctl->sta;
3004 struct ieee80211_vif *vif = info->control.vif;
3005 + struct ath_frame_info *fi = get_frame_info(skb);
3006 struct ath_softc *sc = hw->priv;
3007 struct ath_txq *txq = txctl->txq;
3008 struct ath_atx_tid *tid = NULL;
3009 @@ -2170,11 +2170,13 @@ int ath_tx_start(struct ieee80211_hw *hw
3010 q = skb_get_queue_mapping(skb);
3012 ath_txq_lock(sc, txq);
3013 - if (txq == sc->tx.txq_map[q] &&
3014 - ++txq->pending_frames > sc->tx.txq_max_pending[q] &&
3016 - ieee80211_stop_queue(sc->hw, q);
3017 - txq->stopped = true;
3018 + if (txq == sc->tx.txq_map[q]) {
3020 + if (++txq->pending_frames > sc->tx.txq_max_pending[q] &&
3022 + ieee80211_stop_queue(sc->hw, q);
3023 + txq->stopped = true;
3027 if (txctl->an && ieee80211_is_data_present(hdr->frame_control))