]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
AP MLD: Allow scan processing link to match the request
authorChenming Huang <quic_chenhuan@quicinc.com>
Thu, 25 Jan 2024 08:23:03 +0000 (13:53 +0530)
committerJouni Malinen <j@w1.fi>
Fri, 12 Apr 2024 07:52:19 +0000 (10:52 +0300)
If the driver provides an identifying cookie value for scan operations,
use that to select which link processes the scan result. This is needed
for OBSS scans that can be required in different links if operating as
an AP MLD.  Distinguish the scans using scan_cookie for QCA vendor scan
events.

Signed-off-by: Chenming Huang <quic_chenhuan@quicinc.com>
src/ap/drv_callbacks.c
src/ap/hostapd.h
src/ap/hw_features.c
src/drivers/driver.h
src/drivers/driver_nl80211_event.c

index 6ee62b0e87877796b91b8f9be92427e5d803ca23..9ca720548214b0a92b871fa7a7b40d955c617c4c 100644 (file)
@@ -1747,6 +1747,34 @@ switch_link_hapd(struct hostapd_data *hapd, int link_id)
 }
 
 
+static struct hostapd_data *
+switch_link_scan(struct hostapd_data *hapd, u64 scan_cookie)
+{
+#ifdef CONFIG_IEEE80211BE
+       if (hapd->conf->mld_ap && scan_cookie != 0) {
+               unsigned int i;
+
+               for (i = 0; i < hapd->iface->interfaces->count; i++) {
+                       struct hostapd_iface *h;
+                       struct hostapd_data *h_hapd;
+
+                       h = hapd->iface->interfaces->iface[i];
+                       h_hapd = h->bss[0];
+                       if (!hostapd_is_ml_partner(hapd, h_hapd))
+                               continue;
+
+                       if (h_hapd->scan_cookie == scan_cookie) {
+                               h_hapd->scan_cookie = 0;
+                               return h_hapd;
+                       }
+               }
+       }
+#endif /* CONFIG_IEEE80211BE */
+
+       return hapd;
+}
+
+
 #define HAPD_BROADCAST ((struct hostapd_data *) -1)
 
 static struct hostapd_data * get_hapd_bssid(struct hostapd_iface *iface,
@@ -2372,6 +2400,11 @@ void wpa_supplicant_event(void *ctx, enum wpa_event_type event,
                michael_mic_failure(hapd, data->michael_mic_failure.src, 1);
                break;
        case EVENT_SCAN_RESULTS:
+#ifdef NEED_AP_MLME
+               if (data)
+                       hapd = switch_link_scan(hapd,
+                                               data->scan_info.scan_cookie);
+#endif /* NEED_AP_MLME */
                if (hapd->iface->scan_cb)
                        hapd->iface->scan_cb(hapd->iface);
 #ifdef CONFIG_IEEE80211BE
index affe4f604fe555dedf6627b2c9d0caac119f022b..bed4c48ca32f92d750a62703a106bff020f22fda 100644 (file)
@@ -482,6 +482,9 @@ struct hostapd_data {
 #ifdef CONFIG_NAN_USD
        struct nan_de *nan_de;
 #endif /* CONFIG_NAN_USD */
+
+       u64 scan_cookie; /* Scan instance identifier for the ongoing HT40 scan
+                         */
 };
 
 
index fd401d78af826e233c259518c8351df43f53ea87..2f4c8b71c896b9413a914c8bc1d2e3a49e3209d4 100644 (file)
@@ -521,6 +521,7 @@ static void ap_ht40_scan_retry(void *eloop_data, void *user_data)
 
        if (ret == 0) {
                iface->scan_cb = ieee80211n_check_scan;
+               iface->bss[0]->scan_cookie = params.scan_cookie;
                return;
        }
 
@@ -577,6 +578,7 @@ static int ieee80211n_check_40mhz(struct hostapd_iface *iface)
        }
 
        iface->scan_cb = ieee80211n_check_scan;
+       iface->bss[0]->scan_cookie = params.scan_cookie;
        return 1;
 }
 
index d67c949b65c2737aae31187d9489c46e7ffce3f2..9a58ac2e2b6c7da90100bfff3f95779e9f93327c 100644 (file)
@@ -6395,6 +6395,8 @@ union wpa_event_data {
         *      (if available).
         * @scan_start_tsf_bssid: The BSSID according to which %scan_start_tsf
         *      is set.
+        * @scan_cookie: Unique identification representing the corresponding
+        *      scan request. 0 if no unique identification is available.
         */
        struct scan_info {
                int aborted;
@@ -6406,6 +6408,7 @@ union wpa_event_data {
                int nl_scan_event;
                u64 scan_start_tsf;
                u8 scan_start_tsf_bssid[ETH_ALEN];
+               u64 scan_cookie;
        } scan_info;
 
        /**
index 51b27bd5e79da1dc9d17e2d21a0142ce17554d4f..61b49c1d5fed8f90ca185d91aabd9529e20587a8 100644 (file)
@@ -2963,6 +2963,7 @@ static void send_vendor_scan_event(struct wpa_driver_nl80211_data *drv,
        info = &event.scan_info;
        info->aborted = aborted;
        info->external_scan = external_scan;
+       info->scan_cookie = nla_get_u64(tb[QCA_WLAN_VENDOR_ATTR_SCAN_COOKIE]);
 
        if (tb[QCA_WLAN_VENDOR_ATTR_SCAN_SSIDS]) {
                nla_for_each_nested(nl,