-: ------------ > 1: 8c452a4905d2 wifi: nl80211: define Seamless Mobility Domain (SMD) device capability  1: f2b856c5530f ! 2: 138bf905dcc4 wifi: nl80211: define Seamless Mobility Domain (SMD) device capability @@ ## Metadata ## -Author: Pooventhiran G  +Author: Rohan Dutta   ## Commit message ## - wifi: nl80211: define Seamless Mobility Domain (SMD) device capability + wifi: nl80211/cfg80211: define interfaces for SMD STA indications  - Per IEEE P802.11bn/D2.0, Aug 2026, subclause 37.16, an AP MLD can be - managed by a Seamless Mobility Domain Management Entity (SMD-ME) along - with partner AP MLDs to enable seamless transition of an associated - non-AP MLD from the current AP MLD to a target AP MLD. A non-AP MLD - advertising SMD supports association to an SMD-ME and SMD BSS - Transition between AP MLDs within an SMD. + Define nl80211 and cfg80211 interfaces to support non-AP STA MLD + creation upon SMD negotiation. This helps the drivers to instantiate + workflows to support ST of the STA.  - Userspace needs a way to be aware of the driver's SMD capabilities so that - it can enable SMD configuration and operation only on capable devices. - Define nl80211 and wiphy flag interfaces to advertise SMD support to - userspace. - - Co-developed-by: Rohan Dutta  Signed-off-by: Rohan Dutta  + Signed-off-by: Sidhanta Sahu  Signed-off-by: Pooventhiran G   ## include/net/cfg80211.h ## -@@ include/net/cfg80211.h: struct cfg80211_ops { - * STA) basis for station and P2P client interfaces. - * (Note that if userspace doesn't give the MAC address, the AP's address - * is substituted to allow for older userspace versions.) -+ * @WIPHY_FLAG_SUPPORTS_SMD: The device supports Seamless Mobility Domain (SMD) -+ * setup and BSS Transition. +@@ include/net/cfg80211.h: struct cfg80211_ttlm_params { + * @link_sta_params: link related params. + * @epp_peer: EPP peer indication + * @nmi_mac: MAC address of the NMI station of the NAN peer ++ * @smd_sta: station has negotiated SMD */ - enum wiphy_flags { - WIPHY_FLAG_SUPPORTS_EXT_KEK_KCK = BIT(0), -@@ include/net/cfg80211.h: enum wiphy_flags { - WIPHY_FLAG_HAS_CHANNEL_SWITCH = BIT(23), - WIPHY_FLAG_NOTIFY_REGDOM_BY_DRIVER = BIT(24), - WIPHY_FLAG_CHANNEL_CHANGE_ON_BEACON = BIT(25), -+ WIPHY_FLAG_SUPPORTS_SMD = BIT(26), + struct station_parameters { + struct net_device *vlan; +@@ include/net/cfg80211.h: struct station_parameters { + struct link_station_parameters link_sta_params; + bool epp_peer; + const u8 *nmi_mac; ++ bool smd_sta; };  /**  ## include/uapi/linux/nl80211.h ##  @@ - * processing of peer DH IE to generate PMK. + * + * Drivers can indicate userspace about the support for SMD (and ST) by setting + * %NL80211_EXT_FEATURE_SMD_SUPPORT. ++ * ++ * Userspace indicate that the non-AP MLD has negotiated SMD with the AP MLD ++ * by setting %NL80211_ATTR_SMD in %NL80211_CMD_NEW_STATION. */  -+/** -+ * DOC: Seamless Mobility Domain (AP) -+ * -+ * Seamless Mobility Domain (SMD) is a mobility domain consisting of multiple -+ * non-colocated AP multi-link devices where a non-AP MLD can perform SMD BSS -+ * Transition (ST) between the AP MLDs without reassociation (hence, seamless). -+ * ST is done in two phases: -+ * Preparation (where the target AP MLD sets up the links for the non-AP -+ * MLD but keep in powersave) and -+ * Execution (actual roaming where the non-AP MLD transitions to the -+ * target AP MLD and continues traffic). -+ * -+ * To use this in nl80211, multiple commands carry the %NL80211_ATTR_SMD_SUPPORT -+ * attribute: -+ * Drivers set %WIPHY_FLAG_SUPPORTS_SMD to indicate userspace about the -+ * SMD capability in %NL80211_CMD_GET_WIPHY. -+ * %NL80211_CMD_START_AP carries %NL80211_ATTR_SMD_SUPPORT to indicate that -+ * the AP affiliated to an AP MLD is part of an SMD. -+ */ -+ /** - * enum nl80211_commands - supported nl80211 commands - *  @@ include/uapi/linux/nl80211.h: enum nl80211_commands { * @NL80211_ATTR_ASSOC_PROTECTED_TWT: Enable protected TWT for the association, * requires protected TWT support (flag attribute) * -+ * @NL80211_ATTR_SMD_SUPPORT: Flag attribute to indicate SMD support. Used with -+ * multiple commands to indicate appropriate SMD support (refer DOC). ++ * @NL80211_ATTR_SMD: Flag attribute to indicate that the station has negotiated ++ * SMD.  + * * @NUM_NL80211_ATTR: total number of nl80211_attrs available * @NL80211_ATTR_MAX: highest attribute number currently defined @@ include/uapi/linux/nl80211.h: enum nl80211_attrs {  NL80211_ATTR_ASSOC_PROTECTED_TWT,  -+ NL80211_ATTR_SMD_SUPPORT, ++ NL80211_ATTR_SMD,  + /* add attributes here, update the policy in nl80211.c */  @@ net/wireless/nl80211.c: static const struct nla_policy nl80211_policy[NUM_NL8021 [NL80211_ATTR_ASSOC_CIP] = { .type = NLA_FLAG }, [NL80211_ATTR_CIP_CAPABILITIES] = { .type = NLA_U8 }, [NL80211_ATTR_ASSOC_PROTECTED_TWT] = { .type = NLA_FLAG }, -+ [NL80211_ATTR_SMD_SUPPORT] = { .type = NLA_FLAG }, ++ [NL80211_ATTR_SMD] = { .type = NLA_FLAG }, };  /* policy for the key attributes */ -@@ net/wireless/nl80211.c: static int nl80211_send_wiphy(struct cfg80211_registered_device *rdev, - if (nl80211_put_nan_capa(&rdev->wiphy, msg)) - goto nla_put_failure; +@@ net/wireless/nl80211.c: static int nl80211_new_station(struct sk_buff *skb, struct genl_info *info) + params.epp_peer = + nla_get_flag(info->attrs[NL80211_ATTR_EPP_PEER]);  -+ state->split_start++; -+ break; -+ case 19: -+ if (rdev->wiphy.flags & WIPHY_FLAG_SUPPORTS_SMD) -+ nla_put_flag(msg, NL80211_ATTR_SMD_SUPPORT); ++ params.smd_sta = nla_get_flag(info->attrs[NL80211_ATTR_SMD]); ++ if (!wiphy_ext_feature_isset(&rdev->wiphy, ++ NL80211_EXT_FEATURE_SMD_SUPPORT) && ++ params.smd_sta) ++ return -EINVAL;  + - /* done */ - state->split_start = 0; - break; + err = rdev_add_station(rdev, wdev, mac_addr, ¶ms); + dev_put(params.vlan); + return err;  2: 296ac6cc3096 < -: ------------ wifi: nl80211/cfg80211: define interfaces for SMD setup and STA update  3: df8283593a22 ! 3: 43ef9992d619 wifi: nl80211: add SMD BSS Transition sub-state STA flags @@ Metadata Author: Pooventhiran G   ## Commit message ## - wifi: nl80211: add SMD BSS Transition sub-state STA flags + wifi: nl80211: add ST sub-state STA flags for non-AP MLD  IEEE P802.11bn/D2.0, Aug 2026, subclause 11.3.1, defines three new MLD state sub-states (4a, 4b, 4c) that apply when a non-AP MLD and its - associated SMD-ME are in state 4 and an SMD BSS Transition is - in progress. + associated SMD-ME are in state 4 and an ST is in progress.  Add the corresponding nl80211 STA flags to track the state changes: - - NL80211_STA_FLAG_SMD_PREP_TARGET - State 4a: non-AP MLD is prepared + - NL80211_STA_FLAG_ST_PREPARED - State 4a: non-AP MLD is prepared with target AP MLD - - NL80211_STA_FLAG_SMD_EXEC_CURRENT - State 4b: ST execution active on + - NL80211_STA_FLAG_ST_EXECUTING - State 4b: ST execution active on current AP MLD - - NL80211_STA_FLAG_SMD_DL_DRAIN - State 4c: DL draining period + - NL80211_STA_FLAG_ST_DL_DRAIN - State 4c: DL draining period  Signed-off-by: Pooventhiran G   ## include/uapi/linux/nl80211.h ##  @@ - * the AP MLD. %NL80211_ATTR_SMD_ROAM_STA is also set on the target AP MLD - * to indicate that it is part of ST Preparation; drivers must keep these - * links in powersave at this point until successful ST Execution. + * + * Userspace indicate that the non-AP MLD has negotiated SMD with the AP MLD + * by setting %NL80211_ATTR_SMD in %NL80211_CMD_NEW_STATION.  + *  + * When a non-AP MLD undergoes ST, userspace can indicate the current state of  + * ST at the current AP MLD and target AP MLD using the STA flags -+ * %NL80211_STA_FLAG_SMD_PREP_TARGET, %NL80211_STA_FLAG_SMD_EXEC_CURRENT, and -+ * %NL80211_STA_FLAG_SMD_DL_DRAIN. -+ * %NL80211_STA_FLAG_SMD_PREP_TARGET can be set in %NL80211_CMD_NEW_STATION -+ * on the target AP MLD while creating the station entry. -+ * %NL80211_STA_FLAG_SMD_{EXEC_CURRENT,DL_DRAIN}, on the other hand, can be ++ * %NL80211_STA_FLAG_ST_PREPARED, %NL80211_STA_FLAG_ST_EXECUTING, and ++ * %NL80211_STA_FLAG_ST_DL_DRAIN. ++ * %NL80211_STA_FLAG_ST_PREPARED can be set in %NL80211_CMD_NEW_STATION ++ * on the target AP MLD while creating the station entry. Drivers must ++ * keep these links in powersave at this point until successful ++ * ST Execution. ++ * %NL80211_STA_FLAG_ST_{EXECUTING,DL_DRAIN}, on the other hand, can be  + * set using %NL80211_CMD_SET_STATION on the current AP MLD. */  /**  @@ include/uapi/linux/nl80211.h: enum nl80211_iftype { + * previously added station into associated state * @NL80211_STA_FLAG_SPP_AMSDU: station supports SPP A-MSDUs * @NL80211_STA_FLAG_CIP: station has Control Integrity Protocol (CIP) enabled - * @NL80211_STA_FLAG_SMD: station has negotiated SMD. -+ * @NL80211_STA_FLAG_SMD_PREP_TARGET: station is prepared at SMD target AP MLD ++ * @NL80211_STA_FLAG_ST_PREPARED: station is prepared at target AP MLD  + * (State 4a). -+ * @NL80211_STA_FLAG_SMD_EXEC_CURRENT: current AP MLD is executing SMD BSS -+ * Transition (State 4b). -+ * @NL80211_STA_FLAG_SMD_DL_DRAIN: current AP MLD is in DL draining period ++ * @NL80211_STA_FLAG_ST_EXECUTING: current AP MLD is executing ST (State 4b). ++ * @NL80211_STA_FLAG_ST_DL_DRAIN: current AP MLD is in DL draining period  + * (State 4c). * @NL80211_STA_FLAG_MAX: highest station flag number currently defined * @__NL80211_STA_FLAG_AFTER_LAST: internal use */  @@ include/uapi/linux/nl80211.h: enum nl80211_sta_flags { + NL80211_STA_FLAG_ASSOCIATED, NL80211_STA_FLAG_SPP_AMSDU, NL80211_STA_FLAG_CIP, - NL80211_STA_FLAG_SMD, -+ NL80211_STA_FLAG_SMD_PREP_TARGET, -+ NL80211_STA_FLAG_SMD_EXEC_CURRENT, -+ NL80211_STA_FLAG_SMD_DL_DRAIN, ++ NL80211_STA_FLAG_ST_PREPARED, ++ NL80211_STA_FLAG_ST_EXECUTING, ++ NL80211_STA_FLAG_ST_DL_DRAIN,  /* keep last */ __NL80211_STA_FLAG_AFTER_LAST,  ## net/wireless/nl80211.c ##  @@ net/wireless/nl80211.c: static const struct nla_policy sta_flags_policy[NL80211_STA_FLAG_MAX + 1] = { + [NL80211_STA_FLAG_MFP] = { .type = NLA_FLAG }, [NL80211_STA_FLAG_AUTHENTICATED] = { .type = NLA_FLAG }, [NL80211_STA_FLAG_TDLS_PEER] = { .type = NLA_FLAG }, - [NL80211_STA_FLAG_SMD] = { .type = NLA_FLAG }, -+ [NL80211_STA_FLAG_SMD_PREP_TARGET] = { .type = NLA_FLAG }, -+ [NL80211_STA_FLAG_SMD_EXEC_CURRENT] = { .type = NLA_FLAG }, -+ [NL80211_STA_FLAG_SMD_DL_DRAIN] = { .type = NLA_FLAG }, ++ [NL80211_STA_FLAG_ST_PREPARED] = { .type = NLA_FLAG }, ++ [NL80211_STA_FLAG_ST_EXECUTING] = { .type = NLA_FLAG }, ++ [NL80211_STA_FLAG_ST_DL_DRAIN] = { .type = NLA_FLAG }, };  static int parse_station_flags(struct genl_info *info, @@ net/wireless/nl80211.c: static int parse_station_flags(struct genl_info *info, switch (iftype) { case NL80211_IFTYPE_AP: case NL80211_IFTYPE_AP_VLAN: -- params->sta_flags_mask = BIT(NL80211_STA_FLAG_SMD);  + params->sta_flags_mask = -+ BIT(NL80211_STA_FLAG_SMD) | -+ BIT(NL80211_STA_FLAG_SMD_PREP_TARGET) | -+ BIT(NL80211_STA_FLAG_SMD_EXEC_CURRENT) | -+ BIT(NL80211_STA_FLAG_SMD_DL_DRAIN); - fallthrough; ++ BIT(NL80211_STA_FLAG_ST_PREPARED) | ++ BIT(NL80211_STA_FLAG_ST_EXECUTING) | ++ BIT(NL80211_STA_FLAG_ST_DL_DRAIN); ++ fallthrough; case NL80211_IFTYPE_P2P_GO: - params->sta_flags_mask |= BIT(NL80211_STA_FLAG_AUTHORIZED) | +- params->sta_flags_mask = BIT(NL80211_STA_FLAG_AUTHORIZED) | +- BIT(NL80211_STA_FLAG_SHORT_PREAMBLE) | +- BIT(NL80211_STA_FLAG_WME) | +- BIT(NL80211_STA_FLAG_MFP); ++ params->sta_flags_mask |= BIT(NL80211_STA_FLAG_AUTHORIZED) | ++ BIT(NL80211_STA_FLAG_SHORT_PREAMBLE) | ++ BIT(NL80211_STA_FLAG_WME) | ++ BIT(NL80211_STA_FLAG_MFP); + break; + case NL80211_IFTYPE_P2P_CLIENT: + case NL80211_IFTYPE_STATION:  @@ net/wireless/nl80211.c: int cfg80211_check_station_change(struct wiphy *wiphy, return -EINVAL;  /* When you run into this, adjust the code below for the new flag */ -- BUILD_BUG_ON(NL80211_STA_FLAG_MAX != 10); -+ BUILD_BUG_ON(NL80211_STA_FLAG_MAX != 13); +- BUILD_BUG_ON(NL80211_STA_FLAG_MAX != 9); ++ BUILD_BUG_ON(NL80211_STA_FLAG_MAX != 12);  switch (statype) { case CFG80211_STA_MESH_PEER_KERNEL:  @@ net/wireless/nl80211.c: int cfg80211_check_station_change(struct wiphy *wiphy, + BIT(NL80211_STA_FLAG_WME) | BIT(NL80211_STA_FLAG_MFP) | BIT(NL80211_STA_FLAG_SPP_AMSDU) | - BIT(NL80211_STA_FLAG_CIP) | -- BIT(NL80211_STA_FLAG_SMD))) -+ BIT(NL80211_STA_FLAG_SMD) | -+ BIT(NL80211_STA_FLAG_SMD_PREP_TARGET) | -+ BIT(NL80211_STA_FLAG_SMD_EXEC_CURRENT) | -+ BIT(NL80211_STA_FLAG_SMD_DL_DRAIN))) +- BIT(NL80211_STA_FLAG_CIP))) ++ BIT(NL80211_STA_FLAG_CIP) | ++ BIT(NL80211_STA_FLAG_ST_PREPARED) | ++ BIT(NL80211_STA_FLAG_ST_EXECUTING) | ++ BIT(NL80211_STA_FLAG_ST_DL_DRAIN))) return -EINVAL;  /* but authenticated/associated only if driver handles it */ @@ net/wireless/nl80211.c: static int nl80211_new_station(struct sk_buff *skb, stru return -EINVAL;  /* When you run into this, adjust the code below for the new flag */ -- BUILD_BUG_ON(NL80211_STA_FLAG_MAX != 10); -+ BUILD_BUG_ON(NL80211_STA_FLAG_MAX != 13); +- BUILD_BUG_ON(NL80211_STA_FLAG_MAX != 9); ++ BUILD_BUG_ON(NL80211_STA_FLAG_MAX != 12);  switch (wdev->iftype) { case NL80211_IFTYPE_AP:  4: 662c9b76d929 ! 4: 64de349648d4 wifi: cfg80211: define layouts for SMD BSS Transition context @@ Metadata Author: Pooventhiran G   ## Commit message ## - wifi: cfg80211: define layouts for SMD BSS Transition context + wifi: cfg80211: define layouts for ST context transfer  IEEE P802.11bn/D2.0, Aug 2026, subclause 37.16.9, defines the context - data to be transported during SMD BSS Transition (ST) laid out in - subclause 37.16. The station's context data is attached to the ST - Preparation or Execution Request action frames so that userspace - receives the context along with the relevant frame. + data to be transported during ST laid out in subclause 37.16. + The station's context data is attached to the ST Preparation or + Execution Request action frames so that userspace receives the context + along with the relevant frame.  Define the context data: per-TID sequence numbers (SN) in downlink (DL) and uplink (UL) directions, packet number (PN) in DL, per-TID packet @@ include/net/cfg80211.h: void cfg80211_incumbent_signal_notify(struct wiphy *wiph gfp_t gfp);   +/* -+ * Context information carried in SMD BSS Transition (refer IEEE P802.11bn/D2.0, ++ * Context information carried in SMD Transition (refer IEEE P802.11bn/D2.0,  + * Aug 2026, subclause 37.16.9.  + */  + @@ include/net/cfg80211.h: void cfg80211_incumbent_signal_notify(struct wiphy *wiph  + * Data TIDs transported in the context, IEEE P802.11bn/D2.0, Aug 2026,  + * subclause 9.4.2.364.  + */ -+#define IEEE80211_SMD_CTX_NUM_TIDS 8 -+ -+#define IEEE80211_SMD_CTX_MAX_PN_LEN 16 ++#define IEEE80211_ST_CTX_NUM_TIDS 8  +  +/** -+ * struct ieee80211_smd_ctx_ba - BlockAck parameters for DL and UL ++ * struct ieee80211_st_ctx_ba - BlockAck parameters for DL and UL  + *  + * @amsdu_supported: Peer's capability to support A-MSDU within A-MPDU.  + * @ba_policy: BlockAck policy (0 = delayed BlockAck, 1 = immediate BlockAck) -+ * @buffer_size: Reorder buffer size from ADDBA Request (10-bit, max 1023) ++ * @buffer_size: Reorder (combined) buffer size from ADDBA Request  + * @timeout: BlockAck session timeout  + * @ext_no_frag: ADDBA Extension fragmentation support  + * @extfrag_level: ADDBA Extension HE fragmentation level -+ * @ext_buffer_size: ADDBA Extension buffer size; combined with @buffer_size as -+ * (@ext_buffer_size << 10 | @buffer_size) to get the full reorder -+ * buffer size  + * @winstarto: WinStartO of the BA window  + */ -+struct ieee80211_smd_ctx_ba { ++struct ieee80211_st_ctx_ba {  + bool amsdu_supported;  + u8 ba_policy;  + u16 buffer_size;  + u16 timeout;  + bool ext_no_frag;  + u8 extfrag_level; -+ u16 ext_buffer_size;  + u16 winstarto;  +};  +  +/** -+ * struct ieee80211_smd_ctx - IEEE 802.11bn SMD Roaming Context (refer ++ * struct ieee80211_st_ctx - IEEE 802.11bn SMD Transition Context (refer  + * IEEE P802.11bn/D2.0, Aug 2026, subclause 37.16.9)  + * -+ * @dl_sn_valid: if downlink (DL) SN Transfer is requested or not -+ * @ul_sn_valid: if uplink (UL) SN Transfer is requested or not -+ * @pn_valid: if PN is transferred or not -+ * @ba_params_valid: if BlockAck parameters are transferred or not -+ * @mgmt_tid_valid: if management information is transferred or not. -+ * @{d,u}l.mgmt_sn and @ul.mgmt_pn are still bounded by @{d,u}l_sn_valid -+ * and @pn_valid fields. -+ * @pn_len: Length of PN in bytes; varies by cipher type -+ * (e.g. CCMP (6), GCMP-256 (16)) ++ * @no_dl_sn_transfer: if downlink (DL) SN Transfer is requested or not ++ * @no_ul_sn_transfer: if uplink (UL) SN Transfer is requested or not ++ * @pn_valid: if PN is present in the context ++ * @ba_params_valid: if BlockAck parameters are present in the context ++ * @mgmt_tid_valid: if management information is present in the context ++ * @{dl,ul}.mgmt_sn and @ul.mgmt_pn are still bounded by ++ * @no_{dl,ul}_sn_transfer and @pn_valid fields.  + * @dl: DL context data such as SN, PN, and BlockAck params. -+ * SN and PN transferred are offset to reserve space for DL frames sent by -+ * the current AP MLD so that the target AP MLD does not repeat them. ++ * SN and PN are offset to reserve space for DL frames sent by the ++ * current AP MLD so that the target AP MLD does not repeat them.  + * @ul: UL context data such as SN, PN, and BlockAck params.  + */ -+struct ieee80211_smd_ctx { -+ u8 dl_sn_valid:1; -+ u8 ul_sn_valid:1; ++struct ieee80211_st_ctx { ++ u8 no_dl_sn_transfer:1; ++ u8 no_ul_sn_transfer:1;  + u8 pn_valid:1;  + u8 ba_params_valid:1;  + u8 mgmt_tid_valid:1;  + -+ u8 pn_len; -+  + struct {  + u8 valid_tid_bmap; -+ u16 sn[IEEE80211_SMD_CTX_NUM_TIDS]; -+ u8 pn[IEEE80211_SMD_CTX_MAX_PN_LEN]; -+ struct ieee80211_smd_ctx_ba ba[IEEE80211_SMD_CTX_NUM_TIDS]; ++ u16 sn[IEEE80211_ST_CTX_NUM_TIDS]; ++ u8 pn[IEEE80211_CCMP_PN_LEN]; ++ struct ieee80211_st_ctx_ba ba[IEEE80211_ST_CTX_NUM_TIDS];  + u16 mgmt_sn;  + } dl;  + struct {  + u8 valid_tid_bmap; -+ u16 sn[IEEE80211_SMD_CTX_NUM_TIDS]; -+ u8 pn[IEEE80211_SMD_CTX_NUM_TIDS][IEEE80211_SMD_CTX_MAX_PN_LEN]; -+ struct ieee80211_smd_ctx_ba ba[IEEE80211_SMD_CTX_NUM_TIDS]; ++ u16 sn[IEEE80211_ST_CTX_NUM_TIDS]; ++ u8 pn[IEEE80211_ST_CTX_NUM_TIDS][IEEE80211_CCMP_PN_LEN]; ++ struct ieee80211_st_ctx_ba ba[IEEE80211_ST_CTX_NUM_TIDS];  + u16 mgmt_sn; -+ u8 mgmt_pn[IEEE80211_SMD_CTX_MAX_PN_LEN]; ++ u8 mgmt_pn[IEEE80211_CCMP_PN_LEN];  + } ul;  +};  +  5: fe89d9417c38 < -: ------------ wifi: nl80211: define interfaces for SMD BSS Transition context transfer  -: ------------ > 5: 610560962dd5 wifi: nl80211: define interfaces for ST context transfer  6: cf04c14dc717 ! 6: b15a3be1b709 wifi: ieee80211: define APIs for UHR Link Reconfiguration frame checks @@ Commit message  Add APIs necessary to check whether the frame is a UHR Link Reconfiguration Request/Response/Notify frame and subtypes to invoke - necessary SMD BSS Transition handling on the AP MLD. + necessary SMD Transition handling on the AP MLD.  Signed-off-by: Pooventhiran G    7: ca8344d5b761 = 7: 0b35ad236d87 wifi: ieee80211: define API to check if frame is class 3  8: debf50c4b4d8 ! 8: 49d5d0378c4e wifi: nl80211/cfg80211: pack SMD dynamic context along with frame @@ Metadata Author: Pooventhiran G   ## Commit message ## - wifi: nl80211/cfg80211: pack SMD dynamic context along with frame + wifi: nl80211/cfg80211: pack ST dynamic context along with frame  While packing the received management frame in nl80211_send_mgmt() to - send to userspace, nest the SMD dynamic context along with the frame + send to userspace, nest the ST dynamic context along with the frame message. This shall be used by userspace to transport the context to the target AP MLD for programming the dynamic state of the STA session for - seamless roaming as part of SMD BSS Transition. + seamless roaming as part of ST.  Suggested-by: Jouni Malinen  Co-developed-by: Aditya Sathish  @@ include/net/cfg80211.h: struct mgmt_frame_regs { };   +/** -+ * struct cfg80211_smd_transition_info - SMD BSS Transition info ++ * struct cfg80211_smd_transition_info - SMD Transition info  + *  + * @ctx: Dynamic context to be transferred as part of ST  + * @type: Type of ST indication  + */  +struct cfg80211_smd_transition_info { -+ struct ieee80211_smd_ctx *ctx; -+ enum nl80211_smd_ctx_type type; ++ struct ieee80211_st_ctx *ctx; ++ enum nl80211_st_ctx_type type;  +};  + /** @@ include/net/cfg80211.h: void cfg80211_conn_failed(struct net_device *dev, const * @rx_tstamp: Hardware timestamp of frame RX in nanoseconds * @ack_tstamp: Hardware timestamp of ack TX in nanoseconds * @no_sta: set if no station is known for the frame (relevant for MLD) -+ * @st_info: SMD BSS Transition data ++ * @st_info: SMD Transition data */ struct cfg80211_rx_info { int freq; @@ include/net/cfg80211.h: struct cfg80211_rx_info { /**  ## net/wireless/nl80211.c ## -@@ net/wireless/nl80211.c: nl80211_epcs_cfg(struct sk_buff *skb, struct genl_info *info) - return rdev_set_epcs(rdev, dev, val); +@@ net/wireless/nl80211.c: static int nl80211_abandon_st(struct sk_buff *skb, struct genl_info *info) + info->attrs[NL80211_ATTR_LOCAL_STATE_CHANGE]); }  -+static size_t _nl80211_smd_ctx_nl_ba_param_size(u8 n_tids, bool dl) -+{ -+ size_t n = 0; -+ -+ n += nla_total_size(0); /* ba_params nest header */ -+ n += n_tids * (nla_total_size(0) + /* tid nest header */ -+ nla_total_size(sizeof(u16)) + /* buff_size */ -+ nla_total_size(sizeof(u8)) + /* policy */ -+ nla_total_size(0) + /* amsdu_support */ -+ nla_total_size(sizeof(u16)) + /* timeout */ -+ nla_total_size(0) + /* ext_no_frag */ -+ nla_total_size(sizeof(u8)) + /* ext_frag_lvl */ -+ nla_total_size(sizeof(u16))); /* ext_buff_size */ -+ -+ if (dl) -+ n += n_tids * nla_total_size(sizeof(u16)); /* winstarto */ -+ -+ return n; -+} -+ -+static size_t -+nl80211_smd_ctx_nl_size(struct cfg80211_smd_transition_info *st_info) -+{ -+ const struct ieee80211_smd_ctx *ctx = st_info->ctx; -+ int n_dl_tids = 0, n_ul_tids = 0; -+ u8 pn_len = ctx->pn_len; -+ size_t n = 0; -+ -+ /* count valid TIDs */ -+ n_dl_tids = hweight8(ctx->dl.valid_tid_bmap); -+ n_ul_tids = hweight8(ctx->ul.valid_tid_bmap); -+ -+ n += nla_total_size(sizeof(u8)); /* ST type */ -+ -+ /* outer NL80211_ATTR_SMD_CTX nest */ -+ n += nla_total_size(0); /* nest header */ -+ -+ /* DL nest */ -+ n += nla_total_size(0); /* DL nest header */ -+ -+ n += nla_total_size(sizeof(u8)); /* valid_tid_bitmap */ -+ -+ if (ctx->dl_sn_valid) { -+ n += nla_total_size(0); /* DL SN nest header */ -+ n += n_dl_tids * nla_total_size(sizeof(u16)); /* DL SN */ -+ if (ctx->mgmt_tid_valid) -+ n += nla_total_size(sizeof(u16)); /* DL mgmt_sn */ -+ } -+ -+ if (ctx->pn_valid) -+ n += nla_total_size(pn_len); /* DL PN */ -+ -+ if (ctx->ba_params_valid) -+ n += _nl80211_smd_ctx_nl_ba_param_size(n_dl_tids, true); /* DL BA */ -+ -+ /* UL nest */ -+ n += nla_total_size(0); /* UL nest header */ -+ -+ n += nla_total_size(sizeof(u8)); /* valid_tid_bitmap */ -+ -+ if (ctx->ul_sn_valid) { -+ n += nla_total_size(0); /* UL SN nest header */ -+ n += n_ul_tids * nla_total_size(sizeof(u16)); /* UL SN */ -+ if (ctx->mgmt_tid_valid) -+ n += nla_total_size(sizeof(u16)); /* UL mgmt_sn */ -+ } -+ -+ if (ctx->pn_valid) { -+ n += nla_total_size(0); /* UL PN nest header */ -+ n += n_ul_tids * nla_total_size(pn_len); /* UL PN */ -+ if (ctx->mgmt_tid_valid) -+ n += nla_total_size(pn_len); /* UL mgmt_pn */ -+ } -+ -+ if (ctx->ba_params_valid) -+ n += _nl80211_smd_ctx_nl_ba_param_size(n_ul_tids, false); /* UL BA */ -+ -+ return n; -+} -+  +static int -+nl80211_put_smd_ctx_ba_params(struct sk_buff *msg, -+ const unsigned long *tid_bmap, -+ const struct ieee80211_smd_ctx_ba *ba_tids, -+ bool dl) ++nl80211_put_st_ctx_ba_params(struct sk_buff *msg, unsigned long tid_bmap, ++ const struct ieee80211_st_ctx_ba *ba_tids, ++ bool dl)  +{ -+ u32 ba_params_attr = NL80211_SMD_CTX_DL_ATTR_BA_PARAMS; -+ struct nlattr *dl_ul_ba = NULL, *tid_ba = NULL; ++ struct nlattr *ctx_ba;  + u8 tid;  + -+ if (!dl) -+ ba_params_attr = NL80211_SMD_CTX_UL_ATTR_BA_PARAMS; -+ -+ dl_ul_ba = nla_nest_start(msg, ba_params_attr); -+ if (!dl_ul_ba) ++ ctx_ba = nla_nest_start(msg, NL80211_ST_CTX_INFO_ATTR_BA_PARAMS); ++ if (!ctx_ba)  + return -ENOBUFS;  + -+ for_each_set_bit(tid, tid_bmap, IEEE80211_SMD_CTX_NUM_TIDS) { -+ const struct ieee80211_smd_ctx_ba *ba = &ba_tids[tid]; ++ for_each_set_bit(tid, &tid_bmap, IEEE80211_ST_CTX_NUM_TIDS) { ++ const struct ieee80211_st_ctx_ba *ba = &ba_tids[tid]; ++ struct nlattr *tid_ba = nla_nest_start(msg, tid + 1);  + -+ tid_ba = nla_nest_start(msg, tid + 1);  + if (!tid_ba)  + goto nla_fail;  + -+ if (nla_put_u16(msg, NL80211_SMD_CTX_BA_ATTR_BUFF_SIZE, ++ if (nla_put_u16(msg, NL80211_ST_CTX_BA_ATTR_BUFF_SIZE,  + ba->buffer_size) || -+ nla_put_u8(msg, NL80211_SMD_CTX_BA_ATTR_POLICY, ++ nla_put_u8(msg, NL80211_ST_CTX_BA_ATTR_POLICY,  + ba->ba_policy) ||  + (ba->amsdu_supported &&  + nla_put_flag(msg, -+ NL80211_SMD_CTX_BA_ATTR_AMSDU_SUPPORT)) || -+ nla_put_u16(msg, NL80211_SMD_CTX_BA_ATTR_TIMEOUT, ++ NL80211_ST_CTX_BA_ATTR_AMSDU_SUPPORT)) || ++ nla_put_u16(msg, NL80211_ST_CTX_BA_ATTR_TIMEOUT,  + ba->timeout) ||  + (ba->ext_no_frag && -+ nla_put_flag(msg, NL80211_SMD_CTX_BA_ATTR_EXT_NO_FRAG)) || -+ nla_put_u8(msg, NL80211_SMD_CTX_BA_ATTR_EXT_FRAG_LEVEL, ++ nla_put_flag(msg, NL80211_ST_CTX_BA_ATTR_EXT_NO_FRAG)) || ++ nla_put_u8(msg, NL80211_ST_CTX_BA_ATTR_EXT_FRAG_LEVEL,  + ba->extfrag_level) || -+ nla_put_u16(msg, NL80211_SMD_CTX_BA_ATTR_EXT_BUFF_SIZE, -+ ba->ext_buffer_size) || -+ (dl && nla_put_u16(msg, NL80211_SMD_CTX_BA_ATTR_WINSTARTO, ++ (dl && nla_put_u16(msg, NL80211_ST_CTX_BA_ATTR_WINSTARTO,  + ba->winstarto))) {  + nla_nest_cancel(msg, tid_ba);  + goto nla_fail; @@ net/wireless/nl80211.c: nl80211_epcs_cfg(struct sk_buff *skb, struct genl_info *  + nla_nest_end(msg, tid_ba);  + }  + -+ nla_nest_end(msg, dl_ul_ba); ++ nla_nest_end(msg, ctx_ba);  + return 0;  +  +nla_fail: -+ nla_nest_cancel(msg, dl_ul_ba);  + return -ENOBUFS;  +}  + -+static int nl80211_put_smd_ctx(struct sk_buff *msg, -+ struct cfg80211_smd_transition_info *st_info) ++static int nl80211_put_st_ctx(struct sk_buff *msg, ++ struct cfg80211_smd_transition_info *st_info)  +{ -+ struct nlattr *dl_sn = NULL, *ul_sn = NULL, *ul_pn = NULL; -+ struct nlattr *smd_ctx = NULL, *dl = NULL, *ul = NULL; -+ const struct ieee80211_smd_ctx *ctx; -+ unsigned long dl_tid_bmap = 0, ul_tid_bmap = 0; -+ bool pn_valid; -+ u8 tid; ++ unsigned long dl_tid_bmap, ul_tid_bmap; ++ const struct ieee80211_st_ctx *ctx; ++ struct nlattr *st_ctx, *dl, *ul;  +  + /* ST Type */ -+ if (nla_put_u8(msg, NL80211_ATTR_SMD_CTX_TYPE, st_info->type)) -+ return -ENOBUFS; ++ if (nla_put_u8(msg, NL80211_ATTR_ST_CTX_TYPE, st_info->type)) ++ goto nla_fail;  + -+ smd_ctx = nla_nest_start(msg, NL80211_ATTR_SMD_CTX); -+ if (!smd_ctx) -+ return -ENOBUFS; ++ st_ctx = nla_nest_start(msg, NL80211_ATTR_ST_CTX); ++ if (!st_ctx) ++ goto nla_fail;  +  + ctx = st_info->ctx;  +  + /* Build DL context */  + dl_tid_bmap = ctx->dl.valid_tid_bmap;  + -+ dl = nla_nest_start(msg, NL80211_SMD_CTX_ATTR_DL); ++ dl = nla_nest_start(msg, NL80211_ST_CTX_ATTR_DL);  + if (!dl)  + goto nla_fail;  + -+ if (nla_put_u8(msg, NL80211_SMD_CTX_DL_ATTR_VALID_TID_BITMAP, -+ ctx->dl.valid_tid_bmap)) -+ goto nla_fail_dl; ++ if (!ctx->no_dl_sn_transfer) { ++ struct nlattr *dl_sn = ++ nla_nest_start(msg, NL80211_ST_CTX_INFO_ATTR_SN); ++ u8 tid;  + -+ if (ctx->dl_sn_valid) { -+ dl_sn = nla_nest_start(msg, NL80211_SMD_CTX_DL_ATTR_SN);  + if (!dl_sn) -+ goto nla_fail_dl; ++ goto nla_fail;  +  + for_each_set_bit(tid, &dl_tid_bmap, -+ IEEE80211_SMD_CTX_NUM_TIDS) { -+ if (nla_put_u16(msg, tid + 1, ctx->dl.sn[tid])) { -+ nla_nest_cancel(msg, dl_sn); -+ goto nla_fail_dl; -+ } ++ IEEE80211_ST_CTX_NUM_TIDS) { ++ struct nlattr *tid_sn = nla_nest_start(msg, tid + 1); ++ ++ if (!tid_sn || ++ nla_put_u16(msg, NL80211_ST_CTX_INFO_ATTR_SN_PER_TID, ++ ctx->dl.sn[tid])) ++ goto nla_fail; ++ ++ nla_nest_end(msg, tid_sn);  + }  + nla_nest_end(msg, dl_sn);  + }  + -+ pn_valid = (ctx->pn_len && ctx->pn_len <= IEEE80211_SMD_CTX_MAX_PN_LEN && -+ ctx->pn_valid); -+ -+ if (pn_valid && -+ nla_put(msg, NL80211_SMD_CTX_DL_ATTR_PN, ctx->pn_len, ctx->dl.pn)) -+ goto nla_fail_dl; ++ if (ctx->pn_valid && ++ nla_put(msg, NL80211_ST_CTX_INFO_ATTR_DL_PN, ++ IEEE80211_CCMP_PN_LEN, ctx->dl.pn)) ++ goto nla_fail;  +  + if (ctx->ba_params_valid && -+ nl80211_put_smd_ctx_ba_params(msg, &dl_tid_bmap, -+ ctx->dl.ba, true)) -+ goto nla_fail_dl; ++ nl80211_put_st_ctx_ba_params(msg, dl_tid_bmap, ctx->dl.ba, true)) ++ goto nla_fail;  + -+ if (ctx->dl_sn_valid && ctx->mgmt_tid_valid && -+ nla_put_u16(msg, NL80211_SMD_CTX_DL_ATTR_MGMT_SN, ctx->dl.mgmt_sn)) -+ goto nla_fail_dl; ++ if (!ctx->no_dl_sn_transfer && ctx->mgmt_tid_valid && ++ nla_put_u16(msg, NL80211_ST_CTX_INFO_ATTR_MGMT_SN, ctx->dl.mgmt_sn)) ++ goto nla_fail;  +  + nla_nest_end(msg, dl);  +  + /* Build UL context */  + ul_tid_bmap = ctx->ul.valid_tid_bmap;  + -+ ul = nla_nest_start(msg, NL80211_SMD_CTX_ATTR_UL); ++ ul = nla_nest_start(msg, NL80211_ST_CTX_ATTR_UL);  + if (!ul)  + goto nla_fail;  + -+ if (nla_put_u8(msg, NL80211_SMD_CTX_UL_ATTR_VALID_TID_BITMAP, -+ ctx->ul.valid_tid_bmap)) -+ goto nla_fail_ul; ++ if (!ctx->no_ul_sn_transfer) { ++ struct nlattr *ul_sn = ++ nla_nest_start(msg, NL80211_ST_CTX_INFO_ATTR_SN); ++ u8 tid;  + -+ if (ctx->ul_sn_valid) { -+ ul_sn = nla_nest_start(msg, NL80211_SMD_CTX_UL_ATTR_SN);  + if (!ul_sn) -+ goto nla_fail_ul; ++ goto nla_fail;  +  + for_each_set_bit(tid, &ul_tid_bmap, -+ IEEE80211_SMD_CTX_NUM_TIDS) { -+ if (nla_put_u16(msg, tid + 1, ctx->ul.sn[tid])) { -+ nla_nest_cancel(msg, ul_sn); -+ goto nla_fail_ul; -+ } ++ IEEE80211_ST_CTX_NUM_TIDS) { ++ struct nlattr *tid_sn = nla_nest_start(msg, tid + 1); ++ ++ if (!tid_sn || ++ nla_put_u16(msg, NL80211_ST_CTX_INFO_ATTR_SN_PER_TID, ++ ctx->ul.sn[tid])) ++ goto nla_fail; ++ ++ nla_nest_end(msg, tid_sn);  + }  + nla_nest_end(msg, ul_sn);  + }  + -+ if (pn_valid) { -+ ul_pn = nla_nest_start(msg, NL80211_SMD_CTX_UL_ATTR_PN); ++ if (ctx->pn_valid) { ++ struct nlattr *ul_pn = ++ nla_nest_start(msg, NL80211_ST_CTX_INFO_ATTR_UL_PN); ++ u8 tid; ++  + if (!ul_pn) -+ goto nla_fail_ul; ++ goto nla_fail;  +  + for_each_set_bit(tid, &ul_tid_bmap, -+ IEEE80211_SMD_CTX_NUM_TIDS) { -+ if (nla_put(msg, tid + 1, ctx->pn_len, -+ ctx->ul.pn[tid])) { -+ nla_nest_cancel(msg, ul_pn); -+ goto nla_fail_ul; -+ } ++ IEEE80211_ST_CTX_NUM_TIDS) { ++ struct nlattr *tid_pn = nla_nest_start(msg, tid + 1); ++ ++ if (!tid_pn || ++ nla_put(msg, NL80211_ST_CTX_INFO_ATTR_UL_PN_PER_TID, ++ IEEE80211_CCMP_PN_LEN, ctx->ul.pn[tid])) ++ goto nla_fail; ++ nla_nest_end(msg, tid_pn);  + }  + nla_nest_end(msg, ul_pn);  + }  +  + if (ctx->ba_params_valid && -+ nl80211_put_smd_ctx_ba_params(msg, &ul_tid_bmap, -+ ctx->ul.ba, false)) -+ goto nla_fail_ul; ++ nl80211_put_st_ctx_ba_params(msg, ul_tid_bmap, ctx->ul.ba, false)) ++ goto nla_fail;  +  + if (ctx->mgmt_tid_valid) { -+ if (ctx->ul_sn_valid && -+ nla_put_u16(msg, NL80211_SMD_CTX_UL_ATTR_MGMT_SN, ++ if (!ctx->no_ul_sn_transfer && ++ nla_put_u16(msg, NL80211_ST_CTX_INFO_ATTR_MGMT_SN,  + ctx->ul.mgmt_sn)) -+ goto nla_fail_ul; ++ goto nla_fail;  + -+ if (pn_valid && -+ nla_put(msg, NL80211_SMD_CTX_UL_ATTR_MGMT_PN, -+ ctx->pn_len, ctx->ul.mgmt_pn)) -+ goto nla_fail_ul; ++ if (ctx->pn_valid && ++ nla_put(msg, NL80211_ST_CTX_INFO_ATTR_UL_MGMT_PN, ++ IEEE80211_CCMP_PN_LEN, ctx->ul.mgmt_pn)) ++ goto nla_fail;  + }  +  + nla_nest_end(msg, ul);  + -+ nla_nest_end(msg, smd_ctx); ++ nla_nest_end(msg, st_ctx);  +  + return 0;  + -+nla_fail_ul: -+ nla_nest_cancel(msg, ul); -+ -+nla_fail_dl: -+ nla_nest_cancel(msg, dl); -+  +nla_fail: -+ nla_nest_cancel(msg, smd_ctx); -+ return -EINVAL; ++ return -ENOBUFS;  +}  + #define NL80211_FLAG_NEED_WIPHY 0x01 #define NL80211_FLAG_NEED_NETDEV 0x02 #define NL80211_FLAG_NEED_RTNL 0x04  @@ net/wireless/nl80211.c: int nl80211_send_mgmt(struct cfg80211_registered_device *rdev, - struct cfg80211_rx_info *info, gfp_t gfp) - { - struct net_device *netdev = wdev->netdev; -+ int st_roaming_data_len = 0; struct sk_buff *msg; void *hdr;   - msg = nlmsg_new(100 + info->len, gfp); -+ if (info->st_info.ctx) -+ st_roaming_data_len = nl80211_smd_ctx_nl_size(&info->st_info); -+ -+ msg = nlmsg_new(100 + info->len + st_roaming_data_len, gfp); ++ msg = nlmsg_new(NLMSG_DEFAULT_SIZE, gfp); if (!msg) return -ENOMEM;  @@ net/wireless/nl80211.c: int nl80211_send_mgmt(struct cfg80211_registered_device nla_put_flag(msg, NL80211_ATTR_FRAME_NO_STA))) goto nla_put_failure;  -+ if (st_roaming_data_len && -+ nl80211_put_smd_ctx(msg, &info->st_info)) ++ if (info->st_info.ctx && ++ nl80211_put_st_ctx(msg, &info->st_info))  + goto nla_put_failure;  + genlmsg_end(msg, hdr);  9: f4ebcafaf817 ! 9: 2af1aec01f38 wifi: nl80211/cfg80211: add support for SMD context programming @@ Metadata Author: Pooventhiran G   ## Commit message ## - wifi: nl80211/cfg80211: add support for SMD context programming + wifi: nl80211/cfg80211: add support for ST context programming  On the target AP MLD to which the STA will be transitioning, the dynamic context collected and sent by the current AP MLD needs to be programmed @@ Commit message Such data include Sequence Number (SN), Packet Number (PN), BlockAck sessions, and any driver-specific data.  - Add nl80211 support to handle NL80211_CMD_SET_SMD_CTX, parse the SMD + Add nl80211 support to handle NL80211_CMD_SET_ST_CTX, parse the ST context attributes, and invoke the cfg80211 operation on the target AP MLD.  @@ Commit message  ## include/net/cfg80211.h ##  @@ include/net/cfg80211.h: struct cfg80211_smd_transition_info { - * - * @start_pd: Start the PD interface. - * @stop_pd: Stop the PD interface. + * @execute_st: Execute a previously prepared SMD transition + * @abandon_st: Abandon a prepared SMD transition to the given AP MLD. + * If @local_only is true don't send the ST abandon action frame.  + * -+ * @set_smd_ctx: Set UHR SMD context data for the non-AP MLD. @st_info->ctx is -+ * freed immediately after this call returns; drivers must copy -+ * @st_info->ctx if asynchronous processing is required. ++ * @set_st_ctx: Set ST context data for the non-AP MLD. @st_info->ctx is freed ++ * immediately after this call returns; drivers must copy @st_info->ctx ++ * if asynchronous processing is required. */ struct cfg80211_ops { int (*suspend)(struct wiphy *wiphy, struct cfg80211_wowlan *wow);  @@ include/net/cfg80211.h: struct cfg80211_ops { - bool val); - int (*start_pd)(struct wiphy *wiphy, struct wireless_dev *wdev); - void (*stop_pd)(struct wiphy *wiphy, struct wireless_dev *wdev); -+ int (*set_smd_ctx)(struct wiphy *wiphy, struct wireless_dev *wdev, -+ const u8 *addr, -+ struct cfg80211_smd_transition_info *st_info); + struct cfg80211_st_exec_request *req); + int (*abandon_st)(struct wiphy *wiphy, struct net_device *dev, + const u8 *ap_mld_addr, bool local_only); ++ int (*set_st_ctx)(struct wiphy *wiphy, struct wireless_dev *wdev, ++ const u8 *addr, ++ struct cfg80211_smd_transition_info *st_info); };  /*  ## net/wireless/nl80211.c ## -@@ net/wireless/nl80211.c: static int nl80211_put_smd_ctx(struct sk_buff *msg, - return -EINVAL; +@@ net/wireless/nl80211.c: static int nl80211_put_st_ctx(struct sk_buff *msg, + return -ENOBUFS; }  -+static int -+nl80211_parse_smd_ctx_ba_params(struct nlattr *tb, -+ struct ieee80211_smd_ctx_ba *ba_tids) ++static int nl80211_parse_st_ctx_ba_params(struct nlattr *tb, ++ struct ieee80211_st_ctx_ba *ba_tids, ++ u8 *valid_tid_bmap)  +{ -+ struct nlattr *ba_tb[NL80211_SMD_CTX_BA_ATTR_MAX + 1]; -+ struct ieee80211_smd_ctx_ba *ba;  + struct nlattr *ba_attr;  + int n_tids = 0; -+ int rem, tid; ++ int rem;  +  + nla_for_each_nested(ba_attr, tb, rem) { -+ tid = nla_type(ba_attr) - 1; -+ if (tid < 0 || tid >= IEEE80211_SMD_CTX_NUM_TIDS) -+ return -EINVAL; ++ struct nlattr *ba_tb[NL80211_ST_CTX_BA_ATTR_MAX + 1]; ++ struct ieee80211_st_ctx_ba *ba; ++ int tid = nla_type(ba_attr) - 1;  + -+ if (nla_parse_nested(ba_tb, NL80211_SMD_CTX_BA_ATTR_MAX, -+ ba_attr, nl80211_smd_ctx_ba_policy, -+ NULL)) ++ if (tid < 0 || tid >= IEEE80211_ST_CTX_NUM_TIDS)  + return -EINVAL;  + ++ nla_parse_nested(ba_tb, NL80211_ST_CTX_BA_ATTR_MAX, ++ ba_attr, NULL, NULL); ++  + ba = &ba_tids[tid];  + -+ if (ba_tb[NL80211_SMD_CTX_BA_ATTR_BUFF_SIZE]) ++ if (ba_tb[NL80211_ST_CTX_BA_ATTR_BUFF_SIZE])  + ba->buffer_size = -+ nla_get_u16(ba_tb[NL80211_SMD_CTX_BA_ATTR_BUFF_SIZE]); ++ nla_get_u16(ba_tb[NL80211_ST_CTX_BA_ATTR_BUFF_SIZE]);  + -+ if (ba_tb[NL80211_SMD_CTX_BA_ATTR_POLICY]) ++ if (ba_tb[NL80211_ST_CTX_BA_ATTR_POLICY])  + ba->ba_policy = -+ nla_get_u8(ba_tb[NL80211_SMD_CTX_BA_ATTR_POLICY]); ++ nla_get_u8(ba_tb[NL80211_ST_CTX_BA_ATTR_POLICY]);  +  + ba->amsdu_supported = -+ !!ba_tb[NL80211_SMD_CTX_BA_ATTR_AMSDU_SUPPORT]; ++ nla_get_flag(ba_tb[NL80211_ST_CTX_BA_ATTR_AMSDU_SUPPORT]);  + -+ if (ba_tb[NL80211_SMD_CTX_BA_ATTR_TIMEOUT]) ++ if (ba_tb[NL80211_ST_CTX_BA_ATTR_TIMEOUT])  + ba->timeout = -+ nla_get_u16(ba_tb[NL80211_SMD_CTX_BA_ATTR_TIMEOUT]); ++ nla_get_u16(ba_tb[NL80211_ST_CTX_BA_ATTR_TIMEOUT]);  + -+ ba->ext_no_frag = !!ba_tb[NL80211_SMD_CTX_BA_ATTR_EXT_NO_FRAG]; ++ ba->ext_no_frag = ++ nla_get_flag(ba_tb[NL80211_ST_CTX_BA_ATTR_EXT_NO_FRAG]);  + -+ if (ba_tb[NL80211_SMD_CTX_BA_ATTR_EXT_FRAG_LEVEL]) ++ if (ba_tb[NL80211_ST_CTX_BA_ATTR_EXT_FRAG_LEVEL])  + ba->extfrag_level = -+ nla_get_u8(ba_tb[NL80211_SMD_CTX_BA_ATTR_EXT_FRAG_LEVEL]); ++ nla_get_u8(ba_tb[NL80211_ST_CTX_BA_ATTR_EXT_FRAG_LEVEL]);  + -+ if (ba_tb[NL80211_SMD_CTX_BA_ATTR_EXT_BUFF_SIZE]) -+ ba->ext_buffer_size = -+ nla_get_u16(ba_tb[NL80211_SMD_CTX_BA_ATTR_EXT_BUFF_SIZE]); -+ -+ if (ba_tb[NL80211_SMD_CTX_BA_ATTR_WINSTARTO]) ++ if (ba_tb[NL80211_ST_CTX_BA_ATTR_WINSTARTO])  + ba->winstarto = -+ nla_get_u16(ba_tb[NL80211_SMD_CTX_BA_ATTR_WINSTARTO]); ++ nla_get_u16(ba_tb[NL80211_ST_CTX_BA_ATTR_WINSTARTO]);  + ++ *valid_tid_bmap |= BIT(tid);  + n_tids++;  + }  + @@ net/wireless/nl80211.c: static int nl80211_put_smd_ctx(struct sk_buff *msg,  + return 0;  +}  + -+static int nl80211_parse_smd_ctx(struct genl_info *info, -+ struct cfg80211_smd_transition_info *st_info) ++static int nl80211_parse_st_ctx(struct genl_info *info, ++ struct cfg80211_smd_transition_info *st_info)  +{ -+ struct nlattr *dl_tb[NL80211_SMD_CTX_DL_ATTR_MAX + 1]; -+ struct nlattr *ul_tb[NL80211_SMD_CTX_UL_ATTR_MAX + 1]; -+ struct nlattr *tb[NL80211_SMD_CTX_ATTR_MAX + 1]; -+ struct ieee80211_smd_ctx *ctx; -+ struct nlattr *bmap_attr; -+ -+ st_info->type = nla_get_u8(info->attrs[NL80211_ATTR_SMD_CTX_TYPE]); -+ -+ if (nla_parse_nested(tb, NL80211_SMD_CTX_ATTR_MAX, -+ info->attrs[NL80211_ATTR_SMD_CTX], -+ nl80211_smd_ctx_policy, NULL)) { -+ GENL_SET_ERR_MSG(info, "failed to parse SMD context"); -+ return -EINVAL; -+ } ++ struct nlattr *ctx_tb[NL80211_ST_CTX_INFO_ATTR_MAX + 1]; ++ struct nlattr *tb[NL80211_ST_CTX_ATTR_MAX + 1]; ++ struct ieee80211_st_ctx *ctx; ++ struct nlattr *ba_attr; ++ ++ st_info->ctx = NULL;  + -+ ctx = kzalloc(sizeof(*ctx), GFP_KERNEL); ++ ctx = kzalloc_obj(*ctx);  + if (!ctx)  + return -ENOMEM;  + -+ st_info->ctx = ctx; ++ nla_parse_nested(tb, NL80211_ST_CTX_ATTR_MAX, ++ info->attrs[NL80211_ATTR_ST_CTX], NULL, NULL);  + -+ /* DL Context */ -+ if (tb[NL80211_SMD_CTX_ATTR_DL]) { -+ struct nlattr *ba_attr; -+ -+ if (nla_parse_nested(dl_tb, NL80211_SMD_CTX_DL_ATTR_MAX, -+ tb[NL80211_SMD_CTX_ATTR_DL], -+ nl80211_smd_ctx_dl_policy, NULL)) { -+ GENL_SET_ERR_MSG(info, "failed to parse DL context"); -+ goto err_free_ctx; -+ } ++ ctx->no_dl_sn_transfer = 1; ++ ctx->no_ul_sn_transfer = 1;  + -+ bmap_attr = dl_tb[NL80211_SMD_CTX_DL_ATTR_VALID_TID_BITMAP]; -+ if (bmap_attr) -+ ctx->dl.valid_tid_bmap = nla_get_u8(bmap_attr); ++ /* DL Context */ ++ if (tb[NL80211_ST_CTX_ATTR_DL]) { ++ nla_parse_nested(ctx_tb, NL80211_ST_CTX_INFO_ATTR_MAX, ++ tb[NL80211_ST_CTX_ATTR_DL], NULL, NULL);  + -+ if (dl_tb[NL80211_SMD_CTX_DL_ATTR_SN]) { ++ if (ctx_tb[NL80211_ST_CTX_INFO_ATTR_SN]) {  + struct nlattr *sn_attr;  + int n_tids = 0;  + int rem, tid;  +  + nla_for_each_nested(sn_attr, -+ dl_tb[NL80211_SMD_CTX_DL_ATTR_SN], ++ ctx_tb[NL80211_ST_CTX_INFO_ATTR_SN],  + rem) { ++ struct nlattr *per_tid[NL80211_ST_CTX_INFO_ATTR_MAX + 1]; ++ struct nlattr *sn; ++  + tid = nla_type(sn_attr) - 1;  + if (tid < 0 || -+ tid >= IEEE80211_SMD_CTX_NUM_TIDS) { ++ tid >= IEEE80211_ST_CTX_NUM_TIDS) {  + GENL_SET_ERR_MSG(info,  + "invalid DL SN tid");  + goto err_free_ctx;  + }  + -+ if (nla_len(sn_attr) != sizeof(u16)) { ++ nla_parse_nested(per_tid, ++ NL80211_ST_CTX_INFO_ATTR_MAX, ++ sn_attr, NULL, NULL); ++ ++ sn = per_tid[NL80211_ST_CTX_INFO_ATTR_SN_PER_TID]; ++ if (!sn) {  + GENL_SET_ERR_MSG(info, -+ "invalid DL SN len"); ++ "no DL SN for tid");  + goto err_free_ctx;  + }  + -+ ctx->dl.sn[tid] = nla_get_u16(sn_attr); ++ ctx->dl.sn[tid] = nla_get_u16(sn); ++ ctx->dl.valid_tid_bmap |= BIT(tid);  + n_tids++;  + }  + @@ net/wireless/nl80211.c: static int nl80211_put_smd_ctx(struct sk_buff *msg,  + goto err_free_ctx;  + }  + -+ ctx->dl_sn_valid = 1; ++ ctx->no_dl_sn_transfer = 0;  + }  + -+ if (dl_tb[NL80211_SMD_CTX_DL_ATTR_PN]) { -+ const u8 *pn_data = -+ nla_data(dl_tb[NL80211_SMD_CTX_DL_ATTR_PN]); -+ -+ ctx->pn_len = -+ nla_len(dl_tb[NL80211_SMD_CTX_DL_ATTR_PN]); -+ if (ctx->pn_len > IEEE80211_SMD_CTX_MAX_PN_LEN) { -+ GENL_SET_ERR_MSG(info, "invalid DL PN length"); -+ goto err_free_ctx; -+ } -+ -+ memcpy(ctx->dl.pn, pn_data, ctx->pn_len); ++ if (ctx_tb[NL80211_ST_CTX_INFO_ATTR_DL_PN]) { ++ memcpy(ctx->dl.pn, ++ nla_data(ctx_tb[NL80211_ST_CTX_INFO_ATTR_DL_PN]), ++ nla_len(ctx_tb[NL80211_ST_CTX_INFO_ATTR_DL_PN]));  + ctx->pn_valid = 1;  + }  + -+ ba_attr = dl_tb[NL80211_SMD_CTX_DL_ATTR_BA_PARAMS]; ++ ba_attr = ctx_tb[NL80211_ST_CTX_INFO_ATTR_BA_PARAMS];  + if (ba_attr) { -+ if (nl80211_parse_smd_ctx_ba_params(ba_attr, -+ ctx->dl.ba)) { ++ if (nl80211_parse_st_ctx_ba_params(ba_attr, ++ ctx->dl.ba, ++ &ctx->dl.valid_tid_bmap)) {  + GENL_SET_ERR_MSG(info,  + "failed to parse DL BlockAck params");  + goto err_free_ctx;  + } -+  + ctx->ba_params_valid = 1;  + }  + -+ if (dl_tb[NL80211_SMD_CTX_DL_ATTR_MGMT_SN]) { ++ if (ctx_tb[NL80211_ST_CTX_INFO_ATTR_MGMT_SN]) {  + ctx->dl.mgmt_sn = -+ nla_get_u16(dl_tb[NL80211_SMD_CTX_DL_ATTR_MGMT_SN]); ++ nla_get_u16(ctx_tb[NL80211_ST_CTX_INFO_ATTR_MGMT_SN]);  + ctx->mgmt_tid_valid = 1; -+ ctx->dl_sn_valid = 1; ++ ctx->no_dl_sn_transfer = 0;  + }  + }  +  + /* UL Context */ -+ if (tb[NL80211_SMD_CTX_ATTR_UL]) { -+ struct nlattr *ba_attr; -+ -+ if (nla_parse_nested(ul_tb, NL80211_SMD_CTX_UL_ATTR_MAX, -+ tb[NL80211_SMD_CTX_ATTR_UL], -+ nl80211_smd_ctx_ul_policy, NULL)) { -+ GENL_SET_ERR_MSG(info, "failed to parse UL context"); -+ goto err_free_ctx; -+ } ++ if (tb[NL80211_ST_CTX_ATTR_UL]) { ++ nla_parse_nested(ctx_tb, NL80211_ST_CTX_INFO_ATTR_MAX, ++ tb[NL80211_ST_CTX_ATTR_UL], NULL, NULL);  + -+ bmap_attr = ul_tb[NL80211_SMD_CTX_UL_ATTR_VALID_TID_BITMAP]; -+ if (bmap_attr) -+ ctx->ul.valid_tid_bmap = nla_get_u8(bmap_attr); -+ -+ if (ul_tb[NL80211_SMD_CTX_UL_ATTR_SN]) { ++ if (ctx_tb[NL80211_ST_CTX_INFO_ATTR_SN]) {  + struct nlattr *sn_attr;  + int n_tids = 0;  + int rem, tid;  +  + nla_for_each_nested(sn_attr, -+ ul_tb[NL80211_SMD_CTX_UL_ATTR_SN], ++ ctx_tb[NL80211_ST_CTX_INFO_ATTR_SN],  + rem) { ++ struct nlattr *per_tid[NL80211_ST_CTX_INFO_ATTR_MAX + 1]; ++ struct nlattr *sn; ++  + tid = nla_type(sn_attr) - 1;  + if (tid < 0 || -+ tid >= IEEE80211_SMD_CTX_NUM_TIDS) { ++ tid >= IEEE80211_ST_CTX_NUM_TIDS) {  + GENL_SET_ERR_MSG(info,  + "invalid UL SN tid");  + goto err_free_ctx;  + }  + -+ if (nla_len(sn_attr) != sizeof(u16)) { ++ nla_parse_nested(per_tid, ++ NL80211_ST_CTX_INFO_ATTR_MAX, ++ sn_attr, NULL, NULL); ++ ++ sn = per_tid[NL80211_ST_CTX_INFO_ATTR_SN_PER_TID]; ++ if (!sn) {  + GENL_SET_ERR_MSG(info, -+ "invalid UL SN len"); ++ "no UL SN for tid");  + goto err_free_ctx;  + }  + -+ ctx->ul.sn[tid] = nla_get_u16(sn_attr); ++ ctx->ul.sn[tid] = nla_get_u16(sn); ++ ctx->ul.valid_tid_bmap |= BIT(tid);  + n_tids++;  + }  + @@ net/wireless/nl80211.c: static int nl80211_put_smd_ctx(struct sk_buff *msg,  + goto err_free_ctx;  + }  + -+ ctx->ul_sn_valid = 1; ++ ctx->no_ul_sn_transfer = 0;  + }  + -+ if (ul_tb[NL80211_SMD_CTX_UL_ATTR_PN]) { ++ if (ctx_tb[NL80211_ST_CTX_INFO_ATTR_UL_PN]) {  + struct nlattr *pn_attr;  + int n_tids = 0;  + int rem, tid;  +  + nla_for_each_nested(pn_attr, -+ ul_tb[NL80211_SMD_CTX_UL_ATTR_PN], ++ ctx_tb[NL80211_ST_CTX_INFO_ATTR_UL_PN],  + rem) { -+ u8 pn_len; ++ struct nlattr *per_tid[NL80211_ST_CTX_INFO_ATTR_MAX + 1]; ++ struct nlattr *pn;  +  + tid = nla_type(pn_attr) - 1;  + if (tid < 0 || -+ tid >= IEEE80211_SMD_CTX_NUM_TIDS) { ++ tid >= IEEE80211_ST_CTX_NUM_TIDS) {  + GENL_SET_ERR_MSG(info,  + "invalid UL PN tid");  + goto err_free_ctx;  + }  + -+ /* -+ * PN length must be the same for all DL and -+ * UL TIDs. -+ */ -+ pn_len = nla_len(pn_attr); -+ if (pn_len > IEEE80211_SMD_CTX_MAX_PN_LEN || -+ (ctx->pn_len && pn_len != ctx->pn_len)) { ++ nla_parse_nested(per_tid, ++ NL80211_ST_CTX_INFO_ATTR_MAX, ++ pn_attr, NULL, NULL); ++ ++ pn = per_tid[NL80211_ST_CTX_INFO_ATTR_UL_PN_PER_TID]; ++ if (!pn) {  + GENL_SET_ERR_MSG(info, -+ "invalid PN length"); ++ "no UL PN for tid");  + goto err_free_ctx;  + } -+ ctx->pn_len = pn_len;  + -+ memcpy(ctx->ul.pn[tid], nla_data(pn_attr), -+ ctx->pn_len); ++ memcpy(ctx->ul.pn[tid], pn, nla_len(pn));  + n_tids++;  + }  + @@ net/wireless/nl80211.c: static int nl80211_put_smd_ctx(struct sk_buff *msg,  + ctx->pn_valid = 1;  + }  + -+ ba_attr = ul_tb[NL80211_SMD_CTX_UL_ATTR_BA_PARAMS]; ++ ba_attr = ctx_tb[NL80211_ST_CTX_INFO_ATTR_BA_PARAMS];  + if (ba_attr) { -+ if (nl80211_parse_smd_ctx_ba_params(ba_attr, -+ ctx->ul.ba)) { ++ if (nl80211_parse_st_ctx_ba_params(ba_attr, ++ ctx->ul.ba, ++ &ctx->ul.valid_tid_bmap)) {  + GENL_SET_ERR_MSG(info,  + "failed to parse UL BlockAck params");  + goto err_free_ctx;  + } -+  + ctx->ba_params_valid = 1;  + }  + -+ if (ul_tb[NL80211_SMD_CTX_UL_ATTR_MGMT_SN]) { ++ if (ctx_tb[NL80211_ST_CTX_INFO_ATTR_MGMT_SN]) {  + ctx->ul.mgmt_sn = -+ nla_get_u16(ul_tb[NL80211_SMD_CTX_UL_ATTR_MGMT_SN]); ++ nla_get_u16(ctx_tb[NL80211_ST_CTX_INFO_ATTR_MGMT_SN]);  + ctx->mgmt_tid_valid = 1; -+ ctx->ul_sn_valid = 1; ++ ctx->no_ul_sn_transfer = 0;  + }  + -+ if (ul_tb[NL80211_SMD_CTX_UL_ATTR_MGMT_PN]) { -+ u8 pn_len = nla_len(ul_tb[NL80211_SMD_CTX_UL_ATTR_MGMT_PN]); -+ -+ if (pn_len > IEEE80211_SMD_CTX_MAX_PN_LEN || -+ (ctx->pn_len && pn_len != ctx->pn_len)) { -+ GENL_SET_ERR_MSG(info, "invalid UL mgmt PN length"); -+ goto err_free_ctx; -+ } ++ if (ctx_tb[NL80211_ST_CTX_INFO_ATTR_UL_MGMT_PN]) {  + memcpy(ctx->ul.mgmt_pn, -+ nla_data(ul_tb[NL80211_SMD_CTX_UL_ATTR_MGMT_PN]), -+ pn_len); ++ nla_data(ctx_tb[NL80211_ST_CTX_INFO_ATTR_UL_MGMT_PN]), ++ IEEE80211_CCMP_PN_LEN);  + ctx->mgmt_tid_valid = 1;  + ctx->pn_valid = 1;  + }  + }  + ++ st_info->type = nla_get_u8(info->attrs[NL80211_ATTR_ST_CTX_TYPE]); ++ st_info->ctx = ctx; ++  + return 0;  +  +err_free_ctx:  + kfree(ctx); -+ st_info->ctx = NULL;  + return -EINVAL;  +}  + @@ net/wireless/nl80211.c: static int nl80211_set_sar_specs(struct sk_buff *skb, st return err; }  -+static int nl80211_set_smd_ctx(struct sk_buff *skb, struct genl_info *info) ++static int nl80211_set_st_ctx(struct sk_buff *skb, struct genl_info *info)  +{  + struct cfg80211_registered_device *rdev = info->user_ptr[0];  + struct cfg80211_smd_transition_info st_info = {}; @@ net/wireless/nl80211.c: static int nl80211_set_sar_specs(struct sk_buff *skb, st  + const u8 *addr;  + int err;  + -+ if (!rdev->ops->set_smd_ctx) ++ if (!rdev->ops->set_st_ctx)  + return -EOPNOTSUPP;  +  + if (wdev->iftype != NL80211_IFTYPE_AP && @@ net/wireless/nl80211.c: static int nl80211_set_sar_specs(struct sk_buff *skb, st  + return -EINVAL;  +  + if (!info->attrs[NL80211_ATTR_MLD_ADDR] || -+ !info->attrs[NL80211_ATTR_SMD_CTX] || -+ !info->attrs[NL80211_ATTR_SMD_CTX_TYPE]) { ++ !info->attrs[NL80211_ATTR_ST_CTX] || ++ !info->attrs[NL80211_ATTR_ST_CTX_TYPE]) {  + GENL_SET_ERR_MSG(info, "required attributes are missing");  + return -EINVAL;  + }  +  + addr = nla_data(info->attrs[NL80211_ATTR_MLD_ADDR]);  + -+ err = nl80211_parse_smd_ctx(info, &st_info); ++ err = nl80211_parse_st_ctx(info, &st_info);  + if (err)  + return err;  +  + /* drivers must copy @ctx for any deferred processing */ -+ err = rdev_set_smd_ctx(rdev, wdev, addr, &st_info); ++ err = rdev_set_st_ctx(rdev, wdev, addr, &st_info);  +  + kfree(st_info.ctx);  + return err; @@ net/wireless/nl80211.c: static int nl80211_set_sar_specs(struct sk_buff *skb, st ((__sel) == (value)) ? NL80211_IFL_SEL_##name : int __missing_selector(void);  @@ net/wireless/nl80211.c: static const struct genl_small_ops nl80211_small_ops[] = { - .internal_flags = IFLAGS(NL80211_FLAG_NEED_NETDEV_UP | - NL80211_FLAG_NO_WIPHY_MTX), + .flags = GENL_UNS_ADMIN_PERM, + .internal_flags = IFLAGS(NL80211_FLAG_NEED_NETDEV_UP), },  + { -+ .cmd = NL80211_CMD_SET_SMD_CTX, -+ .doit = nl80211_set_smd_ctx, ++ .cmd = NL80211_CMD_SET_ST_CTX, ++ .doit = nl80211_set_st_ctx,  + .flags = GENL_UNS_ADMIN_PERM,  + .internal_flags = IFLAGS(NL80211_FLAG_NEED_NETDEV_UP |  + NL80211_FLAG_CLEAR_SKB), @@ net/wireless/nl80211.c: static const struct genl_small_ops nl80211_small_ops[] = static struct genl_family nl80211_fam __ro_after_init = {  ## net/wireless/rdev-ops.h ## -@@ net/wireless/rdev-ops.h: rdev_set_epcs(struct cfg80211_registered_device *rdev, +@@ net/wireless/rdev-ops.h: static inline int rdev_abandon_st(struct cfg80211_registered_device *rdev, return ret; }  -+static inline int rdev_set_smd_ctx(struct cfg80211_registered_device *rdev, -+ struct wireless_dev *wdev, const u8 *addr, -+ struct cfg80211_smd_transition_info *st_info) ++static inline int rdev_set_st_ctx(struct cfg80211_registered_device *rdev, ++ struct wireless_dev *wdev, const u8 *addr, ++ struct cfg80211_smd_transition_info *st_info)  +{  + int ret = -EOPNOTSUPP;  + -+ trace_rdev_set_smd_ctx(&rdev->wiphy, wdev, addr, st_info); -+ if (rdev->ops->set_smd_ctx) -+ ret = rdev->ops->set_smd_ctx(&rdev->wiphy, wdev, addr, st_info); ++ trace_rdev_set_st_ctx(&rdev->wiphy, wdev, addr, st_info); ++ if (rdev->ops->set_st_ctx) ++ ret = rdev->ops->set_st_ctx(&rdev->wiphy, wdev, addr, st_info);  + trace_rdev_return_int(&rdev->wiphy, ret);  +  + return ret; @@ net/wireless/rdev-ops.h: rdev_set_epcs(struct cfg80211_registered_device *rdev, #endif /* __CFG80211_RDEV_OPS */  ## net/wireless/trace.h ## -@@ net/wireless/trace.h: TRACE_EVENT(cfg80211_nan_channel_evac, - TP_printk(WDEV_PR_FMT ", " WIPHY_PR_FMT ", " CHAN_DEF_PR_FMT, - WDEV_PR_ARG, WIPHY_PR_ARG, CHAN_DEF_PR_ARG) +@@ net/wireless/trace.h: DEFINE_EVENT(cfg80211_st_evt, cfg80211_st_abandoned, + struct cfg80211_bss **links), + TP_ARGS(netdev, links) );  + -+TRACE_EVENT(rdev_set_smd_ctx, ++TRACE_EVENT(rdev_set_st_ctx,  + TP_PROTO(struct wiphy *wiphy, struct wireless_dev *wdev, const u8 *addr,  + struct cfg80211_smd_transition_info *st_info),  + @@ net/wireless/trace.h: TRACE_EVENT(cfg80211_nan_channel_evac,  + ),  +  + TP_fast_assign( -+ struct ieee80211_smd_ctx *ctx = st_info->ctx; ++ struct ieee80211_st_ctx *ctx = st_info->ctx;  +  + WIPHY_ASSIGN;  + WDEV_ASSIGN; @@ net/wireless/trace.h: TRACE_EVENT(cfg80211_nan_channel_evac,  + __entry->dl_tid_bitmap, __entry->ul_tid_bitmap  + )  +); -+ #endif /* !__RDEV_OPS_TRACE || TRACE_HEADER_MULTI_READ */  #undef TRACE_INCLUDE_PATH 10: 5fab123edc2c ! 10: c194b027c6d4 wifi: nl80211/cfg80211: add support for querying SMD context for target AP MLD @@ Metadata Author: Pooventhiran G   ## Commit message ## - wifi: nl80211/cfg80211: add support for querying SMD context for target AP MLD + wifi: nl80211/cfg80211: add support for querying ST context for target AP MLD  - During SMD BSS Transition, the non-AP MLD that has been prepared with a - target AP MLD may send the ST Execution frame directly to the target AP - MLD. In such scenarios, the target AP MLD should pull the context from - the current AP MLD to program TX and RX queues. + During ST, the non-AP MLD that has been prepared with a target AP MLD + may send the ST Execution frame directly to the target AP MLD. In such + scenarios, the target AP MLD should pull the context from the current + AP MLD to program TX and RX queues.  - Add nl80211 support to handle NL80211_CMD_GET_SMD_CTX, which is sent by + Add nl80211 support to handle NL80211_CMD_GET_ST_CTX, which is sent by userspace of the current AP MLD on behalf of the target AP MLD. This command carries the context type to indicate to the drivers which context needs to be collected. Once the collection is complete, the context is sent back to userspace as an asynchronous multicast event using - NL80211_CMD_SMD_CTX_EVENT with full context data carried in - NL80211_ATTR_SMD_CTX. + NL80211_CMD_ST_CTX_EVENT with full context data carried in + NL80211_ATTR_ST_CTX.  Signed-off-by: Pooventhiran G   ## include/net/cfg80211.h ##  @@ include/net/cfg80211.h: struct cfg80211_smd_transition_info { - enum nl80211_smd_ctx_type type; - }; -  -+/** -+ * struct cfg80211_smd_get_ctx_pending - pending async GET_SMD_CTX request -+ * @list: linkage on wireless_dev::smd_get_ctx_pending_list -+ * @sta_addr: non-AP MLD address for which context was requested -+ * @dev_tracker: tracker object for the netdev referenced -+ */ -+struct cfg80211_smd_get_ctx_pending { -+ struct list_head list; -+ u8 sta_addr[ETH_ALEN]; -+ netdevice_tracker dev_tracker; -+}; -+ - /** - * struct cfg80211_ops - backend description for wireless configuration - * -@@ include/net/cfg80211.h: struct cfg80211_smd_transition_info { - * @set_smd_ctx: Set UHR SMD context data for the non-AP MLD. @st_info->ctx is - * freed immediately after this call returns; drivers must copy - * @st_info->ctx if asynchronous processing is required. -+ * -+ * @get_smd_ctx: Get UHR SMD context data for the non-AP MLD. + * @set_st_ctx: Set ST context data for the non-AP MLD. @st_info->ctx is freed + * immediately after this call returns; drivers must copy @st_info->ctx + * if asynchronous processing is required. ++ * @get_st_ctx: Get ST context data for the non-AP MLD. */ struct cfg80211_ops { int (*suspend)(struct wiphy *wiphy, struct cfg80211_wowlan *wow);  @@ include/net/cfg80211.h: struct cfg80211_ops { - int (*set_smd_ctx)(struct wiphy *wiphy, struct wireless_dev *wdev, - const u8 *addr, - struct cfg80211_smd_transition_info *st_info); -+ int (*get_smd_ctx)(struct wiphy *wiphy, struct wireless_dev *wdev, -+ const u8 *addr, -+ enum nl80211_smd_ctx_type type); + int (*set_st_ctx)(struct wiphy *wiphy, struct wireless_dev *wdev, + const u8 *addr, + struct cfg80211_smd_transition_info *st_info); ++ int (*get_st_ctx)(struct wiphy *wiphy, struct wireless_dev *wdev, ++ const u8 *addr, enum nl80211_st_ctx_type type); };  /* -@@ include/net/cfg80211.h: enum ieee80211_ap_reg_power { - * @links.cac_time_ms: CAC time in ms - * @valid_links: bitmap describing what elements of @links are valid - * @radio_mask: Bitmask of radios that this interface is allowed to operate on. -+ * @smd_get_ctx_lock: lock to protect pending get_smd_ctx requests. -+ * @smd_get_ctx_pending_list: list to track pending get_smd_ctx requests. - */ - struct wireless_dev { - struct wiphy *wiphy; -@@ include/net/cfg80211.h: struct wireless_dev { - } links[IEEE80211_MLD_MAX_NUM_LINKS]; - u16 valid_links; -  -+ /* protects @smd_get_ctx_pending_list */ -+ spinlock_t smd_get_ctx_lock; -+ struct list_head smd_get_ctx_pending_list; -+ - u32 radio_mask; - }; -  -@@ include/net/cfg80211.h: struct ieee80211_smd_ctx { +@@ include/net/cfg80211.h: struct ieee80211_st_ctx { } ul; };   +/** -+ * cfg80211_free_pending_smd_ctx_req - Free remaining entries in the -+ * cfg80211_smd_get_ctx_pending list. -+ * @wdev: wdev that maintains the list -+ * @addr: if @addr is NULL, drain the entire list; otherwise, drain only the -+ * matching entries -+ * -+ * When the current AP MLD requests the station's context, those requests are -+ * maintained in a pending list until drivers notify completion. In case the -+ * device is brought down or the station is removed prematurely, free up the -+ * remaining entries in the list. -+ */ -+void cfg80211_free_pending_smd_ctx_req(struct wireless_dev *wdev, -+ const u8 *addr); -+ -+/** -+ * cfg80211_get_smd_ctx_done - deliver async GET_SMD_CTX result to nl80211 ++ * cfg80211_notify_get_st_ctx_done - deliver async GET_ST_CTX result to ++ * userspace  + * @wdev: wireless device that handled the request  + * @sta_addr: non-AP MLD address the context was collected for -+ * @st_info: SMD BSS Transition Info (set @st_info->ctx to NULL to indicate ++ * @st_info: SMD Transition Info (set @st_info->ctx to NULL to indicate  + * failure)  + * -+ * Called via ieee80211_get_smd_ctx_done after async driver context collection -+ * completes. Finds the matching pending request and sends a multicast -+ * %NL80211_CMD_SMD_CTX_EVENT reply to userspace (MLME group). ++ * Sends a multicast %NL80211_CMD_ST_CTX_EVENT reply to userspace (MLME group).  + *  + * Return: None  + */ -+void cfg80211_get_smd_ctx_done(struct wireless_dev *wdev, -+ const u8 *sta_addr, -+ struct cfg80211_smd_transition_info *st_info); ++void ++cfg80211_notify_get_st_ctx_done(struct wireless_dev *wdev, ++ const u8 *sta_addr, ++ struct cfg80211_smd_transition_info *st_info);  + #endif /* __NET_CFG80211_H */  - ## net/wireless/core.c ## -@@ net/wireless/core.c: void wiphy_rfkill_set_hw_state_reason(struct wiphy *wiphy, bool blocked, - } - EXPORT_SYMBOL(wiphy_rfkill_set_hw_state_reason); -  -+void cfg80211_free_pending_smd_ctx_req(struct wireless_dev *wdev, -+ const u8 *addr) -+{ -+ struct cfg80211_smd_get_ctx_pending *pending, *tmp; -+ -+ spin_lock_bh(&wdev->smd_get_ctx_lock); -+ list_for_each_entry_safe(pending, tmp, -+ &wdev->smd_get_ctx_pending_list, -+ list) { -+ if (!addr || ether_addr_equal(pending->sta_addr, addr)) { -+ list_del(&pending->list); -+ netdev_put(wdev->netdev, &pending->dev_tracker); -+ kfree(pending); -+ } -+ } -+ spin_unlock_bh(&wdev->smd_get_ctx_lock); -+} -+EXPORT_SYMBOL(cfg80211_free_pending_smd_ctx_req); -+ - static void _cfg80211_unregister_wdev(struct wireless_dev *wdev, - bool unregister_netdev) - { -@@ net/wireless/core.c: static void _cfg80211_unregister_wdev(struct wireless_dev *wdev, - } - } -  -+ if (wdev->iftype == NL80211_IFTYPE_AP || -+ wdev->iftype == NL80211_IFTYPE_AP_VLAN) -+ cfg80211_free_pending_smd_ctx_req(wdev, NULL); -+ - wdev->connected = false; - } -  -@@ net/wireless/core.c: void cfg80211_init_wdev(struct wireless_dev *wdev) - INIT_LIST_HEAD(&wdev->pmsr_list); - spin_lock_init(&wdev->pmsr_lock); - wiphy_work_init(&wdev->pmsr_free_wk, cfg80211_pmsr_free_wk); -+ spin_lock_init(&wdev->smd_get_ctx_lock); -+ INIT_LIST_HEAD(&wdev->smd_get_ctx_pending_list); -  - #ifdef CONFIG_CFG80211_WEXT - wdev->wext.default_key = -1; - - ## net/wireless/mlme.c ## -@@ net/wireless/mlme.c: void cfg80211_mlo_reconf_add_done(struct net_device *dev, - nl80211_mlo_reconf_add_done(dev, data); - } - EXPORT_SYMBOL(cfg80211_mlo_reconf_add_done); -+ -+void cfg80211_get_smd_ctx_done(struct wireless_dev *wdev, -+ const u8 *sta_addr, -+ struct cfg80211_smd_transition_info *st_info) -+{ -+ struct cfg80211_smd_get_ctx_pending *pending = NULL, *iter; -+ -+ spin_lock_bh(&wdev->smd_get_ctx_lock); -+ list_for_each_entry(iter, &wdev->smd_get_ctx_pending_list, list) { -+ if (ether_addr_equal(iter->sta_addr, sta_addr)) { -+ pending = iter; -+ list_del(&pending->list); -+ break; -+ } -+ } -+ spin_unlock_bh(&wdev->smd_get_ctx_lock); -+ -+ if (!pending) { -+ wiphy_err(wdev->wiphy, -+ "No pending SMD ctx req for %pM found in %s\n", -+ sta_addr, __func__); -+ return; -+ } -+ -+ nl80211_notify_get_smd_ctx_done(wdev, sta_addr, st_info); -+ -+ netdev_put(wdev->netdev, &pending->dev_tracker); -+ kfree(pending); -+} -+EXPORT_SYMBOL(cfg80211_get_smd_ctx_done); - ## net/wireless/nl80211.c ## -@@ net/wireless/nl80211.c: static size_t _nl80211_smd_ctx_nl_ba_param_size(u8 n_tids, bool dl) - return n; - } -  --static size_t --nl80211_smd_ctx_nl_size(struct cfg80211_smd_transition_info *st_info) -+size_t nl80211_smd_ctx_nl_size(struct cfg80211_smd_transition_info *st_info) - { - const struct ieee80211_smd_ctx *ctx = st_info->ctx; - int n_dl_tids = 0, n_ul_tids = 0; -@@ net/wireless/nl80211.c: nl80211_put_smd_ctx_ba_params(struct sk_buff *msg, +@@ net/wireless/nl80211.c: nl80211_put_st_ctx_ba_params(struct sk_buff *msg, unsigned long tid_bmap, return -ENOBUFS; }  --static int nl80211_put_smd_ctx(struct sk_buff *msg, -- struct cfg80211_smd_transition_info *st_info) -+int nl80211_put_smd_ctx(struct sk_buff *msg, -+ struct cfg80211_smd_transition_info *st_info) +-static int nl80211_put_st_ctx(struct sk_buff *msg, +- struct cfg80211_smd_transition_info *st_info) ++int nl80211_put_st_ctx(struct sk_buff *msg, ++ struct cfg80211_smd_transition_info *st_info) { - struct nlattr *dl_sn = NULL, *ul_sn = NULL, *ul_pn = NULL; - struct nlattr *smd_ctx = NULL, *dl = NULL, *ul = NULL; -@@ net/wireless/nl80211.c: static int nl80211_set_smd_ctx(struct sk_buff *skb, struct genl_info *info) + unsigned long dl_tid_bmap, ul_tid_bmap; + const struct ieee80211_st_ctx *ctx; +@@ net/wireless/nl80211.c: static int nl80211_set_st_ctx(struct sk_buff *skb, struct genl_info *info) return err; }  -+static struct cfg80211_smd_get_ctx_pending * -+__cfg80211_get_smd_sta_pending_ctx(struct wireless_dev *wdev, const u8 *addr) -+{ -+ struct cfg80211_smd_get_ctx_pending *pending = NULL, *tmp; -+ -+ lockdep_assert_held(&wdev->smd_get_ctx_lock); -+ -+ list_for_each_entry(tmp, &wdev->smd_get_ctx_pending_list, list) { -+ if (ether_addr_equal(tmp->sta_addr, addr)) { -+ pending = tmp; -+ break; -+ } -+ } -+ -+ return pending; -+} -+ -+static int nl80211_get_smd_ctx(struct sk_buff *skb, struct genl_info *info) ++static int nl80211_get_st_ctx(struct sk_buff *skb, struct genl_info *info)  +{  + struct cfg80211_registered_device *rdev = info->user_ptr[0];  + struct net_device *dev = info->user_ptr[1];  + struct wireless_dev *wdev = dev->ieee80211_ptr; -+ struct cfg80211_smd_get_ctx_pending *pending; -+ enum nl80211_smd_ctx_type type; ++ enum nl80211_st_ctx_type type;  + const u8 *addr = NULL;  + int err;  + -+ if (!rdev->ops->get_smd_ctx) ++ if (!rdev->ops->get_st_ctx)  + return -EOPNOTSUPP;  +  + if (wdev->iftype != NL80211_IFTYPE_AP && @@ net/wireless/nl80211.c: static int nl80211_set_smd_ctx(struct sk_buff *skb, stru  + return -EINVAL;  +  + if (!info->attrs[NL80211_ATTR_MLD_ADDR] || -+ !info->attrs[NL80211_ATTR_SMD_CTX_TYPE]) { ++ !info->attrs[NL80211_ATTR_ST_CTX_TYPE]) {  + GENL_SET_ERR_MSG(info, "required attributes are missing");  + return -EINVAL;  + }  +  + addr = nla_data(info->attrs[NL80211_ATTR_MLD_ADDR]); -+ type = nla_get_u8(info->attrs[NL80211_ATTR_SMD_CTX_TYPE]); -+ -+ spin_lock_bh(&wdev->smd_get_ctx_lock); -+ if (__cfg80211_get_smd_sta_pending_ctx(wdev, addr)) { -+ spin_unlock_bh(&wdev->smd_get_ctx_lock); -+ return -EBUSY; -+ } -+ /* safe to unlock, concurrent commands are serialized by wiphy mutex */ -+ spin_unlock_bh(&wdev->smd_get_ctx_lock); -+ -+ pending = kzalloc_obj(*pending); -+ if (!pending) -+ return -ENOMEM; ++ type = nla_get_u8(info->attrs[NL80211_ATTR_ST_CTX_TYPE]);  + -+ memcpy(pending->sta_addr, addr, ETH_ALEN); -+ -+ /* -+ * Take reference and add to the list before calling the driver to avoid -+ * race. Upon success, the reference is released while reporting back -+ * the context or in the list removal and drain path. -+ */ -+ netdev_hold(wdev->netdev, &pending->dev_tracker, GFP_KERNEL); -+ -+ spin_lock_bh(&wdev->smd_get_ctx_lock); -+ list_add_tail(&pending->list, &wdev->smd_get_ctx_pending_list); -+ spin_unlock_bh(&wdev->smd_get_ctx_lock); -+ -+ err = rdev_get_smd_ctx(rdev, wdev, addr, type); -+ if (err) { -+ /* revert upon failure */ -+ spin_lock_bh(&wdev->smd_get_ctx_lock); -+ pending = __cfg80211_get_smd_sta_pending_ctx(wdev, addr); -+ if (pending) { -+ list_del(&pending->list); -+ netdev_put(wdev->netdev, &pending->dev_tracker); -+ kfree(pending); -+ } -+ spin_unlock_bh(&wdev->smd_get_ctx_lock); -+ return err; -+ } ++ err = rdev_get_st_ctx(rdev, wdev, addr, type);  + -+ /* Reply will arrive via cfg80211_get_smd_ctx_done() */ -+ return 0; ++ return err;  +}  + #define SELECTOR(__sel, name, value) \ @@ net/wireless/nl80211.c: static const struct genl_small_ops nl80211_small_ops[] = NL80211_FLAG_CLEAR_SKB), },  + { -+ .cmd = NL80211_CMD_GET_SMD_CTX, -+ .doit = nl80211_get_smd_ctx, ++ .cmd = NL80211_CMD_GET_ST_CTX, ++ .doit = nl80211_get_st_ctx,  + .flags = GENL_UNS_ADMIN_PERM,  + .internal_flags = IFLAGS(NL80211_FLAG_NEED_NETDEV_UP),  + }, @@ net/wireless/nl80211.c: void cfg80211_nan_channel_evac(struct wireless_dev *wdev EXPORT_SYMBOL(cfg80211_nan_channel_evac);   +void -+nl80211_notify_get_smd_ctx_done(struct wireless_dev *wdev, ++cfg80211_notify_get_st_ctx_done(struct wireless_dev *wdev,  + const u8 *sta_addr,  + struct cfg80211_smd_transition_info *st_info)  +{  + struct cfg80211_registered_device *rdev = wiphy_to_rdev(wdev->wiphy);  + struct net_device *dev = wdev->netdev; -+ size_t msg_len = NLMSG_DEFAULT_SIZE;  + struct sk_buff *msg;  + void *hdr;  + -+ if (st_info->ctx) -+ msg_len = 100 + nl80211_smd_ctx_nl_size(st_info) + -+ nla_total_size(ETH_ALEN); /* MLD address */ -+ -+ msg = nlmsg_new(msg_len, GFP_ATOMIC); ++ msg = nlmsg_new(NLMSG_DEFAULT_SIZE, GFP_ATOMIC);  + if (!msg)  + return;  + -+ hdr = nl80211hdr_put(msg, 0, 0, 0, NL80211_CMD_SMD_CTX_EVENT); ++ hdr = nl80211hdr_put(msg, 0, 0, 0, NL80211_CMD_ST_CTX_EVENT);  + if (!hdr)  + goto nla_put_failure;  + @@ net/wireless/nl80211.c: void cfg80211_nan_channel_evac(struct wireless_dev *wdev  + nla_put(msg, NL80211_ATTR_MLD_ADDR, ETH_ALEN, sta_addr))  + goto nla_put_failure;  + -+ if (st_info->ctx && nl80211_put_smd_ctx(msg, st_info)) ++ if (st_info->ctx && nl80211_put_st_ctx(msg, st_info))  + goto nla_put_failure;  +  + genlmsg_end(msg, hdr); @@ net/wireless/nl80211.c: void cfg80211_nan_channel_evac(struct wireless_dev *wdev  +nla_put_failure:  + nlmsg_free(msg);  +} ++EXPORT_SYMBOL(cfg80211_notify_get_st_ctx_done);  + /* initialisation/exit functions */  int __init nl80211_init(void)  ## net/wireless/nl80211.h ## -@@ net/wireless/nl80211.h: int nl80211_pmsr_start(struct sk_buff *skb, struct genl_info *info); - void nl80211_mlo_reconf_add_done(struct net_device *dev, - struct cfg80211_mlo_reconf_done_data *data); +@@ net/wireless/nl80211.h: void nl80211_st_execution_response(struct cfg80211_registered_device *rdev, + void nl80211_st_done(struct cfg80211_registered_device *rdev, + struct net_device *dev);  -+size_t nl80211_smd_ctx_nl_size(struct cfg80211_smd_transition_info *st_info); -+int nl80211_put_smd_ctx(struct sk_buff *msg, -+ struct cfg80211_smd_transition_info *st_info); -+ -+void -+nl80211_notify_get_smd_ctx_done(struct wireless_dev *wdev, -+ const u8 *sta_addr, -+ struct cfg80211_smd_transition_info *st_info); ++int nl80211_put_st_ctx(struct sk_buff *msg, ++ struct cfg80211_smd_transition_info *st_info);  + #endif /* __NET_WIRELESS_NL80211_H */  ## net/wireless/rdev-ops.h ## -@@ net/wireless/rdev-ops.h: static inline int rdev_set_smd_ctx(struct cfg80211_registered_device *rdev, +@@ net/wireless/rdev-ops.h: static inline int rdev_set_st_ctx(struct cfg80211_registered_device *rdev, return ret; }  -+static inline int rdev_get_smd_ctx(struct cfg80211_registered_device *rdev, -+ struct wireless_dev *wdev, const u8 *addr, -+ enum nl80211_smd_ctx_type type) ++static inline int rdev_get_st_ctx(struct cfg80211_registered_device *rdev, ++ struct wireless_dev *wdev, const u8 *addr, ++ enum nl80211_st_ctx_type type)  +{  + int ret = -EOPNOTSUPP;  + -+ trace_rdev_get_smd_ctx(&rdev->wiphy, wdev, addr, type); -+ if (rdev->ops->get_smd_ctx) -+ ret = rdev->ops->get_smd_ctx(&rdev->wiphy, wdev, addr, type); ++ trace_rdev_get_st_ctx(&rdev->wiphy, wdev, addr, type); ++ if (rdev->ops->get_st_ctx) ++ ret = rdev->ops->get_st_ctx(&rdev->wiphy, wdev, addr, type);  + trace_rdev_return_int(&rdev->wiphy, ret);  +  + return ret; @@ net/wireless/rdev-ops.h: static inline int rdev_set_smd_ctx(struct cfg80211_regi #endif /* __CFG80211_RDEV_OPS */  ## net/wireless/trace.h ## -@@ net/wireless/trace.h: TRACE_EVENT(rdev_set_smd_ctx, +@@ net/wireless/trace.h: TRACE_EVENT(rdev_set_st_ctx, + __entry->dl_tid_bitmap, __entry->ul_tid_bitmap ) ); -  -+TRACE_EVENT(rdev_get_smd_ctx, ++ ++TRACE_EVENT(rdev_get_st_ctx,  + TP_PROTO(struct wiphy *wiphy, struct wireless_dev *wdev, const u8 *addr, -+ enum nl80211_smd_ctx_type type), ++ enum nl80211_st_ctx_type type),  +  + TP_ARGS(wiphy, wdev, addr, type),  + @@ net/wireless/trace.h: TRACE_EVENT(rdev_set_smd_ctx,  + WIPHY_PR_ARG, WDEV_PR_ARG, __entry->sta_addr,  + __entry->st_type)  +); -+ #endif /* !__RDEV_OPS_TRACE || TRACE_HEADER_MULTI_READ */  #undef TRACE_INCLUDE_PATH 11: 5dd3d948d02c ! 11: a541231c915a wifi: nl80211/cfg80211: define API to notify SMD Drain completion @@ Metadata Author: Pooventhiran G   ## Commit message ## - wifi: nl80211/cfg80211: define API to notify SMD Drain completion + wifi: nl80211/cfg80211: define API to notify ST Drain completion  The non-AP MLD that has started transitioning to the target AP MLD (ST Execution) from the current AP MLD will be in downlink draining until @@ Commit message ST Execution Response frame.  But if the AP MLD has completed draining the packets before the draining - period completion, the draining can be terminated early. Add cfg80211 - and nl80211 APIs for the drivers to send this completion event to - userspace to perform the necessary clean-ups. + period completion, the draining can be terminated early. Add APIs for + the drivers to send this completion event to userspace to perform the + necessary clean-ups.  Suggested-by: Rohan Dutta  Signed-off-by: Pooventhiran G   ## include/net/cfg80211.h ## -@@ include/net/cfg80211.h: void cfg80211_get_smd_ctx_done(struct wireless_dev *wdev, - const u8 *sta_addr, - struct cfg80211_smd_transition_info *st_info); +@@ include/net/cfg80211.h: cfg80211_notify_get_st_ctx_done(struct wireless_dev *wdev, + const u8 *sta_addr, + struct cfg80211_smd_transition_info *st_info);  -+/** -+ * cfg80211_notify_smd_drain_completion - notify userspace about downlink drain ++/* ++ * cfg80211_notify_st_drain_completion - notify userspace about downlink drain  + * early termination.  + * @wdev: wireless device corresponding to the AP MLD  + * @sta_addr: non-AP MLD address for which DL draining is being terminated -+ * -+ * Should be called under wiphy_lock.  + */ -+void cfg80211_notify_smd_drain_completion(struct wireless_dev *wdev, -+ const u8 *sta_addr); ++void cfg80211_notify_st_drain_completion(struct wireless_dev *wdev, ++ const u8 *sta_addr);  + #endif /* __NET_CFG80211_H */  ## include/uapi/linux/nl80211.h ##  @@ * AP MLD can request the context from the driver on the target's behalf using - * %NL80211_CMD_GET_SMD_CTX and the response can be reported back using - * %NL80211_CMD_SMD_CTX_EVENT. + * %NL80211_CMD_GET_ST_CTX and the response can be reported back using + * %NL80211_CMD_ST_CTX_EVENT.  + *  + * The current AP MLD, after successful execution of the non-AP MLD with the  + * target AP MLD, can continue to drain the buffered packets if a non-zero  + * Nominal Maximum DL Draining Period Duration has been sent in the ST Execution  + * Response. Drivers, however, can terminate draining early using the -+ * %NL80211_CMD_SMD_DRAIN_COMPLETION_EVENT event. ++ * %NL80211_CMD_ST_DRAIN_COMPLETION_EVENT event. */  /**  @@ - * (requested via %NL80211_CMD_GET_SMD_CTX) to userspace. It carries - * %NL80211_ATTR_MLD_ADDR, %NL80211_ATTR_SMD_CTX_TYPE, and - * %NL80211_ATTR_SMD_CTX. -+ * @NL80211_CMD_SMD_DRAIN_COMPLETION_EVENT: Event indicating to userspace that + * (requested via %NL80211_CMD_GET_ST_CTX) to userspace. It carries + * %NL80211_ATTR_MLD_ADDR, %NL80211_ATTR_ST_CTX_TYPE, and + * %NL80211_ATTR_ST_CTX. ++ * @NL80211_CMD_ST_DRAIN_COMPLETION_EVENT: Event indicating to userspace that  + * the Downlink Drain for the station, identified by  + * %NL80211_ATTR_MLD_ADDR, has been terminated early by the driver.  + * Userspace can remove the station upon this event. @@ include/uapi/linux/nl80211.h * @NL80211_CMD_MAX: highest used command number * @__NL80211_CMD_AFTER_LAST: internal use  @@ include/uapi/linux/nl80211.h: enum nl80211_commands { - NL80211_CMD_SET_SMD_CTX, - NL80211_CMD_GET_SMD_CTX, - NL80211_CMD_SMD_CTX_EVENT, -+ NL80211_CMD_SMD_DRAIN_COMPLETION_EVENT, + NL80211_CMD_SET_ST_CTX, + NL80211_CMD_GET_ST_CTX, + NL80211_CMD_ST_CTX_EVENT, ++ NL80211_CMD_ST_DRAIN_COMPLETION_EVENT,  /* add new commands above here */   - ## net/wireless/mlme.c ## -@@ net/wireless/mlme.c: void cfg80211_get_smd_ctx_done(struct wireless_dev *wdev, - kfree(pending); - } - EXPORT_SYMBOL(cfg80211_get_smd_ctx_done); -+ -+void cfg80211_notify_smd_drain_completion(struct wireless_dev *wdev, -+ const u8 *sta_addr) -+{ -+ struct wiphy *wiphy = wdev->wiphy; -+ -+ lockdep_assert_wiphy(wiphy); -+ -+ nl80211_notify_smd_drain_completion(wdev, sta_addr); -+} -+EXPORT_SYMBOL(cfg80211_notify_smd_drain_completion); - ## net/wireless/nl80211.c ## -@@ net/wireless/nl80211.c: nl80211_notify_get_smd_ctx_done(struct wireless_dev *wdev, - nlmsg_free(msg); +@@ net/wireless/nl80211.c: cfg80211_notify_get_st_ctx_done(struct wireless_dev *wdev, } + EXPORT_SYMBOL(cfg80211_notify_get_st_ctx_done);  -+void nl80211_notify_smd_drain_completion(struct wireless_dev *wdev, ++void cfg80211_notify_st_drain_completion(struct wireless_dev *wdev,  + const u8 *sta_addr)  +{  + struct cfg80211_registered_device *rdev = wiphy_to_rdev(wdev->wiphy); @@ net/wireless/nl80211.c: nl80211_notify_get_smd_ctx_done(struct wireless_dev *wde  + struct sk_buff *msg;  + void *hdr;  + -+ msg = nlmsg_new(NLMSG_DEFAULT_SIZE, GFP_KERNEL); ++ msg = nlmsg_new(NLMSG_DEFAULT_SIZE, GFP_ATOMIC);  + if (!msg)  + return;  +  + hdr = nl80211hdr_put(msg, 0, 0, 0, -+ NL80211_CMD_SMD_DRAIN_COMPLETION_EVENT); ++ NL80211_CMD_ST_DRAIN_COMPLETION_EVENT);  + if (!hdr)  + goto nla_put_failure;  + @@ net/wireless/nl80211.c: nl80211_notify_get_smd_ctx_done(struct wireless_dev *wde  + genlmsg_end(msg, hdr);  +  + genlmsg_multicast_netns(&nl80211_fam, wiphy_net(&rdev->wiphy), msg, 0, -+ NL80211_MCGRP_MLME, GFP_KERNEL); ++ NL80211_MCGRP_MLME, GFP_ATOMIC);  + return;  +  +nla_put_failure:  + nlmsg_free(msg);  +} ++EXPORT_SYMBOL(cfg80211_notify_st_drain_completion);  + /* initialisation/exit functions */  int __init nl80211_init(void) - - ## net/wireless/nl80211.h ## -@@ net/wireless/nl80211.h: nl80211_notify_get_smd_ctx_done(struct wireless_dev *wdev, - const u8 *sta_addr, - struct cfg80211_smd_transition_info *st_info); -  -+void nl80211_notify_smd_drain_completion(struct wireless_dev *wdev, -+ const u8 *sta_addr); -+ - #endif /* __NET_WIRELESS_NL80211_H */ 12: f575aa00a9e3 < -: ------------ wifi: mac80211: set SMD parameters for AP setup and STA update 13: 2d4d78e5efa0 ! 12: a70af70cffe6 wifi: mac80211: apply SMD BSS Transition STA sub-states @@ Metadata Author: Pooventhiran G   ## Commit message ## - wifi: mac80211: apply SMD BSS Transition STA sub-states + wifi: mac80211: apply SMD indication and ST sub-states to STA  - During SMD BSS Transition, the non-AP STA MLD roaming from the current - AP MLD to the target AP MLD switches its new SMD sub-states. Capture - these state transitions to track the station roaming. + When userspace marks the non-AP MLD as SMD, mark it in mac80211 so that + SMD operations are properly routed and handled in the drivers. Such a + STA, while roaming from the current AP MLD to the target AP MLD, moves + through the new ST sub-states. Capture these state transitions to track + the station roaming.  These are transient sub-states of WLAN_STA_AUTHORIZED with the SMD-ME. The station remains authenticated, associated, and RSNA-established - throughout. At most one of the three may be set at a time; mutual - exclusion is enforced in sta_apply_smd_state_flags(). + throughout. These sub-states, though, are tracked with the MLD state + machine itself. At most one of the three may be set at a time; mutual + exclusion is enforced in sta_apply_st_state_flags().  + Signed-off-by: Sidhanta Sahu  Signed-off-by: Pooventhiran G   + ## include/net/mac80211.h ## +@@ include/net/mac80211.h: struct ieee80211_link_sta { + * @nan_sched: NAN peer schedule for this station. Valid only for NMI stations. + * @ext_mld_capa_ops: the MLD's extended MLD capabilities and operations + * NOTE: currently only tracked for AP STAs ++ * @smd_sta: STA has negotiated SMD + */ + struct ieee80211_sta { + u8 addr[ETH_ALEN] __aligned(2); +@@ include/net/mac80211.h: struct ieee80211_sta { + u16 active_links; + u16 ext_mld_capa_ops; + bool epp_peer; ++ bool smd_sta; + struct ieee80211_link_sta deflink; + struct ieee80211_link_sta __rcu *link[IEEE80211_MLD_MAX_NUM_LINKS]; +  + ## net/mac80211/cfg.c ##  @@ net/mac80211/cfg.c: static int sta_link_apply_parameters(struct ieee80211_local *local, return 0; }  -+static int sta_apply_smd_state_flags(struct sta_info *sta, -+ u32 mask, u32 set) ++static int sta_apply_st_state_flags(struct sta_info *sta, ++ u32 mask, u32 set)  +{ -+ bool smd_prep_target, smd_exec_current, smd_dl_drain; -+ u32 expected_mask = BIT(NL80211_STA_FLAG_SMD_PREP_TARGET) | -+ BIT(NL80211_STA_FLAG_SMD_EXEC_CURRENT) | -+ BIT(NL80211_STA_FLAG_SMD_DL_DRAIN); -+ u32 smd_flags; ++ bool st_prepared, st_executing, st_dl_drain; ++ u32 st_state_mask = BIT(NL80211_STA_FLAG_ST_PREPARED) | ++ BIT(NL80211_STA_FLAG_ST_EXECUTING) | ++ BIT(NL80211_STA_FLAG_ST_DL_DRAIN); ++ u32 st_flags;  + -+ if (!(mask & expected_mask)) ++ if (!(mask & st_state_mask))  + return 0;  + -+ smd_flags = mask & expected_mask & set; -+ if (WARN_ON(hweight32(smd_flags) > 1)) ++ st_flags = mask & st_state_mask & set; ++ if (hweight32(st_flags) > 1)  + return -EINVAL;  + -+ smd_prep_target = -+ !!(smd_flags & BIT(NL80211_STA_FLAG_SMD_PREP_TARGET)); -+ smd_exec_current = -+ !!(smd_flags & BIT(NL80211_STA_FLAG_SMD_EXEC_CURRENT)); -+ smd_dl_drain = -+ !!(smd_flags & BIT(NL80211_STA_FLAG_SMD_DL_DRAIN)); ++ st_prepared = st_flags & BIT(NL80211_STA_FLAG_ST_PREPARED); ++ st_executing = st_flags & BIT(NL80211_STA_FLAG_ST_EXECUTING); ++ st_dl_drain = st_flags & BIT(NL80211_STA_FLAG_ST_DL_DRAIN);  +  + if (!test_sta_flag(sta, WLAN_STA_AUTHORIZED) && -+ (smd_exec_current || smd_dl_drain)) ++ (st_executing || st_dl_drain))  + return -EINVAL;  + -+ if (smd_prep_target) { -+ clear_sta_flag(sta, WLAN_STA_SMD_EXEC_CURRENT); -+ clear_sta_flag(sta, WLAN_STA_SMD_DL_DRAIN); -+ set_sta_flag(sta, WLAN_STA_SMD_PREP_TARGET); -+ } else if (smd_exec_current) { -+ clear_sta_flag(sta, WLAN_STA_SMD_PREP_TARGET); -+ clear_sta_flag(sta, WLAN_STA_SMD_DL_DRAIN); -+ set_sta_flag(sta, WLAN_STA_SMD_EXEC_CURRENT); -+ } else if (smd_dl_drain) { -+ clear_sta_flag(sta, WLAN_STA_SMD_PREP_TARGET); -+ clear_sta_flag(sta, WLAN_STA_SMD_EXEC_CURRENT); -+ set_sta_flag(sta, WLAN_STA_SMD_DL_DRAIN); ++ if (st_prepared) { ++ set_sta_flag(sta, WLAN_STA_ST_PREPARED); ++ clear_sta_flag(sta, WLAN_STA_ST_EXECUTING); ++ clear_sta_flag(sta, WLAN_STA_ST_DL_DRAIN); ++ } else if (st_executing) { ++ set_sta_flag(sta, WLAN_STA_ST_EXECUTING); ++ clear_sta_flag(sta, WLAN_STA_ST_PREPARED); ++ clear_sta_flag(sta, WLAN_STA_ST_DL_DRAIN); ++ } else if (st_dl_drain) { ++ set_sta_flag(sta, WLAN_STA_ST_DL_DRAIN); ++ clear_sta_flag(sta, WLAN_STA_ST_PREPARED); ++ clear_sta_flag(sta, WLAN_STA_ST_EXECUTING);  + } else {  + /* all flags revert back to none being set */ -+ clear_sta_flag(sta, WLAN_STA_SMD_PREP_TARGET); -+ clear_sta_flag(sta, WLAN_STA_SMD_EXEC_CURRENT); -+ clear_sta_flag(sta, WLAN_STA_SMD_DL_DRAIN); ++ clear_sta_flag(sta, WLAN_STA_ST_PREPARED); ++ clear_sta_flag(sta, WLAN_STA_ST_EXECUTING); ++ clear_sta_flag(sta, WLAN_STA_ST_DL_DRAIN);  + }  +  + return 0; @@ net/mac80211/cfg.c: static int sta_link_apply_parameters(struct ieee80211_local struct sta_info *sta, struct station_parameters *params)  @@ net/mac80211/cfg.c: static int sta_apply_parameters(struct ieee80211_local *local, - if (params->smd_params.smd_sta) - sta->sta.smd_params = params->smd_params; + if (params->link_sta_params.mld_mac) + sta->sta.mlo = true;  -+ /* -+ * SMD BSS Transition sub-states (IEEE P802.11bn/D2.0, Aug 2026, -+ * subclause 11.3.1). -+ * Only meaningful for SMD-capable stations (WLAN_STA_SMD set). -+ */ -+ if (test_sta_flag(sta, WLAN_STA_SMD)) { -+ ret = sta_apply_smd_state_flags(sta, mask, set); ++ if (sta->sta.smd_sta) { ++ ret = sta_apply_st_state_flags(sta, mask, set);  + if (ret)  + return ret;  + }  + - /* mark TDLS channel switch support, if the AP allows it */ - if (test_sta_flag(sta, WLAN_STA_TDLS_PEER) && - !sdata->deflink.u.mgd.tdls_chan_switch_prohibited && + return 0; + } +  +@@ net/mac80211/cfg.c: static int ieee80211_add_station(struct wiphy *wiphy, struct wireless_dev *wdev, + if (params->sta_flags_set & BIT(NL80211_STA_FLAG_TDLS_PEER)) + sta->sta.tdls = true; +  ++ sta->sta.smd_sta = params->smd_sta; ++ + /* Though the mutex is not needed here (since the station is not + * visible yet), sta_apply_parameters (and inner functions) require + * the mutex due to other paths.  ## net/mac80211/debugfs_sta.c ##  @@ net/mac80211/debugfs_sta.c: static const char * const sta_flag_names[] = { + FLAG(PS_DELIVER), FLAG(USES_ENCRYPTION), FLAG(DECAP_OFFLOAD), - FLAG(SMD), -+ FLAG(SMD_PREP_TARGET), -+ FLAG(SMD_EXEC_CURRENT), -+ FLAG(SMD_DL_DRAIN), ++ FLAG(ST_PREPARED), ++ FLAG(ST_EXECUTING), ++ FLAG(ST_DL_DRAIN), #undef FLAG };   ## net/mac80211/sta_info.h ##  @@ + * @WLAN_STA_USES_ENCRYPTION: This station was configured for encryption, * so drop all packets without a key later. * @WLAN_STA_DECAP_OFFLOAD: This station uses rx decap offload - * @WLAN_STA_SMD: this station is associated to an SMD-ME. -+ * @WLAN_STA_SMD_PREP_TARGET: this SMD station is prepared at the target AP MLD. -+ * @WLAN_STA_SMD_EXEC_CURRENT: this SMD station has started execution at ++ * @WLAN_STA_ST_PREPARED: this SMD station is prepared at the target AP MLD. ++ * @WLAN_STA_ST_EXECUTING: this SMD station has started execution at  + * the current AP MLD. -+ * @WLAN_STA_SMD_DL_DRAIN: this SMD station has started draining at ++ * @WLAN_STA_ST_DL_DRAIN: this SMD station has started draining at  + * the current AP MLD. * * @NUM_WLAN_STA_FLAGS: number of defined flags */  @@ net/mac80211/sta_info.h: enum ieee80211_sta_info_flags { + WLAN_STA_PS_DELIVER, WLAN_STA_USES_ENCRYPTION, WLAN_STA_DECAP_OFFLOAD, - WLAN_STA_SMD, -+ WLAN_STA_SMD_PREP_TARGET, -+ WLAN_STA_SMD_EXEC_CURRENT, -+ WLAN_STA_SMD_DL_DRAIN, ++ WLAN_STA_ST_PREPARED, ++ WLAN_STA_ST_EXECUTING, ++ WLAN_STA_ST_DL_DRAIN,  NUM_WLAN_STA_FLAGS, }; 14: ace7c460a171 ! 13: f07d32900923 wifi: mac80211: add driver_op for SMD substate changes @@ Metadata Author: Pooventhiran G   ## Commit message ## - wifi: mac80211: add driver_op for SMD substate changes + wifi: mac80211: add driver_op for ST substate changes  - During SMD BSS Transition, a non-AP MLD moves through sub-states 4a, - 4b, and 4c that impose different frame-filtering rules on the AP MLD. + During ST, a non-AP MLD moves through sub-states 4a, 4b, and 4c that + impose different frame-filtering rules on the AP MLD.  Add a new driver op that mac80211 calls on each sub-state transition. This lets drivers perform the necessary hardware queue and filtering - adjustments at each phase of the SMD BSS Transition. + adjustments at each phase of ST.  - Valid transition order: - NONE -> PREP (ST preparation completed at the target AP MLD) - NONE -> EXEC (ST execution in progress at the current AP MLD) - EXEC -> DRAIN (DL drain period started at the current AP MLD) + Valid driver transitions: + NONE -> PREPARED (ST preparation completed at the target AP MLD) + NONE -> EXECUTING (ST execution in progress at the current AP MLD) + EXECUTING -> DL_DRAIN (DL drain period started at the current AP MLD)  Suggested-by: Rohan Dutta  Signed-off-by: Pooventhiran G  @@ include/net/mac80211.h: struct ieee80211_prep_tx_info { };   +/** -+ * enum ieee80211_sta_smd_state - SMD BSS Transition sub-state ++ * enum ieee80211_sta_st_state - SMD Transition sub-state  + * -+ * Tracks the 802.11bn SMD BSS Transition sub-state (IEEE P802.11bn/D2.0, -+ * Aug 2026, subclause 11.3.1) for a specific (non-AP MLD, AP MLD) association. ++ * Tracks the 802.11bn SMD Transition sub-state (IEEE P802.11bn/D2.0, Aug 2026, ++ * subclause 11.3.1) for a specific (non-AP MLD, AP MLD) association.  + * -+ * @IEEE80211_STA_SMD_NONE: Plain State 4. No sub-state active. -+ * @IEEE80211_STA_SMD_PREP: State 4a. STA prepared at the target AP MLD -+ * @IEEE80211_STA_SMD_EXEC: State 4b. ST execution active at the current AP MLD -+ * @IEEE80211_STA_SMD_DRAIN: State 4c. DL draining period at the current AP MLD ++ * @IEEE80211_STA_ST_NONE: Plain State 4. No sub-state active. ++ * @IEEE80211_STA_ST_PREPARED: State 4a. STA prepared at the target AP MLD ++ * @IEEE80211_STA_ST_EXECUTING: State 4b. ST execution active at the current AP MLD ++ * @IEEE80211_STA_ST_DL_DRAIN: State 4c. DL draining period at the current AP MLD  + */ -+enum ieee80211_sta_smd_state { -+ IEEE80211_STA_SMD_NONE, -+ IEEE80211_STA_SMD_PREP, -+ IEEE80211_STA_SMD_EXEC, -+ IEEE80211_STA_SMD_DRAIN, ++enum ieee80211_sta_st_state { ++ IEEE80211_STA_ST_NONE, ++ IEEE80211_STA_ST_PREPARED, ++ IEEE80211_STA_ST_EXECUTING, ++ IEEE80211_STA_ST_DL_DRAIN,  +};  + /** @@ include/net/mac80211.h: struct ieee80211_prep_tx_info { * @set_eml_op_mode: Configure eMLSR/eMLMR operation mode in the underlay * driver according to the parameter received in the EML Operating mode * notification frame. -+ * @sta_smd_state: Notifies low level driver about IEEE 802.11bn SMD substate -+ * transition of a station. It must not fail while transitioning down. -+ * The callback can sleep. ++ * @sta_notify_st: Notifies low level driver about IEEE 802.11bn ST substate ++ * transition of a station. The callback can sleep. */ struct ieee80211_ops { void (*tx)(struct ieee80211_hw *hw, @@ include/net/mac80211.h: struct ieee80211_ops { struct ieee80211_vif *vif, struct ieee80211_sta *sta, struct ieee80211_eml_params *eml_params); -+ int (*sta_smd_state)(struct ieee80211_hw *hw, -+ struct ieee80211_vif *vif, -+ struct ieee80211_sta *sta, -+ enum ieee80211_sta_smd_state old_state, -+ enum ieee80211_sta_smd_state new_state); ++ void (*sta_notify_st)(struct ieee80211_hw *hw, ++ struct ieee80211_vif *vif, ++ struct ieee80211_sta *sta, ++ enum ieee80211_sta_st_state state); };  /**  ## net/mac80211/cfg.c ## -@@ net/mac80211/cfg.c: static int sta_apply_smd_state_flags(struct sta_info *sta, - u32 expected_mask = BIT(NL80211_STA_FLAG_SMD_PREP_TARGET) | - BIT(NL80211_STA_FLAG_SMD_EXEC_CURRENT) | - BIT(NL80211_STA_FLAG_SMD_DL_DRAIN); -+ enum ieee80211_sta_smd_state new_ss; - u32 smd_flags; +@@ net/mac80211/cfg.c: static int sta_apply_st_state_flags(struct sta_info *sta, + u32 st_state_mask = BIT(NL80211_STA_FLAG_ST_PREPARED) | + BIT(NL80211_STA_FLAG_ST_EXECUTING) | + BIT(NL80211_STA_FLAG_ST_DL_DRAIN); ++ enum ieee80211_sta_st_state new_ss; + u32 st_flags;  + int err;  - if (!(mask & expected_mask)) + if (!(mask & st_state_mask)) return 0; -@@ net/mac80211/cfg.c: static int sta_apply_smd_state_flags(struct sta_info *sta, - (smd_exec_current || smd_dl_drain)) +@@ net/mac80211/cfg.c: static int sta_apply_st_state_flags(struct sta_info *sta, + (st_executing || st_dl_drain)) return -EINVAL;  -+ if (smd_prep_target) -+ new_ss = IEEE80211_STA_SMD_PREP; -+ else if (smd_exec_current) -+ new_ss = IEEE80211_STA_SMD_EXEC; -+ else if (smd_dl_drain) -+ new_ss = IEEE80211_STA_SMD_DRAIN; ++ if (st_prepared) ++ new_ss = IEEE80211_STA_ST_PREPARED; ++ else if (st_executing) ++ new_ss = IEEE80211_STA_ST_EXECUTING; ++ else if (st_dl_drain) ++ new_ss = IEEE80211_STA_ST_DL_DRAIN;  + else -+ new_ss = IEEE80211_STA_SMD_NONE; ++ new_ss = IEEE80211_STA_ST_NONE;  + -+ if (new_ss == sta->smd_state) ++ if (new_ss == sta->st_state)  + return 0;  + -+ err = sta_info_move_smd_state(sta, new_ss, true); ++ err = sta_info_move_st_state(sta, new_ss);  + if (err)  + return err;  + - if (smd_prep_target) { - clear_sta_flag(sta, WLAN_STA_SMD_EXEC_CURRENT); - clear_sta_flag(sta, WLAN_STA_SMD_DL_DRAIN); -@@ net/mac80211/cfg.c: static int sta_apply_parameters(struct ieee80211_local *local, - sta->sta.spp_amsdu = set & BIT(NL80211_STA_FLAG_SPP_AMSDU); -  - if (mask & BIT(NL80211_STA_FLAG_SMD)) { -- if (set & BIT(NL80211_STA_FLAG_SMD)) -+ if (set & BIT(NL80211_STA_FLAG_SMD)) { - set_sta_flag(sta, WLAN_STA_SMD); -- else if (test_sta_flag(sta, WLAN_STA_SMD)) -+ } else if (test_sta_flag(sta, WLAN_STA_SMD)) { -+ sta_info_reset_smd_state(sta, true); - clear_sta_flag(sta, WLAN_STA_SMD); -+ } - } -  - if (params->smd_params.smd_sta) - sta->sta.smd_params = params->smd_params; -  -- /* -- * SMD BSS Transition sub-states (IEEE P802.11bn/D2.0, Aug 2026, -- * subclause 11.3.1). -- * Only meaningful for SMD-capable stations (WLAN_STA_SMD set). -- */ -- if (test_sta_flag(sta, WLAN_STA_SMD)) { -- ret = sta_apply_smd_state_flags(sta, mask, set); -- if (ret) -- return ret; -- } -- - /* mark TDLS channel switch support, if the AP allows it */ - if (test_sta_flag(sta, WLAN_STA_TDLS_PEER) && - !sdata->deflink.u.mgd.tdls_chan_switch_prohibited && -@@ net/mac80211/cfg.c: static int sta_apply_parameters(struct ieee80211_local *local, - return ret; - } -  -+ /* -+ * SMD BSS Transition sub-states (IEEE P802.11bn/D2.0, Aug 2026, -+ * subclause 11.3.1). -+ * Only meaningful for SMD-capable stations (WLAN_STA_SMD set). -+ */ -+ if (test_sta_flag(sta, WLAN_STA_SMD)) { -+ ret = sta_apply_smd_state_flags(sta, mask, set); -+ if (ret) -+ return ret; -+ } -+ - /* Mark the STA as MLO if MLD MAC address is available */ - if (params->link_sta_params.mld_mac) - sta->sta.mlo = true; + if (st_prepared) { + set_sta_flag(sta, WLAN_STA_ST_PREPARED); + clear_sta_flag(sta, WLAN_STA_ST_EXECUTING);  @@ net/mac80211/cfg.c: static int ieee80211_add_station(struct wiphy *wiphy, struct wireless_dev *wdev, */ if (!err && sdata->vif.type == NL80211_IFTYPE_NAN_DATA) ieee80211_nan_update_ndi_carrier(sta->sdata);  + -+ /* -+ * SMD sub-state was set in sta_apply_parameters() before the station -+ * was inserted so drv_sta_smd_state() was skipped (WLAN_STA_INSERTED -+ * was not yet set). Walk the driver step-by-step to the target state. -+ */ -+ if (!err && test_sta_flag(sta, WLAN_STA_SMD) && -+ sta->smd_state != IEEE80211_STA_SMD_NONE) { -+ err = sta_info_move_drv_smd_state(sta); -+ if (err) -+ WARN_ON(__sta_info_destroy(sta)); -+ } ++ if (!err && sta->sta.smd_sta && ++ sta->st_state != IEEE80211_STA_ST_NONE) ++ drv_sta_notify_st(sta->local, sta->sdata, &sta->sta, ++ sta->st_state);  + return err; }   ## net/mac80211/driver-ops.c ## -@@ net/mac80211/driver-ops.c: int drv_link_sta_statistics(struct ieee80211_local *local, -  - return 0; +@@ net/mac80211/driver-ops.c: void drv_flush_sta(struct ieee80211_local *local, + ieee80211_flush_queues(local, sdata, false); + trace_drv_return_void(local); }  + -+int drv_sta_smd_state(struct ieee80211_local *local, -+ struct ieee80211_sub_if_data *sdata, -+ struct ieee80211_sta *sta, -+ enum ieee80211_sta_smd_state old_state, -+ enum ieee80211_sta_smd_state new_state) ++void drv_sta_notify_st(struct ieee80211_local *local, ++ struct ieee80211_sub_if_data *sdata, ++ struct ieee80211_sta *sta, ++ enum ieee80211_sta_st_state state)  +{ -+ int ret = 0; -+  + might_sleep();  + lockdep_assert_wiphy(local->hw.wiphy);  +  + sdata = get_bss_sdata(sdata);  + if (!check_sdata_in_driver(sdata)) -+ return -EIO; -+ -+ trace_drv_sta_smd_state(local, sdata, sta, old_state, new_state); -+ if (local->ops->sta_smd_state) -+ ret = local->ops->sta_smd_state(&local->hw, &sdata->vif, -+ sta, old_state, new_state); -+ trace_drv_return_int(local, ret); ++ return;  + -+ return ret; ++ trace_drv_sta_notify_st(local, sdata, sta, state); ++ if (local->ops->sta_notify_st) ++ local->ops->sta_notify_st(&local->hw, &sdata->vif, sta, state); ++ trace_drv_return_void(local);  +}  ## net/mac80211/driver-ops.h ## @@ net/mac80211/driver-ops.h: drv_nan_peer_sched_changed(struct ieee80211_local *lo return ret; }  -+int drv_sta_smd_state(struct ieee80211_local *local, -+ struct ieee80211_sub_if_data *sdata, -+ struct ieee80211_sta *sta, -+ enum ieee80211_sta_smd_state old_state, -+ enum ieee80211_sta_smd_state new_state); ++void drv_sta_notify_st(struct ieee80211_local *local, ++ struct ieee80211_sub_if_data *sdata, ++ struct ieee80211_sta *sta, ++ enum ieee80211_sta_st_state state);  + #endif /* __MAC80211_DRIVER_OPS */  @@ net/mac80211/sta_info.c: __sta_info_alloc(struct ieee80211_sub_if_data *sdata, ieee80211_init_frag_cache(&sta->frags);  sta->sta_state = IEEE80211_STA_NONE; -+ sta->smd_state = IEEE80211_STA_SMD_NONE; ++ sta->st_state = IEEE80211_STA_ST_NONE;  if (sdata->vif.type == NL80211_IFTYPE_MESH_POINT) sta->amsdu_mesh_control = -1; @@ net/mac80211/sta_info.c: static int _sta_info_move_state(struct sta_info *sta, "Driver is not allowed to fail if the sta_state is transitioning down the list: %d\n", err);  + -+ /* revert SMD states if STA has transitioned down */ -+ if (new_state == IEEE80211_STA_AUTH && -+ sta->sta_state == IEEE80211_STA_ASSOC) { -+ if (test_sta_flag(sta, WLAN_STA_SMD) && -+ sta->smd_state == IEEE80211_STA_SMD_PREP) -+ sta_info_reset_smd_state(sta, true); -+ } else if (new_state == IEEE80211_STA_ASSOC && -+ sta->sta_state == IEEE80211_STA_AUTHORIZED) { -+ if (test_sta_flag(sta, WLAN_STA_SMD) && -+ sta->smd_state != IEEE80211_STA_SMD_NONE && -+ sta->smd_state != IEEE80211_STA_SMD_PREP) -+ sta_info_reset_smd_state(sta, true); -+ } ++ /* revert ST sub-states if STA has transitioned down */ ++ if (sta->sta.smd_sta && ++ ((new_state == IEEE80211_STA_AUTH && ++ sta->sta_state == IEEE80211_STA_ASSOC) || ++ (new_state == IEEE80211_STA_ASSOC && ++ sta->sta_state == IEEE80211_STA_AUTHORIZED))) ++ sta_info_reset_st_state(sta); }  sta->sta_state = new_state; @@ net/mac80211/sta_info.c: bool ieee80211_link_sta_update_rc_bw(struct ieee80211_l return true; }  + -+int sta_info_move_smd_state(struct sta_info *sta, -+ enum ieee80211_sta_smd_state new_ss, -+ bool notify) ++int sta_info_move_st_state(struct sta_info *sta, ++ enum ieee80211_sta_st_state new_ss)  +{ -+ enum ieee80211_sta_smd_state old_ss = sta->smd_state; ++ enum ieee80211_sta_st_state old_ss = sta->st_state;  + struct ieee80211_local *local = sta->local; -+ bool notify_driver; -+ int err;  +  + might_sleep();  + @@ net/mac80211/sta_info.c: bool ieee80211_link_sta_update_rc_bw(struct ieee80211_l  + return 0;  +  + switch (new_ss) { -+ case IEEE80211_STA_SMD_NONE: -+ if (old_ss != IEEE80211_STA_SMD_PREP && -+ old_ss != IEEE80211_STA_SMD_EXEC && -+ old_ss != IEEE80211_STA_SMD_DRAIN) ++ case IEEE80211_STA_ST_NONE: ++ if (old_ss != IEEE80211_STA_ST_PREPARED && ++ old_ss != IEEE80211_STA_ST_EXECUTING && ++ old_ss != IEEE80211_STA_ST_DL_DRAIN)  + return -EINVAL;  + break; -+ case IEEE80211_STA_SMD_EXEC: -+ if (old_ss != IEEE80211_STA_SMD_NONE) ++ case IEEE80211_STA_ST_EXECUTING: ++ if (old_ss != IEEE80211_STA_ST_NONE)  + return -EINVAL;  + break; -+ case IEEE80211_STA_SMD_DRAIN: -+ if (old_ss != IEEE80211_STA_SMD_EXEC) ++ case IEEE80211_STA_ST_DL_DRAIN: ++ if (old_ss != IEEE80211_STA_ST_EXECUTING)  + return -EINVAL;  + break; -+ case IEEE80211_STA_SMD_PREP: -+ if (old_ss != IEEE80211_STA_SMD_NONE) ++ case IEEE80211_STA_ST_PREPARED: ++ if (old_ss != IEEE80211_STA_ST_NONE)  + return -EINVAL;  + break;  + default: -+ sdata_err(sta->sdata, "invalid smd state %d", new_ss); ++ sdata_err(sta->sdata, "invalid st state %d", new_ss);  + return -EINVAL;  + }  + -+ sta_dbg(sta->sdata, "moving STA %pM SMD state %u -> %u\n", ++ sta_dbg(sta->sdata, "moving STA %pM ST state %u -> %u\n",  + sta->sta.addr, old_ss, new_ss);  + -+ notify_driver = notify && test_sta_flag(sta, WLAN_STA_INSERTED); -+ -+ if (new_ss > old_ss && notify_driver) { -+ err = drv_sta_smd_state(local, sta->sdata, &sta->sta, old_ss, -+ new_ss); -+ if (err) -+ return err; -+ } -+ -+ if (new_ss < old_ss && notify_driver) { -+ err = drv_sta_smd_state(local, sta->sdata, &sta->sta, old_ss, -+ new_ss); -+ /* driver should not fail moving down SMD states */ -+ WARN_ONCE(err, -+ "Driver should not fail moving down SMD states: %d\n", -+ err); -+ } ++ if (test_sta_flag(sta, WLAN_STA_INSERTED)) ++ drv_sta_notify_st(local, sta->sdata, &sta->sta, new_ss);  + -+ sta->smd_state = new_ss; ++ sta->st_state = new_ss;  +  + return 0;  +}  + -+void sta_info_reset_smd_state(struct sta_info *sta, bool notify) ++void sta_info_reset_st_state(struct sta_info *sta)  +{ -+ if (sta->smd_state == IEEE80211_STA_SMD_NONE) ++ if (sta->st_state == IEEE80211_STA_ST_NONE)  + return;  + -+ /* DRAIN -> NONE, EXEC -> NONE or PREP -> NONE */ -+ WARN_ON_ONCE(sta_info_move_smd_state(sta, IEEE80211_STA_SMD_NONE, -+ notify)); -+ -+ clear_sta_flag(sta, WLAN_STA_SMD_PREP_TARGET); -+ clear_sta_flag(sta, WLAN_STA_SMD_EXEC_CURRENT); -+ clear_sta_flag(sta, WLAN_STA_SMD_DL_DRAIN); -+} -+ -+int sta_info_move_drv_smd_state(struct sta_info *sta) -+{ -+ enum ieee80211_sta_smd_state new_ss = sta->smd_state; -+ struct ieee80211_local *local = sta->local; -+ int err = 0; -+ -+ if (!test_sta_flag(sta, WLAN_STA_INSERTED)) -+ return 0; -+ -+ switch (new_ss) { -+ case IEEE80211_STA_SMD_PREP: -+ err = drv_sta_smd_state(local, sta->sdata, &sta->sta, -+ IEEE80211_STA_SMD_NONE, -+ IEEE80211_STA_SMD_PREP); -+ if (err) -+ goto rollback; -+ break; -+ case IEEE80211_STA_SMD_EXEC: -+ case IEEE80211_STA_SMD_DRAIN: -+ err = drv_sta_smd_state(local, sta->sdata, &sta->sta, -+ IEEE80211_STA_SMD_NONE, -+ IEEE80211_STA_SMD_EXEC); -+ if (err) -+ goto rollback; -+ -+ if (new_ss == IEEE80211_STA_SMD_DRAIN) -+ err = drv_sta_smd_state(local, sta->sdata, &sta->sta, -+ IEEE80211_STA_SMD_EXEC, -+ IEEE80211_STA_SMD_DRAIN); -+ break; -+ default: -+ return -EINVAL; -+ } -+ -+ if (!err) -+ return 0; -+ -+ /* if EXEC -> DRAIN failed in the driver, notify EXEC -> NONE */ -+ WARN_ON_ONCE(drv_sta_smd_state(local, sta->sdata, &sta->sta, -+ IEEE80211_STA_SMD_EXEC, -+ IEEE80211_STA_SMD_NONE)); ++ clear_sta_flag(sta, WLAN_STA_ST_PREPARED); ++ clear_sta_flag(sta, WLAN_STA_ST_EXECUTING); ++ clear_sta_flag(sta, WLAN_STA_ST_DL_DRAIN);  + -+rollback: -+ sta_info_reset_smd_state(sta, false); -+ return err; ++ sta->st_state = IEEE80211_STA_ST_NONE;  +}  ## net/mac80211/sta_info.h ## @@ net/mac80211/sta_info.h: struct ieee80211_sta_removed_link_stats { * would be assigned to link[link_id] where link_id is the id assigned * by the AP. * @rem_link_stats: accumulated removed link stats -+ * @smd_state: Sub-state for STAs in SMD BSS Transition ++ * @st_state: Sub-state for STAs in ST */ struct sta_info { /* General information, mostly static */ @@ net/mac80211/sta_info.h: struct sta_info { struct link_sta_info __rcu *link[IEEE80211_MLD_MAX_NUM_LINKS]; struct ieee80211_sta_removed_link_stats rem_link_stats;  -+ enum ieee80211_sta_smd_state smd_state; ++ enum ieee80211_sta_st_state st_state;  + /* keep last! */ struct ieee80211_sta sta; @@ net/mac80211/sta_info.h: static inline u32 sta_stats_encode_rate(struct ieee8021 return r; }  -+int sta_info_move_smd_state(struct sta_info *sta, -+ enum ieee80211_sta_smd_state new_ss, -+ bool notify); -+void sta_info_reset_smd_state(struct sta_info *sta, bool notify); -+int sta_info_move_drv_smd_state(struct sta_info *sta); ++int sta_info_move_st_state(struct sta_info *sta, ++ enum ieee80211_sta_st_state new_ss); ++void sta_info_reset_st_state(struct sta_info *sta);  + #endif /* STA_INFO_H */  @@ net/mac80211/trace.h: TRACE_EVENT(drv_nan_peer_sched_changed, ) );  -+TRACE_EVENT(drv_sta_smd_state, ++TRACE_EVENT(drv_sta_notify_st,  + TP_PROTO(struct ieee80211_local *local,  + struct ieee80211_sub_if_data *sdata,  + struct ieee80211_sta *sta, -+ enum ieee80211_sta_smd_state old_state, -+ enum ieee80211_sta_smd_state new_state), ++ enum ieee80211_sta_st_state state),  + -+ TP_ARGS(local, sdata, sta, old_state, new_state), ++ TP_ARGS(local, sdata, sta, state),  +  + TP_STRUCT__entry(  + LOCAL_ENTRY  + VIF_ENTRY  + STA_ENTRY -+ __field(u32, old_state) -+ __field(u32, new_state) ++ __field(u32, state)  + ),  +  + TP_fast_assign(  + LOCAL_ASSIGN;  + VIF_ASSIGN;  + STA_ASSIGN; -+ __entry->old_state = old_state; -+ __entry->new_state = new_state; ++ __entry->state = state;  + ),  +  + TP_printk( -+ LOCAL_PR_FMT VIF_PR_FMT STA_PR_FMT -+ " smd_state: %d->%d", -+ LOCAL_PR_ARG, VIF_PR_ARG, STA_PR_ARG, -+ __entry->old_state, __entry->new_state ++ LOCAL_PR_FMT VIF_PR_FMT STA_PR_FMT " st_state: %d", ++ LOCAL_PR_ARG, VIF_PR_ARG, STA_PR_ARG, __entry->state  + )  +);  + 15: 4b715d1882b2 ! 14: e093957040d0 wifi: mac80211: filter uplink and downlink frames based on SMD states @@ Metadata Author: Pooventhiran G   ## Commit message ## - wifi: mac80211: filter uplink and downlink frames based on SMD states + wifi: mac80211: filter uplink and downlink frames based on ST states  - During SMD BSS Transition, based on the state that the non-AP MLD is - currently in, there are frame filtering conditions imposed in both - uplink and downlink directions, as per IEEE P802.11bn/D2.0, Aug 2026, - subclause 11.3.1. + During ST, based on the state that the non-AP MLD is currently in, there + are frame filtering conditions imposed in both uplink and downlink + directions, as per IEEE P802.11bn/D2.0, Aug 2026, subclause 11.3.1.  State 4a: - UL/DL: All Class 3 frames except ST Execution Request and Response @@ net/mac80211/rx.c: ieee80211_rx_h_check(struct ieee80211_rx_data *rx) }   +static ieee80211_rx_result debug_noinline -+ieee80211_rx_h_smd_state(struct ieee80211_rx_data *rx) ++ieee80211_rx_h_st_state(struct ieee80211_rx_data *rx)  +{  + struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)rx->skb->data;  + __le16 fc = hdr->frame_control; @@ net/mac80211/rx.c: ieee80211_rx_h_check(struct ieee80211_rx_data *rx)  + if (!rx->sta ||  + (rx->sdata->vif.type != NL80211_IFTYPE_AP &&  + rx->sdata->vif.type != NL80211_IFTYPE_AP_VLAN) || ++ !rx->sta->sta.smd_sta ||  + !test_sta_flag(rx->sta, WLAN_STA_ASSOC) ||  + is_multicast_ether_addr(hdr->addr1))  + return RX_CONTINUE;  + -+ switch (rx->sta->smd_state) { -+ case IEEE80211_STA_SMD_NONE: ++ switch (rx->sta->st_state) { ++ case IEEE80211_STA_ST_NONE:  + break; -+ case IEEE80211_STA_SMD_PREP: ++ case IEEE80211_STA_ST_PREPARED:  + /* 4a: Class 3 disallowed except ST Execution Request */  + if (ieee80211_is_st_exec_req(rx->skb))  + break;  + if (ieee80211_is_class3(rx->skb))  + return RX_DROP_U_SMD_FILTERED;  + break; -+ case IEEE80211_STA_SMD_EXEC: ++ case IEEE80211_STA_ST_EXECUTING:  + /* 4b: Class 3 Data frames disallowed */  + if (ieee80211_is_data(fc))  + return RX_DROP_U_SMD_FILTERED;  + break; -+ case IEEE80211_STA_SMD_DRAIN: ++ case IEEE80211_STA_ST_DL_DRAIN:  + /*  + * 4c: Class 3 frames disallowed except QoS Null, Control, and  + * UHR Reconfiguration Notify frames. @@ net/mac80211/rx.c: static void ieee80211_invoke_rx_handlers(struct ieee80211_rx_  CALL_RXH(ieee80211_rx_h_check_dup); CALL_RXH(ieee80211_rx_h_check); -+ CALL_RXH(ieee80211_rx_h_smd_state); ++ CALL_RXH(ieee80211_rx_h_st_state);  ieee80211_rx_reorder_ampdu(rx, &reorder_release);  @@ net/mac80211/tx.c: ieee80211_tx_h_check_assoc(struct ieee80211_tx_data *tx) }   +static ieee80211_tx_result debug_noinline -+ieee80211_tx_h_smd_state(struct ieee80211_tx_data *tx) ++ieee80211_tx_h_st_state(struct ieee80211_tx_data *tx)  +{  + struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)tx->skb->data;  + __le16 fc = hdr->frame_control; @@ net/mac80211/tx.c: ieee80211_tx_h_check_assoc(struct ieee80211_tx_data *tx)  + if (!tx->sta ||  + (tx->sdata->vif.type != NL80211_IFTYPE_AP &&  + tx->sdata->vif.type != NL80211_IFTYPE_AP_VLAN) || ++ !tx->sta->sta.smd_sta ||  + !test_sta_flag(tx->sta, WLAN_STA_ASSOC) ||  + !(tx->flags & IEEE80211_TX_UNICAST))  + return TX_CONTINUE;  + -+ switch (tx->sta->smd_state) { -+ case IEEE80211_STA_SMD_NONE: ++ switch (tx->sta->st_state) { ++ case IEEE80211_STA_ST_NONE:  + break; -+ case IEEE80211_STA_SMD_PREP: ++ case IEEE80211_STA_ST_PREPARED:  + /* 4a: Class 3 disallowed except ST Execution Response */  + if (ieee80211_is_st_exec_resp(tx->skb))  + break;  + if (ieee80211_is_class3(tx->skb))  + return TX_DROP;  + break; -+ case IEEE80211_STA_SMD_EXEC: ++ case IEEE80211_STA_ST_EXECUTING:  + /* 4b: no restriction */  + break; -+ case IEEE80211_STA_SMD_DRAIN: ++ case IEEE80211_STA_ST_DL_DRAIN:  + /* 4c: Class 3 disallowed except Data, Control,  + * UHR Reconfiguration Notify  + */ @@ net/mac80211/tx.c: static int invoke_tx_handlers_early(struct ieee80211_tx_data  CALL_TXH(ieee80211_tx_h_dynamic_ps); CALL_TXH(ieee80211_tx_h_check_assoc); -+ CALL_TXH(ieee80211_tx_h_smd_state); ++ CALL_TXH(ieee80211_tx_h_st_state); CALL_TXH(ieee80211_tx_h_ps_buf); CALL_TXH(ieee80211_tx_h_check_control_port_protocol); CALL_TXH(ieee80211_tx_h_select_key); 16: 62b5a4791948 < -: ------------ wifi: mac80211: send BlockAck policy in AMPDU action 17: 09a0425f2bd5 ! 15: d6ed79ec4737 wifi: mac80211: pass rx_data directly from ieee80211_rx_list() @@ Commit message Signed-off-by: Pooventhiran G   ## net/mac80211/rx.c ## -@@ net/mac80211/rx.c: static bool ieee80211_rx_valid_freq(struct ieee80211_rx_status *status, +@@ net/mac80211/rx.c: ieee80211_link_from_freq(struct ieee80211_sub_if_data *sdata, int freq) static void __ieee80211_rx_handle_packet(struct ieee80211_hw *hw, struct ieee80211_link_sta *link_pubsta, struct sk_buff *skb,  - struct list_head *list)  + struct list_head *list,  + struct ieee80211_rx_data *rx) + __must_hold_shared(RCU) { struct ieee80211_local *local = hw_to_local(hw); - struct ieee80211_sub_if_data *sdata;  @@ net/mac80211/rx.c: static void __ieee80211_rx_handle_packet(struct ieee80211_hw *hw, struct link_sta_info *link_sta; struct sta_info *sta; @@ net/mac80211/rx.c: static void __ieee80211_rx_handle_packet(struct ieee80211_hw if (unlikely(ieee80211_is_probe_resp(hdr->frame_control) || ieee80211_is_beacon(hdr->frame_control) ||  @@ net/mac80211/rx.c: static void __ieee80211_rx_handle_packet(struct ieee80211_hw *hw, - sta); + sta = sta_from_pub(link_pubsta->sta); link_sta = rcu_dereference(sta->link[link_pubsta->link_id]);   - rx.sdata = sta->sdata; @@ net/mac80211/rx.c: static void __ieee80211_rx_handle_packet(struct ieee80211_hw  continue;  @@ net/mac80211/rx.c: static void __ieee80211_rx_handle_packet(struct ieee80211_hw *hw, - } + link = ieee80211_link_from_freq(sdata, status->freq);  if (rx_data_pending) {  - ieee80211_prepare_and_rx_handle(&rx, skb, false); 18: b7b8997e1aa0 ! 16: 2a65202058f9 wifi: mac80211: handle UHR Link Reconfiguration frame @@ Commit message wifi: mac80211: handle UHR Link Reconfiguration frame  A UHR Link Reconfiguration Request frame (ST Preparation or Execution) - triggers SMD BSS Transition on the current AP MLD. Userspace needs - reporting of the STA's dynamic context along with such frames so that - the same can be transported to the target AP MLD for setting up the STA - TX and RX queues. + triggers SMD Transition on the current AP MLD. Userspace needs reporting + of the STA's dynamic context along with such frames so that the same can + be transported to the target AP MLD for setting up the STA TX and RX + queues.  Reserve a field in ieee80211_rx_status that enables drivers to attach the STA's dynamic context to the corresponding frame. Since the maximum @@ include/net/mac80211.h: enum mac80211_rx_encoding { * @ack_tx_hwtstamp: Hardware timestamp for the ack TX in nanoseconds. Only * needed for Timing measurement and Fine timing measurement action frames. * Only reported by devices that have timestamping enabled. -+ * @smd_ctx: Pointer to IEEE P802.11bn SMD BSS Transition context information. ++ * @st_ctx: Pointer to IEEE P802.11bn SMD Transition context information.  + * Only needed for ST Preparation Request and ST Execution Request action  + * frames. The pointer will be consumed by mac80211; must be kmalloc-ed. -+ * Indicated by @smd_ctx_valid. ++ * Indicated by @st_ctx_valid. * @device_timestamp: arbitrary timestamp for the device, mac80211 doesn't use * it but can store it and pass it back to the driver for synchronisation * @band: the active band when this frame was received  @@ include/net/mac80211.h: enum mac80211_rx_encoding { - * @link_id: id of the link used to receive the packet. Set and used by * mac80211 internally, it uses @freq set by the driver to identify the - * correct link per vif. -+ * @smd_ctx_valid: if @smd_ctx has a valid pointer to the ST context. This flag + * correct link per vif. Set to %IEEE80211_LINK_UNSPECIFIED for non-MLD + * or if link information is not applicable. ++ * @st_ctx_valid: if @st_ctx has a valid pointer to the ST context. This flag  + * is used only for ST Preparation or ST Execution Request frames. */ struct ieee80211_rx_status { @@ include/net/mac80211.h: enum mac80211_rx_encoding { union { u64 boottime_ns; ktime_t ack_tx_hwtstamp; -+ struct ieee80211_smd_ctx *smd_ctx; ++ struct ieee80211_st_ctx *st_ctx; }; u32 device_timestamp; u32 ampdu_reference; @@ include/net/mac80211.h: struct ieee80211_rx_status { u8 zero_length_psdu_type;  - u8 link_id:4;  + u8 link_id:4, -+ smd_ctx_valid:1; ++ st_ctx_valid:1; };  static_assert(sizeof(struct ieee80211_rx_status) <= sizeof_field(struct sk_buff, cb)); @@ net/mac80211/ieee80211_i.h: struct ieee80211_rx_data {  u8 link_addrs[3 * ETH_ALEN];  + -+ struct ieee80211_smd_ctx *smd_ctx; ++ struct ieee80211_st_ctx *st_ctx; };  struct ieee80211_csa_settings { @@ net/mac80211/rx.c: ieee80211_rx_h_action(struct ieee80211_rx_data *rx)  + struct ieee80211_mgmt *mgmt = (void *)info->buf;  + u8 type;  + -+ if (!rx->smd_ctx) ++ if (!rx->st_ctx)  + return;  +  + type = mgmt->u.action.uhr_link_reconf_req.type;  +  + info->st_info.type = type; -+ info->st_info.ctx = rx->smd_ctx; ++ info->st_info.ctx = rx->st_ctx;  +}  + static ieee80211_rx_result debug_noinline @@ net/mac80211/rx.c: void ieee80211_rx_list(struct ieee80211_hw *hw, struct ieee80211_supported_band *sband; struct ieee80211_rx_status *status = IEEE80211_SKB_RXCB(skb); struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data; -+ struct ieee80211_smd_ctx *smd_ctx = NULL; ++ struct ieee80211_st_ctx *st_ctx = NULL; struct ieee80211_rx_data rx = {};  WARN_ON_ONCE(softirq_count() == 0);   + /* cache the pointer to free it later */ -+ if (status->smd_ctx_valid) { -+ smd_ctx = status->smd_ctx; -+ status->smd_ctx = NULL; -+ status->smd_ctx_valid = false; ++ if (status->st_ctx_valid) { ++ st_ctx = status->st_ctx; ++ status->st_ctx = NULL; ++ status->st_ctx_valid = false;  + }  + if (WARN_ON(status->band >= NUM_NL80211_BANDS)) @@ net/mac80211/rx.c: void ieee80211_rx_list(struct ieee80211_hw *hw,  kcov_remote_start_common(skb_get_kcov_handle(skb));  -+ rx.smd_ctx = smd_ctx; ++ rx.st_ctx = st_ctx;  + -+ if (WARN_ONCE((status->flag & RX_FLAG_8023) && rx.smd_ctx, -+ "802.3 packet but with IEEE P802.11bn SMD context")) ++ if (WARN_ONCE((status->flag & RX_FLAG_8023) && rx.st_ctx, ++ "802.3 packet but with IEEE P802.11bn ST context"))  + goto drop;  + /* @@ net/mac80211/rx.c: void ieee80211_rx_list(struct ieee80211_hw *hw, __ieee80211_rx_handle_packet(hw, link_pubsta, skb, list, &rx); } -+ kfree(smd_ctx); ++ kfree(st_ctx);  kcov_remote_stop(); return; drop: -+ kfree(smd_ctx); ++ kfree(st_ctx); kfree_skb(skb); } EXPORT_SYMBOL(ieee80211_rx_list); 19: c10be79097f3 ! 17: e6928dab9332 wifi: mac80211: add mac80211 support to handle NL80211_CMD_SET_SMD_CTX @@ Metadata Author: Pooventhiran G   ## Commit message ## - wifi: mac80211: add mac80211 support to handle NL80211_CMD_SET_SMD_CTX + wifi: mac80211: add mac80211 support to handle NL80211_CMD_SET_ST_CTX  - cfg80211 supports NL80211_CMD_SET_SMD_CTX on the target AP MLD for + cfg80211 supports NL80211_CMD_SET_ST_CTX on the target AP MLD for userspace to program the station's dynamic context on the TX and RX queues.  @@ Commit message so that the context is installed and the target AP MLD is ready to continue data transfer with the non-AP MLD from where it may have left off at the current AP MLD. This facilitates the seamless roaming benefit - of the SMD BSS Transition procedure. + of the ST procedure.  Signed-off-by: Pooventhiran G   ## include/net/mac80211.h ## -@@ include/net/mac80211.h: enum ieee80211_sta_smd_state { - * @sta_smd_state: Notifies low level driver about IEEE 802.11bn SMD substate - * transition of a station. It must not fail while transitioning down. - * The callback can sleep. -+ * @set_smd_ctx: Set the UHR SMD context for the non-AP MLD. This is used on -+ * the target AP MLD side to program dynamic context. +@@ include/net/mac80211.h: enum ieee80211_sta_st_state { + * notification frame. + * @sta_notify_st: Notifies low level driver about IEEE 802.11bn ST substate + * transition of a station. The callback can sleep. ++ * @set_st_ctx: Set the ST context for the non-AP MLD. This is used on the ++ * target AP MLD side to program dynamic context. */ struct ieee80211_ops { void (*tx)(struct ieee80211_hw *hw,  @@ include/net/mac80211.h: struct ieee80211_ops { - struct ieee80211_sta *sta, - enum ieee80211_sta_smd_state old_state, - enum ieee80211_sta_smd_state new_state); -+ int (*set_smd_ctx)(struct ieee80211_hw *hw, struct ieee80211_vif *vif, -+ struct ieee80211_sta *sta, -+ struct cfg80211_smd_transition_info *st_info); + struct ieee80211_vif *vif, + struct ieee80211_sta *sta, + enum ieee80211_sta_st_state state); ++ int (*set_st_ctx)(struct ieee80211_hw *hw, struct ieee80211_vif *vif, ++ struct ieee80211_sta *sta, ++ struct cfg80211_smd_transition_info *st_info); };  /** @@ net/mac80211/cfg.c: ieee80211_set_nan_non_evac_channels(struct wiphy *wiphy, return ieee80211_nan_set_non_evac_channels(sdata, channels); }  -+static int ieee80211_set_smd_ctx(struct wiphy *wiphy, struct wireless_dev *wdev, -+ const u8 *addr, -+ struct cfg80211_smd_transition_info *st_info) ++static int ieee80211_set_st_ctx(struct wiphy *wiphy, struct wireless_dev *wdev, ++ const u8 *addr, ++ struct cfg80211_smd_transition_info *st_info)  +{  + struct ieee80211_local *local = wiphy_priv(wiphy);  + struct ieee80211_sub_if_data *sdata; @@ net/mac80211/cfg.c: ieee80211_set_nan_non_evac_channels(struct wiphy *wiphy,  + sta = sta_info_get_bss(sdata, addr);  + if (!sta)  + return -ENOENT; -+ if (!sta->sta.smd_params.smd_sta || -+ sta->smd_state != IEEE80211_STA_SMD_PREP) ++ if (!sta->sta.smd_sta || ++ sta->st_state != IEEE80211_STA_ST_PREPARED)  + return -EINVAL;  +  + if (!wiphy_dereference(wiphy, sta->ptk[sta->ptk_idx]))  + return -EINVAL;  + -+ return drv_set_smd_ctx(local, sdata, &sta->sta, st_info); ++ return drv_set_st_ctx(local, sdata, &sta->sta, st_info);  +}  + const struct cfg80211_ops mac80211_config_ops = { @@ net/mac80211/cfg.c: const struct cfg80211_ops mac80211_config_ops = { .nan_set_local_sched = ieee80211_set_local_nan_sched, .nan_set_peer_sched = ieee80211_set_peer_nan_sched, .nan_set_non_evac_channels = ieee80211_set_nan_non_evac_channels, -+ .set_smd_ctx = ieee80211_set_smd_ctx, ++ .set_st_ctx = ieee80211_set_st_ctx, };  ## net/mac80211/driver-ops.h ## -@@ net/mac80211/driver-ops.h: int drv_sta_smd_state(struct ieee80211_local *local, - enum ieee80211_sta_smd_state old_state, - enum ieee80211_sta_smd_state new_state); +@@ net/mac80211/driver-ops.h: void drv_sta_notify_st(struct ieee80211_local *local, + struct ieee80211_sta *sta, + enum ieee80211_sta_st_state state);  -+static inline int drv_set_smd_ctx(struct ieee80211_local *local, -+ struct ieee80211_sub_if_data *sdata, -+ struct ieee80211_sta *sta, -+ struct cfg80211_smd_transition_info *st_info) ++static inline int drv_set_st_ctx(struct ieee80211_local *local, ++ struct ieee80211_sub_if_data *sdata, ++ struct ieee80211_sta *sta, ++ struct cfg80211_smd_transition_info *st_info)  +{  + int ret;  + -+ if (!local->ops->set_smd_ctx) ++ if (!local->ops->set_st_ctx)  + return -EOPNOTSUPP;  +  + sdata = get_bss_sdata(sdata); @@ net/mac80211/driver-ops.h: int drv_sta_smd_state(struct ieee80211_local *local,  + if (!check_sdata_in_driver(sdata))  + return -EIO;  + -+ trace_drv_set_smd_ctx(local, sdata, sta, st_info); -+ ret = local->ops->set_smd_ctx(&local->hw, &sdata->vif, sta, st_info); ++ trace_drv_set_st_ctx(local, sdata, sta, st_info); ++ ret = local->ops->set_st_ctx(&local->hw, &sdata->vif, sta, st_info);  + trace_drv_return_int(local, ret);  +  + return ret; @@ net/mac80211/driver-ops.h: int drv_sta_smd_state(struct ieee80211_local *local, #endif /* __MAC80211_DRIVER_OPS */  ## net/mac80211/trace.h ## -@@ net/mac80211/trace.h: TRACE_EVENT(drv_sta_smd_state, +@@ net/mac80211/trace.h: TRACE_EVENT(drv_sta_notify_st, ) );  -+TRACE_EVENT(drv_set_smd_ctx, ++TRACE_EVENT(drv_set_st_ctx,  + TP_PROTO(struct ieee80211_local *local,  + struct ieee80211_sub_if_data *sdata,  + struct ieee80211_sta *sta, @@ net/mac80211/trace.h: TRACE_EVENT(drv_sta_smd_state,  + ),  +  + TP_fast_assign( -+ struct ieee80211_smd_ctx *ctx = st_info->ctx; ++ struct ieee80211_st_ctx *ctx = st_info->ctx;  +  + LOCAL_ASSIGN;  + VIF_ASSIGN; 20: bc145c32334c ! 18: 3785adfa2dbb wifi: mac80211: add mac80211 support to handle NL80211_CMD_GET_SMD_CTX @@ Metadata Author: Pooventhiran G   ## Commit message ## - wifi: mac80211: add mac80211 support to handle NL80211_CMD_GET_SMD_CTX + wifi: mac80211: add mac80211 support to handle NL80211_CMD_GET_ST_CTX  - cfg80211 supports NL80211_CMD_GET_SMD_CTX from userspace on the current + cfg80211 supports NL80211_CMD_GET_ST_CTX from userspace on the current AP MLD to collect the station's context on the target AP MLD's behalf; this context is used by the target AP MLD to program its TX and RX queues to support seamless roaming of the non-AP MLD. @@ Commit message Add mac80211 support for the same to invoke the driver to collect the requested station context. Since context collection is asynchronous, the driver reports the collected context later via - ieee80211_get_smd_ctx_done(), which then packs the context into - NL80211_CMD_SMD_CTX_EVENT and delivers it to userspace as a multicast + ieee80211_get_st_ctx_done(), which then packs the context into + NL80211_CMD_ST_CTX_EVENT and delivers it to userspace as a multicast event.  Signed-off-by: Pooventhiran G   ## include/net/mac80211.h ## -@@ include/net/mac80211.h: enum ieee80211_sta_smd_state { - * The callback can sleep. - * @set_smd_ctx: Set the UHR SMD context for the non-AP MLD. This is used on - * the target AP MLD side to program dynamic context. -+ * @get_smd_ctx: Get the UHR SMD context for the non-AP MLD. This is used in -+ * the current AP MLD side on behalf of the target AP MLD to collect -+ * dynamic context, when the non-AP MLD sends ST Execute frame directly -+ * to the target. Since the response is asynchronous, the drivers that -+ * implement this should not store reference to @sta. +@@ include/net/mac80211.h: enum ieee80211_sta_st_state { + * transition of a station. The callback can sleep. + * @set_st_ctx: Set the ST context for the non-AP MLD. This is used on the + * target AP MLD side to program dynamic context. ++ * @get_st_ctx: Get the ST context for the non-AP MLD. This is used in the ++ * current AP MLD side on behalf of the target AP MLD to collect dynamic ++ * context, when the non-AP MLD sends ST Execute frame directly to the ++ * target. Since the response is asynchronous, the drivers that implement ++ * this should not store reference to @sta. */ struct ieee80211_ops { void (*tx)(struct ieee80211_hw *hw,  @@ include/net/mac80211.h: struct ieee80211_ops { - int (*set_smd_ctx)(struct ieee80211_hw *hw, struct ieee80211_vif *vif, - struct ieee80211_sta *sta, - struct cfg80211_smd_transition_info *st_info); -+ int (*get_smd_ctx)(struct ieee80211_hw *hw, struct ieee80211_vif *vif, -+ struct ieee80211_sta *sta, -+ enum nl80211_smd_ctx_type type); + int (*set_st_ctx)(struct ieee80211_hw *hw, struct ieee80211_vif *vif, + struct ieee80211_sta *sta, + struct cfg80211_smd_transition_info *st_info); ++ int (*get_st_ctx)(struct ieee80211_hw *hw, struct ieee80211_vif *vif, ++ struct ieee80211_sta *sta, ++ enum nl80211_st_ctx_type type); };  /** @@ include/net/mac80211.h: bool ieee80211_vif_nan_started(struct ieee80211_vif *vif int ieee80211_encrypt_tx_skb(struct sk_buff *skb);  +  +/** -+ * ieee80211_get_smd_ctx_done - Deliver async get_smd_ctx result to nl80211 ++ * ieee80211_get_st_ctx_done - Deliver async get_st_ctx result to nl80211  + * @vif: virtual interface  + * @sta_addr: non-AP MLD address the context was collected for -+ * @st_info: SMD BSS Transition Info (set @st_info->ctx to NULL to indicate ++ * @st_info: SMD Transition Info (set @st_info->ctx to NULL to indicate  + * failure)  + */ -+void ieee80211_get_smd_ctx_done(struct ieee80211_vif *vif, -+ const u8 *sta_addr, -+ struct cfg80211_smd_transition_info *st_info); ++static inline ++void ieee80211_get_st_ctx_done(struct ieee80211_vif *vif, ++ const u8 *sta_addr, ++ struct cfg80211_smd_transition_info *st_info) ++{ ++ struct wireless_dev *wdev = ieee80211_vif_to_wdev(vif); ++ ++ if (wdev) ++ cfg80211_notify_get_st_ctx_done(wdev, sta_addr, st_info); ++} #endif /* MAC80211_H */  ## net/mac80211/cfg.c ## -@@ net/mac80211/cfg.c: static int ieee80211_set_smd_ctx(struct wiphy *wiphy, struct wireless_dev *wdev, - return drv_set_smd_ctx(local, sdata, &sta->sta, st_info); +@@ net/mac80211/cfg.c: static int ieee80211_set_st_ctx(struct wiphy *wiphy, struct wireless_dev *wdev, + return drv_set_st_ctx(local, sdata, &sta->sta, st_info); }  -+static int ieee80211_get_smd_ctx(struct wiphy *wiphy, struct wireless_dev *wdev, -+ const u8 *addr, -+ enum nl80211_smd_ctx_type type) ++static int ieee80211_get_st_ctx(struct wiphy *wiphy, struct wireless_dev *wdev, ++ const u8 *addr, ++ enum nl80211_st_ctx_type type)  +{  + struct ieee80211_local *local = wiphy_priv(wiphy);  + struct ieee80211_sub_if_data *sdata; @@ net/mac80211/cfg.c: static int ieee80211_set_smd_ctx(struct wiphy *wiphy, struct  + sta = sta_info_get_bss(sdata, addr);  + if (!sta)  + return -ENOENT; -+ if (!sta->sta.smd_params.smd_sta) ++ if (!sta->sta.smd_sta)  + return -EINVAL;  + -+ return drv_get_smd_ctx(local, sdata, &sta->sta, type); -+} -+ -+void ieee80211_get_smd_ctx_done(struct ieee80211_vif *vif, -+ const u8 *sta_addr, -+ struct cfg80211_smd_transition_info *st_info) -+{ -+ struct ieee80211_sub_if_data *sdata = vif_to_sdata(vif); -+ -+ cfg80211_get_smd_ctx_done(&sdata->wdev, sta_addr, st_info); ++ return drv_get_st_ctx(local, sdata, &sta->sta, type);  +} -+EXPORT_SYMBOL(ieee80211_get_smd_ctx_done);  + const struct cfg80211_ops mac80211_config_ops = { .add_virtual_intf = ieee80211_add_iface, @@ net/mac80211/cfg.c: static int ieee80211_set_smd_ctx(struct wiphy *wiphy, struct  @@ net/mac80211/cfg.c: const struct cfg80211_ops mac80211_config_ops = { .nan_set_peer_sched = ieee80211_set_peer_nan_sched, .nan_set_non_evac_channels = ieee80211_set_nan_non_evac_channels, - .set_smd_ctx = ieee80211_set_smd_ctx, -+ .get_smd_ctx = ieee80211_get_smd_ctx, + .set_st_ctx = ieee80211_set_st_ctx, ++ .get_st_ctx = ieee80211_get_st_ctx, };  ## net/mac80211/driver-ops.h ## -@@ net/mac80211/driver-ops.h: static inline int drv_set_smd_ctx(struct ieee80211_local *local, +@@ net/mac80211/driver-ops.h: static inline int drv_set_st_ctx(struct ieee80211_local *local, return ret; }  -+static inline int drv_get_smd_ctx(struct ieee80211_local *local, -+ struct ieee80211_sub_if_data *sdata, -+ struct ieee80211_sta *sta, -+ enum nl80211_smd_ctx_type type) ++static inline int drv_get_st_ctx(struct ieee80211_local *local, ++ struct ieee80211_sub_if_data *sdata, ++ struct ieee80211_sta *sta, ++ enum nl80211_st_ctx_type type)  +{  + int ret;  + -+ if (!sdata || !local->ops->get_smd_ctx) ++ if (!sdata || !local->ops->get_st_ctx)  + return -EOPNOTSUPP;  +  + sdata = get_bss_sdata(sdata); @@ net/mac80211/driver-ops.h: static inline int drv_set_smd_ctx(struct ieee80211_lo  + if (!check_sdata_in_driver(sdata))  + return -EIO;  + -+ trace_drv_get_smd_ctx(local, sdata, sta, type); -+ ret = local->ops->get_smd_ctx(&local->hw, &sdata->vif, sta, type); ++ trace_drv_get_st_ctx(local, sdata, sta, type); ++ ret = local->ops->get_st_ctx(&local->hw, &sdata->vif, sta, type);  + trace_drv_return_int(local, ret);  +  + return ret; @@ net/mac80211/driver-ops.h: static inline int drv_set_smd_ctx(struct ieee80211_lo  + #endif /* __MAC80211_DRIVER_OPS */  - ## net/mac80211/sta_info.c ## -@@ net/mac80211/sta_info.c: static int __must_check __sta_info_destroy_part1(struct sta_info *sta) - { - struct ieee80211_local *local; - struct ieee80211_sub_if_data *sdata; -+ struct wireless_dev *wdev; - int ret, i; -  - might_sleep(); -@@ net/mac80211/sta_info.c: static int __must_check __sta_info_destroy_part1(struct sta_info *sta) -  - local = sta->local; - sdata = sta->sdata; -+ wdev = &sdata->wdev; -  - lockdep_assert_wiphy(local->hw.wiphy); -  -@@ net/mac80211/sta_info.c: static int __must_check __sta_info_destroy_part1(struct sta_info *sta) - rcu_access_pointer(sdata->u.vlan.sta) == sta) - RCU_INIT_POINTER(sdata->u.vlan.sta, NULL); -  -+ if (sdata->vif.type == NL80211_IFTYPE_AP || -+ sdata->vif.type == NL80211_IFTYPE_AP_VLAN) -+ cfg80211_free_pending_smd_ctx_req(wdev, sta->addr); -+ - return 0; - } -  - ## net/mac80211/trace.h ## -@@ net/mac80211/trace.h: TRACE_EVENT(drv_set_smd_ctx, +@@ net/mac80211/trace.h: TRACE_EVENT(drv_set_st_ctx, ) );  -+TRACE_EVENT(drv_get_smd_ctx, ++TRACE_EVENT(drv_get_st_ctx,  + TP_PROTO(struct ieee80211_local *local,  + struct ieee80211_sub_if_data *sdata,  + struct ieee80211_sta *sta, -+ enum nl80211_smd_ctx_type type), ++ enum nl80211_st_ctx_type type),  +  + TP_ARGS(local, sdata, sta, type),  + 21: 57d03359bd56 < -: ------------ wifi: mac80211: define API to invoke SMD Drain Completion event  -: ------------ > 19: 934960afe60f wifi: mac80211: define API to invoke ST Drain Completion event