P2P: Include only 6 GHz PSCs in full scan
As P2P GOs are not expected to be collocated, i.e., they are not expected to be announced in the RNR element of other APs, they can operate only on preferred scanning channels (PSCs). When performing a full scan for P2P discovery, include only the 6 GHz PSCs (if supported) to avoid scanning channels on which P2P GOs are not expected to reside. While at it also fix couple of places that missed including 60 GHz channels in P2P full scan. Signed-off-by: Ilan Peer <ilan.peer@intel.com>
This commit is contained in:
parent
ef11556242
commit
50a9b7d3d3
4 changed files with 47 additions and 51 deletions
|
@ -337,6 +337,23 @@ static void wpas_p2p_scan_res_fail_handler(struct wpa_supplicant *wpa_s)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void wpas_p2p_scan_freqs(struct wpa_supplicant *wpa_s,
|
||||||
|
struct wpa_driver_scan_params *params,
|
||||||
|
bool include_6ghz)
|
||||||
|
{
|
||||||
|
wpa_add_scan_freqs_list(wpa_s, HOSTAPD_MODE_IEEE80211A,
|
||||||
|
params, false, false);
|
||||||
|
wpa_add_scan_freqs_list(wpa_s, HOSTAPD_MODE_IEEE80211G,
|
||||||
|
params, false, false);
|
||||||
|
wpa_add_scan_freqs_list(wpa_s, HOSTAPD_MODE_IEEE80211AD,
|
||||||
|
params, 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);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
static void wpas_p2p_trigger_scan_cb(struct wpa_radio_work *work, int deinit)
|
static void wpas_p2p_trigger_scan_cb(struct wpa_radio_work *work, int deinit)
|
||||||
{
|
{
|
||||||
struct wpa_supplicant *wpa_s = work->wpa_s;
|
struct wpa_supplicant *wpa_s = work->wpa_s;
|
||||||
|
@ -359,14 +376,9 @@ static void wpas_p2p_trigger_scan_cb(struct wpa_radio_work *work, int deinit)
|
||||||
params->only_new_results = 1;
|
params->only_new_results = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!params->p2p_include_6ghz && !params->freqs) {
|
if (!params->freqs)
|
||||||
wpa_printf(MSG_DEBUG,
|
wpas_p2p_scan_freqs(wpa_s, params, params->p2p_include_6ghz);
|
||||||
"P2P: Exclude 6 GHz channels - update the scan frequency list");
|
|
||||||
wpa_add_scan_freqs_list(wpa_s, HOSTAPD_MODE_IEEE80211G, params,
|
|
||||||
0);
|
|
||||||
wpa_add_scan_freqs_list(wpa_s, HOSTAPD_MODE_IEEE80211A, params,
|
|
||||||
0);
|
|
||||||
}
|
|
||||||
ret = wpa_drv_scan(wpa_s, params);
|
ret = wpa_drv_scan(wpa_s, params);
|
||||||
if (ret == 0)
|
if (ret == 0)
|
||||||
wpa_s->curr_scan_cookie = params->scan_cookie;
|
wpa_s->curr_scan_cookie = params->scan_cookie;
|
||||||
|
@ -445,6 +457,13 @@ static int wpas_p2p_scan(void *ctx, enum p2p_scan_type type, int freq,
|
||||||
num_req_dev_types, req_dev_types);
|
num_req_dev_types, req_dev_types);
|
||||||
if (wps_ie == NULL)
|
if (wps_ie == NULL)
|
||||||
goto fail;
|
goto fail;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* In case 6 GHz channels are requested as part of the P2P scan, only
|
||||||
|
* the PSCs would be included as P2P GOs are not expected to be
|
||||||
|
* collocated, i.e., they would not be announced in the RNR element of
|
||||||
|
* other APs.
|
||||||
|
*/
|
||||||
if (!wpa_s->conf->p2p_6ghz_disable)
|
if (!wpa_s->conf->p2p_6ghz_disable)
|
||||||
params->p2p_include_6ghz = include_6ghz;
|
params->p2p_include_6ghz = include_6ghz;
|
||||||
switch (type) {
|
switch (type) {
|
||||||
|
@ -5512,14 +5531,8 @@ static void wpas_p2p_join_scan_req(struct wpa_supplicant *wpa_s, int freq,
|
||||||
if (freq > 0) {
|
if (freq > 0) {
|
||||||
freqs[0] = freq;
|
freqs[0] = freq;
|
||||||
params.freqs = freqs;
|
params.freqs = freqs;
|
||||||
} else if (wpa_s->conf->p2p_6ghz_disable ||
|
} else {
|
||||||
!is_p2p_allow_6ghz(wpa_s->global->p2p)) {
|
wpas_p2p_scan_freqs(wpa_s, ¶ms, true);
|
||||||
wpa_printf(MSG_DEBUG,
|
|
||||||
"P2P: 6 GHz disabled - update the scan frequency list");
|
|
||||||
wpa_add_scan_freqs_list(wpa_s, HOSTAPD_MODE_IEEE80211G, ¶ms,
|
|
||||||
0);
|
|
||||||
wpa_add_scan_freqs_list(wpa_s, HOSTAPD_MODE_IEEE80211A, ¶ms,
|
|
||||||
0);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ielen = p2p_scan_ie_buf_len(wpa_s->global->p2p);
|
ielen = p2p_scan_ie_buf_len(wpa_s->global->p2p);
|
||||||
|
|
|
@ -146,6 +146,9 @@ struct wpa_ssid * wpas_p2p_get_persistent(struct wpa_supplicant *wpa_s,
|
||||||
void wpas_p2p_notify_ap_sta_authorized(struct wpa_supplicant *wpa_s,
|
void wpas_p2p_notify_ap_sta_authorized(struct wpa_supplicant *wpa_s,
|
||||||
const u8 *addr);
|
const u8 *addr);
|
||||||
int wpas_p2p_scan_no_go_seen(struct wpa_supplicant *wpa_s);
|
int wpas_p2p_scan_no_go_seen(struct wpa_supplicant *wpa_s);
|
||||||
|
void wpas_p2p_scan_freqs(struct wpa_supplicant *wpa_s,
|
||||||
|
struct wpa_driver_scan_params *params,
|
||||||
|
bool include_6ghz);
|
||||||
int wpas_p2p_get_sec_channel_offset_40mhz(struct wpa_supplicant *wpa_s,
|
int wpas_p2p_get_sec_channel_offset_40mhz(struct wpa_supplicant *wpa_s,
|
||||||
struct hostapd_hw_modes *mode,
|
struct hostapd_hw_modes *mode,
|
||||||
u8 channel);
|
u8 channel);
|
||||||
|
|
|
@ -709,7 +709,8 @@ static int non_p2p_network_enabled(struct wpa_supplicant *wpa_s)
|
||||||
|
|
||||||
int wpa_add_scan_freqs_list(struct wpa_supplicant *wpa_s,
|
int wpa_add_scan_freqs_list(struct wpa_supplicant *wpa_s,
|
||||||
enum hostapd_hw_mode band,
|
enum hostapd_hw_mode band,
|
||||||
struct wpa_driver_scan_params *params, bool is_6ghz)
|
struct wpa_driver_scan_params *params,
|
||||||
|
bool is_6ghz, bool only_6ghz_psc)
|
||||||
{
|
{
|
||||||
/* Include only supported channels for the specified band */
|
/* Include only supported channels for the specified band */
|
||||||
struct hostapd_hw_modes *mode;
|
struct hostapd_hw_modes *mode;
|
||||||
|
@ -717,7 +718,7 @@ int wpa_add_scan_freqs_list(struct wpa_supplicant *wpa_s,
|
||||||
int *freqs, i;
|
int *freqs, i;
|
||||||
|
|
||||||
mode = get_mode(wpa_s->hw.modes, wpa_s->hw.num_modes, band, is_6ghz);
|
mode = get_mode(wpa_s->hw.modes, wpa_s->hw.num_modes, band, is_6ghz);
|
||||||
if (!mode)
|
if (!mode || !mode->num_channels)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
if (params->freqs) {
|
if (params->freqs) {
|
||||||
|
@ -734,6 +735,11 @@ int wpa_add_scan_freqs_list(struct wpa_supplicant *wpa_s,
|
||||||
for (i = 0; i < mode->num_channels; i++) {
|
for (i = 0; i < mode->num_channels; i++) {
|
||||||
if (mode->channels[i].flag & HOSTAPD_CHAN_DISABLED)
|
if (mode->channels[i].flag & HOSTAPD_CHAN_DISABLED)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
if (is_6ghz && only_6ghz_psc &&
|
||||||
|
!is_6ghz_psc_frequency(mode->channels[i].freq))
|
||||||
|
continue;
|
||||||
|
|
||||||
params->freqs[num_chans++] = mode->channels[i].freq;
|
params->freqs[num_chans++] = mode->channels[i].freq;
|
||||||
}
|
}
|
||||||
params->freqs[num_chans] = 0;
|
params->freqs[num_chans] = 0;
|
||||||
|
@ -752,13 +758,13 @@ static void wpa_setband_scan_freqs(struct wpa_supplicant *wpa_s,
|
||||||
|
|
||||||
if (wpa_s->setband_mask & WPA_SETBAND_5G)
|
if (wpa_s->setband_mask & WPA_SETBAND_5G)
|
||||||
wpa_add_scan_freqs_list(wpa_s, HOSTAPD_MODE_IEEE80211A, params,
|
wpa_add_scan_freqs_list(wpa_s, HOSTAPD_MODE_IEEE80211A, params,
|
||||||
false);
|
false, false);
|
||||||
if (wpa_s->setband_mask & WPA_SETBAND_2G)
|
if (wpa_s->setband_mask & WPA_SETBAND_2G)
|
||||||
wpa_add_scan_freqs_list(wpa_s, HOSTAPD_MODE_IEEE80211G, params,
|
wpa_add_scan_freqs_list(wpa_s, HOSTAPD_MODE_IEEE80211G, params,
|
||||||
false);
|
false, false);
|
||||||
if (wpa_s->setband_mask & WPA_SETBAND_6G)
|
if (wpa_s->setband_mask & WPA_SETBAND_6G)
|
||||||
wpa_add_scan_freqs_list(wpa_s, HOSTAPD_MODE_IEEE80211A, params,
|
wpa_add_scan_freqs_list(wpa_s, HOSTAPD_MODE_IEEE80211A, params,
|
||||||
true);
|
true, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -1374,35 +1380,9 @@ scan:
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!params.freqs &&
|
if (!params.freqs && is_6ghz_supported(wpa_s) &&
|
||||||
(wpa_s->p2p_in_invitation || wpa_s->p2p_in_provisioning) &&
|
(wpa_s->p2p_in_invitation || wpa_s->p2p_in_provisioning))
|
||||||
!is_p2p_allow_6ghz(wpa_s->global->p2p) &&
|
wpas_p2p_scan_freqs(wpa_s, ¶ms, true);
|
||||||
is_6ghz_supported(wpa_s)) {
|
|
||||||
int i;
|
|
||||||
|
|
||||||
/* Exclude 6 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 (is_6ghz_freq(wpa_s->hw.modes[i].channels[0].freq))
|
|
||||||
continue;
|
|
||||||
if (wpa_s->hw.modes[i].mode == HOSTAPD_MODE_IEEE80211G)
|
|
||||||
wpa_add_scan_freqs_list(
|
|
||||||
wpa_s, HOSTAPD_MODE_IEEE80211G,
|
|
||||||
¶ms, false);
|
|
||||||
if (wpa_s->hw.modes[i].mode == HOSTAPD_MODE_IEEE80211A)
|
|
||||||
wpa_add_scan_freqs_list(
|
|
||||||
wpa_s, HOSTAPD_MODE_IEEE80211A,
|
|
||||||
¶ms, false);
|
|
||||||
if (wpa_s->hw.modes[i].mode == HOSTAPD_MODE_IEEE80211AD)
|
|
||||||
wpa_add_scan_freqs_list(
|
|
||||||
wpa_s, HOSTAPD_MODE_IEEE80211AD,
|
|
||||||
¶ms, false);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endif /* CONFIG_P2P */
|
#endif /* CONFIG_P2P */
|
||||||
|
|
||||||
ret = wpa_supplicant_trigger_scan(wpa_s, scan_params);
|
ret = wpa_supplicant_trigger_scan(wpa_s, scan_params);
|
||||||
|
|
|
@ -92,6 +92,6 @@ void wpa_supplicant_set_default_scan_ies(struct wpa_supplicant *wpa_s);
|
||||||
int wpa_add_scan_freqs_list(struct wpa_supplicant *wpa_s,
|
int wpa_add_scan_freqs_list(struct wpa_supplicant *wpa_s,
|
||||||
enum hostapd_hw_mode band,
|
enum hostapd_hw_mode band,
|
||||||
struct wpa_driver_scan_params *params,
|
struct wpa_driver_scan_params *params,
|
||||||
bool is_6ghz);
|
bool is_6ghz, bool only_6ghz_psc);
|
||||||
|
|
||||||
#endif /* SCAN_H */
|
#endif /* SCAN_H */
|
||||||
|
|
Loading…
Reference in a new issue