[PATCH v3 02/21] MLD STA: Fetch MLO assoc link ID info to core wpa_supplicant

Veerendranath Jakkam quic_vjakkam at quicinc.com
Wed Oct 19 07:13:50 PDT 2022


Add support to fetch MLO association link ID info from driver to
wpa_supplicant instance of corresponding MLD STA interface. This info
needed when setting the MLO connection info to wpa_sm.

Signed-off-by: Veerendranath Jakkam <quic_vjakkam at quicinc.com>
---
 src/drivers/driver.h               |  1 +
 src/drivers/driver_nl80211.c       |  4 ++--
 src/drivers/driver_nl80211.h       |  1 -
 src/drivers/driver_nl80211_event.c | 16 ++++++++--------
 wpa_supplicant/events.c            |  3 ++-
 wpa_supplicant/wpa_supplicant_i.h  |  1 +
 6 files changed, 14 insertions(+), 12 deletions(-)

diff --git a/src/drivers/driver.h b/src/drivers/driver.h
index 4d9a7e3c0..9132409c1 100644
--- a/src/drivers/driver.h
+++ b/src/drivers/driver.h
@@ -2742,6 +2742,7 @@ struct weighted_pcl {
 
 struct driver_sta_mlo_info {
 	u16 valid_links; /* bitmap of valid link IDs */
+	u8 assoc_link_id;
 	u8 ap_mld_addr[ETH_ALEN];
 	struct {
 		u8 addr[ETH_ALEN];
diff --git a/src/drivers/driver_nl80211.c b/src/drivers/driver_nl80211.c
index fdc773a58..38e3f825c 100644
--- a/src/drivers/driver_nl80211.c
+++ b/src/drivers/driver_nl80211.c
@@ -1502,7 +1502,7 @@ static int nl80211_get_assoc_freq_handler(struct nl_msg *msg, void *arg)
 		}
 
 		if (!drv->sta_mlo_info.valid_links ||
-		    drv->mlo_assoc_link_id == link_id) {
+		    drv->sta_mlo_info.assoc_link_id == link_id) {
 			ctx->assoc_freq = freq;
 			wpa_printf(MSG_DEBUG, "nl80211: Associated on %u MHz",
 				   ctx->assoc_freq);
@@ -1530,7 +1530,7 @@ static int nl80211_get_assoc_freq_handler(struct nl_msg *msg, void *arg)
 		}
 
 		if (!drv->sta_mlo_info.valid_links ||
-		    drv->mlo_assoc_link_id == link_id) {
+		    drv->sta_mlo_info.assoc_link_id == link_id) {
 			os_memcpy(ctx->assoc_bssid, bssid, ETH_ALEN);
 			wpa_printf(MSG_DEBUG, "nl80211: Associated with "
 				   MACSTR, MAC2STR(bssid));
diff --git a/src/drivers/driver_nl80211.h b/src/drivers/driver_nl80211.h
index 3eb2a74ab..0b8b0ce11 100644
--- a/src/drivers/driver_nl80211.h
+++ b/src/drivers/driver_nl80211.h
@@ -128,7 +128,6 @@ struct wpa_driver_nl80211_data {
 	u8 bssid[ETH_ALEN];
 	u8 prev_bssid[ETH_ALEN];
 	int associated;
-	int mlo_assoc_link_id;
 	struct driver_sta_mlo_info sta_mlo_info;
 	u8 ssid[SSID_MAX_LEN];
 	size_t ssid_len;
diff --git a/src/drivers/driver_nl80211_event.c b/src/drivers/driver_nl80211_event.c
index aaf4c755f..929bb1888 100644
--- a/src/drivers/driver_nl80211_event.c
+++ b/src/drivers/driver_nl80211_event.c
@@ -537,10 +537,10 @@ static void nl80211_parse_mlo_info(struct wpa_driver_nl80211_data *drv,
 	if (!ml_ie)
 		return;
 
-	drv->mlo_assoc_link_id = nl80211_get_assoc_link_id(&ml_ie[3],
-							   ml_ie[1] - 1);
-	if (drv->mlo_assoc_link_id < 0 ||
-	    drv->mlo_assoc_link_id >= MAX_NUM_MLD_LINKS)
+	drv->sta_mlo_info.assoc_link_id = nl80211_get_assoc_link_id(
+						&ml_ie[3], ml_ie[1] - 1);
+	if (drv->sta_mlo_info.assoc_link_id < 0 ||
+	    drv->sta_mlo_info.assoc_link_id >= MAX_NUM_MLD_LINKS)
 		return;
 
 	os_memcpy(mlo->ap_mld_addr, nla_data(addr), ETH_ALEN);
@@ -554,14 +554,14 @@ static void nl80211_parse_mlo_info(struct wpa_driver_nl80211_data *drv,
 		nl80211_parse_qca_vendor_mlo_link_info(mlo, mlo_links);
 #endif /* CONFIG_DRIVER_NL80211_QCA */
 
-	if (!(mlo->valid_links & BIT(drv->mlo_assoc_link_id))) {
+	if (!(mlo->valid_links & BIT(drv->sta_mlo_info.assoc_link_id))) {
 		wpa_printf(MSG_ERROR, "nl80211: Invalid MLO assoc link ID %d",
-			   drv->mlo_assoc_link_id);
+			   drv->sta_mlo_info.assoc_link_id);
 		mlo->valid_links = 0;
 		return;
 	}
 
-	os_memcpy(drv->bssid, mlo->links[drv->mlo_assoc_link_id].bssid,
+	os_memcpy(drv->bssid, mlo->links[drv->sta_mlo_info.assoc_link_id].bssid,
 		  ETH_ALEN);
 	os_memcpy(drv->prev_bssid, drv->bssid, ETH_ALEN);
 }
@@ -926,7 +926,7 @@ static void mlme_event_ch_switch(struct wpa_driver_nl80211_data *drv,
 				EVENT_LINK_CH_SWITCH_STARTED, &data);
 		}
 
-		if (link_id != drv->mlo_assoc_link_id)
+		if (link_id != drv->sta_mlo_info.assoc_link_id)
 			return;
 	}
 
diff --git a/wpa_supplicant/events.c b/wpa_supplicant/events.c
index e0a97bc2e..f3cbe9755 100644
--- a/wpa_supplicant/events.c
+++ b/wpa_supplicant/events.c
@@ -3387,13 +3387,14 @@ static int wpa_drv_get_mlo_info(struct wpa_supplicant *wpa_s)
 			}
 		}
 
-		if (match &&
+		if (match && wpa_s->mlo_assoc_link_id == mlo.assoc_link_id &&
 		    os_memcmp(wpa_s->ap_mld_addr, mlo.ap_mld_addr,
 			      ETH_ALEN) == 0)
 			return 0;
 	}
 
 	wpa_s->valid_links = mlo.valid_links;
+	wpa_s->mlo_assoc_link_id = mlo.assoc_link_id;
 	os_memcpy(wpa_s->ap_mld_addr, mlo.ap_mld_addr, ETH_ALEN);
 	for (i = 0; i < MAX_NUM_MLD_LINKS; i++) {
 		if (!(wpa_s->valid_links & BIT(i)))
diff --git a/wpa_supplicant/wpa_supplicant_i.h b/wpa_supplicant/wpa_supplicant_i.h
index 4081592bd..9db847cec 100644
--- a/wpa_supplicant/wpa_supplicant_i.h
+++ b/wpa_supplicant/wpa_supplicant_i.h
@@ -740,6 +740,7 @@ struct wpa_supplicant {
 	int ap_ies_from_associnfo;
 	unsigned int assoc_freq;
 	u8 ap_mld_addr[ETH_ALEN];
+	u8 mlo_assoc_link_id;
 	u8 valid_links; /* bitmap of valid MLO link IDs */
 	struct {
 		u8 addr[ETH_ALEN];
-- 
2.25.1




More information about the Hostap mailing list