]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
MLD STA: Fetch MLO association Link ID info to core wpa_supplicant
authorVeerendranath Jakkam <quic_vjakkam@quicinc.com>
Wed, 19 Oct 2022 14:13:50 +0000 (19:43 +0530)
committerJouni Malinen <j@w1.fi>
Mon, 31 Oct 2022 10:07:41 +0000 (12:07 +0200)
Fetch the MLO association Link ID info from the driver to the
wpa_supplicant instance of the corresponding MLD STA interface. This
info is needed when setting the MLO connection info to wpa_sm.

Signed-off-by: Veerendranath Jakkam <quic_vjakkam@quicinc.com>
src/drivers/driver.h
src/drivers/driver_nl80211.c
src/drivers/driver_nl80211.h
src/drivers/driver_nl80211_event.c
wpa_supplicant/events.c
wpa_supplicant/wpa_supplicant_i.h

index 4d9a7e3c08e4e57dccc734eb2e8241b7e0e3821d..9132409c1bb43f7141ab3d2762d74d08f845d35d 100644 (file)
@@ -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];
index fdc773a5833fb06d9cd849188d887e437b388bd1..38e3f825cc9e89d66f7584d3e0a4019c7740807a 100644 (file)
@@ -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));
index 3eb2a74ab4930fca4823cc1b66ecd45511c39f0f..0b8b0ce118b1fe27415d9f3cf0af0d4df8a4e7f6 100644 (file)
@@ -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;
index 81c8b87c755d31b4d84dc6af77fec1ed25cc631e..db3c9c180254aa070230280f6680bb723a37c1f6 100644 (file)
@@ -524,6 +524,7 @@ static void nl80211_parse_mlo_info(struct wpa_driver_nl80211_data *drv,
 {
        const u8 *ml_ie;
        struct driver_sta_mlo_info *mlo = &drv->sta_mlo_info;
+       int res;
 
        if (!addr || !mlo_links || !resp_ie)
                return;
@@ -533,11 +534,14 @@ 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)
+       res = nl80211_get_assoc_link_id(&ml_ie[3], ml_ie[1] - 1);
+       if (res < 0 || res >= MAX_NUM_MLD_LINKS) {
+               wpa_printf(MSG_DEBUG,
+                          "nl80211: Could not find a valid association Link ID (res=%d)",
+                          res);
                return;
+       }
+       drv->sta_mlo_info.assoc_link_id = res;
 
        os_memcpy(mlo->ap_mld_addr, nla_data(addr), ETH_ALEN);
        wpa_printf(MSG_DEBUG, "nl80211: AP MLD MAC Address " MACSTR,
@@ -550,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);
 }
@@ -922,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;
        }
 
index e0a97bc2ea6fcbbed861f80593506ccfd52412f4..f3cbe975584a12c8dfd6acba70ca8e3e5675123f 100644 (file)
@@ -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)))
index 4081592bdd3f1e284cb48c41b983b586eb581bf4..9db847cec78c8d881c83a7375d4fa4f925a6f907 100644 (file)
@@ -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];