1 commit 77980bee5f1f743b46f8749185aca28b8ec69741
2 Author: Johannes Berg <johannes.berg@intel.com>
3 Date: Mon Nov 3 14:29:09 2014 +0100
5 mac80211: fix use-after-free in defragmentation
7 Upon receiving the last fragment, all but the first fragment
8 are freed, but the multicast check for statistics at the end
9 of the function refers to the current skb (the last fragment)
10 causing a use-after-free bug.
12 Since multicast frames cannot be fragmented and we check for
13 this early in the function, just modify that check to also
14 do the accounting to fix the issue.
16 Cc: stable@vger.kernel.org
17 Reported-by: Yosef Khyal <yosefx.khyal@intel.com>
18 Signed-off-by: Johannes Berg <johannes.berg@intel.com>
20 commit e252be2d718dada0abd72208a44b9f1b63919883
21 Author: Hauke Mehrtens <hauke@hauke-m.de>
22 Date: Wed Nov 5 23:31:07 2014 +0100
24 b43: fix NULL pointer dereference in b43_phy_copy()
26 phy_read and phy_write are not set for every phy any more sine this:
27 commit d342b95dd735014a590f9051b1ba227eb54ca8f6
28 Author: Rafał Miłecki <zajec5@gmail.com>
29 Date: Thu Jul 31 21:59:43 2014 +0200
31 b43: don't duplicate common PHY read/write ops
33 b43_phy_copy() accesses phy_read and phy_write directly and will fail
34 with some phys. This patch fixes the regression by using the
35 b43_phy_read() and b43_phy_write() functions which should be used for
36 read and write access.
38 This should fix this bug report:
39 https://bugzilla.kernel.org/show_bug.cgi?id=87731
41 Reported-by: Volker Kempter <v.kempter@pe.tu-clausthal.de>
42 Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
44 commit ddf93ad61cb009ed05ff2547923fb269a3604408
45 Author: Miaoqing Pan <miaoqing@qca.qualcomm.com>
46 Date: Thu Nov 6 10:52:23 2014 +0530
48 ath9k: Fix RTC_DERIVED_CLK usage
50 Based on the reference clock, which could be 25MHz or 40MHz,
51 AR_RTC_DERIVED_CLK is programmed differently for AR9340 and AR9550.
52 But, when a chip reset is done, processing the initvals
53 sets the register back to the default value.
55 Fix this by moving the code in ath9k_hw_init_pll() to
56 ar9003_hw_override_ini(). Also, do this override for AR9531.
58 Cc: stable@vger.kernel.org
59 Signed-off-by: Miaoqing Pan <miaoqing@qca.qualcomm.com>
60 Signed-off-by: Sujith Manoharan <c_manoha@qca.qualcomm.com>
62 commit 536b05e91ac2715942f792184c26beb43dbaa522
63 Author: Felix Fietkau <nbd@openwrt.org>
64 Date: Mon Oct 27 11:50:28 2014 +0100
66 mac80211: flush keys for AP mode on ieee80211_do_stop
68 Userspace can add keys to an AP mode interface before start_ap has been
69 called. If there have been no calls to start_ap/stop_ap in the mean
70 time, the keys will still be around when the interface is brought down.
72 Signed-off-by: Felix Fietkau <nbd@openwrt.org>
74 commit c35074725eb19f353beb5f71266f9e985e46f583
75 Author: Felix Fietkau <nbd@openwrt.org>
76 Date: Wed Oct 22 18:16:14 2014 +0200
78 ath9k_common: always update value in ath9k_cmn_update_txpow
80 In some cases the limit may be the same as reg->power_limit, but the
81 actual value that the hardware uses is not up to date. In that case, a
82 wrong value for current tx power is tracked internally.
83 Fix this by unconditionally updating it.
85 Signed-off-by: Felix Fietkau <nbd@openwrt.org>
87 commit 11f17631d9bf2a9e910dac7d09ba4581f5693831
88 Author: Felix Fietkau <nbd@openwrt.org>
89 Date: Tue Sep 9 09:48:30 2014 +0200
91 ath9k_hw: fix PLL clock initialization for newer SoC
93 On AR934x and newer SoC devices, the layout of the AR_RTC_PLL_CONTROL
94 register changed. This currently breaks at least 5/10 MHz operation.
95 AR933x uses the old layout.
97 It might also have been causing other stability issues because of the
98 different location of the PLL_BYPASS bit which needs to be set during
99 PLL clock initialization.
101 This patch also removes more instances of hardcoded register values in
102 favor of properly computed ones with the PLL_BYPASS bit added.
104 Reported-by: Lorenzo Bianconi <lorenzo.bianconi83@gmail.com>
105 Signed-off-by: Felix Fietkau <nbd@openwrt.org>
107 commit 0fecedddd4a0945873db1bd230ec6a168b3cc4fe
108 Author: Felix Fietkau <nbd@openwrt.org>
109 Date: Mon Sep 8 18:35:08 2014 +0200
111 ath9k_hw: reduce ANI spur immunity setting on HT40 extension channel
113 The cycpwr_thr1 value needs to be lower on the extension channel than on
114 the control channel, similar to how the register settings are programmed
117 Also drop the unnecessary check for HT40 - this register can always be
118 written. This patch has been reported to improve HT40 stability and
119 throughput in some environments.
121 Signed-off-by: Felix Fietkau <nbd@openwrt.org>
123 commit 30d7434ccb853b96de698a040888fa4dacd0cc19
124 Author: Felix Fietkau <nbd@openwrt.org>
125 Date: Mon Sep 8 18:31:26 2014 +0200
127 Revert "ath9k_hw: reduce ANI firstep range for older chips"
129 This reverts commit 09efc56345be4146ab9fc87a55c837ed5d6ea1ab
131 I've received reports that this change is decreasing throughput in some
132 rare conditions on an AR9280 based device
134 Cc: stable@vger.kernel.org
135 Signed-off-by: Felix Fietkau <nbd@openwrt.org>
137 commit 15ed54948f508ad1baad79c30050e2d29a21696d
138 Author: Felix Fietkau <nbd@openwrt.org>
139 Date: Fri Jul 25 16:18:03 2014 +0200
141 mac80211: fix smps mode check for AP_VLAN
143 In ieee80211_sta_ps_deliver_wakeup, sdata->smps_mode is checked. This is
144 initialized only for the base AP interface, not the individual VLANs.
146 Signed-off-by: Felix Fietkau <nbd@openwrt.org>
148 commit bc74ad816bba291359ae46301173ea744bdda9d2
149 Author: Felix Fietkau <nbd@openwrt.org>
150 Date: Fri Jul 25 16:15:44 2014 +0200
152 mac80211: ignore AP_VLAN in ieee80211_recalc_chanctx_chantype
154 When bringing down the AP, a WARN_ON is hit because the bss config chandef
156 Since AP_VLAN channel settings do not matter for anything chanctx related
157 (always inherits the settings from the AP interface), let's just ignore
160 Signed-off-by: Felix Fietkau <nbd@openwrt.org>
162 commit ff354dbdd743e5fe186df8cd17982db19f78231a
163 Author: Felix Fietkau <nbd@openwrt.org>
164 Date: Wed Jul 23 15:33:26 2014 +0200
166 ath9k: fix aggregation session lockup
168 If an aggregation session fails, frames still end up in the driver queue
169 with IEEE80211_TX_CTL_AMPDU set.
170 This causes tx for the affected station/tid to stall, since
171 ath_tx_get_tid_subframe returning packets to send.
173 Fix this by clearing IEEE80211_TX_CTL_AMPDU as long as no aggregation
176 Cc: stable@vger.kernel.org
177 Reported-by: Antonio Quartulli <antonio@open-mesh.com>
178 Signed-off-by: Felix Fietkau <nbd@openwrt.org>
180 commit 38695a6e5a940e6a524523b88a33916b016fb2a1
181 Author: Felix Fietkau <nbd@openwrt.org>
182 Date: Fri Jul 11 12:06:18 2014 +0200
184 mac80211: fix crash on getting sta info with uninitialized rate control
186 If the expected throughput is queried before rate control has been
187 initialized, the minstrel op for it will crash while trying to access
189 Check for WLAN_STA_RATE_CONTROL before attempting to use the rate
192 Reported-by: Jean-Pierre Tosoni <jp.tosoni@acksys.fr>
193 Signed-off-by: Felix Fietkau <nbd@openwrt.org>
195 commit c0ee7fa4c0da824ccccc172bf175fb1f86540921
196 Author: Felix Fietkau <nbd@openwrt.org>
197 Date: Wed Jul 16 18:00:31 2014 +0200
199 ath9k: fix pending tx frames accounting
201 Packets originally buffered for the regular hardware tx queues can end
202 up being transmitted through the U-APSD queue (via PS-Poll or U-APSD).
203 When packets are dropped due to retransmit failures, the pending frames
204 counter is not always updated properly.
205 Fix this by keeping track of the queue that a frame was accounted for in
206 the ath_frame_info struct, and using that on completion to decide
207 whether the counter should be updated.
208 This fixes some spurious transmit queue hangs.
210 Cc: stable@vger.kernel.org
211 Signed-off-by: Felix Fietkau <nbd@openwrt.org>
213 commit edcdf0989410a05a6a4b8438df4010447eaa7d9a
214 Author: Felix Fietkau <nbd@openwrt.org>
215 Date: Sun Jun 22 13:36:20 2014 +0200
217 Revert "cfg80211: Use 5MHz bandwidth by default when checking usable channels"
219 It enables channels that are not supposed to be enabled according to the
222 This reverts commit 8eca1fb692cc9557f386eddce75c300a3855d11a.
224 commit 6e7341074823d2a45b81f2742cbf75f1da790031
225 Author: Rafał Miłecki <zajec5@gmail.com>
226 Date: Sat May 31 19:40:45 2014 +0200
228 b43: disable 5 GHz on G-PHY
230 This fixes regression introduced by adding some G-PHY devices to the
231 list of dual band devices. There is simply no support for 5 GHz on
232 G-PHY devices in b43. It results in:
233 WARNING: CPU: 0 PID: 79 at drivers/net/wireless/b43/phy_g.c:75 b43_gphy_channel_switch+0x125/0x130 [b43]()
234 b43-phy1 ERROR: PHY init: Channel switch to default failed
236 Regression was introduced by the following commit:
238 commit 773cfc508f4d64c14547ff8751b5cbd473124364
239 Author: Rafał Miłecki <zajec5@gmail.com>
240 Date: Mon May 19 23:18:55 2014 +0200
242 b43: add more devices to the bands database
244 Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
245 Signed-off-by: John W. Linville <linville@tuxdriver.com>
247 commit 1186edbef91f15722e5bdf56326ce0abc2935ce7
248 Author: Stanislaw Gruszka <sgruszka@redhat.com>
249 Date: Tue Jun 10 12:51:06 2014 +0200
251 rt2x00: disable TKIP on USB
253 On USB we can not get atomically TKIP key. We have to disable support
254 for TKIP acceleration on USB hardware to avoid bug as showed bellow.
256 [ 860.827243] BUG: scheduling while atomic: hostapd/3397/0x00000002
258 [ 860.827280] Call Trace:
259 [ 860.827282] [<ffffffff81682ea6>] dump_stack+0x4d/0x66
260 [ 860.827284] [<ffffffff8167eb9b>] __schedule_bug+0x47/0x55
261 [ 860.827285] [<ffffffff81685bb3>] __schedule+0x733/0x7b0
262 [ 860.827287] [<ffffffff81685c59>] schedule+0x29/0x70
263 [ 860.827289] [<ffffffff81684f8a>] schedule_timeout+0x15a/0x2b0
264 [ 860.827291] [<ffffffff8105ac50>] ? ftrace_raw_event_tick_stop+0xc0/0xc0
265 [ 860.827294] [<ffffffff810c13c2>] ? __module_text_address+0x12/0x70
266 [ 860.827296] [<ffffffff81686823>] wait_for_completion_timeout+0xb3/0x140
267 [ 860.827298] [<ffffffff81080fc0>] ? wake_up_state+0x20/0x20
268 [ 860.827301] [<ffffffff814d5b3d>] usb_start_wait_urb+0x7d/0x150
269 [ 860.827303] [<ffffffff814d5cd5>] usb_control_msg+0xc5/0x110
270 [ 860.827305] [<ffffffffa02fb0c6>] rt2x00usb_vendor_request+0xc6/0x160 [rt2x00usb]
271 [ 860.827307] [<ffffffffa02fb215>] rt2x00usb_vendor_req_buff_lock+0x75/0x150 [rt2x00usb]
272 [ 860.827309] [<ffffffffa02fb393>] rt2x00usb_vendor_request_buff+0xa3/0xe0 [rt2x00usb]
273 [ 860.827311] [<ffffffffa023d1a3>] rt2x00usb_register_multiread+0x33/0x40 [rt2800usb]
274 [ 860.827314] [<ffffffffa05805f9>] rt2800_get_tkip_seq+0x39/0x50 [rt2800lib]
275 [ 860.827321] [<ffffffffa0480f88>] ieee80211_get_key+0x218/0x2a0 [mac80211]
276 [ 860.827322] [<ffffffff815cc68c>] ? __nlmsg_put+0x6c/0x80
277 [ 860.827329] [<ffffffffa051b02e>] nl80211_get_key+0x22e/0x360 [cfg80211]
279 Cc: stable@vger.kernel.org
280 Reported-and-tested-by: Peter Wu <lekensteyn@gmail.com>
281 Reported-and-tested-by: Pontus Fuchs <pontus.fuchs@gmail.com>
282 Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com>
283 Signed-off-by: John W. Linville <linville@tuxdriver.com>
285 commit 5f313a15da92dda80ac4c9a137bc42d7d0b49adf
286 Author: Rafał Miłecki <zajec5@gmail.com>
287 Date: Thu Jun 12 09:28:38 2014 +0200
289 b43: fix frequency reported on G-PHY with /new/ firmware
291 commit d3a58df87a2e4c2301ac843604202d290a48440b
292 Author: Avraham Stern <avraham.stern@intel.com>
293 Date: Thu May 22 12:17:47 2014 +0300
295 mac80211: set new interfaces as idle upon init
297 Mark new interfaces as idle to allow operations that require that
298 interfaces are idle to take place. Interface types that are always
299 not idle (like AP interfaces) will be set as not idle when they are
300 assigned a channel context.
302 Signed-off-by: Avraham Stern <avraham.stern@intel.com>
303 Signed-off-by: Emmanuel Grumbach<emmanuel.grumbach@intel.com>
304 Signed-off-by: Johannes Berg <johannes.berg@intel.com>
306 commit 923eaf367206e01f22c97aee22300e332d071916
307 Author: Arik Nemtsov <arik@wizery.com>
308 Date: Mon May 26 14:40:51 2014 +0300
310 mac80211: don't check netdev state for debugfs read/write
312 Doing so will lead to an oops for a p2p-dev interface, since it has
315 Cc: stable@vger.kernel.org
316 Signed-off-by: Arik Nemtsov <arikx.nemtsov@intel.com>
317 Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
318 Signed-off-by: Johannes Berg <johannes.berg@intel.com>
320 commit a9fb54169b197f31aff24c8d6270dd1e56cde395
321 Author: chaitanya.mgit@gmail.com <chaitanya.mgit@gmail.com>
322 Date: Mon May 26 18:01:44 2014 +0530
324 regdb: Generalize the mW to dBm power conversion
326 Generalize the power conversion from mW to dBm
327 using log. This should fix the below compilation
328 error for country NO which adds a new power value
329 2000mW which is not handled earlier.
331 CC [M] net/wireless/wext-sme.o
332 CC [M] net/wireless/regdb.o
333 net/wireless/regdb.c:1130:1: error: Unknown undeclared here (not in
335 net/wireless/regdb.c:1130:9: error: expected } before power
336 make[2]: *** [net/wireless/regdb.o] Error 1
337 make[1]: *** [net/wireless] Error 2
338 make: *** [net] Error 2
340 Reported-By: John Walker <john@x109.net>
341 Signed-off-by: Chaitanya T K <chaitanya.mgit@gmail.com>
342 Acked-by: John W. Linville <linville@tuxdriver.com>
343 [remove unneeded parentheses, fix rounding by using %.0f]
344 Signed-off-by: Johannes Berg <johannes.berg@intel.com>
346 commit c7d37a66e345df2fdf1aa7b2c9a6d3d53846ca5b
347 Author: Krzysztof Hałasa <khalasa@piap.pl>
348 Date: Mon May 26 14:14:46 2014 +0200
350 mac80211: fix IBSS join by initializing last_scan_completed
352 Without this fix, freshly rebooted Linux creates a new IBSS
353 instead of joining an existing one. Only when jiffies counter
354 overflows after 5 minutes the IBSS can be successfully joined.
356 Signed-off-by: Krzysztof Hałasa <khalasa@piap.pl>
357 [edit commit message slightly]
358 Cc: stable@vger.kernel.org
359 Signed-off-by: Johannes Berg <johannes.berg@intel.com>
361 commit 34171dc0d623be2c1032416bf7d3819f388ed70d
362 Author: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
363 Date: Sun May 25 15:35:41 2014 +0300
365 mac80211: fix virtual monitor interface addition
367 Since the commit below, cfg80211_chandef_dfs_required()
368 will warn if it gets a an NL80211_IFTYPE_UNSPECIFIED iftype
369 as explicitely written in the commit log.
370 When an virtual monitor interface is added, its type is set
371 in ieee80211_sub_if_data.vif.type, but not in
372 ieee80211_sub_if_data.wdev.iftype which is passed to
373 cfg80211_chandef_dfs_required() hence resulting in the
376 WARNING: CPU: 1 PID: 21265 at net/wireless/chan.c:376 cfg80211_chandef_dfs_required+0xbc/0x130 [cfg80211]()
377 Modules linked in: [...]
378 CPU: 1 PID: 21265 Comm: ifconfig Tainted: G W O 3.13.11+ #12
379 Hardware name: Dell Inc. Latitude E6410/0667CC, BIOS A01 03/05/2010
380 0000000000000009 ffff88008f5fdb08 ffffffff817d4219 ffff88008f5fdb50
381 ffff88008f5fdb40 ffffffff8106f57d 0000000000000000 0000000000000000
382 ffff880081062fb8 ffff8800810604e0 0000000000000001 ffff88008f5fdba0
384 [<ffffffff817d4219>] dump_stack+0x4d/0x66
385 [<ffffffff8106f57d>] warn_slowpath_common+0x7d/0xa0
386 [<ffffffff8106f5ec>] warn_slowpath_fmt+0x4c/0x50
387 [<ffffffffa04ea4ec>] cfg80211_chandef_dfs_required+0xbc/0x130 [cfg80211]
388 [<ffffffffa06b1024>] ieee80211_vif_use_channel+0x94/0x500 [mac80211]
389 [<ffffffffa0684e6b>] ieee80211_add_virtual_monitor+0x1ab/0x5c0 [mac80211]
390 [<ffffffffa0686ae5>] ieee80211_do_open+0xe75/0x1580 [mac80211]
391 [<ffffffffa0687259>] ieee80211_open+0x69/0x70 [mac80211]
394 Fixes: 00ec75fc5a64 ("cfg80211: pass the actual iftype when calling cfg80211_chandef_dfs_required()")
395 Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
396 Acked-by: Luciano Coelho <luciano.coelho@intel.com>
397 Signed-off-by: Johannes Berg <johannes.berg@intel.com>
399 commit d93cc72b37b4e2c314e1c499e80e8801907c2fea
400 Author: Michal Kazior <michal.kazior@tieto.com>
401 Date: Thu Jun 5 14:21:37 2014 +0200
403 mac80211: use csa counter offsets instead of csa_active
405 vif->csa_active is protected by mutexes only. This
406 means it is unreliable to depend on it on codeflow
407 in non-sleepable beacon and CSA code. There was no
408 guarantee to have vif->csa_active update be
409 visible before beacons are updated on SMP systems.
411 Using csa counter offsets which are embedded in
412 beacon struct (and thus are protected with single
413 RCU assignment) is much safer.
415 Signed-off-by: Michal Kazior <michal.kazior@tieto.com>
416 Signed-off-by: Johannes Berg <johannes.berg@intel.com>
418 commit d2746694fcdef24e0a7a1947d8c70082cde81a26
419 Author: Michal Kazior <michal.kazior@tieto.com>
420 Date: Thu Jun 5 14:21:36 2014 +0200
422 mac80211: move csa counters from sdata to beacon/presp
424 Having csa counters part of beacon and probe_resp
425 structures makes it easier to get rid of possible
426 races between setting a beacon and updating
427 counters on SMP systems by guaranteeing counters
428 are always consistent against given beacon struct.
430 While at it relax WARN_ON into WARN_ON_ONCE to
431 prevent spamming logs and racing.
433 Signed-off-by: Michal Kazior <michal.kazior@tieto.com>
434 Signed-off-by: Johannes Berg <johannes.berg@intel.com>
436 commit 5dcb54f3a1a8cd7e0331e773487574f9743615db
437 Author: Janusz Dziedzic <janusz.dziedzic@tieto.com>
438 Date: Thu Jun 5 08:12:57 2014 +0200
440 mac80211: allow tx via monitor iface when DFS
442 Allow send frames using monitor interface
443 when DFS chandef and we pass CAC (beaconing
446 This fix problem when old kernel and new backports used,
447 in such case hostapd create/use also monitor interface.
448 Before this patch all frames hostapd send using monitor
449 iface were dropped when AP was configured on DFS channel.
451 Signed-off-by: Janusz Dziedzic <janusz.dziedzic@tieto.com>
452 Signed-off-by: Johannes Berg <johannes.berg@intel.com>
454 commit 6f09a1beb0d2007572248c986780562219bd206f
455 Author: Johannes Berg <johannes.berg@intel.com>
456 Date: Wed Jun 4 17:31:56 2014 +0200
458 cfg80211: make ethtool the driver's responsibility
460 Currently, cfg80211 tries to implement ethtool, but that doesn't
461 really scale well, with all the different operations. Make the
462 lower-level driver responsible for it, which currently only has
463 an effect on mac80211. It will similarly not scale well at that
464 level though, since mac80211 also has many drivers.
466 To cleanly implement this in mac80211, introduce a new file and
467 move some code to appropriate places.
469 Signed-off-by: Johannes Berg <johannes.berg@intel.com>
471 commit 6b0c6f133de8f90caeb1c4a902e6140567c5bf96
472 Author: Johannes Berg <johannes.berg@intel.com>
473 Date: Wed Jun 4 17:06:23 2014 +0200
475 mac80211: remove weak WEP IV accounting
477 Since WEP is practically dead, there seems very little
478 point in keeping WEP weak IV accounting.
480 Signed-off-by: Johannes Berg <johannes.berg@intel.com>
482 commit aecdc89fb4664c76baa4bbd46008f220532309ff
483 Author: Luciano Coelho <luciano.coelho@intel.com>
484 Date: Fri May 23 11:04:50 2014 +0300
486 ath9k/ath10k: remove unnecessary channel_switch_beacon callbacks
488 The channel_switch_beacon callback is optional, so it doesn't have to
489 be defined if it's not going to do anything useful with it. Both
490 ath9k and ath10k define the callback and just returns. This commit
493 Cc: Michal Kazior <michal.kazior@tieto.com>
494 Signed-off-by: Luciano Coelho <luciano.coelho@intel.com>
495 Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
497 commit 60ccc107c9b9fb732fdee1f76bb2dad44f0e1798
498 Author: Rajkumar Manoharan <rmanohar@qti.qualcomm.com>
499 Date: Tue May 27 16:58:02 2014 +0530
501 ath9k: Fix deadlock while updating p2p beacon timer
503 pm_lock is taken twice while syncing HW TSF of p2p vif.
504 Fix this by taking the lock at caller side.
506 Cc: Felix Fietkau <nbd@openwrt.org>
507 Signed-off-by: Rajkumar Manoharan <rmanohar@qti.qualcomm.com>
508 Signed-off-by: John W. Linville <linville@tuxdriver.com>
510 commit f3831a4e3903dbc1a57d5df56deb6a143fd001bc
511 Author: Stanislaw Gruszka <sgruszka@redhat.com>
512 Date: Thu Jun 5 13:52:27 2014 +0200
514 rt2x00: do not initialize BCN_OFFSET registers
516 We setup BCN_OFFSET{0,1} registers dynamically, don't have to
519 Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com>
521 commit e5c58ca7a48d4c82f282749a978052c47fd95998
522 Author: Stanislaw Gruszka <sgruszka@redhat.com>
523 Date: Thu Jun 5 13:52:26 2014 +0200
525 rt2x00: change order when stop beaconing
527 When no beaconing is needed, first stop beacon queue (disable beaconing
528 globally) to avoid possible sending of not prepared beacon on short
529 period after clearing beacon and before stop of BCN queue.
531 Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com>
533 commit 382c1b9e03f52d0cd741ef1d942cad0f649f0744
534 Author: Stanislaw Gruszka <sgruszka@redhat.com>
535 Date: Thu Jun 5 13:52:25 2014 +0200
537 rt2x00: change default MAC_BSSID_DW1_BSS_BCN_NUM
539 We setup MAC_BSSID_DW1_BSS_BCN_NUM dynamically when numbers of active
540 beacons increase. Change default to 0 to tell hardware that we want to
541 send only one beacon as default.
543 Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com>
545 commit 3b400571dd033e46fa7e76c5bb92a3ce8198afa9
546 Author: Stanislaw Gruszka <sgruszka@redhat.com>
547 Date: Thu Jun 5 13:52:24 2014 +0200
549 rt2x00: change beaconing setup on RT2800
551 As reported by Matthias, on 5572 chip, even if we clear up TXWI
552 of corresponding beacon, hardware still try to send it or do other
553 action that increase power consumption peak up to 1A.
555 To avoid the issue, setup beaconing dynamically by configuring offsets
556 of currently active beacons and MAC_BSSID_DW1_BSS_BCN_NUM variable,
557 which limit number of beacons that hardware will try to send.
559 Reported-by: Matthias Fend <Matthias.Fend@wolfvision.net>
560 Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com>
562 commit 916e591b2cc41f7e572992175ca56d866d7bc958
563 Author: Stanislaw Gruszka <sgruszka@redhat.com>
564 Date: Thu Jun 5 13:52:23 2014 +0200
566 rt2x00: change beaconing locking
568 This patch is needed for further changes to keep global variables
569 consistent when changing beaconing on diffrent vif's.
571 Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com>
573 commit 930b0dffd1731f3f418f9132faea720a23b7af61
574 Author: Johannes Berg <johannes.berg@intel.com>
575 Date: Tue Jun 3 11:18:47 2014 +0200
577 mac80211: fix station/driver powersave race
579 It is currently possible to have a race due to the station PS
580 unblock work like this:
581 * station goes to sleep with frames buffered in the driver
582 * driver blocks wakeup
583 * station wakes up again
584 * driver flushes/returns frames, and unblocks, which schedules
586 * unblock work starts to run, and checks that the station is
587 awake (i.e. that the WLAN_STA_PS_STA flag isn't set)
588 * we process a received frame with PM=1, setting the flag again
589 * ieee80211_sta_ps_deliver_wakeup() runs, delivering all frames
590 to the driver, and then clearing the WLAN_STA_PS_DRIVER and
591 WLAN_STA_PS_STA flags
593 In this scenario, mac80211 will think that the station is awake,
594 while it really is asleep, and any TX'ed frames should be filtered
595 by the device (it will know that the station is sleeping) but then
596 passed to mac80211 again, which will not buffer it either as it
597 thinks the station is awake, and eventually the packets will be
600 Fix this by moving the clearing of the flags to exactly where we
601 learn about the situation. This creates a problem of reordering,
602 so introduce another flag indicating that delivery is being done,
603 this new flag also queues frames and is cleared only while the
604 spinlock is held (which the queuing code also holds) so that any
605 concurrent delivery/TX is handled correctly.
607 Reported-by: Andrei Otcheretianski <andrei.otcheretianski@intel.com>
608 Signed-off-by: Johannes Berg <johannes.berg@intel.com>
610 commit 6df35206bc6c1c6aad1d8077df5786b4a7f77873
611 Author: Felix Fietkau <nbd@openwrt.org>
612 Date: Fri May 23 19:58:14 2014 +0200
614 mac80211: reduce packet loss notifications under load
616 During strong signal fluctuations under high throughput, few consecutive
617 failed A-MPDU transmissions can easily trigger packet loss notification,
618 and thus (in AP mode) client disconnection.
620 Reduce the number of false positives by checking the A-MPDU status flag
621 and treating a failed A-MPDU as a single packet.
623 Signed-off-by: Felix Fietkau <nbd@openwrt.org>
625 commit 7b7843a36fbcc568834404c7430ff895d8502131
626 Author: Felix Fietkau <nbd@openwrt.org>
627 Date: Fri May 23 19:26:32 2014 +0200
629 mac80211: fix a memory leak on sta rate selection table
631 Cc: stable@vger.kernel.org
632 Reported-by: Christophe Prévotaux <cprevotaux@nltinc.com>
633 Signed-off-by: Felix Fietkau <nbd@openwrt.org>
635 commit 96892d6aa0a153423070addf3070bc79578b3897
636 Author: Felix Fietkau <nbd@openwrt.org>
637 Date: Mon May 19 21:20:49 2014 +0200
639 ath9k: avoid passing buffers to the hardware during flush
641 The commit "ath9k: fix possible hang on flush" changed the receive code
642 to always link rx descriptors of processed frames, even when flushing.
643 In some cases, this leads to flushed rx buffers being passed to the
644 hardware while rx is already stopped.
646 Signed-off-by: Felix Fietkau <nbd@openwrt.org>
648 --- a/drivers/net/wireless/ath/ath9k/recv.c
649 +++ b/drivers/net/wireless/ath/ath9k/recv.c
650 @@ -34,7 +34,8 @@ static inline bool ath9k_check_auto_slee
651 * buffer (or rx fifo). This can incorrectly acknowledge packets
652 * to a sender if last desc is self-linked.
654 -static void ath_rx_buf_link(struct ath_softc *sc, struct ath_rxbuf *bf)
655 +static void ath_rx_buf_link(struct ath_softc *sc, struct ath_rxbuf *bf,
658 struct ath_hw *ah = sc->sc_ah;
659 struct ath_common *common = ath9k_hw_common(ah);
660 @@ -59,18 +60,19 @@ static void ath_rx_buf_link(struct ath_s
664 - if (sc->rx.rxlink == NULL)
665 - ath9k_hw_putrxbuf(ah, bf->bf_daddr);
668 *sc->rx.rxlink = bf->bf_daddr;
670 + ath9k_hw_putrxbuf(ah, bf->bf_daddr);
672 sc->rx.rxlink = &ds->ds_link;
675 -static void ath_rx_buf_relink(struct ath_softc *sc, struct ath_rxbuf *bf)
676 +static void ath_rx_buf_relink(struct ath_softc *sc, struct ath_rxbuf *bf,
680 - ath_rx_buf_link(sc, sc->rx.buf_hold);
681 + ath_rx_buf_link(sc, sc->rx.buf_hold, flush);
683 sc->rx.buf_hold = bf;
685 @@ -442,7 +444,7 @@ int ath_startrecv(struct ath_softc *sc)
686 sc->rx.buf_hold = NULL;
687 sc->rx.rxlink = NULL;
688 list_for_each_entry_safe(bf, tbf, &sc->rx.rxbuf, list) {
689 - ath_rx_buf_link(sc, bf);
690 + ath_rx_buf_link(sc, bf, false);
693 /* We could have deleted elements so the list may be empty now */
694 @@ -1118,12 +1120,12 @@ requeue_drop_frag:
696 list_add_tail(&bf->list, &sc->rx.rxbuf);
699 - ath_rx_edma_buf_link(sc, qtype);
701 - ath_rx_buf_relink(sc, bf);
703 + ath_rx_buf_relink(sc, bf, flush);
706 + } else if (!flush) {
707 + ath_rx_edma_buf_link(sc, qtype);
711 --- a/net/mac80211/sta_info.c
712 +++ b/net/mac80211/sta_info.c
713 @@ -100,7 +100,8 @@ static void __cleanup_single_sta(struct
716 if (test_sta_flag(sta, WLAN_STA_PS_STA) ||
717 - test_sta_flag(sta, WLAN_STA_PS_DRIVER)) {
718 + test_sta_flag(sta, WLAN_STA_PS_DRIVER) ||
719 + test_sta_flag(sta, WLAN_STA_PS_DELIVER)) {
720 if (sta->sdata->vif.type == NL80211_IFTYPE_AP ||
721 sta->sdata->vif.type == NL80211_IFTYPE_AP_VLAN)
722 ps = &sdata->bss->ps;
723 @@ -111,6 +112,7 @@ static void __cleanup_single_sta(struct
725 clear_sta_flag(sta, WLAN_STA_PS_STA);
726 clear_sta_flag(sta, WLAN_STA_PS_DRIVER);
727 + clear_sta_flag(sta, WLAN_STA_PS_DELIVER);
729 atomic_dec(&ps->num_sta_ps);
730 sta_info_recalc_tim(sta);
731 @@ -125,7 +127,7 @@ static void __cleanup_single_sta(struct
732 if (ieee80211_vif_is_mesh(&sdata->vif))
733 mesh_sta_cleanup(sta);
735 - cancel_work_sync(&sta->drv_unblock_wk);
736 + cancel_work_sync(&sta->drv_deliver_wk);
739 * Destroy aggregation state here. It would be nice to wait for the
740 @@ -227,6 +229,7 @@ struct sta_info *sta_info_get_by_idx(str
742 void sta_info_free(struct ieee80211_local *local, struct sta_info *sta)
744 + struct ieee80211_sta_rates *rates;
748 @@ -238,6 +241,10 @@ void sta_info_free(struct ieee80211_loca
752 + rates = rcu_dereference_protected(sta->sta.rates, true);
756 sta_dbg(sta->sdata, "Destroyed STA %pM\n", sta->sta.addr);
759 @@ -252,33 +259,23 @@ static void sta_info_hash_add(struct iee
760 rcu_assign_pointer(local->sta_hash[STA_HASH(sta->sta.addr)], sta);
763 -static void sta_unblock(struct work_struct *wk)
764 +static void sta_deliver_ps_frames(struct work_struct *wk)
766 struct sta_info *sta;
768 - sta = container_of(wk, struct sta_info, drv_unblock_wk);
769 + sta = container_of(wk, struct sta_info, drv_deliver_wk);
774 - if (!test_sta_flag(sta, WLAN_STA_PS_STA)) {
775 - local_bh_disable();
776 + local_bh_disable();
777 + if (!test_sta_flag(sta, WLAN_STA_PS_STA))
778 ieee80211_sta_ps_deliver_wakeup(sta);
780 - } else if (test_and_clear_sta_flag(sta, WLAN_STA_PSPOLL)) {
781 - clear_sta_flag(sta, WLAN_STA_PS_DRIVER);
783 - local_bh_disable();
784 + else if (test_and_clear_sta_flag(sta, WLAN_STA_PSPOLL))
785 ieee80211_sta_ps_deliver_poll_response(sta);
787 - } else if (test_and_clear_sta_flag(sta, WLAN_STA_UAPSD)) {
788 - clear_sta_flag(sta, WLAN_STA_PS_DRIVER);
790 - local_bh_disable();
791 + else if (test_and_clear_sta_flag(sta, WLAN_STA_UAPSD))
792 ieee80211_sta_ps_deliver_uapsd(sta);
795 - clear_sta_flag(sta, WLAN_STA_PS_DRIVER);
799 static int sta_prepare_rate_control(struct ieee80211_local *local,
800 @@ -340,7 +337,7 @@ struct sta_info *sta_info_alloc(struct i
802 spin_lock_init(&sta->lock);
803 spin_lock_init(&sta->ps_lock);
804 - INIT_WORK(&sta->drv_unblock_wk, sta_unblock);
805 + INIT_WORK(&sta->drv_deliver_wk, sta_deliver_ps_frames);
806 INIT_WORK(&sta->ampdu_mlme.work, ieee80211_ba_session_work);
807 mutex_init(&sta->ampdu_mlme.mtx);
808 #ifdef CPTCFG_MAC80211_MESH
809 @@ -1101,8 +1098,11 @@ void ieee80211_sta_ps_deliver_wakeup(str
813 - if (sdata->vif.type == NL80211_IFTYPE_AP ||
814 - sdata->vif.type == NL80211_IFTYPE_AP_VLAN)
815 + if (sdata->vif.type == NL80211_IFTYPE_AP_VLAN)
816 + sdata = container_of(sdata->bss, struct ieee80211_sub_if_data,
819 + if (sdata->vif.type == NL80211_IFTYPE_AP)
820 ps = &sdata->bss->ps;
821 else if (ieee80211_vif_is_mesh(&sdata->vif))
822 ps = &sdata->u.mesh.ps;
823 @@ -1140,8 +1140,15 @@ void ieee80211_sta_ps_deliver_wakeup(str
826 ieee80211_add_pending_skbs(local, &pending);
827 - clear_sta_flag(sta, WLAN_STA_PS_DRIVER);
828 - clear_sta_flag(sta, WLAN_STA_PS_STA);
830 + /* now we're no longer in the deliver code */
831 + clear_sta_flag(sta, WLAN_STA_PS_DELIVER);
833 + /* The station might have polled and then woken up before we responded,
834 + * so clear these flags now to avoid them sticking around.
836 + clear_sta_flag(sta, WLAN_STA_PSPOLL);
837 + clear_sta_flag(sta, WLAN_STA_UAPSD);
838 spin_unlock(&sta->ps_lock);
840 atomic_dec(&ps->num_sta_ps);
841 @@ -1542,10 +1549,26 @@ void ieee80211_sta_block_awake(struct ie
843 trace_api_sta_block_awake(sta->local, pubsta, block);
847 set_sta_flag(sta, WLAN_STA_PS_DRIVER);
848 - else if (test_sta_flag(sta, WLAN_STA_PS_DRIVER))
849 - ieee80211_queue_work(hw, &sta->drv_unblock_wk);
853 + if (!test_sta_flag(sta, WLAN_STA_PS_DRIVER))
856 + if (!test_sta_flag(sta, WLAN_STA_PS_STA)) {
857 + set_sta_flag(sta, WLAN_STA_PS_DELIVER);
858 + clear_sta_flag(sta, WLAN_STA_PS_DRIVER);
859 + ieee80211_queue_work(hw, &sta->drv_deliver_wk);
860 + } else if (test_sta_flag(sta, WLAN_STA_PSPOLL) ||
861 + test_sta_flag(sta, WLAN_STA_UAPSD)) {
862 + /* must be asleep in this case */
863 + clear_sta_flag(sta, WLAN_STA_PS_DRIVER);
864 + ieee80211_queue_work(hw, &sta->drv_deliver_wk);
866 + clear_sta_flag(sta, WLAN_STA_PS_DRIVER);
869 EXPORT_SYMBOL(ieee80211_sta_block_awake);
871 @@ -1703,3 +1726,140 @@ u8 sta_info_tx_streams(struct sta_info *
872 return ((ht_cap->mcs.tx_params & IEEE80211_HT_MCS_TX_MAX_STREAMS_MASK)
873 >> IEEE80211_HT_MCS_TX_MAX_STREAMS_SHIFT) + 1;
876 +void sta_set_sinfo(struct sta_info *sta, struct station_info *sinfo)
878 + struct ieee80211_sub_if_data *sdata = sta->sdata;
879 + struct ieee80211_local *local = sdata->local;
880 + struct rate_control_ref *ref = NULL;
881 + struct timespec uptime;
886 + if (test_sta_flag(sta, WLAN_STA_RATE_CONTROL))
887 + ref = local->rate_ctrl;
889 + sinfo->generation = sdata->local->sta_generation;
891 + sinfo->filled = STATION_INFO_INACTIVE_TIME |
892 + STATION_INFO_RX_BYTES64 |
893 + STATION_INFO_TX_BYTES64 |
894 + STATION_INFO_RX_PACKETS |
895 + STATION_INFO_TX_PACKETS |
896 + STATION_INFO_TX_RETRIES |
897 + STATION_INFO_TX_FAILED |
898 + STATION_INFO_TX_BITRATE |
899 + STATION_INFO_RX_BITRATE |
900 + STATION_INFO_RX_DROP_MISC |
901 + STATION_INFO_BSS_PARAM |
902 + STATION_INFO_CONNECTED_TIME |
903 + STATION_INFO_STA_FLAGS |
904 + STATION_INFO_BEACON_LOSS_COUNT;
906 + do_posix_clock_monotonic_gettime(&uptime);
907 + sinfo->connected_time = uptime.tv_sec - sta->last_connected;
909 + sinfo->inactive_time = jiffies_to_msecs(jiffies - sta->last_rx);
910 + sinfo->tx_bytes = 0;
911 + for (ac = 0; ac < IEEE80211_NUM_ACS; ac++) {
912 + sinfo->tx_bytes += sta->tx_bytes[ac];
913 + packets += sta->tx_packets[ac];
915 + sinfo->tx_packets = packets;
916 + sinfo->rx_bytes = sta->rx_bytes;
917 + sinfo->rx_packets = sta->rx_packets;
918 + sinfo->tx_retries = sta->tx_retry_count;
919 + sinfo->tx_failed = sta->tx_retry_failed;
920 + sinfo->rx_dropped_misc = sta->rx_dropped;
921 + sinfo->beacon_loss_count = sta->beacon_loss_count;
923 + if ((sta->local->hw.flags & IEEE80211_HW_SIGNAL_DBM) ||
924 + (sta->local->hw.flags & IEEE80211_HW_SIGNAL_UNSPEC)) {
925 + sinfo->filled |= STATION_INFO_SIGNAL | STATION_INFO_SIGNAL_AVG;
926 + if (!local->ops->get_rssi ||
927 + drv_get_rssi(local, sdata, &sta->sta, &sinfo->signal))
928 + sinfo->signal = (s8)sta->last_signal;
929 + sinfo->signal_avg = (s8) -ewma_read(&sta->avg_signal);
932 + sinfo->filled |= STATION_INFO_CHAIN_SIGNAL |
933 + STATION_INFO_CHAIN_SIGNAL_AVG;
935 + sinfo->chains = sta->chains;
936 + for (i = 0; i < ARRAY_SIZE(sinfo->chain_signal); i++) {
937 + sinfo->chain_signal[i] = sta->chain_signal_last[i];
938 + sinfo->chain_signal_avg[i] =
939 + (s8) -ewma_read(&sta->chain_signal_avg[i]);
943 + sta_set_rate_info_tx(sta, &sta->last_tx_rate, &sinfo->txrate);
944 + sta_set_rate_info_rx(sta, &sinfo->rxrate);
946 + if (ieee80211_vif_is_mesh(&sdata->vif)) {
947 +#ifdef CPTCFG_MAC80211_MESH
948 + sinfo->filled |= STATION_INFO_LLID |
949 + STATION_INFO_PLID |
950 + STATION_INFO_PLINK_STATE |
951 + STATION_INFO_LOCAL_PM |
952 + STATION_INFO_PEER_PM |
953 + STATION_INFO_NONPEER_PM;
955 + sinfo->llid = sta->llid;
956 + sinfo->plid = sta->plid;
957 + sinfo->plink_state = sta->plink_state;
958 + if (test_sta_flag(sta, WLAN_STA_TOFFSET_KNOWN)) {
959 + sinfo->filled |= STATION_INFO_T_OFFSET;
960 + sinfo->t_offset = sta->t_offset;
962 + sinfo->local_pm = sta->local_pm;
963 + sinfo->peer_pm = sta->peer_pm;
964 + sinfo->nonpeer_pm = sta->nonpeer_pm;
968 + sinfo->bss_param.flags = 0;
969 + if (sdata->vif.bss_conf.use_cts_prot)
970 + sinfo->bss_param.flags |= BSS_PARAM_FLAGS_CTS_PROT;
971 + if (sdata->vif.bss_conf.use_short_preamble)
972 + sinfo->bss_param.flags |= BSS_PARAM_FLAGS_SHORT_PREAMBLE;
973 + if (sdata->vif.bss_conf.use_short_slot)
974 + sinfo->bss_param.flags |= BSS_PARAM_FLAGS_SHORT_SLOT_TIME;
975 + sinfo->bss_param.dtim_period = sdata->local->hw.conf.ps_dtim_period;
976 + sinfo->bss_param.beacon_interval = sdata->vif.bss_conf.beacon_int;
978 + sinfo->sta_flags.set = 0;
979 + sinfo->sta_flags.mask = BIT(NL80211_STA_FLAG_AUTHORIZED) |
980 + BIT(NL80211_STA_FLAG_SHORT_PREAMBLE) |
981 + BIT(NL80211_STA_FLAG_WME) |
982 + BIT(NL80211_STA_FLAG_MFP) |
983 + BIT(NL80211_STA_FLAG_AUTHENTICATED) |
984 + BIT(NL80211_STA_FLAG_ASSOCIATED) |
985 + BIT(NL80211_STA_FLAG_TDLS_PEER);
986 + if (test_sta_flag(sta, WLAN_STA_AUTHORIZED))
987 + sinfo->sta_flags.set |= BIT(NL80211_STA_FLAG_AUTHORIZED);
988 + if (test_sta_flag(sta, WLAN_STA_SHORT_PREAMBLE))
989 + sinfo->sta_flags.set |= BIT(NL80211_STA_FLAG_SHORT_PREAMBLE);
990 + if (test_sta_flag(sta, WLAN_STA_WME))
991 + sinfo->sta_flags.set |= BIT(NL80211_STA_FLAG_WME);
992 + if (test_sta_flag(sta, WLAN_STA_MFP))
993 + sinfo->sta_flags.set |= BIT(NL80211_STA_FLAG_MFP);
994 + if (test_sta_flag(sta, WLAN_STA_AUTH))
995 + sinfo->sta_flags.set |= BIT(NL80211_STA_FLAG_AUTHENTICATED);
996 + if (test_sta_flag(sta, WLAN_STA_ASSOC))
997 + sinfo->sta_flags.set |= BIT(NL80211_STA_FLAG_ASSOCIATED);
998 + if (test_sta_flag(sta, WLAN_STA_TDLS_PEER))
999 + sinfo->sta_flags.set |= BIT(NL80211_STA_FLAG_TDLS_PEER);
1001 + /* check if the driver has a SW RC implementation */
1002 + if (ref && ref->ops->get_expected_throughput)
1003 + thr = ref->ops->get_expected_throughput(sta->rate_ctrl_priv);
1005 + thr = drv_get_expected_throughput(local, &sta->sta);
1008 + sinfo->filled |= STATION_INFO_EXPECTED_THROUGHPUT;
1009 + sinfo->expected_throughput = thr;
1012 --- a/net/mac80211/status.c
1013 +++ b/net/mac80211/status.c
1014 @@ -541,6 +541,23 @@ static void ieee80211_tx_latency_end_msr
1016 #define STA_LOST_PKT_THRESHOLD 50
1018 +static void ieee80211_lost_packet(struct sta_info *sta, struct sk_buff *skb)
1020 + struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
1022 + /* This packet was aggregated but doesn't carry status info */
1023 + if ((info->flags & IEEE80211_TX_CTL_AMPDU) &&
1024 + !(info->flags & IEEE80211_TX_STAT_AMPDU))
1027 + if (++sta->lost_packets < STA_LOST_PKT_THRESHOLD)
1030 + cfg80211_cqm_pktloss_notify(sta->sdata->dev, sta->sta.addr,
1031 + sta->lost_packets, GFP_ATOMIC);
1032 + sta->lost_packets = 0;
1035 void ieee80211_tx_status(struct ieee80211_hw *hw, struct sk_buff *skb)
1037 struct sk_buff *skb2;
1038 @@ -680,12 +697,8 @@ void ieee80211_tx_status(struct ieee8021
1039 if (info->flags & IEEE80211_TX_STAT_ACK) {
1040 if (sta->lost_packets)
1041 sta->lost_packets = 0;
1042 - } else if (++sta->lost_packets >= STA_LOST_PKT_THRESHOLD) {
1043 - cfg80211_cqm_pktloss_notify(sta->sdata->dev,
1045 - sta->lost_packets,
1047 - sta->lost_packets = 0;
1049 + ieee80211_lost_packet(sta, skb);
1053 --- a/net/mac80211/rx.c
1054 +++ b/net/mac80211/rx.c
1055 @@ -1107,6 +1107,8 @@ static void sta_ps_end(struct sta_info *
1059 + set_sta_flag(sta, WLAN_STA_PS_DELIVER);
1060 + clear_sta_flag(sta, WLAN_STA_PS_STA);
1061 ieee80211_sta_ps_deliver_wakeup(sta);
1064 @@ -1646,11 +1648,14 @@ ieee80211_rx_h_defragment(struct ieee802
1065 sc = le16_to_cpu(hdr->seq_ctrl);
1066 frag = sc & IEEE80211_SCTL_FRAG;
1068 - if (likely((!ieee80211_has_morefrags(fc) && frag == 0) ||
1069 - is_multicast_ether_addr(hdr->addr1))) {
1070 - /* not fragmented */
1071 + if (likely(!ieee80211_has_morefrags(fc) && frag == 0))
1074 + if (is_multicast_ether_addr(hdr->addr1)) {
1075 + rx->local->dot11MulticastReceivedFrameCount++;
1079 I802_DEBUG_INC(rx->local->rx_handlers_fragments);
1081 if (skb_linearize(rx->skb))
1082 @@ -1743,10 +1748,7 @@ ieee80211_rx_h_defragment(struct ieee802
1085 rx->sta->rx_packets++;
1086 - if (is_multicast_ether_addr(hdr->addr1))
1087 - rx->local->dot11MulticastReceivedFrameCount++;
1089 - ieee80211_led_rx(rx->local);
1090 + ieee80211_led_rx(rx->local);
1094 --- a/net/mac80211/sta_info.h
1095 +++ b/net/mac80211/sta_info.h
1096 @@ -82,6 +82,7 @@ enum ieee80211_sta_info_flags {
1097 WLAN_STA_TOFFSET_KNOWN,
1098 WLAN_STA_MPSP_OWNER,
1099 WLAN_STA_MPSP_RECIPIENT,
1100 + WLAN_STA_PS_DELIVER,
1103 #define ADDBA_RESP_INTERVAL HZ
1104 @@ -265,7 +266,7 @@ struct ieee80211_tx_latency_stat {
1105 * @last_rx_rate_vht_nss: rx status nss of last data packet
1106 * @lock: used for locking all fields that require locking, see comments
1107 * in the header file.
1108 - * @drv_unblock_wk: used for driver PS unblocking
1109 + * @drv_deliver_wk: used for delivering frames after driver PS unblocking
1110 * @listen_interval: listen interval of this station, when we're acting as AP
1111 * @_flags: STA flags, see &enum ieee80211_sta_info_flags, do not use directly
1112 * @ps_lock: used for powersave (when mac80211 is the AP) related locking
1113 @@ -278,7 +279,6 @@ struct ieee80211_tx_latency_stat {
1114 * @driver_buffered_tids: bitmap of TIDs the driver has data buffered on
1115 * @rx_packets: Number of MSDUs received from this STA
1116 * @rx_bytes: Number of bytes received from this STA
1117 - * @wep_weak_iv_count: number of weak WEP IVs received from this station
1118 * @last_rx: time (in jiffies) when last frame was received from this STA
1119 * @last_connected: time (in seconds) when a station got connected
1120 * @num_duplicates: number of duplicate frames received from this STA
1121 @@ -345,7 +345,7 @@ struct sta_info {
1122 void *rate_ctrl_priv;
1125 - struct work_struct drv_unblock_wk;
1126 + struct work_struct drv_deliver_wk;
1128 u16 listen_interval;
1130 @@ -367,7 +367,6 @@ struct sta_info {
1131 /* Updated from RX path only, no locking requirements */
1132 unsigned long rx_packets;
1134 - unsigned long wep_weak_iv_count;
1135 unsigned long last_rx;
1136 long last_connected;
1137 unsigned long num_duplicates;
1138 @@ -628,6 +627,8 @@ void sta_set_rate_info_tx(struct sta_inf
1139 struct rate_info *rinfo);
1140 void sta_set_rate_info_rx(struct sta_info *sta,
1141 struct rate_info *rinfo);
1142 +void sta_set_sinfo(struct sta_info *sta, struct station_info *sinfo);
1144 void ieee80211_sta_expire(struct ieee80211_sub_if_data *sdata,
1145 unsigned long exp_time);
1146 u8 sta_info_tx_streams(struct sta_info *sta);
1147 --- a/net/mac80211/tx.c
1148 +++ b/net/mac80211/tx.c
1149 @@ -469,7 +469,8 @@ ieee80211_tx_h_unicast_ps_buf(struct iee
1152 if (unlikely((test_sta_flag(sta, WLAN_STA_PS_STA) ||
1153 - test_sta_flag(sta, WLAN_STA_PS_DRIVER)) &&
1154 + test_sta_flag(sta, WLAN_STA_PS_DRIVER) ||
1155 + test_sta_flag(sta, WLAN_STA_PS_DELIVER)) &&
1156 !(info->flags & IEEE80211_TX_CTL_NO_PS_BUFFER))) {
1157 int ac = skb_get_queue_mapping(tx->skb);
1159 @@ -486,7 +487,8 @@ ieee80211_tx_h_unicast_ps_buf(struct iee
1160 * ahead and Tx the packet.
1162 if (!test_sta_flag(sta, WLAN_STA_PS_STA) &&
1163 - !test_sta_flag(sta, WLAN_STA_PS_DRIVER)) {
1164 + !test_sta_flag(sta, WLAN_STA_PS_DRIVER) &&
1165 + !test_sta_flag(sta, WLAN_STA_PS_DELIVER)) {
1166 spin_unlock(&sta->ps_lock);
1169 @@ -1618,12 +1620,12 @@ netdev_tx_t ieee80211_monitor_start_xmit
1171 struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr);
1172 struct ieee80211_chanctx_conf *chanctx_conf;
1173 - struct ieee80211_channel *chan;
1174 struct ieee80211_radiotap_header *prthdr =
1175 (struct ieee80211_radiotap_header *)skb->data;
1176 struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
1177 struct ieee80211_hdr *hdr;
1178 struct ieee80211_sub_if_data *tmp_sdata, *sdata;
1179 + struct cfg80211_chan_def *chandef;
1183 @@ -1721,9 +1723,9 @@ netdev_tx_t ieee80211_monitor_start_xmit
1187 - chan = chanctx_conf->def.chan;
1188 + chandef = &chanctx_conf->def;
1189 else if (!local->use_chanctx)
1190 - chan = local->_oper_chandef.chan;
1191 + chandef = &local->_oper_chandef;
1195 @@ -1743,10 +1745,11 @@ netdev_tx_t ieee80211_monitor_start_xmit
1196 * radar detection by itself. We can do that later by adding a
1197 * monitor flag interfaces used for AP support.
1199 - if ((chan->flags & (IEEE80211_CHAN_NO_IR | IEEE80211_CHAN_RADAR)))
1200 + if (!cfg80211_reg_can_beacon(local->hw.wiphy, chandef,
1204 - ieee80211_xmit(sdata, skb, chan->band);
1205 + ieee80211_xmit(sdata, skb, chandef->chan->band);
1208 return NETDEV_TX_OK;
1209 @@ -2425,7 +2428,7 @@ static void ieee80211_set_csa(struct iee
1211 size_t beacon_data_len;
1213 - u8 count = sdata->csa_current_counter;
1214 + u8 count = beacon->csa_current_counter;
1216 switch (sdata->vif.type) {
1217 case NL80211_IFTYPE_AP:
1218 @@ -2444,46 +2447,54 @@ static void ieee80211_set_csa(struct iee
1223 for (i = 0; i < IEEE80211_MAX_CSA_COUNTERS_NUM; ++i) {
1224 - u16 counter_offset_beacon =
1225 - sdata->csa_counter_offset_beacon[i];
1226 - u16 counter_offset_presp = sdata->csa_counter_offset_presp[i];
1228 - if (counter_offset_beacon) {
1229 - if (WARN_ON(counter_offset_beacon >= beacon_data_len))
1232 - beacon_data[counter_offset_beacon] = count;
1235 - if (sdata->vif.type == NL80211_IFTYPE_AP &&
1236 - counter_offset_presp) {
1238 - resp = rcu_dereference(sdata->u.ap.probe_resp);
1239 + resp = rcu_dereference(sdata->u.ap.probe_resp);
1241 - /* If nl80211 accepted the offset, this should
1244 - if (WARN_ON(!resp)) {
1245 + if (beacon->csa_counter_offsets[i]) {
1246 + if (WARN_ON_ONCE(beacon->csa_counter_offsets[i] >=
1247 + beacon_data_len)) {
1251 - resp->data[counter_offset_presp] = count;
1252 - rcu_read_unlock();
1254 + beacon_data[beacon->csa_counter_offsets[i]] = count;
1257 + if (sdata->vif.type == NL80211_IFTYPE_AP && resp &&
1258 + resp->csa_counter_offsets)
1259 + resp->data[resp->csa_counter_offsets[i]] = count;
1261 + rcu_read_unlock();
1264 u8 ieee80211_csa_update_counter(struct ieee80211_vif *vif)
1266 struct ieee80211_sub_if_data *sdata = vif_to_sdata(vif);
1267 + struct beacon_data *beacon = NULL;
1272 + if (sdata->vif.type == NL80211_IFTYPE_AP)
1273 + beacon = rcu_dereference(sdata->u.ap.beacon);
1274 + else if (sdata->vif.type == NL80211_IFTYPE_ADHOC)
1275 + beacon = rcu_dereference(sdata->u.ibss.presp);
1276 + else if (ieee80211_vif_is_mesh(&sdata->vif))
1277 + beacon = rcu_dereference(sdata->u.mesh.beacon);
1282 - sdata->csa_current_counter--;
1283 + beacon->csa_current_counter--;
1285 /* the counter should never reach 0 */
1286 - WARN_ON(!sdata->csa_current_counter);
1287 + WARN_ON_ONCE(!beacon->csa_current_counter);
1288 + count = beacon->csa_current_counter;
1290 - return sdata->csa_current_counter;
1292 + rcu_read_unlock();
1295 EXPORT_SYMBOL(ieee80211_csa_update_counter);
1297 @@ -2493,7 +2504,6 @@ bool ieee80211_csa_is_complete(struct ie
1298 struct beacon_data *beacon = NULL;
1300 size_t beacon_data_len;
1301 - int counter_beacon = sdata->csa_counter_offset_beacon[0];
1304 if (!ieee80211_sdata_running(sdata))
1305 @@ -2531,10 +2541,13 @@ bool ieee80211_csa_is_complete(struct ie
1309 - if (WARN_ON(counter_beacon > beacon_data_len))
1310 + if (!beacon->csa_counter_offsets[0])
1313 + if (WARN_ON_ONCE(beacon->csa_counter_offsets[0] > beacon_data_len))
1316 - if (beacon_data[counter_beacon] == 1)
1317 + if (beacon_data[beacon->csa_counter_offsets[0]] == 1)
1321 @@ -2550,6 +2563,7 @@ __ieee80211_beacon_get(struct ieee80211_
1324 struct ieee80211_local *local = hw_to_local(hw);
1325 + struct beacon_data *beacon = NULL;
1326 struct sk_buff *skb = NULL;
1327 struct ieee80211_tx_info *info;
1328 struct ieee80211_sub_if_data *sdata = NULL;
1329 @@ -2571,10 +2585,10 @@ __ieee80211_beacon_get(struct ieee80211_
1331 if (sdata->vif.type == NL80211_IFTYPE_AP) {
1332 struct ieee80211_if_ap *ap = &sdata->u.ap;
1333 - struct beacon_data *beacon = rcu_dereference(ap->beacon);
1335 + beacon = rcu_dereference(ap->beacon);
1337 - if (sdata->vif.csa_active) {
1338 + if (beacon->csa_counter_offsets[0]) {
1340 ieee80211_csa_update_counter(vif);
1342 @@ -2615,37 +2629,37 @@ __ieee80211_beacon_get(struct ieee80211_
1343 } else if (sdata->vif.type == NL80211_IFTYPE_ADHOC) {
1344 struct ieee80211_if_ibss *ifibss = &sdata->u.ibss;
1345 struct ieee80211_hdr *hdr;
1346 - struct beacon_data *presp = rcu_dereference(ifibss->presp);
1349 + beacon = rcu_dereference(ifibss->presp);
1353 - if (sdata->vif.csa_active) {
1354 + if (beacon->csa_counter_offsets[0]) {
1356 ieee80211_csa_update_counter(vif);
1358 - ieee80211_set_csa(sdata, presp);
1359 + ieee80211_set_csa(sdata, beacon);
1362 - skb = dev_alloc_skb(local->tx_headroom + presp->head_len +
1363 + skb = dev_alloc_skb(local->tx_headroom + beacon->head_len +
1364 local->hw.extra_beacon_tailroom);
1367 skb_reserve(skb, local->tx_headroom);
1368 - memcpy(skb_put(skb, presp->head_len), presp->head,
1370 + memcpy(skb_put(skb, beacon->head_len), beacon->head,
1371 + beacon->head_len);
1373 hdr = (struct ieee80211_hdr *) skb->data;
1374 hdr->frame_control = cpu_to_le16(IEEE80211_FTYPE_MGMT |
1375 IEEE80211_STYPE_BEACON);
1376 } else if (ieee80211_vif_is_mesh(&sdata->vif)) {
1377 struct ieee80211_if_mesh *ifmsh = &sdata->u.mesh;
1378 - struct beacon_data *bcn = rcu_dereference(ifmsh->beacon);
1381 + beacon = rcu_dereference(ifmsh->beacon);
1385 - if (sdata->vif.csa_active) {
1386 + if (beacon->csa_counter_offsets[0]) {
1388 /* TODO: For mesh csa_counter is in TU, so
1389 * decrementing it by one isn't correct, but
1390 @@ -2654,40 +2668,42 @@ __ieee80211_beacon_get(struct ieee80211_
1392 ieee80211_csa_update_counter(vif);
1394 - ieee80211_set_csa(sdata, bcn);
1395 + ieee80211_set_csa(sdata, beacon);
1398 if (ifmsh->sync_ops)
1399 - ifmsh->sync_ops->adjust_tbtt(sdata, bcn);
1400 + ifmsh->sync_ops->adjust_tbtt(sdata, beacon);
1402 skb = dev_alloc_skb(local->tx_headroom +
1404 + beacon->head_len +
1407 + beacon->tail_len +
1408 local->hw.extra_beacon_tailroom);
1411 skb_reserve(skb, local->tx_headroom);
1412 - memcpy(skb_put(skb, bcn->head_len), bcn->head, bcn->head_len);
1413 + memcpy(skb_put(skb, beacon->head_len), beacon->head,
1414 + beacon->head_len);
1415 ieee80211_beacon_add_tim(sdata, &ifmsh->ps, skb, is_template);
1418 - offs->tim_offset = bcn->head_len;
1419 - offs->tim_length = skb->len - bcn->head_len;
1420 + offs->tim_offset = beacon->head_len;
1421 + offs->tim_length = skb->len - beacon->head_len;
1424 - memcpy(skb_put(skb, bcn->tail_len), bcn->tail, bcn->tail_len);
1425 + memcpy(skb_put(skb, beacon->tail_len), beacon->tail,
1426 + beacon->tail_len);
1434 + if (offs && beacon) {
1437 for (i = 0; i < IEEE80211_MAX_CSA_COUNTERS_NUM; i++) {
1438 - u16 csa_off = sdata->csa_counter_offset_beacon[i];
1439 + u16 csa_off = beacon->csa_counter_offsets[i];
1443 --- a/drivers/net/wireless/rt2x00/rt2800lib.c
1444 +++ b/drivers/net/wireless/rt2x00/rt2800lib.c
1445 @@ -947,6 +947,40 @@ static inline u8 rt2800_get_beacon_offse
1446 return BEACON_BASE_TO_OFFSET(rt2800_hw_beacon_base(rt2x00dev, index));
1449 +static void rt2800_update_beacons_setup(struct rt2x00_dev *rt2x00dev)
1451 + struct data_queue *queue = rt2x00dev->bcn;
1452 + struct queue_entry *entry;
1453 + int i, bcn_num = 0;
1458 + * Setup offsets of all active beacons in BCN_OFFSET{0,1} registers.
1460 + for (i = 0; i < queue->limit; i++) {
1461 + entry = &queue->entries[i];
1462 + if (!test_bit(ENTRY_BCN_ENABLED, &entry->flags))
1464 + off = rt2800_get_beacon_offset(rt2x00dev, entry->entry_idx);
1465 + reg |= off << (8 * bcn_num);
1469 + WARN_ON_ONCE(bcn_num != rt2x00dev->intf_beaconing);
1471 + rt2800_register_write(rt2x00dev, BCN_OFFSET0, (u32) reg);
1472 + rt2800_register_write(rt2x00dev, BCN_OFFSET1, (u32) (reg >> 32));
1475 + * H/W sends up to MAC_BSSID_DW1_BSS_BCN_NUM + 1 consecutive beacons.
1477 + rt2800_register_read(rt2x00dev, MAC_BSSID_DW1, &bssid_dw1);
1478 + rt2x00_set_field32(&bssid_dw1, MAC_BSSID_DW1_BSS_BCN_NUM,
1479 + bcn_num > 0 ? bcn_num - 1 : 0);
1480 + rt2800_register_write(rt2x00dev, MAC_BSSID_DW1, bssid_dw1);
1483 void rt2800_write_beacon(struct queue_entry *entry, struct txentry_desc *txdesc)
1485 struct rt2x00_dev *rt2x00dev = entry->queue->rt2x00dev;
1486 @@ -1003,6 +1037,12 @@ void rt2800_write_beacon(struct queue_en
1488 rt2800_register_multiwrite(rt2x00dev, beacon_base, entry->skb->data,
1489 entry->skb->len + padding_len);
1490 + __set_bit(ENTRY_BCN_ENABLED, &entry->flags);
1493 + * Change global beacons settings.
1495 + rt2800_update_beacons_setup(rt2x00dev);
1498 * Restore beaconing state.
1499 @@ -1053,8 +1093,13 @@ void rt2800_clear_beacon(struct queue_en
1502 rt2800_clear_beacon_register(rt2x00dev, entry->entry_idx);
1503 + __clear_bit(ENTRY_BCN_ENABLED, &entry->flags);
1506 + * Change global beacons settings.
1508 + rt2800_update_beacons_setup(rt2x00dev);
1510 * Restore beaconing state.
1512 rt2800_register_write(rt2x00dev, BCN_TIME_CFG, orig_reg);
1513 @@ -1556,7 +1601,7 @@ void rt2800_config_intf(struct rt2x00_de
1514 if (!is_zero_ether_addr((const u8 *)conf->bssid)) {
1515 reg = le32_to_cpu(conf->bssid[1]);
1516 rt2x00_set_field32(®, MAC_BSSID_DW1_BSS_ID_MASK, 3);
1517 - rt2x00_set_field32(®, MAC_BSSID_DW1_BSS_BCN_NUM, 7);
1518 + rt2x00_set_field32(®, MAC_BSSID_DW1_BSS_BCN_NUM, 0);
1519 conf->bssid[1] = cpu_to_le32(reg);
1522 @@ -4517,28 +4562,6 @@ static int rt2800_init_registers(struct
1526 - rt2800_register_read(rt2x00dev, BCN_OFFSET0, ®);
1527 - rt2x00_set_field32(®, BCN_OFFSET0_BCN0,
1528 - rt2800_get_beacon_offset(rt2x00dev, 0));
1529 - rt2x00_set_field32(®, BCN_OFFSET0_BCN1,
1530 - rt2800_get_beacon_offset(rt2x00dev, 1));
1531 - rt2x00_set_field32(®, BCN_OFFSET0_BCN2,
1532 - rt2800_get_beacon_offset(rt2x00dev, 2));
1533 - rt2x00_set_field32(®, BCN_OFFSET0_BCN3,
1534 - rt2800_get_beacon_offset(rt2x00dev, 3));
1535 - rt2800_register_write(rt2x00dev, BCN_OFFSET0, reg);
1537 - rt2800_register_read(rt2x00dev, BCN_OFFSET1, ®);
1538 - rt2x00_set_field32(®, BCN_OFFSET1_BCN4,
1539 - rt2800_get_beacon_offset(rt2x00dev, 4));
1540 - rt2x00_set_field32(®, BCN_OFFSET1_BCN5,
1541 - rt2800_get_beacon_offset(rt2x00dev, 5));
1542 - rt2x00_set_field32(®, BCN_OFFSET1_BCN6,
1543 - rt2800_get_beacon_offset(rt2x00dev, 6));
1544 - rt2x00_set_field32(®, BCN_OFFSET1_BCN7,
1545 - rt2800_get_beacon_offset(rt2x00dev, 7));
1546 - rt2800_register_write(rt2x00dev, BCN_OFFSET1, reg);
1548 rt2800_register_write(rt2x00dev, LEGACY_BASIC_RATE, 0x0000013f);
1549 rt2800_register_write(rt2x00dev, HT_BASIC_RATE, 0x00008003);
1551 --- a/drivers/net/wireless/rt2x00/rt2x00dev.c
1552 +++ b/drivers/net/wireless/rt2x00/rt2x00dev.c
1553 @@ -141,8 +141,11 @@ static void rt2x00lib_intf_scheduled_ite
1554 if (!test_bit(DEVICE_STATE_ENABLED_RADIO, &rt2x00dev->flags))
1557 - if (test_and_clear_bit(DELAYED_UPDATE_BEACON, &intf->delayed_flags))
1558 + if (test_and_clear_bit(DELAYED_UPDATE_BEACON, &intf->delayed_flags)) {
1559 + mutex_lock(&intf->beacon_skb_mutex);
1560 rt2x00queue_update_beacon(rt2x00dev, vif);
1561 + mutex_unlock(&intf->beacon_skb_mutex);
1565 static void rt2x00lib_intf_scheduled(struct work_struct *work)
1566 @@ -216,7 +219,7 @@ static void rt2x00lib_beaconupdate_iter(
1567 * never be called for USB devices.
1569 WARN_ON(rt2x00_is_usb(rt2x00dev));
1570 - rt2x00queue_update_beacon_locked(rt2x00dev, vif);
1571 + rt2x00queue_update_beacon(rt2x00dev, vif);
1574 void rt2x00lib_beacondone(struct rt2x00_dev *rt2x00dev)
1575 --- a/drivers/net/wireless/rt2x00/rt2x00mac.c
1576 +++ b/drivers/net/wireless/rt2x00/rt2x00mac.c
1577 @@ -487,6 +487,8 @@ int rt2x00mac_set_key(struct ieee80211_h
1578 crypto.cipher = rt2x00crypto_key_to_cipher(key);
1579 if (crypto.cipher == CIPHER_NONE)
1581 + if (crypto.cipher == CIPHER_TKIP && rt2x00_is_usb(rt2x00dev))
1582 + return -EOPNOTSUPP;
1586 @@ -624,25 +626,24 @@ void rt2x00mac_bss_info_changed(struct i
1587 * Start/stop beaconing.
1589 if (changes & BSS_CHANGED_BEACON_ENABLED) {
1590 + mutex_lock(&intf->beacon_skb_mutex);
1591 if (!bss_conf->enable_beacon && intf->enable_beacon) {
1592 rt2x00dev->intf_beaconing--;
1593 intf->enable_beacon = false;
1595 - * Clear beacon in the H/W for this vif. This is needed
1596 - * to disable beaconing on this particular interface
1597 - * and keep it running on other interfaces.
1599 - rt2x00queue_clear_beacon(rt2x00dev, vif);
1601 if (rt2x00dev->intf_beaconing == 0) {
1603 * Last beaconing interface disabled
1604 * -> stop beacon queue.
1606 - mutex_lock(&intf->beacon_skb_mutex);
1607 rt2x00queue_stop_queue(rt2x00dev->bcn);
1608 - mutex_unlock(&intf->beacon_skb_mutex);
1611 + * Clear beacon in the H/W for this vif. This is needed
1612 + * to disable beaconing on this particular interface
1613 + * and keep it running on other interfaces.
1615 + rt2x00queue_clear_beacon(rt2x00dev, vif);
1616 } else if (bss_conf->enable_beacon && !intf->enable_beacon) {
1617 rt2x00dev->intf_beaconing++;
1618 intf->enable_beacon = true;
1619 @@ -658,11 +659,10 @@ void rt2x00mac_bss_info_changed(struct i
1620 * First beaconing interface enabled
1621 * -> start beacon queue.
1623 - mutex_lock(&intf->beacon_skb_mutex);
1624 rt2x00queue_start_queue(rt2x00dev->bcn);
1625 - mutex_unlock(&intf->beacon_skb_mutex);
1628 + mutex_unlock(&intf->beacon_skb_mutex);
1632 --- a/drivers/net/wireless/rt2x00/rt2x00queue.c
1633 +++ b/drivers/net/wireless/rt2x00/rt2x00queue.c
1634 @@ -754,8 +754,6 @@ int rt2x00queue_clear_beacon(struct rt2x
1635 if (unlikely(!intf->beacon))
1638 - mutex_lock(&intf->beacon_skb_mutex);
1641 * Clean up the beacon skb.
1643 @@ -768,13 +766,11 @@ int rt2x00queue_clear_beacon(struct rt2x
1644 if (rt2x00dev->ops->lib->clear_beacon)
1645 rt2x00dev->ops->lib->clear_beacon(intf->beacon);
1647 - mutex_unlock(&intf->beacon_skb_mutex);
1652 -int rt2x00queue_update_beacon_locked(struct rt2x00_dev *rt2x00dev,
1653 - struct ieee80211_vif *vif)
1654 +int rt2x00queue_update_beacon(struct rt2x00_dev *rt2x00dev,
1655 + struct ieee80211_vif *vif)
1657 struct rt2x00_intf *intf = vif_to_intf(vif);
1658 struct skb_frame_desc *skbdesc;
1659 @@ -815,19 +811,6 @@ int rt2x00queue_update_beacon_locked(str
1663 -int rt2x00queue_update_beacon(struct rt2x00_dev *rt2x00dev,
1664 - struct ieee80211_vif *vif)
1666 - struct rt2x00_intf *intf = vif_to_intf(vif);
1669 - mutex_lock(&intf->beacon_skb_mutex);
1670 - ret = rt2x00queue_update_beacon_locked(rt2x00dev, vif);
1671 - mutex_unlock(&intf->beacon_skb_mutex);
1676 bool rt2x00queue_for_each_entry(struct data_queue *queue,
1677 enum queue_index start,
1678 enum queue_index end,
1679 --- a/drivers/net/wireless/rt2x00/rt2x00queue.h
1680 +++ b/drivers/net/wireless/rt2x00/rt2x00queue.h
1681 @@ -353,6 +353,7 @@ struct txentry_desc {
1683 enum queue_entry_flags {
1685 + ENTRY_BCN_ENABLED,
1686 ENTRY_OWNER_DEVICE_DATA,
1688 ENTRY_DATA_IO_FAILED,
1689 --- a/drivers/net/wireless/ath/ath9k/main.c
1690 +++ b/drivers/net/wireless/ath/ath9k/main.c
1691 @@ -1757,7 +1757,6 @@ out:
1692 void ath9k_update_p2p_ps(struct ath_softc *sc, struct ieee80211_vif *vif)
1694 struct ath_vif *avp = (void *)vif->drv_priv;
1695 - unsigned long flags;
1698 if (!sc->p2p_ps_timer)
1699 @@ -1767,14 +1766,9 @@ void ath9k_update_p2p_ps(struct ath_soft
1702 sc->p2p_ps_vif = avp;
1704 - spin_lock_irqsave(&sc->sc_pm_lock, flags);
1705 - if (!(sc->ps_flags & PS_BEACON_SYNC)) {
1706 - tsf = ath9k_hw_gettsf32(sc->sc_ah);
1707 - ieee80211_parse_p2p_noa(&vif->bss_conf.p2p_noa_attr, &avp->noa, tsf);
1708 - ath9k_update_p2p_ps_timer(sc, avp);
1710 - spin_unlock_irqrestore(&sc->sc_pm_lock, flags);
1711 + tsf = ath9k_hw_gettsf32(sc->sc_ah);
1712 + ieee80211_parse_p2p_noa(&vif->bss_conf.p2p_noa_attr, &avp->noa, tsf);
1713 + ath9k_update_p2p_ps_timer(sc, avp);
1716 static void ath9k_bss_info_changed(struct ieee80211_hw *hw,
1717 @@ -1791,6 +1785,7 @@ static void ath9k_bss_info_changed(struc
1718 struct ath_hw *ah = sc->sc_ah;
1719 struct ath_common *common = ath9k_hw_common(ah);
1720 struct ath_vif *avp = (void *)vif->drv_priv;
1721 + unsigned long flags;
1724 ath9k_ps_wakeup(sc);
1725 @@ -1853,7 +1848,10 @@ static void ath9k_bss_info_changed(struc
1727 if (changed & BSS_CHANGED_P2P_PS) {
1728 spin_lock_bh(&sc->sc_pcu_lock);
1729 - ath9k_update_p2p_ps(sc, vif);
1730 + spin_lock_irqsave(&sc->sc_pm_lock, flags);
1731 + if (!(sc->ps_flags & PS_BEACON_SYNC))
1732 + ath9k_update_p2p_ps(sc, vif);
1733 + spin_unlock_irqrestore(&sc->sc_pm_lock, flags);
1734 spin_unlock_bh(&sc->sc_pcu_lock);
1737 @@ -2232,14 +2230,6 @@ static void ath9k_sw_scan_complete(struc
1738 clear_bit(ATH_OP_SCANNING, &common->op_flags);
1741 -static void ath9k_channel_switch_beacon(struct ieee80211_hw *hw,
1742 - struct ieee80211_vif *vif,
1743 - struct cfg80211_chan_def *chandef)
1745 - /* depend on vif->csa_active only */
1749 struct ieee80211_ops ath9k_ops = {
1751 .start = ath9k_start,
1752 @@ -2287,5 +2277,4 @@ struct ieee80211_ops ath9k_ops = {
1754 .sw_scan_start = ath9k_sw_scan_start,
1755 .sw_scan_complete = ath9k_sw_scan_complete,
1756 - .channel_switch_beacon = ath9k_channel_switch_beacon,
1758 --- a/drivers/net/wireless/ath/ath10k/mac.c
1759 +++ b/drivers/net/wireless/ath/ath10k/mac.c
1760 @@ -4142,14 +4142,6 @@ static int ath10k_set_bitrate_mask(struc
1761 fixed_nss, force_sgi);
1764 -static void ath10k_channel_switch_beacon(struct ieee80211_hw *hw,
1765 - struct ieee80211_vif *vif,
1766 - struct cfg80211_chan_def *chandef)
1768 - /* there's no need to do anything here. vif->csa_active is enough */
1772 static void ath10k_sta_rc_update(struct ieee80211_hw *hw,
1773 struct ieee80211_vif *vif,
1774 struct ieee80211_sta *sta,
1775 @@ -4256,7 +4248,6 @@ static const struct ieee80211_ops ath10k
1776 .restart_complete = ath10k_restart_complete,
1777 .get_survey = ath10k_get_survey,
1778 .set_bitrate_mask = ath10k_set_bitrate_mask,
1779 - .channel_switch_beacon = ath10k_channel_switch_beacon,
1780 .sta_rc_update = ath10k_sta_rc_update,
1781 .get_tsf = ath10k_get_tsf,
1783 --- a/net/mac80211/cfg.c
1784 +++ b/net/mac80211/cfg.c
1785 @@ -468,327 +468,6 @@ void sta_set_rate_info_rx(struct sta_inf
1786 rinfo->flags |= RATE_INFO_FLAGS_160_MHZ_WIDTH;
1789 -static void sta_set_sinfo(struct sta_info *sta, struct station_info *sinfo)
1791 - struct ieee80211_sub_if_data *sdata = sta->sdata;
1792 - struct ieee80211_local *local = sdata->local;
1793 - struct rate_control_ref *ref = local->rate_ctrl;
1794 - struct timespec uptime;
1799 - sinfo->generation = sdata->local->sta_generation;
1801 - sinfo->filled = STATION_INFO_INACTIVE_TIME |
1802 - STATION_INFO_RX_BYTES64 |
1803 - STATION_INFO_TX_BYTES64 |
1804 - STATION_INFO_RX_PACKETS |
1805 - STATION_INFO_TX_PACKETS |
1806 - STATION_INFO_TX_RETRIES |
1807 - STATION_INFO_TX_FAILED |
1808 - STATION_INFO_TX_BITRATE |
1809 - STATION_INFO_RX_BITRATE |
1810 - STATION_INFO_RX_DROP_MISC |
1811 - STATION_INFO_BSS_PARAM |
1812 - STATION_INFO_CONNECTED_TIME |
1813 - STATION_INFO_STA_FLAGS |
1814 - STATION_INFO_BEACON_LOSS_COUNT;
1816 - do_posix_clock_monotonic_gettime(&uptime);
1817 - sinfo->connected_time = uptime.tv_sec - sta->last_connected;
1819 - sinfo->inactive_time = jiffies_to_msecs(jiffies - sta->last_rx);
1820 - sinfo->tx_bytes = 0;
1821 - for (ac = 0; ac < IEEE80211_NUM_ACS; ac++) {
1822 - sinfo->tx_bytes += sta->tx_bytes[ac];
1823 - packets += sta->tx_packets[ac];
1825 - sinfo->tx_packets = packets;
1826 - sinfo->rx_bytes = sta->rx_bytes;
1827 - sinfo->rx_packets = sta->rx_packets;
1828 - sinfo->tx_retries = sta->tx_retry_count;
1829 - sinfo->tx_failed = sta->tx_retry_failed;
1830 - sinfo->rx_dropped_misc = sta->rx_dropped;
1831 - sinfo->beacon_loss_count = sta->beacon_loss_count;
1833 - if ((sta->local->hw.flags & IEEE80211_HW_SIGNAL_DBM) ||
1834 - (sta->local->hw.flags & IEEE80211_HW_SIGNAL_UNSPEC)) {
1835 - sinfo->filled |= STATION_INFO_SIGNAL | STATION_INFO_SIGNAL_AVG;
1836 - if (!local->ops->get_rssi ||
1837 - drv_get_rssi(local, sdata, &sta->sta, &sinfo->signal))
1838 - sinfo->signal = (s8)sta->last_signal;
1839 - sinfo->signal_avg = (s8) -ewma_read(&sta->avg_signal);
1841 - if (sta->chains) {
1842 - sinfo->filled |= STATION_INFO_CHAIN_SIGNAL |
1843 - STATION_INFO_CHAIN_SIGNAL_AVG;
1845 - sinfo->chains = sta->chains;
1846 - for (i = 0; i < ARRAY_SIZE(sinfo->chain_signal); i++) {
1847 - sinfo->chain_signal[i] = sta->chain_signal_last[i];
1848 - sinfo->chain_signal_avg[i] =
1849 - (s8) -ewma_read(&sta->chain_signal_avg[i]);
1853 - sta_set_rate_info_tx(sta, &sta->last_tx_rate, &sinfo->txrate);
1854 - sta_set_rate_info_rx(sta, &sinfo->rxrate);
1856 - if (ieee80211_vif_is_mesh(&sdata->vif)) {
1857 -#ifdef CPTCFG_MAC80211_MESH
1858 - sinfo->filled |= STATION_INFO_LLID |
1859 - STATION_INFO_PLID |
1860 - STATION_INFO_PLINK_STATE |
1861 - STATION_INFO_LOCAL_PM |
1862 - STATION_INFO_PEER_PM |
1863 - STATION_INFO_NONPEER_PM;
1865 - sinfo->llid = sta->llid;
1866 - sinfo->plid = sta->plid;
1867 - sinfo->plink_state = sta->plink_state;
1868 - if (test_sta_flag(sta, WLAN_STA_TOFFSET_KNOWN)) {
1869 - sinfo->filled |= STATION_INFO_T_OFFSET;
1870 - sinfo->t_offset = sta->t_offset;
1872 - sinfo->local_pm = sta->local_pm;
1873 - sinfo->peer_pm = sta->peer_pm;
1874 - sinfo->nonpeer_pm = sta->nonpeer_pm;
1878 - sinfo->bss_param.flags = 0;
1879 - if (sdata->vif.bss_conf.use_cts_prot)
1880 - sinfo->bss_param.flags |= BSS_PARAM_FLAGS_CTS_PROT;
1881 - if (sdata->vif.bss_conf.use_short_preamble)
1882 - sinfo->bss_param.flags |= BSS_PARAM_FLAGS_SHORT_PREAMBLE;
1883 - if (sdata->vif.bss_conf.use_short_slot)
1884 - sinfo->bss_param.flags |= BSS_PARAM_FLAGS_SHORT_SLOT_TIME;
1885 - sinfo->bss_param.dtim_period = sdata->local->hw.conf.ps_dtim_period;
1886 - sinfo->bss_param.beacon_interval = sdata->vif.bss_conf.beacon_int;
1888 - sinfo->sta_flags.set = 0;
1889 - sinfo->sta_flags.mask = BIT(NL80211_STA_FLAG_AUTHORIZED) |
1890 - BIT(NL80211_STA_FLAG_SHORT_PREAMBLE) |
1891 - BIT(NL80211_STA_FLAG_WME) |
1892 - BIT(NL80211_STA_FLAG_MFP) |
1893 - BIT(NL80211_STA_FLAG_AUTHENTICATED) |
1894 - BIT(NL80211_STA_FLAG_ASSOCIATED) |
1895 - BIT(NL80211_STA_FLAG_TDLS_PEER);
1896 - if (test_sta_flag(sta, WLAN_STA_AUTHORIZED))
1897 - sinfo->sta_flags.set |= BIT(NL80211_STA_FLAG_AUTHORIZED);
1898 - if (test_sta_flag(sta, WLAN_STA_SHORT_PREAMBLE))
1899 - sinfo->sta_flags.set |= BIT(NL80211_STA_FLAG_SHORT_PREAMBLE);
1900 - if (test_sta_flag(sta, WLAN_STA_WME))
1901 - sinfo->sta_flags.set |= BIT(NL80211_STA_FLAG_WME);
1902 - if (test_sta_flag(sta, WLAN_STA_MFP))
1903 - sinfo->sta_flags.set |= BIT(NL80211_STA_FLAG_MFP);
1904 - if (test_sta_flag(sta, WLAN_STA_AUTH))
1905 - sinfo->sta_flags.set |= BIT(NL80211_STA_FLAG_AUTHENTICATED);
1906 - if (test_sta_flag(sta, WLAN_STA_ASSOC))
1907 - sinfo->sta_flags.set |= BIT(NL80211_STA_FLAG_ASSOCIATED);
1908 - if (test_sta_flag(sta, WLAN_STA_TDLS_PEER))
1909 - sinfo->sta_flags.set |= BIT(NL80211_STA_FLAG_TDLS_PEER);
1911 - /* check if the driver has a SW RC implementation */
1912 - if (ref && ref->ops->get_expected_throughput)
1913 - thr = ref->ops->get_expected_throughput(sta->rate_ctrl_priv);
1915 - thr = drv_get_expected_throughput(local, &sta->sta);
1918 - sinfo->filled |= STATION_INFO_EXPECTED_THROUGHPUT;
1919 - sinfo->expected_throughput = thr;
1923 -static const char ieee80211_gstrings_sta_stats[][ETH_GSTRING_LEN] = {
1924 - "rx_packets", "rx_bytes", "wep_weak_iv_count",
1925 - "rx_duplicates", "rx_fragments", "rx_dropped",
1926 - "tx_packets", "tx_bytes", "tx_fragments",
1927 - "tx_filtered", "tx_retry_failed", "tx_retries",
1928 - "beacon_loss", "sta_state", "txrate", "rxrate", "signal",
1929 - "channel", "noise", "ch_time", "ch_time_busy",
1930 - "ch_time_ext_busy", "ch_time_rx", "ch_time_tx"
1932 -#define STA_STATS_LEN ARRAY_SIZE(ieee80211_gstrings_sta_stats)
1934 -static int ieee80211_get_et_sset_count(struct wiphy *wiphy,
1935 - struct net_device *dev,
1938 - struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev);
1941 - if (sset == ETH_SS_STATS)
1942 - rv += STA_STATS_LEN;
1944 - rv += drv_get_et_sset_count(sdata, sset);
1947 - return -EOPNOTSUPP;
1951 -static void ieee80211_get_et_stats(struct wiphy *wiphy,
1952 - struct net_device *dev,
1953 - struct ethtool_stats *stats,
1956 - struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev);
1957 - struct ieee80211_chanctx_conf *chanctx_conf;
1958 - struct ieee80211_channel *channel;
1959 - struct sta_info *sta;
1960 - struct ieee80211_local *local = sdata->local;
1961 - struct station_info sinfo;
1962 - struct survey_info survey;
1964 -#define STA_STATS_SURVEY_LEN 7
1966 - memset(data, 0, sizeof(u64) * STA_STATS_LEN);
1968 -#define ADD_STA_STATS(sta) \
1970 - data[i++] += sta->rx_packets; \
1971 - data[i++] += sta->rx_bytes; \
1972 - data[i++] += sta->wep_weak_iv_count; \
1973 - data[i++] += sta->num_duplicates; \
1974 - data[i++] += sta->rx_fragments; \
1975 - data[i++] += sta->rx_dropped; \
1977 - data[i++] += sinfo.tx_packets; \
1978 - data[i++] += sinfo.tx_bytes; \
1979 - data[i++] += sta->tx_fragments; \
1980 - data[i++] += sta->tx_filtered_count; \
1981 - data[i++] += sta->tx_retry_failed; \
1982 - data[i++] += sta->tx_retry_count; \
1983 - data[i++] += sta->beacon_loss_count; \
1986 - /* For Managed stations, find the single station based on BSSID
1987 - * and use that. For interface types, iterate through all available
1988 - * stations and add stats for any station that is assigned to this
1992 - mutex_lock(&local->sta_mtx);
1994 - if (sdata->vif.type == NL80211_IFTYPE_STATION) {
1995 - sta = sta_info_get_bss(sdata, sdata->u.mgd.bssid);
1997 - if (!(sta && !WARN_ON(sta->sdata->dev != dev)))
2001 - sta_set_sinfo(sta, &sinfo);
2004 - ADD_STA_STATS(sta);
2006 - data[i++] = sta->sta_state;
2009 - if (sinfo.filled & STATION_INFO_TX_BITRATE)
2010 - data[i] = 100000 *
2011 - cfg80211_calculate_bitrate(&sinfo.txrate);
2013 - if (sinfo.filled & STATION_INFO_RX_BITRATE)
2014 - data[i] = 100000 *
2015 - cfg80211_calculate_bitrate(&sinfo.rxrate);
2018 - if (sinfo.filled & STATION_INFO_SIGNAL_AVG)
2019 - data[i] = (u8)sinfo.signal_avg;
2022 - list_for_each_entry(sta, &local->sta_list, list) {
2023 - /* Make sure this station belongs to the proper dev */
2024 - if (sta->sdata->dev != dev)
2028 - sta_set_sinfo(sta, &sinfo);
2030 - ADD_STA_STATS(sta);
2035 - i = STA_STATS_LEN - STA_STATS_SURVEY_LEN;
2036 - /* Get survey stats for current channel */
2037 - survey.filled = 0;
2040 - chanctx_conf = rcu_dereference(sdata->vif.chanctx_conf);
2042 - channel = chanctx_conf->def.chan;
2045 - rcu_read_unlock();
2050 - survey.filled = 0;
2051 - if (drv_get_survey(local, q, &survey) != 0) {
2052 - survey.filled = 0;
2056 - } while (channel != survey.channel);
2059 - if (survey.filled)
2060 - data[i++] = survey.channel->center_freq;
2063 - if (survey.filled & SURVEY_INFO_NOISE_DBM)
2064 - data[i++] = (u8)survey.noise;
2067 - if (survey.filled & SURVEY_INFO_CHANNEL_TIME)
2068 - data[i++] = survey.channel_time;
2071 - if (survey.filled & SURVEY_INFO_CHANNEL_TIME_BUSY)
2072 - data[i++] = survey.channel_time_busy;
2075 - if (survey.filled & SURVEY_INFO_CHANNEL_TIME_EXT_BUSY)
2076 - data[i++] = survey.channel_time_ext_busy;
2079 - if (survey.filled & SURVEY_INFO_CHANNEL_TIME_RX)
2080 - data[i++] = survey.channel_time_rx;
2083 - if (survey.filled & SURVEY_INFO_CHANNEL_TIME_TX)
2084 - data[i++] = survey.channel_time_tx;
2088 - mutex_unlock(&local->sta_mtx);
2090 - if (WARN_ON(i != STA_STATS_LEN))
2093 - drv_get_et_stats(sdata, stats, &(data[STA_STATS_LEN]));
2096 -static void ieee80211_get_et_strings(struct wiphy *wiphy,
2097 - struct net_device *dev,
2098 - u32 sset, u8 *data)
2100 - struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev);
2101 - int sz_sta_stats = 0;
2103 - if (sset == ETH_SS_STATS) {
2104 - sz_sta_stats = sizeof(ieee80211_gstrings_sta_stats);
2105 - memcpy(data, ieee80211_gstrings_sta_stats, sz_sta_stats);
2107 - drv_get_et_strings(sdata, sset, &(data[sz_sta_stats]));
2110 static int ieee80211_dump_station(struct wiphy *wiphy, struct net_device *dev,
2111 int idx, u8 *mac, struct station_info *sinfo)
2113 @@ -875,7 +554,8 @@ static int ieee80211_set_monitor_channel
2116 static int ieee80211_set_probe_resp(struct ieee80211_sub_if_data *sdata,
2117 - const u8 *resp, size_t resp_len)
2118 + const u8 *resp, size_t resp_len,
2119 + const struct ieee80211_csa_settings *csa)
2121 struct probe_resp *new, *old;
2123 @@ -891,6 +571,11 @@ static int ieee80211_set_probe_resp(stru
2124 new->len = resp_len;
2125 memcpy(new->data, resp, resp_len);
2128 + memcpy(new->csa_counter_offsets, csa->counter_offsets_presp,
2129 + csa->n_counter_offsets_presp *
2130 + sizeof(new->csa_counter_offsets[0]));
2132 rcu_assign_pointer(sdata->u.ap.probe_resp, new);
2134 kfree_rcu(old, rcu_head);
2135 @@ -899,7 +584,8 @@ static int ieee80211_set_probe_resp(stru
2138 static int ieee80211_assign_beacon(struct ieee80211_sub_if_data *sdata,
2139 - struct cfg80211_beacon_data *params)
2140 + struct cfg80211_beacon_data *params,
2141 + const struct ieee80211_csa_settings *csa)
2143 struct beacon_data *new, *old;
2144 int new_head_len, new_tail_len;
2145 @@ -943,6 +629,13 @@ static int ieee80211_assign_beacon(struc
2146 new->head_len = new_head_len;
2147 new->tail_len = new_tail_len;
2150 + new->csa_current_counter = csa->count;
2151 + memcpy(new->csa_counter_offsets, csa->counter_offsets_beacon,
2152 + csa->n_counter_offsets_beacon *
2153 + sizeof(new->csa_counter_offsets[0]));
2158 memcpy(new->head, params->head, new_head_len);
2159 @@ -957,7 +650,7 @@ static int ieee80211_assign_beacon(struc
2160 memcpy(new->tail, old->tail, new_tail_len);
2162 err = ieee80211_set_probe_resp(sdata, params->probe_resp,
2163 - params->probe_resp_len);
2164 + params->probe_resp_len, csa);
2168 @@ -1042,7 +735,7 @@ static int ieee80211_start_ap(struct wip
2169 sdata->vif.bss_conf.p2p_noa_attr.oppps_ctwindow |=
2170 IEEE80211_P2P_OPPPS_ENABLE_BIT;
2172 - err = ieee80211_assign_beacon(sdata, ¶ms->beacon);
2173 + err = ieee80211_assign_beacon(sdata, ¶ms->beacon, NULL);
2175 ieee80211_vif_release_channel(sdata);
2177 @@ -1090,7 +783,7 @@ static int ieee80211_change_beacon(struc
2181 - err = ieee80211_assign_beacon(sdata, params);
2182 + err = ieee80211_assign_beacon(sdata, params, NULL);
2185 ieee80211_bss_info_change_notify(sdata, err);
2186 @@ -1164,7 +857,6 @@ static int ieee80211_stop_ap(struct wiph
2187 sdata->u.ap.driver_smps_mode = IEEE80211_SMPS_OFF;
2189 __sta_info_flush(sdata, true);
2190 - ieee80211_free_keys(sdata, true);
2192 sdata->vif.bss_conf.enable_beacon = false;
2193 sdata->vif.bss_conf.ssid_len = 0;
2194 @@ -3073,7 +2765,8 @@ static int ieee80211_set_after_csa_beaco
2196 switch (sdata->vif.type) {
2197 case NL80211_IFTYPE_AP:
2198 - err = ieee80211_assign_beacon(sdata, sdata->u.ap.next_beacon);
2199 + err = ieee80211_assign_beacon(sdata, sdata->u.ap.next_beacon,
2201 kfree(sdata->u.ap.next_beacon);
2202 sdata->u.ap.next_beacon = NULL;
2204 @@ -3176,6 +2869,7 @@ static int ieee80211_set_csa_beacon(stru
2205 struct cfg80211_csa_settings *params,
2208 + struct ieee80211_csa_settings csa = {};
2211 switch (sdata->vif.type) {
2212 @@ -3210,20 +2904,13 @@ static int ieee80211_set_csa_beacon(stru
2213 IEEE80211_MAX_CSA_COUNTERS_NUM))
2216 - /* make sure we don't have garbage in other counters */
2217 - memset(sdata->csa_counter_offset_beacon, 0,
2218 - sizeof(sdata->csa_counter_offset_beacon));
2219 - memset(sdata->csa_counter_offset_presp, 0,
2220 - sizeof(sdata->csa_counter_offset_presp));
2222 - memcpy(sdata->csa_counter_offset_beacon,
2223 - params->counter_offsets_beacon,
2224 - params->n_counter_offsets_beacon * sizeof(u16));
2225 - memcpy(sdata->csa_counter_offset_presp,
2226 - params->counter_offsets_presp,
2227 - params->n_counter_offsets_presp * sizeof(u16));
2228 + csa.counter_offsets_beacon = params->counter_offsets_beacon;
2229 + csa.counter_offsets_presp = params->counter_offsets_presp;
2230 + csa.n_counter_offsets_beacon = params->n_counter_offsets_beacon;
2231 + csa.n_counter_offsets_presp = params->n_counter_offsets_presp;
2232 + csa.count = params->count;
2234 - err = ieee80211_assign_beacon(sdata, ¶ms->beacon_csa);
2235 + err = ieee80211_assign_beacon(sdata, ¶ms->beacon_csa, &csa);
2237 kfree(sdata->u.ap.next_beacon);
2239 @@ -3367,7 +3054,6 @@ __ieee80211_channel_switch(struct wiphy
2240 sdata->csa_radar_required = params->radar_required;
2241 sdata->csa_chandef = params->chandef;
2242 sdata->csa_block_tx = params->block_tx;
2243 - sdata->csa_current_counter = params->count;
2244 sdata->vif.csa_active = true;
2246 if (sdata->csa_block_tx)
2247 @@ -3515,10 +3201,23 @@ static int ieee80211_mgmt_tx(struct wiph
2248 sdata->vif.type == NL80211_IFTYPE_ADHOC) &&
2249 params->n_csa_offsets) {
2251 - u8 c = sdata->csa_current_counter;
2252 + struct beacon_data *beacon = NULL;
2256 - for (i = 0; i < params->n_csa_offsets; i++)
2257 - data[params->csa_offsets[i]] = c;
2258 + if (sdata->vif.type == NL80211_IFTYPE_AP)
2259 + beacon = rcu_dereference(sdata->u.ap.beacon);
2260 + else if (sdata->vif.type == NL80211_IFTYPE_ADHOC)
2261 + beacon = rcu_dereference(sdata->u.ibss.presp);
2262 + else if (ieee80211_vif_is_mesh(&sdata->vif))
2263 + beacon = rcu_dereference(sdata->u.mesh.beacon);
2266 + for (i = 0; i < params->n_csa_offsets; i++)
2267 + data[params->csa_offsets[i]] =
2268 + beacon->csa_current_counter;
2270 + rcu_read_unlock();
2273 IEEE80211_SKB_CB(skb)->flags = flags;
2274 @@ -3598,21 +3297,6 @@ static int ieee80211_get_antenna(struct
2275 return drv_get_antenna(local, tx_ant, rx_ant);
2278 -static int ieee80211_set_ringparam(struct wiphy *wiphy, u32 tx, u32 rx)
2280 - struct ieee80211_local *local = wiphy_priv(wiphy);
2282 - return drv_set_ringparam(local, tx, rx);
2285 -static void ieee80211_get_ringparam(struct wiphy *wiphy,
2286 - u32 *tx, u32 *tx_max, u32 *rx, u32 *rx_max)
2288 - struct ieee80211_local *local = wiphy_priv(wiphy);
2290 - drv_get_ringparam(local, tx, tx_max, rx, rx_max);
2293 static int ieee80211_set_rekey_data(struct wiphy *wiphy,
2294 struct net_device *dev,
2295 struct cfg80211_gtk_rekey_data *data)
2296 @@ -3844,8 +3528,6 @@ const struct cfg80211_ops mac80211_confi
2297 .mgmt_frame_register = ieee80211_mgmt_frame_register,
2298 .set_antenna = ieee80211_set_antenna,
2299 .get_antenna = ieee80211_get_antenna,
2300 - .set_ringparam = ieee80211_set_ringparam,
2301 - .get_ringparam = ieee80211_get_ringparam,
2302 .set_rekey_data = ieee80211_set_rekey_data,
2303 .tdls_oper = ieee80211_tdls_oper,
2304 .tdls_mgmt = ieee80211_tdls_mgmt,
2305 @@ -3854,9 +3536,6 @@ const struct cfg80211_ops mac80211_confi
2307 .set_wakeup = ieee80211_set_wakeup,
2309 - .get_et_sset_count = ieee80211_get_et_sset_count,
2310 - .get_et_stats = ieee80211_get_et_stats,
2311 - .get_et_strings = ieee80211_get_et_strings,
2312 .get_channel = ieee80211_cfg_get_channel,
2313 .start_radar_detection = ieee80211_start_radar_detection,
2314 .channel_switch = ieee80211_channel_switch,
2315 --- a/net/mac80211/debugfs_sta.c
2316 +++ b/net/mac80211/debugfs_sta.c
2317 @@ -587,7 +587,6 @@ void ieee80211_sta_debugfs_add(struct st
2318 DEBUGFS_ADD_COUNTER(tx_filtered, tx_filtered_count);
2319 DEBUGFS_ADD_COUNTER(tx_retry_failed, tx_retry_failed);
2320 DEBUGFS_ADD_COUNTER(tx_retry_count, tx_retry_count);
2321 - DEBUGFS_ADD_COUNTER(wep_weak_iv_count, wep_weak_iv_count);
2323 if (sizeof(sta->driver_buffered_tids) == sizeof(u32))
2324 debugfs_create_x32("driver_buffered_tids", 0400,
2325 --- a/net/mac80211/wep.c
2326 +++ b/net/mac80211/wep.c
2327 @@ -271,22 +271,6 @@ static int ieee80211_wep_decrypt(struct
2332 -static bool ieee80211_wep_is_weak_iv(struct sk_buff *skb,
2333 - struct ieee80211_key *key)
2335 - struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data;
2336 - unsigned int hdrlen;
2340 - hdrlen = ieee80211_hdrlen(hdr->frame_control);
2341 - ivpos = skb->data + hdrlen;
2342 - iv = (ivpos[0] << 16) | (ivpos[1] << 8) | ivpos[2];
2344 - return ieee80211_wep_weak_iv(iv, key->conf.keylen);
2348 ieee80211_crypto_wep_decrypt(struct ieee80211_rx_data *rx)
2350 @@ -301,16 +285,12 @@ ieee80211_crypto_wep_decrypt(struct ieee
2351 if (!(status->flag & RX_FLAG_DECRYPTED)) {
2352 if (skb_linearize(rx->skb))
2353 return RX_DROP_UNUSABLE;
2354 - if (rx->sta && ieee80211_wep_is_weak_iv(rx->skb, rx->key))
2355 - rx->sta->wep_weak_iv_count++;
2356 if (ieee80211_wep_decrypt(rx->local, rx->skb, rx->key))
2357 return RX_DROP_UNUSABLE;
2358 } else if (!(status->flag & RX_FLAG_IV_STRIPPED)) {
2359 if (!pskb_may_pull(rx->skb, ieee80211_hdrlen(fc) +
2360 IEEE80211_WEP_IV_LEN))
2361 return RX_DROP_UNUSABLE;
2362 - if (rx->sta && ieee80211_wep_is_weak_iv(rx->skb, rx->key))
2363 - rx->sta->wep_weak_iv_count++;
2364 ieee80211_wep_remove_iv(rx->local, rx->skb, rx->key);
2366 if (pskb_trim(rx->skb, rx->skb->len - IEEE80211_WEP_ICV_LEN))
2367 --- a/include/net/cfg80211.h
2368 +++ b/include/net/cfg80211.h
2369 @@ -2278,16 +2278,6 @@ struct cfg80211_qos_map {
2371 * @set_noack_map: Set the NoAck Map for the TIDs.
2373 - * @get_et_sset_count: Ethtool API to get string-set count.
2374 - * See @ethtool_ops.get_sset_count
2376 - * @get_et_stats: Ethtool API to get a set of u64 stats.
2377 - * See @ethtool_ops.get_ethtool_stats
2379 - * @get_et_strings: Ethtool API to get a set of strings to describe stats
2380 - * and perhaps other supported types of ethtool data-sets.
2381 - * See @ethtool_ops.get_strings
2383 * @get_channel: Get the current operating channel for the virtual interface.
2384 * For monitor interfaces, it should return %NULL unless there's a single
2385 * current monitoring channel.
2386 @@ -2529,13 +2519,6 @@ struct cfg80211_ops {
2387 struct net_device *dev,
2390 - int (*get_et_sset_count)(struct wiphy *wiphy,
2391 - struct net_device *dev, int sset);
2392 - void (*get_et_stats)(struct wiphy *wiphy, struct net_device *dev,
2393 - struct ethtool_stats *stats, u64 *data);
2394 - void (*get_et_strings)(struct wiphy *wiphy, struct net_device *dev,
2395 - u32 sset, u8 *data);
2397 int (*get_channel)(struct wiphy *wiphy,
2398 struct wireless_dev *wdev,
2399 struct cfg80211_chan_def *chandef);
2400 @@ -4846,6 +4829,10 @@ void cfg80211_stop_iface(struct wiphy *w
2402 void cfg80211_shutdown_all_interfaces(struct wiphy *wiphy);
2405 +/* ethtool helper */
2406 +void cfg80211_get_drvinfo(struct net_device *dev, struct ethtool_drvinfo *info);
2408 /* Logging, debugging and troubleshooting/diagnostic helpers. */
2410 /* wiphy_printk helpers, similar to dev_printk */
2411 --- a/net/mac80211/Makefile
2412 +++ b/net/mac80211/Makefile
2413 @@ -17,6 +17,7 @@ mac80211-y := \
2421 --- a/net/mac80211/ieee80211_i.h
2422 +++ b/net/mac80211/ieee80211_i.h
2423 @@ -229,16 +229,29 @@ struct ieee80211_rx_data {
2427 +struct ieee80211_csa_settings {
2428 + const u16 *counter_offsets_beacon;
2429 + const u16 *counter_offsets_presp;
2431 + int n_counter_offsets_beacon;
2432 + int n_counter_offsets_presp;
2437 struct beacon_data {
2439 int head_len, tail_len;
2440 struct ieee80211_meshconf_ie *meshconf;
2441 + u16 csa_counter_offsets[IEEE80211_MAX_CSA_COUNTERS_NUM];
2442 + u8 csa_current_counter;
2443 struct rcu_head rcu_head;
2447 struct rcu_head rcu_head;
2449 + u16 csa_counter_offsets[IEEE80211_MAX_CSA_COUNTERS_NUM];
2453 @@ -754,8 +767,6 @@ struct ieee80211_sub_if_data {
2454 struct mac80211_qos_map __rcu *qos_map;
2456 struct work_struct csa_finalize_work;
2457 - u16 csa_counter_offset_beacon[IEEE80211_MAX_CSA_COUNTERS_NUM];
2458 - u16 csa_counter_offset_presp[IEEE80211_MAX_CSA_COUNTERS_NUM];
2459 bool csa_radar_required;
2460 bool csa_block_tx; /* write-protected by sdata_lock and local->mtx */
2461 struct cfg80211_chan_def csa_chandef;
2462 @@ -767,7 +778,6 @@ struct ieee80211_sub_if_data {
2463 struct ieee80211_chanctx *reserved_chanctx;
2464 struct cfg80211_chan_def reserved_chandef;
2465 bool reserved_radar_required;
2466 - u8 csa_current_counter;
2468 /* used to reconfigure hardware SM PS */
2469 struct work_struct recalc_smps;
2470 @@ -1850,6 +1860,8 @@ int ieee80211_tdls_oper(struct wiphy *wi
2471 const u8 *peer, enum nl80211_tdls_operation oper);
2474 +extern const struct ethtool_ops ieee80211_ethtool_ops;
2476 #ifdef CPTCFG_MAC80211_NOINLINE
2477 #define debug_noinline noinline
2479 --- a/net/mac80211/iface.c
2480 +++ b/net/mac80211/iface.c
2481 @@ -399,6 +399,7 @@ int ieee80211_add_virtual_monitor(struct
2482 sdata->vif.type = NL80211_IFTYPE_MONITOR;
2483 snprintf(sdata->name, IFNAMSIZ, "%s-monitor",
2484 wiphy_name(local->hw.wiphy));
2485 + sdata->wdev.iftype = NL80211_IFTYPE_MONITOR;
2487 sdata->encrypt_headroom = IEEE80211_ENCRYPT_HEADROOM;
2489 @@ -928,9 +929,6 @@ static void ieee80211_do_stop(struct iee
2492 ieee80211_free_keys(sdata, true);
2494 - /* fall through */
2495 - case NL80211_IFTYPE_AP:
2496 skb_queue_purge(&sdata->skb_queue);
2499 @@ -1303,6 +1301,7 @@ static void ieee80211_setup_sdata(struct
2500 sdata->control_port_protocol = cpu_to_be16(ETH_P_PAE);
2501 sdata->control_port_no_encrypt = false;
2502 sdata->encrypt_headroom = IEEE80211_ENCRYPT_HEADROOM;
2503 + sdata->vif.bss_conf.idle = true;
2505 sdata->noack_map = 0;
2507 @@ -1721,6 +1720,8 @@ int ieee80211_if_add(struct ieee80211_lo
2509 ndev->features |= local->hw.netdev_features;
2511 + netdev_set_default_ethtool_ops(ndev, &ieee80211_ethtool_ops);
2513 ret = register_netdevice(ndev);
2516 --- a/net/wireless/core.c
2517 +++ b/net/wireless/core.c
2520 #include "debugfs.h"
2521 #include "wext-compat.h"
2522 -#include "ethtool.h"
2523 #include "rdev-ops.h"
2525 /* name for sysfs, %d is appended */
2526 @@ -940,8 +939,6 @@ static int cfg80211_netdev_notifier_call
2527 /* allow mac80211 to determine the timeout */
2528 wdev->ps_timeout = -1;
2530 - netdev_set_default_ethtool_ops(dev, &cfg80211_ethtool_ops);
2532 if ((wdev->iftype == NL80211_IFTYPE_STATION ||
2533 wdev->iftype == NL80211_IFTYPE_P2P_CLIENT ||
2534 wdev->iftype == NL80211_IFTYPE_ADHOC) && !wdev->use_4addr)
2535 --- a/net/wireless/ethtool.c
2536 +++ b/net/wireless/ethtool.c
2538 #include <linux/utsname.h>
2539 #include <net/cfg80211.h>
2541 -#include "ethtool.h"
2542 #include "rdev-ops.h"
2544 -static void cfg80211_get_drvinfo(struct net_device *dev,
2545 - struct ethtool_drvinfo *info)
2546 +void cfg80211_get_drvinfo(struct net_device *dev, struct ethtool_drvinfo *info)
2548 struct wireless_dev *wdev = dev->ieee80211_ptr;
2550 @@ -23,84 +21,4 @@ static void cfg80211_get_drvinfo(struct
2551 strlcpy(info->bus_info, dev_name(wiphy_dev(wdev->wiphy)),
2552 sizeof(info->bus_info));
2555 -static int cfg80211_get_regs_len(struct net_device *dev)
2557 - /* For now, return 0... */
2561 -static void cfg80211_get_regs(struct net_device *dev, struct ethtool_regs *regs,
2564 - struct wireless_dev *wdev = dev->ieee80211_ptr;
2566 - regs->version = wdev->wiphy->hw_version;
2570 -static void cfg80211_get_ringparam(struct net_device *dev,
2571 - struct ethtool_ringparam *rp)
2573 - struct wireless_dev *wdev = dev->ieee80211_ptr;
2574 - struct cfg80211_registered_device *rdev = wiphy_to_rdev(wdev->wiphy);
2576 - memset(rp, 0, sizeof(*rp));
2578 - if (rdev->ops->get_ringparam)
2579 - rdev_get_ringparam(rdev, &rp->tx_pending, &rp->tx_max_pending,
2580 - &rp->rx_pending, &rp->rx_max_pending);
2583 -static int cfg80211_set_ringparam(struct net_device *dev,
2584 - struct ethtool_ringparam *rp)
2586 - struct wireless_dev *wdev = dev->ieee80211_ptr;
2587 - struct cfg80211_registered_device *rdev = wiphy_to_rdev(wdev->wiphy);
2589 - if (rp->rx_mini_pending != 0 || rp->rx_jumbo_pending != 0)
2592 - if (rdev->ops->set_ringparam)
2593 - return rdev_set_ringparam(rdev, rp->tx_pending, rp->rx_pending);
2598 -static int cfg80211_get_sset_count(struct net_device *dev, int sset)
2600 - struct wireless_dev *wdev = dev->ieee80211_ptr;
2601 - struct cfg80211_registered_device *rdev = wiphy_to_rdev(wdev->wiphy);
2602 - if (rdev->ops->get_et_sset_count)
2603 - return rdev_get_et_sset_count(rdev, dev, sset);
2604 - return -EOPNOTSUPP;
2607 -static void cfg80211_get_stats(struct net_device *dev,
2608 - struct ethtool_stats *stats, u64 *data)
2610 - struct wireless_dev *wdev = dev->ieee80211_ptr;
2611 - struct cfg80211_registered_device *rdev = wiphy_to_rdev(wdev->wiphy);
2612 - if (rdev->ops->get_et_stats)
2613 - rdev_get_et_stats(rdev, dev, stats, data);
2616 -static void cfg80211_get_strings(struct net_device *dev, u32 sset, u8 *data)
2618 - struct wireless_dev *wdev = dev->ieee80211_ptr;
2619 - struct cfg80211_registered_device *rdev = wiphy_to_rdev(wdev->wiphy);
2620 - if (rdev->ops->get_et_strings)
2621 - rdev_get_et_strings(rdev, dev, sset, data);
2624 -const struct ethtool_ops cfg80211_ethtool_ops = {
2625 - .get_drvinfo = cfg80211_get_drvinfo,
2626 - .get_regs_len = cfg80211_get_regs_len,
2627 - .get_regs = cfg80211_get_regs,
2628 - .get_link = ethtool_op_get_link,
2629 - .get_ringparam = cfg80211_get_ringparam,
2630 - .set_ringparam = cfg80211_set_ringparam,
2631 - .get_strings = cfg80211_get_strings,
2632 - .get_ethtool_stats = cfg80211_get_stats,
2633 - .get_sset_count = cfg80211_get_sset_count,
2635 +EXPORT_SYMBOL(cfg80211_get_drvinfo);
2636 --- a/net/wireless/ethtool.h
2639 -#ifndef __CFG80211_ETHTOOL__
2640 -#define __CFG80211_ETHTOOL__
2642 -extern const struct ethtool_ops cfg80211_ethtool_ops;
2644 -#endif /* __CFG80211_ETHTOOL__ */
2645 --- a/net/wireless/rdev-ops.h
2646 +++ b/net/wireless/rdev-ops.h
2647 @@ -714,25 +714,6 @@ static inline int rdev_get_antenna(struc
2651 -static inline int rdev_set_ringparam(struct cfg80211_registered_device *rdev,
2655 - trace_rdev_set_ringparam(&rdev->wiphy, tx, rx);
2656 - ret = rdev->ops->set_ringparam(&rdev->wiphy, tx, rx);
2657 - trace_rdev_return_int(&rdev->wiphy, ret);
2661 -static inline void rdev_get_ringparam(struct cfg80211_registered_device *rdev,
2662 - u32 *tx, u32 *tx_max, u32 *rx,
2665 - trace_rdev_get_ringparam(&rdev->wiphy);
2666 - rdev->ops->get_ringparam(&rdev->wiphy, tx, tx_max, rx, rx_max);
2667 - trace_rdev_return_void_tx_rx(&rdev->wiphy, *tx, *tx_max, *rx, *rx_max);
2671 rdev_sched_scan_start(struct cfg80211_registered_device *rdev,
2672 struct net_device *dev,
2673 @@ -816,35 +797,6 @@ static inline int rdev_set_noack_map(str
2677 -rdev_get_et_sset_count(struct cfg80211_registered_device *rdev,
2678 - struct net_device *dev, int sset)
2681 - trace_rdev_get_et_sset_count(&rdev->wiphy, dev, sset);
2682 - ret = rdev->ops->get_et_sset_count(&rdev->wiphy, dev, sset);
2683 - trace_rdev_return_int(&rdev->wiphy, ret);
2687 -static inline void rdev_get_et_stats(struct cfg80211_registered_device *rdev,
2688 - struct net_device *dev,
2689 - struct ethtool_stats *stats, u64 *data)
2691 - trace_rdev_get_et_stats(&rdev->wiphy, dev);
2692 - rdev->ops->get_et_stats(&rdev->wiphy, dev, stats, data);
2693 - trace_rdev_return_void(&rdev->wiphy);
2696 -static inline void rdev_get_et_strings(struct cfg80211_registered_device *rdev,
2697 - struct net_device *dev, u32 sset,
2700 - trace_rdev_get_et_strings(&rdev->wiphy, dev, sset);
2701 - rdev->ops->get_et_strings(&rdev->wiphy, dev, sset, data);
2702 - trace_rdev_return_void(&rdev->wiphy);
2706 rdev_get_channel(struct cfg80211_registered_device *rdev,
2707 struct wireless_dev *wdev,
2708 struct cfg80211_chan_def *chandef)
2709 --- a/net/wireless/trace.h
2710 +++ b/net/wireless/trace.h
2711 @@ -298,11 +298,6 @@ DEFINE_EVENT(wiphy_only_evt, rdev_return
2715 -DEFINE_EVENT(wiphy_only_evt, rdev_get_ringparam,
2716 - TP_PROTO(struct wiphy *wiphy),
2720 DEFINE_EVENT(wiphy_only_evt, rdev_get_antenna,
2721 TP_PROTO(struct wiphy *wiphy),
2723 @@ -580,11 +575,6 @@ DEFINE_EVENT(wiphy_netdev_evt, rdev_stop
2724 TP_ARGS(wiphy, netdev)
2727 -DEFINE_EVENT(wiphy_netdev_evt, rdev_get_et_stats,
2728 - TP_PROTO(struct wiphy *wiphy, struct net_device *netdev),
2729 - TP_ARGS(wiphy, netdev)
2732 DEFINE_EVENT(wiphy_netdev_evt, rdev_sched_scan_stop,
2733 TP_PROTO(struct wiphy *wiphy, struct net_device *netdev),
2734 TP_ARGS(wiphy, netdev)
2735 @@ -1439,11 +1429,6 @@ DECLARE_EVENT_CLASS(tx_rx_evt,
2736 WIPHY_PR_ARG, __entry->tx, __entry->rx)
2739 -DEFINE_EVENT(tx_rx_evt, rdev_set_ringparam,
2740 - TP_PROTO(struct wiphy *wiphy, u32 tx, u32 rx),
2741 - TP_ARGS(wiphy, rx, tx)
2744 DEFINE_EVENT(tx_rx_evt, rdev_set_antenna,
2745 TP_PROTO(struct wiphy *wiphy, u32 tx, u32 rx),
2746 TP_ARGS(wiphy, rx, tx)
2747 @@ -1725,40 +1710,6 @@ TRACE_EVENT(rdev_set_noack_map,
2748 WIPHY_PR_ARG, NETDEV_PR_ARG, __entry->noack_map)
2751 -TRACE_EVENT(rdev_get_et_sset_count,
2752 - TP_PROTO(struct wiphy *wiphy, struct net_device *netdev, int sset),
2753 - TP_ARGS(wiphy, netdev, sset),
2757 - __field(int, sset)
2762 - __entry->sset = sset;
2764 - TP_printk(WIPHY_PR_FMT ", " NETDEV_PR_FMT ", sset: %d",
2765 - WIPHY_PR_ARG, NETDEV_PR_ARG, __entry->sset)
2768 -TRACE_EVENT(rdev_get_et_strings,
2769 - TP_PROTO(struct wiphy *wiphy, struct net_device *netdev, u32 sset),
2770 - TP_ARGS(wiphy, netdev, sset),
2774 - __field(u32, sset)
2779 - __entry->sset = sset;
2781 - TP_printk(WIPHY_PR_FMT ", " NETDEV_PR_FMT ", sset: %u",
2782 - WIPHY_PR_ARG, NETDEV_PR_ARG, __entry->sset)
2785 DEFINE_EVENT(wiphy_wdev_evt, rdev_get_channel,
2786 TP_PROTO(struct wiphy *wiphy, struct wireless_dev *wdev),
2787 TP_ARGS(wiphy, wdev)
2789 +++ b/net/mac80211/ethtool.c
2792 + * mac80211 ethtool hooks for cfg80211
2794 + * Copied from cfg.c - originally
2795 + * Copyright 2006-2010 Johannes Berg <johannes@sipsolutions.net>
2796 + * Copyright 2014 Intel Corporation (Author: Johannes Berg)
2798 + * This file is GPLv2 as found in COPYING.
2800 +#include <linux/types.h>
2801 +#include <net/cfg80211.h>
2802 +#include "ieee80211_i.h"
2803 +#include "sta_info.h"
2804 +#include "driver-ops.h"
2806 +static int ieee80211_set_ringparam(struct net_device *dev,
2807 + struct ethtool_ringparam *rp)
2809 + struct ieee80211_local *local = wiphy_priv(dev->ieee80211_ptr->wiphy);
2811 + if (rp->rx_mini_pending != 0 || rp->rx_jumbo_pending != 0)
2814 + return drv_set_ringparam(local, rp->tx_pending, rp->rx_pending);
2817 +static void ieee80211_get_ringparam(struct net_device *dev,
2818 + struct ethtool_ringparam *rp)
2820 + struct ieee80211_local *local = wiphy_priv(dev->ieee80211_ptr->wiphy);
2822 + memset(rp, 0, sizeof(*rp));
2824 + drv_get_ringparam(local, &rp->tx_pending, &rp->tx_max_pending,
2825 + &rp->rx_pending, &rp->rx_max_pending);
2828 +static const char ieee80211_gstrings_sta_stats[][ETH_GSTRING_LEN] = {
2829 + "rx_packets", "rx_bytes",
2830 + "rx_duplicates", "rx_fragments", "rx_dropped",
2831 + "tx_packets", "tx_bytes", "tx_fragments",
2832 + "tx_filtered", "tx_retry_failed", "tx_retries",
2833 + "beacon_loss", "sta_state", "txrate", "rxrate", "signal",
2834 + "channel", "noise", "ch_time", "ch_time_busy",
2835 + "ch_time_ext_busy", "ch_time_rx", "ch_time_tx"
2837 +#define STA_STATS_LEN ARRAY_SIZE(ieee80211_gstrings_sta_stats)
2839 +static int ieee80211_get_sset_count(struct net_device *dev, int sset)
2841 + struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev);
2844 + if (sset == ETH_SS_STATS)
2845 + rv += STA_STATS_LEN;
2847 + rv += drv_get_et_sset_count(sdata, sset);
2850 + return -EOPNOTSUPP;
2854 +static void ieee80211_get_stats(struct net_device *dev,
2855 + struct ethtool_stats *stats,
2858 + struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev);
2859 + struct ieee80211_chanctx_conf *chanctx_conf;
2860 + struct ieee80211_channel *channel;
2861 + struct sta_info *sta;
2862 + struct ieee80211_local *local = sdata->local;
2863 + struct station_info sinfo;
2864 + struct survey_info survey;
2866 +#define STA_STATS_SURVEY_LEN 7
2868 + memset(data, 0, sizeof(u64) * STA_STATS_LEN);
2870 +#define ADD_STA_STATS(sta) \
2872 + data[i++] += sta->rx_packets; \
2873 + data[i++] += sta->rx_bytes; \
2874 + data[i++] += sta->num_duplicates; \
2875 + data[i++] += sta->rx_fragments; \
2876 + data[i++] += sta->rx_dropped; \
2878 + data[i++] += sinfo.tx_packets; \
2879 + data[i++] += sinfo.tx_bytes; \
2880 + data[i++] += sta->tx_fragments; \
2881 + data[i++] += sta->tx_filtered_count; \
2882 + data[i++] += sta->tx_retry_failed; \
2883 + data[i++] += sta->tx_retry_count; \
2884 + data[i++] += sta->beacon_loss_count; \
2887 + /* For Managed stations, find the single station based on BSSID
2888 + * and use that. For interface types, iterate through all available
2889 + * stations and add stats for any station that is assigned to this
2893 + mutex_lock(&local->sta_mtx);
2895 + if (sdata->vif.type == NL80211_IFTYPE_STATION) {
2896 + sta = sta_info_get_bss(sdata, sdata->u.mgd.bssid);
2898 + if (!(sta && !WARN_ON(sta->sdata->dev != dev)))
2902 + sta_set_sinfo(sta, &sinfo);
2905 + ADD_STA_STATS(sta);
2907 + data[i++] = sta->sta_state;
2910 + if (sinfo.filled & STATION_INFO_TX_BITRATE)
2911 + data[i] = 100000 *
2912 + cfg80211_calculate_bitrate(&sinfo.txrate);
2914 + if (sinfo.filled & STATION_INFO_RX_BITRATE)
2915 + data[i] = 100000 *
2916 + cfg80211_calculate_bitrate(&sinfo.rxrate);
2919 + if (sinfo.filled & STATION_INFO_SIGNAL_AVG)
2920 + data[i] = (u8)sinfo.signal_avg;
2923 + list_for_each_entry(sta, &local->sta_list, list) {
2924 + /* Make sure this station belongs to the proper dev */
2925 + if (sta->sdata->dev != dev)
2929 + sta_set_sinfo(sta, &sinfo);
2931 + ADD_STA_STATS(sta);
2936 + i = STA_STATS_LEN - STA_STATS_SURVEY_LEN;
2937 + /* Get survey stats for current channel */
2938 + survey.filled = 0;
2941 + chanctx_conf = rcu_dereference(sdata->vif.chanctx_conf);
2943 + channel = chanctx_conf->def.chan;
2946 + rcu_read_unlock();
2951 + survey.filled = 0;
2952 + if (drv_get_survey(local, q, &survey) != 0) {
2953 + survey.filled = 0;
2957 + } while (channel != survey.channel);
2960 + if (survey.filled)
2961 + data[i++] = survey.channel->center_freq;
2964 + if (survey.filled & SURVEY_INFO_NOISE_DBM)
2965 + data[i++] = (u8)survey.noise;
2968 + if (survey.filled & SURVEY_INFO_CHANNEL_TIME)
2969 + data[i++] = survey.channel_time;
2972 + if (survey.filled & SURVEY_INFO_CHANNEL_TIME_BUSY)
2973 + data[i++] = survey.channel_time_busy;
2976 + if (survey.filled & SURVEY_INFO_CHANNEL_TIME_EXT_BUSY)
2977 + data[i++] = survey.channel_time_ext_busy;
2980 + if (survey.filled & SURVEY_INFO_CHANNEL_TIME_RX)
2981 + data[i++] = survey.channel_time_rx;
2984 + if (survey.filled & SURVEY_INFO_CHANNEL_TIME_TX)
2985 + data[i++] = survey.channel_time_tx;
2989 + mutex_unlock(&local->sta_mtx);
2991 + if (WARN_ON(i != STA_STATS_LEN))
2994 + drv_get_et_stats(sdata, stats, &(data[STA_STATS_LEN]));
2997 +static void ieee80211_get_strings(struct net_device *dev, u32 sset, u8 *data)
2999 + struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev);
3000 + int sz_sta_stats = 0;
3002 + if (sset == ETH_SS_STATS) {
3003 + sz_sta_stats = sizeof(ieee80211_gstrings_sta_stats);
3004 + memcpy(data, ieee80211_gstrings_sta_stats, sz_sta_stats);
3006 + drv_get_et_strings(sdata, sset, &(data[sz_sta_stats]));
3009 +static int ieee80211_get_regs_len(struct net_device *dev)
3014 +static void ieee80211_get_regs(struct net_device *dev,
3015 + struct ethtool_regs *regs,
3018 + struct wireless_dev *wdev = dev->ieee80211_ptr;
3020 + regs->version = wdev->wiphy->hw_version;
3024 +const struct ethtool_ops ieee80211_ethtool_ops = {
3025 + .get_drvinfo = cfg80211_get_drvinfo,
3026 + .get_regs_len = ieee80211_get_regs_len,
3027 + .get_regs = ieee80211_get_regs,
3028 + .get_link = ethtool_op_get_link,
3029 + .get_ringparam = ieee80211_get_ringparam,
3030 + .set_ringparam = ieee80211_set_ringparam,
3031 + .get_strings = ieee80211_get_strings,
3032 + .get_ethtool_stats = ieee80211_get_stats,
3033 + .get_sset_count = ieee80211_get_sset_count,
3035 --- a/net/mac80211/ibss.c
3036 +++ b/net/mac80211/ibss.c
3037 @@ -143,7 +143,7 @@ ieee80211_ibss_build_presp(struct ieee80
3038 *pos++ = csa_settings->block_tx ? 1 : 0;
3039 *pos++ = ieee80211_frequency_to_channel(
3040 csa_settings->chandef.chan->center_freq);
3041 - sdata->csa_counter_offset_beacon[0] = (pos - presp->head);
3042 + presp->csa_counter_offsets[0] = (pos - presp->head);
3043 *pos++ = csa_settings->count;
3046 @@ -1677,6 +1677,7 @@ int ieee80211_ibss_join(struct ieee80211
3047 sdata->u.ibss.control_port = params->control_port;
3048 sdata->u.ibss.userspace_handles_dfs = params->userspace_handles_dfs;
3049 sdata->u.ibss.basic_rates = params->basic_rates;
3050 + sdata->u.ibss.last_scan_completed = jiffies;
3052 /* fix basic_rates if channel does not support these rates */
3053 rate_flags = ieee80211_chandef_rate_flags(¶ms->chandef);
3054 --- a/net/mac80211/mesh.c
3055 +++ b/net/mac80211/mesh.c
3056 @@ -679,7 +679,7 @@ ieee80211_mesh_build_beacon(struct ieee8
3058 *pos++ = ieee80211_frequency_to_channel(
3059 csa->settings.chandef.chan->center_freq);
3060 - sdata->csa_counter_offset_beacon[0] = hdr_len + 6;
3061 + bcn->csa_counter_offsets[0] = hdr_len + 6;
3062 *pos++ = csa->settings.count;
3063 *pos++ = WLAN_EID_CHAN_SWITCH_PARAM;
3065 --- a/net/wireless/genregdb.awk
3066 +++ b/net/wireless/genregdb.awk
3067 @@ -65,17 +65,7 @@ function parse_reg_rule()
3070 if (units == "mW") {
3071 - if (power == 100) {
3073 - } else if (power == 200) {
3075 - } else if (power == 500) {
3077 - } else if (power == 1000) {
3080 - print "Unknown power value in database!"
3082 + power = 10 * log(power)/log(10)
3086 @@ -114,7 +104,7 @@ function parse_reg_rule()
3090 - printf "\t\tREG_RULE_EXT(%d, %d, %d, %d, %d, %d, %s),\n", start, end, bw, gain, power, dfs_cac, flags
3091 + printf "\t\tREG_RULE_EXT(%d, %d, %d, %d, %.0f, %d, %s),\n", start, end, bw, gain, power, dfs_cac, flags
3095 --- a/net/mac80211/debugfs_netdev.c
3096 +++ b/net/mac80211/debugfs_netdev.c
3097 @@ -34,8 +34,7 @@ static ssize_t ieee80211_if_read(
3098 ssize_t ret = -EINVAL;
3100 read_lock(&dev_base_lock);
3101 - if (sdata->dev->reg_state == NETREG_REGISTERED)
3102 - ret = (*format)(sdata, buf, sizeof(buf));
3103 + ret = (*format)(sdata, buf, sizeof(buf));
3104 read_unlock(&dev_base_lock);
3107 @@ -62,8 +61,7 @@ static ssize_t ieee80211_if_write(
3111 - if (sdata->dev->reg_state == NETREG_REGISTERED)
3112 - ret = (*write)(sdata, buf, count);
3113 + ret = (*write)(sdata, buf, count);
3117 --- a/drivers/net/wireless/b43/xmit.c
3118 +++ b/drivers/net/wireless/b43/xmit.c
3119 @@ -811,9 +811,13 @@ void b43_rx(struct b43_wldev *dev, struc
3122 status.band = IEEE80211_BAND_2GHZ;
3123 - /* chanid is the radio channel cookie value as used
3124 - * to tune the radio. */
3125 - status.freq = chanid + 2400;
3126 + /* Somewhere between 478.104 and 508.1084 firmware for G-PHY
3127 + * has been modified to be compatible with N-PHY and others.
3129 + if (dev->fw.rev >= 508)
3130 + status.freq = ieee80211_channel_to_frequency(chanid, status.band);
3132 + status.freq = chanid + 2400;
3135 case B43_PHYTYPE_LP:
3136 --- a/drivers/net/wireless/b43/main.c
3137 +++ b/drivers/net/wireless/b43/main.c
3138 @@ -5216,6 +5216,7 @@ static int b43_wireless_core_attach(stru
3139 /* We don't support 5 GHz on some PHYs yet */
3140 switch (dev->phy.type) {
3142 + case B43_PHYTYPE_G:
3144 case B43_PHYTYPE_LP:
3145 case B43_PHYTYPE_HT:
3146 --- a/net/wireless/reg.c
3147 +++ b/net/wireless/reg.c
3148 @@ -935,7 +935,7 @@ freq_reg_info_regd(struct wiphy *wiphy,
3149 if (!band_rule_found)
3150 band_rule_found = freq_in_rule_band(fr, center_freq);
3152 - bw_fits = reg_does_bw_fit(fr, center_freq, MHZ_TO_KHZ(5));
3153 + bw_fits = reg_does_bw_fit(fr, center_freq, MHZ_TO_KHZ(20));
3155 if (band_rule_found && bw_fits)
3157 @@ -1019,10 +1019,10 @@ static void chan_reg_rule_print_dbg(cons
3161 -/* Find an ieee80211_reg_rule such that a 5MHz channel with frequency
3162 - * chan->center_freq fits there.
3163 - * If there is no such reg_rule, disable the channel, otherwise set the
3164 - * flags corresponding to the bandwidths allowed in the particular reg_rule
3166 + * Note that right now we assume the desired channel bandwidth
3167 + * is always 20 MHz for each individual channel (HT40 uses 20 MHz
3168 + * per channel, the primary and the extension channel).
3170 static void handle_channel(struct wiphy *wiphy,
3171 enum nl80211_reg_initiator initiator,
3172 @@ -1083,12 +1083,8 @@ static void handle_channel(struct wiphy
3173 if (reg_rule->flags & NL80211_RRF_AUTO_BW)
3174 max_bandwidth_khz = reg_get_max_bandwidth(regd, reg_rule);
3176 - if (max_bandwidth_khz < MHZ_TO_KHZ(10))
3177 - bw_flags = IEEE80211_CHAN_NO_10MHZ;
3178 - if (max_bandwidth_khz < MHZ_TO_KHZ(20))
3179 - bw_flags |= IEEE80211_CHAN_NO_20MHZ;
3180 if (max_bandwidth_khz < MHZ_TO_KHZ(40))
3181 - bw_flags |= IEEE80211_CHAN_NO_HT40;
3182 + bw_flags = IEEE80211_CHAN_NO_HT40;
3183 if (max_bandwidth_khz < MHZ_TO_KHZ(80))
3184 bw_flags |= IEEE80211_CHAN_NO_80MHZ;
3185 if (max_bandwidth_khz < MHZ_TO_KHZ(160))
3186 @@ -1522,12 +1518,8 @@ static void handle_channel_custom(struct
3187 if (reg_rule->flags & NL80211_RRF_AUTO_BW)
3188 max_bandwidth_khz = reg_get_max_bandwidth(regd, reg_rule);
3190 - if (max_bandwidth_khz < MHZ_TO_KHZ(10))
3191 - bw_flags = IEEE80211_CHAN_NO_10MHZ;
3192 - if (max_bandwidth_khz < MHZ_TO_KHZ(20))
3193 - bw_flags |= IEEE80211_CHAN_NO_20MHZ;
3194 if (max_bandwidth_khz < MHZ_TO_KHZ(40))
3195 - bw_flags |= IEEE80211_CHAN_NO_HT40;
3196 + bw_flags = IEEE80211_CHAN_NO_HT40;
3197 if (max_bandwidth_khz < MHZ_TO_KHZ(80))
3198 bw_flags |= IEEE80211_CHAN_NO_80MHZ;
3199 if (max_bandwidth_khz < MHZ_TO_KHZ(160))
3200 --- a/drivers/net/wireless/ath/ath9k/ath9k.h
3201 +++ b/drivers/net/wireless/ath/ath9k/ath9k.h
3202 @@ -185,7 +185,8 @@ struct ath_atx_ac {
3204 struct ath_frame_info {
3209 enum ath9k_key_type keytype;
3212 --- a/drivers/net/wireless/ath/ath9k/xmit.c
3213 +++ b/drivers/net/wireless/ath/ath9k/xmit.c
3214 @@ -147,15 +147,13 @@ static void ath_set_rates(struct ieee802
3215 static void ath_txq_skb_done(struct ath_softc *sc, struct ath_txq *txq,
3216 struct sk_buff *skb)
3220 - q = skb_get_queue_mapping(skb);
3221 - if (txq == sc->tx.uapsdq)
3222 - txq = sc->tx.txq_map[q];
3223 + struct ath_frame_info *fi = get_frame_info(skb);
3226 - if (txq != sc->tx.txq_map[q])
3230 + txq = sc->tx.txq_map[q];
3231 if (WARN_ON(--txq->pending_frames < 0))
3232 txq->pending_frames = 0;
3234 @@ -887,6 +885,15 @@ ath_tx_get_tid_subframe(struct ath_softc
3236 tx_info = IEEE80211_SKB_CB(skb);
3237 tx_info->flags &= ~IEEE80211_TX_CTL_CLEAR_PS_FILT;
3240 + * No aggregation session is running, but there may be frames
3241 + * from a previous session or a failed attempt in the queue.
3242 + * Send them out as normal data frames
3245 + tx_info->flags &= ~IEEE80211_TX_CTL_AMPDU;
3247 if (!(tx_info->flags & IEEE80211_TX_CTL_AMPDU)) {
3248 bf->bf_state.bf_type = 0;
3250 @@ -1999,6 +2006,7 @@ static void setup_frame_info(struct ieee
3251 an = (struct ath_node *) sta->drv_priv;
3253 memset(fi, 0, sizeof(*fi));
3256 fi->keyix = hw_key->hw_key_idx;
3257 else if (an && ieee80211_is_data(hdr->frame_control) && an->ps_key > 0)
3258 @@ -2150,6 +2158,7 @@ int ath_tx_start(struct ieee80211_hw *hw
3259 struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
3260 struct ieee80211_sta *sta = txctl->sta;
3261 struct ieee80211_vif *vif = info->control.vif;
3262 + struct ath_frame_info *fi = get_frame_info(skb);
3263 struct ath_softc *sc = hw->priv;
3264 struct ath_txq *txq = txctl->txq;
3265 struct ath_atx_tid *tid = NULL;
3266 @@ -2170,11 +2179,13 @@ int ath_tx_start(struct ieee80211_hw *hw
3267 q = skb_get_queue_mapping(skb);
3269 ath_txq_lock(sc, txq);
3270 - if (txq == sc->tx.txq_map[q] &&
3271 - ++txq->pending_frames > sc->tx.txq_max_pending[q] &&
3273 - ieee80211_stop_queue(sc->hw, q);
3274 - txq->stopped = true;
3275 + if (txq == sc->tx.txq_map[q]) {
3277 + if (++txq->pending_frames > sc->tx.txq_max_pending[q] &&
3279 + ieee80211_stop_queue(sc->hw, q);
3280 + txq->stopped = true;
3284 if (txctl->an && ieee80211_is_data_present(hdr->frame_control))
3285 --- a/net/mac80211/chan.c
3286 +++ b/net/mac80211/chan.c
3287 @@ -521,6 +521,8 @@ static void ieee80211_recalc_chanctx_cha
3289 if (rcu_access_pointer(sdata->vif.chanctx_conf) != conf)
3291 + if (sdata->vif.type == NL80211_IFTYPE_AP_VLAN)
3295 compat = &sdata->vif.bss_conf.chandef;
3296 --- a/drivers/net/wireless/ath/ath9k/ar5008_phy.c
3297 +++ b/drivers/net/wireless/ath/ath9k/ar5008_phy.c
3298 @@ -1004,9 +1004,11 @@ static bool ar5008_hw_ani_control_new(st
3299 case ATH9K_ANI_FIRSTEP_LEVEL:{
3303 + value = level * 2;
3304 REG_RMW_FIELD(ah, AR_PHY_FIND_SIG,
3305 AR_PHY_FIND_SIG_FIRSTEP, value);
3306 + REG_RMW_FIELD(ah, AR_PHY_FIND_SIG_LOW,
3307 + AR_PHY_FIND_SIG_FIRSTEP_LOW, value);
3309 if (level != aniState->firstepLevel) {
3310 ath_dbg(common, ANI,
3311 @@ -1040,9 +1042,8 @@ static bool ar5008_hw_ani_control_new(st
3312 REG_RMW_FIELD(ah, AR_PHY_TIMING5,
3313 AR_PHY_TIMING5_CYCPWR_THR1, value);
3315 - if (IS_CHAN_HT40(ah->curchan))
3316 - REG_RMW_FIELD(ah, AR_PHY_EXT_CCA,
3317 - AR_PHY_EXT_TIMING5_CYCPWR_THR1, value);
3318 + REG_RMW_FIELD(ah, AR_PHY_EXT_CCA,
3319 + AR_PHY_EXT_TIMING5_CYCPWR_THR1, value - 1);
3321 if (level != aniState->spurImmunityLevel) {
3322 ath_dbg(common, ANI,
3323 --- a/drivers/net/wireless/ath/ath9k/ar9003_phy.c
3324 +++ b/drivers/net/wireless/ath/ath9k/ar9003_phy.c
3325 @@ -517,6 +517,23 @@ static void ar9003_hw_spur_mitigate(stru
3326 ar9003_hw_spur_mitigate_ofdm(ah, chan);
3329 +static u32 ar9003_hw_compute_pll_control_soc(struct ath_hw *ah,
3330 + struct ath9k_channel *chan)
3334 + pll = SM(0x5, AR_RTC_9300_SOC_PLL_REFDIV);
3336 + if (chan && IS_CHAN_HALF_RATE(chan))
3337 + pll |= SM(0x1, AR_RTC_9300_SOC_PLL_CLKSEL);
3338 + else if (chan && IS_CHAN_QUARTER_RATE(chan))
3339 + pll |= SM(0x2, AR_RTC_9300_SOC_PLL_CLKSEL);
3341 + pll |= SM(0x2c, AR_RTC_9300_SOC_PLL_DIV_INT);
3346 static u32 ar9003_hw_compute_pll_control(struct ath_hw *ah,
3347 struct ath9k_channel *chan)
3349 @@ -647,6 +664,19 @@ static void ar9003_hw_override_ini(struc
3350 ah->enabled_cals |= TX_CL_CAL;
3352 ah->enabled_cals &= ~TX_CL_CAL;
3354 + if (AR_SREV_9340(ah) || AR_SREV_9531(ah) || AR_SREV_9550(ah)) {
3355 + if (ah->is_clk_25mhz) {
3356 + REG_WRITE(ah, AR_RTC_DERIVED_CLK, 0x17c << 1);
3357 + REG_WRITE(ah, AR_SLP32_MODE, 0x0010f3d7);
3358 + REG_WRITE(ah, AR_SLP32_INC, 0x0001e7ae);
3360 + REG_WRITE(ah, AR_RTC_DERIVED_CLK, 0x261 << 1);
3361 + REG_WRITE(ah, AR_SLP32_MODE, 0x0010f400);
3362 + REG_WRITE(ah, AR_SLP32_INC, 0x0001e800);
3368 static void ar9003_hw_prog_ini(struct ath_hw *ah,
3369 @@ -1779,7 +1809,12 @@ void ar9003_hw_attach_phy_ops(struct ath
3371 priv_ops->rf_set_freq = ar9003_hw_set_channel;
3372 priv_ops->spur_mitigate_freq = ar9003_hw_spur_mitigate;
3373 - priv_ops->compute_pll_control = ar9003_hw_compute_pll_control;
3375 + if (AR_SREV_9340(ah) || AR_SREV_9550(ah) || AR_SREV_9531(ah))
3376 + priv_ops->compute_pll_control = ar9003_hw_compute_pll_control_soc;
3378 + priv_ops->compute_pll_control = ar9003_hw_compute_pll_control;
3380 priv_ops->set_channel_regs = ar9003_hw_set_channel_regs;
3381 priv_ops->init_bb = ar9003_hw_init_bb;
3382 priv_ops->process_ini = ar9003_hw_process_ini;
3383 --- a/drivers/net/wireless/ath/ath9k/hw.c
3384 +++ b/drivers/net/wireless/ath/ath9k/hw.c
3385 @@ -702,6 +702,8 @@ static void ath9k_hw_init_pll(struct ath
3389 + pll = ath9k_hw_compute_pll_control(ah, chan);
3391 if (AR_SREV_9485(ah) || AR_SREV_9565(ah)) {
3392 /* program BB PLL ki and kd value, ki=0x4, kd=0x40 */
3393 REG_RMW_FIELD(ah, AR_CH0_BB_DPLL2,
3394 @@ -752,7 +754,8 @@ static void ath9k_hw_init_pll(struct ath
3395 REG_RMW_FIELD(ah, AR_CH0_DDR_DPLL3,
3396 AR_CH0_DPLL3_PHASE_SHIFT, 0x1);
3398 - REG_WRITE(ah, AR_RTC_PLL_CONTROL, 0x1142c);
3399 + REG_WRITE(ah, AR_RTC_PLL_CONTROL,
3400 + pll | AR_RTC_9300_PLL_BYPASS);
3403 /* program refdiv, nint, frac to RTC register */
3404 @@ -768,7 +771,8 @@ static void ath9k_hw_init_pll(struct ath
3405 } else if (AR_SREV_9340(ah) || AR_SREV_9550(ah) || AR_SREV_9531(ah)) {
3406 u32 regval, pll2_divint, pll2_divfrac, refdiv;
3408 - REG_WRITE(ah, AR_RTC_PLL_CONTROL, 0x1142c);
3409 + REG_WRITE(ah, AR_RTC_PLL_CONTROL,
3410 + pll | AR_RTC_9300_SOC_PLL_BYPASS);
3413 REG_SET_BIT(ah, AR_PHY_PLL_MODE, 0x1 << 16);
3414 @@ -840,7 +844,6 @@ static void ath9k_hw_init_pll(struct ath
3418 - pll = ath9k_hw_compute_pll_control(ah, chan);
3419 if (AR_SREV_9565(ah))
3421 REG_WRITE(ah, AR_RTC_PLL_CONTROL, pll);
3422 @@ -858,19 +861,6 @@ static void ath9k_hw_init_pll(struct ath
3423 udelay(RTC_PLL_SETTLE_DELAY);
3425 REG_WRITE(ah, AR_RTC_SLEEP_CLK, AR_RTC_FORCE_DERIVED_CLK);
3427 - if (AR_SREV_9340(ah) || AR_SREV_9550(ah)) {
3428 - if (ah->is_clk_25mhz) {
3429 - REG_WRITE(ah, AR_RTC_DERIVED_CLK, 0x17c << 1);
3430 - REG_WRITE(ah, AR_SLP32_MODE, 0x0010f3d7);
3431 - REG_WRITE(ah, AR_SLP32_INC, 0x0001e7ae);
3433 - REG_WRITE(ah, AR_RTC_DERIVED_CLK, 0x261 << 1);
3434 - REG_WRITE(ah, AR_SLP32_MODE, 0x0010f400);
3435 - REG_WRITE(ah, AR_SLP32_INC, 0x0001e800);
3441 static void ath9k_hw_init_interrupt_masks(struct ath_hw *ah,
3442 --- a/drivers/net/wireless/ath/ath9k/reg.h
3443 +++ b/drivers/net/wireless/ath/ath9k/reg.h
3444 @@ -1236,12 +1236,23 @@ enum {
3445 #define AR_CH0_DPLL3_PHASE_SHIFT_S 23
3446 #define AR_PHY_CCA_NOM_VAL_2GHZ -118
3448 +#define AR_RTC_9300_SOC_PLL_DIV_INT 0x0000003f
3449 +#define AR_RTC_9300_SOC_PLL_DIV_INT_S 0
3450 +#define AR_RTC_9300_SOC_PLL_DIV_FRAC 0x000fffc0
3451 +#define AR_RTC_9300_SOC_PLL_DIV_FRAC_S 6
3452 +#define AR_RTC_9300_SOC_PLL_REFDIV 0x01f00000
3453 +#define AR_RTC_9300_SOC_PLL_REFDIV_S 20
3454 +#define AR_RTC_9300_SOC_PLL_CLKSEL 0x06000000
3455 +#define AR_RTC_9300_SOC_PLL_CLKSEL_S 25
3456 +#define AR_RTC_9300_SOC_PLL_BYPASS 0x08000000
3458 #define AR_RTC_9300_PLL_DIV 0x000003ff
3459 #define AR_RTC_9300_PLL_DIV_S 0
3460 #define AR_RTC_9300_PLL_REFDIV 0x00003C00
3461 #define AR_RTC_9300_PLL_REFDIV_S 10
3462 #define AR_RTC_9300_PLL_CLKSEL 0x0000C000
3463 #define AR_RTC_9300_PLL_CLKSEL_S 14
3464 +#define AR_RTC_9300_PLL_BYPASS 0x00010000
3466 #define AR_RTC_9160_PLL_DIV 0x000003ff
3467 #define AR_RTC_9160_PLL_DIV_S 0
3468 --- a/drivers/net/wireless/ath/ath9k/common.c
3469 +++ b/drivers/net/wireless/ath/ath9k/common.c
3470 @@ -368,11 +368,11 @@ void ath9k_cmn_update_txpow(struct ath_h
3472 struct ath_regulatory *reg = ath9k_hw_regulatory(ah);
3474 - if (reg->power_limit != new_txpow) {
3475 + if (reg->power_limit != new_txpow)
3476 ath9k_hw_set_txpowerlimit(ah, new_txpow, false);
3477 - /* read back in case value is clamped */
3478 - *txpower = reg->max_power_level;
3481 + /* read back in case value is clamped */
3482 + *txpower = reg->max_power_level;
3484 EXPORT_SYMBOL(ath9k_cmn_update_txpow);
3486 --- a/drivers/net/wireless/b43/phy_common.c
3487 +++ b/drivers/net/wireless/b43/phy_common.c
3488 @@ -276,8 +276,7 @@ void b43_phy_write(struct b43_wldev *dev
3489 void b43_phy_copy(struct b43_wldev *dev, u16 destreg, u16 srcreg)
3491 assert_mac_suspended(dev);
3492 - dev->phy.ops->phy_write(dev, destreg,
3493 - dev->phy.ops->phy_read(dev, srcreg));
3494 + b43_phy_write(dev, destreg, b43_phy_read(dev, srcreg));
3497 void b43_phy_mask(struct b43_wldev *dev, u16 offset, u16 mask)