]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
P2P GO: Add support for handling 6 GHz band in freq parameter
authorKavita Kavita <kkavita@qti.qualcomm.com>
Sun, 4 May 2025 11:26:53 +0000 (16:56 +0530)
committerJouni Malinen <j@w1.fi>
Fri, 23 May 2025 13:02:02 +0000 (16:02 +0300)
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 <kkavita@qti.qualcomm.com>
wpa_supplicant/p2p_supplicant.c

index cb2f0d19b829e34e434d7ec0aa5962362267b582..2090dde0222b595ca8f04e104c9557365920ad6b 100644 (file)
@@ -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,