[PATCH 05/10] AP: SMD: Setup SMD for APs across multiple BSSIDs

Pooventhiran G pooventhiran.g at oss.qualcomm.com
Sat Nov 21 12:34:14 PST 2026


When MBSSID is enabled along with SMD for an AP, support appropriate
advertisements in the MBSSID element(s) subject to the Inheritance
rules. The Reduced Neighbor Report element carries a bit, Same SMD, to
indicate SMD membership of the reported AP with respect to the reporting
AP.

Signed-off-by: Pooventhiran G <pooventhiran.g at oss.qualcomm.com>
---
 src/ap/ieee802_11.c | 71 ++++++++++++++++++++++++++++++++++++---------
 1 file changed, 58 insertions(+), 13 deletions(-)

diff --git a/src/ap/ieee802_11.c b/src/ap/ieee802_11.c
index 0b36bc5c25be..6b1bb0cf0494 100644
--- a/src/ap/ieee802_11.c
+++ b/src/ap/ieee802_11.c
@@ -11724,6 +11724,13 @@ static bool hostapd_eid_rnr_bss(struct hostapd_data *hapd,
 
 	bss_param |= RNR_BSS_PARAM_CO_LOCATED;
 
+#ifdef CONFIG_IEEE80211BN
+	if (reporting_hapd->conf->smd.enabled && bss->conf->smd.enabled &&
+	    ether_addr_equal(reporting_hapd->conf->smd.identifier,
+			     bss->conf->smd.identifier))
+		bss_param |= RNR_BSS_PARAM_SAME_SMD;
+#endif /* CONFIG_IEEE80211BN */
+
 	*eid++ = bss_param;
 	*eid++ = RNR_20_MHZ_PSD_MAX_TXPOWER;
 
@@ -12035,8 +12042,8 @@ static size_t hostapd_eid_mbssid_elem_len(struct hostapd_data *hapd,
 					  size_t known_bss_len)
 {
 	struct hostapd_data *tx_bss = hostapd_mbssid_get_tx_bss(hapd);
-	size_t len, i, tx_xrate_len;
-	u8 ext_capa[20], buf[100];
+	size_t len, i, tx_xrate_len, tx_bss_smd_info_len = 0;
+	u8 ext_capa[20], buf[100], tx_bss_smd_info[20];
 
 	/* Element ID: 1 octet
 	 * Length: 1 octet
@@ -12050,12 +12057,17 @@ static size_t hostapd_eid_mbssid_elem_len(struct hostapd_data *hapd,
 	len = 1;
 
 	tx_xrate_len = hostapd_eid_ext_supp_rates(tx_bss, buf) - buf;
+#ifdef CONFIG_IEEE80211BN
+	tx_bss_smd_info_len = hostapd_eid_smd_info_len(tx_bss);
+	(void) hostapd_eid_smd_info(tx_bss, tx_bss_smd_info);
+#endif /* CONFIG_IEEE80211BN */
 
 	for (i = *bss_index; i < hapd->iface->num_bss; i++) {
 		struct hostapd_data *bss = hapd->iface->bss[i];
 		const u8 *auth, *rsn = NULL, *rsnx = NULL;
-		size_t nontx_profile_len, auth_len, xrate_len;
-		u8 ie_count = 0;
+		size_t nontx_profile_len, auth_len, xrate_len, smd_info_len = 0;
+		u8 ie_count = 0, ext_ie_count = 0;
+		u8 smd_info[20];
 
 		if (!bss || !bss->conf || !bss->started ||
 		    mbssid_known_bss(i, known_bss, known_bss_len))
@@ -12087,7 +12099,6 @@ static size_t hostapd_eid_mbssid_elem_len(struct hostapd_data *hapd,
 
 		nontx_profile_len += hostapd_mbssid_ext_capa(bss, tx_bss,
 							     ext_capa);
-
 		if (!rsn && hostapd_wpa_ie(tx_bss, WLAN_EID_RSN))
 			ie_count++;
 		if (!rsnx && hostapd_wpa_ie(tx_bss, WLAN_EID_RSNX))
@@ -12109,8 +12120,19 @@ static size_t hostapd_eid_mbssid_elem_len(struct hostapd_data *hapd,
 				bss, NULL, true, false);
 #endif /* CONFIG_IEEE80211BE */
 
-		if (ie_count)
-			nontx_profile_len += 4 + ie_count + 1;
+#ifdef CONFIG_IEEE80211BN
+		smd_info_len = hostapd_eid_smd_info_len(bss);
+		(void) hostapd_eid_smd_info(bss, smd_info);
+#endif /* CONFIG_IEEE80211BN */
+
+		if (tx_bss_smd_info_len && !smd_info_len)
+			ext_ie_count++;
+		else if (smd_info_len &&
+			 os_memcmp(tx_bss_smd_info, smd_info, smd_info_len))
+			nontx_profile_len += smd_info_len;
+
+		if (ie_count || ext_ie_count)
+			nontx_profile_len += 4 + ie_count + 1 + ext_ie_count;
 
 		if (len + nontx_profile_len > 255)
 			break;
@@ -12200,15 +12222,19 @@ static u8 * hostapd_eid_mbssid_elem(struct hostapd_data *hapd, u8 *eid, u8 *end,
 				    const u8 *known_bss, size_t known_bss_len)
 {
 	struct hostapd_data *tx_bss = hostapd_mbssid_get_tx_bss(hapd);
-	size_t i, tx_xrate_len;
+	size_t i, tx_xrate_len, tx_smd_info_len = 0;
 	u8 *eid_len_offset, *max_bssid_indicator_offset;
-	u8 buf[100];
+	u8 buf[100], tx_smd_info[20];
 
 	*eid++ = WLAN_EID_MULTIPLE_BSSID;
 	eid_len_offset = eid++;
 	max_bssid_indicator_offset = eid++;
 
 	tx_xrate_len = hostapd_eid_ext_supp_rates(tx_bss, buf) - buf;
+#ifdef CONFIG_IEEE80211BN
+	tx_smd_info_len = hostapd_eid_smd_info_len(tx_bss);
+	(void) hostapd_eid_smd_info(tx_bss, tx_smd_info);
+#endif /* CONFIG_IEEE80211BN */
 
 	for (i = *bss_index; i < hapd->iface->num_bss; i++) {
 		struct hostapd_data *bss = hapd->iface->bss[i];
@@ -12217,9 +12243,11 @@ static u8 * hostapd_eid_mbssid_elem(struct hostapd_data *hapd, u8 *eid, u8 *end,
 		u8 *eid_len_pos, *nontx_bss_start = eid;
 		const u8 *auth, *rsn = NULL, *rsnx = NULL;
 		u8 ie_count = 0, non_inherit_ie[3];
-		size_t auth_len = 0, xrate_len;
+		u8 ext_ie_count = 0, non_inherit_ext_ie[3];
+		size_t auth_len = 0, xrate_len, smd_info_len = 0;
 		u16 capab_info;
 		u8 mbssindex = i;
+		u8 smd_info[20];
 
 		if (!bss || !bss->conf || !bss->started ||
 		    mbssid_known_bss(i, known_bss, known_bss_len))
@@ -12300,14 +12328,31 @@ static u8 * hostapd_eid_mbssid_elem(struct hostapd_data *hapd, u8 *eid, u8 *end,
 			eid = hostapd_eid_eht_basic_ml_common(bss, eid, NULL,
 							      true, false);
 #endif /* CONFIG_IEEE80211BE */
-		if (ie_count) {
+
+#ifdef CONFIG_IEEE80211BN
+		smd_info_len = hostapd_eid_smd_info_len(bss);
+		(void) hostapd_eid_smd_info(bss, smd_info);
+#endif /* CONFIG_IEEE80211BN */
+
+		if (tx_smd_info_len && !smd_info_len) {
+			non_inherit_ext_ie[ext_ie_count++] =
+				WLAN_EID_EXT_SMD_INFO;
+		} else if (smd_info_len &&
+			   os_memcmp(tx_smd_info, smd_info, smd_info_len)) {
+			os_memcpy(eid, smd_info, smd_info_len);
+			eid += smd_info_len;
+		}
+
+		if (ie_count || ext_ie_count) {
 			*eid++ = WLAN_EID_EXTENSION;
-			*eid++ = 2 + ie_count + 1;
+			*eid++ = 2 + ie_count + 1 + ext_ie_count;
 			*eid++ = WLAN_EID_EXT_NON_INHERITANCE;
 			*eid++ = ie_count;
 			os_memcpy(eid, non_inherit_ie, ie_count);
 			eid += ie_count;
-			*eid++ = 0; /* No Element ID Extension List */
+			*eid++ = ext_ie_count;
+			os_memcpy(eid, non_inherit_ext_ie, ext_ie_count);
+			eid += ext_ie_count;
 		}
 
 		*eid_len_pos = (eid - eid_len_pos) - 1;
-- 
2.34.1




More information about the Hostap mailing list