[PATCH v2 17/17] Add support for parsing MLO connection info from roam+auth event

Veerendranath Jakkam quic_vjakkam at quicinc.com
Thu Sep 8 07:44:23 PDT 2022


Parse QCA_WLAN_VENDOR_ATTR_ROAM_AUTH_MLO_LINKS in
QCA_NL80211_VENDOR_SUBCMD_KEY_MGMT_ROAM_AUTH event.

Signed-off-by: Veerendranath Jakkam <quic_vjakkam at quicinc.com>
---
 src/drivers/driver_nl80211_event.c | 110 +++++++++++++++++++++--------
 1 file changed, 82 insertions(+), 28 deletions(-)

diff --git a/src/drivers/driver_nl80211_event.c b/src/drivers/driver_nl80211_event.c
index c4cffe051..d4fb4c385 100644
--- a/src/drivers/driver_nl80211_event.c
+++ b/src/drivers/driver_nl80211_event.c
@@ -420,8 +420,80 @@ convert_connect_fail_reason_codes(enum qca_sta_connect_fail_reason_codes
 	}
 }
 
+
+static void
+nl80211_parse_qca_vendor_mlo_link_info(struct driver_sta_mlo_info *mlo,
+				       struct nlattr *mlo_links)
+{
+	struct nlattr *link;
+	int rem_links;
+
+	nla_for_each_nested(link, mlo_links, rem_links) {
+		struct nlattr *tb[QCA_WLAN_VENDOR_ATTR_MLO_LINK_MAX + 1];
+		int link_id;
+
+		nla_parse(tb,QCA_WLAN_VENDOR_ATTR_MLO_LINK_MAX, nla_data(link),
+			  nla_len(link), NULL);
+
+		if (!tb[QCA_WLAN_VENDOR_ATTR_MLO_LINK_ID] ||
+		    !tb[QCA_WLAN_VENDOR_ATTR_MLO_LINK_MAC_ADDR] ||
+		    !tb[QCA_WLAN_VENDOR_ATTR_MLO_LINK_BSSID])
+			continue;
+
+		link_id = nla_get_u8(tb[QCA_WLAN_VENDOR_ATTR_MLO_LINK_ID]);
+		if (link_id >= MAX_NUM_MLD_LINKS)
+			continue;
+
+		mlo->valid_links |= BIT(link_id);
+		os_memcpy(mlo->links[link_id].addr,
+			  nla_data(tb[QCA_WLAN_VENDOR_ATTR_MLO_LINK_MAC_ADDR]),
+			  ETH_ALEN);
+		os_memcpy(mlo->links[link_id].bssid,
+			  nla_data(tb[QCA_WLAN_VENDOR_ATTR_MLO_LINK_BSSID]),
+			  ETH_ALEN);
+		wpa_printf(MSG_DEBUG, "link[%u].addr " MACSTR, link_id,
+			   MAC2STR(mlo->links[link_id].addr));
+		wpa_printf(MSG_DEBUG, "link[%u].bssid " MACSTR, link_id,
+			   MAC2STR(mlo->links[link_id].bssid));
+	}
+}
+
 #endif /* CONFIG_DRIVER_NL80211_QCA */
 
