From: Pooventhiran G <pooventhiran.g@oss.qualcomm.com>
To: Johannes Berg <johannes@sipsolutions.net>
Cc: linux-wireless@vger.kernel.org, linux-kernel@vger.kernel.org,
pooventhiran.g@oss.qualcomm.com
Subject: [PATCH wireless-next v5 13/19] wifi: mac80211: add driver_op for ST substate changes
Date: Wed, 02 Dec 2026 15:58:08 +0530 [thread overview]
Message-ID: <20261202-smd-v5-13-1b020be65c7c@oss.qualcomm.com> (raw)
In-Reply-To: <20261202-smd-v5-0-1b020be65c7c@oss.qualcomm.com>
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
next prev parent reply other threads:[~2026-12-02 10:29 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
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 ` Pooventhiran G [this message]
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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20261202-smd-v5-13-1b020be65c7c@oss.qualcomm.com \
--to=pooventhiran.g@oss.qualcomm.com \
--cc=johannes@sipsolutions.net \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-wireless@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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®