From d5e6f79988ec471a7360dd8c956a967a00124d57 Mon Sep 17 00:00:00 2001 From: Chenming Huang Date: Thu, 25 Jan 2024 13:53:03 +0530 Subject: [PATCH] AP MLD: Request Handle OBSS scan for a specific link OBSS scan can be required in different links if operating as an AP MLD. When triggering scan, specify the link ID for the driver to find the correct link to scan. Signed-off-by: Chenming Huang --- src/ap/hw_features.c | 11 +++++++++++ src/drivers/driver.h | 8 ++++++++ src/drivers/driver_nl80211_scan.c | 5 +++++ wpa_supplicant/scan.c | 1 + 4 files changed, 25 insertions(+) diff --git a/src/ap/hw_features.c b/src/ap/hw_features.c index 2f4c8b71c..c4556603d 100644 --- a/src/ap/hw_features.c +++ b/src/ap/hw_features.c @@ -506,6 +506,12 @@ static void ap_ht40_scan_retry(void *eloop_data, void *user_data) else ieee80211n_scan_channels_5g(iface, ¶ms); + params.link_id = -1; +#ifdef CONFIG_IEEE80211BE + if (iface->bss[0]->conf->mld_ap) + params.link_id = iface->bss[0]->mld_link_id; +#endif /* CONFIG_IEEE80211BE */ + ret = hostapd_driver_scan(iface->bss[0], ¶ms); iface->num_ht40_scan_tries++; os_free(params.freqs); @@ -557,6 +563,11 @@ static int ieee80211n_check_40mhz(struct hostapd_iface *iface) else ieee80211n_scan_channels_5g(iface, ¶ms); + params.link_id = -1; +#ifdef CONFIG_IEEE80211BE + if (iface->bss[0]->conf->mld_ap) + params.link_id = iface->bss[0]->mld_link_id; +#endif /* CONFIG_IEEE80211BE */ ret = hostapd_driver_scan(iface->bss[0], ¶ms); os_free(params.freqs); diff --git a/src/drivers/driver.h b/src/drivers/driver.h index 9a58ac2e2..36dc07805 100644 --- a/src/drivers/driver.h +++ b/src/drivers/driver.h @@ -701,6 +701,14 @@ struct wpa_driver_scan_params { */ unsigned int min_probe_req_content:1; + /** + * link_id - Specify the link that is requesting the scan on an MLD + * + * This is set when operating as an AP MLD and doing an OBSS scan. + * -1 indicates that no particular link ID is set. + */ + s8 link_id; + /* * NOTE: Whenever adding new parameters here, please make sure * wpa_scan_clone_params() and wpa_scan_free_params() get updated with diff --git a/src/drivers/driver_nl80211_scan.c b/src/drivers/driver_nl80211_scan.c index 577f84fef..1eb437405 100644 --- a/src/drivers/driver_nl80211_scan.c +++ b/src/drivers/driver_nl80211_scan.c @@ -1275,6 +1275,11 @@ int wpa_driver_nl80211_vendor_scan(struct i802_bss *bss, goto fail; } + if (is_ap_interface(drv->nlmode) && + params->link_id != NL80211_DRV_LINK_ID_NA && + nla_put_u8(msg, QCA_WLAN_VENDOR_ATTR_SCAN_LINK_ID, params->link_id)) + goto fail; + nla_nest_end(msg, attr); ret = send_and_recv_resp(drv, msg, scan_cookie_handler, &cookie); diff --git a/wpa_supplicant/scan.c b/wpa_supplicant/scan.c index 2db4d8b91..ccd694bd0 100644 --- a/wpa_supplicant/scan.c +++ b/wpa_supplicant/scan.c @@ -3351,6 +3351,7 @@ wpa_scan_clone_params(const struct wpa_driver_scan_params *src) params->duration = src->duration; params->duration_mandatory = src->duration_mandatory; params->oce_scan = src->oce_scan; + params->link_id = src->link_id; if (src->sched_scan_plans_num > 0) { params->sched_scan_plans =