wifi: mac80211: refactoring towards SMD transition
Subsystems (2)
Johannes Berg
maintainercover wifi: mac80211: refactoring towards SMD transition
So I realize this doesn't make a ton of sense as is, but all the SMD transition patches don't really work in a single series.
Mostly refactoring and parsing SMD elements, and the first-link inheritance used for those frames. Patch 3 is because I'll be putting the SMD transition code into a new file, it's a lot of code.
johannes
Johannes Berg
maintainerPATCH 1/8 wifi: mac80211: refactor link handling
From: Johannes Berg <[email protected]>
For SMD transition, we're going to have to allocate links that are for the connection to the target AP MLD, which are not linked into the vif/sdata yet.
Refactor the link allocation, attaching, detaching and freeing so that we can separately allocate (and free on abandon) those links; expose those functions.
Actually swapping over to the new links during SMD Transition will require more work, however.
While at it add a missing synchronize_rcu() on the error path, the links were previously published in the data structure.
--- net/mac80211/ieee80211_i.h | 5 ++ net/mac80211/iface.c | 1 + net/mac80211/link.c | 132 ++++++++++++++++++++++++++----------- 3 files changed, 98 insertions(+), 40 deletions(-)
net/mac80211/ieee80211_i.h +5 -0
@@ -2265,6 +2265,11 @@ void ieee80211_link_init(struct ieee80211_sub_if_data *sdata,int link_id, struct ieee80211_link_data *link, struct ieee80211_bss_conf *link_conf); +struct ieee80211_link_data * +ieee80211_alloc_link (struct ieee80211_sub_if_data *sdata,int link_id); +void ieee80211_free_link (struct ieee80211_link_data *link); +void ieee80211_link_attach (struct ieee80211_link_data *link); +void ieee80211_link_detach (struct ieee80211_link_data *link);void ieee80211_link_stop (struct ieee80211_link_data *link);int ieee80211_vif_set_links (struct ieee80211_sub_if_data *sdata,u16 new_links,u16 dormant_links);
net/mac80211/iface.c +1 -0
@@ -1252,6 +1252,7 @@ static void ieee80211_sdata_init(struct ieee80211_local *local,* MLD connection, we get a separate allocation for it. */ ieee80211_link_init (sdata,-1 , &sdata->deflink, &sdata->vif.bss_conf); +ieee80211_link_attach (&sdata->deflink); } int ieee80211_add_virtual_monitor(struct ieee80211_local *local,
net/mac80211/link.c +92 -40
224 lines not on this page · raw message
Signature · 1 line
2.56.0
Johannes Berg
maintainerPATCH 2/8 wifi: mac80211: factor out ieee80211_mgd_reset_ap_state()
In reply to Johannes BergFrom: Johannes Berg <[email protected]>
ieee80211_set_disassoc() resets all the AP state, but most of that will also need to be reset during SMD Transition. Factor out parts into a new ieee80211_mgd_reset_ap_state() function to be able to reuse it later, and add some things that should have been in it (e.g. cancelling works).
--- net/mac80211/mlme.c | 76 ++++++++++++++++++++++++++------------------- 1 file changed, 44 insertions(+), 32 deletions(-)
net/mac80211/mlme.c +44 -32
@@ -4584,6 +4584,49 @@ static u8 ieee80211_mgd_next_dialog_token(struct ieee80211_sub_if_data *sdata)return sdata->u.mgd.dialog_token_alloc; } +static void ieee80211_mgd_reset_ap_state (struct ieee80211_sub_if_data *sdata) +{ +struct ieee80211_if_managed *ifmgd = &sdata->u.mgd; +struct wiphy *wiphy = sdata->local->hw.wiphy; + +ieee80211_stop_poll (sdata); +wiphy_work_cancel (wiphy, &ifmgd->monitor_work); +wiphy_work_cancel (wiphy, &ifmgd->beacon_connection_loss_work); +wiphy_work_cancel (wiphy, &ifmgd->csa_connection_drop_work); + +/* existing TX TSPEC sessions no longer exist */ +memset (ifmgd->tx_tspec,0 ,sizeof (ifmgd->tx_tspec)); +wiphy_delayed_work_cancel (wiphy, &ifmgd->tx_tspec_wk); + +memset (&ifmgd->ttlm_info,0 ,sizeof (ifmgd->ttlm_info)); +wiphy_hrtimer_work_cancel (wiphy, &ifmgd->ttlm_work); + +memset (&sdata->vif.neg_ttlm,0 ,sizeof (sdata->vif.neg_ttlm)); +wiphy_delayed_work_cancel (wiphy, &ifmgd->neg_ttlm_timeout_work); + + ifmgd->removed_links =0 ; +wiphy_hrtimer_work_cancel (wiphy, &ifmgd->ml_reconf_work); + +wiphy_work_cancel (wiphy, &ifmgd->teardown_ttlm_work); + +/* +* if disconnection happens in the middle of the ML reconfiguration +* flow, cfg80211 must called to release the BSS references obtained +* when the flow started. +*/ +ieee80211_ml_reconf_reset (sdata); + + ifmgd->mcast_seq_last =IEEE80211_SN_MODULO ; + + ifmgd->epcs.dialog_token =0 ; + + ifmgd->uhr_omp.links =0 ; + ifmgd->uhr_omp.acked = false; + ifmgd->uhr_omp.pending =0 ; + ifmgd->uhr_omp.pending_init =0 ; +wiphy_hrtimer_work_cancel (wiphy, &ifmgd->uhr_omp.status_work); +} +static void ieee80211_set_disassoc (struct ieee80211_sub_if_data *sdata,u16 stype,u16 reason,bool tx,u8 *frame_buf)
@@ -4613,8 +4656,6 @@ static void ieee80211_set_disassoc(struct ieee80211_sub_if_data *sdata,if (WARN_ON (!ifmgd->associated))return ; -ieee80211_stop_poll (sdata); - ifmgd->associated = false;if (tx) {
@@ -4796,10 +4837,6 @@ static void ieee80211_set_disassoc(struct ieee80211_sub_if_data *sdata, sdata->deflink.u.mgd.csa.ignored_same_chan = false;ieee80211_vif_unblock_queues_csa (sdata); -/* existing TX TSPEC sessions no longer exist */ -memset (ifmgd->tx_tspec,0 ,sizeof (ifmgd->tx_tspec)); -wiphy_delayed_work_cancel (local->hw.wiphy, &ifmgd->tx_tspec_wk); - sdata->vif.bss_conf.power_type =IEEE80211_REG_UNSET_AP ; sdata->vif.bss_conf.pwr_reduction =0 ;ieee80211_clear_tpe (&sdata->vif.bss_conf.tpe);
@@ -4808,39 +4845,14 @@ static void ieee80211_set_disassoc(struct ieee80211_sub_if_data *sdata, sdata->vif.cfg.eml_med_sync_delay =0 ; sdata->vif.cfg.mld_capa_op =0 ; -memset (&sdata->u.mgd.ttlm_info,0 , -sizeof (sdata->u.mgd.ttlm_info)); -wiphy_hrtimer_work_cancel (sdata->local->hw.wiphy, &ifmgd->ttlm_work); - -memset (&sdata->vif.neg_ttlm,0 ,sizeof (sdata->vif.neg_ttlm)); -wiphy_delayed_work_cancel (sdata->local->hw.wiphy, - &ifmgd->neg_ttlm_timeout_work); - - sdata->u.mgd.removed_links =0 ; -wiphy_hrtimer_work_cancel (sdata->local->hw.wiphy, - &sdata->u.mgd.ml_reconf_work); - -wiphy_work_cancel (sdata->local->hw.wiphy, - &ifmgd->teardown_ttlm_work); - -/* if disconnection happens in the middle of the ML reconfiguration -* flow, cfg80211 must called to release the BSS references obtained -* when the flow started. -*/ -ieee80211_ml_reconf_reset (sdata); +ieee80211_mgd_reset_ap_state (sdata);ieee80211_vif_set_links (sdata,0 ,0 ); - ifmgd->mcast_seq_last =IEEE80211_SN_MODULO ; - ifmgd->epcs.enabled = false; - ifmgd->epcs.dialog_token =0 ;memset (ifmgd->userspace_selectors,0 ,sizeof (ifmgd->userspace_selectors)); - - ifmgd->uhr_omp.pending =0 ; - ifmgd->uhr_omp.pending_init =0 ; }static void ieee80211_reset_ap_probe (struct ieee80211_sub_if_data *sdata)
Signature · 1 line
2.56.0
Johannes Berg
maintainerPATCH 3/8 wifi: mac80211: expose MLME functions
In reply to Johannes BergFrom: Johannes Berg <[email protected]>
SMD transition is a large chunk of code that will go into its own file. Expose the necessary functionality from mlme.c in a new mlme.h (this is because it should only be used by the ST code.)
Refactor ieee80211_prep_channel() a bit to have a new function that doesn't actually allocate the chanctx, which is needed for SMD Transition as well.
--- net/mac80211/mlme.c | 193 ++++++++++++++++++++++++++------------------ net/mac80211/mlme.h | 55 +++++++++++++ 2 files changed, 169 insertions(+), 79 deletions(-) create mode 100644 net/mac80211/mlme.h
net/mac80211/mlme.c +114 -79
@@ -26,6 +26,7 @@#include <linux/unaligned.h> #include "ieee80211_i.h" +#include "mlme.h" #include "driver-ops.h" #include "rate.h" #include "led.h"
@@ -105,8 +106,7 @@ MODULE_PARM_DESC(probe_wait_ms,* has happened -- the work that runs from this timer will * do that. */ -static void run_again (struct ieee80211_sub_if_data *sdata, -unsigned long timeout) +void run_again (struct ieee80211_sub_if_data *sdata,unsigned long timeout) {lockdep_assert_wiphy (sdata->local->hw.wiphy);
@@ -1505,8 +1505,8 @@ ieee80211_determine_chan_mode(struct ieee80211_sub_if_data *sdata, }EXPORT_SYMBOL_IF_MAC80211_KUNIT (ieee80211_determine_chan_mode); -static void ieee80211_send_uhr_omp_req_dbe (struct ieee80211_sub_if_data *sdata, -u16 link_mask,bool initial) +void ieee80211_send_uhr_omp_req_dbe (struct ieee80211_sub_if_data *sdata, +u16 link_mask,bool initial) {struct ieee80211_mle_basic_common_info *common;struct ieee80211_mle_per_sta_profile *per_sta;
@@ -2204,7 +2204,6 @@ static size_t ieee80211_add_before_reg_conn(struct sk_buff *skb,return noffset; } -#define PRESENT_ELEMS_MAX 8#define PRESENT_ELEM_EXT_OFFS 0x100 static void
@@ -2214,16 +2213,15 @@ ieee80211_assoc_add_ml_elem(struct ieee80211_sub_if_data *sdata,const u16 *present_elems, struct ieee80211_mgd_assoc_data *assoc_data); -static size_t -ieee80211_add_link_elems (struct ieee80211_sub_if_data *sdata, -struct sk_buff *skb,u16 *capab, -const struct element *ext_capa, -const u8 *extra_elems, -size_t extra_elems_len, -unsigned int link_id, -struct ieee80211_link_data *link, -u16 *present_elems, -struct ieee80211_mgd_assoc_data *assoc_data) +size_t ieee80211_add_link_elems (struct ieee80211_sub_if_data *sdata, +struct sk_buff *skb,u16 *capab, +const struct element *ext_capa, +const u8 *extra_elems, +size_t extra_elems_len, +unsigned int link_id, +struct ieee80211_link_data *link, +u16 *present_elems, +struct ieee80211_mgd_assoc_data *assoc_data) {enum nl80211_iftype iftype =ieee80211_vif_type_p2p (&sdata->vif);struct cfg80211_bss *cbss = assoc_data->link[link_id].bss;
@@ -2421,9 +2419,9 @@ ieee80211_add_link_elems(struct ieee80211_sub_if_data *sdata,return offset; } -static void ieee80211_add_non_inheritance_elem (struct sk_buff *skb, -const u16 *outer, -const u16 *inner) +void ieee80211_add_non_inheritance_elem (struct sk_buff *skb, +const u16 *outer, +const u16 *inner) {unsigned int skb_len = skb->len;bool at_extension = false;
@@ -2595,11 +2593,10 @@ ieee80211_assoc_add_ml_elem(struct ieee80211_sub_if_data *sdata,ieee80211_fragment_element (skb, ml_elem_len,WLAN_EID_FRAGMENT ); } -static int -ieee80211_link_common_elems_size (struct ieee80211_sub_if_data *sdata, -enum nl80211_iftype iftype, -struct cfg80211_bss *cbss, -size_t elems_len) +int ieee80211_link_common_elems_size (struct ieee80211_sub_if_data *sdata, +enum nl80211_iftype iftype, +struct cfg80211_bss *cbss, +size_t elems_len) {struct ieee80211_local *local = sdata->local;const struct ieee80211_sband_iftype_data *iftd;
@@ -4399,8 +4396,8 @@ static u64 ieee80211_handle_bss_capability(struct ieee80211_link_data *link,return changed; } -static u64 ieee80211_link_set_associated (struct ieee80211_link_data *link, -struct cfg80211_bss *cbss) +u64 ieee80211_link_set_associated (struct ieee80211_link_data *link, +struct cfg80211_bss *cbss) {struct ieee80211_sub_if_data *sdata = link->sdata;struct ieee80211_bss_conf *bss_conf = link->conf;
@@ -4574,7 +4571,7 @@ static void ieee80211_ml_reconf_reset(struct ieee80211_sub_if_data *sdata) } } -static u8 ieee80211_mgd_next_dialog_token (struct ieee80211_sub_if_data *sdata) +u8 ieee80211_mgd_next_dialog_token (struct ieee80211_sub_if_data *sdata) { sdata->u.mgd.dialog_token_alloc++;
@@ -4584,7 +4581,7 @@ static u8 ieee80211_mgd_next_dialog_token(struct ieee80211_sub_if_data *sdata)return sdata->u.mgd.dialog_token_alloc; } -static void ieee80211_mgd_reset_ap_state (struct ieee80211_sub_if_data *sdata) +void ieee80211_mgd_reset_ap_state (struct ieee80211_sub_if_data *sdata) {struct ieee80211_if_managed *ifmgd = &sdata->u.mgd;struct wiphy *wiphy = sdata->local->hw.wiphy;
@@ -5122,7 +5119,7 @@ static void ieee80211_report_disconnect(struct ieee80211_sub_if_data *sdata,drv_event_callback (sdata->local, sdata, &event); } -static void __ieee80211_disconnect (struct ieee80211_sub_if_data *sdata) +void __ieee80211_disconnect (struct ieee80211_sub_if_data *sdata) {struct ieee80211_local *local = sdata->local;struct ieee80211_if_managed *ifmgd = &sdata->u.mgd;
@@ -6444,9 +6441,9 @@ static bool ieee80211_assoc_config_link(struct ieee80211_link_data *link,return ret; } -static int ieee80211_mgd_setup_link_sta (struct ieee80211_link_data *link, -struct link_sta_info *link_sta, -struct cfg80211_bss *cbss) +int ieee80211_mgd_setup_link_sta (struct ieee80211_link_data *link, +struct link_sta_info *link_sta, +struct cfg80211_bss *cbss) {struct ieee80211_sub_if_data *sdata = link->sdata;struct ieee80211_local *local = sdata->local;
@@ -6601,12 +6598,11 @@ static u8 ieee80211_max_rx_chains(struct ieee80211_link_data *link,return chains; } -static void -ieee80211_determine_our_sta_mode (struct ieee80211_sub_if_data *sdata, -struct ieee80211_supported_band *sband, -struct cfg80211_assoc_request *req, -bool wmm_used,int link_id, -struct ieee80211_conn_settings *conn) +void ieee80211_determine_our_sta_mode (struct ieee80211_sub_if_data *sdata, +struct ieee80211_supported_band *sband, +struct cfg80211_assoc_request *req, +bool wmm_used,int link_id, +struct ieee80211_conn_settings *conn) {struct ieee80211_sta_ht_cap sta_ht_cap = sband->ht_cap;bool is_5ghz = sband->band ==NL80211_BAND_5GHZ ;
@@ -6855,37 +6851,34 @@ ieee80211_determine_our_sta_mode_assoc(struct ieee80211_sub_if_data *sdata, conn->bw_limit, tmp.bw_limit); } -static int ieee80211_prep_channel (struct ieee80211_sub_if_data *sdata, -struct ieee80211_link_data *link, -struct link_sta_info *link_sta, -int link_id, -struct cfg80211_bss *cbss,bool mlo, -struct ieee80211_conn_settings *conn, -unsigned long *userspace_selectors) +static int __ieee80211_calc_channel (struct ieee80211_sub_if_data *sdata, +struct ieee80211_link_data *link, +struct link_sta_info *link_sta, +int link_id, +struct cfg80211_bss *cbss,bool mlo, +struct ieee80211_conn_settings *conn, +unsigned long *userspace_selectors, +struct ieee80211_chan_req *chanreq) {struct ieee80211_local *local = sdata->local;bool is_6ghz = cbss->channel->band ==NL80211_BAND_6GHZ ; -struct ieee80211_chan_req chanreq = {};struct cfg80211_chan_def ap_chandef;struct ieee802_11_elems *elems; -int ret;lockdep_assert_wiphy (local->hw.wiphy); -rcu_read_lock (); +guard (rcu)(); + elems =ieee80211_determine_chan_mode (sdata, conn, cbss, link_sta, link_id, - &chanreq, &ap_chandef, + chanreq, &ap_chandef, userspace_selectors); -if (IS_ERR (elems)) { -rcu_read_unlock (); +if (IS_ERR (elems))return PTR_ERR (elems); - }if (mlo && !elems->ml_basic) {sdata_info (sdata,"Rejecting MLO as it is not supported by AP\n" ); -rcu_read_unlock ();kfree (elems);return -EINVAL ; }
@@ -6908,20 +6901,36 @@ static int ieee80211_prep_channel(struct ieee80211_sub_if_data *sdata, link->conf->tpe = elems->tpe;ieee80211_rearrange_tpe (&link->conf->tpe, &ap_chandef, - &chanreq.oper); + &chanreq->oper); } -rcu_read_unlock (); -/* the element data was RCU protected so no longer valid anyway */ +kfree (elems); - elems =NULL ;if (!link)return 0 ; -rcu_read_lock (); link->needed_rx_chains =min (ieee80211_max_rx_chains (link, cbss), local->rx_chains); -rcu_read_unlock (); + +return 0 ; +} + +static int ieee80211_prep_channel (struct ieee80211_sub_if_data *sdata, +struct ieee80211_link_data *link, +struct link_sta_info *link_sta, +int link_id, +struct cfg80211_bss *cbss,bool mlo, +struct ieee80211_conn_settings *conn, +unsigned long *userspace_selectors) +{ +struct ieee80211_chan_req chanreq = {}; +int ret; + + ret =__ieee80211_calc_channel (sdata, link, link_sta, link_id, cbss, + mlo, conn, userspace_selectors, + &chanreq); +if (ret || !link) +return ret;/* * If this fails (possibly due to channel context sharing
@@ -6945,6 +6954,27 @@ static int ieee80211_prep_channel(struct ieee80211_sub_if_data *sdata,return ret; } +int ieee80211_calc_channel (struct ieee80211_sub_if_data *sdata, +struct ieee80211_link_data *link, +struct link_sta_info *link_sta, +int link_id, +struct cfg80211_bss *cbss,bool mlo, +struct ieee80211_conn_settings *conn, +unsigned long *userspace_selectors) +{ +struct ieee80211_chan_req chanreq = {}; +int ret; + + ret =__ieee80211_calc_channel (sdata, link, link_sta, link_id, cbss, + mlo, conn, userspace_selectors, + &chanreq); +if (ret || !link) +return ret; + + link->conf->chanreq = chanreq; +return 0 ; +} +static bool ieee80211_get_dtim (const struct cfg80211_bss_ies *ies,u8 *dtim_count,u8 *dtim_period) {
@@ -6979,6 +7009,28 @@ static bool ieee80211_get_dtim(const struct cfg80211_bss_ies *ies,return true; } +void ieee80211_mgd_link_beacon_info (struct ieee80211_link_data *link, +struct cfg80211_bss *cbss) +{ +if (!link->u.mgd.have_beacon) { +const struct cfg80211_bss_ies *ies; + +rcu_read_lock (); + ies =rcu_dereference (cbss->beacon_ies); +if (ies) + link->u.mgd.have_beacon = true; +else + ies =rcu_dereference (cbss->ies); +ieee80211_get_dtim (ies, + &link->conf->sync_dtim_count, + &link->u.mgd.dtim_period); + link->conf->beacon_int = cbss->beacon_interval; +rcu_read_unlock (); + } + + link->conf->dtim_period = link->u.mgd.dtim_period ?:1 ; +} +static u16 ieee80211_get_ttlm (u8 bm_size,u8 *data) {if (bm_size ==1 )
@@ -7186,23 +7238,7 @@ static bool ieee80211_assoc_success(struct ieee80211_sub_if_data *sdata,if (WARN_ON (!link_sta)) goto out_err; -if (!link->u.mgd.have_beacon) { -const struct cfg80211_bss_ies *ies; - -rcu_read_lock (); - ies =rcu_dereference (cbss->beacon_ies); -if (ies) - link->u.mgd.have_beacon = true; -else - ies =rcu_dereference (cbss->ies); -ieee80211_get_dtim (ies, - &link->conf->sync_dtim_count, - &link->u.mgd.dtim_period); - link->conf->beacon_int = cbss->beacon_interval; -rcu_read_unlock (); - } - - link->conf->dtim_period = link->u.mgd.dtim_period ?:1 ; +ieee80211_mgd_link_beacon_info (link, cbss);if (link_id != assoc_data->assoc_link_id) { link->u.mgd.conn = assoc_data->link[link_id].conn;
@@ -10345,10 +10381,9 @@ ieee80211_setup_assoc_link(struct ieee80211_sub_if_data *sdata, } } -static int -ieee80211_mgd_get_ap_ht_vht_capa (struct ieee80211_sub_if_data *sdata, -struct ieee80211_mgd_assoc_data *assoc_data, -int link_id) +int ieee80211_mgd_get_ap_ht_vht_capa (struct ieee80211_sub_if_data *sdata, +struct ieee80211_mgd_assoc_data *assoc_data, +int link_id) {struct cfg80211_bss *cbss = assoc_data->link[link_id].bss;enum nl80211_band band = cbss->channel->band;
net/mac80211/mlme.h new file +55 -0
55 lines not on this page · raw message
Signature · 1 line
2.56.0
Johannes Berg
maintainerPATCH 4/8 wifi: define SMD Transition frame formats
In reply to Johannes BergFrom: Johannes Berg <[email protected]>
Define structures and flags for various bits and pieces of frames and elements used during SMD Transition, per Draft 802.11bn D2.0.
--- include/linux/ieee80211-eht.h | 5 + include/linux/ieee80211-uhr.h | 315 ++++++++++++++++++++++++++++++++++ include/linux/ieee80211.h | 1 + 3 files changed, 321 insertions(+)
include/linux/ieee80211-eht.h +5 -0
@@ -772,6 +772,9 @@ static inline u16 ieee80211_mle_get_mld_capa_op(const u8 *data)#define IEEE80211_EHT_ML_EXT_MLD_CAPA_BTM_MLD_RECO_MULTI_AP 0x0080/* defined by UHR Draft P802.11bn_D1.5 Figure 9-1168 */ #define IEEE80211_UHR_ML_EXT_MLD_CAPA_ML_PM 0x0100 +/* defined by UHR Draft P802.11bn_D2.0 Figure 9-1171 */ +#define IEEE80211_UHR_ML_EXT_MLD_CAPA_MAX_DL_BA_BITMAP_LEN 0x1c00 +#define IEEE80211_UHR_ML_EXT_MLD_CAPA_DL_DUAL_BA 0x2000/** * ieee80211_mle_get_ext_mld_capa_op - returns the extended MLD capabilities
@@ -1159,6 +1162,8 @@ ieee80211_mle_basic_sta_prof_enh_crit_upd(const struct ieee80211_mle_per_sta_pro#define IEEE80211_MLE_STA_RECONF_CONTROL_OPERATION_TYPE_DEL_LINK 3#define IEEE80211_MLE_STA_RECONF_CONTROL_OPERATION_TYPE_NSTR_STATUS 4#define IEEE80211_MLE_STA_RECONF_CONTROL_OPERATION_TYPE_UHR_OMP_UPD 5 +#define IEEE80211_MLE_STA_RECONF_CONTROL_OPERATION_TYPE_DEL_ST_PREP 6 +#define IEEE80211_MLE_STA_RECONF_CONTROL_OPERATION_TYPE_ST_LINK_DISABLE 7#define IEEE80211_MLE_STA_RECONF_CONTROL_OPERATION_PARAMS_PRESENT 0x0800#define IEEE80211_MLE_STA_RECONF_CONTROL_OPERATION_NSTR_BMAP_SIZE 0x1000#define IEEE80211_MLE_STA_RECONF_CONTROL_OPERATION_NSTR_IND_BMAP_PRES 0x2000
include/linux/ieee80211-uhr.h +315 -0
331 lines not on this page · raw message
include/linux/ieee80211.h +1 -0
@@ -1815,6 +1815,7 @@ enum ieee80211_eid_ext {WLAN_EID_EXT_OPS =46 ,WLAN_EID_EXT_HE_BSS_LOAD =47 ,WLAN_EID_EXT_MAX_CHANNEL_SWITCH_TIME =52 , +WLAN_EID_EXT_OCI =54 ,WLAN_EID_EXT_MULTIPLE_BSSID_CONFIGURATION =55 ,WLAN_EID_EXT_NON_INHERITANCE =56 , WLAN_EID_EXT_KNOWN_BSSID = 57,
Signature · 1 line
2.56.0
Johannes Berg
maintainerPATCH 5/8 wifi: mac80211: parse SMD BSS Transition Parameters element
In reply to Johannes BergFrom: Johannes Berg <[email protected]>
As previously defined in the header file, this element has a different layout depending on the action frame it's carried in, so the 'type' is no longer sufficient. Add a new enum indicating which 'action_frame' we're parsing to allow for this, and parse the element accordingly in SMD Transition preparation and execution responses, in preparation for ST implementation.
--- net/mac80211/ieee80211_i.h | 26 ++++++++++++++++++++++++++ net/mac80211/parse.c | 18 ++++++++++++++++++ 2 files changed, 44 insertions(+)
net/mac80211/ieee80211_i.h +26 -0
@@ -1916,6 +1916,8 @@ struct ieee802_11_elems {const struct ieee80211_uhr_operation *uhr_operation;const struct ieee80211_cip_cap *cip_cap;const struct ieee80211_uhr_parameters_update *uhr_param_upd; +const struct ieee80211_smd_bss_trans_params_prep_resp *smd_prep_resp; +const struct ieee80211_smd_bss_trans_params_exec_resp *smd_exec_resp;/* not the order in the psd values is per element, not per chandef */ struct ieee80211_parsed_tpe tpe;
@@ -2553,6 +2555,26 @@ static inline void ieee80211_tx_skb(struct ieee80211_sub_if_data *sdata,ieee80211_tx_skb_tid (sdata, skb,NULL ,7 ,-1 ); } +/** +* enum ieee80211_parse_action_frame - action frame context for element parsing +* +* Some elements reuse the same element ID for different structures depending +* on which action frame they appear in. This selects the action frame the +* elements came from so the parser can extract the correct variant. +* +* @IEEE80211_PARSE_ACTION_FRAME_UNSPECIFIED: not one of the action frames that +* need such disambiguation - parse elements normally +* @IEEE80211_PARSE_ACTION_FRAME_ST_PREP_RESP: SMD transition preparation +* response +* @IEEE80211_PARSE_ACTION_FRAME_ST_EXEC_RESP: SMD transition execution +* response +*/ +enum ieee80211_parse_action_frame { +IEEE80211_PARSE_ACTION_FRAME_UNSPECIFIED =0 , +IEEE80211_PARSE_ACTION_FRAME_ST_PREP_RESP , +IEEE80211_PARSE_ACTION_FRAME_ST_EXEC_RESP , +}; +/** * struct ieee80211_elems_parse_params - element parsing parameters * @mode: connection mode for parsing
@@ -2572,6 +2594,9 @@ static inline void ieee80211_tx_skb(struct ieee80211_sub_if_data *sdata,* (or re-association) response frame if this is given * @from_ap: frame is received from an AP (currently used only * for EHT capabilities parsing) +* @action_frame: which action frame the elements came from, to +* disambiguate elements that reuse the same element ID across different +* action frames, or %IEEE80211_PARSE_ACTION_FRAME_UNSPECIFIED */ struct ieee80211_elems_parse_params {enum ieee80211_conn_mode mode;
@@ -2583,6 +2608,7 @@ struct ieee80211_elems_parse_params {struct cfg80211_bss *bss;int link_id;bool from_ap; +enum ieee80211_parse_action_frame action_frame; }; struct ieee802_11_elems *
net/mac80211/parse.c +18 -0
@@ -236,6 +236,20 @@ ieee80211_parse_extension_element(u32 *crc, elems_parse->uhr_param_upd.start = params->start; elems_parse->uhr_param_upd.len = params->len;break ; +case WLAN_EID_EXT_BSS_SMD_TRANS_PARAMS : +switch (params->action_frame) { +case IEEE80211_PARSE_ACTION_FRAME_ST_PREP_RESP : +if (ieee80211_smd_prep_resp_size_ok (data, len)) + elems->smd_prep_resp = data; +break ; +case IEEE80211_PARSE_ACTION_FRAME_ST_EXEC_RESP : +if (ieee80211_smd_exec_resp_size_ok (data, len)) + elems->smd_exec_resp = data; +break ; +default : +break ; + } +break ; }if (crc && calc_crc)
@@ -351,6 +365,10 @@ _ieee802_11_parse_elems_full(struct ieee80211_elems_parse_params *params,break ; } +WARN (params->type != (IEEE80211_FTYPE_MGMT |IEEE80211_STYPE_ACTION ) && + params->action_frame !=IEEE80211_PARSE_ACTION_FRAME_UNSPECIFIED , +"action frame type specified for non-action frame\n" ); +for_each_element (elem, params->start, params->len) {const struct element *subelem;u8 elem_parse_failed;
Signature · 1 line
2.56.0
Johannes Berg
maintainerPATCH 6/8 wifi: mac80211: implement MLE first-profile inheritance
In reply to Johannes BergFrom: Johannes Berg <[email protected]>
In association response and other cases, the per-STA profiles in links (with complete information) inherit elements from the outer elements. In UHR, this is extended to inherit from the first link, so that UHR link reconfiguration and other frames can use inheritance.
Implement the inheritance for this: add a new 'base' copy of the parsing parameters, initialized to the original input, and overwrite that to point to the first profile when parsing one of the frames using this inheritance. The profile finding is extended to allow -1 link ID to find the first one.
Also constify the parse parameters to make things clearer, especially in ieee80211_prep_mle_link_parse() which now has *three* such arguments.
--- net/mac80211/ieee80211_i.h | 2 +- net/mac80211/parse.c | 109 +++++++++++++++++++++++++++++-------- 2 files changed, 86 insertions(+), 25 deletions(-)
net/mac80211/ieee80211_i.h +1 -1
@@ -2612,7 +2612,7 @@ struct ieee80211_elems_parse_params { };struct ieee802_11_elems * -ieee802_11_parse_elems_full (struct ieee80211_elems_parse_params *params); +ieee802_11_parse_elems_full (const struct ieee80211_elems_parse_params *params);static inline struct ieee802_11_elems * ieee802_11_parse_elems(const u8 *start, size_t len, u8 type,
net/mac80211/parse.c +85 -24
198 lines not on this page · raw message
Signature · 1 line
2.56.0
Johannes Berg
maintainerPATCH 7/8 wifi: mac80211: pass assoc_data to link config
In reply to Johannes BergFrom: Johannes Berg <[email protected]>
This function is already used for association and EHT link reconfiguration, but auto-detects which of the two. Pass the assoc_data explicitly to be able to use it for SMD transition as well later.
Also wrap most of the (many) arguments in a struct, expose the function for SMD Transition and add an argument to skip the bandwidth check, which cannot be done during SMD Transition.
--- net/mac80211/mlme.c | 57 +++++++++++++++++++++++++++------------------ net/mac80211/mlme.h | 15 ++++++++++++ 2 files changed, 49 insertions(+), 23 deletions(-)
net/mac80211/mlme.c +34 -23
@@ -1678,8 +1678,6 @@ static int ieee80211_config_bw(struct ieee80211_link_data *link,u16 ht_opmode;int ret; -memset (out,0 ,sizeof (*out)); -switch (stype) {case IEEE80211_STYPE_BEACON : frame ="beacon" ;
@@ -5941,33 +5939,32 @@ static void ieee80211_epcs_teardown(struct ieee80211_sub_if_data *sdata) } } -static bool ieee80211_assoc_config_link (struct ieee80211_link_data *link, -struct link_sta_info *link_sta, -struct cfg80211_bss *cbss, -struct ieee80211_mgmt *mgmt, -const u8 *elem_start, -unsigned int elem_len, -u64 *changed) +bool ieee80211_assoc_config_link (struct ieee80211_mgd_assoc_data *assoc_data, +struct ieee80211_link_data *link, +const struct ieee80211_assoc_config_link_params *params, +u64 *changed) { +struct link_sta_info *link_sta = params->link_sta; +struct cfg80211_bss *cbss = params->cbss; +struct ieee80211_mgmt *mgmt = params->mgmt;struct ieee80211_sub_if_data *sdata = link->sdata; -struct ieee80211_mgd_assoc_data *assoc_data = - sdata->u.mgd.assoc_data ?: sdata->u.mgd.reconf.add_links_data;struct ieee80211_bss_conf *bss_conf = link->conf;struct ieee80211_local *local = sdata->local;unsigned int link_id = link->link_id;struct ieee80211_elems_parse_params parse_params = { .mode = link->u.mgd.conn.mode, - .start = elem_start, - .len = elem_len, + .start = params->elem_start, + .len = params->elem_len, .link_id = link_id == assoc_data->assoc_link_id ?-1 : link_id, .from_ap = true, .type =le16_to_cpu (mgmt->frame_control) &IEEE80211_FCTL_TYPE , + .action_frame = params->action_frame, };bool is_5ghz = cbss->channel->band ==NL80211_BAND_5GHZ ;bool is_6ghz = cbss->channel->band ==NL80211_BAND_6GHZ ;bool is_s1g = cbss->channel->band ==NL80211_BAND_S1GHZ ;const struct cfg80211_bss_ies *bss_ies =NULL ; -struct ieee80211_config_bw_out config_bw_out; +struct ieee80211_config_bw_out config_bw_out = {};struct ieee802_11_elems *bss_elems =NULL ;struct ieee80211_supported_band *sband;struct ieee802_11_elems *elems;
@@ -6185,7 +6182,8 @@ static bool ieee80211_assoc_config_link(struct ieee80211_link_data *link, }/* check/update if AP changed anything in assoc response vs. scan */ - if (ieee80211_config_bw(link, elems, +if (!params->skip_bw_check && + ieee80211_config_bw(link, elems, link_id == assoc_data->assoc_link_id, le16_to_cpu(mgmt->frame_control) & IEEE80211_FCTL_STYPE,
@@ -7215,6 +7213,13 @@ static bool ieee80211_assoc_success(struct ieee80211_sub_if_data *sdata,for (link_id =0 ; link_id <IEEE80211_MLD_MAX_NUM_LINKS ; link_id++) {struct cfg80211_bss *cbss = assoc_data->link[link_id].bss; +struct ieee80211_assoc_config_link_params params = { + .cbss = cbss, + .mgmt = mgmt, + .action_frame =IEEE80211_PARSE_ACTION_FRAME_UNSPECIFIED , + .elem_start = elem_start, + .elem_len = elem_len, + };struct ieee80211_link_data *link;struct link_sta_info *link_sta;
@@ -7258,9 +7263,9 @@ static bool ieee80211_assoc_success(struct ieee80211_sub_if_data *sdata,if (err) goto out_err; -if (!ieee80211_assoc_config_link (link, link_sta, - assoc_data->link[link_id].bss, - mgmt, elem_start, elem_len, + params.link_sta = link_sta; +if (!ieee80211_assoc_config_link (sdata->u.mgd.assoc_data, + link, ¶ms, &changed[link_id])) goto out_err;
@@ -8234,7 +8239,7 @@ static void ieee80211_rx_mgmt_beacon(struct ieee80211_link_data *link,size_t baselen;struct ieee802_11_elems *elems;struct ieee80211_local *local = sdata->local; -struct ieee80211_config_bw_out config_bw_out; +struct ieee80211_config_bw_out config_bw_out = {};struct ieee80211_chanctx_conf *chanctx_conf;struct ieee80211_supported_band *sband;struct ieee80211_channel *chan;
@@ -11201,6 +11206,13 @@ ieee80211_process_ml_reconf_resp(struct ieee80211_sub_if_data *sdata, link_mask =0 ;for (link_id =0 ; link_id <IEEE80211_MLD_MAX_NUM_LINKS ; link_id++) {struct cfg80211_bss *cbss = add_links_data->link[link_id].bss; +struct ieee80211_assoc_config_link_params params = { + .cbss = cbss, + .mgmt = mgmt, + .action_frame =IEEE80211_PARSE_ACTION_FRAME_UNSPECIFIED , + .elem_start = pos, + .elem_len = len, + };struct ieee80211_link_data *link;struct link_sta_info *link_sta;u64 changed =0 ;
@@ -11252,10 +11264,9 @@ ieee80211_process_ml_reconf_resp(struct ieee80211_sub_if_data *sdata, add_links_data->link[link_id].bss)) goto disconnect; -if (!ieee80211_assoc_config_link (link, link_sta, - add_links_data->link[link_id].bss, - mgmt, pos, len, - &changed)) + params.link_sta = link_sta; +if (!ieee80211_assoc_config_link (sdata->u.mgd.reconf.add_links_data, + link, ¶ms, &changed)) goto disconnect;/* The AP MLD indicated success for this link, but the station
net/mac80211/mlme.h +15 -0
@@ -32,6 +32,21 @@ void ieee80211_determine_our_sta_mode(struct ieee80211_sub_if_data *sdata,struct cfg80211_assoc_request *req, bool wmm_used, int link_id, struct ieee80211_conn_settings *conn); + +struct ieee80211_assoc_config_link_params { +struct link_sta_info *link_sta; +struct cfg80211_bss *cbss; +struct ieee80211_mgmt *mgmt; +enum ieee80211_parse_action_frame action_frame; +const u8 *elem_start; +unsigned int elem_len; +bool skip_bw_check; +}; + +bool ieee80211_assoc_config_link (struct ieee80211_mgd_assoc_data *assoc_data, +struct ieee80211_link_data *link, +const struct ieee80211_assoc_config_link_params *params, +u64 *changed); int ieee80211_calc_channel(struct ieee80211_sub_if_data *sdata, struct ieee80211_link_data *link, struct link_sta_info *link_sta, int link_id,
Signature · 1 line
2.56.0
Johannes Berg
maintainerPATCH 8/8 wifi: mac80211: move assoc request elems into assoc data
In reply to Johannes BergFrom: Johannes Berg <[email protected]>
These don't need to be stored in the interface, they can be stored in the assoc data.
--- net/mac80211/ieee80211_i.h | 10 ++++------ net/mac80211/mlme.c | 17 ++++++++--------- 2 files changed, 12 insertions(+), 15 deletions(-)
net/mac80211/ieee80211_i.h +4 -6
@@ -508,6 +508,10 @@ struct ieee80211_mgd_assoc_data {u8 fils_kek[FILS_MAX_KEK_LEN ];size_t fils_kek_len; +/* separately allocated, needs to be freed */ +u8 *req_elems; +size_t req_elems_len; +size_t ie_len;u8 *ie_pos;/* used to fill ie[] with link[].elems */ u8 ie[];
@@ -631,12 +635,6 @@ struct ieee80211_if_managed {*/ struct wiphy_delayed_work tx_tspec_wk; -/* Information elements from the last transmitted (Re)Association -* Request frame. -*/ -u8 *assoc_req_ies; -size_t assoc_req_ies_len; -struct wiphy_hrtimer_work ml_reconf_work;u16 removed_links;
net/mac80211/mlme.c +8 -9
@@ -2830,14 +2830,15 @@ static int ieee80211_send_assoc(struct ieee80211_sub_if_data *sdata) } pos =skb_tail_pointer (skb); -kfree (ifmgd->assoc_req_ies); - ifmgd->assoc_req_ies =kmemdup (ie_start, pos - ie_start,GFP_ATOMIC ); -if (!ifmgd->assoc_req_ies) { +/* might already exist (on retry) */ +kfree (assoc_data->req_elems); + assoc_data->req_elems =kmemdup (ie_start, pos - ie_start,GFP_ATOMIC ); +if (!assoc_data->req_elems) {dev_kfree_skb (skb);return -ENOMEM ; } - ifmgd->assoc_req_ies_len = pos - ie_start; + assoc_data->req_elems_len = pos - ie_start; info.link_id = assoc_data->assoc_link_id;drv_mgd_prepare_tx (local, sdata, &info);
@@ -5437,6 +5438,7 @@ static void ieee80211_destroy_assoc_data(struct ieee80211_sub_if_data *sdata,ieee80211_vif_set_links (sdata,0 ,0 ); } +kfree (assoc_data->req_elems);kfree (assoc_data); }
@@ -7561,8 +7563,8 @@ static void ieee80211_rx_mgmt_assoc_resp(struct ieee80211_sub_if_data *sdata, resp.buf = (u8 *)mgmt; resp.len = len; - resp.req_ies = ifmgd->assoc_req_ies; - resp.req_ies_len = ifmgd->assoc_req_ies_len; + resp.req_ies = assoc_data->req_elems; + resp.req_ies_len = assoc_data->req_elems_len;cfg80211_rx_assoc_resp (sdata->dev, &resp); assoc_status = status_code ==WLAN_STATUS_SUCCESS ?ASSOC_SUCCESS :ASSOC_REJECTED ;
@@ -11011,9 +11013,6 @@ void ieee80211_mgd_stop(struct ieee80211_sub_if_data *sdata) ifmgd->teardown_skb =NULL ; ifmgd->orig_teardown_skb =NULL ; } -kfree (ifmgd->assoc_req_ies); - ifmgd->assoc_req_ies =NULL ; - ifmgd->assoc_req_ies_len =0 ;spin_unlock_bh (&ifmgd->teardown_lock);timer_delete_sync (&ifmgd->timer); }
Signature · 1 line
2.56.0