* [PATCH wireless-next v5 00/19] wifi: Add Seamless Mobility Domain (SMD) AP support
@ 2026-12-02 10:27 Pooventhiran G
2026-12-02 10:27 ` [PATCH wireless-next v5 01/19] wifi: nl80211: define Seamless Mobility Domain (SMD) device capability Pooventhiran G
` (18 more replies)
0 siblings, 19 replies; 20+ messages in thread
From: Pooventhiran G @ 2026-12-02 10:27 UTC (permalink / raw)
To: Johannes Berg; +Cc: linux-wireless, linux-kernel, pooventhiran.g
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 Transition (ST) procedure.
This series implements the nl80211, cfg80211, and mac80211 support for
SMD 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 managing the associated non-AP MLD that has
negotiated SMD via NL80211_CMD_NEW_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_ST_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.
- If the driver completes draining, the same can be intimated to
userspace for cleanups using NL80211_CMD_ST_DRAIN_COMPLETION_EVENT.
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_ST_CTX and
NL80211_CMD_ST_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 ST 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 19
[1] RFC: https://lore.kernel.org/linux-wireless/fbf4209c-4fd8-4047-96d7-7fa34d9ba44d@quicinc.com/
[2] Patch ("wifi: mac80211: handle UHR Link Reconfiguration frame")
Signed-off-by: Pooventhiran G <pooventhiran.g@oss.qualcomm.com>
---
Changes in v5:
- Renamed SMD BSS Transition to SMD Transition (and ST) throughout the
series
- Used wiphy_ext_feature to advertise SMD support in ("wifi: nl80211:
define Seamless Mobility Domain (SMD) device capability")
- Removed SMD indication in AP setup from ("wifi: nl80211/cfg80211:
define interfaces for SMD setup and STA update") and ("wifi: mac80211:
set SMD parameters for AP setup and STA update")
- Refactored &struct ieee80211_smd_ctx ("wifi: cfg80211: define layouts
for SMD BSS Transition context")
- Refactored per-TID attributes to use nest of same attribute enabling
stricter policy checks in ("wifi: nl80211: define interfaces for SMD BSS
Transition context transfer")
- Replaced dynamic ST context size calculation with a static size in
("wifi: nl80211/cfg80211: pack SMD dynamic context along with frame")
- Removed netdev tracker from ("wifi: nl80211/cfg80211: add support for
querying SMD context for target AP MLD")
- Removed wiphy_lock dependency from ("wifi: nl80211/cfg80211: define
API to notify SMD Drain completion")
- Refactored ST substates to just be a new state notification in ("wifi:
mac80211: add driver_op for SMD substate changes")
- Removed ("wifi: mac80211: send BlockAck policy in AMPDU action")
commit
- Fixed up ieee80211_*() wrappers in ("wifi: mac80211: add mac80211
support to handle NL80211_CMD_GET_SMD_CTX") and ("wifi: mac80211:
define API to invoke SMD Drain Completion event")
- Link to v4: https://lore.kernel.org/r/20261106-smd-v4-0-62e39487f51a@oss.qualcomm.com
Changes in v4:
- Fixed clang warning in ieee80211_tx_h_smd_state
- Link to v3: https://lore.kernel.org/r/20261106-smd-v3-0-1723950e3cf8@oss.qualcomm.com
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/20260924-smd-v2-0-bb40094da1d4@oss.qualcomm.com
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/20260908-smd-v1-0-65ad4ab30fbd@oss.qualcomm.com/
---
Pooventhiran G (17):
wifi: nl80211: add ST sub-state STA flags for non-AP MLD
wifi: cfg80211: define layouts for ST context transfer
wifi: nl80211: define interfaces for ST 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 ST dynamic context along with frame
wifi: nl80211/cfg80211: add support for ST context programming
wifi: nl80211/cfg80211: add support for querying ST context for target AP MLD
wifi: nl80211/cfg80211: define API to notify ST Drain completion
wifi: mac80211: apply SMD indication and ST sub-states to STA
wifi: mac80211: add driver_op for ST substate changes
wifi: mac80211: filter uplink and downlink frames based on ST states
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_ST_CTX
wifi: mac80211: add mac80211 support to handle NL80211_CMD_GET_ST_CTX
wifi: mac80211: define API to invoke ST Drain Completion event
Rohan Dutta (1):
wifi: nl80211/cfg80211: define interfaces for SMD STA indications
Sidhanta Sahu (1):
wifi: nl80211: define Seamless Mobility Domain (SMD) device capability
include/linux/ieee80211-uhr.h | 125 ++++++++
include/linux/ieee80211.h | 43 +++
include/net/cfg80211.h | 123 ++++++++
include/net/mac80211.h | 85 +++++-
include/uapi/linux/nl80211.h | 219 +++++++++++++
net/mac80211/cfg.c | 134 ++++++++
net/mac80211/debugfs_sta.c | 3 +
net/mac80211/driver-ops.c | 18 ++
net/mac80211/driver-ops.h | 53 ++++
net/mac80211/drop.h | 1 +
net/mac80211/ieee80211_i.h | 2 +
net/mac80211/rx.c | 141 +++++++--
net/mac80211/sta_info.c | 67 ++++
net/mac80211/sta_info.h | 15 +
net/mac80211/trace.h | 91 ++++++
net/mac80211/tx.c | 43 +++
net/wireless/nl80211.c | 692 +++++++++++++++++++++++++++++++++++++++++-
net/wireless/nl80211.h | 3 +
net/wireless/rdev-ops.h | 28 ++
net/wireless/trace.h | 60 ++++
20 files changed, 1907 insertions(+), 39 deletions(-)
---
base-commit: 18d0bedbb5f0538396cb7f763ed9cd1dd69c5b23
change-id: 20260908-smd-16986850d725
Best regards,
--
^ permalink raw reply [flat|nested] 20+ messages in thread
* [PATCH wireless-next v5 01/19] wifi: nl80211: define Seamless Mobility Domain (SMD) device capability
2026-12-02 10:27 [PATCH wireless-next v5 00/19] wifi: Add Seamless Mobility Domain (SMD) AP support Pooventhiran G
@ 2026-12-02 10:27 ` Pooventhiran G
2026-12-02 10:27 ` [PATCH wireless-next v5 02/19] wifi: nl80211/cfg80211: define interfaces for SMD STA indications Pooventhiran G
` (17 subsequent siblings)
18 siblings, 0 replies; 20+ messages in thread
From: Pooventhiran G @ 2026-12-02 10:27 UTC (permalink / raw)
To: Johannes Berg; +Cc: linux-wireless, linux-kernel, pooventhiran.g
From: Sidhanta Sahu <sidhanta.sahu@oss.qualcomm.com>
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 Transition
(ST) 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 interfaces to advertise SMD support to userspace.
Signed-off-by: Sidhanta Sahu <sidhanta.sahu@oss.qualcomm.com>
Co-developed-by: Pooventhiran G <pooventhiran.g@oss.qualcomm.com>
Signed-off-by: Pooventhiran G <pooventhiran.g@oss.qualcomm.com>
---
include/uapi/linux/nl80211.h | 20 ++++++++++++++++++++
1 file changed, 20 insertions(+)
diff --git a/include/uapi/linux/nl80211.h b/include/uapi/linux/nl80211.h
index 439a08654274..2e4b08c41587 100644
--- a/include/uapi/linux/nl80211.h
+++ b/include/uapi/linux/nl80211.h
@@ -401,6 +401,22 @@
* of them.
*/
+/**
+ * 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
+ * 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).
+ *
+ * Drivers can indicate userspace about the support for SMD (and ST) by setting
+ * %NL80211_EXT_FEATURE_SMD_SUPPORT.
+ */
+
/**
* enum nl80211_commands - supported nl80211 commands
*
@@ -7289,6 +7305,9 @@ enum nl80211_feature_flags {
* @NL80211_EXT_FEATURE_UPDATE_BEACON: Driver supports
* %NL80211_CMD_UPDATE_BEACON.
*
+ * @NL80211_EXT_FEATURE_SMD_SUPPORT: Driver supports Seamless Mobility Domain
+ * (SMD) and Transition (ST).
+ *
* @NUM_NL80211_EXT_FEATURES: number of extended features.
* @MAX_NL80211_EXT_FEATURES: highest extended feature index.
*/
@@ -7373,6 +7392,7 @@ enum nl80211_ext_feature_index {
NL80211_EXT_FEATURE_PROBE_AP,
NL80211_EXT_FEATURE_FAST_ROAM_OFFLOAD,
NL80211_EXT_FEATURE_UPDATE_BEACON,
+ NL80211_EXT_FEATURE_SMD_SUPPORT,
/* add new features before the definition below */
NUM_NL80211_EXT_FEATURES,
--
2.34.1
^ permalink raw reply [flat|nested] 20+ messages in thread
* [PATCH wireless-next v5 02/19] wifi: nl80211/cfg80211: define interfaces for SMD STA indications
2026-12-02 10:27 [PATCH wireless-next v5 00/19] wifi: Add Seamless Mobility Domain (SMD) AP support Pooventhiran G
2026-12-02 10:27 ` [PATCH wireless-next v5 01/19] wifi: nl80211: define Seamless Mobility Domain (SMD) device capability Pooventhiran G
@ 2026-12-02 10:27 ` Pooventhiran G
2026-12-02 10:27 ` [PATCH wireless-next v5 03/19] wifi: nl80211: add ST sub-state STA flags for non-AP MLD Pooventhiran G
` (16 subsequent siblings)
18 siblings, 0 replies; 20+ messages in thread
From: Pooventhiran G @ 2026-12-02 10:27 UTC (permalink / raw)
To: Johannes Berg; +Cc: linux-wireless, linux-kernel, pooventhiran.g
From: Rohan Dutta <drohan@qti.qualcomm.com>
Define nl80211 and cfg80211 interfaces to support non-AP STA MLD
creation upon SMD negotiation. This helps the drivers to instantiate
workflows to support ST of the STA.
Signed-off-by: Rohan Dutta <drohan@qti.qualcomm.com>
Signed-off-by: Sidhanta Sahu <sidhanta.sahu@oss.qualcomm.com>
Signed-off-by: Pooventhiran G <pooventhiran.g@oss.qualcomm.com>
---
include/net/cfg80211.h | 2 ++
include/uapi/linux/nl80211.h | 8 ++++++++
net/wireless/nl80211.c | 7 +++++++
3 files changed, 17 insertions(+)
diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h
index c166f97dcf81..c17b6e128394 100644
--- a/include/net/cfg80211.h
+++ b/include/net/cfg80211.h
@@ -1920,6 +1920,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_sta: station has negotiated SMD
*/
struct station_parameters {
struct net_device *vlan;
@@ -1948,6 +1949,7 @@ struct station_parameters {
struct link_station_parameters link_sta_params;
bool epp_peer;
const u8 *nmi_mac;
+ bool smd_sta;
};
/**
diff --git a/include/uapi/linux/nl80211.h b/include/uapi/linux/nl80211.h
index 2e4b08c41587..ed64aeb13ed2 100644
--- a/include/uapi/linux/nl80211.h
+++ b/include/uapi/linux/nl80211.h
@@ -415,6 +415,9 @@
*
* Drivers can indicate userspace about the support for SMD (and ST) by setting
* %NL80211_EXT_FEATURE_SMD_SUPPORT.
+ *
+ * Userspace indicate that the non-AP MLD has negotiated SMD with the AP MLD
+ * by setting %NL80211_ATTR_SMD in %NL80211_CMD_NEW_STATION.
*/
/**
@@ -3355,6 +3358,9 @@ enum nl80211_commands {
* @NL80211_ATTR_ASSOC_PROTECTED_TWT: Enable protected TWT for the association,
* requires protected TWT support (flag attribute)
*
+ * @NL80211_ATTR_SMD: Flag attribute to indicate that the station has negotiated
+ * SMD.
+ *
* @NUM_NL80211_ATTR: total number of nl80211_attrs available
* @NL80211_ATTR_MAX: highest attribute number currently defined
* @__NL80211_ATTR_AFTER_LAST: internal use
@@ -3962,6 +3968,8 @@ enum nl80211_attrs {
NL80211_ATTR_ASSOC_PROTECTED_TWT,
+ NL80211_ATTR_SMD,
+
/* add attributes here, update the policy in nl80211.c */
__NL80211_ATTR_AFTER_LAST,
diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c
index 8a5c9dd9d0db..003e7dae87f9 100644
--- a/net/wireless/nl80211.c
+++ b/net/wireless/nl80211.c
@@ -1220,6 +1220,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] = { .type = NLA_FLAG },
};
/* policy for the key attributes */
@@ -10216,6 +10217,12 @@ static int nl80211_new_station(struct sk_buff *skb, struct genl_info *info)
params.epp_peer =
nla_get_flag(info->attrs[NL80211_ATTR_EPP_PEER]);
+ params.smd_sta = nla_get_flag(info->attrs[NL80211_ATTR_SMD]);
+ if (!wiphy_ext_feature_isset(&rdev->wiphy,
+ NL80211_EXT_FEATURE_SMD_SUPPORT) &&
+ params.smd_sta)
+ return -EINVAL;
+
err = rdev_add_station(rdev, wdev, mac_addr, ¶ms);
dev_put(params.vlan);
return err;
--
2.34.1
^ permalink raw reply [flat|nested] 20+ messages in thread
* [PATCH wireless-next v5 03/19] wifi: nl80211: add ST sub-state STA flags for non-AP MLD
2026-12-02 10:27 [PATCH wireless-next v5 00/19] wifi: Add Seamless Mobility Domain (SMD) AP support Pooventhiran G
2026-12-02 10:27 ` [PATCH wireless-next v5 01/19] wifi: nl80211: define Seamless Mobility Domain (SMD) device capability Pooventhiran G
2026-12-02 10:27 ` [PATCH wireless-next v5 02/19] wifi: nl80211/cfg80211: define interfaces for SMD STA indications Pooventhiran G
@ 2026-12-02 10:27 ` Pooventhiran G
2026-12-02 10:27 ` [PATCH wireless-next v5 04/19] wifi: cfg80211: define layouts for ST context transfer Pooventhiran G
` (15 subsequent siblings)
18 siblings, 0 replies; 20+ messages in thread
From: Pooventhiran G @ 2026-12-02 10:27 UTC (permalink / raw)
To: Johannes Berg; +Cc: linux-wireless, linux-kernel, pooventhiran.g
IEEE P802.11bn/D2.0, Aug 2026, subclause 11.3.1, defines three new MLD
state sub-states (4a, 4b, 4c) that apply when a non-AP MLD and its
associated SMD-ME are in state 4 and an ST is in progress.
Add the corresponding nl80211 STA flags to track the state changes:
- NL80211_STA_FLAG_ST_PREPARED - State 4a: non-AP MLD is prepared
with target AP MLD
- NL80211_STA_FLAG_ST_EXECUTING - State 4b: ST execution active on
current AP MLD
- NL80211_STA_FLAG_ST_DL_DRAIN - State 4c: DL draining period
Signed-off-by: Pooventhiran G <pooventhiran.g@oss.qualcomm.com>
---
include/uapi/linux/nl80211.h | 19 +++++++++++++++++++
net/wireless/nl80211.c | 25 ++++++++++++++++++-------
2 files changed, 37 insertions(+), 7 deletions(-)
diff --git a/include/uapi/linux/nl80211.h b/include/uapi/linux/nl80211.h
index ed64aeb13ed2..5ef6f704be0f 100644
--- a/include/uapi/linux/nl80211.h
+++ b/include/uapi/linux/nl80211.h
@@ -418,6 +418,17 @@
*
* Userspace indicate that the non-AP MLD has negotiated SMD with the AP MLD
* by setting %NL80211_ATTR_SMD in %NL80211_CMD_NEW_STATION.
+ *
+ * When a non-AP MLD undergoes ST, userspace can indicate the current state of
+ * ST at the current AP MLD and target AP MLD using the STA flags
+ * %NL80211_STA_FLAG_ST_PREPARED, %NL80211_STA_FLAG_ST_EXECUTING, and
+ * %NL80211_STA_FLAG_ST_DL_DRAIN.
+ * %NL80211_STA_FLAG_ST_PREPARED can be set in %NL80211_CMD_NEW_STATION
+ * on the target AP MLD while creating the station entry. Drivers must
+ * keep these links in powersave at this point until successful
+ * ST Execution.
+ * %NL80211_STA_FLAG_ST_{EXECUTING,DL_DRAIN}, on the other hand, can be
+ * set using %NL80211_CMD_SET_STATION on the current AP MLD.
*/
/**
@@ -4121,6 +4132,11 @@ 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_ST_PREPARED: station is prepared at target AP MLD
+ * (State 4a).
+ * @NL80211_STA_FLAG_ST_EXECUTING: current AP MLD is executing ST (State 4b).
+ * @NL80211_STA_FLAG_ST_DL_DRAIN: current AP MLD is in DL draining period
+ * (State 4c).
* @NL80211_STA_FLAG_MAX: highest station flag number currently defined
* @__NL80211_STA_FLAG_AFTER_LAST: internal use
*/
@@ -4135,6 +4151,9 @@ enum nl80211_sta_flags {
NL80211_STA_FLAG_ASSOCIATED,
NL80211_STA_FLAG_SPP_AMSDU,
NL80211_STA_FLAG_CIP,
+ NL80211_STA_FLAG_ST_PREPARED,
+ NL80211_STA_FLAG_ST_EXECUTING,
+ NL80211_STA_FLAG_ST_DL_DRAIN,
/* keep last */
__NL80211_STA_FLAG_AFTER_LAST,
diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c
index 003e7dae87f9..f15ddf5a94a6 100644
--- a/net/wireless/nl80211.c
+++ b/net/wireless/nl80211.c
@@ -8020,6 +8020,9 @@ static const struct nla_policy sta_flags_policy[NL80211_STA_FLAG_MAX + 1] = {
[NL80211_STA_FLAG_MFP] = { .type = NLA_FLAG },
[NL80211_STA_FLAG_AUTHENTICATED] = { .type = NLA_FLAG },
[NL80211_STA_FLAG_TDLS_PEER] = { .type = NLA_FLAG },
+ [NL80211_STA_FLAG_ST_PREPARED] = { .type = NLA_FLAG },
+ [NL80211_STA_FLAG_ST_EXECUTING] = { .type = NLA_FLAG },
+ [NL80211_STA_FLAG_ST_DL_DRAIN] = { .type = NLA_FLAG },
};
static int parse_station_flags(struct genl_info *info,
@@ -8086,11 +8089,16 @@ 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_ST_PREPARED) |
+ BIT(NL80211_STA_FLAG_ST_EXECUTING) |
+ BIT(NL80211_STA_FLAG_ST_DL_DRAIN);
+ fallthrough;
case NL80211_IFTYPE_P2P_GO:
- params->sta_flags_mask = BIT(NL80211_STA_FLAG_AUTHORIZED) |
- BIT(NL80211_STA_FLAG_SHORT_PREAMBLE) |
- BIT(NL80211_STA_FLAG_WME) |
- BIT(NL80211_STA_FLAG_MFP);
+ params->sta_flags_mask |= BIT(NL80211_STA_FLAG_AUTHORIZED) |
+ BIT(NL80211_STA_FLAG_SHORT_PREAMBLE) |
+ BIT(NL80211_STA_FLAG_WME) |
+ BIT(NL80211_STA_FLAG_MFP);
break;
case NL80211_IFTYPE_P2P_CLIENT:
case NL80211_IFTYPE_STATION:
@@ -9298,7 +9306,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 != 9);
+ BUILD_BUG_ON(NL80211_STA_FLAG_MAX != 12);
switch (statype) {
case CFG80211_STA_MESH_PEER_KERNEL:
@@ -9393,7 +9401,10 @@ int cfg80211_check_station_change(struct wiphy *wiphy,
BIT(NL80211_STA_FLAG_WME) |
BIT(NL80211_STA_FLAG_MFP) |
BIT(NL80211_STA_FLAG_SPP_AMSDU) |
- BIT(NL80211_STA_FLAG_CIP)))
+ BIT(NL80211_STA_FLAG_CIP) |
+ BIT(NL80211_STA_FLAG_ST_PREPARED) |
+ BIT(NL80211_STA_FLAG_ST_EXECUTING) |
+ BIT(NL80211_STA_FLAG_ST_DL_DRAIN)))
return -EINVAL;
/* but authenticated/associated only if driver handles it */
@@ -10096,7 +10107,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 != 9);
+ BUILD_BUG_ON(NL80211_STA_FLAG_MAX != 12);
switch (wdev->iftype) {
case NL80211_IFTYPE_AP:
--
2.34.1
^ permalink raw reply [flat|nested] 20+ messages in thread
* [PATCH wireless-next v5 04/19] wifi: cfg80211: define layouts for ST context transfer
2026-12-02 10:27 [PATCH wireless-next v5 00/19] wifi: Add Seamless Mobility Domain (SMD) AP support Pooventhiran G
` (2 preceding siblings ...)
2026-12-02 10:27 ` [PATCH wireless-next v5 03/19] wifi: nl80211: add ST sub-state STA flags for non-AP MLD Pooventhiran G
@ 2026-12-02 10:27 ` Pooventhiran G
2026-12-02 10:28 ` [PATCH wireless-next v5 05/19] wifi: nl80211: define interfaces " Pooventhiran G
` (14 subsequent siblings)
18 siblings, 0 replies; 20+ messages in thread
From: Pooventhiran G @ 2026-12-02 10:27 UTC (permalink / raw)
To: Johannes Berg; +Cc: linux-wireless, linux-kernel, pooventhiran.g
IEEE P802.11bn/D2.0, Aug 2026, subclause 37.16.9, defines the context
data to be transported during ST laid out in subclause 37.16.
The station's context data is attached to the ST Preparation or
Execution Request action frames so that userspace receives the context
along with the relevant frame.
Define the context data: per-TID sequence numbers (SN) in downlink (DL)
and uplink (UL) directions, packet number (PN) in DL, per-TID packet
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.
Signed-off-by: Pooventhiran G <pooventhiran.g@oss.qualcomm.com>
---
include/net/cfg80211.h | 72 ++++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 72 insertions(+)
diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h
index c17b6e128394..8df01cc53274 100644
--- a/include/net/cfg80211.h
+++ b/include/net/cfg80211.h
@@ -11430,4 +11430,76 @@ void cfg80211_incumbent_signal_notify(struct wiphy *wiphy,
u32 signal_interference_bitmap,
gfp_t gfp);
+/*
+ * Context information carried in SMD 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_ST_CTX_NUM_TIDS 8
+
+/**
+ * struct ieee80211_st_ctx_ba - BlockAck parameters for DL and UL
+ *
+ * @amsdu_supported: Peer's capability to support A-MSDU within A-MPDU.
+ * @ba_policy: BlockAck policy (0 = delayed BlockAck, 1 = immediate BlockAck)
+ * @buffer_size: Reorder (combined) buffer size from ADDBA Request
+ * @timeout: BlockAck session timeout
+ * @ext_no_frag: ADDBA Extension fragmentation support
+ * @extfrag_level: ADDBA Extension HE fragmentation level
+ * @winstarto: WinStartO of the BA window
+ */
+struct ieee80211_st_ctx_ba {
+ bool amsdu_supported;
+ u8 ba_policy;
+ u16 buffer_size;
+ u16 timeout;
+ bool ext_no_frag;
+ u8 extfrag_level;
+ u16 winstarto;
+};
+
+/**
+ * struct ieee80211_st_ctx - IEEE 802.11bn SMD Transition Context (refer
+ * IEEE P802.11bn/D2.0, Aug 2026, subclause 37.16.9)
+ *
+ * @no_dl_sn_transfer: if downlink (DL) SN Transfer is requested or not
+ * @no_ul_sn_transfer: if uplink (UL) SN Transfer is requested or not
+ * @pn_valid: if PN is present in the context
+ * @ba_params_valid: if BlockAck parameters are present in the context
+ * @mgmt_tid_valid: if management information is present in the context
+ * @{dl,ul}.mgmt_sn and @ul.mgmt_pn are still bounded by
+ * @no_{dl,ul}_sn_transfer and @pn_valid fields.
+ * @dl: DL context data such as SN, PN, and BlockAck params.
+ * SN and PN 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_st_ctx {
+ u8 no_dl_sn_transfer:1;
+ u8 no_ul_sn_transfer:1;
+ u8 pn_valid:1;
+ u8 ba_params_valid:1;
+ u8 mgmt_tid_valid:1;
+
+ struct {
+ u8 valid_tid_bmap;
+ u16 sn[IEEE80211_ST_CTX_NUM_TIDS];
+ u8 pn[IEEE80211_CCMP_PN_LEN];
+ struct ieee80211_st_ctx_ba ba[IEEE80211_ST_CTX_NUM_TIDS];
+ u16 mgmt_sn;
+ } dl;
+ struct {
+ u8 valid_tid_bmap;
+ u16 sn[IEEE80211_ST_CTX_NUM_TIDS];
+ u8 pn[IEEE80211_ST_CTX_NUM_TIDS][IEEE80211_CCMP_PN_LEN];
+ struct ieee80211_st_ctx_ba ba[IEEE80211_ST_CTX_NUM_TIDS];
+ u16 mgmt_sn;
+ u8 mgmt_pn[IEEE80211_CCMP_PN_LEN];
+ } ul;
+};
+
#endif /* __NET_CFG80211_H */
--
2.34.1
^ permalink raw reply [flat|nested] 20+ messages in thread
* [PATCH wireless-next v5 05/19] wifi: nl80211: define interfaces for ST context transfer
2026-12-02 10:27 [PATCH wireless-next v5 00/19] wifi: Add Seamless Mobility Domain (SMD) AP support Pooventhiran G
` (3 preceding siblings ...)
2026-12-02 10:27 ` [PATCH wireless-next v5 04/19] wifi: cfg80211: define layouts for ST context transfer Pooventhiran G
@ 2026-12-02 10:28 ` Pooventhiran G
2026-12-02 10:28 ` [PATCH wireless-next v5 06/19] wifi: ieee80211: define APIs for UHR Link Reconfiguration frame checks Pooventhiran G
` (13 subsequent siblings)
18 siblings, 0 replies; 20+ messages in thread
From: Pooventhiran G @ 2026-12-02 10:28 UTC (permalink / raw)
To: Johannes Berg; +Cc: linux-wireless, linux-kernel, pooventhiran.g
Define nl80211 attributes and policies required to pack SMD 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.
Suggested-by: Jouni Malinen <jouni.malinen@oss.qualcomm.com>
Signed-off-by: Pooventhiran G <pooventhiran.g@oss.qualcomm.com>
---
include/uapi/linux/nl80211.h | 161 +++++++++++++++++++++++++++++++++++++++++++
net/wireless/nl80211.c | 40 +++++++++++
2 files changed, 201 insertions(+)
diff --git a/include/uapi/linux/nl80211.h b/include/uapi/linux/nl80211.h
index 5ef6f704be0f..0e59769161dc 100644
--- a/include/uapi/linux/nl80211.h
+++ b/include/uapi/linux/nl80211.h
@@ -429,6 +429,19 @@
* ST Execution.
* %NL80211_STA_FLAG_ST_{EXECUTING,DL_DRAIN}, on the other hand, can be
* set using %NL80211_CMD_SET_STATION on the current AP MLD.
+ *
+ * Drivers can use %NL80211_ATTR_ST_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_ST_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_ST_CTX and the response can be reported back using
+ * %NL80211_CMD_ST_CTX_EVENT.
*/
/**
@@ -1589,6 +1602,19 @@
* addresses (%NL80211_ATTR_MLO_LINKS, each nested link with
* %NL80211_ATTR_MLO_LINK_ID, %NL80211_ATTR_BSSID and %NL80211_ATTR_MAC).
*
+ * @NL80211_CMD_SET_ST_CTX: Set the ST 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_ST_CTX_TYPE,
+ * and %NL80211_ATTR_ST_CTX. The station must be present on the target AP
+ * MLD in the "prepared" state with a default key installed.
+ * @NL80211_CMD_GET_ST_CTX: Get the ST 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_ST_CTX_TYPE.
+ * @NL80211_CMD_ST_CTX_EVENT: Event reporting the collected ST context
+ * (requested via %NL80211_CMD_GET_ST_CTX) to userspace. It carries
+ * %NL80211_ATTR_MLD_ADDR, %NL80211_ATTR_ST_CTX_TYPE, and
+ * %NL80211_ATTR_ST_CTX.
+ *
* @NL80211_CMD_MAX: highest used command number
* @__NL80211_CMD_AFTER_LAST: internal use
*/
@@ -1876,6 +1902,10 @@ enum nl80211_commands {
NL80211_CMD_EXECUTE_SMD_TRANSITION,
NL80211_CMD_COMPLETED_SMD_TRANSITION,
+ NL80211_CMD_SET_ST_CTX,
+ NL80211_CMD_GET_ST_CTX,
+ NL80211_CMD_ST_CTX_EVENT,
+
/* add new commands above here */
/* used to define NL80211_CMD_MAX below */
@@ -3371,6 +3401,12 @@ enum nl80211_commands {
*
* @NL80211_ATTR_SMD: Flag attribute to indicate that the station has negotiated
* SMD.
+ * @NL80211_ATTR_ST_CTX: Nested attribute associated with ST context data.
+ * Used with %NL80211_CMD_FRAME, %NL80211_CMD_SET_ST_CTX, and
+ * %NL80211_CMD_ST_CTX_EVENT. See &enum nl80211_st_ctx.
+ * @NL80211_ATTR_ST_CTX_TYPE: u8 attribute specifying the type of ST context.
+ * Used with %NL80211_CMD_FRAME, %NL80211_CMD_SET_ST_CTX,
+ * %NL80211_CMD_GET_ST_CTX, and %NL80211_CMD_ST_CTX_EVENT.
*
* @NUM_NL80211_ATTR: total number of nl80211_attrs available
* @NL80211_ATTR_MAX: highest attribute number currently defined
@@ -3980,6 +4016,8 @@ enum nl80211_attrs {
NL80211_ATTR_ASSOC_PROTECTED_TWT,
NL80211_ATTR_SMD,
+ NL80211_ATTR_ST_CTX,
+ NL80211_ATTR_ST_CTX_TYPE,
/* add attributes here, update the policy in nl80211.c */
@@ -9343,4 +9381,127 @@ enum nl80211_nan_peer_map_attrs {
#define NL80211_NAN_SCHED_NOT_AVAIL_SLOT 0xff
+/**
+ * enum nl80211_st_ctx_type - ST Request Type values
+ *
+ * Used with %NL80211_ATTR_ST_CTX_TYPE.
+ *
+ * @NL80211_ST_CTX_TYPE_PREP: ST Preparation.
+ * @NL80211_ST_CTX_TYPE_EXEC: ST Execution.
+ * @NUM_ST_CTX_TYPES: internal.
+ * @NL80211_ST_CTX_TYPE_MAX: Max type of ST context.
+ */
+enum nl80211_st_ctx_type {
+ NL80211_ST_CTX_TYPE_PREP,
+ NL80211_ST_CTX_TYPE_EXEC,
+
+ NUM_ST_CTX_TYPES,
+ NL80211_ST_CTX_TYPE_MAX = NUM_ST_CTX_TYPES - 1,
+};
+
+/**
+ * enum nl80211_st_ctx_ba_param - ST Block Ack Context attributes
+ *
+ * @__NL80211_ST_CTX_BA_ATTR_INVALID: Invalid attribute.
+ * @NL80211_ST_CTX_BA_ATTR_BUFF_SIZE: Required (u16) full BA buffer size.
+ * @NL80211_ST_CTX_BA_ATTR_POLICY: Required (u8) BA policy.
+ * @NL80211_ST_CTX_BA_ATTR_AMSDU_SUPPORT: Flag attribute to indicate
+ * AMSDU support.
+ * @NL80211_ST_CTX_BA_ATTR_TIMEOUT: Required (u16) Block Ack timeout.
+ * @NL80211_ST_CTX_BA_ATTR_EXT_NO_FRAG: Flag attribute to indicate
+ * fragmentation support.
+ * @NL80211_ST_CTX_BA_ATTR_EXT_FRAG_LEVEL: Required (u8) HE fragmentation
+ * level.
+ * @NL80211_ST_CTX_BA_ATTR_WINSTARTO: Required (u16) Starting Sequence Number
+ * of the BA window.
+ * Applicable only when %NL80211_ST_CTX_INFO_ATTR_BA_PARAMS is used with
+ * %NL80211_ST_CTX_ATTR_DL.
+ * @__NL80211_ST_CTX_BA_ATTR_LAST: Last attribute, used internally.
+ * @NL80211_ST_CTX_BA_ATTR_MAX: Max attribute.
+ *
+ * Used with %NL80211_ST_CTX_INFO_ATTR_BA_PARAMS.
+ */
+enum nl80211_st_ctx_ba_param {
+ __NL80211_ST_CTX_BA_ATTR_INVALID,
+ NL80211_ST_CTX_BA_ATTR_BUFF_SIZE,
+ NL80211_ST_CTX_BA_ATTR_POLICY,
+ NL80211_ST_CTX_BA_ATTR_AMSDU_SUPPORT,
+ NL80211_ST_CTX_BA_ATTR_TIMEOUT,
+ NL80211_ST_CTX_BA_ATTR_EXT_NO_FRAG,
+ NL80211_ST_CTX_BA_ATTR_EXT_FRAG_LEVEL,
+ NL80211_ST_CTX_BA_ATTR_WINSTARTO,
+
+ __NL80211_ST_CTX_BA_ATTR_LAST,
+ NL80211_ST_CTX_BA_ATTR_MAX = __NL80211_ST_CTX_BA_ATTR_LAST - 1
+};
+
+/**
+ * enum nl80211_st_ctx_info - ST Dynamic Context Information
+ *
+ * @__NL80211_ST_CTX_INFO_ATTR_INVALID: Invalid attribute.
+ * @NL80211_ST_CTX_INFO_ATTR_SN: Optional (nested), next SN per-TID to be
+ * assigned or last SN received per-TID for DL/UL individually addressed
+ * frames.
+ * @NL80211_ST_CTX_INFO_ATTR_SN_PER_TID: Per-TID SN (u16) used with
+ * %NL80211_ST_CTX_INFO_ATTR_SN nest.
+ * @NL80211_ST_CTX_INFO_ATTR_BA_PARAMS: Optional (nested) Block Ack parameters
+ * in DL/UL (uses &enum nl80211_st_ctx_ba_param).
+ * @NL80211_ST_CTX_INFO_ATTR_MGMT_SN: Optional (u16) next SN to be assigned or
+ * last SN received for DL/UL individually addressed management frames.
+ * @NL80211_ST_CTX_INFO_ATTR_DL_PN: Optional (binary) starting PN for
+ * DL individually addressed frames.
+ * @NL80211_ST_CTX_INFO_ATTR_UL_PN: Optional (nested) last PN received per TID
+ * for UL individually addressed frames.
+ * @NL80211_ST_CTX_INFO_ATTR_UL_PN_PER_TID: Per-TID UL PN (binary) used
+ * with %NL80211_ST_CTX_INFO_ATTR_UL_PN nest.
+ * @NL80211_ST_CTX_INFO_ATTR_UL_MGMT_PN: Optional (binary) last PN
+ * received for UL individually addressed management frames.
+ * @__NL80211_ST_CTX_INFO_ATTR_LAST: Last attribute, used internally.
+ * @NL80211_ST_CTX_INFO_ATTR_MAX: Max attribute.
+ *
+ * This defines the namespace for context information that are either common to
+ * both DL and UL, or direction-specific. Used with %NL80211_ST_CTX_ATTR_DL and
+ * %NL80211_ST_CTX_ATTR_UL, appropriately.
+ */
+enum nl80211_st_ctx_info {
+ __NL80211_ST_CTX_INFO_ATTR_INVALID,
+ NL80211_ST_CTX_INFO_ATTR_SN,
+ NL80211_ST_CTX_INFO_ATTR_SN_PER_TID,
+ NL80211_ST_CTX_INFO_ATTR_BA_PARAMS,
+ NL80211_ST_CTX_INFO_ATTR_MGMT_SN,
+ NL80211_ST_CTX_INFO_ATTR_DL_PN,
+ NL80211_ST_CTX_INFO_ATTR_UL_PN,
+ NL80211_ST_CTX_INFO_ATTR_UL_PN_PER_TID,
+ NL80211_ST_CTX_INFO_ATTR_UL_MGMT_PN,
+
+ __NL80211_ST_CTX_INFO_ATTR_LAST,
+ NL80211_ST_CTX_INFO_ATTR_MAX = __NL80211_ST_CTX_INFO_ATTR_LAST - 1
+};
+
+/**
+ * enum nl80211_st_ctx - ST Context information
+ *
+ * Top-level container for SMD Transition dynamic context. Carried in
+ * %NL80211_ATTR_ST_CTX with %NL80211_CMD_SET_ST_CTX (target AP MLD) or
+ * with %NL80211_CMD_FRAME (current AP MLD reporting context to userspace)
+ * and %NL80211_CMD_ST_CTX_EVENT (current AP MLD reporting the requested
+ * context on behalf of the target AP MLD).
+ *
+ * @__NL80211_ST_CTX_ATTR_INVALID: Invalid attribute.
+ * @NL80211_ST_CTX_ATTR_DL: Optional (nested) DL parameters.
+ * See &enum nl80211_st_ctx_dl.
+ * @NL80211_ST_CTX_ATTR_UL: Optional (nested) UL parameters.
+ * See &enum nl80211_st_ctx_ul.
+ * @__NL80211_ST_CTX_ATTR_LAST: Last attribute, used internally.
+ * @NL80211_ST_CTX_ATTR_MAX: Max attribute.
+ */
+enum nl80211_st_ctx {
+ __NL80211_ST_CTX_ATTR_INVALID,
+ NL80211_ST_CTX_ATTR_DL,
+ NL80211_ST_CTX_ATTR_UL,
+
+ __NL80211_ST_CTX_ATTR_LAST,
+ NL80211_ST_CTX_ATTR_MAX = __NL80211_ST_CTX_ATTR_LAST - 1
+};
+
#endif /* __LINUX_NL80211_H */
diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c
index f15ddf5a94a6..3e51ce0155d3 100644
--- a/net/wireless/nl80211.c
+++ b/net/wireless/nl80211.c
@@ -808,6 +808,43 @@ nl80211_nan_conf_policy[NL80211_NAN_CONF_ATTR_MAX + 1] = {
[NL80211_NAN_CONF_INSTANT_COMM] = { .type = NLA_FLAG },
};
+static const struct nla_policy
+nl80211_st_ctx_ba_policy[NL80211_ST_CTX_BA_ATTR_MAX + 1] = {
+ [NL80211_ST_CTX_BA_ATTR_BUFF_SIZE] = { .type = NLA_U16 },
+ [NL80211_ST_CTX_BA_ATTR_POLICY] = { .type = NLA_U8 },
+ [NL80211_ST_CTX_BA_ATTR_AMSDU_SUPPORT] = { .type = NLA_FLAG },
+ [NL80211_ST_CTX_BA_ATTR_TIMEOUT] = { .type = NLA_U16 },
+ [NL80211_ST_CTX_BA_ATTR_EXT_NO_FRAG] = { .type = NLA_FLAG },
+ [NL80211_ST_CTX_BA_ATTR_EXT_FRAG_LEVEL] = { .type = NLA_U8 },
+ [NL80211_ST_CTX_BA_ATTR_WINSTARTO] = { .type = NLA_U16 },
+};
+
+static const struct nla_policy
+nl80211_st_ctx_info_policy[NL80211_ST_CTX_INFO_ATTR_MAX + 1] = {
+ [NL80211_ST_CTX_INFO_ATTR_SN] =
+ NLA_POLICY_NESTED_ARRAY(nl80211_st_ctx_info_policy),
+ [NL80211_ST_CTX_INFO_ATTR_SN_PER_TID] = { .type = NLA_U16 },
+ [NL80211_ST_CTX_INFO_ATTR_BA_PARAMS] =
+ NLA_POLICY_NESTED_ARRAY(nl80211_st_ctx_ba_policy),
+ [NL80211_ST_CTX_INFO_ATTR_MGMT_SN] = { .type = NLA_U16 },
+ [NL80211_ST_CTX_INFO_ATTR_DL_PN] =
+ NLA_POLICY_EXACT_LEN(IEEE80211_CCMP_PN_LEN),
+ [NL80211_ST_CTX_INFO_ATTR_UL_PN] =
+ NLA_POLICY_NESTED_ARRAY(nl80211_st_ctx_info_policy),
+ [NL80211_ST_CTX_INFO_ATTR_UL_PN_PER_TID] =
+ NLA_POLICY_EXACT_LEN(IEEE80211_CCMP_PN_LEN),
+ [NL80211_ST_CTX_INFO_ATTR_UL_MGMT_PN] =
+ NLA_POLICY_EXACT_LEN(IEEE80211_CCMP_PN_LEN),
+};
+
+static const struct nla_policy
+nl80211_st_ctx_policy[NL80211_ST_CTX_ATTR_MAX + 1] = {
+ [NL80211_ST_CTX_ATTR_DL] =
+ NLA_POLICY_NESTED(nl80211_st_ctx_info_policy),
+ [NL80211_ST_CTX_ATTR_UL] =
+ NLA_POLICY_NESTED(nl80211_st_ctx_info_policy),
+};
+
static const struct netlink_range_validation nl80211_punct_bitmap_range = {
.min = 0,
.max = 0xffff,
@@ -1221,6 +1258,9 @@ static const struct nla_policy nl80211_policy[NUM_NL80211_ATTR] = {
[NL80211_ATTR_CIP_CAPABILITIES] = { .type = NLA_U8 },
[NL80211_ATTR_ASSOC_PROTECTED_TWT] = { .type = NLA_FLAG },
[NL80211_ATTR_SMD] = { .type = NLA_FLAG },
+ [NL80211_ATTR_ST_CTX] = NLA_POLICY_NESTED(nl80211_st_ctx_policy),
+ [NL80211_ATTR_ST_CTX_TYPE] =
+ NLA_POLICY_MAX(NLA_U8, NL80211_ST_CTX_TYPE_MAX),
};
/* policy for the key attributes */
--
2.34.1
^ permalink raw reply [flat|nested] 20+ messages in thread
* [PATCH wireless-next v5 06/19] wifi: ieee80211: define APIs for UHR Link Reconfiguration frame checks
2026-12-02 10:27 [PATCH wireless-next v5 00/19] wifi: Add Seamless Mobility Domain (SMD) AP support Pooventhiran G
` (4 preceding siblings ...)
2026-12-02 10:28 ` [PATCH wireless-next v5 05/19] wifi: nl80211: define interfaces " Pooventhiran G
@ 2026-12-02 10:28 ` Pooventhiran G
2026-12-02 10:28 ` [PATCH wireless-next v5 07/19] wifi: ieee80211: define API to check if frame is class 3 Pooventhiran G
` (12 subsequent siblings)
18 siblings, 0 replies; 20+ messages in thread
From: Pooventhiran G @ 2026-12-02 10:28 UTC (permalink / raw)
To: Johannes Berg; +Cc: linux-wireless, linux-kernel, pooventhiran.g
Add APIs necessary to check whether the frame is a UHR Link
Reconfiguration Request/Response/Notify frame and subtypes to invoke
necessary SMD Transition handling on the AP MLD.
Signed-off-by: Pooventhiran G <pooventhiran.g@oss.qualcomm.com>
---
include/linux/ieee80211-uhr.h | 125 ++++++++++++++++++++++++++++++++++++++++++
1 file changed, 125 insertions(+)
diff --git a/include/linux/ieee80211-uhr.h b/include/linux/ieee80211-uhr.h
index b9e592e7b8bf..aefb5444c5f9 100644
--- a/include/linux/ieee80211-uhr.h
+++ b/include/linux/ieee80211-uhr.h
@@ -690,6 +690,131 @@ ieee80211_uhr_mode_change_tuple_next(const struct ieee80211_uhr_mode_change_tupl
return (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( \
--
2.34.1
^ permalink raw reply [flat|nested] 20+ messages in thread
* [PATCH wireless-next v5 07/19] wifi: ieee80211: define API to check if frame is class 3
2026-12-02 10:27 [PATCH wireless-next v5 00/19] wifi: Add Seamless Mobility Domain (SMD) AP support Pooventhiran G
` (5 preceding siblings ...)
2026-12-02 10:28 ` [PATCH wireless-next v5 06/19] wifi: ieee80211: define APIs for UHR Link Reconfiguration frame checks Pooventhiran G
@ 2026-12-02 10:28 ` Pooventhiran G
2026-12-02 10:28 ` [PATCH wireless-next v5 08/19] wifi: nl80211/cfg80211: pack ST dynamic context along with frame Pooventhiran G
` (11 subsequent siblings)
18 siblings, 0 replies; 20+ messages in thread
From: Pooventhiran G @ 2026-12-02 10:28 UTC (permalink / raw)
To: Johannes Berg; +Cc: linux-wireless, linux-kernel, pooventhiran.g
IEEE 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.
Signed-off-by: Pooventhiran G <pooventhiran.g@oss.qualcomm.com>
---
include/linux/ieee80211.h | 43 +++++++++++++++++++++++++++++++++++++++++++
1 file changed, 43 insertions(+)
diff --git a/include/linux/ieee80211.h b/include/linux/ieee80211.h
index 3ac98fbd6146..3a916b8e4b6e 100644
--- a/include/linux/ieee80211.h
+++ b/include/linux/ieee80211.h
@@ -2941,4 +2941,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 */
--
2.34.1
^ permalink raw reply [flat|nested] 20+ messages in thread
* [PATCH wireless-next v5 08/19] wifi: nl80211/cfg80211: pack ST dynamic context along with frame
2026-12-02 10:27 [PATCH wireless-next v5 00/19] wifi: Add Seamless Mobility Domain (SMD) AP support Pooventhiran G
` (6 preceding siblings ...)
2026-12-02 10:28 ` [PATCH wireless-next v5 07/19] wifi: ieee80211: define API to check if frame is class 3 Pooventhiran G
@ 2026-12-02 10:28 ` Pooventhiran G
2026-12-02 10:28 ` [PATCH wireless-next v5 09/19] wifi: nl80211/cfg80211: add support for ST context programming Pooventhiran G
` (10 subsequent siblings)
18 siblings, 0 replies; 20+ messages in thread
From: Pooventhiran G @ 2026-12-02 10:28 UTC (permalink / raw)
To: Johannes Berg; +Cc: linux-wireless, linux-kernel, pooventhiran.g
While packing the received management frame in nl80211_send_mgmt() to
send to userspace, nest the ST dynamic context along with the frame
message. This shall be used by userspace to transport the context to the
target AP MLD for programming the dynamic state of the STA session for
seamless roaming as part of ST.
Suggested-by: Jouni Malinen <jouni.malinen@oss.qualcomm.com>
Co-developed-by: Aditya Sathish <asathish@qti.qualcomm.com>
Signed-off-by: Aditya Sathish <asathish@qti.qualcomm.com>
Signed-off-by: Pooventhiran G <pooventhiran.g@oss.qualcomm.com>
---
include/net/cfg80211.h | 13 ++++
net/wireless/nl80211.c | 191 ++++++++++++++++++++++++++++++++++++++++++++++++-
2 files changed, 203 insertions(+), 1 deletion(-)
diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h
index 8df01cc53274..ade029268548 100644
--- a/include/net/cfg80211.h
+++ b/include/net/cfg80211.h
@@ -4926,6 +4926,17 @@ struct mgmt_frame_regs {
u32 global_mcast_stypes, interface_mcast_stypes;
};
+/**
+ * struct cfg80211_smd_transition_info - SMD Transition info
+ *
+ * @ctx: Dynamic context to be transferred as part of ST
+ * @type: Type of ST indication
+ */
+struct cfg80211_smd_transition_info {
+ struct ieee80211_st_ctx *ctx;
+ enum nl80211_st_ctx_type type;
+};
+
/**
* struct cfg80211_ops - backend description for wireless configuration
*
@@ -9740,6 +9751,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 Transition data
*/
struct cfg80211_rx_info {
int freq;
@@ -9752,6 +9764,7 @@ struct cfg80211_rx_info {
u64 rx_tstamp;
u64 ack_tstamp;
bool no_sta;
+ struct cfg80211_smd_transition_info st_info;
};
/**
diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c
index 3e51ce0155d3..bf81d67f42ac 100644
--- a/net/wireless/nl80211.c
+++ b/net/wireless/nl80211.c
@@ -20234,6 +20234,191 @@ static int nl80211_abandon_st(struct sk_buff *skb, struct genl_info *info)
info->attrs[NL80211_ATTR_LOCAL_STATE_CHANGE]);
}
+static int
+nl80211_put_st_ctx_ba_params(struct sk_buff *msg, unsigned long tid_bmap,
+ const struct ieee80211_st_ctx_ba *ba_tids,
+ bool dl)
+{
+ struct nlattr *ctx_ba;
+ u8 tid;
+
+ ctx_ba = nla_nest_start(msg, NL80211_ST_CTX_INFO_ATTR_BA_PARAMS);
+ if (!ctx_ba)
+ return -ENOBUFS;
+
+ for_each_set_bit(tid, &tid_bmap, IEEE80211_ST_CTX_NUM_TIDS) {
+ const struct ieee80211_st_ctx_ba *ba = &ba_tids[tid];
+ struct nlattr *tid_ba = nla_nest_start(msg, tid + 1);
+
+ if (!tid_ba)
+ goto nla_fail;
+
+ if (nla_put_u16(msg, NL80211_ST_CTX_BA_ATTR_BUFF_SIZE,
+ ba->buffer_size) ||
+ nla_put_u8(msg, NL80211_ST_CTX_BA_ATTR_POLICY,
+ ba->ba_policy) ||
+ (ba->amsdu_supported &&
+ nla_put_flag(msg,
+ NL80211_ST_CTX_BA_ATTR_AMSDU_SUPPORT)) ||
+ nla_put_u16(msg, NL80211_ST_CTX_BA_ATTR_TIMEOUT,
+ ba->timeout) ||
+ (ba->ext_no_frag &&
+ nla_put_flag(msg, NL80211_ST_CTX_BA_ATTR_EXT_NO_FRAG)) ||
+ nla_put_u8(msg, NL80211_ST_CTX_BA_ATTR_EXT_FRAG_LEVEL,
+ ba->extfrag_level) ||
+ (dl && nla_put_u16(msg, NL80211_ST_CTX_BA_ATTR_WINSTARTO,
+ ba->winstarto))) {
+ nla_nest_cancel(msg, tid_ba);
+ goto nla_fail;
+ }
+
+ nla_nest_end(msg, tid_ba);
+ }
+
+ nla_nest_end(msg, ctx_ba);
+ return 0;
+
+nla_fail:
+ return -ENOBUFS;
+}
+
+static int nl80211_put_st_ctx(struct sk_buff *msg,
+ struct cfg80211_smd_transition_info *st_info)
+{
+ unsigned long dl_tid_bmap, ul_tid_bmap;
+ const struct ieee80211_st_ctx *ctx;
+ struct nlattr *st_ctx, *dl, *ul;
+
+ /* ST Type */
+ if (nla_put_u8(msg, NL80211_ATTR_ST_CTX_TYPE, st_info->type))
+ goto nla_fail;
+
+ st_ctx = nla_nest_start(msg, NL80211_ATTR_ST_CTX);
+ if (!st_ctx)
+ goto nla_fail;
+
+ ctx = st_info->ctx;
+
+ /* Build DL context */
+ dl_tid_bmap = ctx->dl.valid_tid_bmap;
+
+ dl = nla_nest_start(msg, NL80211_ST_CTX_ATTR_DL);
+ if (!dl)
+ goto nla_fail;
+
+ if (!ctx->no_dl_sn_transfer) {
+ struct nlattr *dl_sn =
+ nla_nest_start(msg, NL80211_ST_CTX_INFO_ATTR_SN);
+ u8 tid;
+
+ if (!dl_sn)
+ goto nla_fail;
+
+ for_each_set_bit(tid, &dl_tid_bmap,
+ IEEE80211_ST_CTX_NUM_TIDS) {
+ struct nlattr *tid_sn = nla_nest_start(msg, tid + 1);
+
+ if (!tid_sn ||
+ nla_put_u16(msg, NL80211_ST_CTX_INFO_ATTR_SN_PER_TID,
+ ctx->dl.sn[tid]))
+ goto nla_fail;
+
+ nla_nest_end(msg, tid_sn);
+ }
+ nla_nest_end(msg, dl_sn);
+ }
+
+ if (ctx->pn_valid &&
+ nla_put(msg, NL80211_ST_CTX_INFO_ATTR_DL_PN,
+ IEEE80211_CCMP_PN_LEN, ctx->dl.pn))
+ goto nla_fail;
+
+ if (ctx->ba_params_valid &&
+ nl80211_put_st_ctx_ba_params(msg, dl_tid_bmap, ctx->dl.ba, true))
+ goto nla_fail;
+
+ if (!ctx->no_dl_sn_transfer && ctx->mgmt_tid_valid &&
+ nla_put_u16(msg, NL80211_ST_CTX_INFO_ATTR_MGMT_SN, ctx->dl.mgmt_sn))
+ goto nla_fail;
+
+ nla_nest_end(msg, dl);
+
+ /* Build UL context */
+ ul_tid_bmap = ctx->ul.valid_tid_bmap;
+
+ ul = nla_nest_start(msg, NL80211_ST_CTX_ATTR_UL);
+ if (!ul)
+ goto nla_fail;
+
+ if (!ctx->no_ul_sn_transfer) {
+ struct nlattr *ul_sn =
+ nla_nest_start(msg, NL80211_ST_CTX_INFO_ATTR_SN);
+ u8 tid;
+
+ if (!ul_sn)
+ goto nla_fail;
+
+ for_each_set_bit(tid, &ul_tid_bmap,
+ IEEE80211_ST_CTX_NUM_TIDS) {
+ struct nlattr *tid_sn = nla_nest_start(msg, tid + 1);
+
+ if (!tid_sn ||
+ nla_put_u16(msg, NL80211_ST_CTX_INFO_ATTR_SN_PER_TID,
+ ctx->ul.sn[tid]))
+ goto nla_fail;
+
+ nla_nest_end(msg, tid_sn);
+ }
+ nla_nest_end(msg, ul_sn);
+ }
+
+ if (ctx->pn_valid) {
+ struct nlattr *ul_pn =
+ nla_nest_start(msg, NL80211_ST_CTX_INFO_ATTR_UL_PN);
+ u8 tid;
+
+ if (!ul_pn)
+ goto nla_fail;
+
+ for_each_set_bit(tid, &ul_tid_bmap,
+ IEEE80211_ST_CTX_NUM_TIDS) {
+ struct nlattr *tid_pn = nla_nest_start(msg, tid + 1);
+
+ if (!tid_pn ||
+ nla_put(msg, NL80211_ST_CTX_INFO_ATTR_UL_PN_PER_TID,
+ IEEE80211_CCMP_PN_LEN, ctx->ul.pn[tid]))
+ goto nla_fail;
+ nla_nest_end(msg, tid_pn);
+ }
+ nla_nest_end(msg, ul_pn);
+ }
+
+ if (ctx->ba_params_valid &&
+ nl80211_put_st_ctx_ba_params(msg, ul_tid_bmap, ctx->ul.ba, false))
+ goto nla_fail;
+
+ if (ctx->mgmt_tid_valid) {
+ if (!ctx->no_ul_sn_transfer &&
+ nla_put_u16(msg, NL80211_ST_CTX_INFO_ATTR_MGMT_SN,
+ ctx->ul.mgmt_sn))
+ goto nla_fail;
+
+ if (ctx->pn_valid &&
+ nla_put(msg, NL80211_ST_CTX_INFO_ATTR_UL_MGMT_PN,
+ IEEE80211_CCMP_PN_LEN, ctx->ul.mgmt_pn))
+ goto nla_fail;
+ }
+
+ nla_nest_end(msg, ul);
+
+ nla_nest_end(msg, st_ctx);
+
+ return 0;
+
+nla_fail:
+ return -ENOBUFS;
+}
+
#define NL80211_FLAG_NEED_WIPHY 0x01
#define NL80211_FLAG_NEED_NETDEV 0x02
#define NL80211_FLAG_NEED_RTNL 0x04
@@ -23157,7 +23342,7 @@ int nl80211_send_mgmt(struct cfg80211_registered_device *rdev,
struct sk_buff *msg;
void *hdr;
- msg = nlmsg_new(100 + info->len, gfp);
+ msg = nlmsg_new(NLMSG_DEFAULT_SIZE, gfp);
if (!msg)
return -ENOMEM;
@@ -23193,6 +23378,10 @@ int nl80211_send_mgmt(struct cfg80211_registered_device *rdev,
nla_put_flag(msg, NL80211_ATTR_FRAME_NO_STA)))
goto nla_put_failure;
+ if (info->st_info.ctx &&
+ nl80211_put_st_ctx(msg, &info->st_info))
+ goto nla_put_failure;
+
genlmsg_end(msg, hdr);
return genlmsg_unicast(wiphy_net(&rdev->wiphy), msg, nlportid);
--
2.34.1
^ permalink raw reply [flat|nested] 20+ messages in thread
* [PATCH wireless-next v5 09/19] wifi: nl80211/cfg80211: add support for ST context programming
2026-12-02 10:27 [PATCH wireless-next v5 00/19] wifi: Add Seamless Mobility Domain (SMD) AP support Pooventhiran G
` (7 preceding siblings ...)
2026-12-02 10:28 ` [PATCH wireless-next v5 08/19] wifi: nl80211/cfg80211: pack ST dynamic context along with frame Pooventhiran G
@ 2026-12-02 10:28 ` Pooventhiran G
2026-12-02 10:28 ` [PATCH wireless-next v5 10/19] wifi: nl80211/cfg80211: add support for querying ST context for target AP MLD Pooventhiran G
` (9 subsequent siblings)
18 siblings, 0 replies; 20+ messages in thread
From: Pooventhiran G @ 2026-12-02 10:28 UTC (permalink / raw)
To: Johannes Berg; +Cc: linux-wireless, linux-kernel, pooventhiran.g
On the target AP MLD to which the STA will be transitioning, the dynamic
context collected and sent by the current AP MLD needs to be programmed
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_ST_CTX, parse the ST
context attributes, and invoke the cfg80211 operation on the target AP
MLD.
Signed-off-by: Pooventhiran G <pooventhiran.g@oss.qualcomm.com>
---
include/net/cfg80211.h | 7 ++
net/wireless/nl80211.c | 323 ++++++++++++++++++++++++++++++++++++++++++++++++
net/wireless/rdev-ops.h | 14 +++
net/wireless/trace.h | 34 +++++
4 files changed, 378 insertions(+)
diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h
index ade029268548..5269719c8d15 100644
--- a/include/net/cfg80211.h
+++ b/include/net/cfg80211.h
@@ -5407,6 +5407,10 @@ struct cfg80211_smd_transition_info {
* @execute_st: Execute a previously prepared SMD transition
* @abandon_st: Abandon a prepared SMD transition to the given AP MLD.
* If @local_only is true don't send the ST abandon action frame.
+ *
+ * @set_st_ctx: Set ST context data for the non-AP MLD. @st_info->ctx is freed
+ * immediately after this call returns; drivers must copy @st_info->ctx
+ * if asynchronous processing is required.
*/
struct cfg80211_ops {
int (*suspend)(struct wiphy *wiphy, struct cfg80211_wowlan *wow);
@@ -5811,6 +5815,9 @@ struct cfg80211_ops {
struct cfg80211_st_exec_request *req);
int (*abandon_st)(struct wiphy *wiphy, struct net_device *dev,
const u8 *ap_mld_addr, bool local_only);
+ int (*set_st_ctx)(struct wiphy *wiphy, struct wireless_dev *wdev,
+ const u8 *addr,
+ struct cfg80211_smd_transition_info *st_info);
};
/*
diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c
index bf81d67f42ac..f76198cc0e84 100644
--- a/net/wireless/nl80211.c
+++ b/net/wireless/nl80211.c
@@ -20419,6 +20419,286 @@ static int nl80211_put_st_ctx(struct sk_buff *msg,
return -ENOBUFS;
}
+static int nl80211_parse_st_ctx_ba_params(struct nlattr *tb,
+ struct ieee80211_st_ctx_ba *ba_tids,
+ u8 *valid_tid_bmap)
+{
+ struct nlattr *ba_attr;
+ int n_tids = 0;
+ int rem;
+
+ nla_for_each_nested(ba_attr, tb, rem) {
+ struct nlattr *ba_tb[NL80211_ST_CTX_BA_ATTR_MAX + 1];
+ struct ieee80211_st_ctx_ba *ba;
+ int tid = nla_type(ba_attr) - 1;
+
+ if (tid < 0 || tid >= IEEE80211_ST_CTX_NUM_TIDS)
+ return -EINVAL;
+
+ nla_parse_nested(ba_tb, NL80211_ST_CTX_BA_ATTR_MAX,
+ ba_attr, NULL, NULL);
+
+ ba = &ba_tids[tid];
+
+ if (ba_tb[NL80211_ST_CTX_BA_ATTR_BUFF_SIZE])
+ ba->buffer_size =
+ nla_get_u16(ba_tb[NL80211_ST_CTX_BA_ATTR_BUFF_SIZE]);
+
+ if (ba_tb[NL80211_ST_CTX_BA_ATTR_POLICY])
+ ba->ba_policy =
+ nla_get_u8(ba_tb[NL80211_ST_CTX_BA_ATTR_POLICY]);
+
+ ba->amsdu_supported =
+ nla_get_flag(ba_tb[NL80211_ST_CTX_BA_ATTR_AMSDU_SUPPORT]);
+
+ if (ba_tb[NL80211_ST_CTX_BA_ATTR_TIMEOUT])
+ ba->timeout =
+ nla_get_u16(ba_tb[NL80211_ST_CTX_BA_ATTR_TIMEOUT]);
+
+ ba->ext_no_frag =
+ nla_get_flag(ba_tb[NL80211_ST_CTX_BA_ATTR_EXT_NO_FRAG]);
+
+ if (ba_tb[NL80211_ST_CTX_BA_ATTR_EXT_FRAG_LEVEL])
+ ba->extfrag_level =
+ nla_get_u8(ba_tb[NL80211_ST_CTX_BA_ATTR_EXT_FRAG_LEVEL]);
+
+ if (ba_tb[NL80211_ST_CTX_BA_ATTR_WINSTARTO])
+ ba->winstarto =
+ nla_get_u16(ba_tb[NL80211_ST_CTX_BA_ATTR_WINSTARTO]);
+
+ *valid_tid_bmap |= BIT(tid);
+ n_tids++;
+ }
+
+ if (!n_tids)
+ return -EINVAL;
+
+ return 0;
+}
+
+static int nl80211_parse_st_ctx(struct genl_info *info,
+ struct cfg80211_smd_transition_info *st_info)
+{
+ struct nlattr *ctx_tb[NL80211_ST_CTX_INFO_ATTR_MAX + 1];
+ struct nlattr *tb[NL80211_ST_CTX_ATTR_MAX + 1];
+ struct ieee80211_st_ctx *ctx;
+ struct nlattr *ba_attr;
+
+ st_info->ctx = NULL;
+
+ ctx = kzalloc_obj(*ctx);
+ if (!ctx)
+ return -ENOMEM;
+
+ nla_parse_nested(tb, NL80211_ST_CTX_ATTR_MAX,
+ info->attrs[NL80211_ATTR_ST_CTX], NULL, NULL);
+
+ ctx->no_dl_sn_transfer = 1;
+ ctx->no_ul_sn_transfer = 1;
+
+ /* DL Context */
+ if (tb[NL80211_ST_CTX_ATTR_DL]) {
+ nla_parse_nested(ctx_tb, NL80211_ST_CTX_INFO_ATTR_MAX,
+ tb[NL80211_ST_CTX_ATTR_DL], NULL, NULL);
+
+ if (ctx_tb[NL80211_ST_CTX_INFO_ATTR_SN]) {
+ struct nlattr *sn_attr;
+ int n_tids = 0;
+ int rem, tid;
+
+ nla_for_each_nested(sn_attr,
+ ctx_tb[NL80211_ST_CTX_INFO_ATTR_SN],
+ rem) {
+ struct nlattr *per_tid[NL80211_ST_CTX_INFO_ATTR_MAX + 1];
+ struct nlattr *sn;
+
+ tid = nla_type(sn_attr) - 1;
+ if (tid < 0 ||
+ tid >= IEEE80211_ST_CTX_NUM_TIDS) {
+ GENL_SET_ERR_MSG(info,
+ "invalid DL SN tid");
+ goto err_free_ctx;
+ }
+
+ nla_parse_nested(per_tid,
+ NL80211_ST_CTX_INFO_ATTR_MAX,
+ sn_attr, NULL, NULL);
+
+ sn = per_tid[NL80211_ST_CTX_INFO_ATTR_SN_PER_TID];
+ if (!sn) {
+ GENL_SET_ERR_MSG(info,
+ "no DL SN for tid");
+ goto err_free_ctx;
+ }
+
+ ctx->dl.sn[tid] = nla_get_u16(sn);
+ ctx->dl.valid_tid_bmap |= BIT(tid);
+ n_tids++;
+ }
+
+ if (!n_tids) {
+ GENL_SET_ERR_MSG(info, "empty DL SN nesting");
+ goto err_free_ctx;
+ }
+
+ ctx->no_dl_sn_transfer = 0;
+ }
+
+ if (ctx_tb[NL80211_ST_CTX_INFO_ATTR_DL_PN]) {
+ memcpy(ctx->dl.pn,
+ nla_data(ctx_tb[NL80211_ST_CTX_INFO_ATTR_DL_PN]),
+ nla_len(ctx_tb[NL80211_ST_CTX_INFO_ATTR_DL_PN]));
+ ctx->pn_valid = 1;
+ }
+
+ ba_attr = ctx_tb[NL80211_ST_CTX_INFO_ATTR_BA_PARAMS];
+ if (ba_attr) {
+ if (nl80211_parse_st_ctx_ba_params(ba_attr,
+ ctx->dl.ba,
+ &ctx->dl.valid_tid_bmap)) {
+ GENL_SET_ERR_MSG(info,
+ "failed to parse DL BlockAck params");
+ goto err_free_ctx;
+ }
+ ctx->ba_params_valid = 1;
+ }
+
+ if (ctx_tb[NL80211_ST_CTX_INFO_ATTR_MGMT_SN]) {
+ ctx->dl.mgmt_sn =
+ nla_get_u16(ctx_tb[NL80211_ST_CTX_INFO_ATTR_MGMT_SN]);
+ ctx->mgmt_tid_valid = 1;
+ ctx->no_dl_sn_transfer = 0;
+ }
+ }
+
+ /* UL Context */
+ if (tb[NL80211_ST_CTX_ATTR_UL]) {
+ nla_parse_nested(ctx_tb, NL80211_ST_CTX_INFO_ATTR_MAX,
+ tb[NL80211_ST_CTX_ATTR_UL], NULL, NULL);
+
+ if (ctx_tb[NL80211_ST_CTX_INFO_ATTR_SN]) {
+ struct nlattr *sn_attr;
+ int n_tids = 0;
+ int rem, tid;
+
+ nla_for_each_nested(sn_attr,
+ ctx_tb[NL80211_ST_CTX_INFO_ATTR_SN],
+ rem) {
+ struct nlattr *per_tid[NL80211_ST_CTX_INFO_ATTR_MAX + 1];
+ struct nlattr *sn;
+
+ tid = nla_type(sn_attr) - 1;
+ if (tid < 0 ||
+ tid >= IEEE80211_ST_CTX_NUM_TIDS) {
+ GENL_SET_ERR_MSG(info,
+ "invalid UL SN tid");
+ goto err_free_ctx;
+ }
+
+ nla_parse_nested(per_tid,
+ NL80211_ST_CTX_INFO_ATTR_MAX,
+ sn_attr, NULL, NULL);
+
+ sn = per_tid[NL80211_ST_CTX_INFO_ATTR_SN_PER_TID];
+ if (!sn) {
+ GENL_SET_ERR_MSG(info,
+ "no UL SN for tid");
+ goto err_free_ctx;
+ }
+
+ ctx->ul.sn[tid] = nla_get_u16(sn);
+ ctx->ul.valid_tid_bmap |= BIT(tid);
+ n_tids++;
+ }
+
+ if (!n_tids) {
+ GENL_SET_ERR_MSG(info, "empty UL SN nesting");
+ goto err_free_ctx;
+ }
+
+ ctx->no_ul_sn_transfer = 0;
+ }
+
+ if (ctx_tb[NL80211_ST_CTX_INFO_ATTR_UL_PN]) {
+ struct nlattr *pn_attr;
+ int n_tids = 0;
+ int rem, tid;
+
+ nla_for_each_nested(pn_attr,
+ ctx_tb[NL80211_ST_CTX_INFO_ATTR_UL_PN],
+ rem) {
+ struct nlattr *per_tid[NL80211_ST_CTX_INFO_ATTR_MAX + 1];
+ struct nlattr *pn;
+
+ tid = nla_type(pn_attr) - 1;
+ if (tid < 0 ||
+ tid >= IEEE80211_ST_CTX_NUM_TIDS) {
+ GENL_SET_ERR_MSG(info,
+ "invalid UL PN tid");
+ goto err_free_ctx;
+ }
+
+ nla_parse_nested(per_tid,
+ NL80211_ST_CTX_INFO_ATTR_MAX,
+ pn_attr, NULL, NULL);
+
+ pn = per_tid[NL80211_ST_CTX_INFO_ATTR_UL_PN_PER_TID];
+ if (!pn) {
+ GENL_SET_ERR_MSG(info,
+ "no UL PN for tid");
+ goto err_free_ctx;
+ }
+
+ memcpy(ctx->ul.pn[tid], pn, nla_len(pn));
+ n_tids++;
+ }
+
+ if (!n_tids) {
+ GENL_SET_ERR_MSG(info, "empty UL PN nesting");
+ goto err_free_ctx;
+ }
+
+ ctx->pn_valid = 1;
+ }
+
+ ba_attr = ctx_tb[NL80211_ST_CTX_INFO_ATTR_BA_PARAMS];
+ if (ba_attr) {
+ if (nl80211_parse_st_ctx_ba_params(ba_attr,
+ ctx->ul.ba,
+ &ctx->ul.valid_tid_bmap)) {
+ GENL_SET_ERR_MSG(info,
+ "failed to parse UL BlockAck params");
+ goto err_free_ctx;
+ }
+ ctx->ba_params_valid = 1;
+ }
+
+ if (ctx_tb[NL80211_ST_CTX_INFO_ATTR_MGMT_SN]) {
+ ctx->ul.mgmt_sn =
+ nla_get_u16(ctx_tb[NL80211_ST_CTX_INFO_ATTR_MGMT_SN]);
+ ctx->mgmt_tid_valid = 1;
+ ctx->no_ul_sn_transfer = 0;
+ }
+
+ if (ctx_tb[NL80211_ST_CTX_INFO_ATTR_UL_MGMT_PN]) {
+ memcpy(ctx->ul.mgmt_pn,
+ nla_data(ctx_tb[NL80211_ST_CTX_INFO_ATTR_UL_MGMT_PN]),
+ IEEE80211_CCMP_PN_LEN);
+ ctx->mgmt_tid_valid = 1;
+ ctx->pn_valid = 1;
+ }
+ }
+
+ st_info->type = nla_get_u8(info->attrs[NL80211_ATTR_ST_CTX_TYPE]);
+ st_info->ctx = ctx;
+
+ return 0;
+
+err_free_ctx:
+ kfree(ctx);
+ return -EINVAL;
+}
+
#define NL80211_FLAG_NEED_WIPHY 0x01
#define NL80211_FLAG_NEED_NETDEV 0x02
#define NL80211_FLAG_NEED_RTNL 0x04
@@ -20850,6 +21130,42 @@ static int nl80211_set_sar_specs(struct sk_buff *skb, struct genl_info *info)
return err;
}
+static int nl80211_set_st_ctx(struct sk_buff *skb, struct genl_info *info)
+{
+ struct cfg80211_registered_device *rdev = info->user_ptr[0];
+ struct cfg80211_smd_transition_info st_info = {};
+ struct net_device *dev = info->user_ptr[1];
+ struct wireless_dev *wdev = dev->ieee80211_ptr;
+ const u8 *addr;
+ int err;
+
+ if (!rdev->ops->set_st_ctx)
+ return -EOPNOTSUPP;
+
+ if (wdev->iftype != NL80211_IFTYPE_AP &&
+ wdev->iftype != NL80211_IFTYPE_AP_VLAN)
+ return -EINVAL;
+
+ if (!info->attrs[NL80211_ATTR_MLD_ADDR] ||
+ !info->attrs[NL80211_ATTR_ST_CTX] ||
+ !info->attrs[NL80211_ATTR_ST_CTX_TYPE]) {
+ GENL_SET_ERR_MSG(info, "required attributes are missing");
+ return -EINVAL;
+ }
+
+ addr = nla_data(info->attrs[NL80211_ATTR_MLD_ADDR]);
+
+ err = nl80211_parse_st_ctx(info, &st_info);
+ if (err)
+ return err;
+
+ /* drivers must copy @ctx for any deferred processing */
+ err = rdev_set_st_ctx(rdev, wdev, addr, &st_info);
+
+ kfree(st_info.ctx);
+ return err;
+}
+
#define SELECTOR(__sel, name, value) \
((__sel) == (value)) ? NL80211_IFL_SEL_##name :
int __missing_selector(void);
@@ -21785,6 +22101,13 @@ static const struct genl_small_ops nl80211_small_ops[] = {
.flags = GENL_UNS_ADMIN_PERM,
.internal_flags = IFLAGS(NL80211_FLAG_NEED_NETDEV_UP),
},
+ {
+ .cmd = NL80211_CMD_SET_ST_CTX,
+ .doit = nl80211_set_st_ctx,
+ .flags = GENL_UNS_ADMIN_PERM,
+ .internal_flags = IFLAGS(NL80211_FLAG_NEED_NETDEV_UP |
+ NL80211_FLAG_CLEAR_SKB),
+ },
};
static struct genl_family nl80211_fam __ro_after_init = {
diff --git a/net/wireless/rdev-ops.h b/net/wireless/rdev-ops.h
index 44a4255bbc03..824b606479db 100644
--- a/net/wireless/rdev-ops.h
+++ b/net/wireless/rdev-ops.h
@@ -1755,4 +1755,18 @@ static inline int rdev_abandon_st(struct cfg80211_registered_device *rdev,
return ret;
}
+static inline int rdev_set_st_ctx(struct cfg80211_registered_device *rdev,
+ struct wireless_dev *wdev, const u8 *addr,
+ struct cfg80211_smd_transition_info *st_info)
+{
+ int ret = -EOPNOTSUPP;
+
+ trace_rdev_set_st_ctx(&rdev->wiphy, wdev, addr, st_info);
+ if (rdev->ops->set_st_ctx)
+ ret = rdev->ops->set_st_ctx(&rdev->wiphy, wdev, addr, st_info);
+ trace_rdev_return_int(&rdev->wiphy, ret);
+
+ return ret;
+}
+
#endif /* __CFG80211_RDEV_OPS */
diff --git a/net/wireless/trace.h b/net/wireless/trace.h
index b0ff3cc4176d..7806a2edb26f 100644
--- a/net/wireless/trace.h
+++ b/net/wireless/trace.h
@@ -4702,6 +4702,40 @@ DEFINE_EVENT(cfg80211_st_evt, cfg80211_st_abandoned,
struct cfg80211_bss **links),
TP_ARGS(netdev, links)
);
+
+TRACE_EVENT(rdev_set_st_ctx,
+ TP_PROTO(struct wiphy *wiphy, struct wireless_dev *wdev, const u8 *addr,
+ struct cfg80211_smd_transition_info *st_info),
+
+ 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_st_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
--
2.34.1
^ permalink raw reply [flat|nested] 20+ messages in thread
* [PATCH wireless-next v5 10/19] wifi: nl80211/cfg80211: add support for querying ST context for target AP MLD
2026-12-02 10:27 [PATCH wireless-next v5 00/19] wifi: Add Seamless Mobility Domain (SMD) AP support Pooventhiran G
` (8 preceding siblings ...)
2026-12-02 10:28 ` [PATCH wireless-next v5 09/19] wifi: nl80211/cfg80211: add support for ST context programming Pooventhiran G
@ 2026-12-02 10:28 ` Pooventhiran G
2026-12-02 10:28 ` [PATCH wireless-next v5 11/19] wifi: nl80211/cfg80211: define API to notify ST Drain completion Pooventhiran G
` (8 subsequent siblings)
18 siblings, 0 replies; 20+ messages in thread
From: Pooventhiran G @ 2026-12-02 10:28 UTC (permalink / raw)
To: Johannes Berg; +Cc: linux-wireless, linux-kernel, pooventhiran.g
During ST, the non-AP MLD that has been prepared with a target AP MLD
may send the ST Execution frame directly to the target AP MLD. In such
scenarios, the target AP MLD should pull the context from the current
AP MLD to program TX and RX queues.
Add nl80211 support to handle NL80211_CMD_GET_ST_CTX, which is sent by
userspace of the current AP MLD on behalf of the target AP MLD. This
command carries the context type to indicate to the drivers which context
needs to be collected. Once the collection is complete, the context is
sent back to userspace as an asynchronous multicast event using
NL80211_CMD_ST_CTX_EVENT with full context data carried in
NL80211_ATTR_ST_CTX.
Signed-off-by: Pooventhiran G <pooventhiran.g@oss.qualcomm.com>
---
include/net/cfg80211.h | 20 +++++++++++++
net/wireless/nl80211.c | 77 +++++++++++++++++++++++++++++++++++++++++++++++--
net/wireless/nl80211.h | 3 ++
net/wireless/rdev-ops.h | 14 +++++++++
net/wireless/trace.h | 26 +++++++++++++++++
5 files changed, 138 insertions(+), 2 deletions(-)
diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h
index 5269719c8d15..f07b7064dcb1 100644
--- a/include/net/cfg80211.h
+++ b/include/net/cfg80211.h
@@ -5411,6 +5411,7 @@ struct cfg80211_smd_transition_info {
* @set_st_ctx: Set ST context data for the non-AP MLD. @st_info->ctx is freed
* immediately after this call returns; drivers must copy @st_info->ctx
* if asynchronous processing is required.
+ * @get_st_ctx: Get ST context data for the non-AP MLD.
*/
struct cfg80211_ops {
int (*suspend)(struct wiphy *wiphy, struct cfg80211_wowlan *wow);
@@ -5818,6 +5819,8 @@ struct cfg80211_ops {
int (*set_st_ctx)(struct wiphy *wiphy, struct wireless_dev *wdev,
const u8 *addr,
struct cfg80211_smd_transition_info *st_info);
+ int (*get_st_ctx)(struct wiphy *wiphy, struct wireless_dev *wdev,
+ const u8 *addr, enum nl80211_st_ctx_type type);
};
/*
@@ -11522,4 +11525,21 @@ struct ieee80211_st_ctx {
} ul;
};
+/**
+ * cfg80211_notify_get_st_ctx_done - deliver async GET_ST_CTX result to
+ * userspace
+ * @wdev: wireless device that handled the request
+ * @sta_addr: non-AP MLD address the context was collected for
+ * @st_info: SMD Transition Info (set @st_info->ctx to NULL to indicate
+ * failure)
+ *
+ * Sends a multicast %NL80211_CMD_ST_CTX_EVENT reply to userspace (MLME group).
+ *
+ * Return: None
+ */
+void
+cfg80211_notify_get_st_ctx_done(struct wireless_dev *wdev,
+ const u8 *sta_addr,
+ struct cfg80211_smd_transition_info *st_info);
+
#endif /* __NET_CFG80211_H */
diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c
index f76198cc0e84..ae54b96bc573 100644
--- a/net/wireless/nl80211.c
+++ b/net/wireless/nl80211.c
@@ -20282,8 +20282,8 @@ nl80211_put_st_ctx_ba_params(struct sk_buff *msg, unsigned long tid_bmap,
return -ENOBUFS;
}
-static int nl80211_put_st_ctx(struct sk_buff *msg,
- struct cfg80211_smd_transition_info *st_info)
+int nl80211_put_st_ctx(struct sk_buff *msg,
+ struct cfg80211_smd_transition_info *st_info)
{
unsigned long dl_tid_bmap, ul_tid_bmap;
const struct ieee80211_st_ctx *ctx;
@@ -21166,6 +21166,36 @@ static int nl80211_set_st_ctx(struct sk_buff *skb, struct genl_info *info)
return err;
}
+static int nl80211_get_st_ctx(struct sk_buff *skb, struct genl_info *info)
+{
+ struct cfg80211_registered_device *rdev = info->user_ptr[0];
+ struct net_device *dev = info->user_ptr[1];
+ struct wireless_dev *wdev = dev->ieee80211_ptr;
+ enum nl80211_st_ctx_type type;
+ const u8 *addr = NULL;
+ int err;
+
+ if (!rdev->ops->get_st_ctx)
+ return -EOPNOTSUPP;
+
+ if (wdev->iftype != NL80211_IFTYPE_AP &&
+ wdev->iftype != NL80211_IFTYPE_AP_VLAN)
+ return -EINVAL;
+
+ if (!info->attrs[NL80211_ATTR_MLD_ADDR] ||
+ !info->attrs[NL80211_ATTR_ST_CTX_TYPE]) {
+ GENL_SET_ERR_MSG(info, "required attributes are missing");
+ return -EINVAL;
+ }
+
+ addr = nla_data(info->attrs[NL80211_ATTR_MLD_ADDR]);
+ type = nla_get_u8(info->attrs[NL80211_ATTR_ST_CTX_TYPE]);
+
+ err = rdev_get_st_ctx(rdev, wdev, addr, type);
+
+ return err;
+}
+
#define SELECTOR(__sel, name, value) \
((__sel) == (value)) ? NL80211_IFL_SEL_##name :
int __missing_selector(void);
@@ -22108,6 +22138,12 @@ static const struct genl_small_ops nl80211_small_ops[] = {
.internal_flags = IFLAGS(NL80211_FLAG_NEED_NETDEV_UP |
NL80211_FLAG_CLEAR_SKB),
},
+ {
+ .cmd = NL80211_CMD_GET_ST_CTX,
+ .doit = nl80211_get_st_ctx,
+ .flags = GENL_UNS_ADMIN_PERM,
+ .internal_flags = IFLAGS(NL80211_FLAG_NEED_NETDEV_UP),
+ },
};
static struct genl_family nl80211_fam __ro_after_init = {
@@ -25304,6 +25340,43 @@ void cfg80211_nan_channel_evac(struct wireless_dev *wdev,
}
EXPORT_SYMBOL(cfg80211_nan_channel_evac);
+void
+cfg80211_notify_get_st_ctx_done(struct wireless_dev *wdev,
+ const u8 *sta_addr,
+ struct cfg80211_smd_transition_info *st_info)
+{
+ struct cfg80211_registered_device *rdev = wiphy_to_rdev(wdev->wiphy);
+ struct net_device *dev = wdev->netdev;
+ struct sk_buff *msg;
+ void *hdr;
+
+ msg = nlmsg_new(NLMSG_DEFAULT_SIZE, GFP_ATOMIC);
+ if (!msg)
+ return;
+
+ hdr = nl80211hdr_put(msg, 0, 0, 0, NL80211_CMD_ST_CTX_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;
+
+ if (st_info->ctx && nl80211_put_st_ctx(msg, st_info))
+ goto nla_put_failure;
+
+ genlmsg_end(msg, hdr);
+
+ genlmsg_multicast_netns(&nl80211_fam, wiphy_net(&rdev->wiphy), msg, 0,
+ NL80211_MCGRP_MLME, GFP_ATOMIC);
+ return;
+
+nla_put_failure:
+ nlmsg_free(msg);
+}
+EXPORT_SYMBOL(cfg80211_notify_get_st_ctx_done);
+
/* initialisation/exit functions */
int __init nl80211_init(void)
diff --git a/net/wireless/nl80211.h b/net/wireless/nl80211.h
index 1e75b38ad88d..075988f03d51 100644
--- a/net/wireless/nl80211.h
+++ b/net/wireless/nl80211.h
@@ -140,4 +140,7 @@ void nl80211_st_execution_response(struct cfg80211_registered_device *rdev,
void nl80211_st_done(struct cfg80211_registered_device *rdev,
struct net_device *dev);
+int nl80211_put_st_ctx(struct sk_buff *msg,
+ struct cfg80211_smd_transition_info *st_info);
+
#endif /* __NET_WIRELESS_NL80211_H */
diff --git a/net/wireless/rdev-ops.h b/net/wireless/rdev-ops.h
index 824b606479db..eb555e0c0d6a 100644
--- a/net/wireless/rdev-ops.h
+++ b/net/wireless/rdev-ops.h
@@ -1769,4 +1769,18 @@ static inline int rdev_set_st_ctx(struct cfg80211_registered_device *rdev,
return ret;
}
+static inline int rdev_get_st_ctx(struct cfg80211_registered_device *rdev,
+ struct wireless_dev *wdev, const u8 *addr,
+ enum nl80211_st_ctx_type type)
+{
+ int ret = -EOPNOTSUPP;
+
+ trace_rdev_get_st_ctx(&rdev->wiphy, wdev, addr, type);
+ if (rdev->ops->get_st_ctx)
+ ret = rdev->ops->get_st_ctx(&rdev->wiphy, wdev, addr, type);
+ trace_rdev_return_int(&rdev->wiphy, ret);
+
+ return ret;
+}
+
#endif /* __CFG80211_RDEV_OPS */
diff --git a/net/wireless/trace.h b/net/wireless/trace.h
index 7806a2edb26f..fbd8068edb93 100644
--- a/net/wireless/trace.h
+++ b/net/wireless/trace.h
@@ -4736,6 +4736,32 @@ TRACE_EVENT(rdev_set_st_ctx,
__entry->dl_tid_bitmap, __entry->ul_tid_bitmap
)
);
+
+TRACE_EVENT(rdev_get_st_ctx,
+ TP_PROTO(struct wiphy *wiphy, struct wireless_dev *wdev, const u8 *addr,
+ enum nl80211_st_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
--
2.34.1
^ permalink raw reply [flat|nested] 20+ messages in thread
* [PATCH wireless-next v5 11/19] wifi: nl80211/cfg80211: define API to notify ST Drain completion
2026-12-02 10:27 [PATCH wireless-next v5 00/19] wifi: Add Seamless Mobility Domain (SMD) AP support Pooventhiran G
` (9 preceding siblings ...)
2026-12-02 10:28 ` [PATCH wireless-next v5 10/19] wifi: nl80211/cfg80211: add support for querying ST context for target AP MLD Pooventhiran G
@ 2026-12-02 10:28 ` Pooventhiran G
2026-12-02 10:28 ` [PATCH wireless-next v5 12/19] wifi: mac80211: apply SMD indication and ST sub-states to STA Pooventhiran G
` (7 subsequent siblings)
18 siblings, 0 replies; 20+ messages in thread
From: Pooventhiran G @ 2026-12-02 10:28 UTC (permalink / raw)
To: Johannes Berg; +Cc: linux-wireless, linux-kernel, pooventhiran.g
The non-AP MLD that has started transitioning to the target AP MLD (ST
Execution) from the current AP MLD will be in downlink draining until
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 APIs for
the drivers to send this completion event to userspace to perform the
necessary clean-ups.
Suggested-by: Rohan Dutta <drohan@qti.qualcomm.com>
Signed-off-by: Pooventhiran G <pooventhiran.g@oss.qualcomm.com>
---
include/net/cfg80211.h | 9 +++++++++
include/uapi/linux/nl80211.h | 11 +++++++++++
net/wireless/nl80211.c | 33 +++++++++++++++++++++++++++++++++
3 files changed, 53 insertions(+)
diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h
index f07b7064dcb1..c77de0205af3 100644
--- a/include/net/cfg80211.h
+++ b/include/net/cfg80211.h
@@ -11542,4 +11542,13 @@ cfg80211_notify_get_st_ctx_done(struct wireless_dev *wdev,
const u8 *sta_addr,
struct cfg80211_smd_transition_info *st_info);
+/*
+ * cfg80211_notify_st_drain_completion - notify userspace about downlink drain
+ * early termination.
+ * @wdev: wireless device corresponding to the AP MLD
+ * @sta_addr: non-AP MLD address for which DL draining is being terminated
+ */
+void cfg80211_notify_st_drain_completion(struct wireless_dev *wdev,
+ const u8 *sta_addr);
+
#endif /* __NET_CFG80211_H */
diff --git a/include/uapi/linux/nl80211.h b/include/uapi/linux/nl80211.h
index 0e59769161dc..2f30a1e3cb04 100644
--- a/include/uapi/linux/nl80211.h
+++ b/include/uapi/linux/nl80211.h
@@ -442,6 +442,12 @@
* AP MLD can request the context from the driver on the target's behalf using
* %NL80211_CMD_GET_ST_CTX and the response can be reported back using
* %NL80211_CMD_ST_CTX_EVENT.
+ *
+ * The current AP MLD, after successful execution of the non-AP MLD with the
+ * target AP MLD, can continue to drain the buffered packets if a non-zero
+ * Nominal Maximum DL Draining Period Duration has been sent in the ST Execution
+ * Response. Drivers, however, can terminate draining early using the
+ * %NL80211_CMD_ST_DRAIN_COMPLETION_EVENT event.
*/
/**
@@ -1614,6 +1620,10 @@
* (requested via %NL80211_CMD_GET_ST_CTX) to userspace. It carries
* %NL80211_ATTR_MLD_ADDR, %NL80211_ATTR_ST_CTX_TYPE, and
* %NL80211_ATTR_ST_CTX.
+ * @NL80211_CMD_ST_DRAIN_COMPLETION_EVENT: Event indicating to userspace that
+ * the Downlink Drain for the station, identified by
+ * %NL80211_ATTR_MLD_ADDR, has been terminated early by the driver.
+ * Userspace can remove the station upon this event.
*
* @NL80211_CMD_MAX: highest used command number
* @__NL80211_CMD_AFTER_LAST: internal use
@@ -1905,6 +1915,7 @@ enum nl80211_commands {
NL80211_CMD_SET_ST_CTX,
NL80211_CMD_GET_ST_CTX,
NL80211_CMD_ST_CTX_EVENT,
+ NL80211_CMD_ST_DRAIN_COMPLETION_EVENT,
/* add new commands above here */
diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c
index ae54b96bc573..d3dccf932b5d 100644
--- a/net/wireless/nl80211.c
+++ b/net/wireless/nl80211.c
@@ -25377,6 +25377,39 @@ cfg80211_notify_get_st_ctx_done(struct wireless_dev *wdev,
}
EXPORT_SYMBOL(cfg80211_notify_get_st_ctx_done);
+void cfg80211_notify_st_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_ATOMIC);
+ if (!msg)
+ return;
+
+ hdr = nl80211hdr_put(msg, 0, 0, 0,
+ NL80211_CMD_ST_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_ATOMIC);
+ return;
+
+nla_put_failure:
+ nlmsg_free(msg);
+}
+EXPORT_SYMBOL(cfg80211_notify_st_drain_completion);
+
/* initialisation/exit functions */
int __init nl80211_init(void)
--
2.34.1
^ permalink raw reply [flat|nested] 20+ messages in thread
* [PATCH wireless-next v5 12/19] wifi: mac80211: apply SMD indication and ST sub-states to STA
2026-12-02 10:27 [PATCH wireless-next v5 00/19] wifi: Add Seamless Mobility Domain (SMD) AP support Pooventhiran G
` (10 preceding siblings ...)
2026-12-02 10:28 ` [PATCH wireless-next v5 11/19] wifi: nl80211/cfg80211: define API to notify ST Drain completion Pooventhiran G
@ 2026-12-02 10:28 ` Pooventhiran G
2026-12-02 10:28 ` [PATCH wireless-next v5 13/19] wifi: mac80211: add driver_op for ST substate changes Pooventhiran G
` (6 subsequent siblings)
18 siblings, 0 replies; 20+ messages in thread
From: Pooventhiran G @ 2026-12-02 10:28 UTC (permalink / raw)
To: Johannes Berg; +Cc: linux-wireless, linux-kernel, pooventhiran.g
When userspace marks the non-AP MLD as SMD, mark it in mac80211 so that
SMD operations are properly routed and handled in the drivers. Such a
STA, while roaming from the current AP MLD to the target AP MLD, moves
through the new ST sub-states. Capture these state transitions to track
the station roaming.
These are transient sub-states of WLAN_STA_AUTHORIZED with the SMD-ME.
The station remains authenticated, associated, and RSNA-established
throughout. These sub-states, though, are tracked with the MLD state
machine itself. At most one of the three may be set at a time; mutual
exclusion is enforced in sta_apply_st_state_flags().
Signed-off-by: Sidhanta Sahu <sidhanta.sahu@oss.qualcomm.com>
Signed-off-by: Pooventhiran G <pooventhiran.g@oss.qualcomm.com>
---
include/net/mac80211.h | 2 ++
net/mac80211/cfg.c | 54 ++++++++++++++++++++++++++++++++++++++++++++++
net/mac80211/debugfs_sta.c | 3 +++
net/mac80211/sta_info.h | 8 +++++++
4 files changed, 67 insertions(+)
diff --git a/include/net/mac80211.h b/include/net/mac80211.h
index f768ef9184eb..5d9b11842420 100644
--- a/include/net/mac80211.h
+++ b/include/net/mac80211.h
@@ -2738,6 +2738,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_sta: STA has negotiated SMD
*/
struct ieee80211_sta {
u8 addr[ETH_ALEN] __aligned(2);
@@ -2768,6 +2769,7 @@ struct ieee80211_sta {
u16 active_links;
u16 ext_mld_capa_ops;
bool epp_peer;
+ bool smd_sta;
struct ieee80211_link_sta deflink;
struct ieee80211_link_sta __rcu *link[IEEE80211_MLD_MAX_NUM_LINKS];
diff --git a/net/mac80211/cfg.c b/net/mac80211/cfg.c
index 9e47360ee8f5..f05192a52fbb 100644
--- a/net/mac80211/cfg.c
+++ b/net/mac80211/cfg.c
@@ -2702,6 +2702,52 @@ static int sta_link_apply_parameters(struct ieee80211_local *local,
return 0;
}
+static int sta_apply_st_state_flags(struct sta_info *sta,
+ u32 mask, u32 set)
+{
+ bool st_prepared, st_executing, st_dl_drain;
+ u32 st_state_mask = BIT(NL80211_STA_FLAG_ST_PREPARED) |
+ BIT(NL80211_STA_FLAG_ST_EXECUTING) |
+ BIT(NL80211_STA_FLAG_ST_DL_DRAIN);
+ u32 st_flags;
+
+ if (!(mask & st_state_mask))
+ return 0;
+
+ st_flags = mask & st_state_mask & set;
+ if (hweight32(st_flags) > 1)
+ return -EINVAL;
+
+ st_prepared = st_flags & BIT(NL80211_STA_FLAG_ST_PREPARED);
+ st_executing = st_flags & BIT(NL80211_STA_FLAG_ST_EXECUTING);
+ st_dl_drain = st_flags & BIT(NL80211_STA_FLAG_ST_DL_DRAIN);
+
+ if (!test_sta_flag(sta, WLAN_STA_AUTHORIZED) &&
+ (st_executing || st_dl_drain))
+ return -EINVAL;
+
+ if (st_prepared) {
+ set_sta_flag(sta, WLAN_STA_ST_PREPARED);
+ clear_sta_flag(sta, WLAN_STA_ST_EXECUTING);
+ clear_sta_flag(sta, WLAN_STA_ST_DL_DRAIN);
+ } else if (st_executing) {
+ set_sta_flag(sta, WLAN_STA_ST_EXECUTING);
+ clear_sta_flag(sta, WLAN_STA_ST_PREPARED);
+ clear_sta_flag(sta, WLAN_STA_ST_DL_DRAIN);
+ } else if (st_dl_drain) {
+ set_sta_flag(sta, WLAN_STA_ST_DL_DRAIN);
+ clear_sta_flag(sta, WLAN_STA_ST_PREPARED);
+ clear_sta_flag(sta, WLAN_STA_ST_EXECUTING);
+ } else {
+ /* all flags revert back to none being set */
+ clear_sta_flag(sta, WLAN_STA_ST_PREPARED);
+ clear_sta_flag(sta, WLAN_STA_ST_EXECUTING);
+ clear_sta_flag(sta, WLAN_STA_ST_DL_DRAIN);
+ }
+
+ return 0;
+}
+
static int sta_apply_parameters(struct ieee80211_local *local,
struct sta_info *sta,
struct station_parameters *params)
@@ -2886,6 +2932,12 @@ static int sta_apply_parameters(struct ieee80211_local *local,
if (params->link_sta_params.mld_mac)
sta->sta.mlo = true;
+ if (sta->sta.smd_sta) {
+ ret = sta_apply_st_state_flags(sta, mask, set);
+ if (ret)
+ return ret;
+ }
+
return 0;
}
@@ -2953,6 +3005,8 @@ static int ieee80211_add_station(struct wiphy *wiphy, struct wireless_dev *wdev,
if (params->sta_flags_set & BIT(NL80211_STA_FLAG_TDLS_PEER))
sta->sta.tdls = true;
+ sta->sta.smd_sta = params->smd_sta;
+
/* Though the mutex is not needed here (since the station is not
* visible yet), sta_apply_parameters (and inner functions) require
* the mutex due to other paths.
diff --git a/net/mac80211/debugfs_sta.c b/net/mac80211/debugfs_sta.c
index 8d6b4a1bb8d6..342b190ea6bb 100644
--- a/net/mac80211/debugfs_sta.c
+++ b/net/mac80211/debugfs_sta.c
@@ -78,6 +78,9 @@ static const char * const sta_flag_names[] = {
FLAG(PS_DELIVER),
FLAG(USES_ENCRYPTION),
FLAG(DECAP_OFFLOAD),
+ FLAG(ST_PREPARED),
+ FLAG(ST_EXECUTING),
+ FLAG(ST_DL_DRAIN),
#undef FLAG
};
diff --git a/net/mac80211/sta_info.h b/net/mac80211/sta_info.h
index 5fda4771eee3..da0babb15aaf 100644
--- a/net/mac80211/sta_info.h
+++ b/net/mac80211/sta_info.h
@@ -72,6 +72,11 @@
* @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_ST_PREPARED: this SMD station is prepared at the target AP MLD.
+ * @WLAN_STA_ST_EXECUTING: this SMD station has started execution at
+ * the current AP MLD.
+ * @WLAN_STA_ST_DL_DRAIN: this SMD station has started draining at
+ * the current AP MLD.
*
* @NUM_WLAN_STA_FLAGS: number of defined flags
*/
@@ -104,6 +109,9 @@ enum ieee80211_sta_info_flags {
WLAN_STA_PS_DELIVER,
WLAN_STA_USES_ENCRYPTION,
WLAN_STA_DECAP_OFFLOAD,
+ WLAN_STA_ST_PREPARED,
+ WLAN_STA_ST_EXECUTING,
+ WLAN_STA_ST_DL_DRAIN,
NUM_WLAN_STA_FLAGS,
};
--
2.34.1
^ permalink raw reply [flat|nested] 20+ messages in thread
* [PATCH wireless-next v5 13/19] wifi: mac80211: add driver_op for ST substate changes
2026-12-02 10:27 [PATCH wireless-next v5 00/19] wifi: Add Seamless Mobility Domain (SMD) AP support Pooventhiran G
` (11 preceding siblings ...)
2026-12-02 10:28 ` [PATCH wireless-next v5 12/19] wifi: mac80211: apply SMD indication and ST sub-states to STA Pooventhiran G
@ 2026-12-02 10:28 ` Pooventhiran G
2026-12-02 10:28 ` [PATCH wireless-next v5 14/19] wifi: mac80211: filter uplink and downlink frames based on ST states Pooventhiran G
` (5 subsequent siblings)
18 siblings, 0 replies; 20+ messages in thread
From: Pooventhiran G @ 2026-12-02 10:28 UTC (permalink / raw)
To: Johannes Berg; +Cc: linux-wireless, linux-kernel, pooventhiran.g
During ST, a non-AP MLD moves through sub-states 4a, 4b, and 4c that
impose different frame-filtering rules on the AP MLD.
Add a new driver op that mac80211 calls on each sub-state transition.
This lets drivers perform the necessary hardware queue and filtering
adjustments at each phase of ST.
Valid driver transitions:
NONE -> PREPARED (ST preparation completed at the target AP MLD)
NONE -> EXECUTING (ST execution in progress at the current AP MLD)
EXECUTING -> DL_DRAIN (DL drain period started at the current AP MLD)
Suggested-by: Rohan Dutta <drohan@qti.qualcomm.com>
Signed-off-by: Pooventhiran G <pooventhiran.g@oss.qualcomm.com>
---
include/net/mac80211.h | 24 +++++++++++++++++
net/mac80211/cfg.c | 24 +++++++++++++++++
net/mac80211/driver-ops.c | 18 +++++++++++++
net/mac80211/driver-ops.h | 5 ++++
net/mac80211/sta_info.c | 67 +++++++++++++++++++++++++++++++++++++++++++++++
net/mac80211/sta_info.h | 7 +++++
net/mac80211/trace.h | 28 ++++++++++++++++++++
7 files changed, 173 insertions(+)
diff --git a/include/net/mac80211.h b/include/net/mac80211.h
index 5d9b11842420..63de0df466dd 100644
--- a/include/net/mac80211.h
+++ b/include/net/mac80211.h
@@ -4097,6 +4097,24 @@ struct ieee80211_prep_tx_info {
int link_id;
};
+/**
+ * enum ieee80211_sta_st_state - SMD Transition sub-state
+ *
+ * Tracks the 802.11bn SMD Transition sub-state (IEEE P802.11bn/D2.0, Aug 2026,
+ * subclause 11.3.1) for a specific (non-AP MLD, AP MLD) association.
+ *
+ * @IEEE80211_STA_ST_NONE: Plain State 4. No sub-state active.
+ * @IEEE80211_STA_ST_PREPARED: State 4a. STA prepared at the target AP MLD
+ * @IEEE80211_STA_ST_EXECUTING: State 4b. ST execution active at the current AP MLD
+ * @IEEE80211_STA_ST_DL_DRAIN: State 4c. DL draining period at the current AP MLD
+ */
+enum ieee80211_sta_st_state {
+ IEEE80211_STA_ST_NONE,
+ IEEE80211_STA_ST_PREPARED,
+ IEEE80211_STA_ST_EXECUTING,
+ IEEE80211_STA_ST_DL_DRAIN,
+};
+
/**
* struct ieee80211_ops - callbacks from mac80211 to the driver
*
@@ -4779,6 +4797,8 @@ 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_notify_st: Notifies low level driver about IEEE 802.11bn ST substate
+ * transition of a station. The callback can sleep.
*/
struct ieee80211_ops {
void (*tx)(struct ieee80211_hw *hw,
@@ -5192,6 +5212,10 @@ struct ieee80211_ops {
struct ieee80211_vif *vif,
struct ieee80211_sta *sta,
struct ieee80211_eml_params *eml_params);
+ void (*sta_notify_st)(struct ieee80211_hw *hw,
+ struct ieee80211_vif *vif,
+ struct ieee80211_sta *sta,
+ enum ieee80211_sta_st_state state);
};
/**
diff --git a/net/mac80211/cfg.c b/net/mac80211/cfg.c
index f05192a52fbb..0a4ba00c962e 100644
--- a/net/mac80211/cfg.c
+++ b/net/mac80211/cfg.c
@@ -2709,7 +2709,9 @@ static int sta_apply_st_state_flags(struct sta_info *sta,
u32 st_state_mask = BIT(NL80211_STA_FLAG_ST_PREPARED) |
BIT(NL80211_STA_FLAG_ST_EXECUTING) |
BIT(NL80211_STA_FLAG_ST_DL_DRAIN);
+ enum ieee80211_sta_st_state new_ss;
u32 st_flags;
+ int err;
if (!(mask & st_state_mask))
return 0;
@@ -2726,6 +2728,22 @@ static int sta_apply_st_state_flags(struct sta_info *sta,
(st_executing || st_dl_drain))
return -EINVAL;
+ if (st_prepared)
+ new_ss = IEEE80211_STA_ST_PREPARED;
+ else if (st_executing)
+ new_ss = IEEE80211_STA_ST_EXECUTING;
+ else if (st_dl_drain)
+ new_ss = IEEE80211_STA_ST_DL_DRAIN;
+ else
+ new_ss = IEEE80211_STA_ST_NONE;
+
+ if (new_ss == sta->st_state)
+ return 0;
+
+ err = sta_info_move_st_state(sta, new_ss);
+ if (err)
+ return err;
+
if (st_prepared) {
set_sta_flag(sta, WLAN_STA_ST_PREPARED);
clear_sta_flag(sta, WLAN_STA_ST_EXECUTING);
@@ -3034,6 +3052,12 @@ static int ieee80211_add_station(struct wiphy *wiphy, struct wireless_dev *wdev,
*/
if (!err && sdata->vif.type == NL80211_IFTYPE_NAN_DATA)
ieee80211_nan_update_ndi_carrier(sta->sdata);
+
+ if (!err && sta->sta.smd_sta &&
+ sta->st_state != IEEE80211_STA_ST_NONE)
+ drv_sta_notify_st(sta->local, sta->sdata, &sta->sta,
+ sta->st_state);
+
return err;
}
diff --git a/net/mac80211/driver-ops.c b/net/mac80211/driver-ops.c
index 0e854b0974de..6ad3ecba4ea7 100644
--- a/net/mac80211/driver-ops.c
+++ b/net/mac80211/driver-ops.c
@@ -745,3 +745,21 @@ void drv_flush_sta(struct ieee80211_local *local,
ieee80211_flush_queues(local, sdata, false);
trace_drv_return_void(local);
}
+
+void drv_sta_notify_st(struct ieee80211_local *local,
+ struct ieee80211_sub_if_data *sdata,
+ struct ieee80211_sta *sta,
+ enum ieee80211_sta_st_state state)
+{
+ might_sleep();
+ lockdep_assert_wiphy(local->hw.wiphy);
+
+ sdata = get_bss_sdata(sdata);
+ if (!check_sdata_in_driver(sdata))
+ return;
+
+ trace_drv_sta_notify_st(local, sdata, sta, state);
+ if (local->ops->sta_notify_st)
+ local->ops->sta_notify_st(&local->hw, &sdata->vif, sta, state);
+ trace_drv_return_void(local);
+}
diff --git a/net/mac80211/driver-ops.h b/net/mac80211/driver-ops.h
index 0edaaab7ac52..8b35f3f89f78 100644
--- a/net/mac80211/driver-ops.h
+++ b/net/mac80211/driver-ops.h
@@ -1788,4 +1788,9 @@ drv_nan_peer_sched_changed(struct ieee80211_local *local,
return ret;
}
+void drv_sta_notify_st(struct ieee80211_local *local,
+ struct ieee80211_sub_if_data *sdata,
+ struct ieee80211_sta *sta,
+ enum ieee80211_sta_st_state state);
+
#endif /* __MAC80211_DRIVER_OPS */
diff --git a/net/mac80211/sta_info.c b/net/mac80211/sta_info.c
index e2ff3a242bb3..e337cff214f5 100644
--- a/net/mac80211/sta_info.c
+++ b/net/mac80211/sta_info.c
@@ -730,6 +730,7 @@ __sta_info_alloc(struct ieee80211_sub_if_data *sdata,
ieee80211_init_frag_cache(&sta->frags);
sta->sta_state = IEEE80211_STA_NONE;
+ sta->st_state = IEEE80211_STA_ST_NONE;
if (sdata->vif.type == NL80211_IFTYPE_MESH_POINT)
sta->amsdu_mesh_control = -1;
@@ -1640,6 +1641,14 @@ static int _sta_info_move_state(struct sta_info *sta,
WARN_ONCE(err,
"Driver is not allowed to fail if the sta_state is transitioning down the list: %d\n",
err);
+
+ /* revert ST sub-states if STA has transitioned down */
+ if (sta->sta.smd_sta &&
+ ((new_state == IEEE80211_STA_AUTH &&
+ sta->sta_state == IEEE80211_STA_ASSOC) ||
+ (new_state == IEEE80211_STA_ASSOC &&
+ sta->sta_state == IEEE80211_STA_AUTHORIZED)))
+ sta_info_reset_st_state(sta);
}
sta->sta_state = new_state;
@@ -4108,3 +4117,61 @@ bool ieee80211_link_sta_update_rc_bw(struct ieee80211_link_data *link,
return true;
}
+
+int sta_info_move_st_state(struct sta_info *sta,
+ enum ieee80211_sta_st_state new_ss)
+{
+ enum ieee80211_sta_st_state old_ss = sta->st_state;
+ struct ieee80211_local *local = sta->local;
+
+ might_sleep();
+
+ if (old_ss == new_ss)
+ return 0;
+
+ switch (new_ss) {
+ case IEEE80211_STA_ST_NONE:
+ if (old_ss != IEEE80211_STA_ST_PREPARED &&
+ old_ss != IEEE80211_STA_ST_EXECUTING &&
+ old_ss != IEEE80211_STA_ST_DL_DRAIN)
+ return -EINVAL;
+ break;
+ case IEEE80211_STA_ST_EXECUTING:
+ if (old_ss != IEEE80211_STA_ST_NONE)
+ return -EINVAL;
+ break;
+ case IEEE80211_STA_ST_DL_DRAIN:
+ if (old_ss != IEEE80211_STA_ST_EXECUTING)
+ return -EINVAL;
+ break;
+ case IEEE80211_STA_ST_PREPARED:
+ if (old_ss != IEEE80211_STA_ST_NONE)
+ return -EINVAL;
+ break;
+ default:
+ sdata_err(sta->sdata, "invalid st state %d", new_ss);
+ return -EINVAL;
+ }
+
+ sta_dbg(sta->sdata, "moving STA %pM ST state %u -> %u\n",
+ sta->sta.addr, old_ss, new_ss);
+
+ if (test_sta_flag(sta, WLAN_STA_INSERTED))
+ drv_sta_notify_st(local, sta->sdata, &sta->sta, new_ss);
+
+ sta->st_state = new_ss;
+
+ return 0;
+}
+
+void sta_info_reset_st_state(struct sta_info *sta)
+{
+ if (sta->st_state == IEEE80211_STA_ST_NONE)
+ return;
+
+ clear_sta_flag(sta, WLAN_STA_ST_PREPARED);
+ clear_sta_flag(sta, WLAN_STA_ST_EXECUTING);
+ clear_sta_flag(sta, WLAN_STA_ST_DL_DRAIN);
+
+ sta->st_state = IEEE80211_STA_ST_NONE;
+}
diff --git a/net/mac80211/sta_info.h b/net/mac80211/sta_info.h
index da0babb15aaf..2c842fddf285 100644
--- a/net/mac80211/sta_info.h
+++ b/net/mac80211/sta_info.h
@@ -728,6 +728,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
+ * @st_state: Sub-state for STAs in ST
*/
struct sta_info {
/* General information, mostly static */
@@ -804,6 +805,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_st_state st_state;
+
/* keep last! */
struct ieee80211_sta sta;
};
@@ -1200,4 +1203,8 @@ static inline u32 sta_stats_encode_rate(struct ieee80211_rx_status *s)
return r;
}
+int sta_info_move_st_state(struct sta_info *sta,
+ enum ieee80211_sta_st_state new_ss);
+void sta_info_reset_st_state(struct sta_info *sta);
+
#endif /* STA_INFO_H */
diff --git a/net/mac80211/trace.h b/net/mac80211/trace.h
index f34d079f3d38..00464c6f3ae7 100644
--- a/net/mac80211/trace.h
+++ b/net/mac80211/trace.h
@@ -3426,6 +3426,34 @@ TRACE_EVENT(drv_nan_peer_sched_changed,
)
);
+TRACE_EVENT(drv_sta_notify_st,
+ TP_PROTO(struct ieee80211_local *local,
+ struct ieee80211_sub_if_data *sdata,
+ struct ieee80211_sta *sta,
+ enum ieee80211_sta_st_state state),
+
+ TP_ARGS(local, sdata, sta, state),
+
+ TP_STRUCT__entry(
+ LOCAL_ENTRY
+ VIF_ENTRY
+ STA_ENTRY
+ __field(u32, state)
+ ),
+
+ TP_fast_assign(
+ LOCAL_ASSIGN;
+ VIF_ASSIGN;
+ STA_ASSIGN;
+ __entry->state = state;
+ ),
+
+ TP_printk(
+ LOCAL_PR_FMT VIF_PR_FMT STA_PR_FMT " st_state: %d",
+ LOCAL_PR_ARG, VIF_PR_ARG, STA_PR_ARG, __entry->state
+ )
+);
+
#endif /* !__MAC80211_DRIVER_TRACE || TRACE_HEADER_MULTI_READ */
#undef TRACE_INCLUDE_PATH
--
2.34.1
^ permalink raw reply [flat|nested] 20+ messages in thread
* [PATCH wireless-next v5 14/19] wifi: mac80211: filter uplink and downlink frames based on ST states
2026-12-02 10:27 [PATCH wireless-next v5 00/19] wifi: Add Seamless Mobility Domain (SMD) AP support Pooventhiran G
` (12 preceding siblings ...)
2026-12-02 10:28 ` [PATCH wireless-next v5 13/19] wifi: mac80211: add driver_op for ST substate changes Pooventhiran G
@ 2026-12-02 10:28 ` Pooventhiran G
2026-12-02 10:28 ` [PATCH wireless-next v5 15/19] wifi: mac80211: pass rx_data directly from ieee80211_rx_list() Pooventhiran G
` (4 subsequent siblings)
18 siblings, 0 replies; 20+ messages in thread
From: Pooventhiran G @ 2026-12-02 10:28 UTC (permalink / raw)
To: Johannes Berg; +Cc: linux-wireless, linux-kernel, pooventhiran.g
During ST, based on the state that the non-AP MLD is currently in, there
are frame filtering conditions imposed in both uplink and downlink
directions, as per IEEE P802.11bn/D2.0, Aug 2026, subclause 11.3.1.
State 4a:
- UL/DL: All Class 3 frames except ST Execution Request and Response
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.
Signed-off-by: Pooventhiran G <pooventhiran.g@oss.qualcomm.com>
---
net/mac80211/drop.h | 1 +
net/mac80211/rx.c | 45 +++++++++++++++++++++++++++++++++++++++++++++
net/mac80211/tx.c | 43 +++++++++++++++++++++++++++++++++++++++++++
3 files changed, 89 insertions(+)
diff --git a/net/mac80211/drop.h b/net/mac80211/drop.h
index f433ee17cce5..fe037c94b2ca 100644
--- a/net/mac80211/drop.h
+++ b/net/mac80211/drop.h
@@ -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 */
diff --git a/net/mac80211/rx.c b/net/mac80211/rx.c
index a2356cd17691..a152471151a9 100644
--- a/net/mac80211/rx.c
+++ b/net/mac80211/rx.c
@@ -1628,6 +1628,50 @@ ieee80211_rx_h_check(struct ieee80211_rx_data *rx)
return RX_CONTINUE;
}
+static ieee80211_rx_result debug_noinline
+ieee80211_rx_h_st_state(struct ieee80211_rx_data *rx)
+{
+ struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)rx->skb->data;
+ __le16 fc = hdr->frame_control;
+
+ if (!rx->sta ||
+ (rx->sdata->vif.type != NL80211_IFTYPE_AP &&
+ rx->sdata->vif.type != NL80211_IFTYPE_AP_VLAN) ||
+ !rx->sta->sta.smd_sta ||
+ !test_sta_flag(rx->sta, WLAN_STA_ASSOC) ||
+ is_multicast_ether_addr(hdr->addr1))
+ return RX_CONTINUE;
+
+ switch (rx->sta->st_state) {
+ case IEEE80211_STA_ST_NONE:
+ break;
+ case IEEE80211_STA_ST_PREPARED:
+ /* 4a: Class 3 disallowed except ST Execution Request */
+ if (ieee80211_is_st_exec_req(rx->skb))
+ break;
+ if (ieee80211_is_class3(rx->skb))
+ return RX_DROP_U_SMD_FILTERED;
+ break;
+ case IEEE80211_STA_ST_EXECUTING:
+ /* 4b: Class 3 Data frames disallowed */
+ if (ieee80211_is_data(fc))
+ return RX_DROP_U_SMD_FILTERED;
+ break;
+ case IEEE80211_STA_ST_DL_DRAIN:
+ /*
+ * 4c: Class 3 frames disallowed except QoS Null, Control, and
+ * UHR Reconfiguration Notify frames.
+ */
+ if (ieee80211_is_qos_nullfunc(fc) || ieee80211_is_ctl(fc) ||
+ ieee80211_is_uhr_link_reconf_notify(rx->skb))
+ break;
+ if (ieee80211_is_class3(rx->skb))
+ return RX_DROP_U_SMD_FILTERED;
+ break;
+ }
+
+ return RX_CONTINUE;
+}
static ieee80211_rx_result debug_noinline
ieee80211_rx_h_check_more_data(struct ieee80211_rx_data *rx)
@@ -4305,6 +4349,7 @@ static void ieee80211_invoke_rx_handlers(struct ieee80211_rx_data *rx)
CALL_RXH(ieee80211_rx_h_check_dup);
CALL_RXH(ieee80211_rx_h_check);
+ CALL_RXH(ieee80211_rx_h_st_state);
ieee80211_rx_reorder_ampdu(rx, &reorder_release);
diff --git a/net/mac80211/tx.c b/net/mac80211/tx.c
index cb9ecac25a9c..aab0f8f6bd9c 100644
--- a/net/mac80211/tx.c
+++ b/net/mac80211/tx.c
@@ -308,6 +308,48 @@ ieee80211_tx_h_check_assoc(struct ieee80211_tx_data *tx)
return TX_CONTINUE;
}
+static ieee80211_tx_result debug_noinline
+ieee80211_tx_h_st_state(struct ieee80211_tx_data *tx)
+{
+ struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)tx->skb->data;
+ __le16 fc = hdr->frame_control;
+
+ if (!tx->sta ||
+ (tx->sdata->vif.type != NL80211_IFTYPE_AP &&
+ tx->sdata->vif.type != NL80211_IFTYPE_AP_VLAN) ||
+ !tx->sta->sta.smd_sta ||
+ !test_sta_flag(tx->sta, WLAN_STA_ASSOC) ||
+ !(tx->flags & IEEE80211_TX_UNICAST))
+ return TX_CONTINUE;
+
+ switch (tx->sta->st_state) {
+ case IEEE80211_STA_ST_NONE:
+ break;
+ case IEEE80211_STA_ST_PREPARED:
+ /* 4a: Class 3 disallowed except ST Execution Response */
+ if (ieee80211_is_st_exec_resp(tx->skb))
+ break;
+ if (ieee80211_is_class3(tx->skb))
+ return TX_DROP;
+ break;
+ case IEEE80211_STA_ST_EXECUTING:
+ /* 4b: no restriction */
+ break;
+ case IEEE80211_STA_ST_DL_DRAIN:
+ /* 4c: Class 3 disallowed except Data, Control,
+ * UHR Reconfiguration Notify
+ */
+ if (ieee80211_is_ctl(fc) || ieee80211_is_data(fc) ||
+ ieee80211_is_uhr_link_reconf_notify(tx->skb))
+ break;
+ if (ieee80211_is_class3(tx->skb))
+ return TX_DROP;
+ break;
+ }
+
+ return TX_CONTINUE;
+}
+
/* This function is called whenever the AP is about to exceed the maximum limit
* of buffered frames for power saving STAs. This situation should not really
* happen often during normal operation, so dropping the oldest buffered packet
@@ -1883,6 +1925,7 @@ static int invoke_tx_handlers_early(struct ieee80211_tx_data *tx)
CALL_TXH(ieee80211_tx_h_dynamic_ps);
CALL_TXH(ieee80211_tx_h_check_assoc);
+ CALL_TXH(ieee80211_tx_h_st_state);
CALL_TXH(ieee80211_tx_h_ps_buf);
CALL_TXH(ieee80211_tx_h_check_control_port_protocol);
CALL_TXH(ieee80211_tx_h_select_key);
--
2.34.1
^ permalink raw reply [flat|nested] 20+ messages in thread
* [PATCH wireless-next v5 15/19] wifi: mac80211: pass rx_data directly from ieee80211_rx_list()
2026-12-02 10:27 [PATCH wireless-next v5 00/19] wifi: Add Seamless Mobility Domain (SMD) AP support Pooventhiran G
` (13 preceding siblings ...)
2026-12-02 10:28 ` [PATCH wireless-next v5 14/19] wifi: mac80211: filter uplink and downlink frames based on ST states Pooventhiran G
@ 2026-12-02 10:28 ` Pooventhiran G
2026-12-02 10:28 ` [PATCH wireless-next v5 16/19] wifi: mac80211: handle UHR Link Reconfiguration frame Pooventhiran G
` (3 subsequent siblings)
18 siblings, 0 replies; 20+ messages in thread
From: Pooventhiran G @ 2026-12-02 10:28 UTC (permalink / raw)
To: Johannes Berg; +Cc: linux-wireless, linux-kernel, pooventhiran.g
rx_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.
Signed-off-by: Pooventhiran G <pooventhiran.g@oss.qualcomm.com>
---
net/mac80211/rx.c | 60 +++++++++++++++++++++++++++----------------------------
1 file changed, 30 insertions(+), 30 deletions(-)
diff --git a/net/mac80211/rx.c b/net/mac80211/rx.c
index a152471151a9..d7d662c9ccd5 100644
--- a/net/mac80211/rx.c
+++ b/net/mac80211/rx.c
@@ -5432,7 +5432,8 @@ ieee80211_link_from_freq(struct ieee80211_sub_if_data *sdata, int freq)
static void __ieee80211_rx_handle_packet(struct ieee80211_hw *hw,
struct ieee80211_link_sta *link_pubsta,
struct sk_buff *skb,
- struct list_head *list)
+ struct list_head *list,
+ struct ieee80211_rx_data *rx)
__must_hold_shared(RCU)
{
struct ieee80211_local *local = hw_to_local(hw);
@@ -5442,16 +5443,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);
@@ -5483,8 +5482,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) ||
@@ -5504,9 +5503,9 @@ static void __ieee80211_rx_handle_packet(struct ieee80211_hw *hw,
sta = sta_from_pub(link_pubsta->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;
@@ -5526,13 +5525,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;
@@ -5550,20 +5549,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;
@@ -5635,14 +5634,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;
@@ -5652,22 +5651,22 @@ static void __ieee80211_rx_handle_packet(struct ieee80211_hw *hw,
link = ieee80211_link_from_freq(sdata, status->freq);
if (rx_data_pending) {
- ieee80211_prepare_and_rx_handle(&rx, skb, false);
+ 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:
@@ -5688,6 +5687,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);
@@ -5839,7 +5839,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();
--
2.34.1
^ permalink raw reply [flat|nested] 20+ messages in thread
* [PATCH wireless-next v5 16/19] wifi: mac80211: handle UHR Link Reconfiguration frame
2026-12-02 10:27 [PATCH wireless-next v5 00/19] wifi: Add Seamless Mobility Domain (SMD) AP support Pooventhiran G
` (14 preceding siblings ...)
2026-12-02 10:28 ` [PATCH wireless-next v5 15/19] wifi: mac80211: pass rx_data directly from ieee80211_rx_list() Pooventhiran G
@ 2026-12-02 10:28 ` Pooventhiran G
2026-12-02 10:28 ` [PATCH wireless-next v5 17/19] wifi: mac80211: add mac80211 support to handle NL80211_CMD_SET_ST_CTX Pooventhiran G
` (2 subsequent siblings)
18 siblings, 0 replies; 20+ messages in thread
From: Pooventhiran G @ 2026-12-02 10:28 UTC (permalink / raw)
To: Johannes Berg; +Cc: linux-wireless, linux-kernel, pooventhiran.g
A UHR Link Reconfiguration Request frame (ST Preparation or Execution)
triggers SMD Transition on the current AP MLD. Userspace needs reporting
of the STA's dynamic context along with such frames so that the same can
be transported to the target AP MLD for setting up the STA TX and RX
queues.
Reserve a field in ieee80211_rx_status that enables drivers to attach
the STA's dynamic context to the corresponding frame. Since the maximum
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.
Signed-off-by: Pooventhiran G <pooventhiran.g@oss.qualcomm.com>
---
include/net/mac80211.h | 10 +++++++++-
net/mac80211/ieee80211_i.h | 2 ++
net/mac80211/rx.c | 36 ++++++++++++++++++++++++++++++++++++
3 files changed, 47 insertions(+), 1 deletion(-)
diff --git a/include/net/mac80211.h b/include/net/mac80211.h
index 63de0df466dd..be8406bb0d73 100644
--- a/include/net/mac80211.h
+++ b/include/net/mac80211.h
@@ -1733,6 +1733,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.
+ * @st_ctx: Pointer to IEEE P802.11bn SMD Transition context information.
+ * Only needed for ST Preparation Request and ST Execution Request action
+ * frames. The pointer will be consumed by mac80211; must be kmalloc-ed.
+ * Indicated by @st_ctx_valid.
* @device_timestamp: arbitrary timestamp for the device, mac80211 doesn't use
* it but can store it and pass it back to the driver for synchronisation
* @band: the active band when this frame was received
@@ -1774,12 +1778,15 @@ enum mac80211_rx_encoding {
* mac80211 internally, it uses @freq set by the driver to identify the
* correct link per vif. Set to %IEEE80211_LINK_UNSPECIFIED for non-MLD
* or if link information is not applicable.
+ * @st_ctx_valid: if @st_ctx has a valid pointer to the ST context. This flag
+ * is used only for ST Preparation or ST Execution Request frames.
*/
struct ieee80211_rx_status {
u64 mactime;
union {
u64 boottime_ns;
ktime_t ack_tx_hwtstamp;
+ struct ieee80211_st_ctx *st_ctx;
};
u32 device_timestamp;
u32 ampdu_reference;
@@ -1813,7 +1820,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,
+ st_ctx_valid:1;
};
static_assert(sizeof(struct ieee80211_rx_status) <= sizeof_field(struct sk_buff, cb));
diff --git a/net/mac80211/ieee80211_i.h b/net/mac80211/ieee80211_i.h
index a74b1e711733..e77eebb62886 100644
--- a/net/mac80211/ieee80211_i.h
+++ b/net/mac80211/ieee80211_i.h
@@ -279,6 +279,8 @@ struct ieee80211_rx_data {
};
u8 link_addrs[3 * ETH_ALEN];
+
+ struct ieee80211_st_ctx *st_ctx;
};
struct ieee80211_csa_settings {
diff --git a/net/mac80211/rx.c b/net/mac80211/rx.c
index d7d662c9ccd5..c2f1a30d5c12 100644
--- a/net/mac80211/rx.c
+++ b/net/mac80211/rx.c
@@ -4006,6 +4006,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->st_ctx)
+ return;
+
+ type = mgmt->u.action.uhr_link_reconf_req.type;
+
+ info->st_info.type = type;
+ info->st_info.ctx = rx->st_ctx;
+}
+
static ieee80211_rx_result debug_noinline
ieee80211_rx_h_userspace_mgmt(struct ieee80211_rx_data *rx)
{
@@ -4017,6 +4033,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 */
@@ -4038,6 +4055,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)) {
@@ -5687,10 +5707,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_st_ctx *st_ctx = NULL;
struct ieee80211_rx_data rx = {};
WARN_ON_ONCE(softirq_count() == 0);
+ /* cache the pointer to free it later */
+ if (status->st_ctx_valid) {
+ st_ctx = status->st_ctx;
+ status->st_ctx = NULL;
+ status->st_ctx_valid = false;
+ }
+
if (WARN_ON(status->band >= NUM_NL80211_BANDS))
goto drop;
@@ -5822,6 +5850,12 @@ void ieee80211_rx_list(struct ieee80211_hw *hw,
kcov_remote_start_common(skb_get_kcov_handle(skb));
+ rx.st_ctx = st_ctx;
+
+ if (WARN_ONCE((status->flag & RX_FLAG_8023) && rx.st_ctx,
+ "802.3 packet but with IEEE P802.11bn ST context"))
+ goto drop;
+
/*
* Frames with failed FCS/PLCP checksum are not returned,
* all other frames are returned without radiotap header
@@ -5841,10 +5875,12 @@ void ieee80211_rx_list(struct ieee80211_hw *hw,
__ieee80211_rx_handle_packet(hw, link_pubsta, skb,
list, &rx);
}
+ kfree(st_ctx);
kcov_remote_stop();
return;
drop:
+ kfree(st_ctx);
kfree_skb(skb);
}
EXPORT_SYMBOL(ieee80211_rx_list);
--
2.34.1
^ permalink raw reply [flat|nested] 20+ messages in thread
* [PATCH wireless-next v5 17/19] wifi: mac80211: add mac80211 support to handle NL80211_CMD_SET_ST_CTX
2026-12-02 10:27 [PATCH wireless-next v5 00/19] wifi: Add Seamless Mobility Domain (SMD) AP support Pooventhiran G
` (15 preceding siblings ...)
2026-12-02 10:28 ` [PATCH wireless-next v5 16/19] wifi: mac80211: handle UHR Link Reconfiguration frame Pooventhiran G
@ 2026-12-02 10:28 ` Pooventhiran G
2026-12-02 10:28 ` [PATCH wireless-next v5 18/19] wifi: mac80211: add mac80211 support to handle NL80211_CMD_GET_ST_CTX Pooventhiran G
2026-12-02 10:28 ` [PATCH wireless-next v5 19/19] wifi: mac80211: define API to invoke ST Drain Completion event Pooventhiran G
18 siblings, 0 replies; 20+ messages in thread
From: Pooventhiran G @ 2026-12-02 10:28 UTC (permalink / raw)
To: Johannes Berg; +Cc: linux-wireless, linux-kernel, pooventhiran.g
cfg80211 supports NL80211_CMD_SET_ST_CTX on the target AP MLD for
userspace to program the station's dynamic context on the TX and RX
queues.
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 ST procedure.
Signed-off-by: Pooventhiran G <pooventhiran.g@oss.qualcomm.com>
---
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(+)
diff --git a/include/net/mac80211.h b/include/net/mac80211.h
index be8406bb0d73..6b500d039374 100644
--- a/include/net/mac80211.h
+++ b/include/net/mac80211.h
@@ -4807,6 +4807,8 @@ enum ieee80211_sta_st_state {
* notification frame.
* @sta_notify_st: Notifies low level driver about IEEE 802.11bn ST substate
* transition of a station. The callback can sleep.
+ * @set_st_ctx: Set the ST context for the non-AP MLD. This is used on the
+ * target AP MLD side to program dynamic context.
*/
struct ieee80211_ops {
void (*tx)(struct ieee80211_hw *hw,
@@ -5224,6 +5226,9 @@ struct ieee80211_ops {
struct ieee80211_vif *vif,
struct ieee80211_sta *sta,
enum ieee80211_sta_st_state state);
+ int (*set_st_ctx)(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
+ struct ieee80211_sta *sta,
+ struct cfg80211_smd_transition_info *st_info);
};
/**
diff --git a/net/mac80211/cfg.c b/net/mac80211/cfg.c
index 0a4ba00c962e..9f0083fa7dd9 100644
--- a/net/mac80211/cfg.c
+++ b/net/mac80211/cfg.c
@@ -6351,6 +6351,35 @@ ieee80211_set_nan_non_evac_channels(struct wiphy *wiphy,
return ieee80211_nan_set_non_evac_channels(sdata, channels);
}
+static int ieee80211_set_st_ctx(struct wiphy *wiphy, struct wireless_dev *wdev,
+ const u8 *addr,
+ struct cfg80211_smd_transition_info *st_info)
+{
+ struct ieee80211_local *local = wiphy_priv(wiphy);
+ struct ieee80211_sub_if_data *sdata;
+ 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_sta ||
+ sta->st_state != IEEE80211_STA_ST_PREPARED)
+ return -EINVAL;
+
+ if (!wiphy_dereference(wiphy, sta->ptk[sta->ptk_idx]))
+ return -EINVAL;
+
+ return drv_set_st_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,
@@ -6474,4 +6503,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_st_ctx = ieee80211_set_st_ctx,
};
diff --git a/net/mac80211/driver-ops.h b/net/mac80211/driver-ops.h
index 8b35f3f89f78..5cef900b7809 100644
--- a/net/mac80211/driver-ops.h
+++ b/net/mac80211/driver-ops.h
@@ -1793,4 +1793,28 @@ void drv_sta_notify_st(struct ieee80211_local *local,
struct ieee80211_sta *sta,
enum ieee80211_sta_st_state state);
+static inline int drv_set_st_ctx(struct ieee80211_local *local,
+ struct ieee80211_sub_if_data *sdata,
+ struct ieee80211_sta *sta,
+ struct cfg80211_smd_transition_info *st_info)
+{
+ int ret;
+
+ if (!local->ops->set_st_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_st_ctx(local, sdata, sta, st_info);
+ ret = local->ops->set_st_ctx(&local->hw, &sdata->vif, sta, st_info);
+ trace_drv_return_int(local, ret);
+
+ return ret;
+}
+
#endif /* __MAC80211_DRIVER_OPS */
diff --git a/net/mac80211/trace.h b/net/mac80211/trace.h
index 00464c6f3ae7..c996f99ea1b2 100644
--- a/net/mac80211/trace.h
+++ b/net/mac80211/trace.h
@@ -3454,6 +3454,42 @@ TRACE_EVENT(drv_sta_notify_st,
)
);
+TRACE_EVENT(drv_set_st_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_st_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
--
2.34.1
^ permalink raw reply [flat|nested] 20+ messages in thread
* [PATCH wireless-next v5 18/19] wifi: mac80211: add mac80211 support to handle NL80211_CMD_GET_ST_CTX
2026-12-02 10:27 [PATCH wireless-next v5 00/19] wifi: Add Seamless Mobility Domain (SMD) AP support Pooventhiran G
` (16 preceding siblings ...)
2026-12-02 10:28 ` [PATCH wireless-next v5 17/19] wifi: mac80211: add mac80211 support to handle NL80211_CMD_SET_ST_CTX Pooventhiran G
@ 2026-12-02 10:28 ` Pooventhiran G
2026-12-02 10:28 ` [PATCH wireless-next v5 19/19] wifi: mac80211: define API to invoke ST Drain Completion event Pooventhiran G
18 siblings, 0 replies; 20+ messages in thread
From: Pooventhiran G @ 2026-12-02 10:28 UTC (permalink / raw)
To: Johannes Berg; +Cc: linux-wireless, linux-kernel, pooventhiran.g
cfg80211 supports NL80211_CMD_GET_ST_CTX from userspace on the current
AP MLD to collect the station's context on the target AP MLD's behalf;
this context is used by the target AP MLD to program its TX and RX
queues to support seamless roaming of the non-AP MLD.
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_st_ctx_done(), which then packs the context into
NL80211_CMD_ST_CTX_EVENT and delivers it to userspace as a multicast
event.
Signed-off-by: Pooventhiran G <pooventhiran.g@oss.qualcomm.com>
---
include/net/mac80211.h | 26 ++++++++++++++++++++++++++
net/mac80211/cfg.c | 26 ++++++++++++++++++++++++++
net/mac80211/driver-ops.h | 24 ++++++++++++++++++++++++
net/mac80211/trace.h | 27 +++++++++++++++++++++++++++
4 files changed, 103 insertions(+)
diff --git a/include/net/mac80211.h b/include/net/mac80211.h
index 6b500d039374..3d0297795081 100644
--- a/include/net/mac80211.h
+++ b/include/net/mac80211.h
@@ -4809,6 +4809,11 @@ enum ieee80211_sta_st_state {
* transition of a station. The callback can sleep.
* @set_st_ctx: Set the ST context for the non-AP MLD. This is used on the
* target AP MLD side to program dynamic context.
+ * @get_st_ctx: Get the ST context for the non-AP MLD. This is used in the
+ * current AP MLD side on behalf of the target AP MLD to collect dynamic
+ * context, when the non-AP MLD sends ST Execute frame directly to the
+ * target. Since the response is asynchronous, the drivers that implement
+ * this should not store reference to @sta.
*/
struct ieee80211_ops {
void (*tx)(struct ieee80211_hw *hw,
@@ -5229,6 +5234,9 @@ struct ieee80211_ops {
int (*set_st_ctx)(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
struct ieee80211_sta *sta,
struct cfg80211_smd_transition_info *st_info);
+ int (*get_st_ctx)(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
+ struct ieee80211_sta *sta,
+ enum nl80211_st_ctx_type type);
};
/**
@@ -8306,4 +8314,22 @@ 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_st_ctx_done - Deliver async get_st_ctx result to nl80211
+ * @vif: virtual interface
+ * @sta_addr: non-AP MLD address the context was collected for
+ * @st_info: SMD Transition Info (set @st_info->ctx to NULL to indicate
+ * failure)
+ */
+static inline
+void ieee80211_get_st_ctx_done(struct ieee80211_vif *vif,
+ const u8 *sta_addr,
+ struct cfg80211_smd_transition_info *st_info)
+{
+ struct wireless_dev *wdev = ieee80211_vif_to_wdev(vif);
+
+ if (wdev)
+ cfg80211_notify_get_st_ctx_done(wdev, sta_addr, st_info);
+}
#endif /* MAC80211_H */
diff --git a/net/mac80211/cfg.c b/net/mac80211/cfg.c
index 9f0083fa7dd9..270f5bf47be3 100644
--- a/net/mac80211/cfg.c
+++ b/net/mac80211/cfg.c
@@ -6380,6 +6380,31 @@ static int ieee80211_set_st_ctx(struct wiphy *wiphy, struct wireless_dev *wdev,
return drv_set_st_ctx(local, sdata, &sta->sta, st_info);
}
+static int ieee80211_get_st_ctx(struct wiphy *wiphy, struct wireless_dev *wdev,
+ const u8 *addr,
+ enum nl80211_st_ctx_type type)
+{
+ struct ieee80211_local *local = wiphy_priv(wiphy);
+ struct ieee80211_sub_if_data *sdata;
+ 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_sta)
+ return -EINVAL;
+
+ return drv_get_st_ctx(local, sdata, &sta->sta, type);
+}
+
const struct cfg80211_ops mac80211_config_ops = {
.add_virtual_intf = ieee80211_add_iface,
.del_virtual_intf = ieee80211_del_iface,
@@ -6504,4 +6529,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_st_ctx = ieee80211_set_st_ctx,
+ .get_st_ctx = ieee80211_get_st_ctx,
};
diff --git a/net/mac80211/driver-ops.h b/net/mac80211/driver-ops.h
index 5cef900b7809..d29f68dc06b1 100644
--- a/net/mac80211/driver-ops.h
+++ b/net/mac80211/driver-ops.h
@@ -1817,4 +1817,28 @@ static inline int drv_set_st_ctx(struct ieee80211_local *local,
return ret;
}
+static inline int drv_get_st_ctx(struct ieee80211_local *local,
+ struct ieee80211_sub_if_data *sdata,
+ struct ieee80211_sta *sta,
+ enum nl80211_st_ctx_type type)
+{
+ int ret;
+
+ if (!sdata || !local->ops->get_st_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_st_ctx(local, sdata, sta, type);
+ ret = local->ops->get_st_ctx(&local->hw, &sdata->vif, sta, type);
+ trace_drv_return_int(local, ret);
+
+ return ret;
+}
+
#endif /* __MAC80211_DRIVER_OPS */
diff --git a/net/mac80211/trace.h b/net/mac80211/trace.h
index c996f99ea1b2..5526a7db53d9 100644
--- a/net/mac80211/trace.h
+++ b/net/mac80211/trace.h
@@ -3490,6 +3490,33 @@ TRACE_EVENT(drv_set_st_ctx,
)
);
+TRACE_EVENT(drv_get_st_ctx,
+ TP_PROTO(struct ieee80211_local *local,
+ struct ieee80211_sub_if_data *sdata,
+ struct ieee80211_sta *sta,
+ enum nl80211_st_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
--
2.34.1
^ permalink raw reply [flat|nested] 20+ messages in thread
* [PATCH wireless-next v5 19/19] wifi: mac80211: define API to invoke ST Drain Completion event
2026-12-02 10:27 [PATCH wireless-next v5 00/19] wifi: Add Seamless Mobility Domain (SMD) AP support Pooventhiran G
` (17 preceding siblings ...)
2026-12-02 10:28 ` [PATCH wireless-next v5 18/19] wifi: mac80211: add mac80211 support to handle NL80211_CMD_GET_ST_CTX Pooventhiran G
@ 2026-12-02 10:28 ` Pooventhiran G
18 siblings, 0 replies; 20+ messages in thread
From: Pooventhiran G @ 2026-12-02 10:28 UTC (permalink / raw)
To: Johannes Berg; +Cc: linux-wireless, linux-kernel, pooventhiran.g
To indicate userspace the early termination of the DL draining period,
define an API for drivers to invoke the ST Drain Completion event.
Suggested-by: Rohan Dutta <drohan@qti.qualcomm.com>
Signed-off-by: Pooventhiran G <pooventhiran.g@oss.qualcomm.com>
---
include/net/mac80211.h | 18 ++++++++++++++++++
1 file changed, 18 insertions(+)
diff --git a/include/net/mac80211.h b/include/net/mac80211.h
index 3d0297795081..c3492f733830 100644
--- a/include/net/mac80211.h
+++ b/include/net/mac80211.h
@@ -8332,4 +8332,22 @@ void ieee80211_get_st_ctx_done(struct ieee80211_vif *vif,
if (wdev)
cfg80211_notify_get_st_ctx_done(wdev, sta_addr, st_info);
}
+
+/**
+ * ieee80211_notify_st_drain_completion - notify downlink drain completion for
+ * an SMD station.
+ * @vif: virtual interface
+ * @sta_addr: non-AP MLD address the ST Draining is being completed
+ *
+ * Return: 0 if success, -EINVAL otherwise
+ */
+static inline
+void ieee80211_notify_st_drain_completion(struct ieee80211_vif *vif,
+ const u8 *sta_addr)
+{
+ struct wireless_dev *wdev = ieee80211_vif_to_wdev(vif);
+
+ if (wdev)
+ cfg80211_notify_st_drain_completion(wdev, sta_addr);
+}
#endif /* MAC80211_H */
--
2.34.1
^ permalink raw reply [flat|nested] 20+ messages in thread
end of thread, other threads:[~2026-12-02 10:29 UTC | newest]
Thread overview: 20+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-12-02 10:27 [PATCH wireless-next v5 00/19] wifi: Add Seamless Mobility Domain (SMD) AP support Pooventhiran G
2026-12-02 10:27 ` [PATCH wireless-next v5 01/19] wifi: nl80211: define Seamless Mobility Domain (SMD) device capability Pooventhiran G
2026-12-02 10:27 ` [PATCH wireless-next v5 02/19] wifi: nl80211/cfg80211: define interfaces for SMD STA indications Pooventhiran G
2026-12-02 10:27 ` [PATCH wireless-next v5 03/19] wifi: nl80211: add ST sub-state STA flags for non-AP MLD Pooventhiran G
2026-12-02 10:27 ` [PATCH wireless-next v5 04/19] wifi: cfg80211: define layouts for ST context transfer Pooventhiran G
2026-12-02 10:28 ` [PATCH wireless-next v5 05/19] wifi: nl80211: define interfaces " Pooventhiran G
2026-12-02 10:28 ` [PATCH wireless-next v5 06/19] wifi: ieee80211: define APIs for UHR Link Reconfiguration frame checks Pooventhiran G
2026-12-02 10:28 ` [PATCH wireless-next v5 07/19] wifi: ieee80211: define API to check if frame is class 3 Pooventhiran G
2026-12-02 10:28 ` [PATCH wireless-next v5 08/19] wifi: nl80211/cfg80211: pack ST dynamic context along with frame Pooventhiran G
2026-12-02 10:28 ` [PATCH wireless-next v5 09/19] wifi: nl80211/cfg80211: add support for ST context programming Pooventhiran G
2026-12-02 10:28 ` [PATCH wireless-next v5 10/19] wifi: nl80211/cfg80211: add support for querying ST context for target AP MLD Pooventhiran G
2026-12-02 10:28 ` [PATCH wireless-next v5 11/19] wifi: nl80211/cfg80211: define API to notify ST Drain completion Pooventhiran G
2026-12-02 10:28 ` [PATCH wireless-next v5 12/19] wifi: mac80211: apply SMD indication and ST sub-states to STA Pooventhiran G
2026-12-02 10:28 ` [PATCH wireless-next v5 13/19] wifi: mac80211: add driver_op for ST substate changes Pooventhiran G
2026-12-02 10:28 ` [PATCH wireless-next v5 14/19] wifi: mac80211: filter uplink and downlink frames based on ST states Pooventhiran G
2026-12-02 10:28 ` [PATCH wireless-next v5 15/19] wifi: mac80211: pass rx_data directly from ieee80211_rx_list() Pooventhiran G
2026-12-02 10:28 ` [PATCH wireless-next v5 16/19] wifi: mac80211: handle UHR Link Reconfiguration frame Pooventhiran G
2026-12-02 10:28 ` [PATCH wireless-next v5 17/19] wifi: mac80211: add mac80211 support to handle NL80211_CMD_SET_ST_CTX Pooventhiran G
2026-12-02 10:28 ` [PATCH wireless-next v5 18/19] wifi: mac80211: add mac80211 support to handle NL80211_CMD_GET_ST_CTX Pooventhiran G
2026-12-02 10:28 ` [PATCH wireless-next v5 19/19] wifi: mac80211: define API to invoke ST Drain Completion event Pooventhiran G
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®