1 commit 0fecedddd4a0945873db1bd230ec6a168b3cc4fe
2 Author: Felix Fietkau <nbd@openwrt.org>
3 Date: Mon Sep 8 18:35:08 2014 +0200
5 ath9k_hw: reduce ANI spur immunity setting on HT40 extension channel
7 The cycpwr_thr1 value needs to be lower on the extension channel than on
8 the control channel, similar to how the register settings are programmed
11 Also drop the unnecessary check for HT40 - this register can always be
12 written. This patch has been reported to improve HT40 stability and
13 throughput in some environments.
15 Signed-off-by: Felix Fietkau <nbd@openwrt.org>
17 commit 30d7434ccb853b96de698a040888fa4dacd0cc19
18 Author: Felix Fietkau <nbd@openwrt.org>
19 Date: Mon Sep 8 18:31:26 2014 +0200
21 Revert "ath9k_hw: reduce ANI firstep range for older chips"
23 This reverts commit 09efc56345be4146ab9fc87a55c837ed5d6ea1ab
25 I've received reports that this change is decreasing throughput in some
26 rare conditions on an AR9280 based device
28 Cc: stable@vger.kernel.org
29 Signed-off-by: Felix Fietkau <nbd@openwrt.org>
31 commit 15ed54948f508ad1baad79c30050e2d29a21696d
32 Author: Felix Fietkau <nbd@openwrt.org>
33 Date: Fri Jul 25 16:18:03 2014 +0200
35 mac80211: fix smps mode check for AP_VLAN
37 In ieee80211_sta_ps_deliver_wakeup, sdata->smps_mode is checked. This is
38 initialized only for the base AP interface, not the individual VLANs.
40 Signed-off-by: Felix Fietkau <nbd@openwrt.org>
42 commit bc74ad816bba291359ae46301173ea744bdda9d2
43 Author: Felix Fietkau <nbd@openwrt.org>
44 Date: Fri Jul 25 16:15:44 2014 +0200
46 mac80211: ignore AP_VLAN in ieee80211_recalc_chanctx_chantype
48 When bringing down the AP, a WARN_ON is hit because the bss config chandef
50 Since AP_VLAN channel settings do not matter for anything chanctx related
51 (always inherits the settings from the AP interface), let's just ignore
54 Signed-off-by: Felix Fietkau <nbd@openwrt.org>
56 commit ff354dbdd743e5fe186df8cd17982db19f78231a
57 Author: Felix Fietkau <nbd@openwrt.org>
58 Date: Wed Jul 23 15:33:26 2014 +0200
60 ath9k: fix aggregation session lockup
62 If an aggregation session fails, frames still end up in the driver queue
63 with IEEE80211_TX_CTL_AMPDU set.
64 This causes tx for the affected station/tid to stall, since
65 ath_tx_get_tid_subframe returning packets to send.
67 Fix this by clearing IEEE80211_TX_CTL_AMPDU as long as no aggregation
70 Cc: stable@vger.kernel.org
71 Reported-by: Antonio Quartulli <antonio@open-mesh.com>
72 Signed-off-by: Felix Fietkau <nbd@openwrt.org>
74 commit 38695a6e5a940e6a524523b88a33916b016fb2a1
75 Author: Felix Fietkau <nbd@openwrt.org>
76 Date: Fri Jul 11 12:06:18 2014 +0200
78 mac80211: fix crash on getting sta info with uninitialized rate control
80 If the expected throughput is queried before rate control has been
81 initialized, the minstrel op for it will crash while trying to access
83 Check for WLAN_STA_RATE_CONTROL before attempting to use the rate
86 Reported-by: Jean-Pierre Tosoni <jp.tosoni@acksys.fr>
87 Signed-off-by: Felix Fietkau <nbd@openwrt.org>
89 commit c0ee7fa4c0da824ccccc172bf175fb1f86540921
90 Author: Felix Fietkau <nbd@openwrt.org>
91 Date: Wed Jul 16 18:00:31 2014 +0200
93 ath9k: fix pending tx frames accounting
95 Packets originally buffered for the regular hardware tx queues can end
96 up being transmitted through the U-APSD queue (via PS-Poll or U-APSD).
97 When packets are dropped due to retransmit failures, the pending frames
98 counter is not always updated properly.
99 Fix this by keeping track of the queue that a frame was accounted for in
100 the ath_frame_info struct, and using that on completion to decide
101 whether the counter should be updated.
102 This fixes some spurious transmit queue hangs.
104 Cc: stable@vger.kernel.org
105 Signed-off-by: Felix Fietkau <nbd@openwrt.org>
107 commit edcdf0989410a05a6a4b8438df4010447eaa7d9a
108 Author: Felix Fietkau <nbd@openwrt.org>
109 Date: Sun Jun 22 13:36:20 2014 +0200
111 Revert "cfg80211: Use 5MHz bandwidth by default when checking usable channels"
113 It enables channels that are not supposed to be enabled according to the
116 This reverts commit 8eca1fb692cc9557f386eddce75c300a3855d11a.
118 commit 6e7341074823d2a45b81f2742cbf75f1da790031
119 Author: Rafał Miłecki <zajec5@gmail.com>
120 Date: Sat May 31 19:40:45 2014 +0200
122 b43: disable 5 GHz on G-PHY
124 This fixes regression introduced by adding some G-PHY devices to the
125 list of dual band devices. There is simply no support for 5 GHz on
126 G-PHY devices in b43. It results in:
127 WARNING: CPU: 0 PID: 79 at drivers/net/wireless/b43/phy_g.c:75 b43_gphy_channel_switch+0x125/0x130 [b43]()
128 b43-phy1 ERROR: PHY init: Channel switch to default failed
130 Regression was introduced by the following commit:
132 commit 773cfc508f4d64c14547ff8751b5cbd473124364
133 Author: Rafał Miłecki <zajec5@gmail.com>
134 Date: Mon May 19 23:18:55 2014 +0200
136 b43: add more devices to the bands database
138 Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
139 Signed-off-by: John W. Linville <linville@tuxdriver.com>
141 commit 1186edbef91f15722e5bdf56326ce0abc2935ce7
142 Author: Stanislaw Gruszka <sgruszka@redhat.com>
143 Date: Tue Jun 10 12:51:06 2014 +0200
145 rt2x00: disable TKIP on USB
147 On USB we can not get atomically TKIP key. We have to disable support
148 for TKIP acceleration on USB hardware to avoid bug as showed bellow.
150 [ 860.827243] BUG: scheduling while atomic: hostapd/3397/0x00000002
152 [ 860.827280] Call Trace:
153 [ 860.827282] [<ffffffff81682ea6>] dump_stack+0x4d/0x66
154 [ 860.827284] [<ffffffff8167eb9b>] __schedule_bug+0x47/0x55
155 [ 860.827285] [<ffffffff81685bb3>] __schedule+0x733/0x7b0
156 [ 860.827287] [<ffffffff81685c59>] schedule+0x29/0x70
157 [ 860.827289] [<ffffffff81684f8a>] schedule_timeout+0x15a/0x2b0
158 [ 860.827291] [<ffffffff8105ac50>] ? ftrace_raw_event_tick_stop+0xc0/0xc0
159 [ 860.827294] [<ffffffff810c13c2>] ? __module_text_address+0x12/0x70
160 [ 860.827296] [<ffffffff81686823>] wait_for_completion_timeout+0xb3/0x140
161 [ 860.827298] [<ffffffff81080fc0>] ? wake_up_state+0x20/0x20
162 [ 860.827301] [<ffffffff814d5b3d>] usb_start_wait_urb+0x7d/0x150
163 [ 860.827303] [<ffffffff814d5cd5>] usb_control_msg+0xc5/0x110
164 [ 860.827305] [<ffffffffa02fb0c6>] rt2x00usb_vendor_request+0xc6/0x160 [rt2x00usb]
165 [ 860.827307] [<ffffffffa02fb215>] rt2x00usb_vendor_req_buff_lock+0x75/0x150 [rt2x00usb]
166 [ 860.827309] [<ffffffffa02fb393>] rt2x00usb_vendor_request_buff+0xa3/0xe0 [rt2x00usb]
167 [ 860.827311] [<ffffffffa023d1a3>] rt2x00usb_register_multiread+0x33/0x40 [rt2800usb]
168 [ 860.827314] [<ffffffffa05805f9>] rt2800_get_tkip_seq+0x39/0x50 [rt2800lib]
169 [ 860.827321] [<ffffffffa0480f88>] ieee80211_get_key+0x218/0x2a0 [mac80211]
170 [ 860.827322] [<ffffffff815cc68c>] ? __nlmsg_put+0x6c/0x80
171 [ 860.827329] [<ffffffffa051b02e>] nl80211_get_key+0x22e/0x360 [cfg80211]
173 Cc: stable@vger.kernel.org
174 Reported-and-tested-by: Peter Wu <lekensteyn@gmail.com>
175 Reported-and-tested-by: Pontus Fuchs <pontus.fuchs@gmail.com>
176 Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com>
177 Signed-off-by: John W. Linville <linville@tuxdriver.com>
179 commit 5f313a15da92dda80ac4c9a137bc42d7d0b49adf
180 Author: Rafał Miłecki <zajec5@gmail.com>
181 Date: Thu Jun 12 09:28:38 2014 +0200
183 b43: fix frequency reported on G-PHY with /new/ firmware
185 commit d3a58df87a2e4c2301ac843604202d290a48440b
186 Author: Avraham Stern <avraham.stern@intel.com>
187 Date: Thu May 22 12:17:47 2014 +0300
189 mac80211: set new interfaces as idle upon init
191 Mark new interfaces as idle to allow operations that require that
192 interfaces are idle to take place. Interface types that are always
193 not idle (like AP interfaces) will be set as not idle when they are
194 assigned a channel context.
196 Signed-off-by: Avraham Stern <avraham.stern@intel.com>
197 Signed-off-by: Emmanuel Grumbach<emmanuel.grumbach@intel.com>
198 Signed-off-by: Johannes Berg <johannes.berg@intel.com>
200 commit 923eaf367206e01f22c97aee22300e332d071916
201 Author: Arik Nemtsov <arik@wizery.com>
202 Date: Mon May 26 14:40:51 2014 +0300
204 mac80211: don't check netdev state for debugfs read/write
206 Doing so will lead to an oops for a p2p-dev interface, since it has
209 Cc: stable@vger.kernel.org
210 Signed-off-by: Arik Nemtsov <arikx.nemtsov@intel.com>
211 Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
212 Signed-off-by: Johannes Berg <johannes.berg@intel.com>
214 commit a9fb54169b197f31aff24c8d6270dd1e56cde395
215 Author: chaitanya.mgit@gmail.com <chaitanya.mgit@gmail.com>
216 Date: Mon May 26 18:01:44 2014 +0530
218 regdb: Generalize the mW to dBm power conversion
220 Generalize the power conversion from mW to dBm
221 using log. This should fix the below compilation
222 error for country NO which adds a new power value
223 2000mW which is not handled earlier.
225 CC [M] net/wireless/wext-sme.o
226 CC [M] net/wireless/regdb.o
227 net/wireless/regdb.c:1130:1: error: Unknown undeclared here (not in
229 net/wireless/regdb.c:1130:9: error: expected } before power
230 make[2]: *** [net/wireless/regdb.o] Error 1
231 make[1]: *** [net/wireless] Error 2
232 make: *** [net] Error 2
234 Reported-By: John Walker <john@x109.net>
235 Signed-off-by: Chaitanya T K <chaitanya.mgit@gmail.com>
236 Acked-by: John W. Linville <linville@tuxdriver.com>
237 [remove unneeded parentheses, fix rounding by using %.0f]
238 Signed-off-by: Johannes Berg <johannes.berg@intel.com>
240 commit c7d37a66e345df2fdf1aa7b2c9a6d3d53846ca5b
241 Author: Krzysztof Hałasa <khalasa@piap.pl>
242 Date: Mon May 26 14:14:46 2014 +0200
244 mac80211: fix IBSS join by initializing last_scan_completed
246 Without this fix, freshly rebooted Linux creates a new IBSS
247 instead of joining an existing one. Only when jiffies counter
248 overflows after 5 minutes the IBSS can be successfully joined.
250 Signed-off-by: Krzysztof Hałasa <khalasa@piap.pl>
251 [edit commit message slightly]
252 Cc: stable@vger.kernel.org
253 Signed-off-by: Johannes Berg <johannes.berg@intel.com>
255 commit 34171dc0d623be2c1032416bf7d3819f388ed70d
256 Author: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
257 Date: Sun May 25 15:35:41 2014 +0300
259 mac80211: fix virtual monitor interface addition
261 Since the commit below, cfg80211_chandef_dfs_required()
262 will warn if it gets a an NL80211_IFTYPE_UNSPECIFIED iftype
263 as explicitely written in the commit log.
264 When an virtual monitor interface is added, its type is set
265 in ieee80211_sub_if_data.vif.type, but not in
266 ieee80211_sub_if_data.wdev.iftype which is passed to
267 cfg80211_chandef_dfs_required() hence resulting in the
270 WARNING: CPU: 1 PID: 21265 at net/wireless/chan.c:376 cfg80211_chandef_dfs_required+0xbc/0x130 [cfg80211]()
271 Modules linked in: [...]
272 CPU: 1 PID: 21265 Comm: ifconfig Tainted: G W O 3.13.11+ #12
273 Hardware name: Dell Inc. Latitude E6410/0667CC, BIOS A01 03/05/2010
274 0000000000000009 ffff88008f5fdb08 ffffffff817d4219 ffff88008f5fdb50
275 ffff88008f5fdb40 ffffffff8106f57d 0000000000000000 0000000000000000
276 ffff880081062fb8 ffff8800810604e0 0000000000000001 ffff88008f5fdba0
278 [<ffffffff817d4219>] dump_stack+0x4d/0x66
279 [<ffffffff8106f57d>] warn_slowpath_common+0x7d/0xa0
280 [<ffffffff8106f5ec>] warn_slowpath_fmt+0x4c/0x50
281 [<ffffffffa04ea4ec>] cfg80211_chandef_dfs_required+0xbc/0x130 [cfg80211]
282 [<ffffffffa06b1024>] ieee80211_vif_use_channel+0x94/0x500 [mac80211]
283 [<ffffffffa0684e6b>] ieee80211_add_virtual_monitor+0x1ab/0x5c0 [mac80211]
284 [<ffffffffa0686ae5>] ieee80211_do_open+0xe75/0x1580 [mac80211]
285 [<ffffffffa0687259>] ieee80211_open+0x69/0x70 [mac80211]
288 Fixes: 00ec75fc5a64 ("cfg80211: pass the actual iftype when calling cfg80211_chandef_dfs_required()")
289 Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
290 Acked-by: Luciano Coelho <luciano.coelho@intel.com>
291 Signed-off-by: Johannes Berg <johannes.berg@intel.com>
293 commit d93cc72b37b4e2c314e1c499e80e8801907c2fea
294 Author: Michal Kazior <michal.kazior@tieto.com>
295 Date: Thu Jun 5 14:21:37 2014 +0200
297 mac80211: use csa counter offsets instead of csa_active
299 vif->csa_active is protected by mutexes only. This
300 means it is unreliable to depend on it on codeflow
301 in non-sleepable beacon and CSA code. There was no
302 guarantee to have vif->csa_active update be
303 visible before beacons are updated on SMP systems.
305 Using csa counter offsets which are embedded in
306 beacon struct (and thus are protected with single
307 RCU assignment) is much safer.
309 Signed-off-by: Michal Kazior <michal.kazior@tieto.com>
310 Signed-off-by: Johannes Berg <johannes.berg@intel.com>
312 commit d2746694fcdef24e0a7a1947d8c70082cde81a26
313 Author: Michal Kazior <michal.kazior@tieto.com>
314 Date: Thu Jun 5 14:21:36 2014 +0200
316 mac80211: move csa counters from sdata to beacon/presp
318 Having csa counters part of beacon and probe_resp
319 structures makes it easier to get rid of possible
320 races between setting a beacon and updating
321 counters on SMP systems by guaranteeing counters
322 are always consistent against given beacon struct.
324 While at it relax WARN_ON into WARN_ON_ONCE to
325 prevent spamming logs and racing.
327 Signed-off-by: Michal Kazior <michal.kazior@tieto.com>
328 Signed-off-by: Johannes Berg <johannes.berg@intel.com>
330 commit 5dcb54f3a1a8cd7e0331e773487574f9743615db
331 Author: Janusz Dziedzic <janusz.dziedzic@tieto.com>
332 Date: Thu Jun 5 08:12:57 2014 +0200
334 mac80211: allow tx via monitor iface when DFS
336 Allow send frames using monitor interface
337 when DFS chandef and we pass CAC (beaconing
340 This fix problem when old kernel and new backports used,
341 in such case hostapd create/use also monitor interface.
342 Before this patch all frames hostapd send using monitor
343 iface were dropped when AP was configured on DFS channel.
345 Signed-off-by: Janusz Dziedzic <janusz.dziedzic@tieto.com>
346 Signed-off-by: Johannes Berg <johannes.berg@intel.com>
348 commit 6f09a1beb0d2007572248c986780562219bd206f
349 Author: Johannes Berg <johannes.berg@intel.com>
350 Date: Wed Jun 4 17:31:56 2014 +0200
352 cfg80211: make ethtool the driver's responsibility
354 Currently, cfg80211 tries to implement ethtool, but that doesn't
355 really scale well, with all the different operations. Make the
356 lower-level driver responsible for it, which currently only has
357 an effect on mac80211. It will similarly not scale well at that
358 level though, since mac80211 also has many drivers.
360 To cleanly implement this in mac80211, introduce a new file and
361 move some code to appropriate places.
363 Signed-off-by: Johannes Berg <johannes.berg@intel.com>
365 commit 6b0c6f133de8f90caeb1c4a902e6140567c5bf96
366 Author: Johannes Berg <johannes.berg@intel.com>
367 Date: Wed Jun 4 17:06:23 2014 +0200
369 mac80211: remove weak WEP IV accounting
371 Since WEP is practically dead, there seems very little
372 point in keeping WEP weak IV accounting.
374 Signed-off-by: Johannes Berg <johannes.berg@intel.com>
376 commit aecdc89fb4664c76baa4bbd46008f220532309ff
377 Author: Luciano Coelho <luciano.coelho@intel.com>
378 Date: Fri May 23 11:04:50 2014 +0300
380 ath9k/ath10k: remove unnecessary channel_switch_beacon callbacks
382 The channel_switch_beacon callback is optional, so it doesn't have to
383 be defined if it's not going to do anything useful with it. Both
384 ath9k and ath10k define the callback and just returns. This commit
387 Cc: Michal Kazior <michal.kazior@tieto.com>
388 Signed-off-by: Luciano Coelho <luciano.coelho@intel.com>
389 Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
391 commit 60ccc107c9b9fb732fdee1f76bb2dad44f0e1798
392 Author: Rajkumar Manoharan <rmanohar@qti.qualcomm.com>
393 Date: Tue May 27 16:58:02 2014 +0530
395 ath9k: Fix deadlock while updating p2p beacon timer
397 pm_lock is taken twice while syncing HW TSF of p2p vif.
398 Fix this by taking the lock at caller side.
400 Cc: Felix Fietkau <nbd@openwrt.org>
401 Signed-off-by: Rajkumar Manoharan <rmanohar@qti.qualcomm.com>
402 Signed-off-by: John W. Linville <linville@tuxdriver.com>
404 commit f3831a4e3903dbc1a57d5df56deb6a143fd001bc
405 Author: Stanislaw Gruszka <sgruszka@redhat.com>
406 Date: Thu Jun 5 13:52:27 2014 +0200
408 rt2x00: do not initialize BCN_OFFSET registers
410 We setup BCN_OFFSET{0,1} registers dynamically, don't have to
413 Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com>
415 commit e5c58ca7a48d4c82f282749a978052c47fd95998
416 Author: Stanislaw Gruszka <sgruszka@redhat.com>
417 Date: Thu Jun 5 13:52:26 2014 +0200
419 rt2x00: change order when stop beaconing
421 When no beaconing is needed, first stop beacon queue (disable beaconing
422 globally) to avoid possible sending of not prepared beacon on short
423 period after clearing beacon and before stop of BCN queue.
425 Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com>
427 commit 382c1b9e03f52d0cd741ef1d942cad0f649f0744
428 Author: Stanislaw Gruszka <sgruszka@redhat.com>
429 Date: Thu Jun 5 13:52:25 2014 +0200
431 rt2x00: change default MAC_BSSID_DW1_BSS_BCN_NUM
433 We setup MAC_BSSID_DW1_BSS_BCN_NUM dynamically when numbers of active
434 beacons increase. Change default to 0 to tell hardware that we want to
435 send only one beacon as default.
437 Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com>
439 commit 3b400571dd033e46fa7e76c5bb92a3ce8198afa9
440 Author: Stanislaw Gruszka <sgruszka@redhat.com>
441 Date: Thu Jun 5 13:52:24 2014 +0200
443 rt2x00: change beaconing setup on RT2800
445 As reported by Matthias, on 5572 chip, even if we clear up TXWI
446 of corresponding beacon, hardware still try to send it or do other
447 action that increase power consumption peak up to 1A.
449 To avoid the issue, setup beaconing dynamically by configuring offsets
450 of currently active beacons and MAC_BSSID_DW1_BSS_BCN_NUM variable,
451 which limit number of beacons that hardware will try to send.
453 Reported-by: Matthias Fend <Matthias.Fend@wolfvision.net>
454 Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com>
456 commit 916e591b2cc41f7e572992175ca56d866d7bc958
457 Author: Stanislaw Gruszka <sgruszka@redhat.com>
458 Date: Thu Jun 5 13:52:23 2014 +0200
460 rt2x00: change beaconing locking
462 This patch is needed for further changes to keep global variables
463 consistent when changing beaconing on diffrent vif's.
465 Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com>
467 commit 930b0dffd1731f3f418f9132faea720a23b7af61
468 Author: Johannes Berg <johannes.berg@intel.com>
469 Date: Tue Jun 3 11:18:47 2014 +0200
471 mac80211: fix station/driver powersave race
473 It is currently possible to have a race due to the station PS
474 unblock work like this:
475 * station goes to sleep with frames buffered in the driver
476 * driver blocks wakeup
477 * station wakes up again
478 * driver flushes/returns frames, and unblocks, which schedules
480 * unblock work starts to run, and checks that the station is
481 awake (i.e. that the WLAN_STA_PS_STA flag isn't set)
482 * we process a received frame with PM=1, setting the flag again
483 * ieee80211_sta_ps_deliver_wakeup() runs, delivering all frames
484 to the driver, and then clearing the WLAN_STA_PS_DRIVER and
485 WLAN_STA_PS_STA flags
487 In this scenario, mac80211 will think that the station is awake,
488 while it really is asleep, and any TX'ed frames should be filtered
489 by the device (it will know that the station is sleeping) but then
490 passed to mac80211 again, which will not buffer it either as it
491 thinks the station is awake, and eventually the packets will be
494 Fix this by moving the clearing of the flags to exactly where we
495 learn about the situation. This creates a problem of reordering,
496 so introduce another flag indicating that delivery is being done,
497 this new flag also queues frames and is cleared only while the
498 spinlock is held (which the queuing code also holds) so that any
499 concurrent delivery/TX is handled correctly.
501 Reported-by: Andrei Otcheretianski <andrei.otcheretianski@intel.com>
502 Signed-off-by: Johannes Berg <johannes.berg@intel.com>
504 commit 6df35206bc6c1c6aad1d8077df5786b4a7f77873
505 Author: Felix Fietkau <nbd@openwrt.org>
506 Date: Fri May 23 19:58:14 2014 +0200
508 mac80211: reduce packet loss notifications under load
510 During strong signal fluctuations under high throughput, few consecutive
511 failed A-MPDU transmissions can easily trigger packet loss notification,
512 and thus (in AP mode) client disconnection.
514 Reduce the number of false positives by checking the A-MPDU status flag
515 and treating a failed A-MPDU as a single packet.
517 Signed-off-by: Felix Fietkau <nbd@openwrt.org>
519 commit 7b7843a36fbcc568834404c7430ff895d8502131
520 Author: Felix Fietkau <nbd@openwrt.org>
521 Date: Fri May 23 19:26:32 2014 +0200
523 mac80211: fix a memory leak on sta rate selection table
525 Cc: stable@vger.kernel.org
526 Reported-by: Christophe Prévotaux <cprevotaux@nltinc.com>
527 Signed-off-by: Felix Fietkau <nbd@openwrt.org>
529 commit 96892d6aa0a153423070addf3070bc79578b3897
530 Author: Felix Fietkau <nbd@openwrt.org>
531 Date: Mon May 19 21:20:49 2014 +0200
533 ath9k: avoid passing buffers to the hardware during flush
535 The commit "ath9k: fix possible hang on flush" changed the receive code
536 to always link rx descriptors of processed frames, even when flushing.
537 In some cases, this leads to flushed rx buffers being passed to the
538 hardware while rx is already stopped.
540 Signed-off-by: Felix Fietkau <nbd@openwrt.org>
542 --- a/drivers/net/wireless/ath/ath9k/recv.c
543 +++ b/drivers/net/wireless/ath/ath9k/recv.c
544 @@ -34,7 +34,8 @@ static inline bool ath9k_check_auto_slee
545 * buffer (or rx fifo). This can incorrectly acknowledge packets
546 * to a sender if last desc is self-linked.
548 -static void ath_rx_buf_link(struct ath_softc *sc, struct ath_rxbuf *bf)
549 +static void ath_rx_buf_link(struct ath_softc *sc, struct ath_rxbuf *bf,
552 struct ath_hw *ah = sc->sc_ah;
553 struct ath_common *common = ath9k_hw_common(ah);
554 @@ -59,18 +60,19 @@ static void ath_rx_buf_link(struct ath_s
558 - if (sc->rx.rxlink == NULL)
559 - ath9k_hw_putrxbuf(ah, bf->bf_daddr);
562 *sc->rx.rxlink = bf->bf_daddr;
564 + ath9k_hw_putrxbuf(ah, bf->bf_daddr);
566 sc->rx.rxlink = &ds->ds_link;
569 -static void ath_rx_buf_relink(struct ath_softc *sc, struct ath_rxbuf *bf)
570 +static void ath_rx_buf_relink(struct ath_softc *sc, struct ath_rxbuf *bf,
574 - ath_rx_buf_link(sc, sc->rx.buf_hold);
575 + ath_rx_buf_link(sc, sc->rx.buf_hold, flush);
577 sc->rx.buf_hold = bf;
579 @@ -442,7 +444,7 @@ int ath_startrecv(struct ath_softc *sc)
580 sc->rx.buf_hold = NULL;
581 sc->rx.rxlink = NULL;
582 list_for_each_entry_safe(bf, tbf, &sc->rx.rxbuf, list) {
583 - ath_rx_buf_link(sc, bf);
584 + ath_rx_buf_link(sc, bf, false);
587 /* We could have deleted elements so the list may be empty now */
588 @@ -1118,12 +1120,12 @@ requeue_drop_frag:
590 list_add_tail(&bf->list, &sc->rx.rxbuf);
593 - ath_rx_edma_buf_link(sc, qtype);
595 - ath_rx_buf_relink(sc, bf);
597 + ath_rx_buf_relink(sc, bf, flush);
600 + } else if (!flush) {
601 + ath_rx_edma_buf_link(sc, qtype);
605 --- a/net/mac80211/sta_info.c
606 +++ b/net/mac80211/sta_info.c
607 @@ -100,7 +100,8 @@ static void __cleanup_single_sta(struct
610 if (test_sta_flag(sta, WLAN_STA_PS_STA) ||
611 - test_sta_flag(sta, WLAN_STA_PS_DRIVER)) {
612 + test_sta_flag(sta, WLAN_STA_PS_DRIVER) ||
613 + test_sta_flag(sta, WLAN_STA_PS_DELIVER)) {
614 if (sta->sdata->vif.type == NL80211_IFTYPE_AP ||
615 sta->sdata->vif.type == NL80211_IFTYPE_AP_VLAN)
616 ps = &sdata->bss->ps;
617 @@ -111,6 +112,7 @@ static void __cleanup_single_sta(struct
619 clear_sta_flag(sta, WLAN_STA_PS_STA);
620 clear_sta_flag(sta, WLAN_STA_PS_DRIVER);
621 + clear_sta_flag(sta, WLAN_STA_PS_DELIVER);
623 atomic_dec(&ps->num_sta_ps);
624 sta_info_recalc_tim(sta);
625 @@ -125,7 +127,7 @@ static void __cleanup_single_sta(struct
626 if (ieee80211_vif_is_mesh(&sdata->vif))
627 mesh_sta_cleanup(sta);
629 - cancel_work_sync(&sta->drv_unblock_wk);
630 + cancel_work_sync(&sta->drv_deliver_wk);
633 * Destroy aggregation state here. It would be nice to wait for the
634 @@ -227,6 +229,7 @@ struct sta_info *sta_info_get_by_idx(str
636 void sta_info_free(struct ieee80211_local *local, struct sta_info *sta)
638 + struct ieee80211_sta_rates *rates;
642 @@ -238,6 +241,10 @@ void sta_info_free(struct ieee80211_loca
646 + rates = rcu_dereference_protected(sta->sta.rates, true);
650 sta_dbg(sta->sdata, "Destroyed STA %pM\n", sta->sta.addr);
653 @@ -252,33 +259,23 @@ static void sta_info_hash_add(struct iee
654 rcu_assign_pointer(local->sta_hash[STA_HASH(sta->sta.addr)], sta);
657 -static void sta_unblock(struct work_struct *wk)
658 +static void sta_deliver_ps_frames(struct work_struct *wk)
660 struct sta_info *sta;
662 - sta = container_of(wk, struct sta_info, drv_unblock_wk);
663 + sta = container_of(wk, struct sta_info, drv_deliver_wk);
668 - if (!test_sta_flag(sta, WLAN_STA_PS_STA)) {
669 - local_bh_disable();
670 + local_bh_disable();
671 + if (!test_sta_flag(sta, WLAN_STA_PS_STA))
672 ieee80211_sta_ps_deliver_wakeup(sta);
674 - } else if (test_and_clear_sta_flag(sta, WLAN_STA_PSPOLL)) {
675 - clear_sta_flag(sta, WLAN_STA_PS_DRIVER);
677 - local_bh_disable();
678 + else if (test_and_clear_sta_flag(sta, WLAN_STA_PSPOLL))
679 ieee80211_sta_ps_deliver_poll_response(sta);
681 - } else if (test_and_clear_sta_flag(sta, WLAN_STA_UAPSD)) {
682 - clear_sta_flag(sta, WLAN_STA_PS_DRIVER);
684 - local_bh_disable();
685 + else if (test_and_clear_sta_flag(sta, WLAN_STA_UAPSD))
686 ieee80211_sta_ps_deliver_uapsd(sta);
689 - clear_sta_flag(sta, WLAN_STA_PS_DRIVER);
693 static int sta_prepare_rate_control(struct ieee80211_local *local,
694 @@ -340,7 +337,7 @@ struct sta_info *sta_info_alloc(struct i
696 spin_lock_init(&sta->lock);
697 spin_lock_init(&sta->ps_lock);
698 - INIT_WORK(&sta->drv_unblock_wk, sta_unblock);
699 + INIT_WORK(&sta->drv_deliver_wk, sta_deliver_ps_frames);
700 INIT_WORK(&sta->ampdu_mlme.work, ieee80211_ba_session_work);
701 mutex_init(&sta->ampdu_mlme.mtx);
702 #ifdef CPTCFG_MAC80211_MESH
703 @@ -1101,8 +1098,11 @@ void ieee80211_sta_ps_deliver_wakeup(str
707 - if (sdata->vif.type == NL80211_IFTYPE_AP ||
708 - sdata->vif.type == NL80211_IFTYPE_AP_VLAN)
709 + if (sdata->vif.type == NL80211_IFTYPE_AP_VLAN)
710 + sdata = container_of(sdata->bss, struct ieee80211_sub_if_data,
713 + if (sdata->vif.type == NL80211_IFTYPE_AP)
714 ps = &sdata->bss->ps;
715 else if (ieee80211_vif_is_mesh(&sdata->vif))
716 ps = &sdata->u.mesh.ps;
717 @@ -1140,8 +1140,15 @@ void ieee80211_sta_ps_deliver_wakeup(str
720 ieee80211_add_pending_skbs(local, &pending);
721 - clear_sta_flag(sta, WLAN_STA_PS_DRIVER);
722 - clear_sta_flag(sta, WLAN_STA_PS_STA);
724 + /* now we're no longer in the deliver code */
725 + clear_sta_flag(sta, WLAN_STA_PS_DELIVER);
727 + /* The station might have polled and then woken up before we responded,
728 + * so clear these flags now to avoid them sticking around.
730 + clear_sta_flag(sta, WLAN_STA_PSPOLL);
731 + clear_sta_flag(sta, WLAN_STA_UAPSD);
732 spin_unlock(&sta->ps_lock);
734 atomic_dec(&ps->num_sta_ps);
735 @@ -1542,10 +1549,26 @@ void ieee80211_sta_block_awake(struct ie
737 trace_api_sta_block_awake(sta->local, pubsta, block);
741 set_sta_flag(sta, WLAN_STA_PS_DRIVER);
742 - else if (test_sta_flag(sta, WLAN_STA_PS_DRIVER))
743 - ieee80211_queue_work(hw, &sta->drv_unblock_wk);
747 + if (!test_sta_flag(sta, WLAN_STA_PS_DRIVER))
750 + if (!test_sta_flag(sta, WLAN_STA_PS_STA)) {
751 + set_sta_flag(sta, WLAN_STA_PS_DELIVER);
752 + clear_sta_flag(sta, WLAN_STA_PS_DRIVER);
753 + ieee80211_queue_work(hw, &sta->drv_deliver_wk);
754 + } else if (test_sta_flag(sta, WLAN_STA_PSPOLL) ||
755 + test_sta_flag(sta, WLAN_STA_UAPSD)) {
756 + /* must be asleep in this case */
757 + clear_sta_flag(sta, WLAN_STA_PS_DRIVER);
758 + ieee80211_queue_work(hw, &sta->drv_deliver_wk);
760 + clear_sta_flag(sta, WLAN_STA_PS_DRIVER);
763 EXPORT_SYMBOL(ieee80211_sta_block_awake);
765 @@ -1703,3 +1726,140 @@ u8 sta_info_tx_streams(struct sta_info *
766 return ((ht_cap->mcs.tx_params & IEEE80211_HT_MCS_TX_MAX_STREAMS_MASK)
767 >> IEEE80211_HT_MCS_TX_MAX_STREAMS_SHIFT) + 1;
770 +void sta_set_sinfo(struct sta_info *sta, struct station_info *sinfo)
772 + struct ieee80211_sub_if_data *sdata = sta->sdata;
773 + struct ieee80211_local *local = sdata->local;
774 + struct rate_control_ref *ref = NULL;
775 + struct timespec uptime;
780 + if (test_sta_flag(sta, WLAN_STA_RATE_CONTROL))
781 + ref = local->rate_ctrl;
783 + sinfo->generation = sdata->local->sta_generation;
785 + sinfo->filled = STATION_INFO_INACTIVE_TIME |
786 + STATION_INFO_RX_BYTES64 |
787 + STATION_INFO_TX_BYTES64 |
788 + STATION_INFO_RX_PACKETS |
789 + STATION_INFO_TX_PACKETS |
790 + STATION_INFO_TX_RETRIES |
791 + STATION_INFO_TX_FAILED |
792 + STATION_INFO_TX_BITRATE |
793 + STATION_INFO_RX_BITRATE |
794 + STATION_INFO_RX_DROP_MISC |
795 + STATION_INFO_BSS_PARAM |
796 + STATION_INFO_CONNECTED_TIME |
797 + STATION_INFO_STA_FLAGS |
798 + STATION_INFO_BEACON_LOSS_COUNT;
800 + do_posix_clock_monotonic_gettime(&uptime);
801 + sinfo->connected_time = uptime.tv_sec - sta->last_connected;
803 + sinfo->inactive_time = jiffies_to_msecs(jiffies - sta->last_rx);
804 + sinfo->tx_bytes = 0;
805 + for (ac = 0; ac < IEEE80211_NUM_ACS; ac++) {
806 + sinfo->tx_bytes += sta->tx_bytes[ac];
807 + packets += sta->tx_packets[ac];
809 + sinfo->tx_packets = packets;
810 + sinfo->rx_bytes = sta->rx_bytes;
811 + sinfo->rx_packets = sta->rx_packets;
812 + sinfo->tx_retries = sta->tx_retry_count;
813 + sinfo->tx_failed = sta->tx_retry_failed;
814 + sinfo->rx_dropped_misc = sta->rx_dropped;
815 + sinfo->beacon_loss_count = sta->beacon_loss_count;
817 + if ((sta->local->hw.flags & IEEE80211_HW_SIGNAL_DBM) ||
818 + (sta->local->hw.flags & IEEE80211_HW_SIGNAL_UNSPEC)) {
819 + sinfo->filled |= STATION_INFO_SIGNAL | STATION_INFO_SIGNAL_AVG;
820 + if (!local->ops->get_rssi ||
821 + drv_get_rssi(local, sdata, &sta->sta, &sinfo->signal))
822 + sinfo->signal = (s8)sta->last_signal;
823 + sinfo->signal_avg = (s8) -ewma_read(&sta->avg_signal);
826 + sinfo->filled |= STATION_INFO_CHAIN_SIGNAL |
827 + STATION_INFO_CHAIN_SIGNAL_AVG;
829 + sinfo->chains = sta->chains;
830 + for (i = 0; i < ARRAY_SIZE(sinfo->chain_signal); i++) {
831 + sinfo->chain_signal[i] = sta->chain_signal_last[i];
832 + sinfo->chain_signal_avg[i] =
833 + (s8) -ewma_read(&sta->chain_signal_avg[i]);
837 + sta_set_rate_info_tx(sta, &sta->last_tx_rate, &sinfo->txrate);
838 + sta_set_rate_info_rx(sta, &sinfo->rxrate);
840 + if (ieee80211_vif_is_mesh(&sdata->vif)) {
841 +#ifdef CPTCFG_MAC80211_MESH
842 + sinfo->filled |= STATION_INFO_LLID |
843 + STATION_INFO_PLID |
844 + STATION_INFO_PLINK_STATE |
845 + STATION_INFO_LOCAL_PM |
846 + STATION_INFO_PEER_PM |
847 + STATION_INFO_NONPEER_PM;
849 + sinfo->llid = sta->llid;
850 + sinfo->plid = sta->plid;
851 + sinfo->plink_state = sta->plink_state;
852 + if (test_sta_flag(sta, WLAN_STA_TOFFSET_KNOWN)) {
853 + sinfo->filled |= STATION_INFO_T_OFFSET;
854 + sinfo->t_offset = sta->t_offset;
856 + sinfo->local_pm = sta->local_pm;
857 + sinfo->peer_pm = sta->peer_pm;
858 + sinfo->nonpeer_pm = sta->nonpeer_pm;
862 + sinfo->bss_param.flags = 0;
863 + if (sdata->vif.bss_conf.use_cts_prot)
864 + sinfo->bss_param.flags |= BSS_PARAM_FLAGS_CTS_PROT;
865 + if (sdata->vif.bss_conf.use_short_preamble)
866 + sinfo->bss_param.flags |= BSS_PARAM_FLAGS_SHORT_PREAMBLE;
867 + if (sdata->vif.bss_conf.use_short_slot)
868 + sinfo->bss_param.flags |= BSS_PARAM_FLAGS_SHORT_SLOT_TIME;
869 + sinfo->bss_param.dtim_period = sdata->local->hw.conf.ps_dtim_period;
870 + sinfo->bss_param.beacon_interval = sdata->vif.bss_conf.beacon_int;
872 + sinfo->sta_flags.set = 0;
873 + sinfo->sta_flags.mask = BIT(NL80211_STA_FLAG_AUTHORIZED) |
874 + BIT(NL80211_STA_FLAG_SHORT_PREAMBLE) |
875 + BIT(NL80211_STA_FLAG_WME) |
876 + BIT(NL80211_STA_FLAG_MFP) |
877 + BIT(NL80211_STA_FLAG_AUTHENTICATED) |
878 + BIT(NL80211_STA_FLAG_ASSOCIATED) |
879 + BIT(NL80211_STA_FLAG_TDLS_PEER);
880 + if (test_sta_flag(sta, WLAN_STA_AUTHORIZED))
881 + sinfo->sta_flags.set |= BIT(NL80211_STA_FLAG_AUTHORIZED);
882 + if (test_sta_flag(sta, WLAN_STA_SHORT_PREAMBLE))
883 + sinfo->sta_flags.set |= BIT(NL80211_STA_FLAG_SHORT_PREAMBLE);
884 + if (test_sta_flag(sta, WLAN_STA_WME))
885 + sinfo->sta_flags.set |= BIT(NL80211_STA_FLAG_WME);
886 + if (test_sta_flag(sta, WLAN_STA_MFP))
887 + sinfo->sta_flags.set |= BIT(NL80211_STA_FLAG_MFP);
888 + if (test_sta_flag(sta, WLAN_STA_AUTH))
889 + sinfo->sta_flags.set |= BIT(NL80211_STA_FLAG_AUTHENTICATED);
890 + if (test_sta_flag(sta, WLAN_STA_ASSOC))
891 + sinfo->sta_flags.set |= BIT(NL80211_STA_FLAG_ASSOCIATED);
892 + if (test_sta_flag(sta, WLAN_STA_TDLS_PEER))
893 + sinfo->sta_flags.set |= BIT(NL80211_STA_FLAG_TDLS_PEER);
895 + /* check if the driver has a SW RC implementation */
896 + if (ref && ref->ops->get_expected_throughput)
897 + thr = ref->ops->get_expected_throughput(sta->rate_ctrl_priv);
899 + thr = drv_get_expected_throughput(local, &sta->sta);
902 + sinfo->filled |= STATION_INFO_EXPECTED_THROUGHPUT;
903 + sinfo->expected_throughput = thr;
906 --- a/net/mac80211/status.c
907 +++ b/net/mac80211/status.c
908 @@ -541,6 +541,23 @@ static void ieee80211_tx_latency_end_msr
910 #define STA_LOST_PKT_THRESHOLD 50
912 +static void ieee80211_lost_packet(struct sta_info *sta, struct sk_buff *skb)
914 + struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
916 + /* This packet was aggregated but doesn't carry status info */
917 + if ((info->flags & IEEE80211_TX_CTL_AMPDU) &&
918 + !(info->flags & IEEE80211_TX_STAT_AMPDU))
921 + if (++sta->lost_packets < STA_LOST_PKT_THRESHOLD)
924 + cfg80211_cqm_pktloss_notify(sta->sdata->dev, sta->sta.addr,
925 + sta->lost_packets, GFP_ATOMIC);
926 + sta->lost_packets = 0;
929 void ieee80211_tx_status(struct ieee80211_hw *hw, struct sk_buff *skb)
931 struct sk_buff *skb2;
932 @@ -680,12 +697,8 @@ void ieee80211_tx_status(struct ieee8021
933 if (info->flags & IEEE80211_TX_STAT_ACK) {
934 if (sta->lost_packets)
935 sta->lost_packets = 0;
936 - } else if (++sta->lost_packets >= STA_LOST_PKT_THRESHOLD) {
937 - cfg80211_cqm_pktloss_notify(sta->sdata->dev,
941 - sta->lost_packets = 0;
943 + ieee80211_lost_packet(sta, skb);
947 --- a/net/mac80211/rx.c
948 +++ b/net/mac80211/rx.c
949 @@ -1107,6 +1107,8 @@ static void sta_ps_end(struct sta_info *
953 + set_sta_flag(sta, WLAN_STA_PS_DELIVER);
954 + clear_sta_flag(sta, WLAN_STA_PS_STA);
955 ieee80211_sta_ps_deliver_wakeup(sta);
958 --- a/net/mac80211/sta_info.h
959 +++ b/net/mac80211/sta_info.h
960 @@ -82,6 +82,7 @@ enum ieee80211_sta_info_flags {
961 WLAN_STA_TOFFSET_KNOWN,
963 WLAN_STA_MPSP_RECIPIENT,
964 + WLAN_STA_PS_DELIVER,
967 #define ADDBA_RESP_INTERVAL HZ
968 @@ -265,7 +266,7 @@ struct ieee80211_tx_latency_stat {
969 * @last_rx_rate_vht_nss: rx status nss of last data packet
970 * @lock: used for locking all fields that require locking, see comments
971 * in the header file.
972 - * @drv_unblock_wk: used for driver PS unblocking
973 + * @drv_deliver_wk: used for delivering frames after driver PS unblocking
974 * @listen_interval: listen interval of this station, when we're acting as AP
975 * @_flags: STA flags, see &enum ieee80211_sta_info_flags, do not use directly
976 * @ps_lock: used for powersave (when mac80211 is the AP) related locking
977 @@ -278,7 +279,6 @@ struct ieee80211_tx_latency_stat {
978 * @driver_buffered_tids: bitmap of TIDs the driver has data buffered on
979 * @rx_packets: Number of MSDUs received from this STA
980 * @rx_bytes: Number of bytes received from this STA
981 - * @wep_weak_iv_count: number of weak WEP IVs received from this station
982 * @last_rx: time (in jiffies) when last frame was received from this STA
983 * @last_connected: time (in seconds) when a station got connected
984 * @num_duplicates: number of duplicate frames received from this STA
985 @@ -345,7 +345,7 @@ struct sta_info {
986 void *rate_ctrl_priv;
989 - struct work_struct drv_unblock_wk;
990 + struct work_struct drv_deliver_wk;
994 @@ -367,7 +367,6 @@ struct sta_info {
995 /* Updated from RX path only, no locking requirements */
996 unsigned long rx_packets;
998 - unsigned long wep_weak_iv_count;
999 unsigned long last_rx;
1000 long last_connected;
1001 unsigned long num_duplicates;
1002 @@ -628,6 +627,8 @@ void sta_set_rate_info_tx(struct sta_inf
1003 struct rate_info *rinfo);
1004 void sta_set_rate_info_rx(struct sta_info *sta,
1005 struct rate_info *rinfo);
1006 +void sta_set_sinfo(struct sta_info *sta, struct station_info *sinfo);
1008 void ieee80211_sta_expire(struct ieee80211_sub_if_data *sdata,
1009 unsigned long exp_time);
1010 u8 sta_info_tx_streams(struct sta_info *sta);
1011 --- a/net/mac80211/tx.c
1012 +++ b/net/mac80211/tx.c
1013 @@ -469,7 +469,8 @@ ieee80211_tx_h_unicast_ps_buf(struct iee
1016 if (unlikely((test_sta_flag(sta, WLAN_STA_PS_STA) ||
1017 - test_sta_flag(sta, WLAN_STA_PS_DRIVER)) &&
1018 + test_sta_flag(sta, WLAN_STA_PS_DRIVER) ||
1019 + test_sta_flag(sta, WLAN_STA_PS_DELIVER)) &&
1020 !(info->flags & IEEE80211_TX_CTL_NO_PS_BUFFER))) {
1021 int ac = skb_get_queue_mapping(tx->skb);
1023 @@ -486,7 +487,8 @@ ieee80211_tx_h_unicast_ps_buf(struct iee
1024 * ahead and Tx the packet.
1026 if (!test_sta_flag(sta, WLAN_STA_PS_STA) &&
1027 - !test_sta_flag(sta, WLAN_STA_PS_DRIVER)) {
1028 + !test_sta_flag(sta, WLAN_STA_PS_DRIVER) &&
1029 + !test_sta_flag(sta, WLAN_STA_PS_DELIVER)) {
1030 spin_unlock(&sta->ps_lock);
1033 @@ -1618,12 +1620,12 @@ netdev_tx_t ieee80211_monitor_start_xmit
1035 struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr);
1036 struct ieee80211_chanctx_conf *chanctx_conf;
1037 - struct ieee80211_channel *chan;
1038 struct ieee80211_radiotap_header *prthdr =
1039 (struct ieee80211_radiotap_header *)skb->data;
1040 struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
1041 struct ieee80211_hdr *hdr;
1042 struct ieee80211_sub_if_data *tmp_sdata, *sdata;
1043 + struct cfg80211_chan_def *chandef;
1047 @@ -1721,9 +1723,9 @@ netdev_tx_t ieee80211_monitor_start_xmit
1051 - chan = chanctx_conf->def.chan;
1052 + chandef = &chanctx_conf->def;
1053 else if (!local->use_chanctx)
1054 - chan = local->_oper_chandef.chan;
1055 + chandef = &local->_oper_chandef;
1059 @@ -1743,10 +1745,11 @@ netdev_tx_t ieee80211_monitor_start_xmit
1060 * radar detection by itself. We can do that later by adding a
1061 * monitor flag interfaces used for AP support.
1063 - if ((chan->flags & (IEEE80211_CHAN_NO_IR | IEEE80211_CHAN_RADAR)))
1064 + if (!cfg80211_reg_can_beacon(local->hw.wiphy, chandef,
1068 - ieee80211_xmit(sdata, skb, chan->band);
1069 + ieee80211_xmit(sdata, skb, chandef->chan->band);
1072 return NETDEV_TX_OK;
1073 @@ -2425,7 +2428,7 @@ static void ieee80211_set_csa(struct iee
1075 size_t beacon_data_len;
1077 - u8 count = sdata->csa_current_counter;
1078 + u8 count = beacon->csa_current_counter;
1080 switch (sdata->vif.type) {
1081 case NL80211_IFTYPE_AP:
1082 @@ -2444,46 +2447,54 @@ static void ieee80211_set_csa(struct iee
1087 for (i = 0; i < IEEE80211_MAX_CSA_COUNTERS_NUM; ++i) {
1088 - u16 counter_offset_beacon =
1089 - sdata->csa_counter_offset_beacon[i];
1090 - u16 counter_offset_presp = sdata->csa_counter_offset_presp[i];
1092 - if (counter_offset_beacon) {
1093 - if (WARN_ON(counter_offset_beacon >= beacon_data_len))
1096 - beacon_data[counter_offset_beacon] = count;
1099 - if (sdata->vif.type == NL80211_IFTYPE_AP &&
1100 - counter_offset_presp) {
1102 - resp = rcu_dereference(sdata->u.ap.probe_resp);
1103 + resp = rcu_dereference(sdata->u.ap.probe_resp);
1105 - /* If nl80211 accepted the offset, this should
1108 - if (WARN_ON(!resp)) {
1109 + if (beacon->csa_counter_offsets[i]) {
1110 + if (WARN_ON_ONCE(beacon->csa_counter_offsets[i] >=
1111 + beacon_data_len)) {
1115 - resp->data[counter_offset_presp] = count;
1116 - rcu_read_unlock();
1118 + beacon_data[beacon->csa_counter_offsets[i]] = count;
1121 + if (sdata->vif.type == NL80211_IFTYPE_AP && resp &&
1122 + resp->csa_counter_offsets)
1123 + resp->data[resp->csa_counter_offsets[i]] = count;
1125 + rcu_read_unlock();
1128 u8 ieee80211_csa_update_counter(struct ieee80211_vif *vif)
1130 struct ieee80211_sub_if_data *sdata = vif_to_sdata(vif);
1131 + struct beacon_data *beacon = NULL;
1136 + if (sdata->vif.type == NL80211_IFTYPE_AP)
1137 + beacon = rcu_dereference(sdata->u.ap.beacon);
1138 + else if (sdata->vif.type == NL80211_IFTYPE_ADHOC)
1139 + beacon = rcu_dereference(sdata->u.ibss.presp);
1140 + else if (ieee80211_vif_is_mesh(&sdata->vif))
1141 + beacon = rcu_dereference(sdata->u.mesh.beacon);
1146 - sdata->csa_current_counter--;
1147 + beacon->csa_current_counter--;
1149 /* the counter should never reach 0 */
1150 - WARN_ON(!sdata->csa_current_counter);
1151 + WARN_ON_ONCE(!beacon->csa_current_counter);
1152 + count = beacon->csa_current_counter;
1154 - return sdata->csa_current_counter;
1156 + rcu_read_unlock();
1159 EXPORT_SYMBOL(ieee80211_csa_update_counter);
1161 @@ -2493,7 +2504,6 @@ bool ieee80211_csa_is_complete(struct ie
1162 struct beacon_data *beacon = NULL;
1164 size_t beacon_data_len;
1165 - int counter_beacon = sdata->csa_counter_offset_beacon[0];
1168 if (!ieee80211_sdata_running(sdata))
1169 @@ -2531,10 +2541,13 @@ bool ieee80211_csa_is_complete(struct ie
1173 - if (WARN_ON(counter_beacon > beacon_data_len))
1174 + if (!beacon->csa_counter_offsets[0])
1177 + if (WARN_ON_ONCE(beacon->csa_counter_offsets[0] > beacon_data_len))
1180 - if (beacon_data[counter_beacon] == 1)
1181 + if (beacon_data[beacon->csa_counter_offsets[0]] == 1)
1185 @@ -2550,6 +2563,7 @@ __ieee80211_beacon_get(struct ieee80211_
1188 struct ieee80211_local *local = hw_to_local(hw);
1189 + struct beacon_data *beacon = NULL;
1190 struct sk_buff *skb = NULL;
1191 struct ieee80211_tx_info *info;
1192 struct ieee80211_sub_if_data *sdata = NULL;
1193 @@ -2571,10 +2585,10 @@ __ieee80211_beacon_get(struct ieee80211_
1195 if (sdata->vif.type == NL80211_IFTYPE_AP) {
1196 struct ieee80211_if_ap *ap = &sdata->u.ap;
1197 - struct beacon_data *beacon = rcu_dereference(ap->beacon);
1199 + beacon = rcu_dereference(ap->beacon);
1201 - if (sdata->vif.csa_active) {
1202 + if (beacon->csa_counter_offsets[0]) {
1204 ieee80211_csa_update_counter(vif);
1206 @@ -2615,37 +2629,37 @@ __ieee80211_beacon_get(struct ieee80211_
1207 } else if (sdata->vif.type == NL80211_IFTYPE_ADHOC) {
1208 struct ieee80211_if_ibss *ifibss = &sdata->u.ibss;
1209 struct ieee80211_hdr *hdr;
1210 - struct beacon_data *presp = rcu_dereference(ifibss->presp);
1213 + beacon = rcu_dereference(ifibss->presp);
1217 - if (sdata->vif.csa_active) {
1218 + if (beacon->csa_counter_offsets[0]) {
1220 ieee80211_csa_update_counter(vif);
1222 - ieee80211_set_csa(sdata, presp);
1223 + ieee80211_set_csa(sdata, beacon);
1226 - skb = dev_alloc_skb(local->tx_headroom + presp->head_len +
1227 + skb = dev_alloc_skb(local->tx_headroom + beacon->head_len +
1228 local->hw.extra_beacon_tailroom);
1231 skb_reserve(skb, local->tx_headroom);
1232 - memcpy(skb_put(skb, presp->head_len), presp->head,
1234 + memcpy(skb_put(skb, beacon->head_len), beacon->head,
1235 + beacon->head_len);
1237 hdr = (struct ieee80211_hdr *) skb->data;
1238 hdr->frame_control = cpu_to_le16(IEEE80211_FTYPE_MGMT |
1239 IEEE80211_STYPE_BEACON);
1240 } else if (ieee80211_vif_is_mesh(&sdata->vif)) {
1241 struct ieee80211_if_mesh *ifmsh = &sdata->u.mesh;
1242 - struct beacon_data *bcn = rcu_dereference(ifmsh->beacon);
1245 + beacon = rcu_dereference(ifmsh->beacon);
1249 - if (sdata->vif.csa_active) {
1250 + if (beacon->csa_counter_offsets[0]) {
1252 /* TODO: For mesh csa_counter is in TU, so
1253 * decrementing it by one isn't correct, but
1254 @@ -2654,40 +2668,42 @@ __ieee80211_beacon_get(struct ieee80211_
1256 ieee80211_csa_update_counter(vif);
1258 - ieee80211_set_csa(sdata, bcn);
1259 + ieee80211_set_csa(sdata, beacon);
1262 if (ifmsh->sync_ops)
1263 - ifmsh->sync_ops->adjust_tbtt(sdata, bcn);
1264 + ifmsh->sync_ops->adjust_tbtt(sdata, beacon);
1266 skb = dev_alloc_skb(local->tx_headroom +
1268 + beacon->head_len +
1271 + beacon->tail_len +
1272 local->hw.extra_beacon_tailroom);
1275 skb_reserve(skb, local->tx_headroom);
1276 - memcpy(skb_put(skb, bcn->head_len), bcn->head, bcn->head_len);
1277 + memcpy(skb_put(skb, beacon->head_len), beacon->head,
1278 + beacon->head_len);
1279 ieee80211_beacon_add_tim(sdata, &ifmsh->ps, skb, is_template);
1282 - offs->tim_offset = bcn->head_len;
1283 - offs->tim_length = skb->len - bcn->head_len;
1284 + offs->tim_offset = beacon->head_len;
1285 + offs->tim_length = skb->len - beacon->head_len;
1288 - memcpy(skb_put(skb, bcn->tail_len), bcn->tail, bcn->tail_len);
1289 + memcpy(skb_put(skb, beacon->tail_len), beacon->tail,
1290 + beacon->tail_len);
1298 + if (offs && beacon) {
1301 for (i = 0; i < IEEE80211_MAX_CSA_COUNTERS_NUM; i++) {
1302 - u16 csa_off = sdata->csa_counter_offset_beacon[i];
1303 + u16 csa_off = beacon->csa_counter_offsets[i];
1307 --- a/drivers/net/wireless/rt2x00/rt2800lib.c
1308 +++ b/drivers/net/wireless/rt2x00/rt2800lib.c
1309 @@ -947,6 +947,40 @@ static inline u8 rt2800_get_beacon_offse
1310 return BEACON_BASE_TO_OFFSET(rt2800_hw_beacon_base(rt2x00dev, index));
1313 +static void rt2800_update_beacons_setup(struct rt2x00_dev *rt2x00dev)
1315 + struct data_queue *queue = rt2x00dev->bcn;
1316 + struct queue_entry *entry;
1317 + int i, bcn_num = 0;
1322 + * Setup offsets of all active beacons in BCN_OFFSET{0,1} registers.
1324 + for (i = 0; i < queue->limit; i++) {
1325 + entry = &queue->entries[i];
1326 + if (!test_bit(ENTRY_BCN_ENABLED, &entry->flags))
1328 + off = rt2800_get_beacon_offset(rt2x00dev, entry->entry_idx);
1329 + reg |= off << (8 * bcn_num);
1333 + WARN_ON_ONCE(bcn_num != rt2x00dev->intf_beaconing);
1335 + rt2800_register_write(rt2x00dev, BCN_OFFSET0, (u32) reg);
1336 + rt2800_register_write(rt2x00dev, BCN_OFFSET1, (u32) (reg >> 32));
1339 + * H/W sends up to MAC_BSSID_DW1_BSS_BCN_NUM + 1 consecutive beacons.
1341 + rt2800_register_read(rt2x00dev, MAC_BSSID_DW1, &bssid_dw1);
1342 + rt2x00_set_field32(&bssid_dw1, MAC_BSSID_DW1_BSS_BCN_NUM,
1343 + bcn_num > 0 ? bcn_num - 1 : 0);
1344 + rt2800_register_write(rt2x00dev, MAC_BSSID_DW1, bssid_dw1);
1347 void rt2800_write_beacon(struct queue_entry *entry, struct txentry_desc *txdesc)
1349 struct rt2x00_dev *rt2x00dev = entry->queue->rt2x00dev;
1350 @@ -1003,6 +1037,12 @@ void rt2800_write_beacon(struct queue_en
1352 rt2800_register_multiwrite(rt2x00dev, beacon_base, entry->skb->data,
1353 entry->skb->len + padding_len);
1354 + __set_bit(ENTRY_BCN_ENABLED, &entry->flags);
1357 + * Change global beacons settings.
1359 + rt2800_update_beacons_setup(rt2x00dev);
1362 * Restore beaconing state.
1363 @@ -1053,8 +1093,13 @@ void rt2800_clear_beacon(struct queue_en
1366 rt2800_clear_beacon_register(rt2x00dev, entry->entry_idx);
1367 + __clear_bit(ENTRY_BCN_ENABLED, &entry->flags);
1370 + * Change global beacons settings.
1372 + rt2800_update_beacons_setup(rt2x00dev);
1374 * Restore beaconing state.
1376 rt2800_register_write(rt2x00dev, BCN_TIME_CFG, orig_reg);
1377 @@ -1556,7 +1601,7 @@ void rt2800_config_intf(struct rt2x00_de
1378 if (!is_zero_ether_addr((const u8 *)conf->bssid)) {
1379 reg = le32_to_cpu(conf->bssid[1]);
1380 rt2x00_set_field32(®, MAC_BSSID_DW1_BSS_ID_MASK, 3);
1381 - rt2x00_set_field32(®, MAC_BSSID_DW1_BSS_BCN_NUM, 7);
1382 + rt2x00_set_field32(®, MAC_BSSID_DW1_BSS_BCN_NUM, 0);
1383 conf->bssid[1] = cpu_to_le32(reg);
1386 @@ -4517,28 +4562,6 @@ static int rt2800_init_registers(struct
1390 - rt2800_register_read(rt2x00dev, BCN_OFFSET0, ®);
1391 - rt2x00_set_field32(®, BCN_OFFSET0_BCN0,
1392 - rt2800_get_beacon_offset(rt2x00dev, 0));
1393 - rt2x00_set_field32(®, BCN_OFFSET0_BCN1,
1394 - rt2800_get_beacon_offset(rt2x00dev, 1));
1395 - rt2x00_set_field32(®, BCN_OFFSET0_BCN2,
1396 - rt2800_get_beacon_offset(rt2x00dev, 2));
1397 - rt2x00_set_field32(®, BCN_OFFSET0_BCN3,
1398 - rt2800_get_beacon_offset(rt2x00dev, 3));
1399 - rt2800_register_write(rt2x00dev, BCN_OFFSET0, reg);
1401 - rt2800_register_read(rt2x00dev, BCN_OFFSET1, ®);
1402 - rt2x00_set_field32(®, BCN_OFFSET1_BCN4,
1403 - rt2800_get_beacon_offset(rt2x00dev, 4));
1404 - rt2x00_set_field32(®, BCN_OFFSET1_BCN5,
1405 - rt2800_get_beacon_offset(rt2x00dev, 5));
1406 - rt2x00_set_field32(®, BCN_OFFSET1_BCN6,
1407 - rt2800_get_beacon_offset(rt2x00dev, 6));
1408 - rt2x00_set_field32(®, BCN_OFFSET1_BCN7,
1409 - rt2800_get_beacon_offset(rt2x00dev, 7));
1410 - rt2800_register_write(rt2x00dev, BCN_OFFSET1, reg);
1412 rt2800_register_write(rt2x00dev, LEGACY_BASIC_RATE, 0x0000013f);
1413 rt2800_register_write(rt2x00dev, HT_BASIC_RATE, 0x00008003);
1415 --- a/drivers/net/wireless/rt2x00/rt2x00dev.c
1416 +++ b/drivers/net/wireless/rt2x00/rt2x00dev.c
1417 @@ -141,8 +141,11 @@ static void rt2x00lib_intf_scheduled_ite
1418 if (!test_bit(DEVICE_STATE_ENABLED_RADIO, &rt2x00dev->flags))
1421 - if (test_and_clear_bit(DELAYED_UPDATE_BEACON, &intf->delayed_flags))
1422 + if (test_and_clear_bit(DELAYED_UPDATE_BEACON, &intf->delayed_flags)) {
1423 + mutex_lock(&intf->beacon_skb_mutex);
1424 rt2x00queue_update_beacon(rt2x00dev, vif);
1425 + mutex_unlock(&intf->beacon_skb_mutex);
1429 static void rt2x00lib_intf_scheduled(struct work_struct *work)
1430 @@ -216,7 +219,7 @@ static void rt2x00lib_beaconupdate_iter(
1431 * never be called for USB devices.
1433 WARN_ON(rt2x00_is_usb(rt2x00dev));
1434 - rt2x00queue_update_beacon_locked(rt2x00dev, vif);
1435 + rt2x00queue_update_beacon(rt2x00dev, vif);
1438 void rt2x00lib_beacondone(struct rt2x00_dev *rt2x00dev)
1439 --- a/drivers/net/wireless/rt2x00/rt2x00mac.c
1440 +++ b/drivers/net/wireless/rt2x00/rt2x00mac.c
1441 @@ -487,6 +487,8 @@ int rt2x00mac_set_key(struct ieee80211_h
1442 crypto.cipher = rt2x00crypto_key_to_cipher(key);
1443 if (crypto.cipher == CIPHER_NONE)
1445 + if (crypto.cipher == CIPHER_TKIP && rt2x00_is_usb(rt2x00dev))
1446 + return -EOPNOTSUPP;
1450 @@ -624,25 +626,24 @@ void rt2x00mac_bss_info_changed(struct i
1451 * Start/stop beaconing.
1453 if (changes & BSS_CHANGED_BEACON_ENABLED) {
1454 + mutex_lock(&intf->beacon_skb_mutex);
1455 if (!bss_conf->enable_beacon && intf->enable_beacon) {
1456 rt2x00dev->intf_beaconing--;
1457 intf->enable_beacon = false;
1459 - * Clear beacon in the H/W for this vif. This is needed
1460 - * to disable beaconing on this particular interface
1461 - * and keep it running on other interfaces.
1463 - rt2x00queue_clear_beacon(rt2x00dev, vif);
1465 if (rt2x00dev->intf_beaconing == 0) {
1467 * Last beaconing interface disabled
1468 * -> stop beacon queue.
1470 - mutex_lock(&intf->beacon_skb_mutex);
1471 rt2x00queue_stop_queue(rt2x00dev->bcn);
1472 - mutex_unlock(&intf->beacon_skb_mutex);
1475 + * Clear beacon in the H/W for this vif. This is needed
1476 + * to disable beaconing on this particular interface
1477 + * and keep it running on other interfaces.
1479 + rt2x00queue_clear_beacon(rt2x00dev, vif);
1480 } else if (bss_conf->enable_beacon && !intf->enable_beacon) {
1481 rt2x00dev->intf_beaconing++;
1482 intf->enable_beacon = true;
1483 @@ -658,11 +659,10 @@ void rt2x00mac_bss_info_changed(struct i
1484 * First beaconing interface enabled
1485 * -> start beacon queue.
1487 - mutex_lock(&intf->beacon_skb_mutex);
1488 rt2x00queue_start_queue(rt2x00dev->bcn);
1489 - mutex_unlock(&intf->beacon_skb_mutex);
1492 + mutex_unlock(&intf->beacon_skb_mutex);
1496 --- a/drivers/net/wireless/rt2x00/rt2x00queue.c
1497 +++ b/drivers/net/wireless/rt2x00/rt2x00queue.c
1498 @@ -754,8 +754,6 @@ int rt2x00queue_clear_beacon(struct rt2x
1499 if (unlikely(!intf->beacon))
1502 - mutex_lock(&intf->beacon_skb_mutex);
1505 * Clean up the beacon skb.
1507 @@ -768,13 +766,11 @@ int rt2x00queue_clear_beacon(struct rt2x
1508 if (rt2x00dev->ops->lib->clear_beacon)
1509 rt2x00dev->ops->lib->clear_beacon(intf->beacon);
1511 - mutex_unlock(&intf->beacon_skb_mutex);
1516 -int rt2x00queue_update_beacon_locked(struct rt2x00_dev *rt2x00dev,
1517 - struct ieee80211_vif *vif)
1518 +int rt2x00queue_update_beacon(struct rt2x00_dev *rt2x00dev,
1519 + struct ieee80211_vif *vif)
1521 struct rt2x00_intf *intf = vif_to_intf(vif);
1522 struct skb_frame_desc *skbdesc;
1523 @@ -815,19 +811,6 @@ int rt2x00queue_update_beacon_locked(str
1527 -int rt2x00queue_update_beacon(struct rt2x00_dev *rt2x00dev,
1528 - struct ieee80211_vif *vif)
1530 - struct rt2x00_intf *intf = vif_to_intf(vif);
1533 - mutex_lock(&intf->beacon_skb_mutex);
1534 - ret = rt2x00queue_update_beacon_locked(rt2x00dev, vif);
1535 - mutex_unlock(&intf->beacon_skb_mutex);
1540 bool rt2x00queue_for_each_entry(struct data_queue *queue,
1541 enum queue_index start,
1542 enum queue_index end,
1543 --- a/drivers/net/wireless/rt2x00/rt2x00queue.h
1544 +++ b/drivers/net/wireless/rt2x00/rt2x00queue.h
1545 @@ -353,6 +353,7 @@ struct txentry_desc {
1547 enum queue_entry_flags {
1549 + ENTRY_BCN_ENABLED,
1550 ENTRY_OWNER_DEVICE_DATA,
1552 ENTRY_DATA_IO_FAILED,
1553 --- a/drivers/net/wireless/ath/ath9k/main.c
1554 +++ b/drivers/net/wireless/ath/ath9k/main.c
1555 @@ -1757,7 +1757,6 @@ out:
1556 void ath9k_update_p2p_ps(struct ath_softc *sc, struct ieee80211_vif *vif)
1558 struct ath_vif *avp = (void *)vif->drv_priv;
1559 - unsigned long flags;
1562 if (!sc->p2p_ps_timer)
1563 @@ -1767,14 +1766,9 @@ void ath9k_update_p2p_ps(struct ath_soft
1566 sc->p2p_ps_vif = avp;
1568 - spin_lock_irqsave(&sc->sc_pm_lock, flags);
1569 - if (!(sc->ps_flags & PS_BEACON_SYNC)) {
1570 - tsf = ath9k_hw_gettsf32(sc->sc_ah);
1571 - ieee80211_parse_p2p_noa(&vif->bss_conf.p2p_noa_attr, &avp->noa, tsf);
1572 - ath9k_update_p2p_ps_timer(sc, avp);
1574 - spin_unlock_irqrestore(&sc->sc_pm_lock, flags);
1575 + tsf = ath9k_hw_gettsf32(sc->sc_ah);
1576 + ieee80211_parse_p2p_noa(&vif->bss_conf.p2p_noa_attr, &avp->noa, tsf);
1577 + ath9k_update_p2p_ps_timer(sc, avp);
1580 static void ath9k_bss_info_changed(struct ieee80211_hw *hw,
1581 @@ -1791,6 +1785,7 @@ static void ath9k_bss_info_changed(struc
1582 struct ath_hw *ah = sc->sc_ah;
1583 struct ath_common *common = ath9k_hw_common(ah);
1584 struct ath_vif *avp = (void *)vif->drv_priv;
1585 + unsigned long flags;
1588 ath9k_ps_wakeup(sc);
1589 @@ -1853,7 +1848,10 @@ static void ath9k_bss_info_changed(struc
1591 if (changed & BSS_CHANGED_P2P_PS) {
1592 spin_lock_bh(&sc->sc_pcu_lock);
1593 - ath9k_update_p2p_ps(sc, vif);
1594 + spin_lock_irqsave(&sc->sc_pm_lock, flags);
1595 + if (!(sc->ps_flags & PS_BEACON_SYNC))
1596 + ath9k_update_p2p_ps(sc, vif);
1597 + spin_unlock_irqrestore(&sc->sc_pm_lock, flags);
1598 spin_unlock_bh(&sc->sc_pcu_lock);
1601 @@ -2232,14 +2230,6 @@ static void ath9k_sw_scan_complete(struc
1602 clear_bit(ATH_OP_SCANNING, &common->op_flags);
1605 -static void ath9k_channel_switch_beacon(struct ieee80211_hw *hw,
1606 - struct ieee80211_vif *vif,
1607 - struct cfg80211_chan_def *chandef)
1609 - /* depend on vif->csa_active only */
1613 struct ieee80211_ops ath9k_ops = {
1615 .start = ath9k_start,
1616 @@ -2287,5 +2277,4 @@ struct ieee80211_ops ath9k_ops = {
1618 .sw_scan_start = ath9k_sw_scan_start,
1619 .sw_scan_complete = ath9k_sw_scan_complete,
1620 - .channel_switch_beacon = ath9k_channel_switch_beacon,
1622 --- a/drivers/net/wireless/ath/ath10k/mac.c
1623 +++ b/drivers/net/wireless/ath/ath10k/mac.c
1624 @@ -4142,14 +4142,6 @@ static int ath10k_set_bitrate_mask(struc
1625 fixed_nss, force_sgi);
1628 -static void ath10k_channel_switch_beacon(struct ieee80211_hw *hw,
1629 - struct ieee80211_vif *vif,
1630 - struct cfg80211_chan_def *chandef)
1632 - /* there's no need to do anything here. vif->csa_active is enough */
1636 static void ath10k_sta_rc_update(struct ieee80211_hw *hw,
1637 struct ieee80211_vif *vif,
1638 struct ieee80211_sta *sta,
1639 @@ -4256,7 +4248,6 @@ static const struct ieee80211_ops ath10k
1640 .restart_complete = ath10k_restart_complete,
1641 .get_survey = ath10k_get_survey,
1642 .set_bitrate_mask = ath10k_set_bitrate_mask,
1643 - .channel_switch_beacon = ath10k_channel_switch_beacon,
1644 .sta_rc_update = ath10k_sta_rc_update,
1645 .get_tsf = ath10k_get_tsf,
1647 --- a/net/mac80211/cfg.c
1648 +++ b/net/mac80211/cfg.c
1649 @@ -468,327 +468,6 @@ void sta_set_rate_info_rx(struct sta_inf
1650 rinfo->flags |= RATE_INFO_FLAGS_160_MHZ_WIDTH;
1653 -static void sta_set_sinfo(struct sta_info *sta, struct station_info *sinfo)
1655 - struct ieee80211_sub_if_data *sdata = sta->sdata;
1656 - struct ieee80211_local *local = sdata->local;
1657 - struct rate_control_ref *ref = local->rate_ctrl;
1658 - struct timespec uptime;
1663 - sinfo->generation = sdata->local->sta_generation;
1665 - sinfo->filled = STATION_INFO_INACTIVE_TIME |
1666 - STATION_INFO_RX_BYTES64 |
1667 - STATION_INFO_TX_BYTES64 |
1668 - STATION_INFO_RX_PACKETS |
1669 - STATION_INFO_TX_PACKETS |
1670 - STATION_INFO_TX_RETRIES |
1671 - STATION_INFO_TX_FAILED |
1672 - STATION_INFO_TX_BITRATE |
1673 - STATION_INFO_RX_BITRATE |
1674 - STATION_INFO_RX_DROP_MISC |
1675 - STATION_INFO_BSS_PARAM |
1676 - STATION_INFO_CONNECTED_TIME |
1677 - STATION_INFO_STA_FLAGS |
1678 - STATION_INFO_BEACON_LOSS_COUNT;
1680 - do_posix_clock_monotonic_gettime(&uptime);
1681 - sinfo->connected_time = uptime.tv_sec - sta->last_connected;
1683 - sinfo->inactive_time = jiffies_to_msecs(jiffies - sta->last_rx);
1684 - sinfo->tx_bytes = 0;
1685 - for (ac = 0; ac < IEEE80211_NUM_ACS; ac++) {
1686 - sinfo->tx_bytes += sta->tx_bytes[ac];
1687 - packets += sta->tx_packets[ac];
1689 - sinfo->tx_packets = packets;
1690 - sinfo->rx_bytes = sta->rx_bytes;
1691 - sinfo->rx_packets = sta->rx_packets;
1692 - sinfo->tx_retries = sta->tx_retry_count;
1693 - sinfo->tx_failed = sta->tx_retry_failed;
1694 - sinfo->rx_dropped_misc = sta->rx_dropped;
1695 - sinfo->beacon_loss_count = sta->beacon_loss_count;
1697 - if ((sta->local->hw.flags & IEEE80211_HW_SIGNAL_DBM) ||
1698 - (sta->local->hw.flags & IEEE80211_HW_SIGNAL_UNSPEC)) {
1699 - sinfo->filled |= STATION_INFO_SIGNAL | STATION_INFO_SIGNAL_AVG;
1700 - if (!local->ops->get_rssi ||
1701 - drv_get_rssi(local, sdata, &sta->sta, &sinfo->signal))
1702 - sinfo->signal = (s8)sta->last_signal;
1703 - sinfo->signal_avg = (s8) -ewma_read(&sta->avg_signal);
1705 - if (sta->chains) {
1706 - sinfo->filled |= STATION_INFO_CHAIN_SIGNAL |
1707 - STATION_INFO_CHAIN_SIGNAL_AVG;
1709 - sinfo->chains = sta->chains;
1710 - for (i = 0; i < ARRAY_SIZE(sinfo->chain_signal); i++) {
1711 - sinfo->chain_signal[i] = sta->chain_signal_last[i];
1712 - sinfo->chain_signal_avg[i] =
1713 - (s8) -ewma_read(&sta->chain_signal_avg[i]);
1717 - sta_set_rate_info_tx(sta, &sta->last_tx_rate, &sinfo->txrate);
1718 - sta_set_rate_info_rx(sta, &sinfo->rxrate);
1720 - if (ieee80211_vif_is_mesh(&sdata->vif)) {
1721 -#ifdef CPTCFG_MAC80211_MESH
1722 - sinfo->filled |= STATION_INFO_LLID |
1723 - STATION_INFO_PLID |
1724 - STATION_INFO_PLINK_STATE |
1725 - STATION_INFO_LOCAL_PM |
1726 - STATION_INFO_PEER_PM |
1727 - STATION_INFO_NONPEER_PM;
1729 - sinfo->llid = sta->llid;
1730 - sinfo->plid = sta->plid;
1731 - sinfo->plink_state = sta->plink_state;
1732 - if (test_sta_flag(sta, WLAN_STA_TOFFSET_KNOWN)) {
1733 - sinfo->filled |= STATION_INFO_T_OFFSET;
1734 - sinfo->t_offset = sta->t_offset;
1736 - sinfo->local_pm = sta->local_pm;
1737 - sinfo->peer_pm = sta->peer_pm;
1738 - sinfo->nonpeer_pm = sta->nonpeer_pm;
1742 - sinfo->bss_param.flags = 0;
1743 - if (sdata->vif.bss_conf.use_cts_prot)
1744 - sinfo->bss_param.flags |= BSS_PARAM_FLAGS_CTS_PROT;
1745 - if (sdata->vif.bss_conf.use_short_preamble)
1746 - sinfo->bss_param.flags |= BSS_PARAM_FLAGS_SHORT_PREAMBLE;
1747 - if (sdata->vif.bss_conf.use_short_slot)
1748 - sinfo->bss_param.flags |= BSS_PARAM_FLAGS_SHORT_SLOT_TIME;
1749 - sinfo->bss_param.dtim_period = sdata->local->hw.conf.ps_dtim_period;
1750 - sinfo->bss_param.beacon_interval = sdata->vif.bss_conf.beacon_int;
1752 - sinfo->sta_flags.set = 0;
1753 - sinfo->sta_flags.mask = BIT(NL80211_STA_FLAG_AUTHORIZED) |
1754 - BIT(NL80211_STA_FLAG_SHORT_PREAMBLE) |
1755 - BIT(NL80211_STA_FLAG_WME) |
1756 - BIT(NL80211_STA_FLAG_MFP) |
1757 - BIT(NL80211_STA_FLAG_AUTHENTICATED) |
1758 - BIT(NL80211_STA_FLAG_ASSOCIATED) |
1759 - BIT(NL80211_STA_FLAG_TDLS_PEER);
1760 - if (test_sta_flag(sta, WLAN_STA_AUTHORIZED))
1761 - sinfo->sta_flags.set |= BIT(NL80211_STA_FLAG_AUTHORIZED);
1762 - if (test_sta_flag(sta, WLAN_STA_SHORT_PREAMBLE))
1763 - sinfo->sta_flags.set |= BIT(NL80211_STA_FLAG_SHORT_PREAMBLE);
1764 - if (test_sta_flag(sta, WLAN_STA_WME))
1765 - sinfo->sta_flags.set |= BIT(NL80211_STA_FLAG_WME);
1766 - if (test_sta_flag(sta, WLAN_STA_MFP))
1767 - sinfo->sta_flags.set |= BIT(NL80211_STA_FLAG_MFP);
1768 - if (test_sta_flag(sta, WLAN_STA_AUTH))
1769 - sinfo->sta_flags.set |= BIT(NL80211_STA_FLAG_AUTHENTICATED);
1770 - if (test_sta_flag(sta, WLAN_STA_ASSOC))
1771 - sinfo->sta_flags.set |= BIT(NL80211_STA_FLAG_ASSOCIATED);
1772 - if (test_sta_flag(sta, WLAN_STA_TDLS_PEER))
1773 - sinfo->sta_flags.set |= BIT(NL80211_STA_FLAG_TDLS_PEER);
1775 - /* check if the driver has a SW RC implementation */
1776 - if (ref && ref->ops->get_expected_throughput)
1777 - thr = ref->ops->get_expected_throughput(sta->rate_ctrl_priv);
1779 - thr = drv_get_expected_throughput(local, &sta->sta);
1782 - sinfo->filled |= STATION_INFO_EXPECTED_THROUGHPUT;
1783 - sinfo->expected_throughput = thr;
1787 -static const char ieee80211_gstrings_sta_stats[][ETH_GSTRING_LEN] = {
1788 - "rx_packets", "rx_bytes", "wep_weak_iv_count",
1789 - "rx_duplicates", "rx_fragments", "rx_dropped",
1790 - "tx_packets", "tx_bytes", "tx_fragments",
1791 - "tx_filtered", "tx_retry_failed", "tx_retries",
1792 - "beacon_loss", "sta_state", "txrate", "rxrate", "signal",
1793 - "channel", "noise", "ch_time", "ch_time_busy",
1794 - "ch_time_ext_busy", "ch_time_rx", "ch_time_tx"
1796 -#define STA_STATS_LEN ARRAY_SIZE(ieee80211_gstrings_sta_stats)
1798 -static int ieee80211_get_et_sset_count(struct wiphy *wiphy,
1799 - struct net_device *dev,
1802 - struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev);
1805 - if (sset == ETH_SS_STATS)
1806 - rv += STA_STATS_LEN;
1808 - rv += drv_get_et_sset_count(sdata, sset);
1811 - return -EOPNOTSUPP;
1815 -static void ieee80211_get_et_stats(struct wiphy *wiphy,
1816 - struct net_device *dev,
1817 - struct ethtool_stats *stats,
1820 - struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev);
1821 - struct ieee80211_chanctx_conf *chanctx_conf;
1822 - struct ieee80211_channel *channel;
1823 - struct sta_info *sta;
1824 - struct ieee80211_local *local = sdata->local;
1825 - struct station_info sinfo;
1826 - struct survey_info survey;
1828 -#define STA_STATS_SURVEY_LEN 7
1830 - memset(data, 0, sizeof(u64) * STA_STATS_LEN);
1832 -#define ADD_STA_STATS(sta) \
1834 - data[i++] += sta->rx_packets; \
1835 - data[i++] += sta->rx_bytes; \
1836 - data[i++] += sta->wep_weak_iv_count; \
1837 - data[i++] += sta->num_duplicates; \
1838 - data[i++] += sta->rx_fragments; \
1839 - data[i++] += sta->rx_dropped; \
1841 - data[i++] += sinfo.tx_packets; \
1842 - data[i++] += sinfo.tx_bytes; \
1843 - data[i++] += sta->tx_fragments; \
1844 - data[i++] += sta->tx_filtered_count; \
1845 - data[i++] += sta->tx_retry_failed; \
1846 - data[i++] += sta->tx_retry_count; \
1847 - data[i++] += sta->beacon_loss_count; \
1850 - /* For Managed stations, find the single station based on BSSID
1851 - * and use that. For interface types, iterate through all available
1852 - * stations and add stats for any station that is assigned to this
1856 - mutex_lock(&local->sta_mtx);
1858 - if (sdata->vif.type == NL80211_IFTYPE_STATION) {
1859 - sta = sta_info_get_bss(sdata, sdata->u.mgd.bssid);
1861 - if (!(sta && !WARN_ON(sta->sdata->dev != dev)))
1865 - sta_set_sinfo(sta, &sinfo);
1868 - ADD_STA_STATS(sta);
1870 - data[i++] = sta->sta_state;
1873 - if (sinfo.filled & STATION_INFO_TX_BITRATE)
1874 - data[i] = 100000 *
1875 - cfg80211_calculate_bitrate(&sinfo.txrate);
1877 - if (sinfo.filled & STATION_INFO_RX_BITRATE)
1878 - data[i] = 100000 *
1879 - cfg80211_calculate_bitrate(&sinfo.rxrate);
1882 - if (sinfo.filled & STATION_INFO_SIGNAL_AVG)
1883 - data[i] = (u8)sinfo.signal_avg;
1886 - list_for_each_entry(sta, &local->sta_list, list) {
1887 - /* Make sure this station belongs to the proper dev */
1888 - if (sta->sdata->dev != dev)
1892 - sta_set_sinfo(sta, &sinfo);
1894 - ADD_STA_STATS(sta);
1899 - i = STA_STATS_LEN - STA_STATS_SURVEY_LEN;
1900 - /* Get survey stats for current channel */
1901 - survey.filled = 0;
1904 - chanctx_conf = rcu_dereference(sdata->vif.chanctx_conf);
1906 - channel = chanctx_conf->def.chan;
1909 - rcu_read_unlock();
1914 - survey.filled = 0;
1915 - if (drv_get_survey(local, q, &survey) != 0) {
1916 - survey.filled = 0;
1920 - } while (channel != survey.channel);
1923 - if (survey.filled)
1924 - data[i++] = survey.channel->center_freq;
1927 - if (survey.filled & SURVEY_INFO_NOISE_DBM)
1928 - data[i++] = (u8)survey.noise;
1931 - if (survey.filled & SURVEY_INFO_CHANNEL_TIME)
1932 - data[i++] = survey.channel_time;
1935 - if (survey.filled & SURVEY_INFO_CHANNEL_TIME_BUSY)
1936 - data[i++] = survey.channel_time_busy;
1939 - if (survey.filled & SURVEY_INFO_CHANNEL_TIME_EXT_BUSY)
1940 - data[i++] = survey.channel_time_ext_busy;
1943 - if (survey.filled & SURVEY_INFO_CHANNEL_TIME_RX)
1944 - data[i++] = survey.channel_time_rx;
1947 - if (survey.filled & SURVEY_INFO_CHANNEL_TIME_TX)
1948 - data[i++] = survey.channel_time_tx;
1952 - mutex_unlock(&local->sta_mtx);
1954 - if (WARN_ON(i != STA_STATS_LEN))
1957 - drv_get_et_stats(sdata, stats, &(data[STA_STATS_LEN]));
1960 -static void ieee80211_get_et_strings(struct wiphy *wiphy,
1961 - struct net_device *dev,
1962 - u32 sset, u8 *data)
1964 - struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev);
1965 - int sz_sta_stats = 0;
1967 - if (sset == ETH_SS_STATS) {
1968 - sz_sta_stats = sizeof(ieee80211_gstrings_sta_stats);
1969 - memcpy(data, ieee80211_gstrings_sta_stats, sz_sta_stats);
1971 - drv_get_et_strings(sdata, sset, &(data[sz_sta_stats]));
1974 static int ieee80211_dump_station(struct wiphy *wiphy, struct net_device *dev,
1975 int idx, u8 *mac, struct station_info *sinfo)
1977 @@ -875,7 +554,8 @@ static int ieee80211_set_monitor_channel
1980 static int ieee80211_set_probe_resp(struct ieee80211_sub_if_data *sdata,
1981 - const u8 *resp, size_t resp_len)
1982 + const u8 *resp, size_t resp_len,
1983 + const struct ieee80211_csa_settings *csa)
1985 struct probe_resp *new, *old;
1987 @@ -891,6 +571,11 @@ static int ieee80211_set_probe_resp(stru
1988 new->len = resp_len;
1989 memcpy(new->data, resp, resp_len);
1992 + memcpy(new->csa_counter_offsets, csa->counter_offsets_presp,
1993 + csa->n_counter_offsets_presp *
1994 + sizeof(new->csa_counter_offsets[0]));
1996 rcu_assign_pointer(sdata->u.ap.probe_resp, new);
1998 kfree_rcu(old, rcu_head);
1999 @@ -899,7 +584,8 @@ static int ieee80211_set_probe_resp(stru
2002 static int ieee80211_assign_beacon(struct ieee80211_sub_if_data *sdata,
2003 - struct cfg80211_beacon_data *params)
2004 + struct cfg80211_beacon_data *params,
2005 + const struct ieee80211_csa_settings *csa)
2007 struct beacon_data *new, *old;
2008 int new_head_len, new_tail_len;
2009 @@ -943,6 +629,13 @@ static int ieee80211_assign_beacon(struc
2010 new->head_len = new_head_len;
2011 new->tail_len = new_tail_len;
2014 + new->csa_current_counter = csa->count;
2015 + memcpy(new->csa_counter_offsets, csa->counter_offsets_beacon,
2016 + csa->n_counter_offsets_beacon *
2017 + sizeof(new->csa_counter_offsets[0]));
2022 memcpy(new->head, params->head, new_head_len);
2023 @@ -957,7 +650,7 @@ static int ieee80211_assign_beacon(struc
2024 memcpy(new->tail, old->tail, new_tail_len);
2026 err = ieee80211_set_probe_resp(sdata, params->probe_resp,
2027 - params->probe_resp_len);
2028 + params->probe_resp_len, csa);
2032 @@ -1042,7 +735,7 @@ static int ieee80211_start_ap(struct wip
2033 sdata->vif.bss_conf.p2p_noa_attr.oppps_ctwindow |=
2034 IEEE80211_P2P_OPPPS_ENABLE_BIT;
2036 - err = ieee80211_assign_beacon(sdata, ¶ms->beacon);
2037 + err = ieee80211_assign_beacon(sdata, ¶ms->beacon, NULL);
2039 ieee80211_vif_release_channel(sdata);
2041 @@ -1090,7 +783,7 @@ static int ieee80211_change_beacon(struc
2045 - err = ieee80211_assign_beacon(sdata, params);
2046 + err = ieee80211_assign_beacon(sdata, params, NULL);
2049 ieee80211_bss_info_change_notify(sdata, err);
2050 @@ -3073,7 +2766,8 @@ static int ieee80211_set_after_csa_beaco
2052 switch (sdata->vif.type) {
2053 case NL80211_IFTYPE_AP:
2054 - err = ieee80211_assign_beacon(sdata, sdata->u.ap.next_beacon);
2055 + err = ieee80211_assign_beacon(sdata, sdata->u.ap.next_beacon,
2057 kfree(sdata->u.ap.next_beacon);
2058 sdata->u.ap.next_beacon = NULL;
2060 @@ -3176,6 +2870,7 @@ static int ieee80211_set_csa_beacon(stru
2061 struct cfg80211_csa_settings *params,
2064 + struct ieee80211_csa_settings csa = {};
2067 switch (sdata->vif.type) {
2068 @@ -3210,20 +2905,13 @@ static int ieee80211_set_csa_beacon(stru
2069 IEEE80211_MAX_CSA_COUNTERS_NUM))
2072 - /* make sure we don't have garbage in other counters */
2073 - memset(sdata->csa_counter_offset_beacon, 0,
2074 - sizeof(sdata->csa_counter_offset_beacon));
2075 - memset(sdata->csa_counter_offset_presp, 0,
2076 - sizeof(sdata->csa_counter_offset_presp));
2078 - memcpy(sdata->csa_counter_offset_beacon,
2079 - params->counter_offsets_beacon,
2080 - params->n_counter_offsets_beacon * sizeof(u16));
2081 - memcpy(sdata->csa_counter_offset_presp,
2082 - params->counter_offsets_presp,
2083 - params->n_counter_offsets_presp * sizeof(u16));
2084 + csa.counter_offsets_beacon = params->counter_offsets_beacon;
2085 + csa.counter_offsets_presp = params->counter_offsets_presp;
2086 + csa.n_counter_offsets_beacon = params->n_counter_offsets_beacon;
2087 + csa.n_counter_offsets_presp = params->n_counter_offsets_presp;
2088 + csa.count = params->count;
2090 - err = ieee80211_assign_beacon(sdata, ¶ms->beacon_csa);
2091 + err = ieee80211_assign_beacon(sdata, ¶ms->beacon_csa, &csa);
2093 kfree(sdata->u.ap.next_beacon);
2095 @@ -3367,7 +3055,6 @@ __ieee80211_channel_switch(struct wiphy
2096 sdata->csa_radar_required = params->radar_required;
2097 sdata->csa_chandef = params->chandef;
2098 sdata->csa_block_tx = params->block_tx;
2099 - sdata->csa_current_counter = params->count;
2100 sdata->vif.csa_active = true;
2102 if (sdata->csa_block_tx)
2103 @@ -3515,10 +3202,23 @@ static int ieee80211_mgmt_tx(struct wiph
2104 sdata->vif.type == NL80211_IFTYPE_ADHOC) &&
2105 params->n_csa_offsets) {
2107 - u8 c = sdata->csa_current_counter;
2108 + struct beacon_data *beacon = NULL;
2112 - for (i = 0; i < params->n_csa_offsets; i++)
2113 - data[params->csa_offsets[i]] = c;
2114 + if (sdata->vif.type == NL80211_IFTYPE_AP)
2115 + beacon = rcu_dereference(sdata->u.ap.beacon);
2116 + else if (sdata->vif.type == NL80211_IFTYPE_ADHOC)
2117 + beacon = rcu_dereference(sdata->u.ibss.presp);
2118 + else if (ieee80211_vif_is_mesh(&sdata->vif))
2119 + beacon = rcu_dereference(sdata->u.mesh.beacon);
2122 + for (i = 0; i < params->n_csa_offsets; i++)
2123 + data[params->csa_offsets[i]] =
2124 + beacon->csa_current_counter;
2126 + rcu_read_unlock();
2129 IEEE80211_SKB_CB(skb)->flags = flags;
2130 @@ -3598,21 +3298,6 @@ static int ieee80211_get_antenna(struct
2131 return drv_get_antenna(local, tx_ant, rx_ant);
2134 -static int ieee80211_set_ringparam(struct wiphy *wiphy, u32 tx, u32 rx)
2136 - struct ieee80211_local *local = wiphy_priv(wiphy);
2138 - return drv_set_ringparam(local, tx, rx);
2141 -static void ieee80211_get_ringparam(struct wiphy *wiphy,
2142 - u32 *tx, u32 *tx_max, u32 *rx, u32 *rx_max)
2144 - struct ieee80211_local *local = wiphy_priv(wiphy);
2146 - drv_get_ringparam(local, tx, tx_max, rx, rx_max);
2149 static int ieee80211_set_rekey_data(struct wiphy *wiphy,
2150 struct net_device *dev,
2151 struct cfg80211_gtk_rekey_data *data)
2152 @@ -3844,8 +3529,6 @@ const struct cfg80211_ops mac80211_confi
2153 .mgmt_frame_register = ieee80211_mgmt_frame_register,
2154 .set_antenna = ieee80211_set_antenna,
2155 .get_antenna = ieee80211_get_antenna,
2156 - .set_ringparam = ieee80211_set_ringparam,
2157 - .get_ringparam = ieee80211_get_ringparam,
2158 .set_rekey_data = ieee80211_set_rekey_data,
2159 .tdls_oper = ieee80211_tdls_oper,
2160 .tdls_mgmt = ieee80211_tdls_mgmt,
2161 @@ -3854,9 +3537,6 @@ const struct cfg80211_ops mac80211_confi
2163 .set_wakeup = ieee80211_set_wakeup,
2165 - .get_et_sset_count = ieee80211_get_et_sset_count,
2166 - .get_et_stats = ieee80211_get_et_stats,
2167 - .get_et_strings = ieee80211_get_et_strings,
2168 .get_channel = ieee80211_cfg_get_channel,
2169 .start_radar_detection = ieee80211_start_radar_detection,
2170 .channel_switch = ieee80211_channel_switch,
2171 --- a/net/mac80211/debugfs_sta.c
2172 +++ b/net/mac80211/debugfs_sta.c
2173 @@ -587,7 +587,6 @@ void ieee80211_sta_debugfs_add(struct st
2174 DEBUGFS_ADD_COUNTER(tx_filtered, tx_filtered_count);
2175 DEBUGFS_ADD_COUNTER(tx_retry_failed, tx_retry_failed);
2176 DEBUGFS_ADD_COUNTER(tx_retry_count, tx_retry_count);
2177 - DEBUGFS_ADD_COUNTER(wep_weak_iv_count, wep_weak_iv_count);
2179 if (sizeof(sta->driver_buffered_tids) == sizeof(u32))
2180 debugfs_create_x32("driver_buffered_tids", 0400,
2181 --- a/net/mac80211/wep.c
2182 +++ b/net/mac80211/wep.c
2183 @@ -271,22 +271,6 @@ static int ieee80211_wep_decrypt(struct
2188 -static bool ieee80211_wep_is_weak_iv(struct sk_buff *skb,
2189 - struct ieee80211_key *key)
2191 - struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data;
2192 - unsigned int hdrlen;
2196 - hdrlen = ieee80211_hdrlen(hdr->frame_control);
2197 - ivpos = skb->data + hdrlen;
2198 - iv = (ivpos[0] << 16) | (ivpos[1] << 8) | ivpos[2];
2200 - return ieee80211_wep_weak_iv(iv, key->conf.keylen);
2204 ieee80211_crypto_wep_decrypt(struct ieee80211_rx_data *rx)
2206 @@ -301,16 +285,12 @@ ieee80211_crypto_wep_decrypt(struct ieee
2207 if (!(status->flag & RX_FLAG_DECRYPTED)) {
2208 if (skb_linearize(rx->skb))
2209 return RX_DROP_UNUSABLE;
2210 - if (rx->sta && ieee80211_wep_is_weak_iv(rx->skb, rx->key))
2211 - rx->sta->wep_weak_iv_count++;
2212 if (ieee80211_wep_decrypt(rx->local, rx->skb, rx->key))
2213 return RX_DROP_UNUSABLE;
2214 } else if (!(status->flag & RX_FLAG_IV_STRIPPED)) {
2215 if (!pskb_may_pull(rx->skb, ieee80211_hdrlen(fc) +
2216 IEEE80211_WEP_IV_LEN))
2217 return RX_DROP_UNUSABLE;
2218 - if (rx->sta && ieee80211_wep_is_weak_iv(rx->skb, rx->key))
2219 - rx->sta->wep_weak_iv_count++;
2220 ieee80211_wep_remove_iv(rx->local, rx->skb, rx->key);
2222 if (pskb_trim(rx->skb, rx->skb->len - IEEE80211_WEP_ICV_LEN))
2223 --- a/include/net/cfg80211.h
2224 +++ b/include/net/cfg80211.h
2225 @@ -2278,16 +2278,6 @@ struct cfg80211_qos_map {
2227 * @set_noack_map: Set the NoAck Map for the TIDs.
2229 - * @get_et_sset_count: Ethtool API to get string-set count.
2230 - * See @ethtool_ops.get_sset_count
2232 - * @get_et_stats: Ethtool API to get a set of u64 stats.
2233 - * See @ethtool_ops.get_ethtool_stats
2235 - * @get_et_strings: Ethtool API to get a set of strings to describe stats
2236 - * and perhaps other supported types of ethtool data-sets.
2237 - * See @ethtool_ops.get_strings
2239 * @get_channel: Get the current operating channel for the virtual interface.
2240 * For monitor interfaces, it should return %NULL unless there's a single
2241 * current monitoring channel.
2242 @@ -2529,13 +2519,6 @@ struct cfg80211_ops {
2243 struct net_device *dev,
2246 - int (*get_et_sset_count)(struct wiphy *wiphy,
2247 - struct net_device *dev, int sset);
2248 - void (*get_et_stats)(struct wiphy *wiphy, struct net_device *dev,
2249 - struct ethtool_stats *stats, u64 *data);
2250 - void (*get_et_strings)(struct wiphy *wiphy, struct net_device *dev,
2251 - u32 sset, u8 *data);
2253 int (*get_channel)(struct wiphy *wiphy,
2254 struct wireless_dev *wdev,
2255 struct cfg80211_chan_def *chandef);
2256 @@ -4846,6 +4829,10 @@ void cfg80211_stop_iface(struct wiphy *w
2258 void cfg80211_shutdown_all_interfaces(struct wiphy *wiphy);
2261 +/* ethtool helper */
2262 +void cfg80211_get_drvinfo(struct net_device *dev, struct ethtool_drvinfo *info);
2264 /* Logging, debugging and troubleshooting/diagnostic helpers. */
2266 /* wiphy_printk helpers, similar to dev_printk */
2267 --- a/net/mac80211/Makefile
2268 +++ b/net/mac80211/Makefile
2269 @@ -17,6 +17,7 @@ mac80211-y := \
2277 --- a/net/mac80211/ieee80211_i.h
2278 +++ b/net/mac80211/ieee80211_i.h
2279 @@ -229,16 +229,29 @@ struct ieee80211_rx_data {
2283 +struct ieee80211_csa_settings {
2284 + const u16 *counter_offsets_beacon;
2285 + const u16 *counter_offsets_presp;
2287 + int n_counter_offsets_beacon;
2288 + int n_counter_offsets_presp;
2293 struct beacon_data {
2295 int head_len, tail_len;
2296 struct ieee80211_meshconf_ie *meshconf;
2297 + u16 csa_counter_offsets[IEEE80211_MAX_CSA_COUNTERS_NUM];
2298 + u8 csa_current_counter;
2299 struct rcu_head rcu_head;
2303 struct rcu_head rcu_head;
2305 + u16 csa_counter_offsets[IEEE80211_MAX_CSA_COUNTERS_NUM];
2309 @@ -754,8 +767,6 @@ struct ieee80211_sub_if_data {
2310 struct mac80211_qos_map __rcu *qos_map;
2312 struct work_struct csa_finalize_work;
2313 - u16 csa_counter_offset_beacon[IEEE80211_MAX_CSA_COUNTERS_NUM];
2314 - u16 csa_counter_offset_presp[IEEE80211_MAX_CSA_COUNTERS_NUM];
2315 bool csa_radar_required;
2316 bool csa_block_tx; /* write-protected by sdata_lock and local->mtx */
2317 struct cfg80211_chan_def csa_chandef;
2318 @@ -767,7 +778,6 @@ struct ieee80211_sub_if_data {
2319 struct ieee80211_chanctx *reserved_chanctx;
2320 struct cfg80211_chan_def reserved_chandef;
2321 bool reserved_radar_required;
2322 - u8 csa_current_counter;
2324 /* used to reconfigure hardware SM PS */
2325 struct work_struct recalc_smps;
2326 @@ -1850,6 +1860,8 @@ int ieee80211_tdls_oper(struct wiphy *wi
2327 const u8 *peer, enum nl80211_tdls_operation oper);
2330 +extern const struct ethtool_ops ieee80211_ethtool_ops;
2332 #ifdef CPTCFG_MAC80211_NOINLINE
2333 #define debug_noinline noinline
2335 --- a/net/mac80211/iface.c
2336 +++ b/net/mac80211/iface.c
2337 @@ -399,6 +399,7 @@ int ieee80211_add_virtual_monitor(struct
2338 sdata->vif.type = NL80211_IFTYPE_MONITOR;
2339 snprintf(sdata->name, IFNAMSIZ, "%s-monitor",
2340 wiphy_name(local->hw.wiphy));
2341 + sdata->wdev.iftype = NL80211_IFTYPE_MONITOR;
2343 sdata->encrypt_headroom = IEEE80211_ENCRYPT_HEADROOM;
2345 @@ -1303,6 +1304,7 @@ static void ieee80211_setup_sdata(struct
2346 sdata->control_port_protocol = cpu_to_be16(ETH_P_PAE);
2347 sdata->control_port_no_encrypt = false;
2348 sdata->encrypt_headroom = IEEE80211_ENCRYPT_HEADROOM;
2349 + sdata->vif.bss_conf.idle = true;
2351 sdata->noack_map = 0;
2353 @@ -1721,6 +1723,8 @@ int ieee80211_if_add(struct ieee80211_lo
2355 ndev->features |= local->hw.netdev_features;
2357 + netdev_set_default_ethtool_ops(ndev, &ieee80211_ethtool_ops);
2359 ret = register_netdevice(ndev);
2362 --- a/net/wireless/core.c
2363 +++ b/net/wireless/core.c
2366 #include "debugfs.h"
2367 #include "wext-compat.h"
2368 -#include "ethtool.h"
2369 #include "rdev-ops.h"
2371 /* name for sysfs, %d is appended */
2372 @@ -940,8 +939,6 @@ static int cfg80211_netdev_notifier_call
2373 /* allow mac80211 to determine the timeout */
2374 wdev->ps_timeout = -1;
2376 - netdev_set_default_ethtool_ops(dev, &cfg80211_ethtool_ops);
2378 if ((wdev->iftype == NL80211_IFTYPE_STATION ||
2379 wdev->iftype == NL80211_IFTYPE_P2P_CLIENT ||
2380 wdev->iftype == NL80211_IFTYPE_ADHOC) && !wdev->use_4addr)
2381 --- a/net/wireless/ethtool.c
2382 +++ b/net/wireless/ethtool.c
2384 #include <linux/utsname.h>
2385 #include <net/cfg80211.h>
2387 -#include "ethtool.h"
2388 #include "rdev-ops.h"
2390 -static void cfg80211_get_drvinfo(struct net_device *dev,
2391 - struct ethtool_drvinfo *info)
2392 +void cfg80211_get_drvinfo(struct net_device *dev, struct ethtool_drvinfo *info)
2394 struct wireless_dev *wdev = dev->ieee80211_ptr;
2396 @@ -23,84 +21,4 @@ static void cfg80211_get_drvinfo(struct
2397 strlcpy(info->bus_info, dev_name(wiphy_dev(wdev->wiphy)),
2398 sizeof(info->bus_info));
2401 -static int cfg80211_get_regs_len(struct net_device *dev)
2403 - /* For now, return 0... */
2407 -static void cfg80211_get_regs(struct net_device *dev, struct ethtool_regs *regs,
2410 - struct wireless_dev *wdev = dev->ieee80211_ptr;
2412 - regs->version = wdev->wiphy->hw_version;
2416 -static void cfg80211_get_ringparam(struct net_device *dev,
2417 - struct ethtool_ringparam *rp)
2419 - struct wireless_dev *wdev = dev->ieee80211_ptr;
2420 - struct cfg80211_registered_device *rdev = wiphy_to_rdev(wdev->wiphy);
2422 - memset(rp, 0, sizeof(*rp));
2424 - if (rdev->ops->get_ringparam)
2425 - rdev_get_ringparam(rdev, &rp->tx_pending, &rp->tx_max_pending,
2426 - &rp->rx_pending, &rp->rx_max_pending);
2429 -static int cfg80211_set_ringparam(struct net_device *dev,
2430 - struct ethtool_ringparam *rp)
2432 - struct wireless_dev *wdev = dev->ieee80211_ptr;
2433 - struct cfg80211_registered_device *rdev = wiphy_to_rdev(wdev->wiphy);
2435 - if (rp->rx_mini_pending != 0 || rp->rx_jumbo_pending != 0)
2438 - if (rdev->ops->set_ringparam)
2439 - return rdev_set_ringparam(rdev, rp->tx_pending, rp->rx_pending);
2444 -static int cfg80211_get_sset_count(struct net_device *dev, int sset)
2446 - struct wireless_dev *wdev = dev->ieee80211_ptr;
2447 - struct cfg80211_registered_device *rdev = wiphy_to_rdev(wdev->wiphy);
2448 - if (rdev->ops->get_et_sset_count)
2449 - return rdev_get_et_sset_count(rdev, dev, sset);
2450 - return -EOPNOTSUPP;
2453 -static void cfg80211_get_stats(struct net_device *dev,
2454 - struct ethtool_stats *stats, u64 *data)
2456 - struct wireless_dev *wdev = dev->ieee80211_ptr;
2457 - struct cfg80211_registered_device *rdev = wiphy_to_rdev(wdev->wiphy);
2458 - if (rdev->ops->get_et_stats)
2459 - rdev_get_et_stats(rdev, dev, stats, data);
2462 -static void cfg80211_get_strings(struct net_device *dev, u32 sset, u8 *data)
2464 - struct wireless_dev *wdev = dev->ieee80211_ptr;
2465 - struct cfg80211_registered_device *rdev = wiphy_to_rdev(wdev->wiphy);
2466 - if (rdev->ops->get_et_strings)
2467 - rdev_get_et_strings(rdev, dev, sset, data);
2470 -const struct ethtool_ops cfg80211_ethtool_ops = {
2471 - .get_drvinfo = cfg80211_get_drvinfo,
2472 - .get_regs_len = cfg80211_get_regs_len,
2473 - .get_regs = cfg80211_get_regs,
2474 - .get_link = ethtool_op_get_link,
2475 - .get_ringparam = cfg80211_get_ringparam,
2476 - .set_ringparam = cfg80211_set_ringparam,
2477 - .get_strings = cfg80211_get_strings,
2478 - .get_ethtool_stats = cfg80211_get_stats,
2479 - .get_sset_count = cfg80211_get_sset_count,
2481 +EXPORT_SYMBOL(cfg80211_get_drvinfo);
2482 --- a/net/wireless/ethtool.h
2485 -#ifndef __CFG80211_ETHTOOL__
2486 -#define __CFG80211_ETHTOOL__
2488 -extern const struct ethtool_ops cfg80211_ethtool_ops;
2490 -#endif /* __CFG80211_ETHTOOL__ */
2491 --- a/net/wireless/rdev-ops.h
2492 +++ b/net/wireless/rdev-ops.h
2493 @@ -714,25 +714,6 @@ static inline int rdev_get_antenna(struc
2497 -static inline int rdev_set_ringparam(struct cfg80211_registered_device *rdev,
2501 - trace_rdev_set_ringparam(&rdev->wiphy, tx, rx);
2502 - ret = rdev->ops->set_ringparam(&rdev->wiphy, tx, rx);
2503 - trace_rdev_return_int(&rdev->wiphy, ret);
2507 -static inline void rdev_get_ringparam(struct cfg80211_registered_device *rdev,
2508 - u32 *tx, u32 *tx_max, u32 *rx,
2511 - trace_rdev_get_ringparam(&rdev->wiphy);
2512 - rdev->ops->get_ringparam(&rdev->wiphy, tx, tx_max, rx, rx_max);
2513 - trace_rdev_return_void_tx_rx(&rdev->wiphy, *tx, *tx_max, *rx, *rx_max);
2517 rdev_sched_scan_start(struct cfg80211_registered_device *rdev,
2518 struct net_device *dev,
2519 @@ -816,35 +797,6 @@ static inline int rdev_set_noack_map(str
2523 -rdev_get_et_sset_count(struct cfg80211_registered_device *rdev,
2524 - struct net_device *dev, int sset)
2527 - trace_rdev_get_et_sset_count(&rdev->wiphy, dev, sset);
2528 - ret = rdev->ops->get_et_sset_count(&rdev->wiphy, dev, sset);
2529 - trace_rdev_return_int(&rdev->wiphy, ret);
2533 -static inline void rdev_get_et_stats(struct cfg80211_registered_device *rdev,
2534 - struct net_device *dev,
2535 - struct ethtool_stats *stats, u64 *data)
2537 - trace_rdev_get_et_stats(&rdev->wiphy, dev);
2538 - rdev->ops->get_et_stats(&rdev->wiphy, dev, stats, data);
2539 - trace_rdev_return_void(&rdev->wiphy);
2542 -static inline void rdev_get_et_strings(struct cfg80211_registered_device *rdev,
2543 - struct net_device *dev, u32 sset,
2546 - trace_rdev_get_et_strings(&rdev->wiphy, dev, sset);
2547 - rdev->ops->get_et_strings(&rdev->wiphy, dev, sset, data);
2548 - trace_rdev_return_void(&rdev->wiphy);
2552 rdev_get_channel(struct cfg80211_registered_device *rdev,
2553 struct wireless_dev *wdev,
2554 struct cfg80211_chan_def *chandef)
2555 --- a/net/wireless/trace.h
2556 +++ b/net/wireless/trace.h
2557 @@ -298,11 +298,6 @@ DEFINE_EVENT(wiphy_only_evt, rdev_return
2561 -DEFINE_EVENT(wiphy_only_evt, rdev_get_ringparam,
2562 - TP_PROTO(struct wiphy *wiphy),
2566 DEFINE_EVENT(wiphy_only_evt, rdev_get_antenna,
2567 TP_PROTO(struct wiphy *wiphy),
2569 @@ -580,11 +575,6 @@ DEFINE_EVENT(wiphy_netdev_evt, rdev_stop
2570 TP_ARGS(wiphy, netdev)
2573 -DEFINE_EVENT(wiphy_netdev_evt, rdev_get_et_stats,
2574 - TP_PROTO(struct wiphy *wiphy, struct net_device *netdev),
2575 - TP_ARGS(wiphy, netdev)
2578 DEFINE_EVENT(wiphy_netdev_evt, rdev_sched_scan_stop,
2579 TP_PROTO(struct wiphy *wiphy, struct net_device *netdev),
2580 TP_ARGS(wiphy, netdev)
2581 @@ -1439,11 +1429,6 @@ DECLARE_EVENT_CLASS(tx_rx_evt,
2582 WIPHY_PR_ARG, __entry->tx, __entry->rx)
2585 -DEFINE_EVENT(tx_rx_evt, rdev_set_ringparam,
2586 - TP_PROTO(struct wiphy *wiphy, u32 tx, u32 rx),
2587 - TP_ARGS(wiphy, rx, tx)
2590 DEFINE_EVENT(tx_rx_evt, rdev_set_antenna,
2591 TP_PROTO(struct wiphy *wiphy, u32 tx, u32 rx),
2592 TP_ARGS(wiphy, rx, tx)
2593 @@ -1725,40 +1710,6 @@ TRACE_EVENT(rdev_set_noack_map,
2594 WIPHY_PR_ARG, NETDEV_PR_ARG, __entry->noack_map)
2597 -TRACE_EVENT(rdev_get_et_sset_count,
2598 - TP_PROTO(struct wiphy *wiphy, struct net_device *netdev, int sset),
2599 - TP_ARGS(wiphy, netdev, sset),
2603 - __field(int, sset)
2608 - __entry->sset = sset;
2610 - TP_printk(WIPHY_PR_FMT ", " NETDEV_PR_FMT ", sset: %d",
2611 - WIPHY_PR_ARG, NETDEV_PR_ARG, __entry->sset)
2614 -TRACE_EVENT(rdev_get_et_strings,
2615 - TP_PROTO(struct wiphy *wiphy, struct net_device *netdev, u32 sset),
2616 - TP_ARGS(wiphy, netdev, sset),
2620 - __field(u32, sset)
2625 - __entry->sset = sset;
2627 - TP_printk(WIPHY_PR_FMT ", " NETDEV_PR_FMT ", sset: %u",
2628 - WIPHY_PR_ARG, NETDEV_PR_ARG, __entry->sset)
2631 DEFINE_EVENT(wiphy_wdev_evt, rdev_get_channel,
2632 TP_PROTO(struct wiphy *wiphy, struct wireless_dev *wdev),
2633 TP_ARGS(wiphy, wdev)
2635 +++ b/net/mac80211/ethtool.c
2638 + * mac80211 ethtool hooks for cfg80211
2640 + * Copied from cfg.c - originally
2641 + * Copyright 2006-2010 Johannes Berg <johannes@sipsolutions.net>
2642 + * Copyright 2014 Intel Corporation (Author: Johannes Berg)
2644 + * This file is GPLv2 as found in COPYING.
2646 +#include <linux/types.h>
2647 +#include <net/cfg80211.h>
2648 +#include "ieee80211_i.h"
2649 +#include "sta_info.h"
2650 +#include "driver-ops.h"
2652 +static int ieee80211_set_ringparam(struct net_device *dev,
2653 + struct ethtool_ringparam *rp)
2655 + struct ieee80211_local *local = wiphy_priv(dev->ieee80211_ptr->wiphy);
2657 + if (rp->rx_mini_pending != 0 || rp->rx_jumbo_pending != 0)
2660 + return drv_set_ringparam(local, rp->tx_pending, rp->rx_pending);
2663 +static void ieee80211_get_ringparam(struct net_device *dev,
2664 + struct ethtool_ringparam *rp)
2666 + struct ieee80211_local *local = wiphy_priv(dev->ieee80211_ptr->wiphy);
2668 + memset(rp, 0, sizeof(*rp));
2670 + drv_get_ringparam(local, &rp->tx_pending, &rp->tx_max_pending,
2671 + &rp->rx_pending, &rp->rx_max_pending);
2674 +static const char ieee80211_gstrings_sta_stats[][ETH_GSTRING_LEN] = {
2675 + "rx_packets", "rx_bytes",
2676 + "rx_duplicates", "rx_fragments", "rx_dropped",
2677 + "tx_packets", "tx_bytes", "tx_fragments",
2678 + "tx_filtered", "tx_retry_failed", "tx_retries",
2679 + "beacon_loss", "sta_state", "txrate", "rxrate", "signal",
2680 + "channel", "noise", "ch_time", "ch_time_busy",
2681 + "ch_time_ext_busy", "ch_time_rx", "ch_time_tx"
2683 +#define STA_STATS_LEN ARRAY_SIZE(ieee80211_gstrings_sta_stats)
2685 +static int ieee80211_get_sset_count(struct net_device *dev, int sset)
2687 + struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev);
2690 + if (sset == ETH_SS_STATS)
2691 + rv += STA_STATS_LEN;
2693 + rv += drv_get_et_sset_count(sdata, sset);
2696 + return -EOPNOTSUPP;
2700 +static void ieee80211_get_stats(struct net_device *dev,
2701 + struct ethtool_stats *stats,
2704 + struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev);
2705 + struct ieee80211_chanctx_conf *chanctx_conf;
2706 + struct ieee80211_channel *channel;
2707 + struct sta_info *sta;
2708 + struct ieee80211_local *local = sdata->local;
2709 + struct station_info sinfo;
2710 + struct survey_info survey;
2712 +#define STA_STATS_SURVEY_LEN 7
2714 + memset(data, 0, sizeof(u64) * STA_STATS_LEN);
2716 +#define ADD_STA_STATS(sta) \
2718 + data[i++] += sta->rx_packets; \
2719 + data[i++] += sta->rx_bytes; \
2720 + data[i++] += sta->num_duplicates; \
2721 + data[i++] += sta->rx_fragments; \
2722 + data[i++] += sta->rx_dropped; \
2724 + data[i++] += sinfo.tx_packets; \
2725 + data[i++] += sinfo.tx_bytes; \
2726 + data[i++] += sta->tx_fragments; \
2727 + data[i++] += sta->tx_filtered_count; \
2728 + data[i++] += sta->tx_retry_failed; \
2729 + data[i++] += sta->tx_retry_count; \
2730 + data[i++] += sta->beacon_loss_count; \
2733 + /* For Managed stations, find the single station based on BSSID
2734 + * and use that. For interface types, iterate through all available
2735 + * stations and add stats for any station that is assigned to this
2739 + mutex_lock(&local->sta_mtx);
2741 + if (sdata->vif.type == NL80211_IFTYPE_STATION) {
2742 + sta = sta_info_get_bss(sdata, sdata->u.mgd.bssid);
2744 + if (!(sta && !WARN_ON(sta->sdata->dev != dev)))
2748 + sta_set_sinfo(sta, &sinfo);
2751 + ADD_STA_STATS(sta);
2753 + data[i++] = sta->sta_state;
2756 + if (sinfo.filled & STATION_INFO_TX_BITRATE)
2757 + data[i] = 100000 *
2758 + cfg80211_calculate_bitrate(&sinfo.txrate);
2760 + if (sinfo.filled & STATION_INFO_RX_BITRATE)
2761 + data[i] = 100000 *
2762 + cfg80211_calculate_bitrate(&sinfo.rxrate);
2765 + if (sinfo.filled & STATION_INFO_SIGNAL_AVG)
2766 + data[i] = (u8)sinfo.signal_avg;
2769 + list_for_each_entry(sta, &local->sta_list, list) {
2770 + /* Make sure this station belongs to the proper dev */
2771 + if (sta->sdata->dev != dev)
2775 + sta_set_sinfo(sta, &sinfo);
2777 + ADD_STA_STATS(sta);
2782 + i = STA_STATS_LEN - STA_STATS_SURVEY_LEN;
2783 + /* Get survey stats for current channel */
2784 + survey.filled = 0;
2787 + chanctx_conf = rcu_dereference(sdata->vif.chanctx_conf);
2789 + channel = chanctx_conf->def.chan;
2792 + rcu_read_unlock();
2797 + survey.filled = 0;
2798 + if (drv_get_survey(local, q, &survey) != 0) {
2799 + survey.filled = 0;
2803 + } while (channel != survey.channel);
2806 + if (survey.filled)
2807 + data[i++] = survey.channel->center_freq;
2810 + if (survey.filled & SURVEY_INFO_NOISE_DBM)
2811 + data[i++] = (u8)survey.noise;
2814 + if (survey.filled & SURVEY_INFO_CHANNEL_TIME)
2815 + data[i++] = survey.channel_time;
2818 + if (survey.filled & SURVEY_INFO_CHANNEL_TIME_BUSY)
2819 + data[i++] = survey.channel_time_busy;
2822 + if (survey.filled & SURVEY_INFO_CHANNEL_TIME_EXT_BUSY)
2823 + data[i++] = survey.channel_time_ext_busy;
2826 + if (survey.filled & SURVEY_INFO_CHANNEL_TIME_RX)
2827 + data[i++] = survey.channel_time_rx;
2830 + if (survey.filled & SURVEY_INFO_CHANNEL_TIME_TX)
2831 + data[i++] = survey.channel_time_tx;
2835 + mutex_unlock(&local->sta_mtx);
2837 + if (WARN_ON(i != STA_STATS_LEN))
2840 + drv_get_et_stats(sdata, stats, &(data[STA_STATS_LEN]));
2843 +static void ieee80211_get_strings(struct net_device *dev, u32 sset, u8 *data)
2845 + struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev);
2846 + int sz_sta_stats = 0;
2848 + if (sset == ETH_SS_STATS) {
2849 + sz_sta_stats = sizeof(ieee80211_gstrings_sta_stats);
2850 + memcpy(data, ieee80211_gstrings_sta_stats, sz_sta_stats);
2852 + drv_get_et_strings(sdata, sset, &(data[sz_sta_stats]));
2855 +static int ieee80211_get_regs_len(struct net_device *dev)
2860 +static void ieee80211_get_regs(struct net_device *dev,
2861 + struct ethtool_regs *regs,
2864 + struct wireless_dev *wdev = dev->ieee80211_ptr;
2866 + regs->version = wdev->wiphy->hw_version;
2870 +const struct ethtool_ops ieee80211_ethtool_ops = {
2871 + .get_drvinfo = cfg80211_get_drvinfo,
2872 + .get_regs_len = ieee80211_get_regs_len,
2873 + .get_regs = ieee80211_get_regs,
2874 + .get_link = ethtool_op_get_link,
2875 + .get_ringparam = ieee80211_get_ringparam,
2876 + .set_ringparam = ieee80211_set_ringparam,
2877 + .get_strings = ieee80211_get_strings,
2878 + .get_ethtool_stats = ieee80211_get_stats,
2879 + .get_sset_count = ieee80211_get_sset_count,
2881 --- a/net/mac80211/ibss.c
2882 +++ b/net/mac80211/ibss.c
2883 @@ -143,7 +143,7 @@ ieee80211_ibss_build_presp(struct ieee80
2884 *pos++ = csa_settings->block_tx ? 1 : 0;
2885 *pos++ = ieee80211_frequency_to_channel(
2886 csa_settings->chandef.chan->center_freq);
2887 - sdata->csa_counter_offset_beacon[0] = (pos - presp->head);
2888 + presp->csa_counter_offsets[0] = (pos - presp->head);
2889 *pos++ = csa_settings->count;
2892 @@ -1677,6 +1677,7 @@ int ieee80211_ibss_join(struct ieee80211
2893 sdata->u.ibss.control_port = params->control_port;
2894 sdata->u.ibss.userspace_handles_dfs = params->userspace_handles_dfs;
2895 sdata->u.ibss.basic_rates = params->basic_rates;
2896 + sdata->u.ibss.last_scan_completed = jiffies;
2898 /* fix basic_rates if channel does not support these rates */
2899 rate_flags = ieee80211_chandef_rate_flags(¶ms->chandef);
2900 --- a/net/mac80211/mesh.c
2901 +++ b/net/mac80211/mesh.c
2902 @@ -679,7 +679,7 @@ ieee80211_mesh_build_beacon(struct ieee8
2904 *pos++ = ieee80211_frequency_to_channel(
2905 csa->settings.chandef.chan->center_freq);
2906 - sdata->csa_counter_offset_beacon[0] = hdr_len + 6;
2907 + bcn->csa_counter_offsets[0] = hdr_len + 6;
2908 *pos++ = csa->settings.count;
2909 *pos++ = WLAN_EID_CHAN_SWITCH_PARAM;
2911 --- a/net/wireless/genregdb.awk
2912 +++ b/net/wireless/genregdb.awk
2913 @@ -65,17 +65,7 @@ function parse_reg_rule()
2916 if (units == "mW") {
2917 - if (power == 100) {
2919 - } else if (power == 200) {
2921 - } else if (power == 500) {
2923 - } else if (power == 1000) {
2926 - print "Unknown power value in database!"
2928 + power = 10 * log(power)/log(10)
2932 @@ -114,7 +104,7 @@ function parse_reg_rule()
2936 - printf "\t\tREG_RULE_EXT(%d, %d, %d, %d, %d, %d, %s),\n", start, end, bw, gain, power, dfs_cac, flags
2937 + printf "\t\tREG_RULE_EXT(%d, %d, %d, %d, %.0f, %d, %s),\n", start, end, bw, gain, power, dfs_cac, flags
2941 --- a/net/mac80211/debugfs_netdev.c
2942 +++ b/net/mac80211/debugfs_netdev.c
2943 @@ -34,8 +34,7 @@ static ssize_t ieee80211_if_read(
2944 ssize_t ret = -EINVAL;
2946 read_lock(&dev_base_lock);
2947 - if (sdata->dev->reg_state == NETREG_REGISTERED)
2948 - ret = (*format)(sdata, buf, sizeof(buf));
2949 + ret = (*format)(sdata, buf, sizeof(buf));
2950 read_unlock(&dev_base_lock);
2953 @@ -62,8 +61,7 @@ static ssize_t ieee80211_if_write(
2957 - if (sdata->dev->reg_state == NETREG_REGISTERED)
2958 - ret = (*write)(sdata, buf, count);
2959 + ret = (*write)(sdata, buf, count);
2963 --- a/drivers/net/wireless/b43/xmit.c
2964 +++ b/drivers/net/wireless/b43/xmit.c
2965 @@ -811,9 +811,13 @@ void b43_rx(struct b43_wldev *dev, struc
2968 status.band = IEEE80211_BAND_2GHZ;
2969 - /* chanid is the radio channel cookie value as used
2970 - * to tune the radio. */
2971 - status.freq = chanid + 2400;
2972 + /* Somewhere between 478.104 and 508.1084 firmware for G-PHY
2973 + * has been modified to be compatible with N-PHY and others.
2975 + if (dev->fw.rev >= 508)
2976 + status.freq = ieee80211_channel_to_frequency(chanid, status.band);
2978 + status.freq = chanid + 2400;
2981 case B43_PHYTYPE_LP:
2982 --- a/drivers/net/wireless/b43/main.c
2983 +++ b/drivers/net/wireless/b43/main.c
2984 @@ -5216,6 +5216,7 @@ static int b43_wireless_core_attach(stru
2985 /* We don't support 5 GHz on some PHYs yet */
2986 switch (dev->phy.type) {
2988 + case B43_PHYTYPE_G:
2990 case B43_PHYTYPE_LP:
2991 case B43_PHYTYPE_HT:
2992 --- a/net/wireless/reg.c
2993 +++ b/net/wireless/reg.c
2994 @@ -935,7 +935,7 @@ freq_reg_info_regd(struct wiphy *wiphy,
2995 if (!band_rule_found)
2996 band_rule_found = freq_in_rule_band(fr, center_freq);
2998 - bw_fits = reg_does_bw_fit(fr, center_freq, MHZ_TO_KHZ(5));
2999 + bw_fits = reg_does_bw_fit(fr, center_freq, MHZ_TO_KHZ(20));
3001 if (band_rule_found && bw_fits)
3003 @@ -1019,10 +1019,10 @@ static void chan_reg_rule_print_dbg(cons
3007 -/* Find an ieee80211_reg_rule such that a 5MHz channel with frequency
3008 - * chan->center_freq fits there.
3009 - * If there is no such reg_rule, disable the channel, otherwise set the
3010 - * flags corresponding to the bandwidths allowed in the particular reg_rule
3012 + * Note that right now we assume the desired channel bandwidth
3013 + * is always 20 MHz for each individual channel (HT40 uses 20 MHz
3014 + * per channel, the primary and the extension channel).
3016 static void handle_channel(struct wiphy *wiphy,
3017 enum nl80211_reg_initiator initiator,
3018 @@ -1083,12 +1083,8 @@ static void handle_channel(struct wiphy
3019 if (reg_rule->flags & NL80211_RRF_AUTO_BW)
3020 max_bandwidth_khz = reg_get_max_bandwidth(regd, reg_rule);
3022 - if (max_bandwidth_khz < MHZ_TO_KHZ(10))
3023 - bw_flags = IEEE80211_CHAN_NO_10MHZ;
3024 - if (max_bandwidth_khz < MHZ_TO_KHZ(20))
3025 - bw_flags |= IEEE80211_CHAN_NO_20MHZ;
3026 if (max_bandwidth_khz < MHZ_TO_KHZ(40))
3027 - bw_flags |= IEEE80211_CHAN_NO_HT40;
3028 + bw_flags = IEEE80211_CHAN_NO_HT40;
3029 if (max_bandwidth_khz < MHZ_TO_KHZ(80))
3030 bw_flags |= IEEE80211_CHAN_NO_80MHZ;
3031 if (max_bandwidth_khz < MHZ_TO_KHZ(160))
3032 @@ -1522,12 +1518,8 @@ static void handle_channel_custom(struct
3033 if (reg_rule->flags & NL80211_RRF_AUTO_BW)
3034 max_bandwidth_khz = reg_get_max_bandwidth(regd, reg_rule);
3036 - if (max_bandwidth_khz < MHZ_TO_KHZ(10))
3037 - bw_flags = IEEE80211_CHAN_NO_10MHZ;
3038 - if (max_bandwidth_khz < MHZ_TO_KHZ(20))
3039 - bw_flags |= IEEE80211_CHAN_NO_20MHZ;
3040 if (max_bandwidth_khz < MHZ_TO_KHZ(40))
3041 - bw_flags |= IEEE80211_CHAN_NO_HT40;
3042 + bw_flags = IEEE80211_CHAN_NO_HT40;
3043 if (max_bandwidth_khz < MHZ_TO_KHZ(80))
3044 bw_flags |= IEEE80211_CHAN_NO_80MHZ;
3045 if (max_bandwidth_khz < MHZ_TO_KHZ(160))
3046 --- a/drivers/net/wireless/ath/ath9k/ath9k.h
3047 +++ b/drivers/net/wireless/ath/ath9k/ath9k.h
3048 @@ -185,7 +185,8 @@ struct ath_atx_ac {
3050 struct ath_frame_info {
3055 enum ath9k_key_type keytype;
3058 --- a/drivers/net/wireless/ath/ath9k/xmit.c
3059 +++ b/drivers/net/wireless/ath/ath9k/xmit.c
3060 @@ -147,15 +147,13 @@ static void ath_set_rates(struct ieee802
3061 static void ath_txq_skb_done(struct ath_softc *sc, struct ath_txq *txq,
3062 struct sk_buff *skb)
3066 - q = skb_get_queue_mapping(skb);
3067 - if (txq == sc->tx.uapsdq)
3068 - txq = sc->tx.txq_map[q];
3069 + struct ath_frame_info *fi = get_frame_info(skb);
3072 - if (txq != sc->tx.txq_map[q])
3076 + txq = sc->tx.txq_map[q];
3077 if (WARN_ON(--txq->pending_frames < 0))
3078 txq->pending_frames = 0;
3080 @@ -887,6 +885,15 @@ ath_tx_get_tid_subframe(struct ath_softc
3082 tx_info = IEEE80211_SKB_CB(skb);
3083 tx_info->flags &= ~IEEE80211_TX_CTL_CLEAR_PS_FILT;
3086 + * No aggregation session is running, but there may be frames
3087 + * from a previous session or a failed attempt in the queue.
3088 + * Send them out as normal data frames
3091 + tx_info->flags &= ~IEEE80211_TX_CTL_AMPDU;
3093 if (!(tx_info->flags & IEEE80211_TX_CTL_AMPDU)) {
3094 bf->bf_state.bf_type = 0;
3096 @@ -1999,6 +2006,7 @@ static void setup_frame_info(struct ieee
3097 an = (struct ath_node *) sta->drv_priv;
3099 memset(fi, 0, sizeof(*fi));
3102 fi->keyix = hw_key->hw_key_idx;
3103 else if (an && ieee80211_is_data(hdr->frame_control) && an->ps_key > 0)
3104 @@ -2150,6 +2158,7 @@ int ath_tx_start(struct ieee80211_hw *hw
3105 struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
3106 struct ieee80211_sta *sta = txctl->sta;
3107 struct ieee80211_vif *vif = info->control.vif;
3108 + struct ath_frame_info *fi = get_frame_info(skb);
3109 struct ath_softc *sc = hw->priv;
3110 struct ath_txq *txq = txctl->txq;
3111 struct ath_atx_tid *tid = NULL;
3112 @@ -2170,11 +2179,13 @@ int ath_tx_start(struct ieee80211_hw *hw
3113 q = skb_get_queue_mapping(skb);
3115 ath_txq_lock(sc, txq);
3116 - if (txq == sc->tx.txq_map[q] &&
3117 - ++txq->pending_frames > sc->tx.txq_max_pending[q] &&
3119 - ieee80211_stop_queue(sc->hw, q);
3120 - txq->stopped = true;
3121 + if (txq == sc->tx.txq_map[q]) {
3123 + if (++txq->pending_frames > sc->tx.txq_max_pending[q] &&
3125 + ieee80211_stop_queue(sc->hw, q);
3126 + txq->stopped = true;
3130 if (txctl->an && ieee80211_is_data_present(hdr->frame_control))
3131 --- a/net/mac80211/chan.c
3132 +++ b/net/mac80211/chan.c
3133 @@ -521,6 +521,8 @@ static void ieee80211_recalc_chanctx_cha
3135 if (rcu_access_pointer(sdata->vif.chanctx_conf) != conf)
3137 + if (sdata->vif.type == NL80211_IFTYPE_AP_VLAN)
3141 compat = &sdata->vif.bss_conf.chandef;
3142 --- a/drivers/net/wireless/ath/ath9k/ar5008_phy.c
3143 +++ b/drivers/net/wireless/ath/ath9k/ar5008_phy.c
3144 @@ -1004,9 +1004,11 @@ static bool ar5008_hw_ani_control_new(st
3145 case ATH9K_ANI_FIRSTEP_LEVEL:{
3149 + value = level * 2;
3150 REG_RMW_FIELD(ah, AR_PHY_FIND_SIG,
3151 AR_PHY_FIND_SIG_FIRSTEP, value);
3152 + REG_RMW_FIELD(ah, AR_PHY_FIND_SIG_LOW,
3153 + AR_PHY_FIND_SIG_FIRSTEP_LOW, value);
3155 if (level != aniState->firstepLevel) {
3156 ath_dbg(common, ANI,
3157 @@ -1040,9 +1042,8 @@ static bool ar5008_hw_ani_control_new(st
3158 REG_RMW_FIELD(ah, AR_PHY_TIMING5,
3159 AR_PHY_TIMING5_CYCPWR_THR1, value);
3161 - if (IS_CHAN_HT40(ah->curchan))
3162 - REG_RMW_FIELD(ah, AR_PHY_EXT_CCA,
3163 - AR_PHY_EXT_TIMING5_CYCPWR_THR1, value);
3164 + REG_RMW_FIELD(ah, AR_PHY_EXT_CCA,
3165 + AR_PHY_EXT_TIMING5_CYCPWR_THR1, value - 1);
3167 if (level != aniState->spurImmunityLevel) {
3168 ath_dbg(common, ANI,