aboutsummaryrefslogtreecommitdiffstats
path: root/wpa_supplicant
diff options
context:
space:
mode:
authorSunil Dutt <usdutt@qti.qualcomm.com>2017-10-08 05:33:21 (GMT)
committerJouni Malinen <j@w1.fi>2017-10-11 14:01:10 (GMT)
commitf516090228a9f9ea5ea02ec2348c2c3fa268f082 (patch)
tree327d0066faf6e5c70a0b0b1d5ec7630f27010768 /wpa_supplicant
parent7413c34d5e17dfd173311217c1265058eeba0d55 (diff)
downloadhostap-f516090228a9f9ea5ea02ec2348c2c3fa268f082.zip
hostap-f516090228a9f9ea5ea02ec2348c2c3fa268f082.tar.gz
hostap-f516090228a9f9ea5ea02ec2348c2c3fa268f082.tar.bz2
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>
Diffstat (limited to 'wpa_supplicant')
-rw-r--r--wpa_supplicant/p2p_supplicant.c48
1 files changed, 24 insertions, 24 deletions
diff --git a/wpa_supplicant/p2p_supplicant.c b/wpa_supplicant/p2p_supplicant.c
index d4bd19a..fd6a1a2 100644
--- a/wpa_supplicant/p2p_supplicant.c
+++ b/wpa_supplicant/p2p_supplicant.c
@@ -5730,30 +5730,6 @@ static void wpas_p2p_select_go_freq_no_pref(struct wpa_supplicant *wpa_s,
{
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 */
for (i = 0; i < 4; i++) {
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;
}
+ /* 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;
wpa_printf(MSG_DEBUG, "P2P: No 2.4, 5, or 60 GHz channel allowed");
return;