mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
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 12/19] wifi: mac80211: apply SMD indication and ST sub-states to STA
Date: Wed, 02 Dec 2026 15:58:07 +0530	[thread overview]
Message-ID: <20261202-smd-v5-12-1b020be65c7c@oss.qualcomm.com> (raw)
In-Reply-To: <20261202-smd-v5-0-1b020be65c7c@oss.qualcomm.com>

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


  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 ` Pooventhiran G [this message]
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

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-12-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®