From 1d08b238cb9f9fc5cc6cf6d5d4cb85cae5493e8b Mon Sep 17 00:00:00 2001 From: Jouni Malinen Date: Thu, 28 Jul 2022 16:40:05 +0300 Subject: [PATCH] nl80211: Allow more time for the initial scan with 6 GHz The initial timeout of 10 seconds for the first scan before knowing whether the driver reports scan completion events may not be sufficient in cases where the driver ends up scanning a large number of channels. In particular, this could be hit with 6 GHz support. Increase this timeout when the driver indicates support for 6 GHz channels. Signed-off-by: Jouni Malinen --- src/drivers/driver_nl80211.h | 1 + src/drivers/driver_nl80211_capa.c | 8 ++++++-- src/drivers/driver_nl80211_scan.c | 2 +- 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/src/drivers/driver_nl80211.h b/src/drivers/driver_nl80211.h index 18da94a76..6e40d5556 100644 --- a/src/drivers/driver_nl80211.h +++ b/src/drivers/driver_nl80211.h @@ -180,6 +180,7 @@ struct wpa_driver_nl80211_data { unsigned int unsol_bcast_probe_resp:1; unsigned int qca_do_acs:1; unsigned int brcm_do_acs:1; + unsigned int uses_6ghz:1; u64 vendor_scan_cookie; u64 remain_on_chan_cookie; diff --git a/src/drivers/driver_nl80211_capa.c b/src/drivers/driver_nl80211_capa.c index 739be32a9..7ede0d030 100644 --- a/src/drivers/driver_nl80211_capa.c +++ b/src/drivers/driver_nl80211_capa.c @@ -2475,7 +2475,8 @@ static const char * modestr(enum hostapd_hw_mode mode) } -static void nl80211_dump_chan_list(struct hostapd_hw_modes *modes, +static void nl80211_dump_chan_list(struct wpa_driver_nl80211_data *drv, + struct hostapd_hw_modes *modes, u16 num_modes) { int i; @@ -2493,6 +2494,9 @@ static void nl80211_dump_chan_list(struct hostapd_hw_modes *modes, for (j = 0; j < mode->num_channels; j++) { struct hostapd_channel_data *chan = &mode->channels[j]; + if (chan->freq >= 5925 && chan->freq <= 7125 && + !(chan->flag & HOSTAPD_CHAN_DISABLED)) + drv->uses_6ghz = true; res = os_snprintf(pos, end - pos, " %d%s%s%s", chan->freq, (chan->flag & HOSTAPD_CHAN_DISABLED) ? @@ -2564,7 +2568,7 @@ nl80211_get_hw_feature_data(void *priv, u16 *num_modes, u16 *flags, modes = wpa_driver_nl80211_postprocess_modes(result.modes, num_modes); - nl80211_dump_chan_list(modes, *num_modes); + nl80211_dump_chan_list(drv, modes, *num_modes); return modes; } diff --git a/src/drivers/driver_nl80211_scan.c b/src/drivers/driver_nl80211_scan.c index c31ed6eb1..d54dd3a33 100644 --- a/src/drivers/driver_nl80211_scan.c +++ b/src/drivers/driver_nl80211_scan.c @@ -412,7 +412,7 @@ int wpa_driver_nl80211_scan(struct i802_bss *bss, drv->scan_state = SCAN_REQUESTED; /* Not all drivers generate "scan completed" wireless event, so try to * read results after a timeout. */ - timeout = 10; + timeout = drv->uses_6ghz ? 15 : 10; if (drv->scan_complete_events) { /* * The driver seems to deliver events to notify when scan is -- 2.47.2