[PATCH wireless-next v3 02/21] wifi: nl80211/cfg80211: define interfaces for SMD setup and STA update

From: Pooventhiran G

Date: Thu Nov 05 2026 - 14:58:24 EST


From: Aditya Sathish <asathish@xxxxxxxxxxxxxxxx>

Define nl80211 and cfg80211 interfaces to support SMD setup for an AP
MLD and the non-AP STA MLD creation upon SMD negotiation.

Allow only APs affiliated to an AP MLD to enable SMD while starting.
STA creation can happen in two ways: typical 802.11 association with SMD
negotiated or via SMD BSS Transition Preparation on the target AP MLD;
the latter should be marked explicitly to inform drivers so that they
can handle ST Execution and datapath switch once the ST procedure is
completed.

Signed-off-by: Aditya Sathish <asathish@xxxxxxxxxxxxxxxx>
Co-developed-by: Rohan Dutta <drohan@xxxxxxxxxxxxxxxx>
Signed-off-by: Rohan Dutta <drohan@xxxxxxxxxxxxxxxx>
Co-developed-by: Sidhanta Sahu <sidhanta.sahu@xxxxxxxxxxxxxxxx>
Signed-off-by: Sidhanta Sahu <sidhanta.sahu@xxxxxxxxxxxxxxxx>
Signed-off-by: Pooventhiran G <pooventhiran.g@xxxxxxxxxxxxxxxx>
---
include/net/cfg80211.h | 15 ++++++++++
include/uapi/linux/nl80211.h | 10 +++++++
net/wireless/nl80211.c | 68 +++++++++++++++++++++++++++++++++++++++-----
3 files changed, 86 insertions(+), 7 deletions(-)

diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h
index b4f384ade47a..54d549afd8e3 100644
--- a/include/net/cfg80211.h
+++ b/include/net/cfg80211.h
@@ -1624,6 +1624,7 @@ struct cfg80211_s1g_short_beacon {
* @mbssid_config: AP settings for multiple bssid
* @s1g_long_beacon_period: S1G long beacon period
* @s1g_short_beacon: S1G short beacon data
+ * @smd: Seamless Mobility Domain (SMD) enabled
*/
struct cfg80211_ap_settings {
struct cfg80211_chan_def chandef;
@@ -1656,6 +1657,7 @@ struct cfg80211_ap_settings {
struct cfg80211_mbssid_config mbssid_config;
u8 s1g_long_beacon_period;
struct cfg80211_s1g_short_beacon s1g_short_beacon;
+ bool smd;
};


@@ -1880,6 +1882,17 @@ struct cfg80211_ttlm_params {
u16 ulink[8];
};

+/**
+ * struct cfg80211_sta_smd_params - SMD parameters for an added station
+ *
+ * @smd_sta: SMD-negotiated STA
+ * @roam_sta: station was created via SMD BSS Transition procedure
+ */
+struct cfg80211_sta_smd_params {
+ bool smd_sta;
+ bool roam_sta;
+};
+
/**
* struct station_parameters - station parameters
*
@@ -1920,6 +1933,7 @@ struct cfg80211_ttlm_params {
* @link_sta_params: link related params.
* @epp_peer: EPP peer indication
* @nmi_mac: MAC address of the NMI station of the NAN peer
+ * @smd_params: SMD params for this station
*/
struct station_parameters {
struct net_device *vlan;
@@ -1948,6 +1962,7 @@ struct station_parameters {
struct link_station_parameters link_sta_params;
bool epp_peer;
const u8 *nmi_mac;
+ struct cfg80211_sta_smd_params smd_params;
};

/**
diff --git a/include/uapi/linux/nl80211.h b/include/uapi/linux/nl80211.h
index 3e71564ce87c..cfc1bcad13f0 100644
--- a/include/uapi/linux/nl80211.h
+++ b/include/uapi/linux/nl80211.h
@@ -361,6 +361,11 @@
* SMD capability in %NL80211_CMD_GET_WIPHY.
* %NL80211_CMD_START_AP carries %NL80211_ATTR_SMD_SUPPORT to indicate that
* the AP affiliated to an AP MLD is part of an SMD.
+ * %NL80211_CMD_NEW_STATION carries %NL80211_ATTR_SMD_SUPPORT to indicate
+ * that the non-AP MLD getting added has successfully negotiated SMD with
+ * the AP MLD. %NL80211_ATTR_SMD_ROAM_STA is also set on the target AP MLD
+ * to indicate that it is part of ST Preparation; drivers must keep these
+ * links in powersave at this point until successful ST Execution.
*/

/**
@@ -3265,6 +3270,8 @@ enum nl80211_commands {
*
* @NL80211_ATTR_SMD_SUPPORT: Flag attribute to indicate SMD support. Used with
* multiple commands to indicate appropriate SMD support (refer DOC).
+ * @NL80211_ATTR_SMD_ROAM_STA: Flag attribute to indicate that the station is
+ * created as part of SMD BSS Transition and not by typical association.
*
* @NUM_NL80211_ATTR: total number of nl80211_attrs available
* @NL80211_ATTR_MAX: highest attribute number currently defined
@@ -3874,6 +3881,7 @@ enum nl80211_attrs {
NL80211_ATTR_ASSOC_PROTECTED_TWT,

NL80211_ATTR_SMD_SUPPORT,
+ NL80211_ATTR_SMD_ROAM_STA,

/* add attributes here, update the policy in nl80211.c */

@@ -4026,6 +4034,7 @@ enum nl80211_iftype {
* previously added station into associated state
* @NL80211_STA_FLAG_SPP_AMSDU: station supports SPP A-MSDUs
* @NL80211_STA_FLAG_CIP: station has Control Integrity Protocol (CIP) enabled
+ * @NL80211_STA_FLAG_SMD: station has negotiated SMD.
* @NL80211_STA_FLAG_MAX: highest station flag number currently defined
* @__NL80211_STA_FLAG_AFTER_LAST: internal use
*/
@@ -4040,6 +4049,7 @@ enum nl80211_sta_flags {
NL80211_STA_FLAG_ASSOCIATED,
NL80211_STA_FLAG_SPP_AMSDU,
NL80211_STA_FLAG_CIP,
+ NL80211_STA_FLAG_SMD,

/* keep last */
__NL80211_STA_FLAG_AFTER_LAST,
diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c
index 16d00ebed10a..b06772ec8ac5 100644
--- a/net/wireless/nl80211.c
+++ b/net/wireless/nl80211.c
@@ -1202,6 +1202,7 @@ 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_SUPPORT] = { .type = NLA_FLAG },
+ [NL80211_ATTR_SMD_ROAM_STA] = { .type = NLA_FLAG },
};

/* policy for the key attributes */
@@ -7379,6 +7380,28 @@ static int nl80211_check_npca(struct cfg80211_registered_device *rdev,
return -EINVAL;
}

+static int nl80211_validate_smd(struct genl_info *info,
+ struct cfg80211_ap_settings *params)
+{
+ struct cfg80211_registered_device *rdev = info->user_ptr[0];
+ struct net_device *dev = info->user_ptr[1];
+ struct wireless_dev *wdev = dev->ieee80211_ptr;
+
+ if (!(rdev->wiphy.flags & WIPHY_FLAG_SUPPORTS_SMD)) {
+ GENL_SET_ERR_MSG(info, "SMD is not supported");
+ return -EOPNOTSUPP;
+ }
+
+ if (!wdev->valid_links) {
+ GENL_SET_ERR_MSG(info, "SMD is not allowed without MLO");
+ return -EINVAL;
+ }
+
+ params->smd = true;
+
+ return 0;
+}
+
static int nl80211_start_ap(struct sk_buff *skb, struct genl_info *info)
{
struct cfg80211_registered_device *rdev = info->user_ptr[0];
@@ -7661,6 +7684,12 @@ static int nl80211_start_ap(struct sk_buff *skb, struct genl_info *info)

/* FIXME: validate MLO/link-id against driver capabilities */

+ if (info->attrs[NL80211_ATTR_SMD_SUPPORT]) {
+ err = nl80211_validate_smd(info, params);
+ if (err)
+ goto out;
+ }
+
err = rdev_start_ap(rdev, dev, params);
if (!err) {
wdev->links[link_id].ap.beacon_interval = params->beacon_interval;
@@ -7995,6 +8024,7 @@ 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_SMD] = { .type = NLA_FLAG },
};

static int parse_station_flags(struct genl_info *info,
@@ -8061,11 +8091,13 @@ static int parse_station_flags(struct genl_info *info,
switch (iftype) {
case NL80211_IFTYPE_AP:
case NL80211_IFTYPE_AP_VLAN:
+ params->sta_flags_mask = BIT(NL80211_STA_FLAG_SMD);
+ 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:
@@ -9276,7 +9308,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 != 10);

switch (statype) {
case CFG80211_STA_MESH_PEER_KERNEL:
@@ -9371,7 +9403,8 @@ 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_SMD)))
return -EINVAL;

/* but authenticated/associated only if driver handles it */
@@ -9633,6 +9666,23 @@ static int nl80211_parse_sta_txpower_setting(struct genl_info *info,
return 0;
}

+static int nl80211_parse_sta_smd(struct genl_info *info,
+ struct station_parameters *params)
+{
+ params->smd_params.smd_sta =
+ !!info->attrs[NL80211_ATTR_SMD_SUPPORT];
+
+ if (!params->smd_params.smd_sta)
+ return 0;
+
+ if (!info->attrs[NL80211_ATTR_MLD_ADDR])
+ return -EINVAL;
+
+ params->smd_params.roam_sta = !!info->attrs[NL80211_ATTR_SMD_ROAM_STA];
+
+ return 0;
+}
+
static int nl80211_set_station(struct sk_buff *skb, struct genl_info *info)
{
struct cfg80211_registered_device *rdev = info->user_ptr[0];
@@ -10041,6 +10091,10 @@ static int nl80211_new_station(struct sk_buff *skb, struct genl_info *info)
if (parse_station_flags(info, wdev->iftype, &params))
return -EINVAL;

+ err = nl80211_parse_sta_smd(info, &params);
+ if (err)
+ return err;
+
/* HT/VHT requires QoS, but if we don't have that just ignore HT/VHT
* as userspace might just pass through the capabilities from the IEs
* directly, rather than enforcing this restriction and returning an
@@ -10074,7 +10128,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 != 10);

switch (wdev->iftype) {
case NL80211_IFTYPE_AP:

--
2.34.1