+static void nl80211_parse_mlo_link_info(struct driver_sta_mlo_info *mlo,
+					struct nlattr *mlo_links)
+{
+	struct nlattr *link;
+	int rem_links;
+
+	nla_for_each_nested(link, mlo_links, rem_links) {
+		struct nlattr *tb[NL80211_ATTR_MAX + 1];
+		int link_id;
+
+		nla_parse(tb, NL80211_ATTR_MAX, nla_data(link), nla_len(link),
+			  NULL);
+
+		if (!tb[NL80211_ATTR_MLO_LINK_ID] || !tb[NL80211_ATTR_MAC] ||
+		    !tb[NL80211_ATTR_BSSID])
+			continue;
+
+		link_id = nla_get_u8(tb[NL80211_ATTR_MLO_LINK_ID]);
+		if (link_id >= MAX_NUM_MLD_LINKS)
+			continue;
+
+		mlo->valid_links |= BIT(link_id);
+		os_memcpy(mlo->links[link_id].addr,
+			  nla_data(tb[NL80211_ATTR_MAC]), ETH_ALEN);
+		os_memcpy(mlo->links[link_id].bssid,
+			  nla_data(tb[NL80211_ATTR_BSSID]), ETH_ALEN);
+		wpa_printf(MSG_DEBUG, "link[%u].addr " MACSTR, link_id,
+			   MAC2STR(mlo->links[link_id].addr));
+		wpa_printf(MSG_DEBUG, "link[%u].bssid " MACSTR, link_id,
+			   MAC2STR(mlo->links[link_id].bssid));
+	}
+}
+
+
 static int nl80211_get_assoc_link_id(const u8* data, u8 len)
 {
 	if (!(data[0] & BASIC_MULTI_LINK_CTRL0_PRES_LINK_ID))
@@ -438,12 +510,11 @@ static int nl80211_get_assoc_link_id(const u8* data, u8 len)
 }
 
 static void nl80211_parse_mlo_info(struct wpa_driver_nl80211_data *drv,
+				   enum nl80211_commands cmd,
 				   struct nlattr *addr,
 				   struct nlattr *mlo_links,
 				   struct nlattr *resp_ie)
 {
-	struct nlattr *link;
-	int rem_links;
 	const u8 *ml_ie;
 	struct driver_sta_mlo_info *mlo = &drv->sta_mlo_info;
 
@@ -465,30 +536,13 @@ static void nl80211_parse_mlo_info(struct wpa_driver_nl80211_data *drv,
 	os_memcpy(mlo->ap_mld_addr, nla_data(addr), ETH_ALEN);
 	wpa_printf(MSG_DEBUG, "ap_mld_addr " MACSTR, MAC2STR(mlo->ap_mld_addr));
 
-	nla_for_each_nested(link, mlo_links, rem_links) {
-		struct nlattr *tb[NL80211_ATTR_MAX + 1];
-		int link_id;
-
-		nla_parse(tb, NL80211_ATTR_MAX, nla_data(link), nla_len(link),
-			  NULL);
-
-		if (!tb[NL80211_ATTR_MLO_LINK_ID] || !tb[NL80211_ATTR_MAC] ||
-		    !tb[NL80211_ATTR_BSSID])
-			continue;
-
-		link_id = nla_get_u8(tb[NL80211_ATTR_MLO_LINK_ID]);
-		if (link_id >= MAX_NUM_MLD_LINKS)
-			continue;
-
-		mlo->valid_links |= BIT(link_id);
-		os_memcpy(mlo->links[link_id].addr,
-			  nla_data(tb[NL80211_ATTR_MAC]), ETH_ALEN);
-		os_memcpy(mlo->links[link_id].bssid,
-			  nla_data(tb[NL80211_ATTR_BSSID]), ETH_ALEN);
-		wpa_printf(MSG_DEBUG, "link[%u].addr " MACSTR, link_id,
-			   MAC2STR(mlo->links[link_id].addr));
-		wpa_printf(MSG_DEBUG, "link[%u].bssid " MACSTR, link_id,
-			   MAC2STR(mlo->links[link_id].bssid));
+	if (0) {
+#ifdef CONFIG_DRIVER_NL80211_QCA
+	} else if (cmd == NL80211_CMD_ROAM) {
+		nl80211_parse_qca_vendor_mlo_link_info(mlo, mlo_links);
+#endif /* CONFIG_DRIVER_NL80211_QCA */
+	} else {
+		nl80211_parse_mlo_link_info(mlo, mlo_links);
 	}
 
 	if (!(mlo->valid_links & BIT(drv->mlo_assoc_link_id))) {
@@ -611,7 +665,7 @@ static void mlme_event_connect(struct wpa_driver_nl80211_data *drv,
 
 	drv->associated = 1;
 	drv->sta_mlo_info.valid_links = 0;
-	nl80211_parse_mlo_info(drv, addr, mlo_links, resp_ie);
+	nl80211_parse_mlo_info(drv, cmd, addr, mlo_links, resp_ie);
 	if (!drv->sta_mlo_info.valid_links && addr) {
 		os_memcpy(drv->bssid, nla_data(addr), ETH_ALEN);
 		os_memcpy(drv->prev_bssid, drv->bssid, ETH_ALEN);
@@ -2240,7 +2294,7 @@ static void qca_nl80211_key_mgmt_auth(struct wpa_driver_nl80211_data *drv,
 			   tb[QCA_WLAN_VENDOR_ATTR_ROAM_AUTH_FILS_ERP_NEXT_SEQ_NUM],
 			   tb[QCA_WLAN_VENDOR_ATTR_ROAM_AUTH_PMK],
 			   tb[QCA_WLAN_VENDOR_ATTR_ROAM_AUTH_PMKID],
-			   NULL);
+			   tb[QCA_WLAN_VENDOR_ATTR_ROAM_AUTH_MLO_LINKS]);
 }
 
 
-- 
2.25.1




More information about the Hostap mailing list