diff mbox series

[3/4] nl80211: fix simultaneous scanning failure in case of MLO

Message ID 20240422111906.2928263-4-quic_adisi@quicinc.com
State Changes Requested
Headers show
Series MLO related fixes for scan/ACS | expand

Commit Message

Aditya Kumar Singh April 22, 2024, 11:19 a.m. UTC
Currently only 1 scan can be performed on per phy level at a time in
driver. Due to this, if via other underlying phy, a scan request is sent,
kernel returns -EBUSY. And then hostapd would try to set the interface in
station mode if it was originally in AP mode and retry sending a scan
request. However, this behaviour is expected in case of multi link
operation and hence there is no need to switch the mode as such.

Hence, add logic to not change the NL mode if kernel returns -EBUSY during
multi link AP operation. The caller can accordingly decide and if needed,
it can re-schedule a scan request after some time.

Signed-off-by: Aditya Kumar Singh <quic_adisi@quicinc.com>
---
 src/drivers/driver_nl80211_scan.c | 34 +++++++++++++++++++++++++++++++
 1 file changed, 34 insertions(+)

Comments

Jouni Malinen June 11, 2024, 9:16 p.m. UTC | #1
On Mon, Apr 22, 2024 at 04:49:05PM +0530, Aditya Kumar Singh wrote:
> Currently only 1 scan can be performed on per phy level at a time in
> driver. Due to this, if via other underlying phy, a scan request is sent,
> kernel returns -EBUSY. And then hostapd would try to set the interface in
> station mode if it was originally in AP mode and retry sending a scan
> request. However, this behaviour is expected in case of multi link
> operation and hence there is no need to switch the mode as such.
> 
> Hence, add logic to not change the NL mode if kernel returns -EBUSY during
> multi link AP operation. The caller can accordingly decide and if needed,
> it can re-schedule a scan request after some time.

This does not compile without patch 2/4, so I cannot apply this before
the items on patch 2 are addressed.
Aditya Kumar Singh June 12, 2024, 9:13 a.m. UTC | #2
On 6/12/24 02:46, Jouni Malinen wrote:
> On Mon, Apr 22, 2024 at 04:49:05PM +0530, Aditya Kumar Singh wrote:
>> Currently only 1 scan can be performed on per phy level at a time in
>> driver. Due to this, if via other underlying phy, a scan request is sent,
>> kernel returns -EBUSY. And then hostapd would try to set the interface in
>> station mode if it was originally in AP mode and retry sending a scan
>> request. However, this behaviour is expected in case of multi link
>> operation and hence there is no need to switch the mode as such.
>>
>> Hence, add logic to not change the NL mode if kernel returns -EBUSY during
>> multi link AP operation. The caller can accordingly decide and if needed,
>> it can re-schedule a scan request after some time.
> 
> This does not compile without patch 2/4, so I cannot apply this before
> the items on patch 2 are addressed.
> 

Sure, will address 2/4 comments and send 2/4 and 3/4 in next version.
diff mbox series

Patch

diff --git a/src/drivers/driver_nl80211_scan.c b/src/drivers/driver_nl80211_scan.c
index 68deb2d9e296..95c7ba80e81a 100644
--- a/src/drivers/driver_nl80211_scan.c
+++ b/src/drivers/driver_nl80211_scan.c
@@ -413,6 +413,40 @@  int wpa_driver_nl80211_scan(struct i802_bss *bss,
 		if (drv->hostapd && is_ap_interface(drv->nlmode)) {
 			enum nl80211_iftype old_mode = drv->nlmode;
 
+#ifdef CONFIG_IEEE80211BE
+			/* For Multi Link BSS, retry scan if any other links
+			 * are busy scanning
+			 */
+			if (ret == -EBUSY &&
+			    nl80211_link_valid(bss->valid_links, params->mlo_link_id)) {
+				struct i802_bss *link_bss;
+				u8 link_id;
+
+				wpa_printf(MSG_DEBUG,
+					   "nl80211: Scan trigger on Multi Link BSS failed (requested link=%d on interface %s)",
+					   params->mlo_link_id, bss->ifname);
+
+				for (link_bss = drv->first_bss; link_bss;
+				     link_bss = link_bss->next)
+					if (link_bss->scan_link)
+						break;
+
+				if (!link_bss) {
+					wpa_printf(MSG_DEBUG,
+						   "nl80211: Interface information already running scan not available");
+					goto fail;
+				}
+
+				link_id =
+				       nl80211_get_link_id_from_link(link_bss,
+								     link_bss->scan_link);
+				wpa_printf(MSG_DEBUG,
+					   "nl80211: Scan already running on interface %s link %d",
+					   link_bss->ifname, link_id);
+				goto fail;
+			}
+#endif /* CONFIG_IEEE80211BE */
+
 			/*
 			 * mac80211 does not allow scan requests in AP mode, so
 			 * try to do this in station mode.