P2P: Remove 6 GHz channels from full scan if 6 GHz not enabled for P2P

The channels included for the scan to connect to a P2P GO are optimized
such that the P2P GO preferred channel and the common channels are
included for the first few scans followed by a full scan in which all
the channels supported by the local device are included. This results in
P2P client including the 6 GHz channels for the full scan after GO
Negotiation even when 6 GHz channels are not used for the P2P
connection.

Exclude the 6 GHz channels from the full scan if 6 GHz channels are
supported but are not used for P2P connection.

Signed-off-by: Sreeramya Soratkal <ssramya@codeaurora.org>
This commit is contained in:
Sreeramya Soratkal 2021-09-28 21:03:15 +05:30 committed by Jouni Malinen
parent 147932addd
commit 7dc7b88148

View file

@ -392,6 +392,29 @@ wpa_supplicant_build_filter_ssids(struct wpa_config *conf, size_t *num_ssids)
}
#ifdef CONFIG_P2P
static bool is_6ghz_supported(struct wpa_supplicant *wpa_s)
{
struct hostapd_channel_data *chnl;
int i, j;
for (i = 0; i < wpa_s->hw.num_modes; i++) {
if (wpa_s->hw.modes[i].mode == HOSTAPD_MODE_IEEE80211A) {
chnl = wpa_s->hw.modes[i].channels;
for (j = 0; j < wpa_s->hw.modes[i].num_channels; j++) {
if (chnl[j].flag & HOSTAPD_CHAN_DISABLED)
continue;
if (is_6ghz_freq(chnl[j].freq))
return true;
}
}
}
return false;
}
#endif /* CONFIG_P2P */
static void wpa_supplicant_optimize_freqs(
struct wpa_supplicant *wpa_s, struct wpa_driver_scan_params *params)
{
@ -1337,6 +1360,34 @@ scan:
}
}
}
if (!params.freqs &&
(wpa_s->p2p_in_invitation || wpa_s->p2p_in_provisioning) &&
!is_p2p_allow_6ghz(wpa_s->global->p2p) &&
is_6ghz_supported(wpa_s)) {
int i;
/* Exclude 5 GHz channels from the full scan for P2P connection
* since the 6 GHz band is disabled for P2P uses. */
wpa_printf(MSG_DEBUG,
"P2P: 6 GHz disabled - update the scan frequency list");
for (i = 0; i < wpa_s->hw.num_modes; i++) {
if (wpa_s->hw.modes[i].num_channels == 0)
continue;
if (wpa_s->hw.modes[i].mode == HOSTAPD_MODE_IEEE80211G)
wpa_add_scan_freqs_list(
wpa_s, HOSTAPD_MODE_IEEE80211G,
&params, false);
if (wpa_s->hw.modes[i].mode == HOSTAPD_MODE_IEEE80211A)
wpa_add_scan_freqs_list(
wpa_s, HOSTAPD_MODE_IEEE80211A,
&params, false);
if (wpa_s->hw.modes[i].mode == HOSTAPD_MODE_IEEE80211AD)
wpa_add_scan_freqs_list(
wpa_s, HOSTAPD_MODE_IEEE80211AD,
&params, false);
}
}
#endif /* CONFIG_P2P */
ret = wpa_supplicant_trigger_scan(wpa_s, scan_params);