[PATCH wireless-next v5 12/19] wifi: mac80211: apply SMD indication and ST sub-states to STA
From: Pooventhiran G
Date: Wed Dec 02 2026 - 05:29:12 EST
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@xxxxxxxxxxxxxxxx>
Signed-off-by: Pooventhiran G <pooventhiran.g@xxxxxxxxxxxxxxxx>
---
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