cfg80211/mac80211 patches from our internal tree 2023-09-18
v2 cover cfg80211/mac80211 patches from our internal tree 2023-09-18
From: Gregory Greenman <[email protected]>
Hi,
A bunch of patches from our internal tree with mac80211 and cfg80211 changes. It's the usual developement, cleanups and bugfixes.
v2: Modified patches 13 and 14 according to the received comments (update draft version to D4, rename t2l_map to ttlm to have the same terminology as the draft and add some kernel-doc); Fixed typo in commit message of patch 11.
The changes in this patch set are:
* add implementation for set_antenna API
* CSA fixes
* initial support for TID to link mapping
* MLO improvements
* fixes and cleanups
Thanks,
Gregory
Ayala Beker (3):
wifi: mac80211: don't connect to an AP while it's in a CSA process
wifi: mac80211: add support for parsing TID to Link mapping element
wifi: mac80211: support handling of advertised TID-to-link mapping
Benjamin Berg (3):
wifi: cfg80211: report per-link errors during association
wifi: mac80211: report per-link error during association
wifi: mac80211: reject MLO channel configuration if not supported
Emmanuel Grumbach (1):
wifi: mac80211: update the rx_chains after set_antenna()
Ilan Peer (3):
wifi: cfg80211: Fix 6GHz scan configuration
wifi: mac80211: Notify the low level driver on change in MLO valid
links
wifi: mac80211_hwsim: Handle BSS_CHANGED_VALID_LINKS
Johannes Berg (8):
wifi: mac80211: use bandwidth indication element for CSA
wifi: mac80211: relax RCU check in for_each_vif_active_link()
wifi: mac80211: allow for_each_sta_active_link() under RCU
wifi: cfg80211: reg: describe return values in kernel-doc
wifi: mac80211: describe return values in kernel-doc
wifi: mac80211_hwsim: move kernel-doc description
wifi: mac80211: work around Cisco AP 9115 VHT MPDU length
wifi: mac80211: support antenna control in injection
drivers/net/wireless/virtual/mac80211_hwsim.c | 26 +- include/linux/ieee80211.h | 83 +++++ include/net/cfg80211.h | 3 + include/net/mac80211.h | 12 +- net/mac80211/cfg.c | 11 +- net/mac80211/ibss.c | 2 +- net/mac80211/ieee80211_i.h | 22 +- net/mac80211/main.c | 3 +- net/mac80211/mesh_plink.c | 2 +- net/mac80211/mlme.c | 284 +++++++++++++++++- net/mac80211/spectmgmt.c | 13 +- net/mac80211/tx.c | 16 + net/mac80211/util.c | 52 +++- net/mac80211/vht.c | 16 +- net/wireless/nl80211.c | 50 ++- net/wireless/reg.c | 16 +- net/wireless/scan.c | 4 + 17 files changed, 562 insertions(+), 53 deletions(-)
Signature · 1 line
2.38.1
PATCH v2 1/18 wifi: mac80211: use bandwidth indication element for CSA
From: Johannes Berg <[email protected]>
In CSA, parse the (EHT) bandwidth indication element and use it (in fact prefer it if present).
--- include/linux/ieee80211.h | 23 +++++++++++++++++++++ net/mac80211/ieee80211_i.h | 3 ++- net/mac80211/mlme.c | 5 +++-- net/mac80211/spectmgmt.c | 13 ++++++++++-- net/mac80211/util.c | 42 ++++++++++++++++++++++++++------------ 5 files changed, 68 insertions(+), 18 deletions(-)
include/linux/ieee80211.h +23 -0
@@ -3139,6 +3139,28 @@ ieee80211_eht_oper_size_ok(const u8 *data, u8 len)return len >= needed; } +#define IEEE80211_BW_IND_DIS_SUBCH_PRESENT BIT(1) + +struct ieee80211_bandwidth_indication { +u8 params; +struct ieee80211_eht_operation_info info; +} __packed; + +static inline bool +ieee80211_bandwidth_indication_size_ok (const u8 *data,u8 len) +{ +const struct ieee80211_bandwidth_indication *bwi = (const void *)data; + +if (len <sizeof (*bwi)) +return false; + +if (bwi->params &IEEE80211_BW_IND_DIS_SUBCH_PRESENT && + len <sizeof (*bwi) +2 ) +return false; + +return true; +} +#define LISTEN_INT_USF GENMASK(15, 14)#define LISTEN_INT_UI GENMASK(13, 0)
@@ -3596,6 +3618,7 @@ enum ieee80211_eid_ext {WLAN_EID_EXT_EHT_OPERATION =106 ,WLAN_EID_EXT_EHT_MULTI_LINK =107 ,WLAN_EID_EXT_EHT_CAPABILITY =108 , + WLAN_EID_EXT_BANDWIDTH_INDICATION = 135, };/* Action category code */
net/mac80211/ieee80211_i.h +2 -1
@@ -1677,6 +1677,7 @@ struct ieee802_11_elems {const struct ieee80211_eht_operation *eht_operation;const struct ieee80211_multi_link_elem *ml_basic;const struct ieee80211_multi_link_elem *ml_reconf; +const struct ieee80211_bandwidth_indication *bandwidth_indication;/* length of them, respectively */ u8 ext_capab_len;
@@ -2463,7 +2464,7 @@ bool ieee80211_chandef_vht_oper(struct ieee80211_hw *hw, u32 vht_cap_info,const struct ieee80211_vht_operation *oper, const struct ieee80211_ht_operation *htop, struct cfg80211_chan_def *chandef); -void ieee80211_chandef_eht_oper (const struct ieee80211_eht_operation *eht_oper, +void ieee80211_chandef_eht_oper (const struct ieee80211_eht_operation_info *info,bool support_160,bool support_320,struct cfg80211_chan_def *chandef); bool ieee80211_chandef_he_6ghz_oper(struct ieee80211_sub_if_data *sdata,
net/mac80211/mlme.c +3 -2
@@ -109,7 +109,8 @@ ieee80211_extract_dis_subch_bmap(const struct ieee80211_eht_operation *eht_oper,return 0 ;/* set 160/320 supported to get the full AP definition */ -ieee80211_chandef_eht_oper (eht_oper, true, true, &ap_chandef); +ieee80211_chandef_eht_oper ((const void *)eht_oper->optional, + true, true, &ap_chandef); ap_center_freq = ap_chandef.center_freq1; ap_bw =20 *BIT (u8_get_bits (info->control,IEEE80211_EHT_OPER_CHAN_WIDTH ));
@@ -387,7 +388,7 @@ ieee80211_determine_chantype(struct ieee80211_sub_if_data *sdata,if (eht_oper && (eht_oper->params &IEEE80211_EHT_OPER_INFO_PRESENT )) {struct cfg80211_chan_def eht_chandef = *chandef; -ieee80211_chandef_eht_oper (eht_oper, +ieee80211_chandef_eht_oper ((const void *)eht_oper->optional, eht_chandef.width ==NL80211_CHAN_WIDTH_160 , false, &eht_chandef);
net/mac80211/spectmgmt.c +11 -2
@@ -9,7 +9,7 @@* Copyright 2007, Michael Wu <[email protected]> * Copyright 2007-2008, Intel Corporation * Copyright 2008, Johannes Berg <[email protected]> -* Copyright (C) 2018, 2020, 2022 Intel Corporation +* Copyright (C) 2018, 2020, 2022-2023 Intel Corporation */ #include <linux/ieee80211.h>
@@ -33,12 +33,14 @@ int ieee80211_parse_ch_switch_ie(struct ieee80211_sub_if_data *sdata,struct cfg80211_chan_def new_vht_chandef = {};const struct ieee80211_sec_chan_offs_ie *sec_chan_offs;const struct ieee80211_wide_bw_chansw_ie *wide_bw_chansw_ie; +const struct ieee80211_bandwidth_indication *bwi;int secondary_channel_offset =-1 ;memset (csa_ie,0 ,sizeof (*csa_ie)); sec_chan_offs = elems->sec_chan_offs; wide_bw_chansw_ie = elems->wide_bw_chansw_ie; + bwi = elems->bandwidth_indication;if (conn_flags & (IEEE80211_CONN_DISABLE_HT |IEEE80211_CONN_DISABLE_40MHZ )) {
@@ -132,7 +134,14 @@ int ieee80211_parse_ch_switch_ie(struct ieee80211_sub_if_data *sdata,break ; } - if (wide_bw_chansw_ie) { +if (bwi) { +/* start with the CSA one */ + new_vht_chandef = csa_ie->chandef; +/* and update the width accordingly */ +/* FIXME: support 160/320 */ +ieee80211_chandef_eht_oper (&bwi->info, true, true, + &new_vht_chandef); + } else if (wide_bw_chansw_ie) { u8 new_seg1 = wide_bw_chansw_ie->new_center_freq_seg1; struct ieee80211_vht_operation vht_oper = { .chan_width =
net/mac80211/util.c +29 -13
81 lines not on this page · raw message
Signature · 1 line
2.38.1
PATCH v2 2/18 wifi: mac80211: update the rx_chains after set_antenna()
In reply to [email protected]From: Emmanuel Grumbach <[email protected]>
rx_chains was set only upon registration and it we rely on it for the active chains upon SMPS configuration after association.
When we use the set_antenna() API to limit the rx_chains from 2 to 1, this caused issues with iwlwifi since we still had 2 active_chains requested.
--- net/mac80211/cfg.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)
net/mac80211/cfg.c +7 -1
@@ -4044,11 +4044,17 @@ ieee80211_update_mgmt_frame_registrations(struct wiphy *wiphy,static int ieee80211_set_antenna (struct wiphy *wiphy,u32 tx_ant,u32 rx_ant) {struct ieee80211_local *local =wiphy_priv (wiphy); +int ret;if (local->started)return -EOPNOTSUPP ; -return drv_set_antenna (local, tx_ant, rx_ant); + ret =drv_set_antenna (local, tx_ant, rx_ant); +if (ret) +return ret; + + local->rx_chains =hweight8 (rx_ant); +return 0 ; }static int ieee80211_get_antenna (struct wiphy *wiphy,u32 *tx_ant,u32 *rx_ant)
Signature · 1 line
2.38.1
PATCH v2 3/18 wifi: mac80211: don't connect to an AP while it's in a CSA process
In reply to [email protected]From: Ayala Beker <[email protected]>
Connection to an AP that is running a CSA flow may end up with a failure as the AP might change its channel during the connection flow while we do not track the channel change yet. Avoid that by rejecting a connection to such an AP.
--- net/mac80211/mlme.c | 34 +++++++++++++++++++++++++++++++++- 1 file changed, 33 insertions(+), 1 deletion(-)
net/mac80211/mlme.c +33 -1
@@ -7015,6 +7015,7 @@ int ieee80211_mgd_auth(struct ieee80211_sub_if_data *sdata,struct ieee80211_if_managed *ifmgd = &sdata->u.mgd;struct ieee80211_mgd_auth_data *auth_data;struct ieee80211_link_data *link; +const struct element *csa_elem, *ecsa_elem;u16 auth_alg;int err;bool cont_auth;
@@ -7057,6 +7058,22 @@ int ieee80211_mgd_auth(struct ieee80211_sub_if_data *sdata,if (ifmgd->assoc_data)return -EBUSY ; +rcu_read_lock (); + csa_elem =ieee80211_bss_get_elem (req->bss,WLAN_EID_CHANNEL_SWITCH ); + ecsa_elem =ieee80211_bss_get_elem (req->bss, +WLAN_EID_EXT_CHANSWITCH_ANN ); +if ((csa_elem && + csa_elem->datalen ==sizeof (struct ieee80211_channel_sw_ie ) && + ((struct ieee80211_channel_sw_ie *)csa_elem->data)->count !=0 ) || + (ecsa_elem && + ecsa_elem->datalen ==sizeof (struct ieee80211_ext_chansw_ie ) && + ((struct ieee80211_ext_chansw_ie *)ecsa_elem->data)->count !=0 )) { +rcu_read_unlock (); +sdata_info (sdata,"AP is in CSA process, reject auth\n" ); +return -EINVAL ; + } +rcu_read_unlock (); + auth_data =kzalloc (sizeof (*auth_data) + req->auth_data_len + req->ie_len,GFP_KERNEL );if (!auth_data)
@@ -7364,7 +7381,7 @@ int ieee80211_mgd_assoc(struct ieee80211_sub_if_data *sdata,struct ieee80211_local *local = sdata->local;struct ieee80211_if_managed *ifmgd = &sdata->u.mgd;struct ieee80211_mgd_assoc_data *assoc_data; -const struct element *ssid_elem; +const struct element *ssid_elem, *csa_elem, *ecsa_elem;struct ieee80211_vif_cfg *vif_cfg = &sdata->vif.cfg;ieee80211_conn_flags_t conn_flags =0 ;struct ieee80211_link_data *link;
@@ -7394,6 +7411,21 @@ int ieee80211_mgd_assoc(struct ieee80211_sub_if_data *sdata,kfree (assoc_data);return -EINVAL ; } + + csa_elem =ieee80211_bss_get_elem (cbss,WLAN_EID_CHANNEL_SWITCH ); + ecsa_elem =ieee80211_bss_get_elem (cbss,WLAN_EID_EXT_CHANSWITCH_ANN ); +if ((csa_elem && + csa_elem->datalen ==sizeof (struct ieee80211_channel_sw_ie ) && + ((struct ieee80211_channel_sw_ie *)csa_elem->data)->count !=0 ) || + (ecsa_elem && + ecsa_elem->datalen ==sizeof (struct ieee80211_ext_chansw_ie ) && + ((struct ieee80211_ext_chansw_ie *)ecsa_elem->data)->count !=0 )) { +sdata_info (sdata,"AP is in CSA process, reject assoc\n" ); +rcu_read_unlock (); +kfree (assoc_data); +return -EINVAL ; + } +memcpy (assoc_data->ssid, ssid_elem->data, ssid_elem->datalen); assoc_data->ssid_len = ssid_elem->datalen;memcpy (vif_cfg->ssid, assoc_data->ssid, assoc_data->ssid_len);
Signature · 1 line
2.38.1
PATCH v2 4/18 wifi: mac80211: relax RCU check in for_each_vif_active_link()
In reply to [email protected]From: Johannes Berg <[email protected]>
To iterate the vif links we don't necessarily need to be in an RCU critical section, it's also possible to hold the sdata/wdev mutex. Annotate for_each_vif_active_link() accordingly.
--- include/net/mac80211.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
include/net/mac80211.h +1 -1
@@ -1942,7 +1942,7 @@ static inline bool ieee80211_vif_is_mld(const struct ieee80211_vif *vif)for (link_id =0 ; link_id <ARRAY_SIZE ((vif)->link_conf); link_id++) \if ((!(vif)->active_links || \ (vif)->active_links &BIT (link_id)) && \ - (link =rcu_dereference ((vif)->link_conf[link_id]))) + (link =link_conf_dereference_check (vif, link_id))) static inline bool ieee80211_vif_is_mesh(struct ieee80211_vif *vif) {
Signature · 1 line
2.38.1
PATCH v2 5/18 wifi: mac80211: allow for_each_sta_active_link() under RCU
In reply to [email protected]From: Johannes Berg <[email protected]>
Since we only use this to protect the dereference and with STA mutex, we can also allow this with just RCU.
--- include/net/mac80211.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
include/net/mac80211.h +1 -1
@@ -2393,7 +2393,7 @@ static inline bool lockdep_sta_mutex_held(struct ieee80211_sta *pubsta)for (link_id =0 ; link_id <ARRAY_SIZE ((sta)->link); link_id++) \if ((!(vif)->active_links || \ (vif)->active_links &BIT (link_id)) && \ - ((link_sta) =link_sta_dereference_protected (sta, link_id))) + ((link_sta) =link_sta_dereference_check (sta, link_id)))/** * enum sta_notify_cmd - sta notify command
Signature · 1 line
2.38.1
PATCH v2 6/18 wifi: cfg80211: reg: describe return values in kernel-doc
In reply to [email protected]From: Johannes Berg <[email protected]>
Describe the function return values in kernel-doc.
--- net/wireless/reg.c | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-)
net/wireless/reg.c +13 -3
@@ -1283,7 +1283,9 @@ static bool is_valid_rd(const struct ieee80211_regdomain *rd)* 60 GHz band. * This resolution can be lowered and should be considered as we add * regulatory rule support for other "bands". -**/ +* +* Returns: whether or not the frequency is in the range +*/ static bool freq_in_rule_band (const struct ieee80211_freq_range *freq_range,u32 freq_khz) {
@@ -1492,6 +1494,8 @@ static void add_rule(struct ieee80211_reg_rule *rule,* Returns a pointer to the regulatory domain structure which will hold the * resulting intersection of rules between rd1 and rd2. We will * kzalloc() this structure for you. +* +* Returns: the intersected regdomain */ static struct ieee80211_regdomain * regdom_intersect(const struct ieee80211_regdomain *rd1,
@@ -2673,6 +2677,9 @@ static void reg_set_request_processed(void)* * The wireless subsystem can use this function to process * a regulatory request issued by the regulatory core. +* +* Returns: %REG_REQ_OK or %REG_REQ_IGNORE, indicating if the +* hint was processed or ignored */ static enum reg_request_treatment reg_process_hint_core (struct regulatory_request *core_request)
@@ -2729,6 +2736,9 @@ __reg_process_hint_user(struct regulatory_request *user_request)* * The wireless subsystem can use this function to process * a regulatory request initiated by userspace. +* +* Returns: %REG_REQ_OK or %REG_REQ_IGNORE, indicating if the +* hint was processed or ignored */ static enum reg_request_treatment reg_process_hint_user (struct regulatory_request *user_request)
@@ -2784,7 +2794,7 @@ __reg_process_hint_driver(struct regulatory_request *driver_request)* The wireless subsystem can use this function to process * a regulatory request issued by an 802.11 driver. * -* Returns one of the different reg request treatment values. +* Returns: one of the different reg request treatment values. */ static enum reg_request_treatment reg_process_hint_driver(struct wiphy *wiphy,
@@ -2888,7 +2898,7 @@ __reg_process_hint_country_ie(struct wiphy *wiphy,* The wireless subsystem can use this function to process * a regulatory request issued by a country Information Element. * -* Returns one of the different reg request treatment values. +* Returns: one of the different reg request treatment values. */ static enum reg_request_treatment reg_process_hint_country_ie(struct wiphy *wiphy,
Signature · 1 line
2.38.1
PATCH v2 7/18 wifi: mac80211: describe return values in kernel-doc
In reply to [email protected]From: Johannes Berg <[email protected]>
Add descriptions for two return values for two functions that are missing them.
--- net/mac80211/tx.c | 2 ++ net/mac80211/util.c | 2 ++ 2 files changed, 4 insertions(+)
net/mac80211/tx.c +2 -0
@@ -4474,6 +4474,8 @@ static void ieee80211_mlo_multicast_tx(struct net_device *dev,* @dev: incoming interface * * On failure skb will be freed. +* +* Returns: the netdev TX status (but really only %NETDEV_TX_OK) */ netdev_tx_t ieee80211_subif_start_xmit (struct sk_buff *skb,struct net_device *dev)
net/mac80211/util.c +2 -0
@@ -4146,6 +4146,8 @@ u8 ieee80211_mcs_to_chains(const struct ieee80211_mcs_info *mcs)* This function calculates the RX timestamp at the given MPDU offset, taking * into account what the RX timestamp was. An offset of 0 will just normalize * the timestamp to TSF at beginning of MPDU reception. +* +* Returns: the calculated timestamp */ u64 ieee80211_calculate_rx_timestamp(struct ieee80211_local *local, struct ieee80211_rx_status *status,
Signature · 1 line
2.38.1
PATCH v2 8/18 wifi: mac80211_hwsim: move kernel-doc description
In reply to [email protected]From: Johannes Berg <[email protected]>
Move the description after the parameter section, to make the kernel-doc script in verbose mode happy about it.
--- drivers/net/wireless/virtual/mac80211_hwsim.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-)
drivers/net/wireless/virtual/mac80211_hwsim.c +9 -9
@@ -72,15 +72,6 @@ MODULE_PARM_DESC(mlo, "Support MLO");/** * enum hwsim_regtest - the type of regulatory tests we offer * -* These are the different values you can use for the regtest -* module parameter. This is useful to help test world roaming -* and the driver regulatory_hint() call and combinations of these. -* If you want to do specific alpha2 regulatory domain tests simply -* use the userspace regulatory request as that will be respected as -* well without the need of this module parameter. This is designed -* only for testing the driver regulatory request, world roaming -* and all possible combinations. -* * @HWSIM_REGTEST_DISABLED: No regulatory tests are performed, * this is the default value. * @HWSIM_REGTEST_DRIVER_REG_FOLLOW: Used for testing the driver regulatory
@@ -125,6 +116,15 @@ MODULE_PARM_DESC(mlo, "Support MLO");* domain request * 6 and on - should follow the intersection of the 3rd, 4rth and 5th radio * regulatory requests. +* +* These are the different values you can use for the regtest +* module parameter. This is useful to help test world roaming +* and the driver regulatory_hint() call and combinations of these. +* If you want to do specific alpha2 regulatory domain tests simply +* use the userspace regulatory request as that will be respected as +* well without the need of this module parameter. This is designed +* only for testing the driver regulatory request, world roaming +* and all possible combinations. */ enum hwsim_regtest {HWSIM_REGTEST_DISABLED =0 ,
Signature · 1 line
2.38.1
PATCH v2 9/18 wifi: cfg80211: Fix 6GHz scan configuration
In reply to [email protected]From: Ilan Peer <[email protected]>
When the scan request includes a non broadcast BSSID, when adding the scan parameters for 6GHz collocated scanning, do not include entries that do not match the given BSSID.
--- net/wireless/scan.c | 4 ++++ 1 file changed, 4 insertions(+)
net/wireless/scan.c +4 -0
@@ -908,6 +908,10 @@ static int cfg80211_scan_6ghz(struct cfg80211_registered_device *rdev) !cfg80211_find_ssid_match(ap, request))continue ; +if (!is_broadcast_ether_addr (request->bssid) && + !ether_addr_equal (request->bssid, ap->bssid)) +continue ; +if (!request->n_ssids && ap->multi_bss && !ap->transmitted_bssid)continue ;
Signature · 1 line
2.38.1
PATCH v2 10/18 wifi: mac80211: work around Cisco AP 9115 VHT MPDU length
In reply to [email protected]From: Johannes Berg <[email protected]>
Cisco AP module 9115 with FW 17.3 has a bug and sends a too large maximum MPDU length in the association response (indicating 12k) that it cannot actually process.
Work around that by taking the minimum between what's in the association response and the BSS elements (from beacon or probe response).
--- net/mac80211/cfg.c | 3 ++- net/mac80211/ibss.c | 2 +- net/mac80211/ieee80211_i.h | 1 + net/mac80211/mesh_plink.c | 2 +- net/mac80211/mlme.c | 27 +++++++++++++++++++++++++-- net/mac80211/vht.c | 16 ++++++++++++++-- 6 files changed, 44 insertions(+), 7 deletions(-)
net/mac80211/cfg.c +2 -1
@@ -1836,7 +1836,8 @@ static int sta_link_apply_parameters(struct ieee80211_local *local,/* VHT can override some HT caps such as the A-MSDU max length */ if (params->vht_capa)ieee80211_vht_cap_ie_to_sta_vht_cap (sdata, sband, - params->vht_capa, link_sta); + params->vht_capa,NULL , + link_sta);if (params->he_capa) ieee80211_he_cap_ie_to_sta_he_cap(sdata, sband,
net/mac80211/ibss.c +1 -1
@@ -1046,7 +1046,7 @@ static void ieee80211_update_sta_info(struct ieee80211_sub_if_data *sdata, &chandef);memcpy (&cap_ie, elems->vht_cap_elem,sizeof (cap_ie));ieee80211_vht_cap_ie_to_sta_vht_cap (sdata, sband, - &cap_ie, + &cap_ie,NULL , &sta->deflink);if (memcmp (&cap, &sta->sta.deflink.vht_cap,sizeof (cap))) rates_updated |= true;
net/mac80211/ieee80211_i.h +1 -0
@@ -2085,6 +2085,7 @@ void ieee80211_vht_cap_ie_to_sta_vht_cap(struct ieee80211_sub_if_data *sdata, struct ieee80211_supported_band *sband, const struct ieee80211_vht_cap *vht_cap_ie, + const struct ieee80211_vht_cap *vht_cap_ie2, struct link_sta_info *link_sta);enum ieee80211_sta_rx_bandwidth ieee80211_sta_cap_rx_bw (struct link_sta_info *link_sta);
net/mac80211/mesh_plink.c +1 -1
@@ -451,7 +451,7 @@ static void mesh_sta_info_init(struct ieee80211_sub_if_data *sdata, changed |=IEEE80211_RC_BW_CHANGED ;ieee80211_vht_cap_ie_to_sta_vht_cap (sdata, sband, - elems->vht_cap_elem, + elems->vht_cap_elem,NULL , &sta->deflink); ieee80211_he_cap_ie_to_sta_he_cap(sdata, sband, elems->he_cap,
net/mac80211/mlme.c +25 -2
@@ -4162,10 +4162,33 @@ static bool ieee80211_assoc_config_link(struct ieee80211_link_data *link, elems->ht_cap_elem, link_sta); -if (elems->vht_cap_elem && !(link->u.mgd.conn_flags &IEEE80211_CONN_DISABLE_VHT )) +if (elems->vht_cap_elem && + !(link->u.mgd.conn_flags &IEEE80211_CONN_DISABLE_VHT )) { +const struct ieee80211_vht_cap *bss_vht_cap =NULL ; +const struct cfg80211_bss_ies *ies; + +/* +* Cisco AP module 9115 with FW 17.3 has a bug and sends a +* too large maximum MPDU length in the association response +* (indicating 12k) that it cannot actually process ... +* Work around that. +*/ +rcu_read_lock (); + ies =rcu_dereference (cbss->ies); +if (ies) { +const struct element *elem; + + elem =cfg80211_find_elem (WLAN_EID_VHT_CAPABILITY , + ies->data, ies->len); +if (elem && elem->datalen >=sizeof (*bss_vht_cap)) + bss_vht_cap = (const void *)elem->data; + } +ieee80211_vht_cap_ie_to_sta_vht_cap (sdata, sband, elems->vht_cap_elem, - link_sta); + bss_vht_cap, link_sta); +rcu_read_unlock (); + }if (elems->he_operation && !(link->u.mgd.conn_flags &IEEE80211_CONN_DISABLE_HE ) && elems->he_cap) {
net/mac80211/vht.c +14 -2
@@ -4,7 +4,7 @@* * Portions of this file * Copyright(c) 2015 - 2016 Intel Deutschland GmbH -* Copyright (C) 2018 - 2022 Intel Corporation +* Copyright (C) 2018 - 2023 Intel Corporation */ #include <linux/ieee80211.h>
@@ -116,12 +116,14 @@ void ieee80211_vht_cap_ie_to_sta_vht_cap(struct ieee80211_sub_if_data *sdata, struct ieee80211_supported_band *sband, const struct ieee80211_vht_cap *vht_cap_ie, + const struct ieee80211_vht_cap *vht_cap_ie2, struct link_sta_info *link_sta) { struct ieee80211_sta_vht_cap *vht_cap = &link_sta->pub->vht_cap;struct ieee80211_sta_vht_cap own_cap;u32 cap_info, i;bool have_80mhz; +u32 mpdu_len;memset (vht_cap,0 ,sizeof (*vht_cap));
@@ -317,11 +319,21 @@ ieee80211_vht_cap_ie_to_sta_vht_cap(struct ieee80211_sub_if_data *sdata, link_sta->pub->bandwidth =ieee80211_sta_cur_vht_bw (link_sta); +/* +* Work around the Cisco 9115 FW 17.3 bug by taking the min of +* both reported MPDU lengths. +*/ + mpdu_len = vht_cap->cap &IEEE80211_VHT_CAP_MAX_MPDU_MASK ; +if (vht_cap_ie2) + mpdu_len =min_t (u32, mpdu_len, +le32_get_bits (vht_cap_ie2->vht_cap_info, +IEEE80211_VHT_CAP_MAX_MPDU_MASK )); +/* * FIXME - should the amsdu len be per link? store per link * and maintain a minimum? */ -switch (vht_cap->cap &IEEE80211_VHT_CAP_MAX_MPDU_MASK ) { +switch (mpdu_len) {case IEEE80211_VHT_CAP_MAX_MPDU_LENGTH_11454 : link_sta->pub->agg.max_amsdu_len =IEEE80211_MAX_MPDU_LEN_VHT_11454 ;break ;
Signature · 1 line
2.38.1
PATCH v2 11/18 wifi: mac80211: Notify the low level driver on change in MLO valid links
In reply to [email protected]From: Ilan Peer <[email protected]>
Notify the low level driver when there is change in the valid links.
--- include/net/mac80211.h | 2 ++ net/mac80211/main.c | 3 ++- net/mac80211/mlme.c | 2 ++ 3 files changed, 6 insertions(+), 1 deletion(-)
include/net/mac80211.h +2 -0
@@ -341,6 +341,7 @@ struct ieee80211_vif_chanctx_switch {* @BSS_CHANGED_UNSOL_BCAST_PROBE_RESP: Unsolicited broadcast probe response * status changed. * @BSS_CHANGED_EHT_PUNCTURING: The channel puncturing bitmap changed. +* @BSS_CHANGED_MLD_VALID_LINKS: MLD valid links status changed. */ enum ieee80211_bss_change {BSS_CHANGED_ASSOC =1 <<0 ,
@@ -376,6 +377,7 @@ enum ieee80211_bss_change {BSS_CHANGED_FILS_DISCOVERY =1 <<30 ,BSS_CHANGED_UNSOL_BCAST_PROBE_RESP =1 <<31 ,BSS_CHANGED_EHT_PUNCTURING =BIT_ULL (32 ), + BSS_CHANGED_MLD_VALID_LINKS = BIT_ULL(33), /* when adding here, make sure to change ieee80211_reconfig */ };
net/mac80211/main.c +2 -1
@@ -207,7 +207,8 @@ int ieee80211_hw_config(struct ieee80211_local *local, u32 changed) BSS_CHANGED_PS |\ BSS_CHANGED_IBSS |\ BSS_CHANGED_ARP_FILTER |\ - BSS_CHANGED_SSID) + BSS_CHANGED_SSID |\ + BSS_CHANGED_MLD_VALID_LINKS)void ieee80211_bss_info_change_notify (struct ieee80211_sub_if_data *sdata,u64 changed)
net/mac80211/mlme.c +2 -0
@@ -5736,6 +5736,8 @@ static void ieee80211_ml_reconf_work(struct wiphy *wiphy,if (ret)sdata_info (sdata,"Failed setting valid links\n" ); +ieee80211_vif_cfg_change_notify (sdata,BSS_CHANGED_MLD_VALID_LINKS ); + out:if (!ret)cfg80211_links_removed (sdata->dev, sdata->u.mgd.removed_links);
Signature · 1 line
2.38.1
PATCH v2 12/18 wifi: mac80211_hwsim: Handle BSS_CHANGED_VALID_LINKS
In reply to [email protected]From: Ilan Peer <[email protected]>
In station mode, set the active links to all the usable links.
--- drivers/net/wireless/virtual/mac80211_hwsim.c | 8 ++++++++ 1 file changed, 8 insertions(+)
drivers/net/wireless/virtual/mac80211_hwsim.c +8 -0
@@ -2445,6 +2445,14 @@ static void mac80211_hwsim_vif_info_changed(struct ieee80211_hw *hw, vp->assoc = vif->cfg.assoc; vp->aid = vif->cfg.aid; } + +if (vif->type ==NL80211_IFTYPE_STATION && + changed &BSS_CHANGED_MLD_VALID_LINKS ) { +u16 usable_links =ieee80211_vif_usable_links (vif); + +if (vif->active_links != usable_links) +ieee80211_set_active_links_async (vif, usable_links); + } } static void mac80211_hwsim_link_info_changed(struct ieee80211_hw *hw,
Signature · 1 line
2.38.1
PATCH v2 13/18 wifi: mac80211: add support for parsing TID to Link mapping element
In reply to [email protected]From: Ayala Beker <[email protected]>
Add the relevant definitions for TID to Link mapping element according to the P802.11be_D4.0.
--- include/linux/ieee80211.h | 58 ++++++++++++++++++++++++++++++++++++++ net/mac80211/ieee80211_i.h | 3 ++ net/mac80211/util.c | 8 ++++++ 3 files changed, 69 insertions(+)
include/linux/ieee80211.h +58 -0
@@ -1246,6 +1246,30 @@ struct ieee80211_twt_setup {u8 params[]; } __packed; +#define IEEE80211_TTLM_MAX_CNT 2 +#define IEEE80211_TTLM_CONTROL_DIRECTION 0x03 +#define IEEE80211_TTLM_CONTROL_DEF_LINK_MAP 0x04 +#define IEEE80211_TTLM_CONTROL_SWITCH_TIME_PRESENT 0x08 +#define IEEE80211_TTLM_CONTROL_EXPECTED_DUR_PRESENT 0x10 +#define IEEE80211_TTLM_CONTROL_LINK_MAP_SIZE 0x20 + +#define IEEE80211_TTLM_DIRECTION_DOWN 0 +#define IEEE80211_TTLM_DIRECTION_UP 1 +#define IEEE80211_TTLM_DIRECTION_BOTH 2 + +/** +* struct ieee80211_ttlm_elem - TID-To-Link Mapping element +* +* Defined in section 9.4.2.314 in P802.11be_D4 +* +* @control: the first part of control field +* @optional: the second part of control field +*/ +struct ieee80211_ttlm_elem { +u8 control; +u8 optional[]; +} __packed; +struct ieee80211_mgmt {__le16 frame_control;__le16 duration;
@@ -3618,6 +3642,7 @@ enum ieee80211_eid_ext {WLAN_EID_EXT_EHT_OPERATION =106 ,WLAN_EID_EXT_EHT_MULTI_LINK =107 ,WLAN_EID_EXT_EHT_CAPABILITY =108 , +WLAN_EID_EXT_TID_TO_LINK_MAPPING =109 , WLAN_EID_EXT_BANDWIDTH_INDICATION = 135, };
@@ -5155,6 +5180,39 @@ static inline bool ieee80211_mle_reconf_sta_prof_size_ok(const u8 *data, fixed + prof->sta_info_len -1 <= len; } +static inline bool ieee80211_tid_to_link_map_size_ok (const u8 *data,size_t len) +{ +const struct ieee80211_ttlm_elem *t2l = (const void *)data; +u8 control, fixed =sizeof (*t2l), elem_len =0 ; + +if (len < fixed) +return false; + + control = t2l->control; + +if (control &IEEE80211_TTLM_CONTROL_SWITCH_TIME_PRESENT ) + elem_len +=2 ; +if (control &IEEE80211_TTLM_CONTROL_EXPECTED_DUR_PRESENT ) + elem_len +=3 ; + +if (!(control &IEEE80211_TTLM_CONTROL_DEF_LINK_MAP )) { +u8 bm_size; + + elem_len +=1 ; +if (len < fixed + elem_len) +return false; + +if (control &IEEE80211_TTLM_CONTROL_LINK_MAP_SIZE ) + bm_size =1 ; +else + bm_size =2 ; + + elem_len +=hweight8 (t2l->optional[0 ]) * bm_size; + } + +return len >= fixed + elem_len; +} +#define for_each_mle_subelement (_elem, _data, _len) \ if (ieee80211_mle_size_ok(_data, _len)) \ for_each_element(_elem, \
net/mac80211/ieee80211_i.h +3 -0
@@ -1678,6 +1678,7 @@ struct ieee802_11_elems {const struct ieee80211_multi_link_elem *ml_basic;const struct ieee80211_multi_link_elem *ml_reconf;const struct ieee80211_bandwidth_indication *bandwidth_indication; +const struct ieee80211_ttlm_elem *ttlm[IEEE80211_TTLM_MAX_CNT ];/* length of them, respectively */ u8 ext_capab_len;
@@ -1711,6 +1712,8 @@ struct ieee802_11_elems {/* The reconfiguration Multi-Link element in the original IEs */ const struct element *ml_reconf_elem; +u8 ttlm_num; +/* * store the per station profile pointer and length in case that the * parsing also handled Multi-Link element parsing for a specific link
net/mac80211/util.c +8 -0
@@ -995,6 +995,14 @@ ieee80211_parse_extension_element(u32 *crc, elems->bandwidth_indication = data; calc_crc = true;break ; +case WLAN_EID_EXT_TID_TO_LINK_MAPPING : + calc_crc = true; +if (ieee80211_tid_to_link_map_size_ok (data, len) && + elems->ttlm_num <ARRAY_SIZE (elems->ttlm)) { + elems->ttlm[elems->ttlm_num] = (void *)data; + elems->ttlm_num++; + } +break ; }if (crc && calc_crc)
Signature · 1 line
2.38.1
PATCH v2 14/18 wifi: mac80211: support handling of advertised TID-to-link mapping
In reply to [email protected]From: Ayala Beker <[email protected]>
Support handling of advertised TID-to-link mapping elements received in a beacon.
These elements are used by AP MLD to disable specific links and force all clients to stop using these links.
By default if no TID-to-link mapping is advertised, all TIDs shall be mapped to all links.
--- net/mac80211/ieee80211_i.h | 15 +++ net/mac80211/mlme.c | 196 +++++++++++++++++++++++++++++++++++++ 2 files changed, 211 insertions(+)
net/mac80211/ieee80211_i.h +15 -0
@@ -467,6 +467,17 @@ struct ieee80211_sta_tx_tspec {bool downgraded; }; +/* Advertised TID-to-link mapping info */ +struct ieee80211_adv_ttlm_info { +/* time in TUs at which the new mapping is established, or 0 if there is +* no planned advertised TID-to-link mapping +*/ +u16 switch_time; +u32 duration;/* duration of the planned T2L map in TUs */ +u16 map;/* map of usable links for all TIDs */ +bool active;/* whether the advertised mapping is active or not */ +}; + DECLARE_EWMA(beacon_signal, 4, 4)struct ieee80211_if_managed {
@@ -560,6 +571,10 @@ struct ieee80211_if_managed {struct wiphy_delayed_work ml_reconf_work;u16 removed_links; + +/* TID-to-link mapping support */ +struct wiphy_delayed_work ttlm_work; +struct ieee80211_adv_ttlm_info ttlm_info; };struct ieee80211_if_ibss {
net/mac80211/mlme.c +196 -0
226 lines not on this page · raw message
Signature · 1 line
2.38.1
PATCH v2 15/18 wifi: mac80211: support antenna control in injection
In reply to [email protected]From: Johannes Berg <[email protected]>
Support antenna control for injection by parsing the antenna radiotap field (which may be presented multiple times) and telling the driver about the resulting antenna bitmap. Of course there's no guarantee the driver will actually honour this, just like any other injection control.
If misconfigured, i.e. the injected HT/VHT MCS needs more chains than antennas are configured, the bitmap is reset to zero, indicating no selection.
For now this is only set up for two anntenas so we keep more free bits, but that can be trivially extended if any driver implements support for it that can deal with hardware with more antennas.
--- include/linux/ieee80211.h | 2 ++ include/net/mac80211.h | 6 +++++- net/mac80211/tx.c | 14 ++++++++++++++ 3 files changed, 21 insertions(+), 1 deletion(-)
include/linux/ieee80211.h +2 -0
@@ -1705,6 +1705,8 @@ struct ieee80211_mcs_info {#define IEEE80211_HT_MCS_TX_MAX_STREAMS 4#define IEEE80211_HT_MCS_TX_UNEQUAL_MODULATION 0x10 +#define IEEE80211_HT_MCS_CHAINS (mcs) ((mcs) == 32 ? 1 : (1 + ((mcs) >> 3))) +/* * 802.11n D5.0 20.3.5 / 20.6 says: * - indices 0 to 7 and 32 are single spatial stream
include/net/mac80211.h +5 -1
@@ -1178,7 +1178,11 @@ struct ieee80211_tx_info { u8 use_cts_prot:1; u8 short_preamble:1; u8 skip_table:1; -/* 2 bytes free */ + +/* for injection only (bitmap) */ + u8 antennas:2; + +/* 14 bits free */ };/* only needed before rate control */ unsigned long jiffies;
net/mac80211/tx.c +14 -0
@@ -2162,6 +2162,11 @@ bool ieee80211_parse_tx_radiotap(struct sk_buff *skb, rate_found = true;break ; +case IEEE80211_RADIOTAP_ANTENNA : +/* this can appear multiple times, keep a bitmap */ + info->control.antennas |=BIT (*iterator.this_arg); +break ; +case IEEE80211_RADIOTAP_DATA_RETRIES : rate_retries = *iterator.this_arg;break ;
@@ -2256,8 +2261,17 @@ bool ieee80211_parse_tx_radiotap(struct sk_buff *skb, }if (rate_flags &IEEE80211_TX_RC_MCS ) { +/* reset antennas if not enough */ +if (IEEE80211_HT_MCS_CHAINS (rate) > +hweight8 (info->control.antennas)) + info->control.antennas =0 ; + info->control.rates[0 ].idx = rate; }else if (rate_flags &IEEE80211_TX_RC_VHT_MCS ) { +/* reset antennas if not enough */ +if (vht_nss >hweight8 (info->control.antennas)) + info->control.antennas =0 ; +ieee80211_rate_set_vht (info->control.rates, vht_mcs, vht_nss); }else if (sband) {
Signature · 1 line
2.38.1
PATCH v2 16/18 wifi: cfg80211: report per-link errors during association
In reply to [email protected]From: Benjamin Berg <[email protected]>
When one of the links (other than the assoc_link) is misconfigured and cannot work the association will fail. However, userspace was not able to tell that the operation only failed because of a problem with one of the links. Fix this, by allowing the driver to set a per-link error code and reporting the (first) offending link by setting the bad_attr accordingly.
This only allows us to report the first error, but that is sufficient for userspace to e.g. remove the offending link and retry.
--- include/net/cfg80211.h | 3 +++ net/wireless/nl80211.c | 50 +++++++++++++++++++++++++++++++++++++----- 2 files changed, 47 insertions(+), 6 deletions(-)
include/net/cfg80211.h +3 -0
@@ -2964,12 +2964,15 @@ struct cfg80211_auth_request {* @elems_len: length of the elements * @disabled: If set this link should be included during association etc. but it * should not be used until enabled by the AP MLD. +* @error: per-link error code, must be <= 0. If there is an error, then the +* operation as a whole must fail. */ struct cfg80211_assoc_link {struct cfg80211_bss *bss;const u8 *elems;size_t elems_len;bool disabled; +int error; };/**
net/wireless/nl80211.c +44 -6
98 lines not on this page · raw message
Signature · 1 line
2.38.1
PATCH v2 17/18 wifi: mac80211: report per-link error during association
In reply to [email protected]From: Benjamin Berg <[email protected]>
With this cfg80211 can report the link that caused the error to userspace which is then able to react to it by e.g. removing the link from the association and retrying.
--- net/mac80211/mlme.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
net/mac80211/mlme.c +3 -1
@@ -7889,8 +7889,10 @@ int ieee80211_mgd_assoc(struct ieee80211_sub_if_data *sdata,/* only calculate the flags, hence link == NULL */ err =ieee80211_prep_channel (sdata,NULL , assoc_data->link[i].bss, &assoc_data->link[i].conn_flags); -if (err) +if (err) { + req->links[i].error = err; goto err_clear; + } }/* needed for transmitting the assoc frames properly */
Signature · 1 line
2.38.1
PATCH v2 18/18 wifi: mac80211: reject MLO channel configuration if not supported
In reply to [email protected]From: Benjamin Berg <[email protected]>
Reject configuring a channel for MLO if either EHT is not supported or the BSS does not have the correct ML element. This avoids trying to do a multi-link association with a misconfigured AP.
--- net/mac80211/mlme.c | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-)
net/mac80211/mlme.c +13 -3
@@ -4778,6 +4778,7 @@ ieee80211_verify_sta_eht_mcs_support(struct ieee80211_sub_if_data *sdata,static int ieee80211_prep_channel (struct ieee80211_sub_if_data *sdata,struct ieee80211_link_data *link,struct cfg80211_bss *cbss, +bool mlo,ieee80211_conn_flags_t *conn_flags) {struct ieee80211_local *local = sdata->local;
@@ -4791,6 +4792,7 @@ static int ieee80211_prep_channel(struct ieee80211_sub_if_data *sdata,struct cfg80211_chan_def chandef;bool is_6ghz = cbss->channel->band ==NL80211_BAND_6GHZ ;bool is_5ghz = cbss->channel->band ==NL80211_BAND_5GHZ ; +bool supports_mlo = false;struct ieee80211_bss *bss = (void *)cbss->priv;struct ieee80211_elems_parse_params parse_params = { .link_id =-1 ,
@@ -4944,6 +4946,8 @@ static int ieee80211_prep_channel(struct ieee80211_sub_if_data *sdata,ieee80211_mle_type_ok (eht_ml_elem->data +1 ,IEEE80211_ML_CONTROL_TYPE_BASIC , eht_ml_elem->datalen - 1)) { + supports_mlo = true; + sdata->vif.cfg.eml_cap =ieee80211_mle_get_eml_cap (eht_ml_elem->data +1 ); sdata->vif.cfg.eml_med_sync_delay =
@@ -4999,6 +5003,11 @@ static int ieee80211_prep_channel(struct ieee80211_sub_if_data *sdata,return -EINVAL ; } +if (mlo && !supports_mlo) { +sdata_info (sdata,"Rejecting MLO as it is not supported by AP\n" ); +return -EINVAL ; + } +if (!link)return 0 ;
@@ -5147,7 +5156,7 @@ static bool ieee80211_assoc_success(struct ieee80211_sub_if_data *sdata, link->conf->dtim_period = link->u.mgd.dtim_period ?:1 ;if (link_id != assoc_data->assoc_link_id) { - err =ieee80211_prep_channel (sdata, link, cbss, + err =ieee80211_prep_channel (sdata, link, cbss, true, &link->u.mgd.conn_flags);if (err) {link_info (link,"prep_channel failed\n" );
@@ -7182,7 +7191,7 @@ static int ieee80211_prep_connection(struct ieee80211_sub_if_data *sdata, }if (new_sta || override) { - err =ieee80211_prep_channel (sdata, link, cbss, + err =ieee80211_prep_channel (sdata, link, cbss, mlo, &link->u.mgd.conn_flags);if (err) {if (new_sta)
@@ -7887,7 +7896,8 @@ int ieee80211_mgd_assoc(struct ieee80211_sub_if_data *sdata,if (i == assoc_data->assoc_link_id)continue ;/* only calculate the flags, hence link == NULL */ - err =ieee80211_prep_channel (sdata,NULL , assoc_data->link[i].bss, + err =ieee80211_prep_channel (sdata,NULL , + assoc_data->link[i].bss, true, &assoc_data->link[i].conn_flags);if (err) { req->links[i].error = err;
Signature · 1 line
2.38.1