From: Kavita Kavita Date: Wed, 7 May 2025 10:08:52 +0000 (+0530) Subject: P2P GO: Use driver preferred frequency instead of ACS when band is specified X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=0306618ed2d7032a9116ea53dfbd1f02780bacfd;p=thirdparty%2Fhostap.git P2P GO: Use driver preferred frequency instead of ACS when band is specified ACS was enabled by default when the band is specified as 2 or 5 in the "freq" parameter for P2P_GROUP_ADD control interface command. Use the driver preferred frequency list instead of ACS when the driver preferred frequency list is available. This allows the GO to be started more quickly. Signed-off-by: Kavita Kavita --- diff --git a/wpa_supplicant/ctrl_iface.c b/wpa_supplicant/ctrl_iface.c index 3892df99d..96737fb21 100644 --- a/wpa_supplicant/ctrl_iface.c +++ b/wpa_supplicant/ctrl_iface.c @@ -7365,7 +7365,18 @@ static int p2p_ctrl_group_add(struct wpa_supplicant *wpa_s, char *cmd) #ifdef CONFIG_ACS if ((wpa_s->drv_flags & WPA_DRIVER_FLAGS_ACS_OFFLOAD) && - (acs || freq == 2 || freq == 5)) { + (freq == 2 || freq == 5)) { + unsigned int res, size = P2P_MAX_PREF_CHANNELS; + struct weighted_pcl pref_freq_list[P2P_MAX_PREF_CHANNELS]; + + acs = 1; + res = wpa_drv_get_pref_freq_list(wpa_s, WPA_IF_P2P_GO, + &size, pref_freq_list); + if (!res && size > 0) + acs = 0; + } + + if ((wpa_s->drv_flags & WPA_DRIVER_FLAGS_ACS_OFFLOAD) && acs) { if (freq == 2 && wpa_s->best_24_freq <= 0) { wpa_s->p2p_go_acs_band = HOSTAPD_MODE_IEEE80211G; wpa_s->p2p_go_do_acs = 1;