P2P: Prefer 5/60 GHz band over 2.4 GHz during GO configuration
Previously, wpas_p2p_select_go_freq_no_pref() ended up selecting a 2.4 GHz band channel first before even considering 5 or 60 GHz channels. This was likely done more or less by accident rather than by design when the 5 GHz and 60 GHz band extensions were added. It seems reasonable to enhance this by reordering the code to start with 5 and 60 GHz operating classes and move to 2.4 GHz band only if no channel was available in 5 or 60 GHz bands for P2P GO use. This does have some potential interop issues with 2.4 GHz only peer devices when starting up an autonomous GO (i.e., without there being prior knowledge of channels that the peers support). Upper layers are expected to enforce 2.4 GHz selection if that is needed for some use cases. Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
This commit is contained in:
parent
7413c34d5e
commit
f516090228
1 changed files with 24 additions and 24 deletions
|
@ -5730,30 +5730,6 @@ static void wpas_p2p_select_go_freq_no_pref(struct wpa_supplicant *wpa_s,
|
||||||
{
|
{
|
||||||
unsigned int i, r;
|
unsigned int i, r;
|
||||||
|
|
||||||
/* first try some random selection of the social channels */
|
|
||||||
if (os_get_random((u8 *) &r, sizeof(r)) < 0)
|
|
||||||
return;
|
|
||||||
|
|
||||||
for (i = 0; i < 3; i++) {
|
|
||||||
params->freq = 2412 + ((r + i) % 3) * 25;
|
|
||||||
if (wpas_p2p_supported_freq_go(wpa_s, channels, params->freq))
|
|
||||||
goto out;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* try all other channels in operating class 81 */
|
|
||||||
for (i = 0; i < 11; i++) {
|
|
||||||
params->freq = 2412 + i * 5;
|
|
||||||
|
|
||||||
/* skip social channels; covered in the previous loop */
|
|
||||||
if (params->freq == 2412 ||
|
|
||||||
params->freq == 2437 ||
|
|
||||||
params->freq == 2462)
|
|
||||||
continue;
|
|
||||||
|
|
||||||
if (wpas_p2p_supported_freq_go(wpa_s, channels, params->freq))
|
|
||||||
goto out;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* try all channels in operating class 115 */
|
/* try all channels in operating class 115 */
|
||||||
for (i = 0; i < 4; i++) {
|
for (i = 0; i < 4; i++) {
|
||||||
params->freq = 5180 + i * 20;
|
params->freq = 5180 + i * 20;
|
||||||
|
@ -5788,6 +5764,30 @@ static void wpas_p2p_select_go_freq_no_pref(struct wpa_supplicant *wpa_s,
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* try some random selection of the social channels */
|
||||||
|
if (os_get_random((u8 *) &r, sizeof(r)) < 0)
|
||||||
|
return;
|
||||||
|
|
||||||
|
for (i = 0; i < 3; i++) {
|
||||||
|
params->freq = 2412 + ((r + i) % 3) * 25;
|
||||||
|
if (wpas_p2p_supported_freq_go(wpa_s, channels, params->freq))
|
||||||
|
goto out;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* try all other channels in operating class 81 */
|
||||||
|
for (i = 0; i < 11; i++) {
|
||||||
|
params->freq = 2412 + i * 5;
|
||||||
|
|
||||||
|
/* skip social channels; covered in the previous loop */
|
||||||
|
if (params->freq == 2412 ||
|
||||||
|
params->freq == 2437 ||
|
||||||
|
params->freq == 2462)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
if (wpas_p2p_supported_freq_go(wpa_s, channels, params->freq))
|
||||||
|
goto out;
|
||||||
|
}
|
||||||
|
|
||||||
params->freq = 0;
|
params->freq = 0;
|
||||||
wpa_printf(MSG_DEBUG, "P2P: No 2.4, 5, or 60 GHz channel allowed");
|
wpa_printf(MSG_DEBUG, "P2P: No 2.4, 5, or 60 GHz channel allowed");
|
||||||
return;
|
return;
|
||||||
|
|
Loading…
Reference in a new issue