From: Kavita Kavita Date: Sun, 4 May 2025 11:26:53 +0000 (+0530) Subject: P2P GO: Add support for handling 6 GHz band in freq parameter X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=4507c39bb14fc1a49bc2a80241a2b3ac502a1316;p=thirdparty%2Fhostap.git P2P GO: Add support for handling 6 GHz band in freq parameter Add support for handling 6 GHz band in freq parameter while selecting the P2P GO frequency in cases where the driver has indicated a list of preferred channels. Signed-off-by: Kavita Kavita --- diff --git a/wpa_supplicant/p2p_supplicant.c b/wpa_supplicant/p2p_supplicant.c index cb2f0d19b..2090dde02 100644 --- a/wpa_supplicant/p2p_supplicant.c +++ b/wpa_supplicant/p2p_supplicant.c @@ -7358,7 +7358,7 @@ static int wpas_p2p_select_go_freq(struct wpa_supplicant *wpa_s, int freq) } } - if (freq == 2 || freq == 5) { + if (freq == 2 || freq == 5 || freq == 6) { res = wpa_drv_get_pref_freq_list(wpa_s, WPA_IF_P2P_GO, &size, pref_freq_list); if (!res && size > 0 && !is_p2p_allow_6ghz(wpa_s->global->p2p)) @@ -7471,6 +7471,36 @@ static int wpas_p2p_select_go_freq(struct wpa_supplicant *wpa_s, int freq) } } + if (freq == 6) { + wpa_printf(MSG_DEBUG, "P2P: Request to start GO on 6 GHz band"); + if (!res && size > 0) { + for (i = 0; i < size; i++) { + freq = pref_freq_list[i].freq; + if (is_6ghz_freq(freq) && + p2p_supported_freq(wpa_s->global->p2p, + freq) && + !wpas_p2p_disallowed_freq(wpa_s->global, + freq) && + p2p_pref_freq_allowed(&pref_freq_list[i], + true)) + break; + } + + if (i >= size) { + wpa_printf(MSG_DEBUG, + "P2P: Could not select 6 GHz channel for P2P group"); + return -1; + } + + wpa_printf(MSG_DEBUG, + "P2P: Use preferred 6 GHz band channel: %d MHz", + freq); + } else { + wpa_printf(MSG_DEBUG, + "P2P: No preferred 6 GHz channel available"); + } + } + if (freq > 0 && !p2p_supported_freq_go(wpa_s->global->p2p, freq)) { if ((wpa_s->drv_flags & WPA_DRIVER_FLAGS_DFS_OFFLOAD) && ieee80211_is_dfs(freq, wpa_s->hw.modes,