1 commit c0ee7fa4c0da824ccccc172bf175fb1f86540921
2 Author: Felix Fietkau <nbd@openwrt.org>
3 Date: Wed Jul 16 18:00:31 2014 +0200
5 ath9k: fix pending tx frames accounting
7 Packets originally buffered for the regular hardware tx queues can end
8 up being transmitted through the U-APSD queue (via PS-Poll or U-APSD).
9 When packets are dropped due to retransmit failures, the pending frames
10 counter is not always updated properly.
11 Fix this by keeping track of the queue that a frame was accounted for in
12 the ath_frame_info struct, and using that on completion to decide
13 whether the counter should be updated.
14 This fixes some spurious transmit queue hangs.
16 Cc: stable@vger.kernel.org
17 Signed-off-by: Felix Fietkau <nbd@openwrt.org>
19 commit edcdf0989410a05a6a4b8438df4010447eaa7d9a
20 Author: Felix Fietkau <nbd@openwrt.org>
21 Date: Sun Jun 22 13:36:20 2014 +0200
23 Revert "cfg80211: Use 5MHz bandwidth by default when checking usable channels"
25 It enables channels that are not supposed to be enabled according to the
28 This reverts commit 8eca1fb692cc9557f386eddce75c300a3855d11a.
30 commit 6e7341074823d2a45b81f2742cbf75f1da790031
31 Author: Rafał Miłecki <zajec5@gmail.com>
32 Date: Sat May 31 19:40:45 2014 +0200
34 b43: disable 5 GHz on G-PHY
36 This fixes regression introduced by adding some G-PHY devices to the
37 list of dual band devices. There is simply no support for 5 GHz on
38 G-PHY devices in b43. It results in:
39 WARNING: CPU: 0 PID: 79 at drivers/net/wireless/b43/phy_g.c:75 b43_gphy_channel_switch+0x125/0x130 [b43]()
40 b43-phy1 ERROR: PHY init: Channel switch to default failed
42 Regression was introduced by the following commit:
44 commit 773cfc508f4d64c14547ff8751b5cbd473124364
45 Author: Rafał Miłecki <zajec5@gmail.com>
46 Date: Mon May 19 23:18:55 2014 +0200
48 b43: add more devices to the bands database
50 Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
51 Signed-off-by: John W. Linville <linville@tuxdriver.com>
53 commit 1186edbef91f15722e5bdf56326ce0abc2935ce7
54 Author: Stanislaw Gruszka <sgruszka@redhat.com>
55 Date: Tue Jun 10 12:51:06 2014 +0200
57 rt2x00: disable TKIP on USB
59 On USB we can not get atomically TKIP key. We have to disable support
60 for TKIP acceleration on USB hardware to avoid bug as showed bellow.
62 [ 860.827243] BUG: scheduling while atomic: hostapd/3397/0x00000002
64 [ 860.827280] Call Trace:
65 [ 860.827282] [<ffffffff81682ea6>] dump_stack+0x4d/0x66
66 [ 860.827284] [<ffffffff8167eb9b>] __schedule_bug+0x47/0x55
67 [ 860.827285] [<ffffffff81685bb3>] __schedule+0x733/0x7b0
68 [ 860.827287] [<ffffffff81685c59>] schedule+0x29/0x70
69 [ 860.827289] [<ffffffff81684f8a>] schedule_timeout+0x15a/0x2b0
70 [ 860.827291] [<ffffffff8105ac50>] ? ftrace_raw_event_tick_stop+0xc0/0xc0
71 [ 860.827294] [<ffffffff810c13c2>] ? __module_text_address+0x12/0x70
72 [ 860.827296] [<ffffffff81686823>] wait_for_completion_timeout+0xb3/0x140
73 [ 860.827298] [<ffffffff81080fc0>] ? wake_up_state+0x20/0x20
74 [ 860.827301] [<ffffffff814d5b3d>] usb_start_wait_urb+0x7d/0x150
75 [ 860.827303] [<ffffffff814d5cd5>] usb_control_msg+0xc5/0x110
76 [ 860.827305] [<ffffffffa02fb0c6>] rt2x00usb_vendor_request+0xc6/0x160 [rt2x00usb]
77 [ 860.827307] [<ffffffffa02fb215>] rt2x00usb_vendor_req_buff_lock+0x75/0x150 [rt2x00usb]
78 [ 860.827309] [<ffffffffa02fb393>] rt2x00usb_vendor_request_buff+0xa3/0xe0 [rt2x00usb]
79 [ 860.827311] [<ffffffffa023d1a3>] rt2x00usb_register_multiread+0x33/0x40 [rt2800usb]
80 [ 860.827314] [<ffffffffa05805f9>] rt2800_get_tkip_seq+0x39/0x50 [rt2800lib]
81 [ 860.827321] [<ffffffffa0480f88>] ieee80211_get_key+0x218/0x2a0 [mac80211]
82 [ 860.827322] [<ffffffff815cc68c>] ? __nlmsg_put+0x6c/0x80
83 [ 860.827329] [<ffffffffa051b02e>] nl80211_get_key+0x22e/0x360 [cfg80211]
85 Cc: stable@vger.kernel.org
86 Reported-and-tested-by: Peter Wu <lekensteyn@gmail.com>
87 Reported-and-tested-by: Pontus Fuchs <pontus.fuchs@gmail.com>
88 Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com>
89 Signed-off-by: John W. Linville <linville@tuxdriver.com>
91 commit 5f313a15da92dda80ac4c9a137bc42d7d0b49adf
92 Author: Rafał Miłecki <zajec5@gmail.com>
93 Date: Thu Jun 12 09:28:38 2014 +0200
95 b43: fix frequency reported on G-PHY with /new/ firmware
97 commit d3a58df87a2e4c2301ac843604202d290a48440b
98 Author: Avraham Stern <avraham.stern@intel.com>
99 Date: Thu May 22 12:17:47 2014 +0300
101 mac80211: set new interfaces as idle upon init
103 Mark new interfaces as idle to allow operations that require that
104 interfaces are idle to take place. Interface types that are always
105 not idle (like AP interfaces) will be set as not idle when they are
106 assigned a channel context.
108 Signed-off-by: Avraham Stern <avraham.stern@intel.com>
109 Signed-off-by: Emmanuel Grumbach<emmanuel.grumbach@intel.com>
110 Signed-off-by: Johannes Berg <johannes.berg@intel.com>
112 commit 923eaf367206e01f22c97aee22300e332d071916
113 Author: Arik Nemtsov <arik@wizery.com>
114 Date: Mon May 26 14:40:51 2014 +0300
116 mac80211: don't check netdev state for debugfs read/write
118 Doing so will lead to an oops for a p2p-dev interface, since it has
121 Cc: stable@vger.kernel.org
122 Signed-off-by: Arik Nemtsov <arikx.nemtsov@intel.com>
123 Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
124 Signed-off-by: Johannes Berg <johannes.berg@intel.com>
126 commit a9fb54169b197f31aff24c8d6270dd1e56cde395
127 Author: chaitanya.mgit@gmail.com <chaitanya.mgit@gmail.com>
128 Date: Mon May 26 18:01:44 2014 +0530
130 regdb: Generalize the mW to dBm power conversion
132 Generalize the power conversion from mW to dBm
133 using log. This should fix the below compilation
134 error for country NO which adds a new power value
135 2000mW which is not handled earlier.
137 CC [M] net/wireless/wext-sme.o
138 CC [M] net/wireless/regdb.o
139 net/wireless/regdb.c:1130:1: error: Unknown undeclared here (not in
141 net/wireless/regdb.c:1130:9: error: expected } before power
142 make[2]: *** [net/wireless/regdb.o] Error 1
143 make[1]: *** [net/wireless] Error 2
144 make: *** [net] Error 2
146 Reported-By: John Walker <john@x109.net>
147 Signed-off-by: Chaitanya T K <chaitanya.mgit@gmail.com>
148 Acked-by: John W. Linville <linville@tuxdriver.com>
149 [remove unneeded parentheses, fix rounding by using %.0f]
150 Signed-off-by: Johannes Berg <johannes.berg@intel.com>
152 commit c7d37a66e345df2fdf1aa7b2c9a6d3d53846ca5b
153 Author: Krzysztof Hałasa <khalasa@piap.pl>
154 Date: Mon May 26 14:14:46 2014 +0200
156 mac80211: fix IBSS join by initializing last_scan_completed
158 Without this fix, freshly rebooted Linux creates a new IBSS
159 instead of joining an existing one. Only when jiffies counter
160 overflows after 5 minutes the IBSS can be successfully joined.
162 Signed-off-by: Krzysztof Hałasa <khalasa@piap.pl>
163 [edit commit message slightly]
164 Cc: stable@vger.kernel.org
165 Signed-off-by: Johannes Berg <johannes.berg@intel.com>
167 commit 34171dc0d623be2c1032416bf7d3819f388ed70d
168 Author: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
169 Date: Sun May 25 15:35:41 2014 +0300
171 mac80211: fix virtual monitor interface addition
173 Since the commit below, cfg80211_chandef_dfs_required()
174 will warn if it gets a an NL80211_IFTYPE_UNSPECIFIED iftype
175 as explicitely written in the commit log.
176 When an virtual monitor interface is added, its type is set
177 in ieee80211_sub_if_data.vif.type, but not in
178 ieee80211_sub_if_data.wdev.iftype which is passed to
179 cfg80211_chandef_dfs_required() hence resulting in the
182 WARNING: CPU: 1 PID: 21265 at net/wireless/chan.c:376 cfg80211_chandef_dfs_required+0xbc/0x130 [cfg80211]()
183 Modules linked in: [...]
184 CPU: 1 PID: 21265 Comm: ifconfig Tainted: G W O 3.13.11+ #12
185 Hardware name: Dell Inc. Latitude E6410/0667CC, BIOS A01 03/05/2010
186 0000000000000009 ffff88008f5fdb08 ffffffff817d4219 ffff88008f5fdb50
187 ffff88008f5fdb40 ffffffff8106f57d 0000000000000000 0000000000000000
188 ffff880081062fb8 ffff8800810604e0 0000000000000001 ffff88008f5fdba0
190 [<ffffffff817d4219>] dump_stack+0x4d/0x66
191 [<ffffffff8106f57d>] warn_slowpath_common+0x7d/0xa0
192 [<ffffffff8106f5ec>] warn_slowpath_fmt+0x4c/0x50
193 [<ffffffffa04ea4ec>] cfg80211_chandef_dfs_required+0xbc/0x130 [cfg80211]
194 [<ffffffffa06b1024>] ieee80211_vif_use_channel+0x94/0x500 [mac80211]
195 [<ffffffffa0684e6b>] ieee80211_add_virtual_monitor+0x1ab/0x5c0 [mac80211]
196 [<ffffffffa0686ae5>] ieee80211_do_open+0xe75/0x1580 [mac80211]
197 [<ffffffffa0687259>] ieee80211_open+0x69/0x70 [mac80211]
200 Fixes: 00ec75fc5a64 ("cfg80211: pass the actual iftype when calling cfg80211_chandef_dfs_required()")
201 Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
202 Acked-by: Luciano Coelho <luciano.coelho@intel.com>
203 Signed-off-by: Johannes Berg <johannes.berg@intel.com>
205 commit d93cc72b37b4e2c314e1c499e80e8801907c2fea
206 Author: Michal Kazior <michal.kazior@tieto.com>
207 Date: Thu Jun 5 14:21:37 2014 +0200
209 mac80211: use csa counter offsets instead of csa_active
211 vif->csa_active is protected by mutexes only. This
212 means it is unreliable to depend on it on codeflow
213 in non-sleepable beacon and CSA code. There was no
214 guarantee to have vif->csa_active update be
215 visible before beacons are updated on SMP systems.
217 Using csa counter offsets which are embedded in
218 beacon struct (and thus are protected with single
219 RCU assignment) is much safer.
221 Signed-off-by: Michal Kazior <michal.kazior@tieto.com>
222 Signed-off-by: Johannes Berg <johannes.berg@intel.com>
224 commit d2746694fcdef24e0a7a1947d8c70082cde81a26
225 Author: Michal Kazior <michal.kazior@tieto.com>
226 Date: Thu Jun 5 14:21:36 2014 +0200
228 mac80211: move csa counters from sdata to beacon/presp
230 Having csa counters part of beacon and probe_resp
231 structures makes it easier to get rid of possible
232 races between setting a beacon and updating
233 counters on SMP systems by guaranteeing counters
234 are always consistent against given beacon struct.
236 While at it relax WARN_ON into WARN_ON_ONCE to
237 prevent spamming logs and racing.
239 Signed-off-by: Michal Kazior <michal.kazior@tieto.com>
240 Signed-off-by: Johannes Berg <johannes.berg@intel.com>
242 commit 5dcb54f3a1a8cd7e0331e773487574f9743615db
243 Author: Janusz Dziedzic <janusz.dziedzic@tieto.com>
244 Date: Thu Jun 5 08:12:57 2014 +0200
246 mac80211: allow tx via monitor iface when DFS
248 Allow send frames using monitor interface
249 when DFS chandef and we pass CAC (beaconing
252 This fix problem when old kernel and new backports used,
253 in such case hostapd create/use also monitor interface.
254 Before this patch all frames hostapd send using monitor
255 iface were dropped when AP was configured on DFS channel.
257 Signed-off-by: Janusz Dziedzic <janusz.dziedzic@tieto.com>
258 Signed-off-by: Johannes Berg <johannes.berg@intel.com>
260 commit 6f09a1beb0d2007572248c986780562219bd206f
261 Author: Johannes Berg <johannes.berg@intel.com>
262 Date: Wed Jun 4 17:31:56 2014 +0200
264 cfg80211: make ethtool the driver's responsibility
266 Currently, cfg80211 tries to implement ethtool, but that doesn't
267 really scale well, with all the different operations. Make the
268 lower-level driver responsible for it, which currently only has
269 an effect on mac80211. It will similarly not scale well at that
270 level though, since mac80211 also has many drivers.
272 To cleanly implement this in mac80211, introduce a new file and
273 move some code to appropriate places.
275 Signed-off-by: Johannes Berg <johannes.berg@intel.com>
277 commit 6b0c6f133de8f90caeb1c4a902e6140567c5bf96
278 Author: Johannes Berg <johannes.berg@intel.com>
279 Date: Wed Jun 4 17:06:23 2014 +0200
281 mac80211: remove weak WEP IV accounting
283 Since WEP is practically dead, there seems very little
284 point in keeping WEP weak IV accounting.
286 Signed-off-by: Johannes Berg <johannes.berg@intel.com>
288 commit aecdc89fb4664c76baa4bbd46008f220532309ff
289 Author: Luciano Coelho <luciano.coelho@intel.com>
290 Date: Fri May 23 11:04:50 2014 +0300
292 ath9k/ath10k: remove unnecessary channel_switch_beacon callbacks
294 The channel_switch_beacon callback is optional, so it doesn't have to
295 be defined if it's not going to do anything useful with it. Both
296 ath9k and ath10k define the callback and just returns. This commit
299 Cc: Michal Kazior <michal.kazior@tieto.com>
300 Signed-off-by: Luciano Coelho <luciano.coelho@intel.com>
301 Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
303 commit 60ccc107c9b9fb732fdee1f76bb2dad44f0e1798
304 Author: Rajkumar Manoharan <rmanohar@qti.qualcomm.com>
305 Date: Tue May 27 16:58:02 2014 +0530
307 ath9k: Fix deadlock while updating p2p beacon timer
309 pm_lock is taken twice while syncing HW TSF of p2p vif.
310 Fix this by taking the lock at caller side.
312 Cc: Felix Fietkau <nbd@openwrt.org>
313 Signed-off-by: Rajkumar Manoharan <rmanohar@qti.qualcomm.com>
314 Signed-off-by: John W. Linville <linville@tuxdriver.com>
316 commit f3831a4e3903dbc1a57d5df56deb6a143fd001bc
317 Author: Stanislaw Gruszka <sgruszka@redhat.com>
318 Date: Thu Jun 5 13:52:27 2014 +0200
320 rt2x00: do not initialize BCN_OFFSET registers
322 We setup BCN_OFFSET{0,1} registers dynamically, don't have to
325 Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com>
327 commit e5c58ca7a48d4c82f282749a978052c47fd95998
328 Author: Stanislaw Gruszka <sgruszka@redhat.com>
329 Date: Thu Jun 5 13:52:26 2014 +0200
331 rt2x00: change order when stop beaconing
333 When no beaconing is needed, first stop beacon queue (disable beaconing
334 globally) to avoid possible sending of not prepared beacon on short
335 period after clearing beacon and before stop of BCN queue.
337 Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com>
339 commit 382c1b9e03f52d0cd741ef1d942cad0f649f0744
340 Author: Stanislaw Gruszka <sgruszka@redhat.com>
341 Date: Thu Jun 5 13:52:25 2014 +0200
343 rt2x00: change default MAC_BSSID_DW1_BSS_BCN_NUM
345 We setup MAC_BSSID_DW1_BSS_BCN_NUM dynamically when numbers of active
346 beacons increase. Change default to 0 to tell hardware that we want to
347 send only one beacon as default.
349 Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com>
351 commit 3b400571dd033e46fa7e76c5bb92a3ce8198afa9
352 Author: Stanislaw Gruszka <sgruszka@redhat.com>
353 Date: Thu Jun 5 13:52:24 2014 +0200
355 rt2x00: change beaconing setup on RT2800
357 As reported by Matthias, on 5572 chip, even if we clear up TXWI
358 of corresponding beacon, hardware still try to send it or do other
359 action that increase power consumption peak up to 1A.
361 To avoid the issue, setup beaconing dynamically by configuring offsets
362 of currently active beacons and MAC_BSSID_DW1_BSS_BCN_NUM variable,
363 which limit number of beacons that hardware will try to send.
365 Reported-by: Matthias Fend <Matthias.Fend@wolfvision.net>
366 Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com>
368 commit 916e591b2cc41f7e572992175ca56d866d7bc958
369 Author: Stanislaw Gruszka <sgruszka@redhat.com>
370 Date: Thu Jun 5 13:52:23 2014 +0200
372 rt2x00: change beaconing locking
374 This patch is needed for further changes to keep global variables
375 consistent when changing beaconing on diffrent vif's.
377 Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com>
379 commit 930b0dffd1731f3f418f9132faea720a23b7af61
380 Author: Johannes Berg <johannes.berg@intel.com>
381 Date: Tue Jun 3 11:18:47 2014 +0200
383 mac80211: fix station/driver powersave race
385 It is currently possible to have a race due to the station PS
386 unblock work like this:
387 * station goes to sleep with frames buffered in the driver
388 * driver blocks wakeup
389 * station wakes up again
390 * driver flushes/returns frames, and unblocks, which schedules
392 * unblock work starts to run, and checks that the station is
393 awake (i.e. that the WLAN_STA_PS_STA flag isn't set)
394 * we process a received frame with PM=1, setting the flag again
395 * ieee80211_sta_ps_deliver_wakeup() runs, delivering all frames
396 to the driver, and then clearing the WLAN_STA_PS_DRIVER and
397 WLAN_STA_PS_STA flags
399 In this scenario, mac80211 will think that the station is awake,
400 while it really is asleep, and any TX'ed frames should be filtered
401 by the device (it will know that the station is sleeping) but then
402 passed to mac80211 again, which will not buffer it either as it
403 thinks the station is awake, and eventually the packets will be
406 Fix this by moving the clearing of the flags to exactly where we
407 learn about the situation. This creates a problem of reordering,
408 so introduce another flag indicating that delivery is being done,
409 this new flag also queues frames and is cleared only while the
410 spinlock is held (which the queuing code also holds) so that any
411 concurrent delivery/TX is handled correctly.
413 Reported-by: Andrei Otcheretianski <andrei.otcheretianski@intel.com>
414 Signed-off-by: Johannes Berg <johannes.berg@intel.com>
416 commit 6df35206bc6c1c6aad1d8077df5786b4a7f77873
417 Author: Felix Fietkau <nbd@openwrt.org>
418 Date: Fri May 23 19:58:14 2014 +0200
420 mac80211: reduce packet loss notifications under load
422 During strong signal fluctuations under high throughput, few consecutive
423 failed A-MPDU transmissions can easily trigger packet loss notification,
424 and thus (in AP mode) client disconnection.
426 Reduce the number of false positives by checking the A-MPDU status flag
427 and treating a failed A-MPDU as a single packet.
429 Signed-off-by: Felix Fietkau <nbd@openwrt.org>
431 commit 7b7843a36fbcc568834404c7430ff895d8502131
432 Author: Felix Fietkau <nbd@openwrt.org>
433 Date: Fri May 23 19:26:32 2014 +0200
435 mac80211: fix a memory leak on sta rate selection table
437 Cc: stable@vger.kernel.org
438 Reported-by: Christophe Prévotaux <cprevotaux@nltinc.com>
439 Signed-off-by: Felix Fietkau <nbd@openwrt.org>
441 commit 96892d6aa0a153423070addf3070bc79578b3897
442 Author: Felix Fietkau <nbd@openwrt.org>
443 Date: Mon May 19 21:20:49 2014 +0200
445 ath9k: avoid passing buffers to the hardware during flush
447 The commit "ath9k: fix possible hang on flush" changed the receive code
448 to always link rx descriptors of processed frames, even when flushing.
449 In some cases, this leads to flushed rx buffers being passed to the
450 hardware while rx is already stopped.
452 Signed-off-by: Felix Fietkau <nbd@openwrt.org>
454 --- a/drivers/net/wireless/ath/ath9k/recv.c
455 +++ b/drivers/net/wireless/ath/ath9k/recv.c
456 @@ -34,7 +34,8 @@ static inline bool ath9k_check_auto_slee
457 * buffer (or rx fifo). This can incorrectly acknowledge packets
458 * to a sender if last desc is self-linked.
460 -static void ath_rx_buf_link(struct ath_softc *sc, struct ath_rxbuf *bf)
461 +static void ath_rx_buf_link(struct ath_softc *sc, struct ath_rxbuf *bf,
464 struct ath_hw *ah = sc->sc_ah;
465 struct ath_common *common = ath9k_hw_common(ah);
466 @@ -59,18 +60,19 @@ static void ath_rx_buf_link(struct ath_s
470 - if (sc->rx.rxlink == NULL)
471 - ath9k_hw_putrxbuf(ah, bf->bf_daddr);
474 *sc->rx.rxlink = bf->bf_daddr;
476 + ath9k_hw_putrxbuf(ah, bf->bf_daddr);
478 sc->rx.rxlink = &ds->ds_link;
481 -static void ath_rx_buf_relink(struct ath_softc *sc, struct ath_rxbuf *bf)
482 +static void ath_rx_buf_relink(struct ath_softc *sc, struct ath_rxbuf *bf,
486 - ath_rx_buf_link(sc, sc->rx.buf_hold);
487 + ath_rx_buf_link(sc, sc->rx.buf_hold, flush);
489 sc->rx.buf_hold = bf;
491 @@ -442,7 +444,7 @@ int ath_startrecv(struct ath_softc *sc)
492 sc->rx.buf_hold = NULL;
493 sc->rx.rxlink = NULL;
494 list_for_each_entry_safe(bf, tbf, &sc->rx.rxbuf, list) {
495 - ath_rx_buf_link(sc, bf);
496 + ath_rx_buf_link(sc, bf, false);
499 /* We could have deleted elements so the list may be empty now */
500 @@ -1118,12 +1120,12 @@ requeue_drop_frag:
502 list_add_tail(&bf->list, &sc->rx.rxbuf);
505 - ath_rx_edma_buf_link(sc, qtype);
507 - ath_rx_buf_relink(sc, bf);
509 + ath_rx_buf_relink(sc, bf, flush);
512 + } else if (!flush) {
513 + ath_rx_edma_buf_link(sc, qtype);
517 --- a/net/mac80211/sta_info.c
518 +++ b/net/mac80211/sta_info.c
519 @@ -100,7 +100,8 @@ static void __cleanup_single_sta(struct
522 if (test_sta_flag(sta, WLAN_STA_PS_STA) ||
523 - test_sta_flag(sta, WLAN_STA_PS_DRIVER)) {
524 + test_sta_flag(sta, WLAN_STA_PS_DRIVER) ||
525 + test_sta_flag(sta, WLAN_STA_PS_DELIVER)) {
526 if (sta->sdata->vif.type == NL80211_IFTYPE_AP ||
527 sta->sdata->vif.type == NL80211_IFTYPE_AP_VLAN)
528 ps = &sdata->bss->ps;
529 @@ -111,6 +112,7 @@ static void __cleanup_single_sta(struct
531 clear_sta_flag(sta, WLAN_STA_PS_STA);
532 clear_sta_flag(sta, WLAN_STA_PS_DRIVER);
533 + clear_sta_flag(sta, WLAN_STA_PS_DELIVER);
535 atomic_dec(&ps->num_sta_ps);
536 sta_info_recalc_tim(sta);
537 @@ -125,7 +127,7 @@ static void __cleanup_single_sta(struct
538 if (ieee80211_vif_is_mesh(&sdata->vif))
539 mesh_sta_cleanup(sta);
541 - cancel_work_sync(&sta->drv_unblock_wk);
542 + cancel_work_sync(&sta->drv_deliver_wk);
545 * Destroy aggregation state here. It would be nice to wait for the
546 @@ -227,6 +229,7 @@ struct sta_info *sta_info_get_by_idx(str
548 void sta_info_free(struct ieee80211_local *local, struct sta_info *sta)
550 + struct ieee80211_sta_rates *rates;
554 @@ -238,6 +241,10 @@ void sta_info_free(struct ieee80211_loca
558 + rates = rcu_dereference_protected(sta->sta.rates, true);
562 sta_dbg(sta->sdata, "Destroyed STA %pM\n", sta->sta.addr);
565 @@ -252,33 +259,23 @@ static void sta_info_hash_add(struct iee
566 rcu_assign_pointer(local->sta_hash[STA_HASH(sta->sta.addr)], sta);
569 -static void sta_unblock(struct work_struct *wk)
570 +static void sta_deliver_ps_frames(struct work_struct *wk)
572 struct sta_info *sta;
574 - sta = container_of(wk, struct sta_info, drv_unblock_wk);
575 + sta = container_of(wk, struct sta_info, drv_deliver_wk);
580 - if (!test_sta_flag(sta, WLAN_STA_PS_STA)) {
581 - local_bh_disable();
582 + local_bh_disable();
583 + if (!test_sta_flag(sta, WLAN_STA_PS_STA))
584 ieee80211_sta_ps_deliver_wakeup(sta);
586 - } else if (test_and_clear_sta_flag(sta, WLAN_STA_PSPOLL)) {
587 - clear_sta_flag(sta, WLAN_STA_PS_DRIVER);
589 - local_bh_disable();
590 + else if (test_and_clear_sta_flag(sta, WLAN_STA_PSPOLL))
591 ieee80211_sta_ps_deliver_poll_response(sta);
593 - } else if (test_and_clear_sta_flag(sta, WLAN_STA_UAPSD)) {
594 - clear_sta_flag(sta, WLAN_STA_PS_DRIVER);
596 - local_bh_disable();
597 + else if (test_and_clear_sta_flag(sta, WLAN_STA_UAPSD))
598 ieee80211_sta_ps_deliver_uapsd(sta);
601 - clear_sta_flag(sta, WLAN_STA_PS_DRIVER);
605 static int sta_prepare_rate_control(struct ieee80211_local *local,
606 @@ -340,7 +337,7 @@ struct sta_info *sta_info_alloc(struct i
608 spin_lock_init(&sta->lock);
609 spin_lock_init(&sta->ps_lock);
610 - INIT_WORK(&sta->drv_unblock_wk, sta_unblock);
611 + INIT_WORK(&sta->drv_deliver_wk, sta_deliver_ps_frames);
612 INIT_WORK(&sta->ampdu_mlme.work, ieee80211_ba_session_work);
613 mutex_init(&sta->ampdu_mlme.mtx);
614 #ifdef CPTCFG_MAC80211_MESH
615 @@ -1140,8 +1137,15 @@ void ieee80211_sta_ps_deliver_wakeup(str
618 ieee80211_add_pending_skbs(local, &pending);
619 - clear_sta_flag(sta, WLAN_STA_PS_DRIVER);
620 - clear_sta_flag(sta, WLAN_STA_PS_STA);
622 + /* now we're no longer in the deliver code */
623 + clear_sta_flag(sta, WLAN_STA_PS_DELIVER);
625 + /* The station might have polled and then woken up before we responded,
626 + * so clear these flags now to avoid them sticking around.
628 + clear_sta_flag(sta, WLAN_STA_PSPOLL);
629 + clear_sta_flag(sta, WLAN_STA_UAPSD);
630 spin_unlock(&sta->ps_lock);
632 atomic_dec(&ps->num_sta_ps);
633 @@ -1542,10 +1546,26 @@ void ieee80211_sta_block_awake(struct ie
635 trace_api_sta_block_awake(sta->local, pubsta, block);
639 set_sta_flag(sta, WLAN_STA_PS_DRIVER);
640 - else if (test_sta_flag(sta, WLAN_STA_PS_DRIVER))
641 - ieee80211_queue_work(hw, &sta->drv_unblock_wk);
645 + if (!test_sta_flag(sta, WLAN_STA_PS_DRIVER))
648 + if (!test_sta_flag(sta, WLAN_STA_PS_STA)) {
649 + set_sta_flag(sta, WLAN_STA_PS_DELIVER);
650 + clear_sta_flag(sta, WLAN_STA_PS_DRIVER);
651 + ieee80211_queue_work(hw, &sta->drv_deliver_wk);
652 + } else if (test_sta_flag(sta, WLAN_STA_PSPOLL) ||
653 + test_sta_flag(sta, WLAN_STA_UAPSD)) {
654 + /* must be asleep in this case */
655 + clear_sta_flag(sta, WLAN_STA_PS_DRIVER);
656 + ieee80211_queue_work(hw, &sta->drv_deliver_wk);
658 + clear_sta_flag(sta, WLAN_STA_PS_DRIVER);
661 EXPORT_SYMBOL(ieee80211_sta_block_awake);
663 @@ -1703,3 +1723,137 @@ u8 sta_info_tx_streams(struct sta_info *
664 return ((ht_cap->mcs.tx_params & IEEE80211_HT_MCS_TX_MAX_STREAMS_MASK)
665 >> IEEE80211_HT_MCS_TX_MAX_STREAMS_SHIFT) + 1;
668 +void sta_set_sinfo(struct sta_info *sta, struct station_info *sinfo)
670 + struct ieee80211_sub_if_data *sdata = sta->sdata;
671 + struct ieee80211_local *local = sdata->local;
672 + struct rate_control_ref *ref = local->rate_ctrl;
673 + struct timespec uptime;
678 + sinfo->generation = sdata->local->sta_generation;
680 + sinfo->filled = STATION_INFO_INACTIVE_TIME |
681 + STATION_INFO_RX_BYTES64 |
682 + STATION_INFO_TX_BYTES64 |
683 + STATION_INFO_RX_PACKETS |
684 + STATION_INFO_TX_PACKETS |
685 + STATION_INFO_TX_RETRIES |
686 + STATION_INFO_TX_FAILED |
687 + STATION_INFO_TX_BITRATE |
688 + STATION_INFO_RX_BITRATE |
689 + STATION_INFO_RX_DROP_MISC |
690 + STATION_INFO_BSS_PARAM |
691 + STATION_INFO_CONNECTED_TIME |
692 + STATION_INFO_STA_FLAGS |
693 + STATION_INFO_BEACON_LOSS_COUNT;
695 + do_posix_clock_monotonic_gettime(&uptime);
696 + sinfo->connected_time = uptime.tv_sec - sta->last_connected;
698 + sinfo->inactive_time = jiffies_to_msecs(jiffies - sta->last_rx);
699 + sinfo->tx_bytes = 0;
700 + for (ac = 0; ac < IEEE80211_NUM_ACS; ac++) {
701 + sinfo->tx_bytes += sta->tx_bytes[ac];
702 + packets += sta->tx_packets[ac];
704 + sinfo->tx_packets = packets;
705 + sinfo->rx_bytes = sta->rx_bytes;
706 + sinfo->rx_packets = sta->rx_packets;
707 + sinfo->tx_retries = sta->tx_retry_count;
708 + sinfo->tx_failed = sta->tx_retry_failed;
709 + sinfo->rx_dropped_misc = sta->rx_dropped;
710 + sinfo->beacon_loss_count = sta->beacon_loss_count;
712 + if ((sta->local->hw.flags & IEEE80211_HW_SIGNAL_DBM) ||
713 + (sta->local->hw.flags & IEEE80211_HW_SIGNAL_UNSPEC)) {
714 + sinfo->filled |= STATION_INFO_SIGNAL | STATION_INFO_SIGNAL_AVG;
715 + if (!local->ops->get_rssi ||
716 + drv_get_rssi(local, sdata, &sta->sta, &sinfo->signal))
717 + sinfo->signal = (s8)sta->last_signal;
718 + sinfo->signal_avg = (s8) -ewma_read(&sta->avg_signal);
721 + sinfo->filled |= STATION_INFO_CHAIN_SIGNAL |
722 + STATION_INFO_CHAIN_SIGNAL_AVG;
724 + sinfo->chains = sta->chains;
725 + for (i = 0; i < ARRAY_SIZE(sinfo->chain_signal); i++) {
726 + sinfo->chain_signal[i] = sta->chain_signal_last[i];
727 + sinfo->chain_signal_avg[i] =
728 + (s8) -ewma_read(&sta->chain_signal_avg[i]);
732 + sta_set_rate_info_tx(sta, &sta->last_tx_rate, &sinfo->txrate);
733 + sta_set_rate_info_rx(sta, &sinfo->rxrate);
735 + if (ieee80211_vif_is_mesh(&sdata->vif)) {
736 +#ifdef CPTCFG_MAC80211_MESH
737 + sinfo->filled |= STATION_INFO_LLID |
738 + STATION_INFO_PLID |
739 + STATION_INFO_PLINK_STATE |
740 + STATION_INFO_LOCAL_PM |
741 + STATION_INFO_PEER_PM |
742 + STATION_INFO_NONPEER_PM;
744 + sinfo->llid = sta->llid;
745 + sinfo->plid = sta->plid;
746 + sinfo->plink_state = sta->plink_state;
747 + if (test_sta_flag(sta, WLAN_STA_TOFFSET_KNOWN)) {
748 + sinfo->filled |= STATION_INFO_T_OFFSET;
749 + sinfo->t_offset = sta->t_offset;
751 + sinfo->local_pm = sta->local_pm;
752 + sinfo->peer_pm = sta->peer_pm;
753 + sinfo->nonpeer_pm = sta->nonpeer_pm;
757 + sinfo->bss_param.flags = 0;
758 + if (sdata->vif.bss_conf.use_cts_prot)
759 + sinfo->bss_param.flags |= BSS_PARAM_FLAGS_CTS_PROT;
760 + if (sdata->vif.bss_conf.use_short_preamble)
761 + sinfo->bss_param.flags |= BSS_PARAM_FLAGS_SHORT_PREAMBLE;
762 + if (sdata->vif.bss_conf.use_short_slot)
763 + sinfo->bss_param.flags |= BSS_PARAM_FLAGS_SHORT_SLOT_TIME;
764 + sinfo->bss_param.dtim_period = sdata->local->hw.conf.ps_dtim_period;
765 + sinfo->bss_param.beacon_interval = sdata->vif.bss_conf.beacon_int;
767 + sinfo->sta_flags.set = 0;
768 + sinfo->sta_flags.mask = BIT(NL80211_STA_FLAG_AUTHORIZED) |
769 + BIT(NL80211_STA_FLAG_SHORT_PREAMBLE) |
770 + BIT(NL80211_STA_FLAG_WME) |
771 + BIT(NL80211_STA_FLAG_MFP) |
772 + BIT(NL80211_STA_FLAG_AUTHENTICATED) |
773 + BIT(NL80211_STA_FLAG_ASSOCIATED) |
774 + BIT(NL80211_STA_FLAG_TDLS_PEER);
775 + if (test_sta_flag(sta, WLAN_STA_AUTHORIZED))
776 + sinfo->sta_flags.set |= BIT(NL80211_STA_FLAG_AUTHORIZED);
777 + if (test_sta_flag(sta, WLAN_STA_SHORT_PREAMBLE))
778 + sinfo->sta_flags.set |= BIT(NL80211_STA_FLAG_SHORT_PREAMBLE);
779 + if (test_sta_flag(sta, WLAN_STA_WME))
780 + sinfo->sta_flags.set |= BIT(NL80211_STA_FLAG_WME);
781 + if (test_sta_flag(sta, WLAN_STA_MFP))
782 + sinfo->sta_flags.set |= BIT(NL80211_STA_FLAG_MFP);
783 + if (test_sta_flag(sta, WLAN_STA_AUTH))
784 + sinfo->sta_flags.set |= BIT(NL80211_STA_FLAG_AUTHENTICATED);
785 + if (test_sta_flag(sta, WLAN_STA_ASSOC))
786 + sinfo->sta_flags.set |= BIT(NL80211_STA_FLAG_ASSOCIATED);
787 + if (test_sta_flag(sta, WLAN_STA_TDLS_PEER))
788 + sinfo->sta_flags.set |= BIT(NL80211_STA_FLAG_TDLS_PEER);
790 + /* check if the driver has a SW RC implementation */
791 + if (ref && ref->ops->get_expected_throughput)
792 + thr = ref->ops->get_expected_throughput(sta->rate_ctrl_priv);
794 + thr = drv_get_expected_throughput(local, &sta->sta);
797 + sinfo->filled |= STATION_INFO_EXPECTED_THROUGHPUT;
798 + sinfo->expected_throughput = thr;
801 --- a/net/mac80211/status.c
802 +++ b/net/mac80211/status.c
803 @@ -541,6 +541,23 @@ static void ieee80211_tx_latency_end_msr
805 #define STA_LOST_PKT_THRESHOLD 50
807 +static void ieee80211_lost_packet(struct sta_info *sta, struct sk_buff *skb)
809 + struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
811 + /* This packet was aggregated but doesn't carry status info */
812 + if ((info->flags & IEEE80211_TX_CTL_AMPDU) &&
813 + !(info->flags & IEEE80211_TX_STAT_AMPDU))
816 + if (++sta->lost_packets < STA_LOST_PKT_THRESHOLD)
819 + cfg80211_cqm_pktloss_notify(sta->sdata->dev, sta->sta.addr,
820 + sta->lost_packets, GFP_ATOMIC);
821 + sta->lost_packets = 0;
824 void ieee80211_tx_status(struct ieee80211_hw *hw, struct sk_buff *skb)
826 struct sk_buff *skb2;
827 @@ -680,12 +697,8 @@ void ieee80211_tx_status(struct ieee8021
828 if (info->flags & IEEE80211_TX_STAT_ACK) {
829 if (sta->lost_packets)
830 sta->lost_packets = 0;
831 - } else if (++sta->lost_packets >= STA_LOST_PKT_THRESHOLD) {
832 - cfg80211_cqm_pktloss_notify(sta->sdata->dev,
836 - sta->lost_packets = 0;
838 + ieee80211_lost_packet(sta, skb);
842 --- a/net/mac80211/rx.c
843 +++ b/net/mac80211/rx.c
844 @@ -1107,6 +1107,8 @@ static void sta_ps_end(struct sta_info *
848 + set_sta_flag(sta, WLAN_STA_PS_DELIVER);
849 + clear_sta_flag(sta, WLAN_STA_PS_STA);
850 ieee80211_sta_ps_deliver_wakeup(sta);
853 --- a/net/mac80211/sta_info.h
854 +++ b/net/mac80211/sta_info.h
855 @@ -82,6 +82,7 @@ enum ieee80211_sta_info_flags {
856 WLAN_STA_TOFFSET_KNOWN,
858 WLAN_STA_MPSP_RECIPIENT,
859 + WLAN_STA_PS_DELIVER,
862 #define ADDBA_RESP_INTERVAL HZ
863 @@ -265,7 +266,7 @@ struct ieee80211_tx_latency_stat {
864 * @last_rx_rate_vht_nss: rx status nss of last data packet
865 * @lock: used for locking all fields that require locking, see comments
866 * in the header file.
867 - * @drv_unblock_wk: used for driver PS unblocking
868 + * @drv_deliver_wk: used for delivering frames after driver PS unblocking
869 * @listen_interval: listen interval of this station, when we're acting as AP
870 * @_flags: STA flags, see &enum ieee80211_sta_info_flags, do not use directly
871 * @ps_lock: used for powersave (when mac80211 is the AP) related locking
872 @@ -278,7 +279,6 @@ struct ieee80211_tx_latency_stat {
873 * @driver_buffered_tids: bitmap of TIDs the driver has data buffered on
874 * @rx_packets: Number of MSDUs received from this STA
875 * @rx_bytes: Number of bytes received from this STA
876 - * @wep_weak_iv_count: number of weak WEP IVs received from this station
877 * @last_rx: time (in jiffies) when last frame was received from this STA
878 * @last_connected: time (in seconds) when a station got connected
879 * @num_duplicates: number of duplicate frames received from this STA
880 @@ -345,7 +345,7 @@ struct sta_info {
881 void *rate_ctrl_priv;
884 - struct work_struct drv_unblock_wk;
885 + struct work_struct drv_deliver_wk;
889 @@ -367,7 +367,6 @@ struct sta_info {
890 /* Updated from RX path only, no locking requirements */
891 unsigned long rx_packets;
893 - unsigned long wep_weak_iv_count;
894 unsigned long last_rx;
896 unsigned long num_duplicates;
897 @@ -628,6 +627,8 @@ void sta_set_rate_info_tx(struct sta_inf
898 struct rate_info *rinfo);
899 void sta_set_rate_info_rx(struct sta_info *sta,
900 struct rate_info *rinfo);
901 +void sta_set_sinfo(struct sta_info *sta, struct station_info *sinfo);
903 void ieee80211_sta_expire(struct ieee80211_sub_if_data *sdata,
904 unsigned long exp_time);
905 u8 sta_info_tx_streams(struct sta_info *sta);
906 --- a/net/mac80211/tx.c
907 +++ b/net/mac80211/tx.c
908 @@ -469,7 +469,8 @@ ieee80211_tx_h_unicast_ps_buf(struct iee
911 if (unlikely((test_sta_flag(sta, WLAN_STA_PS_STA) ||
912 - test_sta_flag(sta, WLAN_STA_PS_DRIVER)) &&
913 + test_sta_flag(sta, WLAN_STA_PS_DRIVER) ||
914 + test_sta_flag(sta, WLAN_STA_PS_DELIVER)) &&
915 !(info->flags & IEEE80211_TX_CTL_NO_PS_BUFFER))) {
916 int ac = skb_get_queue_mapping(tx->skb);
918 @@ -486,7 +487,8 @@ ieee80211_tx_h_unicast_ps_buf(struct iee
919 * ahead and Tx the packet.
921 if (!test_sta_flag(sta, WLAN_STA_PS_STA) &&
922 - !test_sta_flag(sta, WLAN_STA_PS_DRIVER)) {
923 + !test_sta_flag(sta, WLAN_STA_PS_DRIVER) &&
924 + !test_sta_flag(sta, WLAN_STA_PS_DELIVER)) {
925 spin_unlock(&sta->ps_lock);
928 @@ -1618,12 +1620,12 @@ netdev_tx_t ieee80211_monitor_start_xmit
930 struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr);
931 struct ieee80211_chanctx_conf *chanctx_conf;
932 - struct ieee80211_channel *chan;
933 struct ieee80211_radiotap_header *prthdr =
934 (struct ieee80211_radiotap_header *)skb->data;
935 struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
936 struct ieee80211_hdr *hdr;
937 struct ieee80211_sub_if_data *tmp_sdata, *sdata;
938 + struct cfg80211_chan_def *chandef;
942 @@ -1721,9 +1723,9 @@ netdev_tx_t ieee80211_monitor_start_xmit
946 - chan = chanctx_conf->def.chan;
947 + chandef = &chanctx_conf->def;
948 else if (!local->use_chanctx)
949 - chan = local->_oper_chandef.chan;
950 + chandef = &local->_oper_chandef;
954 @@ -1743,10 +1745,11 @@ netdev_tx_t ieee80211_monitor_start_xmit
955 * radar detection by itself. We can do that later by adding a
956 * monitor flag interfaces used for AP support.
958 - if ((chan->flags & (IEEE80211_CHAN_NO_IR | IEEE80211_CHAN_RADAR)))
959 + if (!cfg80211_reg_can_beacon(local->hw.wiphy, chandef,
963 - ieee80211_xmit(sdata, skb, chan->band);
964 + ieee80211_xmit(sdata, skb, chandef->chan->band);
968 @@ -2425,7 +2428,7 @@ static void ieee80211_set_csa(struct iee
970 size_t beacon_data_len;
972 - u8 count = sdata->csa_current_counter;
973 + u8 count = beacon->csa_current_counter;
975 switch (sdata->vif.type) {
976 case NL80211_IFTYPE_AP:
977 @@ -2444,46 +2447,54 @@ static void ieee80211_set_csa(struct iee
982 for (i = 0; i < IEEE80211_MAX_CSA_COUNTERS_NUM; ++i) {
983 - u16 counter_offset_beacon =
984 - sdata->csa_counter_offset_beacon[i];
985 - u16 counter_offset_presp = sdata->csa_counter_offset_presp[i];
987 - if (counter_offset_beacon) {
988 - if (WARN_ON(counter_offset_beacon >= beacon_data_len))
991 - beacon_data[counter_offset_beacon] = count;
994 - if (sdata->vif.type == NL80211_IFTYPE_AP &&
995 - counter_offset_presp) {
997 - resp = rcu_dereference(sdata->u.ap.probe_resp);
998 + resp = rcu_dereference(sdata->u.ap.probe_resp);
1000 - /* If nl80211 accepted the offset, this should
1003 - if (WARN_ON(!resp)) {
1004 + if (beacon->csa_counter_offsets[i]) {
1005 + if (WARN_ON_ONCE(beacon->csa_counter_offsets[i] >=
1006 + beacon_data_len)) {
1010 - resp->data[counter_offset_presp] = count;
1011 - rcu_read_unlock();
1013 + beacon_data[beacon->csa_counter_offsets[i]] = count;
1016 + if (sdata->vif.type == NL80211_IFTYPE_AP && resp &&
1017 + resp->csa_counter_offsets)
1018 + resp->data[resp->csa_counter_offsets[i]] = count;
1020 + rcu_read_unlock();
1023 u8 ieee80211_csa_update_counter(struct ieee80211_vif *vif)
1025 struct ieee80211_sub_if_data *sdata = vif_to_sdata(vif);
1026 + struct beacon_data *beacon = NULL;
1031 + if (sdata->vif.type == NL80211_IFTYPE_AP)
1032 + beacon = rcu_dereference(sdata->u.ap.beacon);
1033 + else if (sdata->vif.type == NL80211_IFTYPE_ADHOC)
1034 + beacon = rcu_dereference(sdata->u.ibss.presp);
1035 + else if (ieee80211_vif_is_mesh(&sdata->vif))
1036 + beacon = rcu_dereference(sdata->u.mesh.beacon);
1041 - sdata->csa_current_counter--;
1042 + beacon->csa_current_counter--;
1044 /* the counter should never reach 0 */
1045 - WARN_ON(!sdata->csa_current_counter);
1046 + WARN_ON_ONCE(!beacon->csa_current_counter);
1047 + count = beacon->csa_current_counter;
1049 - return sdata->csa_current_counter;
1051 + rcu_read_unlock();
1054 EXPORT_SYMBOL(ieee80211_csa_update_counter);
1056 @@ -2493,7 +2504,6 @@ bool ieee80211_csa_is_complete(struct ie
1057 struct beacon_data *beacon = NULL;
1059 size_t beacon_data_len;
1060 - int counter_beacon = sdata->csa_counter_offset_beacon[0];
1063 if (!ieee80211_sdata_running(sdata))
1064 @@ -2531,10 +2541,13 @@ bool ieee80211_csa_is_complete(struct ie
1068 - if (WARN_ON(counter_beacon > beacon_data_len))
1069 + if (!beacon->csa_counter_offsets[0])
1072 + if (WARN_ON_ONCE(beacon->csa_counter_offsets[0] > beacon_data_len))
1075 - if (beacon_data[counter_beacon] == 1)
1076 + if (beacon_data[beacon->csa_counter_offsets[0]] == 1)
1080 @@ -2550,6 +2563,7 @@ __ieee80211_beacon_get(struct ieee80211_
1083 struct ieee80211_local *local = hw_to_local(hw);
1084 + struct beacon_data *beacon = NULL;
1085 struct sk_buff *skb = NULL;
1086 struct ieee80211_tx_info *info;
1087 struct ieee80211_sub_if_data *sdata = NULL;
1088 @@ -2571,10 +2585,10 @@ __ieee80211_beacon_get(struct ieee80211_
1090 if (sdata->vif.type == NL80211_IFTYPE_AP) {
1091 struct ieee80211_if_ap *ap = &sdata->u.ap;
1092 - struct beacon_data *beacon = rcu_dereference(ap->beacon);
1094 + beacon = rcu_dereference(ap->beacon);
1096 - if (sdata->vif.csa_active) {
1097 + if (beacon->csa_counter_offsets[0]) {
1099 ieee80211_csa_update_counter(vif);
1101 @@ -2615,37 +2629,37 @@ __ieee80211_beacon_get(struct ieee80211_
1102 } else if (sdata->vif.type == NL80211_IFTYPE_ADHOC) {
1103 struct ieee80211_if_ibss *ifibss = &sdata->u.ibss;
1104 struct ieee80211_hdr *hdr;
1105 - struct beacon_data *presp = rcu_dereference(ifibss->presp);
1108 + beacon = rcu_dereference(ifibss->presp);
1112 - if (sdata->vif.csa_active) {
1113 + if (beacon->csa_counter_offsets[0]) {
1115 ieee80211_csa_update_counter(vif);
1117 - ieee80211_set_csa(sdata, presp);
1118 + ieee80211_set_csa(sdata, beacon);
1121 - skb = dev_alloc_skb(local->tx_headroom + presp->head_len +
1122 + skb = dev_alloc_skb(local->tx_headroom + beacon->head_len +
1123 local->hw.extra_beacon_tailroom);
1126 skb_reserve(skb, local->tx_headroom);
1127 - memcpy(skb_put(skb, presp->head_len), presp->head,
1129 + memcpy(skb_put(skb, beacon->head_len), beacon->head,
1130 + beacon->head_len);
1132 hdr = (struct ieee80211_hdr *) skb->data;
1133 hdr->frame_control = cpu_to_le16(IEEE80211_FTYPE_MGMT |
1134 IEEE80211_STYPE_BEACON);
1135 } else if (ieee80211_vif_is_mesh(&sdata->vif)) {
1136 struct ieee80211_if_mesh *ifmsh = &sdata->u.mesh;
1137 - struct beacon_data *bcn = rcu_dereference(ifmsh->beacon);
1140 + beacon = rcu_dereference(ifmsh->beacon);
1144 - if (sdata->vif.csa_active) {
1145 + if (beacon->csa_counter_offsets[0]) {
1147 /* TODO: For mesh csa_counter is in TU, so
1148 * decrementing it by one isn't correct, but
1149 @@ -2654,40 +2668,42 @@ __ieee80211_beacon_get(struct ieee80211_
1151 ieee80211_csa_update_counter(vif);
1153 - ieee80211_set_csa(sdata, bcn);
1154 + ieee80211_set_csa(sdata, beacon);
1157 if (ifmsh->sync_ops)
1158 - ifmsh->sync_ops->adjust_tbtt(sdata, bcn);
1159 + ifmsh->sync_ops->adjust_tbtt(sdata, beacon);
1161 skb = dev_alloc_skb(local->tx_headroom +
1163 + beacon->head_len +
1166 + beacon->tail_len +
1167 local->hw.extra_beacon_tailroom);
1170 skb_reserve(skb, local->tx_headroom);
1171 - memcpy(skb_put(skb, bcn->head_len), bcn->head, bcn->head_len);
1172 + memcpy(skb_put(skb, beacon->head_len), beacon->head,
1173 + beacon->head_len);
1174 ieee80211_beacon_add_tim(sdata, &ifmsh->ps, skb, is_template);
1177 - offs->tim_offset = bcn->head_len;
1178 - offs->tim_length = skb->len - bcn->head_len;
1179 + offs->tim_offset = beacon->head_len;
1180 + offs->tim_length = skb->len - beacon->head_len;
1183 - memcpy(skb_put(skb, bcn->tail_len), bcn->tail, bcn->tail_len);
1184 + memcpy(skb_put(skb, beacon->tail_len), beacon->tail,
1185 + beacon->tail_len);
1193 + if (offs && beacon) {
1196 for (i = 0; i < IEEE80211_MAX_CSA_COUNTERS_NUM; i++) {
1197 - u16 csa_off = sdata->csa_counter_offset_beacon[i];
1198 + u16 csa_off = beacon->csa_counter_offsets[i];
1202 --- a/drivers/net/wireless/rt2x00/rt2800lib.c
1203 +++ b/drivers/net/wireless/rt2x00/rt2800lib.c
1204 @@ -947,6 +947,40 @@ static inline u8 rt2800_get_beacon_offse
1205 return BEACON_BASE_TO_OFFSET(rt2800_hw_beacon_base(rt2x00dev, index));
1208 +static void rt2800_update_beacons_setup(struct rt2x00_dev *rt2x00dev)
1210 + struct data_queue *queue = rt2x00dev->bcn;
1211 + struct queue_entry *entry;
1212 + int i, bcn_num = 0;
1217 + * Setup offsets of all active beacons in BCN_OFFSET{0,1} registers.
1219 + for (i = 0; i < queue->limit; i++) {
1220 + entry = &queue->entries[i];
1221 + if (!test_bit(ENTRY_BCN_ENABLED, &entry->flags))
1223 + off = rt2800_get_beacon_offset(rt2x00dev, entry->entry_idx);
1224 + reg |= off << (8 * bcn_num);
1228 + WARN_ON_ONCE(bcn_num != rt2x00dev->intf_beaconing);
1230 + rt2800_register_write(rt2x00dev, BCN_OFFSET0, (u32) reg);
1231 + rt2800_register_write(rt2x00dev, BCN_OFFSET1, (u32) (reg >> 32));
1234 + * H/W sends up to MAC_BSSID_DW1_BSS_BCN_NUM + 1 consecutive beacons.
1236 + rt2800_register_read(rt2x00dev, MAC_BSSID_DW1, &bssid_dw1);
1237 + rt2x00_set_field32(&bssid_dw1, MAC_BSSID_DW1_BSS_BCN_NUM,
1238 + bcn_num > 0 ? bcn_num - 1 : 0);
1239 + rt2800_register_write(rt2x00dev, MAC_BSSID_DW1, bssid_dw1);
1242 void rt2800_write_beacon(struct queue_entry *entry, struct txentry_desc *txdesc)
1244 struct rt2x00_dev *rt2x00dev = entry->queue->rt2x00dev;
1245 @@ -1003,6 +1037,12 @@ void rt2800_write_beacon(struct queue_en
1247 rt2800_register_multiwrite(rt2x00dev, beacon_base, entry->skb->data,
1248 entry->skb->len + padding_len);
1249 + __set_bit(ENTRY_BCN_ENABLED, &entry->flags);
1252 + * Change global beacons settings.
1254 + rt2800_update_beacons_setup(rt2x00dev);
1257 * Restore beaconing state.
1258 @@ -1053,8 +1093,13 @@ void rt2800_clear_beacon(struct queue_en
1261 rt2800_clear_beacon_register(rt2x00dev, entry->entry_idx);
1262 + __clear_bit(ENTRY_BCN_ENABLED, &entry->flags);
1265 + * Change global beacons settings.
1267 + rt2800_update_beacons_setup(rt2x00dev);
1269 * Restore beaconing state.
1271 rt2800_register_write(rt2x00dev, BCN_TIME_CFG, orig_reg);
1272 @@ -1556,7 +1601,7 @@ void rt2800_config_intf(struct rt2x00_de
1273 if (!is_zero_ether_addr((const u8 *)conf->bssid)) {
1274 reg = le32_to_cpu(conf->bssid[1]);
1275 rt2x00_set_field32(®, MAC_BSSID_DW1_BSS_ID_MASK, 3);
1276 - rt2x00_set_field32(®, MAC_BSSID_DW1_BSS_BCN_NUM, 7);
1277 + rt2x00_set_field32(®, MAC_BSSID_DW1_BSS_BCN_NUM, 0);
1278 conf->bssid[1] = cpu_to_le32(reg);
1281 @@ -4517,28 +4562,6 @@ static int rt2800_init_registers(struct
1285 - rt2800_register_read(rt2x00dev, BCN_OFFSET0, ®);
1286 - rt2x00_set_field32(®, BCN_OFFSET0_BCN0,
1287 - rt2800_get_beacon_offset(rt2x00dev, 0));
1288 - rt2x00_set_field32(®, BCN_OFFSET0_BCN1,
1289 - rt2800_get_beacon_offset(rt2x00dev, 1));
1290 - rt2x00_set_field32(®, BCN_OFFSET0_BCN2,
1291 - rt2800_get_beacon_offset(rt2x00dev, 2));
1292 - rt2x00_set_field32(®, BCN_OFFSET0_BCN3,
1293 - rt2800_get_beacon_offset(rt2x00dev, 3));
1294 - rt2800_register_write(rt2x00dev, BCN_OFFSET0, reg);
1296 - rt2800_register_read(rt2x00dev, BCN_OFFSET1, ®);
1297 - rt2x00_set_field32(®, BCN_OFFSET1_BCN4,
1298 - rt2800_get_beacon_offset(rt2x00dev, 4));
1299 - rt2x00_set_field32(®, BCN_OFFSET1_BCN5,
1300 - rt2800_get_beacon_offset(rt2x00dev, 5));
1301 - rt2x00_set_field32(®, BCN_OFFSET1_BCN6,
1302 - rt2800_get_beacon_offset(rt2x00dev, 6));
1303 - rt2x00_set_field32(®, BCN_OFFSET1_BCN7,
1304 - rt2800_get_beacon_offset(rt2x00dev, 7));
1305 - rt2800_register_write(rt2x00dev, BCN_OFFSET1, reg);
1307 rt2800_register_write(rt2x00dev, LEGACY_BASIC_RATE, 0x0000013f);
1308 rt2800_register_write(rt2x00dev, HT_BASIC_RATE, 0x00008003);
1310 --- a/drivers/net/wireless/rt2x00/rt2x00dev.c
1311 +++ b/drivers/net/wireless/rt2x00/rt2x00dev.c
1312 @@ -141,8 +141,11 @@ static void rt2x00lib_intf_scheduled_ite
1313 if (!test_bit(DEVICE_STATE_ENABLED_RADIO, &rt2x00dev->flags))
1316 - if (test_and_clear_bit(DELAYED_UPDATE_BEACON, &intf->delayed_flags))
1317 + if (test_and_clear_bit(DELAYED_UPDATE_BEACON, &intf->delayed_flags)) {
1318 + mutex_lock(&intf->beacon_skb_mutex);
1319 rt2x00queue_update_beacon(rt2x00dev, vif);
1320 + mutex_unlock(&intf->beacon_skb_mutex);
1324 static void rt2x00lib_intf_scheduled(struct work_struct *work)
1325 @@ -216,7 +219,7 @@ static void rt2x00lib_beaconupdate_iter(
1326 * never be called for USB devices.
1328 WARN_ON(rt2x00_is_usb(rt2x00dev));
1329 - rt2x00queue_update_beacon_locked(rt2x00dev, vif);
1330 + rt2x00queue_update_beacon(rt2x00dev, vif);
1333 void rt2x00lib_beacondone(struct rt2x00_dev *rt2x00dev)
1334 --- a/drivers/net/wireless/rt2x00/rt2x00mac.c
1335 +++ b/drivers/net/wireless/rt2x00/rt2x00mac.c
1336 @@ -487,6 +487,8 @@ int rt2x00mac_set_key(struct ieee80211_h
1337 crypto.cipher = rt2x00crypto_key_to_cipher(key);
1338 if (crypto.cipher == CIPHER_NONE)
1340 + if (crypto.cipher == CIPHER_TKIP && rt2x00_is_usb(rt2x00dev))
1341 + return -EOPNOTSUPP;
1345 @@ -624,25 +626,24 @@ void rt2x00mac_bss_info_changed(struct i
1346 * Start/stop beaconing.
1348 if (changes & BSS_CHANGED_BEACON_ENABLED) {
1349 + mutex_lock(&intf->beacon_skb_mutex);
1350 if (!bss_conf->enable_beacon && intf->enable_beacon) {
1351 rt2x00dev->intf_beaconing--;
1352 intf->enable_beacon = false;
1354 - * Clear beacon in the H/W for this vif. This is needed
1355 - * to disable beaconing on this particular interface
1356 - * and keep it running on other interfaces.
1358 - rt2x00queue_clear_beacon(rt2x00dev, vif);
1360 if (rt2x00dev->intf_beaconing == 0) {
1362 * Last beaconing interface disabled
1363 * -> stop beacon queue.
1365 - mutex_lock(&intf->beacon_skb_mutex);
1366 rt2x00queue_stop_queue(rt2x00dev->bcn);
1367 - mutex_unlock(&intf->beacon_skb_mutex);
1370 + * Clear beacon in the H/W for this vif. This is needed
1371 + * to disable beaconing on this particular interface
1372 + * and keep it running on other interfaces.
1374 + rt2x00queue_clear_beacon(rt2x00dev, vif);
1375 } else if (bss_conf->enable_beacon && !intf->enable_beacon) {
1376 rt2x00dev->intf_beaconing++;
1377 intf->enable_beacon = true;
1378 @@ -658,11 +659,10 @@ void rt2x00mac_bss_info_changed(struct i
1379 * First beaconing interface enabled
1380 * -> start beacon queue.
1382 - mutex_lock(&intf->beacon_skb_mutex);
1383 rt2x00queue_start_queue(rt2x00dev->bcn);
1384 - mutex_unlock(&intf->beacon_skb_mutex);
1387 + mutex_unlock(&intf->beacon_skb_mutex);
1391 --- a/drivers/net/wireless/rt2x00/rt2x00queue.c
1392 +++ b/drivers/net/wireless/rt2x00/rt2x00queue.c
1393 @@ -754,8 +754,6 @@ int rt2x00queue_clear_beacon(struct rt2x
1394 if (unlikely(!intf->beacon))
1397 - mutex_lock(&intf->beacon_skb_mutex);
1400 * Clean up the beacon skb.
1402 @@ -768,13 +766,11 @@ int rt2x00queue_clear_beacon(struct rt2x
1403 if (rt2x00dev->ops->lib->clear_beacon)
1404 rt2x00dev->ops->lib->clear_beacon(intf->beacon);
1406 - mutex_unlock(&intf->beacon_skb_mutex);
1411 -int rt2x00queue_update_beacon_locked(struct rt2x00_dev *rt2x00dev,
1412 - struct ieee80211_vif *vif)
1413 +int rt2x00queue_update_beacon(struct rt2x00_dev *rt2x00dev,
1414 + struct ieee80211_vif *vif)
1416 struct rt2x00_intf *intf = vif_to_intf(vif);
1417 struct skb_frame_desc *skbdesc;
1418 @@ -815,19 +811,6 @@ int rt2x00queue_update_beacon_locked(str
1422 -int rt2x00queue_update_beacon(struct rt2x00_dev *rt2x00dev,
1423 - struct ieee80211_vif *vif)
1425 - struct rt2x00_intf *intf = vif_to_intf(vif);
1428 - mutex_lock(&intf->beacon_skb_mutex);
1429 - ret = rt2x00queue_update_beacon_locked(rt2x00dev, vif);
1430 - mutex_unlock(&intf->beacon_skb_mutex);
1435 bool rt2x00queue_for_each_entry(struct data_queue *queue,
1436 enum queue_index start,
1437 enum queue_index end,
1438 --- a/drivers/net/wireless/rt2x00/rt2x00queue.h
1439 +++ b/drivers/net/wireless/rt2x00/rt2x00queue.h
1440 @@ -353,6 +353,7 @@ struct txentry_desc {
1442 enum queue_entry_flags {
1444 + ENTRY_BCN_ENABLED,
1445 ENTRY_OWNER_DEVICE_DATA,
1447 ENTRY_DATA_IO_FAILED,
1448 --- a/drivers/net/wireless/ath/ath9k/main.c
1449 +++ b/drivers/net/wireless/ath/ath9k/main.c
1450 @@ -1757,7 +1757,6 @@ out:
1451 void ath9k_update_p2p_ps(struct ath_softc *sc, struct ieee80211_vif *vif)
1453 struct ath_vif *avp = (void *)vif->drv_priv;
1454 - unsigned long flags;
1457 if (!sc->p2p_ps_timer)
1458 @@ -1767,14 +1766,9 @@ void ath9k_update_p2p_ps(struct ath_soft
1461 sc->p2p_ps_vif = avp;
1463 - spin_lock_irqsave(&sc->sc_pm_lock, flags);
1464 - if (!(sc->ps_flags & PS_BEACON_SYNC)) {
1465 - tsf = ath9k_hw_gettsf32(sc->sc_ah);
1466 - ieee80211_parse_p2p_noa(&vif->bss_conf.p2p_noa_attr, &avp->noa, tsf);
1467 - ath9k_update_p2p_ps_timer(sc, avp);
1469 - spin_unlock_irqrestore(&sc->sc_pm_lock, flags);
1470 + tsf = ath9k_hw_gettsf32(sc->sc_ah);
1471 + ieee80211_parse_p2p_noa(&vif->bss_conf.p2p_noa_attr, &avp->noa, tsf);
1472 + ath9k_update_p2p_ps_timer(sc, avp);
1475 static void ath9k_bss_info_changed(struct ieee80211_hw *hw,
1476 @@ -1791,6 +1785,7 @@ static void ath9k_bss_info_changed(struc
1477 struct ath_hw *ah = sc->sc_ah;
1478 struct ath_common *common = ath9k_hw_common(ah);
1479 struct ath_vif *avp = (void *)vif->drv_priv;
1480 + unsigned long flags;
1483 ath9k_ps_wakeup(sc);
1484 @@ -1853,7 +1848,10 @@ static void ath9k_bss_info_changed(struc
1486 if (changed & BSS_CHANGED_P2P_PS) {
1487 spin_lock_bh(&sc->sc_pcu_lock);
1488 - ath9k_update_p2p_ps(sc, vif);
1489 + spin_lock_irqsave(&sc->sc_pm_lock, flags);
1490 + if (!(sc->ps_flags & PS_BEACON_SYNC))
1491 + ath9k_update_p2p_ps(sc, vif);
1492 + spin_unlock_irqrestore(&sc->sc_pm_lock, flags);
1493 spin_unlock_bh(&sc->sc_pcu_lock);
1496 @@ -2232,14 +2230,6 @@ static void ath9k_sw_scan_complete(struc
1497 clear_bit(ATH_OP_SCANNING, &common->op_flags);
1500 -static void ath9k_channel_switch_beacon(struct ieee80211_hw *hw,
1501 - struct ieee80211_vif *vif,
1502 - struct cfg80211_chan_def *chandef)
1504 - /* depend on vif->csa_active only */
1508 struct ieee80211_ops ath9k_ops = {
1510 .start = ath9k_start,
1511 @@ -2287,5 +2277,4 @@ struct ieee80211_ops ath9k_ops = {
1513 .sw_scan_start = ath9k_sw_scan_start,
1514 .sw_scan_complete = ath9k_sw_scan_complete,
1515 - .channel_switch_beacon = ath9k_channel_switch_beacon,
1517 --- a/drivers/net/wireless/ath/ath10k/mac.c
1518 +++ b/drivers/net/wireless/ath/ath10k/mac.c
1519 @@ -4142,14 +4142,6 @@ static int ath10k_set_bitrate_mask(struc
1520 fixed_nss, force_sgi);
1523 -static void ath10k_channel_switch_beacon(struct ieee80211_hw *hw,
1524 - struct ieee80211_vif *vif,
1525 - struct cfg80211_chan_def *chandef)
1527 - /* there's no need to do anything here. vif->csa_active is enough */
1531 static void ath10k_sta_rc_update(struct ieee80211_hw *hw,
1532 struct ieee80211_vif *vif,
1533 struct ieee80211_sta *sta,
1534 @@ -4256,7 +4248,6 @@ static const struct ieee80211_ops ath10k
1535 .restart_complete = ath10k_restart_complete,
1536 .get_survey = ath10k_get_survey,
1537 .set_bitrate_mask = ath10k_set_bitrate_mask,
1538 - .channel_switch_beacon = ath10k_channel_switch_beacon,
1539 .sta_rc_update = ath10k_sta_rc_update,
1540 .get_tsf = ath10k_get_tsf,
1542 --- a/net/mac80211/cfg.c
1543 +++ b/net/mac80211/cfg.c
1544 @@ -468,327 +468,6 @@ void sta_set_rate_info_rx(struct sta_inf
1545 rinfo->flags |= RATE_INFO_FLAGS_160_MHZ_WIDTH;
1548 -static void sta_set_sinfo(struct sta_info *sta, struct station_info *sinfo)
1550 - struct ieee80211_sub_if_data *sdata = sta->sdata;
1551 - struct ieee80211_local *local = sdata->local;
1552 - struct rate_control_ref *ref = local->rate_ctrl;
1553 - struct timespec uptime;
1558 - sinfo->generation = sdata->local->sta_generation;
1560 - sinfo->filled = STATION_INFO_INACTIVE_TIME |
1561 - STATION_INFO_RX_BYTES64 |
1562 - STATION_INFO_TX_BYTES64 |
1563 - STATION_INFO_RX_PACKETS |
1564 - STATION_INFO_TX_PACKETS |
1565 - STATION_INFO_TX_RETRIES |
1566 - STATION_INFO_TX_FAILED |
1567 - STATION_INFO_TX_BITRATE |
1568 - STATION_INFO_RX_BITRATE |
1569 - STATION_INFO_RX_DROP_MISC |
1570 - STATION_INFO_BSS_PARAM |
1571 - STATION_INFO_CONNECTED_TIME |
1572 - STATION_INFO_STA_FLAGS |
1573 - STATION_INFO_BEACON_LOSS_COUNT;
1575 - do_posix_clock_monotonic_gettime(&uptime);
1576 - sinfo->connected_time = uptime.tv_sec - sta->last_connected;
1578 - sinfo->inactive_time = jiffies_to_msecs(jiffies - sta->last_rx);
1579 - sinfo->tx_bytes = 0;
1580 - for (ac = 0; ac < IEEE80211_NUM_ACS; ac++) {
1581 - sinfo->tx_bytes += sta->tx_bytes[ac];
1582 - packets += sta->tx_packets[ac];
1584 - sinfo->tx_packets = packets;
1585 - sinfo->rx_bytes = sta->rx_bytes;
1586 - sinfo->rx_packets = sta->rx_packets;
1587 - sinfo->tx_retries = sta->tx_retry_count;
1588 - sinfo->tx_failed = sta->tx_retry_failed;
1589 - sinfo->rx_dropped_misc = sta->rx_dropped;
1590 - sinfo->beacon_loss_count = sta->beacon_loss_count;
1592 - if ((sta->local->hw.flags & IEEE80211_HW_SIGNAL_DBM) ||
1593 - (sta->local->hw.flags & IEEE80211_HW_SIGNAL_UNSPEC)) {
1594 - sinfo->filled |= STATION_INFO_SIGNAL | STATION_INFO_SIGNAL_AVG;
1595 - if (!local->ops->get_rssi ||
1596 - drv_get_rssi(local, sdata, &sta->sta, &sinfo->signal))
1597 - sinfo->signal = (s8)sta->last_signal;
1598 - sinfo->signal_avg = (s8) -ewma_read(&sta->avg_signal);
1600 - if (sta->chains) {
1601 - sinfo->filled |= STATION_INFO_CHAIN_SIGNAL |
1602 - STATION_INFO_CHAIN_SIGNAL_AVG;
1604 - sinfo->chains = sta->chains;
1605 - for (i = 0; i < ARRAY_SIZE(sinfo->chain_signal); i++) {
1606 - sinfo->chain_signal[i] = sta->chain_signal_last[i];
1607 - sinfo->chain_signal_avg[i] =
1608 - (s8) -ewma_read(&sta->chain_signal_avg[i]);
1612 - sta_set_rate_info_tx(sta, &sta->last_tx_rate, &sinfo->txrate);
1613 - sta_set_rate_info_rx(sta, &sinfo->rxrate);
1615 - if (ieee80211_vif_is_mesh(&sdata->vif)) {
1616 -#ifdef CPTCFG_MAC80211_MESH
1617 - sinfo->filled |= STATION_INFO_LLID |
1618 - STATION_INFO_PLID |
1619 - STATION_INFO_PLINK_STATE |
1620 - STATION_INFO_LOCAL_PM |
1621 - STATION_INFO_PEER_PM |
1622 - STATION_INFO_NONPEER_PM;
1624 - sinfo->llid = sta->llid;
1625 - sinfo->plid = sta->plid;
1626 - sinfo->plink_state = sta->plink_state;
1627 - if (test_sta_flag(sta, WLAN_STA_TOFFSET_KNOWN)) {
1628 - sinfo->filled |= STATION_INFO_T_OFFSET;
1629 - sinfo->t_offset = sta->t_offset;
1631 - sinfo->local_pm = sta->local_pm;
1632 - sinfo->peer_pm = sta->peer_pm;
1633 - sinfo->nonpeer_pm = sta->nonpeer_pm;
1637 - sinfo->bss_param.flags = 0;
1638 - if (sdata->vif.bss_conf.use_cts_prot)
1639 - sinfo->bss_param.flags |= BSS_PARAM_FLAGS_CTS_PROT;
1640 - if (sdata->vif.bss_conf.use_short_preamble)
1641 - sinfo->bss_param.flags |= BSS_PARAM_FLAGS_SHORT_PREAMBLE;
1642 - if (sdata->vif.bss_conf.use_short_slot)
1643 - sinfo->bss_param.flags |= BSS_PARAM_FLAGS_SHORT_SLOT_TIME;
1644 - sinfo->bss_param.dtim_period = sdata->local->hw.conf.ps_dtim_period;
1645 - sinfo->bss_param.beacon_interval = sdata->vif.bss_conf.beacon_int;
1647 - sinfo->sta_flags.set = 0;
1648 - sinfo->sta_flags.mask = BIT(NL80211_STA_FLAG_AUTHORIZED) |
1649 - BIT(NL80211_STA_FLAG_SHORT_PREAMBLE) |
1650 - BIT(NL80211_STA_FLAG_WME) |
1651 - BIT(NL80211_STA_FLAG_MFP) |
1652 - BIT(NL80211_STA_FLAG_AUTHENTICATED) |
1653 - BIT(NL80211_STA_FLAG_ASSOCIATED) |
1654 - BIT(NL80211_STA_FLAG_TDLS_PEER);
1655 - if (test_sta_flag(sta, WLAN_STA_AUTHORIZED))
1656 - sinfo->sta_flags.set |= BIT(NL80211_STA_FLAG_AUTHORIZED);
1657 - if (test_sta_flag(sta, WLAN_STA_SHORT_PREAMBLE))
1658 - sinfo->sta_flags.set |= BIT(NL80211_STA_FLAG_SHORT_PREAMBLE);
1659 - if (test_sta_flag(sta, WLAN_STA_WME))
1660 - sinfo->sta_flags.set |= BIT(NL80211_STA_FLAG_WME);
1661 - if (test_sta_flag(sta, WLAN_STA_MFP))
1662 - sinfo->sta_flags.set |= BIT(NL80211_STA_FLAG_MFP);
1663 - if (test_sta_flag(sta, WLAN_STA_AUTH))
1664 - sinfo->sta_flags.set |= BIT(NL80211_STA_FLAG_AUTHENTICATED);
1665 - if (test_sta_flag(sta, WLAN_STA_ASSOC))
1666 - sinfo->sta_flags.set |= BIT(NL80211_STA_FLAG_ASSOCIATED);
1667 - if (test_sta_flag(sta, WLAN_STA_TDLS_PEER))
1668 - sinfo->sta_flags.set |= BIT(NL80211_STA_FLAG_TDLS_PEER);
1670 - /* check if the driver has a SW RC implementation */
1671 - if (ref && ref->ops->get_expected_throughput)
1672 - thr = ref->ops->get_expected_throughput(sta->rate_ctrl_priv);
1674 - thr = drv_get_expected_throughput(local, &sta->sta);
1677 - sinfo->filled |= STATION_INFO_EXPECTED_THROUGHPUT;
1678 - sinfo->expected_throughput = thr;
1682 -static const char ieee80211_gstrings_sta_stats[][ETH_GSTRING_LEN] = {
1683 - "rx_packets", "rx_bytes", "wep_weak_iv_count",
1684 - "rx_duplicates", "rx_fragments", "rx_dropped",
1685 - "tx_packets", "tx_bytes", "tx_fragments",
1686 - "tx_filtered", "tx_retry_failed", "tx_retries",
1687 - "beacon_loss", "sta_state", "txrate", "rxrate", "signal",
1688 - "channel", "noise", "ch_time", "ch_time_busy",
1689 - "ch_time_ext_busy", "ch_time_rx", "ch_time_tx"
1691 -#define STA_STATS_LEN ARRAY_SIZE(ieee80211_gstrings_sta_stats)
1693 -static int ieee80211_get_et_sset_count(struct wiphy *wiphy,
1694 - struct net_device *dev,
1697 - struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev);
1700 - if (sset == ETH_SS_STATS)
1701 - rv += STA_STATS_LEN;
1703 - rv += drv_get_et_sset_count(sdata, sset);
1706 - return -EOPNOTSUPP;
1710 -static void ieee80211_get_et_stats(struct wiphy *wiphy,
1711 - struct net_device *dev,
1712 - struct ethtool_stats *stats,
1715 - struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev);
1716 - struct ieee80211_chanctx_conf *chanctx_conf;
1717 - struct ieee80211_channel *channel;
1718 - struct sta_info *sta;
1719 - struct ieee80211_local *local = sdata->local;
1720 - struct station_info sinfo;
1721 - struct survey_info survey;
1723 -#define STA_STATS_SURVEY_LEN 7
1725 - memset(data, 0, sizeof(u64) * STA_STATS_LEN);
1727 -#define ADD_STA_STATS(sta) \
1729 - data[i++] += sta->rx_packets; \
1730 - data[i++] += sta->rx_bytes; \
1731 - data[i++] += sta->wep_weak_iv_count; \
1732 - data[i++] += sta->num_duplicates; \
1733 - data[i++] += sta->rx_fragments; \
1734 - data[i++] += sta->rx_dropped; \
1736 - data[i++] += sinfo.tx_packets; \
1737 - data[i++] += sinfo.tx_bytes; \
1738 - data[i++] += sta->tx_fragments; \
1739 - data[i++] += sta->tx_filtered_count; \
1740 - data[i++] += sta->tx_retry_failed; \
1741 - data[i++] += sta->tx_retry_count; \
1742 - data[i++] += sta->beacon_loss_count; \
1745 - /* For Managed stations, find the single station based on BSSID
1746 - * and use that. For interface types, iterate through all available
1747 - * stations and add stats for any station that is assigned to this
1751 - mutex_lock(&local->sta_mtx);
1753 - if (sdata->vif.type == NL80211_IFTYPE_STATION) {
1754 - sta = sta_info_get_bss(sdata, sdata->u.mgd.bssid);
1756 - if (!(sta && !WARN_ON(sta->sdata->dev != dev)))
1760 - sta_set_sinfo(sta, &sinfo);
1763 - ADD_STA_STATS(sta);
1765 - data[i++] = sta->sta_state;
1768 - if (sinfo.filled & STATION_INFO_TX_BITRATE)
1769 - data[i] = 100000 *
1770 - cfg80211_calculate_bitrate(&sinfo.txrate);
1772 - if (sinfo.filled & STATION_INFO_RX_BITRATE)
1773 - data[i] = 100000 *
1774 - cfg80211_calculate_bitrate(&sinfo.rxrate);
1777 - if (sinfo.filled & STATION_INFO_SIGNAL_AVG)
1778 - data[i] = (u8)sinfo.signal_avg;
1781 - list_for_each_entry(sta, &local->sta_list, list) {
1782 - /* Make sure this station belongs to the proper dev */
1783 - if (sta->sdata->dev != dev)
1787 - sta_set_sinfo(sta, &sinfo);
1789 - ADD_STA_STATS(sta);
1794 - i = STA_STATS_LEN - STA_STATS_SURVEY_LEN;
1795 - /* Get survey stats for current channel */
1796 - survey.filled = 0;
1799 - chanctx_conf = rcu_dereference(sdata->vif.chanctx_conf);
1801 - channel = chanctx_conf->def.chan;
1804 - rcu_read_unlock();
1809 - survey.filled = 0;
1810 - if (drv_get_survey(local, q, &survey) != 0) {
1811 - survey.filled = 0;
1815 - } while (channel != survey.channel);
1818 - if (survey.filled)
1819 - data[i++] = survey.channel->center_freq;
1822 - if (survey.filled & SURVEY_INFO_NOISE_DBM)
1823 - data[i++] = (u8)survey.noise;
1826 - if (survey.filled & SURVEY_INFO_CHANNEL_TIME)
1827 - data[i++] = survey.channel_time;
1830 - if (survey.filled & SURVEY_INFO_CHANNEL_TIME_BUSY)
1831 - data[i++] = survey.channel_time_busy;
1834 - if (survey.filled & SURVEY_INFO_CHANNEL_TIME_EXT_BUSY)
1835 - data[i++] = survey.channel_time_ext_busy;
1838 - if (survey.filled & SURVEY_INFO_CHANNEL_TIME_RX)
1839 - data[i++] = survey.channel_time_rx;
1842 - if (survey.filled & SURVEY_INFO_CHANNEL_TIME_TX)
1843 - data[i++] = survey.channel_time_tx;
1847 - mutex_unlock(&local->sta_mtx);
1849 - if (WARN_ON(i != STA_STATS_LEN))
1852 - drv_get_et_stats(sdata, stats, &(data[STA_STATS_LEN]));
1855 -static void ieee80211_get_et_strings(struct wiphy *wiphy,
1856 - struct net_device *dev,
1857 - u32 sset, u8 *data)
1859 - struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev);
1860 - int sz_sta_stats = 0;
1862 - if (sset == ETH_SS_STATS) {
1863 - sz_sta_stats = sizeof(ieee80211_gstrings_sta_stats);
1864 - memcpy(data, ieee80211_gstrings_sta_stats, sz_sta_stats);
1866 - drv_get_et_strings(sdata, sset, &(data[sz_sta_stats]));
1869 static int ieee80211_dump_station(struct wiphy *wiphy, struct net_device *dev,
1870 int idx, u8 *mac, struct station_info *sinfo)
1872 @@ -875,7 +554,8 @@ static int ieee80211_set_monitor_channel
1875 static int ieee80211_set_probe_resp(struct ieee80211_sub_if_data *sdata,
1876 - const u8 *resp, size_t resp_len)
1877 + const u8 *resp, size_t resp_len,
1878 + const struct ieee80211_csa_settings *csa)
1880 struct probe_resp *new, *old;
1882 @@ -891,6 +571,11 @@ static int ieee80211_set_probe_resp(stru
1883 new->len = resp_len;
1884 memcpy(new->data, resp, resp_len);
1887 + memcpy(new->csa_counter_offsets, csa->counter_offsets_presp,
1888 + csa->n_counter_offsets_presp *
1889 + sizeof(new->csa_counter_offsets[0]));
1891 rcu_assign_pointer(sdata->u.ap.probe_resp, new);
1893 kfree_rcu(old, rcu_head);
1894 @@ -899,7 +584,8 @@ static int ieee80211_set_probe_resp(stru
1897 static int ieee80211_assign_beacon(struct ieee80211_sub_if_data *sdata,
1898 - struct cfg80211_beacon_data *params)
1899 + struct cfg80211_beacon_data *params,
1900 + const struct ieee80211_csa_settings *csa)
1902 struct beacon_data *new, *old;
1903 int new_head_len, new_tail_len;
1904 @@ -943,6 +629,13 @@ static int ieee80211_assign_beacon(struc
1905 new->head_len = new_head_len;
1906 new->tail_len = new_tail_len;
1909 + new->csa_current_counter = csa->count;
1910 + memcpy(new->csa_counter_offsets, csa->counter_offsets_beacon,
1911 + csa->n_counter_offsets_beacon *
1912 + sizeof(new->csa_counter_offsets[0]));
1917 memcpy(new->head, params->head, new_head_len);
1918 @@ -957,7 +650,7 @@ static int ieee80211_assign_beacon(struc
1919 memcpy(new->tail, old->tail, new_tail_len);
1921 err = ieee80211_set_probe_resp(sdata, params->probe_resp,
1922 - params->probe_resp_len);
1923 + params->probe_resp_len, csa);
1927 @@ -1042,7 +735,7 @@ static int ieee80211_start_ap(struct wip
1928 sdata->vif.bss_conf.p2p_noa_attr.oppps_ctwindow |=
1929 IEEE80211_P2P_OPPPS_ENABLE_BIT;
1931 - err = ieee80211_assign_beacon(sdata, ¶ms->beacon);
1932 + err = ieee80211_assign_beacon(sdata, ¶ms->beacon, NULL);
1934 ieee80211_vif_release_channel(sdata);
1936 @@ -1090,7 +783,7 @@ static int ieee80211_change_beacon(struc
1940 - err = ieee80211_assign_beacon(sdata, params);
1941 + err = ieee80211_assign_beacon(sdata, params, NULL);
1944 ieee80211_bss_info_change_notify(sdata, err);
1945 @@ -3073,7 +2766,8 @@ static int ieee80211_set_after_csa_beaco
1947 switch (sdata->vif.type) {
1948 case NL80211_IFTYPE_AP:
1949 - err = ieee80211_assign_beacon(sdata, sdata->u.ap.next_beacon);
1950 + err = ieee80211_assign_beacon(sdata, sdata->u.ap.next_beacon,
1952 kfree(sdata->u.ap.next_beacon);
1953 sdata->u.ap.next_beacon = NULL;
1955 @@ -3176,6 +2870,7 @@ static int ieee80211_set_csa_beacon(stru
1956 struct cfg80211_csa_settings *params,
1959 + struct ieee80211_csa_settings csa = {};
1962 switch (sdata->vif.type) {
1963 @@ -3210,20 +2905,13 @@ static int ieee80211_set_csa_beacon(stru
1964 IEEE80211_MAX_CSA_COUNTERS_NUM))
1967 - /* make sure we don't have garbage in other counters */
1968 - memset(sdata->csa_counter_offset_beacon, 0,
1969 - sizeof(sdata->csa_counter_offset_beacon));
1970 - memset(sdata->csa_counter_offset_presp, 0,
1971 - sizeof(sdata->csa_counter_offset_presp));
1973 - memcpy(sdata->csa_counter_offset_beacon,
1974 - params->counter_offsets_beacon,
1975 - params->n_counter_offsets_beacon * sizeof(u16));
1976 - memcpy(sdata->csa_counter_offset_presp,
1977 - params->counter_offsets_presp,
1978 - params->n_counter_offsets_presp * sizeof(u16));
1979 + csa.counter_offsets_beacon = params->counter_offsets_beacon;
1980 + csa.counter_offsets_presp = params->counter_offsets_presp;
1981 + csa.n_counter_offsets_beacon = params->n_counter_offsets_beacon;
1982 + csa.n_counter_offsets_presp = params->n_counter_offsets_presp;
1983 + csa.count = params->count;
1985 - err = ieee80211_assign_beacon(sdata, ¶ms->beacon_csa);
1986 + err = ieee80211_assign_beacon(sdata, ¶ms->beacon_csa, &csa);
1988 kfree(sdata->u.ap.next_beacon);
1990 @@ -3367,7 +3055,6 @@ __ieee80211_channel_switch(struct wiphy
1991 sdata->csa_radar_required = params->radar_required;
1992 sdata->csa_chandef = params->chandef;
1993 sdata->csa_block_tx = params->block_tx;
1994 - sdata->csa_current_counter = params->count;
1995 sdata->vif.csa_active = true;
1997 if (sdata->csa_block_tx)
1998 @@ -3515,10 +3202,23 @@ static int ieee80211_mgmt_tx(struct wiph
1999 sdata->vif.type == NL80211_IFTYPE_ADHOC) &&
2000 params->n_csa_offsets) {
2002 - u8 c = sdata->csa_current_counter;
2003 + struct beacon_data *beacon = NULL;
2007 - for (i = 0; i < params->n_csa_offsets; i++)
2008 - data[params->csa_offsets[i]] = c;
2009 + if (sdata->vif.type == NL80211_IFTYPE_AP)
2010 + beacon = rcu_dereference(sdata->u.ap.beacon);
2011 + else if (sdata->vif.type == NL80211_IFTYPE_ADHOC)
2012 + beacon = rcu_dereference(sdata->u.ibss.presp);
2013 + else if (ieee80211_vif_is_mesh(&sdata->vif))
2014 + beacon = rcu_dereference(sdata->u.mesh.beacon);
2017 + for (i = 0; i < params->n_csa_offsets; i++)
2018 + data[params->csa_offsets[i]] =
2019 + beacon->csa_current_counter;
2021 + rcu_read_unlock();
2024 IEEE80211_SKB_CB(skb)->flags = flags;
2025 @@ -3598,21 +3298,6 @@ static int ieee80211_get_antenna(struct
2026 return drv_get_antenna(local, tx_ant, rx_ant);
2029 -static int ieee80211_set_ringparam(struct wiphy *wiphy, u32 tx, u32 rx)
2031 - struct ieee80211_local *local = wiphy_priv(wiphy);
2033 - return drv_set_ringparam(local, tx, rx);
2036 -static void ieee80211_get_ringparam(struct wiphy *wiphy,
2037 - u32 *tx, u32 *tx_max, u32 *rx, u32 *rx_max)
2039 - struct ieee80211_local *local = wiphy_priv(wiphy);
2041 - drv_get_ringparam(local, tx, tx_max, rx, rx_max);
2044 static int ieee80211_set_rekey_data(struct wiphy *wiphy,
2045 struct net_device *dev,
2046 struct cfg80211_gtk_rekey_data *data)
2047 @@ -3844,8 +3529,6 @@ const struct cfg80211_ops mac80211_confi
2048 .mgmt_frame_register = ieee80211_mgmt_frame_register,
2049 .set_antenna = ieee80211_set_antenna,
2050 .get_antenna = ieee80211_get_antenna,
2051 - .set_ringparam = ieee80211_set_ringparam,
2052 - .get_ringparam = ieee80211_get_ringparam,
2053 .set_rekey_data = ieee80211_set_rekey_data,
2054 .tdls_oper = ieee80211_tdls_oper,
2055 .tdls_mgmt = ieee80211_tdls_mgmt,
2056 @@ -3854,9 +3537,6 @@ const struct cfg80211_ops mac80211_confi
2058 .set_wakeup = ieee80211_set_wakeup,
2060 - .get_et_sset_count = ieee80211_get_et_sset_count,
2061 - .get_et_stats = ieee80211_get_et_stats,
2062 - .get_et_strings = ieee80211_get_et_strings,
2063 .get_channel = ieee80211_cfg_get_channel,
2064 .start_radar_detection = ieee80211_start_radar_detection,
2065 .channel_switch = ieee80211_channel_switch,
2066 --- a/net/mac80211/debugfs_sta.c
2067 +++ b/net/mac80211/debugfs_sta.c
2068 @@ -587,7 +587,6 @@ void ieee80211_sta_debugfs_add(struct st
2069 DEBUGFS_ADD_COUNTER(tx_filtered, tx_filtered_count);
2070 DEBUGFS_ADD_COUNTER(tx_retry_failed, tx_retry_failed);
2071 DEBUGFS_ADD_COUNTER(tx_retry_count, tx_retry_count);
2072 - DEBUGFS_ADD_COUNTER(wep_weak_iv_count, wep_weak_iv_count);
2074 if (sizeof(sta->driver_buffered_tids) == sizeof(u32))
2075 debugfs_create_x32("driver_buffered_tids", 0400,
2076 --- a/net/mac80211/wep.c
2077 +++ b/net/mac80211/wep.c
2078 @@ -271,22 +271,6 @@ static int ieee80211_wep_decrypt(struct
2083 -static bool ieee80211_wep_is_weak_iv(struct sk_buff *skb,
2084 - struct ieee80211_key *key)
2086 - struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data;
2087 - unsigned int hdrlen;
2091 - hdrlen = ieee80211_hdrlen(hdr->frame_control);
2092 - ivpos = skb->data + hdrlen;
2093 - iv = (ivpos[0] << 16) | (ivpos[1] << 8) | ivpos[2];
2095 - return ieee80211_wep_weak_iv(iv, key->conf.keylen);
2099 ieee80211_crypto_wep_decrypt(struct ieee80211_rx_data *rx)
2101 @@ -301,16 +285,12 @@ ieee80211_crypto_wep_decrypt(struct ieee
2102 if (!(status->flag & RX_FLAG_DECRYPTED)) {
2103 if (skb_linearize(rx->skb))
2104 return RX_DROP_UNUSABLE;
2105 - if (rx->sta && ieee80211_wep_is_weak_iv(rx->skb, rx->key))
2106 - rx->sta->wep_weak_iv_count++;
2107 if (ieee80211_wep_decrypt(rx->local, rx->skb, rx->key))
2108 return RX_DROP_UNUSABLE;
2109 } else if (!(status->flag & RX_FLAG_IV_STRIPPED)) {
2110 if (!pskb_may_pull(rx->skb, ieee80211_hdrlen(fc) +
2111 IEEE80211_WEP_IV_LEN))
2112 return RX_DROP_UNUSABLE;
2113 - if (rx->sta && ieee80211_wep_is_weak_iv(rx->skb, rx->key))
2114 - rx->sta->wep_weak_iv_count++;
2115 ieee80211_wep_remove_iv(rx->local, rx->skb, rx->key);
2117 if (pskb_trim(rx->skb, rx->skb->len - IEEE80211_WEP_ICV_LEN))
2118 --- a/include/net/cfg80211.h
2119 +++ b/include/net/cfg80211.h
2120 @@ -2278,16 +2278,6 @@ struct cfg80211_qos_map {
2122 * @set_noack_map: Set the NoAck Map for the TIDs.
2124 - * @get_et_sset_count: Ethtool API to get string-set count.
2125 - * See @ethtool_ops.get_sset_count
2127 - * @get_et_stats: Ethtool API to get a set of u64 stats.
2128 - * See @ethtool_ops.get_ethtool_stats
2130 - * @get_et_strings: Ethtool API to get a set of strings to describe stats
2131 - * and perhaps other supported types of ethtool data-sets.
2132 - * See @ethtool_ops.get_strings
2134 * @get_channel: Get the current operating channel for the virtual interface.
2135 * For monitor interfaces, it should return %NULL unless there's a single
2136 * current monitoring channel.
2137 @@ -2529,13 +2519,6 @@ struct cfg80211_ops {
2138 struct net_device *dev,
2141 - int (*get_et_sset_count)(struct wiphy *wiphy,
2142 - struct net_device *dev, int sset);
2143 - void (*get_et_stats)(struct wiphy *wiphy, struct net_device *dev,
2144 - struct ethtool_stats *stats, u64 *data);
2145 - void (*get_et_strings)(struct wiphy *wiphy, struct net_device *dev,
2146 - u32 sset, u8 *data);
2148 int (*get_channel)(struct wiphy *wiphy,
2149 struct wireless_dev *wdev,
2150 struct cfg80211_chan_def *chandef);
2151 @@ -4846,6 +4829,10 @@ void cfg80211_stop_iface(struct wiphy *w
2153 void cfg80211_shutdown_all_interfaces(struct wiphy *wiphy);
2156 +/* ethtool helper */
2157 +void cfg80211_get_drvinfo(struct net_device *dev, struct ethtool_drvinfo *info);
2159 /* Logging, debugging and troubleshooting/diagnostic helpers. */
2161 /* wiphy_printk helpers, similar to dev_printk */
2162 --- a/net/mac80211/Makefile
2163 +++ b/net/mac80211/Makefile
2164 @@ -17,6 +17,7 @@ mac80211-y := \
2172 --- a/net/mac80211/ieee80211_i.h
2173 +++ b/net/mac80211/ieee80211_i.h
2174 @@ -229,16 +229,29 @@ struct ieee80211_rx_data {
2178 +struct ieee80211_csa_settings {
2179 + const u16 *counter_offsets_beacon;
2180 + const u16 *counter_offsets_presp;
2182 + int n_counter_offsets_beacon;
2183 + int n_counter_offsets_presp;
2188 struct beacon_data {
2190 int head_len, tail_len;
2191 struct ieee80211_meshconf_ie *meshconf;
2192 + u16 csa_counter_offsets[IEEE80211_MAX_CSA_COUNTERS_NUM];
2193 + u8 csa_current_counter;
2194 struct rcu_head rcu_head;
2198 struct rcu_head rcu_head;
2200 + u16 csa_counter_offsets[IEEE80211_MAX_CSA_COUNTERS_NUM];
2204 @@ -754,8 +767,6 @@ struct ieee80211_sub_if_data {
2205 struct mac80211_qos_map __rcu *qos_map;
2207 struct work_struct csa_finalize_work;
2208 - u16 csa_counter_offset_beacon[IEEE80211_MAX_CSA_COUNTERS_NUM];
2209 - u16 csa_counter_offset_presp[IEEE80211_MAX_CSA_COUNTERS_NUM];
2210 bool csa_radar_required;
2211 bool csa_block_tx; /* write-protected by sdata_lock and local->mtx */
2212 struct cfg80211_chan_def csa_chandef;
2213 @@ -767,7 +778,6 @@ struct ieee80211_sub_if_data {
2214 struct ieee80211_chanctx *reserved_chanctx;
2215 struct cfg80211_chan_def reserved_chandef;
2216 bool reserved_radar_required;
2217 - u8 csa_current_counter;
2219 /* used to reconfigure hardware SM PS */
2220 struct work_struct recalc_smps;
2221 @@ -1850,6 +1860,8 @@ int ieee80211_tdls_oper(struct wiphy *wi
2222 const u8 *peer, enum nl80211_tdls_operation oper);
2225 +extern const struct ethtool_ops ieee80211_ethtool_ops;
2227 #ifdef CPTCFG_MAC80211_NOINLINE
2228 #define debug_noinline noinline
2230 --- a/net/mac80211/iface.c
2231 +++ b/net/mac80211/iface.c
2232 @@ -399,6 +399,7 @@ int ieee80211_add_virtual_monitor(struct
2233 sdata->vif.type = NL80211_IFTYPE_MONITOR;
2234 snprintf(sdata->name, IFNAMSIZ, "%s-monitor",
2235 wiphy_name(local->hw.wiphy));
2236 + sdata->wdev.iftype = NL80211_IFTYPE_MONITOR;
2238 sdata->encrypt_headroom = IEEE80211_ENCRYPT_HEADROOM;
2240 @@ -1303,6 +1304,7 @@ static void ieee80211_setup_sdata(struct
2241 sdata->control_port_protocol = cpu_to_be16(ETH_P_PAE);
2242 sdata->control_port_no_encrypt = false;
2243 sdata->encrypt_headroom = IEEE80211_ENCRYPT_HEADROOM;
2244 + sdata->vif.bss_conf.idle = true;
2246 sdata->noack_map = 0;
2248 @@ -1721,6 +1723,8 @@ int ieee80211_if_add(struct ieee80211_lo
2250 ndev->features |= local->hw.netdev_features;
2252 + netdev_set_default_ethtool_ops(ndev, &ieee80211_ethtool_ops);
2254 ret = register_netdevice(ndev);
2257 --- a/net/wireless/core.c
2258 +++ b/net/wireless/core.c
2261 #include "debugfs.h"
2262 #include "wext-compat.h"
2263 -#include "ethtool.h"
2264 #include "rdev-ops.h"
2266 /* name for sysfs, %d is appended */
2267 @@ -940,8 +939,6 @@ static int cfg80211_netdev_notifier_call
2268 /* allow mac80211 to determine the timeout */
2269 wdev->ps_timeout = -1;
2271 - netdev_set_default_ethtool_ops(dev, &cfg80211_ethtool_ops);
2273 if ((wdev->iftype == NL80211_IFTYPE_STATION ||
2274 wdev->iftype == NL80211_IFTYPE_P2P_CLIENT ||
2275 wdev->iftype == NL80211_IFTYPE_ADHOC) && !wdev->use_4addr)
2276 --- a/net/wireless/ethtool.c
2277 +++ b/net/wireless/ethtool.c
2279 #include <linux/utsname.h>
2280 #include <net/cfg80211.h>
2282 -#include "ethtool.h"
2283 #include "rdev-ops.h"
2285 -static void cfg80211_get_drvinfo(struct net_device *dev,
2286 - struct ethtool_drvinfo *info)
2287 +void cfg80211_get_drvinfo(struct net_device *dev, struct ethtool_drvinfo *info)
2289 struct wireless_dev *wdev = dev->ieee80211_ptr;
2291 @@ -23,84 +21,4 @@ static void cfg80211_get_drvinfo(struct
2292 strlcpy(info->bus_info, dev_name(wiphy_dev(wdev->wiphy)),
2293 sizeof(info->bus_info));
2296 -static int cfg80211_get_regs_len(struct net_device *dev)
2298 - /* For now, return 0... */
2302 -static void cfg80211_get_regs(struct net_device *dev, struct ethtool_regs *regs,
2305 - struct wireless_dev *wdev = dev->ieee80211_ptr;
2307 - regs->version = wdev->wiphy->hw_version;
2311 -static void cfg80211_get_ringparam(struct net_device *dev,
2312 - struct ethtool_ringparam *rp)
2314 - struct wireless_dev *wdev = dev->ieee80211_ptr;
2315 - struct cfg80211_registered_device *rdev = wiphy_to_rdev(wdev->wiphy);
2317 - memset(rp, 0, sizeof(*rp));
2319 - if (rdev->ops->get_ringparam)
2320 - rdev_get_ringparam(rdev, &rp->tx_pending, &rp->tx_max_pending,
2321 - &rp->rx_pending, &rp->rx_max_pending);
2324 -static int cfg80211_set_ringparam(struct net_device *dev,
2325 - struct ethtool_ringparam *rp)
2327 - struct wireless_dev *wdev = dev->ieee80211_ptr;
2328 - struct cfg80211_registered_device *rdev = wiphy_to_rdev(wdev->wiphy);
2330 - if (rp->rx_mini_pending != 0 || rp->rx_jumbo_pending != 0)
2333 - if (rdev->ops->set_ringparam)
2334 - return rdev_set_ringparam(rdev, rp->tx_pending, rp->rx_pending);
2339 -static int cfg80211_get_sset_count(struct net_device *dev, int sset)
2341 - struct wireless_dev *wdev = dev->ieee80211_ptr;
2342 - struct cfg80211_registered_device *rdev = wiphy_to_rdev(wdev->wiphy);
2343 - if (rdev->ops->get_et_sset_count)
2344 - return rdev_get_et_sset_count(rdev, dev, sset);
2345 - return -EOPNOTSUPP;
2348 -static void cfg80211_get_stats(struct net_device *dev,
2349 - struct ethtool_stats *stats, u64 *data)
2351 - struct wireless_dev *wdev = dev->ieee80211_ptr;
2352 - struct cfg80211_registered_device *rdev = wiphy_to_rdev(wdev->wiphy);
2353 - if (rdev->ops->get_et_stats)
2354 - rdev_get_et_stats(rdev, dev, stats, data);
2357 -static void cfg80211_get_strings(struct net_device *dev, u32 sset, u8 *data)
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_strings)
2362 - rdev_get_et_strings(rdev, dev, sset, data);
2365 -const struct ethtool_ops cfg80211_ethtool_ops = {
2366 - .get_drvinfo = cfg80211_get_drvinfo,
2367 - .get_regs_len = cfg80211_get_regs_len,
2368 - .get_regs = cfg80211_get_regs,
2369 - .get_link = ethtool_op_get_link,
2370 - .get_ringparam = cfg80211_get_ringparam,
2371 - .set_ringparam = cfg80211_set_ringparam,
2372 - .get_strings = cfg80211_get_strings,
2373 - .get_ethtool_stats = cfg80211_get_stats,
2374 - .get_sset_count = cfg80211_get_sset_count,
2376 +EXPORT_SYMBOL(cfg80211_get_drvinfo);
2377 --- a/net/wireless/ethtool.h
2380 -#ifndef __CFG80211_ETHTOOL__
2381 -#define __CFG80211_ETHTOOL__
2383 -extern const struct ethtool_ops cfg80211_ethtool_ops;
2385 -#endif /* __CFG80211_ETHTOOL__ */
2386 --- a/net/wireless/rdev-ops.h
2387 +++ b/net/wireless/rdev-ops.h
2388 @@ -714,25 +714,6 @@ static inline int rdev_get_antenna(struc
2392 -static inline int rdev_set_ringparam(struct cfg80211_registered_device *rdev,
2396 - trace_rdev_set_ringparam(&rdev->wiphy, tx, rx);
2397 - ret = rdev->ops->set_ringparam(&rdev->wiphy, tx, rx);
2398 - trace_rdev_return_int(&rdev->wiphy, ret);
2402 -static inline void rdev_get_ringparam(struct cfg80211_registered_device *rdev,
2403 - u32 *tx, u32 *tx_max, u32 *rx,
2406 - trace_rdev_get_ringparam(&rdev->wiphy);
2407 - rdev->ops->get_ringparam(&rdev->wiphy, tx, tx_max, rx, rx_max);
2408 - trace_rdev_return_void_tx_rx(&rdev->wiphy, *tx, *tx_max, *rx, *rx_max);
2412 rdev_sched_scan_start(struct cfg80211_registered_device *rdev,
2413 struct net_device *dev,
2414 @@ -816,35 +797,6 @@ static inline int rdev_set_noack_map(str
2418 -rdev_get_et_sset_count(struct cfg80211_registered_device *rdev,
2419 - struct net_device *dev, int sset)
2422 - trace_rdev_get_et_sset_count(&rdev->wiphy, dev, sset);
2423 - ret = rdev->ops->get_et_sset_count(&rdev->wiphy, dev, sset);
2424 - trace_rdev_return_int(&rdev->wiphy, ret);
2428 -static inline void rdev_get_et_stats(struct cfg80211_registered_device *rdev,
2429 - struct net_device *dev,
2430 - struct ethtool_stats *stats, u64 *data)
2432 - trace_rdev_get_et_stats(&rdev->wiphy, dev);
2433 - rdev->ops->get_et_stats(&rdev->wiphy, dev, stats, data);
2434 - trace_rdev_return_void(&rdev->wiphy);
2437 -static inline void rdev_get_et_strings(struct cfg80211_registered_device *rdev,
2438 - struct net_device *dev, u32 sset,
2441 - trace_rdev_get_et_strings(&rdev->wiphy, dev, sset);
2442 - rdev->ops->get_et_strings(&rdev->wiphy, dev, sset, data);
2443 - trace_rdev_return_void(&rdev->wiphy);
2447 rdev_get_channel(struct cfg80211_registered_device *rdev,
2448 struct wireless_dev *wdev,
2449 struct cfg80211_chan_def *chandef)
2450 --- a/net/wireless/trace.h
2451 +++ b/net/wireless/trace.h
2452 @@ -298,11 +298,6 @@ DEFINE_EVENT(wiphy_only_evt, rdev_return
2456 -DEFINE_EVENT(wiphy_only_evt, rdev_get_ringparam,
2457 - TP_PROTO(struct wiphy *wiphy),
2461 DEFINE_EVENT(wiphy_only_evt, rdev_get_antenna,
2462 TP_PROTO(struct wiphy *wiphy),
2464 @@ -580,11 +575,6 @@ DEFINE_EVENT(wiphy_netdev_evt, rdev_stop
2465 TP_ARGS(wiphy, netdev)
2468 -DEFINE_EVENT(wiphy_netdev_evt, rdev_get_et_stats,
2469 - TP_PROTO(struct wiphy *wiphy, struct net_device *netdev),
2470 - TP_ARGS(wiphy, netdev)
2473 DEFINE_EVENT(wiphy_netdev_evt, rdev_sched_scan_stop,
2474 TP_PROTO(struct wiphy *wiphy, struct net_device *netdev),
2475 TP_ARGS(wiphy, netdev)
2476 @@ -1439,11 +1429,6 @@ DECLARE_EVENT_CLASS(tx_rx_evt,
2477 WIPHY_PR_ARG, __entry->tx, __entry->rx)
2480 -DEFINE_EVENT(tx_rx_evt, rdev_set_ringparam,
2481 - TP_PROTO(struct wiphy *wiphy, u32 tx, u32 rx),
2482 - TP_ARGS(wiphy, rx, tx)
2485 DEFINE_EVENT(tx_rx_evt, rdev_set_antenna,
2486 TP_PROTO(struct wiphy *wiphy, u32 tx, u32 rx),
2487 TP_ARGS(wiphy, rx, tx)
2488 @@ -1725,40 +1710,6 @@ TRACE_EVENT(rdev_set_noack_map,
2489 WIPHY_PR_ARG, NETDEV_PR_ARG, __entry->noack_map)
2492 -TRACE_EVENT(rdev_get_et_sset_count,
2493 - TP_PROTO(struct wiphy *wiphy, struct net_device *netdev, int sset),
2494 - TP_ARGS(wiphy, netdev, sset),
2498 - __field(int, sset)
2503 - __entry->sset = sset;
2505 - TP_printk(WIPHY_PR_FMT ", " NETDEV_PR_FMT ", sset: %d",
2506 - WIPHY_PR_ARG, NETDEV_PR_ARG, __entry->sset)
2509 -TRACE_EVENT(rdev_get_et_strings,
2510 - TP_PROTO(struct wiphy *wiphy, struct net_device *netdev, u32 sset),
2511 - TP_ARGS(wiphy, netdev, sset),
2515 - __field(u32, sset)
2520 - __entry->sset = sset;
2522 - TP_printk(WIPHY_PR_FMT ", " NETDEV_PR_FMT ", sset: %u",
2523 - WIPHY_PR_ARG, NETDEV_PR_ARG, __entry->sset)
2526 DEFINE_EVENT(wiphy_wdev_evt, rdev_get_channel,
2527 TP_PROTO(struct wiphy *wiphy, struct wireless_dev *wdev),
2528 TP_ARGS(wiphy, wdev)
2530 +++ b/net/mac80211/ethtool.c
2533 + * mac80211 ethtool hooks for cfg80211
2535 + * Copied from cfg.c - originally
2536 + * Copyright 2006-2010 Johannes Berg <johannes@sipsolutions.net>
2537 + * Copyright 2014 Intel Corporation (Author: Johannes Berg)
2539 + * This file is GPLv2 as found in COPYING.
2541 +#include <linux/types.h>
2542 +#include <net/cfg80211.h>
2543 +#include "ieee80211_i.h"
2544 +#include "sta_info.h"
2545 +#include "driver-ops.h"
2547 +static int ieee80211_set_ringparam(struct net_device *dev,
2548 + struct ethtool_ringparam *rp)
2550 + struct ieee80211_local *local = wiphy_priv(dev->ieee80211_ptr->wiphy);
2552 + if (rp->rx_mini_pending != 0 || rp->rx_jumbo_pending != 0)
2555 + return drv_set_ringparam(local, rp->tx_pending, rp->rx_pending);
2558 +static void ieee80211_get_ringparam(struct net_device *dev,
2559 + struct ethtool_ringparam *rp)
2561 + struct ieee80211_local *local = wiphy_priv(dev->ieee80211_ptr->wiphy);
2563 + memset(rp, 0, sizeof(*rp));
2565 + drv_get_ringparam(local, &rp->tx_pending, &rp->tx_max_pending,
2566 + &rp->rx_pending, &rp->rx_max_pending);
2569 +static const char ieee80211_gstrings_sta_stats[][ETH_GSTRING_LEN] = {
2570 + "rx_packets", "rx_bytes",
2571 + "rx_duplicates", "rx_fragments", "rx_dropped",
2572 + "tx_packets", "tx_bytes", "tx_fragments",
2573 + "tx_filtered", "tx_retry_failed", "tx_retries",
2574 + "beacon_loss", "sta_state", "txrate", "rxrate", "signal",
2575 + "channel", "noise", "ch_time", "ch_time_busy",
2576 + "ch_time_ext_busy", "ch_time_rx", "ch_time_tx"
2578 +#define STA_STATS_LEN ARRAY_SIZE(ieee80211_gstrings_sta_stats)
2580 +static int ieee80211_get_sset_count(struct net_device *dev, int sset)
2582 + struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev);
2585 + if (sset == ETH_SS_STATS)
2586 + rv += STA_STATS_LEN;
2588 + rv += drv_get_et_sset_count(sdata, sset);
2591 + return -EOPNOTSUPP;
2595 +static void ieee80211_get_stats(struct net_device *dev,
2596 + struct ethtool_stats *stats,
2599 + struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev);
2600 + struct ieee80211_chanctx_conf *chanctx_conf;
2601 + struct ieee80211_channel *channel;
2602 + struct sta_info *sta;
2603 + struct ieee80211_local *local = sdata->local;
2604 + struct station_info sinfo;
2605 + struct survey_info survey;
2607 +#define STA_STATS_SURVEY_LEN 7
2609 + memset(data, 0, sizeof(u64) * STA_STATS_LEN);
2611 +#define ADD_STA_STATS(sta) \
2613 + data[i++] += sta->rx_packets; \
2614 + data[i++] += sta->rx_bytes; \
2615 + data[i++] += sta->num_duplicates; \
2616 + data[i++] += sta->rx_fragments; \
2617 + data[i++] += sta->rx_dropped; \
2619 + data[i++] += sinfo.tx_packets; \
2620 + data[i++] += sinfo.tx_bytes; \
2621 + data[i++] += sta->tx_fragments; \
2622 + data[i++] += sta->tx_filtered_count; \
2623 + data[i++] += sta->tx_retry_failed; \
2624 + data[i++] += sta->tx_retry_count; \
2625 + data[i++] += sta->beacon_loss_count; \
2628 + /* For Managed stations, find the single station based on BSSID
2629 + * and use that. For interface types, iterate through all available
2630 + * stations and add stats for any station that is assigned to this
2634 + mutex_lock(&local->sta_mtx);
2636 + if (sdata->vif.type == NL80211_IFTYPE_STATION) {
2637 + sta = sta_info_get_bss(sdata, sdata->u.mgd.bssid);
2639 + if (!(sta && !WARN_ON(sta->sdata->dev != dev)))
2643 + sta_set_sinfo(sta, &sinfo);
2646 + ADD_STA_STATS(sta);
2648 + data[i++] = sta->sta_state;
2651 + if (sinfo.filled & STATION_INFO_TX_BITRATE)
2652 + data[i] = 100000 *
2653 + cfg80211_calculate_bitrate(&sinfo.txrate);
2655 + if (sinfo.filled & STATION_INFO_RX_BITRATE)
2656 + data[i] = 100000 *
2657 + cfg80211_calculate_bitrate(&sinfo.rxrate);
2660 + if (sinfo.filled & STATION_INFO_SIGNAL_AVG)
2661 + data[i] = (u8)sinfo.signal_avg;
2664 + list_for_each_entry(sta, &local->sta_list, list) {
2665 + /* Make sure this station belongs to the proper dev */
2666 + if (sta->sdata->dev != dev)
2670 + sta_set_sinfo(sta, &sinfo);
2672 + ADD_STA_STATS(sta);
2677 + i = STA_STATS_LEN - STA_STATS_SURVEY_LEN;
2678 + /* Get survey stats for current channel */
2679 + survey.filled = 0;
2682 + chanctx_conf = rcu_dereference(sdata->vif.chanctx_conf);
2684 + channel = chanctx_conf->def.chan;
2687 + rcu_read_unlock();
2692 + survey.filled = 0;
2693 + if (drv_get_survey(local, q, &survey) != 0) {
2694 + survey.filled = 0;
2698 + } while (channel != survey.channel);
2701 + if (survey.filled)
2702 + data[i++] = survey.channel->center_freq;
2705 + if (survey.filled & SURVEY_INFO_NOISE_DBM)
2706 + data[i++] = (u8)survey.noise;
2709 + if (survey.filled & SURVEY_INFO_CHANNEL_TIME)
2710 + data[i++] = survey.channel_time;
2713 + if (survey.filled & SURVEY_INFO_CHANNEL_TIME_BUSY)
2714 + data[i++] = survey.channel_time_busy;
2717 + if (survey.filled & SURVEY_INFO_CHANNEL_TIME_EXT_BUSY)
2718 + data[i++] = survey.channel_time_ext_busy;
2721 + if (survey.filled & SURVEY_INFO_CHANNEL_TIME_RX)
2722 + data[i++] = survey.channel_time_rx;
2725 + if (survey.filled & SURVEY_INFO_CHANNEL_TIME_TX)
2726 + data[i++] = survey.channel_time_tx;
2730 + mutex_unlock(&local->sta_mtx);
2732 + if (WARN_ON(i != STA_STATS_LEN))
2735 + drv_get_et_stats(sdata, stats, &(data[STA_STATS_LEN]));
2738 +static void ieee80211_get_strings(struct net_device *dev, u32 sset, u8 *data)
2740 + struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev);
2741 + int sz_sta_stats = 0;
2743 + if (sset == ETH_SS_STATS) {
2744 + sz_sta_stats = sizeof(ieee80211_gstrings_sta_stats);
2745 + memcpy(data, ieee80211_gstrings_sta_stats, sz_sta_stats);
2747 + drv_get_et_strings(sdata, sset, &(data[sz_sta_stats]));
2750 +static int ieee80211_get_regs_len(struct net_device *dev)
2755 +static void ieee80211_get_regs(struct net_device *dev,
2756 + struct ethtool_regs *regs,
2759 + struct wireless_dev *wdev = dev->ieee80211_ptr;
2761 + regs->version = wdev->wiphy->hw_version;
2765 +const struct ethtool_ops ieee80211_ethtool_ops = {
2766 + .get_drvinfo = cfg80211_get_drvinfo,
2767 + .get_regs_len = ieee80211_get_regs_len,
2768 + .get_regs = ieee80211_get_regs,
2769 + .get_link = ethtool_op_get_link,
2770 + .get_ringparam = ieee80211_get_ringparam,
2771 + .set_ringparam = ieee80211_set_ringparam,
2772 + .get_strings = ieee80211_get_strings,
2773 + .get_ethtool_stats = ieee80211_get_stats,
2774 + .get_sset_count = ieee80211_get_sset_count,
2776 --- a/net/mac80211/ibss.c
2777 +++ b/net/mac80211/ibss.c
2778 @@ -143,7 +143,7 @@ ieee80211_ibss_build_presp(struct ieee80
2779 *pos++ = csa_settings->block_tx ? 1 : 0;
2780 *pos++ = ieee80211_frequency_to_channel(
2781 csa_settings->chandef.chan->center_freq);
2782 - sdata->csa_counter_offset_beacon[0] = (pos - presp->head);
2783 + presp->csa_counter_offsets[0] = (pos - presp->head);
2784 *pos++ = csa_settings->count;
2787 @@ -1677,6 +1677,7 @@ int ieee80211_ibss_join(struct ieee80211
2788 sdata->u.ibss.control_port = params->control_port;
2789 sdata->u.ibss.userspace_handles_dfs = params->userspace_handles_dfs;
2790 sdata->u.ibss.basic_rates = params->basic_rates;
2791 + sdata->u.ibss.last_scan_completed = jiffies;
2793 /* fix basic_rates if channel does not support these rates */
2794 rate_flags = ieee80211_chandef_rate_flags(¶ms->chandef);
2795 --- a/net/mac80211/mesh.c
2796 +++ b/net/mac80211/mesh.c
2797 @@ -679,7 +679,7 @@ ieee80211_mesh_build_beacon(struct ieee8
2799 *pos++ = ieee80211_frequency_to_channel(
2800 csa->settings.chandef.chan->center_freq);
2801 - sdata->csa_counter_offset_beacon[0] = hdr_len + 6;
2802 + bcn->csa_counter_offsets[0] = hdr_len + 6;
2803 *pos++ = csa->settings.count;
2804 *pos++ = WLAN_EID_CHAN_SWITCH_PARAM;
2806 --- a/net/wireless/genregdb.awk
2807 +++ b/net/wireless/genregdb.awk
2808 @@ -65,17 +65,7 @@ function parse_reg_rule()
2811 if (units == "mW") {
2812 - if (power == 100) {
2814 - } else if (power == 200) {
2816 - } else if (power == 500) {
2818 - } else if (power == 1000) {
2821 - print "Unknown power value in database!"
2823 + power = 10 * log(power)/log(10)
2827 @@ -114,7 +104,7 @@ function parse_reg_rule()
2831 - printf "\t\tREG_RULE_EXT(%d, %d, %d, %d, %d, %d, %s),\n", start, end, bw, gain, power, dfs_cac, flags
2832 + printf "\t\tREG_RULE_EXT(%d, %d, %d, %d, %.0f, %d, %s),\n", start, end, bw, gain, power, dfs_cac, flags
2836 --- a/net/mac80211/debugfs_netdev.c
2837 +++ b/net/mac80211/debugfs_netdev.c
2838 @@ -34,8 +34,7 @@ static ssize_t ieee80211_if_read(
2839 ssize_t ret = -EINVAL;
2841 read_lock(&dev_base_lock);
2842 - if (sdata->dev->reg_state == NETREG_REGISTERED)
2843 - ret = (*format)(sdata, buf, sizeof(buf));
2844 + ret = (*format)(sdata, buf, sizeof(buf));
2845 read_unlock(&dev_base_lock);
2848 @@ -62,8 +61,7 @@ static ssize_t ieee80211_if_write(
2852 - if (sdata->dev->reg_state == NETREG_REGISTERED)
2853 - ret = (*write)(sdata, buf, count);
2854 + ret = (*write)(sdata, buf, count);
2858 --- a/drivers/net/wireless/b43/xmit.c
2859 +++ b/drivers/net/wireless/b43/xmit.c
2860 @@ -811,9 +811,13 @@ void b43_rx(struct b43_wldev *dev, struc
2863 status.band = IEEE80211_BAND_2GHZ;
2864 - /* chanid is the radio channel cookie value as used
2865 - * to tune the radio. */
2866 - status.freq = chanid + 2400;
2867 + /* Somewhere between 478.104 and 508.1084 firmware for G-PHY
2868 + * has been modified to be compatible with N-PHY and others.
2870 + if (dev->fw.rev >= 508)
2871 + status.freq = ieee80211_channel_to_frequency(chanid, status.band);
2873 + status.freq = chanid + 2400;
2876 case B43_PHYTYPE_LP:
2877 --- a/drivers/net/wireless/b43/main.c
2878 +++ b/drivers/net/wireless/b43/main.c
2879 @@ -5216,6 +5216,7 @@ static int b43_wireless_core_attach(stru
2880 /* We don't support 5 GHz on some PHYs yet */
2881 switch (dev->phy.type) {
2883 + case B43_PHYTYPE_G:
2885 case B43_PHYTYPE_LP:
2886 case B43_PHYTYPE_HT:
2887 --- a/net/wireless/reg.c
2888 +++ b/net/wireless/reg.c
2889 @@ -935,7 +935,7 @@ freq_reg_info_regd(struct wiphy *wiphy,
2890 if (!band_rule_found)
2891 band_rule_found = freq_in_rule_band(fr, center_freq);
2893 - bw_fits = reg_does_bw_fit(fr, center_freq, MHZ_TO_KHZ(5));
2894 + bw_fits = reg_does_bw_fit(fr, center_freq, MHZ_TO_KHZ(20));
2896 if (band_rule_found && bw_fits)
2898 @@ -1019,10 +1019,10 @@ static void chan_reg_rule_print_dbg(cons
2902 -/* Find an ieee80211_reg_rule such that a 5MHz channel with frequency
2903 - * chan->center_freq fits there.
2904 - * If there is no such reg_rule, disable the channel, otherwise set the
2905 - * flags corresponding to the bandwidths allowed in the particular reg_rule
2907 + * Note that right now we assume the desired channel bandwidth
2908 + * is always 20 MHz for each individual channel (HT40 uses 20 MHz
2909 + * per channel, the primary and the extension channel).
2911 static void handle_channel(struct wiphy *wiphy,
2912 enum nl80211_reg_initiator initiator,
2913 @@ -1083,12 +1083,8 @@ static void handle_channel(struct wiphy
2914 if (reg_rule->flags & NL80211_RRF_AUTO_BW)
2915 max_bandwidth_khz = reg_get_max_bandwidth(regd, reg_rule);
2917 - if (max_bandwidth_khz < MHZ_TO_KHZ(10))
2918 - bw_flags = IEEE80211_CHAN_NO_10MHZ;
2919 - if (max_bandwidth_khz < MHZ_TO_KHZ(20))
2920 - bw_flags |= IEEE80211_CHAN_NO_20MHZ;
2921 if (max_bandwidth_khz < MHZ_TO_KHZ(40))
2922 - bw_flags |= IEEE80211_CHAN_NO_HT40;
2923 + bw_flags = IEEE80211_CHAN_NO_HT40;
2924 if (max_bandwidth_khz < MHZ_TO_KHZ(80))
2925 bw_flags |= IEEE80211_CHAN_NO_80MHZ;
2926 if (max_bandwidth_khz < MHZ_TO_KHZ(160))
2927 @@ -1522,12 +1518,8 @@ static void handle_channel_custom(struct
2928 if (reg_rule->flags & NL80211_RRF_AUTO_BW)
2929 max_bandwidth_khz = reg_get_max_bandwidth(regd, reg_rule);
2931 - if (max_bandwidth_khz < MHZ_TO_KHZ(10))
2932 - bw_flags = IEEE80211_CHAN_NO_10MHZ;
2933 - if (max_bandwidth_khz < MHZ_TO_KHZ(20))
2934 - bw_flags |= IEEE80211_CHAN_NO_20MHZ;
2935 if (max_bandwidth_khz < MHZ_TO_KHZ(40))
2936 - bw_flags |= IEEE80211_CHAN_NO_HT40;
2937 + bw_flags = IEEE80211_CHAN_NO_HT40;
2938 if (max_bandwidth_khz < MHZ_TO_KHZ(80))
2939 bw_flags |= IEEE80211_CHAN_NO_80MHZ;
2940 if (max_bandwidth_khz < MHZ_TO_KHZ(160))
2941 --- a/drivers/net/wireless/ath/ath9k/ath9k.h
2942 +++ b/drivers/net/wireless/ath/ath9k/ath9k.h
2943 @@ -185,7 +185,8 @@ struct ath_atx_ac {
2945 struct ath_frame_info {
2950 enum ath9k_key_type keytype;
2953 --- a/drivers/net/wireless/ath/ath9k/xmit.c
2954 +++ b/drivers/net/wireless/ath/ath9k/xmit.c
2955 @@ -147,15 +147,13 @@ static void ath_set_rates(struct ieee802
2956 static void ath_txq_skb_done(struct ath_softc *sc, struct ath_txq *txq,
2957 struct sk_buff *skb)
2961 - q = skb_get_queue_mapping(skb);
2962 - if (txq == sc->tx.uapsdq)
2963 - txq = sc->tx.txq_map[q];
2964 + struct ath_frame_info *fi = get_frame_info(skb);
2967 - if (txq != sc->tx.txq_map[q])
2971 + txq = sc->tx.txq_map[q];
2972 if (WARN_ON(--txq->pending_frames < 0))
2973 txq->pending_frames = 0;
2975 @@ -1999,6 +1997,7 @@ static void setup_frame_info(struct ieee
2976 an = (struct ath_node *) sta->drv_priv;
2978 memset(fi, 0, sizeof(*fi));
2981 fi->keyix = hw_key->hw_key_idx;
2982 else if (an && ieee80211_is_data(hdr->frame_control) && an->ps_key > 0)
2983 @@ -2150,6 +2149,7 @@ int ath_tx_start(struct ieee80211_hw *hw
2984 struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
2985 struct ieee80211_sta *sta = txctl->sta;
2986 struct ieee80211_vif *vif = info->control.vif;
2987 + struct ath_frame_info *fi = get_frame_info(skb);
2988 struct ath_softc *sc = hw->priv;
2989 struct ath_txq *txq = txctl->txq;
2990 struct ath_atx_tid *tid = NULL;
2991 @@ -2170,11 +2170,13 @@ int ath_tx_start(struct ieee80211_hw *hw
2992 q = skb_get_queue_mapping(skb);
2994 ath_txq_lock(sc, txq);
2995 - if (txq == sc->tx.txq_map[q] &&
2996 - ++txq->pending_frames > sc->tx.txq_max_pending[q] &&
2998 - ieee80211_stop_queue(sc->hw, q);
2999 - txq->stopped = true;
3000 + if (txq == sc->tx.txq_map[q]) {
3002 + if (++txq->pending_frames > sc->tx.txq_max_pending[q] &&
3004 + ieee80211_stop_queue(sc->hw, q);
3005 + txq->stopped = true;
3009 if (txctl->an && ieee80211_is_data_present(hdr->frame_control))