Sorry, the message should read "non-DFS", not DFS. On Thu, Dec 15, 2022 at 8:51 PM Matthew Wang <matthewmwang@xxxxxxxxxxxx> wrote: > > From: Matthew Wang <matthewmwang@xxxxxxxxxx> > > Allow specifying preferred GO band in addition to frequency. If a band > is specified, the first two scans will be limited to only DFS channels > to shorten scan times, and the next two will scan the entire band. > --- > wpa_supplicant/p2p_supplicant.c | 8 +++--- > wpa_supplicant/scan.c | 43 ++++++++++++++++++++++++++------- > wpa_supplicant/scan.h | 3 ++- > 3 files changed, 40 insertions(+), 14 deletions(-) > > diff --git a/wpa_supplicant/p2p_supplicant.c b/wpa_supplicant/p2p_supplicant.c > index dc240140d..c9b32210e 100644 > --- a/wpa_supplicant/p2p_supplicant.c > +++ b/wpa_supplicant/p2p_supplicant.c > @@ -342,15 +342,15 @@ void wpas_p2p_scan_freqs(struct wpa_supplicant *wpa_s, > bool include_6ghz) > { > wpa_add_scan_freqs_list(wpa_s, HOSTAPD_MODE_IEEE80211A, > - params, false, false); > + params, false, false, false); > wpa_add_scan_freqs_list(wpa_s, HOSTAPD_MODE_IEEE80211G, > - params, false, false); > + params, false, false, false); > wpa_add_scan_freqs_list(wpa_s, HOSTAPD_MODE_IEEE80211AD, > - params, false, false); > + params, false, false, false); > if (!wpa_s->conf->p2p_6ghz_disable && > is_p2p_allow_6ghz(wpa_s->global->p2p) && include_6ghz) > wpa_add_scan_freqs_list(wpa_s, HOSTAPD_MODE_IEEE80211A, > - params, true, true); > + params, true, true, false); > } > > > diff --git a/wpa_supplicant/scan.c b/wpa_supplicant/scan.c > index cdf12f938..9128fafd0 100644 > --- a/wpa_supplicant/scan.c > +++ b/wpa_supplicant/scan.c > @@ -476,11 +476,33 @@ static void wpa_supplicant_optimize_freqs( > */ > if (params->freqs == NULL && wpa_s->p2p_in_invitation < 5 && > wpa_s->p2p_invite_go_freq > 0) { > - wpa_dbg(wpa_s, MSG_DEBUG, "P2P: Scan only GO preferred frequency %d MHz during invitation", > - wpa_s->p2p_invite_go_freq); > - params->freqs = os_calloc(2, sizeof(int)); > - if (params->freqs) > - params->freqs[0] = wpa_s->p2p_invite_go_freq; > + if (wpa_s->p2p_invite_go_freq == 2 || > + wpa_s->p2p_invite_go_freq == 5) { > + wpa_dbg(wpa_s, MSG_DEBUG, "P2P: Scan only GO preferred band %d GHz during invitation", > + wpa_s->p2p_invite_go_freq); > + enum hostapd_hw_mode mode; > + if (wpa_s->hw.modes == NULL) > + return; > + mode = wpa_s->p2p_invite_go_freq == 5 ? > + HOSTAPD_MODE_IEEE80211A : > + HOSTAPD_MODE_IEEE80211G; > + if (wpa_s->p2p_in_invitation <= 2) > + wpa_add_scan_freqs_list(wpa_s, mode, > + params, false, > + true); > + if (params->freqs == NULL || > + (params->freqs && params->freqs[0] == 0)) > + wpa_add_scan_freqs_list(wpa_s, mode, > + params, false, > + false); > + } else { > + wpa_dbg(wpa_s, MSG_DEBUG, "P2P: Scan only GO preferred frequency %d MHz during invitation", > + wpa_s->p2p_invite_go_freq); > + params->freqs = os_calloc(2, sizeof(int)); > + if (params->freqs) > + params->freqs[0] = > + wpa_s->p2p_invite_go_freq; > + } > } > wpa_s->p2p_in_invitation++; > if (wpa_s->p2p_in_invitation > 20) { > @@ -738,7 +760,8 @@ static int non_p2p_network_enabled(struct wpa_supplicant *wpa_s) > int wpa_add_scan_freqs_list(struct wpa_supplicant *wpa_s, > enum hostapd_hw_mode band, > struct wpa_driver_scan_params *params, > - bool is_6ghz, bool only_6ghz_psc) > + bool is_6ghz, bool only_6ghz_psc, > + bool exclude_radar) > { > /* Include only supported channels for the specified band */ > struct hostapd_hw_modes *mode; > @@ -763,6 +786,8 @@ int wpa_add_scan_freqs_list(struct wpa_supplicant *wpa_s, > for (i = 0; i < mode->num_channels; i++) { > if (mode->channels[i].flag & HOSTAPD_CHAN_DISABLED) > continue; > + if (exclude_radar && (mode->channels[i].flag & HOSTAPD_CHAN_RADAR)) > + continue; > > if (is_6ghz && only_6ghz_psc && > !is_6ghz_psc_frequency(mode->channels[i].freq)) > @@ -786,13 +811,13 @@ static void wpa_setband_scan_freqs(struct wpa_supplicant *wpa_s, > > if (wpa_s->setband_mask & WPA_SETBAND_5G) > wpa_add_scan_freqs_list(wpa_s, HOSTAPD_MODE_IEEE80211A, params, > - false, false); > + false, false, false); > if (wpa_s->setband_mask & WPA_SETBAND_2G) > wpa_add_scan_freqs_list(wpa_s, HOSTAPD_MODE_IEEE80211G, params, > - false, false); > + false, false, false); > if (wpa_s->setband_mask & WPA_SETBAND_6G) > wpa_add_scan_freqs_list(wpa_s, HOSTAPD_MODE_IEEE80211A, params, > - true, false); > + true, false, false); > } > > > diff --git a/wpa_supplicant/scan.h b/wpa_supplicant/scan.h > index 6e074f48a..30f43951c 100644 > --- a/wpa_supplicant/scan.h > +++ b/wpa_supplicant/scan.h > @@ -92,6 +92,7 @@ void wpa_supplicant_set_default_scan_ies(struct wpa_supplicant *wpa_s); > int wpa_add_scan_freqs_list(struct wpa_supplicant *wpa_s, > enum hostapd_hw_mode band, > struct wpa_driver_scan_params *params, > - bool is_6ghz, bool only_6ghz_psc); > + bool is_6ghz, bool only_6ghz_psc, > + bool exclude_radar); > > #endif /* SCAN_H */ > -- > 2.39.0.314.g84b9a713c41-goog > _______________________________________________ Hostap mailing list Hostap@xxxxxxxxxxxxxxxxxxx http://lists.infradead.org/mailman/listinfo/hostap