1 commit 5f313a15da92dda80ac4c9a137bc42d7d0b49adf
2 Author: Rafał Miłecki <zajec5@gmail.com>
3 Date: Thu Jun 12 09:28:38 2014 +0200
5 b43: fix frequency reported on G-PHY with /new/ firmware
7 commit d3a58df87a2e4c2301ac843604202d290a48440b
8 Author: Avraham Stern <avraham.stern@intel.com>
9 Date: Thu May 22 12:17:47 2014 +0300
11 mac80211: set new interfaces as idle upon init
13 Mark new interfaces as idle to allow operations that require that
14 interfaces are idle to take place. Interface types that are always
15 not idle (like AP interfaces) will be set as not idle when they are
16 assigned a channel context.
18 Signed-off-by: Avraham Stern <avraham.stern@intel.com>
19 Signed-off-by: Emmanuel Grumbach<emmanuel.grumbach@intel.com>
20 Signed-off-by: Johannes Berg <johannes.berg@intel.com>
22 commit 923eaf367206e01f22c97aee22300e332d071916
23 Author: Arik Nemtsov <arik@wizery.com>
24 Date: Mon May 26 14:40:51 2014 +0300
26 mac80211: don't check netdev state for debugfs read/write
28 Doing so will lead to an oops for a p2p-dev interface, since it has
31 Cc: stable@vger.kernel.org
32 Signed-off-by: Arik Nemtsov <arikx.nemtsov@intel.com>
33 Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
34 Signed-off-by: Johannes Berg <johannes.berg@intel.com>
36 commit a9fb54169b197f31aff24c8d6270dd1e56cde395
37 Author: chaitanya.mgit@gmail.com <chaitanya.mgit@gmail.com>
38 Date: Mon May 26 18:01:44 2014 +0530
40 regdb: Generalize the mW to dBm power conversion
42 Generalize the power conversion from mW to dBm
43 using log. This should fix the below compilation
44 error for country NO which adds a new power value
45 2000mW which is not handled earlier.
47 CC [M] net/wireless/wext-sme.o
48 CC [M] net/wireless/regdb.o
49 net/wireless/regdb.c:1130:1: error: Unknown undeclared here (not in
51 net/wireless/regdb.c:1130:9: error: expected } before power
52 make[2]: *** [net/wireless/regdb.o] Error 1
53 make[1]: *** [net/wireless] Error 2
54 make: *** [net] Error 2
56 Reported-By: John Walker <john@x109.net>
57 Signed-off-by: Chaitanya T K <chaitanya.mgit@gmail.com>
58 Acked-by: John W. Linville <linville@tuxdriver.com>
59 [remove unneeded parentheses, fix rounding by using %.0f]
60 Signed-off-by: Johannes Berg <johannes.berg@intel.com>
62 commit c7d37a66e345df2fdf1aa7b2c9a6d3d53846ca5b
63 Author: Krzysztof Hałasa <khalasa@piap.pl>
64 Date: Mon May 26 14:14:46 2014 +0200
66 mac80211: fix IBSS join by initializing last_scan_completed
68 Without this fix, freshly rebooted Linux creates a new IBSS
69 instead of joining an existing one. Only when jiffies counter
70 overflows after 5 minutes the IBSS can be successfully joined.
72 Signed-off-by: Krzysztof Hałasa <khalasa@piap.pl>
73 [edit commit message slightly]
74 Cc: stable@vger.kernel.org
75 Signed-off-by: Johannes Berg <johannes.berg@intel.com>
77 commit 34171dc0d623be2c1032416bf7d3819f388ed70d
78 Author: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
79 Date: Sun May 25 15:35:41 2014 +0300
81 mac80211: fix virtual monitor interface addition
83 Since the commit below, cfg80211_chandef_dfs_required()
84 will warn if it gets a an NL80211_IFTYPE_UNSPECIFIED iftype
85 as explicitely written in the commit log.
86 When an virtual monitor interface is added, its type is set
87 in ieee80211_sub_if_data.vif.type, but not in
88 ieee80211_sub_if_data.wdev.iftype which is passed to
89 cfg80211_chandef_dfs_required() hence resulting in the
92 WARNING: CPU: 1 PID: 21265 at net/wireless/chan.c:376 cfg80211_chandef_dfs_required+0xbc/0x130 [cfg80211]()
93 Modules linked in: [...]
94 CPU: 1 PID: 21265 Comm: ifconfig Tainted: G W O 3.13.11+ #12
95 Hardware name: Dell Inc. Latitude E6410/0667CC, BIOS A01 03/05/2010
96 0000000000000009 ffff88008f5fdb08 ffffffff817d4219 ffff88008f5fdb50
97 ffff88008f5fdb40 ffffffff8106f57d 0000000000000000 0000000000000000
98 ffff880081062fb8 ffff8800810604e0 0000000000000001 ffff88008f5fdba0
100 [<ffffffff817d4219>] dump_stack+0x4d/0x66
101 [<ffffffff8106f57d>] warn_slowpath_common+0x7d/0xa0
102 [<ffffffff8106f5ec>] warn_slowpath_fmt+0x4c/0x50
103 [<ffffffffa04ea4ec>] cfg80211_chandef_dfs_required+0xbc/0x130 [cfg80211]
104 [<ffffffffa06b1024>] ieee80211_vif_use_channel+0x94/0x500 [mac80211]
105 [<ffffffffa0684e6b>] ieee80211_add_virtual_monitor+0x1ab/0x5c0 [mac80211]
106 [<ffffffffa0686ae5>] ieee80211_do_open+0xe75/0x1580 [mac80211]
107 [<ffffffffa0687259>] ieee80211_open+0x69/0x70 [mac80211]
110 Fixes: 00ec75fc5a64 ("cfg80211: pass the actual iftype when calling cfg80211_chandef_dfs_required()")
111 Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
112 Acked-by: Luciano Coelho <luciano.coelho@intel.com>
113 Signed-off-by: Johannes Berg <johannes.berg@intel.com>
115 commit d93cc72b37b4e2c314e1c499e80e8801907c2fea
116 Author: Michal Kazior <michal.kazior@tieto.com>
117 Date: Thu Jun 5 14:21:37 2014 +0200
119 mac80211: use csa counter offsets instead of csa_active
121 vif->csa_active is protected by mutexes only. This
122 means it is unreliable to depend on it on codeflow
123 in non-sleepable beacon and CSA code. There was no
124 guarantee to have vif->csa_active update be
125 visible before beacons are updated on SMP systems.
127 Using csa counter offsets which are embedded in
128 beacon struct (and thus are protected with single
129 RCU assignment) is much safer.
131 Signed-off-by: Michal Kazior <michal.kazior@tieto.com>
132 Signed-off-by: Johannes Berg <johannes.berg@intel.com>
134 commit d2746694fcdef24e0a7a1947d8c70082cde81a26
135 Author: Michal Kazior <michal.kazior@tieto.com>
136 Date: Thu Jun 5 14:21:36 2014 +0200
138 mac80211: move csa counters from sdata to beacon/presp
140 Having csa counters part of beacon and probe_resp
141 structures makes it easier to get rid of possible
142 races between setting a beacon and updating
143 counters on SMP systems by guaranteeing counters
144 are always consistent against given beacon struct.
146 While at it relax WARN_ON into WARN_ON_ONCE to
147 prevent spamming logs and racing.
149 Signed-off-by: Michal Kazior <michal.kazior@tieto.com>
150 Signed-off-by: Johannes Berg <johannes.berg@intel.com>
152 commit 5dcb54f3a1a8cd7e0331e773487574f9743615db
153 Author: Janusz Dziedzic <janusz.dziedzic@tieto.com>
154 Date: Thu Jun 5 08:12:57 2014 +0200
156 mac80211: allow tx via monitor iface when DFS
158 Allow send frames using monitor interface
159 when DFS chandef and we pass CAC (beaconing
162 This fix problem when old kernel and new backports used,
163 in such case hostapd create/use also monitor interface.
164 Before this patch all frames hostapd send using monitor
165 iface were dropped when AP was configured on DFS channel.
167 Signed-off-by: Janusz Dziedzic <janusz.dziedzic@tieto.com>
168 Signed-off-by: Johannes Berg <johannes.berg@intel.com>
170 commit 6f09a1beb0d2007572248c986780562219bd206f
171 Author: Johannes Berg <johannes.berg@intel.com>
172 Date: Wed Jun 4 17:31:56 2014 +0200
174 cfg80211: make ethtool the driver's responsibility
176 Currently, cfg80211 tries to implement ethtool, but that doesn't
177 really scale well, with all the different operations. Make the
178 lower-level driver responsible for it, which currently only has
179 an effect on mac80211. It will similarly not scale well at that
180 level though, since mac80211 also has many drivers.
182 To cleanly implement this in mac80211, introduce a new file and
183 move some code to appropriate places.
185 Signed-off-by: Johannes Berg <johannes.berg@intel.com>
187 commit 6b0c6f133de8f90caeb1c4a902e6140567c5bf96
188 Author: Johannes Berg <johannes.berg@intel.com>
189 Date: Wed Jun 4 17:06:23 2014 +0200
191 mac80211: remove weak WEP IV accounting
193 Since WEP is practically dead, there seems very little
194 point in keeping WEP weak IV accounting.
196 Signed-off-by: Johannes Berg <johannes.berg@intel.com>
198 commit aecdc89fb4664c76baa4bbd46008f220532309ff
199 Author: Luciano Coelho <luciano.coelho@intel.com>
200 Date: Fri May 23 11:04:50 2014 +0300
202 ath9k/ath10k: remove unnecessary channel_switch_beacon callbacks
204 The channel_switch_beacon callback is optional, so it doesn't have to
205 be defined if it's not going to do anything useful with it. Both
206 ath9k and ath10k define the callback and just returns. This commit
209 Cc: Michal Kazior <michal.kazior@tieto.com>
210 Signed-off-by: Luciano Coelho <luciano.coelho@intel.com>
211 Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
213 commit 60ccc107c9b9fb732fdee1f76bb2dad44f0e1798
214 Author: Rajkumar Manoharan <rmanohar@qti.qualcomm.com>
215 Date: Tue May 27 16:58:02 2014 +0530
217 ath9k: Fix deadlock while updating p2p beacon timer
219 pm_lock is taken twice while syncing HW TSF of p2p vif.
220 Fix this by taking the lock at caller side.
222 Cc: Felix Fietkau <nbd@openwrt.org>
223 Signed-off-by: Rajkumar Manoharan <rmanohar@qti.qualcomm.com>
224 Signed-off-by: John W. Linville <linville@tuxdriver.com>
226 commit f3831a4e3903dbc1a57d5df56deb6a143fd001bc
227 Author: Stanislaw Gruszka <sgruszka@redhat.com>
228 Date: Thu Jun 5 13:52:27 2014 +0200
230 rt2x00: do not initialize BCN_OFFSET registers
232 We setup BCN_OFFSET{0,1} registers dynamically, don't have to
235 Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com>
237 commit e5c58ca7a48d4c82f282749a978052c47fd95998
238 Author: Stanislaw Gruszka <sgruszka@redhat.com>
239 Date: Thu Jun 5 13:52:26 2014 +0200
241 rt2x00: change order when stop beaconing
243 When no beaconing is needed, first stop beacon queue (disable beaconing
244 globally) to avoid possible sending of not prepared beacon on short
245 period after clearing beacon and before stop of BCN queue.
247 Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com>
249 commit 382c1b9e03f52d0cd741ef1d942cad0f649f0744
250 Author: Stanislaw Gruszka <sgruszka@redhat.com>
251 Date: Thu Jun 5 13:52:25 2014 +0200
253 rt2x00: change default MAC_BSSID_DW1_BSS_BCN_NUM
255 We setup MAC_BSSID_DW1_BSS_BCN_NUM dynamically when numbers of active
256 beacons increase. Change default to 0 to tell hardware that we want to
257 send only one beacon as default.
259 Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com>
261 commit 3b400571dd033e46fa7e76c5bb92a3ce8198afa9
262 Author: Stanislaw Gruszka <sgruszka@redhat.com>
263 Date: Thu Jun 5 13:52:24 2014 +0200
265 rt2x00: change beaconing setup on RT2800
267 As reported by Matthias, on 5572 chip, even if we clear up TXWI
268 of corresponding beacon, hardware still try to send it or do other
269 action that increase power consumption peak up to 1A.
271 To avoid the issue, setup beaconing dynamically by configuring offsets
272 of currently active beacons and MAC_BSSID_DW1_BSS_BCN_NUM variable,
273 which limit number of beacons that hardware will try to send.
275 Reported-by: Matthias Fend <Matthias.Fend@wolfvision.net>
276 Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com>
278 commit 916e591b2cc41f7e572992175ca56d866d7bc958
279 Author: Stanislaw Gruszka <sgruszka@redhat.com>
280 Date: Thu Jun 5 13:52:23 2014 +0200
282 rt2x00: change beaconing locking
284 This patch is needed for further changes to keep global variables
285 consistent when changing beaconing on diffrent vif's.
287 Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com>
289 commit 930b0dffd1731f3f418f9132faea720a23b7af61
290 Author: Johannes Berg <johannes.berg@intel.com>
291 Date: Tue Jun 3 11:18:47 2014 +0200
293 mac80211: fix station/driver powersave race
295 It is currently possible to have a race due to the station PS
296 unblock work like this:
297 * station goes to sleep with frames buffered in the driver
298 * driver blocks wakeup
299 * station wakes up again
300 * driver flushes/returns frames, and unblocks, which schedules
302 * unblock work starts to run, and checks that the station is
303 awake (i.e. that the WLAN_STA_PS_STA flag isn't set)
304 * we process a received frame with PM=1, setting the flag again
305 * ieee80211_sta_ps_deliver_wakeup() runs, delivering all frames
306 to the driver, and then clearing the WLAN_STA_PS_DRIVER and
307 WLAN_STA_PS_STA flags
309 In this scenario, mac80211 will think that the station is awake,
310 while it really is asleep, and any TX'ed frames should be filtered
311 by the device (it will know that the station is sleeping) but then
312 passed to mac80211 again, which will not buffer it either as it
313 thinks the station is awake, and eventually the packets will be
316 Fix this by moving the clearing of the flags to exactly where we
317 learn about the situation. This creates a problem of reordering,
318 so introduce another flag indicating that delivery is being done,
319 this new flag also queues frames and is cleared only while the
320 spinlock is held (which the queuing code also holds) so that any
321 concurrent delivery/TX is handled correctly.
323 Reported-by: Andrei Otcheretianski <andrei.otcheretianski@intel.com>
324 Signed-off-by: Johannes Berg <johannes.berg@intel.com>
326 commit 6df35206bc6c1c6aad1d8077df5786b4a7f77873
327 Author: Felix Fietkau <nbd@openwrt.org>
328 Date: Fri May 23 19:58:14 2014 +0200
330 mac80211: reduce packet loss notifications under load
332 During strong signal fluctuations under high throughput, few consecutive
333 failed A-MPDU transmissions can easily trigger packet loss notification,
334 and thus (in AP mode) client disconnection.
336 Reduce the number of false positives by checking the A-MPDU status flag
337 and treating a failed A-MPDU as a single packet.
339 Signed-off-by: Felix Fietkau <nbd@openwrt.org>
341 commit 7b7843a36fbcc568834404c7430ff895d8502131
342 Author: Felix Fietkau <nbd@openwrt.org>
343 Date: Fri May 23 19:26:32 2014 +0200
345 mac80211: fix a memory leak on sta rate selection table
347 Cc: stable@vger.kernel.org
348 Reported-by: Christophe Prévotaux <cprevotaux@nltinc.com>
349 Signed-off-by: Felix Fietkau <nbd@openwrt.org>
351 commit 96892d6aa0a153423070addf3070bc79578b3897
352 Author: Felix Fietkau <nbd@openwrt.org>
353 Date: Mon May 19 21:20:49 2014 +0200
355 ath9k: avoid passing buffers to the hardware during flush
357 The commit "ath9k: fix possible hang on flush" changed the receive code
358 to always link rx descriptors of processed frames, even when flushing.
359 In some cases, this leads to flushed rx buffers being passed to the
360 hardware while rx is already stopped.
362 Signed-off-by: Felix Fietkau <nbd@openwrt.org>
364 --- a/drivers/net/wireless/ath/ath9k/recv.c
365 +++ b/drivers/net/wireless/ath/ath9k/recv.c
366 @@ -34,7 +34,8 @@ static inline bool ath9k_check_auto_slee
367 * buffer (or rx fifo). This can incorrectly acknowledge packets
368 * to a sender if last desc is self-linked.
370 -static void ath_rx_buf_link(struct ath_softc *sc, struct ath_rxbuf *bf)
371 +static void ath_rx_buf_link(struct ath_softc *sc, struct ath_rxbuf *bf,
374 struct ath_hw *ah = sc->sc_ah;
375 struct ath_common *common = ath9k_hw_common(ah);
376 @@ -59,18 +60,19 @@ static void ath_rx_buf_link(struct ath_s
380 - if (sc->rx.rxlink == NULL)
381 - ath9k_hw_putrxbuf(ah, bf->bf_daddr);
384 *sc->rx.rxlink = bf->bf_daddr;
386 + ath9k_hw_putrxbuf(ah, bf->bf_daddr);
388 sc->rx.rxlink = &ds->ds_link;
391 -static void ath_rx_buf_relink(struct ath_softc *sc, struct ath_rxbuf *bf)
392 +static void ath_rx_buf_relink(struct ath_softc *sc, struct ath_rxbuf *bf,
396 - ath_rx_buf_link(sc, sc->rx.buf_hold);
397 + ath_rx_buf_link(sc, sc->rx.buf_hold, flush);
399 sc->rx.buf_hold = bf;
401 @@ -442,7 +444,7 @@ int ath_startrecv(struct ath_softc *sc)
402 sc->rx.buf_hold = NULL;
403 sc->rx.rxlink = NULL;
404 list_for_each_entry_safe(bf, tbf, &sc->rx.rxbuf, list) {
405 - ath_rx_buf_link(sc, bf);
406 + ath_rx_buf_link(sc, bf, false);
409 /* We could have deleted elements so the list may be empty now */
410 @@ -1118,12 +1120,12 @@ requeue_drop_frag:
412 list_add_tail(&bf->list, &sc->rx.rxbuf);
415 - ath_rx_edma_buf_link(sc, qtype);
417 - ath_rx_buf_relink(sc, bf);
419 + ath_rx_buf_relink(sc, bf, flush);
422 + } else if (!flush) {
423 + ath_rx_edma_buf_link(sc, qtype);
427 --- a/net/mac80211/sta_info.c
428 +++ b/net/mac80211/sta_info.c
429 @@ -100,7 +100,8 @@ static void __cleanup_single_sta(struct
432 if (test_sta_flag(sta, WLAN_STA_PS_STA) ||
433 - test_sta_flag(sta, WLAN_STA_PS_DRIVER)) {
434 + test_sta_flag(sta, WLAN_STA_PS_DRIVER) ||
435 + test_sta_flag(sta, WLAN_STA_PS_DELIVER)) {
436 if (sta->sdata->vif.type == NL80211_IFTYPE_AP ||
437 sta->sdata->vif.type == NL80211_IFTYPE_AP_VLAN)
438 ps = &sdata->bss->ps;
439 @@ -111,6 +112,7 @@ static void __cleanup_single_sta(struct
441 clear_sta_flag(sta, WLAN_STA_PS_STA);
442 clear_sta_flag(sta, WLAN_STA_PS_DRIVER);
443 + clear_sta_flag(sta, WLAN_STA_PS_DELIVER);
445 atomic_dec(&ps->num_sta_ps);
446 sta_info_recalc_tim(sta);
447 @@ -125,7 +127,7 @@ static void __cleanup_single_sta(struct
448 if (ieee80211_vif_is_mesh(&sdata->vif))
449 mesh_sta_cleanup(sta);
451 - cancel_work_sync(&sta->drv_unblock_wk);
452 + cancel_work_sync(&sta->drv_deliver_wk);
455 * Destroy aggregation state here. It would be nice to wait for the
456 @@ -227,6 +229,7 @@ struct sta_info *sta_info_get_by_idx(str
458 void sta_info_free(struct ieee80211_local *local, struct sta_info *sta)
460 + struct ieee80211_sta_rates *rates;
464 @@ -238,6 +241,10 @@ void sta_info_free(struct ieee80211_loca
468 + rates = rcu_dereference_protected(sta->sta.rates, true);
472 sta_dbg(sta->sdata, "Destroyed STA %pM\n", sta->sta.addr);
475 @@ -252,33 +259,23 @@ static void sta_info_hash_add(struct iee
476 rcu_assign_pointer(local->sta_hash[STA_HASH(sta->sta.addr)], sta);
479 -static void sta_unblock(struct work_struct *wk)
480 +static void sta_deliver_ps_frames(struct work_struct *wk)
482 struct sta_info *sta;
484 - sta = container_of(wk, struct sta_info, drv_unblock_wk);
485 + sta = container_of(wk, struct sta_info, drv_deliver_wk);
490 - if (!test_sta_flag(sta, WLAN_STA_PS_STA)) {
491 - local_bh_disable();
492 + local_bh_disable();
493 + if (!test_sta_flag(sta, WLAN_STA_PS_STA))
494 ieee80211_sta_ps_deliver_wakeup(sta);
496 - } else if (test_and_clear_sta_flag(sta, WLAN_STA_PSPOLL)) {
497 - clear_sta_flag(sta, WLAN_STA_PS_DRIVER);
499 - local_bh_disable();
500 + else if (test_and_clear_sta_flag(sta, WLAN_STA_PSPOLL))
501 ieee80211_sta_ps_deliver_poll_response(sta);
503 - } else if (test_and_clear_sta_flag(sta, WLAN_STA_UAPSD)) {
504 - clear_sta_flag(sta, WLAN_STA_PS_DRIVER);
506 - local_bh_disable();
507 + else if (test_and_clear_sta_flag(sta, WLAN_STA_UAPSD))
508 ieee80211_sta_ps_deliver_uapsd(sta);
511 - clear_sta_flag(sta, WLAN_STA_PS_DRIVER);
515 static int sta_prepare_rate_control(struct ieee80211_local *local,
516 @@ -340,7 +337,7 @@ struct sta_info *sta_info_alloc(struct i
518 spin_lock_init(&sta->lock);
519 spin_lock_init(&sta->ps_lock);
520 - INIT_WORK(&sta->drv_unblock_wk, sta_unblock);
521 + INIT_WORK(&sta->drv_deliver_wk, sta_deliver_ps_frames);
522 INIT_WORK(&sta->ampdu_mlme.work, ieee80211_ba_session_work);
523 mutex_init(&sta->ampdu_mlme.mtx);
524 #ifdef CPTCFG_MAC80211_MESH
525 @@ -1140,8 +1137,15 @@ void ieee80211_sta_ps_deliver_wakeup(str
528 ieee80211_add_pending_skbs(local, &pending);
529 - clear_sta_flag(sta, WLAN_STA_PS_DRIVER);
530 - clear_sta_flag(sta, WLAN_STA_PS_STA);
532 + /* now we're no longer in the deliver code */
533 + clear_sta_flag(sta, WLAN_STA_PS_DELIVER);
535 + /* The station might have polled and then woken up before we responded,
536 + * so clear these flags now to avoid them sticking around.
538 + clear_sta_flag(sta, WLAN_STA_PSPOLL);
539 + clear_sta_flag(sta, WLAN_STA_UAPSD);
540 spin_unlock(&sta->ps_lock);
542 atomic_dec(&ps->num_sta_ps);
543 @@ -1542,10 +1546,26 @@ void ieee80211_sta_block_awake(struct ie
545 trace_api_sta_block_awake(sta->local, pubsta, block);
549 set_sta_flag(sta, WLAN_STA_PS_DRIVER);
550 - else if (test_sta_flag(sta, WLAN_STA_PS_DRIVER))
551 - ieee80211_queue_work(hw, &sta->drv_unblock_wk);
555 + if (!test_sta_flag(sta, WLAN_STA_PS_DRIVER))
558 + if (!test_sta_flag(sta, WLAN_STA_PS_STA)) {
559 + set_sta_flag(sta, WLAN_STA_PS_DELIVER);
560 + clear_sta_flag(sta, WLAN_STA_PS_DRIVER);
561 + ieee80211_queue_work(hw, &sta->drv_deliver_wk);
562 + } else if (test_sta_flag(sta, WLAN_STA_PSPOLL) ||
563 + test_sta_flag(sta, WLAN_STA_UAPSD)) {
564 + /* must be asleep in this case */
565 + clear_sta_flag(sta, WLAN_STA_PS_DRIVER);
566 + ieee80211_queue_work(hw, &sta->drv_deliver_wk);
568 + clear_sta_flag(sta, WLAN_STA_PS_DRIVER);
571 EXPORT_SYMBOL(ieee80211_sta_block_awake);
573 @@ -1703,3 +1723,137 @@ u8 sta_info_tx_streams(struct sta_info *
574 return ((ht_cap->mcs.tx_params & IEEE80211_HT_MCS_TX_MAX_STREAMS_MASK)
575 >> IEEE80211_HT_MCS_TX_MAX_STREAMS_SHIFT) + 1;
578 +void sta_set_sinfo(struct sta_info *sta, struct station_info *sinfo)
580 + struct ieee80211_sub_if_data *sdata = sta->sdata;
581 + struct ieee80211_local *local = sdata->local;
582 + struct rate_control_ref *ref = local->rate_ctrl;
583 + struct timespec uptime;
588 + sinfo->generation = sdata->local->sta_generation;
590 + sinfo->filled = STATION_INFO_INACTIVE_TIME |
591 + STATION_INFO_RX_BYTES64 |
592 + STATION_INFO_TX_BYTES64 |
593 + STATION_INFO_RX_PACKETS |
594 + STATION_INFO_TX_PACKETS |
595 + STATION_INFO_TX_RETRIES |
596 + STATION_INFO_TX_FAILED |
597 + STATION_INFO_TX_BITRATE |
598 + STATION_INFO_RX_BITRATE |
599 + STATION_INFO_RX_DROP_MISC |
600 + STATION_INFO_BSS_PARAM |
601 + STATION_INFO_CONNECTED_TIME |
602 + STATION_INFO_STA_FLAGS |
603 + STATION_INFO_BEACON_LOSS_COUNT;
605 + do_posix_clock_monotonic_gettime(&uptime);
606 + sinfo->connected_time = uptime.tv_sec - sta->last_connected;
608 + sinfo->inactive_time = jiffies_to_msecs(jiffies - sta->last_rx);
609 + sinfo->tx_bytes = 0;
610 + for (ac = 0; ac < IEEE80211_NUM_ACS; ac++) {
611 + sinfo->tx_bytes += sta->tx_bytes[ac];
612 + packets += sta->tx_packets[ac];
614 + sinfo->tx_packets = packets;
615 + sinfo->rx_bytes = sta->rx_bytes;
616 + sinfo->rx_packets = sta->rx_packets;
617 + sinfo->tx_retries = sta->tx_retry_count;
618 + sinfo->tx_failed = sta->tx_retry_failed;
619 + sinfo->rx_dropped_misc = sta->rx_dropped;
620 + sinfo->beacon_loss_count = sta->beacon_loss_count;
622 + if ((sta->local->hw.flags & IEEE80211_HW_SIGNAL_DBM) ||
623 + (sta->local->hw.flags & IEEE80211_HW_SIGNAL_UNSPEC)) {
624 + sinfo->filled |= STATION_INFO_SIGNAL | STATION_INFO_SIGNAL_AVG;
625 + if (!local->ops->get_rssi ||
626 + drv_get_rssi(local, sdata, &sta->sta, &sinfo->signal))
627 + sinfo->signal = (s8)sta->last_signal;
628 + sinfo->signal_avg = (s8) -ewma_read(&sta->avg_signal);
631 + sinfo->filled |= STATION_INFO_CHAIN_SIGNAL |
632 + STATION_INFO_CHAIN_SIGNAL_AVG;
634 + sinfo->chains = sta->chains;
635 + for (i = 0; i < ARRAY_SIZE(sinfo->chain_signal); i++) {
636 + sinfo->chain_signal[i] = sta->chain_signal_last[i];
637 + sinfo->chain_signal_avg[i] =
638 + (s8) -ewma_read(&sta->chain_signal_avg[i]);
642 + sta_set_rate_info_tx(sta, &sta->last_tx_rate, &sinfo->txrate);
643 + sta_set_rate_info_rx(sta, &sinfo->rxrate);
645 + if (ieee80211_vif_is_mesh(&sdata->vif)) {
646 +#ifdef CPTCFG_MAC80211_MESH
647 + sinfo->filled |= STATION_INFO_LLID |
648 + STATION_INFO_PLID |
649 + STATION_INFO_PLINK_STATE |
650 + STATION_INFO_LOCAL_PM |
651 + STATION_INFO_PEER_PM |
652 + STATION_INFO_NONPEER_PM;
654 + sinfo->llid = sta->llid;
655 + sinfo->plid = sta->plid;
656 + sinfo->plink_state = sta->plink_state;
657 + if (test_sta_flag(sta, WLAN_STA_TOFFSET_KNOWN)) {
658 + sinfo->filled |= STATION_INFO_T_OFFSET;
659 + sinfo->t_offset = sta->t_offset;
661 + sinfo->local_pm = sta->local_pm;
662 + sinfo->peer_pm = sta->peer_pm;
663 + sinfo->nonpeer_pm = sta->nonpeer_pm;
667 + sinfo->bss_param.flags = 0;
668 + if (sdata->vif.bss_conf.use_cts_prot)
669 + sinfo->bss_param.flags |= BSS_PARAM_FLAGS_CTS_PROT;
670 + if (sdata->vif.bss_conf.use_short_preamble)
671 + sinfo->bss_param.flags |= BSS_PARAM_FLAGS_SHORT_PREAMBLE;
672 + if (sdata->vif.bss_conf.use_short_slot)
673 + sinfo->bss_param.flags |= BSS_PARAM_FLAGS_SHORT_SLOT_TIME;
674 + sinfo->bss_param.dtim_period = sdata->local->hw.conf.ps_dtim_period;
675 + sinfo->bss_param.beacon_interval = sdata->vif.bss_conf.beacon_int;
677 + sinfo->sta_flags.set = 0;
678 + sinfo->sta_flags.mask = BIT(NL80211_STA_FLAG_AUTHORIZED) |
679 + BIT(NL80211_STA_FLAG_SHORT_PREAMBLE) |
680 + BIT(NL80211_STA_FLAG_WME) |
681 + BIT(NL80211_STA_FLAG_MFP) |
682 + BIT(NL80211_STA_FLAG_AUTHENTICATED) |
683 + BIT(NL80211_STA_FLAG_ASSOCIATED) |
684 + BIT(NL80211_STA_FLAG_TDLS_PEER);
685 + if (test_sta_flag(sta, WLAN_STA_AUTHORIZED))
686 + sinfo->sta_flags.set |= BIT(NL80211_STA_FLAG_AUTHORIZED);
687 + if (test_sta_flag(sta, WLAN_STA_SHORT_PREAMBLE))
688 + sinfo->sta_flags.set |= BIT(NL80211_STA_FLAG_SHORT_PREAMBLE);
689 + if (test_sta_flag(sta, WLAN_STA_WME))
690 + sinfo->sta_flags.set |= BIT(NL80211_STA_FLAG_WME);
691 + if (test_sta_flag(sta, WLAN_STA_MFP))
692 + sinfo->sta_flags.set |= BIT(NL80211_STA_FLAG_MFP);
693 + if (test_sta_flag(sta, WLAN_STA_AUTH))
694 + sinfo->sta_flags.set |= BIT(NL80211_STA_FLAG_AUTHENTICATED);
695 + if (test_sta_flag(sta, WLAN_STA_ASSOC))
696 + sinfo->sta_flags.set |= BIT(NL80211_STA_FLAG_ASSOCIATED);
697 + if (test_sta_flag(sta, WLAN_STA_TDLS_PEER))
698 + sinfo->sta_flags.set |= BIT(NL80211_STA_FLAG_TDLS_PEER);
700 + /* check if the driver has a SW RC implementation */
701 + if (ref && ref->ops->get_expected_throughput)
702 + thr = ref->ops->get_expected_throughput(sta->rate_ctrl_priv);
704 + thr = drv_get_expected_throughput(local, &sta->sta);
707 + sinfo->filled |= STATION_INFO_EXPECTED_THROUGHPUT;
708 + sinfo->expected_throughput = thr;
711 --- a/net/mac80211/status.c
712 +++ b/net/mac80211/status.c
713 @@ -541,6 +541,23 @@ static void ieee80211_tx_latency_end_msr
715 #define STA_LOST_PKT_THRESHOLD 50
717 +static void ieee80211_lost_packet(struct sta_info *sta, struct sk_buff *skb)
719 + struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
721 + /* This packet was aggregated but doesn't carry status info */
722 + if ((info->flags & IEEE80211_TX_CTL_AMPDU) &&
723 + !(info->flags & IEEE80211_TX_STAT_AMPDU))
726 + if (++sta->lost_packets < STA_LOST_PKT_THRESHOLD)
729 + cfg80211_cqm_pktloss_notify(sta->sdata->dev, sta->sta.addr,
730 + sta->lost_packets, GFP_ATOMIC);
731 + sta->lost_packets = 0;
734 void ieee80211_tx_status(struct ieee80211_hw *hw, struct sk_buff *skb)
736 struct sk_buff *skb2;
737 @@ -680,12 +697,8 @@ void ieee80211_tx_status(struct ieee8021
738 if (info->flags & IEEE80211_TX_STAT_ACK) {
739 if (sta->lost_packets)
740 sta->lost_packets = 0;
741 - } else if (++sta->lost_packets >= STA_LOST_PKT_THRESHOLD) {
742 - cfg80211_cqm_pktloss_notify(sta->sdata->dev,
746 - sta->lost_packets = 0;
748 + ieee80211_lost_packet(sta, skb);
752 --- a/net/mac80211/rx.c
753 +++ b/net/mac80211/rx.c
754 @@ -1107,6 +1107,8 @@ static void sta_ps_end(struct sta_info *
758 + set_sta_flag(sta, WLAN_STA_PS_DELIVER);
759 + clear_sta_flag(sta, WLAN_STA_PS_STA);
760 ieee80211_sta_ps_deliver_wakeup(sta);
763 --- a/net/mac80211/sta_info.h
764 +++ b/net/mac80211/sta_info.h
765 @@ -82,6 +82,7 @@ enum ieee80211_sta_info_flags {
766 WLAN_STA_TOFFSET_KNOWN,
768 WLAN_STA_MPSP_RECIPIENT,
769 + WLAN_STA_PS_DELIVER,
772 #define ADDBA_RESP_INTERVAL HZ
773 @@ -265,7 +266,7 @@ struct ieee80211_tx_latency_stat {
774 * @last_rx_rate_vht_nss: rx status nss of last data packet
775 * @lock: used for locking all fields that require locking, see comments
776 * in the header file.
777 - * @drv_unblock_wk: used for driver PS unblocking
778 + * @drv_deliver_wk: used for delivering frames after driver PS unblocking
779 * @listen_interval: listen interval of this station, when we're acting as AP
780 * @_flags: STA flags, see &enum ieee80211_sta_info_flags, do not use directly
781 * @ps_lock: used for powersave (when mac80211 is the AP) related locking
782 @@ -278,7 +279,6 @@ struct ieee80211_tx_latency_stat {
783 * @driver_buffered_tids: bitmap of TIDs the driver has data buffered on
784 * @rx_packets: Number of MSDUs received from this STA
785 * @rx_bytes: Number of bytes received from this STA
786 - * @wep_weak_iv_count: number of weak WEP IVs received from this station
787 * @last_rx: time (in jiffies) when last frame was received from this STA
788 * @last_connected: time (in seconds) when a station got connected
789 * @num_duplicates: number of duplicate frames received from this STA
790 @@ -345,7 +345,7 @@ struct sta_info {
791 void *rate_ctrl_priv;
794 - struct work_struct drv_unblock_wk;
795 + struct work_struct drv_deliver_wk;
799 @@ -367,7 +367,6 @@ struct sta_info {
800 /* Updated from RX path only, no locking requirements */
801 unsigned long rx_packets;
803 - unsigned long wep_weak_iv_count;
804 unsigned long last_rx;
806 unsigned long num_duplicates;
807 @@ -628,6 +627,8 @@ void sta_set_rate_info_tx(struct sta_inf
808 struct rate_info *rinfo);
809 void sta_set_rate_info_rx(struct sta_info *sta,
810 struct rate_info *rinfo);
811 +void sta_set_sinfo(struct sta_info *sta, struct station_info *sinfo);
813 void ieee80211_sta_expire(struct ieee80211_sub_if_data *sdata,
814 unsigned long exp_time);
815 u8 sta_info_tx_streams(struct sta_info *sta);
816 --- a/net/mac80211/tx.c
817 +++ b/net/mac80211/tx.c
818 @@ -469,7 +469,8 @@ ieee80211_tx_h_unicast_ps_buf(struct iee
821 if (unlikely((test_sta_flag(sta, WLAN_STA_PS_STA) ||
822 - test_sta_flag(sta, WLAN_STA_PS_DRIVER)) &&
823 + test_sta_flag(sta, WLAN_STA_PS_DRIVER) ||
824 + test_sta_flag(sta, WLAN_STA_PS_DELIVER)) &&
825 !(info->flags & IEEE80211_TX_CTL_NO_PS_BUFFER))) {
826 int ac = skb_get_queue_mapping(tx->skb);
828 @@ -486,7 +487,8 @@ ieee80211_tx_h_unicast_ps_buf(struct iee
829 * ahead and Tx the packet.
831 if (!test_sta_flag(sta, WLAN_STA_PS_STA) &&
832 - !test_sta_flag(sta, WLAN_STA_PS_DRIVER)) {
833 + !test_sta_flag(sta, WLAN_STA_PS_DRIVER) &&
834 + !test_sta_flag(sta, WLAN_STA_PS_DELIVER)) {
835 spin_unlock(&sta->ps_lock);
838 @@ -1618,12 +1620,12 @@ netdev_tx_t ieee80211_monitor_start_xmit
840 struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr);
841 struct ieee80211_chanctx_conf *chanctx_conf;
842 - struct ieee80211_channel *chan;
843 struct ieee80211_radiotap_header *prthdr =
844 (struct ieee80211_radiotap_header *)skb->data;
845 struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
846 struct ieee80211_hdr *hdr;
847 struct ieee80211_sub_if_data *tmp_sdata, *sdata;
848 + struct cfg80211_chan_def *chandef;
852 @@ -1721,9 +1723,9 @@ netdev_tx_t ieee80211_monitor_start_xmit
856 - chan = chanctx_conf->def.chan;
857 + chandef = &chanctx_conf->def;
858 else if (!local->use_chanctx)
859 - chan = local->_oper_chandef.chan;
860 + chandef = &local->_oper_chandef;
864 @@ -1743,10 +1745,11 @@ netdev_tx_t ieee80211_monitor_start_xmit
865 * radar detection by itself. We can do that later by adding a
866 * monitor flag interfaces used for AP support.
868 - if ((chan->flags & (IEEE80211_CHAN_NO_IR | IEEE80211_CHAN_RADAR)))
869 + if (!cfg80211_reg_can_beacon(local->hw.wiphy, chandef,
873 - ieee80211_xmit(sdata, skb, chan->band);
874 + ieee80211_xmit(sdata, skb, chandef->chan->band);
878 @@ -2425,7 +2428,7 @@ static void ieee80211_set_csa(struct iee
880 size_t beacon_data_len;
882 - u8 count = sdata->csa_current_counter;
883 + u8 count = beacon->csa_current_counter;
885 switch (sdata->vif.type) {
886 case NL80211_IFTYPE_AP:
887 @@ -2444,46 +2447,54 @@ static void ieee80211_set_csa(struct iee
892 for (i = 0; i < IEEE80211_MAX_CSA_COUNTERS_NUM; ++i) {
893 - u16 counter_offset_beacon =
894 - sdata->csa_counter_offset_beacon[i];
895 - u16 counter_offset_presp = sdata->csa_counter_offset_presp[i];
897 - if (counter_offset_beacon) {
898 - if (WARN_ON(counter_offset_beacon >= beacon_data_len))
901 - beacon_data[counter_offset_beacon] = count;
904 - if (sdata->vif.type == NL80211_IFTYPE_AP &&
905 - counter_offset_presp) {
907 - resp = rcu_dereference(sdata->u.ap.probe_resp);
908 + resp = rcu_dereference(sdata->u.ap.probe_resp);
910 - /* If nl80211 accepted the offset, this should
913 - if (WARN_ON(!resp)) {
914 + if (beacon->csa_counter_offsets[i]) {
915 + if (WARN_ON_ONCE(beacon->csa_counter_offsets[i] >=
916 + beacon_data_len)) {
920 - resp->data[counter_offset_presp] = count;
923 + beacon_data[beacon->csa_counter_offsets[i]] = count;
926 + if (sdata->vif.type == NL80211_IFTYPE_AP && resp &&
927 + resp->csa_counter_offsets)
928 + resp->data[resp->csa_counter_offsets[i]] = count;
933 u8 ieee80211_csa_update_counter(struct ieee80211_vif *vif)
935 struct ieee80211_sub_if_data *sdata = vif_to_sdata(vif);
936 + struct beacon_data *beacon = NULL;
941 + if (sdata->vif.type == NL80211_IFTYPE_AP)
942 + beacon = rcu_dereference(sdata->u.ap.beacon);
943 + else if (sdata->vif.type == NL80211_IFTYPE_ADHOC)
944 + beacon = rcu_dereference(sdata->u.ibss.presp);
945 + else if (ieee80211_vif_is_mesh(&sdata->vif))
946 + beacon = rcu_dereference(sdata->u.mesh.beacon);
951 - sdata->csa_current_counter--;
952 + beacon->csa_current_counter--;
954 /* the counter should never reach 0 */
955 - WARN_ON(!sdata->csa_current_counter);
956 + WARN_ON_ONCE(!beacon->csa_current_counter);
957 + count = beacon->csa_current_counter;
959 - return sdata->csa_current_counter;
964 EXPORT_SYMBOL(ieee80211_csa_update_counter);
966 @@ -2493,7 +2504,6 @@ bool ieee80211_csa_is_complete(struct ie
967 struct beacon_data *beacon = NULL;
969 size_t beacon_data_len;
970 - int counter_beacon = sdata->csa_counter_offset_beacon[0];
973 if (!ieee80211_sdata_running(sdata))
974 @@ -2531,10 +2541,13 @@ bool ieee80211_csa_is_complete(struct ie
978 - if (WARN_ON(counter_beacon > beacon_data_len))
979 + if (!beacon->csa_counter_offsets[0])
982 + if (WARN_ON_ONCE(beacon->csa_counter_offsets[0] > beacon_data_len))
985 - if (beacon_data[counter_beacon] == 1)
986 + if (beacon_data[beacon->csa_counter_offsets[0]] == 1)
990 @@ -2550,6 +2563,7 @@ __ieee80211_beacon_get(struct ieee80211_
993 struct ieee80211_local *local = hw_to_local(hw);
994 + struct beacon_data *beacon = NULL;
995 struct sk_buff *skb = NULL;
996 struct ieee80211_tx_info *info;
997 struct ieee80211_sub_if_data *sdata = NULL;
998 @@ -2571,10 +2585,10 @@ __ieee80211_beacon_get(struct ieee80211_
1000 if (sdata->vif.type == NL80211_IFTYPE_AP) {
1001 struct ieee80211_if_ap *ap = &sdata->u.ap;
1002 - struct beacon_data *beacon = rcu_dereference(ap->beacon);
1004 + beacon = rcu_dereference(ap->beacon);
1006 - if (sdata->vif.csa_active) {
1007 + if (beacon->csa_counter_offsets[0]) {
1009 ieee80211_csa_update_counter(vif);
1011 @@ -2615,37 +2629,37 @@ __ieee80211_beacon_get(struct ieee80211_
1012 } else if (sdata->vif.type == NL80211_IFTYPE_ADHOC) {
1013 struct ieee80211_if_ibss *ifibss = &sdata->u.ibss;
1014 struct ieee80211_hdr *hdr;
1015 - struct beacon_data *presp = rcu_dereference(ifibss->presp);
1018 + beacon = rcu_dereference(ifibss->presp);
1022 - if (sdata->vif.csa_active) {
1023 + if (beacon->csa_counter_offsets[0]) {
1025 ieee80211_csa_update_counter(vif);
1027 - ieee80211_set_csa(sdata, presp);
1028 + ieee80211_set_csa(sdata, beacon);
1031 - skb = dev_alloc_skb(local->tx_headroom + presp->head_len +
1032 + skb = dev_alloc_skb(local->tx_headroom + beacon->head_len +
1033 local->hw.extra_beacon_tailroom);
1036 skb_reserve(skb, local->tx_headroom);
1037 - memcpy(skb_put(skb, presp->head_len), presp->head,
1039 + memcpy(skb_put(skb, beacon->head_len), beacon->head,
1040 + beacon->head_len);
1042 hdr = (struct ieee80211_hdr *) skb->data;
1043 hdr->frame_control = cpu_to_le16(IEEE80211_FTYPE_MGMT |
1044 IEEE80211_STYPE_BEACON);
1045 } else if (ieee80211_vif_is_mesh(&sdata->vif)) {
1046 struct ieee80211_if_mesh *ifmsh = &sdata->u.mesh;
1047 - struct beacon_data *bcn = rcu_dereference(ifmsh->beacon);
1050 + beacon = rcu_dereference(ifmsh->beacon);
1054 - if (sdata->vif.csa_active) {
1055 + if (beacon->csa_counter_offsets[0]) {
1057 /* TODO: For mesh csa_counter is in TU, so
1058 * decrementing it by one isn't correct, but
1059 @@ -2654,40 +2668,42 @@ __ieee80211_beacon_get(struct ieee80211_
1061 ieee80211_csa_update_counter(vif);
1063 - ieee80211_set_csa(sdata, bcn);
1064 + ieee80211_set_csa(sdata, beacon);
1067 if (ifmsh->sync_ops)
1068 - ifmsh->sync_ops->adjust_tbtt(sdata, bcn);
1069 + ifmsh->sync_ops->adjust_tbtt(sdata, beacon);
1071 skb = dev_alloc_skb(local->tx_headroom +
1073 + beacon->head_len +
1076 + beacon->tail_len +
1077 local->hw.extra_beacon_tailroom);
1080 skb_reserve(skb, local->tx_headroom);
1081 - memcpy(skb_put(skb, bcn->head_len), bcn->head, bcn->head_len);
1082 + memcpy(skb_put(skb, beacon->head_len), beacon->head,
1083 + beacon->head_len);
1084 ieee80211_beacon_add_tim(sdata, &ifmsh->ps, skb, is_template);
1087 - offs->tim_offset = bcn->head_len;
1088 - offs->tim_length = skb->len - bcn->head_len;
1089 + offs->tim_offset = beacon->head_len;
1090 + offs->tim_length = skb->len - beacon->head_len;
1093 - memcpy(skb_put(skb, bcn->tail_len), bcn->tail, bcn->tail_len);
1094 + memcpy(skb_put(skb, beacon->tail_len), beacon->tail,
1095 + beacon->tail_len);
1103 + if (offs && beacon) {
1106 for (i = 0; i < IEEE80211_MAX_CSA_COUNTERS_NUM; i++) {
1107 - u16 csa_off = sdata->csa_counter_offset_beacon[i];
1108 + u16 csa_off = beacon->csa_counter_offsets[i];
1112 --- a/drivers/net/wireless/rt2x00/rt2800lib.c
1113 +++ b/drivers/net/wireless/rt2x00/rt2800lib.c
1114 @@ -947,6 +947,40 @@ static inline u8 rt2800_get_beacon_offse
1115 return BEACON_BASE_TO_OFFSET(rt2800_hw_beacon_base(rt2x00dev, index));
1118 +static void rt2800_update_beacons_setup(struct rt2x00_dev *rt2x00dev)
1120 + struct data_queue *queue = rt2x00dev->bcn;
1121 + struct queue_entry *entry;
1122 + int i, bcn_num = 0;
1127 + * Setup offsets of all active beacons in BCN_OFFSET{0,1} registers.
1129 + for (i = 0; i < queue->limit; i++) {
1130 + entry = &queue->entries[i];
1131 + if (!test_bit(ENTRY_BCN_ENABLED, &entry->flags))
1133 + off = rt2800_get_beacon_offset(rt2x00dev, entry->entry_idx);
1134 + reg |= off << (8 * bcn_num);
1138 + WARN_ON_ONCE(bcn_num != rt2x00dev->intf_beaconing);
1140 + rt2800_register_write(rt2x00dev, BCN_OFFSET0, (u32) reg);
1141 + rt2800_register_write(rt2x00dev, BCN_OFFSET1, (u32) (reg >> 32));
1144 + * H/W sends up to MAC_BSSID_DW1_BSS_BCN_NUM + 1 consecutive beacons.
1146 + rt2800_register_read(rt2x00dev, MAC_BSSID_DW1, &bssid_dw1);
1147 + rt2x00_set_field32(&bssid_dw1, MAC_BSSID_DW1_BSS_BCN_NUM,
1148 + bcn_num > 0 ? bcn_num - 1 : 0);
1149 + rt2800_register_write(rt2x00dev, MAC_BSSID_DW1, bssid_dw1);
1152 void rt2800_write_beacon(struct queue_entry *entry, struct txentry_desc *txdesc)
1154 struct rt2x00_dev *rt2x00dev = entry->queue->rt2x00dev;
1155 @@ -1003,6 +1037,12 @@ void rt2800_write_beacon(struct queue_en
1157 rt2800_register_multiwrite(rt2x00dev, beacon_base, entry->skb->data,
1158 entry->skb->len + padding_len);
1159 + __set_bit(ENTRY_BCN_ENABLED, &entry->flags);
1162 + * Change global beacons settings.
1164 + rt2800_update_beacons_setup(rt2x00dev);
1167 * Restore beaconing state.
1168 @@ -1053,8 +1093,13 @@ void rt2800_clear_beacon(struct queue_en
1171 rt2800_clear_beacon_register(rt2x00dev, entry->entry_idx);
1172 + __clear_bit(ENTRY_BCN_ENABLED, &entry->flags);
1175 + * Change global beacons settings.
1177 + rt2800_update_beacons_setup(rt2x00dev);
1179 * Restore beaconing state.
1181 rt2800_register_write(rt2x00dev, BCN_TIME_CFG, orig_reg);
1182 @@ -1556,7 +1601,7 @@ void rt2800_config_intf(struct rt2x00_de
1183 if (!is_zero_ether_addr((const u8 *)conf->bssid)) {
1184 reg = le32_to_cpu(conf->bssid[1]);
1185 rt2x00_set_field32(®, MAC_BSSID_DW1_BSS_ID_MASK, 3);
1186 - rt2x00_set_field32(®, MAC_BSSID_DW1_BSS_BCN_NUM, 7);
1187 + rt2x00_set_field32(®, MAC_BSSID_DW1_BSS_BCN_NUM, 0);
1188 conf->bssid[1] = cpu_to_le32(reg);
1191 @@ -4517,28 +4562,6 @@ static int rt2800_init_registers(struct
1195 - rt2800_register_read(rt2x00dev, BCN_OFFSET0, ®);
1196 - rt2x00_set_field32(®, BCN_OFFSET0_BCN0,
1197 - rt2800_get_beacon_offset(rt2x00dev, 0));
1198 - rt2x00_set_field32(®, BCN_OFFSET0_BCN1,
1199 - rt2800_get_beacon_offset(rt2x00dev, 1));
1200 - rt2x00_set_field32(®, BCN_OFFSET0_BCN2,
1201 - rt2800_get_beacon_offset(rt2x00dev, 2));
1202 - rt2x00_set_field32(®, BCN_OFFSET0_BCN3,
1203 - rt2800_get_beacon_offset(rt2x00dev, 3));
1204 - rt2800_register_write(rt2x00dev, BCN_OFFSET0, reg);
1206 - rt2800_register_read(rt2x00dev, BCN_OFFSET1, ®);
1207 - rt2x00_set_field32(®, BCN_OFFSET1_BCN4,
1208 - rt2800_get_beacon_offset(rt2x00dev, 4));
1209 - rt2x00_set_field32(®, BCN_OFFSET1_BCN5,
1210 - rt2800_get_beacon_offset(rt2x00dev, 5));
1211 - rt2x00_set_field32(®, BCN_OFFSET1_BCN6,
1212 - rt2800_get_beacon_offset(rt2x00dev, 6));
1213 - rt2x00_set_field32(®, BCN_OFFSET1_BCN7,
1214 - rt2800_get_beacon_offset(rt2x00dev, 7));
1215 - rt2800_register_write(rt2x00dev, BCN_OFFSET1, reg);
1217 rt2800_register_write(rt2x00dev, LEGACY_BASIC_RATE, 0x0000013f);
1218 rt2800_register_write(rt2x00dev, HT_BASIC_RATE, 0x00008003);
1220 --- a/drivers/net/wireless/rt2x00/rt2x00dev.c
1221 +++ b/drivers/net/wireless/rt2x00/rt2x00dev.c
1222 @@ -141,8 +141,11 @@ static void rt2x00lib_intf_scheduled_ite
1223 if (!test_bit(DEVICE_STATE_ENABLED_RADIO, &rt2x00dev->flags))
1226 - if (test_and_clear_bit(DELAYED_UPDATE_BEACON, &intf->delayed_flags))
1227 + if (test_and_clear_bit(DELAYED_UPDATE_BEACON, &intf->delayed_flags)) {
1228 + mutex_lock(&intf->beacon_skb_mutex);
1229 rt2x00queue_update_beacon(rt2x00dev, vif);
1230 + mutex_unlock(&intf->beacon_skb_mutex);
1234 static void rt2x00lib_intf_scheduled(struct work_struct *work)
1235 @@ -216,7 +219,7 @@ static void rt2x00lib_beaconupdate_iter(
1236 * never be called for USB devices.
1238 WARN_ON(rt2x00_is_usb(rt2x00dev));
1239 - rt2x00queue_update_beacon_locked(rt2x00dev, vif);
1240 + rt2x00queue_update_beacon(rt2x00dev, vif);
1243 void rt2x00lib_beacondone(struct rt2x00_dev *rt2x00dev)
1244 --- a/drivers/net/wireless/rt2x00/rt2x00mac.c
1245 +++ b/drivers/net/wireless/rt2x00/rt2x00mac.c
1246 @@ -624,25 +624,24 @@ void rt2x00mac_bss_info_changed(struct i
1247 * Start/stop beaconing.
1249 if (changes & BSS_CHANGED_BEACON_ENABLED) {
1250 + mutex_lock(&intf->beacon_skb_mutex);
1251 if (!bss_conf->enable_beacon && intf->enable_beacon) {
1252 rt2x00dev->intf_beaconing--;
1253 intf->enable_beacon = false;
1255 - * Clear beacon in the H/W for this vif. This is needed
1256 - * to disable beaconing on this particular interface
1257 - * and keep it running on other interfaces.
1259 - rt2x00queue_clear_beacon(rt2x00dev, vif);
1261 if (rt2x00dev->intf_beaconing == 0) {
1263 * Last beaconing interface disabled
1264 * -> stop beacon queue.
1266 - mutex_lock(&intf->beacon_skb_mutex);
1267 rt2x00queue_stop_queue(rt2x00dev->bcn);
1268 - mutex_unlock(&intf->beacon_skb_mutex);
1271 + * Clear beacon in the H/W for this vif. This is needed
1272 + * to disable beaconing on this particular interface
1273 + * and keep it running on other interfaces.
1275 + rt2x00queue_clear_beacon(rt2x00dev, vif);
1276 } else if (bss_conf->enable_beacon && !intf->enable_beacon) {
1277 rt2x00dev->intf_beaconing++;
1278 intf->enable_beacon = true;
1279 @@ -658,11 +657,10 @@ void rt2x00mac_bss_info_changed(struct i
1280 * First beaconing interface enabled
1281 * -> start beacon queue.
1283 - mutex_lock(&intf->beacon_skb_mutex);
1284 rt2x00queue_start_queue(rt2x00dev->bcn);
1285 - mutex_unlock(&intf->beacon_skb_mutex);
1288 + mutex_unlock(&intf->beacon_skb_mutex);
1292 --- a/drivers/net/wireless/rt2x00/rt2x00queue.c
1293 +++ b/drivers/net/wireless/rt2x00/rt2x00queue.c
1294 @@ -754,8 +754,6 @@ int rt2x00queue_clear_beacon(struct rt2x
1295 if (unlikely(!intf->beacon))
1298 - mutex_lock(&intf->beacon_skb_mutex);
1301 * Clean up the beacon skb.
1303 @@ -768,13 +766,11 @@ int rt2x00queue_clear_beacon(struct rt2x
1304 if (rt2x00dev->ops->lib->clear_beacon)
1305 rt2x00dev->ops->lib->clear_beacon(intf->beacon);
1307 - mutex_unlock(&intf->beacon_skb_mutex);
1312 -int rt2x00queue_update_beacon_locked(struct rt2x00_dev *rt2x00dev,
1313 - struct ieee80211_vif *vif)
1314 +int rt2x00queue_update_beacon(struct rt2x00_dev *rt2x00dev,
1315 + struct ieee80211_vif *vif)
1317 struct rt2x00_intf *intf = vif_to_intf(vif);
1318 struct skb_frame_desc *skbdesc;
1319 @@ -815,19 +811,6 @@ int rt2x00queue_update_beacon_locked(str
1323 -int rt2x00queue_update_beacon(struct rt2x00_dev *rt2x00dev,
1324 - struct ieee80211_vif *vif)
1326 - struct rt2x00_intf *intf = vif_to_intf(vif);
1329 - mutex_lock(&intf->beacon_skb_mutex);
1330 - ret = rt2x00queue_update_beacon_locked(rt2x00dev, vif);
1331 - mutex_unlock(&intf->beacon_skb_mutex);
1336 bool rt2x00queue_for_each_entry(struct data_queue *queue,
1337 enum queue_index start,
1338 enum queue_index end,
1339 --- a/drivers/net/wireless/rt2x00/rt2x00queue.h
1340 +++ b/drivers/net/wireless/rt2x00/rt2x00queue.h
1341 @@ -353,6 +353,7 @@ struct txentry_desc {
1343 enum queue_entry_flags {
1345 + ENTRY_BCN_ENABLED,
1346 ENTRY_OWNER_DEVICE_DATA,
1348 ENTRY_DATA_IO_FAILED,
1349 --- a/drivers/net/wireless/ath/ath9k/main.c
1350 +++ b/drivers/net/wireless/ath/ath9k/main.c
1351 @@ -1757,7 +1757,6 @@ out:
1352 void ath9k_update_p2p_ps(struct ath_softc *sc, struct ieee80211_vif *vif)
1354 struct ath_vif *avp = (void *)vif->drv_priv;
1355 - unsigned long flags;
1358 if (!sc->p2p_ps_timer)
1359 @@ -1767,14 +1766,9 @@ void ath9k_update_p2p_ps(struct ath_soft
1362 sc->p2p_ps_vif = avp;
1364 - spin_lock_irqsave(&sc->sc_pm_lock, flags);
1365 - if (!(sc->ps_flags & PS_BEACON_SYNC)) {
1366 - tsf = ath9k_hw_gettsf32(sc->sc_ah);
1367 - ieee80211_parse_p2p_noa(&vif->bss_conf.p2p_noa_attr, &avp->noa, tsf);
1368 - ath9k_update_p2p_ps_timer(sc, avp);
1370 - spin_unlock_irqrestore(&sc->sc_pm_lock, flags);
1371 + tsf = ath9k_hw_gettsf32(sc->sc_ah);
1372 + ieee80211_parse_p2p_noa(&vif->bss_conf.p2p_noa_attr, &avp->noa, tsf);
1373 + ath9k_update_p2p_ps_timer(sc, avp);
1376 static void ath9k_bss_info_changed(struct ieee80211_hw *hw,
1377 @@ -1791,6 +1785,7 @@ static void ath9k_bss_info_changed(struc
1378 struct ath_hw *ah = sc->sc_ah;
1379 struct ath_common *common = ath9k_hw_common(ah);
1380 struct ath_vif *avp = (void *)vif->drv_priv;
1381 + unsigned long flags;
1384 ath9k_ps_wakeup(sc);
1385 @@ -1853,7 +1848,10 @@ static void ath9k_bss_info_changed(struc
1387 if (changed & BSS_CHANGED_P2P_PS) {
1388 spin_lock_bh(&sc->sc_pcu_lock);
1389 - ath9k_update_p2p_ps(sc, vif);
1390 + spin_lock_irqsave(&sc->sc_pm_lock, flags);
1391 + if (!(sc->ps_flags & PS_BEACON_SYNC))
1392 + ath9k_update_p2p_ps(sc, vif);
1393 + spin_unlock_irqrestore(&sc->sc_pm_lock, flags);
1394 spin_unlock_bh(&sc->sc_pcu_lock);
1397 @@ -2232,14 +2230,6 @@ static void ath9k_sw_scan_complete(struc
1398 clear_bit(ATH_OP_SCANNING, &common->op_flags);
1401 -static void ath9k_channel_switch_beacon(struct ieee80211_hw *hw,
1402 - struct ieee80211_vif *vif,
1403 - struct cfg80211_chan_def *chandef)
1405 - /* depend on vif->csa_active only */
1409 struct ieee80211_ops ath9k_ops = {
1411 .start = ath9k_start,
1412 @@ -2287,5 +2277,4 @@ struct ieee80211_ops ath9k_ops = {
1414 .sw_scan_start = ath9k_sw_scan_start,
1415 .sw_scan_complete = ath9k_sw_scan_complete,
1416 - .channel_switch_beacon = ath9k_channel_switch_beacon,
1418 --- a/drivers/net/wireless/ath/ath10k/mac.c
1419 +++ b/drivers/net/wireless/ath/ath10k/mac.c
1420 @@ -4142,14 +4142,6 @@ static int ath10k_set_bitrate_mask(struc
1421 fixed_nss, force_sgi);
1424 -static void ath10k_channel_switch_beacon(struct ieee80211_hw *hw,
1425 - struct ieee80211_vif *vif,
1426 - struct cfg80211_chan_def *chandef)
1428 - /* there's no need to do anything here. vif->csa_active is enough */
1432 static void ath10k_sta_rc_update(struct ieee80211_hw *hw,
1433 struct ieee80211_vif *vif,
1434 struct ieee80211_sta *sta,
1435 @@ -4256,7 +4248,6 @@ static const struct ieee80211_ops ath10k
1436 .restart_complete = ath10k_restart_complete,
1437 .get_survey = ath10k_get_survey,
1438 .set_bitrate_mask = ath10k_set_bitrate_mask,
1439 - .channel_switch_beacon = ath10k_channel_switch_beacon,
1440 .sta_rc_update = ath10k_sta_rc_update,
1441 .get_tsf = ath10k_get_tsf,
1443 --- a/net/mac80211/cfg.c
1444 +++ b/net/mac80211/cfg.c
1445 @@ -468,327 +468,6 @@ void sta_set_rate_info_rx(struct sta_inf
1446 rinfo->flags |= RATE_INFO_FLAGS_160_MHZ_WIDTH;
1449 -static void sta_set_sinfo(struct sta_info *sta, struct station_info *sinfo)
1451 - struct ieee80211_sub_if_data *sdata = sta->sdata;
1452 - struct ieee80211_local *local = sdata->local;
1453 - struct rate_control_ref *ref = local->rate_ctrl;
1454 - struct timespec uptime;
1459 - sinfo->generation = sdata->local->sta_generation;
1461 - sinfo->filled = STATION_INFO_INACTIVE_TIME |
1462 - STATION_INFO_RX_BYTES64 |
1463 - STATION_INFO_TX_BYTES64 |
1464 - STATION_INFO_RX_PACKETS |
1465 - STATION_INFO_TX_PACKETS |
1466 - STATION_INFO_TX_RETRIES |
1467 - STATION_INFO_TX_FAILED |
1468 - STATION_INFO_TX_BITRATE |
1469 - STATION_INFO_RX_BITRATE |
1470 - STATION_INFO_RX_DROP_MISC |
1471 - STATION_INFO_BSS_PARAM |
1472 - STATION_INFO_CONNECTED_TIME |
1473 - STATION_INFO_STA_FLAGS |
1474 - STATION_INFO_BEACON_LOSS_COUNT;
1476 - do_posix_clock_monotonic_gettime(&uptime);
1477 - sinfo->connected_time = uptime.tv_sec - sta->last_connected;
1479 - sinfo->inactive_time = jiffies_to_msecs(jiffies - sta->last_rx);
1480 - sinfo->tx_bytes = 0;
1481 - for (ac = 0; ac < IEEE80211_NUM_ACS; ac++) {
1482 - sinfo->tx_bytes += sta->tx_bytes[ac];
1483 - packets += sta->tx_packets[ac];
1485 - sinfo->tx_packets = packets;
1486 - sinfo->rx_bytes = sta->rx_bytes;
1487 - sinfo->rx_packets = sta->rx_packets;
1488 - sinfo->tx_retries = sta->tx_retry_count;
1489 - sinfo->tx_failed = sta->tx_retry_failed;
1490 - sinfo->rx_dropped_misc = sta->rx_dropped;
1491 - sinfo->beacon_loss_count = sta->beacon_loss_count;
1493 - if ((sta->local->hw.flags & IEEE80211_HW_SIGNAL_DBM) ||
1494 - (sta->local->hw.flags & IEEE80211_HW_SIGNAL_UNSPEC)) {
1495 - sinfo->filled |= STATION_INFO_SIGNAL | STATION_INFO_SIGNAL_AVG;
1496 - if (!local->ops->get_rssi ||
1497 - drv_get_rssi(local, sdata, &sta->sta, &sinfo->signal))
1498 - sinfo->signal = (s8)sta->last_signal;
1499 - sinfo->signal_avg = (s8) -ewma_read(&sta->avg_signal);
1501 - if (sta->chains) {
1502 - sinfo->filled |= STATION_INFO_CHAIN_SIGNAL |
1503 - STATION_INFO_CHAIN_SIGNAL_AVG;
1505 - sinfo->chains = sta->chains;
1506 - for (i = 0; i < ARRAY_SIZE(sinfo->chain_signal); i++) {
1507 - sinfo->chain_signal[i] = sta->chain_signal_last[i];
1508 - sinfo->chain_signal_avg[i] =
1509 - (s8) -ewma_read(&sta->chain_signal_avg[i]);
1513 - sta_set_rate_info_tx(sta, &sta->last_tx_rate, &sinfo->txrate);
1514 - sta_set_rate_info_rx(sta, &sinfo->rxrate);
1516 - if (ieee80211_vif_is_mesh(&sdata->vif)) {
1517 -#ifdef CPTCFG_MAC80211_MESH
1518 - sinfo->filled |= STATION_INFO_LLID |
1519 - STATION_INFO_PLID |
1520 - STATION_INFO_PLINK_STATE |
1521 - STATION_INFO_LOCAL_PM |
1522 - STATION_INFO_PEER_PM |
1523 - STATION_INFO_NONPEER_PM;
1525 - sinfo->llid = sta->llid;
1526 - sinfo->plid = sta->plid;
1527 - sinfo->plink_state = sta->plink_state;
1528 - if (test_sta_flag(sta, WLAN_STA_TOFFSET_KNOWN)) {
1529 - sinfo->filled |= STATION_INFO_T_OFFSET;
1530 - sinfo->t_offset = sta->t_offset;
1532 - sinfo->local_pm = sta->local_pm;
1533 - sinfo->peer_pm = sta->peer_pm;
1534 - sinfo->nonpeer_pm = sta->nonpeer_pm;
1538 - sinfo->bss_param.flags = 0;
1539 - if (sdata->vif.bss_conf.use_cts_prot)
1540 - sinfo->bss_param.flags |= BSS_PARAM_FLAGS_CTS_PROT;
1541 - if (sdata->vif.bss_conf.use_short_preamble)
1542 - sinfo->bss_param.flags |= BSS_PARAM_FLAGS_SHORT_PREAMBLE;
1543 - if (sdata->vif.bss_conf.use_short_slot)
1544 - sinfo->bss_param.flags |= BSS_PARAM_FLAGS_SHORT_SLOT_TIME;
1545 - sinfo->bss_param.dtim_period = sdata->local->hw.conf.ps_dtim_period;
1546 - sinfo->bss_param.beacon_interval = sdata->vif.bss_conf.beacon_int;
1548 - sinfo->sta_flags.set = 0;
1549 - sinfo->sta_flags.mask = BIT(NL80211_STA_FLAG_AUTHORIZED) |
1550 - BIT(NL80211_STA_FLAG_SHORT_PREAMBLE) |
1551 - BIT(NL80211_STA_FLAG_WME) |
1552 - BIT(NL80211_STA_FLAG_MFP) |
1553 - BIT(NL80211_STA_FLAG_AUTHENTICATED) |
1554 - BIT(NL80211_STA_FLAG_ASSOCIATED) |
1555 - BIT(NL80211_STA_FLAG_TDLS_PEER);
1556 - if (test_sta_flag(sta, WLAN_STA_AUTHORIZED))
1557 - sinfo->sta_flags.set |= BIT(NL80211_STA_FLAG_AUTHORIZED);
1558 - if (test_sta_flag(sta, WLAN_STA_SHORT_PREAMBLE))
1559 - sinfo->sta_flags.set |= BIT(NL80211_STA_FLAG_SHORT_PREAMBLE);
1560 - if (test_sta_flag(sta, WLAN_STA_WME))
1561 - sinfo->sta_flags.set |= BIT(NL80211_STA_FLAG_WME);
1562 - if (test_sta_flag(sta, WLAN_STA_MFP))
1563 - sinfo->sta_flags.set |= BIT(NL80211_STA_FLAG_MFP);
1564 - if (test_sta_flag(sta, WLAN_STA_AUTH))
1565 - sinfo->sta_flags.set |= BIT(NL80211_STA_FLAG_AUTHENTICATED);
1566 - if (test_sta_flag(sta, WLAN_STA_ASSOC))
1567 - sinfo->sta_flags.set |= BIT(NL80211_STA_FLAG_ASSOCIATED);
1568 - if (test_sta_flag(sta, WLAN_STA_TDLS_PEER))
1569 - sinfo->sta_flags.set |= BIT(NL80211_STA_FLAG_TDLS_PEER);
1571 - /* check if the driver has a SW RC implementation */
1572 - if (ref && ref->ops->get_expected_throughput)
1573 - thr = ref->ops->get_expected_throughput(sta->rate_ctrl_priv);
1575 - thr = drv_get_expected_throughput(local, &sta->sta);
1578 - sinfo->filled |= STATION_INFO_EXPECTED_THROUGHPUT;
1579 - sinfo->expected_throughput = thr;
1583 -static const char ieee80211_gstrings_sta_stats[][ETH_GSTRING_LEN] = {
1584 - "rx_packets", "rx_bytes", "wep_weak_iv_count",
1585 - "rx_duplicates", "rx_fragments", "rx_dropped",
1586 - "tx_packets", "tx_bytes", "tx_fragments",
1587 - "tx_filtered", "tx_retry_failed", "tx_retries",
1588 - "beacon_loss", "sta_state", "txrate", "rxrate", "signal",
1589 - "channel", "noise", "ch_time", "ch_time_busy",
1590 - "ch_time_ext_busy", "ch_time_rx", "ch_time_tx"
1592 -#define STA_STATS_LEN ARRAY_SIZE(ieee80211_gstrings_sta_stats)
1594 -static int ieee80211_get_et_sset_count(struct wiphy *wiphy,
1595 - struct net_device *dev,
1598 - struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev);
1601 - if (sset == ETH_SS_STATS)
1602 - rv += STA_STATS_LEN;
1604 - rv += drv_get_et_sset_count(sdata, sset);
1607 - return -EOPNOTSUPP;
1611 -static void ieee80211_get_et_stats(struct wiphy *wiphy,
1612 - struct net_device *dev,
1613 - struct ethtool_stats *stats,
1616 - struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev);
1617 - struct ieee80211_chanctx_conf *chanctx_conf;
1618 - struct ieee80211_channel *channel;
1619 - struct sta_info *sta;
1620 - struct ieee80211_local *local = sdata->local;
1621 - struct station_info sinfo;
1622 - struct survey_info survey;
1624 -#define STA_STATS_SURVEY_LEN 7
1626 - memset(data, 0, sizeof(u64) * STA_STATS_LEN);
1628 -#define ADD_STA_STATS(sta) \
1630 - data[i++] += sta->rx_packets; \
1631 - data[i++] += sta->rx_bytes; \
1632 - data[i++] += sta->wep_weak_iv_count; \
1633 - data[i++] += sta->num_duplicates; \
1634 - data[i++] += sta->rx_fragments; \
1635 - data[i++] += sta->rx_dropped; \
1637 - data[i++] += sinfo.tx_packets; \
1638 - data[i++] += sinfo.tx_bytes; \
1639 - data[i++] += sta->tx_fragments; \
1640 - data[i++] += sta->tx_filtered_count; \
1641 - data[i++] += sta->tx_retry_failed; \
1642 - data[i++] += sta->tx_retry_count; \
1643 - data[i++] += sta->beacon_loss_count; \
1646 - /* For Managed stations, find the single station based on BSSID
1647 - * and use that. For interface types, iterate through all available
1648 - * stations and add stats for any station that is assigned to this
1652 - mutex_lock(&local->sta_mtx);
1654 - if (sdata->vif.type == NL80211_IFTYPE_STATION) {
1655 - sta = sta_info_get_bss(sdata, sdata->u.mgd.bssid);
1657 - if (!(sta && !WARN_ON(sta->sdata->dev != dev)))
1661 - sta_set_sinfo(sta, &sinfo);
1664 - ADD_STA_STATS(sta);
1666 - data[i++] = sta->sta_state;
1669 - if (sinfo.filled & STATION_INFO_TX_BITRATE)
1670 - data[i] = 100000 *
1671 - cfg80211_calculate_bitrate(&sinfo.txrate);
1673 - if (sinfo.filled & STATION_INFO_RX_BITRATE)
1674 - data[i] = 100000 *
1675 - cfg80211_calculate_bitrate(&sinfo.rxrate);
1678 - if (sinfo.filled & STATION_INFO_SIGNAL_AVG)
1679 - data[i] = (u8)sinfo.signal_avg;
1682 - list_for_each_entry(sta, &local->sta_list, list) {
1683 - /* Make sure this station belongs to the proper dev */
1684 - if (sta->sdata->dev != dev)
1688 - sta_set_sinfo(sta, &sinfo);
1690 - ADD_STA_STATS(sta);
1695 - i = STA_STATS_LEN - STA_STATS_SURVEY_LEN;
1696 - /* Get survey stats for current channel */
1697 - survey.filled = 0;
1700 - chanctx_conf = rcu_dereference(sdata->vif.chanctx_conf);
1702 - channel = chanctx_conf->def.chan;
1705 - rcu_read_unlock();
1710 - survey.filled = 0;
1711 - if (drv_get_survey(local, q, &survey) != 0) {
1712 - survey.filled = 0;
1716 - } while (channel != survey.channel);
1719 - if (survey.filled)
1720 - data[i++] = survey.channel->center_freq;
1723 - if (survey.filled & SURVEY_INFO_NOISE_DBM)
1724 - data[i++] = (u8)survey.noise;
1727 - if (survey.filled & SURVEY_INFO_CHANNEL_TIME)
1728 - data[i++] = survey.channel_time;
1731 - if (survey.filled & SURVEY_INFO_CHANNEL_TIME_BUSY)
1732 - data[i++] = survey.channel_time_busy;
1735 - if (survey.filled & SURVEY_INFO_CHANNEL_TIME_EXT_BUSY)
1736 - data[i++] = survey.channel_time_ext_busy;
1739 - if (survey.filled & SURVEY_INFO_CHANNEL_TIME_RX)
1740 - data[i++] = survey.channel_time_rx;
1743 - if (survey.filled & SURVEY_INFO_CHANNEL_TIME_TX)
1744 - data[i++] = survey.channel_time_tx;
1748 - mutex_unlock(&local->sta_mtx);
1750 - if (WARN_ON(i != STA_STATS_LEN))
1753 - drv_get_et_stats(sdata, stats, &(data[STA_STATS_LEN]));
1756 -static void ieee80211_get_et_strings(struct wiphy *wiphy,
1757 - struct net_device *dev,
1758 - u32 sset, u8 *data)
1760 - struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev);
1761 - int sz_sta_stats = 0;
1763 - if (sset == ETH_SS_STATS) {
1764 - sz_sta_stats = sizeof(ieee80211_gstrings_sta_stats);
1765 - memcpy(data, ieee80211_gstrings_sta_stats, sz_sta_stats);
1767 - drv_get_et_strings(sdata, sset, &(data[sz_sta_stats]));
1770 static int ieee80211_dump_station(struct wiphy *wiphy, struct net_device *dev,
1771 int idx, u8 *mac, struct station_info *sinfo)
1773 @@ -875,7 +554,8 @@ static int ieee80211_set_monitor_channel
1776 static int ieee80211_set_probe_resp(struct ieee80211_sub_if_data *sdata,
1777 - const u8 *resp, size_t resp_len)
1778 + const u8 *resp, size_t resp_len,
1779 + const struct ieee80211_csa_settings *csa)
1781 struct probe_resp *new, *old;
1783 @@ -891,6 +571,11 @@ static int ieee80211_set_probe_resp(stru
1784 new->len = resp_len;
1785 memcpy(new->data, resp, resp_len);
1788 + memcpy(new->csa_counter_offsets, csa->counter_offsets_presp,
1789 + csa->n_counter_offsets_presp *
1790 + sizeof(new->csa_counter_offsets[0]));
1792 rcu_assign_pointer(sdata->u.ap.probe_resp, new);
1794 kfree_rcu(old, rcu_head);
1795 @@ -899,7 +584,8 @@ static int ieee80211_set_probe_resp(stru
1798 static int ieee80211_assign_beacon(struct ieee80211_sub_if_data *sdata,
1799 - struct cfg80211_beacon_data *params)
1800 + struct cfg80211_beacon_data *params,
1801 + const struct ieee80211_csa_settings *csa)
1803 struct beacon_data *new, *old;
1804 int new_head_len, new_tail_len;
1805 @@ -943,6 +629,13 @@ static int ieee80211_assign_beacon(struc
1806 new->head_len = new_head_len;
1807 new->tail_len = new_tail_len;
1810 + new->csa_current_counter = csa->count;
1811 + memcpy(new->csa_counter_offsets, csa->counter_offsets_beacon,
1812 + csa->n_counter_offsets_beacon *
1813 + sizeof(new->csa_counter_offsets[0]));
1818 memcpy(new->head, params->head, new_head_len);
1819 @@ -957,7 +650,7 @@ static int ieee80211_assign_beacon(struc
1820 memcpy(new->tail, old->tail, new_tail_len);
1822 err = ieee80211_set_probe_resp(sdata, params->probe_resp,
1823 - params->probe_resp_len);
1824 + params->probe_resp_len, csa);
1828 @@ -1042,7 +735,7 @@ static int ieee80211_start_ap(struct wip
1829 sdata->vif.bss_conf.p2p_noa_attr.oppps_ctwindow |=
1830 IEEE80211_P2P_OPPPS_ENABLE_BIT;
1832 - err = ieee80211_assign_beacon(sdata, ¶ms->beacon);
1833 + err = ieee80211_assign_beacon(sdata, ¶ms->beacon, NULL);
1835 ieee80211_vif_release_channel(sdata);
1837 @@ -1090,7 +783,7 @@ static int ieee80211_change_beacon(struc
1841 - err = ieee80211_assign_beacon(sdata, params);
1842 + err = ieee80211_assign_beacon(sdata, params, NULL);
1845 ieee80211_bss_info_change_notify(sdata, err);
1846 @@ -3073,7 +2766,8 @@ static int ieee80211_set_after_csa_beaco
1848 switch (sdata->vif.type) {
1849 case NL80211_IFTYPE_AP:
1850 - err = ieee80211_assign_beacon(sdata, sdata->u.ap.next_beacon);
1851 + err = ieee80211_assign_beacon(sdata, sdata->u.ap.next_beacon,
1853 kfree(sdata->u.ap.next_beacon);
1854 sdata->u.ap.next_beacon = NULL;
1856 @@ -3176,6 +2870,7 @@ static int ieee80211_set_csa_beacon(stru
1857 struct cfg80211_csa_settings *params,
1860 + struct ieee80211_csa_settings csa = {};
1863 switch (sdata->vif.type) {
1864 @@ -3210,20 +2905,13 @@ static int ieee80211_set_csa_beacon(stru
1865 IEEE80211_MAX_CSA_COUNTERS_NUM))
1868 - /* make sure we don't have garbage in other counters */
1869 - memset(sdata->csa_counter_offset_beacon, 0,
1870 - sizeof(sdata->csa_counter_offset_beacon));
1871 - memset(sdata->csa_counter_offset_presp, 0,
1872 - sizeof(sdata->csa_counter_offset_presp));
1874 - memcpy(sdata->csa_counter_offset_beacon,
1875 - params->counter_offsets_beacon,
1876 - params->n_counter_offsets_beacon * sizeof(u16));
1877 - memcpy(sdata->csa_counter_offset_presp,
1878 - params->counter_offsets_presp,
1879 - params->n_counter_offsets_presp * sizeof(u16));
1880 + csa.counter_offsets_beacon = params->counter_offsets_beacon;
1881 + csa.counter_offsets_presp = params->counter_offsets_presp;
1882 + csa.n_counter_offsets_beacon = params->n_counter_offsets_beacon;
1883 + csa.n_counter_offsets_presp = params->n_counter_offsets_presp;
1884 + csa.count = params->count;
1886 - err = ieee80211_assign_beacon(sdata, ¶ms->beacon_csa);
1887 + err = ieee80211_assign_beacon(sdata, ¶ms->beacon_csa, &csa);
1889 kfree(sdata->u.ap.next_beacon);
1891 @@ -3367,7 +3055,6 @@ __ieee80211_channel_switch(struct wiphy
1892 sdata->csa_radar_required = params->radar_required;
1893 sdata->csa_chandef = params->chandef;
1894 sdata->csa_block_tx = params->block_tx;
1895 - sdata->csa_current_counter = params->count;
1896 sdata->vif.csa_active = true;
1898 if (sdata->csa_block_tx)
1899 @@ -3515,10 +3202,23 @@ static int ieee80211_mgmt_tx(struct wiph
1900 sdata->vif.type == NL80211_IFTYPE_ADHOC) &&
1901 params->n_csa_offsets) {
1903 - u8 c = sdata->csa_current_counter;
1904 + struct beacon_data *beacon = NULL;
1908 - for (i = 0; i < params->n_csa_offsets; i++)
1909 - data[params->csa_offsets[i]] = c;
1910 + if (sdata->vif.type == NL80211_IFTYPE_AP)
1911 + beacon = rcu_dereference(sdata->u.ap.beacon);
1912 + else if (sdata->vif.type == NL80211_IFTYPE_ADHOC)
1913 + beacon = rcu_dereference(sdata->u.ibss.presp);
1914 + else if (ieee80211_vif_is_mesh(&sdata->vif))
1915 + beacon = rcu_dereference(sdata->u.mesh.beacon);
1918 + for (i = 0; i < params->n_csa_offsets; i++)
1919 + data[params->csa_offsets[i]] =
1920 + beacon->csa_current_counter;
1922 + rcu_read_unlock();
1925 IEEE80211_SKB_CB(skb)->flags = flags;
1926 @@ -3598,21 +3298,6 @@ static int ieee80211_get_antenna(struct
1927 return drv_get_antenna(local, tx_ant, rx_ant);
1930 -static int ieee80211_set_ringparam(struct wiphy *wiphy, u32 tx, u32 rx)
1932 - struct ieee80211_local *local = wiphy_priv(wiphy);
1934 - return drv_set_ringparam(local, tx, rx);
1937 -static void ieee80211_get_ringparam(struct wiphy *wiphy,
1938 - u32 *tx, u32 *tx_max, u32 *rx, u32 *rx_max)
1940 - struct ieee80211_local *local = wiphy_priv(wiphy);
1942 - drv_get_ringparam(local, tx, tx_max, rx, rx_max);
1945 static int ieee80211_set_rekey_data(struct wiphy *wiphy,
1946 struct net_device *dev,
1947 struct cfg80211_gtk_rekey_data *data)
1948 @@ -3844,8 +3529,6 @@ const struct cfg80211_ops mac80211_confi
1949 .mgmt_frame_register = ieee80211_mgmt_frame_register,
1950 .set_antenna = ieee80211_set_antenna,
1951 .get_antenna = ieee80211_get_antenna,
1952 - .set_ringparam = ieee80211_set_ringparam,
1953 - .get_ringparam = ieee80211_get_ringparam,
1954 .set_rekey_data = ieee80211_set_rekey_data,
1955 .tdls_oper = ieee80211_tdls_oper,
1956 .tdls_mgmt = ieee80211_tdls_mgmt,
1957 @@ -3854,9 +3537,6 @@ const struct cfg80211_ops mac80211_confi
1959 .set_wakeup = ieee80211_set_wakeup,
1961 - .get_et_sset_count = ieee80211_get_et_sset_count,
1962 - .get_et_stats = ieee80211_get_et_stats,
1963 - .get_et_strings = ieee80211_get_et_strings,
1964 .get_channel = ieee80211_cfg_get_channel,
1965 .start_radar_detection = ieee80211_start_radar_detection,
1966 .channel_switch = ieee80211_channel_switch,
1967 --- a/net/mac80211/debugfs_sta.c
1968 +++ b/net/mac80211/debugfs_sta.c
1969 @@ -587,7 +587,6 @@ void ieee80211_sta_debugfs_add(struct st
1970 DEBUGFS_ADD_COUNTER(tx_filtered, tx_filtered_count);
1971 DEBUGFS_ADD_COUNTER(tx_retry_failed, tx_retry_failed);
1972 DEBUGFS_ADD_COUNTER(tx_retry_count, tx_retry_count);
1973 - DEBUGFS_ADD_COUNTER(wep_weak_iv_count, wep_weak_iv_count);
1975 if (sizeof(sta->driver_buffered_tids) == sizeof(u32))
1976 debugfs_create_x32("driver_buffered_tids", 0400,
1977 --- a/net/mac80211/wep.c
1978 +++ b/net/mac80211/wep.c
1979 @@ -271,22 +271,6 @@ static int ieee80211_wep_decrypt(struct
1984 -static bool ieee80211_wep_is_weak_iv(struct sk_buff *skb,
1985 - struct ieee80211_key *key)
1987 - struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data;
1988 - unsigned int hdrlen;
1992 - hdrlen = ieee80211_hdrlen(hdr->frame_control);
1993 - ivpos = skb->data + hdrlen;
1994 - iv = (ivpos[0] << 16) | (ivpos[1] << 8) | ivpos[2];
1996 - return ieee80211_wep_weak_iv(iv, key->conf.keylen);
2000 ieee80211_crypto_wep_decrypt(struct ieee80211_rx_data *rx)
2002 @@ -301,16 +285,12 @@ ieee80211_crypto_wep_decrypt(struct ieee
2003 if (!(status->flag & RX_FLAG_DECRYPTED)) {
2004 if (skb_linearize(rx->skb))
2005 return RX_DROP_UNUSABLE;
2006 - if (rx->sta && ieee80211_wep_is_weak_iv(rx->skb, rx->key))
2007 - rx->sta->wep_weak_iv_count++;
2008 if (ieee80211_wep_decrypt(rx->local, rx->skb, rx->key))
2009 return RX_DROP_UNUSABLE;
2010 } else if (!(status->flag & RX_FLAG_IV_STRIPPED)) {
2011 if (!pskb_may_pull(rx->skb, ieee80211_hdrlen(fc) +
2012 IEEE80211_WEP_IV_LEN))
2013 return RX_DROP_UNUSABLE;
2014 - if (rx->sta && ieee80211_wep_is_weak_iv(rx->skb, rx->key))
2015 - rx->sta->wep_weak_iv_count++;
2016 ieee80211_wep_remove_iv(rx->local, rx->skb, rx->key);
2018 if (pskb_trim(rx->skb, rx->skb->len - IEEE80211_WEP_ICV_LEN))
2019 --- a/include/net/cfg80211.h
2020 +++ b/include/net/cfg80211.h
2021 @@ -2278,16 +2278,6 @@ struct cfg80211_qos_map {
2023 * @set_noack_map: Set the NoAck Map for the TIDs.
2025 - * @get_et_sset_count: Ethtool API to get string-set count.
2026 - * See @ethtool_ops.get_sset_count
2028 - * @get_et_stats: Ethtool API to get a set of u64 stats.
2029 - * See @ethtool_ops.get_ethtool_stats
2031 - * @get_et_strings: Ethtool API to get a set of strings to describe stats
2032 - * and perhaps other supported types of ethtool data-sets.
2033 - * See @ethtool_ops.get_strings
2035 * @get_channel: Get the current operating channel for the virtual interface.
2036 * For monitor interfaces, it should return %NULL unless there's a single
2037 * current monitoring channel.
2038 @@ -2529,13 +2519,6 @@ struct cfg80211_ops {
2039 struct net_device *dev,
2042 - int (*get_et_sset_count)(struct wiphy *wiphy,
2043 - struct net_device *dev, int sset);
2044 - void (*get_et_stats)(struct wiphy *wiphy, struct net_device *dev,
2045 - struct ethtool_stats *stats, u64 *data);
2046 - void (*get_et_strings)(struct wiphy *wiphy, struct net_device *dev,
2047 - u32 sset, u8 *data);
2049 int (*get_channel)(struct wiphy *wiphy,
2050 struct wireless_dev *wdev,
2051 struct cfg80211_chan_def *chandef);
2052 @@ -4846,6 +4829,10 @@ void cfg80211_stop_iface(struct wiphy *w
2054 void cfg80211_shutdown_all_interfaces(struct wiphy *wiphy);
2057 +/* ethtool helper */
2058 +void cfg80211_get_drvinfo(struct net_device *dev, struct ethtool_drvinfo *info);
2060 /* Logging, debugging and troubleshooting/diagnostic helpers. */
2062 /* wiphy_printk helpers, similar to dev_printk */
2063 --- a/net/mac80211/Makefile
2064 +++ b/net/mac80211/Makefile
2065 @@ -17,6 +17,7 @@ mac80211-y := \
2073 --- a/net/mac80211/ieee80211_i.h
2074 +++ b/net/mac80211/ieee80211_i.h
2075 @@ -229,16 +229,29 @@ struct ieee80211_rx_data {
2079 +struct ieee80211_csa_settings {
2080 + const u16 *counter_offsets_beacon;
2081 + const u16 *counter_offsets_presp;
2083 + int n_counter_offsets_beacon;
2084 + int n_counter_offsets_presp;
2089 struct beacon_data {
2091 int head_len, tail_len;
2092 struct ieee80211_meshconf_ie *meshconf;
2093 + u16 csa_counter_offsets[IEEE80211_MAX_CSA_COUNTERS_NUM];
2094 + u8 csa_current_counter;
2095 struct rcu_head rcu_head;
2099 struct rcu_head rcu_head;
2101 + u16 csa_counter_offsets[IEEE80211_MAX_CSA_COUNTERS_NUM];
2105 @@ -754,8 +767,6 @@ struct ieee80211_sub_if_data {
2106 struct mac80211_qos_map __rcu *qos_map;
2108 struct work_struct csa_finalize_work;
2109 - u16 csa_counter_offset_beacon[IEEE80211_MAX_CSA_COUNTERS_NUM];
2110 - u16 csa_counter_offset_presp[IEEE80211_MAX_CSA_COUNTERS_NUM];
2111 bool csa_radar_required;
2112 bool csa_block_tx; /* write-protected by sdata_lock and local->mtx */
2113 struct cfg80211_chan_def csa_chandef;
2114 @@ -767,7 +778,6 @@ struct ieee80211_sub_if_data {
2115 struct ieee80211_chanctx *reserved_chanctx;
2116 struct cfg80211_chan_def reserved_chandef;
2117 bool reserved_radar_required;
2118 - u8 csa_current_counter;
2120 /* used to reconfigure hardware SM PS */
2121 struct work_struct recalc_smps;
2122 @@ -1850,6 +1860,8 @@ int ieee80211_tdls_oper(struct wiphy *wi
2123 const u8 *peer, enum nl80211_tdls_operation oper);
2126 +extern const struct ethtool_ops ieee80211_ethtool_ops;
2128 #ifdef CPTCFG_MAC80211_NOINLINE
2129 #define debug_noinline noinline
2131 --- a/net/mac80211/iface.c
2132 +++ b/net/mac80211/iface.c
2133 @@ -399,6 +399,7 @@ int ieee80211_add_virtual_monitor(struct
2134 sdata->vif.type = NL80211_IFTYPE_MONITOR;
2135 snprintf(sdata->name, IFNAMSIZ, "%s-monitor",
2136 wiphy_name(local->hw.wiphy));
2137 + sdata->wdev.iftype = NL80211_IFTYPE_MONITOR;
2139 sdata->encrypt_headroom = IEEE80211_ENCRYPT_HEADROOM;
2141 @@ -1303,6 +1304,7 @@ static void ieee80211_setup_sdata(struct
2142 sdata->control_port_protocol = cpu_to_be16(ETH_P_PAE);
2143 sdata->control_port_no_encrypt = false;
2144 sdata->encrypt_headroom = IEEE80211_ENCRYPT_HEADROOM;
2145 + sdata->vif.bss_conf.idle = true;
2147 sdata->noack_map = 0;
2149 @@ -1721,6 +1723,8 @@ int ieee80211_if_add(struct ieee80211_lo
2151 ndev->features |= local->hw.netdev_features;
2153 + netdev_set_default_ethtool_ops(ndev, &ieee80211_ethtool_ops);
2155 ret = register_netdevice(ndev);
2158 --- a/net/wireless/core.c
2159 +++ b/net/wireless/core.c
2162 #include "debugfs.h"
2163 #include "wext-compat.h"
2164 -#include "ethtool.h"
2165 #include "rdev-ops.h"
2167 /* name for sysfs, %d is appended */
2168 @@ -940,8 +939,6 @@ static int cfg80211_netdev_notifier_call
2169 /* allow mac80211 to determine the timeout */
2170 wdev->ps_timeout = -1;
2172 - netdev_set_default_ethtool_ops(dev, &cfg80211_ethtool_ops);
2174 if ((wdev->iftype == NL80211_IFTYPE_STATION ||
2175 wdev->iftype == NL80211_IFTYPE_P2P_CLIENT ||
2176 wdev->iftype == NL80211_IFTYPE_ADHOC) && !wdev->use_4addr)
2177 --- a/net/wireless/ethtool.c
2178 +++ b/net/wireless/ethtool.c
2180 #include <linux/utsname.h>
2181 #include <net/cfg80211.h>
2183 -#include "ethtool.h"
2184 #include "rdev-ops.h"
2186 -static void cfg80211_get_drvinfo(struct net_device *dev,
2187 - struct ethtool_drvinfo *info)
2188 +void cfg80211_get_drvinfo(struct net_device *dev, struct ethtool_drvinfo *info)
2190 struct wireless_dev *wdev = dev->ieee80211_ptr;
2192 @@ -23,84 +21,4 @@ static void cfg80211_get_drvinfo(struct
2193 strlcpy(info->bus_info, dev_name(wiphy_dev(wdev->wiphy)),
2194 sizeof(info->bus_info));
2197 -static int cfg80211_get_regs_len(struct net_device *dev)
2199 - /* For now, return 0... */
2203 -static void cfg80211_get_regs(struct net_device *dev, struct ethtool_regs *regs,
2206 - struct wireless_dev *wdev = dev->ieee80211_ptr;
2208 - regs->version = wdev->wiphy->hw_version;
2212 -static void cfg80211_get_ringparam(struct net_device *dev,
2213 - struct ethtool_ringparam *rp)
2215 - struct wireless_dev *wdev = dev->ieee80211_ptr;
2216 - struct cfg80211_registered_device *rdev = wiphy_to_rdev(wdev->wiphy);
2218 - memset(rp, 0, sizeof(*rp));
2220 - if (rdev->ops->get_ringparam)
2221 - rdev_get_ringparam(rdev, &rp->tx_pending, &rp->tx_max_pending,
2222 - &rp->rx_pending, &rp->rx_max_pending);
2225 -static int cfg80211_set_ringparam(struct net_device *dev,
2226 - struct ethtool_ringparam *rp)
2228 - struct wireless_dev *wdev = dev->ieee80211_ptr;
2229 - struct cfg80211_registered_device *rdev = wiphy_to_rdev(wdev->wiphy);
2231 - if (rp->rx_mini_pending != 0 || rp->rx_jumbo_pending != 0)
2234 - if (rdev->ops->set_ringparam)
2235 - return rdev_set_ringparam(rdev, rp->tx_pending, rp->rx_pending);
2240 -static int cfg80211_get_sset_count(struct net_device *dev, int sset)
2242 - struct wireless_dev *wdev = dev->ieee80211_ptr;
2243 - struct cfg80211_registered_device *rdev = wiphy_to_rdev(wdev->wiphy);
2244 - if (rdev->ops->get_et_sset_count)
2245 - return rdev_get_et_sset_count(rdev, dev, sset);
2246 - return -EOPNOTSUPP;
2249 -static void cfg80211_get_stats(struct net_device *dev,
2250 - struct ethtool_stats *stats, u64 *data)
2252 - struct wireless_dev *wdev = dev->ieee80211_ptr;
2253 - struct cfg80211_registered_device *rdev = wiphy_to_rdev(wdev->wiphy);
2254 - if (rdev->ops->get_et_stats)
2255 - rdev_get_et_stats(rdev, dev, stats, data);
2258 -static void cfg80211_get_strings(struct net_device *dev, u32 sset, u8 *data)
2260 - struct wireless_dev *wdev = dev->ieee80211_ptr;
2261 - struct cfg80211_registered_device *rdev = wiphy_to_rdev(wdev->wiphy);
2262 - if (rdev->ops->get_et_strings)
2263 - rdev_get_et_strings(rdev, dev, sset, data);
2266 -const struct ethtool_ops cfg80211_ethtool_ops = {
2267 - .get_drvinfo = cfg80211_get_drvinfo,
2268 - .get_regs_len = cfg80211_get_regs_len,
2269 - .get_regs = cfg80211_get_regs,
2270 - .get_link = ethtool_op_get_link,
2271 - .get_ringparam = cfg80211_get_ringparam,
2272 - .set_ringparam = cfg80211_set_ringparam,
2273 - .get_strings = cfg80211_get_strings,
2274 - .get_ethtool_stats = cfg80211_get_stats,
2275 - .get_sset_count = cfg80211_get_sset_count,
2277 +EXPORT_SYMBOL(cfg80211_get_drvinfo);
2278 --- a/net/wireless/ethtool.h
2281 -#ifndef __CFG80211_ETHTOOL__
2282 -#define __CFG80211_ETHTOOL__
2284 -extern const struct ethtool_ops cfg80211_ethtool_ops;
2286 -#endif /* __CFG80211_ETHTOOL__ */
2287 --- a/net/wireless/rdev-ops.h
2288 +++ b/net/wireless/rdev-ops.h
2289 @@ -714,25 +714,6 @@ static inline int rdev_get_antenna(struc
2293 -static inline int rdev_set_ringparam(struct cfg80211_registered_device *rdev,
2297 - trace_rdev_set_ringparam(&rdev->wiphy, tx, rx);
2298 - ret = rdev->ops->set_ringparam(&rdev->wiphy, tx, rx);
2299 - trace_rdev_return_int(&rdev->wiphy, ret);
2303 -static inline void rdev_get_ringparam(struct cfg80211_registered_device *rdev,
2304 - u32 *tx, u32 *tx_max, u32 *rx,
2307 - trace_rdev_get_ringparam(&rdev->wiphy);
2308 - rdev->ops->get_ringparam(&rdev->wiphy, tx, tx_max, rx, rx_max);
2309 - trace_rdev_return_void_tx_rx(&rdev->wiphy, *tx, *tx_max, *rx, *rx_max);
2313 rdev_sched_scan_start(struct cfg80211_registered_device *rdev,
2314 struct net_device *dev,
2315 @@ -816,35 +797,6 @@ static inline int rdev_set_noack_map(str
2319 -rdev_get_et_sset_count(struct cfg80211_registered_device *rdev,
2320 - struct net_device *dev, int sset)
2323 - trace_rdev_get_et_sset_count(&rdev->wiphy, dev, sset);
2324 - ret = rdev->ops->get_et_sset_count(&rdev->wiphy, dev, sset);
2325 - trace_rdev_return_int(&rdev->wiphy, ret);
2329 -static inline void rdev_get_et_stats(struct cfg80211_registered_device *rdev,
2330 - struct net_device *dev,
2331 - struct ethtool_stats *stats, u64 *data)
2333 - trace_rdev_get_et_stats(&rdev->wiphy, dev);
2334 - rdev->ops->get_et_stats(&rdev->wiphy, dev, stats, data);
2335 - trace_rdev_return_void(&rdev->wiphy);
2338 -static inline void rdev_get_et_strings(struct cfg80211_registered_device *rdev,
2339 - struct net_device *dev, u32 sset,
2342 - trace_rdev_get_et_strings(&rdev->wiphy, dev, sset);
2343 - rdev->ops->get_et_strings(&rdev->wiphy, dev, sset, data);
2344 - trace_rdev_return_void(&rdev->wiphy);
2348 rdev_get_channel(struct cfg80211_registered_device *rdev,
2349 struct wireless_dev *wdev,
2350 struct cfg80211_chan_def *chandef)
2351 --- a/net/wireless/trace.h
2352 +++ b/net/wireless/trace.h
2353 @@ -298,11 +298,6 @@ DEFINE_EVENT(wiphy_only_evt, rdev_return
2357 -DEFINE_EVENT(wiphy_only_evt, rdev_get_ringparam,
2358 - TP_PROTO(struct wiphy *wiphy),
2362 DEFINE_EVENT(wiphy_only_evt, rdev_get_antenna,
2363 TP_PROTO(struct wiphy *wiphy),
2365 @@ -580,11 +575,6 @@ DEFINE_EVENT(wiphy_netdev_evt, rdev_stop
2366 TP_ARGS(wiphy, netdev)
2369 -DEFINE_EVENT(wiphy_netdev_evt, rdev_get_et_stats,
2370 - TP_PROTO(struct wiphy *wiphy, struct net_device *netdev),
2371 - TP_ARGS(wiphy, netdev)
2374 DEFINE_EVENT(wiphy_netdev_evt, rdev_sched_scan_stop,
2375 TP_PROTO(struct wiphy *wiphy, struct net_device *netdev),
2376 TP_ARGS(wiphy, netdev)
2377 @@ -1439,11 +1429,6 @@ DECLARE_EVENT_CLASS(tx_rx_evt,
2378 WIPHY_PR_ARG, __entry->tx, __entry->rx)
2381 -DEFINE_EVENT(tx_rx_evt, rdev_set_ringparam,
2382 - TP_PROTO(struct wiphy *wiphy, u32 tx, u32 rx),
2383 - TP_ARGS(wiphy, rx, tx)
2386 DEFINE_EVENT(tx_rx_evt, rdev_set_antenna,
2387 TP_PROTO(struct wiphy *wiphy, u32 tx, u32 rx),
2388 TP_ARGS(wiphy, rx, tx)
2389 @@ -1725,40 +1710,6 @@ TRACE_EVENT(rdev_set_noack_map,
2390 WIPHY_PR_ARG, NETDEV_PR_ARG, __entry->noack_map)
2393 -TRACE_EVENT(rdev_get_et_sset_count,
2394 - TP_PROTO(struct wiphy *wiphy, struct net_device *netdev, int sset),
2395 - TP_ARGS(wiphy, netdev, sset),
2399 - __field(int, sset)
2404 - __entry->sset = sset;
2406 - TP_printk(WIPHY_PR_FMT ", " NETDEV_PR_FMT ", sset: %d",
2407 - WIPHY_PR_ARG, NETDEV_PR_ARG, __entry->sset)
2410 -TRACE_EVENT(rdev_get_et_strings,
2411 - TP_PROTO(struct wiphy *wiphy, struct net_device *netdev, u32 sset),
2412 - TP_ARGS(wiphy, netdev, sset),
2416 - __field(u32, sset)
2421 - __entry->sset = sset;
2423 - TP_printk(WIPHY_PR_FMT ", " NETDEV_PR_FMT ", sset: %u",
2424 - WIPHY_PR_ARG, NETDEV_PR_ARG, __entry->sset)
2427 DEFINE_EVENT(wiphy_wdev_evt, rdev_get_channel,
2428 TP_PROTO(struct wiphy *wiphy, struct wireless_dev *wdev),
2429 TP_ARGS(wiphy, wdev)
2431 +++ b/net/mac80211/ethtool.c
2434 + * mac80211 ethtool hooks for cfg80211
2436 + * Copied from cfg.c - originally
2437 + * Copyright 2006-2010 Johannes Berg <johannes@sipsolutions.net>
2438 + * Copyright 2014 Intel Corporation (Author: Johannes Berg)
2440 + * This file is GPLv2 as found in COPYING.
2442 +#include <linux/types.h>
2443 +#include <net/cfg80211.h>
2444 +#include "ieee80211_i.h"
2445 +#include "sta_info.h"
2446 +#include "driver-ops.h"
2448 +static int ieee80211_set_ringparam(struct net_device *dev,
2449 + struct ethtool_ringparam *rp)
2451 + struct ieee80211_local *local = wiphy_priv(dev->ieee80211_ptr->wiphy);
2453 + if (rp->rx_mini_pending != 0 || rp->rx_jumbo_pending != 0)
2456 + return drv_set_ringparam(local, rp->tx_pending, rp->rx_pending);
2459 +static void ieee80211_get_ringparam(struct net_device *dev,
2460 + struct ethtool_ringparam *rp)
2462 + struct ieee80211_local *local = wiphy_priv(dev->ieee80211_ptr->wiphy);
2464 + memset(rp, 0, sizeof(*rp));
2466 + drv_get_ringparam(local, &rp->tx_pending, &rp->tx_max_pending,
2467 + &rp->rx_pending, &rp->rx_max_pending);
2470 +static const char ieee80211_gstrings_sta_stats[][ETH_GSTRING_LEN] = {
2471 + "rx_packets", "rx_bytes",
2472 + "rx_duplicates", "rx_fragments", "rx_dropped",
2473 + "tx_packets", "tx_bytes", "tx_fragments",
2474 + "tx_filtered", "tx_retry_failed", "tx_retries",
2475 + "beacon_loss", "sta_state", "txrate", "rxrate", "signal",
2476 + "channel", "noise", "ch_time", "ch_time_busy",
2477 + "ch_time_ext_busy", "ch_time_rx", "ch_time_tx"
2479 +#define STA_STATS_LEN ARRAY_SIZE(ieee80211_gstrings_sta_stats)
2481 +static int ieee80211_get_sset_count(struct net_device *dev, int sset)
2483 + struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev);
2486 + if (sset == ETH_SS_STATS)
2487 + rv += STA_STATS_LEN;
2489 + rv += drv_get_et_sset_count(sdata, sset);
2492 + return -EOPNOTSUPP;
2496 +static void ieee80211_get_stats(struct net_device *dev,
2497 + struct ethtool_stats *stats,
2500 + struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev);
2501 + struct ieee80211_chanctx_conf *chanctx_conf;
2502 + struct ieee80211_channel *channel;
2503 + struct sta_info *sta;
2504 + struct ieee80211_local *local = sdata->local;
2505 + struct station_info sinfo;
2506 + struct survey_info survey;
2508 +#define STA_STATS_SURVEY_LEN 7
2510 + memset(data, 0, sizeof(u64) * STA_STATS_LEN);
2512 +#define ADD_STA_STATS(sta) \
2514 + data[i++] += sta->rx_packets; \
2515 + data[i++] += sta->rx_bytes; \
2516 + data[i++] += sta->num_duplicates; \
2517 + data[i++] += sta->rx_fragments; \
2518 + data[i++] += sta->rx_dropped; \
2520 + data[i++] += sinfo.tx_packets; \
2521 + data[i++] += sinfo.tx_bytes; \
2522 + data[i++] += sta->tx_fragments; \
2523 + data[i++] += sta->tx_filtered_count; \
2524 + data[i++] += sta->tx_retry_failed; \
2525 + data[i++] += sta->tx_retry_count; \
2526 + data[i++] += sta->beacon_loss_count; \
2529 + /* For Managed stations, find the single station based on BSSID
2530 + * and use that. For interface types, iterate through all available
2531 + * stations and add stats for any station that is assigned to this
2535 + mutex_lock(&local->sta_mtx);
2537 + if (sdata->vif.type == NL80211_IFTYPE_STATION) {
2538 + sta = sta_info_get_bss(sdata, sdata->u.mgd.bssid);
2540 + if (!(sta && !WARN_ON(sta->sdata->dev != dev)))
2544 + sta_set_sinfo(sta, &sinfo);
2547 + ADD_STA_STATS(sta);
2549 + data[i++] = sta->sta_state;
2552 + if (sinfo.filled & STATION_INFO_TX_BITRATE)
2553 + data[i] = 100000 *
2554 + cfg80211_calculate_bitrate(&sinfo.txrate);
2556 + if (sinfo.filled & STATION_INFO_RX_BITRATE)
2557 + data[i] = 100000 *
2558 + cfg80211_calculate_bitrate(&sinfo.rxrate);
2561 + if (sinfo.filled & STATION_INFO_SIGNAL_AVG)
2562 + data[i] = (u8)sinfo.signal_avg;
2565 + list_for_each_entry(sta, &local->sta_list, list) {
2566 + /* Make sure this station belongs to the proper dev */
2567 + if (sta->sdata->dev != dev)
2571 + sta_set_sinfo(sta, &sinfo);
2573 + ADD_STA_STATS(sta);
2578 + i = STA_STATS_LEN - STA_STATS_SURVEY_LEN;
2579 + /* Get survey stats for current channel */
2580 + survey.filled = 0;
2583 + chanctx_conf = rcu_dereference(sdata->vif.chanctx_conf);
2585 + channel = chanctx_conf->def.chan;
2588 + rcu_read_unlock();
2593 + survey.filled = 0;
2594 + if (drv_get_survey(local, q, &survey) != 0) {
2595 + survey.filled = 0;
2599 + } while (channel != survey.channel);
2602 + if (survey.filled)
2603 + data[i++] = survey.channel->center_freq;
2606 + if (survey.filled & SURVEY_INFO_NOISE_DBM)
2607 + data[i++] = (u8)survey.noise;
2610 + if (survey.filled & SURVEY_INFO_CHANNEL_TIME)
2611 + data[i++] = survey.channel_time;
2614 + if (survey.filled & SURVEY_INFO_CHANNEL_TIME_BUSY)
2615 + data[i++] = survey.channel_time_busy;
2618 + if (survey.filled & SURVEY_INFO_CHANNEL_TIME_EXT_BUSY)
2619 + data[i++] = survey.channel_time_ext_busy;
2622 + if (survey.filled & SURVEY_INFO_CHANNEL_TIME_RX)
2623 + data[i++] = survey.channel_time_rx;
2626 + if (survey.filled & SURVEY_INFO_CHANNEL_TIME_TX)
2627 + data[i++] = survey.channel_time_tx;
2631 + mutex_unlock(&local->sta_mtx);
2633 + if (WARN_ON(i != STA_STATS_LEN))
2636 + drv_get_et_stats(sdata, stats, &(data[STA_STATS_LEN]));
2639 +static void ieee80211_get_strings(struct net_device *dev, u32 sset, u8 *data)
2641 + struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev);
2642 + int sz_sta_stats = 0;
2644 + if (sset == ETH_SS_STATS) {
2645 + sz_sta_stats = sizeof(ieee80211_gstrings_sta_stats);
2646 + memcpy(data, ieee80211_gstrings_sta_stats, sz_sta_stats);
2648 + drv_get_et_strings(sdata, sset, &(data[sz_sta_stats]));
2651 +static int ieee80211_get_regs_len(struct net_device *dev)
2656 +static void ieee80211_get_regs(struct net_device *dev,
2657 + struct ethtool_regs *regs,
2660 + struct wireless_dev *wdev = dev->ieee80211_ptr;
2662 + regs->version = wdev->wiphy->hw_version;
2666 +const struct ethtool_ops ieee80211_ethtool_ops = {
2667 + .get_drvinfo = cfg80211_get_drvinfo,
2668 + .get_regs_len = ieee80211_get_regs_len,
2669 + .get_regs = ieee80211_get_regs,
2670 + .get_link = ethtool_op_get_link,
2671 + .get_ringparam = ieee80211_get_ringparam,
2672 + .set_ringparam = ieee80211_set_ringparam,
2673 + .get_strings = ieee80211_get_strings,
2674 + .get_ethtool_stats = ieee80211_get_stats,
2675 + .get_sset_count = ieee80211_get_sset_count,
2677 --- a/net/mac80211/ibss.c
2678 +++ b/net/mac80211/ibss.c
2679 @@ -143,7 +143,7 @@ ieee80211_ibss_build_presp(struct ieee80
2680 *pos++ = csa_settings->block_tx ? 1 : 0;
2681 *pos++ = ieee80211_frequency_to_channel(
2682 csa_settings->chandef.chan->center_freq);
2683 - sdata->csa_counter_offset_beacon[0] = (pos - presp->head);
2684 + presp->csa_counter_offsets[0] = (pos - presp->head);
2685 *pos++ = csa_settings->count;
2688 @@ -1677,6 +1677,7 @@ int ieee80211_ibss_join(struct ieee80211
2689 sdata->u.ibss.control_port = params->control_port;
2690 sdata->u.ibss.userspace_handles_dfs = params->userspace_handles_dfs;
2691 sdata->u.ibss.basic_rates = params->basic_rates;
2692 + sdata->u.ibss.last_scan_completed = jiffies;
2694 /* fix basic_rates if channel does not support these rates */
2695 rate_flags = ieee80211_chandef_rate_flags(¶ms->chandef);
2696 --- a/net/mac80211/mesh.c
2697 +++ b/net/mac80211/mesh.c
2698 @@ -679,7 +679,7 @@ ieee80211_mesh_build_beacon(struct ieee8
2700 *pos++ = ieee80211_frequency_to_channel(
2701 csa->settings.chandef.chan->center_freq);
2702 - sdata->csa_counter_offset_beacon[0] = hdr_len + 6;
2703 + bcn->csa_counter_offsets[0] = hdr_len + 6;
2704 *pos++ = csa->settings.count;
2705 *pos++ = WLAN_EID_CHAN_SWITCH_PARAM;
2707 --- a/net/wireless/genregdb.awk
2708 +++ b/net/wireless/genregdb.awk
2709 @@ -65,17 +65,7 @@ function parse_reg_rule()
2712 if (units == "mW") {
2713 - if (power == 100) {
2715 - } else if (power == 200) {
2717 - } else if (power == 500) {
2719 - } else if (power == 1000) {
2722 - print "Unknown power value in database!"
2724 + power = 10 * log(power)/log(10)
2728 @@ -114,7 +104,7 @@ function parse_reg_rule()
2732 - printf "\t\tREG_RULE_EXT(%d, %d, %d, %d, %d, %d, %s),\n", start, end, bw, gain, power, dfs_cac, flags
2733 + printf "\t\tREG_RULE_EXT(%d, %d, %d, %d, %.0f, %d, %s),\n", start, end, bw, gain, power, dfs_cac, flags
2737 --- a/net/mac80211/debugfs_netdev.c
2738 +++ b/net/mac80211/debugfs_netdev.c
2739 @@ -34,8 +34,7 @@ static ssize_t ieee80211_if_read(
2740 ssize_t ret = -EINVAL;
2742 read_lock(&dev_base_lock);
2743 - if (sdata->dev->reg_state == NETREG_REGISTERED)
2744 - ret = (*format)(sdata, buf, sizeof(buf));
2745 + ret = (*format)(sdata, buf, sizeof(buf));
2746 read_unlock(&dev_base_lock);
2749 @@ -62,8 +61,7 @@ static ssize_t ieee80211_if_write(
2753 - if (sdata->dev->reg_state == NETREG_REGISTERED)
2754 - ret = (*write)(sdata, buf, count);
2755 + ret = (*write)(sdata, buf, count);
2759 --- a/drivers/net/wireless/b43/xmit.c
2760 +++ b/drivers/net/wireless/b43/xmit.c
2761 @@ -811,9 +811,13 @@ void b43_rx(struct b43_wldev *dev, struc
2764 status.band = IEEE80211_BAND_2GHZ;
2765 - /* chanid is the radio channel cookie value as used
2766 - * to tune the radio. */
2767 - status.freq = chanid + 2400;
2768 + /* Somewhere between 478.104 and 508.1084 firmware for G-PHY
2769 + * has been modified to be compatible with N-PHY and others.
2771 + if (dev->fw.rev >= 508)
2772 + status.freq = ieee80211_channel_to_frequency(chanid, status.band);
2774 + status.freq = chanid + 2400;
2777 case B43_PHYTYPE_LP: