Hi, For an autonomous group, it only picks a channel from the operating class 115 which is not available in the EU region anymore. As a result, an autonomous group creation would always fail. The operating class 124, i.e. SRD channels are available. In this patch, we add the operating class 124 as possible channels candidates for an autonomous group. Best regards, Jimmy
From b5ce8f2e73666c771bc46b9dace416c5cf8454ef Mon Sep 17 00:00:00 2001 From: Jimmy Chen <jimmycmchen@xxxxxxxxxx> Date: Tue, 29 Sep 2020 17:27:34 +0800 Subject: [PATCH] p2p: pick 5g channel from more possible channels There are more possible available channels for 5GHz currently. Especially in EU region, the operating class 115 channels are no longer available, but SRD channels (the operating class 124) are available. Signed-off-by: Jimmy Chen <jimmycmchen@xxxxxxxxxx> --- wpa_supplicant/p2p_supplicant.c | 27 +++++++++++++++++++++++++-- 1 file changed, 25 insertions(+), 2 deletions(-) diff --git a/wpa_supplicant/p2p_supplicant.c b/wpa_supplicant/p2p_supplicant.c index 4c083f865..4866d430f 100644 --- a/wpa_supplicant/p2p_supplicant.c +++ b/wpa_supplicant/p2p_supplicant.c @@ -6050,8 +6050,31 @@ static int wpas_p2p_select_go_freq(struct wpa_supplicant *wpa_s, int freq) } else { if (os_get_random((u8 *) &r, sizeof(r)) < 0) return -1; - freq = 5180 + (r % 4) * 20; - if (!p2p_supported_freq_go(wpa_s->global->p2p, freq)) { + + /* + * most of 5G channels are DFS, only operating class 115 and 124 + * are available possibly, randomly pick a start to check them. + */ + int possible_5g_freqs[] = { + /* operating class 115 */ + 5180, 5200, 5220, 5240, + /* operating class 124 */ + 5745, 5765, 5785, 5805, + }; + int possible_5g_freqs_num = + sizeof(possible_5g_freqs)/sizeof(possible_5g_freqs[0]); + + int i; + for (i = 0; i < possible_5g_freqs_num; i++, r++) { + if (p2p_supported_freq_go( + wpa_s->global->p2p, + possible_5g_freqs[r % possible_5g_freqs_num])) { + freq = possible_5g_freqs[r % possible_5g_freqs_num]; + break; + } + } + + if (i >= possible_5g_freqs_num) { wpa_printf(MSG_DEBUG, "P2P: Could not select " "5 GHz channel for P2P group"); return -1; -- 2.28.0.1011.ga647a8990f-goog
_______________________________________________ Hostap mailing list Hostap@xxxxxxxxxxxxxxxxxxx http://lists.infradead.org/mailman/listinfo/hostap