wifi: Add Seamless Mobility Domain (SMD) AP support
Subsystems (2)
v3 cover wifi: Add Seamless Mobility Domain (SMD) AP support
IEEE P802.11bn introduces the Seamless Mobility Domain (SMD) - a mobility domain uniquely identified by the SMD identifier MAC address - where a non-AP MLD that is associated to the SMD Management Entity (SMD-ME) can transition from its current AP MLD to a non-colocated target AP MLD without requiring reassociation via SMD BSS Transition (ST) procedure.
This series implements the nl80211, cfg80211, and mac80211 support for SMD BSS Transition in AP mode. Along with a summary of the ST procedure, the design of this series and patch structure are presented below.
The ST procedure broadly involves
- ST Discovery and association to SMD-ME
- ST Preparation
- ST Execution and Downlink Draining
- ST Context
The communication between the current AP MLD and target AP MLD are via Inter-AP (IAP) communication (solicited and unsolicited) over the backhaul which is managed entirely within userspace (hostapd) - as per the discussions on the RFC [1].
The IEEE standard defines only the type of data that may be exchanged via IAP but does not define the format and method of the IAP communication protocol and keeps it out of scope (subclause 37.16.9). So, those details are not part of this series.
ST Discovery and association to SMD-ME (subclauses 37.16.2 through 37.16.4)
===========================================================================
A non-AP MLD may use techniques like active scanning, neighbor reports, or BSS Transition Management to discover the neighboring SMD AP MLDs. Once discoverred, the non-AP MLD can perform authentication and association with the SMD-ME and negotiate SMD capabilities. While generating PTK, based on SMD PTK mode, either SMD Identifier is involved in the PTK formula or only SMD KDK is generated.
- This series supports configuring an AP MLD as managed by an SMD-ME with attributes such as SMD Identifier, SMD Preparation Timeout, SMD Type, PTK Mode, etc., via NL80211_CMD_START_AP.
- This series supports managing the associated non-AP MLD that has negotiated SMD via NL80211_CMD_NEW_STATION and NL80211_CMD_CHANGE_STATION.
ST Preparation (subclauses 37.16.5 and 37.16.6)
===============================================
The current AP MLD and non-AP MLD can use BTM frames to select a target AP MLD that the non-AP MLD can transition to. Once the target is selected, the ST procedure is invoked in two phases: ST Preparation and ST Execution.
The non-AP MLD sends an ST Preparation Request (UHR Link Reconfiguration Request frame to with Type set to ST Preparation and Per-STA Profile subelements of the setup links for the target AP MLD carried in a Reconfiguration Multi-Link element) to the current AP MLD.
On reception of this frame, the current AP MLD collects the non-AP MLD's dynamic sesion context and attach it to the same frame while delivering it to userspace. Userspace then sends this information as an IAP message to the target AP MLD. If Per-AP MLD PTK mode is used, DH key exchange happens in ST Preparation to derive the new PTK at the target AP MLD.
The target, once processed the message, will set up the links as rquested and sends back the ST Preparation Response so that the current AP MLD can send the ST Preparation Response (UHR Link Reconfiguration Response frame with Type set to ST Preparation and statuses for each setup link) to the non-AP MLD.
- This series defines the layout for STA's dynamic context and supports reporting the driver-attached STA's dynamic context along with the frame via NL80211_CMD_FRAME event (this avoids roundtrips between driver and userspace to separately request context for the recently received frame).
- The target AP MLD leverages the existing flows to set up the links (NONE -> AUTH -> ASSOC).
- This series supports moving the STA to the prepared state (4a) via the new STA flags (subclause 11.3.1).
- This series supports programming the STA's dynamic context via NL80211_CMD_SET_CTX on the target AP MLD.
NOTE:
(a) While implementing the suggestion to follow the approach similar to how radiotap headers are attached to the SKB, for tagging the STA's dynamic context to the frame SKB from driver to mac80211, an alternative approach was found.
(b) This reserves a new field in &struct ieee80211_rx_status as part of an existing union (please see this patch [2]). Since this was simpler than _pushing_ the context pointer to the frame SKB and _pulling_ back, this series follows this approach.
ST Execution and Downlink Draining (subclauses 37.16.7, 37.16.8, and 37.16.10)
==============================================================================
When the non-AP STA is ready to transition to the target AP MLD that it has already been prepared with, it can send the ST Execution Request (UHR Link Reconfiguration Request frame with Type set to ST Execution) in two ways:
Via the current AP MLD
----------------------
This path traces a similar flow to ST Preparation for context collection and reporting to userspace of the current AP MLD, transport to the target AP MLD, and ST Execution Response back to the current AP MLD and non-AP MLD. If there is a Nominal Maximum DL Draining Period Duration field is present in the ST Execution Response, the current AP MLD may start the DL draining period to drain the pendign buffered frames to the non-AP MLD.
- This series supports moving the non-AP MLD to the execution in-progress state (state 4b) via the new STA flags on the current AP MLD
upon reception of the ST Execution Rquest.
- This series supports moving the non-AP MLD to the DL draining started state (state 4c) via the new STA flags on the current AP MLD and implements proper validation for these flags as they are mutually exclusive.
Upon successful ST Execution, the non-AP MLD moves to the authorized state (state 4) on the target AP MLD and the unauthenticated and unassociated state (state 1) on the current AP MLD, without reassociation.
Via the target AP MLD
---------------------
The non-AP MLD might send the ST Execution Request directly to the target AP MLD when the current AP MLD links are not reliable (RSSI drops after ST Preparation, etc.,).
When the target AP MLD receives such a frame, it cannot collect the STA's dynamic context. Hence, the context is requested from the current AP MLD via IAP and then programmed on the target AP MLD. There is no DL draining in this path.
- This series supports fetching of context on the current AP MLD on behalf of the target AP MLD via NL80211_CMD_GET_SMD_CTX and NL80211_CMD_SMD_CTX_EVENT.
ST Context (subclause 37.16.9)
==============================
The following information are part of the STA's dynamic context and transferred from the current AP MLD to the target AP MLD during ST Preparation and ST Execution:
- Block-ack parameters and timeout per TID
- Next DL sequence numbers per TID
- Duplicate receiver cache entries
- Replay counters
- Starting PN for DL individually addressed frames
- SCS stream descriptors
- MSCS Descriptor
- EPCS authorization info and priority access state
- WinStartO for existing DL block-ack agreements
The non-AP STA may optionally request that sequence numbers not be transferred (to reset SN at the target AP MLD).
This series suporting the SMD BSS Transition is structured as:
- nl80211/cfg80211 set of patches followed by their corresponding mac80211 set of patches.
- nl80211/cfg80211: patches 1 to 11
- mac80211: patches 12 to 21
[1] RFC: https://lore.kernel.org/linux-wireless/[email protected]/
[2] Patch ("wifi: mac80211: handle UHR Link Reconfiguration frame")
---
Changes in v3:
- Replaced deprecated dev_{hold,put} APIs with netdev_{hold,put} APIs.
- Split and sorted the patches to list all nl80211/cfg80211 set of patches followed by mac80211 set of patches.
- Relocated context layout and cleaned up driver context with standard fields defined - ("wifi: cfg80211: define layouts for SMD BSS Transition context").
- Split ("wifi: mac80211: handle UHR Link Reconfiguration frame") to
pass @rx directly from ieee80211_rx_list() in ("wifi: mac80211: pass rx_data directly from ieee80211_rx_list()").
- Added nl80211 DOC for AP SMD operations in corresponding patches.
- Added SMD state based frame filtering in ("wifi: mac80211: filter uplink and downlink frames based on SMD states").
- Added DL Drain early termination event support in ("wifi: mac80211:
define API to invoke SMD Drain Completion event").
- Fixed up commit texts and kdocs because of patch reorder.
- Rebased on top of the latest snapshot.
- Link to v2: https://lore.kernel.org/r/[email protected]
Changes in v2:
- Replaced SKB extension with a mac80211-contained solution using ieee80211_rx_status to forward the ST Preparation and Execution frames along with the context.
- Fixed cover letter, commit text, and kdocs to clean up the AI-suggested style and words.
- Fixed the build failure from v1.
- Rebased onto a latest snapshot of wireless-next (6c0b7357e3c7f365ec51dd8d2b626130ee983ce1).
v1: https://lore.kernel.org/all/[email protected]/
---
Aditya Sathish (1):
wifi: nl80211/cfg80211: define interfaces for SMD setup and STA update
Pooventhiran G (19):
wifi: nl80211: define Seamless Mobility Domain (SMD) device capability
wifi: nl80211: add SMD BSS Transition sub-state STA flags
wifi: cfg80211: define layouts for SMD BSS Transition context
wifi: nl80211: define interfaces for SMD BSS Transition context transfer
wifi: ieee80211: define APIs for UHR Link Reconfiguration frame checks
wifi: ieee80211: define API to check if frame is class 3
wifi: nl80211/cfg80211: pack SMD dynamic context along with frame
wifi: nl80211/cfg80211: add support for SMD context programming
wifi: nl80211/cfg80211: add support for querying SMD context for target AP MLD
wifi: nl80211/cfg80211: define API to notify SMD Drain completion
wifi: mac80211: apply SMD BSS Transition STA sub-states
wifi: mac80211: add driver_op for SMD substate changes
wifi: mac80211: filter uplink and downlink frames based on SMD states
wifi: mac80211: send BlockAck policy in AMPDU action
wifi: mac80211: pass rx_data directly from ieee80211_rx_list()
wifi: mac80211: handle UHR Link Reconfiguration frame
wifi: mac80211: add mac80211 support to handle NL80211_CMD_SET_SMD_CTX
wifi: mac80211: add mac80211 support to handle NL80211_CMD_GET_SMD_CTX
wifi: mac80211: define API to invoke SMD Drain Completion event
Rohan Dutta (1):
wifi: mac80211: set SMD parameters for AP setup and STA update
include/linux/ieee80211-uhr.h | 125 ++++++ include/linux/ieee80211.h | 43 ++ include/net/cfg80211.h | 186 +++++++++ include/net/mac80211.h | 96 ++++- include/uapi/linux/nl80211.h | 254 ++++++++++++ net/mac80211/agg-rx.c | 1 + net/mac80211/cfg.c | 189 +++++++++ net/mac80211/debugfs_sta.c | 4 + net/mac80211/driver-ops.c | 24 ++ net/mac80211/driver-ops.h | 54 +++ net/mac80211/drop.h | 1 + net/mac80211/ieee80211_i.h | 2 + net/mac80211/rx.c | 140 +++++-- net/mac80211/sta_info.c | 146 +++++++ net/mac80211/sta_info.h | 19 + net/mac80211/trace.h | 104 ++++- net/mac80211/tx.c | 42 ++ net/wireless/core.c | 25 ++ net/wireless/mlme.c | 41 ++ net/wireless/nl80211.c | 930 +++++++++++++++++++++++++++++++++++++++++- net/wireless/nl80211.h | 12 + net/wireless/rdev-ops.h | 28 ++ net/wireless/trace.h | 61 +++ 23 files changed, 2485 insertions(+), 42 deletions(-)
---
base-commit: b8e5b0ae8ff47240366d38e5d12c65f878724316
change-id: 20260908-smd-16986850d725
Best regards,
PATCH v3 1/21 wifi: nl80211: define Seamless Mobility Domain (SMD) device capability
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.
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.
--- include/net/cfg80211.h | 3 +++ include/uapi/linux/nl80211.h | 25 +++++++++++++++++++++++++ net/wireless/nl80211.c | 7 +++++++ 3 files changed, 35 insertions(+)
include/net/cfg80211.h +3 -0
@@ -5796,6 +5796,8 @@ 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. */ enum wiphy_flags {WIPHY_FLAG_SUPPORTS_EXT_KEK_KCK =BIT (0 ),
@@ -5823,6 +5825,7 @@ 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), };/**
include/uapi/linux/nl80211.h +25 -0
@@ -343,6 +343,26 @@* processing of peer DH IE to generate PMK. */ +/** +* 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 *
@@ -3243,6 +3263,9 @@ 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). +* * @NUM_NL80211_ATTR: total number of nl80211_attrs available * @NL80211_ATTR_MAX: highest attribute number currently defined * @__NL80211_ATTR_AFTER_LAST: internal use
@@ -3850,6 +3873,8 @@ enum nl80211_attrs {NL80211_ATTR_ASSOC_PROTECTED_TWT , +NL80211_ATTR_SMD_SUPPORT , +/* add attributes here, update the policy in nl80211.c */ __NL80211_ATTR_AFTER_LAST,
net/wireless/nl80211.c +7 -0
@@ -1201,6 +1201,7 @@ static const struct nla_policy nl80211_policy[NUM_NL80211_ATTR] = { [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 }, };/* policy for the key attributes */
@@ -3824,6 +3825,12 @@ static int nl80211_send_wiphy(struct cfg80211_registered_device *rdev,if (nl80211_put_nan_capa (&rdev->wiphy, msg)) goto nla_put_failure; + state->split_start++; +break ; +case 19 : +if (rdev->wiphy.flags &WIPHY_FLAG_SUPPORTS_SMD ) +nla_put_flag (msg,NL80211_ATTR_SMD_SUPPORT ); +/* done */ state->split_start =0 ;break ;
Signature · 1 line
2.34.1
PATCH v3 2/21 wifi: nl80211/cfg80211: define interfaces for SMD setup and STA update
In reply to Pooventhiran GFrom: Aditya Sathish <[email protected]>
Define nl80211 and cfg80211 interfaces to support SMD setup for an AP MLD and the non-AP STA MLD creation upon SMD negotiation.
Allow only APs affiliated to an AP MLD to enable SMD while starting. STA creation can happen in two ways: typical 802.11 association with SMD negotiated or via SMD BSS Transition Preparation on the target AP MLD; the latter should be marked explicitly to inform drivers so that they can handle ST Execution and datapath switch once the ST procedure is completed.
--- include/net/cfg80211.h | 15 ++++++++++ include/uapi/linux/nl80211.h | 10 +++++++ net/wireless/nl80211.c | 68 +++++++++++++++++++++++++++++++++++++++----- 3 files changed, 86 insertions(+), 7 deletions(-)
include/net/cfg80211.h +15 -0
@@ -1624,6 +1624,7 @@ struct cfg80211_s1g_short_beacon {* @mbssid_config: AP settings for multiple bssid * @s1g_long_beacon_period: S1G long beacon period * @s1g_short_beacon: S1G short beacon data +* @smd: Seamless Mobility Domain (SMD) enabled */ struct cfg80211_ap_settings {struct cfg80211_chan_def chandef;
@@ -1656,6 +1657,7 @@ struct cfg80211_ap_settings {struct cfg80211_mbssid_config mbssid_config;u8 s1g_long_beacon_period;struct cfg80211_s1g_short_beacon s1g_short_beacon; +bool smd; };
@@ -1880,6 +1882,17 @@ struct cfg80211_ttlm_params {u16 ulink[8 ]; }; +/** +* struct cfg80211_sta_smd_params - SMD parameters for an added station +* +* @smd_sta: SMD-negotiated STA +* @roam_sta: station was created via SMD BSS Transition procedure +*/ +struct cfg80211_sta_smd_params { +bool smd_sta; +bool roam_sta; +}; +/** * struct station_parameters - station parameters *
@@ -1920,6 +1933,7 @@ 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_params: SMD params for this station */ struct station_parameters {struct net_device *vlan;
@@ -1948,6 +1962,7 @@ struct station_parameters {struct link_station_parameters link_sta_params;bool epp_peer;const u8 *nmi_mac; +struct cfg80211_sta_smd_params smd_params; };/**
include/uapi/linux/nl80211.h +10 -0
@@ -361,6 +361,11 @@* 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. +* %NL80211_CMD_NEW_STATION carries %NL80211_ATTR_SMD_SUPPORT to indicate +* that the non-AP MLD getting added has successfully negotiated SMD with +* 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. */ /**
@@ -3265,6 +3270,8 @@ enum nl80211_commands {* * @NL80211_ATTR_SMD_SUPPORT: Flag attribute to indicate SMD support. Used with * multiple commands to indicate appropriate SMD support (refer DOC). +* @NL80211_ATTR_SMD_ROAM_STA: Flag attribute to indicate that the station is +* created as part of SMD BSS Transition and not by typical association. * * @NUM_NL80211_ATTR: total number of nl80211_attrs available * @NL80211_ATTR_MAX: highest attribute number currently defined
@@ -3874,6 +3881,7 @@ enum nl80211_attrs {NL80211_ATTR_ASSOC_PROTECTED_TWT ,NL80211_ATTR_SMD_SUPPORT , + NL80211_ATTR_SMD_ROAM_STA,/* add attributes here, update the policy in nl80211.c */
@@ -4026,6 +4034,7 @@ 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_MAX: highest station flag number currently defined * @__NL80211_STA_FLAG_AFTER_LAST: internal use */
@@ -4040,6 +4049,7 @@ enum nl80211_sta_flags {NL80211_STA_FLAG_ASSOCIATED ,NL80211_STA_FLAG_SPP_AMSDU ,NL80211_STA_FLAG_CIP , +NL80211_STA_FLAG_SMD ,/* keep last */ __NL80211_STA_FLAG_AFTER_LAST,
net/wireless/nl80211.c +61 -7
129 lines not on this page · raw message
Signature · 1 line
2.34.1
PATCH v3 3/21 wifi: nl80211: add SMD BSS Transition sub-state STA flags
In reply to Pooventhiran GIEEE 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.
Add the corresponding nl80211 STA flags to track the state changes:
- NL80211_STA_FLAG_SMD_PREP_TARGET - State 4a: non-AP MLD is prepared with target AP MLD
- NL80211_STA_FLAG_SMD_EXEC_CURRENT - State 4b: ST execution active on current AP MLD
- NL80211_STA_FLAG_SMD_DL_DRAIN - State 4c: DL draining period
--- include/uapi/linux/nl80211.h | 18 ++++++++++++++++++ net/wireless/nl80211.c | 18 ++++++++++++++---- 2 files changed, 32 insertions(+), 4 deletions(-)
include/uapi/linux/nl80211.h +18 -0
@@ -366,6 +366,15 @@* 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. +* +* 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 +* set using %NL80211_CMD_SET_STATION on the current AP MLD. */ /**
@@ -4035,6 +4044,12 @@ enum nl80211_iftype {* @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 +* (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 +* (State 4c). * @NL80211_STA_FLAG_MAX: highest station flag number currently defined * @__NL80211_STA_FLAG_AFTER_LAST: internal use */
@@ -4050,6 +4065,9 @@ enum nl80211_sta_flags {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 ,/* keep last */ __NL80211_STA_FLAG_AFTER_LAST,
net/wireless/nl80211.c +14 -4
@@ -8025,6 +8025,9 @@ static const struct nla_policy sta_flags_policy[NL80211_STA_FLAG_MAX + 1] = { [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 }, }; static int parse_station_flags(struct genl_info *info,
@@ -8091,7 +8094,11 @@ 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;case NL80211_IFTYPE_P2P_GO : params->sta_flags_mask |= BIT(NL80211_STA_FLAG_AUTHORIZED) |
@@ -9308,7 +9315,7 @@ 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 );switch (statype) {case CFG80211_STA_MESH_PEER_KERNEL :
@@ -9404,7 +9411,10 @@ int cfg80211_check_station_change(struct wiphy *wiphy,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))) return -EINVAL;/* but authenticated/associated only if driver handles it */
@@ -10128,7 +10138,7 @@ static int nl80211_new_station(struct sk_buff *skb, struct genl_info *info)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 );switch (wdev->iftype) {case NL80211_IFTYPE_AP :
Signature · 1 line
2.34.1
PATCH v3 4/21 wifi: cfg80211: define layouts for SMD BSS Transition context
In reply to Pooventhiran GIEEE 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.
Define the context data: per-TID sequence numbers (SN) in downlink (DL) and uplink (UL) directions, packet number (PN) in DL, per-TID packet numbers in UL, per-TID BlockAck session parameters in DL and UL, management SN in DL and UL, and management PN in UL. This data is used by drivers to report the context along with the frame SKB.
--- include/net/cfg80211.h | 82 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 82 insertions(+)
include/net/cfg80211.h +82 -0
@@ -11147,4 +11147,86 @@ void cfg80211_incumbent_signal_notify(struct wiphy *wiphy,u32 signal_interference_bitmap, gfp_t gfp); +/* +* Context information carried in SMD BSS Transition (refer IEEE P802.11bn/D2.0, +* Aug 2026, subclause 37.16.9. +*/ + +/* +* 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 + +/** +* struct ieee80211_smd_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) +* @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 { +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 +* 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)) +* @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. +* @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 ; +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 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 mgmt_sn; +u8 mgmt_pn[IEEE80211_SMD_CTX_MAX_PN_LEN ]; + } ul; +}; +#endif /* __NET_CFG80211_H */
Signature · 1 line
2.34.1
PATCH v3 5/21 wifi: nl80211: define interfaces for SMD BSS Transition context transfer
In reply to Pooventhiran GDefine nl80211 attributes and policies required to pack SMD BSS Transition context along with NL80211_CMD_FRAME to be sent to userspace, and to set and get the context during roaming via current AP MLD and roaming via target AP MLD. Without these, userspace will not be able to transport the context to the target AP MLD, program the context on the target AP MLD TX and RX queues, nor fetch the context on behalf of the target AP MLD if the ST Execution frame is sent directly to the target.
--- include/uapi/linux/nl80211.h | 190 +++++++++++++++++++++++++++++++++++++++++++ net/wireless/nl80211.c | 48 +++++++++++ 2 files changed, 238 insertions(+)
include/uapi/linux/nl80211.h +190 -0
@@ -375,6 +375,19 @@* on the target AP MLD while creating the station entry. * %NL80211_STA_FLAG_SMD_{EXEC_CURRENT,DL_DRAIN}, on the other hand, can be * set using %NL80211_CMD_SET_STATION on the current AP MLD. +* +* Drivers can use %NL80211_ATTR_SMD_CTX to pack the dynamic context of the +* non-AP MLD along with the ST Preparation or ST Execution Request frames in +* the %NL80211_CMD_FRAME event. +* +* On the target AP MLD, this collected context, received in the +* userspace-managed backhaul between the AP MLDs, can be programmed using +* %NL80211_CMD_SET_SMD_CTX. +* +* In case the non-AP MLD executes directly with the target AP MLD, the current +* 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. */ /**
@@ -1502,6 +1515,21 @@* and multiple can be nested in %NL80211_ATTR_MLO_LINKS but then the * update isn't atomic if any failures happen. * Only supported with %NL80211_EXT_FEATURE_UPDATE_BEACON. +* +* @NL80211_CMD_SET_SMD_CTX: Set the SMD BSS Transition dynamic context for a +* non-AP MLD sent from the current AP MLD on the target AP MLD managed by +* an SMD-ME. This command carries %NL80211_ATTR_MLD_ADDR, +* %NL80211_ATTR_SMD_CTX_TYPE and %NL80211_ATTR_SMD_CTX. The station must +* be present on the target AP MLD in the "prepared" state with a default +* key installed. +* @NL80211_CMD_GET_SMD_CTX: Get the SMD BSS Transition dynamic context for a +* non-AP MLD associated to an AP MLD managed by an SMD-ME. This command +* carries %NL80211_ATTR_MLD_ADDR and %NL80211_ATTR_SMD_CTX_TYPE. +* @NL80211_CMD_SMD_CTX_EVENT: Event reporting the collected SMD context +* (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_MAX: highest used command number * @__NL80211_CMD_AFTER_LAST: internal use */
@@ -1784,6 +1812,10 @@ enum nl80211_commands {NL80211_CMD_UPDATE_BEACON , +NL80211_CMD_SET_SMD_CTX , +NL80211_CMD_GET_SMD_CTX , + NL80211_CMD_SMD_CTX_EVENT, +/* add new commands above here */ /* used to define NL80211_CMD_MAX below */
@@ -3282,6 +3314,13 @@ enum nl80211_commands {* @NL80211_ATTR_SMD_ROAM_STA: Flag attribute to indicate that the station is * created as part of SMD BSS Transition and not by typical association. * +* @NL80211_ATTR_SMD_CTX: Nested attribute associated with UHR SMD BSS +* Transition data. Used with %NL80211_CMD_FRAME, %NL80211_CMD_SET_SMD_CTX, +* and %NL80211_CMD_SMD_CTX_EVENT. See &enum nl80211_smd_ctx. +* @NL80211_ATTR_SMD_CTX_TYPE: u8 attribute specifying the type of SMD context. +* Used along with %NL80211_CMD_FRAME, %NL80211_CMD_SET_SMD_CTX, +* %NL80211_CMD_GET_SMD_CTX, and %NL80211_CMD_SMD_CTX_EVENT. +* * @NUM_NL80211_ATTR: total number of nl80211_attrs available * @NL80211_ATTR_MAX: highest attribute number currently defined * @__NL80211_ATTR_AFTER_LAST: internal use
@@ -3892,6 +3931,9 @@ enum nl80211_attrs {NL80211_ATTR_SMD_SUPPORT ,NL80211_ATTR_SMD_ROAM_STA , +NL80211_ATTR_SMD_CTX , +NL80211_ATTR_SMD_CTX_TYPE , +/* add attributes here, update the policy in nl80211.c */ __NL80211_ATTR_AFTER_LAST,
@@ -9253,4 +9295,152 @@ enum nl80211_nan_peer_map_attrs {#define NL80211_NAN_SCHED_NOT_AVAIL_SLOT 0xff +/** +* enum nl80211_smd_ctx_type - SMD Request Type values +* +* Used with %NL80211_ATTR_SMD_CTX_TYPE. +* +* @NL80211_SMD_CTX_TYPE_PREP: SMD BSS Transition (ST) Preparation. +* @NL80211_SMD_CTX_TYPE_EXEC: ST Execution. +* @NUM_SMD_CTX_TYPES: internal. +* @NL80211_SMD_CTX_TYPE_MAX: Max type of ST context. +*/ +enum nl80211_smd_ctx_type { +NL80211_SMD_CTX_TYPE_PREP , +NL80211_SMD_CTX_TYPE_EXEC , + +NUM_SMD_CTX_TYPES , +NL80211_SMD_CTX_TYPE_MAX =NUM_SMD_CTX_TYPES -1 , +}; + +/** +* enum nl80211_smd_ctx_ba_param - SMD Block Ack Context attributes +* +* @__NL80211_SMD_CTX_BA_ATTR_INVALID: Invalid attribute. +* @NL80211_SMD_CTX_BA_ATTR_BUFF_SIZE: Required (u16) BA buffer size. +* @NL80211_SMD_CTX_BA_ATTR_POLICY: Required (u8) BA policy. +* @NL80211_SMD_CTX_BA_ATTR_AMSDU_SUPPORT: Flag attribute to indicate +* AMSDU support. +* @NL80211_SMD_CTX_BA_ATTR_TIMEOUT: Required (u16) Block Ack timeout. +* @NL80211_SMD_CTX_BA_ATTR_EXT_NO_FRAG: Flag attribute to indicate +* fragmentation support. +* @NL80211_SMD_CTX_BA_ATTR_EXT_FRAG_LEVEL: Required (u8) HE fragmentation +* level. +* @NL80211_SMD_CTX_BA_ATTR_EXT_BUFF_SIZE: Required (u16) extended buffer size. +* @NL80211_SMD_CTX_BA_ATTR_WINSTARTO: Required (u16) Starting Sequence Number +* of the BA window. +* Applicable only with %NL80211_SMD_CTX_DL_ATTR_BA_PARAMS. +* @__NL80211_SMD_CTX_BA_ATTR_LAST: Last attribute, used internally. +* @NL80211_SMD_CTX_BA_ATTR_MAX: Max attribute. +* +* Used with %NL80211_SMD_CTX_DL_ATTR_BA_PARAMS and +* %NL80211_SMD_CTX_UL_ATTR_BA_PARAMS. +*/ +enum nl80211_smd_ctx_ba_param { + __NL80211_SMD_CTX_BA_ATTR_INVALID, +NL80211_SMD_CTX_BA_ATTR_BUFF_SIZE , +NL80211_SMD_CTX_BA_ATTR_POLICY , +NL80211_SMD_CTX_BA_ATTR_AMSDU_SUPPORT , +NL80211_SMD_CTX_BA_ATTR_TIMEOUT , +NL80211_SMD_CTX_BA_ATTR_EXT_NO_FRAG , +NL80211_SMD_CTX_BA_ATTR_EXT_FRAG_LEVEL , +NL80211_SMD_CTX_BA_ATTR_EXT_BUFF_SIZE , +NL80211_SMD_CTX_BA_ATTR_WINSTARTO , + + __NL80211_SMD_CTX_BA_ATTR_LAST, +NL80211_SMD_CTX_BA_ATTR_MAX = __NL80211_SMD_CTX_BA_ATTR_LAST -1 +}; + +/** +* enum nl80211_smd_ctx_dl - SMD Dynamic Context - DL direction +* +* @__NL80211_SMD_CTX_DL_ATTR_INVALID: Invalid attribute. +* @NL80211_SMD_CTX_DL_ATTR_VALID_TID_BITMAP: Optional (u8) TIDs included. +* @NL80211_SMD_CTX_DL_ATTR_SN: Optional (nested) next SN (u16) per TID to +* be assigned to DL individually addressed frames. +* @NL80211_SMD_CTX_DL_ATTR_PN: Optional (binary) starting PN (max 16 bytes) for +* DL individually addressed frames. +* @NL80211_SMD_CTX_DL_ATTR_BA_PARAMS: Optional (nested) Block Ack parameters, +* nested array of TIDs (uses &enum nl80211_smd_ctx_ba_param). +* @NL80211_SMD_CTX_DL_ATTR_MGMT_SN: Optional (u16) next SN to be assigned for +* DL individually addressed management frames. +* @NL80211_SMD_CTX_DL_ATTR_MGMT_PN: Optional (binary) starting PN +* (max 16 bytes) for DL individually addressed management frames. +* @__NL80211_SMD_CTX_DL_ATTR_LAST: Last attribute, used internally. +* @NL80211_SMD_CTX_DL_ATTR_MAX: Max attribute. +* +* Used with %NL80211_SMD_CTX_ATTR_DL. +*/ +enum nl80211_smd_ctx_dl { + __NL80211_SMD_CTX_DL_ATTR_INVALID, +NL80211_SMD_CTX_DL_ATTR_VALID_TID_BITMAP , +NL80211_SMD_CTX_DL_ATTR_SN , +NL80211_SMD_CTX_DL_ATTR_PN , +NL80211_SMD_CTX_DL_ATTR_BA_PARAMS , +NL80211_SMD_CTX_DL_ATTR_MGMT_SN , +NL80211_SMD_CTX_DL_ATTR_MGMT_PN , + + __NL80211_SMD_CTX_DL_ATTR_LAST, +NL80211_SMD_CTX_DL_ATTR_MAX = __NL80211_SMD_CTX_DL_ATTR_LAST -1 +}; + +/** +* enum nl80211_smd_ctx_ul - SMD Dynamic Context - UL direction +* +* @__NL80211_SMD_CTX_UL_ATTR_INVALID: Invalid attribute. +* @NL80211_SMD_CTX_UL_ATTR_VALID_TID_BITMAP: Optional (u8) TIDs included. +* @NL80211_SMD_CTX_UL_ATTR_SN: Optional (nested) last SN received per TID +* for UL individually addressed frames. +* @NL80211_SMD_CTX_UL_ATTR_PN: Optional (nested) last PN received per TID +* for UL individually addressed frames. +* @NL80211_SMD_CTX_UL_ATTR_BA_PARAMS: Optional (nested) Block Ack parameters +* (uses &enum nl80211_smd_ctx_ba_param). +* @NL80211_SMD_CTX_UL_ATTR_MGMT_SN: Optional (u16) last SN received for +* UL individually addressed management frames. +* @NL80211_SMD_CTX_UL_ATTR_MGMT_PN: Optional (binary, max 16 bytes) last PN +* received for UL individually addressed management frames. +* @__NL80211_SMD_CTX_UL_ATTR_LAST: Last attribute, used internally. +* @NL80211_SMD_CTX_UL_ATTR_MAX: Max attribute. +* +* Used with %NL80211_SMD_CTX_ATTR_UL. +*/ +enum nl80211_smd_ctx_ul { + __NL80211_SMD_CTX_UL_ATTR_INVALID, +NL80211_SMD_CTX_UL_ATTR_VALID_TID_BITMAP , +NL80211_SMD_CTX_UL_ATTR_SN , +NL80211_SMD_CTX_UL_ATTR_PN , +NL80211_SMD_CTX_UL_ATTR_BA_PARAMS , +NL80211_SMD_CTX_UL_ATTR_MGMT_SN , +NL80211_SMD_CTX_UL_ATTR_MGMT_PN , + + __NL80211_SMD_CTX_UL_ATTR_LAST, +NL80211_SMD_CTX_UL_ATTR_MAX = __NL80211_SMD_CTX_UL_ATTR_LAST -1 +}; + +/** +* enum nl80211_smd_ctx - SMD Context information +* +* Top-level container for SMD BSS Transition dynamic context. Carried in +* %NL80211_ATTR_SMD_CTX with %NL80211_CMD_SET_SMD_CTX (target AP MLD) or +* with %NL80211_CMD_FRAME (current AP MLD reporting context to userspace) +* and %NL80211_CMD_SMD_CTX_EVENT (current AP MLD reporting the requested +* context on behalf of the target AP MLD). +* +* @__NL80211_SMD_CTX_ATTR_INVALID: Invalid attribute. +* @NL80211_SMD_CTX_ATTR_DL: Optional (nested) DL parameters. +* See &enum nl80211_smd_ctx_dl. +* @NL80211_SMD_CTX_ATTR_UL: Optional (nested) UL parameters. +* See &enum nl80211_smd_ctx_ul. +* @__NL80211_SMD_CTX_ATTR_LAST: Last attribute, used internally. +* @NL80211_SMD_CTX_ATTR_MAX: Max attribute. +*/ +enum nl80211_smd_ctx { + __NL80211_SMD_CTX_ATTR_INVALID, +NL80211_SMD_CTX_ATTR_DL , +NL80211_SMD_CTX_ATTR_UL , + + __NL80211_SMD_CTX_ATTR_LAST, +NL80211_SMD_CTX_ATTR_MAX = __NL80211_SMD_CTX_ATTR_LAST -1 +}; +#endif /* __LINUX_NL80211_H */
net/wireless/nl80211.c +48 -0
60 lines not on this page · raw message
Signature · 1 line
2.34.1
PATCH v3 6/21 wifi: ieee80211: define APIs for UHR Link Reconfiguration frame checks
In reply to Pooventhiran GAdd 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.
--- include/linux/ieee80211-uhr.h | 125 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 125 insertions(+)
include/linux/ieee80211-uhr.h +125 -0
@@ -699,6 +699,131 @@ ieee80211_uhr_mode_change_tuple_next(const struct ieee80211_uhr_mode_change_tuplreturn (const void *)((const u8 *)tuple + needed); } +/** +* ieee80211_is_uhr_link_reconf_req - check if frame is UHR Link Reconf Request +* @skb: the SKB to check +* Return: whether or not the frame is a UHR Link Reconf Request frame +*/ +static inline bool ieee80211_is_uhr_link_reconf_req (struct sk_buff *skb) +{ +struct ieee80211_mgmt *mgmt = (void *)skb->data; +u8 category, action; + +if (!ieee80211_is_action (mgmt->frame_control)) +return false; + +if (skb->len <IEEE80211_MIN_ACTION_SIZE (uhr_link_reconf_req)) +return false; + + category = mgmt->u.action.category; + action = mgmt->u.action.action_code; + +return category ==WLAN_CATEGORY_PROTECTED_UHR && + action ==IEEE80211_PROTECTED_UHR_ACTION_LINK_RECONFIG_REQUEST ; +} + +/** +* ieee80211_is_uhr_link_reconf_resp - check if frame is UHR Link Reconf +* Response +* @skb: the SKB to check +* Return: whether or not the frame is a UHR Link Reconf Response frame +*/ +static inline bool ieee80211_is_uhr_link_reconf_resp (struct sk_buff *skb) +{ +struct ieee80211_mgmt *mgmt = (void *)skb->data; +u8 category, action; + +if (!ieee80211_is_action (mgmt->frame_control)) +return false; + +if (skb->len <IEEE80211_MIN_ACTION_SIZE (uhr_link_reconf_resp)) +return false; + + category = mgmt->u.action.category; + action = mgmt->u.action.action_code; + +return category ==WLAN_CATEGORY_PROTECTED_UHR && + action ==IEEE80211_PROTECTED_UHR_ACTION_LINK_RECONFIG_RESPONSE ; +} + +/** +* ieee80211_is_st_prep_req - check if frame is ST Preparation Request +* @skb: the SKB to check +* Return: whether or not the frame is an ST Prep request frame +*/ +static inline bool ieee80211_is_st_prep_req (struct sk_buff *skb) +{ +struct ieee80211_mgmt *mgmt = (void *)skb->data; +u8 type; + +if (!ieee80211_is_uhr_link_reconf_req (skb)) +return false; + + type = mgmt->u.action.uhr_link_reconf_req.type; + +return type ==IEEE80211_UHR_LINK_RECONFIG_REQUEST_ST_PREP ; +} + +/** +* ieee80211_is_st_exec_req - check if frame is ST Execution Request +* @skb: the SKB to check +* Return: whether or not the frame is an ST Exec request frame +*/ +static inline bool ieee80211_is_st_exec_req (struct sk_buff *skb) +{ +struct ieee80211_mgmt *mgmt = (void *)skb->data; +u8 type; + +if (!ieee80211_is_uhr_link_reconf_req (skb)) +return false; + + type = mgmt->u.action.uhr_link_reconf_req.type; + +return type ==IEEE80211_UHR_LINK_RECONFIG_REQUEST_ST_EXEC ; +} + +/** +* ieee80211_is_st_exec_resp - check if frame is ST Execution Response +* @skb: the SKB to check +* Return: whether or not the frame is an ST Exec response frame +*/ +static inline bool ieee80211_is_st_exec_resp (struct sk_buff *skb) +{ +struct ieee80211_mgmt *mgmt = (void *)skb->data; +u8 type; + +if (!ieee80211_is_uhr_link_reconf_resp (skb)) +return false; + + type = mgmt->u.action.uhr_link_reconf_resp.type; + +return type ==IEEE80211_UHR_LINK_RECONFIG_REQUEST_ST_EXEC ; +} + +/** +* ieee80211_is_uhr_link_reconf_notify - check if frame is UHR Link Reconf +* Notify +* @skb: the SKB to check +* Return: whether or not the frame is a UHR Link Reconf Notify frame +*/ +static inline bool ieee80211_is_uhr_link_reconf_notify (struct sk_buff *skb) +{ +struct ieee80211_mgmt *mgmt = (void *)skb->data; +u8 category, action; + +if (!ieee80211_is_action (mgmt->frame_control)) +return false; + +if (skb->len <IEEE80211_MIN_ACTION_SIZE (uhr_link_reconf_notif)) +return false; + + category = mgmt->u.action.category; + action = mgmt->u.action.action_code; + +return category ==WLAN_CATEGORY_PROTECTED_UHR && + action ==IEEE80211_PROTECTED_UHR_ACTION_LINK_RECONFIG_NOTIFY ; +} +#define for_each_uhr_mode_change_tuple (data, len, tuple) \ for (tuple = (const void *)(data); \ ieee80211_uhr_mode_change_tuple_next( \
Signature · 1 line
2.34.1
PATCH v3 7/21 wifi: ieee80211: define API to check if frame is class 3
In reply to Pooventhiran GIEEE Std 802.11-2024, subclause 11.3.3, classifies a list of frames as class 3 and these frames are expected only if the STAs are at least authenticated and associated. Define an API to check if a frame is class 3 according to these conditions. This can be used to filter frames in both TX and RX. The API simply classifies the listed frames as class 3 and does not check if the STAs are in expected states.
--- include/linux/ieee80211.h | 43 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+)
include/linux/ieee80211.h +43 -0
@@ -2940,4 +2940,47 @@ struct ieee80211_cip_cap {u8 v; } __packed; +/** +* ieee80211_is_class3 - check if this frame @skb is a class 3 frame +* @skb: frame to check +* +* This function checks the frame class simply based on the list defined in +* IEEE Std 802.11-2024, subclause 11.3.3. It does not verify whether the frame +* is unicast or related STA states. +* +* Return: %true if it is class3, %false otherwise +*/ +static inline bool ieee80211_is_class3 (struct sk_buff *skb) +{ +struct ieee80211_mgmt *mgmt = (void *)skb->data; +__le16 fc = mgmt->frame_control; +u8 category; + +/* Data frames */ +if (ieee80211_is_data (fc)) +return true; + +/* Management frames */ +if (ieee80211_is_action (fc)) { +if (ieee80211_has_protected (fc)) +return true; + +if (skb->len <IEEE80211_MIN_ACTION_SIZE (category)) +return false; + category = mgmt->u.action.category; + +if (category !=WLAN_CATEGORY_PUBLIC && + category !=WLAN_CATEGORY_SELF_PROTECTED && + category !=WLAN_CATEGORY_UNPROT_DMG ) +return true; + } + +/* Control frames */ +if (ieee80211_is_back (fc) ||ieee80211_is_back_req (fc) || +ieee80211_is_pspoll (fc)) +return true; + +return false; +} +#endif /* LINUX_IEEE80211_H */
Signature · 1 line
2.34.1
PATCH v3 8/21 wifi: nl80211/cfg80211: pack SMD dynamic context along with frame
In reply to Pooventhiran GWhile packing the received management frame in nl80211_send_mgmt() to send to userspace, nest the SMD 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.
--- include/net/cfg80211.h | 13 +++ net/wireless/nl80211.c | 286 ++++++++++++++++++++++++++++++++++++++++++++++++- 2 files changed, 298 insertions(+), 1 deletion(-)
include/net/cfg80211.h +13 -0
@@ -4893,6 +4893,17 @@ struct mgmt_frame_regs {u32 global_mcast_stypes, interface_mcast_stypes; }; +/** +* struct cfg80211_smd_transition_info - SMD BSS 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 cfg80211_ops - backend description for wireless configuration *
@@ -9624,6 +9635,7 @@ void cfg80211_conn_failed(struct net_device *dev, const u8 *mac_addr,* @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 */ struct cfg80211_rx_info {int freq;
@@ -9636,6 +9648,7 @@ struct cfg80211_rx_info {u64 rx_tstamp;u64 ack_tstamp;bool no_sta; +struct cfg80211_smd_transition_info st_info; };/**
net/wireless/nl80211.c +285 -1
307 lines not on this page · raw message
Signature · 1 line
2.34.1
PATCH v3 9/21 wifi: nl80211/cfg80211: add support for SMD context programming
In reply to Pooventhiran GOn 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 on the TX and RX queues to enable seamless transition and reception.
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 context attributes, and invoke the cfg80211 operation on the target AP MLD.
--- include/net/cfg80211.h | 7 + net/wireless/nl80211.c | 347 ++++++++++++++++++++++++++++++++++++++++++++++++ net/wireless/rdev-ops.h | 14 ++ net/wireless/trace.h | 35 +++++ 4 files changed, 403 insertions(+)
include/net/cfg80211.h +7 -0
@@ -5361,6 +5361,10 @@ struct cfg80211_smd_transition_info {* * @start_pd: Start the PD interface. * @stop_pd: Stop the PD interface. +* +* @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. */ struct cfg80211_ops {int (*suspend)(struct wiphy *wiphy,struct cfg80211_wowlan *wow);
@@ -5759,6 +5763,9 @@ 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); };/*
net/wireless/nl80211.c +347 -0
365 lines not on this page · raw message
net/wireless/rdev-ops.h +14 -0
@@ -1713,4 +1713,18 @@ rdev_set_epcs(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) +{ +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_return_int (&rdev->wiphy, ret); + +return ret; +} +#endif /* __CFG80211_RDEV_OPS */
net/wireless/trace.h +35 -0
@@ -4474,6 +4474,41 @@ 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 ) ); + +TRACE_EVENT (rdev_set_smd_ctx, + TP_PROTO(struct wiphy *wiphy, struct wireless_dev *wdev, const u8 *addr, + struct cfg80211_smd_transition_info *st_info), + +TP_ARGS (wiphy, wdev, addr, st_info), + +TP_STRUCT__entry ( + WIPHY_ENTRY + WDEV_ENTRY + MAC_ENTRY(sta_addr) + __field(u8, st_type) + __field(u8, dl_tid_bitmap) +__field (u8, ul_tid_bitmap) + ), + +TP_fast_assign ( + struct ieee80211_smd_ctx *ctx = st_info->ctx; + + WIPHY_ASSIGN; + WDEV_ASSIGN; + MAC_ASSIGN(sta_addr, addr); + __entry->st_type = st_info->type; + __entry->dl_tid_bitmap = ctx->dl.valid_tid_bmap; + __entry->ul_tid_bitmap = ctx->ul.valid_tid_bmap; + ), + +TP_printk (WIPHY_PR_FMT ", " WDEV_PR_FMT +", sta=%pM, ST type=%u DL TIDs: 0x%x, UL TIDs: 0x%x" , +WIPHY_PR_ARG ,WDEV_PR_ARG , __entry->sta_addr, + __entry->st_type, + __entry->dl_tid_bitmap, __entry->ul_tid_bitmap + ) +); +#endif /* !__RDEV_OPS_TRACE || TRACE_HEADER_MULTI_READ */ #undef TRACE_INCLUDE_PATH
Signature · 1 line
2.34.1
PATCH v3 10/21 wifi: nl80211/cfg80211: add support for querying SMD context for target AP MLD
In reply to Pooventhiran GDuring 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.
Add nl80211 support to handle NL80211_CMD_GET_SMD_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.
--- include/net/cfg80211.h | 55 +++++++++++++++++++ net/wireless/core.c | 25 +++++++++ net/wireless/mlme.c | 30 +++++++++++ net/wireless/nl80211.c | 140 ++++++++++++++++++++++++++++++++++++++++++++++-- net/wireless/nl80211.h | 9 ++++ net/wireless/rdev-ops.h | 14 +++++ net/wireless/trace.h | 26 +++++++++ 7 files changed, 295 insertions(+), 4 deletions(-)
include/net/cfg80211.h +55 -0
@@ -4904,6 +4904,18 @@ 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 *
@@ -5365,6 +5377,8 @@ 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. */ struct cfg80211_ops {int (*suspend)(struct wiphy *wiphy,struct cfg80211_wowlan *wow);
@@ -5766,6 +5780,9 @@ 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); };/*
@@ -7357,6 +7374,8 @@ 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;
@@ -7480,6 +7499,10 @@ 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; };
@@ -11249,4 +11272,36 @@ struct ieee80211_smd_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 +* @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 +* 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). +* +* Return: None +*/ +void cfg80211_get_smd_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 +25 -0
@@ -1483,6 +1483,25 @@ 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) {
@@ -1565,6 +1584,10 @@ 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; }
@@ -1708,6 +1731,8 @@ 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 +30 -0
@@ -1577,3 +1577,33 @@ 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 +136 -4
170 lines not on this page · raw message
net/wireless/nl80211.h +9 -0
@@ -129,4 +129,13 @@ 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); +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); +#endif /* __NET_WIRELESS_NL80211_H */
net/wireless/rdev-ops.h +14 -0
@@ -1727,4 +1727,18 @@ static inline int rdev_set_smd_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) +{ +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_return_int (&rdev->wiphy, ret); + +return ret; +} +#endif /* __CFG80211_RDEV_OPS */
net/wireless/trace.h +26 -0
@@ -4509,6 +4509,32 @@ TRACE_EVENT(rdev_set_smd_ctx, ) ); +TRACE_EVENT (rdev_get_smd_ctx, + TP_PROTO(struct wiphy *wiphy, struct wireless_dev *wdev, const u8 *addr, + enum nl80211_smd_ctx_type type), + +TP_ARGS (wiphy, wdev, addr, type), + +TP_STRUCT__entry ( + WIPHY_ENTRY + WDEV_ENTRY + MAC_ENTRY(sta_addr) +__field (u8, st_type) + ), + +TP_fast_assign ( + WIPHY_ASSIGN; + WDEV_ASSIGN; + MAC_ASSIGN(sta_addr, addr); + __entry->st_type = type; + ), + +TP_printk (WIPHY_PR_FMT ", " WDEV_PR_FMT +", sta=%pM, ST type=%u" , +WIPHY_PR_ARG ,WDEV_PR_ARG , __entry->sta_addr, + __entry->st_type) +); +#endif /* !__RDEV_OPS_TRACE || TRACE_HEADER_MULTI_READ */ #undef TRACE_INCLUDE_PATH
Signature · 1 line
2.34.1
PATCH v3 11/21 wifi: nl80211/cfg80211: define API to notify SMD Drain completion
In reply to Pooventhiran GThe 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 the Nominal Maximum DL Draining Period Duration field advertised in the 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.
--- include/net/cfg80211.h | 11 +++++++++++ include/uapi/linux/nl80211.h | 11 +++++++++++ net/wireless/mlme.c | 11 +++++++++++ net/wireless/nl80211.c | 32 ++++++++++++++++++++++++++++++++ net/wireless/nl80211.h | 3 +++ 5 files changed, 68 insertions(+)
include/net/cfg80211.h +11 -0
@@ -11304,4 +11304,15 @@ void cfg80211_get_smd_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 +* 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); +#endif /* __NET_CFG80211_H */
include/uapi/linux/nl80211.h +11 -0
@@ -388,6 +388,12 @@* 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. +* +* 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. */ /**
@@ -1529,6 +1535,10 @@* (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 +* 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. * * @NL80211_CMD_MAX: highest used command number * @__NL80211_CMD_AFTER_LAST: internal use
@@ -1815,6 +1825,7 @@ enum nl80211_commands {NL80211_CMD_SET_SMD_CTX ,NL80211_CMD_GET_SMD_CTX ,NL80211_CMD_SMD_CTX_EVENT , + NL80211_CMD_SMD_DRAIN_COMPLETION_EVENT,/* add new commands above here */
net/wireless/mlme.c +11 -0
@@ -1607,3 +1607,14 @@ 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 +32 -0
@@ -25273,6 +25273,38 @@ nl80211_notify_get_smd_ctx_done(struct wireless_dev *wdev,nlmsg_free (msg); } +void nl80211_notify_smd_drain_completion (struct wireless_dev *wdev, +const u8 *sta_addr) +{ +struct cfg80211_registered_device *rdev =wiphy_to_rdev (wdev->wiphy); +struct net_device *dev = wdev->netdev; +struct sk_buff *msg; +void *hdr; + + msg =nlmsg_new (NLMSG_DEFAULT_SIZE ,GFP_KERNEL ); +if (!msg) +return ; + + hdr =nl80211hdr_put (msg,0 ,0 ,0 , +NL80211_CMD_SMD_DRAIN_COMPLETION_EVENT ); +if (!hdr) + goto nla_put_failure; + +if (nla_put_u32 (msg,NL80211_ATTR_WIPHY , rdev->wiphy_idx) || +nla_put_u32 (msg,NL80211_ATTR_IFINDEX , dev->ifindex) || +nla_put (msg,NL80211_ATTR_MLD_ADDR ,ETH_ALEN , sta_addr)) + goto nla_put_failure; + +genlmsg_end (msg, hdr); + +genlmsg_multicast_netns (&nl80211_fam,wiphy_net (&rdev->wiphy), msg,0 , +NL80211_MCGRP_MLME ,GFP_KERNEL ); +return ; + +nla_put_failure: +nlmsg_free (msg); +} +/* initialisation/exit functions */ int __init nl80211_init (void )
net/wireless/nl80211.h +3 -0
@@ -138,4 +138,7 @@ 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 */
Signature · 1 line
2.34.1
PATCH v3 12/21 wifi: mac80211: set SMD parameters for AP setup and STA update
In reply to Pooventhiran GFrom: Rohan Dutta <[email protected]>
When userspace marks SMD parameters for AP setup and STA update (during association and ST Preparation procedure), mark them in mac80211 so that SMD operations are properly routed and handled in the drivers.
--- include/net/mac80211.h | 5 +++++ net/mac80211/cfg.c | 12 ++++++++++++ net/mac80211/debugfs_sta.c | 1 + net/mac80211/sta_info.h | 2 ++ 4 files changed, 20 insertions(+)
include/net/mac80211.h +5 -0
@@ -796,6 +796,7 @@ struct ieee80211_bss_npca_params {* @s1g_long_beacon_period: number of beacon intervals between each long * beacon transmission. * @npca: NPCA parameters +* @smd_ap: AP supports SMD */ struct ieee80211_bss_conf {struct ieee80211_vif *vif;
@@ -902,6 +903,7 @@ struct ieee80211_bss_conf {u8 s1g_long_beacon_period;struct ieee80211_bss_npca_params npca; +bool smd_ap; };#define IEEE80211_NAN_MAX_CHANNELS 3
@@ -2731,6 +2733,7 @@ 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_params: SMD parameters of the STA */ struct ieee80211_sta {u8 addr[ETH_ALEN ]__aligned(2) ;
@@ -2768,6 +2771,8 @@ struct ieee80211_sta {/* should only be accessed with the wiphy mutex held */ struct ieee80211_nan_peer_sched *nan_sched; +struct cfg80211_sta_smd_params smd_params; +/* must be last */ u8 drv_priv[]__aligned(sizeof(void *)) ; };
net/mac80211/cfg.c +12 -0
@@ -1864,6 +1864,8 @@ static int ieee80211_start_ap(struct wiphy *wiphy, struct net_device *dev, } } + link_conf->smd_ap = params->smd; +if (sdata->vif.type ==NL80211_IFTYPE_AP && params->mbssid_config.tx_wdev) { err = ieee80211_set_ap_mbssid_options(sdata,
@@ -2778,6 +2780,16 @@ static int sta_apply_parameters(struct ieee80211_local *local,if (mask &BIT (NL80211_STA_FLAG_SPP_AMSDU )) 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 )) +set_sta_flag (sta,WLAN_STA_SMD ); +else if (test_sta_flag (sta,WLAN_STA_SMD )) +clear_sta_flag (sta,WLAN_STA_SMD ); + } + +if (params->smd_params.smd_sta) + sta->sta.smd_params = params->smd_params; +/* 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/debugfs_sta.c +1 -0
@@ -78,6 +78,7 @@ static const char * const sta_flag_names[] = {FLAG (PS_DELIVER ),FLAG (USES_ENCRYPTION ),FLAG (DECAP_OFFLOAD ), +FLAG (SMD ), #undef FLAG };
net/mac80211/sta_info.h +2 -0
@@ -72,6 +72,7 @@* @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. * * @NUM_WLAN_STA_FLAGS: number of defined flags */
@@ -104,6 +105,7 @@ enum ieee80211_sta_info_flags {WLAN_STA_PS_DELIVER ,WLAN_STA_USES_ENCRYPTION ,WLAN_STA_DECAP_OFFLOAD , +WLAN_STA_SMD , NUM_WLAN_STA_FLAGS, };
Signature · 1 line
2.34.1
PATCH v3 13/21 wifi: mac80211: apply SMD BSS Transition STA sub-states
In reply to Pooventhiran GDuring 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.
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().
--- net/mac80211/cfg.c | 60 ++++++++++++++++++++++++++++++++++++++++++++++ net/mac80211/debugfs_sta.c | 3 +++ net/mac80211/sta_info.h | 8 +++++++ 3 files changed, 71 insertions(+)
net/mac80211/cfg.c +60 -0
@@ -2704,6 +2704,55 @@ 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) +{ +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; + +if (!(mask & expected_mask)) +return 0 ; + + smd_flags = mask & expected_mask & set; +if (WARN_ON (hweight32 (smd_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 )); + +if (!test_sta_flag (sta,WLAN_STA_AUTHORIZED ) && + (smd_exec_current || smd_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 ); + }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 ); + } + +return 0 ; +} +static int sta_apply_parameters (struct ieee80211_local *local,struct sta_info *sta,struct station_parameters *params)
@@ -2790,6 +2839,17 @@ static int sta_apply_parameters(struct ieee80211_local *local,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/debugfs_sta.c +3 -0
@@ -79,6 +79,9 @@ static const char * const sta_flag_names[] = {FLAG (USES_ENCRYPTION ),FLAG (DECAP_OFFLOAD ),FLAG (SMD ), +FLAG (SMD_PREP_TARGET ), +FLAG (SMD_EXEC_CURRENT ), +FLAG (SMD_DL_DRAIN ), #undef FLAG };
net/mac80211/sta_info.h +8 -0
@@ -73,6 +73,11 @@* 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 +* the current AP MLD. +* @WLAN_STA_SMD_DL_DRAIN: this SMD station has started draining at +* the current AP MLD. * * @NUM_WLAN_STA_FLAGS: number of defined flags */
@@ -106,6 +111,9 @@ enum ieee80211_sta_info_flags {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 , NUM_WLAN_STA_FLAGS, };
Signature · 1 line
2.34.1
PATCH v3 14/21 wifi: mac80211: add driver_op for SMD substate changes
In reply to Pooventhiran GDuring 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.
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.
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)
--- include/net/mac80211.h | 26 +++++++++ net/mac80211/cfg.c | 59 ++++++++++++++----- net/mac80211/driver-ops.c | 24 ++++++++ net/mac80211/driver-ops.h | 6 ++ net/mac80211/sta_info.c | 140 ++++++++++++++++++++++++++++++++++++++++++++++ net/mac80211/sta_info.h | 9 +++ net/mac80211/trace.h | 33 +++++++++++ 7 files changed, 284 insertions(+), 13 deletions(-)
include/net/mac80211.h +26 -0
@@ -4092,6 +4092,24 @@ struct ieee80211_prep_tx_info {int link_id; }; +/** +* enum ieee80211_sta_smd_state - SMD BSS 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. +* +* @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 +*/ +enum ieee80211_sta_smd_state { +IEEE80211_STA_SMD_NONE , +IEEE80211_STA_SMD_PREP , +IEEE80211_STA_SMD_EXEC , +IEEE80211_STA_SMD_DRAIN , +}; +/** * struct ieee80211_ops - callbacks from mac80211 to the driver *
@@ -4771,6 +4789,9 @@ 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. */ struct ieee80211_ops { void (*tx)(struct ieee80211_hw *hw,
@@ -5184,6 +5205,11 @@ 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); };/**
net/mac80211/cfg.c +46 -13
97 lines not on this page · raw message
net/mac80211/driver-ops.c +24 -0
@@ -709,3 +709,27 @@ int drv_link_sta_statistics(struct ieee80211_local *local,return 0 ; } + +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) +{ +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 ret; +}
net/mac80211/driver-ops.h +6 -0
@@ -1805,4 +1805,10 @@ drv_nan_peer_sched_changed(struct ieee80211_local *local, 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); +#endif /* __MAC80211_DRIVER_OPS */
net/mac80211/sta_info.c +140 -0
155 lines not on this page · raw message
net/mac80211/sta_info.h +9 -0
@@ -723,6 +723,7 @@ 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 */ struct sta_info {/* General information, mostly static */
@@ -799,6 +800,8 @@ 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; +/* keep last! */ struct ieee80211_sta sta; };
@@ -1177,4 +1180,10 @@ static inline u32 sta_stats_encode_rate(struct ieee80211_rx_status *s) 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); +#endif /* STA_INFO_H */
net/mac80211/trace.h +33 -0
@@ -3431,6 +3431,39 @@ TRACE_EVENT(drv_nan_peer_sched_changed, ) ); +TRACE_EVENT (drv_sta_smd_state, + 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), + +TP_ARGS (local, sdata, sta, old_state, new_state), + +TP_STRUCT__entry ( + LOCAL_ENTRY + VIF_ENTRY + STA_ENTRY + __field(u32, old_state) +__field (u32, new_state) + ), + +TP_fast_assign ( + LOCAL_ASSIGN; + VIF_ASSIGN; + STA_ASSIGN; + __entry->old_state = old_state; + __entry->new_state = new_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 + ) +); +#endif /* !__MAC80211_DRIVER_TRACE || TRACE_HEADER_MULTI_READ */ #undef TRACE_INCLUDE_PATH
Signature · 1 line
2.34.1
PATCH v3 15/21 wifi: mac80211: filter uplink and downlink frames based on SMD states
In reply to Pooventhiran GDuring 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.
State 4a:
- UL/DL: All Class 3 frames except ST Execution Request and Response frames are disallowed.
State 4b:
- UL: Class 3 data frames are disallowed.
- DL: All Class 3 data, control, management frames are disallowed.
State 4c:
- UL: All Class 3 frames except QoS Null, Control, and UHR Reconfiguration Notify frames are disallowed.
- DL: All Class 3 frames except Data, Control, and UHR Reconfiguration Notify frames are disallowed.
Add the filters in both tx and rx handlers to implement the conditions to avoid exchanging those frames while the station is transitioning 'seamlessly' (state-4) to the target AP MLD. The unexpected frames will cause out-of-state operations and leaks in the context transferred.
--- net/mac80211/drop.h | 1 + net/mac80211/rx.c | 44 ++++++++++++++++++++++++++++++++++++++++++++ net/mac80211/tx.c | 42 ++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 87 insertions(+)
net/mac80211/drop.h +1 -0
@@ -109,6 +109,7 @@ typedef unsigned int __bitwise ieee80211_rx_result; R(RX_DROP_U_UNHANDLED_MGMT_STYPE) \ R(RX_DROP_U_NO_LINK) \ R(RX_DROP_U_DEFRAG_OVERFLOW) \ + R(RX_DROP_U_SMD_FILTERED) \ /* this line for the trailing \ - add before this */ /* having two enums allows for checking ieee80211_rx_result use with sparse */
net/mac80211/rx.c +44 -0
56 lines not on this page · raw message
net/mac80211/tx.c +42 -0
54 lines not on this page · raw message
Signature · 1 line
2.34.1
kernel test robot
build botRe: [PATCH wireless-next v3 15/21] wifi: mac80211: filter uplink and downlink frames based on SMD states
kernel test robot noticed the following build warnings:
Hi Pooventhiran,
kernel test robot noticed the following build warnings:
[auto build test WARNING on b8e5b0ae8ff47240366d38e5d12c65f878724316]
url: https://github.com/intel-lab-lkp/linux/commits/Pooventhiran-G/wifi-nl80211-define-Seamless-Mobility-Domain-SMD-device-capability/20261106-010836 base: b8e5b0ae8ff47240366d38e5d12c65f878724316 patch link: https://lore.kernel.org/r/20261106-smd-v3-15-1723950e3cf8%40oss.qualcomm.com patch subject: [PATCH wireless-next v3 15/21] wifi: mac80211: filter uplink and downlink frames based on SMD states config: x86_64-kexec (https://download.01.org/0day-ci/archive/20261106/[email protected]/config) compiler: clang version 22.1.8 (https://github.com/llvm/llvm-project ca7933e47d3a3451d81e72ac174dcb5aa28b59d1) reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20261106/[email protected]/reproduce)
If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/
All warnings (new ones prefixed by >>):
>> net/mac80211/tx.c:318:48: warning: overlapping comparisons always evaluate to true [-Wtautological-overlap-compare]
318 | (tx->sdata->vif.type != NL80211_IFTYPE_AP ||
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~
319 | tx->sdata->vif.type != NL80211_IFTYPE_AP_VLAN) ||
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~1 warning generated.
vim +318 net/mac80211/tx.c
310
311 static ieee80211_tx_result debug_noinline
312 ieee80211_tx_h_smd_state(struct ieee80211_tx_data *tx)
313 {
314 struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)tx->skb->data;
315 __le16 fc = hdr->frame_control;
316
317 if (!tx->sta ||
> 318 (tx->sdata->vif.type != NL80211_IFTYPE_AP ||
319 tx->sdata->vif.type != NL80211_IFTYPE_AP_VLAN) ||
320 !test_sta_flag(tx->sta, WLAN_STA_ASSOC) ||
321 !(tx->flags & IEEE80211_TX_UNICAST))
322 return TX_CONTINUE;
323
324 switch (tx->sta->smd_state) {
325 case IEEE80211_STA_SMD_NONE:
326 break;
327 case IEEE80211_STA_SMD_PREP:
328 /* 4a: Class 3 disallowed except ST Execution Response */
329 if (ieee80211_is_st_exec_resp(tx->skb))
330 break;
331 if (ieee80211_is_class3(tx->skb))
332 return TX_DROP;
333 break;
334 case IEEE80211_STA_SMD_EXEC:
335 /* 4b: no restriction */
336 break;
337 case IEEE80211_STA_SMD_DRAIN:
338 /* 4c: Class 3 disallowed except Data, Control,
339 * UHR Reconfiguration Notify
340 */
341 if (ieee80211_is_ctl(fc) || ieee80211_is_data(fc) ||
342 ieee80211_is_uhr_link_reconf_notify(tx->skb))
343 break;
344 if (ieee80211_is_class3(tx->skb))
345 return TX_DROP;
346 break;
347 }
348
349 return TX_CONTINUE;
350 }
351
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
PATCH v3 16/21 wifi: mac80211: send BlockAck policy in AMPDU action
In reply to Pooventhiran GWhile sending AMPDU action hints to drivers, mac80211 does not include the BlockAck policy extracted from ADDBA frames. Drivers may require the complete set of BlockAck negotiation parameters for certain use cases, such as SMD BSS Transition, where the complete BlockAck context needs to be transported as part of the transition.
Include the BlockAck policy as well in AMPDU action so that drivers have the required information about the negotiation. Since the policy is extracted from the received ADDBA Request, it is valid only for IEEE80211_AMPDU_RX_START.
--- include/net/mac80211.h | 15 +++++++++++++++ net/mac80211/agg-rx.c | 1 + net/mac80211/trace.h | 8 +++++--- 3 files changed, 21 insertions(+), 3 deletions(-)
include/net/mac80211.h +15 -0
@@ -3979,6 +3979,19 @@ enum ieee80211_ampdu_mlme_action {#define IEEE80211_AMPDU_TX_START_IMMEDIATE 1#define IEEE80211_AMPDU_TX_START_DELAY_ADDBA 2 +/** +* enum ieee80211_ba_policy - BlockAck Policy +* +* @IEEE80211_BLOCKACK_DELAYED: Block ACK sent to the BAR sender in next TXOP +* @IEEE80211_BLOCKACK_IMMEDIATE: Block ACK sent to the BAR sender immediately +* +* This field is valid only for %IEEE80211_AMPDU_RX_START. +*/ +enum ieee80211_ba_policy { +IEEE80211_BLOCKACK_DELAYED , +IEEE80211_BLOCKACK_IMMEDIATE , +}; +/** * struct ieee80211_ampdu_params - AMPDU action parameters *
@@ -3991,6 +4004,7 @@ enum ieee80211_ampdu_mlme_action {* @buf_size: reorder buffer size (number of subframes). Valid only when the * action is set to %IEEE80211_AMPDU_RX_START or * %IEEE80211_AMPDU_TX_OPERATIONAL +* @policy: BlockAck policy of type &enum ieee80211_ba_policy * @amsdu: indicates the peer's ability to receive A-MSDU within A-MPDU. * valid when the action is set to %IEEE80211_AMPDU_TX_OPERATIONAL * @timeout: BA session timeout. Valid only when the action is set to
@@ -4002,6 +4016,7 @@ struct ieee80211_ampdu_params {u16 tid;u16 ssn;u16 buf_size; +enum ieee80211_ba_policy policy;bool amsdu;u16 timeout; };
net/mac80211/agg-rx.c +1 -0
@@ -289,6 +289,7 @@ void __ieee80211_start_rx_ba_session(struct sta_info *sta, .amsdu = false, .timeout = timeout, .ssn = start_seq_num, + .policy = ba_policy, };int i, ret = -EOPNOTSUPP ;u16 status =WLAN_STATUS_REQUEST_DECLINED ;
net/mac80211/trace.h +5 -3
@@ -116,6 +116,7 @@ __field(u16, ssn) \ __field(u16, buf_size) \ __field(bool, amsdu) \ + __field(u8, policy) \ __field(u16, timeout) \ __field(u16, action)#define AMPDU_ACTION_ASSIGN STA_NAMED_ASSIGN(params->sta); \
@@ -123,12 +124,13 @@ __entry->ssn = params->ssn; \ __entry->buf_size = params->buf_size; \ __entry->amsdu = params->amsdu; \ + __entry->policy = params->policy; \ __entry->timeout = params->timeout; \ __entry->action = params->action; -#define AMPDU_ACTION_PR_FMT STA_PR_FMT " tid %d, ssn %d, buf_size %u, amsdu %d, timeout %d action %d" +#define AMPDU_ACTION_PR_FMT STA_PR_FMT " tid %d, ssn %d, buf_size %u, amsdu %d, policy=%u, timeout %d action %d"#define AMPDU_ACTION_PR_ARG STA_PR_ARG, __entry->tid, __entry->ssn, \ - __entry->buf_size, __entry->amsdu, __entry->timeout, \ - __entry->action + __entry->buf_size, __entry->amsdu, __entry->policy, \ + __entry->timeout, __entry->action/* * Tracing for driver callbacks.
Signature · 1 line
2.34.1
PATCH v3 17/21 wifi: mac80211: pass rx_data directly from ieee80211_rx_list()
In reply to Pooventhiran Grx_data is currently defined inside __ieee80211_rx_handle_packet() and is passed to the rx handlers called inside. Define it early in ieee80211_rx_list() so that new transient data that live just between the driver and mac80211 interface layer can be passed to the rx handlers as well.
--- net/mac80211/rx.c | 60 +++++++++++++++++++++++++++---------------------------- 1 file changed, 30 insertions(+), 30 deletions(-)
net/mac80211/rx.c +30 -30
@@ -5374,7 +5374,8 @@ static bool ieee80211_rx_valid_freq(struct ieee80211_rx_status *status,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) {struct ieee80211_local *local =hw_to_local (hw);struct ieee80211_sub_if_data *sdata;
@@ -5383,16 +5384,14 @@ static void __ieee80211_rx_handle_packet(struct ieee80211_hw *hw,struct link_sta_info *link_sta;struct sta_info *sta;__le16 fc; -struct ieee80211_rx_data rx;struct rhlist_head *tmp;bool rx_data_pending;int err =0 ; fc = ((struct ieee80211_hdr *)skb->data)->frame_control; -memset (&rx,0 ,sizeof (rx)); - rx.skb = skb; - rx.local = local; - rx.list = list; + rx->skb = skb; + rx->local = local; + rx->list = list;if (ieee80211_is_data (fc) ||ieee80211_is_mgmt (fc))I802_DEBUG_INC (local->dot11ReceivedFragmentCount);
@@ -5424,8 +5423,8 @@ static void __ieee80211_rx_handle_packet(struct ieee80211_hw *hw, } hdr = (struct ieee80211_hdr *)skb->data; -ieee80211_parse_qos (&rx); -ieee80211_verify_alignment (&rx); +ieee80211_parse_qos (rx); +ieee80211_verify_alignment (rx); if (unlikely(ieee80211_is_probe_resp(hdr->frame_control) || ieee80211_is_beacon(hdr->frame_control) ||
@@ -5446,9 +5445,9 @@ static void __ieee80211_rx_handle_packet(struct ieee80211_hw *hw, sta); link_sta =rcu_dereference (sta->link[link_pubsta->link_id]); - rx.sdata = sta->sdata; -if (ieee80211_rx_data_set_link_sta (&rx, link_sta) && -ieee80211_prepare_and_rx_handle (&rx, skb, true)) + rx->sdata = sta->sdata; +if (ieee80211_rx_data_set_link_sta (rx, link_sta) && +ieee80211_prepare_and_rx_handle (rx, skb, true))return ; goto out;
@@ -5468,13 +5467,13 @@ static void __ieee80211_rx_handle_packet(struct ieee80211_hw *hw,continue ;if (rx_data_pending) { -ieee80211_prepare_and_rx_handle (&rx, skb, +ieee80211_prepare_and_rx_handle (rx, skb, false); rx_data_pending = false; } - rx.sdata = sta->sdata; -if (!ieee80211_rx_data_set_link_sta (&rx, &sta->deflink)) + rx->sdata = sta->sdata; +if (!ieee80211_rx_data_set_link_sta (rx, &sta->deflink))continue ; rx_data_pending = true;
@@ -5492,20 +5491,20 @@ static void __ieee80211_rx_handle_packet(struct ieee80211_hw *hw,continue ;if (rx_data_pending) { -ieee80211_prepare_and_rx_handle (&rx, skb, +ieee80211_prepare_and_rx_handle (rx, skb, false); rx_data_pending = false; } - rx.sdata = sta->sdata; -if (!ieee80211_rx_data_set_link_sta (&rx, link_sta)) + rx->sdata = sta->sdata; +if (!ieee80211_rx_data_set_link_sta (rx, link_sta))continue ; rx_data_pending = true; }if (rx_data_pending) { -if (ieee80211_prepare_and_rx_handle (&rx, skb, true)) +if (ieee80211_prepare_and_rx_handle (rx, skb, true))return ; goto out;
@@ -5560,14 +5559,14 @@ static void __ieee80211_rx_handle_packet(struct ieee80211_hw *hw,if (link_sta && link &&ieee80211_rx_valid_freq (status, link)) {if (rx_data_pending) { -ieee80211_prepare_and_rx_handle (&rx, skb, false); +ieee80211_prepare_and_rx_handle (rx, skb, false); rx_data_pending = false; }/* No valid_links check as we need to RX beacons */ - rx.sdata = sdata; -if (ieee80211_rx_data_set_link_sta (&rx, link_sta)) + rx->sdata = sdata; +if (ieee80211_rx_data_set_link_sta (rx, link_sta)) rx_data_pending = true;continue ;
@@ -5596,22 +5595,22 @@ static void __ieee80211_rx_handle_packet(struct ieee80211_hw *hw, }if (rx_data_pending) { -ieee80211_prepare_and_rx_handle (&rx, skb, false); +ieee80211_prepare_and_rx_handle (rx, skb, false); rx_data_pending = false; } - rx.sdata = sdata; - rx.local = sdata->local; - rx.link = link; - rx.link_id = link != &sdata->deflink ? link->link_id :-1 ; - rx.sta =NULL ; - rx.link_sta =NULL ; + rx->sdata = sdata; + rx->local = sdata->local; + rx->link = link; + rx->link_id = link != &sdata->deflink ? link->link_id :-1 ; + rx->sta =NULL ; + rx->link_sta =NULL ; rx_data_pending = true; }if (rx_data_pending && -ieee80211_prepare_and_rx_handle (&rx, skb, true)) +ieee80211_prepare_and_rx_handle (rx, skb, true))return ; out:
@@ -5631,6 +5630,7 @@ 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_rx_data rx = {};WARN_ON_ONCE (softirq_count () ==0 );
@@ -5782,7 +5782,7 @@ void ieee80211_rx_list(struct ieee80211_hw *hw,__ieee80211_rx_handle_8023 (hw, link_pubsta, skb, list); else __ieee80211_rx_handle_packet(hw, link_pubsta, skb, -list ); + list, &rx); }kcov_remote_stop ();
Signature · 1 line
2.34.1
PATCH v3 18/21 wifi: mac80211: handle UHR Link Reconfiguration frame
In reply to Pooventhiran GA 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.
Reserve a field in ieee80211_rx_status that enables drivers to attach the STA's dynamic context to the corresponding frame. Since the maximum possible context can grow too big, attach the pointer to the context to the frame. Add handling for UHR ST Preparation and Execution Request frames so that the associated context is propagated through cfg80211 and nl80211 for userspace reporting.
--- include/net/mac80211.h | 10 +++++++++- net/mac80211/ieee80211_i.h | 2 ++ net/mac80211/rx.c | 36 ++++++++++++++++++++++++++++++++++++ 3 files changed, 47 insertions(+), 1 deletion(-)
include/net/mac80211.h +9 -1
@@ -1735,6 +1735,10 @@ 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. +* 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. * @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
@@ -1775,12 +1779,15 @@ 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 +* is used only for ST Preparation or ST Execution Request frames. */ struct ieee80211_rx_status {u64 mactime;union {u64 boottime_ns;ktime_t ack_tx_hwtstamp; +struct ieee80211_smd_ctx *smd_ctx; };u32 device_timestamp;u32 ampdu_reference;
@@ -1814,7 +1821,8 @@ struct ieee80211_rx_status {u8 chains;s8 chain_signal[IEEE80211_MAX_CHAINS ];u8 zero_length_psdu_type; - u8 link_id:4; + u8 link_id:4, + smd_ctx_valid:1; }; static_assert(sizeof(struct ieee80211_rx_status) <= sizeof_field(struct sk_buff, cb));
net/mac80211/ieee80211_i.h +2 -0
@@ -279,6 +279,8 @@ struct ieee80211_rx_data { };u8 link_addrs[3 *ETH_ALEN ]; + +struct ieee80211_smd_ctx *smd_ctx; };struct ieee80211_csa_settings {
net/mac80211/rx.c +36 -0
@@ -3992,6 +3992,22 @@ ieee80211_rx_h_action(struct ieee80211_rx_data *rx)return RX_QUEUED ; } +static void +ieee80211_rx_h_userspace_mgmt_st_req_frame (struct cfg80211_rx_info *info, +struct ieee80211_rx_data *rx) +{ +struct ieee80211_mgmt *mgmt = (void *)info->buf; +u8 type; + +if (!rx->smd_ctx) +return ; + + type = mgmt->u.action.uhr_link_reconf_req.type; + + info->st_info.type = type; + info->st_info.ctx = rx->smd_ctx; +} + static ieee80211_rx_result debug_noinlineieee80211_rx_h_userspace_mgmt (struct ieee80211_rx_data *rx) {
@@ -4003,6 +4019,7 @@ ieee80211_rx_h_userspace_mgmt(struct ieee80211_rx_data *rx) .link_id = rx->link_id, .have_link_id = rx->link_id >= 0, .no_sta = !rx->sta, + .st_info.ctx = NULL, };/* skip known-bad action frames and return them in the next handler */
@@ -4024,6 +4041,9 @@ ieee80211_rx_h_userspace_mgmt(struct ieee80211_rx_data *rx) ieee80211_is_ftm(rx->skb)) { info.rx_tstamp =ktime_to_ns (skb_hwtstamps (rx->skb)->hwtstamp); info.ack_tstamp =ktime_to_ns (status->ack_tx_hwtstamp); + } else if (ieee80211_is_st_prep_req(rx->skb) || + ieee80211_is_st_exec_req(rx->skb)) { +ieee80211_rx_h_userspace_mgmt_st_req_frame (&info, rx); }if (cfg80211_rx_mgmt_ext (&rx->sdata->wdev, &info)) {
@@ -5630,10 +5650,18 @@ 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_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 (WARN_ON (status->band >=NUM_NL80211_BANDS )) goto drop;
@@ -5765,6 +5793,12 @@ void ieee80211_rx_list(struct ieee80211_hw *hw,kcov_remote_start_common (skb_get_kcov_handle (skb)); + rx.smd_ctx = smd_ctx; + +if (WARN_ONCE ((status->flag &RX_FLAG_8023 ) && rx.smd_ctx, +"802.3 packet but with IEEE P802.11bn SMD context" )) + goto drop; +/* * Frames with failed FCS/PLCP checksum are not returned, * all other frames are returned without radiotap header
@@ -5784,10 +5818,12 @@ void ieee80211_rx_list(struct ieee80211_hw *hw,__ieee80211_rx_handle_packet (hw, link_pubsta, skb, list, &rx); } +kfree (smd_ctx);kcov_remote_stop ();return ; drop: +kfree (smd_ctx);kfree_skb (skb); }EXPORT_SYMBOL (ieee80211_rx_list);
Signature · 1 line
2.34.1
PATCH v3 19/21 wifi: mac80211: add mac80211 support to handle NL80211_CMD_SET_SMD_CTX
In reply to Pooventhiran Gcfg80211 supports NL80211_CMD_SET_SMD_CTX on the target AP MLD for userspace to program the station's dynamic context on the TX and RX queues.
Add mac80211 support to handle this command in driver and lower layers 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.
--- include/net/mac80211.h | 5 +++++ net/mac80211/cfg.c | 30 ++++++++++++++++++++++++++++++ net/mac80211/driver-ops.h | 24 ++++++++++++++++++++++++ net/mac80211/trace.h | 36 ++++++++++++++++++++++++++++++++++++ 4 files changed, 95 insertions(+)
include/net/mac80211.h +5 -0
@@ -4815,6 +4815,8 @@ 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. */ struct ieee80211_ops { void (*tx)(struct ieee80211_hw *hw,
@@ -5233,6 +5235,9 @@ 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); };/**
net/mac80211/cfg.c +30 -0
@@ -6359,6 +6359,35 @@ 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) +{ +struct ieee80211_local *local =wiphy_priv (wiphy); +struct ieee80211_sub_if_data *sdata; +struct sta_info *sta; + +lockdep_assert_wiphy (wiphy); + + sdata =IEEE80211_WDEV_TO_SUB_IF (wdev); + +if (sdata->vif.type !=NL80211_IFTYPE_AP && + sdata->vif.type !=NL80211_IFTYPE_AP_VLAN ) +return -EOPNOTSUPP ; + + 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 ) +return -EINVAL ; + +if (!wiphy_dereference (wiphy, sta->ptk[sta->ptk_idx])) +return -EINVAL ; + +return drv_set_smd_ctx (local, sdata, &sta->sta, st_info); +} +const struct cfg80211_ops mac80211_config_ops = { .add_virtual_intf = ieee80211_add_iface, .del_virtual_intf = ieee80211_del_iface,
@@ -6482,4 +6511,5 @@ 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, };
net/mac80211/driver-ops.h +24 -0
@@ -1811,4 +1811,28 @@ int drv_sta_smd_state(struct ieee80211_local *local,enum ieee80211_sta_smd_state old_state, enum ieee80211_sta_smd_state new_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) +{ +int ret; + +if (!local->ops->set_smd_ctx) +return -EOPNOTSUPP ; + + sdata =get_bss_sdata (sdata); + +lockdep_assert_wiphy (local->hw.wiphy); + +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_return_int (local, ret); + +return ret; +} +#endif /* __MAC80211_DRIVER_OPS */
net/mac80211/trace.h +36 -0
@@ -3466,6 +3466,42 @@ TRACE_EVENT(drv_sta_smd_state, ) ); +TRACE_EVENT (drv_set_smd_ctx, + TP_PROTO(struct ieee80211_local *local, + struct ieee80211_sub_if_data *sdata, + struct ieee80211_sta *sta, + struct cfg80211_smd_transition_info *st_info), + +TP_ARGS (local, sdata, sta, st_info), + +TP_STRUCT__entry ( + LOCAL_ENTRY + VIF_ENTRY + STA_ENTRY + __field(u8, st_type) + __field(u8, dl_tid_bitmap) +__field (u8, ul_tid_bitmap) + ), + +TP_fast_assign ( + struct ieee80211_smd_ctx *ctx = st_info->ctx; + + LOCAL_ASSIGN; + VIF_ASSIGN; + STA_ASSIGN; + __entry->st_type = st_info->type; + __entry->dl_tid_bitmap = ctx->dl.valid_tid_bmap; + __entry->ul_tid_bitmap = ctx->ul.valid_tid_bmap; + ), + + TP_printk(LOCAL_PR_FMT VIF_PR_FMT STA_PR_FMT +", ST type=%u DL TIDs: 0x%x, UL TIDs: 0x%x" , +LOCAL_PR_ARG ,VIF_PR_ARG ,STA_PR_ARG , + __entry->st_type, + __entry->dl_tid_bitmap, __entry->ul_tid_bitmap + ) +); +#endif /* !__MAC80211_DRIVER_TRACE || TRACE_HEADER_MULTI_READ */ #undef TRACE_INCLUDE_PATH
Signature · 1 line
2.34.1
PATCH v3 20/21 wifi: mac80211: add mac80211 support to handle NL80211_CMD_GET_SMD_CTX
In reply to Pooventhiran Gcfg80211 supports NL80211_CMD_GET_SMD_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.
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 event.
--- include/net/mac80211.h | 19 +++++++++++++++++++ net/mac80211/cfg.c | 36 ++++++++++++++++++++++++++++++++++++ net/mac80211/driver-ops.h | 24 ++++++++++++++++++++++++ net/mac80211/sta_info.c | 6 ++++++ net/mac80211/trace.h | 27 +++++++++++++++++++++++++++ 5 files changed, 112 insertions(+)
include/net/mac80211.h +19 -0
@@ -4817,6 +4817,11 @@ 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. */ struct ieee80211_ops { void (*tx)(struct ieee80211_hw *hw,
@@ -5238,6 +5243,9 @@ 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); };/**
@@ -8312,4 +8320,15 @@ bool ieee80211_vif_nan_started(struct ieee80211_vif *vif);* Return: 0 if success and non-zero on error */ int ieee80211_encrypt_tx_skb (struct sk_buff *skb); + +/** +* ieee80211_get_smd_ctx_done - Deliver async get_smd_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 +* failure) +*/ +void ieee80211_get_smd_ctx_done (struct ieee80211_vif *vif, +const u8 *sta_addr, +struct cfg80211_smd_transition_info *st_info);#endif /* MAC80211_H */
net/mac80211/cfg.c +36 -0
@@ -6388,6 +6388,41 @@ static int ieee80211_set_smd_ctx(struct wiphy *wiphy, struct wireless_dev *wdev,return drv_set_smd_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) +{ +struct ieee80211_local *local =wiphy_priv (wiphy); +struct ieee80211_sub_if_data *sdata; +struct sta_info *sta; + +lockdep_assert_wiphy (wiphy); + + sdata =IEEE80211_WDEV_TO_SUB_IF (wdev); + +if (sdata->vif.type !=NL80211_IFTYPE_AP && + sdata->vif.type !=NL80211_IFTYPE_AP_VLAN ) +return -EOPNOTSUPP ; + + sta =sta_info_get_bss (sdata, addr); +if (!sta) +return -ENOENT ; +if (!sta->sta.smd_params.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); +} +EXPORT_SYMBOL (ieee80211_get_smd_ctx_done); +const struct cfg80211_ops mac80211_config_ops = { .add_virtual_intf = ieee80211_add_iface, .del_virtual_intf = ieee80211_del_iface,
@@ -6512,4 +6547,5 @@ 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, };
net/mac80211/driver-ops.h +24 -0
@@ -1835,4 +1835,28 @@ static inline int drv_set_smd_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) +{ +int ret; + +if (!sdata || !local->ops->get_smd_ctx) +return -EOPNOTSUPP ; + + sdata =get_bss_sdata (sdata); + +lockdep_assert_wiphy (local->hw.wiphy); + +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_return_int (local, ret); + +return ret; +} +#endif /* __MAC80211_DRIVER_OPS */
net/mac80211/sta_info.c +6 -0
@@ -1312,6 +1312,7 @@ 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 ();
@@ -1321,6 +1322,7 @@ 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);
@@ -1390,6 +1392,10 @@ 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 +27 -0
@@ -3502,6 +3502,33 @@ TRACE_EVENT(drv_set_smd_ctx, ) ); +TRACE_EVENT (drv_get_smd_ctx, + TP_PROTO(struct ieee80211_local *local, + struct ieee80211_sub_if_data *sdata, + struct ieee80211_sta *sta, + enum nl80211_smd_ctx_type type), + +TP_ARGS (local, sdata, sta, type), + +TP_STRUCT__entry ( + LOCAL_ENTRY + VIF_ENTRY + STA_ENTRY +__field (u8, st_type) + ), + +TP_fast_assign ( + LOCAL_ASSIGN; + VIF_ASSIGN; + STA_ASSIGN; + __entry->st_type = type; + ), + + TP_printk(LOCAL_PR_FMT VIF_PR_FMT STA_PR_FMT ", ST type=%u", +LOCAL_PR_ARG ,VIF_PR_ARG ,STA_PR_ARG , __entry->st_type + ) +); +#endif /* !__MAC80211_DRIVER_TRACE || TRACE_HEADER_MULTI_READ */ #undef TRACE_INCLUDE_PATH
Signature · 1 line
2.34.1
PATCH v3 21/21 wifi: mac80211: define API to invoke SMD Drain Completion event
In reply to Pooventhiran GTo indicate userspace the early termination of the DL draining period, define an API for drivers to invoke the SMD Drain Completion event. This API makes sure that the non-AP MLD is already in the DL Drain sub-state (4c) in the first place to being able to terminate it.
--- include/net/mac80211.h | 16 ++++++++++++++++ net/mac80211/cfg.c | 18 ++++++++++++++++++ 2 files changed, 34 insertions(+)
include/net/mac80211.h +16 -0
@@ -8331,4 +8331,20 @@ int ieee80211_encrypt_tx_skb(struct sk_buff *skb);void ieee80211_get_smd_ctx_done (struct ieee80211_vif *vif,const u8 *sta_addr,struct cfg80211_smd_transition_info *st_info); + +/** +* ieee80211_notify_smd_drain_completion - notify downlink drain completion for +* an SMD station. +* @vif: virtual interface +* @station: non-AP MLD object +* +* The start of DL draining will have moved the station to SMD sub-state +* %IEEE80211_STA_SMD_DRAIN. Hence, drain completion is valid only if the +* station is already in this state. Should be called under wiphy_lock. +* +* Return: 0 if success, -EINVAL otherwise +*/ +int ieee80211_notify_smd_drain_completion (struct ieee80211_vif *vif, +struct ieee80211_sta *station); +#endif /* MAC80211_H */
net/mac80211/cfg.c +18 -0
@@ -6423,6 +6423,24 @@ void ieee80211_get_smd_ctx_done(struct ieee80211_vif *vif, }EXPORT_SYMBOL (ieee80211_get_smd_ctx_done); +int ieee80211_notify_smd_drain_completion (struct ieee80211_vif *vif, +struct ieee80211_sta *station) +{ +struct ieee80211_sub_if_data *sdata =vif_to_sdata (vif); + struct sta_info *sta = container_of(station, struct sta_info, sta); + +lockdep_assert_wiphy (sdata->local->hw.wiphy); + +/* doesn't make sense to terminate if we are not draining already */ +if (sta->smd_state !=IEEE80211_STA_SMD_DRAIN ) +return -EINVAL ; + +cfg80211_notify_smd_drain_completion (&sdata->wdev, sta->addr); + +return 0 ; +} +EXPORT_SYMBOL (ieee80211_notify_smd_drain_completion); +const struct cfg80211_ops mac80211_config_ops = { .add_virtual_intf = ieee80211_add_iface, .del_virtual_intf = ieee80211_del_iface,
Signature · 1 line
2.34.1