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 (pairwise
&& params
->mode
== NL80211_KEY_SET_TX
)
507 return ieee80211_set_tx(sdata
, mac_addr
, key_idx
);
509 /* reject WEP and TKIP keys if WEP failed to initialize */
510 switch (params
->cipher
) {
511 case WLAN_CIPHER_SUITE_WEP40
:
512 case WLAN_CIPHER_SUITE_TKIP
:
513 case WLAN_CIPHER_SUITE_WEP104
:
516 if (WARN_ON_ONCE(fips_enabled
))
523 key
= ieee80211_key_alloc(params
->cipher
, key_idx
, params
->key_len
,
524 params
->key
, params
->seq_len
, params
->seq
);
528 key
->conf
.link_id
= link_id
;
531 key
->conf
.flags
|= IEEE80211_KEY_FLAG_PAIRWISE
;
533 if (params
->mode
== NL80211_KEY_NO_TX
)
534 key
->conf
.flags
|= IEEE80211_KEY_FLAG_NO_AUTO_TX
;
537 sta
= sta_info_get_bss(sdata
, mac_addr
);
539 * The ASSOC test makes sure the driver is ready to
540 * receive the key. When wpa_supplicant has roamed
541 * using FT, it attempts to set the key before
542 * association has completed, this rejects that attempt
543 * so it will set the key again after association.
545 * TODO: accept the key if we have a station entry and
546 * add it to the device after the station.
548 if (!sta
|| !test_sta_flag(sta
, WLAN_STA_ASSOC
)) {
549 ieee80211_key_free_unused(key
);
554 switch (sdata
->vif
.type
) {
555 case NL80211_IFTYPE_STATION
:
556 if (sdata
->u
.mgd
.mfp
!= IEEE80211_MFP_DISABLED
)
557 key
->conf
.flags
|= IEEE80211_KEY_FLAG_RX_MGMT
;
559 case NL80211_IFTYPE_AP
:
560 case NL80211_IFTYPE_AP_VLAN
:
561 /* Keys without a station are used for TX only */
562 if (sta
&& test_sta_flag(sta
, WLAN_STA_MFP
))
563 key
->conf
.flags
|= IEEE80211_KEY_FLAG_RX_MGMT
;
565 case NL80211_IFTYPE_ADHOC
:
568 case NL80211_IFTYPE_MESH_POINT
:
569 #ifdef CONFIG_MAC80211_MESH
570 if (sdata
->u
.mesh
.security
!= IEEE80211_MESH_SEC_NONE
)
571 key
->conf
.flags
|= IEEE80211_KEY_FLAG_RX_MGMT
;
574 case NL80211_IFTYPE_WDS
:
575 case NL80211_IFTYPE_MONITOR
:
576 case NL80211_IFTYPE_P2P_DEVICE
:
577 case NL80211_IFTYPE_NAN
:
578 case NL80211_IFTYPE_UNSPECIFIED
:
579 case NUM_NL80211_IFTYPES
:
580 case NL80211_IFTYPE_P2P_CLIENT
:
581 case NL80211_IFTYPE_P2P_GO
:
582 case NL80211_IFTYPE_OCB
:
583 /* shouldn't happen */
588 err
= ieee80211_key_link(key
, link
, sta
);
589 /* KRACK protection, shouldn't happen but just silently accept key */
590 if (err
== -EALREADY
)
596 static struct ieee80211_key
*
597 ieee80211_lookup_key(struct ieee80211_sub_if_data
*sdata
, int link_id
,
598 u8 key_idx
, bool pairwise
, const u8
*mac_addr
)
600 struct ieee80211_local
*local __maybe_unused
= sdata
->local
;
601 struct ieee80211_link_data
*link
= &sdata
->deflink
;
602 struct ieee80211_key
*key
;
605 link
= sdata_dereference(sdata
->link
[link_id
], sdata
);
611 struct sta_info
*sta
;
612 struct link_sta_info
*link_sta
;
614 sta
= sta_info_get_bss(sdata
, mac_addr
);
619 link_sta
= rcu_dereference_check(sta
->link
[link_id
],
620 lockdep_is_held(&local
->hw
.wiphy
->mtx
));
624 link_sta
= &sta
->deflink
;
627 if (pairwise
&& key_idx
< NUM_DEFAULT_KEYS
)
628 return wiphy_dereference(local
->hw
.wiphy
,
632 key_idx
< NUM_DEFAULT_KEYS
+
633 NUM_DEFAULT_MGMT_KEYS
+
634 NUM_DEFAULT_BEACON_KEYS
)
635 return wiphy_dereference(local
->hw
.wiphy
,
636 link_sta
->gtk
[key_idx
]);
641 if (pairwise
&& key_idx
< NUM_DEFAULT_KEYS
)
642 return wiphy_dereference(local
->hw
.wiphy
, sdata
->keys
[key_idx
]);
644 key
= wiphy_dereference(local
->hw
.wiphy
, link
->gtk
[key_idx
]);
648 /* or maybe it was a WEP key */
649 if (key_idx
< NUM_DEFAULT_KEYS
)
650 return wiphy_dereference(local
->hw
.wiphy
, sdata
->keys
[key_idx
]);
655 static int ieee80211_del_key(struct wiphy
*wiphy
, struct net_device
*dev
,
656 int link_id
, u8 key_idx
, bool pairwise
,
659 struct ieee80211_sub_if_data
*sdata
= IEEE80211_DEV_TO_SUB_IF(dev
);
660 struct ieee80211_local
*local
= sdata
->local
;
661 struct ieee80211_key
*key
;
663 lockdep_assert_wiphy(local
->hw
.wiphy
);
665 key
= ieee80211_lookup_key(sdata
, link_id
, key_idx
, pairwise
, mac_addr
);
669 ieee80211_key_free(key
, sdata
->vif
.type
== NL80211_IFTYPE_STATION
);
674 static int ieee80211_get_key(struct wiphy
*wiphy
, struct net_device
*dev
,
675 int link_id
, u8 key_idx
, bool pairwise
,
676 const u8
*mac_addr
, void *cookie
,
677 void (*callback
)(void *cookie
,
678 struct key_params
*params
))
680 struct ieee80211_sub_if_data
*sdata
;
682 struct key_params params
;
683 struct ieee80211_key
*key
;
688 struct ieee80211_key_seq kseq
= {};
690 sdata
= IEEE80211_DEV_TO_SUB_IF(dev
);
694 key
= ieee80211_lookup_key(sdata
, link_id
, key_idx
, pairwise
, mac_addr
);
698 memset(¶ms
, 0, sizeof(params
));
700 params
.cipher
= key
->conf
.cipher
;
702 switch (key
->conf
.cipher
) {
703 case WLAN_CIPHER_SUITE_TKIP
:
704 pn64
= atomic64_read(&key
->conf
.tx_pn
);
705 iv32
= TKIP_PN_TO_IV32(pn64
);
706 iv16
= TKIP_PN_TO_IV16(pn64
);
708 if (key
->flags
& KEY_FLAG_UPLOADED_TO_HARDWARE
&&
709 !(key
->conf
.flags
& IEEE80211_KEY_FLAG_GENERATE_IV
)) {
710 drv_get_key_seq(sdata
->local
, key
, &kseq
);
711 iv32
= kseq
.tkip
.iv32
;
712 iv16
= kseq
.tkip
.iv16
;
715 seq
[0] = iv16
& 0xff;
716 seq
[1] = (iv16
>> 8) & 0xff;
717 seq
[2] = iv32
& 0xff;
718 seq
[3] = (iv32
>> 8) & 0xff;
719 seq
[4] = (iv32
>> 16) & 0xff;
720 seq
[5] = (iv32
>> 24) & 0xff;
724 case WLAN_CIPHER_SUITE_CCMP
:
725 case WLAN_CIPHER_SUITE_CCMP_256
:
726 case WLAN_CIPHER_SUITE_AES_CMAC
:
727 case WLAN_CIPHER_SUITE_BIP_CMAC_256
:
728 BUILD_BUG_ON(offsetof(typeof(kseq
), ccmp
) !=
729 offsetof(typeof(kseq
), aes_cmac
));
731 case WLAN_CIPHER_SUITE_BIP_GMAC_128
:
732 case WLAN_CIPHER_SUITE_BIP_GMAC_256
:
733 BUILD_BUG_ON(offsetof(typeof(kseq
), ccmp
) !=
734 offsetof(typeof(kseq
), aes_gmac
));
736 case WLAN_CIPHER_SUITE_GCMP
:
737 case WLAN_CIPHER_SUITE_GCMP_256
:
738 BUILD_BUG_ON(offsetof(typeof(kseq
), ccmp
) !=
739 offsetof(typeof(kseq
), gcmp
));
741 if (key
->flags
& KEY_FLAG_UPLOADED_TO_HARDWARE
&&
742 !(key
->conf
.flags
& IEEE80211_KEY_FLAG_GENERATE_IV
)) {
743 drv_get_key_seq(sdata
->local
, key
, &kseq
);
744 memcpy(seq
, kseq
.ccmp
.pn
, 6);
746 pn64
= atomic64_read(&key
->conf
.tx_pn
);
758 if (!(key
->flags
& KEY_FLAG_UPLOADED_TO_HARDWARE
))
760 if (WARN_ON(key
->conf
.flags
& IEEE80211_KEY_FLAG_GENERATE_IV
))
762 drv_get_key_seq(sdata
->local
, key
, &kseq
);
763 params
.seq
= kseq
.hw
.seq
;
764 params
.seq_len
= kseq
.hw
.seq_len
;
768 callback(cookie
, ¶ms
);
776 static int ieee80211_config_default_key(struct wiphy
*wiphy
,
777 struct net_device
*dev
,
778 int link_id
, u8 key_idx
, bool uni
,
781 struct ieee80211_sub_if_data
*sdata
= IEEE80211_DEV_TO_SUB_IF(dev
);
782 struct ieee80211_link_data
*link
=
783 ieee80211_link_or_deflink(sdata
, link_id
, false);
786 return PTR_ERR(link
);
788 ieee80211_set_default_key(link
, key_idx
, uni
, multi
);
793 static int ieee80211_config_default_mgmt_key(struct wiphy
*wiphy
,
794 struct net_device
*dev
,
795 int link_id
, u8 key_idx
)
797 struct ieee80211_sub_if_data
*sdata
= IEEE80211_DEV_TO_SUB_IF(dev
);
798 struct ieee80211_link_data
*link
=
799 ieee80211_link_or_deflink(sdata
, link_id
, true);
802 return PTR_ERR(link
);
804 ieee80211_set_default_mgmt_key(link
, key_idx
);
809 static int ieee80211_config_default_beacon_key(struct wiphy
*wiphy
,
810 struct net_device
*dev
,
811 int link_id
, u8 key_idx
)
813 struct ieee80211_sub_if_data
*sdata
= IEEE80211_DEV_TO_SUB_IF(dev
);
814 struct ieee80211_link_data
*link
=
815 ieee80211_link_or_deflink(sdata
, link_id
, true);
818 return PTR_ERR(link
);
820 ieee80211_set_default_beacon_key(link
, key_idx
);
825 void sta_set_rate_info_tx(struct sta_info
*sta
,
826 const struct ieee80211_tx_rate
*rate
,
827 struct rate_info
*rinfo
)
830 if (rate
->flags
& IEEE80211_TX_RC_MCS
) {
831 rinfo
->flags
|= RATE_INFO_FLAGS_MCS
;
832 rinfo
->mcs
= rate
->idx
;
833 } else if (rate
->flags
& IEEE80211_TX_RC_VHT_MCS
) {
834 rinfo
->flags
|= RATE_INFO_FLAGS_VHT_MCS
;
835 rinfo
->mcs
= ieee80211_rate_get_vht_mcs(rate
);
836 rinfo
->nss
= ieee80211_rate_get_vht_nss(rate
);
838 struct ieee80211_supported_band
*sband
;
840 sband
= ieee80211_get_sband(sta
->sdata
);
841 WARN_ON_ONCE(sband
&& !sband
->bitrates
);
842 if (sband
&& sband
->bitrates
)
843 rinfo
->legacy
= sband
->bitrates
[rate
->idx
].bitrate
;
845 if (rate
->flags
& IEEE80211_TX_RC_40_MHZ_WIDTH
)
846 rinfo
->bw
= RATE_INFO_BW_40
;
847 else if (rate
->flags
& IEEE80211_TX_RC_80_MHZ_WIDTH
)
848 rinfo
->bw
= RATE_INFO_BW_80
;
849 else if (rate
->flags
& IEEE80211_TX_RC_160_MHZ_WIDTH
)
850 rinfo
->bw
= RATE_INFO_BW_160
;
852 rinfo
->bw
= RATE_INFO_BW_20
;
853 if (rate
->flags
& IEEE80211_TX_RC_SHORT_GI
)
854 rinfo
->flags
|= RATE_INFO_FLAGS_SHORT_GI
;
857 static int ieee80211_dump_station(struct wiphy
*wiphy
, struct net_device
*dev
,
858 int idx
, u8
*mac
, struct station_info
*sinfo
)
860 struct ieee80211_sub_if_data
*sdata
= IEEE80211_DEV_TO_SUB_IF(dev
);
861 struct ieee80211_local
*local
= sdata
->local
;
862 struct sta_info
*sta
;
865 lockdep_assert_wiphy(local
->hw
.wiphy
);
867 sta
= sta_info_get_by_idx(sdata
, idx
);
870 memcpy(mac
, sta
->sta
.addr
, ETH_ALEN
);
871 sta_set_sinfo(sta
, sinfo
, true);
877 static int ieee80211_dump_survey(struct wiphy
*wiphy
, struct net_device
*dev
,
878 int idx
, struct survey_info
*survey
)
880 struct ieee80211_local
*local
= wdev_priv(dev
->ieee80211_ptr
);
882 return drv_get_survey(local
, idx
, survey
);
885 static int ieee80211_get_station(struct wiphy
*wiphy
, struct net_device
*dev
,
886 const u8
*mac
, struct station_info
*sinfo
)
888 struct ieee80211_sub_if_data
*sdata
= IEEE80211_DEV_TO_SUB_IF(dev
);
889 struct ieee80211_local
*local
= sdata
->local
;
890 struct sta_info
*sta
;
893 lockdep_assert_wiphy(local
->hw
.wiphy
);
895 sta
= sta_info_get_bss(sdata
, mac
);
898 sta_set_sinfo(sta
, sinfo
, true);
904 static int ieee80211_set_monitor_channel(struct wiphy
*wiphy
,
905 struct net_device
*dev
,
906 struct cfg80211_chan_def
*chandef
)
908 struct ieee80211_local
*local
= wiphy_priv(wiphy
);
909 struct ieee80211_sub_if_data
*sdata
;
910 struct ieee80211_chan_req chanreq
= { .oper
= *chandef
};
913 lockdep_assert_wiphy(local
->hw
.wiphy
);
915 sdata
= IEEE80211_DEV_TO_SUB_IF(dev
);
916 if (!ieee80211_hw_check(&local
->hw
, NO_VIRTUAL_MONITOR
)) {
917 if (cfg80211_chandef_identical(&local
->monitor_chanreq
.oper
,
921 sdata
= wiphy_dereference(wiphy
, local
->monitor_sdata
);
926 if (rcu_access_pointer(sdata
->deflink
.conf
->chanctx_conf
) &&
927 cfg80211_chandef_identical(&sdata
->vif
.bss_conf
.chanreq
.oper
,
931 ieee80211_link_release_channel(&sdata
->deflink
);
932 ret
= ieee80211_link_use_channel(&sdata
->deflink
, &chanreq
,
933 IEEE80211_CHANCTX_SHARED
);
937 local
->monitor_chanreq
= chanreq
;
942 ieee80211_set_probe_resp(struct ieee80211_sub_if_data
*sdata
,
943 const u8
*resp
, size_t resp_len
,
944 const struct ieee80211_csa_settings
*csa
,
945 const struct ieee80211_color_change_settings
*cca
,
946 struct ieee80211_link_data
*link
)
948 struct probe_resp
*new, *old
;
950 if (!resp
|| !resp_len
)
953 old
= sdata_dereference(link
->u
.ap
.probe_resp
, sdata
);
955 new = kzalloc(sizeof(struct probe_resp
) + resp_len
, GFP_KERNEL
);
960 memcpy(new->data
, resp
, resp_len
);
963 memcpy(new->cntdwn_counter_offsets
, csa
->counter_offsets_presp
,
964 csa
->n_counter_offsets_presp
*
965 sizeof(new->cntdwn_counter_offsets
[0]));
967 new->cntdwn_counter_offsets
[0] = cca
->counter_offset_presp
;
969 rcu_assign_pointer(link
->u
.ap
.probe_resp
, new);
971 kfree_rcu(old
, rcu_head
);
976 static int ieee80211_set_fils_discovery(struct ieee80211_sub_if_data
*sdata
,
977 struct cfg80211_fils_discovery
*params
,
978 struct ieee80211_link_data
*link
,
979 struct ieee80211_bss_conf
*link_conf
,
982 struct fils_discovery_data
*new, *old
= NULL
;
983 struct ieee80211_fils_discovery
*fd
;
988 fd
= &link_conf
->fils_discovery
;
989 fd
->min_interval
= params
->min_interval
;
990 fd
->max_interval
= params
->max_interval
;
992 old
= sdata_dereference(link
->u
.ap
.fils_discovery
, sdata
);
994 kfree_rcu(old
, rcu_head
);
996 if (params
->tmpl
&& params
->tmpl_len
) {
997 new = kzalloc(sizeof(*new) + params
->tmpl_len
, GFP_KERNEL
);
1000 new->len
= params
->tmpl_len
;
1001 memcpy(new->data
, params
->tmpl
, params
->tmpl_len
);
1002 rcu_assign_pointer(link
->u
.ap
.fils_discovery
, new);
1004 RCU_INIT_POINTER(link
->u
.ap
.fils_discovery
, NULL
);
1007 *changed
|= BSS_CHANGED_FILS_DISCOVERY
;
1012 ieee80211_set_unsol_bcast_probe_resp(struct ieee80211_sub_if_data
*sdata
,
1013 struct cfg80211_unsol_bcast_probe_resp
*params
,
1014 struct ieee80211_link_data
*link
,
1015 struct ieee80211_bss_conf
*link_conf
,
1018 struct unsol_bcast_probe_resp_data
*new, *old
= NULL
;
1020 if (!params
->update
)
1023 link_conf
->unsol_bcast_probe_resp_interval
= params
->interval
;
1025 old
= sdata_dereference(link
->u
.ap
.unsol_bcast_probe_resp
, sdata
);
1027 kfree_rcu(old
, rcu_head
);
1029 if (params
->tmpl
&& params
->tmpl_len
) {
1030 new = kzalloc(sizeof(*new) + params
->tmpl_len
, GFP_KERNEL
);
1033 new->len
= params
->tmpl_len
;
1034 memcpy(new->data
, params
->tmpl
, params
->tmpl_len
);
1035 rcu_assign_pointer(link
->u
.ap
.unsol_bcast_probe_resp
, new);
1037 RCU_INIT_POINTER(link
->u
.ap
.unsol_bcast_probe_resp
, NULL
);
1040 *changed
|= BSS_CHANGED_UNSOL_BCAST_PROBE_RESP
;
1044 static int ieee80211_set_ftm_responder_params(
1045 struct ieee80211_sub_if_data
*sdata
,
1046 const u8
*lci
, size_t lci_len
,
1047 const u8
*civicloc
, size_t civicloc_len
,
1048 struct ieee80211_bss_conf
*link_conf
)
1050 struct ieee80211_ftm_responder_params
*new, *old
;
1054 if (!lci_len
&& !civicloc_len
)
1057 old
= link_conf
->ftmr_params
;
1058 len
= lci_len
+ civicloc_len
;
1060 new = kzalloc(sizeof(*new) + len
, GFP_KERNEL
);
1064 pos
= (u8
*)(new + 1);
1066 new->lci_len
= lci_len
;
1068 memcpy(pos
, lci
, lci_len
);
1073 new->civicloc_len
= civicloc_len
;
1074 new->civicloc
= pos
;
1075 memcpy(pos
, civicloc
, civicloc_len
);
1076 pos
+= civicloc_len
;
1079 link_conf
->ftmr_params
= new;
1086 ieee80211_copy_mbssid_beacon(u8
*pos
, struct cfg80211_mbssid_elems
*dst
,
1087 struct cfg80211_mbssid_elems
*src
)
1091 for (i
= 0; i
< src
->cnt
; i
++) {
1092 memcpy(pos
+ offset
, src
->elem
[i
].data
, src
->elem
[i
].len
);
1093 dst
->elem
[i
].len
= src
->elem
[i
].len
;
1094 dst
->elem
[i
].data
= pos
+ offset
;
1095 offset
+= dst
->elem
[i
].len
;
1097 dst
->cnt
= src
->cnt
;
1103 ieee80211_copy_rnr_beacon(u8
*pos
, struct cfg80211_rnr_elems
*dst
,
1104 struct cfg80211_rnr_elems
*src
)
1108 for (i
= 0; i
< src
->cnt
; i
++) {
1109 memcpy(pos
+ offset
, src
->elem
[i
].data
, src
->elem
[i
].len
);
1110 dst
->elem
[i
].len
= src
->elem
[i
].len
;
1111 dst
->elem
[i
].data
= pos
+ offset
;
1112 offset
+= dst
->elem
[i
].len
;
1114 dst
->cnt
= src
->cnt
;
1120 ieee80211_assign_beacon(struct ieee80211_sub_if_data
*sdata
,
1121 struct ieee80211_link_data
*link
,
1122 struct cfg80211_beacon_data
*params
,
1123 const struct ieee80211_csa_settings
*csa
,
1124 const struct ieee80211_color_change_settings
*cca
,
1127 struct cfg80211_mbssid_elems
*mbssid
= NULL
;
1128 struct cfg80211_rnr_elems
*rnr
= NULL
;
1129 struct beacon_data
*new, *old
;
1130 int new_head_len
, new_tail_len
;
1132 u64 _changed
= BSS_CHANGED_BEACON
;
1133 struct ieee80211_bss_conf
*link_conf
= link
->conf
;
1135 old
= sdata_dereference(link
->u
.ap
.beacon
, sdata
);
1137 /* Need to have a beacon head if we don't have one yet */
1138 if (!params
->head
&& !old
)
1141 /* new or old head? */
1143 new_head_len
= params
->head_len
;
1145 new_head_len
= old
->head_len
;
1147 /* new or old tail? */
1148 if (params
->tail
|| !old
)
1149 /* params->tail_len will be zero for !params->tail */
1150 new_tail_len
= params
->tail_len
;
1152 new_tail_len
= old
->tail_len
;
1154 size
= sizeof(*new) + new_head_len
+ new_tail_len
;
1156 /* new or old multiple BSSID elements? */
1157 if (params
->mbssid_ies
) {
1158 mbssid
= params
->mbssid_ies
;
1159 size
+= struct_size(new->mbssid_ies
, elem
, mbssid
->cnt
);
1160 if (params
->rnr_ies
) {
1161 rnr
= params
->rnr_ies
;
1162 size
+= struct_size(new->rnr_ies
, elem
, rnr
->cnt
);
1164 size
+= ieee80211_get_mbssid_beacon_len(mbssid
, rnr
,
1166 } else if (old
&& old
->mbssid_ies
) {
1167 mbssid
= old
->mbssid_ies
;
1168 size
+= struct_size(new->mbssid_ies
, elem
, mbssid
->cnt
);
1169 if (old
&& old
->rnr_ies
) {
1171 size
+= struct_size(new->rnr_ies
, elem
, rnr
->cnt
);
1173 size
+= ieee80211_get_mbssid_beacon_len(mbssid
, rnr
,
1177 new = kzalloc(size
, GFP_KERNEL
);
1181 /* start filling the new info now */
1184 * pointers go into the block we allocated,
1185 * memory is | beacon_data | head | tail | mbssid_ies | rnr_ies
1187 new->head
= ((u8
*) new) + sizeof(*new);
1188 new->tail
= new->head
+ new_head_len
;
1189 new->head_len
= new_head_len
;
1190 new->tail_len
= new_tail_len
;
1191 /* copy in optional mbssid_ies */
1193 u8
*pos
= new->tail
+ new->tail_len
;
1195 new->mbssid_ies
= (void *)pos
;
1196 pos
+= struct_size(new->mbssid_ies
, elem
, mbssid
->cnt
);
1197 pos
+= ieee80211_copy_mbssid_beacon(pos
, new->mbssid_ies
,
1200 new->rnr_ies
= (void *)pos
;
1201 pos
+= struct_size(new->rnr_ies
, elem
, rnr
->cnt
);
1202 ieee80211_copy_rnr_beacon(pos
, new->rnr_ies
, rnr
);
1204 /* update bssid_indicator */
1205 link_conf
->bssid_indicator
=
1206 ilog2(__roundup_pow_of_two(mbssid
->cnt
+ 1));
1210 new->cntdwn_current_counter
= csa
->count
;
1211 memcpy(new->cntdwn_counter_offsets
, csa
->counter_offsets_beacon
,
1212 csa
->n_counter_offsets_beacon
*
1213 sizeof(new->cntdwn_counter_offsets
[0]));
1215 new->cntdwn_current_counter
= cca
->count
;
1216 new->cntdwn_counter_offsets
[0] = cca
->counter_offset_beacon
;
1221 memcpy(new->head
, params
->head
, new_head_len
);
1223 memcpy(new->head
, old
->head
, new_head_len
);
1225 /* copy in optional tail */
1227 memcpy(new->tail
, params
->tail
, new_tail_len
);
1230 memcpy(new->tail
, old
->tail
, new_tail_len
);
1232 err
= ieee80211_set_probe_resp(sdata
, params
->probe_resp
,
1233 params
->probe_resp_len
, csa
, cca
, link
);
1239 _changed
|= BSS_CHANGED_AP_PROBE_RESP
;
1241 if (params
->ftm_responder
!= -1) {
1242 link_conf
->ftm_responder
= params
->ftm_responder
;
1243 err
= ieee80211_set_ftm_responder_params(sdata
,
1247 params
->civicloc_len
,
1255 _changed
|= BSS_CHANGED_FTM_RESPONDER
;
1258 rcu_assign_pointer(link
->u
.ap
.beacon
, new);
1259 sdata
->u
.ap
.active
= true;
1262 kfree_rcu(old
, rcu_head
);
1264 *changed
|= _changed
;
1268 static u8
ieee80211_num_beaconing_links(struct ieee80211_sub_if_data
*sdata
)
1270 struct ieee80211_link_data
*link
;
1271 u8 link_id
, num
= 0;
1273 if (sdata
->vif
.type
!= NL80211_IFTYPE_AP
&&
1274 sdata
->vif
.type
!= NL80211_IFTYPE_P2P_GO
)
1277 if (!sdata
->vif
.valid_links
)
1280 for (link_id
= 0; link_id
< IEEE80211_MLD_MAX_NUM_LINKS
; link_id
++) {
1281 link
= sdata_dereference(sdata
->link
[link_id
], sdata
);
1285 if (sdata_dereference(link
->u
.ap
.beacon
, sdata
))
1292 static int ieee80211_start_ap(struct wiphy
*wiphy
, struct net_device
*dev
,
1293 struct cfg80211_ap_settings
*params
)
1295 struct ieee80211_sub_if_data
*sdata
= IEEE80211_DEV_TO_SUB_IF(dev
);
1296 struct ieee80211_local
*local
= sdata
->local
;
1297 struct beacon_data
*old
;
1298 struct ieee80211_sub_if_data
*vlan
;
1299 u64 changed
= BSS_CHANGED_BEACON_INT
|
1300 BSS_CHANGED_BEACON_ENABLED
|
1301 BSS_CHANGED_BEACON
|
1302 BSS_CHANGED_P2P_PS
|
1303 BSS_CHANGED_TXPOWER
|
1306 int prev_beacon_int
;
1307 unsigned int link_id
= params
->beacon
.link_id
;
1308 struct ieee80211_link_data
*link
;
1309 struct ieee80211_bss_conf
*link_conf
;
1310 struct ieee80211_chan_req chanreq
= { .oper
= params
->chandef
};
1312 lockdep_assert_wiphy(local
->hw
.wiphy
);
1314 link
= sdata_dereference(sdata
->link
[link_id
], sdata
);
1318 link_conf
= link
->conf
;
1320 old
= sdata_dereference(link
->u
.ap
.beacon
, sdata
);
1324 link
->smps_mode
= IEEE80211_SMPS_OFF
;
1326 link
->needed_rx_chains
= sdata
->local
->rx_chains
;
1328 prev_beacon_int
= link_conf
->beacon_int
;
1329 link_conf
->beacon_int
= params
->beacon_interval
;
1332 link_conf
->ht_ldpc
=
1333 params
->ht_cap
->cap_info
&
1334 cpu_to_le16(IEEE80211_HT_CAP_LDPC_CODING
);
1336 if (params
->vht_cap
) {
1337 link_conf
->vht_ldpc
=
1338 params
->vht_cap
->vht_cap_info
&
1339 cpu_to_le32(IEEE80211_VHT_CAP_RXLDPC
);
1340 link_conf
->vht_su_beamformer
=
1341 params
->vht_cap
->vht_cap_info
&
1342 cpu_to_le32(IEEE80211_VHT_CAP_SU_BEAMFORMER_CAPABLE
);
1343 link_conf
->vht_su_beamformee
=
1344 params
->vht_cap
->vht_cap_info
&
1345 cpu_to_le32(IEEE80211_VHT_CAP_SU_BEAMFORMEE_CAPABLE
);
1346 link_conf
->vht_mu_beamformer
=
1347 params
->vht_cap
->vht_cap_info
&
1348 cpu_to_le32(IEEE80211_VHT_CAP_MU_BEAMFORMER_CAPABLE
);
1349 link_conf
->vht_mu_beamformee
=
1350 params
->vht_cap
->vht_cap_info
&
1351 cpu_to_le32(IEEE80211_VHT_CAP_MU_BEAMFORMEE_CAPABLE
);
1354 if (params
->he_cap
&& params
->he_oper
) {
1355 link_conf
->he_support
= true;
1356 link_conf
->htc_trig_based_pkt_ext
=
1357 le32_get_bits(params
->he_oper
->he_oper_params
,
1358 IEEE80211_HE_OPERATION_DFLT_PE_DURATION_MASK
);
1359 link_conf
->frame_time_rts_th
=
1360 le32_get_bits(params
->he_oper
->he_oper_params
,
1361 IEEE80211_HE_OPERATION_RTS_THRESHOLD_MASK
);
1362 changed
|= BSS_CHANGED_HE_OBSS_PD
;
1364 if (params
->beacon
.he_bss_color
.enabled
)
1365 changed
|= BSS_CHANGED_HE_BSS_COLOR
;
1368 if (params
->he_cap
) {
1369 link_conf
->he_ldpc
=
1370 params
->he_cap
->phy_cap_info
[1] &
1371 IEEE80211_HE_PHY_CAP1_LDPC_CODING_IN_PAYLOAD
;
1372 link_conf
->he_su_beamformer
=
1373 params
->he_cap
->phy_cap_info
[3] &
1374 IEEE80211_HE_PHY_CAP3_SU_BEAMFORMER
;
1375 link_conf
->he_su_beamformee
=
1376 params
->he_cap
->phy_cap_info
[4] &
1377 IEEE80211_HE_PHY_CAP4_SU_BEAMFORMEE
;
1378 link_conf
->he_mu_beamformer
=
1379 params
->he_cap
->phy_cap_info
[4] &
1380 IEEE80211_HE_PHY_CAP4_MU_BEAMFORMER
;
1381 link_conf
->he_full_ul_mumimo
=
1382 params
->he_cap
->phy_cap_info
[2] &
1383 IEEE80211_HE_PHY_CAP2_UL_MU_FULL_MU_MIMO
;
1386 if (params
->eht_cap
) {
1387 if (!link_conf
->he_support
)
1390 link_conf
->eht_support
= true;
1392 link_conf
->eht_su_beamformer
=
1393 params
->eht_cap
->fixed
.phy_cap_info
[0] &
1394 IEEE80211_EHT_PHY_CAP0_SU_BEAMFORMER
;
1395 link_conf
->eht_su_beamformee
=
1396 params
->eht_cap
->fixed
.phy_cap_info
[0] &
1397 IEEE80211_EHT_PHY_CAP0_SU_BEAMFORMEE
;
1398 link_conf
->eht_mu_beamformer
=
1399 params
->eht_cap
->fixed
.phy_cap_info
[7] &
1400 (IEEE80211_EHT_PHY_CAP7_MU_BEAMFORMER_80MHZ
|
1401 IEEE80211_EHT_PHY_CAP7_MU_BEAMFORMER_160MHZ
|
1402 IEEE80211_EHT_PHY_CAP7_MU_BEAMFORMER_320MHZ
);
1403 link_conf
->eht_80mhz_full_bw_ul_mumimo
=
1404 params
->eht_cap
->fixed
.phy_cap_info
[7] &
1405 (IEEE80211_EHT_PHY_CAP7_NON_OFDMA_UL_MU_MIMO_80MHZ
|
1406 IEEE80211_EHT_PHY_CAP7_NON_OFDMA_UL_MU_MIMO_160MHZ
|
1407 IEEE80211_EHT_PHY_CAP7_NON_OFDMA_UL_MU_MIMO_320MHZ
);
1409 link_conf
->eht_su_beamformer
= false;
1410 link_conf
->eht_su_beamformee
= false;
1411 link_conf
->eht_mu_beamformer
= false;
1414 if (sdata
->vif
.type
== NL80211_IFTYPE_AP
&&
1415 params
->mbssid_config
.tx_wdev
) {
1416 err
= ieee80211_set_ap_mbssid_options(sdata
,
1417 ¶ms
->mbssid_config
,
1423 err
= ieee80211_link_use_channel(link
, &chanreq
,
1424 IEEE80211_CHANCTX_SHARED
);
1426 ieee80211_link_copy_chanctx_to_vlans(link
, false);
1428 link_conf
->beacon_int
= prev_beacon_int
;
1433 * Apply control port protocol, this allows us to
1434 * not encrypt dynamic WEP control frames.
1436 sdata
->control_port_protocol
= params
->crypto
.control_port_ethertype
;
1437 sdata
->control_port_no_encrypt
= params
->crypto
.control_port_no_encrypt
;
1438 sdata
->control_port_over_nl80211
=
1439 params
->crypto
.control_port_over_nl80211
;
1440 sdata
->control_port_no_preauth
=
1441 params
->crypto
.control_port_no_preauth
;
1443 list_for_each_entry(vlan
, &sdata
->u
.ap
.vlans
, u
.vlan
.list
) {
1444 vlan
->control_port_protocol
=
1445 params
->crypto
.control_port_ethertype
;
1446 vlan
->control_port_no_encrypt
=
1447 params
->crypto
.control_port_no_encrypt
;
1448 vlan
->control_port_over_nl80211
=
1449 params
->crypto
.control_port_over_nl80211
;
1450 vlan
->control_port_no_preauth
=
1451 params
->crypto
.control_port_no_preauth
;
1454 link_conf
->dtim_period
= params
->dtim_period
;
1455 link_conf
->enable_beacon
= true;
1456 link_conf
->allow_p2p_go_ps
= sdata
->vif
.p2p
;
1457 link_conf
->twt_responder
= params
->twt_responder
;
1458 link_conf
->he_obss_pd
= params
->he_obss_pd
;
1459 link_conf
->he_bss_color
= params
->beacon
.he_bss_color
;
1460 sdata
->vif
.cfg
.s1g
= params
->chandef
.chan
->band
==
1463 sdata
->vif
.cfg
.ssid_len
= params
->ssid_len
;
1464 if (params
->ssid_len
)
1465 memcpy(sdata
->vif
.cfg
.ssid
, params
->ssid
,
1467 link_conf
->hidden_ssid
=
1468 (params
->hidden_ssid
!= NL80211_HIDDEN_SSID_NOT_IN_USE
);
1470 memset(&link_conf
->p2p_noa_attr
, 0,
1471 sizeof(link_conf
->p2p_noa_attr
));
1472 link_conf
->p2p_noa_attr
.oppps_ctwindow
=
1473 params
->p2p_ctwindow
& IEEE80211_P2P_OPPPS_CTWINDOW_MASK
;
1474 if (params
->p2p_opp_ps
)
1475 link_conf
->p2p_noa_attr
.oppps_ctwindow
|=
1476 IEEE80211_P2P_OPPPS_ENABLE_BIT
;
1478 sdata
->beacon_rate_set
= false;
1479 if (wiphy_ext_feature_isset(local
->hw
.wiphy
,
1480 NL80211_EXT_FEATURE_BEACON_RATE_LEGACY
)) {
1481 for (i
= 0; i
< NUM_NL80211_BANDS
; i
++) {
1482 sdata
->beacon_rateidx_mask
[i
] =
1483 params
->beacon_rate
.control
[i
].legacy
;
1484 if (sdata
->beacon_rateidx_mask
[i
])
1485 sdata
->beacon_rate_set
= true;
1489 if (ieee80211_hw_check(&local
->hw
, HAS_RATE_CONTROL
))
1490 link_conf
->beacon_tx_rate
= params
->beacon_rate
;
1492 err
= ieee80211_assign_beacon(sdata
, link
, ¶ms
->beacon
, NULL
, NULL
,
1497 err
= ieee80211_set_fils_discovery(sdata
, ¶ms
->fils_discovery
,
1498 link
, link_conf
, &changed
);
1502 err
= ieee80211_set_unsol_bcast_probe_resp(sdata
,
1503 ¶ms
->unsol_bcast_probe_resp
,
1504 link
, link_conf
, &changed
);
1508 err
= drv_start_ap(sdata
->local
, sdata
, link_conf
);
1510 old
= sdata_dereference(link
->u
.ap
.beacon
, sdata
);
1513 kfree_rcu(old
, rcu_head
);
1514 RCU_INIT_POINTER(link
->u
.ap
.beacon
, NULL
);
1516 if (ieee80211_num_beaconing_links(sdata
) == 0)
1517 sdata
->u
.ap
.active
= false;
1522 ieee80211_recalc_dtim(local
, sdata
);
1523 ieee80211_vif_cfg_change_notify(sdata
, BSS_CHANGED_SSID
);
1524 ieee80211_link_info_change_notify(sdata
, link
, changed
);
1526 if (ieee80211_num_beaconing_links(sdata
) <= 1)
1527 netif_carrier_on(dev
);
1529 list_for_each_entry(vlan
, &sdata
->u
.ap
.vlans
, u
.vlan
.list
)
1530 netif_carrier_on(vlan
->dev
);
1535 ieee80211_link_release_channel(link
);
1540 static int ieee80211_change_beacon(struct wiphy
*wiphy
, struct net_device
*dev
,
1541 struct cfg80211_ap_update
*params
)
1544 struct ieee80211_sub_if_data
*sdata
= IEEE80211_DEV_TO_SUB_IF(dev
);
1545 struct ieee80211_link_data
*link
;
1546 struct cfg80211_beacon_data
*beacon
= ¶ms
->beacon
;
1547 struct beacon_data
*old
;
1549 struct ieee80211_bss_conf
*link_conf
;
1552 lockdep_assert_wiphy(wiphy
);
1554 link
= sdata_dereference(sdata
->link
[beacon
->link_id
], sdata
);
1558 link_conf
= link
->conf
;
1560 /* don't allow changing the beacon while a countdown is in place - offset
1561 * of channel switch counter may change
1563 if (link_conf
->csa_active
|| link_conf
->color_change_active
)
1566 old
= sdata_dereference(link
->u
.ap
.beacon
, sdata
);
1570 err
= ieee80211_assign_beacon(sdata
, link
, beacon
, NULL
, NULL
,
1575 err
= ieee80211_set_fils_discovery(sdata
, ¶ms
->fils_discovery
,
1576 link
, link_conf
, &changed
);
1580 err
= ieee80211_set_unsol_bcast_probe_resp(sdata
,
1581 ¶ms
->unsol_bcast_probe_resp
,
1582 link
, link_conf
, &changed
);
1586 if (beacon
->he_bss_color_valid
&&
1587 beacon
->he_bss_color
.enabled
!= link_conf
->he_bss_color
.enabled
) {
1588 link_conf
->he_bss_color
.enabled
= beacon
->he_bss_color
.enabled
;
1589 changed
|= BSS_CHANGED_HE_BSS_COLOR
;
1592 ieee80211_link_info_change_notify(sdata
, link
, changed
);
1596 static void ieee80211_free_next_beacon(struct ieee80211_link_data
*link
)
1598 if (!link
->u
.ap
.next_beacon
)
1601 kfree(link
->u
.ap
.next_beacon
->mbssid_ies
);
1602 kfree(link
->u
.ap
.next_beacon
->rnr_ies
);
1603 kfree(link
->u
.ap
.next_beacon
);
1604 link
->u
.ap
.next_beacon
= NULL
;
1607 static int ieee80211_stop_ap(struct wiphy
*wiphy
, struct net_device
*dev
,
1608 unsigned int link_id
)
1610 struct ieee80211_sub_if_data
*sdata
= IEEE80211_DEV_TO_SUB_IF(dev
);
1611 struct ieee80211_sub_if_data
*vlan
;
1612 struct ieee80211_local
*local
= sdata
->local
;
1613 struct beacon_data
*old_beacon
;
1614 struct probe_resp
*old_probe_resp
;
1615 struct fils_discovery_data
*old_fils_discovery
;
1616 struct unsol_bcast_probe_resp_data
*old_unsol_bcast_probe_resp
;
1617 struct cfg80211_chan_def chandef
;
1618 struct ieee80211_link_data
*link
=
1619 sdata_dereference(sdata
->link
[link_id
], sdata
);
1620 struct ieee80211_bss_conf
*link_conf
= link
->conf
;
1623 lockdep_assert_wiphy(local
->hw
.wiphy
);
1625 old_beacon
= sdata_dereference(link
->u
.ap
.beacon
, sdata
);
1628 old_probe_resp
= sdata_dereference(link
->u
.ap
.probe_resp
,
1630 old_fils_discovery
= sdata_dereference(link
->u
.ap
.fils_discovery
,
1632 old_unsol_bcast_probe_resp
=
1633 sdata_dereference(link
->u
.ap
.unsol_bcast_probe_resp
,
1636 /* abort any running channel switch or color change */
1637 link_conf
->csa_active
= false;
1638 link_conf
->color_change_active
= false;
1639 ieee80211_vif_unblock_queues_csa(sdata
);
1641 ieee80211_free_next_beacon(link
);
1643 /* turn off carrier for this interface and dependent VLANs */
1644 list_for_each_entry(vlan
, &sdata
->u
.ap
.vlans
, u
.vlan
.list
)
1645 netif_carrier_off(vlan
->dev
);
1647 if (ieee80211_num_beaconing_links(sdata
) <= 1) {
1648 netif_carrier_off(dev
);
1649 sdata
->u
.ap
.active
= false;
1652 /* remove beacon and probe response */
1653 RCU_INIT_POINTER(link
->u
.ap
.beacon
, NULL
);
1654 RCU_INIT_POINTER(link
->u
.ap
.probe_resp
, NULL
);
1655 RCU_INIT_POINTER(link
->u
.ap
.fils_discovery
, NULL
);
1656 RCU_INIT_POINTER(link
->u
.ap
.unsol_bcast_probe_resp
, NULL
);
1657 kfree_rcu(old_beacon
, rcu_head
);
1659 kfree_rcu(old_probe_resp
, rcu_head
);
1660 if (old_fils_discovery
)
1661 kfree_rcu(old_fils_discovery
, rcu_head
);
1662 if (old_unsol_bcast_probe_resp
)
1663 kfree_rcu(old_unsol_bcast_probe_resp
, rcu_head
);
1665 kfree(link_conf
->ftmr_params
);
1666 link_conf
->ftmr_params
= NULL
;
1668 sdata
->vif
.mbssid_tx_vif
= NULL
;
1669 link_conf
->bssid_index
= 0;
1670 link_conf
->nontransmitted
= false;
1671 link_conf
->ema_ap
= false;
1672 link_conf
->bssid_indicator
= 0;
1674 __sta_info_flush(sdata
, true, link_id
);
1676 ieee80211_remove_link_keys(link
, &keys
);
1677 if (!list_empty(&keys
)) {
1679 ieee80211_free_key_list(local
, &keys
);
1682 link_conf
->enable_beacon
= false;
1683 sdata
->beacon_rate_set
= false;
1684 sdata
->vif
.cfg
.ssid_len
= 0;
1685 clear_bit(SDATA_STATE_OFFCHANNEL_BEACON_STOPPED
, &sdata
->state
);
1686 ieee80211_link_info_change_notify(sdata
, link
,
1687 BSS_CHANGED_BEACON_ENABLED
);
1689 if (sdata
->wdev
.links
[link_id
].cac_started
) {
1690 chandef
= link_conf
->chanreq
.oper
;
1691 wiphy_delayed_work_cancel(wiphy
, &link
->dfs_cac_timer_work
);
1692 cfg80211_cac_event(sdata
->dev
, &chandef
,
1693 NL80211_RADAR_CAC_ABORTED
,
1694 GFP_KERNEL
, link_id
);
1697 drv_stop_ap(sdata
->local
, sdata
, link_conf
);
1699 /* free all potentially still buffered bcast frames */
1700 local
->total_ps_buffered
-= skb_queue_len(&sdata
->u
.ap
.ps
.bc_buf
);
1701 ieee80211_purge_tx_queue(&local
->hw
, &sdata
->u
.ap
.ps
.bc_buf
);
1703 ieee80211_link_copy_chanctx_to_vlans(link
, true);
1704 ieee80211_link_release_channel(link
);
1709 static int sta_apply_auth_flags(struct ieee80211_local
*local
,
1710 struct sta_info
*sta
,
1715 if (mask
& BIT(NL80211_STA_FLAG_AUTHENTICATED
) &&
1716 set
& BIT(NL80211_STA_FLAG_AUTHENTICATED
) &&
1717 !test_sta_flag(sta
, WLAN_STA_AUTH
)) {
1718 ret
= sta_info_move_state(sta
, IEEE80211_STA_AUTH
);
1723 if (mask
& BIT(NL80211_STA_FLAG_ASSOCIATED
) &&
1724 set
& BIT(NL80211_STA_FLAG_ASSOCIATED
) &&
1725 !test_sta_flag(sta
, WLAN_STA_ASSOC
)) {
1727 * When peer becomes associated, init rate control as
1728 * well. Some drivers require rate control initialized
1729 * before drv_sta_state() is called.
1731 if (!test_sta_flag(sta
, WLAN_STA_RATE_CONTROL
))
1732 rate_control_rate_init_all_links(sta
);
1734 ret
= sta_info_move_state(sta
, IEEE80211_STA_ASSOC
);
1739 if (mask
& BIT(NL80211_STA_FLAG_AUTHORIZED
)) {
1740 if (set
& BIT(NL80211_STA_FLAG_AUTHORIZED
))
1741 ret
= sta_info_move_state(sta
, IEEE80211_STA_AUTHORIZED
);
1742 else if (test_sta_flag(sta
, WLAN_STA_AUTHORIZED
))
1743 ret
= sta_info_move_state(sta
, IEEE80211_STA_ASSOC
);
1750 if (mask
& BIT(NL80211_STA_FLAG_ASSOCIATED
) &&
1751 !(set
& BIT(NL80211_STA_FLAG_ASSOCIATED
)) &&
1752 test_sta_flag(sta
, WLAN_STA_ASSOC
)) {
1753 ret
= sta_info_move_state(sta
, IEEE80211_STA_AUTH
);
1758 if (mask
& BIT(NL80211_STA_FLAG_AUTHENTICATED
) &&
1759 !(set
& BIT(NL80211_STA_FLAG_AUTHENTICATED
)) &&
1760 test_sta_flag(sta
, WLAN_STA_AUTH
)) {
1761 ret
= sta_info_move_state(sta
, IEEE80211_STA_NONE
);
1769 static void sta_apply_mesh_params(struct ieee80211_local
*local
,
1770 struct sta_info
*sta
,
1771 struct station_parameters
*params
)
1773 #ifdef CONFIG_MAC80211_MESH
1774 struct ieee80211_sub_if_data
*sdata
= sta
->sdata
;
1777 if (params
->sta_modify_mask
& STATION_PARAM_APPLY_PLINK_STATE
) {
1778 switch (params
->plink_state
) {
1779 case NL80211_PLINK_ESTAB
:
1780 if (sta
->mesh
->plink_state
!= NL80211_PLINK_ESTAB
)
1781 changed
= mesh_plink_inc_estab_count(sdata
);
1782 sta
->mesh
->plink_state
= params
->plink_state
;
1783 sta
->mesh
->aid
= params
->peer_aid
;
1785 ieee80211_mps_sta_status_update(sta
);
1786 changed
|= ieee80211_mps_set_sta_local_pm(sta
,
1787 sdata
->u
.mesh
.mshcfg
.power_mode
);
1789 ewma_mesh_tx_rate_avg_init(&sta
->mesh
->tx_rate_avg
);
1790 /* init at low value */
1791 ewma_mesh_tx_rate_avg_add(&sta
->mesh
->tx_rate_avg
, 10);
1794 case NL80211_PLINK_LISTEN
:
1795 case NL80211_PLINK_BLOCKED
:
1796 case NL80211_PLINK_OPN_SNT
:
1797 case NL80211_PLINK_OPN_RCVD
:
1798 case NL80211_PLINK_CNF_RCVD
:
1799 case NL80211_PLINK_HOLDING
:
1800 if (sta
->mesh
->plink_state
== NL80211_PLINK_ESTAB
)
1801 changed
= mesh_plink_dec_estab_count(sdata
);
1802 sta
->mesh
->plink_state
= params
->plink_state
;
1804 ieee80211_mps_sta_status_update(sta
);
1805 changed
|= ieee80211_mps_set_sta_local_pm(sta
,
1806 NL80211_MESH_POWER_UNKNOWN
);
1814 switch (params
->plink_action
) {
1815 case NL80211_PLINK_ACTION_NO_ACTION
:
1818 case NL80211_PLINK_ACTION_OPEN
:
1819 changed
|= mesh_plink_open(sta
);
1821 case NL80211_PLINK_ACTION_BLOCK
:
1822 changed
|= mesh_plink_block(sta
);
1826 if (params
->local_pm
)
1827 changed
|= ieee80211_mps_set_sta_local_pm(sta
,
1830 ieee80211_mbss_info_change_notify(sdata
, changed
);
1834 enum sta_link_apply_mode
{
1836 STA_LINK_MODE_STA_MODIFY
,
1837 STA_LINK_MODE_LINK_MODIFY
,
1840 static int sta_link_apply_parameters(struct ieee80211_local
*local
,
1841 struct sta_info
*sta
,
1842 enum sta_link_apply_mode mode
,
1843 struct link_station_parameters
*params
)
1845 struct ieee80211_supported_band
*sband
;
1846 struct ieee80211_sub_if_data
*sdata
= sta
->sdata
;
1847 u32 link_id
= params
->link_id
< 0 ? 0 : params
->link_id
;
1848 struct ieee80211_link_data
*link
=
1849 sdata_dereference(sdata
->link
[link_id
], sdata
);
1850 struct link_sta_info
*link_sta
=
1851 rcu_dereference_protected(sta
->link
[link_id
],
1852 lockdep_is_held(&local
->hw
.wiphy
->mtx
));
1853 bool changes
= params
->link_mac
||
1854 params
->txpwr_set
||
1855 params
->supported_rates_len
||
1860 params
->opmode_notif_used
;
1863 case STA_LINK_MODE_NEW
:
1864 if (!params
->link_mac
)
1867 case STA_LINK_MODE_LINK_MODIFY
:
1869 case STA_LINK_MODE_STA_MODIFY
:
1870 if (params
->link_id
>= 0)
1877 if (!link
|| !link_sta
)
1880 sband
= ieee80211_get_link_sband(link
);
1884 if (params
->link_mac
) {
1885 if (mode
== STA_LINK_MODE_NEW
) {
1886 memcpy(link_sta
->addr
, params
->link_mac
, ETH_ALEN
);
1887 memcpy(link_sta
->pub
->addr
, params
->link_mac
, ETH_ALEN
);
1888 } else if (!ether_addr_equal(link_sta
->addr
,
1889 params
->link_mac
)) {
1894 if (params
->txpwr_set
) {
1897 link_sta
->pub
->txpwr
.type
= params
->txpwr
.type
;
1898 if (params
->txpwr
.type
== NL80211_TX_POWER_LIMITED
)
1899 link_sta
->pub
->txpwr
.power
= params
->txpwr
.power
;
1900 ret
= drv_sta_set_txpwr(local
, sdata
, sta
);
1905 if (params
->supported_rates
&&
1906 params
->supported_rates_len
) {
1907 ieee80211_parse_bitrates(link
->conf
->chanreq
.oper
.width
,
1908 sband
, params
->supported_rates
,
1909 params
->supported_rates_len
,
1910 &link_sta
->pub
->supp_rates
[sband
->band
]);
1913 if (params
->ht_capa
)
1914 ieee80211_ht_cap_ie_to_sta_ht_cap(sdata
, sband
,
1915 params
->ht_capa
, link_sta
);
1917 /* VHT can override some HT caps such as the A-MSDU max length */
1918 if (params
->vht_capa
)
1919 ieee80211_vht_cap_ie_to_sta_vht_cap(sdata
, sband
,
1920 params
->vht_capa
, NULL
,
1923 if (params
->he_capa
)
1924 ieee80211_he_cap_ie_to_sta_he_cap(sdata
, sband
,
1925 (void *)params
->he_capa
,
1926 params
->he_capa_len
,
1927 (void *)params
->he_6ghz_capa
,
1930 if (params
->he_capa
&& params
->eht_capa
)
1931 ieee80211_eht_cap_ie_to_sta_eht_cap(sdata
, sband
,
1932 (u8
*)params
->he_capa
,
1933 params
->he_capa_len
,
1935 params
->eht_capa_len
,
1938 if (params
->opmode_notif_used
) {
1939 /* returned value is only needed for rc update, but the
1940 * rc isn't initialized here yet, so ignore it
1942 __ieee80211_vht_handle_opmode(sdata
, link_sta
,
1943 params
->opmode_notif
,
1947 ieee80211_sta_init_nss(link_sta
);
1952 static int sta_apply_parameters(struct ieee80211_local
*local
,
1953 struct sta_info
*sta
,
1954 struct station_parameters
*params
)
1956 struct ieee80211_sub_if_data
*sdata
= sta
->sdata
;
1960 mask
= params
->sta_flags_mask
;
1961 set
= params
->sta_flags_set
;
1963 if (ieee80211_vif_is_mesh(&sdata
->vif
)) {
1965 * In mesh mode, ASSOCIATED isn't part of the nl80211
1966 * API but must follow AUTHENTICATED for driver state.
1968 if (mask
& BIT(NL80211_STA_FLAG_AUTHENTICATED
))
1969 mask
|= BIT(NL80211_STA_FLAG_ASSOCIATED
);
1970 if (set
& BIT(NL80211_STA_FLAG_AUTHENTICATED
))
1971 set
|= BIT(NL80211_STA_FLAG_ASSOCIATED
);
1972 } else if (test_sta_flag(sta
, WLAN_STA_TDLS_PEER
)) {
1974 * TDLS -- everything follows authorized, but
1975 * only becoming authorized is possible, not
1978 if (set
& BIT(NL80211_STA_FLAG_AUTHORIZED
)) {
1979 set
|= BIT(NL80211_STA_FLAG_AUTHENTICATED
) |
1980 BIT(NL80211_STA_FLAG_ASSOCIATED
);
1981 mask
|= BIT(NL80211_STA_FLAG_AUTHENTICATED
) |
1982 BIT(NL80211_STA_FLAG_ASSOCIATED
);
1986 if (mask
& BIT(NL80211_STA_FLAG_WME
) &&
1987 local
->hw
.queues
>= IEEE80211_NUM_ACS
)
1988 sta
->sta
.wme
= set
& BIT(NL80211_STA_FLAG_WME
);
1990 /* auth flags will be set later for TDLS,
1991 * and for unassociated stations that move to associated */
1992 if (!test_sta_flag(sta
, WLAN_STA_TDLS_PEER
) &&
1993 !((mask
& BIT(NL80211_STA_FLAG_ASSOCIATED
)) &&
1994 (set
& BIT(NL80211_STA_FLAG_ASSOCIATED
)))) {
1995 ret
= sta_apply_auth_flags(local
, sta
, mask
, set
);
2000 if (mask
& BIT(NL80211_STA_FLAG_SHORT_PREAMBLE
)) {
2001 if (set
& BIT(NL80211_STA_FLAG_SHORT_PREAMBLE
))
2002 set_sta_flag(sta
, WLAN_STA_SHORT_PREAMBLE
);
2004 clear_sta_flag(sta
, WLAN_STA_SHORT_PREAMBLE
);
2007 if (mask
& BIT(NL80211_STA_FLAG_MFP
)) {
2008 sta
->sta
.mfp
= !!(set
& BIT(NL80211_STA_FLAG_MFP
));
2009 if (set
& BIT(NL80211_STA_FLAG_MFP
))
2010 set_sta_flag(sta
, WLAN_STA_MFP
);
2012 clear_sta_flag(sta
, WLAN_STA_MFP
);
2015 if (mask
& BIT(NL80211_STA_FLAG_TDLS_PEER
)) {
2016 if (set
& BIT(NL80211_STA_FLAG_TDLS_PEER
))
2017 set_sta_flag(sta
, WLAN_STA_TDLS_PEER
);
2019 clear_sta_flag(sta
, WLAN_STA_TDLS_PEER
);
2022 if (mask
& BIT(NL80211_STA_FLAG_SPP_AMSDU
))
2023 sta
->sta
.spp_amsdu
= set
& BIT(NL80211_STA_FLAG_SPP_AMSDU
);
2025 /* mark TDLS channel switch support, if the AP allows it */
2026 if (test_sta_flag(sta
, WLAN_STA_TDLS_PEER
) &&
2027 !sdata
->deflink
.u
.mgd
.tdls_chan_switch_prohibited
&&
2028 params
->ext_capab_len
>= 4 &&
2029 params
->ext_capab
[3] & WLAN_EXT_CAPA4_TDLS_CHAN_SWITCH
)
2030 set_sta_flag(sta
, WLAN_STA_TDLS_CHAN_SWITCH
);
2032 if (test_sta_flag(sta
, WLAN_STA_TDLS_PEER
) &&
2033 !sdata
->u
.mgd
.tdls_wider_bw_prohibited
&&
2034 ieee80211_hw_check(&local
->hw
, TDLS_WIDER_BW
) &&
2035 params
->ext_capab_len
>= 8 &&
2036 params
->ext_capab
[7] & WLAN_EXT_CAPA8_TDLS_WIDE_BW_ENABLED
)
2037 set_sta_flag(sta
, WLAN_STA_TDLS_WIDER_BW
);
2039 if (params
->sta_modify_mask
& STATION_PARAM_APPLY_UAPSD
) {
2040 sta
->sta
.uapsd_queues
= params
->uapsd_queues
;
2041 sta
->sta
.max_sp
= params
->max_sp
;
2044 ieee80211_sta_set_max_amsdu_subframes(sta
, params
->ext_capab
,
2045 params
->ext_capab_len
);
2048 * cfg80211 validates this (1-2007) and allows setting the AID
2049 * only when creating a new station entry
2052 sta
->sta
.aid
= params
->aid
;
2055 * Some of the following updates would be racy if called on an
2056 * existing station, via ieee80211_change_station(). However,
2057 * all such changes are rejected by cfg80211 except for updates
2058 * changing the supported rates on an existing but not yet used
2062 if (params
->listen_interval
>= 0)
2063 sta
->listen_interval
= params
->listen_interval
;
2065 ret
= sta_link_apply_parameters(local
, sta
, STA_LINK_MODE_STA_MODIFY
,
2066 ¶ms
->link_sta_params
);
2070 if (params
->support_p2p_ps
>= 0)
2071 sta
->sta
.support_p2p_ps
= params
->support_p2p_ps
;
2073 if (ieee80211_vif_is_mesh(&sdata
->vif
))
2074 sta_apply_mesh_params(local
, sta
, params
);
2076 if (params
->airtime_weight
)
2077 sta
->airtime_weight
= params
->airtime_weight
;
2079 /* set the STA state after all sta info from usermode has been set */
2080 if (test_sta_flag(sta
, WLAN_STA_TDLS_PEER
) ||
2081 set
& BIT(NL80211_STA_FLAG_ASSOCIATED
)) {
2082 ret
= sta_apply_auth_flags(local
, sta
, mask
, set
);
2087 /* Mark the STA as MLO if MLD MAC address is available */
2088 if (params
->link_sta_params
.mld_mac
)
2089 sta
->sta
.mlo
= true;
2094 static int ieee80211_add_station(struct wiphy
*wiphy
, struct net_device
*dev
,
2096 struct station_parameters
*params
)
2098 struct ieee80211_local
*local
= wiphy_priv(wiphy
);
2099 struct sta_info
*sta
;
2100 struct ieee80211_sub_if_data
*sdata
;
2103 lockdep_assert_wiphy(local
->hw
.wiphy
);
2106 sdata
= IEEE80211_DEV_TO_SUB_IF(params
->vlan
);
2108 if (sdata
->vif
.type
!= NL80211_IFTYPE_AP_VLAN
&&
2109 sdata
->vif
.type
!= NL80211_IFTYPE_AP
)
2112 sdata
= IEEE80211_DEV_TO_SUB_IF(dev
);
2114 if (ether_addr_equal(mac
, sdata
->vif
.addr
))
2117 if (!is_valid_ether_addr(mac
))
2120 if (params
->sta_flags_set
& BIT(NL80211_STA_FLAG_TDLS_PEER
) &&
2121 sdata
->vif
.type
== NL80211_IFTYPE_STATION
&&
2122 !sdata
->u
.mgd
.associated
)
2126 * If we have a link ID, it can be a non-MLO station on an AP MLD,
2127 * but we need to have a link_mac in that case as well, so use the
2128 * STA's MAC address in that case.
2130 if (params
->link_sta_params
.link_id
>= 0)
2131 sta
= sta_info_alloc_with_link(sdata
, mac
,
2132 params
->link_sta_params
.link_id
,
2133 params
->link_sta_params
.link_mac
?: mac
,
2136 sta
= sta_info_alloc(sdata
, mac
, GFP_KERNEL
);
2141 if (params
->sta_flags_set
& BIT(NL80211_STA_FLAG_TDLS_PEER
))
2142 sta
->sta
.tdls
= true;
2144 /* Though the mutex is not needed here (since the station is not
2145 * visible yet), sta_apply_parameters (and inner functions) require
2146 * the mutex due to other paths.
2148 err
= sta_apply_parameters(local
, sta
, params
);
2150 sta_info_free(local
, sta
);
2155 * for TDLS and for unassociated station, rate control should be
2156 * initialized only when rates are known and station is marked
2157 * authorized/associated
2159 if (!test_sta_flag(sta
, WLAN_STA_TDLS_PEER
) &&
2160 test_sta_flag(sta
, WLAN_STA_ASSOC
))
2161 rate_control_rate_init_all_links(sta
);
2163 return sta_info_insert(sta
);
2166 static int ieee80211_del_station(struct wiphy
*wiphy
, struct net_device
*dev
,
2167 struct station_del_parameters
*params
)
2169 struct ieee80211_sub_if_data
*sdata
;
2171 sdata
= IEEE80211_DEV_TO_SUB_IF(dev
);
2174 return sta_info_destroy_addr_bss(sdata
, params
->mac
);
2176 sta_info_flush(sdata
, params
->link_id
);
2180 static int ieee80211_change_station(struct wiphy
*wiphy
,
2181 struct net_device
*dev
, const u8
*mac
,
2182 struct station_parameters
*params
)
2184 struct ieee80211_sub_if_data
*sdata
= IEEE80211_DEV_TO_SUB_IF(dev
);
2185 struct ieee80211_local
*local
= wiphy_priv(wiphy
);
2186 struct sta_info
*sta
;
2187 struct ieee80211_sub_if_data
*vlansdata
;
2188 enum cfg80211_station_type statype
;
2191 lockdep_assert_wiphy(local
->hw
.wiphy
);
2193 sta
= sta_info_get_bss(sdata
, mac
);
2197 switch (sdata
->vif
.type
) {
2198 case NL80211_IFTYPE_MESH_POINT
:
2199 if (sdata
->u
.mesh
.user_mpm
)
2200 statype
= CFG80211_STA_MESH_PEER_USER
;
2202 statype
= CFG80211_STA_MESH_PEER_KERNEL
;
2204 case NL80211_IFTYPE_ADHOC
:
2205 statype
= CFG80211_STA_IBSS
;
2207 case NL80211_IFTYPE_STATION
:
2208 if (!test_sta_flag(sta
, WLAN_STA_TDLS_PEER
)) {
2209 statype
= CFG80211_STA_AP_STA
;
2212 if (test_sta_flag(sta
, WLAN_STA_AUTHORIZED
))
2213 statype
= CFG80211_STA_TDLS_PEER_ACTIVE
;
2215 statype
= CFG80211_STA_TDLS_PEER_SETUP
;
2217 case NL80211_IFTYPE_AP
:
2218 case NL80211_IFTYPE_AP_VLAN
:
2219 if (test_sta_flag(sta
, WLAN_STA_ASSOC
))
2220 statype
= CFG80211_STA_AP_CLIENT
;
2222 statype
= CFG80211_STA_AP_CLIENT_UNASSOC
;
2228 err
= cfg80211_check_station_change(wiphy
, params
, statype
);
2232 if (params
->vlan
&& params
->vlan
!= sta
->sdata
->dev
) {
2233 vlansdata
= IEEE80211_DEV_TO_SUB_IF(params
->vlan
);
2235 if (params
->vlan
->ieee80211_ptr
->use_4addr
) {
2236 if (vlansdata
->u
.vlan
.sta
)
2239 rcu_assign_pointer(vlansdata
->u
.vlan
.sta
, sta
);
2240 __ieee80211_check_fast_rx_iface(vlansdata
);
2241 drv_sta_set_4addr(local
, sta
->sdata
, &sta
->sta
, true);
2244 if (sta
->sdata
->vif
.type
== NL80211_IFTYPE_AP_VLAN
&&
2245 sta
->sdata
->u
.vlan
.sta
)
2246 RCU_INIT_POINTER(sta
->sdata
->u
.vlan
.sta
, NULL
);
2248 if (test_sta_flag(sta
, WLAN_STA_AUTHORIZED
))
2249 ieee80211_vif_dec_num_mcast(sta
->sdata
);
2251 sta
->sdata
= vlansdata
;
2252 ieee80211_check_fast_rx(sta
);
2253 ieee80211_check_fast_xmit(sta
);
2255 if (test_sta_flag(sta
, WLAN_STA_AUTHORIZED
)) {
2256 ieee80211_vif_inc_num_mcast(sta
->sdata
);
2257 cfg80211_send_layer2_update(sta
->sdata
->dev
,
2262 err
= sta_apply_parameters(local
, sta
, params
);
2266 if (sdata
->vif
.type
== NL80211_IFTYPE_STATION
&&
2267 params
->sta_flags_mask
& BIT(NL80211_STA_FLAG_AUTHORIZED
)) {
2268 ieee80211_recalc_ps(local
);
2269 ieee80211_recalc_ps_vif(sdata
);
2275 #ifdef CONFIG_MAC80211_MESH
2276 static int ieee80211_add_mpath(struct wiphy
*wiphy
, struct net_device
*dev
,
2277 const u8
*dst
, const u8
*next_hop
)
2279 struct ieee80211_sub_if_data
*sdata
;
2280 struct mesh_path
*mpath
;
2281 struct sta_info
*sta
;
2283 sdata
= IEEE80211_DEV_TO_SUB_IF(dev
);
2286 sta
= sta_info_get(sdata
, next_hop
);
2292 mpath
= mesh_path_add(sdata
, dst
);
2293 if (IS_ERR(mpath
)) {
2295 return PTR_ERR(mpath
);
2298 mesh_path_fix_nexthop(mpath
, sta
);
2304 static int ieee80211_del_mpath(struct wiphy
*wiphy
, struct net_device
*dev
,
2307 struct ieee80211_sub_if_data
*sdata
= IEEE80211_DEV_TO_SUB_IF(dev
);
2310 return mesh_path_del(sdata
, dst
);
2312 mesh_path_flush_by_iface(sdata
);
2316 static int ieee80211_change_mpath(struct wiphy
*wiphy
, struct net_device
*dev
,
2317 const u8
*dst
, const u8
*next_hop
)
2319 struct ieee80211_sub_if_data
*sdata
;
2320 struct mesh_path
*mpath
;
2321 struct sta_info
*sta
;
2323 sdata
= IEEE80211_DEV_TO_SUB_IF(dev
);
2327 sta
= sta_info_get(sdata
, next_hop
);
2333 mpath
= mesh_path_lookup(sdata
, dst
);
2339 mesh_path_fix_nexthop(mpath
, sta
);
2345 static void mpath_set_pinfo(struct mesh_path
*mpath
, u8
*next_hop
,
2346 struct mpath_info
*pinfo
)
2348 struct sta_info
*next_hop_sta
= rcu_dereference(mpath
->next_hop
);
2351 memcpy(next_hop
, next_hop_sta
->sta
.addr
, ETH_ALEN
);
2353 eth_zero_addr(next_hop
);
2355 memset(pinfo
, 0, sizeof(*pinfo
));
2357 pinfo
->generation
= mpath
->sdata
->u
.mesh
.mesh_paths_generation
;
2359 pinfo
->filled
= MPATH_INFO_FRAME_QLEN
|
2362 MPATH_INFO_EXPTIME
|
2363 MPATH_INFO_DISCOVERY_TIMEOUT
|
2364 MPATH_INFO_DISCOVERY_RETRIES
|
2366 MPATH_INFO_HOP_COUNT
|
2367 MPATH_INFO_PATH_CHANGE
;
2369 pinfo
->frame_qlen
= mpath
->frame_queue
.qlen
;
2370 pinfo
->sn
= mpath
->sn
;
2371 pinfo
->metric
= mpath
->metric
;
2372 if (time_before(jiffies
, mpath
->exp_time
))
2373 pinfo
->exptime
= jiffies_to_msecs(mpath
->exp_time
- jiffies
);
2374 pinfo
->discovery_timeout
=
2375 jiffies_to_msecs(mpath
->discovery_timeout
);
2376 pinfo
->discovery_retries
= mpath
->discovery_retries
;
2377 if (mpath
->flags
& MESH_PATH_ACTIVE
)
2378 pinfo
->flags
|= NL80211_MPATH_FLAG_ACTIVE
;
2379 if (mpath
->flags
& MESH_PATH_RESOLVING
)
2380 pinfo
->flags
|= NL80211_MPATH_FLAG_RESOLVING
;
2381 if (mpath
->flags
& MESH_PATH_SN_VALID
)
2382 pinfo
->flags
|= NL80211_MPATH_FLAG_SN_VALID
;
2383 if (mpath
->flags
& MESH_PATH_FIXED
)
2384 pinfo
->flags
|= NL80211_MPATH_FLAG_FIXED
;
2385 if (mpath
->flags
& MESH_PATH_RESOLVED
)
2386 pinfo
->flags
|= NL80211_MPATH_FLAG_RESOLVED
;
2387 pinfo
->hop_count
= mpath
->hop_count
;
2388 pinfo
->path_change_count
= mpath
->path_change_count
;
2391 static int ieee80211_get_mpath(struct wiphy
*wiphy
, struct net_device
*dev
,
2392 u8
*dst
, u8
*next_hop
, struct mpath_info
*pinfo
)
2395 struct ieee80211_sub_if_data
*sdata
;
2396 struct mesh_path
*mpath
;
2398 sdata
= IEEE80211_DEV_TO_SUB_IF(dev
);
2401 mpath
= mesh_path_lookup(sdata
, dst
);
2406 memcpy(dst
, mpath
->dst
, ETH_ALEN
);
2407 mpath_set_pinfo(mpath
, next_hop
, pinfo
);
2412 static int ieee80211_dump_mpath(struct wiphy
*wiphy
, struct net_device
*dev
,
2413 int idx
, u8
*dst
, u8
*next_hop
,
2414 struct mpath_info
*pinfo
)
2416 struct ieee80211_sub_if_data
*sdata
;
2417 struct mesh_path
*mpath
;
2419 sdata
= IEEE80211_DEV_TO_SUB_IF(dev
);
2422 mpath
= mesh_path_lookup_by_idx(sdata
, idx
);
2427 memcpy(dst
, mpath
->dst
, ETH_ALEN
);
2428 mpath_set_pinfo(mpath
, next_hop
, pinfo
);
2433 static void mpp_set_pinfo(struct mesh_path
*mpath
, u8
*mpp
,
2434 struct mpath_info
*pinfo
)
2436 memset(pinfo
, 0, sizeof(*pinfo
));
2437 memcpy(mpp
, mpath
->mpp
, ETH_ALEN
);
2439 pinfo
->generation
= mpath
->sdata
->u
.mesh
.mpp_paths_generation
;
2442 static int ieee80211_get_mpp(struct wiphy
*wiphy
, struct net_device
*dev
,
2443 u8
*dst
, u8
*mpp
, struct mpath_info
*pinfo
)
2446 struct ieee80211_sub_if_data
*sdata
;
2447 struct mesh_path
*mpath
;
2449 sdata
= IEEE80211_DEV_TO_SUB_IF(dev
);
2452 mpath
= mpp_path_lookup(sdata
, dst
);
2457 memcpy(dst
, mpath
->dst
, ETH_ALEN
);
2458 mpp_set_pinfo(mpath
, mpp
, pinfo
);
2463 static int ieee80211_dump_mpp(struct wiphy
*wiphy
, struct net_device
*dev
,
2464 int idx
, u8
*dst
, u8
*mpp
,
2465 struct mpath_info
*pinfo
)
2467 struct ieee80211_sub_if_data
*sdata
;
2468 struct mesh_path
*mpath
;
2470 sdata
= IEEE80211_DEV_TO_SUB_IF(dev
);
2473 mpath
= mpp_path_lookup_by_idx(sdata
, idx
);
2478 memcpy(dst
, mpath
->dst
, ETH_ALEN
);
2479 mpp_set_pinfo(mpath
, mpp
, pinfo
);
2484 static int ieee80211_get_mesh_config(struct wiphy
*wiphy
,
2485 struct net_device
*dev
,
2486 struct mesh_config
*conf
)
2488 struct ieee80211_sub_if_data
*sdata
;
2489 sdata
= IEEE80211_DEV_TO_SUB_IF(dev
);
2491 memcpy(conf
, &(sdata
->u
.mesh
.mshcfg
), sizeof(struct mesh_config
));
2495 static inline bool _chg_mesh_attr(enum nl80211_meshconf_params parm
, u32 mask
)
2497 return (mask
>> (parm
-1)) & 0x1;
2500 static int copy_mesh_setup(struct ieee80211_if_mesh
*ifmsh
,
2501 const struct mesh_setup
*setup
)
2504 struct ieee80211_sub_if_data
*sdata
= container_of(ifmsh
,
2505 struct ieee80211_sub_if_data
, u
.mesh
);
2508 /* allocate information elements */
2511 if (setup
->ie_len
) {
2512 new_ie
= kmemdup(setup
->ie
, setup
->ie_len
,
2517 ifmsh
->ie_len
= setup
->ie_len
;
2520 /* now copy the rest of the setup parameters */
2521 ifmsh
->mesh_id_len
= setup
->mesh_id_len
;
2522 memcpy(ifmsh
->mesh_id
, setup
->mesh_id
, ifmsh
->mesh_id_len
);
2523 ifmsh
->mesh_sp_id
= setup
->sync_method
;
2524 ifmsh
->mesh_pp_id
= setup
->path_sel_proto
;
2525 ifmsh
->mesh_pm_id
= setup
->path_metric
;
2526 ifmsh
->user_mpm
= setup
->user_mpm
;
2527 ifmsh
->mesh_auth_id
= setup
->auth_id
;
2528 ifmsh
->security
= IEEE80211_MESH_SEC_NONE
;
2529 ifmsh
->userspace_handles_dfs
= setup
->userspace_handles_dfs
;
2530 if (setup
->is_authenticated
)
2531 ifmsh
->security
|= IEEE80211_MESH_SEC_AUTHED
;
2532 if (setup
->is_secure
)
2533 ifmsh
->security
|= IEEE80211_MESH_SEC_SECURED
;
2535 /* mcast rate setting in Mesh Node */
2536 memcpy(sdata
->vif
.bss_conf
.mcast_rate
, setup
->mcast_rate
,
2537 sizeof(setup
->mcast_rate
));
2538 sdata
->vif
.bss_conf
.basic_rates
= setup
->basic_rates
;
2540 sdata
->vif
.bss_conf
.beacon_int
= setup
->beacon_interval
;
2541 sdata
->vif
.bss_conf
.dtim_period
= setup
->dtim_period
;
2543 sdata
->beacon_rate_set
= false;
2544 if (wiphy_ext_feature_isset(sdata
->local
->hw
.wiphy
,
2545 NL80211_EXT_FEATURE_BEACON_RATE_LEGACY
)) {
2546 for (i
= 0; i
< NUM_NL80211_BANDS
; i
++) {
2547 sdata
->beacon_rateidx_mask
[i
] =
2548 setup
->beacon_rate
.control
[i
].legacy
;
2549 if (sdata
->beacon_rateidx_mask
[i
])
2550 sdata
->beacon_rate_set
= true;
2557 static int ieee80211_update_mesh_config(struct wiphy
*wiphy
,
2558 struct net_device
*dev
, u32 mask
,
2559 const struct mesh_config
*nconf
)
2561 struct mesh_config
*conf
;
2562 struct ieee80211_sub_if_data
*sdata
;
2563 struct ieee80211_if_mesh
*ifmsh
;
2565 sdata
= IEEE80211_DEV_TO_SUB_IF(dev
);
2566 ifmsh
= &sdata
->u
.mesh
;
2568 /* Set the config options which we are interested in setting */
2569 conf
= &(sdata
->u
.mesh
.mshcfg
);
2570 if (_chg_mesh_attr(NL80211_MESHCONF_RETRY_TIMEOUT
, mask
))
2571 conf
->dot11MeshRetryTimeout
= nconf
->dot11MeshRetryTimeout
;
2572 if (_chg_mesh_attr(NL80211_MESHCONF_CONFIRM_TIMEOUT
, mask
))
2573 conf
->dot11MeshConfirmTimeout
= nconf
->dot11MeshConfirmTimeout
;
2574 if (_chg_mesh_attr(NL80211_MESHCONF_HOLDING_TIMEOUT
, mask
))
2575 conf
->dot11MeshHoldingTimeout
= nconf
->dot11MeshHoldingTimeout
;
2576 if (_chg_mesh_attr(NL80211_MESHCONF_MAX_PEER_LINKS
, mask
))
2577 conf
->dot11MeshMaxPeerLinks
= nconf
->dot11MeshMaxPeerLinks
;
2578 if (_chg_mesh_attr(NL80211_MESHCONF_MAX_RETRIES
, mask
))
2579 conf
->dot11MeshMaxRetries
= nconf
->dot11MeshMaxRetries
;
2580 if (_chg_mesh_attr(NL80211_MESHCONF_TTL
, mask
))
2581 conf
->dot11MeshTTL
= nconf
->dot11MeshTTL
;
2582 if (_chg_mesh_attr(NL80211_MESHCONF_ELEMENT_TTL
, mask
))
2583 conf
->element_ttl
= nconf
->element_ttl
;
2584 if (_chg_mesh_attr(NL80211_MESHCONF_AUTO_OPEN_PLINKS
, mask
)) {
2585 if (ifmsh
->user_mpm
)
2587 conf
->auto_open_plinks
= nconf
->auto_open_plinks
;
2589 if (_chg_mesh_attr(NL80211_MESHCONF_SYNC_OFFSET_MAX_NEIGHBOR
, mask
))
2590 conf
->dot11MeshNbrOffsetMaxNeighbor
=
2591 nconf
->dot11MeshNbrOffsetMaxNeighbor
;
2592 if (_chg_mesh_attr(NL80211_MESHCONF_HWMP_MAX_PREQ_RETRIES
, mask
))
2593 conf
->dot11MeshHWMPmaxPREQretries
=
2594 nconf
->dot11MeshHWMPmaxPREQretries
;
2595 if (_chg_mesh_attr(NL80211_MESHCONF_PATH_REFRESH_TIME
, mask
))
2596 conf
->path_refresh_time
= nconf
->path_refresh_time
;
2597 if (_chg_mesh_attr(NL80211_MESHCONF_MIN_DISCOVERY_TIMEOUT
, mask
))
2598 conf
->min_discovery_timeout
= nconf
->min_discovery_timeout
;
2599 if (_chg_mesh_attr(NL80211_MESHCONF_HWMP_ACTIVE_PATH_TIMEOUT
, mask
))
2600 conf
->dot11MeshHWMPactivePathTimeout
=
2601 nconf
->dot11MeshHWMPactivePathTimeout
;
2602 if (_chg_mesh_attr(NL80211_MESHCONF_HWMP_PREQ_MIN_INTERVAL
, mask
))
2603 conf
->dot11MeshHWMPpreqMinInterval
=
2604 nconf
->dot11MeshHWMPpreqMinInterval
;
2605 if (_chg_mesh_attr(NL80211_MESHCONF_HWMP_PERR_MIN_INTERVAL
, mask
))
2606 conf
->dot11MeshHWMPperrMinInterval
=
2607 nconf
->dot11MeshHWMPperrMinInterval
;
2608 if (_chg_mesh_attr(NL80211_MESHCONF_HWMP_NET_DIAM_TRVS_TIME
,
2610 conf
->dot11MeshHWMPnetDiameterTraversalTime
=
2611 nconf
->dot11MeshHWMPnetDiameterTraversalTime
;
2612 if (_chg_mesh_attr(NL80211_MESHCONF_HWMP_ROOTMODE
, mask
)) {
2613 conf
->dot11MeshHWMPRootMode
= nconf
->dot11MeshHWMPRootMode
;
2614 ieee80211_mesh_root_setup(ifmsh
);
2616 if (_chg_mesh_attr(NL80211_MESHCONF_GATE_ANNOUNCEMENTS
, mask
)) {
2617 /* our current gate announcement implementation rides on root
2618 * announcements, so require this ifmsh to also be a root node
2620 if (nconf
->dot11MeshGateAnnouncementProtocol
&&
2621 !(conf
->dot11MeshHWMPRootMode
> IEEE80211_ROOTMODE_ROOT
)) {
2622 conf
->dot11MeshHWMPRootMode
= IEEE80211_PROACTIVE_RANN
;
2623 ieee80211_mesh_root_setup(ifmsh
);
2625 conf
->dot11MeshGateAnnouncementProtocol
=
2626 nconf
->dot11MeshGateAnnouncementProtocol
;
2628 if (_chg_mesh_attr(NL80211_MESHCONF_HWMP_RANN_INTERVAL
, mask
))
2629 conf
->dot11MeshHWMPRannInterval
=
2630 nconf
->dot11MeshHWMPRannInterval
;
2631 if (_chg_mesh_attr(NL80211_MESHCONF_FORWARDING
, mask
))
2632 conf
->dot11MeshForwarding
= nconf
->dot11MeshForwarding
;
2633 if (_chg_mesh_attr(NL80211_MESHCONF_RSSI_THRESHOLD
, mask
)) {
2634 /* our RSSI threshold implementation is supported only for
2635 * devices that report signal in dBm.
2637 if (!ieee80211_hw_check(&sdata
->local
->hw
, SIGNAL_DBM
))
2639 conf
->rssi_threshold
= nconf
->rssi_threshold
;
2641 if (_chg_mesh_attr(NL80211_MESHCONF_HT_OPMODE
, mask
)) {
2642 conf
->ht_opmode
= nconf
->ht_opmode
;
2643 sdata
->vif
.bss_conf
.ht_operation_mode
= nconf
->ht_opmode
;
2644 ieee80211_link_info_change_notify(sdata
, &sdata
->deflink
,
2647 if (_chg_mesh_attr(NL80211_MESHCONF_HWMP_PATH_TO_ROOT_TIMEOUT
, mask
))
2648 conf
->dot11MeshHWMPactivePathToRootTimeout
=
2649 nconf
->dot11MeshHWMPactivePathToRootTimeout
;
2650 if (_chg_mesh_attr(NL80211_MESHCONF_HWMP_ROOT_INTERVAL
, mask
))
2651 conf
->dot11MeshHWMProotInterval
=
2652 nconf
->dot11MeshHWMProotInterval
;
2653 if (_chg_mesh_attr(NL80211_MESHCONF_HWMP_CONFIRMATION_INTERVAL
, mask
))
2654 conf
->dot11MeshHWMPconfirmationInterval
=
2655 nconf
->dot11MeshHWMPconfirmationInterval
;
2656 if (_chg_mesh_attr(NL80211_MESHCONF_POWER_MODE
, mask
)) {
2657 conf
->power_mode
= nconf
->power_mode
;
2658 ieee80211_mps_local_status_update(sdata
);
2660 if (_chg_mesh_attr(NL80211_MESHCONF_AWAKE_WINDOW
, mask
))
2661 conf
->dot11MeshAwakeWindowDuration
=
2662 nconf
->dot11MeshAwakeWindowDuration
;
2663 if (_chg_mesh_attr(NL80211_MESHCONF_PLINK_TIMEOUT
, mask
))
2664 conf
->plink_timeout
= nconf
->plink_timeout
;
2665 if (_chg_mesh_attr(NL80211_MESHCONF_CONNECTED_TO_GATE
, mask
))
2666 conf
->dot11MeshConnectedToMeshGate
=
2667 nconf
->dot11MeshConnectedToMeshGate
;
2668 if (_chg_mesh_attr(NL80211_MESHCONF_NOLEARN
, mask
))
2669 conf
->dot11MeshNolearn
= nconf
->dot11MeshNolearn
;
2670 if (_chg_mesh_attr(NL80211_MESHCONF_CONNECTED_TO_AS
, mask
))
2671 conf
->dot11MeshConnectedToAuthServer
=
2672 nconf
->dot11MeshConnectedToAuthServer
;
2673 ieee80211_mbss_info_change_notify(sdata
, BSS_CHANGED_BEACON
);
2677 static int ieee80211_join_mesh(struct wiphy
*wiphy
, struct net_device
*dev
,
2678 const struct mesh_config
*conf
,
2679 const struct mesh_setup
*setup
)
2681 struct ieee80211_sub_if_data
*sdata
= IEEE80211_DEV_TO_SUB_IF(dev
);
2682 struct ieee80211_chan_req chanreq
= { .oper
= setup
->chandef
};
2683 struct ieee80211_if_mesh
*ifmsh
= &sdata
->u
.mesh
;
2686 lockdep_assert_wiphy(sdata
->local
->hw
.wiphy
);
2688 memcpy(&ifmsh
->mshcfg
, conf
, sizeof(struct mesh_config
));
2689 err
= copy_mesh_setup(ifmsh
, setup
);
2693 sdata
->control_port_over_nl80211
= setup
->control_port_over_nl80211
;
2695 /* can mesh use other SMPS modes? */
2696 sdata
->deflink
.smps_mode
= IEEE80211_SMPS_OFF
;
2697 sdata
->deflink
.needed_rx_chains
= sdata
->local
->rx_chains
;
2699 err
= ieee80211_link_use_channel(&sdata
->deflink
, &chanreq
,
2700 IEEE80211_CHANCTX_SHARED
);
2704 return ieee80211_start_mesh(sdata
);
2707 static int ieee80211_leave_mesh(struct wiphy
*wiphy
, struct net_device
*dev
)
2709 struct ieee80211_sub_if_data
*sdata
= IEEE80211_DEV_TO_SUB_IF(dev
);
2711 lockdep_assert_wiphy(sdata
->local
->hw
.wiphy
);
2713 ieee80211_stop_mesh(sdata
);
2714 ieee80211_link_release_channel(&sdata
->deflink
);
2715 kfree(sdata
->u
.mesh
.ie
);
2721 static int ieee80211_change_bss(struct wiphy
*wiphy
,
2722 struct net_device
*dev
,
2723 struct bss_parameters
*params
)
2725 struct ieee80211_sub_if_data
*sdata
= IEEE80211_DEV_TO_SUB_IF(dev
);
2726 struct ieee80211_link_data
*link
;
2727 struct ieee80211_supported_band
*sband
;
2730 link
= ieee80211_link_or_deflink(sdata
, params
->link_id
, true);
2732 return PTR_ERR(link
);
2734 if (!sdata_dereference(link
->u
.ap
.beacon
, sdata
))
2737 sband
= ieee80211_get_link_sband(link
);
2741 if (params
->basic_rates
) {
2742 if (!ieee80211_parse_bitrates(link
->conf
->chanreq
.oper
.width
,
2743 wiphy
->bands
[sband
->band
],
2744 params
->basic_rates
,
2745 params
->basic_rates_len
,
2746 &link
->conf
->basic_rates
))
2748 changed
|= BSS_CHANGED_BASIC_RATES
;
2749 ieee80211_check_rate_mask(link
);
2752 if (params
->use_cts_prot
>= 0) {
2753 link
->conf
->use_cts_prot
= params
->use_cts_prot
;
2754 changed
|= BSS_CHANGED_ERP_CTS_PROT
;
2756 if (params
->use_short_preamble
>= 0) {
2757 link
->conf
->use_short_preamble
= params
->use_short_preamble
;
2758 changed
|= BSS_CHANGED_ERP_PREAMBLE
;
2761 if (!link
->conf
->use_short_slot
&&
2762 (sband
->band
== NL80211_BAND_5GHZ
||
2763 sband
->band
== NL80211_BAND_6GHZ
)) {
2764 link
->conf
->use_short_slot
= true;
2765 changed
|= BSS_CHANGED_ERP_SLOT
;
2768 if (params
->use_short_slot_time
>= 0) {
2769 link
->conf
->use_short_slot
= params
->use_short_slot_time
;
2770 changed
|= BSS_CHANGED_ERP_SLOT
;
2773 if (params
->ap_isolate
>= 0) {
2774 if (params
->ap_isolate
)
2775 sdata
->flags
|= IEEE80211_SDATA_DONT_BRIDGE_PACKETS
;
2777 sdata
->flags
&= ~IEEE80211_SDATA_DONT_BRIDGE_PACKETS
;
2778 ieee80211_check_fast_rx_iface(sdata
);
2781 if (params
->ht_opmode
>= 0) {
2782 link
->conf
->ht_operation_mode
= (u16
)params
->ht_opmode
;
2783 changed
|= BSS_CHANGED_HT
;
2786 if (params
->p2p_ctwindow
>= 0) {
2787 link
->conf
->p2p_noa_attr
.oppps_ctwindow
&=
2788 ~IEEE80211_P2P_OPPPS_CTWINDOW_MASK
;
2789 link
->conf
->p2p_noa_attr
.oppps_ctwindow
|=
2790 params
->p2p_ctwindow
& IEEE80211_P2P_OPPPS_CTWINDOW_MASK
;
2791 changed
|= BSS_CHANGED_P2P_PS
;
2794 if (params
->p2p_opp_ps
> 0) {
2795 link
->conf
->p2p_noa_attr
.oppps_ctwindow
|=
2796 IEEE80211_P2P_OPPPS_ENABLE_BIT
;
2797 changed
|= BSS_CHANGED_P2P_PS
;
2798 } else if (params
->p2p_opp_ps
== 0) {
2799 link
->conf
->p2p_noa_attr
.oppps_ctwindow
&=
2800 ~IEEE80211_P2P_OPPPS_ENABLE_BIT
;
2801 changed
|= BSS_CHANGED_P2P_PS
;
2804 ieee80211_link_info_change_notify(sdata
, link
, changed
);
2809 static int ieee80211_set_txq_params(struct wiphy
*wiphy
,
2810 struct net_device
*dev
,
2811 struct ieee80211_txq_params
*params
)
2813 struct ieee80211_local
*local
= wiphy_priv(wiphy
);
2814 struct ieee80211_sub_if_data
*sdata
= IEEE80211_DEV_TO_SUB_IF(dev
);
2815 struct ieee80211_link_data
*link
=
2816 ieee80211_link_or_deflink(sdata
, params
->link_id
, true);
2817 struct ieee80211_tx_queue_params p
;
2819 if (!local
->ops
->conf_tx
)
2822 if (local
->hw
.queues
< IEEE80211_NUM_ACS
)
2826 return PTR_ERR(link
);
2828 memset(&p
, 0, sizeof(p
));
2829 p
.aifs
= params
->aifs
;
2830 p
.cw_max
= params
->cwmax
;
2831 p
.cw_min
= params
->cwmin
;
2832 p
.txop
= params
->txop
;
2835 * Setting tx queue params disables u-apsd because it's only
2836 * called in master mode.
2840 ieee80211_regulatory_limit_wmm_params(sdata
, &p
, params
->ac
);
2842 link
->tx_conf
[params
->ac
] = p
;
2843 if (drv_conf_tx(local
, link
, params
->ac
, &p
)) {
2844 wiphy_debug(local
->hw
.wiphy
,
2845 "failed to set TX queue parameters for AC %d\n",
2850 ieee80211_link_info_change_notify(sdata
, link
,
2857 static int ieee80211_suspend(struct wiphy
*wiphy
,
2858 struct cfg80211_wowlan
*wowlan
)
2860 return __ieee80211_suspend(wiphy_priv(wiphy
), wowlan
);
2863 static int ieee80211_resume(struct wiphy
*wiphy
)
2865 return __ieee80211_resume(wiphy_priv(wiphy
));
2868 #define ieee80211_suspend NULL
2869 #define ieee80211_resume NULL
2872 static int ieee80211_scan(struct wiphy
*wiphy
,
2873 struct cfg80211_scan_request
*req
)
2875 struct ieee80211_sub_if_data
*sdata
;
2877 sdata
= IEEE80211_WDEV_TO_SUB_IF(req
->wdev
);
2879 switch (ieee80211_vif_type_p2p(&sdata
->vif
)) {
2880 case NL80211_IFTYPE_STATION
:
2881 case NL80211_IFTYPE_ADHOC
:
2882 case NL80211_IFTYPE_MESH_POINT
:
2883 case NL80211_IFTYPE_P2P_CLIENT
:
2884 case NL80211_IFTYPE_P2P_DEVICE
:
2886 case NL80211_IFTYPE_P2P_GO
:
2887 if (sdata
->local
->ops
->hw_scan
)
2890 * FIXME: implement NoA while scanning in software,
2891 * for now fall through to allow scanning only when
2892 * beaconing hasn't been configured yet
2895 case NL80211_IFTYPE_AP
:
2897 * If the scan has been forced (and the driver supports
2898 * forcing), don't care about being beaconing already.
2899 * This will create problems to the attached stations (e.g. all
2900 * the frames sent while scanning on other channel will be
2903 if (sdata
->deflink
.u
.ap
.beacon
&&
2904 (!(wiphy
->features
& NL80211_FEATURE_AP_SCAN
) ||
2905 !(req
->flags
& NL80211_SCAN_FLAG_AP
)))
2908 case NL80211_IFTYPE_NAN
:
2913 return ieee80211_request_scan(sdata
, req
);
2916 static void ieee80211_abort_scan(struct wiphy
*wiphy
, struct wireless_dev
*wdev
)
2918 ieee80211_scan_cancel(wiphy_priv(wiphy
));
2922 ieee80211_sched_scan_start(struct wiphy
*wiphy
,
2923 struct net_device
*dev
,
2924 struct cfg80211_sched_scan_request
*req
)
2926 struct ieee80211_sub_if_data
*sdata
= IEEE80211_DEV_TO_SUB_IF(dev
);
2928 if (!sdata
->local
->ops
->sched_scan_start
)
2931 return ieee80211_request_sched_scan_start(sdata
, req
);
2935 ieee80211_sched_scan_stop(struct wiphy
*wiphy
, struct net_device
*dev
,
2938 struct ieee80211_local
*local
= wiphy_priv(wiphy
);
2940 if (!local
->ops
->sched_scan_stop
)
2943 return ieee80211_request_sched_scan_stop(local
);
2946 static int ieee80211_auth(struct wiphy
*wiphy
, struct net_device
*dev
,
2947 struct cfg80211_auth_request
*req
)
2949 return ieee80211_mgd_auth(IEEE80211_DEV_TO_SUB_IF(dev
), req
);
2952 static int ieee80211_assoc(struct wiphy
*wiphy
, struct net_device
*dev
,
2953 struct cfg80211_assoc_request
*req
)
2955 return ieee80211_mgd_assoc(IEEE80211_DEV_TO_SUB_IF(dev
), req
);
2958 static int ieee80211_deauth(struct wiphy
*wiphy
, struct net_device
*dev
,
2959 struct cfg80211_deauth_request
*req
)
2961 return ieee80211_mgd_deauth(IEEE80211_DEV_TO_SUB_IF(dev
), req
);
2964 static int ieee80211_disassoc(struct wiphy
*wiphy
, struct net_device
*dev
,
2965 struct cfg80211_disassoc_request
*req
)
2967 return ieee80211_mgd_disassoc(IEEE80211_DEV_TO_SUB_IF(dev
), req
);
2970 static int ieee80211_join_ibss(struct wiphy
*wiphy
, struct net_device
*dev
,
2971 struct cfg80211_ibss_params
*params
)
2973 return ieee80211_ibss_join(IEEE80211_DEV_TO_SUB_IF(dev
), params
);
2976 static int ieee80211_leave_ibss(struct wiphy
*wiphy
, struct net_device
*dev
)
2978 return ieee80211_ibss_leave(IEEE80211_DEV_TO_SUB_IF(dev
));
2981 static int ieee80211_join_ocb(struct wiphy
*wiphy
, struct net_device
*dev
,
2982 struct ocb_setup
*setup
)
2984 return ieee80211_ocb_join(IEEE80211_DEV_TO_SUB_IF(dev
), setup
);
2987 static int ieee80211_leave_ocb(struct wiphy
*wiphy
, struct net_device
*dev
)
2989 return ieee80211_ocb_leave(IEEE80211_DEV_TO_SUB_IF(dev
));
2992 static int ieee80211_set_mcast_rate(struct wiphy
*wiphy
, struct net_device
*dev
,
2993 int rate
[NUM_NL80211_BANDS
])
2995 struct ieee80211_sub_if_data
*sdata
= IEEE80211_DEV_TO_SUB_IF(dev
);
2997 memcpy(sdata
->vif
.bss_conf
.mcast_rate
, rate
,
2998 sizeof(int) * NUM_NL80211_BANDS
);
3000 if (ieee80211_sdata_running(sdata
))
3001 ieee80211_link_info_change_notify(sdata
, &sdata
->deflink
,
3002 BSS_CHANGED_MCAST_RATE
);
3007 static int ieee80211_set_wiphy_params(struct wiphy
*wiphy
, u32 changed
)
3009 struct ieee80211_local
*local
= wiphy_priv(wiphy
);
3012 if (changed
& WIPHY_PARAM_FRAG_THRESHOLD
) {
3013 ieee80211_check_fast_xmit_all(local
);
3015 err
= drv_set_frag_threshold(local
, wiphy
->frag_threshold
);
3018 ieee80211_check_fast_xmit_all(local
);
3023 if ((changed
& WIPHY_PARAM_COVERAGE_CLASS
) ||
3024 (changed
& WIPHY_PARAM_DYN_ACK
)) {
3027 coverage_class
= changed
& WIPHY_PARAM_COVERAGE_CLASS
?
3028 wiphy
->coverage_class
: -1;
3029 err
= drv_set_coverage_class(local
, coverage_class
);
3035 if (changed
& WIPHY_PARAM_RTS_THRESHOLD
) {
3036 err
= drv_set_rts_threshold(local
, wiphy
->rts_threshold
);
3042 if (changed
& WIPHY_PARAM_RETRY_SHORT
) {
3043 if (wiphy
->retry_short
> IEEE80211_MAX_TX_RETRY
)
3045 local
->hw
.conf
.short_frame_max_tx_count
= wiphy
->retry_short
;
3047 if (changed
& WIPHY_PARAM_RETRY_LONG
) {
3048 if (wiphy
->retry_long
> IEEE80211_MAX_TX_RETRY
)
3050 local
->hw
.conf
.long_frame_max_tx_count
= wiphy
->retry_long
;
3053 (WIPHY_PARAM_RETRY_SHORT
| WIPHY_PARAM_RETRY_LONG
))
3054 ieee80211_hw_config(local
, IEEE80211_CONF_CHANGE_RETRY_LIMITS
);
3056 if (changed
& (WIPHY_PARAM_TXQ_LIMIT
|
3057 WIPHY_PARAM_TXQ_MEMORY_LIMIT
|
3058 WIPHY_PARAM_TXQ_QUANTUM
))
3059 ieee80211_txq_set_params(local
);
3064 static int ieee80211_set_tx_power(struct wiphy
*wiphy
,
3065 struct wireless_dev
*wdev
,
3066 enum nl80211_tx_power_setting type
, int mbm
)
3068 struct ieee80211_local
*local
= wiphy_priv(wiphy
);
3069 struct ieee80211_sub_if_data
*sdata
;
3070 enum nl80211_tx_power_setting txp_type
= type
;
3071 bool update_txp_type
= false;
3072 bool has_monitor
= false;
3073 int user_power_level
;
3074 int old_power
= local
->user_power_level
;
3076 lockdep_assert_wiphy(local
->hw
.wiphy
);
3079 case NL80211_TX_POWER_AUTOMATIC
:
3080 user_power_level
= IEEE80211_UNSET_POWER_LEVEL
;
3081 txp_type
= NL80211_TX_POWER_LIMITED
;
3083 case NL80211_TX_POWER_LIMITED
:
3084 case NL80211_TX_POWER_FIXED
:
3085 if (mbm
< 0 || (mbm
% 100))
3087 user_power_level
= MBM_TO_DBM(mbm
);
3094 sdata
= IEEE80211_WDEV_TO_SUB_IF(wdev
);
3096 if (sdata
->vif
.type
== NL80211_IFTYPE_MONITOR
&&
3097 !ieee80211_hw_check(&local
->hw
, NO_VIRTUAL_MONITOR
)) {
3098 if (!ieee80211_hw_check(&local
->hw
, WANT_MONITOR_VIF
))
3101 sdata
= wiphy_dereference(local
->hw
.wiphy
,
3102 local
->monitor_sdata
);
3107 for (int link_id
= 0;
3108 link_id
< ARRAY_SIZE(sdata
->link
);
3110 struct ieee80211_link_data
*link
=
3111 wiphy_dereference(wiphy
, sdata
->link
[link_id
]);
3116 link
->user_power_level
= user_power_level
;
3118 if (txp_type
!= link
->conf
->txpower_type
) {
3119 update_txp_type
= true;
3120 link
->conf
->txpower_type
= txp_type
;
3123 ieee80211_recalc_txpower(link
, update_txp_type
);
3128 local
->user_power_level
= user_power_level
;
3130 list_for_each_entry(sdata
, &local
->interfaces
, list
) {
3131 if (sdata
->vif
.type
== NL80211_IFTYPE_MONITOR
&&
3132 !ieee80211_hw_check(&local
->hw
, NO_VIRTUAL_MONITOR
)) {
3137 for (int link_id
= 0;
3138 link_id
< ARRAY_SIZE(sdata
->link
);
3140 struct ieee80211_link_data
*link
=
3141 wiphy_dereference(wiphy
, sdata
->link
[link_id
]);
3146 link
->user_power_level
= local
->user_power_level
;
3147 if (txp_type
!= link
->conf
->txpower_type
)
3148 update_txp_type
= true;
3149 link
->conf
->txpower_type
= txp_type
;
3152 list_for_each_entry(sdata
, &local
->interfaces
, list
) {
3153 if (sdata
->vif
.type
== NL80211_IFTYPE_MONITOR
&&
3154 !ieee80211_hw_check(&local
->hw
, NO_VIRTUAL_MONITOR
))
3157 for (int link_id
= 0;
3158 link_id
< ARRAY_SIZE(sdata
->link
);
3160 struct ieee80211_link_data
*link
=
3161 wiphy_dereference(wiphy
, sdata
->link
[link_id
]);
3166 ieee80211_recalc_txpower(link
, update_txp_type
);
3171 sdata
= wiphy_dereference(local
->hw
.wiphy
,
3172 local
->monitor_sdata
);
3173 if (sdata
&& ieee80211_hw_check(&local
->hw
, WANT_MONITOR_VIF
)) {
3174 sdata
->deflink
.user_power_level
= local
->user_power_level
;
3175 if (txp_type
!= sdata
->vif
.bss_conf
.txpower_type
)
3176 update_txp_type
= true;
3177 sdata
->vif
.bss_conf
.txpower_type
= txp_type
;
3179 ieee80211_recalc_txpower(&sdata
->deflink
,
3184 if (local
->emulate_chanctx
&&
3185 (old_power
!= local
->user_power_level
))
3186 ieee80211_hw_conf_chan(local
);
3191 static int ieee80211_get_tx_power(struct wiphy
*wiphy
,
3192 struct wireless_dev
*wdev
,
3195 struct ieee80211_local
*local
= wiphy_priv(wiphy
);
3196 struct ieee80211_sub_if_data
*sdata
= IEEE80211_WDEV_TO_SUB_IF(wdev
);
3198 if (local
->ops
->get_txpower
&&
3199 (sdata
->flags
& IEEE80211_SDATA_IN_DRIVER
))
3200 return drv_get_txpower(local
, sdata
, dbm
);
3202 if (local
->emulate_chanctx
)
3203 *dbm
= local
->hw
.conf
.power_level
;
3205 *dbm
= sdata
->vif
.bss_conf
.txpower
;
3207 /* INT_MIN indicates no power level was set yet */
3208 if (*dbm
== INT_MIN
)
3214 static void ieee80211_rfkill_poll(struct wiphy
*wiphy
)
3216 struct ieee80211_local
*local
= wiphy_priv(wiphy
);
3218 drv_rfkill_poll(local
);
3221 #ifdef CONFIG_NL80211_TESTMODE
3222 static int ieee80211_testmode_cmd(struct wiphy
*wiphy
,
3223 struct wireless_dev
*wdev
,
3224 void *data
, int len
)
3226 struct ieee80211_local
*local
= wiphy_priv(wiphy
);
3227 struct ieee80211_vif
*vif
= NULL
;
3229 if (!local
->ops
->testmode_cmd
)
3233 struct ieee80211_sub_if_data
*sdata
;
3235 sdata
= IEEE80211_WDEV_TO_SUB_IF(wdev
);
3236 if (sdata
->flags
& IEEE80211_SDATA_IN_DRIVER
)
3240 return local
->ops
->testmode_cmd(&local
->hw
, vif
, data
, len
);
3243 static int ieee80211_testmode_dump(struct wiphy
*wiphy
,
3244 struct sk_buff
*skb
,
3245 struct netlink_callback
*cb
,
3246 void *data
, int len
)
3248 struct ieee80211_local
*local
= wiphy_priv(wiphy
);
3250 if (!local
->ops
->testmode_dump
)
3253 return local
->ops
->testmode_dump(&local
->hw
, skb
, cb
, data
, len
);
3257 int __ieee80211_request_smps_mgd(struct ieee80211_sub_if_data
*sdata
,
3258 struct ieee80211_link_data
*link
,
3259 enum ieee80211_smps_mode smps_mode
)
3262 enum ieee80211_smps_mode old_req
;
3264 struct sta_info
*sta
;
3265 bool tdls_peer_found
= false;
3267 lockdep_assert_wiphy(sdata
->local
->hw
.wiphy
);
3269 if (WARN_ON_ONCE(sdata
->vif
.type
!= NL80211_IFTYPE_STATION
))
3272 if (!ieee80211_vif_link_active(&sdata
->vif
, link
->link_id
))
3275 old_req
= link
->u
.mgd
.req_smps
;
3276 link
->u
.mgd
.req_smps
= smps_mode
;
3278 /* The driver indicated that EML is enabled for the interface, which
3279 * implies that SMPS flows towards the AP should be stopped.
3281 if (sdata
->vif
.driver_flags
& IEEE80211_VIF_EML_ACTIVE
)
3284 if (old_req
== smps_mode
&&
3285 smps_mode
!= IEEE80211_SMPS_AUTOMATIC
)
3289 * If not associated, or current association is not an HT
3290 * association, there's no need to do anything, just store
3291 * the new value until we associate.
3293 if (!sdata
->u
.mgd
.associated
||
3294 link
->conf
->chanreq
.oper
.width
== NL80211_CHAN_WIDTH_20_NOHT
)
3297 ap
= sdata
->vif
.cfg
.ap_addr
;
3300 list_for_each_entry_rcu(sta
, &sdata
->local
->sta_list
, list
) {
3301 if (!sta
->sta
.tdls
|| sta
->sdata
!= sdata
|| !sta
->uploaded
||
3302 !test_sta_flag(sta
, WLAN_STA_AUTHORIZED
))
3305 tdls_peer_found
= true;
3310 if (smps_mode
== IEEE80211_SMPS_AUTOMATIC
) {
3311 if (tdls_peer_found
|| !sdata
->u
.mgd
.powersave
)
3312 smps_mode
= IEEE80211_SMPS_OFF
;
3314 smps_mode
= IEEE80211_SMPS_DYNAMIC
;
3317 /* send SM PS frame to AP */
3318 err
= ieee80211_send_smps_action(sdata
, smps_mode
,
3320 ieee80211_vif_is_mld(&sdata
->vif
) ?
3321 link
->link_id
: -1);
3323 link
->u
.mgd
.req_smps
= old_req
;
3324 else if (smps_mode
!= IEEE80211_SMPS_OFF
&& tdls_peer_found
)
3325 ieee80211_teardown_tdls_peers(link
);
3330 static int ieee80211_set_power_mgmt(struct wiphy
*wiphy
, struct net_device
*dev
,
3331 bool enabled
, int timeout
)
3333 struct ieee80211_sub_if_data
*sdata
= IEEE80211_DEV_TO_SUB_IF(dev
);
3334 struct ieee80211_local
*local
= wdev_priv(dev
->ieee80211_ptr
);
3335 unsigned int link_id
;
3337 if (sdata
->vif
.type
!= NL80211_IFTYPE_STATION
)
3340 if (!ieee80211_hw_check(&local
->hw
, SUPPORTS_PS
))
3343 if (enabled
== sdata
->u
.mgd
.powersave
&&
3344 timeout
== local
->dynamic_ps_forced_timeout
)
3347 sdata
->u
.mgd
.powersave
= enabled
;
3348 local
->dynamic_ps_forced_timeout
= timeout
;
3350 /* no change, but if automatic follow powersave */
3351 for (link_id
= 0; link_id
< ARRAY_SIZE(sdata
->link
); link_id
++) {
3352 struct ieee80211_link_data
*link
;
3354 link
= sdata_dereference(sdata
->link
[link_id
], sdata
);
3358 __ieee80211_request_smps_mgd(sdata
, link
,
3359 link
->u
.mgd
.req_smps
);
3362 if (ieee80211_hw_check(&local
->hw
, SUPPORTS_DYNAMIC_PS
))
3363 ieee80211_hw_config(local
, IEEE80211_CONF_CHANGE_PS
);
3365 ieee80211_recalc_ps(local
);
3366 ieee80211_recalc_ps_vif(sdata
);
3367 ieee80211_check_fast_rx_iface(sdata
);
3372 static void ieee80211_set_cqm_rssi_link(struct ieee80211_sub_if_data
*sdata
,
3373 struct ieee80211_link_data
*link
,
3374 s32 rssi_thold
, u32 rssi_hyst
,
3375 s32 rssi_low
, s32 rssi_high
)
3377 struct ieee80211_bss_conf
*conf
;
3379 if (!link
|| !link
->conf
)
3384 if (rssi_thold
&& rssi_hyst
&&
3385 rssi_thold
== conf
->cqm_rssi_thold
&&
3386 rssi_hyst
== conf
->cqm_rssi_hyst
)
3389 conf
->cqm_rssi_thold
= rssi_thold
;
3390 conf
->cqm_rssi_hyst
= rssi_hyst
;
3391 conf
->cqm_rssi_low
= rssi_low
;
3392 conf
->cqm_rssi_high
= rssi_high
;
3393 link
->u
.mgd
.last_cqm_event_signal
= 0;
3395 if (!ieee80211_vif_link_active(&sdata
->vif
, link
->link_id
))
3398 if (sdata
->u
.mgd
.associated
&&
3399 (sdata
->vif
.driver_flags
& IEEE80211_VIF_SUPPORTS_CQM_RSSI
))
3400 ieee80211_link_info_change_notify(sdata
, link
, BSS_CHANGED_CQM
);
3403 static int ieee80211_set_cqm_rssi_config(struct wiphy
*wiphy
,
3404 struct net_device
*dev
,
3405 s32 rssi_thold
, u32 rssi_hyst
)
3407 struct ieee80211_sub_if_data
*sdata
= IEEE80211_DEV_TO_SUB_IF(dev
);
3408 struct ieee80211_vif
*vif
= &sdata
->vif
;
3411 if (vif
->driver_flags
& IEEE80211_VIF_BEACON_FILTER
&&
3412 !(vif
->driver_flags
& IEEE80211_VIF_SUPPORTS_CQM_RSSI
))
3415 /* For MLD, handle CQM change on all the active links */
3416 for (link_id
= 0; link_id
< IEEE80211_MLD_MAX_NUM_LINKS
; link_id
++) {
3417 struct ieee80211_link_data
*link
=
3418 sdata_dereference(sdata
->link
[link_id
], sdata
);
3420 ieee80211_set_cqm_rssi_link(sdata
, link
, rssi_thold
, rssi_hyst
,
3427 static int ieee80211_set_cqm_rssi_range_config(struct wiphy
*wiphy
,
3428 struct net_device
*dev
,
3429 s32 rssi_low
, s32 rssi_high
)
3431 struct ieee80211_sub_if_data
*sdata
= IEEE80211_DEV_TO_SUB_IF(dev
);
3432 struct ieee80211_vif
*vif
= &sdata
->vif
;
3435 if (vif
->driver_flags
& IEEE80211_VIF_BEACON_FILTER
)
3438 /* For MLD, handle CQM change on all the active links */
3439 for (link_id
= 0; link_id
< IEEE80211_MLD_MAX_NUM_LINKS
; link_id
++) {
3440 struct ieee80211_link_data
*link
=
3441 sdata_dereference(sdata
->link
[link_id
], sdata
);
3443 ieee80211_set_cqm_rssi_link(sdata
, link
, 0, 0,
3444 rssi_low
, rssi_high
);
3450 static int ieee80211_set_bitrate_mask(struct wiphy
*wiphy
,
3451 struct net_device
*dev
,
3452 unsigned int link_id
,
3454 const struct cfg80211_bitrate_mask
*mask
)
3456 struct ieee80211_sub_if_data
*sdata
= IEEE80211_DEV_TO_SUB_IF(dev
);
3457 struct ieee80211_local
*local
= wdev_priv(dev
->ieee80211_ptr
);
3460 if (!ieee80211_sdata_running(sdata
))
3464 * If active validate the setting and reject it if it doesn't leave
3465 * at least one basic rate usable, since we really have to be able
3466 * to send something, and if we're an AP we have to be able to do
3467 * so at a basic rate so that all clients can receive it.
3469 if (rcu_access_pointer(sdata
->vif
.bss_conf
.chanctx_conf
) &&
3470 sdata
->vif
.bss_conf
.chanreq
.oper
.chan
) {
3471 u32 basic_rates
= sdata
->vif
.bss_conf
.basic_rates
;
3472 enum nl80211_band band
;
3474 band
= sdata
->vif
.bss_conf
.chanreq
.oper
.chan
->band
;
3476 if (!(mask
->control
[band
].legacy
& basic_rates
))
3480 if (ieee80211_hw_check(&local
->hw
, HAS_RATE_CONTROL
)) {
3481 ret
= drv_set_bitrate_mask(local
, sdata
, mask
);
3486 for (i
= 0; i
< NUM_NL80211_BANDS
; i
++) {
3487 struct ieee80211_supported_band
*sband
= wiphy
->bands
[i
];
3490 sdata
->rc_rateidx_mask
[i
] = mask
->control
[i
].legacy
;
3491 memcpy(sdata
->rc_rateidx_mcs_mask
[i
], mask
->control
[i
].ht_mcs
,
3492 sizeof(mask
->control
[i
].ht_mcs
));
3493 memcpy(sdata
->rc_rateidx_vht_mcs_mask
[i
],
3494 mask
->control
[i
].vht_mcs
,
3495 sizeof(mask
->control
[i
].vht_mcs
));
3497 sdata
->rc_has_mcs_mask
[i
] = false;
3498 sdata
->rc_has_vht_mcs_mask
[i
] = false;
3502 for (j
= 0; j
< IEEE80211_HT_MCS_MASK_LEN
; j
++) {
3503 if (sdata
->rc_rateidx_mcs_mask
[i
][j
] != 0xff) {
3504 sdata
->rc_has_mcs_mask
[i
] = true;
3509 for (j
= 0; j
< NL80211_VHT_NSS_MAX
; j
++) {
3510 if (sdata
->rc_rateidx_vht_mcs_mask
[i
][j
] != 0xffff) {
3511 sdata
->rc_has_vht_mcs_mask
[i
] = true;
3520 static int ieee80211_start_radar_detection(struct wiphy
*wiphy
,
3521 struct net_device
*dev
,
3522 struct cfg80211_chan_def
*chandef
,
3523 u32 cac_time_ms
, int link_id
)
3525 struct ieee80211_sub_if_data
*sdata
= IEEE80211_DEV_TO_SUB_IF(dev
);
3526 struct ieee80211_chan_req chanreq
= { .oper
= *chandef
};
3527 struct ieee80211_local
*local
= sdata
->local
;
3528 struct ieee80211_link_data
*link_data
;
3531 lockdep_assert_wiphy(local
->hw
.wiphy
);
3533 if (!list_empty(&local
->roc_list
) || local
->scanning
)
3536 link_data
= sdata_dereference(sdata
->link
[link_id
], sdata
);
3540 /* whatever, but channel contexts should not complain about that one */
3541 link_data
->smps_mode
= IEEE80211_SMPS_OFF
;
3542 link_data
->needed_rx_chains
= local
->rx_chains
;
3544 err
= ieee80211_link_use_channel(link_data
, &chanreq
,
3545 IEEE80211_CHANCTX_SHARED
);
3549 wiphy_delayed_work_queue(wiphy
, &link_data
->dfs_cac_timer_work
,
3550 msecs_to_jiffies(cac_time_ms
));
3555 static void ieee80211_end_cac(struct wiphy
*wiphy
,
3556 struct net_device
*dev
, unsigned int link_id
)
3558 struct ieee80211_sub_if_data
*sdata
= IEEE80211_DEV_TO_SUB_IF(dev
);
3559 struct ieee80211_local
*local
= sdata
->local
;
3560 struct ieee80211_link_data
*link_data
;
3562 lockdep_assert_wiphy(local
->hw
.wiphy
);
3564 list_for_each_entry(sdata
, &local
->interfaces
, list
) {
3565 link_data
= sdata_dereference(sdata
->link
[link_id
], sdata
);
3569 wiphy_delayed_work_cancel(wiphy
,
3570 &link_data
->dfs_cac_timer_work
);
3572 if (sdata
->wdev
.links
[link_id
].cac_started
) {
3573 ieee80211_link_release_channel(link_data
);
3574 sdata
->wdev
.links
[link_id
].cac_started
= false;
3579 static struct cfg80211_beacon_data
*
3580 cfg80211_beacon_dup(struct cfg80211_beacon_data
*beacon
)
3582 struct cfg80211_beacon_data
*new_beacon
;
3586 len
= beacon
->head_len
+ beacon
->tail_len
+ beacon
->beacon_ies_len
+
3587 beacon
->proberesp_ies_len
+ beacon
->assocresp_ies_len
+
3588 beacon
->probe_resp_len
+ beacon
->lci_len
+ beacon
->civicloc_len
;
3590 if (beacon
->mbssid_ies
)
3591 len
+= ieee80211_get_mbssid_beacon_len(beacon
->mbssid_ies
,
3593 beacon
->mbssid_ies
->cnt
);
3595 new_beacon
= kzalloc(sizeof(*new_beacon
) + len
, GFP_KERNEL
);
3599 if (beacon
->mbssid_ies
&& beacon
->mbssid_ies
->cnt
) {
3600 new_beacon
->mbssid_ies
=
3601 kzalloc(struct_size(new_beacon
->mbssid_ies
,
3602 elem
, beacon
->mbssid_ies
->cnt
),
3604 if (!new_beacon
->mbssid_ies
) {
3609 if (beacon
->rnr_ies
&& beacon
->rnr_ies
->cnt
) {
3610 new_beacon
->rnr_ies
=
3611 kzalloc(struct_size(new_beacon
->rnr_ies
,
3612 elem
, beacon
->rnr_ies
->cnt
),
3614 if (!new_beacon
->rnr_ies
) {
3615 kfree(new_beacon
->mbssid_ies
);
3622 pos
= (u8
*)(new_beacon
+ 1);
3623 if (beacon
->head_len
) {
3624 new_beacon
->head_len
= beacon
->head_len
;
3625 new_beacon
->head
= pos
;
3626 memcpy(pos
, beacon
->head
, beacon
->head_len
);
3627 pos
+= beacon
->head_len
;
3629 if (beacon
->tail_len
) {
3630 new_beacon
->tail_len
= beacon
->tail_len
;
3631 new_beacon
->tail
= pos
;
3632 memcpy(pos
, beacon
->tail
, beacon
->tail_len
);
3633 pos
+= beacon
->tail_len
;
3635 if (beacon
->beacon_ies_len
) {
3636 new_beacon
->beacon_ies_len
= beacon
->beacon_ies_len
;
3637 new_beacon
->beacon_ies
= pos
;
3638 memcpy(pos
, beacon
->beacon_ies
, beacon
->beacon_ies_len
);
3639 pos
+= beacon
->beacon_ies_len
;
3641 if (beacon
->proberesp_ies_len
) {
3642 new_beacon
->proberesp_ies_len
= beacon
->proberesp_ies_len
;
3643 new_beacon
->proberesp_ies
= pos
;
3644 memcpy(pos
, beacon
->proberesp_ies
, beacon
->proberesp_ies_len
);
3645 pos
+= beacon
->proberesp_ies_len
;
3647 if (beacon
->assocresp_ies_len
) {
3648 new_beacon
->assocresp_ies_len
= beacon
->assocresp_ies_len
;
3649 new_beacon
->assocresp_ies
= pos
;
3650 memcpy(pos
, beacon
->assocresp_ies
, beacon
->assocresp_ies_len
);
3651 pos
+= beacon
->assocresp_ies_len
;
3653 if (beacon
->probe_resp_len
) {
3654 new_beacon
->probe_resp_len
= beacon
->probe_resp_len
;
3655 new_beacon
->probe_resp
= pos
;
3656 memcpy(pos
, beacon
->probe_resp
, beacon
->probe_resp_len
);
3657 pos
+= beacon
->probe_resp_len
;
3659 if (beacon
->mbssid_ies
&& beacon
->mbssid_ies
->cnt
) {
3660 pos
+= ieee80211_copy_mbssid_beacon(pos
,
3661 new_beacon
->mbssid_ies
,
3662 beacon
->mbssid_ies
);
3663 if (beacon
->rnr_ies
&& beacon
->rnr_ies
->cnt
)
3664 pos
+= ieee80211_copy_rnr_beacon(pos
,
3665 new_beacon
->rnr_ies
,
3669 /* might copy -1, meaning no changes requested */
3670 new_beacon
->ftm_responder
= beacon
->ftm_responder
;
3672 new_beacon
->lci_len
= beacon
->lci_len
;
3673 new_beacon
->lci
= pos
;
3674 memcpy(pos
, beacon
->lci
, beacon
->lci_len
);
3675 pos
+= beacon
->lci_len
;
3677 if (beacon
->civicloc
) {
3678 new_beacon
->civicloc_len
= beacon
->civicloc_len
;
3679 new_beacon
->civicloc
= pos
;
3680 memcpy(pos
, beacon
->civicloc
, beacon
->civicloc_len
);
3681 pos
+= beacon
->civicloc_len
;
3687 void ieee80211_csa_finish(struct ieee80211_vif
*vif
, unsigned int link_id
)
3689 struct ieee80211_sub_if_data
*sdata
= vif_to_sdata(vif
);
3690 struct ieee80211_local
*local
= sdata
->local
;
3691 struct ieee80211_link_data
*link_data
;
3693 if (WARN_ON(link_id
>= IEEE80211_MLD_MAX_NUM_LINKS
))
3698 link_data
= rcu_dereference(sdata
->link
[link_id
]);
3699 if (WARN_ON(!link_data
)) {
3704 /* TODO: MBSSID with MLO changes */
3705 if (vif
->mbssid_tx_vif
== vif
) {
3706 /* Trigger ieee80211_csa_finish() on the non-transmitting
3707 * interfaces when channel switch is received on
3708 * transmitting interface
3710 struct ieee80211_sub_if_data
*iter
;
3712 list_for_each_entry_rcu(iter
, &local
->interfaces
, list
) {
3713 if (!ieee80211_sdata_running(iter
))
3716 if (iter
== sdata
|| iter
->vif
.mbssid_tx_vif
!= vif
)
3719 wiphy_work_queue(iter
->local
->hw
.wiphy
,
3720 &iter
->deflink
.csa
.finalize_work
);
3723 wiphy_work_queue(local
->hw
.wiphy
, &link_data
->csa
.finalize_work
);
3727 EXPORT_SYMBOL(ieee80211_csa_finish
);
3729 void ieee80211_channel_switch_disconnect(struct ieee80211_vif
*vif
, bool block_tx
)
3731 struct ieee80211_sub_if_data
*sdata
= vif_to_sdata(vif
);
3732 struct ieee80211_if_managed
*ifmgd
= &sdata
->u
.mgd
;
3733 struct ieee80211_local
*local
= sdata
->local
;
3735 sdata
->csa_blocked_queues
= block_tx
;
3736 sdata_info(sdata
, "channel switch failed, disconnecting\n");
3737 wiphy_work_queue(local
->hw
.wiphy
, &ifmgd
->csa_connection_drop_work
);
3739 EXPORT_SYMBOL(ieee80211_channel_switch_disconnect
);
3741 static int ieee80211_set_after_csa_beacon(struct ieee80211_link_data
*link_data
,
3744 struct ieee80211_sub_if_data
*sdata
= link_data
->sdata
;
3747 switch (sdata
->vif
.type
) {
3748 case NL80211_IFTYPE_AP
:
3749 if (!link_data
->u
.ap
.next_beacon
)
3752 err
= ieee80211_assign_beacon(sdata
, link_data
,
3753 link_data
->u
.ap
.next_beacon
,
3754 NULL
, NULL
, changed
);
3755 ieee80211_free_next_beacon(link_data
);
3760 case NL80211_IFTYPE_ADHOC
:
3761 err
= ieee80211_ibss_finish_csa(sdata
, changed
);
3765 #ifdef CONFIG_MAC80211_MESH
3766 case NL80211_IFTYPE_MESH_POINT
:
3767 err
= ieee80211_mesh_finish_csa(sdata
, changed
);
3780 static int __ieee80211_csa_finalize(struct ieee80211_link_data
*link_data
)
3782 struct ieee80211_sub_if_data
*sdata
= link_data
->sdata
;
3783 struct ieee80211_local
*local
= sdata
->local
;
3784 struct ieee80211_bss_conf
*link_conf
= link_data
->conf
;
3788 lockdep_assert_wiphy(local
->hw
.wiphy
);
3791 * using reservation isn't immediate as it may be deferred until later
3792 * with multi-vif. once reservation is complete it will re-schedule the
3793 * work with no reserved_chanctx so verify chandef to check if it
3794 * completed successfully
3797 if (link_data
->reserved_chanctx
) {
3799 * with multi-vif csa driver may call ieee80211_csa_finish()
3800 * many times while waiting for other interfaces to use their
3803 if (link_data
->reserved_ready
)
3806 return ieee80211_link_use_reserved_context(link_data
);
3809 if (!cfg80211_chandef_identical(&link_conf
->chanreq
.oper
,
3810 &link_data
->csa
.chanreq
.oper
))
3813 link_conf
->csa_active
= false;
3815 err
= ieee80211_set_after_csa_beacon(link_data
, &changed
);
3819 ieee80211_link_info_change_notify(sdata
, link_data
, changed
);
3821 ieee80211_vif_unblock_queues_csa(sdata
);
3823 err
= drv_post_channel_switch(link_data
);
3827 cfg80211_ch_switch_notify(sdata
->dev
, &link_data
->csa
.chanreq
.oper
,
3828 link_data
->link_id
);
3833 static void ieee80211_csa_finalize(struct ieee80211_link_data
*link_data
)
3835 struct ieee80211_sub_if_data
*sdata
= link_data
->sdata
;
3837 if (__ieee80211_csa_finalize(link_data
)) {
3838 sdata_info(sdata
, "failed to finalize CSA on link %d, disconnecting\n",
3839 link_data
->link_id
);
3840 cfg80211_stop_iface(sdata
->local
->hw
.wiphy
, &sdata
->wdev
,
3845 void ieee80211_csa_finalize_work(struct wiphy
*wiphy
, struct wiphy_work
*work
)
3847 struct ieee80211_link_data
*link
=
3848 container_of(work
, struct ieee80211_link_data
, csa
.finalize_work
);
3849 struct ieee80211_sub_if_data
*sdata
= link
->sdata
;
3850 struct ieee80211_local
*local
= sdata
->local
;
3852 lockdep_assert_wiphy(local
->hw
.wiphy
);
3854 /* AP might have been stopped while waiting for the lock. */
3855 if (!link
->conf
->csa_active
)
3858 if (!ieee80211_sdata_running(sdata
))
3861 ieee80211_csa_finalize(link
);
3864 static int ieee80211_set_csa_beacon(struct ieee80211_link_data
*link_data
,
3865 struct cfg80211_csa_settings
*params
,
3868 struct ieee80211_sub_if_data
*sdata
= link_data
->sdata
;
3869 struct ieee80211_csa_settings csa
= {};
3872 switch (sdata
->vif
.type
) {
3873 case NL80211_IFTYPE_AP
:
3874 link_data
->u
.ap
.next_beacon
=
3875 cfg80211_beacon_dup(¶ms
->beacon_after
);
3876 if (!link_data
->u
.ap
.next_beacon
)
3880 * With a count of 0, we don't have to wait for any
3881 * TBTT before switching, so complete the CSA
3882 * immediately. In theory, with a count == 1 we
3883 * should delay the switch until just before the next
3884 * TBTT, but that would complicate things so we switch
3885 * immediately too. If we would delay the switch
3886 * until the next TBTT, we would have to set the probe
3889 * TODO: A channel switch with count <= 1 without
3890 * sending a CSA action frame is kind of useless,
3891 * because the clients won't know we're changing
3892 * channels. The action frame must be implemented
3893 * either here or in the userspace.
3895 if (params
->count
<= 1)
3898 if ((params
->n_counter_offsets_beacon
>
3899 IEEE80211_MAX_CNTDWN_COUNTERS_NUM
) ||
3900 (params
->n_counter_offsets_presp
>
3901 IEEE80211_MAX_CNTDWN_COUNTERS_NUM
)) {
3902 ieee80211_free_next_beacon(link_data
);
3906 csa
.counter_offsets_beacon
= params
->counter_offsets_beacon
;
3907 csa
.counter_offsets_presp
= params
->counter_offsets_presp
;
3908 csa
.n_counter_offsets_beacon
= params
->n_counter_offsets_beacon
;
3909 csa
.n_counter_offsets_presp
= params
->n_counter_offsets_presp
;
3910 csa
.count
= params
->count
;
3912 err
= ieee80211_assign_beacon(sdata
, link_data
,
3913 ¶ms
->beacon_csa
, &csa
,
3916 ieee80211_free_next_beacon(link_data
);
3921 case NL80211_IFTYPE_ADHOC
:
3922 if (!sdata
->vif
.cfg
.ibss_joined
)
3925 if (params
->chandef
.width
!= sdata
->u
.ibss
.chandef
.width
)
3928 switch (params
->chandef
.width
) {
3929 case NL80211_CHAN_WIDTH_40
:
3930 if (cfg80211_get_chandef_type(¶ms
->chandef
) !=
3931 cfg80211_get_chandef_type(&sdata
->u
.ibss
.chandef
))
3934 case NL80211_CHAN_WIDTH_5
:
3935 case NL80211_CHAN_WIDTH_10
:
3936 case NL80211_CHAN_WIDTH_20_NOHT
:
3937 case NL80211_CHAN_WIDTH_20
:
3943 /* changes into another band are not supported */
3944 if (sdata
->u
.ibss
.chandef
.chan
->band
!=
3945 params
->chandef
.chan
->band
)
3948 /* see comments in the NL80211_IFTYPE_AP block */
3949 if (params
->count
> 1) {
3950 err
= ieee80211_ibss_csa_beacon(sdata
, params
, changed
);
3955 ieee80211_send_action_csa(sdata
, params
);
3958 #ifdef CONFIG_MAC80211_MESH
3959 case NL80211_IFTYPE_MESH_POINT
: {
3960 struct ieee80211_if_mesh
*ifmsh
= &sdata
->u
.mesh
;
3962 /* changes into another band are not supported */
3963 if (sdata
->vif
.bss_conf
.chanreq
.oper
.chan
->band
!=
3964 params
->chandef
.chan
->band
)
3967 if (ifmsh
->csa_role
== IEEE80211_MESH_CSA_ROLE_NONE
) {
3968 ifmsh
->csa_role
= IEEE80211_MESH_CSA_ROLE_INIT
;
3969 if (!ifmsh
->pre_value
)
3970 ifmsh
->pre_value
= 1;
3975 /* see comments in the NL80211_IFTYPE_AP block */
3976 if (params
->count
> 1) {
3977 err
= ieee80211_mesh_csa_beacon(sdata
, params
, changed
);
3979 ifmsh
->csa_role
= IEEE80211_MESH_CSA_ROLE_NONE
;
3984 if (ifmsh
->csa_role
== IEEE80211_MESH_CSA_ROLE_INIT
)
3985 ieee80211_send_action_csa(sdata
, params
);
3997 static void ieee80211_color_change_abort(struct ieee80211_link_data
*link
)
3999 link
->conf
->color_change_active
= false;
4001 ieee80211_free_next_beacon(link
);
4003 cfg80211_color_change_aborted_notify(link
->sdata
->dev
, link
->link_id
);
4007 __ieee80211_channel_switch(struct wiphy
*wiphy
, struct net_device
*dev
,
4008 struct cfg80211_csa_settings
*params
)
4010 struct ieee80211_sub_if_data
*sdata
= IEEE80211_DEV_TO_SUB_IF(dev
);
4011 struct ieee80211_chan_req chanreq
= { .oper
= params
->chandef
};
4012 struct ieee80211_local
*local
= sdata
->local
;
4013 struct ieee80211_channel_switch ch_switch
= {
4014 .link_id
= params
->link_id
,
4016 struct ieee80211_chanctx_conf
*conf
;
4017 struct ieee80211_chanctx
*chanctx
;
4018 struct ieee80211_bss_conf
*link_conf
;
4019 struct ieee80211_link_data
*link_data
;
4021 u8 link_id
= params
->link_id
;
4024 lockdep_assert_wiphy(local
->hw
.wiphy
);
4026 if (!list_empty(&local
->roc_list
) || local
->scanning
)
4029 if (sdata
->wdev
.links
[link_id
].cac_started
)
4032 if (WARN_ON(link_id
>= IEEE80211_MLD_MAX_NUM_LINKS
))
4035 link_data
= wiphy_dereference(wiphy
, sdata
->link
[link_id
]);
4039 link_conf
= link_data
->conf
;
4041 if (chanreq
.oper
.punctured
&& !link_conf
->eht_support
)
4044 /* don't allow another channel switch if one is already active. */
4045 if (link_conf
->csa_active
)
4048 conf
= wiphy_dereference(wiphy
, link_conf
->chanctx_conf
);
4054 if (params
->chandef
.chan
->freq_offset
) {
4055 /* this may work, but is untested */
4060 chanctx
= container_of(conf
, struct ieee80211_chanctx
, conf
);
4062 ch_switch
.timestamp
= 0;
4063 ch_switch
.device_timestamp
= 0;
4064 ch_switch
.block_tx
= params
->block_tx
;
4065 ch_switch
.chandef
= chanreq
.oper
;
4066 ch_switch
.count
= params
->count
;
4068 err
= drv_pre_channel_switch(sdata
, &ch_switch
);
4072 err
= ieee80211_link_reserve_chanctx(link_data
, &chanreq
,
4074 params
->radar_required
);
4078 /* if reservation is invalid then this will fail */
4079 err
= ieee80211_check_combinations(sdata
, NULL
, chanctx
->mode
, 0, -1);
4081 ieee80211_link_unreserve_chanctx(link_data
);
4085 /* if there is a color change in progress, abort it */
4086 if (link_conf
->color_change_active
)
4087 ieee80211_color_change_abort(link_data
);
4089 err
= ieee80211_set_csa_beacon(link_data
, params
, &changed
);
4091 ieee80211_link_unreserve_chanctx(link_data
);
4095 link_data
->csa
.chanreq
= chanreq
;
4096 link_conf
->csa_active
= true;
4098 if (params
->block_tx
)
4099 ieee80211_vif_block_queues_csa(sdata
);
4101 cfg80211_ch_switch_started_notify(sdata
->dev
,
4102 &link_data
->csa
.chanreq
.oper
, link_id
,
4103 params
->count
, params
->block_tx
);
4106 ieee80211_link_info_change_notify(sdata
, link_data
, changed
);
4107 drv_channel_switch_beacon(sdata
, &link_data
->csa
.chanreq
.oper
);
4109 /* if the beacon didn't change, we can finalize immediately */
4110 ieee80211_csa_finalize(link_data
);
4117 int ieee80211_channel_switch(struct wiphy
*wiphy
, struct net_device
*dev
,
4118 struct cfg80211_csa_settings
*params
)
4120 struct ieee80211_sub_if_data
*sdata
= IEEE80211_DEV_TO_SUB_IF(dev
);
4121 struct ieee80211_local
*local
= sdata
->local
;
4123 lockdep_assert_wiphy(local
->hw
.wiphy
);
4125 return __ieee80211_channel_switch(wiphy
, dev
, params
);
4128 u64
ieee80211_mgmt_tx_cookie(struct ieee80211_local
*local
)
4130 lockdep_assert_wiphy(local
->hw
.wiphy
);
4132 local
->roc_cookie_counter
++;
4134 /* wow, you wrapped 64 bits ... more likely a bug */
4135 if (WARN_ON(local
->roc_cookie_counter
== 0))
4136 local
->roc_cookie_counter
++;
4138 return local
->roc_cookie_counter
;
4141 int ieee80211_attach_ack_skb(struct ieee80211_local
*local
, struct sk_buff
*skb
,
4142 u64
*cookie
, gfp_t gfp
)
4144 unsigned long spin_flags
;
4145 struct sk_buff
*ack_skb
;
4148 ack_skb
= skb_copy(skb
, gfp
);
4152 spin_lock_irqsave(&local
->ack_status_lock
, spin_flags
);
4153 id
= idr_alloc(&local
->ack_status_frames
, ack_skb
,
4154 1, 0x2000, GFP_ATOMIC
);
4155 spin_unlock_irqrestore(&local
->ack_status_lock
, spin_flags
);
4162 IEEE80211_SKB_CB(skb
)->status_data_idr
= 1;
4163 IEEE80211_SKB_CB(skb
)->status_data
= id
;
4165 *cookie
= ieee80211_mgmt_tx_cookie(local
);
4166 IEEE80211_SKB_CB(ack_skb
)->ack
.cookie
= *cookie
;
4172 ieee80211_update_mgmt_frame_registrations(struct wiphy
*wiphy
,
4173 struct wireless_dev
*wdev
,
4174 struct mgmt_frame_regs
*upd
)
4176 struct ieee80211_local
*local
= wiphy_priv(wiphy
);
4177 struct ieee80211_sub_if_data
*sdata
= IEEE80211_WDEV_TO_SUB_IF(wdev
);
4178 u32 preq_mask
= BIT(IEEE80211_STYPE_PROBE_REQ
>> 4);
4179 u32 action_mask
= BIT(IEEE80211_STYPE_ACTION
>> 4);
4180 bool global_change
, intf_change
;
4183 (local
->probe_req_reg
!= !!(upd
->global_stypes
& preq_mask
)) ||
4184 (local
->rx_mcast_action_reg
!=
4185 !!(upd
->global_mcast_stypes
& action_mask
));
4186 local
->probe_req_reg
= upd
->global_stypes
& preq_mask
;
4187 local
->rx_mcast_action_reg
= upd
->global_mcast_stypes
& action_mask
;
4189 intf_change
= (sdata
->vif
.probe_req_reg
!=
4190 !!(upd
->interface_stypes
& preq_mask
)) ||
4191 (sdata
->vif
.rx_mcast_action_reg
!=
4192 !!(upd
->interface_mcast_stypes
& action_mask
));
4193 sdata
->vif
.probe_req_reg
= upd
->interface_stypes
& preq_mask
;
4194 sdata
->vif
.rx_mcast_action_reg
=
4195 upd
->interface_mcast_stypes
& action_mask
;
4197 if (!local
->open_count
)
4200 if (intf_change
&& ieee80211_sdata_running(sdata
))
4201 drv_config_iface_filter(local
, sdata
,
4202 sdata
->vif
.probe_req_reg
?
4207 ieee80211_configure_filter(local
);
4210 static int ieee80211_set_antenna(struct wiphy
*wiphy
, u32 tx_ant
, u32 rx_ant
)
4212 struct ieee80211_local
*local
= wiphy_priv(wiphy
);
4218 ret
= drv_set_antenna(local
, tx_ant
, rx_ant
);
4222 local
->rx_chains
= hweight8(rx_ant
);
4226 static int ieee80211_get_antenna(struct wiphy
*wiphy
, u32
*tx_ant
, u32
*rx_ant
)
4228 struct ieee80211_local
*local
= wiphy_priv(wiphy
);
4230 return drv_get_antenna(local
, tx_ant
, rx_ant
);
4233 static int ieee80211_set_rekey_data(struct wiphy
*wiphy
,
4234 struct net_device
*dev
,
4235 struct cfg80211_gtk_rekey_data
*data
)
4237 struct ieee80211_local
*local
= wiphy_priv(wiphy
);
4238 struct ieee80211_sub_if_data
*sdata
= IEEE80211_DEV_TO_SUB_IF(dev
);
4240 if (!local
->ops
->set_rekey_data
)
4243 drv_set_rekey_data(local
, sdata
, data
);
4248 static int ieee80211_probe_client(struct wiphy
*wiphy
, struct net_device
*dev
,
4249 const u8
*peer
, u64
*cookie
)
4251 struct ieee80211_sub_if_data
*sdata
= IEEE80211_DEV_TO_SUB_IF(dev
);
4252 struct ieee80211_local
*local
= sdata
->local
;
4253 struct ieee80211_qos_hdr
*nullfunc
;
4254 struct sk_buff
*skb
;
4255 int size
= sizeof(*nullfunc
);
4258 struct ieee80211_tx_info
*info
;
4259 struct sta_info
*sta
;
4260 struct ieee80211_chanctx_conf
*chanctx_conf
;
4261 enum nl80211_band band
;
4264 /* the lock is needed to assign the cookie later */
4265 lockdep_assert_wiphy(local
->hw
.wiphy
);
4268 sta
= sta_info_get_bss(sdata
, peer
);
4276 chanctx_conf
= rcu_dereference(sdata
->vif
.bss_conf
.chanctx_conf
);
4277 if (WARN_ON(!chanctx_conf
)) {
4281 band
= chanctx_conf
->def
.chan
->band
;
4284 fc
= cpu_to_le16(IEEE80211_FTYPE_DATA
|
4285 IEEE80211_STYPE_QOS_NULLFUNC
|
4286 IEEE80211_FCTL_FROMDS
);
4289 fc
= cpu_to_le16(IEEE80211_FTYPE_DATA
|
4290 IEEE80211_STYPE_NULLFUNC
|
4291 IEEE80211_FCTL_FROMDS
);
4294 skb
= dev_alloc_skb(local
->hw
.extra_tx_headroom
+ size
);
4302 skb_reserve(skb
, local
->hw
.extra_tx_headroom
);
4304 nullfunc
= skb_put(skb
, size
);
4305 nullfunc
->frame_control
= fc
;
4306 nullfunc
->duration_id
= 0;
4307 memcpy(nullfunc
->addr1
, sta
->sta
.addr
, ETH_ALEN
);
4308 memcpy(nullfunc
->addr2
, sdata
->vif
.addr
, ETH_ALEN
);
4309 memcpy(nullfunc
->addr3
, sdata
->vif
.addr
, ETH_ALEN
);
4310 nullfunc
->seq_ctrl
= 0;
4312 info
= IEEE80211_SKB_CB(skb
);
4314 info
->flags
|= IEEE80211_TX_CTL_REQ_TX_STATUS
|
4315 IEEE80211_TX_INTFL_NL80211_FRAME_TX
;
4318 skb_set_queue_mapping(skb
, IEEE80211_AC_VO
);
4321 nullfunc
->qos_ctrl
= cpu_to_le16(7);
4323 ret
= ieee80211_attach_ack_skb(local
, skb
, cookie
, GFP_ATOMIC
);
4330 ieee80211_xmit(sdata
, sta
, skb
);
4340 static int ieee80211_cfg_get_channel(struct wiphy
*wiphy
,
4341 struct wireless_dev
*wdev
,
4342 unsigned int link_id
,
4343 struct cfg80211_chan_def
*chandef
)
4345 struct ieee80211_sub_if_data
*sdata
= IEEE80211_WDEV_TO_SUB_IF(wdev
);
4346 struct ieee80211_local
*local
= wiphy_priv(wiphy
);
4347 struct ieee80211_chanctx_conf
*chanctx_conf
;
4348 struct ieee80211_link_data
*link
;
4352 link
= rcu_dereference(sdata
->link
[link_id
]);
4358 chanctx_conf
= rcu_dereference(link
->conf
->chanctx_conf
);
4360 *chandef
= link
->conf
->chanreq
.oper
;
4362 } else if (!ieee80211_hw_check(&local
->hw
, NO_VIRTUAL_MONITOR
) &&
4363 local
->open_count
> 0 &&
4364 local
->open_count
== local
->monitors
&&
4365 sdata
->vif
.type
== NL80211_IFTYPE_MONITOR
) {
4366 *chandef
= local
->monitor_chanreq
.oper
;
4376 static void ieee80211_set_wakeup(struct wiphy
*wiphy
, bool enabled
)
4378 drv_set_wakeup(wiphy_priv(wiphy
), enabled
);
4382 static int ieee80211_set_qos_map(struct wiphy
*wiphy
,
4383 struct net_device
*dev
,
4384 struct cfg80211_qos_map
*qos_map
)
4386 struct ieee80211_sub_if_data
*sdata
= IEEE80211_DEV_TO_SUB_IF(dev
);
4387 struct mac80211_qos_map
*new_qos_map
, *old_qos_map
;
4390 new_qos_map
= kzalloc(sizeof(*new_qos_map
), GFP_KERNEL
);
4393 memcpy(&new_qos_map
->qos_map
, qos_map
, sizeof(*qos_map
));
4395 /* A NULL qos_map was passed to disable QoS mapping */
4399 old_qos_map
= sdata_dereference(sdata
->qos_map
, sdata
);
4400 rcu_assign_pointer(sdata
->qos_map
, new_qos_map
);
4402 kfree_rcu(old_qos_map
, rcu_head
);
4407 static int ieee80211_set_ap_chanwidth(struct wiphy
*wiphy
,
4408 struct net_device
*dev
,
4409 unsigned int link_id
,
4410 struct cfg80211_chan_def
*chandef
)
4412 struct ieee80211_sub_if_data
*sdata
= IEEE80211_DEV_TO_SUB_IF(dev
);
4413 struct ieee80211_link_data
*link
;
4414 struct ieee80211_chan_req chanreq
= { .oper
= *chandef
};
4418 link
= sdata_dereference(sdata
->link
[link_id
], sdata
);
4420 ret
= ieee80211_link_change_chanreq(link
, &chanreq
, &changed
);
4422 ieee80211_link_info_change_notify(sdata
, link
, changed
);
4427 static int ieee80211_add_tx_ts(struct wiphy
*wiphy
, struct net_device
*dev
,
4428 u8 tsid
, const u8
*peer
, u8 up
,
4431 struct ieee80211_sub_if_data
*sdata
= IEEE80211_DEV_TO_SUB_IF(dev
);
4432 struct ieee80211_if_managed
*ifmgd
= &sdata
->u
.mgd
;
4433 int ac
= ieee802_1d_to_ac
[up
];
4435 if (sdata
->vif
.type
!= NL80211_IFTYPE_STATION
)
4438 if (!(sdata
->wmm_acm
& BIT(up
)))
4441 if (ifmgd
->tx_tspec
[ac
].admitted_time
)
4444 if (admitted_time
) {
4445 ifmgd
->tx_tspec
[ac
].admitted_time
= 32 * admitted_time
;
4446 ifmgd
->tx_tspec
[ac
].tsid
= tsid
;
4447 ifmgd
->tx_tspec
[ac
].up
= up
;
4453 static int ieee80211_del_tx_ts(struct wiphy
*wiphy
, struct net_device
*dev
,
4454 u8 tsid
, const u8
*peer
)
4456 struct ieee80211_sub_if_data
*sdata
= IEEE80211_DEV_TO_SUB_IF(dev
);
4457 struct ieee80211_if_managed
*ifmgd
= &sdata
->u
.mgd
;
4458 struct ieee80211_local
*local
= wiphy_priv(wiphy
);
4461 for (ac
= 0; ac
< IEEE80211_NUM_ACS
; ac
++) {
4462 struct ieee80211_sta_tx_tspec
*tx_tspec
= &ifmgd
->tx_tspec
[ac
];
4464 /* skip unused entries */
4465 if (!tx_tspec
->admitted_time
)
4468 if (tx_tspec
->tsid
!= tsid
)
4471 /* due to this new packets will be reassigned to non-ACM ACs */
4474 /* Make sure that all packets have been sent to avoid to
4475 * restore the QoS params on packets that are still on the
4479 ieee80211_flush_queues(local
, sdata
, false);
4481 /* restore the normal QoS parameters
4482 * (unconditionally to avoid races)
4484 tx_tspec
->action
= TX_TSPEC_ACTION_STOP_DOWNGRADE
;
4485 tx_tspec
->downgraded
= false;
4486 ieee80211_sta_handle_tspec_ac_params(sdata
);
4488 /* finally clear all the data */
4489 memset(tx_tspec
, 0, sizeof(*tx_tspec
));
4497 void ieee80211_nan_func_terminated(struct ieee80211_vif
*vif
,
4499 enum nl80211_nan_func_term_reason reason
,
4502 struct ieee80211_sub_if_data
*sdata
= vif_to_sdata(vif
);
4503 struct cfg80211_nan_func
*func
;
4506 if (WARN_ON(vif
->type
!= NL80211_IFTYPE_NAN
))
4509 spin_lock_bh(&sdata
->u
.nan
.func_lock
);
4511 func
= idr_find(&sdata
->u
.nan
.function_inst_ids
, inst_id
);
4512 if (WARN_ON(!func
)) {
4513 spin_unlock_bh(&sdata
->u
.nan
.func_lock
);
4517 cookie
= func
->cookie
;
4518 idr_remove(&sdata
->u
.nan
.function_inst_ids
, inst_id
);
4520 spin_unlock_bh(&sdata
->u
.nan
.func_lock
);
4522 cfg80211_free_nan_func(func
);
4524 cfg80211_nan_func_terminated(ieee80211_vif_to_wdev(vif
), inst_id
,
4525 reason
, cookie
, gfp
);
4527 EXPORT_SYMBOL(ieee80211_nan_func_terminated
);
4529 void ieee80211_nan_func_match(struct ieee80211_vif
*vif
,
4530 struct cfg80211_nan_match_params
*match
,
4533 struct ieee80211_sub_if_data
*sdata
= vif_to_sdata(vif
);
4534 struct cfg80211_nan_func
*func
;
4536 if (WARN_ON(vif
->type
!= NL80211_IFTYPE_NAN
))
4539 spin_lock_bh(&sdata
->u
.nan
.func_lock
);
4541 func
= idr_find(&sdata
->u
.nan
.function_inst_ids
, match
->inst_id
);
4542 if (WARN_ON(!func
)) {
4543 spin_unlock_bh(&sdata
->u
.nan
.func_lock
);
4546 match
->cookie
= func
->cookie
;
4548 spin_unlock_bh(&sdata
->u
.nan
.func_lock
);
4550 cfg80211_nan_match(ieee80211_vif_to_wdev(vif
), match
, gfp
);
4552 EXPORT_SYMBOL(ieee80211_nan_func_match
);
4554 static int ieee80211_set_multicast_to_unicast(struct wiphy
*wiphy
,
4555 struct net_device
*dev
,
4558 struct ieee80211_sub_if_data
*sdata
= IEEE80211_DEV_TO_SUB_IF(dev
);
4560 sdata
->u
.ap
.multicast_to_unicast
= enabled
;
4565 void ieee80211_fill_txq_stats(struct cfg80211_txq_stats
*txqstats
,
4566 struct txq_info
*txqi
)
4568 if (!(txqstats
->filled
& BIT(NL80211_TXQ_STATS_BACKLOG_BYTES
))) {
4569 txqstats
->filled
|= BIT(NL80211_TXQ_STATS_BACKLOG_BYTES
);
4570 txqstats
->backlog_bytes
= txqi
->tin
.backlog_bytes
;
4573 if (!(txqstats
->filled
& BIT(NL80211_TXQ_STATS_BACKLOG_PACKETS
))) {
4574 txqstats
->filled
|= BIT(NL80211_TXQ_STATS_BACKLOG_PACKETS
);
4575 txqstats
->backlog_packets
= txqi
->tin
.backlog_packets
;
4578 if (!(txqstats
->filled
& BIT(NL80211_TXQ_STATS_FLOWS
))) {
4579 txqstats
->filled
|= BIT(NL80211_TXQ_STATS_FLOWS
);
4580 txqstats
->flows
= txqi
->tin
.flows
;
4583 if (!(txqstats
->filled
& BIT(NL80211_TXQ_STATS_DROPS
))) {
4584 txqstats
->filled
|= BIT(NL80211_TXQ_STATS_DROPS
);
4585 txqstats
->drops
= txqi
->cstats
.drop_count
;
4588 if (!(txqstats
->filled
& BIT(NL80211_TXQ_STATS_ECN_MARKS
))) {
4589 txqstats
->filled
|= BIT(NL80211_TXQ_STATS_ECN_MARKS
);
4590 txqstats
->ecn_marks
= txqi
->cstats
.ecn_mark
;
4593 if (!(txqstats
->filled
& BIT(NL80211_TXQ_STATS_OVERLIMIT
))) {
4594 txqstats
->filled
|= BIT(NL80211_TXQ_STATS_OVERLIMIT
);
4595 txqstats
->overlimit
= txqi
->tin
.overlimit
;
4598 if (!(txqstats
->filled
& BIT(NL80211_TXQ_STATS_COLLISIONS
))) {
4599 txqstats
->filled
|= BIT(NL80211_TXQ_STATS_COLLISIONS
);
4600 txqstats
->collisions
= txqi
->tin
.collisions
;
4603 if (!(txqstats
->filled
& BIT(NL80211_TXQ_STATS_TX_BYTES
))) {
4604 txqstats
->filled
|= BIT(NL80211_TXQ_STATS_TX_BYTES
);
4605 txqstats
->tx_bytes
= txqi
->tin
.tx_bytes
;
4608 if (!(txqstats
->filled
& BIT(NL80211_TXQ_STATS_TX_PACKETS
))) {
4609 txqstats
->filled
|= BIT(NL80211_TXQ_STATS_TX_PACKETS
);
4610 txqstats
->tx_packets
= txqi
->tin
.tx_packets
;
4614 static int ieee80211_get_txq_stats(struct wiphy
*wiphy
,
4615 struct wireless_dev
*wdev
,
4616 struct cfg80211_txq_stats
*txqstats
)
4618 struct ieee80211_local
*local
= wiphy_priv(wiphy
);
4619 struct ieee80211_sub_if_data
*sdata
;
4622 spin_lock_bh(&local
->fq
.lock
);
4626 sdata
= IEEE80211_WDEV_TO_SUB_IF(wdev
);
4627 if (!sdata
->vif
.txq
) {
4631 ieee80211_fill_txq_stats(txqstats
, to_txq_info(sdata
->vif
.txq
));
4634 txqstats
->filled
|= BIT(NL80211_TXQ_STATS_BACKLOG_PACKETS
) |
4635 BIT(NL80211_TXQ_STATS_BACKLOG_BYTES
) |
4636 BIT(NL80211_TXQ_STATS_OVERLIMIT
) |
4637 BIT(NL80211_TXQ_STATS_OVERMEMORY
) |
4638 BIT(NL80211_TXQ_STATS_COLLISIONS
) |
4639 BIT(NL80211_TXQ_STATS_MAX_FLOWS
);
4640 txqstats
->backlog_packets
= local
->fq
.backlog
;
4641 txqstats
->backlog_bytes
= local
->fq
.memory_usage
;
4642 txqstats
->overlimit
= local
->fq
.overlimit
;
4643 txqstats
->overmemory
= local
->fq
.overmemory
;
4644 txqstats
->collisions
= local
->fq
.collisions
;
4645 txqstats
->max_flows
= local
->fq
.flows_cnt
;
4650 spin_unlock_bh(&local
->fq
.lock
);
4656 ieee80211_get_ftm_responder_stats(struct wiphy
*wiphy
,
4657 struct net_device
*dev
,
4658 struct cfg80211_ftm_responder_stats
*ftm_stats
)
4660 struct ieee80211_local
*local
= wiphy_priv(wiphy
);
4661 struct ieee80211_sub_if_data
*sdata
= IEEE80211_DEV_TO_SUB_IF(dev
);
4663 return drv_get_ftm_responder_stats(local
, sdata
, ftm_stats
);
4667 ieee80211_start_pmsr(struct wiphy
*wiphy
, struct wireless_dev
*dev
,
4668 struct cfg80211_pmsr_request
*request
)
4670 struct ieee80211_local
*local
= wiphy_priv(wiphy
);
4671 struct ieee80211_sub_if_data
*sdata
= IEEE80211_WDEV_TO_SUB_IF(dev
);
4673 return drv_start_pmsr(local
, sdata
, request
);
4677 ieee80211_abort_pmsr(struct wiphy
*wiphy
, struct wireless_dev
*dev
,
4678 struct cfg80211_pmsr_request
*request
)
4680 struct ieee80211_local
*local
= wiphy_priv(wiphy
);
4681 struct ieee80211_sub_if_data
*sdata
= IEEE80211_WDEV_TO_SUB_IF(dev
);
4683 return drv_abort_pmsr(local
, sdata
, request
);
4686 static int ieee80211_set_tid_config(struct wiphy
*wiphy
,
4687 struct net_device
*dev
,
4688 struct cfg80211_tid_config
*tid_conf
)
4690 struct ieee80211_sub_if_data
*sdata
= IEEE80211_DEV_TO_SUB_IF(dev
);
4691 struct sta_info
*sta
;
4693 lockdep_assert_wiphy(sdata
->local
->hw
.wiphy
);
4695 if (!sdata
->local
->ops
->set_tid_config
)
4698 if (!tid_conf
->peer
)
4699 return drv_set_tid_config(sdata
->local
, sdata
, NULL
, tid_conf
);
4701 sta
= sta_info_get_bss(sdata
, tid_conf
->peer
);
4705 return drv_set_tid_config(sdata
->local
, sdata
, &sta
->sta
, tid_conf
);
4708 static int ieee80211_reset_tid_config(struct wiphy
*wiphy
,
4709 struct net_device
*dev
,
4710 const u8
*peer
, u8 tids
)
4712 struct ieee80211_sub_if_data
*sdata
= IEEE80211_DEV_TO_SUB_IF(dev
);
4713 struct sta_info
*sta
;
4715 lockdep_assert_wiphy(sdata
->local
->hw
.wiphy
);
4717 if (!sdata
->local
->ops
->reset_tid_config
)
4721 return drv_reset_tid_config(sdata
->local
, sdata
, NULL
, tids
);
4723 sta
= sta_info_get_bss(sdata
, peer
);
4727 return drv_reset_tid_config(sdata
->local
, sdata
, &sta
->sta
, tids
);
4730 static int ieee80211_set_sar_specs(struct wiphy
*wiphy
,
4731 struct cfg80211_sar_specs
*sar
)
4733 struct ieee80211_local
*local
= wiphy_priv(wiphy
);
4735 if (!local
->ops
->set_sar_specs
)
4738 return local
->ops
->set_sar_specs(&local
->hw
, sar
);
4742 ieee80211_set_after_color_change_beacon(struct ieee80211_link_data
*link
,
4745 struct ieee80211_sub_if_data
*sdata
= link
->sdata
;
4747 switch (sdata
->vif
.type
) {
4748 case NL80211_IFTYPE_AP
: {
4751 if (!link
->u
.ap
.next_beacon
)
4754 ret
= ieee80211_assign_beacon(sdata
, link
,
4755 link
->u
.ap
.next_beacon
,
4756 NULL
, NULL
, changed
);
4757 ieee80211_free_next_beacon(link
);
4773 ieee80211_set_color_change_beacon(struct ieee80211_link_data
*link
,
4774 struct cfg80211_color_change_settings
*params
,
4777 struct ieee80211_sub_if_data
*sdata
= link
->sdata
;
4778 struct ieee80211_color_change_settings color_change
= {};
4781 switch (sdata
->vif
.type
) {
4782 case NL80211_IFTYPE_AP
:
4783 link
->u
.ap
.next_beacon
=
4784 cfg80211_beacon_dup(¶ms
->beacon_next
);
4785 if (!link
->u
.ap
.next_beacon
)
4788 if (params
->count
<= 1)
4791 color_change
.counter_offset_beacon
=
4792 params
->counter_offset_beacon
;
4793 color_change
.counter_offset_presp
=
4794 params
->counter_offset_presp
;
4795 color_change
.count
= params
->count
;
4797 err
= ieee80211_assign_beacon(sdata
, link
,
4798 ¶ms
->beacon_color_change
,
4799 NULL
, &color_change
, changed
);
4801 ieee80211_free_next_beacon(link
);
4813 ieee80211_color_change_bss_config_notify(struct ieee80211_link_data
*link
,
4814 u8 color
, int enable
, u64 changed
)
4816 struct ieee80211_sub_if_data
*sdata
= link
->sdata
;
4818 lockdep_assert_wiphy(sdata
->local
->hw
.wiphy
);
4820 link
->conf
->he_bss_color
.color
= color
;
4821 link
->conf
->he_bss_color
.enabled
= enable
;
4822 changed
|= BSS_CHANGED_HE_BSS_COLOR
;
4824 ieee80211_link_info_change_notify(sdata
, link
, changed
);
4826 if (!sdata
->vif
.bss_conf
.nontransmitted
&& sdata
->vif
.mbssid_tx_vif
) {
4827 struct ieee80211_sub_if_data
*child
;
4829 list_for_each_entry(child
, &sdata
->local
->interfaces
, list
) {
4830 if (child
!= sdata
&& child
->vif
.mbssid_tx_vif
== &sdata
->vif
) {
4831 child
->vif
.bss_conf
.he_bss_color
.color
= color
;
4832 child
->vif
.bss_conf
.he_bss_color
.enabled
= enable
;
4833 ieee80211_link_info_change_notify(child
,
4835 BSS_CHANGED_HE_BSS_COLOR
);
4841 static int ieee80211_color_change_finalize(struct ieee80211_link_data
*link
)
4843 struct ieee80211_sub_if_data
*sdata
= link
->sdata
;
4844 struct ieee80211_local
*local
= sdata
->local
;
4848 lockdep_assert_wiphy(local
->hw
.wiphy
);
4850 link
->conf
->color_change_active
= false;
4852 err
= ieee80211_set_after_color_change_beacon(link
, &changed
);
4854 cfg80211_color_change_aborted_notify(sdata
->dev
, link
->link_id
);
4858 ieee80211_color_change_bss_config_notify(link
,
4859 link
->conf
->color_change_color
,
4861 cfg80211_color_change_notify(sdata
->dev
, link
->link_id
);
4866 void ieee80211_color_change_finalize_work(struct wiphy
*wiphy
,
4867 struct wiphy_work
*work
)
4869 struct ieee80211_link_data
*link
=
4870 container_of(work
, struct ieee80211_link_data
,
4871 color_change_finalize_work
);
4872 struct ieee80211_sub_if_data
*sdata
= link
->sdata
;
4873 struct ieee80211_bss_conf
*link_conf
= link
->conf
;
4874 struct ieee80211_local
*local
= sdata
->local
;
4876 lockdep_assert_wiphy(local
->hw
.wiphy
);
4878 /* AP might have been stopped while waiting for the lock. */
4879 if (!link_conf
->color_change_active
)
4882 if (!ieee80211_sdata_running(sdata
))
4885 ieee80211_color_change_finalize(link
);
4888 void ieee80211_color_collision_detection_work(struct wiphy
*wiphy
,
4889 struct wiphy_work
*work
)
4891 struct ieee80211_link_data
*link
=
4892 container_of(work
, struct ieee80211_link_data
,
4893 color_collision_detect_work
.work
);
4894 struct ieee80211_sub_if_data
*sdata
= link
->sdata
;
4896 cfg80211_obss_color_collision_notify(sdata
->dev
, link
->color_bitmap
,
4900 void ieee80211_color_change_finish(struct ieee80211_vif
*vif
, u8 link_id
)
4902 struct ieee80211_sub_if_data
*sdata
= vif_to_sdata(vif
);
4903 struct ieee80211_link_data
*link
;
4905 if (WARN_ON(link_id
>= IEEE80211_MLD_MAX_NUM_LINKS
))
4910 link
= rcu_dereference(sdata
->link
[link_id
]);
4911 if (WARN_ON(!link
)) {
4916 wiphy_work_queue(sdata
->local
->hw
.wiphy
,
4917 &link
->color_change_finalize_work
);
4921 EXPORT_SYMBOL_GPL(ieee80211_color_change_finish
);
4924 ieee80211_obss_color_collision_notify(struct ieee80211_vif
*vif
,
4925 u64 color_bitmap
, u8 link_id
)
4927 struct ieee80211_sub_if_data
*sdata
= vif_to_sdata(vif
);
4928 struct ieee80211_link_data
*link
;
4930 if (WARN_ON(link_id
>= IEEE80211_MLD_MAX_NUM_LINKS
))
4935 link
= rcu_dereference(sdata
->link
[link_id
]);
4936 if (WARN_ON(!link
)) {
4941 if (link
->conf
->color_change_active
|| link
->conf
->csa_active
) {
4946 if (wiphy_delayed_work_pending(sdata
->local
->hw
.wiphy
,
4947 &link
->color_collision_detect_work
)) {
4952 link
->color_bitmap
= color_bitmap
;
4953 /* queue the color collision detection event every 500 ms in order to
4954 * avoid sending too much netlink messages to userspace.
4956 wiphy_delayed_work_queue(sdata
->local
->hw
.wiphy
,
4957 &link
->color_collision_detect_work
,
4958 msecs_to_jiffies(500));
4962 EXPORT_SYMBOL_GPL(ieee80211_obss_color_collision_notify
);
4965 ieee80211_color_change(struct wiphy
*wiphy
, struct net_device
*dev
,
4966 struct cfg80211_color_change_settings
*params
)
4968 struct ieee80211_sub_if_data
*sdata
= IEEE80211_DEV_TO_SUB_IF(dev
);
4969 struct ieee80211_local
*local
= sdata
->local
;
4970 struct ieee80211_bss_conf
*link_conf
;
4971 struct ieee80211_link_data
*link
;
4972 u8 link_id
= params
->link_id
;
4976 lockdep_assert_wiphy(local
->hw
.wiphy
);
4978 if (WARN_ON(link_id
>= IEEE80211_MLD_MAX_NUM_LINKS
))
4981 link
= wiphy_dereference(wiphy
, sdata
->link
[link_id
]);
4985 link_conf
= link
->conf
;
4987 if (link_conf
->nontransmitted
)
4990 /* don't allow another color change if one is already active or if csa
4993 if (link_conf
->color_change_active
|| link_conf
->csa_active
) {
4998 err
= ieee80211_set_color_change_beacon(link
, params
, &changed
);
5002 link_conf
->color_change_active
= true;
5003 link_conf
->color_change_color
= params
->color
;
5005 cfg80211_color_change_started_notify(sdata
->dev
, params
->count
, link_id
);
5008 ieee80211_color_change_bss_config_notify(link
, 0, 0, changed
);
5010 /* if the beacon didn't change, we can finalize immediately */
5011 ieee80211_color_change_finalize(link
);
5019 ieee80211_set_radar_background(struct wiphy
*wiphy
,
5020 struct cfg80211_chan_def
*chandef
)
5022 struct ieee80211_local
*local
= wiphy_priv(wiphy
);
5024 if (!local
->ops
->set_radar_background
)
5027 return local
->ops
->set_radar_background(&local
->hw
, chandef
);
5030 static int ieee80211_add_intf_link(struct wiphy
*wiphy
,
5031 struct wireless_dev
*wdev
,
5032 unsigned int link_id
)
5034 struct ieee80211_sub_if_data
*sdata
= IEEE80211_WDEV_TO_SUB_IF(wdev
);
5036 lockdep_assert_wiphy(sdata
->local
->hw
.wiphy
);
5038 if (wdev
->use_4addr
)
5041 return ieee80211_vif_set_links(sdata
, wdev
->valid_links
, 0);
5044 static void ieee80211_del_intf_link(struct wiphy
*wiphy
,
5045 struct wireless_dev
*wdev
,
5046 unsigned int link_id
)
5048 struct ieee80211_sub_if_data
*sdata
= IEEE80211_WDEV_TO_SUB_IF(wdev
);
5050 lockdep_assert_wiphy(sdata
->local
->hw
.wiphy
);
5052 ieee80211_vif_set_links(sdata
, wdev
->valid_links
, 0);
5056 ieee80211_add_link_station(struct wiphy
*wiphy
, struct net_device
*dev
,
5057 struct link_station_parameters
*params
)
5059 struct ieee80211_sub_if_data
*sdata
= IEEE80211_DEV_TO_SUB_IF(dev
);
5060 struct ieee80211_local
*local
= wiphy_priv(wiphy
);
5061 struct sta_info
*sta
;
5064 lockdep_assert_wiphy(local
->hw
.wiphy
);
5066 sta
= sta_info_get_bss(sdata
, params
->mld_mac
);
5070 if (!sta
->sta
.valid_links
)
5073 if (sta
->sta
.valid_links
& BIT(params
->link_id
))
5076 ret
= ieee80211_sta_allocate_link(sta
, params
->link_id
);
5080 ret
= sta_link_apply_parameters(local
, sta
, STA_LINK_MODE_NEW
, params
);
5082 ieee80211_sta_free_link(sta
, params
->link_id
);
5086 if (test_sta_flag(sta
, WLAN_STA_ASSOC
)) {
5087 struct link_sta_info
*link_sta
;
5089 link_sta
= sdata_dereference(sta
->link
[params
->link_id
], sdata
);
5090 rate_control_rate_init(link_sta
);
5093 /* ieee80211_sta_activate_link frees the link upon failure */
5094 return ieee80211_sta_activate_link(sta
, params
->link_id
);
5098 ieee80211_mod_link_station(struct wiphy
*wiphy
, struct net_device
*dev
,
5099 struct link_station_parameters
*params
)
5101 struct ieee80211_sub_if_data
*sdata
= IEEE80211_DEV_TO_SUB_IF(dev
);
5102 struct ieee80211_local
*local
= wiphy_priv(wiphy
);
5103 struct sta_info
*sta
;
5105 lockdep_assert_wiphy(local
->hw
.wiphy
);
5107 sta
= sta_info_get_bss(sdata
, params
->mld_mac
);
5111 if (!(sta
->sta
.valid_links
& BIT(params
->link_id
)))
5114 return sta_link_apply_parameters(local
, sta
, STA_LINK_MODE_LINK_MODIFY
,
5119 ieee80211_del_link_station(struct wiphy
*wiphy
, struct net_device
*dev
,
5120 struct link_station_del_parameters
*params
)
5122 struct ieee80211_sub_if_data
*sdata
= IEEE80211_DEV_TO_SUB_IF(dev
);
5123 struct sta_info
*sta
;
5125 lockdep_assert_wiphy(sdata
->local
->hw
.wiphy
);
5127 sta
= sta_info_get_bss(sdata
, params
->mld_mac
);
5131 if (!(sta
->sta
.valid_links
& BIT(params
->link_id
)))
5134 /* must not create a STA without links */
5135 if (sta
->sta
.valid_links
== BIT(params
->link_id
))
5138 ieee80211_sta_remove_link(sta
, params
->link_id
);
5143 static int ieee80211_set_hw_timestamp(struct wiphy
*wiphy
,
5144 struct net_device
*dev
,
5145 struct cfg80211_set_hw_timestamp
*hwts
)
5147 struct ieee80211_sub_if_data
*sdata
= IEEE80211_DEV_TO_SUB_IF(dev
);
5148 struct ieee80211_local
*local
= sdata
->local
;
5150 if (!local
->ops
->set_hw_timestamp
)
5153 if (!check_sdata_in_driver(sdata
))
5156 return local
->ops
->set_hw_timestamp(&local
->hw
, &sdata
->vif
, hwts
);
5160 ieee80211_set_ttlm(struct wiphy
*wiphy
, struct net_device
*dev
,
5161 struct cfg80211_ttlm_params
*params
)
5163 struct ieee80211_sub_if_data
*sdata
= IEEE80211_DEV_TO_SUB_IF(dev
);
5165 lockdep_assert_wiphy(sdata
->local
->hw
.wiphy
);
5167 return ieee80211_req_neg_ttlm(sdata
, params
);
5170 const struct cfg80211_ops mac80211_config_ops
= {
5171 .add_virtual_intf
= ieee80211_add_iface
,
5172 .del_virtual_intf
= ieee80211_del_iface
,
5173 .change_virtual_intf
= ieee80211_change_iface
,
5174 .start_p2p_device
= ieee80211_start_p2p_device
,
5175 .stop_p2p_device
= ieee80211_stop_p2p_device
,
5176 .add_key
= ieee80211_add_key
,
5177 .del_key
= ieee80211_del_key
,
5178 .get_key
= ieee80211_get_key
,
5179 .set_default_key
= ieee80211_config_default_key
,
5180 .set_default_mgmt_key
= ieee80211_config_default_mgmt_key
,
5181 .set_default_beacon_key
= ieee80211_config_default_beacon_key
,
5182 .start_ap
= ieee80211_start_ap
,
5183 .change_beacon
= ieee80211_change_beacon
,
5184 .stop_ap
= ieee80211_stop_ap
,
5185 .add_station
= ieee80211_add_station
,
5186 .del_station
= ieee80211_del_station
,
5187 .change_station
= ieee80211_change_station
,
5188 .get_station
= ieee80211_get_station
,
5189 .dump_station
= ieee80211_dump_station
,
5190 .dump_survey
= ieee80211_dump_survey
,
5191 #ifdef CONFIG_MAC80211_MESH
5192 .add_mpath
= ieee80211_add_mpath
,
5193 .del_mpath
= ieee80211_del_mpath
,
5194 .change_mpath
= ieee80211_change_mpath
,
5195 .get_mpath
= ieee80211_get_mpath
,
5196 .dump_mpath
= ieee80211_dump_mpath
,
5197 .get_mpp
= ieee80211_get_mpp
,
5198 .dump_mpp
= ieee80211_dump_mpp
,
5199 .update_mesh_config
= ieee80211_update_mesh_config
,
5200 .get_mesh_config
= ieee80211_get_mesh_config
,
5201 .join_mesh
= ieee80211_join_mesh
,
5202 .leave_mesh
= ieee80211_leave_mesh
,
5204 .join_ocb
= ieee80211_join_ocb
,
5205 .leave_ocb
= ieee80211_leave_ocb
,
5206 .change_bss
= ieee80211_change_bss
,
5207 .inform_bss
= ieee80211_inform_bss
,
5208 .set_txq_params
= ieee80211_set_txq_params
,
5209 .set_monitor_channel
= ieee80211_set_monitor_channel
,
5210 .suspend
= ieee80211_suspend
,
5211 .resume
= ieee80211_resume
,
5212 .scan
= ieee80211_scan
,
5213 .abort_scan
= ieee80211_abort_scan
,
5214 .sched_scan_start
= ieee80211_sched_scan_start
,
5215 .sched_scan_stop
= ieee80211_sched_scan_stop
,
5216 .auth
= ieee80211_auth
,
5217 .assoc
= ieee80211_assoc
,
5218 .deauth
= ieee80211_deauth
,
5219 .disassoc
= ieee80211_disassoc
,
5220 .join_ibss
= ieee80211_join_ibss
,
5221 .leave_ibss
= ieee80211_leave_ibss
,
5222 .set_mcast_rate
= ieee80211_set_mcast_rate
,
5223 .set_wiphy_params
= ieee80211_set_wiphy_params
,
5224 .set_tx_power
= ieee80211_set_tx_power
,
5225 .get_tx_power
= ieee80211_get_tx_power
,
5226 .rfkill_poll
= ieee80211_rfkill_poll
,
5227 CFG80211_TESTMODE_CMD(ieee80211_testmode_cmd
)
5228 CFG80211_TESTMODE_DUMP(ieee80211_testmode_dump
)
5229 .set_power_mgmt
= ieee80211_set_power_mgmt
,
5230 .set_bitrate_mask
= ieee80211_set_bitrate_mask
,
5231 .remain_on_channel
= ieee80211_remain_on_channel
,
5232 .cancel_remain_on_channel
= ieee80211_cancel_remain_on_channel
,
5233 .mgmt_tx
= ieee80211_mgmt_tx
,
5234 .mgmt_tx_cancel_wait
= ieee80211_mgmt_tx_cancel_wait
,
5235 .set_cqm_rssi_config
= ieee80211_set_cqm_rssi_config
,
5236 .set_cqm_rssi_range_config
= ieee80211_set_cqm_rssi_range_config
,
5237 .update_mgmt_frame_registrations
=
5238 ieee80211_update_mgmt_frame_registrations
,
5239 .set_antenna
= ieee80211_set_antenna
,
5240 .get_antenna
= ieee80211_get_antenna
,
5241 .set_rekey_data
= ieee80211_set_rekey_data
,
5242 .tdls_oper
= ieee80211_tdls_oper
,
5243 .tdls_mgmt
= ieee80211_tdls_mgmt
,
5244 .tdls_channel_switch
= ieee80211_tdls_channel_switch
,
5245 .tdls_cancel_channel_switch
= ieee80211_tdls_cancel_channel_switch
,
5246 .probe_client
= ieee80211_probe_client
,
5247 .set_noack_map
= ieee80211_set_noack_map
,
5249 .set_wakeup
= ieee80211_set_wakeup
,
5251 .get_channel
= ieee80211_cfg_get_channel
,
5252 .start_radar_detection
= ieee80211_start_radar_detection
,
5253 .end_cac
= ieee80211_end_cac
,
5254 .channel_switch
= ieee80211_channel_switch
,
5255 .set_qos_map
= ieee80211_set_qos_map
,
5256 .set_ap_chanwidth
= ieee80211_set_ap_chanwidth
,
5257 .add_tx_ts
= ieee80211_add_tx_ts
,
5258 .del_tx_ts
= ieee80211_del_tx_ts
,
5259 .start_nan
= ieee80211_start_nan
,
5260 .stop_nan
= ieee80211_stop_nan
,
5261 .nan_change_conf
= ieee80211_nan_change_conf
,
5262 .add_nan_func
= ieee80211_add_nan_func
,
5263 .del_nan_func
= ieee80211_del_nan_func
,
5264 .set_multicast_to_unicast
= ieee80211_set_multicast_to_unicast
,
5265 .tx_control_port
= ieee80211_tx_control_port
,
5266 .get_txq_stats
= ieee80211_get_txq_stats
,
5267 .get_ftm_responder_stats
= ieee80211_get_ftm_responder_stats
,
5268 .start_pmsr
= ieee80211_start_pmsr
,
5269 .abort_pmsr
= ieee80211_abort_pmsr
,
5270 .probe_mesh_link
= ieee80211_probe_mesh_link
,
5271 .set_tid_config
= ieee80211_set_tid_config
,
5272 .reset_tid_config
= ieee80211_reset_tid_config
,
5273 .set_sar_specs
= ieee80211_set_sar_specs
,
5274 .color_change
= ieee80211_color_change
,
5275 .set_radar_background
= ieee80211_set_radar_background
,
5276 .add_intf_link
= ieee80211_add_intf_link
,
5277 .del_intf_link
= ieee80211_del_intf_link
,
5278 .add_link_station
= ieee80211_add_link_station
,
5279 .mod_link_station
= ieee80211_mod_link_station
,
5280 .del_link_station
= ieee80211_del_link_station
,
5281 .set_hw_timestamp
= ieee80211_set_hw_timestamp
,
5282 .set_ttlm
= ieee80211_set_ttlm
,
5283 .get_radio_mask
= ieee80211_get_radio_mask
,