1 // SPDX-License-Identifier: GPL-2.0-only
3 * mac80211 configuration hooks for cfg80211
5 * Copyright 2006-2010 Johannes Berg <johannes@sipsolutions.net>
6 * Copyright 2013-2015 Intel Mobile Communications GmbH
7 * Copyright (C) 2015-2017 Intel Deutschland GmbH
8 * Copyright (C) 2018-2024 Intel Corporation
11 #include <linux/ieee80211.h>
12 #include <linux/nl80211.h>
13 #include <linux/rtnetlink.h>
14 #include <linux/slab.h>
15 #include <net/net_namespace.h>
16 #include <linux/rcupdate.h>
17 #include <linux/fips.h>
18 #include <linux/if_ether.h>
19 #include <net/cfg80211.h>
20 #include "ieee80211_i.h"
21 #include "driver-ops.h"
26 static struct ieee80211_link_data
*
27 ieee80211_link_or_deflink(struct ieee80211_sub_if_data
*sdata
, int link_id
,
30 struct ieee80211_link_data
*link
;
34 * For keys, if sdata is not an MLD, we might not use
35 * the return value at all (if it's not a pairwise key),
36 * so in that case (require_valid==false) don't error.
38 if (require_valid
&& ieee80211_vif_is_mld(&sdata
->vif
))
39 return ERR_PTR(-EINVAL
);
41 return &sdata
->deflink
;
44 link
= sdata_dereference(sdata
->link
[link_id
], sdata
);
46 return ERR_PTR(-ENOLINK
);
50 static void ieee80211_set_mu_mimo_follow(struct ieee80211_sub_if_data
*sdata
,
51 struct vif_params
*params
)
53 bool mu_mimo_groups
= false;
54 bool mu_mimo_follow
= false;
56 if (params
->vht_mumimo_groups
) {
59 BUILD_BUG_ON(sizeof(membership
) != WLAN_MEMBERSHIP_LEN
);
61 memcpy(sdata
->vif
.bss_conf
.mu_group
.membership
,
62 params
->vht_mumimo_groups
, WLAN_MEMBERSHIP_LEN
);
63 memcpy(sdata
->vif
.bss_conf
.mu_group
.position
,
64 params
->vht_mumimo_groups
+ WLAN_MEMBERSHIP_LEN
,
65 WLAN_USER_POSITION_LEN
);
66 ieee80211_link_info_change_notify(sdata
, &sdata
->deflink
,
67 BSS_CHANGED_MU_GROUPS
);
68 /* don't care about endianness - just check for 0 */
69 memcpy(&membership
, params
->vht_mumimo_groups
,
71 mu_mimo_groups
= membership
!= 0;
74 if (params
->vht_mumimo_follow_addr
) {
76 is_valid_ether_addr(params
->vht_mumimo_follow_addr
);
77 ether_addr_copy(sdata
->u
.mntr
.mu_follow_addr
,
78 params
->vht_mumimo_follow_addr
);
81 sdata
->vif
.bss_conf
.mu_mimo_owner
= mu_mimo_groups
|| mu_mimo_follow
;
84 static int ieee80211_set_mon_options(struct ieee80211_sub_if_data
*sdata
,
85 struct vif_params
*params
)
87 struct ieee80211_local
*local
= sdata
->local
;
88 struct ieee80211_sub_if_data
*monitor_sdata
;
90 /* check flags first */
91 if (params
->flags
&& ieee80211_sdata_running(sdata
)) {
92 u32 mask
= MONITOR_FLAG_COOK_FRAMES
| MONITOR_FLAG_ACTIVE
;
95 * Prohibit MONITOR_FLAG_COOK_FRAMES and
96 * MONITOR_FLAG_ACTIVE to be changed while the
98 * Else we would need to add a lot of cruft
99 * to update everything:
100 * cooked_mntrs, monitor and all fif_* counters
101 * reconfigure hardware
103 if ((params
->flags
& mask
) != (sdata
->u
.mntr
.flags
& mask
))
107 /* also validate MU-MIMO change */
108 if (ieee80211_hw_check(&local
->hw
, NO_VIRTUAL_MONITOR
))
109 monitor_sdata
= sdata
;
111 monitor_sdata
= wiphy_dereference(local
->hw
.wiphy
,
112 local
->monitor_sdata
);
114 if (!monitor_sdata
&&
115 (params
->vht_mumimo_groups
|| params
->vht_mumimo_follow_addr
))
118 /* apply all changes now - no failures allowed */
121 (ieee80211_hw_check(&local
->hw
, WANT_MONITOR_VIF
) ||
122 ieee80211_hw_check(&local
->hw
, NO_VIRTUAL_MONITOR
)))
123 ieee80211_set_mu_mimo_follow(monitor_sdata
, params
);
126 if (ieee80211_sdata_running(sdata
)) {
127 ieee80211_adjust_monitor_flags(sdata
, -1);
128 sdata
->u
.mntr
.flags
= params
->flags
;
129 ieee80211_adjust_monitor_flags(sdata
, 1);
131 ieee80211_configure_filter(local
);
134 * Because the interface is down, ieee80211_do_stop
135 * and ieee80211_do_open take care of "everything"
136 * mentioned in the comment above.
138 sdata
->u
.mntr
.flags
= params
->flags
;
145 static int ieee80211_set_ap_mbssid_options(struct ieee80211_sub_if_data
*sdata
,
146 struct cfg80211_mbssid_config
*params
,
147 struct ieee80211_bss_conf
*link_conf
)
149 struct ieee80211_sub_if_data
*tx_sdata
;
151 sdata
->vif
.mbssid_tx_vif
= NULL
;
152 link_conf
->bssid_index
= 0;
153 link_conf
->nontransmitted
= false;
154 link_conf
->ema_ap
= false;
155 link_conf
->bssid_indicator
= 0;
157 if (sdata
->vif
.type
!= NL80211_IFTYPE_AP
|| !params
->tx_wdev
)
160 tx_sdata
= IEEE80211_WDEV_TO_SUB_IF(params
->tx_wdev
);
164 if (tx_sdata
== sdata
) {
165 sdata
->vif
.mbssid_tx_vif
= &sdata
->vif
;
167 sdata
->vif
.mbssid_tx_vif
= &tx_sdata
->vif
;
168 link_conf
->nontransmitted
= true;
169 link_conf
->bssid_index
= params
->index
;
172 link_conf
->ema_ap
= true;
177 static struct wireless_dev
*ieee80211_add_iface(struct wiphy
*wiphy
,
179 unsigned char name_assign_type
,
180 enum nl80211_iftype type
,
181 struct vif_params
*params
)
183 struct ieee80211_local
*local
= wiphy_priv(wiphy
);
184 struct wireless_dev
*wdev
;
185 struct ieee80211_sub_if_data
*sdata
;
188 err
= ieee80211_if_add(local
, name
, name_assign_type
, &wdev
, type
, params
);
192 sdata
= IEEE80211_WDEV_TO_SUB_IF(wdev
);
194 if (type
== NL80211_IFTYPE_MONITOR
) {
195 err
= ieee80211_set_mon_options(sdata
, params
);
197 ieee80211_if_remove(sdata
);
202 /* Let the driver know that an interface is going to be added.
203 * Indicate so only for interface types that will be added to the
207 case NL80211_IFTYPE_AP_VLAN
:
209 case NL80211_IFTYPE_MONITOR
:
210 if (!ieee80211_hw_check(&local
->hw
, WANT_MONITOR_VIF
) ||
211 !(params
->flags
& MONITOR_FLAG_ACTIVE
))
215 drv_prep_add_interface(local
,
216 ieee80211_vif_type_p2p(&sdata
->vif
));
223 static int ieee80211_del_iface(struct wiphy
*wiphy
, struct wireless_dev
*wdev
)
225 ieee80211_if_remove(IEEE80211_WDEV_TO_SUB_IF(wdev
));
230 static int ieee80211_change_iface(struct wiphy
*wiphy
,
231 struct net_device
*dev
,
232 enum nl80211_iftype type
,
233 struct vif_params
*params
)
235 struct ieee80211_sub_if_data
*sdata
= IEEE80211_DEV_TO_SUB_IF(dev
);
236 struct ieee80211_local
*local
= sdata
->local
;
237 struct sta_info
*sta
;
240 lockdep_assert_wiphy(local
->hw
.wiphy
);
242 ret
= ieee80211_if_change_type(sdata
, type
);
246 if (type
== NL80211_IFTYPE_AP_VLAN
&& params
->use_4addr
== 0) {
247 RCU_INIT_POINTER(sdata
->u
.vlan
.sta
, NULL
);
248 ieee80211_check_fast_rx_iface(sdata
);
249 } else if (type
== NL80211_IFTYPE_STATION
&& params
->use_4addr
>= 0) {
250 struct ieee80211_if_managed
*ifmgd
= &sdata
->u
.mgd
;
252 if (params
->use_4addr
== ifmgd
->use_4addr
)
255 /* FIXME: no support for 4-addr MLO yet */
256 if (ieee80211_vif_is_mld(&sdata
->vif
))
259 sdata
->u
.mgd
.use_4addr
= params
->use_4addr
;
260 if (!ifmgd
->associated
)
263 sta
= sta_info_get(sdata
, sdata
->deflink
.u
.mgd
.bssid
);
265 drv_sta_set_4addr(local
, sdata
, &sta
->sta
,
268 if (params
->use_4addr
)
269 ieee80211_send_4addr_nullfunc(local
, sdata
);
272 if (sdata
->vif
.type
== NL80211_IFTYPE_MONITOR
) {
273 ret
= ieee80211_set_mon_options(sdata
, params
);
281 static int ieee80211_start_p2p_device(struct wiphy
*wiphy
,
282 struct wireless_dev
*wdev
)
284 struct ieee80211_sub_if_data
*sdata
= IEEE80211_WDEV_TO_SUB_IF(wdev
);
287 lockdep_assert_wiphy(sdata
->local
->hw
.wiphy
);
289 ret
= ieee80211_check_combinations(sdata
, NULL
, 0, 0, -1);
293 return ieee80211_do_open(wdev
, true);
296 static void ieee80211_stop_p2p_device(struct wiphy
*wiphy
,
297 struct wireless_dev
*wdev
)
299 ieee80211_sdata_stop(IEEE80211_WDEV_TO_SUB_IF(wdev
));
302 static int ieee80211_start_nan(struct wiphy
*wiphy
,
303 struct wireless_dev
*wdev
,
304 struct cfg80211_nan_conf
*conf
)
306 struct ieee80211_sub_if_data
*sdata
= IEEE80211_WDEV_TO_SUB_IF(wdev
);
309 lockdep_assert_wiphy(sdata
->local
->hw
.wiphy
);
311 ret
= ieee80211_check_combinations(sdata
, NULL
, 0, 0, -1);
315 ret
= ieee80211_do_open(wdev
, true);
319 ret
= drv_start_nan(sdata
->local
, sdata
, conf
);
321 ieee80211_sdata_stop(sdata
);
323 sdata
->u
.nan
.conf
= *conf
;
328 static void ieee80211_stop_nan(struct wiphy
*wiphy
,
329 struct wireless_dev
*wdev
)
331 struct ieee80211_sub_if_data
*sdata
= IEEE80211_WDEV_TO_SUB_IF(wdev
);
333 drv_stop_nan(sdata
->local
, sdata
);
334 ieee80211_sdata_stop(sdata
);
337 static int ieee80211_nan_change_conf(struct wiphy
*wiphy
,
338 struct wireless_dev
*wdev
,
339 struct cfg80211_nan_conf
*conf
,
342 struct ieee80211_sub_if_data
*sdata
= IEEE80211_WDEV_TO_SUB_IF(wdev
);
343 struct cfg80211_nan_conf new_conf
;
346 if (sdata
->vif
.type
!= NL80211_IFTYPE_NAN
)
349 if (!ieee80211_sdata_running(sdata
))
352 new_conf
= sdata
->u
.nan
.conf
;
354 if (changes
& CFG80211_NAN_CONF_CHANGED_PREF
)
355 new_conf
.master_pref
= conf
->master_pref
;
357 if (changes
& CFG80211_NAN_CONF_CHANGED_BANDS
)
358 new_conf
.bands
= conf
->bands
;
360 ret
= drv_nan_change_conf(sdata
->local
, sdata
, &new_conf
, changes
);
362 sdata
->u
.nan
.conf
= new_conf
;
367 static int ieee80211_add_nan_func(struct wiphy
*wiphy
,
368 struct wireless_dev
*wdev
,
369 struct cfg80211_nan_func
*nan_func
)
371 struct ieee80211_sub_if_data
*sdata
= IEEE80211_WDEV_TO_SUB_IF(wdev
);
374 if (sdata
->vif
.type
!= NL80211_IFTYPE_NAN
)
377 if (!ieee80211_sdata_running(sdata
))
380 spin_lock_bh(&sdata
->u
.nan
.func_lock
);
382 ret
= idr_alloc(&sdata
->u
.nan
.function_inst_ids
,
383 nan_func
, 1, sdata
->local
->hw
.max_nan_de_entries
+ 1,
385 spin_unlock_bh(&sdata
->u
.nan
.func_lock
);
390 nan_func
->instance_id
= ret
;
392 WARN_ON(nan_func
->instance_id
== 0);
394 ret
= drv_add_nan_func(sdata
->local
, sdata
, nan_func
);
396 spin_lock_bh(&sdata
->u
.nan
.func_lock
);
397 idr_remove(&sdata
->u
.nan
.function_inst_ids
,
398 nan_func
->instance_id
);
399 spin_unlock_bh(&sdata
->u
.nan
.func_lock
);
405 static struct cfg80211_nan_func
*
406 ieee80211_find_nan_func_by_cookie(struct ieee80211_sub_if_data
*sdata
,
409 struct cfg80211_nan_func
*func
;
412 lockdep_assert_held(&sdata
->u
.nan
.func_lock
);
414 idr_for_each_entry(&sdata
->u
.nan
.function_inst_ids
, func
, id
) {
415 if (func
->cookie
== cookie
)
422 static void ieee80211_del_nan_func(struct wiphy
*wiphy
,
423 struct wireless_dev
*wdev
, u64 cookie
)
425 struct ieee80211_sub_if_data
*sdata
= IEEE80211_WDEV_TO_SUB_IF(wdev
);
426 struct cfg80211_nan_func
*func
;
429 if (sdata
->vif
.type
!= NL80211_IFTYPE_NAN
||
430 !ieee80211_sdata_running(sdata
))
433 spin_lock_bh(&sdata
->u
.nan
.func_lock
);
435 func
= ieee80211_find_nan_func_by_cookie(sdata
, cookie
);
437 instance_id
= func
->instance_id
;
439 spin_unlock_bh(&sdata
->u
.nan
.func_lock
);
442 drv_del_nan_func(sdata
->local
, sdata
, instance_id
);
445 static int ieee80211_set_noack_map(struct wiphy
*wiphy
,
446 struct net_device
*dev
,
449 struct ieee80211_sub_if_data
*sdata
= IEEE80211_DEV_TO_SUB_IF(dev
);
451 sdata
->noack_map
= noack_map
;
453 ieee80211_check_fast_xmit_iface(sdata
);
458 static int ieee80211_set_tx(struct ieee80211_sub_if_data
*sdata
,
459 const u8
*mac_addr
, u8 key_idx
)
461 struct ieee80211_local
*local
= sdata
->local
;
462 struct ieee80211_key
*key
;
463 struct sta_info
*sta
;
466 if (!wiphy_ext_feature_isset(local
->hw
.wiphy
,
467 NL80211_EXT_FEATURE_EXT_KEY_ID
))
470 sta
= sta_info_get_bss(sdata
, mac_addr
);
475 if (sta
->ptk_idx
== key_idx
)
478 key
= wiphy_dereference(local
->hw
.wiphy
, sta
->ptk
[key_idx
]);
480 if (key
&& key
->conf
.flags
& IEEE80211_KEY_FLAG_NO_AUTO_TX
)
481 ret
= ieee80211_set_tx_key(key
);
486 static int ieee80211_add_key(struct wiphy
*wiphy
, struct net_device
*dev
,
487 int link_id
, u8 key_idx
, bool pairwise
,
488 const u8
*mac_addr
, struct key_params
*params
)
490 struct ieee80211_sub_if_data
*sdata
= IEEE80211_DEV_TO_SUB_IF(dev
);
491 struct ieee80211_link_data
*link
=
492 ieee80211_link_or_deflink(sdata
, link_id
, false);
493 struct ieee80211_local
*local
= sdata
->local
;
494 struct sta_info
*sta
= NULL
;
495 struct ieee80211_key
*key
;
498 lockdep_assert_wiphy(local
->hw
.wiphy
);
500 if (!ieee80211_sdata_running(sdata
))
504 return PTR_ERR(link
);
506 if (WARN_ON(pairwise
&& link_id
>= 0))
509 if (pairwise
&& params
->mode
== NL80211_KEY_SET_TX
)
510 return ieee80211_set_tx(sdata
, mac_addr
, key_idx
);
512 /* reject WEP and TKIP keys if WEP failed to initialize */
513 switch (params
->cipher
) {
514 case WLAN_CIPHER_SUITE_WEP40
:
515 case WLAN_CIPHER_SUITE_TKIP
:
516 case WLAN_CIPHER_SUITE_WEP104
:
519 if (WARN_ON_ONCE(fips_enabled
))
526 key
= ieee80211_key_alloc(params
->cipher
, key_idx
, params
->key_len
,
527 params
->key
, params
->seq_len
, params
->seq
);
532 key
->conf
.flags
|= IEEE80211_KEY_FLAG_PAIRWISE
;
533 key
->conf
.link_id
= -1;
535 key
->conf
.link_id
= link
->link_id
;
538 if (params
->mode
== NL80211_KEY_NO_TX
)
539 key
->conf
.flags
|= IEEE80211_KEY_FLAG_NO_AUTO_TX
;
542 sta
= sta_info_get_bss(sdata
, mac_addr
);
544 * The ASSOC test makes sure the driver is ready to
545 * receive the key. When wpa_supplicant has roamed
546 * using FT, it attempts to set the key before
547 * association has completed, this rejects that attempt
548 * so it will set the key again after association.
550 * TODO: accept the key if we have a station entry and
551 * add it to the device after the station.
553 if (!sta
|| !test_sta_flag(sta
, WLAN_STA_ASSOC
)) {
554 ieee80211_key_free_unused(key
);
559 switch (sdata
->vif
.type
) {
560 case NL80211_IFTYPE_STATION
:
561 if (sdata
->u
.mgd
.mfp
!= IEEE80211_MFP_DISABLED
)
562 key
->conf
.flags
|= IEEE80211_KEY_FLAG_RX_MGMT
;
564 case NL80211_IFTYPE_AP
:
565 case NL80211_IFTYPE_AP_VLAN
:
566 /* Keys without a station are used for TX only */
567 if (sta
&& test_sta_flag(sta
, WLAN_STA_MFP
))
568 key
->conf
.flags
|= IEEE80211_KEY_FLAG_RX_MGMT
;
570 case NL80211_IFTYPE_ADHOC
:
573 case NL80211_IFTYPE_MESH_POINT
:
574 #ifdef CONFIG_MAC80211_MESH
575 if (sdata
->u
.mesh
.security
!= IEEE80211_MESH_SEC_NONE
)
576 key
->conf
.flags
|= IEEE80211_KEY_FLAG_RX_MGMT
;
579 case NL80211_IFTYPE_WDS
:
580 case NL80211_IFTYPE_MONITOR
:
581 case NL80211_IFTYPE_P2P_DEVICE
:
582 case NL80211_IFTYPE_NAN
:
583 case NL80211_IFTYPE_UNSPECIFIED
:
584 case NUM_NL80211_IFTYPES
:
585 case NL80211_IFTYPE_P2P_CLIENT
:
586 case NL80211_IFTYPE_P2P_GO
:
587 case NL80211_IFTYPE_OCB
:
588 /* shouldn't happen */
593 err
= ieee80211_key_link(key
, link
, sta
);
594 /* KRACK protection, shouldn't happen but just silently accept key */
595 if (err
== -EALREADY
)
601 static struct ieee80211_key
*
602 ieee80211_lookup_key(struct ieee80211_sub_if_data
*sdata
, int link_id
,
603 u8 key_idx
, bool pairwise
, const u8
*mac_addr
)
605 struct ieee80211_local
*local __maybe_unused
= sdata
->local
;
606 struct ieee80211_link_data
*link
= &sdata
->deflink
;
607 struct ieee80211_key
*key
;
610 link
= sdata_dereference(sdata
->link
[link_id
], sdata
);
616 struct sta_info
*sta
;
617 struct link_sta_info
*link_sta
;
619 sta
= sta_info_get_bss(sdata
, mac_addr
);
624 link_sta
= rcu_dereference_check(sta
->link
[link_id
],
625 lockdep_is_held(&local
->hw
.wiphy
->mtx
));
629 link_sta
= &sta
->deflink
;
632 if (pairwise
&& key_idx
< NUM_DEFAULT_KEYS
)
633 return wiphy_dereference(local
->hw
.wiphy
,
637 key_idx
< NUM_DEFAULT_KEYS
+
638 NUM_DEFAULT_MGMT_KEYS
+
639 NUM_DEFAULT_BEACON_KEYS
)
640 return wiphy_dereference(local
->hw
.wiphy
,
641 link_sta
->gtk
[key_idx
]);
646 if (pairwise
&& key_idx
< NUM_DEFAULT_KEYS
)
647 return wiphy_dereference(local
->hw
.wiphy
, sdata
->keys
[key_idx
]);
649 key
= wiphy_dereference(local
->hw
.wiphy
, link
->gtk
[key_idx
]);
653 /* or maybe it was a WEP key */
654 if (key_idx
< NUM_DEFAULT_KEYS
)
655 return wiphy_dereference(local
->hw
.wiphy
, sdata
->keys
[key_idx
]);
660 static int ieee80211_del_key(struct wiphy
*wiphy
, struct net_device
*dev
,
661 int link_id
, u8 key_idx
, bool pairwise
,
664 struct ieee80211_sub_if_data
*sdata
= IEEE80211_DEV_TO_SUB_IF(dev
);
665 struct ieee80211_local
*local
= sdata
->local
;
666 struct ieee80211_key
*key
;
668 lockdep_assert_wiphy(local
->hw
.wiphy
);
670 key
= ieee80211_lookup_key(sdata
, link_id
, key_idx
, pairwise
, mac_addr
);
674 ieee80211_key_free(key
, sdata
->vif
.type
== NL80211_IFTYPE_STATION
);
679 static int ieee80211_get_key(struct wiphy
*wiphy
, struct net_device
*dev
,
680 int link_id
, u8 key_idx
, bool pairwise
,
681 const u8
*mac_addr
, void *cookie
,
682 void (*callback
)(void *cookie
,
683 struct key_params
*params
))
685 struct ieee80211_sub_if_data
*sdata
;
687 struct key_params params
;
688 struct ieee80211_key
*key
;
693 struct ieee80211_key_seq kseq
= {};
695 sdata
= IEEE80211_DEV_TO_SUB_IF(dev
);
699 key
= ieee80211_lookup_key(sdata
, link_id
, key_idx
, pairwise
, mac_addr
);
703 memset(¶ms
, 0, sizeof(params
));
705 params
.cipher
= key
->conf
.cipher
;
707 switch (key
->conf
.cipher
) {
708 case WLAN_CIPHER_SUITE_TKIP
:
709 pn64
= atomic64_read(&key
->conf
.tx_pn
);
710 iv32
= TKIP_PN_TO_IV32(pn64
);
711 iv16
= TKIP_PN_TO_IV16(pn64
);
713 if (key
->flags
& KEY_FLAG_UPLOADED_TO_HARDWARE
&&
714 !(key
->conf
.flags
& IEEE80211_KEY_FLAG_GENERATE_IV
)) {
715 drv_get_key_seq(sdata
->local
, key
, &kseq
);
716 iv32
= kseq
.tkip
.iv32
;
717 iv16
= kseq
.tkip
.iv16
;
720 seq
[0] = iv16
& 0xff;
721 seq
[1] = (iv16
>> 8) & 0xff;
722 seq
[2] = iv32
& 0xff;
723 seq
[3] = (iv32
>> 8) & 0xff;
724 seq
[4] = (iv32
>> 16) & 0xff;
725 seq
[5] = (iv32
>> 24) & 0xff;
729 case WLAN_CIPHER_SUITE_CCMP
:
730 case WLAN_CIPHER_SUITE_CCMP_256
:
731 case WLAN_CIPHER_SUITE_AES_CMAC
:
732 case WLAN_CIPHER_SUITE_BIP_CMAC_256
:
733 BUILD_BUG_ON(offsetof(typeof(kseq
), ccmp
) !=
734 offsetof(typeof(kseq
), aes_cmac
));
736 case WLAN_CIPHER_SUITE_BIP_GMAC_128
:
737 case WLAN_CIPHER_SUITE_BIP_GMAC_256
:
738 BUILD_BUG_ON(offsetof(typeof(kseq
), ccmp
) !=
739 offsetof(typeof(kseq
), aes_gmac
));
741 case WLAN_CIPHER_SUITE_GCMP
:
742 case WLAN_CIPHER_SUITE_GCMP_256
:
743 BUILD_BUG_ON(offsetof(typeof(kseq
), ccmp
) !=
744 offsetof(typeof(kseq
), gcmp
));
746 if (key
->flags
& KEY_FLAG_UPLOADED_TO_HARDWARE
&&
747 !(key
->conf
.flags
& IEEE80211_KEY_FLAG_GENERATE_IV
)) {
748 drv_get_key_seq(sdata
->local
, key
, &kseq
);
749 memcpy(seq
, kseq
.ccmp
.pn
, 6);
751 pn64
= atomic64_read(&key
->conf
.tx_pn
);
763 if (!(key
->flags
& KEY_FLAG_UPLOADED_TO_HARDWARE
))
765 if (WARN_ON(key
->conf
.flags
& IEEE80211_KEY_FLAG_GENERATE_IV
))
767 drv_get_key_seq(sdata
->local
, key
, &kseq
);
768 params
.seq
= kseq
.hw
.seq
;
769 params
.seq_len
= kseq
.hw
.seq_len
;
773 callback(cookie
, ¶ms
);
781 static int ieee80211_config_default_key(struct wiphy
*wiphy
,
782 struct net_device
*dev
,
783 int link_id
, u8 key_idx
, bool uni
,
786 struct ieee80211_sub_if_data
*sdata
= IEEE80211_DEV_TO_SUB_IF(dev
);
787 struct ieee80211_link_data
*link
=
788 ieee80211_link_or_deflink(sdata
, link_id
, false);
791 return PTR_ERR(link
);
793 ieee80211_set_default_key(link
, key_idx
, uni
, multi
);
798 static int ieee80211_config_default_mgmt_key(struct wiphy
*wiphy
,
799 struct net_device
*dev
,
800 int link_id
, u8 key_idx
)
802 struct ieee80211_sub_if_data
*sdata
= IEEE80211_DEV_TO_SUB_IF(dev
);
803 struct ieee80211_link_data
*link
=
804 ieee80211_link_or_deflink(sdata
, link_id
, true);
807 return PTR_ERR(link
);
809 ieee80211_set_default_mgmt_key(link
, key_idx
);
814 static int ieee80211_config_default_beacon_key(struct wiphy
*wiphy
,
815 struct net_device
*dev
,
816 int link_id
, u8 key_idx
)
818 struct ieee80211_sub_if_data
*sdata
= IEEE80211_DEV_TO_SUB_IF(dev
);
819 struct ieee80211_link_data
*link
=
820 ieee80211_link_or_deflink(sdata
, link_id
, true);
823 return PTR_ERR(link
);
825 ieee80211_set_default_beacon_key(link
, key_idx
);
830 void sta_set_rate_info_tx(struct sta_info
*sta
,
831 const struct ieee80211_tx_rate
*rate
,
832 struct rate_info
*rinfo
)
835 if (rate
->flags
& IEEE80211_TX_RC_MCS
) {
836 rinfo
->flags
|= RATE_INFO_FLAGS_MCS
;
837 rinfo
->mcs
= rate
->idx
;
838 } else if (rate
->flags
& IEEE80211_TX_RC_VHT_MCS
) {
839 rinfo
->flags
|= RATE_INFO_FLAGS_VHT_MCS
;
840 rinfo
->mcs
= ieee80211_rate_get_vht_mcs(rate
);
841 rinfo
->nss
= ieee80211_rate_get_vht_nss(rate
);
843 struct ieee80211_supported_band
*sband
;
845 sband
= ieee80211_get_sband(sta
->sdata
);
846 WARN_ON_ONCE(sband
&& !sband
->bitrates
);
847 if (sband
&& sband
->bitrates
)
848 rinfo
->legacy
= sband
->bitrates
[rate
->idx
].bitrate
;
850 if (rate
->flags
& IEEE80211_TX_RC_40_MHZ_WIDTH
)
851 rinfo
->bw
= RATE_INFO_BW_40
;
852 else if (rate
->flags
& IEEE80211_TX_RC_80_MHZ_WIDTH
)
853 rinfo
->bw
= RATE_INFO_BW_80
;
854 else if (rate
->flags
& IEEE80211_TX_RC_160_MHZ_WIDTH
)
855 rinfo
->bw
= RATE_INFO_BW_160
;
857 rinfo
->bw
= RATE_INFO_BW_20
;
858 if (rate
->flags
& IEEE80211_TX_RC_SHORT_GI
)
859 rinfo
->flags
|= RATE_INFO_FLAGS_SHORT_GI
;
862 static int ieee80211_dump_station(struct wiphy
*wiphy
, struct net_device
*dev
,
863 int idx
, u8
*mac
, struct station_info
*sinfo
)
865 struct ieee80211_sub_if_data
*sdata
= IEEE80211_DEV_TO_SUB_IF(dev
);
866 struct ieee80211_local
*local
= sdata
->local
;
867 struct sta_info
*sta
;
870 lockdep_assert_wiphy(local
->hw
.wiphy
);
872 sta
= sta_info_get_by_idx(sdata
, idx
);
875 memcpy(mac
, sta
->sta
.addr
, ETH_ALEN
);
876 sta_set_sinfo(sta
, sinfo
, true);
882 static int ieee80211_dump_survey(struct wiphy
*wiphy
, struct net_device
*dev
,
883 int idx
, struct survey_info
*survey
)
885 struct ieee80211_local
*local
= wdev_priv(dev
->ieee80211_ptr
);
887 return drv_get_survey(local
, idx
, survey
);
890 static int ieee80211_get_station(struct wiphy
*wiphy
, struct net_device
*dev
,
891 const u8
*mac
, struct station_info
*sinfo
)
893 struct ieee80211_sub_if_data
*sdata
= IEEE80211_DEV_TO_SUB_IF(dev
);
894 struct ieee80211_local
*local
= sdata
->local
;
895 struct sta_info
*sta
;
898 lockdep_assert_wiphy(local
->hw
.wiphy
);
900 sta
= sta_info_get_bss(sdata
, mac
);
903 sta_set_sinfo(sta
, sinfo
, true);
909 static int ieee80211_set_monitor_channel(struct wiphy
*wiphy
,
910 struct net_device
*dev
,
911 struct cfg80211_chan_def
*chandef
)
913 struct ieee80211_local
*local
= wiphy_priv(wiphy
);
914 struct ieee80211_sub_if_data
*sdata
;
915 struct ieee80211_chan_req chanreq
= { .oper
= *chandef
};
918 lockdep_assert_wiphy(local
->hw
.wiphy
);
920 sdata
= IEEE80211_DEV_TO_SUB_IF(dev
);
921 if (!ieee80211_hw_check(&local
->hw
, NO_VIRTUAL_MONITOR
)) {
922 if (cfg80211_chandef_identical(&local
->monitor_chanreq
.oper
,
926 sdata
= wiphy_dereference(wiphy
, local
->monitor_sdata
);
931 if (rcu_access_pointer(sdata
->deflink
.conf
->chanctx_conf
) &&
932 cfg80211_chandef_identical(&sdata
->vif
.bss_conf
.chanreq
.oper
,
936 ieee80211_link_release_channel(&sdata
->deflink
);
937 ret
= ieee80211_link_use_channel(&sdata
->deflink
, &chanreq
,
938 IEEE80211_CHANCTX_SHARED
);
942 local
->monitor_chanreq
= chanreq
;
947 ieee80211_set_probe_resp(struct ieee80211_sub_if_data
*sdata
,
948 const u8
*resp
, size_t resp_len
,
949 const struct ieee80211_csa_settings
*csa
,
950 const struct ieee80211_color_change_settings
*cca
,
951 struct ieee80211_link_data
*link
)
953 struct probe_resp
*new, *old
;
955 if (!resp
|| !resp_len
)
958 old
= sdata_dereference(link
->u
.ap
.probe_resp
, sdata
);
960 new = kzalloc(sizeof(struct probe_resp
) + resp_len
, GFP_KERNEL
);
965 memcpy(new->data
, resp
, resp_len
);
968 memcpy(new->cntdwn_counter_offsets
, csa
->counter_offsets_presp
,
969 csa
->n_counter_offsets_presp
*
970 sizeof(new->cntdwn_counter_offsets
[0]));
972 new->cntdwn_counter_offsets
[0] = cca
->counter_offset_presp
;
974 rcu_assign_pointer(link
->u
.ap
.probe_resp
, new);
976 kfree_rcu(old
, rcu_head
);
981 static int ieee80211_set_fils_discovery(struct ieee80211_sub_if_data
*sdata
,
982 struct cfg80211_fils_discovery
*params
,
983 struct ieee80211_link_data
*link
,
984 struct ieee80211_bss_conf
*link_conf
,
987 struct fils_discovery_data
*new, *old
= NULL
;
988 struct ieee80211_fils_discovery
*fd
;
993 fd
= &link_conf
->fils_discovery
;
994 fd
->min_interval
= params
->min_interval
;
995 fd
->max_interval
= params
->max_interval
;
997 old
= sdata_dereference(link
->u
.ap
.fils_discovery
, sdata
);
999 kfree_rcu(old
, rcu_head
);
1001 if (params
->tmpl
&& params
->tmpl_len
) {
1002 new = kzalloc(sizeof(*new) + params
->tmpl_len
, GFP_KERNEL
);
1005 new->len
= params
->tmpl_len
;
1006 memcpy(new->data
, params
->tmpl
, params
->tmpl_len
);
1007 rcu_assign_pointer(link
->u
.ap
.fils_discovery
, new);
1009 RCU_INIT_POINTER(link
->u
.ap
.fils_discovery
, NULL
);
1012 *changed
|= BSS_CHANGED_FILS_DISCOVERY
;
1017 ieee80211_set_unsol_bcast_probe_resp(struct ieee80211_sub_if_data
*sdata
,
1018 struct cfg80211_unsol_bcast_probe_resp
*params
,
1019 struct ieee80211_link_data
*link
,
1020 struct ieee80211_bss_conf
*link_conf
,
1023 struct unsol_bcast_probe_resp_data
*new, *old
= NULL
;
1025 if (!params
->update
)
1028 link_conf
->unsol_bcast_probe_resp_interval
= params
->interval
;
1030 old
= sdata_dereference(link
->u
.ap
.unsol_bcast_probe_resp
, sdata
);
1032 kfree_rcu(old
, rcu_head
);
1034 if (params
->tmpl
&& params
->tmpl_len
) {
1035 new = kzalloc(sizeof(*new) + params
->tmpl_len
, GFP_KERNEL
);
1038 new->len
= params
->tmpl_len
;
1039 memcpy(new->data
, params
->tmpl
, params
->tmpl_len
);
1040 rcu_assign_pointer(link
->u
.ap
.unsol_bcast_probe_resp
, new);
1042 RCU_INIT_POINTER(link
->u
.ap
.unsol_bcast_probe_resp
, NULL
);
1045 *changed
|= BSS_CHANGED_UNSOL_BCAST_PROBE_RESP
;
1049 static int ieee80211_set_ftm_responder_params(
1050 struct ieee80211_sub_if_data
*sdata
,
1051 const u8
*lci
, size_t lci_len
,
1052 const u8
*civicloc
, size_t civicloc_len
,
1053 struct ieee80211_bss_conf
*link_conf
)
1055 struct ieee80211_ftm_responder_params
*new, *old
;
1059 if (!lci_len
&& !civicloc_len
)
1062 old
= link_conf
->ftmr_params
;
1063 len
= lci_len
+ civicloc_len
;
1065 new = kzalloc(sizeof(*new) + len
, GFP_KERNEL
);
1069 pos
= (u8
*)(new + 1);
1071 new->lci_len
= lci_len
;
1073 memcpy(pos
, lci
, lci_len
);
1078 new->civicloc_len
= civicloc_len
;
1079 new->civicloc
= pos
;
1080 memcpy(pos
, civicloc
, civicloc_len
);
1081 pos
+= civicloc_len
;
1084 link_conf
->ftmr_params
= new;
1091 ieee80211_copy_mbssid_beacon(u8
*pos
, struct cfg80211_mbssid_elems
*dst
,
1092 struct cfg80211_mbssid_elems
*src
)
1096 dst
->cnt
= src
->cnt
;
1097 for (i
= 0; i
< src
->cnt
; i
++) {
1098 memcpy(pos
+ offset
, src
->elem
[i
].data
, src
->elem
[i
].len
);
1099 dst
->elem
[i
].len
= src
->elem
[i
].len
;
1100 dst
->elem
[i
].data
= pos
+ offset
;
1101 offset
+= dst
->elem
[i
].len
;
1108 ieee80211_copy_rnr_beacon(u8
*pos
, struct cfg80211_rnr_elems
*dst
,
1109 struct cfg80211_rnr_elems
*src
)
1113 for (i
= 0; i
< src
->cnt
; i
++) {
1114 memcpy(pos
+ offset
, src
->elem
[i
].data
, src
->elem
[i
].len
);
1115 dst
->elem
[i
].len
= src
->elem
[i
].len
;
1116 dst
->elem
[i
].data
= pos
+ offset
;
1117 offset
+= dst
->elem
[i
].len
;
1119 dst
->cnt
= src
->cnt
;
1125 ieee80211_assign_beacon(struct ieee80211_sub_if_data
*sdata
,
1126 struct ieee80211_link_data
*link
,
1127 struct cfg80211_beacon_data
*params
,
1128 const struct ieee80211_csa_settings
*csa
,
1129 const struct ieee80211_color_change_settings
*cca
,
1132 struct cfg80211_mbssid_elems
*mbssid
= NULL
;
1133 struct cfg80211_rnr_elems
*rnr
= NULL
;
1134 struct beacon_data
*new, *old
;
1135 int new_head_len
, new_tail_len
;
1137 u64 _changed
= BSS_CHANGED_BEACON
;
1138 struct ieee80211_bss_conf
*link_conf
= link
->conf
;
1140 old
= sdata_dereference(link
->u
.ap
.beacon
, sdata
);
1142 /* Need to have a beacon head if we don't have one yet */
1143 if (!params
->head
&& !old
)
1146 /* new or old head? */
1148 new_head_len
= params
->head_len
;
1150 new_head_len
= old
->head_len
;
1152 /* new or old tail? */
1153 if (params
->tail
|| !old
)
1154 /* params->tail_len will be zero for !params->tail */
1155 new_tail_len
= params
->tail_len
;
1157 new_tail_len
= old
->tail_len
;
1159 size
= sizeof(*new) + new_head_len
+ new_tail_len
;
1161 /* new or old multiple BSSID elements? */
1162 if (params
->mbssid_ies
) {
1163 mbssid
= params
->mbssid_ies
;
1164 size
+= struct_size(new->mbssid_ies
, elem
, mbssid
->cnt
);
1165 if (params
->rnr_ies
) {
1166 rnr
= params
->rnr_ies
;
1167 size
+= struct_size(new->rnr_ies
, elem
, rnr
->cnt
);
1169 size
+= ieee80211_get_mbssid_beacon_len(mbssid
, rnr
,
1171 } else if (old
&& old
->mbssid_ies
) {
1172 mbssid
= old
->mbssid_ies
;
1173 size
+= struct_size(new->mbssid_ies
, elem
, mbssid
->cnt
);
1174 if (old
&& old
->rnr_ies
) {
1176 size
+= struct_size(new->rnr_ies
, elem
, rnr
->cnt
);
1178 size
+= ieee80211_get_mbssid_beacon_len(mbssid
, rnr
,
1182 new = kzalloc(size
, GFP_KERNEL
);
1186 /* start filling the new info now */
1189 * pointers go into the block we allocated,
1190 * memory is | beacon_data | head | tail | mbssid_ies | rnr_ies
1192 new->head
= ((u8
*) new) + sizeof(*new);
1193 new->tail
= new->head
+ new_head_len
;
1194 new->head_len
= new_head_len
;
1195 new->tail_len
= new_tail_len
;
1196 /* copy in optional mbssid_ies */
1198 u8
*pos
= new->tail
+ new->tail_len
;
1200 new->mbssid_ies
= (void *)pos
;
1201 pos
+= struct_size(new->mbssid_ies
, elem
, mbssid
->cnt
);
1202 pos
+= ieee80211_copy_mbssid_beacon(pos
, new->mbssid_ies
,
1205 new->rnr_ies
= (void *)pos
;
1206 pos
+= struct_size(new->rnr_ies
, elem
, rnr
->cnt
);
1207 ieee80211_copy_rnr_beacon(pos
, new->rnr_ies
, rnr
);
1209 /* update bssid_indicator */
1210 link_conf
->bssid_indicator
=
1211 ilog2(__roundup_pow_of_two(mbssid
->cnt
+ 1));
1215 new->cntdwn_current_counter
= csa
->count
;
1216 memcpy(new->cntdwn_counter_offsets
, csa
->counter_offsets_beacon
,
1217 csa
->n_counter_offsets_beacon
*
1218 sizeof(new->cntdwn_counter_offsets
[0]));
1220 new->cntdwn_current_counter
= cca
->count
;
1221 new->cntdwn_counter_offsets
[0] = cca
->counter_offset_beacon
;
1226 memcpy(new->head
, params
->head
, new_head_len
);
1228 memcpy(new->head
, old
->head
, new_head_len
);
1230 /* copy in optional tail */
1232 memcpy(new->tail
, params
->tail
, new_tail_len
);
1235 memcpy(new->tail
, old
->tail
, new_tail_len
);
1237 err
= ieee80211_set_probe_resp(sdata
, params
->probe_resp
,
1238 params
->probe_resp_len
, csa
, cca
, link
);
1244 _changed
|= BSS_CHANGED_AP_PROBE_RESP
;
1246 if (params
->ftm_responder
!= -1) {
1247 link_conf
->ftm_responder
= params
->ftm_responder
;
1248 err
= ieee80211_set_ftm_responder_params(sdata
,
1252 params
->civicloc_len
,
1260 _changed
|= BSS_CHANGED_FTM_RESPONDER
;
1263 rcu_assign_pointer(link
->u
.ap
.beacon
, new);
1264 sdata
->u
.ap
.active
= true;
1267 kfree_rcu(old
, rcu_head
);
1269 *changed
|= _changed
;
1273 static u8
ieee80211_num_beaconing_links(struct ieee80211_sub_if_data
*sdata
)
1275 struct ieee80211_link_data
*link
;
1276 u8 link_id
, num
= 0;
1278 if (sdata
->vif
.type
!= NL80211_IFTYPE_AP
&&
1279 sdata
->vif
.type
!= NL80211_IFTYPE_P2P_GO
)
1282 if (!sdata
->vif
.valid_links
)
1285 for (link_id
= 0; link_id
< IEEE80211_MLD_MAX_NUM_LINKS
; link_id
++) {
1286 link
= sdata_dereference(sdata
->link
[link_id
], sdata
);
1290 if (sdata_dereference(link
->u
.ap
.beacon
, sdata
))
1297 static int ieee80211_start_ap(struct wiphy
*wiphy
, struct net_device
*dev
,
1298 struct cfg80211_ap_settings
*params
)
1300 struct ieee80211_sub_if_data
*sdata
= IEEE80211_DEV_TO_SUB_IF(dev
);
1301 struct ieee80211_local
*local
= sdata
->local
;
1302 struct beacon_data
*old
;
1303 struct ieee80211_sub_if_data
*vlan
;
1304 u64 changed
= BSS_CHANGED_BEACON_INT
|
1305 BSS_CHANGED_BEACON_ENABLED
|
1306 BSS_CHANGED_BEACON
|
1307 BSS_CHANGED_P2P_PS
|
1308 BSS_CHANGED_TXPOWER
|
1311 int prev_beacon_int
;
1312 unsigned int link_id
= params
->beacon
.link_id
;
1313 struct ieee80211_link_data
*link
;
1314 struct ieee80211_bss_conf
*link_conf
;
1315 struct ieee80211_chan_req chanreq
= { .oper
= params
->chandef
};
1317 lockdep_assert_wiphy(local
->hw
.wiphy
);
1319 link
= sdata_dereference(sdata
->link
[link_id
], sdata
);
1323 link_conf
= link
->conf
;
1325 old
= sdata_dereference(link
->u
.ap
.beacon
, sdata
);
1329 link
->smps_mode
= IEEE80211_SMPS_OFF
;
1331 link
->needed_rx_chains
= sdata
->local
->rx_chains
;
1333 prev_beacon_int
= link_conf
->beacon_int
;
1334 link_conf
->beacon_int
= params
->beacon_interval
;
1337 link_conf
->ht_ldpc
=
1338 params
->ht_cap
->cap_info
&
1339 cpu_to_le16(IEEE80211_HT_CAP_LDPC_CODING
);
1341 if (params
->vht_cap
) {
1342 link_conf
->vht_ldpc
=
1343 params
->vht_cap
->vht_cap_info
&
1344 cpu_to_le32(IEEE80211_VHT_CAP_RXLDPC
);
1345 link_conf
->vht_su_beamformer
=
1346 params
->vht_cap
->vht_cap_info
&
1347 cpu_to_le32(IEEE80211_VHT_CAP_SU_BEAMFORMER_CAPABLE
);
1348 link_conf
->vht_su_beamformee
=
1349 params
->vht_cap
->vht_cap_info
&
1350 cpu_to_le32(IEEE80211_VHT_CAP_SU_BEAMFORMEE_CAPABLE
);
1351 link_conf
->vht_mu_beamformer
=
1352 params
->vht_cap
->vht_cap_info
&
1353 cpu_to_le32(IEEE80211_VHT_CAP_MU_BEAMFORMER_CAPABLE
);
1354 link_conf
->vht_mu_beamformee
=
1355 params
->vht_cap
->vht_cap_info
&
1356 cpu_to_le32(IEEE80211_VHT_CAP_MU_BEAMFORMEE_CAPABLE
);
1359 if (params
->he_cap
&& params
->he_oper
) {
1360 link_conf
->he_support
= true;
1361 link_conf
->htc_trig_based_pkt_ext
=
1362 le32_get_bits(params
->he_oper
->he_oper_params
,
1363 IEEE80211_HE_OPERATION_DFLT_PE_DURATION_MASK
);
1364 link_conf
->frame_time_rts_th
=
1365 le32_get_bits(params
->he_oper
->he_oper_params
,
1366 IEEE80211_HE_OPERATION_RTS_THRESHOLD_MASK
);
1367 changed
|= BSS_CHANGED_HE_OBSS_PD
;
1369 if (params
->beacon
.he_bss_color
.enabled
)
1370 changed
|= BSS_CHANGED_HE_BSS_COLOR
;
1373 if (params
->he_cap
) {
1374 link_conf
->he_ldpc
=
1375 params
->he_cap
->phy_cap_info
[1] &
1376 IEEE80211_HE_PHY_CAP1_LDPC_CODING_IN_PAYLOAD
;
1377 link_conf
->he_su_beamformer
=
1378 params
->he_cap
->phy_cap_info
[3] &
1379 IEEE80211_HE_PHY_CAP3_SU_BEAMFORMER
;
1380 link_conf
->he_su_beamformee
=
1381 params
->he_cap
->phy_cap_info
[4] &
1382 IEEE80211_HE_PHY_CAP4_SU_BEAMFORMEE
;
1383 link_conf
->he_mu_beamformer
=
1384 params
->he_cap
->phy_cap_info
[4] &
1385 IEEE80211_HE_PHY_CAP4_MU_BEAMFORMER
;
1386 link_conf
->he_full_ul_mumimo
=
1387 params
->he_cap
->phy_cap_info
[2] &
1388 IEEE80211_HE_PHY_CAP2_UL_MU_FULL_MU_MIMO
;
1391 if (params
->eht_cap
) {
1392 if (!link_conf
->he_support
)
1395 link_conf
->eht_support
= true;
1397 link_conf
->eht_su_beamformer
=
1398 params
->eht_cap
->fixed
.phy_cap_info
[0] &
1399 IEEE80211_EHT_PHY_CAP0_SU_BEAMFORMER
;
1400 link_conf
->eht_su_beamformee
=
1401 params
->eht_cap
->fixed
.phy_cap_info
[0] &
1402 IEEE80211_EHT_PHY_CAP0_SU_BEAMFORMEE
;
1403 link_conf
->eht_mu_beamformer
=
1404 params
->eht_cap
->fixed
.phy_cap_info
[7] &
1405 (IEEE80211_EHT_PHY_CAP7_MU_BEAMFORMER_80MHZ
|
1406 IEEE80211_EHT_PHY_CAP7_MU_BEAMFORMER_160MHZ
|
1407 IEEE80211_EHT_PHY_CAP7_MU_BEAMFORMER_320MHZ
);
1408 link_conf
->eht_80mhz_full_bw_ul_mumimo
=
1409 params
->eht_cap
->fixed
.phy_cap_info
[7] &
1410 (IEEE80211_EHT_PHY_CAP7_NON_OFDMA_UL_MU_MIMO_80MHZ
|
1411 IEEE80211_EHT_PHY_CAP7_NON_OFDMA_UL_MU_MIMO_160MHZ
|
1412 IEEE80211_EHT_PHY_CAP7_NON_OFDMA_UL_MU_MIMO_320MHZ
);
1414 link_conf
->eht_su_beamformer
= false;
1415 link_conf
->eht_su_beamformee
= false;
1416 link_conf
->eht_mu_beamformer
= false;
1419 if (sdata
->vif
.type
== NL80211_IFTYPE_AP
&&
1420 params
->mbssid_config
.tx_wdev
) {
1421 err
= ieee80211_set_ap_mbssid_options(sdata
,
1422 ¶ms
->mbssid_config
,
1428 err
= ieee80211_link_use_channel(link
, &chanreq
,
1429 IEEE80211_CHANCTX_SHARED
);
1431 ieee80211_link_copy_chanctx_to_vlans(link
, false);
1433 link_conf
->beacon_int
= prev_beacon_int
;
1438 * Apply control port protocol, this allows us to
1439 * not encrypt dynamic WEP control frames.
1441 sdata
->control_port_protocol
= params
->crypto
.control_port_ethertype
;
1442 sdata
->control_port_no_encrypt
= params
->crypto
.control_port_no_encrypt
;
1443 sdata
->control_port_over_nl80211
=
1444 params
->crypto
.control_port_over_nl80211
;
1445 sdata
->control_port_no_preauth
=
1446 params
->crypto
.control_port_no_preauth
;
1448 list_for_each_entry(vlan
, &sdata
->u
.ap
.vlans
, u
.vlan
.list
) {
1449 vlan
->control_port_protocol
=
1450 params
->crypto
.control_port_ethertype
;
1451 vlan
->control_port_no_encrypt
=
1452 params
->crypto
.control_port_no_encrypt
;
1453 vlan
->control_port_over_nl80211
=
1454 params
->crypto
.control_port_over_nl80211
;
1455 vlan
->control_port_no_preauth
=
1456 params
->crypto
.control_port_no_preauth
;
1459 link_conf
->dtim_period
= params
->dtim_period
;
1460 link_conf
->enable_beacon
= true;
1461 link_conf
->allow_p2p_go_ps
= sdata
->vif
.p2p
;
1462 link_conf
->twt_responder
= params
->twt_responder
;
1463 link_conf
->he_obss_pd
= params
->he_obss_pd
;
1464 link_conf
->he_bss_color
= params
->beacon
.he_bss_color
;
1465 sdata
->vif
.cfg
.s1g
= params
->chandef
.chan
->band
==
1468 sdata
->vif
.cfg
.ssid_len
= params
->ssid_len
;
1469 if (params
->ssid_len
)
1470 memcpy(sdata
->vif
.cfg
.ssid
, params
->ssid
,
1472 link_conf
->hidden_ssid
=
1473 (params
->hidden_ssid
!= NL80211_HIDDEN_SSID_NOT_IN_USE
);
1475 memset(&link_conf
->p2p_noa_attr
, 0,
1476 sizeof(link_conf
->p2p_noa_attr
));
1477 link_conf
->p2p_noa_attr
.oppps_ctwindow
=
1478 params
->p2p_ctwindow
& IEEE80211_P2P_OPPPS_CTWINDOW_MASK
;
1479 if (params
->p2p_opp_ps
)
1480 link_conf
->p2p_noa_attr
.oppps_ctwindow
|=
1481 IEEE80211_P2P_OPPPS_ENABLE_BIT
;
1483 sdata
->beacon_rate_set
= false;
1484 if (wiphy_ext_feature_isset(local
->hw
.wiphy
,
1485 NL80211_EXT_FEATURE_BEACON_RATE_LEGACY
)) {
1486 for (i
= 0; i
< NUM_NL80211_BANDS
; i
++) {
1487 sdata
->beacon_rateidx_mask
[i
] =
1488 params
->beacon_rate
.control
[i
].legacy
;
1489 if (sdata
->beacon_rateidx_mask
[i
])
1490 sdata
->beacon_rate_set
= true;
1494 if (ieee80211_hw_check(&local
->hw
, HAS_RATE_CONTROL
))
1495 link_conf
->beacon_tx_rate
= params
->beacon_rate
;
1497 err
= ieee80211_assign_beacon(sdata
, link
, ¶ms
->beacon
, NULL
, NULL
,
1502 err
= ieee80211_set_fils_discovery(sdata
, ¶ms
->fils_discovery
,
1503 link
, link_conf
, &changed
);
1507 err
= ieee80211_set_unsol_bcast_probe_resp(sdata
,
1508 ¶ms
->unsol_bcast_probe_resp
,
1509 link
, link_conf
, &changed
);
1513 err
= drv_start_ap(sdata
->local
, sdata
, link_conf
);
1515 old
= sdata_dereference(link
->u
.ap
.beacon
, sdata
);
1518 kfree_rcu(old
, rcu_head
);
1519 RCU_INIT_POINTER(link
->u
.ap
.beacon
, NULL
);
1521 if (ieee80211_num_beaconing_links(sdata
) == 0)
1522 sdata
->u
.ap
.active
= false;
1527 ieee80211_recalc_dtim(local
, sdata
);
1528 ieee80211_vif_cfg_change_notify(sdata
, BSS_CHANGED_SSID
);
1529 ieee80211_link_info_change_notify(sdata
, link
, changed
);
1531 if (ieee80211_num_beaconing_links(sdata
) <= 1)
1532 netif_carrier_on(dev
);
1534 list_for_each_entry(vlan
, &sdata
->u
.ap
.vlans
, u
.vlan
.list
)
1535 netif_carrier_on(vlan
->dev
);
1540 ieee80211_link_release_channel(link
);
1545 static int ieee80211_change_beacon(struct wiphy
*wiphy
, struct net_device
*dev
,
1546 struct cfg80211_ap_update
*params
)
1549 struct ieee80211_sub_if_data
*sdata
= IEEE80211_DEV_TO_SUB_IF(dev
);
1550 struct ieee80211_link_data
*link
;
1551 struct cfg80211_beacon_data
*beacon
= ¶ms
->beacon
;
1552 struct beacon_data
*old
;
1554 struct ieee80211_bss_conf
*link_conf
;
1557 lockdep_assert_wiphy(wiphy
);
1559 link
= sdata_dereference(sdata
->link
[beacon
->link_id
], sdata
);
1563 link_conf
= link
->conf
;
1565 /* don't allow changing the beacon while a countdown is in place - offset
1566 * of channel switch counter may change
1568 if (link_conf
->csa_active
|| link_conf
->color_change_active
)
1571 old
= sdata_dereference(link
->u
.ap
.beacon
, sdata
);
1575 err
= ieee80211_assign_beacon(sdata
, link
, beacon
, NULL
, NULL
,
1580 err
= ieee80211_set_fils_discovery(sdata
, ¶ms
->fils_discovery
,
1581 link
, link_conf
, &changed
);
1585 err
= ieee80211_set_unsol_bcast_probe_resp(sdata
,
1586 ¶ms
->unsol_bcast_probe_resp
,
1587 link
, link_conf
, &changed
);
1591 if (beacon
->he_bss_color_valid
&&
1592 beacon
->he_bss_color
.enabled
!= link_conf
->he_bss_color
.enabled
) {
1593 link_conf
->he_bss_color
.enabled
= beacon
->he_bss_color
.enabled
;
1594 changed
|= BSS_CHANGED_HE_BSS_COLOR
;
1597 ieee80211_link_info_change_notify(sdata
, link
, changed
);
1601 static void ieee80211_free_next_beacon(struct ieee80211_link_data
*link
)
1603 if (!link
->u
.ap
.next_beacon
)
1606 kfree(link
->u
.ap
.next_beacon
->mbssid_ies
);
1607 kfree(link
->u
.ap
.next_beacon
->rnr_ies
);
1608 kfree(link
->u
.ap
.next_beacon
);
1609 link
->u
.ap
.next_beacon
= NULL
;
1612 static int ieee80211_stop_ap(struct wiphy
*wiphy
, struct net_device
*dev
,
1613 unsigned int link_id
)
1615 struct ieee80211_sub_if_data
*sdata
= IEEE80211_DEV_TO_SUB_IF(dev
);
1616 struct ieee80211_sub_if_data
*vlan
;
1617 struct ieee80211_local
*local
= sdata
->local
;
1618 struct beacon_data
*old_beacon
;
1619 struct probe_resp
*old_probe_resp
;
1620 struct fils_discovery_data
*old_fils_discovery
;
1621 struct unsol_bcast_probe_resp_data
*old_unsol_bcast_probe_resp
;
1622 struct cfg80211_chan_def chandef
;
1623 struct ieee80211_link_data
*link
=
1624 sdata_dereference(sdata
->link
[link_id
], sdata
);
1625 struct ieee80211_bss_conf
*link_conf
= link
->conf
;
1628 lockdep_assert_wiphy(local
->hw
.wiphy
);
1630 old_beacon
= sdata_dereference(link
->u
.ap
.beacon
, sdata
);
1633 old_probe_resp
= sdata_dereference(link
->u
.ap
.probe_resp
,
1635 old_fils_discovery
= sdata_dereference(link
->u
.ap
.fils_discovery
,
1637 old_unsol_bcast_probe_resp
=
1638 sdata_dereference(link
->u
.ap
.unsol_bcast_probe_resp
,
1641 /* abort any running channel switch or color change */
1642 link_conf
->csa_active
= false;
1643 link_conf
->color_change_active
= false;
1644 ieee80211_vif_unblock_queues_csa(sdata
);
1646 ieee80211_free_next_beacon(link
);
1648 /* turn off carrier for this interface and dependent VLANs */
1649 list_for_each_entry(vlan
, &sdata
->u
.ap
.vlans
, u
.vlan
.list
)
1650 netif_carrier_off(vlan
->dev
);
1652 if (ieee80211_num_beaconing_links(sdata
) <= 1) {
1653 netif_carrier_off(dev
);
1654 sdata
->u
.ap
.active
= false;
1657 /* remove beacon and probe response */
1658 RCU_INIT_POINTER(link
->u
.ap
.beacon
, NULL
);
1659 RCU_INIT_POINTER(link
->u
.ap
.probe_resp
, NULL
);
1660 RCU_INIT_POINTER(link
->u
.ap
.fils_discovery
, NULL
);
1661 RCU_INIT_POINTER(link
->u
.ap
.unsol_bcast_probe_resp
, NULL
);
1662 kfree_rcu(old_beacon
, rcu_head
);
1664 kfree_rcu(old_probe_resp
, rcu_head
);
1665 if (old_fils_discovery
)
1666 kfree_rcu(old_fils_discovery
, rcu_head
);
1667 if (old_unsol_bcast_probe_resp
)
1668 kfree_rcu(old_unsol_bcast_probe_resp
, rcu_head
);
1670 kfree(link_conf
->ftmr_params
);
1671 link_conf
->ftmr_params
= NULL
;
1673 sdata
->vif
.mbssid_tx_vif
= NULL
;
1674 link_conf
->bssid_index
= 0;
1675 link_conf
->nontransmitted
= false;
1676 link_conf
->ema_ap
= false;
1677 link_conf
->bssid_indicator
= 0;
1679 __sta_info_flush(sdata
, true, link_id
, NULL
);
1681 ieee80211_remove_link_keys(link
, &keys
);
1682 if (!list_empty(&keys
)) {
1684 ieee80211_free_key_list(local
, &keys
);
1687 link_conf
->enable_beacon
= false;
1688 sdata
->beacon_rate_set
= false;
1689 sdata
->vif
.cfg
.ssid_len
= 0;
1690 clear_bit(SDATA_STATE_OFFCHANNEL_BEACON_STOPPED
, &sdata
->state
);
1691 ieee80211_link_info_change_notify(sdata
, link
,
1692 BSS_CHANGED_BEACON_ENABLED
);
1694 if (sdata
->wdev
.links
[link_id
].cac_started
) {
1695 chandef
= link_conf
->chanreq
.oper
;
1696 wiphy_delayed_work_cancel(wiphy
, &link
->dfs_cac_timer_work
);
1697 cfg80211_cac_event(sdata
->dev
, &chandef
,
1698 NL80211_RADAR_CAC_ABORTED
,
1699 GFP_KERNEL
, link_id
);
1702 drv_stop_ap(sdata
->local
, sdata
, link_conf
);
1704 /* free all potentially still buffered bcast frames */
1705 local
->total_ps_buffered
-= skb_queue_len(&sdata
->u
.ap
.ps
.bc_buf
);
1706 ieee80211_purge_tx_queue(&local
->hw
, &sdata
->u
.ap
.ps
.bc_buf
);
1708 ieee80211_link_copy_chanctx_to_vlans(link
, true);
1709 ieee80211_link_release_channel(link
);
1714 static int sta_apply_auth_flags(struct ieee80211_local
*local
,
1715 struct sta_info
*sta
,
1720 if (mask
& BIT(NL80211_STA_FLAG_AUTHENTICATED
) &&
1721 set
& BIT(NL80211_STA_FLAG_AUTHENTICATED
) &&
1722 !test_sta_flag(sta
, WLAN_STA_AUTH
)) {
1723 ret
= sta_info_move_state(sta
, IEEE80211_STA_AUTH
);
1728 if (mask
& BIT(NL80211_STA_FLAG_ASSOCIATED
) &&
1729 set
& BIT(NL80211_STA_FLAG_ASSOCIATED
) &&
1730 !test_sta_flag(sta
, WLAN_STA_ASSOC
)) {
1732 * When peer becomes associated, init rate control as
1733 * well. Some drivers require rate control initialized
1734 * before drv_sta_state() is called.
1736 if (!test_sta_flag(sta
, WLAN_STA_RATE_CONTROL
))
1737 rate_control_rate_init_all_links(sta
);
1739 ret
= sta_info_move_state(sta
, IEEE80211_STA_ASSOC
);
1744 if (mask
& BIT(NL80211_STA_FLAG_AUTHORIZED
)) {
1745 if (set
& BIT(NL80211_STA_FLAG_AUTHORIZED
))
1746 ret
= sta_info_move_state(sta
, IEEE80211_STA_AUTHORIZED
);
1747 else if (test_sta_flag(sta
, WLAN_STA_AUTHORIZED
))
1748 ret
= sta_info_move_state(sta
, IEEE80211_STA_ASSOC
);
1755 if (mask
& BIT(NL80211_STA_FLAG_ASSOCIATED
) &&
1756 !(set
& BIT(NL80211_STA_FLAG_ASSOCIATED
)) &&
1757 test_sta_flag(sta
, WLAN_STA_ASSOC
)) {
1758 ret
= sta_info_move_state(sta
, IEEE80211_STA_AUTH
);
1763 if (mask
& BIT(NL80211_STA_FLAG_AUTHENTICATED
) &&
1764 !(set
& BIT(NL80211_STA_FLAG_AUTHENTICATED
)) &&
1765 test_sta_flag(sta
, WLAN_STA_AUTH
)) {
1766 ret
= sta_info_move_state(sta
, IEEE80211_STA_NONE
);
1774 static void sta_apply_mesh_params(struct ieee80211_local
*local
,
1775 struct sta_info
*sta
,
1776 struct station_parameters
*params
)
1778 #ifdef CONFIG_MAC80211_MESH
1779 struct ieee80211_sub_if_data
*sdata
= sta
->sdata
;
1782 if (params
->sta_modify_mask
& STATION_PARAM_APPLY_PLINK_STATE
) {
1783 switch (params
->plink_state
) {
1784 case NL80211_PLINK_ESTAB
:
1785 if (sta
->mesh
->plink_state
!= NL80211_PLINK_ESTAB
)
1786 changed
= mesh_plink_inc_estab_count(sdata
);
1787 sta
->mesh
->plink_state
= params
->plink_state
;
1788 sta
->mesh
->aid
= params
->peer_aid
;
1790 ieee80211_mps_sta_status_update(sta
);
1791 changed
|= ieee80211_mps_set_sta_local_pm(sta
,
1792 sdata
->u
.mesh
.mshcfg
.power_mode
);
1794 ewma_mesh_tx_rate_avg_init(&sta
->mesh
->tx_rate_avg
);
1795 /* init at low value */
1796 ewma_mesh_tx_rate_avg_add(&sta
->mesh
->tx_rate_avg
, 10);
1799 case NL80211_PLINK_LISTEN
:
1800 case NL80211_PLINK_BLOCKED
:
1801 case NL80211_PLINK_OPN_SNT
:
1802 case NL80211_PLINK_OPN_RCVD
:
1803 case NL80211_PLINK_CNF_RCVD
:
1804 case NL80211_PLINK_HOLDING
:
1805 if (sta
->mesh
->plink_state
== NL80211_PLINK_ESTAB
)
1806 changed
= mesh_plink_dec_estab_count(sdata
);
1807 sta
->mesh
->plink_state
= params
->plink_state
;
1809 ieee80211_mps_sta_status_update(sta
);
1810 changed
|= ieee80211_mps_set_sta_local_pm(sta
,
1811 NL80211_MESH_POWER_UNKNOWN
);
1819 switch (params
->plink_action
) {
1820 case NL80211_PLINK_ACTION_NO_ACTION
:
1823 case NL80211_PLINK_ACTION_OPEN
:
1824 changed
|= mesh_plink_open(sta
);
1826 case NL80211_PLINK_ACTION_BLOCK
:
1827 changed
|= mesh_plink_block(sta
);
1831 if (params
->local_pm
)
1832 changed
|= ieee80211_mps_set_sta_local_pm(sta
,
1835 ieee80211_mbss_info_change_notify(sdata
, changed
);
1839 enum sta_link_apply_mode
{
1841 STA_LINK_MODE_STA_MODIFY
,
1842 STA_LINK_MODE_LINK_MODIFY
,
1845 static int sta_link_apply_parameters(struct ieee80211_local
*local
,
1846 struct sta_info
*sta
,
1847 enum sta_link_apply_mode mode
,
1848 struct link_station_parameters
*params
)
1850 struct ieee80211_supported_band
*sband
;
1851 struct ieee80211_sub_if_data
*sdata
= sta
->sdata
;
1852 u32 link_id
= params
->link_id
< 0 ? 0 : params
->link_id
;
1853 struct ieee80211_link_data
*link
=
1854 sdata_dereference(sdata
->link
[link_id
], sdata
);
1855 struct link_sta_info
*link_sta
=
1856 rcu_dereference_protected(sta
->link
[link_id
],
1857 lockdep_is_held(&local
->hw
.wiphy
->mtx
));
1858 bool changes
= params
->link_mac
||
1859 params
->txpwr_set
||
1860 params
->supported_rates_len
||
1865 params
->opmode_notif_used
;
1868 case STA_LINK_MODE_NEW
:
1869 if (!params
->link_mac
)
1872 case STA_LINK_MODE_LINK_MODIFY
:
1874 case STA_LINK_MODE_STA_MODIFY
:
1875 if (params
->link_id
>= 0)
1882 if (!link
|| !link_sta
)
1885 sband
= ieee80211_get_link_sband(link
);
1889 if (params
->link_mac
) {
1890 if (mode
== STA_LINK_MODE_NEW
) {
1891 memcpy(link_sta
->addr
, params
->link_mac
, ETH_ALEN
);
1892 memcpy(link_sta
->pub
->addr
, params
->link_mac
, ETH_ALEN
);
1893 } else if (!ether_addr_equal(link_sta
->addr
,
1894 params
->link_mac
)) {
1899 if (params
->txpwr_set
) {
1902 link_sta
->pub
->txpwr
.type
= params
->txpwr
.type
;
1903 if (params
->txpwr
.type
== NL80211_TX_POWER_LIMITED
)
1904 link_sta
->pub
->txpwr
.power
= params
->txpwr
.power
;
1905 ret
= drv_sta_set_txpwr(local
, sdata
, sta
);
1910 if (params
->supported_rates
&&
1911 params
->supported_rates_len
) {
1912 ieee80211_parse_bitrates(link
->conf
->chanreq
.oper
.width
,
1913 sband
, params
->supported_rates
,
1914 params
->supported_rates_len
,
1915 &link_sta
->pub
->supp_rates
[sband
->band
]);
1918 if (params
->ht_capa
)
1919 ieee80211_ht_cap_ie_to_sta_ht_cap(sdata
, sband
,
1920 params
->ht_capa
, link_sta
);
1922 /* VHT can override some HT caps such as the A-MSDU max length */
1923 if (params
->vht_capa
)
1924 ieee80211_vht_cap_ie_to_sta_vht_cap(sdata
, sband
,
1925 params
->vht_capa
, NULL
,
1928 if (params
->he_capa
)
1929 ieee80211_he_cap_ie_to_sta_he_cap(sdata
, sband
,
1930 (void *)params
->he_capa
,
1931 params
->he_capa_len
,
1932 (void *)params
->he_6ghz_capa
,
1935 if (params
->he_capa
&& params
->eht_capa
)
1936 ieee80211_eht_cap_ie_to_sta_eht_cap(sdata
, sband
,
1937 (u8
*)params
->he_capa
,
1938 params
->he_capa_len
,
1940 params
->eht_capa_len
,
1943 ieee80211_sta_init_nss(link_sta
);
1945 if (params
->opmode_notif_used
) {
1946 /* returned value is only needed for rc update, but the
1947 * rc isn't initialized here yet, so ignore it
1949 __ieee80211_vht_handle_opmode(sdata
, link_sta
,
1950 params
->opmode_notif
,
1957 static int sta_apply_parameters(struct ieee80211_local
*local
,
1958 struct sta_info
*sta
,
1959 struct station_parameters
*params
)
1961 struct ieee80211_sub_if_data
*sdata
= sta
->sdata
;
1965 mask
= params
->sta_flags_mask
;
1966 set
= params
->sta_flags_set
;
1968 if (ieee80211_vif_is_mesh(&sdata
->vif
)) {
1970 * In mesh mode, ASSOCIATED isn't part of the nl80211
1971 * API but must follow AUTHENTICATED for driver state.
1973 if (mask
& BIT(NL80211_STA_FLAG_AUTHENTICATED
))
1974 mask
|= BIT(NL80211_STA_FLAG_ASSOCIATED
);
1975 if (set
& BIT(NL80211_STA_FLAG_AUTHENTICATED
))
1976 set
|= BIT(NL80211_STA_FLAG_ASSOCIATED
);
1977 } else if (test_sta_flag(sta
, WLAN_STA_TDLS_PEER
)) {
1979 * TDLS -- everything follows authorized, but
1980 * only becoming authorized is possible, not
1983 if (set
& BIT(NL80211_STA_FLAG_AUTHORIZED
)) {
1984 set
|= BIT(NL80211_STA_FLAG_AUTHENTICATED
) |
1985 BIT(NL80211_STA_FLAG_ASSOCIATED
);
1986 mask
|= BIT(NL80211_STA_FLAG_AUTHENTICATED
) |
1987 BIT(NL80211_STA_FLAG_ASSOCIATED
);
1991 if (mask
& BIT(NL80211_STA_FLAG_WME
) &&
1992 local
->hw
.queues
>= IEEE80211_NUM_ACS
)
1993 sta
->sta
.wme
= set
& BIT(NL80211_STA_FLAG_WME
);
1995 /* auth flags will be set later for TDLS,
1996 * and for unassociated stations that move to associated */
1997 if (!test_sta_flag(sta
, WLAN_STA_TDLS_PEER
) &&
1998 !((mask
& BIT(NL80211_STA_FLAG_ASSOCIATED
)) &&
1999 (set
& BIT(NL80211_STA_FLAG_ASSOCIATED
)))) {
2000 ret
= sta_apply_auth_flags(local
, sta
, mask
, set
);
2005 if (mask
& BIT(NL80211_STA_FLAG_SHORT_PREAMBLE
)) {
2006 if (set
& BIT(NL80211_STA_FLAG_SHORT_PREAMBLE
))
2007 set_sta_flag(sta
, WLAN_STA_SHORT_PREAMBLE
);
2009 clear_sta_flag(sta
, WLAN_STA_SHORT_PREAMBLE
);
2012 if (mask
& BIT(NL80211_STA_FLAG_MFP
)) {
2013 sta
->sta
.mfp
= !!(set
& BIT(NL80211_STA_FLAG_MFP
));
2014 if (set
& BIT(NL80211_STA_FLAG_MFP
))
2015 set_sta_flag(sta
, WLAN_STA_MFP
);
2017 clear_sta_flag(sta
, WLAN_STA_MFP
);
2020 if (mask
& BIT(NL80211_STA_FLAG_TDLS_PEER
)) {
2021 if (set
& BIT(NL80211_STA_FLAG_TDLS_PEER
))
2022 set_sta_flag(sta
, WLAN_STA_TDLS_PEER
);
2024 clear_sta_flag(sta
, WLAN_STA_TDLS_PEER
);
2027 if (mask
& BIT(NL80211_STA_FLAG_SPP_AMSDU
))
2028 sta
->sta
.spp_amsdu
= set
& BIT(NL80211_STA_FLAG_SPP_AMSDU
);
2030 /* mark TDLS channel switch support, if the AP allows it */
2031 if (test_sta_flag(sta
, WLAN_STA_TDLS_PEER
) &&
2032 !sdata
->deflink
.u
.mgd
.tdls_chan_switch_prohibited
&&
2033 params
->ext_capab_len
>= 4 &&
2034 params
->ext_capab
[3] & WLAN_EXT_CAPA4_TDLS_CHAN_SWITCH
)
2035 set_sta_flag(sta
, WLAN_STA_TDLS_CHAN_SWITCH
);
2037 if (test_sta_flag(sta
, WLAN_STA_TDLS_PEER
) &&
2038 !sdata
->u
.mgd
.tdls_wider_bw_prohibited
&&
2039 ieee80211_hw_check(&local
->hw
, TDLS_WIDER_BW
) &&
2040 params
->ext_capab_len
>= 8 &&
2041 params
->ext_capab
[7] & WLAN_EXT_CAPA8_TDLS_WIDE_BW_ENABLED
)
2042 set_sta_flag(sta
, WLAN_STA_TDLS_WIDER_BW
);
2044 if (params
->sta_modify_mask
& STATION_PARAM_APPLY_UAPSD
) {
2045 sta
->sta
.uapsd_queues
= params
->uapsd_queues
;
2046 sta
->sta
.max_sp
= params
->max_sp
;
2049 ieee80211_sta_set_max_amsdu_subframes(sta
, params
->ext_capab
,
2050 params
->ext_capab_len
);
2053 * cfg80211 validates this (1-2007) and allows setting the AID
2054 * only when creating a new station entry
2057 sta
->sta
.aid
= params
->aid
;
2060 * Some of the following updates would be racy if called on an
2061 * existing station, via ieee80211_change_station(). However,
2062 * all such changes are rejected by cfg80211 except for updates
2063 * changing the supported rates on an existing but not yet used
2067 if (params
->listen_interval
>= 0)
2068 sta
->listen_interval
= params
->listen_interval
;
2070 ret
= sta_link_apply_parameters(local
, sta
, STA_LINK_MODE_STA_MODIFY
,
2071 ¶ms
->link_sta_params
);
2075 if (params
->support_p2p_ps
>= 0)
2076 sta
->sta
.support_p2p_ps
= params
->support_p2p_ps
;
2078 if (ieee80211_vif_is_mesh(&sdata
->vif
))
2079 sta_apply_mesh_params(local
, sta
, params
);
2081 if (params
->airtime_weight
)
2082 sta
->airtime_weight
= params
->airtime_weight
;
2084 /* set the STA state after all sta info from usermode has been set */
2085 if (test_sta_flag(sta
, WLAN_STA_TDLS_PEER
) ||
2086 set
& BIT(NL80211_STA_FLAG_ASSOCIATED
)) {
2087 ret
= sta_apply_auth_flags(local
, sta
, mask
, set
);
2092 /* Mark the STA as MLO if MLD MAC address is available */
2093 if (params
->link_sta_params
.mld_mac
)
2094 sta
->sta
.mlo
= true;
2099 static int ieee80211_add_station(struct wiphy
*wiphy
, struct net_device
*dev
,
2101 struct station_parameters
*params
)
2103 struct ieee80211_local
*local
= wiphy_priv(wiphy
);
2104 struct sta_info
*sta
;
2105 struct ieee80211_sub_if_data
*sdata
;
2108 lockdep_assert_wiphy(local
->hw
.wiphy
);
2111 sdata
= IEEE80211_DEV_TO_SUB_IF(params
->vlan
);
2113 if (sdata
->vif
.type
!= NL80211_IFTYPE_AP_VLAN
&&
2114 sdata
->vif
.type
!= NL80211_IFTYPE_AP
)
2117 sdata
= IEEE80211_DEV_TO_SUB_IF(dev
);
2119 if (ether_addr_equal(mac
, sdata
->vif
.addr
))
2122 if (!is_valid_ether_addr(mac
))
2125 if (params
->sta_flags_set
& BIT(NL80211_STA_FLAG_TDLS_PEER
) &&
2126 sdata
->vif
.type
== NL80211_IFTYPE_STATION
&&
2127 !sdata
->u
.mgd
.associated
)
2131 * If we have a link ID, it can be a non-MLO station on an AP MLD,
2132 * but we need to have a link_mac in that case as well, so use the
2133 * STA's MAC address in that case.
2135 if (params
->link_sta_params
.link_id
>= 0)
2136 sta
= sta_info_alloc_with_link(sdata
, mac
,
2137 params
->link_sta_params
.link_id
,
2138 params
->link_sta_params
.link_mac
?: mac
,
2141 sta
= sta_info_alloc(sdata
, mac
, GFP_KERNEL
);
2146 if (params
->sta_flags_set
& BIT(NL80211_STA_FLAG_TDLS_PEER
))
2147 sta
->sta
.tdls
= true;
2149 /* Though the mutex is not needed here (since the station is not
2150 * visible yet), sta_apply_parameters (and inner functions) require
2151 * the mutex due to other paths.
2153 err
= sta_apply_parameters(local
, sta
, params
);
2155 sta_info_free(local
, sta
);
2160 * for TDLS and for unassociated station, rate control should be
2161 * initialized only when rates are known and station is marked
2162 * authorized/associated
2164 if (!test_sta_flag(sta
, WLAN_STA_TDLS_PEER
) &&
2165 test_sta_flag(sta
, WLAN_STA_ASSOC
))
2166 rate_control_rate_init_all_links(sta
);
2168 return sta_info_insert(sta
);
2171 static int ieee80211_del_station(struct wiphy
*wiphy
, struct net_device
*dev
,
2172 struct station_del_parameters
*params
)
2174 struct ieee80211_sub_if_data
*sdata
;
2176 sdata
= IEEE80211_DEV_TO_SUB_IF(dev
);
2179 return sta_info_destroy_addr_bss(sdata
, params
->mac
);
2181 sta_info_flush(sdata
, params
->link_id
);
2185 static int ieee80211_change_station(struct wiphy
*wiphy
,
2186 struct net_device
*dev
, const u8
*mac
,
2187 struct station_parameters
*params
)
2189 struct ieee80211_sub_if_data
*sdata
= IEEE80211_DEV_TO_SUB_IF(dev
);
2190 struct ieee80211_local
*local
= wiphy_priv(wiphy
);
2191 struct sta_info
*sta
;
2192 struct ieee80211_sub_if_data
*vlansdata
;
2193 enum cfg80211_station_type statype
;
2196 lockdep_assert_wiphy(local
->hw
.wiphy
);
2198 sta
= sta_info_get_bss(sdata
, mac
);
2202 switch (sdata
->vif
.type
) {
2203 case NL80211_IFTYPE_MESH_POINT
:
2204 if (sdata
->u
.mesh
.user_mpm
)
2205 statype
= CFG80211_STA_MESH_PEER_USER
;
2207 statype
= CFG80211_STA_MESH_PEER_KERNEL
;
2209 case NL80211_IFTYPE_ADHOC
:
2210 statype
= CFG80211_STA_IBSS
;
2212 case NL80211_IFTYPE_STATION
:
2213 if (!test_sta_flag(sta
, WLAN_STA_TDLS_PEER
)) {
2214 statype
= CFG80211_STA_AP_STA
;
2217 if (test_sta_flag(sta
, WLAN_STA_AUTHORIZED
))
2218 statype
= CFG80211_STA_TDLS_PEER_ACTIVE
;
2220 statype
= CFG80211_STA_TDLS_PEER_SETUP
;
2222 case NL80211_IFTYPE_AP
:
2223 case NL80211_IFTYPE_AP_VLAN
:
2224 if (test_sta_flag(sta
, WLAN_STA_ASSOC
))
2225 statype
= CFG80211_STA_AP_CLIENT
;
2227 statype
= CFG80211_STA_AP_CLIENT_UNASSOC
;
2233 err
= cfg80211_check_station_change(wiphy
, params
, statype
);
2237 if (params
->vlan
&& params
->vlan
!= sta
->sdata
->dev
) {
2238 vlansdata
= IEEE80211_DEV_TO_SUB_IF(params
->vlan
);
2240 if (params
->vlan
->ieee80211_ptr
->use_4addr
) {
2241 if (vlansdata
->u
.vlan
.sta
)
2244 rcu_assign_pointer(vlansdata
->u
.vlan
.sta
, sta
);
2245 __ieee80211_check_fast_rx_iface(vlansdata
);
2246 drv_sta_set_4addr(local
, sta
->sdata
, &sta
->sta
, true);
2249 if (sta
->sdata
->vif
.type
== NL80211_IFTYPE_AP_VLAN
&&
2250 sta
->sdata
->u
.vlan
.sta
)
2251 RCU_INIT_POINTER(sta
->sdata
->u
.vlan
.sta
, NULL
);
2253 if (test_sta_flag(sta
, WLAN_STA_AUTHORIZED
))
2254 ieee80211_vif_dec_num_mcast(sta
->sdata
);
2256 sta
->sdata
= vlansdata
;
2257 ieee80211_check_fast_rx(sta
);
2258 ieee80211_check_fast_xmit(sta
);
2260 if (test_sta_flag(sta
, WLAN_STA_AUTHORIZED
)) {
2261 ieee80211_vif_inc_num_mcast(sta
->sdata
);
2262 cfg80211_send_layer2_update(sta
->sdata
->dev
,
2267 err
= sta_apply_parameters(local
, sta
, params
);
2271 if (sdata
->vif
.type
== NL80211_IFTYPE_STATION
&&
2272 params
->sta_flags_mask
& BIT(NL80211_STA_FLAG_AUTHORIZED
)) {
2273 ieee80211_recalc_ps(local
);
2274 ieee80211_recalc_ps_vif(sdata
);
2280 #ifdef CONFIG_MAC80211_MESH
2281 static int ieee80211_add_mpath(struct wiphy
*wiphy
, struct net_device
*dev
,
2282 const u8
*dst
, const u8
*next_hop
)
2284 struct ieee80211_sub_if_data
*sdata
;
2285 struct mesh_path
*mpath
;
2286 struct sta_info
*sta
;
2288 sdata
= IEEE80211_DEV_TO_SUB_IF(dev
);
2291 sta
= sta_info_get(sdata
, next_hop
);
2297 mpath
= mesh_path_add(sdata
, dst
);
2298 if (IS_ERR(mpath
)) {
2300 return PTR_ERR(mpath
);
2303 mesh_path_fix_nexthop(mpath
, sta
);
2309 static int ieee80211_del_mpath(struct wiphy
*wiphy
, struct net_device
*dev
,
2312 struct ieee80211_sub_if_data
*sdata
= IEEE80211_DEV_TO_SUB_IF(dev
);
2315 return mesh_path_del(sdata
, dst
);
2317 mesh_path_flush_by_iface(sdata
);
2321 static int ieee80211_change_mpath(struct wiphy
*wiphy
, struct net_device
*dev
,
2322 const u8
*dst
, const u8
*next_hop
)
2324 struct ieee80211_sub_if_data
*sdata
;
2325 struct mesh_path
*mpath
;
2326 struct sta_info
*sta
;
2328 sdata
= IEEE80211_DEV_TO_SUB_IF(dev
);
2332 sta
= sta_info_get(sdata
, next_hop
);
2338 mpath
= mesh_path_lookup(sdata
, dst
);
2344 mesh_path_fix_nexthop(mpath
, sta
);
2350 static void mpath_set_pinfo(struct mesh_path
*mpath
, u8
*next_hop
,
2351 struct mpath_info
*pinfo
)
2353 struct sta_info
*next_hop_sta
= rcu_dereference(mpath
->next_hop
);
2356 memcpy(next_hop
, next_hop_sta
->sta
.addr
, ETH_ALEN
);
2358 eth_zero_addr(next_hop
);
2360 memset(pinfo
, 0, sizeof(*pinfo
));
2362 pinfo
->generation
= mpath
->sdata
->u
.mesh
.mesh_paths_generation
;
2364 pinfo
->filled
= MPATH_INFO_FRAME_QLEN
|
2367 MPATH_INFO_EXPTIME
|
2368 MPATH_INFO_DISCOVERY_TIMEOUT
|
2369 MPATH_INFO_DISCOVERY_RETRIES
|
2371 MPATH_INFO_HOP_COUNT
|
2372 MPATH_INFO_PATH_CHANGE
;
2374 pinfo
->frame_qlen
= mpath
->frame_queue
.qlen
;
2375 pinfo
->sn
= mpath
->sn
;
2376 pinfo
->metric
= mpath
->metric
;
2377 if (time_before(jiffies
, mpath
->exp_time
))
2378 pinfo
->exptime
= jiffies_to_msecs(mpath
->exp_time
- jiffies
);
2379 pinfo
->discovery_timeout
=
2380 jiffies_to_msecs(mpath
->discovery_timeout
);
2381 pinfo
->discovery_retries
= mpath
->discovery_retries
;
2382 if (mpath
->flags
& MESH_PATH_ACTIVE
)
2383 pinfo
->flags
|= NL80211_MPATH_FLAG_ACTIVE
;
2384 if (mpath
->flags
& MESH_PATH_RESOLVING
)
2385 pinfo
->flags
|= NL80211_MPATH_FLAG_RESOLVING
;
2386 if (mpath
->flags
& MESH_PATH_SN_VALID
)
2387 pinfo
->flags
|= NL80211_MPATH_FLAG_SN_VALID
;
2388 if (mpath
->flags
& MESH_PATH_FIXED
)
2389 pinfo
->flags
|= NL80211_MPATH_FLAG_FIXED
;
2390 if (mpath
->flags
& MESH_PATH_RESOLVED
)
2391 pinfo
->flags
|= NL80211_MPATH_FLAG_RESOLVED
;
2392 pinfo
->hop_count
= mpath
->hop_count
;
2393 pinfo
->path_change_count
= mpath
->path_change_count
;
2396 static int ieee80211_get_mpath(struct wiphy
*wiphy
, struct net_device
*dev
,
2397 u8
*dst
, u8
*next_hop
, struct mpath_info
*pinfo
)
2400 struct ieee80211_sub_if_data
*sdata
;
2401 struct mesh_path
*mpath
;
2403 sdata
= IEEE80211_DEV_TO_SUB_IF(dev
);
2406 mpath
= mesh_path_lookup(sdata
, dst
);
2411 memcpy(dst
, mpath
->dst
, ETH_ALEN
);
2412 mpath_set_pinfo(mpath
, next_hop
, pinfo
);
2417 static int ieee80211_dump_mpath(struct wiphy
*wiphy
, struct net_device
*dev
,
2418 int idx
, u8
*dst
, u8
*next_hop
,
2419 struct mpath_info
*pinfo
)
2421 struct ieee80211_sub_if_data
*sdata
;
2422 struct mesh_path
*mpath
;
2424 sdata
= IEEE80211_DEV_TO_SUB_IF(dev
);
2427 mpath
= mesh_path_lookup_by_idx(sdata
, idx
);
2432 memcpy(dst
, mpath
->dst
, ETH_ALEN
);
2433 mpath_set_pinfo(mpath
, next_hop
, pinfo
);
2438 static void mpp_set_pinfo(struct mesh_path
*mpath
, u8
*mpp
,
2439 struct mpath_info
*pinfo
)
2441 memset(pinfo
, 0, sizeof(*pinfo
));
2442 memcpy(mpp
, mpath
->mpp
, ETH_ALEN
);
2444 pinfo
->generation
= mpath
->sdata
->u
.mesh
.mpp_paths_generation
;
2447 static int ieee80211_get_mpp(struct wiphy
*wiphy
, struct net_device
*dev
,
2448 u8
*dst
, u8
*mpp
, struct mpath_info
*pinfo
)
2451 struct ieee80211_sub_if_data
*sdata
;
2452 struct mesh_path
*mpath
;
2454 sdata
= IEEE80211_DEV_TO_SUB_IF(dev
);
2457 mpath
= mpp_path_lookup(sdata
, dst
);
2462 memcpy(dst
, mpath
->dst
, ETH_ALEN
);
2463 mpp_set_pinfo(mpath
, mpp
, pinfo
);
2468 static int ieee80211_dump_mpp(struct wiphy
*wiphy
, struct net_device
*dev
,
2469 int idx
, u8
*dst
, u8
*mpp
,
2470 struct mpath_info
*pinfo
)
2472 struct ieee80211_sub_if_data
*sdata
;
2473 struct mesh_path
*mpath
;
2475 sdata
= IEEE80211_DEV_TO_SUB_IF(dev
);
2478 mpath
= mpp_path_lookup_by_idx(sdata
, idx
);
2483 memcpy(dst
, mpath
->dst
, ETH_ALEN
);
2484 mpp_set_pinfo(mpath
, mpp
, pinfo
);
2489 static int ieee80211_get_mesh_config(struct wiphy
*wiphy
,
2490 struct net_device
*dev
,
2491 struct mesh_config
*conf
)
2493 struct ieee80211_sub_if_data
*sdata
;
2494 sdata
= IEEE80211_DEV_TO_SUB_IF(dev
);
2496 memcpy(conf
, &(sdata
->u
.mesh
.mshcfg
), sizeof(struct mesh_config
));
2500 static inline bool _chg_mesh_attr(enum nl80211_meshconf_params parm
, u32 mask
)
2502 return (mask
>> (parm
-1)) & 0x1;
2505 static int copy_mesh_setup(struct ieee80211_if_mesh
*ifmsh
,
2506 const struct mesh_setup
*setup
)
2509 struct ieee80211_sub_if_data
*sdata
= container_of(ifmsh
,
2510 struct ieee80211_sub_if_data
, u
.mesh
);
2513 /* allocate information elements */
2516 if (setup
->ie_len
) {
2517 new_ie
= kmemdup(setup
->ie
, setup
->ie_len
,
2522 ifmsh
->ie_len
= setup
->ie_len
;
2525 /* now copy the rest of the setup parameters */
2526 ifmsh
->mesh_id_len
= setup
->mesh_id_len
;
2527 memcpy(ifmsh
->mesh_id
, setup
->mesh_id
, ifmsh
->mesh_id_len
);
2528 ifmsh
->mesh_sp_id
= setup
->sync_method
;
2529 ifmsh
->mesh_pp_id
= setup
->path_sel_proto
;
2530 ifmsh
->mesh_pm_id
= setup
->path_metric
;
2531 ifmsh
->user_mpm
= setup
->user_mpm
;
2532 ifmsh
->mesh_auth_id
= setup
->auth_id
;
2533 ifmsh
->security
= IEEE80211_MESH_SEC_NONE
;
2534 ifmsh
->userspace_handles_dfs
= setup
->userspace_handles_dfs
;
2535 if (setup
->is_authenticated
)
2536 ifmsh
->security
|= IEEE80211_MESH_SEC_AUTHED
;
2537 if (setup
->is_secure
)
2538 ifmsh
->security
|= IEEE80211_MESH_SEC_SECURED
;
2540 /* mcast rate setting in Mesh Node */
2541 memcpy(sdata
->vif
.bss_conf
.mcast_rate
, setup
->mcast_rate
,
2542 sizeof(setup
->mcast_rate
));
2543 sdata
->vif
.bss_conf
.basic_rates
= setup
->basic_rates
;
2545 sdata
->vif
.bss_conf
.beacon_int
= setup
->beacon_interval
;
2546 sdata
->vif
.bss_conf
.dtim_period
= setup
->dtim_period
;
2548 sdata
->beacon_rate_set
= false;
2549 if (wiphy_ext_feature_isset(sdata
->local
->hw
.wiphy
,
2550 NL80211_EXT_FEATURE_BEACON_RATE_LEGACY
)) {
2551 for (i
= 0; i
< NUM_NL80211_BANDS
; i
++) {
2552 sdata
->beacon_rateidx_mask
[i
] =
2553 setup
->beacon_rate
.control
[i
].legacy
;
2554 if (sdata
->beacon_rateidx_mask
[i
])
2555 sdata
->beacon_rate_set
= true;
2562 static int ieee80211_update_mesh_config(struct wiphy
*wiphy
,
2563 struct net_device
*dev
, u32 mask
,
2564 const struct mesh_config
*nconf
)
2566 struct mesh_config
*conf
;
2567 struct ieee80211_sub_if_data
*sdata
;
2568 struct ieee80211_if_mesh
*ifmsh
;
2570 sdata
= IEEE80211_DEV_TO_SUB_IF(dev
);
2571 ifmsh
= &sdata
->u
.mesh
;
2573 /* Set the config options which we are interested in setting */
2574 conf
= &(sdata
->u
.mesh
.mshcfg
);
2575 if (_chg_mesh_attr(NL80211_MESHCONF_RETRY_TIMEOUT
, mask
))
2576 conf
->dot11MeshRetryTimeout
= nconf
->dot11MeshRetryTimeout
;
2577 if (_chg_mesh_attr(NL80211_MESHCONF_CONFIRM_TIMEOUT
, mask
))
2578 conf
->dot11MeshConfirmTimeout
= nconf
->dot11MeshConfirmTimeout
;
2579 if (_chg_mesh_attr(NL80211_MESHCONF_HOLDING_TIMEOUT
, mask
))
2580 conf
->dot11MeshHoldingTimeout
= nconf
->dot11MeshHoldingTimeout
;
2581 if (_chg_mesh_attr(NL80211_MESHCONF_MAX_PEER_LINKS
, mask
))
2582 conf
->dot11MeshMaxPeerLinks
= nconf
->dot11MeshMaxPeerLinks
;
2583 if (_chg_mesh_attr(NL80211_MESHCONF_MAX_RETRIES
, mask
))
2584 conf
->dot11MeshMaxRetries
= nconf
->dot11MeshMaxRetries
;
2585 if (_chg_mesh_attr(NL80211_MESHCONF_TTL
, mask
))
2586 conf
->dot11MeshTTL
= nconf
->dot11MeshTTL
;
2587 if (_chg_mesh_attr(NL80211_MESHCONF_ELEMENT_TTL
, mask
))
2588 conf
->element_ttl
= nconf
->element_ttl
;
2589 if (_chg_mesh_attr(NL80211_MESHCONF_AUTO_OPEN_PLINKS
, mask
)) {
2590 if (ifmsh
->user_mpm
)
2592 conf
->auto_open_plinks
= nconf
->auto_open_plinks
;
2594 if (_chg_mesh_attr(NL80211_MESHCONF_SYNC_OFFSET_MAX_NEIGHBOR
, mask
))
2595 conf
->dot11MeshNbrOffsetMaxNeighbor
=
2596 nconf
->dot11MeshNbrOffsetMaxNeighbor
;
2597 if (_chg_mesh_attr(NL80211_MESHCONF_HWMP_MAX_PREQ_RETRIES
, mask
))
2598 conf
->dot11MeshHWMPmaxPREQretries
=
2599 nconf
->dot11MeshHWMPmaxPREQretries
;
2600 if (_chg_mesh_attr(NL80211_MESHCONF_PATH_REFRESH_TIME
, mask
))
2601 conf
->path_refresh_time
= nconf
->path_refresh_time
;
2602 if (_chg_mesh_attr(NL80211_MESHCONF_MIN_DISCOVERY_TIMEOUT
, mask
))
2603 conf
->min_discovery_timeout
= nconf
->min_discovery_timeout
;
2604 if (_chg_mesh_attr(NL80211_MESHCONF_HWMP_ACTIVE_PATH_TIMEOUT
, mask
))
2605 conf
->dot11MeshHWMPactivePathTimeout
=
2606 nconf
->dot11MeshHWMPactivePathTimeout
;
2607 if (_chg_mesh_attr(NL80211_MESHCONF_HWMP_PREQ_MIN_INTERVAL
, mask
))
2608 conf
->dot11MeshHWMPpreqMinInterval
=
2609 nconf
->dot11MeshHWMPpreqMinInterval
;
2610 if (_chg_mesh_attr(NL80211_MESHCONF_HWMP_PERR_MIN_INTERVAL
, mask
))
2611 conf
->dot11MeshHWMPperrMinInterval
=
2612 nconf
->dot11MeshHWMPperrMinInterval
;
2613 if (_chg_mesh_attr(NL80211_MESHCONF_HWMP_NET_DIAM_TRVS_TIME
,
2615 conf
->dot11MeshHWMPnetDiameterTraversalTime
=
2616 nconf
->dot11MeshHWMPnetDiameterTraversalTime
;
2617 if (_chg_mesh_attr(NL80211_MESHCONF_HWMP_ROOTMODE
, mask
)) {
2618 conf
->dot11MeshHWMPRootMode
= nconf
->dot11MeshHWMPRootMode
;
2619 ieee80211_mesh_root_setup(ifmsh
);
2621 if (_chg_mesh_attr(NL80211_MESHCONF_GATE_ANNOUNCEMENTS
, mask
)) {
2622 /* our current gate announcement implementation rides on root
2623 * announcements, so require this ifmsh to also be a root node
2625 if (nconf
->dot11MeshGateAnnouncementProtocol
&&
2626 !(conf
->dot11MeshHWMPRootMode
> IEEE80211_ROOTMODE_ROOT
)) {
2627 conf
->dot11MeshHWMPRootMode
= IEEE80211_PROACTIVE_RANN
;
2628 ieee80211_mesh_root_setup(ifmsh
);
2630 conf
->dot11MeshGateAnnouncementProtocol
=
2631 nconf
->dot11MeshGateAnnouncementProtocol
;
2633 if (_chg_mesh_attr(NL80211_MESHCONF_HWMP_RANN_INTERVAL
, mask
))
2634 conf
->dot11MeshHWMPRannInterval
=
2635 nconf
->dot11MeshHWMPRannInterval
;
2636 if (_chg_mesh_attr(NL80211_MESHCONF_FORWARDING
, mask
))
2637 conf
->dot11MeshForwarding
= nconf
->dot11MeshForwarding
;
2638 if (_chg_mesh_attr(NL80211_MESHCONF_RSSI_THRESHOLD
, mask
)) {
2639 /* our RSSI threshold implementation is supported only for
2640 * devices that report signal in dBm.
2642 if (!ieee80211_hw_check(&sdata
->local
->hw
, SIGNAL_DBM
))
2644 conf
->rssi_threshold
= nconf
->rssi_threshold
;
2646 if (_chg_mesh_attr(NL80211_MESHCONF_HT_OPMODE
, mask
)) {
2647 conf
->ht_opmode
= nconf
->ht_opmode
;
2648 sdata
->vif
.bss_conf
.ht_operation_mode
= nconf
->ht_opmode
;
2649 ieee80211_link_info_change_notify(sdata
, &sdata
->deflink
,
2652 if (_chg_mesh_attr(NL80211_MESHCONF_HWMP_PATH_TO_ROOT_TIMEOUT
, mask
))
2653 conf
->dot11MeshHWMPactivePathToRootTimeout
=
2654 nconf
->dot11MeshHWMPactivePathToRootTimeout
;
2655 if (_chg_mesh_attr(NL80211_MESHCONF_HWMP_ROOT_INTERVAL
, mask
))
2656 conf
->dot11MeshHWMProotInterval
=
2657 nconf
->dot11MeshHWMProotInterval
;
2658 if (_chg_mesh_attr(NL80211_MESHCONF_HWMP_CONFIRMATION_INTERVAL
, mask
))
2659 conf
->dot11MeshHWMPconfirmationInterval
=
2660 nconf
->dot11MeshHWMPconfirmationInterval
;
2661 if (_chg_mesh_attr(NL80211_MESHCONF_POWER_MODE
, mask
)) {
2662 conf
->power_mode
= nconf
->power_mode
;
2663 ieee80211_mps_local_status_update(sdata
);
2665 if (_chg_mesh_attr(NL80211_MESHCONF_AWAKE_WINDOW
, mask
))
2666 conf
->dot11MeshAwakeWindowDuration
=
2667 nconf
->dot11MeshAwakeWindowDuration
;
2668 if (_chg_mesh_attr(NL80211_MESHCONF_PLINK_TIMEOUT
, mask
))
2669 conf
->plink_timeout
= nconf
->plink_timeout
;
2670 if (_chg_mesh_attr(NL80211_MESHCONF_CONNECTED_TO_GATE
, mask
))
2671 conf
->dot11MeshConnectedToMeshGate
=
2672 nconf
->dot11MeshConnectedToMeshGate
;
2673 if (_chg_mesh_attr(NL80211_MESHCONF_NOLEARN
, mask
))
2674 conf
->dot11MeshNolearn
= nconf
->dot11MeshNolearn
;
2675 if (_chg_mesh_attr(NL80211_MESHCONF_CONNECTED_TO_AS
, mask
))
2676 conf
->dot11MeshConnectedToAuthServer
=
2677 nconf
->dot11MeshConnectedToAuthServer
;
2678 ieee80211_mbss_info_change_notify(sdata
, BSS_CHANGED_BEACON
);
2682 static int ieee80211_join_mesh(struct wiphy
*wiphy
, struct net_device
*dev
,
2683 const struct mesh_config
*conf
,
2684 const struct mesh_setup
*setup
)
2686 struct ieee80211_sub_if_data
*sdata
= IEEE80211_DEV_TO_SUB_IF(dev
);
2687 struct ieee80211_chan_req chanreq
= { .oper
= setup
->chandef
};
2688 struct ieee80211_if_mesh
*ifmsh
= &sdata
->u
.mesh
;
2691 lockdep_assert_wiphy(sdata
->local
->hw
.wiphy
);
2693 memcpy(&ifmsh
->mshcfg
, conf
, sizeof(struct mesh_config
));
2694 err
= copy_mesh_setup(ifmsh
, setup
);
2698 sdata
->control_port_over_nl80211
= setup
->control_port_over_nl80211
;
2700 /* can mesh use other SMPS modes? */
2701 sdata
->deflink
.smps_mode
= IEEE80211_SMPS_OFF
;
2702 sdata
->deflink
.needed_rx_chains
= sdata
->local
->rx_chains
;
2704 err
= ieee80211_link_use_channel(&sdata
->deflink
, &chanreq
,
2705 IEEE80211_CHANCTX_SHARED
);
2709 return ieee80211_start_mesh(sdata
);
2712 static int ieee80211_leave_mesh(struct wiphy
*wiphy
, struct net_device
*dev
)
2714 struct ieee80211_sub_if_data
*sdata
= IEEE80211_DEV_TO_SUB_IF(dev
);
2716 lockdep_assert_wiphy(sdata
->local
->hw
.wiphy
);
2718 ieee80211_stop_mesh(sdata
);
2719 ieee80211_link_release_channel(&sdata
->deflink
);
2720 kfree(sdata
->u
.mesh
.ie
);
2726 static int ieee80211_change_bss(struct wiphy
*wiphy
,
2727 struct net_device
*dev
,
2728 struct bss_parameters
*params
)
2730 struct ieee80211_sub_if_data
*sdata
= IEEE80211_DEV_TO_SUB_IF(dev
);
2731 struct ieee80211_link_data
*link
;
2732 struct ieee80211_supported_band
*sband
;
2735 link
= ieee80211_link_or_deflink(sdata
, params
->link_id
, true);
2737 return PTR_ERR(link
);
2739 if (!sdata_dereference(link
->u
.ap
.beacon
, sdata
))
2742 sband
= ieee80211_get_link_sband(link
);
2746 if (params
->basic_rates
) {
2747 if (!ieee80211_parse_bitrates(link
->conf
->chanreq
.oper
.width
,
2748 wiphy
->bands
[sband
->band
],
2749 params
->basic_rates
,
2750 params
->basic_rates_len
,
2751 &link
->conf
->basic_rates
))
2753 changed
|= BSS_CHANGED_BASIC_RATES
;
2754 ieee80211_check_rate_mask(link
);
2757 if (params
->use_cts_prot
>= 0) {
2758 link
->conf
->use_cts_prot
= params
->use_cts_prot
;
2759 changed
|= BSS_CHANGED_ERP_CTS_PROT
;
2761 if (params
->use_short_preamble
>= 0) {
2762 link
->conf
->use_short_preamble
= params
->use_short_preamble
;
2763 changed
|= BSS_CHANGED_ERP_PREAMBLE
;
2766 if (!link
->conf
->use_short_slot
&&
2767 (sband
->band
== NL80211_BAND_5GHZ
||
2768 sband
->band
== NL80211_BAND_6GHZ
)) {
2769 link
->conf
->use_short_slot
= true;
2770 changed
|= BSS_CHANGED_ERP_SLOT
;
2773 if (params
->use_short_slot_time
>= 0) {
2774 link
->conf
->use_short_slot
= params
->use_short_slot_time
;
2775 changed
|= BSS_CHANGED_ERP_SLOT
;
2778 if (params
->ap_isolate
>= 0) {
2779 if (params
->ap_isolate
)
2780 sdata
->flags
|= IEEE80211_SDATA_DONT_BRIDGE_PACKETS
;
2782 sdata
->flags
&= ~IEEE80211_SDATA_DONT_BRIDGE_PACKETS
;
2783 ieee80211_check_fast_rx_iface(sdata
);
2786 if (params
->ht_opmode
>= 0) {
2787 link
->conf
->ht_operation_mode
= (u16
)params
->ht_opmode
;
2788 changed
|= BSS_CHANGED_HT
;
2791 if (params
->p2p_ctwindow
>= 0) {
2792 link
->conf
->p2p_noa_attr
.oppps_ctwindow
&=
2793 ~IEEE80211_P2P_OPPPS_CTWINDOW_MASK
;
2794 link
->conf
->p2p_noa_attr
.oppps_ctwindow
|=
2795 params
->p2p_ctwindow
& IEEE80211_P2P_OPPPS_CTWINDOW_MASK
;
2796 changed
|= BSS_CHANGED_P2P_PS
;
2799 if (params
->p2p_opp_ps
> 0) {
2800 link
->conf
->p2p_noa_attr
.oppps_ctwindow
|=
2801 IEEE80211_P2P_OPPPS_ENABLE_BIT
;
2802 changed
|= BSS_CHANGED_P2P_PS
;
2803 } else if (params
->p2p_opp_ps
== 0) {
2804 link
->conf
->p2p_noa_attr
.oppps_ctwindow
&=
2805 ~IEEE80211_P2P_OPPPS_ENABLE_BIT
;
2806 changed
|= BSS_CHANGED_P2P_PS
;
2809 ieee80211_link_info_change_notify(sdata
, link
, changed
);
2814 static int ieee80211_set_txq_params(struct wiphy
*wiphy
,
2815 struct net_device
*dev
,
2816 struct ieee80211_txq_params
*params
)
2818 struct ieee80211_local
*local
= wiphy_priv(wiphy
);
2819 struct ieee80211_sub_if_data
*sdata
= IEEE80211_DEV_TO_SUB_IF(dev
);
2820 struct ieee80211_link_data
*link
=
2821 ieee80211_link_or_deflink(sdata
, params
->link_id
, true);
2822 struct ieee80211_tx_queue_params p
;
2824 if (!local
->ops
->conf_tx
)
2827 if (local
->hw
.queues
< IEEE80211_NUM_ACS
)
2831 return PTR_ERR(link
);
2833 memset(&p
, 0, sizeof(p
));
2834 p
.aifs
= params
->aifs
;
2835 p
.cw_max
= params
->cwmax
;
2836 p
.cw_min
= params
->cwmin
;
2837 p
.txop
= params
->txop
;
2840 * Setting tx queue params disables u-apsd because it's only
2841 * called in master mode.
2845 ieee80211_regulatory_limit_wmm_params(sdata
, &p
, params
->ac
);
2847 link
->tx_conf
[params
->ac
] = p
;
2848 if (drv_conf_tx(local
, link
, params
->ac
, &p
)) {
2849 wiphy_debug(local
->hw
.wiphy
,
2850 "failed to set TX queue parameters for AC %d\n",
2855 ieee80211_link_info_change_notify(sdata
, link
,
2862 static int ieee80211_suspend(struct wiphy
*wiphy
,
2863 struct cfg80211_wowlan
*wowlan
)
2865 return __ieee80211_suspend(wiphy_priv(wiphy
), wowlan
);
2868 static int ieee80211_resume(struct wiphy
*wiphy
)
2870 return __ieee80211_resume(wiphy_priv(wiphy
));
2873 #define ieee80211_suspend NULL
2874 #define ieee80211_resume NULL
2877 static int ieee80211_scan(struct wiphy
*wiphy
,
2878 struct cfg80211_scan_request
*req
)
2880 struct ieee80211_sub_if_data
*sdata
;
2882 sdata
= IEEE80211_WDEV_TO_SUB_IF(req
->wdev
);
2884 switch (ieee80211_vif_type_p2p(&sdata
->vif
)) {
2885 case NL80211_IFTYPE_STATION
:
2886 case NL80211_IFTYPE_ADHOC
:
2887 case NL80211_IFTYPE_MESH_POINT
:
2888 case NL80211_IFTYPE_P2P_CLIENT
:
2889 case NL80211_IFTYPE_P2P_DEVICE
:
2891 case NL80211_IFTYPE_P2P_GO
:
2892 if (sdata
->local
->ops
->hw_scan
)
2895 * FIXME: implement NoA while scanning in software,
2896 * for now fall through to allow scanning only when
2897 * beaconing hasn't been configured yet
2900 case NL80211_IFTYPE_AP
:
2902 * If the scan has been forced (and the driver supports
2903 * forcing), don't care about being beaconing already.
2904 * This will create problems to the attached stations (e.g. all
2905 * the frames sent while scanning on other channel will be
2908 if (sdata
->deflink
.u
.ap
.beacon
&&
2909 (!(wiphy
->features
& NL80211_FEATURE_AP_SCAN
) ||
2910 !(req
->flags
& NL80211_SCAN_FLAG_AP
)))
2913 case NL80211_IFTYPE_NAN
:
2918 return ieee80211_request_scan(sdata
, req
);
2921 static void ieee80211_abort_scan(struct wiphy
*wiphy
, struct wireless_dev
*wdev
)
2923 ieee80211_scan_cancel(wiphy_priv(wiphy
));
2927 ieee80211_sched_scan_start(struct wiphy
*wiphy
,
2928 struct net_device
*dev
,
2929 struct cfg80211_sched_scan_request
*req
)
2931 struct ieee80211_sub_if_data
*sdata
= IEEE80211_DEV_TO_SUB_IF(dev
);
2933 if (!sdata
->local
->ops
->sched_scan_start
)
2936 return ieee80211_request_sched_scan_start(sdata
, req
);
2940 ieee80211_sched_scan_stop(struct wiphy
*wiphy
, struct net_device
*dev
,
2943 struct ieee80211_local
*local
= wiphy_priv(wiphy
);
2945 if (!local
->ops
->sched_scan_stop
)
2948 return ieee80211_request_sched_scan_stop(local
);
2951 static int ieee80211_auth(struct wiphy
*wiphy
, struct net_device
*dev
,
2952 struct cfg80211_auth_request
*req
)
2954 return ieee80211_mgd_auth(IEEE80211_DEV_TO_SUB_IF(dev
), req
);
2957 static int ieee80211_assoc(struct wiphy
*wiphy
, struct net_device
*dev
,
2958 struct cfg80211_assoc_request
*req
)
2960 return ieee80211_mgd_assoc(IEEE80211_DEV_TO_SUB_IF(dev
), req
);
2963 static int ieee80211_deauth(struct wiphy
*wiphy
, struct net_device
*dev
,
2964 struct cfg80211_deauth_request
*req
)
2966 return ieee80211_mgd_deauth(IEEE80211_DEV_TO_SUB_IF(dev
), req
);
2969 static int ieee80211_disassoc(struct wiphy
*wiphy
, struct net_device
*dev
,
2970 struct cfg80211_disassoc_request
*req
)
2972 return ieee80211_mgd_disassoc(IEEE80211_DEV_TO_SUB_IF(dev
), req
);
2975 static int ieee80211_join_ibss(struct wiphy
*wiphy
, struct net_device
*dev
,
2976 struct cfg80211_ibss_params
*params
)
2978 return ieee80211_ibss_join(IEEE80211_DEV_TO_SUB_IF(dev
), params
);
2981 static int ieee80211_leave_ibss(struct wiphy
*wiphy
, struct net_device
*dev
)
2983 return ieee80211_ibss_leave(IEEE80211_DEV_TO_SUB_IF(dev
));
2986 static int ieee80211_join_ocb(struct wiphy
*wiphy
, struct net_device
*dev
,
2987 struct ocb_setup
*setup
)
2989 return ieee80211_ocb_join(IEEE80211_DEV_TO_SUB_IF(dev
), setup
);
2992 static int ieee80211_leave_ocb(struct wiphy
*wiphy
, struct net_device
*dev
)
2994 return ieee80211_ocb_leave(IEEE80211_DEV_TO_SUB_IF(dev
));
2997 static int ieee80211_set_mcast_rate(struct wiphy
*wiphy
, struct net_device
*dev
,
2998 int rate
[NUM_NL80211_BANDS
])
3000 struct ieee80211_sub_if_data
*sdata
= IEEE80211_DEV_TO_SUB_IF(dev
);
3002 memcpy(sdata
->vif
.bss_conf
.mcast_rate
, rate
,
3003 sizeof(int) * NUM_NL80211_BANDS
);
3005 if (ieee80211_sdata_running(sdata
))
3006 ieee80211_link_info_change_notify(sdata
, &sdata
->deflink
,
3007 BSS_CHANGED_MCAST_RATE
);
3012 static int ieee80211_set_wiphy_params(struct wiphy
*wiphy
, u32 changed
)
3014 struct ieee80211_local
*local
= wiphy_priv(wiphy
);
3017 if (changed
& WIPHY_PARAM_FRAG_THRESHOLD
) {
3018 ieee80211_check_fast_xmit_all(local
);
3020 err
= drv_set_frag_threshold(local
, wiphy
->frag_threshold
);
3023 ieee80211_check_fast_xmit_all(local
);
3028 if ((changed
& WIPHY_PARAM_COVERAGE_CLASS
) ||
3029 (changed
& WIPHY_PARAM_DYN_ACK
)) {
3032 coverage_class
= changed
& WIPHY_PARAM_COVERAGE_CLASS
?
3033 wiphy
->coverage_class
: -1;
3034 err
= drv_set_coverage_class(local
, coverage_class
);
3040 if (changed
& WIPHY_PARAM_RTS_THRESHOLD
) {
3041 err
= drv_set_rts_threshold(local
, wiphy
->rts_threshold
);
3047 if (changed
& WIPHY_PARAM_RETRY_SHORT
) {
3048 if (wiphy
->retry_short
> IEEE80211_MAX_TX_RETRY
)
3050 local
->hw
.conf
.short_frame_max_tx_count
= wiphy
->retry_short
;
3052 if (changed
& WIPHY_PARAM_RETRY_LONG
) {
3053 if (wiphy
->retry_long
> IEEE80211_MAX_TX_RETRY
)
3055 local
->hw
.conf
.long_frame_max_tx_count
= wiphy
->retry_long
;
3058 (WIPHY_PARAM_RETRY_SHORT
| WIPHY_PARAM_RETRY_LONG
))
3059 ieee80211_hw_config(local
, IEEE80211_CONF_CHANGE_RETRY_LIMITS
);
3061 if (changed
& (WIPHY_PARAM_TXQ_LIMIT
|
3062 WIPHY_PARAM_TXQ_MEMORY_LIMIT
|
3063 WIPHY_PARAM_TXQ_QUANTUM
))
3064 ieee80211_txq_set_params(local
);
3069 static int ieee80211_set_tx_power(struct wiphy
*wiphy
,
3070 struct wireless_dev
*wdev
,
3071 enum nl80211_tx_power_setting type
, int mbm
)
3073 struct ieee80211_local
*local
= wiphy_priv(wiphy
);
3074 struct ieee80211_sub_if_data
*sdata
;
3075 enum nl80211_tx_power_setting txp_type
= type
;
3076 bool update_txp_type
= false;
3077 bool has_monitor
= false;
3078 int user_power_level
;
3079 int old_power
= local
->user_power_level
;
3081 lockdep_assert_wiphy(local
->hw
.wiphy
);
3084 case NL80211_TX_POWER_AUTOMATIC
:
3085 user_power_level
= IEEE80211_UNSET_POWER_LEVEL
;
3086 txp_type
= NL80211_TX_POWER_LIMITED
;
3088 case NL80211_TX_POWER_LIMITED
:
3089 case NL80211_TX_POWER_FIXED
:
3090 if (mbm
< 0 || (mbm
% 100))
3092 user_power_level
= MBM_TO_DBM(mbm
);
3099 sdata
= IEEE80211_WDEV_TO_SUB_IF(wdev
);
3101 if (sdata
->vif
.type
== NL80211_IFTYPE_MONITOR
&&
3102 !ieee80211_hw_check(&local
->hw
, NO_VIRTUAL_MONITOR
)) {
3103 if (!ieee80211_hw_check(&local
->hw
, WANT_MONITOR_VIF
))
3106 sdata
= wiphy_dereference(local
->hw
.wiphy
,
3107 local
->monitor_sdata
);
3112 for (int link_id
= 0;
3113 link_id
< ARRAY_SIZE(sdata
->link
);
3115 struct ieee80211_link_data
*link
=
3116 wiphy_dereference(wiphy
, sdata
->link
[link_id
]);
3121 link
->user_power_level
= user_power_level
;
3123 if (txp_type
!= link
->conf
->txpower_type
) {
3124 update_txp_type
= true;
3125 link
->conf
->txpower_type
= txp_type
;
3128 ieee80211_recalc_txpower(link
, update_txp_type
);
3133 local
->user_power_level
= user_power_level
;
3135 list_for_each_entry(sdata
, &local
->interfaces
, list
) {
3136 if (sdata
->vif
.type
== NL80211_IFTYPE_MONITOR
&&
3137 !ieee80211_hw_check(&local
->hw
, NO_VIRTUAL_MONITOR
)) {
3142 for (int link_id
= 0;
3143 link_id
< ARRAY_SIZE(sdata
->link
);
3145 struct ieee80211_link_data
*link
=
3146 wiphy_dereference(wiphy
, sdata
->link
[link_id
]);
3151 link
->user_power_level
= local
->user_power_level
;
3152 if (txp_type
!= link
->conf
->txpower_type
)
3153 update_txp_type
= true;
3154 link
->conf
->txpower_type
= txp_type
;
3157 list_for_each_entry(sdata
, &local
->interfaces
, list
) {
3158 if (sdata
->vif
.type
== NL80211_IFTYPE_MONITOR
&&
3159 !ieee80211_hw_check(&local
->hw
, NO_VIRTUAL_MONITOR
))
3162 for (int link_id
= 0;
3163 link_id
< ARRAY_SIZE(sdata
->link
);
3165 struct ieee80211_link_data
*link
=
3166 wiphy_dereference(wiphy
, sdata
->link
[link_id
]);
3171 ieee80211_recalc_txpower(link
, update_txp_type
);
3176 sdata
= wiphy_dereference(local
->hw
.wiphy
,
3177 local
->monitor_sdata
);
3178 if (sdata
&& ieee80211_hw_check(&local
->hw
, WANT_MONITOR_VIF
)) {
3179 sdata
->deflink
.user_power_level
= local
->user_power_level
;
3180 if (txp_type
!= sdata
->vif
.bss_conf
.txpower_type
)
3181 update_txp_type
= true;
3182 sdata
->vif
.bss_conf
.txpower_type
= txp_type
;
3184 ieee80211_recalc_txpower(&sdata
->deflink
,
3189 if (local
->emulate_chanctx
&&
3190 (old_power
!= local
->user_power_level
))
3191 ieee80211_hw_conf_chan(local
);
3196 static int ieee80211_get_tx_power(struct wiphy
*wiphy
,
3197 struct wireless_dev
*wdev
,
3198 unsigned int link_id
,
3201 struct ieee80211_local
*local
= wiphy_priv(wiphy
);
3202 struct ieee80211_sub_if_data
*sdata
= IEEE80211_WDEV_TO_SUB_IF(wdev
);
3203 struct ieee80211_link_data
*link_data
;
3205 if (local
->ops
->get_txpower
&&
3206 (sdata
->flags
& IEEE80211_SDATA_IN_DRIVER
))
3207 return drv_get_txpower(local
, sdata
, link_id
, dbm
);
3209 if (local
->emulate_chanctx
) {
3210 *dbm
= local
->hw
.conf
.power_level
;
3212 link_data
= wiphy_dereference(wiphy
, sdata
->link
[link_id
]);
3215 *dbm
= link_data
->conf
->txpower
;
3220 /* INT_MIN indicates no power level was set yet */
3221 if (*dbm
== INT_MIN
)
3227 static void ieee80211_rfkill_poll(struct wiphy
*wiphy
)
3229 struct ieee80211_local
*local
= wiphy_priv(wiphy
);
3231 drv_rfkill_poll(local
);
3234 #ifdef CONFIG_NL80211_TESTMODE
3235 static int ieee80211_testmode_cmd(struct wiphy
*wiphy
,
3236 struct wireless_dev
*wdev
,
3237 void *data
, int len
)
3239 struct ieee80211_local
*local
= wiphy_priv(wiphy
);
3240 struct ieee80211_vif
*vif
= NULL
;
3242 if (!local
->ops
->testmode_cmd
)
3246 struct ieee80211_sub_if_data
*sdata
;
3248 sdata
= IEEE80211_WDEV_TO_SUB_IF(wdev
);
3249 if (sdata
->flags
& IEEE80211_SDATA_IN_DRIVER
)
3253 return local
->ops
->testmode_cmd(&local
->hw
, vif
, data
, len
);
3256 static int ieee80211_testmode_dump(struct wiphy
*wiphy
,
3257 struct sk_buff
*skb
,
3258 struct netlink_callback
*cb
,
3259 void *data
, int len
)
3261 struct ieee80211_local
*local
= wiphy_priv(wiphy
);
3263 if (!local
->ops
->testmode_dump
)
3266 return local
->ops
->testmode_dump(&local
->hw
, skb
, cb
, data
, len
);
3270 int __ieee80211_request_smps_mgd(struct ieee80211_sub_if_data
*sdata
,
3271 struct ieee80211_link_data
*link
,
3272 enum ieee80211_smps_mode smps_mode
)
3275 enum ieee80211_smps_mode old_req
;
3277 struct sta_info
*sta
;
3278 bool tdls_peer_found
= false;
3280 lockdep_assert_wiphy(sdata
->local
->hw
.wiphy
);
3282 if (WARN_ON_ONCE(sdata
->vif
.type
!= NL80211_IFTYPE_STATION
))
3285 if (!ieee80211_vif_link_active(&sdata
->vif
, link
->link_id
))
3288 old_req
= link
->u
.mgd
.req_smps
;
3289 link
->u
.mgd
.req_smps
= smps_mode
;
3291 /* The driver indicated that EML is enabled for the interface, which
3292 * implies that SMPS flows towards the AP should be stopped.
3294 if (sdata
->vif
.driver_flags
& IEEE80211_VIF_EML_ACTIVE
)
3297 if (old_req
== smps_mode
&&
3298 smps_mode
!= IEEE80211_SMPS_AUTOMATIC
)
3302 * If not associated, or current association is not an HT
3303 * association, there's no need to do anything, just store
3304 * the new value until we associate.
3306 if (!sdata
->u
.mgd
.associated
||
3307 link
->conf
->chanreq
.oper
.width
== NL80211_CHAN_WIDTH_20_NOHT
)
3310 ap
= sdata
->vif
.cfg
.ap_addr
;
3313 list_for_each_entry_rcu(sta
, &sdata
->local
->sta_list
, list
) {
3314 if (!sta
->sta
.tdls
|| sta
->sdata
!= sdata
|| !sta
->uploaded
||
3315 !test_sta_flag(sta
, WLAN_STA_AUTHORIZED
))
3318 tdls_peer_found
= true;
3323 if (smps_mode
== IEEE80211_SMPS_AUTOMATIC
) {
3324 if (tdls_peer_found
|| !sdata
->u
.mgd
.powersave
)
3325 smps_mode
= IEEE80211_SMPS_OFF
;
3327 smps_mode
= IEEE80211_SMPS_DYNAMIC
;
3330 /* send SM PS frame to AP */
3331 err
= ieee80211_send_smps_action(sdata
, smps_mode
,
3333 ieee80211_vif_is_mld(&sdata
->vif
) ?
3334 link
->link_id
: -1);
3336 link
->u
.mgd
.req_smps
= old_req
;
3337 else if (smps_mode
!= IEEE80211_SMPS_OFF
&& tdls_peer_found
)
3338 ieee80211_teardown_tdls_peers(link
);
3343 static int ieee80211_set_power_mgmt(struct wiphy
*wiphy
, struct net_device
*dev
,
3344 bool enabled
, int timeout
)
3346 struct ieee80211_sub_if_data
*sdata
= IEEE80211_DEV_TO_SUB_IF(dev
);
3347 struct ieee80211_local
*local
= wdev_priv(dev
->ieee80211_ptr
);
3348 unsigned int link_id
;
3350 if (sdata
->vif
.type
!= NL80211_IFTYPE_STATION
)
3353 if (!ieee80211_hw_check(&local
->hw
, SUPPORTS_PS
))
3356 if (enabled
== sdata
->u
.mgd
.powersave
&&
3357 timeout
== local
->dynamic_ps_forced_timeout
)
3360 sdata
->u
.mgd
.powersave
= enabled
;
3361 local
->dynamic_ps_forced_timeout
= timeout
;
3363 /* no change, but if automatic follow powersave */
3364 for (link_id
= 0; link_id
< ARRAY_SIZE(sdata
->link
); link_id
++) {
3365 struct ieee80211_link_data
*link
;
3367 link
= sdata_dereference(sdata
->link
[link_id
], sdata
);
3371 __ieee80211_request_smps_mgd(sdata
, link
,
3372 link
->u
.mgd
.req_smps
);
3375 if (ieee80211_hw_check(&local
->hw
, SUPPORTS_DYNAMIC_PS
))
3376 ieee80211_hw_config(local
, IEEE80211_CONF_CHANGE_PS
);
3378 ieee80211_recalc_ps(local
);
3379 ieee80211_recalc_ps_vif(sdata
);
3380 ieee80211_check_fast_rx_iface(sdata
);
3385 static void ieee80211_set_cqm_rssi_link(struct ieee80211_sub_if_data
*sdata
,
3386 struct ieee80211_link_data
*link
,
3387 s32 rssi_thold
, u32 rssi_hyst
,
3388 s32 rssi_low
, s32 rssi_high
)
3390 struct ieee80211_bss_conf
*conf
;
3392 if (!link
|| !link
->conf
)
3397 if (rssi_thold
&& rssi_hyst
&&
3398 rssi_thold
== conf
->cqm_rssi_thold
&&
3399 rssi_hyst
== conf
->cqm_rssi_hyst
)
3402 conf
->cqm_rssi_thold
= rssi_thold
;
3403 conf
->cqm_rssi_hyst
= rssi_hyst
;
3404 conf
->cqm_rssi_low
= rssi_low
;
3405 conf
->cqm_rssi_high
= rssi_high
;
3406 link
->u
.mgd
.last_cqm_event_signal
= 0;
3408 if (!ieee80211_vif_link_active(&sdata
->vif
, link
->link_id
))
3411 if (sdata
->u
.mgd
.associated
&&
3412 (sdata
->vif
.driver_flags
& IEEE80211_VIF_SUPPORTS_CQM_RSSI
))
3413 ieee80211_link_info_change_notify(sdata
, link
, BSS_CHANGED_CQM
);
3416 static int ieee80211_set_cqm_rssi_config(struct wiphy
*wiphy
,
3417 struct net_device
*dev
,
3418 s32 rssi_thold
, u32 rssi_hyst
)
3420 struct ieee80211_sub_if_data
*sdata
= IEEE80211_DEV_TO_SUB_IF(dev
);
3421 struct ieee80211_vif
*vif
= &sdata
->vif
;
3424 if (vif
->driver_flags
& IEEE80211_VIF_BEACON_FILTER
&&
3425 !(vif
->driver_flags
& IEEE80211_VIF_SUPPORTS_CQM_RSSI
))
3428 /* For MLD, handle CQM change on all the active links */
3429 for (link_id
= 0; link_id
< IEEE80211_MLD_MAX_NUM_LINKS
; link_id
++) {
3430 struct ieee80211_link_data
*link
=
3431 sdata_dereference(sdata
->link
[link_id
], sdata
);
3433 ieee80211_set_cqm_rssi_link(sdata
, link
, rssi_thold
, rssi_hyst
,
3440 static int ieee80211_set_cqm_rssi_range_config(struct wiphy
*wiphy
,
3441 struct net_device
*dev
,
3442 s32 rssi_low
, s32 rssi_high
)
3444 struct ieee80211_sub_if_data
*sdata
= IEEE80211_DEV_TO_SUB_IF(dev
);
3445 struct ieee80211_vif
*vif
= &sdata
->vif
;
3448 if (vif
->driver_flags
& IEEE80211_VIF_BEACON_FILTER
)
3451 /* For MLD, handle CQM change on all the active links */
3452 for (link_id
= 0; link_id
< IEEE80211_MLD_MAX_NUM_LINKS
; link_id
++) {
3453 struct ieee80211_link_data
*link
=
3454 sdata_dereference(sdata
->link
[link_id
], sdata
);
3456 ieee80211_set_cqm_rssi_link(sdata
, link
, 0, 0,
3457 rssi_low
, rssi_high
);
3463 static int ieee80211_set_bitrate_mask(struct wiphy
*wiphy
,
3464 struct net_device
*dev
,
3465 unsigned int link_id
,
3467 const struct cfg80211_bitrate_mask
*mask
)
3469 struct ieee80211_sub_if_data
*sdata
= IEEE80211_DEV_TO_SUB_IF(dev
);
3470 struct ieee80211_local
*local
= wdev_priv(dev
->ieee80211_ptr
);
3473 if (!ieee80211_sdata_running(sdata
))
3477 * If active validate the setting and reject it if it doesn't leave
3478 * at least one basic rate usable, since we really have to be able
3479 * to send something, and if we're an AP we have to be able to do
3480 * so at a basic rate so that all clients can receive it.
3482 if (rcu_access_pointer(sdata
->vif
.bss_conf
.chanctx_conf
) &&
3483 sdata
->vif
.bss_conf
.chanreq
.oper
.chan
) {
3484 u32 basic_rates
= sdata
->vif
.bss_conf
.basic_rates
;
3485 enum nl80211_band band
;
3487 band
= sdata
->vif
.bss_conf
.chanreq
.oper
.chan
->band
;
3489 if (!(mask
->control
[band
].legacy
& basic_rates
))
3493 if (ieee80211_hw_check(&local
->hw
, HAS_RATE_CONTROL
)) {
3494 ret
= drv_set_bitrate_mask(local
, sdata
, mask
);
3499 for (i
= 0; i
< NUM_NL80211_BANDS
; i
++) {
3500 struct ieee80211_supported_band
*sband
= wiphy
->bands
[i
];
3503 sdata
->rc_rateidx_mask
[i
] = mask
->control
[i
].legacy
;
3504 memcpy(sdata
->rc_rateidx_mcs_mask
[i
], mask
->control
[i
].ht_mcs
,
3505 sizeof(mask
->control
[i
].ht_mcs
));
3506 memcpy(sdata
->rc_rateidx_vht_mcs_mask
[i
],
3507 mask
->control
[i
].vht_mcs
,
3508 sizeof(mask
->control
[i
].vht_mcs
));
3510 sdata
->rc_has_mcs_mask
[i
] = false;
3511 sdata
->rc_has_vht_mcs_mask
[i
] = false;
3515 for (j
= 0; j
< IEEE80211_HT_MCS_MASK_LEN
; j
++) {
3516 if (sdata
->rc_rateidx_mcs_mask
[i
][j
] != 0xff) {
3517 sdata
->rc_has_mcs_mask
[i
] = true;
3522 for (j
= 0; j
< NL80211_VHT_NSS_MAX
; j
++) {
3523 if (sdata
->rc_rateidx_vht_mcs_mask
[i
][j
] != 0xffff) {
3524 sdata
->rc_has_vht_mcs_mask
[i
] = true;
3533 static int ieee80211_start_radar_detection(struct wiphy
*wiphy
,
3534 struct net_device
*dev
,
3535 struct cfg80211_chan_def
*chandef
,
3536 u32 cac_time_ms
, int link_id
)
3538 struct ieee80211_sub_if_data
*sdata
= IEEE80211_DEV_TO_SUB_IF(dev
);
3539 struct ieee80211_chan_req chanreq
= { .oper
= *chandef
};
3540 struct ieee80211_local
*local
= sdata
->local
;
3541 struct ieee80211_link_data
*link_data
;
3544 lockdep_assert_wiphy(local
->hw
.wiphy
);
3546 if (!list_empty(&local
->roc_list
) || local
->scanning
)
3549 link_data
= sdata_dereference(sdata
->link
[link_id
], sdata
);
3553 /* whatever, but channel contexts should not complain about that one */
3554 link_data
->smps_mode
= IEEE80211_SMPS_OFF
;
3555 link_data
->needed_rx_chains
= local
->rx_chains
;
3557 err
= ieee80211_link_use_channel(link_data
, &chanreq
,
3558 IEEE80211_CHANCTX_SHARED
);
3562 wiphy_delayed_work_queue(wiphy
, &link_data
->dfs_cac_timer_work
,
3563 msecs_to_jiffies(cac_time_ms
));
3568 static void ieee80211_end_cac(struct wiphy
*wiphy
,
3569 struct net_device
*dev
, unsigned int link_id
)
3571 struct ieee80211_sub_if_data
*sdata
= IEEE80211_DEV_TO_SUB_IF(dev
);
3572 struct ieee80211_local
*local
= sdata
->local
;
3573 struct ieee80211_link_data
*link_data
;
3575 lockdep_assert_wiphy(local
->hw
.wiphy
);
3577 list_for_each_entry(sdata
, &local
->interfaces
, list
) {
3578 link_data
= sdata_dereference(sdata
->link
[link_id
], sdata
);
3582 wiphy_delayed_work_cancel(wiphy
,
3583 &link_data
->dfs_cac_timer_work
);
3585 if (sdata
->wdev
.links
[link_id
].cac_started
) {
3586 ieee80211_link_release_channel(link_data
);
3587 sdata
->wdev
.links
[link_id
].cac_started
= false;
3592 static struct cfg80211_beacon_data
*
3593 cfg80211_beacon_dup(struct cfg80211_beacon_data
*beacon
)
3595 struct cfg80211_beacon_data
*new_beacon
;
3599 len
= beacon
->head_len
+ beacon
->tail_len
+ beacon
->beacon_ies_len
+
3600 beacon
->proberesp_ies_len
+ beacon
->assocresp_ies_len
+
3601 beacon
->probe_resp_len
+ beacon
->lci_len
+ beacon
->civicloc_len
;
3603 if (beacon
->mbssid_ies
)
3604 len
+= ieee80211_get_mbssid_beacon_len(beacon
->mbssid_ies
,
3606 beacon
->mbssid_ies
->cnt
);
3608 new_beacon
= kzalloc(sizeof(*new_beacon
) + len
, GFP_KERNEL
);
3612 if (beacon
->mbssid_ies
&& beacon
->mbssid_ies
->cnt
) {
3613 new_beacon
->mbssid_ies
=
3614 kzalloc(struct_size(new_beacon
->mbssid_ies
,
3615 elem
, beacon
->mbssid_ies
->cnt
),
3617 if (!new_beacon
->mbssid_ies
) {
3622 if (beacon
->rnr_ies
&& beacon
->rnr_ies
->cnt
) {
3623 new_beacon
->rnr_ies
=
3624 kzalloc(struct_size(new_beacon
->rnr_ies
,
3625 elem
, beacon
->rnr_ies
->cnt
),
3627 if (!new_beacon
->rnr_ies
) {
3628 kfree(new_beacon
->mbssid_ies
);
3635 pos
= (u8
*)(new_beacon
+ 1);
3636 if (beacon
->head_len
) {
3637 new_beacon
->head_len
= beacon
->head_len
;
3638 new_beacon
->head
= pos
;
3639 memcpy(pos
, beacon
->head
, beacon
->head_len
);
3640 pos
+= beacon
->head_len
;
3642 if (beacon
->tail_len
) {
3643 new_beacon
->tail_len
= beacon
->tail_len
;
3644 new_beacon
->tail
= pos
;
3645 memcpy(pos
, beacon
->tail
, beacon
->tail_len
);
3646 pos
+= beacon
->tail_len
;
3648 if (beacon
->beacon_ies_len
) {
3649 new_beacon
->beacon_ies_len
= beacon
->beacon_ies_len
;
3650 new_beacon
->beacon_ies
= pos
;
3651 memcpy(pos
, beacon
->beacon_ies
, beacon
->beacon_ies_len
);
3652 pos
+= beacon
->beacon_ies_len
;
3654 if (beacon
->proberesp_ies_len
) {
3655 new_beacon
->proberesp_ies_len
= beacon
->proberesp_ies_len
;
3656 new_beacon
->proberesp_ies
= pos
;
3657 memcpy(pos
, beacon
->proberesp_ies
, beacon
->proberesp_ies_len
);
3658 pos
+= beacon
->proberesp_ies_len
;
3660 if (beacon
->assocresp_ies_len
) {
3661 new_beacon
->assocresp_ies_len
= beacon
->assocresp_ies_len
;
3662 new_beacon
->assocresp_ies
= pos
;
3663 memcpy(pos
, beacon
->assocresp_ies
, beacon
->assocresp_ies_len
);
3664 pos
+= beacon
->assocresp_ies_len
;
3666 if (beacon
->probe_resp_len
) {
3667 new_beacon
->probe_resp_len
= beacon
->probe_resp_len
;
3668 new_beacon
->probe_resp
= pos
;
3669 memcpy(pos
, beacon
->probe_resp
, beacon
->probe_resp_len
);
3670 pos
+= beacon
->probe_resp_len
;
3672 if (beacon
->mbssid_ies
&& beacon
->mbssid_ies
->cnt
) {
3673 pos
+= ieee80211_copy_mbssid_beacon(pos
,
3674 new_beacon
->mbssid_ies
,
3675 beacon
->mbssid_ies
);
3676 if (beacon
->rnr_ies
&& beacon
->rnr_ies
->cnt
)
3677 pos
+= ieee80211_copy_rnr_beacon(pos
,
3678 new_beacon
->rnr_ies
,
3682 /* might copy -1, meaning no changes requested */
3683 new_beacon
->ftm_responder
= beacon
->ftm_responder
;
3685 new_beacon
->lci_len
= beacon
->lci_len
;
3686 new_beacon
->lci
= pos
;
3687 memcpy(pos
, beacon
->lci
, beacon
->lci_len
);
3688 pos
+= beacon
->lci_len
;
3690 if (beacon
->civicloc
) {
3691 new_beacon
->civicloc_len
= beacon
->civicloc_len
;
3692 new_beacon
->civicloc
= pos
;
3693 memcpy(pos
, beacon
->civicloc
, beacon
->civicloc_len
);
3694 pos
+= beacon
->civicloc_len
;
3700 void ieee80211_csa_finish(struct ieee80211_vif
*vif
, unsigned int link_id
)
3702 struct ieee80211_sub_if_data
*sdata
= vif_to_sdata(vif
);
3703 struct ieee80211_local
*local
= sdata
->local
;
3704 struct ieee80211_link_data
*link_data
;
3706 if (WARN_ON(link_id
>= IEEE80211_MLD_MAX_NUM_LINKS
))
3711 link_data
= rcu_dereference(sdata
->link
[link_id
]);
3712 if (WARN_ON(!link_data
)) {
3717 /* TODO: MBSSID with MLO changes */
3718 if (vif
->mbssid_tx_vif
== vif
) {
3719 /* Trigger ieee80211_csa_finish() on the non-transmitting
3720 * interfaces when channel switch is received on
3721 * transmitting interface
3723 struct ieee80211_sub_if_data
*iter
;
3725 list_for_each_entry_rcu(iter
, &local
->interfaces
, list
) {
3726 if (!ieee80211_sdata_running(iter
))
3729 if (iter
== sdata
|| iter
->vif
.mbssid_tx_vif
!= vif
)
3732 wiphy_work_queue(iter
->local
->hw
.wiphy
,
3733 &iter
->deflink
.csa
.finalize_work
);
3736 wiphy_work_queue(local
->hw
.wiphy
, &link_data
->csa
.finalize_work
);
3740 EXPORT_SYMBOL(ieee80211_csa_finish
);
3742 void ieee80211_channel_switch_disconnect(struct ieee80211_vif
*vif
)
3744 struct ieee80211_sub_if_data
*sdata
= vif_to_sdata(vif
);
3745 struct ieee80211_if_managed
*ifmgd
= &sdata
->u
.mgd
;
3746 struct ieee80211_local
*local
= sdata
->local
;
3748 sdata_info(sdata
, "channel switch failed, disconnecting\n");
3749 wiphy_work_queue(local
->hw
.wiphy
, &ifmgd
->csa_connection_drop_work
);
3751 EXPORT_SYMBOL(ieee80211_channel_switch_disconnect
);
3753 static int ieee80211_set_after_csa_beacon(struct ieee80211_link_data
*link_data
,
3756 struct ieee80211_sub_if_data
*sdata
= link_data
->sdata
;
3759 switch (sdata
->vif
.type
) {
3760 case NL80211_IFTYPE_AP
:
3761 if (!link_data
->u
.ap
.next_beacon
)
3764 err
= ieee80211_assign_beacon(sdata
, link_data
,
3765 link_data
->u
.ap
.next_beacon
,
3766 NULL
, NULL
, changed
);
3767 ieee80211_free_next_beacon(link_data
);
3772 case NL80211_IFTYPE_ADHOC
:
3773 err
= ieee80211_ibss_finish_csa(sdata
, changed
);
3777 #ifdef CONFIG_MAC80211_MESH
3778 case NL80211_IFTYPE_MESH_POINT
:
3779 err
= ieee80211_mesh_finish_csa(sdata
, changed
);
3792 static int __ieee80211_csa_finalize(struct ieee80211_link_data
*link_data
)
3794 struct ieee80211_sub_if_data
*sdata
= link_data
->sdata
;
3795 struct ieee80211_local
*local
= sdata
->local
;
3796 struct ieee80211_bss_conf
*link_conf
= link_data
->conf
;
3800 lockdep_assert_wiphy(local
->hw
.wiphy
);
3803 * using reservation isn't immediate as it may be deferred until later
3804 * with multi-vif. once reservation is complete it will re-schedule the
3805 * work with no reserved_chanctx so verify chandef to check if it
3806 * completed successfully
3809 if (link_data
->reserved_chanctx
) {
3811 * with multi-vif csa driver may call ieee80211_csa_finish()
3812 * many times while waiting for other interfaces to use their
3815 if (link_data
->reserved_ready
)
3818 return ieee80211_link_use_reserved_context(link_data
);
3821 if (!cfg80211_chandef_identical(&link_conf
->chanreq
.oper
,
3822 &link_data
->csa
.chanreq
.oper
))
3825 link_conf
->csa_active
= false;
3827 err
= ieee80211_set_after_csa_beacon(link_data
, &changed
);
3831 ieee80211_link_info_change_notify(sdata
, link_data
, changed
);
3833 ieee80211_vif_unblock_queues_csa(sdata
);
3835 err
= drv_post_channel_switch(link_data
);
3839 cfg80211_ch_switch_notify(sdata
->dev
, &link_data
->csa
.chanreq
.oper
,
3840 link_data
->link_id
);
3845 static void ieee80211_csa_finalize(struct ieee80211_link_data
*link_data
)
3847 struct ieee80211_sub_if_data
*sdata
= link_data
->sdata
;
3849 if (__ieee80211_csa_finalize(link_data
)) {
3850 sdata_info(sdata
, "failed to finalize CSA on link %d, disconnecting\n",
3851 link_data
->link_id
);
3852 cfg80211_stop_iface(sdata
->local
->hw
.wiphy
, &sdata
->wdev
,
3857 void ieee80211_csa_finalize_work(struct wiphy
*wiphy
, struct wiphy_work
*work
)
3859 struct ieee80211_link_data
*link
=
3860 container_of(work
, struct ieee80211_link_data
, csa
.finalize_work
);
3861 struct ieee80211_sub_if_data
*sdata
= link
->sdata
;
3862 struct ieee80211_local
*local
= sdata
->local
;
3864 lockdep_assert_wiphy(local
->hw
.wiphy
);
3866 /* AP might have been stopped while waiting for the lock. */
3867 if (!link
->conf
->csa_active
)
3870 if (!ieee80211_sdata_running(sdata
))
3873 ieee80211_csa_finalize(link
);
3876 static int ieee80211_set_csa_beacon(struct ieee80211_link_data
*link_data
,
3877 struct cfg80211_csa_settings
*params
,
3880 struct ieee80211_sub_if_data
*sdata
= link_data
->sdata
;
3881 struct ieee80211_csa_settings csa
= {};
3884 switch (sdata
->vif
.type
) {
3885 case NL80211_IFTYPE_AP
:
3886 link_data
->u
.ap
.next_beacon
=
3887 cfg80211_beacon_dup(¶ms
->beacon_after
);
3888 if (!link_data
->u
.ap
.next_beacon
)
3892 * With a count of 0, we don't have to wait for any
3893 * TBTT before switching, so complete the CSA
3894 * immediately. In theory, with a count == 1 we
3895 * should delay the switch until just before the next
3896 * TBTT, but that would complicate things so we switch
3897 * immediately too. If we would delay the switch
3898 * until the next TBTT, we would have to set the probe
3901 * TODO: A channel switch with count <= 1 without
3902 * sending a CSA action frame is kind of useless,
3903 * because the clients won't know we're changing
3904 * channels. The action frame must be implemented
3905 * either here or in the userspace.
3907 if (params
->count
<= 1)
3910 if ((params
->n_counter_offsets_beacon
>
3911 IEEE80211_MAX_CNTDWN_COUNTERS_NUM
) ||
3912 (params
->n_counter_offsets_presp
>
3913 IEEE80211_MAX_CNTDWN_COUNTERS_NUM
)) {
3914 ieee80211_free_next_beacon(link_data
);
3918 csa
.counter_offsets_beacon
= params
->counter_offsets_beacon
;
3919 csa
.counter_offsets_presp
= params
->counter_offsets_presp
;
3920 csa
.n_counter_offsets_beacon
= params
->n_counter_offsets_beacon
;
3921 csa
.n_counter_offsets_presp
= params
->n_counter_offsets_presp
;
3922 csa
.count
= params
->count
;
3924 err
= ieee80211_assign_beacon(sdata
, link_data
,
3925 ¶ms
->beacon_csa
, &csa
,
3928 ieee80211_free_next_beacon(link_data
);
3933 case NL80211_IFTYPE_ADHOC
:
3934 if (!sdata
->vif
.cfg
.ibss_joined
)
3937 if (params
->chandef
.width
!= sdata
->u
.ibss
.chandef
.width
)
3940 switch (params
->chandef
.width
) {
3941 case NL80211_CHAN_WIDTH_40
:
3942 if (cfg80211_get_chandef_type(¶ms
->chandef
) !=
3943 cfg80211_get_chandef_type(&sdata
->u
.ibss
.chandef
))
3946 case NL80211_CHAN_WIDTH_5
:
3947 case NL80211_CHAN_WIDTH_10
:
3948 case NL80211_CHAN_WIDTH_20_NOHT
:
3949 case NL80211_CHAN_WIDTH_20
:
3955 /* changes into another band are not supported */
3956 if (sdata
->u
.ibss
.chandef
.chan
->band
!=
3957 params
->chandef
.chan
->band
)
3960 /* see comments in the NL80211_IFTYPE_AP block */
3961 if (params
->count
> 1) {
3962 err
= ieee80211_ibss_csa_beacon(sdata
, params
, changed
);
3967 ieee80211_send_action_csa(sdata
, params
);
3970 #ifdef CONFIG_MAC80211_MESH
3971 case NL80211_IFTYPE_MESH_POINT
: {
3972 struct ieee80211_if_mesh
*ifmsh
= &sdata
->u
.mesh
;
3974 /* changes into another band are not supported */
3975 if (sdata
->vif
.bss_conf
.chanreq
.oper
.chan
->band
!=
3976 params
->chandef
.chan
->band
)
3979 if (ifmsh
->csa_role
== IEEE80211_MESH_CSA_ROLE_NONE
) {
3980 ifmsh
->csa_role
= IEEE80211_MESH_CSA_ROLE_INIT
;
3981 if (!ifmsh
->pre_value
)
3982 ifmsh
->pre_value
= 1;
3987 /* see comments in the NL80211_IFTYPE_AP block */
3988 if (params
->count
> 1) {
3989 err
= ieee80211_mesh_csa_beacon(sdata
, params
, changed
);
3991 ifmsh
->csa_role
= IEEE80211_MESH_CSA_ROLE_NONE
;
3996 if (ifmsh
->csa_role
== IEEE80211_MESH_CSA_ROLE_INIT
)
3997 ieee80211_send_action_csa(sdata
, params
);
4009 static void ieee80211_color_change_abort(struct ieee80211_link_data
*link
)
4011 link
->conf
->color_change_active
= false;
4013 ieee80211_free_next_beacon(link
);
4015 cfg80211_color_change_aborted_notify(link
->sdata
->dev
, link
->link_id
);
4019 __ieee80211_channel_switch(struct wiphy
*wiphy
, struct net_device
*dev
,
4020 struct cfg80211_csa_settings
*params
)
4022 struct ieee80211_sub_if_data
*sdata
= IEEE80211_DEV_TO_SUB_IF(dev
);
4023 struct ieee80211_chan_req chanreq
= { .oper
= params
->chandef
};
4024 struct ieee80211_local
*local
= sdata
->local
;
4025 struct ieee80211_channel_switch ch_switch
= {
4026 .link_id
= params
->link_id
,
4028 struct ieee80211_chanctx_conf
*conf
;
4029 struct ieee80211_chanctx
*chanctx
;
4030 struct ieee80211_bss_conf
*link_conf
;
4031 struct ieee80211_link_data
*link_data
;
4033 u8 link_id
= params
->link_id
;
4036 lockdep_assert_wiphy(local
->hw
.wiphy
);
4038 if (!list_empty(&local
->roc_list
) || local
->scanning
)
4041 if (sdata
->wdev
.links
[link_id
].cac_started
)
4044 if (WARN_ON(link_id
>= IEEE80211_MLD_MAX_NUM_LINKS
))
4047 link_data
= wiphy_dereference(wiphy
, sdata
->link
[link_id
]);
4051 link_conf
= link_data
->conf
;
4053 if (chanreq
.oper
.punctured
&& !link_conf
->eht_support
)
4056 /* don't allow another channel switch if one is already active. */
4057 if (link_conf
->csa_active
)
4060 conf
= wiphy_dereference(wiphy
, link_conf
->chanctx_conf
);
4066 if (params
->chandef
.chan
->freq_offset
) {
4067 /* this may work, but is untested */
4072 chanctx
= container_of(conf
, struct ieee80211_chanctx
, conf
);
4074 ch_switch
.timestamp
= 0;
4075 ch_switch
.device_timestamp
= 0;
4076 ch_switch
.block_tx
= params
->block_tx
;
4077 ch_switch
.chandef
= chanreq
.oper
;
4078 ch_switch
.count
= params
->count
;
4080 err
= drv_pre_channel_switch(sdata
, &ch_switch
);
4084 err
= ieee80211_link_reserve_chanctx(link_data
, &chanreq
,
4086 params
->radar_required
);
4090 /* if reservation is invalid then this will fail */
4091 err
= ieee80211_check_combinations(sdata
, NULL
, chanctx
->mode
, 0, -1);
4093 ieee80211_link_unreserve_chanctx(link_data
);
4097 /* if there is a color change in progress, abort it */
4098 if (link_conf
->color_change_active
)
4099 ieee80211_color_change_abort(link_data
);
4101 err
= ieee80211_set_csa_beacon(link_data
, params
, &changed
);
4103 ieee80211_link_unreserve_chanctx(link_data
);
4107 link_data
->csa
.chanreq
= chanreq
;
4108 link_conf
->csa_active
= true;
4110 if (params
->block_tx
)
4111 ieee80211_vif_block_queues_csa(sdata
);
4113 cfg80211_ch_switch_started_notify(sdata
->dev
,
4114 &link_data
->csa
.chanreq
.oper
, link_id
,
4115 params
->count
, params
->block_tx
);
4118 ieee80211_link_info_change_notify(sdata
, link_data
, changed
);
4119 drv_channel_switch_beacon(sdata
, &link_data
->csa
.chanreq
.oper
);
4121 /* if the beacon didn't change, we can finalize immediately */
4122 ieee80211_csa_finalize(link_data
);
4129 int ieee80211_channel_switch(struct wiphy
*wiphy
, struct net_device
*dev
,
4130 struct cfg80211_csa_settings
*params
)
4132 struct ieee80211_sub_if_data
*sdata
= IEEE80211_DEV_TO_SUB_IF(dev
);
4133 struct ieee80211_local
*local
= sdata
->local
;
4135 lockdep_assert_wiphy(local
->hw
.wiphy
);
4137 return __ieee80211_channel_switch(wiphy
, dev
, params
);
4140 u64
ieee80211_mgmt_tx_cookie(struct ieee80211_local
*local
)
4142 lockdep_assert_wiphy(local
->hw
.wiphy
);
4144 local
->roc_cookie_counter
++;
4146 /* wow, you wrapped 64 bits ... more likely a bug */
4147 if (WARN_ON(local
->roc_cookie_counter
== 0))
4148 local
->roc_cookie_counter
++;
4150 return local
->roc_cookie_counter
;
4153 int ieee80211_attach_ack_skb(struct ieee80211_local
*local
, struct sk_buff
*skb
,
4154 u64
*cookie
, gfp_t gfp
)
4156 unsigned long spin_flags
;
4157 struct sk_buff
*ack_skb
;
4160 ack_skb
= skb_copy(skb
, gfp
);
4164 spin_lock_irqsave(&local
->ack_status_lock
, spin_flags
);
4165 id
= idr_alloc(&local
->ack_status_frames
, ack_skb
,
4166 1, 0x2000, GFP_ATOMIC
);
4167 spin_unlock_irqrestore(&local
->ack_status_lock
, spin_flags
);
4174 IEEE80211_SKB_CB(skb
)->status_data_idr
= 1;
4175 IEEE80211_SKB_CB(skb
)->status_data
= id
;
4177 *cookie
= ieee80211_mgmt_tx_cookie(local
);
4178 IEEE80211_SKB_CB(ack_skb
)->ack
.cookie
= *cookie
;
4184 ieee80211_update_mgmt_frame_registrations(struct wiphy
*wiphy
,
4185 struct wireless_dev
*wdev
,
4186 struct mgmt_frame_regs
*upd
)
4188 struct ieee80211_local
*local
= wiphy_priv(wiphy
);
4189 struct ieee80211_sub_if_data
*sdata
= IEEE80211_WDEV_TO_SUB_IF(wdev
);
4190 u32 preq_mask
= BIT(IEEE80211_STYPE_PROBE_REQ
>> 4);
4191 u32 action_mask
= BIT(IEEE80211_STYPE_ACTION
>> 4);
4192 bool global_change
, intf_change
;
4195 (local
->probe_req_reg
!= !!(upd
->global_stypes
& preq_mask
)) ||
4196 (local
->rx_mcast_action_reg
!=
4197 !!(upd
->global_mcast_stypes
& action_mask
));
4198 local
->probe_req_reg
= upd
->global_stypes
& preq_mask
;
4199 local
->rx_mcast_action_reg
= upd
->global_mcast_stypes
& action_mask
;
4201 intf_change
= (sdata
->vif
.probe_req_reg
!=
4202 !!(upd
->interface_stypes
& preq_mask
)) ||
4203 (sdata
->vif
.rx_mcast_action_reg
!=
4204 !!(upd
->interface_mcast_stypes
& action_mask
));
4205 sdata
->vif
.probe_req_reg
= upd
->interface_stypes
& preq_mask
;
4206 sdata
->vif
.rx_mcast_action_reg
=
4207 upd
->interface_mcast_stypes
& action_mask
;
4209 if (!local
->open_count
)
4212 if (intf_change
&& ieee80211_sdata_running(sdata
))
4213 drv_config_iface_filter(local
, sdata
,
4214 sdata
->vif
.probe_req_reg
?
4219 ieee80211_configure_filter(local
);
4222 static int ieee80211_set_antenna(struct wiphy
*wiphy
, u32 tx_ant
, u32 rx_ant
)
4224 struct ieee80211_local
*local
= wiphy_priv(wiphy
);
4230 ret
= drv_set_antenna(local
, tx_ant
, rx_ant
);
4234 local
->rx_chains
= hweight8(rx_ant
);
4238 static int ieee80211_get_antenna(struct wiphy
*wiphy
, u32
*tx_ant
, u32
*rx_ant
)
4240 struct ieee80211_local
*local
= wiphy_priv(wiphy
);
4242 return drv_get_antenna(local
, tx_ant
, rx_ant
);
4245 static int ieee80211_set_rekey_data(struct wiphy
*wiphy
,
4246 struct net_device
*dev
,
4247 struct cfg80211_gtk_rekey_data
*data
)
4249 struct ieee80211_local
*local
= wiphy_priv(wiphy
);
4250 struct ieee80211_sub_if_data
*sdata
= IEEE80211_DEV_TO_SUB_IF(dev
);
4252 if (!local
->ops
->set_rekey_data
)
4255 drv_set_rekey_data(local
, sdata
, data
);
4260 static int ieee80211_probe_client(struct wiphy
*wiphy
, struct net_device
*dev
,
4261 const u8
*peer
, u64
*cookie
)
4263 struct ieee80211_sub_if_data
*sdata
= IEEE80211_DEV_TO_SUB_IF(dev
);
4264 struct ieee80211_local
*local
= sdata
->local
;
4265 struct ieee80211_qos_hdr
*nullfunc
;
4266 struct sk_buff
*skb
;
4267 int size
= sizeof(*nullfunc
);
4270 struct ieee80211_tx_info
*info
;
4271 struct sta_info
*sta
;
4272 struct ieee80211_chanctx_conf
*chanctx_conf
;
4273 enum nl80211_band band
;
4276 /* the lock is needed to assign the cookie later */
4277 lockdep_assert_wiphy(local
->hw
.wiphy
);
4280 sta
= sta_info_get_bss(sdata
, peer
);
4288 chanctx_conf
= rcu_dereference(sdata
->vif
.bss_conf
.chanctx_conf
);
4289 if (WARN_ON(!chanctx_conf
)) {
4293 band
= chanctx_conf
->def
.chan
->band
;
4296 fc
= cpu_to_le16(IEEE80211_FTYPE_DATA
|
4297 IEEE80211_STYPE_QOS_NULLFUNC
|
4298 IEEE80211_FCTL_FROMDS
);
4301 fc
= cpu_to_le16(IEEE80211_FTYPE_DATA
|
4302 IEEE80211_STYPE_NULLFUNC
|
4303 IEEE80211_FCTL_FROMDS
);
4306 skb
= dev_alloc_skb(local
->hw
.extra_tx_headroom
+ size
);
4314 skb_reserve(skb
, local
->hw
.extra_tx_headroom
);
4316 nullfunc
= skb_put(skb
, size
);
4317 nullfunc
->frame_control
= fc
;
4318 nullfunc
->duration_id
= 0;
4319 memcpy(nullfunc
->addr1
, sta
->sta
.addr
, ETH_ALEN
);
4320 memcpy(nullfunc
->addr2
, sdata
->vif
.addr
, ETH_ALEN
);
4321 memcpy(nullfunc
->addr3
, sdata
->vif
.addr
, ETH_ALEN
);
4322 nullfunc
->seq_ctrl
= 0;
4324 info
= IEEE80211_SKB_CB(skb
);
4326 info
->flags
|= IEEE80211_TX_CTL_REQ_TX_STATUS
|
4327 IEEE80211_TX_INTFL_NL80211_FRAME_TX
;
4330 skb_set_queue_mapping(skb
, IEEE80211_AC_VO
);
4333 nullfunc
->qos_ctrl
= cpu_to_le16(7);
4335 ret
= ieee80211_attach_ack_skb(local
, skb
, cookie
, GFP_ATOMIC
);
4342 ieee80211_xmit(sdata
, sta
, skb
);
4352 static int ieee80211_cfg_get_channel(struct wiphy
*wiphy
,
4353 struct wireless_dev
*wdev
,
4354 unsigned int link_id
,
4355 struct cfg80211_chan_def
*chandef
)
4357 struct ieee80211_sub_if_data
*sdata
= IEEE80211_WDEV_TO_SUB_IF(wdev
);
4358 struct ieee80211_local
*local
= wiphy_priv(wiphy
);
4359 struct ieee80211_chanctx_conf
*chanctx_conf
;
4360 struct ieee80211_link_data
*link
;
4364 link
= rcu_dereference(sdata
->link
[link_id
]);
4370 chanctx_conf
= rcu_dereference(link
->conf
->chanctx_conf
);
4372 *chandef
= link
->conf
->chanreq
.oper
;
4374 } else if (!ieee80211_hw_check(&local
->hw
, NO_VIRTUAL_MONITOR
) &&
4375 local
->open_count
> 0 &&
4376 local
->open_count
== local
->monitors
&&
4377 sdata
->vif
.type
== NL80211_IFTYPE_MONITOR
) {
4378 *chandef
= local
->monitor_chanreq
.oper
;
4388 static void ieee80211_set_wakeup(struct wiphy
*wiphy
, bool enabled
)
4390 drv_set_wakeup(wiphy_priv(wiphy
), enabled
);
4394 static int ieee80211_set_qos_map(struct wiphy
*wiphy
,
4395 struct net_device
*dev
,
4396 struct cfg80211_qos_map
*qos_map
)
4398 struct ieee80211_sub_if_data
*sdata
= IEEE80211_DEV_TO_SUB_IF(dev
);
4399 struct mac80211_qos_map
*new_qos_map
, *old_qos_map
;
4402 new_qos_map
= kzalloc(sizeof(*new_qos_map
), GFP_KERNEL
);
4405 memcpy(&new_qos_map
->qos_map
, qos_map
, sizeof(*qos_map
));
4407 /* A NULL qos_map was passed to disable QoS mapping */
4411 old_qos_map
= sdata_dereference(sdata
->qos_map
, sdata
);
4412 rcu_assign_pointer(sdata
->qos_map
, new_qos_map
);
4414 kfree_rcu(old_qos_map
, rcu_head
);
4419 static int ieee80211_set_ap_chanwidth(struct wiphy
*wiphy
,
4420 struct net_device
*dev
,
4421 unsigned int link_id
,
4422 struct cfg80211_chan_def
*chandef
)
4424 struct ieee80211_sub_if_data
*sdata
= IEEE80211_DEV_TO_SUB_IF(dev
);
4425 struct ieee80211_link_data
*link
;
4426 struct ieee80211_chan_req chanreq
= { .oper
= *chandef
};
4430 link
= sdata_dereference(sdata
->link
[link_id
], sdata
);
4432 ret
= ieee80211_link_change_chanreq(link
, &chanreq
, &changed
);
4434 ieee80211_link_info_change_notify(sdata
, link
, changed
);
4439 static int ieee80211_add_tx_ts(struct wiphy
*wiphy
, struct net_device
*dev
,
4440 u8 tsid
, const u8
*peer
, u8 up
,
4443 struct ieee80211_sub_if_data
*sdata
= IEEE80211_DEV_TO_SUB_IF(dev
);
4444 struct ieee80211_if_managed
*ifmgd
= &sdata
->u
.mgd
;
4445 int ac
= ieee802_1d_to_ac
[up
];
4447 if (sdata
->vif
.type
!= NL80211_IFTYPE_STATION
)
4450 if (!(sdata
->wmm_acm
& BIT(up
)))
4453 if (ifmgd
->tx_tspec
[ac
].admitted_time
)
4456 if (admitted_time
) {
4457 ifmgd
->tx_tspec
[ac
].admitted_time
= 32 * admitted_time
;
4458 ifmgd
->tx_tspec
[ac
].tsid
= tsid
;
4459 ifmgd
->tx_tspec
[ac
].up
= up
;
4465 static int ieee80211_del_tx_ts(struct wiphy
*wiphy
, struct net_device
*dev
,
4466 u8 tsid
, const u8
*peer
)
4468 struct ieee80211_sub_if_data
*sdata
= IEEE80211_DEV_TO_SUB_IF(dev
);
4469 struct ieee80211_if_managed
*ifmgd
= &sdata
->u
.mgd
;
4470 struct ieee80211_local
*local
= wiphy_priv(wiphy
);
4473 for (ac
= 0; ac
< IEEE80211_NUM_ACS
; ac
++) {
4474 struct ieee80211_sta_tx_tspec
*tx_tspec
= &ifmgd
->tx_tspec
[ac
];
4476 /* skip unused entries */
4477 if (!tx_tspec
->admitted_time
)
4480 if (tx_tspec
->tsid
!= tsid
)
4483 /* due to this new packets will be reassigned to non-ACM ACs */
4486 /* Make sure that all packets have been sent to avoid to
4487 * restore the QoS params on packets that are still on the
4491 ieee80211_flush_queues(local
, sdata
, false);
4493 /* restore the normal QoS parameters
4494 * (unconditionally to avoid races)
4496 tx_tspec
->action
= TX_TSPEC_ACTION_STOP_DOWNGRADE
;
4497 tx_tspec
->downgraded
= false;
4498 ieee80211_sta_handle_tspec_ac_params(sdata
);
4500 /* finally clear all the data */
4501 memset(tx_tspec
, 0, sizeof(*tx_tspec
));
4509 void ieee80211_nan_func_terminated(struct ieee80211_vif
*vif
,
4511 enum nl80211_nan_func_term_reason reason
,
4514 struct ieee80211_sub_if_data
*sdata
= vif_to_sdata(vif
);
4515 struct cfg80211_nan_func
*func
;
4518 if (WARN_ON(vif
->type
!= NL80211_IFTYPE_NAN
))
4521 spin_lock_bh(&sdata
->u
.nan
.func_lock
);
4523 func
= idr_find(&sdata
->u
.nan
.function_inst_ids
, inst_id
);
4524 if (WARN_ON(!func
)) {
4525 spin_unlock_bh(&sdata
->u
.nan
.func_lock
);
4529 cookie
= func
->cookie
;
4530 idr_remove(&sdata
->u
.nan
.function_inst_ids
, inst_id
);
4532 spin_unlock_bh(&sdata
->u
.nan
.func_lock
);
4534 cfg80211_free_nan_func(func
);
4536 cfg80211_nan_func_terminated(ieee80211_vif_to_wdev(vif
), inst_id
,
4537 reason
, cookie
, gfp
);
4539 EXPORT_SYMBOL(ieee80211_nan_func_terminated
);
4541 void ieee80211_nan_func_match(struct ieee80211_vif
*vif
,
4542 struct cfg80211_nan_match_params
*match
,
4545 struct ieee80211_sub_if_data
*sdata
= vif_to_sdata(vif
);
4546 struct cfg80211_nan_func
*func
;
4548 if (WARN_ON(vif
->type
!= NL80211_IFTYPE_NAN
))
4551 spin_lock_bh(&sdata
->u
.nan
.func_lock
);
4553 func
= idr_find(&sdata
->u
.nan
.function_inst_ids
, match
->inst_id
);
4554 if (WARN_ON(!func
)) {
4555 spin_unlock_bh(&sdata
->u
.nan
.func_lock
);
4558 match
->cookie
= func
->cookie
;
4560 spin_unlock_bh(&sdata
->u
.nan
.func_lock
);
4562 cfg80211_nan_match(ieee80211_vif_to_wdev(vif
), match
, gfp
);
4564 EXPORT_SYMBOL(ieee80211_nan_func_match
);
4566 static int ieee80211_set_multicast_to_unicast(struct wiphy
*wiphy
,
4567 struct net_device
*dev
,
4570 struct ieee80211_sub_if_data
*sdata
= IEEE80211_DEV_TO_SUB_IF(dev
);
4572 sdata
->u
.ap
.multicast_to_unicast
= enabled
;
4577 void ieee80211_fill_txq_stats(struct cfg80211_txq_stats
*txqstats
,
4578 struct txq_info
*txqi
)
4580 if (!(txqstats
->filled
& BIT(NL80211_TXQ_STATS_BACKLOG_BYTES
))) {
4581 txqstats
->filled
|= BIT(NL80211_TXQ_STATS_BACKLOG_BYTES
);
4582 txqstats
->backlog_bytes
= txqi
->tin
.backlog_bytes
;
4585 if (!(txqstats
->filled
& BIT(NL80211_TXQ_STATS_BACKLOG_PACKETS
))) {
4586 txqstats
->filled
|= BIT(NL80211_TXQ_STATS_BACKLOG_PACKETS
);
4587 txqstats
->backlog_packets
= txqi
->tin
.backlog_packets
;
4590 if (!(txqstats
->filled
& BIT(NL80211_TXQ_STATS_FLOWS
))) {
4591 txqstats
->filled
|= BIT(NL80211_TXQ_STATS_FLOWS
);
4592 txqstats
->flows
= txqi
->tin
.flows
;
4595 if (!(txqstats
->filled
& BIT(NL80211_TXQ_STATS_DROPS
))) {
4596 txqstats
->filled
|= BIT(NL80211_TXQ_STATS_DROPS
);
4597 txqstats
->drops
= txqi
->cstats
.drop_count
;
4600 if (!(txqstats
->filled
& BIT(NL80211_TXQ_STATS_ECN_MARKS
))) {
4601 txqstats
->filled
|= BIT(NL80211_TXQ_STATS_ECN_MARKS
);
4602 txqstats
->ecn_marks
= txqi
->cstats
.ecn_mark
;
4605 if (!(txqstats
->filled
& BIT(NL80211_TXQ_STATS_OVERLIMIT
))) {
4606 txqstats
->filled
|= BIT(NL80211_TXQ_STATS_OVERLIMIT
);
4607 txqstats
->overlimit
= txqi
->tin
.overlimit
;
4610 if (!(txqstats
->filled
& BIT(NL80211_TXQ_STATS_COLLISIONS
))) {
4611 txqstats
->filled
|= BIT(NL80211_TXQ_STATS_COLLISIONS
);
4612 txqstats
->collisions
= txqi
->tin
.collisions
;
4615 if (!(txqstats
->filled
& BIT(NL80211_TXQ_STATS_TX_BYTES
))) {
4616 txqstats
->filled
|= BIT(NL80211_TXQ_STATS_TX_BYTES
);
4617 txqstats
->tx_bytes
= txqi
->tin
.tx_bytes
;
4620 if (!(txqstats
->filled
& BIT(NL80211_TXQ_STATS_TX_PACKETS
))) {
4621 txqstats
->filled
|= BIT(NL80211_TXQ_STATS_TX_PACKETS
);
4622 txqstats
->tx_packets
= txqi
->tin
.tx_packets
;
4626 static int ieee80211_get_txq_stats(struct wiphy
*wiphy
,
4627 struct wireless_dev
*wdev
,
4628 struct cfg80211_txq_stats
*txqstats
)
4630 struct ieee80211_local
*local
= wiphy_priv(wiphy
);
4631 struct ieee80211_sub_if_data
*sdata
;
4634 spin_lock_bh(&local
->fq
.lock
);
4638 sdata
= IEEE80211_WDEV_TO_SUB_IF(wdev
);
4639 if (!sdata
->vif
.txq
) {
4643 ieee80211_fill_txq_stats(txqstats
, to_txq_info(sdata
->vif
.txq
));
4646 txqstats
->filled
|= BIT(NL80211_TXQ_STATS_BACKLOG_PACKETS
) |
4647 BIT(NL80211_TXQ_STATS_BACKLOG_BYTES
) |
4648 BIT(NL80211_TXQ_STATS_OVERLIMIT
) |
4649 BIT(NL80211_TXQ_STATS_OVERMEMORY
) |
4650 BIT(NL80211_TXQ_STATS_COLLISIONS
) |
4651 BIT(NL80211_TXQ_STATS_MAX_FLOWS
);
4652 txqstats
->backlog_packets
= local
->fq
.backlog
;
4653 txqstats
->backlog_bytes
= local
->fq
.memory_usage
;
4654 txqstats
->overlimit
= local
->fq
.overlimit
;
4655 txqstats
->overmemory
= local
->fq
.overmemory
;
4656 txqstats
->collisions
= local
->fq
.collisions
;
4657 txqstats
->max_flows
= local
->fq
.flows_cnt
;
4662 spin_unlock_bh(&local
->fq
.lock
);
4668 ieee80211_get_ftm_responder_stats(struct wiphy
*wiphy
,
4669 struct net_device
*dev
,
4670 struct cfg80211_ftm_responder_stats
*ftm_stats
)
4672 struct ieee80211_local
*local
= wiphy_priv(wiphy
);
4673 struct ieee80211_sub_if_data
*sdata
= IEEE80211_DEV_TO_SUB_IF(dev
);
4675 return drv_get_ftm_responder_stats(local
, sdata
, ftm_stats
);
4679 ieee80211_start_pmsr(struct wiphy
*wiphy
, struct wireless_dev
*dev
,
4680 struct cfg80211_pmsr_request
*request
)
4682 struct ieee80211_local
*local
= wiphy_priv(wiphy
);
4683 struct ieee80211_sub_if_data
*sdata
= IEEE80211_WDEV_TO_SUB_IF(dev
);
4685 return drv_start_pmsr(local
, sdata
, request
);
4689 ieee80211_abort_pmsr(struct wiphy
*wiphy
, struct wireless_dev
*dev
,
4690 struct cfg80211_pmsr_request
*request
)
4692 struct ieee80211_local
*local
= wiphy_priv(wiphy
);
4693 struct ieee80211_sub_if_data
*sdata
= IEEE80211_WDEV_TO_SUB_IF(dev
);
4695 return drv_abort_pmsr(local
, sdata
, request
);
4698 static int ieee80211_set_tid_config(struct wiphy
*wiphy
,
4699 struct net_device
*dev
,
4700 struct cfg80211_tid_config
*tid_conf
)
4702 struct ieee80211_sub_if_data
*sdata
= IEEE80211_DEV_TO_SUB_IF(dev
);
4703 struct sta_info
*sta
;
4705 lockdep_assert_wiphy(sdata
->local
->hw
.wiphy
);
4707 if (!sdata
->local
->ops
->set_tid_config
)
4710 if (!tid_conf
->peer
)
4711 return drv_set_tid_config(sdata
->local
, sdata
, NULL
, tid_conf
);
4713 sta
= sta_info_get_bss(sdata
, tid_conf
->peer
);
4717 return drv_set_tid_config(sdata
->local
, sdata
, &sta
->sta
, tid_conf
);
4720 static int ieee80211_reset_tid_config(struct wiphy
*wiphy
,
4721 struct net_device
*dev
,
4722 const u8
*peer
, u8 tids
)
4724 struct ieee80211_sub_if_data
*sdata
= IEEE80211_DEV_TO_SUB_IF(dev
);
4725 struct sta_info
*sta
;
4727 lockdep_assert_wiphy(sdata
->local
->hw
.wiphy
);
4729 if (!sdata
->local
->ops
->reset_tid_config
)
4733 return drv_reset_tid_config(sdata
->local
, sdata
, NULL
, tids
);
4735 sta
= sta_info_get_bss(sdata
, peer
);
4739 return drv_reset_tid_config(sdata
->local
, sdata
, &sta
->sta
, tids
);
4742 static int ieee80211_set_sar_specs(struct wiphy
*wiphy
,
4743 struct cfg80211_sar_specs
*sar
)
4745 struct ieee80211_local
*local
= wiphy_priv(wiphy
);
4747 if (!local
->ops
->set_sar_specs
)
4750 return local
->ops
->set_sar_specs(&local
->hw
, sar
);
4754 ieee80211_set_after_color_change_beacon(struct ieee80211_link_data
*link
,
4757 struct ieee80211_sub_if_data
*sdata
= link
->sdata
;
4759 switch (sdata
->vif
.type
) {
4760 case NL80211_IFTYPE_AP
: {
4763 if (!link
->u
.ap
.next_beacon
)
4766 ret
= ieee80211_assign_beacon(sdata
, link
,
4767 link
->u
.ap
.next_beacon
,
4768 NULL
, NULL
, changed
);
4769 ieee80211_free_next_beacon(link
);
4785 ieee80211_set_color_change_beacon(struct ieee80211_link_data
*link
,
4786 struct cfg80211_color_change_settings
*params
,
4789 struct ieee80211_sub_if_data
*sdata
= link
->sdata
;
4790 struct ieee80211_color_change_settings color_change
= {};
4793 switch (sdata
->vif
.type
) {
4794 case NL80211_IFTYPE_AP
:
4795 link
->u
.ap
.next_beacon
=
4796 cfg80211_beacon_dup(¶ms
->beacon_next
);
4797 if (!link
->u
.ap
.next_beacon
)
4800 if (params
->count
<= 1)
4803 color_change
.counter_offset_beacon
=
4804 params
->counter_offset_beacon
;
4805 color_change
.counter_offset_presp
=
4806 params
->counter_offset_presp
;
4807 color_change
.count
= params
->count
;
4809 err
= ieee80211_assign_beacon(sdata
, link
,
4810 ¶ms
->beacon_color_change
,
4811 NULL
, &color_change
, changed
);
4813 ieee80211_free_next_beacon(link
);
4825 ieee80211_color_change_bss_config_notify(struct ieee80211_link_data
*link
,
4826 u8 color
, int enable
, u64 changed
)
4828 struct ieee80211_sub_if_data
*sdata
= link
->sdata
;
4830 lockdep_assert_wiphy(sdata
->local
->hw
.wiphy
);
4832 link
->conf
->he_bss_color
.color
= color
;
4833 link
->conf
->he_bss_color
.enabled
= enable
;
4834 changed
|= BSS_CHANGED_HE_BSS_COLOR
;
4836 ieee80211_link_info_change_notify(sdata
, link
, changed
);
4838 if (!sdata
->vif
.bss_conf
.nontransmitted
&& sdata
->vif
.mbssid_tx_vif
) {
4839 struct ieee80211_sub_if_data
*child
;
4841 list_for_each_entry(child
, &sdata
->local
->interfaces
, list
) {
4842 if (child
!= sdata
&& child
->vif
.mbssid_tx_vif
== &sdata
->vif
) {
4843 child
->vif
.bss_conf
.he_bss_color
.color
= color
;
4844 child
->vif
.bss_conf
.he_bss_color
.enabled
= enable
;
4845 ieee80211_link_info_change_notify(child
,
4847 BSS_CHANGED_HE_BSS_COLOR
);
4853 static int ieee80211_color_change_finalize(struct ieee80211_link_data
*link
)
4855 struct ieee80211_sub_if_data
*sdata
= link
->sdata
;
4856 struct ieee80211_local
*local
= sdata
->local
;
4860 lockdep_assert_wiphy(local
->hw
.wiphy
);
4862 link
->conf
->color_change_active
= false;
4864 err
= ieee80211_set_after_color_change_beacon(link
, &changed
);
4866 cfg80211_color_change_aborted_notify(sdata
->dev
, link
->link_id
);
4870 ieee80211_color_change_bss_config_notify(link
,
4871 link
->conf
->color_change_color
,
4873 cfg80211_color_change_notify(sdata
->dev
, link
->link_id
);
4878 void ieee80211_color_change_finalize_work(struct wiphy
*wiphy
,
4879 struct wiphy_work
*work
)
4881 struct ieee80211_link_data
*link
=
4882 container_of(work
, struct ieee80211_link_data
,
4883 color_change_finalize_work
);
4884 struct ieee80211_sub_if_data
*sdata
= link
->sdata
;
4885 struct ieee80211_bss_conf
*link_conf
= link
->conf
;
4886 struct ieee80211_local
*local
= sdata
->local
;
4888 lockdep_assert_wiphy(local
->hw
.wiphy
);
4890 /* AP might have been stopped while waiting for the lock. */
4891 if (!link_conf
->color_change_active
)
4894 if (!ieee80211_sdata_running(sdata
))
4897 ieee80211_color_change_finalize(link
);
4900 void ieee80211_color_collision_detection_work(struct wiphy
*wiphy
,
4901 struct wiphy_work
*work
)
4903 struct ieee80211_link_data
*link
=
4904 container_of(work
, struct ieee80211_link_data
,
4905 color_collision_detect_work
.work
);
4906 struct ieee80211_sub_if_data
*sdata
= link
->sdata
;
4908 cfg80211_obss_color_collision_notify(sdata
->dev
, link
->color_bitmap
,
4912 void ieee80211_color_change_finish(struct ieee80211_vif
*vif
, u8 link_id
)
4914 struct ieee80211_sub_if_data
*sdata
= vif_to_sdata(vif
);
4915 struct ieee80211_link_data
*link
;
4917 if (WARN_ON(link_id
>= IEEE80211_MLD_MAX_NUM_LINKS
))
4922 link
= rcu_dereference(sdata
->link
[link_id
]);
4923 if (WARN_ON(!link
)) {
4928 wiphy_work_queue(sdata
->local
->hw
.wiphy
,
4929 &link
->color_change_finalize_work
);
4933 EXPORT_SYMBOL_GPL(ieee80211_color_change_finish
);
4936 ieee80211_obss_color_collision_notify(struct ieee80211_vif
*vif
,
4937 u64 color_bitmap
, u8 link_id
)
4939 struct ieee80211_sub_if_data
*sdata
= vif_to_sdata(vif
);
4940 struct ieee80211_link_data
*link
;
4942 if (WARN_ON(link_id
>= IEEE80211_MLD_MAX_NUM_LINKS
))
4947 link
= rcu_dereference(sdata
->link
[link_id
]);
4948 if (WARN_ON(!link
)) {
4953 if (link
->conf
->color_change_active
|| link
->conf
->csa_active
) {
4958 if (wiphy_delayed_work_pending(sdata
->local
->hw
.wiphy
,
4959 &link
->color_collision_detect_work
)) {
4964 link
->color_bitmap
= color_bitmap
;
4965 /* queue the color collision detection event every 500 ms in order to
4966 * avoid sending too much netlink messages to userspace.
4968 wiphy_delayed_work_queue(sdata
->local
->hw
.wiphy
,
4969 &link
->color_collision_detect_work
,
4970 msecs_to_jiffies(500));
4974 EXPORT_SYMBOL_GPL(ieee80211_obss_color_collision_notify
);
4977 ieee80211_color_change(struct wiphy
*wiphy
, struct net_device
*dev
,
4978 struct cfg80211_color_change_settings
*params
)
4980 struct ieee80211_sub_if_data
*sdata
= IEEE80211_DEV_TO_SUB_IF(dev
);
4981 struct ieee80211_local
*local
= sdata
->local
;
4982 struct ieee80211_bss_conf
*link_conf
;
4983 struct ieee80211_link_data
*link
;
4984 u8 link_id
= params
->link_id
;
4988 lockdep_assert_wiphy(local
->hw
.wiphy
);
4990 if (WARN_ON(link_id
>= IEEE80211_MLD_MAX_NUM_LINKS
))
4993 link
= wiphy_dereference(wiphy
, sdata
->link
[link_id
]);
4997 link_conf
= link
->conf
;
4999 if (link_conf
->nontransmitted
)
5002 /* don't allow another color change if one is already active or if csa
5005 if (link_conf
->color_change_active
|| link_conf
->csa_active
) {
5010 err
= ieee80211_set_color_change_beacon(link
, params
, &changed
);
5014 link_conf
->color_change_active
= true;
5015 link_conf
->color_change_color
= params
->color
;
5017 cfg80211_color_change_started_notify(sdata
->dev
, params
->count
, link_id
);
5020 ieee80211_color_change_bss_config_notify(link
, 0, 0, changed
);
5022 /* if the beacon didn't change, we can finalize immediately */
5023 ieee80211_color_change_finalize(link
);
5031 ieee80211_set_radar_background(struct wiphy
*wiphy
,
5032 struct cfg80211_chan_def
*chandef
)
5034 struct ieee80211_local
*local
= wiphy_priv(wiphy
);
5036 if (!local
->ops
->set_radar_background
)
5039 return local
->ops
->set_radar_background(&local
->hw
, chandef
);
5042 static int ieee80211_add_intf_link(struct wiphy
*wiphy
,
5043 struct wireless_dev
*wdev
,
5044 unsigned int link_id
)
5046 struct ieee80211_sub_if_data
*sdata
= IEEE80211_WDEV_TO_SUB_IF(wdev
);
5048 lockdep_assert_wiphy(sdata
->local
->hw
.wiphy
);
5050 if (wdev
->use_4addr
)
5053 return ieee80211_vif_set_links(sdata
, wdev
->valid_links
, 0);
5056 static void ieee80211_del_intf_link(struct wiphy
*wiphy
,
5057 struct wireless_dev
*wdev
,
5058 unsigned int link_id
)
5060 struct ieee80211_sub_if_data
*sdata
= IEEE80211_WDEV_TO_SUB_IF(wdev
);
5061 u16 new_links
= wdev
->valid_links
& ~BIT(link_id
);
5063 lockdep_assert_wiphy(sdata
->local
->hw
.wiphy
);
5065 /* During the link teardown process, certain functions require the
5066 * link_id to remain in the valid_links bitmap. Therefore, instead
5067 * of removing the link_id from the bitmap, pass a masked value to
5068 * simulate as if link_id does not exist anymore.
5070 ieee80211_vif_set_links(sdata
, new_links
, 0);
5074 ieee80211_add_link_station(struct wiphy
*wiphy
, struct net_device
*dev
,
5075 struct link_station_parameters
*params
)
5077 struct ieee80211_sub_if_data
*sdata
= IEEE80211_DEV_TO_SUB_IF(dev
);
5078 struct ieee80211_local
*local
= wiphy_priv(wiphy
);
5079 struct sta_info
*sta
;
5082 lockdep_assert_wiphy(local
->hw
.wiphy
);
5084 sta
= sta_info_get_bss(sdata
, params
->mld_mac
);
5088 if (!sta
->sta
.valid_links
)
5091 if (sta
->sta
.valid_links
& BIT(params
->link_id
))
5094 ret
= ieee80211_sta_allocate_link(sta
, params
->link_id
);
5098 ret
= sta_link_apply_parameters(local
, sta
, STA_LINK_MODE_NEW
, params
);
5100 ieee80211_sta_free_link(sta
, params
->link_id
);
5104 if (test_sta_flag(sta
, WLAN_STA_ASSOC
)) {
5105 struct link_sta_info
*link_sta
;
5107 link_sta
= sdata_dereference(sta
->link
[params
->link_id
], sdata
);
5108 rate_control_rate_init(link_sta
);
5111 /* ieee80211_sta_activate_link frees the link upon failure */
5112 return ieee80211_sta_activate_link(sta
, params
->link_id
);
5116 ieee80211_mod_link_station(struct wiphy
*wiphy
, struct net_device
*dev
,
5117 struct link_station_parameters
*params
)
5119 struct ieee80211_sub_if_data
*sdata
= IEEE80211_DEV_TO_SUB_IF(dev
);
5120 struct ieee80211_local
*local
= wiphy_priv(wiphy
);
5121 struct sta_info
*sta
;
5123 lockdep_assert_wiphy(local
->hw
.wiphy
);
5125 sta
= sta_info_get_bss(sdata
, params
->mld_mac
);
5129 if (!(sta
->sta
.valid_links
& BIT(params
->link_id
)))
5132 return sta_link_apply_parameters(local
, sta
, STA_LINK_MODE_LINK_MODIFY
,
5137 ieee80211_del_link_station(struct wiphy
*wiphy
, struct net_device
*dev
,
5138 struct link_station_del_parameters
*params
)
5140 struct ieee80211_sub_if_data
*sdata
= IEEE80211_DEV_TO_SUB_IF(dev
);
5141 struct sta_info
*sta
;
5143 lockdep_assert_wiphy(sdata
->local
->hw
.wiphy
);
5145 sta
= sta_info_get_bss(sdata
, params
->mld_mac
);
5149 if (!(sta
->sta
.valid_links
& BIT(params
->link_id
)))
5152 /* must not create a STA without links */
5153 if (sta
->sta
.valid_links
== BIT(params
->link_id
))
5156 ieee80211_sta_remove_link(sta
, params
->link_id
);
5161 static int ieee80211_set_hw_timestamp(struct wiphy
*wiphy
,
5162 struct net_device
*dev
,
5163 struct cfg80211_set_hw_timestamp
*hwts
)
5165 struct ieee80211_sub_if_data
*sdata
= IEEE80211_DEV_TO_SUB_IF(dev
);
5166 struct ieee80211_local
*local
= sdata
->local
;
5168 if (!local
->ops
->set_hw_timestamp
)
5171 if (!check_sdata_in_driver(sdata
))
5174 return local
->ops
->set_hw_timestamp(&local
->hw
, &sdata
->vif
, hwts
);
5178 ieee80211_set_ttlm(struct wiphy
*wiphy
, struct net_device
*dev
,
5179 struct cfg80211_ttlm_params
*params
)
5181 struct ieee80211_sub_if_data
*sdata
= IEEE80211_DEV_TO_SUB_IF(dev
);
5183 lockdep_assert_wiphy(sdata
->local
->hw
.wiphy
);
5185 return ieee80211_req_neg_ttlm(sdata
, params
);
5189 ieee80211_assoc_ml_reconf(struct wiphy
*wiphy
, struct net_device
*dev
,
5190 struct cfg80211_assoc_link
*add_links
,
5193 struct ieee80211_sub_if_data
*sdata
= IEEE80211_DEV_TO_SUB_IF(dev
);
5195 lockdep_assert_wiphy(sdata
->local
->hw
.wiphy
);
5197 return ieee80211_mgd_assoc_ml_reconf(sdata
, add_links
, rem_links
);
5200 const struct cfg80211_ops mac80211_config_ops
= {
5201 .add_virtual_intf
= ieee80211_add_iface
,
5202 .del_virtual_intf
= ieee80211_del_iface
,
5203 .change_virtual_intf
= ieee80211_change_iface
,
5204 .start_p2p_device
= ieee80211_start_p2p_device
,
5205 .stop_p2p_device
= ieee80211_stop_p2p_device
,
5206 .add_key
= ieee80211_add_key
,
5207 .del_key
= ieee80211_del_key
,
5208 .get_key
= ieee80211_get_key
,
5209 .set_default_key
= ieee80211_config_default_key
,
5210 .set_default_mgmt_key
= ieee80211_config_default_mgmt_key
,
5211 .set_default_beacon_key
= ieee80211_config_default_beacon_key
,
5212 .start_ap
= ieee80211_start_ap
,
5213 .change_beacon
= ieee80211_change_beacon
,
5214 .stop_ap
= ieee80211_stop_ap
,
5215 .add_station
= ieee80211_add_station
,
5216 .del_station
= ieee80211_del_station
,
5217 .change_station
= ieee80211_change_station
,
5218 .get_station
= ieee80211_get_station
,
5219 .dump_station
= ieee80211_dump_station
,
5220 .dump_survey
= ieee80211_dump_survey
,
5221 #ifdef CONFIG_MAC80211_MESH
5222 .add_mpath
= ieee80211_add_mpath
,
5223 .del_mpath
= ieee80211_del_mpath
,
5224 .change_mpath
= ieee80211_change_mpath
,
5225 .get_mpath
= ieee80211_get_mpath
,
5226 .dump_mpath
= ieee80211_dump_mpath
,
5227 .get_mpp
= ieee80211_get_mpp
,
5228 .dump_mpp
= ieee80211_dump_mpp
,
5229 .update_mesh_config
= ieee80211_update_mesh_config
,
5230 .get_mesh_config
= ieee80211_get_mesh_config
,
5231 .join_mesh
= ieee80211_join_mesh
,
5232 .leave_mesh
= ieee80211_leave_mesh
,
5234 .join_ocb
= ieee80211_join_ocb
,
5235 .leave_ocb
= ieee80211_leave_ocb
,
5236 .change_bss
= ieee80211_change_bss
,
5237 .inform_bss
= ieee80211_inform_bss
,
5238 .set_txq_params
= ieee80211_set_txq_params
,
5239 .set_monitor_channel
= ieee80211_set_monitor_channel
,
5240 .suspend
= ieee80211_suspend
,
5241 .resume
= ieee80211_resume
,
5242 .scan
= ieee80211_scan
,
5243 .abort_scan
= ieee80211_abort_scan
,
5244 .sched_scan_start
= ieee80211_sched_scan_start
,
5245 .sched_scan_stop
= ieee80211_sched_scan_stop
,
5246 .auth
= ieee80211_auth
,
5247 .assoc
= ieee80211_assoc
,
5248 .deauth
= ieee80211_deauth
,
5249 .disassoc
= ieee80211_disassoc
,
5250 .join_ibss
= ieee80211_join_ibss
,
5251 .leave_ibss
= ieee80211_leave_ibss
,
5252 .set_mcast_rate
= ieee80211_set_mcast_rate
,
5253 .set_wiphy_params
= ieee80211_set_wiphy_params
,
5254 .set_tx_power
= ieee80211_set_tx_power
,
5255 .get_tx_power
= ieee80211_get_tx_power
,
5256 .rfkill_poll
= ieee80211_rfkill_poll
,
5257 CFG80211_TESTMODE_CMD(ieee80211_testmode_cmd
)
5258 CFG80211_TESTMODE_DUMP(ieee80211_testmode_dump
)
5259 .set_power_mgmt
= ieee80211_set_power_mgmt
,
5260 .set_bitrate_mask
= ieee80211_set_bitrate_mask
,
5261 .remain_on_channel
= ieee80211_remain_on_channel
,
5262 .cancel_remain_on_channel
= ieee80211_cancel_remain_on_channel
,
5263 .mgmt_tx
= ieee80211_mgmt_tx
,
5264 .mgmt_tx_cancel_wait
= ieee80211_mgmt_tx_cancel_wait
,
5265 .set_cqm_rssi_config
= ieee80211_set_cqm_rssi_config
,
5266 .set_cqm_rssi_range_config
= ieee80211_set_cqm_rssi_range_config
,
5267 .update_mgmt_frame_registrations
=
5268 ieee80211_update_mgmt_frame_registrations
,
5269 .set_antenna
= ieee80211_set_antenna
,
5270 .get_antenna
= ieee80211_get_antenna
,
5271 .set_rekey_data
= ieee80211_set_rekey_data
,
5272 .tdls_oper
= ieee80211_tdls_oper
,
5273 .tdls_mgmt
= ieee80211_tdls_mgmt
,
5274 .tdls_channel_switch
= ieee80211_tdls_channel_switch
,
5275 .tdls_cancel_channel_switch
= ieee80211_tdls_cancel_channel_switch
,
5276 .probe_client
= ieee80211_probe_client
,
5277 .set_noack_map
= ieee80211_set_noack_map
,
5279 .set_wakeup
= ieee80211_set_wakeup
,
5281 .get_channel
= ieee80211_cfg_get_channel
,
5282 .start_radar_detection
= ieee80211_start_radar_detection
,
5283 .end_cac
= ieee80211_end_cac
,
5284 .channel_switch
= ieee80211_channel_switch
,
5285 .set_qos_map
= ieee80211_set_qos_map
,
5286 .set_ap_chanwidth
= ieee80211_set_ap_chanwidth
,
5287 .add_tx_ts
= ieee80211_add_tx_ts
,
5288 .del_tx_ts
= ieee80211_del_tx_ts
,
5289 .start_nan
= ieee80211_start_nan
,
5290 .stop_nan
= ieee80211_stop_nan
,
5291 .nan_change_conf
= ieee80211_nan_change_conf
,
5292 .add_nan_func
= ieee80211_add_nan_func
,
5293 .del_nan_func
= ieee80211_del_nan_func
,
5294 .set_multicast_to_unicast
= ieee80211_set_multicast_to_unicast
,
5295 .tx_control_port
= ieee80211_tx_control_port
,
5296 .get_txq_stats
= ieee80211_get_txq_stats
,
5297 .get_ftm_responder_stats
= ieee80211_get_ftm_responder_stats
,
5298 .start_pmsr
= ieee80211_start_pmsr
,
5299 .abort_pmsr
= ieee80211_abort_pmsr
,
5300 .probe_mesh_link
= ieee80211_probe_mesh_link
,
5301 .set_tid_config
= ieee80211_set_tid_config
,
5302 .reset_tid_config
= ieee80211_reset_tid_config
,
5303 .set_sar_specs
= ieee80211_set_sar_specs
,
5304 .color_change
= ieee80211_color_change
,
5305 .set_radar_background
= ieee80211_set_radar_background
,
5306 .add_intf_link
= ieee80211_add_intf_link
,
5307 .del_intf_link
= ieee80211_del_intf_link
,
5308 .add_link_station
= ieee80211_add_link_station
,
5309 .mod_link_station
= ieee80211_mod_link_station
,
5310 .del_link_station
= ieee80211_del_link_station
,
5311 .set_hw_timestamp
= ieee80211_set_hw_timestamp
,
5312 .set_ttlm
= ieee80211_set_ttlm
,
5313 .get_radio_mask
= ieee80211_get_radio_mask
,
5314 .assoc_ml_reconf
= ieee80211_assoc_ml_reconf
,