2 * mac80211 configuration hooks for cfg80211
4 * Copyright 2006-2010 Johannes Berg <johannes@sipsolutions.net>
6 * This file is GPLv2 as found in COPYING.
9 #include <linux/ieee80211.h>
10 #include <linux/nl80211.h>
11 #include <linux/rtnetlink.h>
12 #include <linux/slab.h>
13 #include <net/net_namespace.h>
14 #include <linux/rcupdate.h>
15 #include <linux/if_ether.h>
16 #include <net/cfg80211.h>
17 #include "ieee80211_i.h"
18 #include "driver-ops.h"
23 static struct wireless_dev
*ieee80211_add_iface(struct wiphy
*wiphy
,
25 enum nl80211_iftype type
,
27 struct vif_params
*params
)
29 struct ieee80211_local
*local
= wiphy_priv(wiphy
);
30 struct wireless_dev
*wdev
;
31 struct ieee80211_sub_if_data
*sdata
;
34 err
= ieee80211_if_add(local
, name
, &wdev
, type
, params
);
38 if (type
== NL80211_IFTYPE_MONITOR
&& flags
) {
39 sdata
= IEEE80211_WDEV_TO_SUB_IF(wdev
);
40 sdata
->u
.mntr_flags
= *flags
;
46 static int ieee80211_del_iface(struct wiphy
*wiphy
, struct wireless_dev
*wdev
)
48 ieee80211_if_remove(IEEE80211_WDEV_TO_SUB_IF(wdev
));
53 static int ieee80211_change_iface(struct wiphy
*wiphy
,
54 struct net_device
*dev
,
55 enum nl80211_iftype type
, u32
*flags
,
56 struct vif_params
*params
)
58 struct ieee80211_sub_if_data
*sdata
= IEEE80211_DEV_TO_SUB_IF(dev
);
61 ret
= ieee80211_if_change_type(sdata
, type
);
65 if (type
== NL80211_IFTYPE_AP_VLAN
&&
66 params
&& params
->use_4addr
== 0)
67 RCU_INIT_POINTER(sdata
->u
.vlan
.sta
, NULL
);
68 else if (type
== NL80211_IFTYPE_STATION
&&
69 params
&& params
->use_4addr
>= 0)
70 sdata
->u
.mgd
.use_4addr
= params
->use_4addr
;
72 if (sdata
->vif
.type
== NL80211_IFTYPE_MONITOR
&& flags
) {
73 struct ieee80211_local
*local
= sdata
->local
;
75 if (ieee80211_sdata_running(sdata
)) {
76 u32 mask
= MONITOR_FLAG_COOK_FRAMES
|
80 * Prohibit MONITOR_FLAG_COOK_FRAMES and
81 * MONITOR_FLAG_ACTIVE to be changed while the
83 * Else we would need to add a lot of cruft
84 * to update everything:
85 * cooked_mntrs, monitor and all fif_* counters
86 * reconfigure hardware
88 if ((*flags
& mask
) != (sdata
->u
.mntr_flags
& mask
))
91 ieee80211_adjust_monitor_flags(sdata
, -1);
92 sdata
->u
.mntr_flags
= *flags
;
93 ieee80211_adjust_monitor_flags(sdata
, 1);
95 ieee80211_configure_filter(local
);
98 * Because the interface is down, ieee80211_do_stop
99 * and ieee80211_do_open take care of "everything"
100 * mentioned in the comment above.
102 sdata
->u
.mntr_flags
= *flags
;
109 static int ieee80211_start_p2p_device(struct wiphy
*wiphy
,
110 struct wireless_dev
*wdev
)
112 struct ieee80211_sub_if_data
*sdata
= IEEE80211_WDEV_TO_SUB_IF(wdev
);
115 mutex_lock(&sdata
->local
->chanctx_mtx
);
116 ret
= ieee80211_check_combinations(sdata
, NULL
, 0, 0);
117 mutex_unlock(&sdata
->local
->chanctx_mtx
);
121 return ieee80211_do_open(wdev
, true);
124 static void ieee80211_stop_p2p_device(struct wiphy
*wiphy
,
125 struct wireless_dev
*wdev
)
127 ieee80211_sdata_stop(IEEE80211_WDEV_TO_SUB_IF(wdev
));
130 static int ieee80211_set_noack_map(struct wiphy
*wiphy
,
131 struct net_device
*dev
,
134 struct ieee80211_sub_if_data
*sdata
= IEEE80211_DEV_TO_SUB_IF(dev
);
136 sdata
->noack_map
= noack_map
;
140 static int ieee80211_add_key(struct wiphy
*wiphy
, struct net_device
*dev
,
141 u8 key_idx
, bool pairwise
, const u8
*mac_addr
,
142 struct key_params
*params
)
144 struct ieee80211_sub_if_data
*sdata
= IEEE80211_DEV_TO_SUB_IF(dev
);
145 struct ieee80211_local
*local
= sdata
->local
;
146 struct sta_info
*sta
= NULL
;
147 const struct ieee80211_cipher_scheme
*cs
= NULL
;
148 struct ieee80211_key
*key
;
151 if (!ieee80211_sdata_running(sdata
))
154 /* reject WEP and TKIP keys if WEP failed to initialize */
155 switch (params
->cipher
) {
156 case WLAN_CIPHER_SUITE_WEP40
:
157 case WLAN_CIPHER_SUITE_TKIP
:
158 case WLAN_CIPHER_SUITE_WEP104
:
159 if (IS_ERR(local
->wep_tx_tfm
))
162 case WLAN_CIPHER_SUITE_CCMP
:
163 case WLAN_CIPHER_SUITE_AES_CMAC
:
164 case WLAN_CIPHER_SUITE_GCMP
:
167 cs
= ieee80211_cs_get(local
, params
->cipher
, sdata
->vif
.type
);
171 key
= ieee80211_key_alloc(params
->cipher
, key_idx
, params
->key_len
,
172 params
->key
, params
->seq_len
, params
->seq
,
178 key
->conf
.flags
|= IEEE80211_KEY_FLAG_PAIRWISE
;
180 mutex_lock(&local
->sta_mtx
);
183 if (ieee80211_vif_is_mesh(&sdata
->vif
))
184 sta
= sta_info_get(sdata
, mac_addr
);
186 sta
= sta_info_get_bss(sdata
, mac_addr
);
188 * The ASSOC test makes sure the driver is ready to
189 * receive the key. When wpa_supplicant has roamed
190 * using FT, it attempts to set the key before
191 * association has completed, this rejects that attempt
192 * so it will set the key again after assocation.
194 * TODO: accept the key if we have a station entry and
195 * add it to the device after the station.
197 if (!sta
|| !test_sta_flag(sta
, WLAN_STA_ASSOC
)) {
198 ieee80211_key_free_unused(key
);
204 switch (sdata
->vif
.type
) {
205 case NL80211_IFTYPE_STATION
:
206 if (sdata
->u
.mgd
.mfp
!= IEEE80211_MFP_DISABLED
)
207 key
->conf
.flags
|= IEEE80211_KEY_FLAG_RX_MGMT
;
209 case NL80211_IFTYPE_AP
:
210 case NL80211_IFTYPE_AP_VLAN
:
211 /* Keys without a station are used for TX only */
212 if (key
->sta
&& test_sta_flag(key
->sta
, WLAN_STA_MFP
))
213 key
->conf
.flags
|= IEEE80211_KEY_FLAG_RX_MGMT
;
215 case NL80211_IFTYPE_ADHOC
:
218 case NL80211_IFTYPE_MESH_POINT
:
219 #ifdef CONFIG_MAC80211_MESH
220 if (sdata
->u
.mesh
.security
!= IEEE80211_MESH_SEC_NONE
)
221 key
->conf
.flags
|= IEEE80211_KEY_FLAG_RX_MGMT
;
224 case NL80211_IFTYPE_WDS
:
225 case NL80211_IFTYPE_MONITOR
:
226 case NL80211_IFTYPE_P2P_DEVICE
:
227 case NL80211_IFTYPE_UNSPECIFIED
:
228 case NUM_NL80211_IFTYPES
:
229 case NL80211_IFTYPE_P2P_CLIENT
:
230 case NL80211_IFTYPE_P2P_GO
:
231 /* shouldn't happen */
237 sta
->cipher_scheme
= cs
;
239 err
= ieee80211_key_link(key
, sdata
, sta
);
242 mutex_unlock(&local
->sta_mtx
);
247 static int ieee80211_del_key(struct wiphy
*wiphy
, struct net_device
*dev
,
248 u8 key_idx
, bool pairwise
, const u8
*mac_addr
)
250 struct ieee80211_sub_if_data
*sdata
= IEEE80211_DEV_TO_SUB_IF(dev
);
251 struct ieee80211_local
*local
= sdata
->local
;
252 struct sta_info
*sta
;
253 struct ieee80211_key
*key
= NULL
;
256 mutex_lock(&local
->sta_mtx
);
257 mutex_lock(&local
->key_mtx
);
262 sta
= sta_info_get_bss(sdata
, mac_addr
);
267 key
= key_mtx_dereference(local
, sta
->ptk
[key_idx
]);
269 key
= key_mtx_dereference(local
, sta
->gtk
[key_idx
]);
271 key
= key_mtx_dereference(local
, sdata
->keys
[key_idx
]);
278 ieee80211_key_free(key
, true);
282 mutex_unlock(&local
->key_mtx
);
283 mutex_unlock(&local
->sta_mtx
);
288 static int ieee80211_get_key(struct wiphy
*wiphy
, struct net_device
*dev
,
289 u8 key_idx
, bool pairwise
, const u8
*mac_addr
,
291 void (*callback
)(void *cookie
,
292 struct key_params
*params
))
294 struct ieee80211_sub_if_data
*sdata
;
295 struct sta_info
*sta
= NULL
;
297 struct key_params params
;
298 struct ieee80211_key
*key
= NULL
;
304 sdata
= IEEE80211_DEV_TO_SUB_IF(dev
);
309 sta
= sta_info_get_bss(sdata
, mac_addr
);
313 if (pairwise
&& key_idx
< NUM_DEFAULT_KEYS
)
314 key
= rcu_dereference(sta
->ptk
[key_idx
]);
315 else if (!pairwise
&&
316 key_idx
< NUM_DEFAULT_KEYS
+ NUM_DEFAULT_MGMT_KEYS
)
317 key
= rcu_dereference(sta
->gtk
[key_idx
]);
319 key
= rcu_dereference(sdata
->keys
[key_idx
]);
324 memset(¶ms
, 0, sizeof(params
));
326 params
.cipher
= key
->conf
.cipher
;
328 switch (key
->conf
.cipher
) {
329 case WLAN_CIPHER_SUITE_TKIP
:
330 iv32
= key
->u
.tkip
.tx
.iv32
;
331 iv16
= key
->u
.tkip
.tx
.iv16
;
333 if (key
->flags
& KEY_FLAG_UPLOADED_TO_HARDWARE
)
334 drv_get_tkip_seq(sdata
->local
,
335 key
->conf
.hw_key_idx
,
338 seq
[0] = iv16
& 0xff;
339 seq
[1] = (iv16
>> 8) & 0xff;
340 seq
[2] = iv32
& 0xff;
341 seq
[3] = (iv32
>> 8) & 0xff;
342 seq
[4] = (iv32
>> 16) & 0xff;
343 seq
[5] = (iv32
>> 24) & 0xff;
347 case WLAN_CIPHER_SUITE_CCMP
:
348 pn64
= atomic64_read(&key
->u
.ccmp
.tx_pn
);
358 case WLAN_CIPHER_SUITE_AES_CMAC
:
359 pn64
= atomic64_read(&key
->u
.aes_cmac
.tx_pn
);
371 params
.key
= key
->conf
.key
;
372 params
.key_len
= key
->conf
.keylen
;
374 callback(cookie
, ¶ms
);
382 static int ieee80211_config_default_key(struct wiphy
*wiphy
,
383 struct net_device
*dev
,
384 u8 key_idx
, bool uni
,
387 struct ieee80211_sub_if_data
*sdata
= IEEE80211_DEV_TO_SUB_IF(dev
);
389 ieee80211_set_default_key(sdata
, key_idx
, uni
, multi
);
394 static int ieee80211_config_default_mgmt_key(struct wiphy
*wiphy
,
395 struct net_device
*dev
,
398 struct ieee80211_sub_if_data
*sdata
= IEEE80211_DEV_TO_SUB_IF(dev
);
400 ieee80211_set_default_mgmt_key(sdata
, key_idx
);
405 void sta_set_rate_info_tx(struct sta_info
*sta
,
406 const struct ieee80211_tx_rate
*rate
,
407 struct rate_info
*rinfo
)
410 if (rate
->flags
& IEEE80211_TX_RC_MCS
) {
411 rinfo
->flags
|= RATE_INFO_FLAGS_MCS
;
412 rinfo
->mcs
= rate
->idx
;
413 } else if (rate
->flags
& IEEE80211_TX_RC_VHT_MCS
) {
414 rinfo
->flags
|= RATE_INFO_FLAGS_VHT_MCS
;
415 rinfo
->mcs
= ieee80211_rate_get_vht_mcs(rate
);
416 rinfo
->nss
= ieee80211_rate_get_vht_nss(rate
);
418 struct ieee80211_supported_band
*sband
;
419 int shift
= ieee80211_vif_get_shift(&sta
->sdata
->vif
);
422 sband
= sta
->local
->hw
.wiphy
->bands
[
423 ieee80211_get_sdata_band(sta
->sdata
)];
424 brate
= sband
->bitrates
[rate
->idx
].bitrate
;
425 rinfo
->legacy
= DIV_ROUND_UP(brate
, 1 << shift
);
427 if (rate
->flags
& IEEE80211_TX_RC_40_MHZ_WIDTH
)
428 rinfo
->flags
|= RATE_INFO_FLAGS_40_MHZ_WIDTH
;
429 if (rate
->flags
& IEEE80211_TX_RC_80_MHZ_WIDTH
)
430 rinfo
->flags
|= RATE_INFO_FLAGS_80_MHZ_WIDTH
;
431 if (rate
->flags
& IEEE80211_TX_RC_160_MHZ_WIDTH
)
432 rinfo
->flags
|= RATE_INFO_FLAGS_160_MHZ_WIDTH
;
433 if (rate
->flags
& IEEE80211_TX_RC_SHORT_GI
)
434 rinfo
->flags
|= RATE_INFO_FLAGS_SHORT_GI
;
437 void sta_set_rate_info_rx(struct sta_info
*sta
, struct rate_info
*rinfo
)
441 if (sta
->last_rx_rate_flag
& RX_FLAG_HT
) {
442 rinfo
->flags
|= RATE_INFO_FLAGS_MCS
;
443 rinfo
->mcs
= sta
->last_rx_rate_idx
;
444 } else if (sta
->last_rx_rate_flag
& RX_FLAG_VHT
) {
445 rinfo
->flags
|= RATE_INFO_FLAGS_VHT_MCS
;
446 rinfo
->nss
= sta
->last_rx_rate_vht_nss
;
447 rinfo
->mcs
= sta
->last_rx_rate_idx
;
449 struct ieee80211_supported_band
*sband
;
450 int shift
= ieee80211_vif_get_shift(&sta
->sdata
->vif
);
453 sband
= sta
->local
->hw
.wiphy
->bands
[
454 ieee80211_get_sdata_band(sta
->sdata
)];
455 brate
= sband
->bitrates
[sta
->last_rx_rate_idx
].bitrate
;
456 rinfo
->legacy
= DIV_ROUND_UP(brate
, 1 << shift
);
459 if (sta
->last_rx_rate_flag
& RX_FLAG_40MHZ
)
460 rinfo
->flags
|= RATE_INFO_FLAGS_40_MHZ_WIDTH
;
461 if (sta
->last_rx_rate_flag
& RX_FLAG_SHORT_GI
)
462 rinfo
->flags
|= RATE_INFO_FLAGS_SHORT_GI
;
463 if (sta
->last_rx_rate_vht_flag
& RX_VHT_FLAG_80MHZ
)
464 rinfo
->flags
|= RATE_INFO_FLAGS_80_MHZ_WIDTH
;
465 if (sta
->last_rx_rate_vht_flag
& RX_VHT_FLAG_80P80MHZ
)
466 rinfo
->flags
|= RATE_INFO_FLAGS_80P80_MHZ_WIDTH
;
467 if (sta
->last_rx_rate_vht_flag
& RX_VHT_FLAG_160MHZ
)
468 rinfo
->flags
|= RATE_INFO_FLAGS_160_MHZ_WIDTH
;
471 static void sta_set_sinfo(struct sta_info
*sta
, struct station_info
*sinfo
)
473 struct ieee80211_sub_if_data
*sdata
= sta
->sdata
;
474 struct ieee80211_local
*local
= sdata
->local
;
475 struct timespec uptime
;
479 sinfo
->generation
= sdata
->local
->sta_generation
;
481 sinfo
->filled
= STATION_INFO_INACTIVE_TIME
|
482 STATION_INFO_RX_BYTES64
|
483 STATION_INFO_TX_BYTES64
|
484 STATION_INFO_RX_PACKETS
|
485 STATION_INFO_TX_PACKETS
|
486 STATION_INFO_TX_RETRIES
|
487 STATION_INFO_TX_FAILED
|
488 STATION_INFO_TX_BITRATE
|
489 STATION_INFO_RX_BITRATE
|
490 STATION_INFO_RX_DROP_MISC
|
491 STATION_INFO_BSS_PARAM
|
492 STATION_INFO_CONNECTED_TIME
|
493 STATION_INFO_STA_FLAGS
|
494 STATION_INFO_BEACON_LOSS_COUNT
;
496 do_posix_clock_monotonic_gettime(&uptime
);
497 sinfo
->connected_time
= uptime
.tv_sec
- sta
->last_connected
;
499 sinfo
->inactive_time
= jiffies_to_msecs(jiffies
- sta
->last_rx
);
501 for (ac
= 0; ac
< IEEE80211_NUM_ACS
; ac
++) {
502 sinfo
->tx_bytes
+= sta
->tx_bytes
[ac
];
503 packets
+= sta
->tx_packets
[ac
];
505 sinfo
->tx_packets
= packets
;
506 sinfo
->rx_bytes
= sta
->rx_bytes
;
507 sinfo
->rx_packets
= sta
->rx_packets
;
508 sinfo
->tx_retries
= sta
->tx_retry_count
;
509 sinfo
->tx_failed
= sta
->tx_retry_failed
;
510 sinfo
->rx_dropped_misc
= sta
->rx_dropped
;
511 sinfo
->beacon_loss_count
= sta
->beacon_loss_count
;
513 if ((sta
->local
->hw
.flags
& IEEE80211_HW_SIGNAL_DBM
) ||
514 (sta
->local
->hw
.flags
& IEEE80211_HW_SIGNAL_UNSPEC
)) {
515 sinfo
->filled
|= STATION_INFO_SIGNAL
| STATION_INFO_SIGNAL_AVG
;
516 if (!local
->ops
->get_rssi
||
517 drv_get_rssi(local
, sdata
, &sta
->sta
, &sinfo
->signal
))
518 sinfo
->signal
= (s8
)sta
->last_signal
;
519 sinfo
->signal_avg
= (s8
) -ewma_read(&sta
->avg_signal
);
522 sinfo
->filled
|= STATION_INFO_CHAIN_SIGNAL
|
523 STATION_INFO_CHAIN_SIGNAL_AVG
;
525 sinfo
->chains
= sta
->chains
;
526 for (i
= 0; i
< ARRAY_SIZE(sinfo
->chain_signal
); i
++) {
527 sinfo
->chain_signal
[i
] = sta
->chain_signal_last
[i
];
528 sinfo
->chain_signal_avg
[i
] =
529 (s8
) -ewma_read(&sta
->chain_signal_avg
[i
]);
533 sta_set_rate_info_tx(sta
, &sta
->last_tx_rate
, &sinfo
->txrate
);
534 sta_set_rate_info_rx(sta
, &sinfo
->rxrate
);
536 if (ieee80211_vif_is_mesh(&sdata
->vif
)) {
537 #ifdef CONFIG_MAC80211_MESH
538 sinfo
->filled
|= STATION_INFO_LLID
|
540 STATION_INFO_PLINK_STATE
|
541 STATION_INFO_LOCAL_PM
|
542 STATION_INFO_PEER_PM
|
543 STATION_INFO_NONPEER_PM
;
545 sinfo
->llid
= sta
->llid
;
546 sinfo
->plid
= sta
->plid
;
547 sinfo
->plink_state
= sta
->plink_state
;
548 if (test_sta_flag(sta
, WLAN_STA_TOFFSET_KNOWN
)) {
549 sinfo
->filled
|= STATION_INFO_T_OFFSET
;
550 sinfo
->t_offset
= sta
->t_offset
;
552 sinfo
->local_pm
= sta
->local_pm
;
553 sinfo
->peer_pm
= sta
->peer_pm
;
554 sinfo
->nonpeer_pm
= sta
->nonpeer_pm
;
558 sinfo
->bss_param
.flags
= 0;
559 if (sdata
->vif
.bss_conf
.use_cts_prot
)
560 sinfo
->bss_param
.flags
|= BSS_PARAM_FLAGS_CTS_PROT
;
561 if (sdata
->vif
.bss_conf
.use_short_preamble
)
562 sinfo
->bss_param
.flags
|= BSS_PARAM_FLAGS_SHORT_PREAMBLE
;
563 if (sdata
->vif
.bss_conf
.use_short_slot
)
564 sinfo
->bss_param
.flags
|= BSS_PARAM_FLAGS_SHORT_SLOT_TIME
;
565 sinfo
->bss_param
.dtim_period
= sdata
->local
->hw
.conf
.ps_dtim_period
;
566 sinfo
->bss_param
.beacon_interval
= sdata
->vif
.bss_conf
.beacon_int
;
568 sinfo
->sta_flags
.set
= 0;
569 sinfo
->sta_flags
.mask
= BIT(NL80211_STA_FLAG_AUTHORIZED
) |
570 BIT(NL80211_STA_FLAG_SHORT_PREAMBLE
) |
571 BIT(NL80211_STA_FLAG_WME
) |
572 BIT(NL80211_STA_FLAG_MFP
) |
573 BIT(NL80211_STA_FLAG_AUTHENTICATED
) |
574 BIT(NL80211_STA_FLAG_ASSOCIATED
) |
575 BIT(NL80211_STA_FLAG_TDLS_PEER
);
576 if (test_sta_flag(sta
, WLAN_STA_AUTHORIZED
))
577 sinfo
->sta_flags
.set
|= BIT(NL80211_STA_FLAG_AUTHORIZED
);
578 if (test_sta_flag(sta
, WLAN_STA_SHORT_PREAMBLE
))
579 sinfo
->sta_flags
.set
|= BIT(NL80211_STA_FLAG_SHORT_PREAMBLE
);
580 if (test_sta_flag(sta
, WLAN_STA_WME
))
581 sinfo
->sta_flags
.set
|= BIT(NL80211_STA_FLAG_WME
);
582 if (test_sta_flag(sta
, WLAN_STA_MFP
))
583 sinfo
->sta_flags
.set
|= BIT(NL80211_STA_FLAG_MFP
);
584 if (test_sta_flag(sta
, WLAN_STA_AUTH
))
585 sinfo
->sta_flags
.set
|= BIT(NL80211_STA_FLAG_AUTHENTICATED
);
586 if (test_sta_flag(sta
, WLAN_STA_ASSOC
))
587 sinfo
->sta_flags
.set
|= BIT(NL80211_STA_FLAG_ASSOCIATED
);
588 if (test_sta_flag(sta
, WLAN_STA_TDLS_PEER
))
589 sinfo
->sta_flags
.set
|= BIT(NL80211_STA_FLAG_TDLS_PEER
);
592 static const char ieee80211_gstrings_sta_stats
[][ETH_GSTRING_LEN
] = {
593 "rx_packets", "rx_bytes", "wep_weak_iv_count",
594 "rx_duplicates", "rx_fragments", "rx_dropped",
595 "tx_packets", "tx_bytes", "tx_fragments",
596 "tx_filtered", "tx_retry_failed", "tx_retries",
597 "beacon_loss", "sta_state", "txrate", "rxrate", "signal",
598 "channel", "noise", "ch_time", "ch_time_busy",
599 "ch_time_ext_busy", "ch_time_rx", "ch_time_tx"
601 #define STA_STATS_LEN ARRAY_SIZE(ieee80211_gstrings_sta_stats)
603 static int ieee80211_get_et_sset_count(struct wiphy
*wiphy
,
604 struct net_device
*dev
,
607 struct ieee80211_sub_if_data
*sdata
= IEEE80211_DEV_TO_SUB_IF(dev
);
610 if (sset
== ETH_SS_STATS
)
613 rv
+= drv_get_et_sset_count(sdata
, sset
);
620 static void ieee80211_get_et_stats(struct wiphy
*wiphy
,
621 struct net_device
*dev
,
622 struct ethtool_stats
*stats
,
625 struct ieee80211_sub_if_data
*sdata
= IEEE80211_DEV_TO_SUB_IF(dev
);
626 struct ieee80211_chanctx_conf
*chanctx_conf
;
627 struct ieee80211_channel
*channel
;
628 struct sta_info
*sta
;
629 struct ieee80211_local
*local
= sdata
->local
;
630 struct station_info sinfo
;
631 struct survey_info survey
;
633 #define STA_STATS_SURVEY_LEN 7
635 memset(data
, 0, sizeof(u64
) * STA_STATS_LEN
);
637 #define ADD_STA_STATS(sta) \
639 data[i++] += sta->rx_packets; \
640 data[i++] += sta->rx_bytes; \
641 data[i++] += sta->wep_weak_iv_count; \
642 data[i++] += sta->num_duplicates; \
643 data[i++] += sta->rx_fragments; \
644 data[i++] += sta->rx_dropped; \
646 data[i++] += sinfo.tx_packets; \
647 data[i++] += sinfo.tx_bytes; \
648 data[i++] += sta->tx_fragments; \
649 data[i++] += sta->tx_filtered_count; \
650 data[i++] += sta->tx_retry_failed; \
651 data[i++] += sta->tx_retry_count; \
652 data[i++] += sta->beacon_loss_count; \
655 /* For Managed stations, find the single station based on BSSID
656 * and use that. For interface types, iterate through all available
657 * stations and add stats for any station that is assigned to this
661 mutex_lock(&local
->sta_mtx
);
663 if (sdata
->vif
.type
== NL80211_IFTYPE_STATION
) {
664 sta
= sta_info_get_bss(sdata
, sdata
->u
.mgd
.bssid
);
666 if (!(sta
&& !WARN_ON(sta
->sdata
->dev
!= dev
)))
670 sta_set_sinfo(sta
, &sinfo
);
675 data
[i
++] = sta
->sta_state
;
678 if (sinfo
.filled
& STATION_INFO_TX_BITRATE
)
680 cfg80211_calculate_bitrate(&sinfo
.txrate
);
682 if (sinfo
.filled
& STATION_INFO_RX_BITRATE
)
684 cfg80211_calculate_bitrate(&sinfo
.rxrate
);
687 if (sinfo
.filled
& STATION_INFO_SIGNAL_AVG
)
688 data
[i
] = (u8
)sinfo
.signal_avg
;
691 list_for_each_entry(sta
, &local
->sta_list
, list
) {
692 /* Make sure this station belongs to the proper dev */
693 if (sta
->sdata
->dev
!= dev
)
697 sta_set_sinfo(sta
, &sinfo
);
704 i
= STA_STATS_LEN
- STA_STATS_SURVEY_LEN
;
705 /* Get survey stats for current channel */
709 chanctx_conf
= rcu_dereference(sdata
->vif
.chanctx_conf
);
711 channel
= chanctx_conf
->def
.chan
;
720 if (drv_get_survey(local
, q
, &survey
) != 0) {
725 } while (channel
!= survey
.channel
);
729 data
[i
++] = survey
.channel
->center_freq
;
732 if (survey
.filled
& SURVEY_INFO_NOISE_DBM
)
733 data
[i
++] = (u8
)survey
.noise
;
736 if (survey
.filled
& SURVEY_INFO_CHANNEL_TIME
)
737 data
[i
++] = survey
.channel_time
;
740 if (survey
.filled
& SURVEY_INFO_CHANNEL_TIME_BUSY
)
741 data
[i
++] = survey
.channel_time_busy
;
744 if (survey
.filled
& SURVEY_INFO_CHANNEL_TIME_EXT_BUSY
)
745 data
[i
++] = survey
.channel_time_ext_busy
;
748 if (survey
.filled
& SURVEY_INFO_CHANNEL_TIME_RX
)
749 data
[i
++] = survey
.channel_time_rx
;
752 if (survey
.filled
& SURVEY_INFO_CHANNEL_TIME_TX
)
753 data
[i
++] = survey
.channel_time_tx
;
757 mutex_unlock(&local
->sta_mtx
);
759 if (WARN_ON(i
!= STA_STATS_LEN
))
762 drv_get_et_stats(sdata
, stats
, &(data
[STA_STATS_LEN
]));
765 static void ieee80211_get_et_strings(struct wiphy
*wiphy
,
766 struct net_device
*dev
,
769 struct ieee80211_sub_if_data
*sdata
= IEEE80211_DEV_TO_SUB_IF(dev
);
770 int sz_sta_stats
= 0;
772 if (sset
== ETH_SS_STATS
) {
773 sz_sta_stats
= sizeof(ieee80211_gstrings_sta_stats
);
774 memcpy(data
, ieee80211_gstrings_sta_stats
, sz_sta_stats
);
776 drv_get_et_strings(sdata
, sset
, &(data
[sz_sta_stats
]));
779 static int ieee80211_dump_station(struct wiphy
*wiphy
, struct net_device
*dev
,
780 int idx
, u8
*mac
, struct station_info
*sinfo
)
782 struct ieee80211_sub_if_data
*sdata
= IEEE80211_DEV_TO_SUB_IF(dev
);
783 struct ieee80211_local
*local
= sdata
->local
;
784 struct sta_info
*sta
;
787 mutex_lock(&local
->sta_mtx
);
789 sta
= sta_info_get_by_idx(sdata
, idx
);
792 memcpy(mac
, sta
->sta
.addr
, ETH_ALEN
);
793 sta_set_sinfo(sta
, sinfo
);
796 mutex_unlock(&local
->sta_mtx
);
801 static int ieee80211_dump_survey(struct wiphy
*wiphy
, struct net_device
*dev
,
802 int idx
, struct survey_info
*survey
)
804 struct ieee80211_local
*local
= wdev_priv(dev
->ieee80211_ptr
);
806 return drv_get_survey(local
, idx
, survey
);
809 static int ieee80211_get_station(struct wiphy
*wiphy
, struct net_device
*dev
,
810 u8
*mac
, struct station_info
*sinfo
)
812 struct ieee80211_sub_if_data
*sdata
= IEEE80211_DEV_TO_SUB_IF(dev
);
813 struct ieee80211_local
*local
= sdata
->local
;
814 struct sta_info
*sta
;
817 mutex_lock(&local
->sta_mtx
);
819 sta
= sta_info_get_bss(sdata
, mac
);
822 sta_set_sinfo(sta
, sinfo
);
825 mutex_unlock(&local
->sta_mtx
);
830 static int ieee80211_set_monitor_channel(struct wiphy
*wiphy
,
831 struct cfg80211_chan_def
*chandef
)
833 struct ieee80211_local
*local
= wiphy_priv(wiphy
);
834 struct ieee80211_sub_if_data
*sdata
;
837 if (cfg80211_chandef_identical(&local
->monitor_chandef
, chandef
))
840 mutex_lock(&local
->mtx
);
841 mutex_lock(&local
->iflist_mtx
);
842 if (local
->use_chanctx
) {
843 sdata
= rcu_dereference_protected(
844 local
->monitor_sdata
,
845 lockdep_is_held(&local
->iflist_mtx
));
847 ieee80211_vif_release_channel(sdata
);
848 ret
= ieee80211_vif_use_channel(sdata
, chandef
,
849 IEEE80211_CHANCTX_EXCLUSIVE
);
851 } else if (local
->open_count
== local
->monitors
) {
852 local
->_oper_chandef
= *chandef
;
853 ieee80211_hw_config(local
, 0);
857 local
->monitor_chandef
= *chandef
;
858 mutex_unlock(&local
->iflist_mtx
);
859 mutex_unlock(&local
->mtx
);
864 static int ieee80211_set_probe_resp(struct ieee80211_sub_if_data
*sdata
,
865 const u8
*resp
, size_t resp_len
)
867 struct probe_resp
*new, *old
;
869 if (!resp
|| !resp_len
)
872 old
= sdata_dereference(sdata
->u
.ap
.probe_resp
, sdata
);
874 new = kzalloc(sizeof(struct probe_resp
) + resp_len
, GFP_KERNEL
);
879 memcpy(new->data
, resp
, resp_len
);
881 rcu_assign_pointer(sdata
->u
.ap
.probe_resp
, new);
883 kfree_rcu(old
, rcu_head
);
888 static int ieee80211_assign_beacon(struct ieee80211_sub_if_data
*sdata
,
889 struct cfg80211_beacon_data
*params
)
891 struct beacon_data
*new, *old
;
892 int new_head_len
, new_tail_len
;
894 u32 changed
= BSS_CHANGED_BEACON
;
896 old
= sdata_dereference(sdata
->u
.ap
.beacon
, sdata
);
899 /* Need to have a beacon head if we don't have one yet */
900 if (!params
->head
&& !old
)
903 /* new or old head? */
905 new_head_len
= params
->head_len
;
907 new_head_len
= old
->head_len
;
909 /* new or old tail? */
910 if (params
->tail
|| !old
)
911 /* params->tail_len will be zero for !params->tail */
912 new_tail_len
= params
->tail_len
;
914 new_tail_len
= old
->tail_len
;
916 size
= sizeof(*new) + new_head_len
+ new_tail_len
;
918 new = kzalloc(size
, GFP_KERNEL
);
922 /* start filling the new info now */
925 * pointers go into the block we allocated,
926 * memory is | beacon_data | head | tail |
928 new->head
= ((u8
*) new) + sizeof(*new);
929 new->tail
= new->head
+ new_head_len
;
930 new->head_len
= new_head_len
;
931 new->tail_len
= new_tail_len
;
935 memcpy(new->head
, params
->head
, new_head_len
);
937 memcpy(new->head
, old
->head
, new_head_len
);
939 /* copy in optional tail */
941 memcpy(new->tail
, params
->tail
, new_tail_len
);
944 memcpy(new->tail
, old
->tail
, new_tail_len
);
946 err
= ieee80211_set_probe_resp(sdata
, params
->probe_resp
,
947 params
->probe_resp_len
);
951 changed
|= BSS_CHANGED_AP_PROBE_RESP
;
953 rcu_assign_pointer(sdata
->u
.ap
.beacon
, new);
956 kfree_rcu(old
, rcu_head
);
961 static int ieee80211_start_ap(struct wiphy
*wiphy
, struct net_device
*dev
,
962 struct cfg80211_ap_settings
*params
)
964 struct ieee80211_sub_if_data
*sdata
= IEEE80211_DEV_TO_SUB_IF(dev
);
965 struct ieee80211_local
*local
= sdata
->local
;
966 struct beacon_data
*old
;
967 struct ieee80211_sub_if_data
*vlan
;
968 u32 changed
= BSS_CHANGED_BEACON_INT
|
969 BSS_CHANGED_BEACON_ENABLED
|
975 old
= sdata_dereference(sdata
->u
.ap
.beacon
, sdata
);
979 /* TODO: make hostapd tell us what it wants */
980 sdata
->smps_mode
= IEEE80211_SMPS_OFF
;
981 sdata
->needed_rx_chains
= sdata
->local
->rx_chains
;
983 mutex_lock(&local
->mtx
);
984 err
= ieee80211_vif_use_channel(sdata
, ¶ms
->chandef
,
985 IEEE80211_CHANCTX_SHARED
);
987 ieee80211_vif_copy_chanctx_to_vlans(sdata
, false);
988 mutex_unlock(&local
->mtx
);
993 * Apply control port protocol, this allows us to
994 * not encrypt dynamic WEP control frames.
996 sdata
->control_port_protocol
= params
->crypto
.control_port_ethertype
;
997 sdata
->control_port_no_encrypt
= params
->crypto
.control_port_no_encrypt
;
998 sdata
->encrypt_headroom
= ieee80211_cs_headroom(sdata
->local
,
1002 list_for_each_entry(vlan
, &sdata
->u
.ap
.vlans
, u
.vlan
.list
) {
1003 vlan
->control_port_protocol
=
1004 params
->crypto
.control_port_ethertype
;
1005 vlan
->control_port_no_encrypt
=
1006 params
->crypto
.control_port_no_encrypt
;
1007 vlan
->encrypt_headroom
=
1008 ieee80211_cs_headroom(sdata
->local
,
1013 sdata
->vif
.bss_conf
.beacon_int
= params
->beacon_interval
;
1014 sdata
->vif
.bss_conf
.dtim_period
= params
->dtim_period
;
1015 sdata
->vif
.bss_conf
.enable_beacon
= true;
1017 sdata
->vif
.bss_conf
.ssid_len
= params
->ssid_len
;
1018 if (params
->ssid_len
)
1019 memcpy(sdata
->vif
.bss_conf
.ssid
, params
->ssid
,
1021 sdata
->vif
.bss_conf
.hidden_ssid
=
1022 (params
->hidden_ssid
!= NL80211_HIDDEN_SSID_NOT_IN_USE
);
1024 memset(&sdata
->vif
.bss_conf
.p2p_noa_attr
, 0,
1025 sizeof(sdata
->vif
.bss_conf
.p2p_noa_attr
));
1026 sdata
->vif
.bss_conf
.p2p_noa_attr
.oppps_ctwindow
=
1027 params
->p2p_ctwindow
& IEEE80211_P2P_OPPPS_CTWINDOW_MASK
;
1028 if (params
->p2p_opp_ps
)
1029 sdata
->vif
.bss_conf
.p2p_noa_attr
.oppps_ctwindow
|=
1030 IEEE80211_P2P_OPPPS_ENABLE_BIT
;
1032 err
= ieee80211_assign_beacon(sdata
, ¶ms
->beacon
);
1034 ieee80211_vif_release_channel(sdata
);
1039 err
= drv_start_ap(sdata
->local
, sdata
);
1041 old
= sdata_dereference(sdata
->u
.ap
.beacon
, sdata
);
1044 kfree_rcu(old
, rcu_head
);
1045 RCU_INIT_POINTER(sdata
->u
.ap
.beacon
, NULL
);
1046 ieee80211_vif_release_channel(sdata
);
1050 ieee80211_recalc_dtim(local
, sdata
);
1051 ieee80211_bss_info_change_notify(sdata
, changed
);
1053 netif_carrier_on(dev
);
1054 list_for_each_entry(vlan
, &sdata
->u
.ap
.vlans
, u
.vlan
.list
)
1055 netif_carrier_on(vlan
->dev
);
1060 static int ieee80211_change_beacon(struct wiphy
*wiphy
, struct net_device
*dev
,
1061 struct cfg80211_beacon_data
*params
)
1063 struct ieee80211_sub_if_data
*sdata
;
1064 struct beacon_data
*old
;
1067 sdata
= IEEE80211_DEV_TO_SUB_IF(dev
);
1068 sdata_assert_lock(sdata
);
1070 /* don't allow changing the beacon while CSA is in place - offset
1071 * of channel switch counter may change
1073 if (sdata
->vif
.csa_active
)
1076 old
= sdata_dereference(sdata
->u
.ap
.beacon
, sdata
);
1080 err
= ieee80211_assign_beacon(sdata
, params
);
1083 ieee80211_bss_info_change_notify(sdata
, err
);
1087 static int ieee80211_stop_ap(struct wiphy
*wiphy
, struct net_device
*dev
)
1089 struct ieee80211_sub_if_data
*sdata
= IEEE80211_DEV_TO_SUB_IF(dev
);
1090 struct ieee80211_sub_if_data
*vlan
;
1091 struct ieee80211_local
*local
= sdata
->local
;
1092 struct beacon_data
*old_beacon
;
1093 struct probe_resp
*old_probe_resp
;
1094 struct cfg80211_chan_def chandef
;
1096 sdata_assert_lock(sdata
);
1098 old_beacon
= sdata_dereference(sdata
->u
.ap
.beacon
, sdata
);
1101 old_probe_resp
= sdata_dereference(sdata
->u
.ap
.probe_resp
, sdata
);
1103 /* abort any running channel switch */
1104 sdata
->vif
.csa_active
= false;
1105 kfree(sdata
->u
.ap
.next_beacon
);
1106 sdata
->u
.ap
.next_beacon
= NULL
;
1108 /* turn off carrier for this interface and dependent VLANs */
1109 list_for_each_entry(vlan
, &sdata
->u
.ap
.vlans
, u
.vlan
.list
)
1110 netif_carrier_off(vlan
->dev
);
1111 netif_carrier_off(dev
);
1113 /* remove beacon and probe response */
1114 RCU_INIT_POINTER(sdata
->u
.ap
.beacon
, NULL
);
1115 RCU_INIT_POINTER(sdata
->u
.ap
.probe_resp
, NULL
);
1116 kfree_rcu(old_beacon
, rcu_head
);
1118 kfree_rcu(old_probe_resp
, rcu_head
);
1119 sdata
->u
.ap
.driver_smps_mode
= IEEE80211_SMPS_OFF
;
1121 __sta_info_flush(sdata
, true);
1122 ieee80211_free_keys(sdata
, true);
1124 sdata
->vif
.bss_conf
.enable_beacon
= false;
1125 sdata
->vif
.bss_conf
.ssid_len
= 0;
1126 clear_bit(SDATA_STATE_OFFCHANNEL_BEACON_STOPPED
, &sdata
->state
);
1127 ieee80211_bss_info_change_notify(sdata
, BSS_CHANGED_BEACON_ENABLED
);
1129 if (sdata
->wdev
.cac_started
) {
1130 chandef
= sdata
->vif
.bss_conf
.chandef
;
1131 cancel_delayed_work_sync(&sdata
->dfs_cac_timer_work
);
1132 cfg80211_cac_event(sdata
->dev
, &chandef
,
1133 NL80211_RADAR_CAC_ABORTED
,
1137 drv_stop_ap(sdata
->local
, sdata
);
1139 /* free all potentially still buffered bcast frames */
1140 local
->total_ps_buffered
-= skb_queue_len(&sdata
->u
.ap
.ps
.bc_buf
);
1141 skb_queue_purge(&sdata
->u
.ap
.ps
.bc_buf
);
1143 mutex_lock(&local
->mtx
);
1144 ieee80211_vif_copy_chanctx_to_vlans(sdata
, true);
1145 ieee80211_vif_release_channel(sdata
);
1146 mutex_unlock(&local
->mtx
);
1151 /* Layer 2 Update frame (802.2 Type 1 LLC XID Update response) */
1152 struct iapp_layer2_update
{
1153 u8 da
[ETH_ALEN
]; /* broadcast */
1154 u8 sa
[ETH_ALEN
]; /* STA addr */
1162 static void ieee80211_send_layer2_update(struct sta_info
*sta
)
1164 struct iapp_layer2_update
*msg
;
1165 struct sk_buff
*skb
;
1167 /* Send Level 2 Update Frame to update forwarding tables in layer 2
1170 skb
= dev_alloc_skb(sizeof(*msg
));
1173 msg
= (struct iapp_layer2_update
*)skb_put(skb
, sizeof(*msg
));
1175 /* 802.2 Type 1 Logical Link Control (LLC) Exchange Identifier (XID)
1176 * Update response frame; IEEE Std 802.2-1998, 5.4.1.2.1 */
1178 eth_broadcast_addr(msg
->da
);
1179 memcpy(msg
->sa
, sta
->sta
.addr
, ETH_ALEN
);
1180 msg
->len
= htons(6);
1182 msg
->ssap
= 0x01; /* NULL LSAP, CR Bit: Response */
1183 msg
->control
= 0xaf; /* XID response lsb.1111F101.
1184 * F=0 (no poll command; unsolicited frame) */
1185 msg
->xid_info
[0] = 0x81; /* XID format identifier */
1186 msg
->xid_info
[1] = 1; /* LLC types/classes: Type 1 LLC */
1187 msg
->xid_info
[2] = 0; /* XID sender's receive window size (RW) */
1189 skb
->dev
= sta
->sdata
->dev
;
1190 skb
->protocol
= eth_type_trans(skb
, sta
->sdata
->dev
);
1191 memset(skb
->cb
, 0, sizeof(skb
->cb
));
1195 static int sta_apply_auth_flags(struct ieee80211_local
*local
,
1196 struct sta_info
*sta
,
1201 if (mask
& BIT(NL80211_STA_FLAG_AUTHENTICATED
) &&
1202 set
& BIT(NL80211_STA_FLAG_AUTHENTICATED
) &&
1203 !test_sta_flag(sta
, WLAN_STA_AUTH
)) {
1204 ret
= sta_info_move_state(sta
, IEEE80211_STA_AUTH
);
1209 if (mask
& BIT(NL80211_STA_FLAG_ASSOCIATED
) &&
1210 set
& BIT(NL80211_STA_FLAG_ASSOCIATED
) &&
1211 !test_sta_flag(sta
, WLAN_STA_ASSOC
)) {
1212 ret
= sta_info_move_state(sta
, IEEE80211_STA_ASSOC
);
1217 if (mask
& BIT(NL80211_STA_FLAG_AUTHORIZED
)) {
1218 if (set
& BIT(NL80211_STA_FLAG_AUTHORIZED
))
1219 ret
= sta_info_move_state(sta
, IEEE80211_STA_AUTHORIZED
);
1220 else if (test_sta_flag(sta
, WLAN_STA_AUTHORIZED
))
1221 ret
= sta_info_move_state(sta
, IEEE80211_STA_ASSOC
);
1228 if (mask
& BIT(NL80211_STA_FLAG_ASSOCIATED
) &&
1229 !(set
& BIT(NL80211_STA_FLAG_ASSOCIATED
)) &&
1230 test_sta_flag(sta
, WLAN_STA_ASSOC
)) {
1231 ret
= sta_info_move_state(sta
, IEEE80211_STA_AUTH
);
1236 if (mask
& BIT(NL80211_STA_FLAG_AUTHENTICATED
) &&
1237 !(set
& BIT(NL80211_STA_FLAG_AUTHENTICATED
)) &&
1238 test_sta_flag(sta
, WLAN_STA_AUTH
)) {
1239 ret
= sta_info_move_state(sta
, IEEE80211_STA_NONE
);
1247 static int sta_apply_parameters(struct ieee80211_local
*local
,
1248 struct sta_info
*sta
,
1249 struct station_parameters
*params
)
1252 struct ieee80211_supported_band
*sband
;
1253 struct ieee80211_sub_if_data
*sdata
= sta
->sdata
;
1254 enum ieee80211_band band
= ieee80211_get_sdata_band(sdata
);
1257 sband
= local
->hw
.wiphy
->bands
[band
];
1259 mask
= params
->sta_flags_mask
;
1260 set
= params
->sta_flags_set
;
1262 if (ieee80211_vif_is_mesh(&sdata
->vif
)) {
1264 * In mesh mode, ASSOCIATED isn't part of the nl80211
1265 * API but must follow AUTHENTICATED for driver state.
1267 if (mask
& BIT(NL80211_STA_FLAG_AUTHENTICATED
))
1268 mask
|= BIT(NL80211_STA_FLAG_ASSOCIATED
);
1269 if (set
& BIT(NL80211_STA_FLAG_AUTHENTICATED
))
1270 set
|= BIT(NL80211_STA_FLAG_ASSOCIATED
);
1271 } else if (test_sta_flag(sta
, WLAN_STA_TDLS_PEER
)) {
1273 * TDLS -- everything follows authorized, but
1274 * only becoming authorized is possible, not
1277 if (set
& BIT(NL80211_STA_FLAG_AUTHORIZED
)) {
1278 set
|= BIT(NL80211_STA_FLAG_AUTHENTICATED
) |
1279 BIT(NL80211_STA_FLAG_ASSOCIATED
);
1280 mask
|= BIT(NL80211_STA_FLAG_AUTHENTICATED
) |
1281 BIT(NL80211_STA_FLAG_ASSOCIATED
);
1285 ret
= sta_apply_auth_flags(local
, sta
, mask
, set
);
1289 if (mask
& BIT(NL80211_STA_FLAG_SHORT_PREAMBLE
)) {
1290 if (set
& BIT(NL80211_STA_FLAG_SHORT_PREAMBLE
))
1291 set_sta_flag(sta
, WLAN_STA_SHORT_PREAMBLE
);
1293 clear_sta_flag(sta
, WLAN_STA_SHORT_PREAMBLE
);
1296 if (mask
& BIT(NL80211_STA_FLAG_WME
)) {
1297 if (set
& BIT(NL80211_STA_FLAG_WME
)) {
1298 set_sta_flag(sta
, WLAN_STA_WME
);
1299 sta
->sta
.wme
= true;
1301 clear_sta_flag(sta
, WLAN_STA_WME
);
1302 sta
->sta
.wme
= false;
1306 if (mask
& BIT(NL80211_STA_FLAG_MFP
)) {
1307 if (set
& BIT(NL80211_STA_FLAG_MFP
))
1308 set_sta_flag(sta
, WLAN_STA_MFP
);
1310 clear_sta_flag(sta
, WLAN_STA_MFP
);
1313 if (mask
& BIT(NL80211_STA_FLAG_TDLS_PEER
)) {
1314 if (set
& BIT(NL80211_STA_FLAG_TDLS_PEER
))
1315 set_sta_flag(sta
, WLAN_STA_TDLS_PEER
);
1317 clear_sta_flag(sta
, WLAN_STA_TDLS_PEER
);
1320 if (params
->sta_modify_mask
& STATION_PARAM_APPLY_UAPSD
) {
1321 sta
->sta
.uapsd_queues
= params
->uapsd_queues
;
1322 sta
->sta
.max_sp
= params
->max_sp
;
1326 * cfg80211 validates this (1-2007) and allows setting the AID
1327 * only when creating a new station entry
1330 sta
->sta
.aid
= params
->aid
;
1333 * Some of the following updates would be racy if called on an
1334 * existing station, via ieee80211_change_station(). However,
1335 * all such changes are rejected by cfg80211 except for updates
1336 * changing the supported rates on an existing but not yet used
1340 if (params
->listen_interval
>= 0)
1341 sta
->listen_interval
= params
->listen_interval
;
1343 if (params
->supported_rates
) {
1344 ieee80211_parse_bitrates(&sdata
->vif
.bss_conf
.chandef
,
1345 sband
, params
->supported_rates
,
1346 params
->supported_rates_len
,
1347 &sta
->sta
.supp_rates
[band
]);
1350 if (params
->ht_capa
)
1351 ieee80211_ht_cap_ie_to_sta_ht_cap(sdata
, sband
,
1352 params
->ht_capa
, sta
);
1354 if (params
->vht_capa
)
1355 ieee80211_vht_cap_ie_to_sta_vht_cap(sdata
, sband
,
1356 params
->vht_capa
, sta
);
1358 if (params
->opmode_notif_used
) {
1359 /* returned value is only needed for rc update, but the
1360 * rc isn't initialized here yet, so ignore it
1362 __ieee80211_vht_handle_opmode(sdata
, sta
,
1363 params
->opmode_notif
,
1367 if (ieee80211_vif_is_mesh(&sdata
->vif
)) {
1368 #ifdef CONFIG_MAC80211_MESH
1371 if (params
->sta_modify_mask
& STATION_PARAM_APPLY_PLINK_STATE
) {
1372 switch (params
->plink_state
) {
1373 case NL80211_PLINK_ESTAB
:
1374 if (sta
->plink_state
!= NL80211_PLINK_ESTAB
)
1375 changed
= mesh_plink_inc_estab_count(
1377 sta
->plink_state
= params
->plink_state
;
1379 ieee80211_mps_sta_status_update(sta
);
1380 changed
|= ieee80211_mps_set_sta_local_pm(sta
,
1381 sdata
->u
.mesh
.mshcfg
.power_mode
);
1383 case NL80211_PLINK_LISTEN
:
1384 case NL80211_PLINK_BLOCKED
:
1385 case NL80211_PLINK_OPN_SNT
:
1386 case NL80211_PLINK_OPN_RCVD
:
1387 case NL80211_PLINK_CNF_RCVD
:
1388 case NL80211_PLINK_HOLDING
:
1389 if (sta
->plink_state
== NL80211_PLINK_ESTAB
)
1390 changed
= mesh_plink_dec_estab_count(
1392 sta
->plink_state
= params
->plink_state
;
1394 ieee80211_mps_sta_status_update(sta
);
1395 changed
|= ieee80211_mps_set_sta_local_pm(sta
,
1396 NL80211_MESH_POWER_UNKNOWN
);
1404 switch (params
->plink_action
) {
1405 case NL80211_PLINK_ACTION_NO_ACTION
:
1408 case NL80211_PLINK_ACTION_OPEN
:
1409 changed
|= mesh_plink_open(sta
);
1411 case NL80211_PLINK_ACTION_BLOCK
:
1412 changed
|= mesh_plink_block(sta
);
1416 if (params
->local_pm
)
1418 ieee80211_mps_set_sta_local_pm(sta
,
1420 ieee80211_mbss_info_change_notify(sdata
, changed
);
1427 static int ieee80211_add_station(struct wiphy
*wiphy
, struct net_device
*dev
,
1428 u8
*mac
, struct station_parameters
*params
)
1430 struct ieee80211_local
*local
= wiphy_priv(wiphy
);
1431 struct sta_info
*sta
;
1432 struct ieee80211_sub_if_data
*sdata
;
1437 sdata
= IEEE80211_DEV_TO_SUB_IF(params
->vlan
);
1439 if (sdata
->vif
.type
!= NL80211_IFTYPE_AP_VLAN
&&
1440 sdata
->vif
.type
!= NL80211_IFTYPE_AP
)
1443 sdata
= IEEE80211_DEV_TO_SUB_IF(dev
);
1445 if (ether_addr_equal(mac
, sdata
->vif
.addr
))
1448 if (is_multicast_ether_addr(mac
))
1451 sta
= sta_info_alloc(sdata
, mac
, GFP_KERNEL
);
1456 * defaults -- if userspace wants something else we'll
1457 * change it accordingly in sta_apply_parameters()
1459 if (!(params
->sta_flags_set
& BIT(NL80211_STA_FLAG_TDLS_PEER
))) {
1460 sta_info_pre_move_state(sta
, IEEE80211_STA_AUTH
);
1461 sta_info_pre_move_state(sta
, IEEE80211_STA_ASSOC
);
1464 err
= sta_apply_parameters(local
, sta
, params
);
1466 sta_info_free(local
, sta
);
1471 * for TDLS, rate control should be initialized only when
1472 * rates are known and station is marked authorized
1474 if (!test_sta_flag(sta
, WLAN_STA_TDLS_PEER
))
1475 rate_control_rate_init(sta
);
1477 layer2_update
= sdata
->vif
.type
== NL80211_IFTYPE_AP_VLAN
||
1478 sdata
->vif
.type
== NL80211_IFTYPE_AP
;
1480 err
= sta_info_insert_rcu(sta
);
1487 ieee80211_send_layer2_update(sta
);
1494 static int ieee80211_del_station(struct wiphy
*wiphy
, struct net_device
*dev
,
1497 struct ieee80211_sub_if_data
*sdata
;
1499 sdata
= IEEE80211_DEV_TO_SUB_IF(dev
);
1502 return sta_info_destroy_addr_bss(sdata
, mac
);
1504 sta_info_flush(sdata
);
1508 static int ieee80211_change_station(struct wiphy
*wiphy
,
1509 struct net_device
*dev
, u8
*mac
,
1510 struct station_parameters
*params
)
1512 struct ieee80211_sub_if_data
*sdata
= IEEE80211_DEV_TO_SUB_IF(dev
);
1513 struct ieee80211_local
*local
= wiphy_priv(wiphy
);
1514 struct sta_info
*sta
;
1515 struct ieee80211_sub_if_data
*vlansdata
;
1516 enum cfg80211_station_type statype
;
1519 mutex_lock(&local
->sta_mtx
);
1521 sta
= sta_info_get_bss(sdata
, mac
);
1527 switch (sdata
->vif
.type
) {
1528 case NL80211_IFTYPE_MESH_POINT
:
1529 if (sdata
->u
.mesh
.user_mpm
)
1530 statype
= CFG80211_STA_MESH_PEER_USER
;
1532 statype
= CFG80211_STA_MESH_PEER_KERNEL
;
1534 case NL80211_IFTYPE_ADHOC
:
1535 statype
= CFG80211_STA_IBSS
;
1537 case NL80211_IFTYPE_STATION
:
1538 if (!test_sta_flag(sta
, WLAN_STA_TDLS_PEER
)) {
1539 statype
= CFG80211_STA_AP_STA
;
1542 if (test_sta_flag(sta
, WLAN_STA_AUTHORIZED
))
1543 statype
= CFG80211_STA_TDLS_PEER_ACTIVE
;
1545 statype
= CFG80211_STA_TDLS_PEER_SETUP
;
1547 case NL80211_IFTYPE_AP
:
1548 case NL80211_IFTYPE_AP_VLAN
:
1549 statype
= CFG80211_STA_AP_CLIENT
;
1556 err
= cfg80211_check_station_change(wiphy
, params
, statype
);
1560 if (params
->vlan
&& params
->vlan
!= sta
->sdata
->dev
) {
1561 bool prev_4addr
= false;
1562 bool new_4addr
= false;
1564 vlansdata
= IEEE80211_DEV_TO_SUB_IF(params
->vlan
);
1566 if (params
->vlan
->ieee80211_ptr
->use_4addr
) {
1567 if (vlansdata
->u
.vlan
.sta
) {
1572 rcu_assign_pointer(vlansdata
->u
.vlan
.sta
, sta
);
1576 if (sta
->sdata
->vif
.type
== NL80211_IFTYPE_AP_VLAN
&&
1577 sta
->sdata
->u
.vlan
.sta
) {
1578 RCU_INIT_POINTER(sta
->sdata
->u
.vlan
.sta
, NULL
);
1582 sta
->sdata
= vlansdata
;
1584 if (sta
->sta_state
== IEEE80211_STA_AUTHORIZED
&&
1585 prev_4addr
!= new_4addr
) {
1587 atomic_dec(&sta
->sdata
->bss
->num_mcast_sta
);
1589 atomic_inc(&sta
->sdata
->bss
->num_mcast_sta
);
1592 ieee80211_send_layer2_update(sta
);
1595 err
= sta_apply_parameters(local
, sta
, params
);
1599 /* When peer becomes authorized, init rate control as well */
1600 if (test_sta_flag(sta
, WLAN_STA_TDLS_PEER
) &&
1601 test_sta_flag(sta
, WLAN_STA_AUTHORIZED
))
1602 rate_control_rate_init(sta
);
1604 mutex_unlock(&local
->sta_mtx
);
1606 if ((sdata
->vif
.type
== NL80211_IFTYPE_AP
||
1607 sdata
->vif
.type
== NL80211_IFTYPE_AP_VLAN
) &&
1608 sta
->known_smps_mode
!= sta
->sdata
->bss
->req_smps
&&
1609 test_sta_flag(sta
, WLAN_STA_AUTHORIZED
) &&
1610 sta_info_tx_streams(sta
) != 1) {
1612 "%pM just authorized and MIMO capable - update SMPS\n",
1614 ieee80211_send_smps_action(sta
->sdata
,
1615 sta
->sdata
->bss
->req_smps
,
1617 sta
->sdata
->vif
.bss_conf
.bssid
);
1620 if (sdata
->vif
.type
== NL80211_IFTYPE_STATION
&&
1621 params
->sta_flags_mask
& BIT(NL80211_STA_FLAG_AUTHORIZED
)) {
1622 ieee80211_recalc_ps(local
, -1);
1623 ieee80211_recalc_ps_vif(sdata
);
1628 mutex_unlock(&local
->sta_mtx
);
1632 #ifdef CONFIG_MAC80211_MESH
1633 static int ieee80211_add_mpath(struct wiphy
*wiphy
, struct net_device
*dev
,
1634 u8
*dst
, u8
*next_hop
)
1636 struct ieee80211_sub_if_data
*sdata
;
1637 struct mesh_path
*mpath
;
1638 struct sta_info
*sta
;
1640 sdata
= IEEE80211_DEV_TO_SUB_IF(dev
);
1643 sta
= sta_info_get(sdata
, next_hop
);
1649 mpath
= mesh_path_add(sdata
, dst
);
1650 if (IS_ERR(mpath
)) {
1652 return PTR_ERR(mpath
);
1655 mesh_path_fix_nexthop(mpath
, sta
);
1661 static int ieee80211_del_mpath(struct wiphy
*wiphy
, struct net_device
*dev
,
1664 struct ieee80211_sub_if_data
*sdata
= IEEE80211_DEV_TO_SUB_IF(dev
);
1667 return mesh_path_del(sdata
, dst
);
1669 mesh_path_flush_by_iface(sdata
);
1673 static int ieee80211_change_mpath(struct wiphy
*wiphy
,
1674 struct net_device
*dev
,
1675 u8
*dst
, u8
*next_hop
)
1677 struct ieee80211_sub_if_data
*sdata
;
1678 struct mesh_path
*mpath
;
1679 struct sta_info
*sta
;
1681 sdata
= IEEE80211_DEV_TO_SUB_IF(dev
);
1685 sta
= sta_info_get(sdata
, next_hop
);
1691 mpath
= mesh_path_lookup(sdata
, dst
);
1697 mesh_path_fix_nexthop(mpath
, sta
);
1703 static void mpath_set_pinfo(struct mesh_path
*mpath
, u8
*next_hop
,
1704 struct mpath_info
*pinfo
)
1706 struct sta_info
*next_hop_sta
= rcu_dereference(mpath
->next_hop
);
1709 memcpy(next_hop
, next_hop_sta
->sta
.addr
, ETH_ALEN
);
1711 memset(next_hop
, 0, ETH_ALEN
);
1713 memset(pinfo
, 0, sizeof(*pinfo
));
1715 pinfo
->generation
= mesh_paths_generation
;
1717 pinfo
->filled
= MPATH_INFO_FRAME_QLEN
|
1720 MPATH_INFO_EXPTIME
|
1721 MPATH_INFO_DISCOVERY_TIMEOUT
|
1722 MPATH_INFO_DISCOVERY_RETRIES
|
1725 pinfo
->frame_qlen
= mpath
->frame_queue
.qlen
;
1726 pinfo
->sn
= mpath
->sn
;
1727 pinfo
->metric
= mpath
->metric
;
1728 if (time_before(jiffies
, mpath
->exp_time
))
1729 pinfo
->exptime
= jiffies_to_msecs(mpath
->exp_time
- jiffies
);
1730 pinfo
->discovery_timeout
=
1731 jiffies_to_msecs(mpath
->discovery_timeout
);
1732 pinfo
->discovery_retries
= mpath
->discovery_retries
;
1733 if (mpath
->flags
& MESH_PATH_ACTIVE
)
1734 pinfo
->flags
|= NL80211_MPATH_FLAG_ACTIVE
;
1735 if (mpath
->flags
& MESH_PATH_RESOLVING
)
1736 pinfo
->flags
|= NL80211_MPATH_FLAG_RESOLVING
;
1737 if (mpath
->flags
& MESH_PATH_SN_VALID
)
1738 pinfo
->flags
|= NL80211_MPATH_FLAG_SN_VALID
;
1739 if (mpath
->flags
& MESH_PATH_FIXED
)
1740 pinfo
->flags
|= NL80211_MPATH_FLAG_FIXED
;
1741 if (mpath
->flags
& MESH_PATH_RESOLVED
)
1742 pinfo
->flags
|= NL80211_MPATH_FLAG_RESOLVED
;
1745 static int ieee80211_get_mpath(struct wiphy
*wiphy
, struct net_device
*dev
,
1746 u8
*dst
, u8
*next_hop
, struct mpath_info
*pinfo
)
1749 struct ieee80211_sub_if_data
*sdata
;
1750 struct mesh_path
*mpath
;
1752 sdata
= IEEE80211_DEV_TO_SUB_IF(dev
);
1755 mpath
= mesh_path_lookup(sdata
, dst
);
1760 memcpy(dst
, mpath
->dst
, ETH_ALEN
);
1761 mpath_set_pinfo(mpath
, next_hop
, pinfo
);
1766 static int ieee80211_dump_mpath(struct wiphy
*wiphy
, struct net_device
*dev
,
1767 int idx
, u8
*dst
, u8
*next_hop
,
1768 struct mpath_info
*pinfo
)
1770 struct ieee80211_sub_if_data
*sdata
;
1771 struct mesh_path
*mpath
;
1773 sdata
= IEEE80211_DEV_TO_SUB_IF(dev
);
1776 mpath
= mesh_path_lookup_by_idx(sdata
, idx
);
1781 memcpy(dst
, mpath
->dst
, ETH_ALEN
);
1782 mpath_set_pinfo(mpath
, next_hop
, pinfo
);
1787 static int ieee80211_get_mesh_config(struct wiphy
*wiphy
,
1788 struct net_device
*dev
,
1789 struct mesh_config
*conf
)
1791 struct ieee80211_sub_if_data
*sdata
;
1792 sdata
= IEEE80211_DEV_TO_SUB_IF(dev
);
1794 memcpy(conf
, &(sdata
->u
.mesh
.mshcfg
), sizeof(struct mesh_config
));
1798 static inline bool _chg_mesh_attr(enum nl80211_meshconf_params parm
, u32 mask
)
1800 return (mask
>> (parm
-1)) & 0x1;
1803 static int copy_mesh_setup(struct ieee80211_if_mesh
*ifmsh
,
1804 const struct mesh_setup
*setup
)
1808 struct ieee80211_sub_if_data
*sdata
= container_of(ifmsh
,
1809 struct ieee80211_sub_if_data
, u
.mesh
);
1811 /* allocate information elements */
1815 if (setup
->ie_len
) {
1816 new_ie
= kmemdup(setup
->ie
, setup
->ie_len
,
1821 ifmsh
->ie_len
= setup
->ie_len
;
1825 /* now copy the rest of the setup parameters */
1826 ifmsh
->mesh_id_len
= setup
->mesh_id_len
;
1827 memcpy(ifmsh
->mesh_id
, setup
->mesh_id
, ifmsh
->mesh_id_len
);
1828 ifmsh
->mesh_sp_id
= setup
->sync_method
;
1829 ifmsh
->mesh_pp_id
= setup
->path_sel_proto
;
1830 ifmsh
->mesh_pm_id
= setup
->path_metric
;
1831 ifmsh
->user_mpm
= setup
->user_mpm
;
1832 ifmsh
->mesh_auth_id
= setup
->auth_id
;
1833 ifmsh
->security
= IEEE80211_MESH_SEC_NONE
;
1834 if (setup
->is_authenticated
)
1835 ifmsh
->security
|= IEEE80211_MESH_SEC_AUTHED
;
1836 if (setup
->is_secure
)
1837 ifmsh
->security
|= IEEE80211_MESH_SEC_SECURED
;
1839 /* mcast rate setting in Mesh Node */
1840 memcpy(sdata
->vif
.bss_conf
.mcast_rate
, setup
->mcast_rate
,
1841 sizeof(setup
->mcast_rate
));
1842 sdata
->vif
.bss_conf
.basic_rates
= setup
->basic_rates
;
1844 sdata
->vif
.bss_conf
.beacon_int
= setup
->beacon_interval
;
1845 sdata
->vif
.bss_conf
.dtim_period
= setup
->dtim_period
;
1850 static int ieee80211_update_mesh_config(struct wiphy
*wiphy
,
1851 struct net_device
*dev
, u32 mask
,
1852 const struct mesh_config
*nconf
)
1854 struct mesh_config
*conf
;
1855 struct ieee80211_sub_if_data
*sdata
;
1856 struct ieee80211_if_mesh
*ifmsh
;
1858 sdata
= IEEE80211_DEV_TO_SUB_IF(dev
);
1859 ifmsh
= &sdata
->u
.mesh
;
1861 /* Set the config options which we are interested in setting */
1862 conf
= &(sdata
->u
.mesh
.mshcfg
);
1863 if (_chg_mesh_attr(NL80211_MESHCONF_RETRY_TIMEOUT
, mask
))
1864 conf
->dot11MeshRetryTimeout
= nconf
->dot11MeshRetryTimeout
;
1865 if (_chg_mesh_attr(NL80211_MESHCONF_CONFIRM_TIMEOUT
, mask
))
1866 conf
->dot11MeshConfirmTimeout
= nconf
->dot11MeshConfirmTimeout
;
1867 if (_chg_mesh_attr(NL80211_MESHCONF_HOLDING_TIMEOUT
, mask
))
1868 conf
->dot11MeshHoldingTimeout
= nconf
->dot11MeshHoldingTimeout
;
1869 if (_chg_mesh_attr(NL80211_MESHCONF_MAX_PEER_LINKS
, mask
))
1870 conf
->dot11MeshMaxPeerLinks
= nconf
->dot11MeshMaxPeerLinks
;
1871 if (_chg_mesh_attr(NL80211_MESHCONF_MAX_RETRIES
, mask
))
1872 conf
->dot11MeshMaxRetries
= nconf
->dot11MeshMaxRetries
;
1873 if (_chg_mesh_attr(NL80211_MESHCONF_TTL
, mask
))
1874 conf
->dot11MeshTTL
= nconf
->dot11MeshTTL
;
1875 if (_chg_mesh_attr(NL80211_MESHCONF_ELEMENT_TTL
, mask
))
1876 conf
->element_ttl
= nconf
->element_ttl
;
1877 if (_chg_mesh_attr(NL80211_MESHCONF_AUTO_OPEN_PLINKS
, mask
)) {
1878 if (ifmsh
->user_mpm
)
1880 conf
->auto_open_plinks
= nconf
->auto_open_plinks
;
1882 if (_chg_mesh_attr(NL80211_MESHCONF_SYNC_OFFSET_MAX_NEIGHBOR
, mask
))
1883 conf
->dot11MeshNbrOffsetMaxNeighbor
=
1884 nconf
->dot11MeshNbrOffsetMaxNeighbor
;
1885 if (_chg_mesh_attr(NL80211_MESHCONF_HWMP_MAX_PREQ_RETRIES
, mask
))
1886 conf
->dot11MeshHWMPmaxPREQretries
=
1887 nconf
->dot11MeshHWMPmaxPREQretries
;
1888 if (_chg_mesh_attr(NL80211_MESHCONF_PATH_REFRESH_TIME
, mask
))
1889 conf
->path_refresh_time
= nconf
->path_refresh_time
;
1890 if (_chg_mesh_attr(NL80211_MESHCONF_MIN_DISCOVERY_TIMEOUT
, mask
))
1891 conf
->min_discovery_timeout
= nconf
->min_discovery_timeout
;
1892 if (_chg_mesh_attr(NL80211_MESHCONF_HWMP_ACTIVE_PATH_TIMEOUT
, mask
))
1893 conf
->dot11MeshHWMPactivePathTimeout
=
1894 nconf
->dot11MeshHWMPactivePathTimeout
;
1895 if (_chg_mesh_attr(NL80211_MESHCONF_HWMP_PREQ_MIN_INTERVAL
, mask
))
1896 conf
->dot11MeshHWMPpreqMinInterval
=
1897 nconf
->dot11MeshHWMPpreqMinInterval
;
1898 if (_chg_mesh_attr(NL80211_MESHCONF_HWMP_PERR_MIN_INTERVAL
, mask
))
1899 conf
->dot11MeshHWMPperrMinInterval
=
1900 nconf
->dot11MeshHWMPperrMinInterval
;
1901 if (_chg_mesh_attr(NL80211_MESHCONF_HWMP_NET_DIAM_TRVS_TIME
,
1903 conf
->dot11MeshHWMPnetDiameterTraversalTime
=
1904 nconf
->dot11MeshHWMPnetDiameterTraversalTime
;
1905 if (_chg_mesh_attr(NL80211_MESHCONF_HWMP_ROOTMODE
, mask
)) {
1906 conf
->dot11MeshHWMPRootMode
= nconf
->dot11MeshHWMPRootMode
;
1907 ieee80211_mesh_root_setup(ifmsh
);
1909 if (_chg_mesh_attr(NL80211_MESHCONF_GATE_ANNOUNCEMENTS
, mask
)) {
1910 /* our current gate announcement implementation rides on root
1911 * announcements, so require this ifmsh to also be a root node
1913 if (nconf
->dot11MeshGateAnnouncementProtocol
&&
1914 !(conf
->dot11MeshHWMPRootMode
> IEEE80211_ROOTMODE_ROOT
)) {
1915 conf
->dot11MeshHWMPRootMode
= IEEE80211_PROACTIVE_RANN
;
1916 ieee80211_mesh_root_setup(ifmsh
);
1918 conf
->dot11MeshGateAnnouncementProtocol
=
1919 nconf
->dot11MeshGateAnnouncementProtocol
;
1921 if (_chg_mesh_attr(NL80211_MESHCONF_HWMP_RANN_INTERVAL
, mask
))
1922 conf
->dot11MeshHWMPRannInterval
=
1923 nconf
->dot11MeshHWMPRannInterval
;
1924 if (_chg_mesh_attr(NL80211_MESHCONF_FORWARDING
, mask
))
1925 conf
->dot11MeshForwarding
= nconf
->dot11MeshForwarding
;
1926 if (_chg_mesh_attr(NL80211_MESHCONF_RSSI_THRESHOLD
, mask
)) {
1927 /* our RSSI threshold implementation is supported only for
1928 * devices that report signal in dBm.
1930 if (!(sdata
->local
->hw
.flags
& IEEE80211_HW_SIGNAL_DBM
))
1932 conf
->rssi_threshold
= nconf
->rssi_threshold
;
1934 if (_chg_mesh_attr(NL80211_MESHCONF_HT_OPMODE
, mask
)) {
1935 conf
->ht_opmode
= nconf
->ht_opmode
;
1936 sdata
->vif
.bss_conf
.ht_operation_mode
= nconf
->ht_opmode
;
1937 ieee80211_bss_info_change_notify(sdata
, BSS_CHANGED_HT
);
1939 if (_chg_mesh_attr(NL80211_MESHCONF_HWMP_PATH_TO_ROOT_TIMEOUT
, mask
))
1940 conf
->dot11MeshHWMPactivePathToRootTimeout
=
1941 nconf
->dot11MeshHWMPactivePathToRootTimeout
;
1942 if (_chg_mesh_attr(NL80211_MESHCONF_HWMP_ROOT_INTERVAL
, mask
))
1943 conf
->dot11MeshHWMProotInterval
=
1944 nconf
->dot11MeshHWMProotInterval
;
1945 if (_chg_mesh_attr(NL80211_MESHCONF_HWMP_CONFIRMATION_INTERVAL
, mask
))
1946 conf
->dot11MeshHWMPconfirmationInterval
=
1947 nconf
->dot11MeshHWMPconfirmationInterval
;
1948 if (_chg_mesh_attr(NL80211_MESHCONF_POWER_MODE
, mask
)) {
1949 conf
->power_mode
= nconf
->power_mode
;
1950 ieee80211_mps_local_status_update(sdata
);
1952 if (_chg_mesh_attr(NL80211_MESHCONF_AWAKE_WINDOW
, mask
))
1953 conf
->dot11MeshAwakeWindowDuration
=
1954 nconf
->dot11MeshAwakeWindowDuration
;
1955 if (_chg_mesh_attr(NL80211_MESHCONF_PLINK_TIMEOUT
, mask
))
1956 conf
->plink_timeout
= nconf
->plink_timeout
;
1957 ieee80211_mbss_info_change_notify(sdata
, BSS_CHANGED_BEACON
);
1961 static int ieee80211_join_mesh(struct wiphy
*wiphy
, struct net_device
*dev
,
1962 const struct mesh_config
*conf
,
1963 const struct mesh_setup
*setup
)
1965 struct ieee80211_sub_if_data
*sdata
= IEEE80211_DEV_TO_SUB_IF(dev
);
1966 struct ieee80211_if_mesh
*ifmsh
= &sdata
->u
.mesh
;
1969 memcpy(&ifmsh
->mshcfg
, conf
, sizeof(struct mesh_config
));
1970 err
= copy_mesh_setup(ifmsh
, setup
);
1974 /* can mesh use other SMPS modes? */
1975 sdata
->smps_mode
= IEEE80211_SMPS_OFF
;
1976 sdata
->needed_rx_chains
= sdata
->local
->rx_chains
;
1978 mutex_lock(&sdata
->local
->mtx
);
1979 err
= ieee80211_vif_use_channel(sdata
, &setup
->chandef
,
1980 IEEE80211_CHANCTX_SHARED
);
1981 mutex_unlock(&sdata
->local
->mtx
);
1985 return ieee80211_start_mesh(sdata
);
1988 static int ieee80211_leave_mesh(struct wiphy
*wiphy
, struct net_device
*dev
)
1990 struct ieee80211_sub_if_data
*sdata
= IEEE80211_DEV_TO_SUB_IF(dev
);
1992 ieee80211_stop_mesh(sdata
);
1993 mutex_lock(&sdata
->local
->mtx
);
1994 ieee80211_vif_release_channel(sdata
);
1995 mutex_unlock(&sdata
->local
->mtx
);
2001 static int ieee80211_change_bss(struct wiphy
*wiphy
,
2002 struct net_device
*dev
,
2003 struct bss_parameters
*params
)
2005 struct ieee80211_sub_if_data
*sdata
= IEEE80211_DEV_TO_SUB_IF(dev
);
2006 enum ieee80211_band band
;
2009 if (!sdata_dereference(sdata
->u
.ap
.beacon
, sdata
))
2012 band
= ieee80211_get_sdata_band(sdata
);
2014 if (params
->use_cts_prot
>= 0) {
2015 sdata
->vif
.bss_conf
.use_cts_prot
= params
->use_cts_prot
;
2016 changed
|= BSS_CHANGED_ERP_CTS_PROT
;
2018 if (params
->use_short_preamble
>= 0) {
2019 sdata
->vif
.bss_conf
.use_short_preamble
=
2020 params
->use_short_preamble
;
2021 changed
|= BSS_CHANGED_ERP_PREAMBLE
;
2024 if (!sdata
->vif
.bss_conf
.use_short_slot
&&
2025 band
== IEEE80211_BAND_5GHZ
) {
2026 sdata
->vif
.bss_conf
.use_short_slot
= true;
2027 changed
|= BSS_CHANGED_ERP_SLOT
;
2030 if (params
->use_short_slot_time
>= 0) {
2031 sdata
->vif
.bss_conf
.use_short_slot
=
2032 params
->use_short_slot_time
;
2033 changed
|= BSS_CHANGED_ERP_SLOT
;
2036 if (params
->basic_rates
) {
2037 ieee80211_parse_bitrates(&sdata
->vif
.bss_conf
.chandef
,
2039 params
->basic_rates
,
2040 params
->basic_rates_len
,
2041 &sdata
->vif
.bss_conf
.basic_rates
);
2042 changed
|= BSS_CHANGED_BASIC_RATES
;
2045 if (params
->ap_isolate
>= 0) {
2046 if (params
->ap_isolate
)
2047 sdata
->flags
|= IEEE80211_SDATA_DONT_BRIDGE_PACKETS
;
2049 sdata
->flags
&= ~IEEE80211_SDATA_DONT_BRIDGE_PACKETS
;
2052 if (params
->ht_opmode
>= 0) {
2053 sdata
->vif
.bss_conf
.ht_operation_mode
=
2054 (u16
) params
->ht_opmode
;
2055 changed
|= BSS_CHANGED_HT
;
2058 if (params
->p2p_ctwindow
>= 0) {
2059 sdata
->vif
.bss_conf
.p2p_noa_attr
.oppps_ctwindow
&=
2060 ~IEEE80211_P2P_OPPPS_CTWINDOW_MASK
;
2061 sdata
->vif
.bss_conf
.p2p_noa_attr
.oppps_ctwindow
|=
2062 params
->p2p_ctwindow
& IEEE80211_P2P_OPPPS_CTWINDOW_MASK
;
2063 changed
|= BSS_CHANGED_P2P_PS
;
2066 if (params
->p2p_opp_ps
> 0) {
2067 sdata
->vif
.bss_conf
.p2p_noa_attr
.oppps_ctwindow
|=
2068 IEEE80211_P2P_OPPPS_ENABLE_BIT
;
2069 changed
|= BSS_CHANGED_P2P_PS
;
2070 } else if (params
->p2p_opp_ps
== 0) {
2071 sdata
->vif
.bss_conf
.p2p_noa_attr
.oppps_ctwindow
&=
2072 ~IEEE80211_P2P_OPPPS_ENABLE_BIT
;
2073 changed
|= BSS_CHANGED_P2P_PS
;
2076 ieee80211_bss_info_change_notify(sdata
, changed
);
2081 static int ieee80211_set_txq_params(struct wiphy
*wiphy
,
2082 struct net_device
*dev
,
2083 struct ieee80211_txq_params
*params
)
2085 struct ieee80211_local
*local
= wiphy_priv(wiphy
);
2086 struct ieee80211_sub_if_data
*sdata
= IEEE80211_DEV_TO_SUB_IF(dev
);
2087 struct ieee80211_tx_queue_params p
;
2089 if (!local
->ops
->conf_tx
)
2092 if (local
->hw
.queues
< IEEE80211_NUM_ACS
)
2095 memset(&p
, 0, sizeof(p
));
2096 p
.aifs
= params
->aifs
;
2097 p
.cw_max
= params
->cwmax
;
2098 p
.cw_min
= params
->cwmin
;
2099 p
.txop
= params
->txop
;
2102 * Setting tx queue params disables u-apsd because it's only
2103 * called in master mode.
2107 sdata
->tx_conf
[params
->ac
] = p
;
2108 if (drv_conf_tx(local
, sdata
, params
->ac
, &p
)) {
2109 wiphy_debug(local
->hw
.wiphy
,
2110 "failed to set TX queue parameters for AC %d\n",
2115 ieee80211_bss_info_change_notify(sdata
, BSS_CHANGED_QOS
);
2121 static int ieee80211_suspend(struct wiphy
*wiphy
,
2122 struct cfg80211_wowlan
*wowlan
)
2124 return __ieee80211_suspend(wiphy_priv(wiphy
), wowlan
);
2127 static int ieee80211_resume(struct wiphy
*wiphy
)
2129 return __ieee80211_resume(wiphy_priv(wiphy
));
2132 #define ieee80211_suspend NULL
2133 #define ieee80211_resume NULL
2136 static int ieee80211_scan(struct wiphy
*wiphy
,
2137 struct cfg80211_scan_request
*req
)
2139 struct ieee80211_sub_if_data
*sdata
;
2141 sdata
= IEEE80211_WDEV_TO_SUB_IF(req
->wdev
);
2143 switch (ieee80211_vif_type_p2p(&sdata
->vif
)) {
2144 case NL80211_IFTYPE_STATION
:
2145 case NL80211_IFTYPE_ADHOC
:
2146 case NL80211_IFTYPE_MESH_POINT
:
2147 case NL80211_IFTYPE_P2P_CLIENT
:
2148 case NL80211_IFTYPE_P2P_DEVICE
:
2150 case NL80211_IFTYPE_P2P_GO
:
2151 if (sdata
->local
->ops
->hw_scan
)
2154 * FIXME: implement NoA while scanning in software,
2155 * for now fall through to allow scanning only when
2156 * beaconing hasn't been configured yet
2158 case NL80211_IFTYPE_AP
:
2160 * If the scan has been forced (and the driver supports
2161 * forcing), don't care about being beaconing already.
2162 * This will create problems to the attached stations (e.g. all
2163 * the frames sent while scanning on other channel will be
2166 if (sdata
->u
.ap
.beacon
&&
2167 (!(wiphy
->features
& NL80211_FEATURE_AP_SCAN
) ||
2168 !(req
->flags
& NL80211_SCAN_FLAG_AP
)))
2175 return ieee80211_request_scan(sdata
, req
);
2179 ieee80211_sched_scan_start(struct wiphy
*wiphy
,
2180 struct net_device
*dev
,
2181 struct cfg80211_sched_scan_request
*req
)
2183 struct ieee80211_sub_if_data
*sdata
= IEEE80211_DEV_TO_SUB_IF(dev
);
2185 if (!sdata
->local
->ops
->sched_scan_start
)
2188 return ieee80211_request_sched_scan_start(sdata
, req
);
2192 ieee80211_sched_scan_stop(struct wiphy
*wiphy
, struct net_device
*dev
)
2194 struct ieee80211_sub_if_data
*sdata
= IEEE80211_DEV_TO_SUB_IF(dev
);
2196 if (!sdata
->local
->ops
->sched_scan_stop
)
2199 return ieee80211_request_sched_scan_stop(sdata
);
2202 static int ieee80211_auth(struct wiphy
*wiphy
, struct net_device
*dev
,
2203 struct cfg80211_auth_request
*req
)
2205 return ieee80211_mgd_auth(IEEE80211_DEV_TO_SUB_IF(dev
), req
);
2208 static int ieee80211_assoc(struct wiphy
*wiphy
, struct net_device
*dev
,
2209 struct cfg80211_assoc_request
*req
)
2211 return ieee80211_mgd_assoc(IEEE80211_DEV_TO_SUB_IF(dev
), req
);
2214 static int ieee80211_deauth(struct wiphy
*wiphy
, struct net_device
*dev
,
2215 struct cfg80211_deauth_request
*req
)
2217 return ieee80211_mgd_deauth(IEEE80211_DEV_TO_SUB_IF(dev
), req
);
2220 static int ieee80211_disassoc(struct wiphy
*wiphy
, struct net_device
*dev
,
2221 struct cfg80211_disassoc_request
*req
)
2223 return ieee80211_mgd_disassoc(IEEE80211_DEV_TO_SUB_IF(dev
), req
);
2226 static int ieee80211_join_ibss(struct wiphy
*wiphy
, struct net_device
*dev
,
2227 struct cfg80211_ibss_params
*params
)
2229 return ieee80211_ibss_join(IEEE80211_DEV_TO_SUB_IF(dev
), params
);
2232 static int ieee80211_leave_ibss(struct wiphy
*wiphy
, struct net_device
*dev
)
2234 return ieee80211_ibss_leave(IEEE80211_DEV_TO_SUB_IF(dev
));
2237 static int ieee80211_set_mcast_rate(struct wiphy
*wiphy
, struct net_device
*dev
,
2238 int rate
[IEEE80211_NUM_BANDS
])
2240 struct ieee80211_sub_if_data
*sdata
= IEEE80211_DEV_TO_SUB_IF(dev
);
2242 memcpy(sdata
->vif
.bss_conf
.mcast_rate
, rate
,
2243 sizeof(int) * IEEE80211_NUM_BANDS
);
2248 static int ieee80211_set_wiphy_params(struct wiphy
*wiphy
, u32 changed
)
2250 struct ieee80211_local
*local
= wiphy_priv(wiphy
);
2253 if (changed
& WIPHY_PARAM_FRAG_THRESHOLD
) {
2254 err
= drv_set_frag_threshold(local
, wiphy
->frag_threshold
);
2260 if (changed
& WIPHY_PARAM_COVERAGE_CLASS
) {
2261 err
= drv_set_coverage_class(local
, wiphy
->coverage_class
);
2267 if (changed
& WIPHY_PARAM_RTS_THRESHOLD
) {
2268 err
= drv_set_rts_threshold(local
, wiphy
->rts_threshold
);
2274 if (changed
& WIPHY_PARAM_RETRY_SHORT
) {
2275 if (wiphy
->retry_short
> IEEE80211_MAX_TX_RETRY
)
2277 local
->hw
.conf
.short_frame_max_tx_count
= wiphy
->retry_short
;
2279 if (changed
& WIPHY_PARAM_RETRY_LONG
) {
2280 if (wiphy
->retry_long
> IEEE80211_MAX_TX_RETRY
)
2282 local
->hw
.conf
.long_frame_max_tx_count
= wiphy
->retry_long
;
2285 (WIPHY_PARAM_RETRY_SHORT
| WIPHY_PARAM_RETRY_LONG
))
2286 ieee80211_hw_config(local
, IEEE80211_CONF_CHANGE_RETRY_LIMITS
);
2291 static int ieee80211_set_tx_power(struct wiphy
*wiphy
,
2292 struct wireless_dev
*wdev
,
2293 enum nl80211_tx_power_setting type
, int mbm
)
2295 struct ieee80211_local
*local
= wiphy_priv(wiphy
);
2296 struct ieee80211_sub_if_data
*sdata
;
2299 sdata
= IEEE80211_WDEV_TO_SUB_IF(wdev
);
2302 case NL80211_TX_POWER_AUTOMATIC
:
2303 sdata
->user_power_level
= IEEE80211_UNSET_POWER_LEVEL
;
2305 case NL80211_TX_POWER_LIMITED
:
2306 case NL80211_TX_POWER_FIXED
:
2307 if (mbm
< 0 || (mbm
% 100))
2309 sdata
->user_power_level
= MBM_TO_DBM(mbm
);
2313 ieee80211_recalc_txpower(sdata
);
2319 case NL80211_TX_POWER_AUTOMATIC
:
2320 local
->user_power_level
= IEEE80211_UNSET_POWER_LEVEL
;
2322 case NL80211_TX_POWER_LIMITED
:
2323 case NL80211_TX_POWER_FIXED
:
2324 if (mbm
< 0 || (mbm
% 100))
2326 local
->user_power_level
= MBM_TO_DBM(mbm
);
2330 mutex_lock(&local
->iflist_mtx
);
2331 list_for_each_entry(sdata
, &local
->interfaces
, list
)
2332 sdata
->user_power_level
= local
->user_power_level
;
2333 list_for_each_entry(sdata
, &local
->interfaces
, list
)
2334 ieee80211_recalc_txpower(sdata
);
2335 mutex_unlock(&local
->iflist_mtx
);
2340 static int ieee80211_get_tx_power(struct wiphy
*wiphy
,
2341 struct wireless_dev
*wdev
,
2344 struct ieee80211_local
*local
= wiphy_priv(wiphy
);
2345 struct ieee80211_sub_if_data
*sdata
= IEEE80211_WDEV_TO_SUB_IF(wdev
);
2347 if (!local
->use_chanctx
)
2348 *dbm
= local
->hw
.conf
.power_level
;
2350 *dbm
= sdata
->vif
.bss_conf
.txpower
;
2355 static int ieee80211_set_wds_peer(struct wiphy
*wiphy
, struct net_device
*dev
,
2358 struct ieee80211_sub_if_data
*sdata
= IEEE80211_DEV_TO_SUB_IF(dev
);
2360 memcpy(&sdata
->u
.wds
.remote_addr
, addr
, ETH_ALEN
);
2365 static void ieee80211_rfkill_poll(struct wiphy
*wiphy
)
2367 struct ieee80211_local
*local
= wiphy_priv(wiphy
);
2369 drv_rfkill_poll(local
);
2372 #ifdef CONFIG_NL80211_TESTMODE
2373 static int ieee80211_testmode_cmd(struct wiphy
*wiphy
,
2374 struct wireless_dev
*wdev
,
2375 void *data
, int len
)
2377 struct ieee80211_local
*local
= wiphy_priv(wiphy
);
2378 struct ieee80211_vif
*vif
= NULL
;
2380 if (!local
->ops
->testmode_cmd
)
2384 struct ieee80211_sub_if_data
*sdata
;
2386 sdata
= IEEE80211_WDEV_TO_SUB_IF(wdev
);
2387 if (sdata
->flags
& IEEE80211_SDATA_IN_DRIVER
)
2391 return local
->ops
->testmode_cmd(&local
->hw
, vif
, data
, len
);
2394 static int ieee80211_testmode_dump(struct wiphy
*wiphy
,
2395 struct sk_buff
*skb
,
2396 struct netlink_callback
*cb
,
2397 void *data
, int len
)
2399 struct ieee80211_local
*local
= wiphy_priv(wiphy
);
2401 if (!local
->ops
->testmode_dump
)
2404 return local
->ops
->testmode_dump(&local
->hw
, skb
, cb
, data
, len
);
2408 int __ieee80211_request_smps_ap(struct ieee80211_sub_if_data
*sdata
,
2409 enum ieee80211_smps_mode smps_mode
)
2411 struct sta_info
*sta
;
2412 enum ieee80211_smps_mode old_req
;
2415 if (WARN_ON_ONCE(sdata
->vif
.type
!= NL80211_IFTYPE_AP
))
2418 if (sdata
->vif
.bss_conf
.chandef
.width
== NL80211_CHAN_WIDTH_20_NOHT
)
2421 old_req
= sdata
->u
.ap
.req_smps
;
2422 sdata
->u
.ap
.req_smps
= smps_mode
;
2424 /* AUTOMATIC doesn't mean much for AP - don't allow it */
2425 if (old_req
== smps_mode
||
2426 smps_mode
== IEEE80211_SMPS_AUTOMATIC
)
2429 /* If no associated stations, there's no need to do anything */
2430 if (!atomic_read(&sdata
->u
.ap
.num_mcast_sta
)) {
2431 sdata
->smps_mode
= smps_mode
;
2432 ieee80211_queue_work(&sdata
->local
->hw
, &sdata
->recalc_smps
);
2437 "SMSP %d requested in AP mode, sending Action frame to %d stations\n",
2438 smps_mode
, atomic_read(&sdata
->u
.ap
.num_mcast_sta
));
2440 mutex_lock(&sdata
->local
->sta_mtx
);
2441 for (i
= 0; i
< STA_HASH_SIZE
; i
++) {
2442 for (sta
= rcu_dereference_protected(sdata
->local
->sta_hash
[i
],
2443 lockdep_is_held(&sdata
->local
->sta_mtx
));
2445 sta
= rcu_dereference_protected(sta
->hnext
,
2446 lockdep_is_held(&sdata
->local
->sta_mtx
))) {
2448 * Only stations associated to our AP and
2451 if (sta
->sdata
->bss
!= &sdata
->u
.ap
)
2454 /* This station doesn't support MIMO - skip it */
2455 if (sta_info_tx_streams(sta
) == 1)
2459 * Don't wake up a STA just to send the action frame
2460 * unless we are getting more restrictive.
2462 if (test_sta_flag(sta
, WLAN_STA_PS_STA
) &&
2463 !ieee80211_smps_is_restrictive(sta
->known_smps_mode
,
2466 "Won't send SMPS to sleeping STA %pM\n",
2472 * If the STA is not authorized, wait until it gets
2473 * authorized and the action frame will be sent then.
2475 if (!test_sta_flag(sta
, WLAN_STA_AUTHORIZED
))
2478 ht_dbg(sdata
, "Sending SMPS to %pM\n", sta
->sta
.addr
);
2479 ieee80211_send_smps_action(sdata
, smps_mode
,
2481 sdata
->vif
.bss_conf
.bssid
);
2484 mutex_unlock(&sdata
->local
->sta_mtx
);
2486 sdata
->smps_mode
= smps_mode
;
2487 ieee80211_queue_work(&sdata
->local
->hw
, &sdata
->recalc_smps
);
2492 int __ieee80211_request_smps_mgd(struct ieee80211_sub_if_data
*sdata
,
2493 enum ieee80211_smps_mode smps_mode
)
2496 enum ieee80211_smps_mode old_req
;
2499 lockdep_assert_held(&sdata
->wdev
.mtx
);
2501 if (WARN_ON_ONCE(sdata
->vif
.type
!= NL80211_IFTYPE_STATION
))
2504 old_req
= sdata
->u
.mgd
.req_smps
;
2505 sdata
->u
.mgd
.req_smps
= smps_mode
;
2507 if (old_req
== smps_mode
&&
2508 smps_mode
!= IEEE80211_SMPS_AUTOMATIC
)
2512 * If not associated, or current association is not an HT
2513 * association, there's no need to do anything, just store
2514 * the new value until we associate.
2516 if (!sdata
->u
.mgd
.associated
||
2517 sdata
->vif
.bss_conf
.chandef
.width
== NL80211_CHAN_WIDTH_20_NOHT
)
2520 ap
= sdata
->u
.mgd
.associated
->bssid
;
2522 if (smps_mode
== IEEE80211_SMPS_AUTOMATIC
) {
2523 if (sdata
->u
.mgd
.powersave
)
2524 smps_mode
= IEEE80211_SMPS_DYNAMIC
;
2526 smps_mode
= IEEE80211_SMPS_OFF
;
2529 /* send SM PS frame to AP */
2530 err
= ieee80211_send_smps_action(sdata
, smps_mode
,
2533 sdata
->u
.mgd
.req_smps
= old_req
;
2538 static int ieee80211_set_power_mgmt(struct wiphy
*wiphy
, struct net_device
*dev
,
2539 bool enabled
, int timeout
)
2541 struct ieee80211_sub_if_data
*sdata
= IEEE80211_DEV_TO_SUB_IF(dev
);
2542 struct ieee80211_local
*local
= wdev_priv(dev
->ieee80211_ptr
);
2544 if (sdata
->vif
.type
!= NL80211_IFTYPE_STATION
)
2547 if (!(local
->hw
.flags
& IEEE80211_HW_SUPPORTS_PS
))
2550 if (enabled
== sdata
->u
.mgd
.powersave
&&
2551 timeout
== local
->dynamic_ps_forced_timeout
)
2554 sdata
->u
.mgd
.powersave
= enabled
;
2555 local
->dynamic_ps_forced_timeout
= timeout
;
2557 /* no change, but if automatic follow powersave */
2559 __ieee80211_request_smps_mgd(sdata
, sdata
->u
.mgd
.req_smps
);
2560 sdata_unlock(sdata
);
2562 if (local
->hw
.flags
& IEEE80211_HW_SUPPORTS_DYNAMIC_PS
)
2563 ieee80211_hw_config(local
, IEEE80211_CONF_CHANGE_PS
);
2565 ieee80211_recalc_ps(local
, -1);
2566 ieee80211_recalc_ps_vif(sdata
);
2571 static int ieee80211_set_cqm_rssi_config(struct wiphy
*wiphy
,
2572 struct net_device
*dev
,
2573 s32 rssi_thold
, u32 rssi_hyst
)
2575 struct ieee80211_sub_if_data
*sdata
= IEEE80211_DEV_TO_SUB_IF(dev
);
2576 struct ieee80211_vif
*vif
= &sdata
->vif
;
2577 struct ieee80211_bss_conf
*bss_conf
= &vif
->bss_conf
;
2579 if (rssi_thold
== bss_conf
->cqm_rssi_thold
&&
2580 rssi_hyst
== bss_conf
->cqm_rssi_hyst
)
2583 bss_conf
->cqm_rssi_thold
= rssi_thold
;
2584 bss_conf
->cqm_rssi_hyst
= rssi_hyst
;
2586 /* tell the driver upon association, unless already associated */
2587 if (sdata
->u
.mgd
.associated
&&
2588 sdata
->vif
.driver_flags
& IEEE80211_VIF_SUPPORTS_CQM_RSSI
)
2589 ieee80211_bss_info_change_notify(sdata
, BSS_CHANGED_CQM
);
2594 static int ieee80211_set_bitrate_mask(struct wiphy
*wiphy
,
2595 struct net_device
*dev
,
2597 const struct cfg80211_bitrate_mask
*mask
)
2599 struct ieee80211_sub_if_data
*sdata
= IEEE80211_DEV_TO_SUB_IF(dev
);
2600 struct ieee80211_local
*local
= wdev_priv(dev
->ieee80211_ptr
);
2603 if (!ieee80211_sdata_running(sdata
))
2606 if (local
->hw
.flags
& IEEE80211_HW_HAS_RATE_CONTROL
) {
2607 ret
= drv_set_bitrate_mask(local
, sdata
, mask
);
2612 for (i
= 0; i
< IEEE80211_NUM_BANDS
; i
++) {
2613 struct ieee80211_supported_band
*sband
= wiphy
->bands
[i
];
2616 sdata
->rc_rateidx_mask
[i
] = mask
->control
[i
].legacy
;
2617 memcpy(sdata
->rc_rateidx_mcs_mask
[i
], mask
->control
[i
].ht_mcs
,
2618 sizeof(mask
->control
[i
].ht_mcs
));
2620 sdata
->rc_has_mcs_mask
[i
] = false;
2624 for (j
= 0; j
< IEEE80211_HT_MCS_MASK_LEN
; j
++)
2625 if (~sdata
->rc_rateidx_mcs_mask
[i
][j
]) {
2626 sdata
->rc_has_mcs_mask
[i
] = true;
2634 static int ieee80211_start_roc_work(struct ieee80211_local
*local
,
2635 struct ieee80211_sub_if_data
*sdata
,
2636 struct ieee80211_channel
*channel
,
2637 unsigned int duration
, u64
*cookie
,
2638 struct sk_buff
*txskb
,
2639 enum ieee80211_roc_type type
)
2641 struct ieee80211_roc_work
*roc
, *tmp
;
2642 bool queued
= false;
2645 lockdep_assert_held(&local
->mtx
);
2647 if (local
->use_chanctx
&& !local
->ops
->remain_on_channel
)
2650 roc
= kzalloc(sizeof(*roc
), GFP_KERNEL
);
2655 * If the duration is zero, then the driver
2656 * wouldn't actually do anything. Set it to
2659 * TODO: cancel the off-channel operation
2660 * when we get the SKB's TX status and
2661 * the wait time was zero before.
2666 roc
->chan
= channel
;
2667 roc
->duration
= duration
;
2668 roc
->req_duration
= duration
;
2671 roc
->mgmt_tx_cookie
= (unsigned long)txskb
;
2673 INIT_DELAYED_WORK(&roc
->work
, ieee80211_sw_roc_work
);
2674 INIT_LIST_HEAD(&roc
->dependents
);
2677 * cookie is either the roc cookie (for normal roc)
2678 * or the SKB (for mgmt TX)
2681 /* local->mtx protects this */
2682 local
->roc_cookie_counter
++;
2683 roc
->cookie
= local
->roc_cookie_counter
;
2684 /* wow, you wrapped 64 bits ... more likely a bug */
2685 if (WARN_ON(roc
->cookie
== 0)) {
2687 local
->roc_cookie_counter
++;
2689 *cookie
= roc
->cookie
;
2691 *cookie
= (unsigned long)txskb
;
2694 /* if there's one pending or we're scanning, queue this one */
2695 if (!list_empty(&local
->roc_list
) ||
2696 local
->scanning
|| local
->radar_detect_enabled
)
2697 goto out_check_combine
;
2699 /* if not HW assist, just queue & schedule work */
2700 if (!local
->ops
->remain_on_channel
) {
2701 ieee80211_queue_delayed_work(&local
->hw
, &roc
->work
, 0);
2705 /* otherwise actually kick it off here (for error handling) */
2707 ret
= drv_remain_on_channel(local
, sdata
, channel
, duration
, type
);
2713 roc
->started
= true;
2717 list_for_each_entry(tmp
, &local
->roc_list
, list
) {
2718 if (tmp
->chan
!= channel
|| tmp
->sdata
!= sdata
)
2722 * Extend this ROC if possible:
2724 * If it hasn't started yet, just increase the duration
2725 * and add the new one to the list of dependents.
2726 * If the type of the new ROC has higher priority, modify the
2727 * type of the previous one to match that of the new one.
2729 if (!tmp
->started
) {
2730 list_add_tail(&roc
->list
, &tmp
->dependents
);
2731 tmp
->duration
= max(tmp
->duration
, roc
->duration
);
2732 tmp
->type
= max(tmp
->type
, roc
->type
);
2737 /* If it has already started, it's more difficult ... */
2738 if (local
->ops
->remain_on_channel
) {
2739 unsigned long j
= jiffies
;
2742 * In the offloaded ROC case, if it hasn't begun, add
2743 * this new one to the dependent list to be handled
2744 * when the master one begins. If it has begun,
2745 * check that there's still a minimum time left and
2746 * if so, start this one, transmitting the frame, but
2747 * add it to the list directly after this one with
2748 * a reduced time so we'll ask the driver to execute
2749 * it right after finishing the previous one, in the
2750 * hope that it'll also be executed right afterwards,
2751 * effectively extending the old one.
2752 * If there's no minimum time left, just add it to the
2754 * TODO: the ROC type is ignored here, assuming that it
2755 * is better to immediately use the current ROC.
2757 if (!tmp
->hw_begun
) {
2758 list_add_tail(&roc
->list
, &tmp
->dependents
);
2763 if (time_before(j
+ IEEE80211_ROC_MIN_LEFT
,
2764 tmp
->hw_start_time
+
2765 msecs_to_jiffies(tmp
->duration
))) {
2768 ieee80211_handle_roc_started(roc
);
2770 new_dur
= roc
->duration
-
2771 jiffies_to_msecs(tmp
->hw_start_time
+
2777 /* add right after tmp */
2778 list_add(&roc
->list
, &tmp
->list
);
2780 list_add_tail(&roc
->list
,
2785 } else if (del_timer_sync(&tmp
->work
.timer
)) {
2786 unsigned long new_end
;
2789 * In the software ROC case, cancel the timer, if
2790 * that fails then the finish work is already
2791 * queued/pending and thus we queue the new ROC
2792 * normally, if that succeeds then we can extend
2793 * the timer duration and TX the frame (if any.)
2796 list_add_tail(&roc
->list
, &tmp
->dependents
);
2799 new_end
= jiffies
+ msecs_to_jiffies(roc
->duration
);
2801 /* ok, it was started & we canceled timer */
2802 if (time_after(new_end
, tmp
->work
.timer
.expires
))
2803 mod_timer(&tmp
->work
.timer
, new_end
);
2805 add_timer(&tmp
->work
.timer
);
2807 ieee80211_handle_roc_started(roc
);
2814 list_add_tail(&roc
->list
, &local
->roc_list
);
2819 static int ieee80211_remain_on_channel(struct wiphy
*wiphy
,
2820 struct wireless_dev
*wdev
,
2821 struct ieee80211_channel
*chan
,
2822 unsigned int duration
,
2825 struct ieee80211_sub_if_data
*sdata
= IEEE80211_WDEV_TO_SUB_IF(wdev
);
2826 struct ieee80211_local
*local
= sdata
->local
;
2829 mutex_lock(&local
->mtx
);
2830 ret
= ieee80211_start_roc_work(local
, sdata
, chan
,
2831 duration
, cookie
, NULL
,
2832 IEEE80211_ROC_TYPE_NORMAL
);
2833 mutex_unlock(&local
->mtx
);
2838 static int ieee80211_cancel_roc(struct ieee80211_local
*local
,
2839 u64 cookie
, bool mgmt_tx
)
2841 struct ieee80211_roc_work
*roc
, *tmp
, *found
= NULL
;
2844 mutex_lock(&local
->mtx
);
2845 list_for_each_entry_safe(roc
, tmp
, &local
->roc_list
, list
) {
2846 struct ieee80211_roc_work
*dep
, *tmp2
;
2848 list_for_each_entry_safe(dep
, tmp2
, &roc
->dependents
, list
) {
2849 if (!mgmt_tx
&& dep
->cookie
!= cookie
)
2851 else if (mgmt_tx
&& dep
->mgmt_tx_cookie
!= cookie
)
2853 /* found dependent item -- just remove it */
2854 list_del(&dep
->list
);
2855 mutex_unlock(&local
->mtx
);
2857 ieee80211_roc_notify_destroy(dep
, true);
2861 if (!mgmt_tx
&& roc
->cookie
!= cookie
)
2863 else if (mgmt_tx
&& roc
->mgmt_tx_cookie
!= cookie
)
2871 mutex_unlock(&local
->mtx
);
2876 * We found the item to cancel, so do that. Note that it
2877 * may have dependents, which we also cancel (and send
2878 * the expired signal for.) Not doing so would be quite
2879 * tricky here, but we may need to fix it later.
2882 if (local
->ops
->remain_on_channel
) {
2883 if (found
->started
) {
2884 ret
= drv_cancel_remain_on_channel(local
);
2885 if (WARN_ON_ONCE(ret
)) {
2886 mutex_unlock(&local
->mtx
);
2891 list_del(&found
->list
);
2894 ieee80211_start_next_roc(local
);
2895 mutex_unlock(&local
->mtx
);
2897 ieee80211_roc_notify_destroy(found
, true);
2899 /* work may be pending so use it all the time */
2900 found
->abort
= true;
2901 ieee80211_queue_delayed_work(&local
->hw
, &found
->work
, 0);
2903 mutex_unlock(&local
->mtx
);
2905 /* work will clean up etc */
2906 flush_delayed_work(&found
->work
);
2907 WARN_ON(!found
->to_be_freed
);
2914 static int ieee80211_cancel_remain_on_channel(struct wiphy
*wiphy
,
2915 struct wireless_dev
*wdev
,
2918 struct ieee80211_sub_if_data
*sdata
= IEEE80211_WDEV_TO_SUB_IF(wdev
);
2919 struct ieee80211_local
*local
= sdata
->local
;
2921 return ieee80211_cancel_roc(local
, cookie
, false);
2924 static int ieee80211_start_radar_detection(struct wiphy
*wiphy
,
2925 struct net_device
*dev
,
2926 struct cfg80211_chan_def
*chandef
,
2929 struct ieee80211_sub_if_data
*sdata
= IEEE80211_DEV_TO_SUB_IF(dev
);
2930 struct ieee80211_local
*local
= sdata
->local
;
2933 mutex_lock(&local
->mtx
);
2934 if (!list_empty(&local
->roc_list
) || local
->scanning
) {
2939 /* whatever, but channel contexts should not complain about that one */
2940 sdata
->smps_mode
= IEEE80211_SMPS_OFF
;
2941 sdata
->needed_rx_chains
= local
->rx_chains
;
2943 err
= ieee80211_vif_use_channel(sdata
, chandef
,
2944 IEEE80211_CHANCTX_SHARED
);
2948 ieee80211_queue_delayed_work(&sdata
->local
->hw
,
2949 &sdata
->dfs_cac_timer_work
,
2950 msecs_to_jiffies(cac_time_ms
));
2953 mutex_unlock(&local
->mtx
);
2957 static struct cfg80211_beacon_data
*
2958 cfg80211_beacon_dup(struct cfg80211_beacon_data
*beacon
)
2960 struct cfg80211_beacon_data
*new_beacon
;
2964 len
= beacon
->head_len
+ beacon
->tail_len
+ beacon
->beacon_ies_len
+
2965 beacon
->proberesp_ies_len
+ beacon
->assocresp_ies_len
+
2966 beacon
->probe_resp_len
;
2968 new_beacon
= kzalloc(sizeof(*new_beacon
) + len
, GFP_KERNEL
);
2972 pos
= (u8
*)(new_beacon
+ 1);
2973 if (beacon
->head_len
) {
2974 new_beacon
->head_len
= beacon
->head_len
;
2975 new_beacon
->head
= pos
;
2976 memcpy(pos
, beacon
->head
, beacon
->head_len
);
2977 pos
+= beacon
->head_len
;
2979 if (beacon
->tail_len
) {
2980 new_beacon
->tail_len
= beacon
->tail_len
;
2981 new_beacon
->tail
= pos
;
2982 memcpy(pos
, beacon
->tail
, beacon
->tail_len
);
2983 pos
+= beacon
->tail_len
;
2985 if (beacon
->beacon_ies_len
) {
2986 new_beacon
->beacon_ies_len
= beacon
->beacon_ies_len
;
2987 new_beacon
->beacon_ies
= pos
;
2988 memcpy(pos
, beacon
->beacon_ies
, beacon
->beacon_ies_len
);
2989 pos
+= beacon
->beacon_ies_len
;
2991 if (beacon
->proberesp_ies_len
) {
2992 new_beacon
->proberesp_ies_len
= beacon
->proberesp_ies_len
;
2993 new_beacon
->proberesp_ies
= pos
;
2994 memcpy(pos
, beacon
->proberesp_ies
, beacon
->proberesp_ies_len
);
2995 pos
+= beacon
->proberesp_ies_len
;
2997 if (beacon
->assocresp_ies_len
) {
2998 new_beacon
->assocresp_ies_len
= beacon
->assocresp_ies_len
;
2999 new_beacon
->assocresp_ies
= pos
;
3000 memcpy(pos
, beacon
->assocresp_ies
, beacon
->assocresp_ies_len
);
3001 pos
+= beacon
->assocresp_ies_len
;
3003 if (beacon
->probe_resp_len
) {
3004 new_beacon
->probe_resp_len
= beacon
->probe_resp_len
;
3005 beacon
->probe_resp
= pos
;
3006 memcpy(pos
, beacon
->probe_resp
, beacon
->probe_resp_len
);
3007 pos
+= beacon
->probe_resp_len
;
3013 void ieee80211_csa_finish(struct ieee80211_vif
*vif
)
3015 struct ieee80211_sub_if_data
*sdata
= vif_to_sdata(vif
);
3017 ieee80211_queue_work(&sdata
->local
->hw
,
3018 &sdata
->csa_finalize_work
);
3020 EXPORT_SYMBOL(ieee80211_csa_finish
);
3022 static void ieee80211_csa_finalize(struct ieee80211_sub_if_data
*sdata
)
3024 struct ieee80211_local
*local
= sdata
->local
;
3025 int err
, changed
= 0;
3027 sdata_assert_lock(sdata
);
3029 mutex_lock(&local
->mtx
);
3030 sdata
->radar_required
= sdata
->csa_radar_required
;
3031 err
= ieee80211_vif_change_channel(sdata
, &changed
);
3032 mutex_unlock(&local
->mtx
);
3033 if (WARN_ON(err
< 0))
3036 if (!local
->use_chanctx
) {
3037 local
->_oper_chandef
= sdata
->csa_chandef
;
3038 ieee80211_hw_config(local
, 0);
3041 sdata
->vif
.csa_active
= false;
3042 switch (sdata
->vif
.type
) {
3043 case NL80211_IFTYPE_AP
:
3044 err
= ieee80211_assign_beacon(sdata
, sdata
->u
.ap
.next_beacon
);
3045 kfree(sdata
->u
.ap
.next_beacon
);
3046 sdata
->u
.ap
.next_beacon
= NULL
;
3052 case NL80211_IFTYPE_ADHOC
:
3053 err
= ieee80211_ibss_finish_csa(sdata
);
3058 #ifdef CONFIG_MAC80211_MESH
3059 case NL80211_IFTYPE_MESH_POINT
:
3060 err
= ieee80211_mesh_finish_csa(sdata
);
3071 ieee80211_bss_info_change_notify(sdata
, changed
);
3073 ieee80211_wake_queues_by_reason(&sdata
->local
->hw
,
3074 IEEE80211_MAX_QUEUE_MAP
,
3075 IEEE80211_QUEUE_STOP_REASON_CSA
);
3077 cfg80211_ch_switch_notify(sdata
->dev
, &sdata
->csa_chandef
);
3080 void ieee80211_csa_finalize_work(struct work_struct
*work
)
3082 struct ieee80211_sub_if_data
*sdata
=
3083 container_of(work
, struct ieee80211_sub_if_data
,
3087 /* AP might have been stopped while waiting for the lock. */
3088 if (!sdata
->vif
.csa_active
)
3091 if (!ieee80211_sdata_running(sdata
))
3094 ieee80211_csa_finalize(sdata
);
3097 sdata_unlock(sdata
);
3100 static int ieee80211_set_csa_beacon(struct ieee80211_sub_if_data
*sdata
,
3101 struct cfg80211_csa_settings
*params
,
3106 switch (sdata
->vif
.type
) {
3107 case NL80211_IFTYPE_AP
:
3108 sdata
->u
.ap
.next_beacon
=
3109 cfg80211_beacon_dup(¶ms
->beacon_after
);
3110 if (!sdata
->u
.ap
.next_beacon
)
3114 * With a count of 0, we don't have to wait for any
3115 * TBTT before switching, so complete the CSA
3116 * immediately. In theory, with a count == 1 we
3117 * should delay the switch until just before the next
3118 * TBTT, but that would complicate things so we switch
3119 * immediately too. If we would delay the switch
3120 * until the next TBTT, we would have to set the probe
3123 * TODO: A channel switch with count <= 1 without
3124 * sending a CSA action frame is kind of useless,
3125 * because the clients won't know we're changing
3126 * channels. The action frame must be implemented
3127 * either here or in the userspace.
3129 if (params
->count
<= 1)
3132 sdata
->csa_counter_offset_beacon
=
3133 params
->counter_offset_beacon
;
3134 sdata
->csa_counter_offset_presp
= params
->counter_offset_presp
;
3135 err
= ieee80211_assign_beacon(sdata
, ¶ms
->beacon_csa
);
3137 kfree(sdata
->u
.ap
.next_beacon
);
3143 case NL80211_IFTYPE_ADHOC
:
3144 if (!sdata
->vif
.bss_conf
.ibss_joined
)
3147 if (params
->chandef
.width
!= sdata
->u
.ibss
.chandef
.width
)
3150 switch (params
->chandef
.width
) {
3151 case NL80211_CHAN_WIDTH_40
:
3152 if (cfg80211_get_chandef_type(¶ms
->chandef
) !=
3153 cfg80211_get_chandef_type(&sdata
->u
.ibss
.chandef
))
3155 case NL80211_CHAN_WIDTH_5
:
3156 case NL80211_CHAN_WIDTH_10
:
3157 case NL80211_CHAN_WIDTH_20_NOHT
:
3158 case NL80211_CHAN_WIDTH_20
:
3164 /* changes into another band are not supported */
3165 if (sdata
->u
.ibss
.chandef
.chan
->band
!=
3166 params
->chandef
.chan
->band
)
3169 /* see comments in the NL80211_IFTYPE_AP block */
3170 if (params
->count
> 1) {
3171 err
= ieee80211_ibss_csa_beacon(sdata
, params
);
3177 ieee80211_send_action_csa(sdata
, params
);
3180 #ifdef CONFIG_MAC80211_MESH
3181 case NL80211_IFTYPE_MESH_POINT
: {
3182 struct ieee80211_if_mesh
*ifmsh
= &sdata
->u
.mesh
;
3184 if (params
->chandef
.width
!= sdata
->vif
.bss_conf
.chandef
.width
)
3187 /* changes into another band are not supported */
3188 if (sdata
->vif
.bss_conf
.chandef
.chan
->band
!=
3189 params
->chandef
.chan
->band
)
3192 if (ifmsh
->csa_role
== IEEE80211_MESH_CSA_ROLE_NONE
) {
3193 ifmsh
->csa_role
= IEEE80211_MESH_CSA_ROLE_INIT
;
3194 if (!ifmsh
->pre_value
)
3195 ifmsh
->pre_value
= 1;
3200 /* see comments in the NL80211_IFTYPE_AP block */
3201 if (params
->count
> 1) {
3202 err
= ieee80211_mesh_csa_beacon(sdata
, params
);
3204 ifmsh
->csa_role
= IEEE80211_MESH_CSA_ROLE_NONE
;
3210 if (ifmsh
->csa_role
== IEEE80211_MESH_CSA_ROLE_INIT
)
3211 ieee80211_send_action_csa(sdata
, params
);
3223 int ieee80211_channel_switch(struct wiphy
*wiphy
, struct net_device
*dev
,
3224 struct cfg80211_csa_settings
*params
)
3226 struct ieee80211_sub_if_data
*sdata
= IEEE80211_DEV_TO_SUB_IF(dev
);
3227 struct ieee80211_local
*local
= sdata
->local
;
3228 struct ieee80211_chanctx_conf
*conf
;
3229 struct ieee80211_chanctx
*chanctx
;
3230 int err
, num_chanctx
, changed
= 0;
3232 sdata_assert_lock(sdata
);
3234 if (!list_empty(&local
->roc_list
) || local
->scanning
)
3237 if (sdata
->wdev
.cac_started
)
3240 if (cfg80211_chandef_identical(¶ms
->chandef
,
3241 &sdata
->vif
.bss_conf
.chandef
))
3244 mutex_lock(&local
->chanctx_mtx
);
3245 conf
= rcu_dereference_protected(sdata
->vif
.chanctx_conf
,
3246 lockdep_is_held(&local
->chanctx_mtx
));
3248 mutex_unlock(&local
->chanctx_mtx
);
3252 /* don't handle for multi-VIF cases */
3253 chanctx
= container_of(conf
, struct ieee80211_chanctx
, conf
);
3254 if (ieee80211_chanctx_refcount(local
, chanctx
) > 1) {
3255 mutex_unlock(&local
->chanctx_mtx
);
3259 list_for_each_entry_rcu(chanctx
, &local
->chanctx_list
, list
)
3261 mutex_unlock(&local
->chanctx_mtx
);
3263 if (num_chanctx
> 1)
3266 /* don't allow another channel switch if one is already active. */
3267 if (sdata
->vif
.csa_active
)
3270 err
= ieee80211_set_csa_beacon(sdata
, params
, &changed
);
3274 sdata
->csa_radar_required
= params
->radar_required
;
3276 if (params
->block_tx
)
3277 ieee80211_stop_queues_by_reason(&local
->hw
,
3278 IEEE80211_MAX_QUEUE_MAP
,
3279 IEEE80211_QUEUE_STOP_REASON_CSA
);
3281 sdata
->csa_chandef
= params
->chandef
;
3282 sdata
->vif
.csa_active
= true;
3285 ieee80211_bss_info_change_notify(sdata
, changed
);
3286 drv_channel_switch_beacon(sdata
, ¶ms
->chandef
);
3288 /* if the beacon didn't change, we can finalize immediately */
3289 ieee80211_csa_finalize(sdata
);
3295 static int ieee80211_mgmt_tx(struct wiphy
*wiphy
, struct wireless_dev
*wdev
,
3296 struct cfg80211_mgmt_tx_params
*params
,
3299 struct ieee80211_sub_if_data
*sdata
= IEEE80211_WDEV_TO_SUB_IF(wdev
);
3300 struct ieee80211_local
*local
= sdata
->local
;
3301 struct sk_buff
*skb
;
3302 struct sta_info
*sta
;
3303 const struct ieee80211_mgmt
*mgmt
= (void *)params
->buf
;
3304 bool need_offchan
= false;
3308 if (params
->dont_wait_for_ack
)
3309 flags
= IEEE80211_TX_CTL_NO_ACK
;
3311 flags
= IEEE80211_TX_INTFL_NL80211_FRAME_TX
|
3312 IEEE80211_TX_CTL_REQ_TX_STATUS
;
3315 flags
|= IEEE80211_TX_CTL_NO_CCK_RATE
;
3317 switch (sdata
->vif
.type
) {
3318 case NL80211_IFTYPE_ADHOC
:
3319 if (!sdata
->vif
.bss_conf
.ibss_joined
)
3320 need_offchan
= true;
3322 #ifdef CONFIG_MAC80211_MESH
3323 case NL80211_IFTYPE_MESH_POINT
:
3324 if (ieee80211_vif_is_mesh(&sdata
->vif
) &&
3325 !sdata
->u
.mesh
.mesh_id_len
)
3326 need_offchan
= true;
3329 case NL80211_IFTYPE_AP
:
3330 case NL80211_IFTYPE_AP_VLAN
:
3331 case NL80211_IFTYPE_P2P_GO
:
3332 if (sdata
->vif
.type
!= NL80211_IFTYPE_ADHOC
&&
3333 !ieee80211_vif_is_mesh(&sdata
->vif
) &&
3334 !rcu_access_pointer(sdata
->bss
->beacon
))
3335 need_offchan
= true;
3336 if (!ieee80211_is_action(mgmt
->frame_control
) ||
3337 mgmt
->u
.action
.category
== WLAN_CATEGORY_PUBLIC
||
3338 mgmt
->u
.action
.category
== WLAN_CATEGORY_SELF_PROTECTED
||
3339 mgmt
->u
.action
.category
== WLAN_CATEGORY_SPECTRUM_MGMT
)
3342 sta
= sta_info_get(sdata
, mgmt
->da
);
3347 case NL80211_IFTYPE_STATION
:
3348 case NL80211_IFTYPE_P2P_CLIENT
:
3349 if (!sdata
->u
.mgd
.associated
)
3350 need_offchan
= true;
3352 case NL80211_IFTYPE_P2P_DEVICE
:
3353 need_offchan
= true;
3359 /* configurations requiring offchan cannot work if no channel has been
3362 if (need_offchan
&& !params
->chan
)
3365 mutex_lock(&local
->mtx
);
3367 /* Check if the operating channel is the requested channel */
3368 if (!need_offchan
) {
3369 struct ieee80211_chanctx_conf
*chanctx_conf
;
3372 chanctx_conf
= rcu_dereference(sdata
->vif
.chanctx_conf
);
3375 need_offchan
= params
->chan
&&
3377 chanctx_conf
->def
.chan
);
3378 } else if (!params
->chan
) {
3383 need_offchan
= true;
3388 if (need_offchan
&& !params
->offchan
) {
3393 skb
= dev_alloc_skb(local
->hw
.extra_tx_headroom
+ params
->len
);
3398 skb_reserve(skb
, local
->hw
.extra_tx_headroom
);
3400 memcpy(skb_put(skb
, params
->len
), params
->buf
, params
->len
);
3402 IEEE80211_SKB_CB(skb
)->flags
= flags
;
3404 skb
->dev
= sdata
->dev
;
3406 if (!need_offchan
) {
3407 *cookie
= (unsigned long) skb
;
3408 ieee80211_tx_skb(sdata
, skb
);
3413 IEEE80211_SKB_CB(skb
)->flags
|= IEEE80211_TX_CTL_TX_OFFCHAN
|
3414 IEEE80211_TX_INTFL_OFFCHAN_TX_OK
;
3415 if (local
->hw
.flags
& IEEE80211_HW_QUEUE_CONTROL
)
3416 IEEE80211_SKB_CB(skb
)->hw_queue
=
3417 local
->hw
.offchannel_tx_hw_queue
;
3419 /* This will handle all kinds of coalescing and immediate TX */
3420 ret
= ieee80211_start_roc_work(local
, sdata
, params
->chan
,
3421 params
->wait
, cookie
, skb
,
3422 IEEE80211_ROC_TYPE_MGMT_TX
);
3426 mutex_unlock(&local
->mtx
);
3430 static int ieee80211_mgmt_tx_cancel_wait(struct wiphy
*wiphy
,
3431 struct wireless_dev
*wdev
,
3434 struct ieee80211_local
*local
= wiphy_priv(wiphy
);
3436 return ieee80211_cancel_roc(local
, cookie
, true);
3439 static void ieee80211_mgmt_frame_register(struct wiphy
*wiphy
,
3440 struct wireless_dev
*wdev
,
3441 u16 frame_type
, bool reg
)
3443 struct ieee80211_local
*local
= wiphy_priv(wiphy
);
3445 switch (frame_type
) {
3446 case IEEE80211_FTYPE_MGMT
| IEEE80211_STYPE_PROBE_REQ
:
3448 local
->probe_req_reg
++;
3450 local
->probe_req_reg
--;
3452 if (!local
->open_count
)
3455 ieee80211_queue_work(&local
->hw
, &local
->reconfig_filter
);
3462 static int ieee80211_set_antenna(struct wiphy
*wiphy
, u32 tx_ant
, u32 rx_ant
)
3464 struct ieee80211_local
*local
= wiphy_priv(wiphy
);
3469 return drv_set_antenna(local
, tx_ant
, rx_ant
);
3472 static int ieee80211_get_antenna(struct wiphy
*wiphy
, u32
*tx_ant
, u32
*rx_ant
)
3474 struct ieee80211_local
*local
= wiphy_priv(wiphy
);
3476 return drv_get_antenna(local
, tx_ant
, rx_ant
);
3479 static int ieee80211_set_ringparam(struct wiphy
*wiphy
, u32 tx
, u32 rx
)
3481 struct ieee80211_local
*local
= wiphy_priv(wiphy
);
3483 return drv_set_ringparam(local
, tx
, rx
);
3486 static void ieee80211_get_ringparam(struct wiphy
*wiphy
,
3487 u32
*tx
, u32
*tx_max
, u32
*rx
, u32
*rx_max
)
3489 struct ieee80211_local
*local
= wiphy_priv(wiphy
);
3491 drv_get_ringparam(local
, tx
, tx_max
, rx
, rx_max
);
3494 static int ieee80211_set_rekey_data(struct wiphy
*wiphy
,
3495 struct net_device
*dev
,
3496 struct cfg80211_gtk_rekey_data
*data
)
3498 struct ieee80211_local
*local
= wiphy_priv(wiphy
);
3499 struct ieee80211_sub_if_data
*sdata
= IEEE80211_DEV_TO_SUB_IF(dev
);
3501 if (!local
->ops
->set_rekey_data
)
3504 drv_set_rekey_data(local
, sdata
, data
);
3509 static void ieee80211_tdls_add_ext_capab(struct sk_buff
*skb
)
3511 u8
*pos
= (void *)skb_put(skb
, 7);
3513 *pos
++ = WLAN_EID_EXT_CAPABILITY
;
3514 *pos
++ = 5; /* len */
3519 *pos
++ = WLAN_EXT_CAPA5_TDLS_ENABLED
;
3522 static u16
ieee80211_get_tdls_sta_capab(struct ieee80211_sub_if_data
*sdata
)
3524 struct ieee80211_local
*local
= sdata
->local
;
3528 if (ieee80211_get_sdata_band(sdata
) != IEEE80211_BAND_2GHZ
)
3531 if (!(local
->hw
.flags
& IEEE80211_HW_2GHZ_SHORT_SLOT_INCAPABLE
))
3532 capab
|= WLAN_CAPABILITY_SHORT_SLOT_TIME
;
3533 if (!(local
->hw
.flags
& IEEE80211_HW_2GHZ_SHORT_PREAMBLE_INCAPABLE
))
3534 capab
|= WLAN_CAPABILITY_SHORT_PREAMBLE
;
3539 static void ieee80211_tdls_add_link_ie(struct sk_buff
*skb
, u8
*src_addr
,
3540 u8
*peer
, u8
*bssid
)
3542 struct ieee80211_tdls_lnkie
*lnkid
;
3544 lnkid
= (void *)skb_put(skb
, sizeof(struct ieee80211_tdls_lnkie
));
3546 lnkid
->ie_type
= WLAN_EID_LINK_ID
;
3547 lnkid
->ie_len
= sizeof(struct ieee80211_tdls_lnkie
) - 2;
3549 memcpy(lnkid
->bssid
, bssid
, ETH_ALEN
);
3550 memcpy(lnkid
->init_sta
, src_addr
, ETH_ALEN
);
3551 memcpy(lnkid
->resp_sta
, peer
, ETH_ALEN
);
3555 ieee80211_prep_tdls_encap_data(struct wiphy
*wiphy
, struct net_device
*dev
,
3556 u8
*peer
, u8 action_code
, u8 dialog_token
,
3557 u16 status_code
, struct sk_buff
*skb
)
3559 struct ieee80211_sub_if_data
*sdata
= IEEE80211_DEV_TO_SUB_IF(dev
);
3560 enum ieee80211_band band
= ieee80211_get_sdata_band(sdata
);
3561 struct ieee80211_tdls_data
*tf
;
3563 tf
= (void *)skb_put(skb
, offsetof(struct ieee80211_tdls_data
, u
));
3565 memcpy(tf
->da
, peer
, ETH_ALEN
);
3566 memcpy(tf
->sa
, sdata
->vif
.addr
, ETH_ALEN
);
3567 tf
->ether_type
= cpu_to_be16(ETH_P_TDLS
);
3568 tf
->payload_type
= WLAN_TDLS_SNAP_RFTYPE
;
3570 switch (action_code
) {
3571 case WLAN_TDLS_SETUP_REQUEST
:
3572 tf
->category
= WLAN_CATEGORY_TDLS
;
3573 tf
->action_code
= WLAN_TDLS_SETUP_REQUEST
;
3575 skb_put(skb
, sizeof(tf
->u
.setup_req
));
3576 tf
->u
.setup_req
.dialog_token
= dialog_token
;
3577 tf
->u
.setup_req
.capability
=
3578 cpu_to_le16(ieee80211_get_tdls_sta_capab(sdata
));
3580 ieee80211_add_srates_ie(sdata
, skb
, false, band
);
3581 ieee80211_add_ext_srates_ie(sdata
, skb
, false, band
);
3582 ieee80211_tdls_add_ext_capab(skb
);
3584 case WLAN_TDLS_SETUP_RESPONSE
:
3585 tf
->category
= WLAN_CATEGORY_TDLS
;
3586 tf
->action_code
= WLAN_TDLS_SETUP_RESPONSE
;
3588 skb_put(skb
, sizeof(tf
->u
.setup_resp
));
3589 tf
->u
.setup_resp
.status_code
= cpu_to_le16(status_code
);
3590 tf
->u
.setup_resp
.dialog_token
= dialog_token
;
3591 tf
->u
.setup_resp
.capability
=
3592 cpu_to_le16(ieee80211_get_tdls_sta_capab(sdata
));
3594 ieee80211_add_srates_ie(sdata
, skb
, false, band
);
3595 ieee80211_add_ext_srates_ie(sdata
, skb
, false, band
);
3596 ieee80211_tdls_add_ext_capab(skb
);
3598 case WLAN_TDLS_SETUP_CONFIRM
:
3599 tf
->category
= WLAN_CATEGORY_TDLS
;
3600 tf
->action_code
= WLAN_TDLS_SETUP_CONFIRM
;
3602 skb_put(skb
, sizeof(tf
->u
.setup_cfm
));
3603 tf
->u
.setup_cfm
.status_code
= cpu_to_le16(status_code
);
3604 tf
->u
.setup_cfm
.dialog_token
= dialog_token
;
3606 case WLAN_TDLS_TEARDOWN
:
3607 tf
->category
= WLAN_CATEGORY_TDLS
;
3608 tf
->action_code
= WLAN_TDLS_TEARDOWN
;
3610 skb_put(skb
, sizeof(tf
->u
.teardown
));
3611 tf
->u
.teardown
.reason_code
= cpu_to_le16(status_code
);
3613 case WLAN_TDLS_DISCOVERY_REQUEST
:
3614 tf
->category
= WLAN_CATEGORY_TDLS
;
3615 tf
->action_code
= WLAN_TDLS_DISCOVERY_REQUEST
;
3617 skb_put(skb
, sizeof(tf
->u
.discover_req
));
3618 tf
->u
.discover_req
.dialog_token
= dialog_token
;
3628 ieee80211_prep_tdls_direct(struct wiphy
*wiphy
, struct net_device
*dev
,
3629 u8
*peer
, u8 action_code
, u8 dialog_token
,
3630 u16 status_code
, struct sk_buff
*skb
)
3632 struct ieee80211_sub_if_data
*sdata
= IEEE80211_DEV_TO_SUB_IF(dev
);
3633 enum ieee80211_band band
= ieee80211_get_sdata_band(sdata
);
3634 struct ieee80211_mgmt
*mgmt
;
3636 mgmt
= (void *)skb_put(skb
, 24);
3637 memset(mgmt
, 0, 24);
3638 memcpy(mgmt
->da
, peer
, ETH_ALEN
);
3639 memcpy(mgmt
->sa
, sdata
->vif
.addr
, ETH_ALEN
);
3640 memcpy(mgmt
->bssid
, sdata
->u
.mgd
.bssid
, ETH_ALEN
);
3642 mgmt
->frame_control
= cpu_to_le16(IEEE80211_FTYPE_MGMT
|
3643 IEEE80211_STYPE_ACTION
);
3645 switch (action_code
) {
3646 case WLAN_PUB_ACTION_TDLS_DISCOVER_RES
:
3647 skb_put(skb
, 1 + sizeof(mgmt
->u
.action
.u
.tdls_discover_resp
));
3648 mgmt
->u
.action
.category
= WLAN_CATEGORY_PUBLIC
;
3649 mgmt
->u
.action
.u
.tdls_discover_resp
.action_code
=
3650 WLAN_PUB_ACTION_TDLS_DISCOVER_RES
;
3651 mgmt
->u
.action
.u
.tdls_discover_resp
.dialog_token
=
3653 mgmt
->u
.action
.u
.tdls_discover_resp
.capability
=
3654 cpu_to_le16(ieee80211_get_tdls_sta_capab(sdata
));
3656 ieee80211_add_srates_ie(sdata
, skb
, false, band
);
3657 ieee80211_add_ext_srates_ie(sdata
, skb
, false, band
);
3658 ieee80211_tdls_add_ext_capab(skb
);
3667 static int ieee80211_tdls_mgmt(struct wiphy
*wiphy
, struct net_device
*dev
,
3668 u8
*peer
, u8 action_code
, u8 dialog_token
,
3669 u16 status_code
, u32 peer_capability
,
3670 const u8
*extra_ies
, size_t extra_ies_len
)
3672 struct ieee80211_sub_if_data
*sdata
= IEEE80211_DEV_TO_SUB_IF(dev
);
3673 struct ieee80211_local
*local
= sdata
->local
;
3674 struct sk_buff
*skb
= NULL
;
3678 if (!(wiphy
->flags
& WIPHY_FLAG_SUPPORTS_TDLS
))
3681 /* make sure we are in managed mode, and associated */
3682 if (sdata
->vif
.type
!= NL80211_IFTYPE_STATION
||
3683 !sdata
->u
.mgd
.associated
)
3686 tdls_dbg(sdata
, "TDLS mgmt action %d peer %pM\n",
3689 skb
= dev_alloc_skb(local
->hw
.extra_tx_headroom
+
3690 max(sizeof(struct ieee80211_mgmt
),
3691 sizeof(struct ieee80211_tdls_data
)) +
3692 50 + /* supported rates */
3695 sizeof(struct ieee80211_tdls_lnkie
));
3699 skb_reserve(skb
, local
->hw
.extra_tx_headroom
);
3701 switch (action_code
) {
3702 case WLAN_TDLS_SETUP_REQUEST
:
3703 case WLAN_TDLS_SETUP_RESPONSE
:
3704 case WLAN_TDLS_SETUP_CONFIRM
:
3705 case WLAN_TDLS_TEARDOWN
:
3706 case WLAN_TDLS_DISCOVERY_REQUEST
:
3707 ret
= ieee80211_prep_tdls_encap_data(wiphy
, dev
, peer
,
3708 action_code
, dialog_token
,
3710 send_direct
= false;
3712 case WLAN_PUB_ACTION_TDLS_DISCOVER_RES
:
3713 ret
= ieee80211_prep_tdls_direct(wiphy
, dev
, peer
, action_code
,
3714 dialog_token
, status_code
,
3727 memcpy(skb_put(skb
, extra_ies_len
), extra_ies
, extra_ies_len
);
3729 /* the TDLS link IE is always added last */
3730 switch (action_code
) {
3731 case WLAN_TDLS_SETUP_REQUEST
:
3732 case WLAN_TDLS_SETUP_CONFIRM
:
3733 case WLAN_TDLS_TEARDOWN
:
3734 case WLAN_TDLS_DISCOVERY_REQUEST
:
3735 /* we are the initiator */
3736 ieee80211_tdls_add_link_ie(skb
, sdata
->vif
.addr
, peer
,
3737 sdata
->u
.mgd
.bssid
);
3739 case WLAN_TDLS_SETUP_RESPONSE
:
3740 case WLAN_PUB_ACTION_TDLS_DISCOVER_RES
:
3741 /* we are the responder */
3742 ieee80211_tdls_add_link_ie(skb
, peer
, sdata
->vif
.addr
,
3743 sdata
->u
.mgd
.bssid
);
3751 ieee80211_tx_skb(sdata
, skb
);
3756 * According to 802.11z: Setup req/resp are sent in AC_BK, otherwise
3757 * we should default to AC_VI.
3759 switch (action_code
) {
3760 case WLAN_TDLS_SETUP_REQUEST
:
3761 case WLAN_TDLS_SETUP_RESPONSE
:
3762 skb_set_queue_mapping(skb
, IEEE80211_AC_BK
);
3766 skb_set_queue_mapping(skb
, IEEE80211_AC_VI
);
3771 /* disable bottom halves when entering the Tx path */
3773 ret
= ieee80211_subif_start_xmit(skb
, dev
);
3783 static int ieee80211_tdls_oper(struct wiphy
*wiphy
, struct net_device
*dev
,
3784 u8
*peer
, enum nl80211_tdls_operation oper
)
3786 struct sta_info
*sta
;
3787 struct ieee80211_sub_if_data
*sdata
= IEEE80211_DEV_TO_SUB_IF(dev
);
3789 if (!(wiphy
->flags
& WIPHY_FLAG_SUPPORTS_TDLS
))
3792 if (sdata
->vif
.type
!= NL80211_IFTYPE_STATION
)
3795 tdls_dbg(sdata
, "TDLS oper %d peer %pM\n", oper
, peer
);
3798 case NL80211_TDLS_ENABLE_LINK
:
3800 sta
= sta_info_get(sdata
, peer
);
3806 set_sta_flag(sta
, WLAN_STA_TDLS_PEER_AUTH
);
3809 case NL80211_TDLS_DISABLE_LINK
:
3810 return sta_info_destroy_addr(sdata
, peer
);
3811 case NL80211_TDLS_TEARDOWN
:
3812 case NL80211_TDLS_SETUP
:
3813 case NL80211_TDLS_DISCOVERY_REQ
:
3814 /* We don't support in-driver setup/teardown/discovery */
3823 static int ieee80211_probe_client(struct wiphy
*wiphy
, struct net_device
*dev
,
3824 const u8
*peer
, u64
*cookie
)
3826 struct ieee80211_sub_if_data
*sdata
= IEEE80211_DEV_TO_SUB_IF(dev
);
3827 struct ieee80211_local
*local
= sdata
->local
;
3828 struct ieee80211_qos_hdr
*nullfunc
;
3829 struct sk_buff
*skb
;
3830 int size
= sizeof(*nullfunc
);
3833 struct ieee80211_tx_info
*info
;
3834 struct sta_info
*sta
;
3835 struct ieee80211_chanctx_conf
*chanctx_conf
;
3836 enum ieee80211_band band
;
3839 chanctx_conf
= rcu_dereference(sdata
->vif
.chanctx_conf
);
3840 if (WARN_ON(!chanctx_conf
)) {
3844 band
= chanctx_conf
->def
.chan
->band
;
3845 sta
= sta_info_get_bss(sdata
, peer
);
3847 qos
= test_sta_flag(sta
, WLAN_STA_WME
);
3854 fc
= cpu_to_le16(IEEE80211_FTYPE_DATA
|
3855 IEEE80211_STYPE_QOS_NULLFUNC
|
3856 IEEE80211_FCTL_FROMDS
);
3859 fc
= cpu_to_le16(IEEE80211_FTYPE_DATA
|
3860 IEEE80211_STYPE_NULLFUNC
|
3861 IEEE80211_FCTL_FROMDS
);
3864 skb
= dev_alloc_skb(local
->hw
.extra_tx_headroom
+ size
);
3872 skb_reserve(skb
, local
->hw
.extra_tx_headroom
);
3874 nullfunc
= (void *) skb_put(skb
, size
);
3875 nullfunc
->frame_control
= fc
;
3876 nullfunc
->duration_id
= 0;
3877 memcpy(nullfunc
->addr1
, sta
->sta
.addr
, ETH_ALEN
);
3878 memcpy(nullfunc
->addr2
, sdata
->vif
.addr
, ETH_ALEN
);
3879 memcpy(nullfunc
->addr3
, sdata
->vif
.addr
, ETH_ALEN
);
3880 nullfunc
->seq_ctrl
= 0;
3882 info
= IEEE80211_SKB_CB(skb
);
3884 info
->flags
|= IEEE80211_TX_CTL_REQ_TX_STATUS
|
3885 IEEE80211_TX_INTFL_NL80211_FRAME_TX
;
3887 skb_set_queue_mapping(skb
, IEEE80211_AC_VO
);
3890 nullfunc
->qos_ctrl
= cpu_to_le16(7);
3893 ieee80211_xmit(sdata
, skb
, band
);
3897 *cookie
= (unsigned long) skb
;
3901 static int ieee80211_cfg_get_channel(struct wiphy
*wiphy
,
3902 struct wireless_dev
*wdev
,
3903 struct cfg80211_chan_def
*chandef
)
3905 struct ieee80211_sub_if_data
*sdata
= IEEE80211_WDEV_TO_SUB_IF(wdev
);
3906 struct ieee80211_local
*local
= wiphy_priv(wiphy
);
3907 struct ieee80211_chanctx_conf
*chanctx_conf
;
3911 chanctx_conf
= rcu_dereference(sdata
->vif
.chanctx_conf
);
3913 *chandef
= chanctx_conf
->def
;
3915 } else if (local
->open_count
> 0 &&
3916 local
->open_count
== local
->monitors
&&
3917 sdata
->vif
.type
== NL80211_IFTYPE_MONITOR
) {
3918 if (local
->use_chanctx
)
3919 *chandef
= local
->monitor_chandef
;
3921 *chandef
= local
->_oper_chandef
;
3930 static void ieee80211_set_wakeup(struct wiphy
*wiphy
, bool enabled
)
3932 drv_set_wakeup(wiphy_priv(wiphy
), enabled
);
3936 static int ieee80211_set_qos_map(struct wiphy
*wiphy
,
3937 struct net_device
*dev
,
3938 struct cfg80211_qos_map
*qos_map
)
3940 struct ieee80211_sub_if_data
*sdata
= IEEE80211_DEV_TO_SUB_IF(dev
);
3941 struct mac80211_qos_map
*new_qos_map
, *old_qos_map
;
3944 new_qos_map
= kzalloc(sizeof(*new_qos_map
), GFP_KERNEL
);
3947 memcpy(&new_qos_map
->qos_map
, qos_map
, sizeof(*qos_map
));
3949 /* A NULL qos_map was passed to disable QoS mapping */
3953 old_qos_map
= sdata_dereference(sdata
->qos_map
, sdata
);
3954 rcu_assign_pointer(sdata
->qos_map
, new_qos_map
);
3956 kfree_rcu(old_qos_map
, rcu_head
);
3961 static int ieee80211_set_ap_chanwidth(struct wiphy
*wiphy
,
3962 struct net_device
*dev
,
3963 struct cfg80211_chan_def
*chandef
)
3965 struct ieee80211_sub_if_data
*sdata
= IEEE80211_DEV_TO_SUB_IF(dev
);
3969 ret
= ieee80211_vif_change_bandwidth(sdata
, chandef
, &changed
);
3971 ieee80211_bss_info_change_notify(sdata
, changed
);
3976 const struct cfg80211_ops mac80211_config_ops
= {
3977 .add_virtual_intf
= ieee80211_add_iface
,
3978 .del_virtual_intf
= ieee80211_del_iface
,
3979 .change_virtual_intf
= ieee80211_change_iface
,
3980 .start_p2p_device
= ieee80211_start_p2p_device
,
3981 .stop_p2p_device
= ieee80211_stop_p2p_device
,
3982 .add_key
= ieee80211_add_key
,
3983 .del_key
= ieee80211_del_key
,
3984 .get_key
= ieee80211_get_key
,
3985 .set_default_key
= ieee80211_config_default_key
,
3986 .set_default_mgmt_key
= ieee80211_config_default_mgmt_key
,
3987 .start_ap
= ieee80211_start_ap
,
3988 .change_beacon
= ieee80211_change_beacon
,
3989 .stop_ap
= ieee80211_stop_ap
,
3990 .add_station
= ieee80211_add_station
,
3991 .del_station
= ieee80211_del_station
,
3992 .change_station
= ieee80211_change_station
,
3993 .get_station
= ieee80211_get_station
,
3994 .dump_station
= ieee80211_dump_station
,
3995 .dump_survey
= ieee80211_dump_survey
,
3996 #ifdef CONFIG_MAC80211_MESH
3997 .add_mpath
= ieee80211_add_mpath
,
3998 .del_mpath
= ieee80211_del_mpath
,
3999 .change_mpath
= ieee80211_change_mpath
,
4000 .get_mpath
= ieee80211_get_mpath
,
4001 .dump_mpath
= ieee80211_dump_mpath
,
4002 .update_mesh_config
= ieee80211_update_mesh_config
,
4003 .get_mesh_config
= ieee80211_get_mesh_config
,
4004 .join_mesh
= ieee80211_join_mesh
,
4005 .leave_mesh
= ieee80211_leave_mesh
,
4007 .change_bss
= ieee80211_change_bss
,
4008 .set_txq_params
= ieee80211_set_txq_params
,
4009 .set_monitor_channel
= ieee80211_set_monitor_channel
,
4010 .suspend
= ieee80211_suspend
,
4011 .resume
= ieee80211_resume
,
4012 .scan
= ieee80211_scan
,
4013 .sched_scan_start
= ieee80211_sched_scan_start
,
4014 .sched_scan_stop
= ieee80211_sched_scan_stop
,
4015 .auth
= ieee80211_auth
,
4016 .assoc
= ieee80211_assoc
,
4017 .deauth
= ieee80211_deauth
,
4018 .disassoc
= ieee80211_disassoc
,
4019 .join_ibss
= ieee80211_join_ibss
,
4020 .leave_ibss
= ieee80211_leave_ibss
,
4021 .set_mcast_rate
= ieee80211_set_mcast_rate
,
4022 .set_wiphy_params
= ieee80211_set_wiphy_params
,
4023 .set_tx_power
= ieee80211_set_tx_power
,
4024 .get_tx_power
= ieee80211_get_tx_power
,
4025 .set_wds_peer
= ieee80211_set_wds_peer
,
4026 .rfkill_poll
= ieee80211_rfkill_poll
,
4027 CFG80211_TESTMODE_CMD(ieee80211_testmode_cmd
)
4028 CFG80211_TESTMODE_DUMP(ieee80211_testmode_dump
)
4029 .set_power_mgmt
= ieee80211_set_power_mgmt
,
4030 .set_bitrate_mask
= ieee80211_set_bitrate_mask
,
4031 .remain_on_channel
= ieee80211_remain_on_channel
,
4032 .cancel_remain_on_channel
= ieee80211_cancel_remain_on_channel
,
4033 .mgmt_tx
= ieee80211_mgmt_tx
,
4034 .mgmt_tx_cancel_wait
= ieee80211_mgmt_tx_cancel_wait
,
4035 .set_cqm_rssi_config
= ieee80211_set_cqm_rssi_config
,
4036 .mgmt_frame_register
= ieee80211_mgmt_frame_register
,
4037 .set_antenna
= ieee80211_set_antenna
,
4038 .get_antenna
= ieee80211_get_antenna
,
4039 .set_ringparam
= ieee80211_set_ringparam
,
4040 .get_ringparam
= ieee80211_get_ringparam
,
4041 .set_rekey_data
= ieee80211_set_rekey_data
,
4042 .tdls_oper
= ieee80211_tdls_oper
,
4043 .tdls_mgmt
= ieee80211_tdls_mgmt
,
4044 .probe_client
= ieee80211_probe_client
,
4045 .set_noack_map
= ieee80211_set_noack_map
,
4047 .set_wakeup
= ieee80211_set_wakeup
,
4049 .get_et_sset_count
= ieee80211_get_et_sset_count
,
4050 .get_et_stats
= ieee80211_get_et_stats
,
4051 .get_et_strings
= ieee80211_get_et_strings
,
4052 .get_channel
= ieee80211_cfg_get_channel
,
4053 .start_radar_detection
= ieee80211_start_radar_detection
,
4054 .channel_switch
= ieee80211_channel_switch
,
4055 .set_qos_map
= ieee80211_set_qos_map
,
4056 .set_ap_chanwidth
= ieee80211_set_ap_chanwidth
,