]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
Parse 6 GHz capability from driver capabilities
authorMatthew Wang <matthewmwang@chromium.org>
Fri, 2 Jun 2023 22:15:10 +0000 (15:15 -0700)
committerJouni Malinen <j@w1.fi>
Tue, 31 Oct 2023 10:01:26 +0000 (12:01 +0200)
Store 6 GHz capability on channel list update for wpa_supplicant use.
This will be used in the next commit to extend scanning behavior based
on changes to 6 GHz channel availability.

Signed-off-by: Matthew Wang <matthewmwang@chromium.org>
wpa_supplicant/scan.c
wpa_supplicant/wpa_supplicant.c
wpa_supplicant/wpa_supplicant_i.h

index e4b72a8fa95bcd2b8e8b370460fbd340acecc4fc..b05f3d0a06dc31b37a18f51f9d3ddce8b32cc010 100644 (file)
@@ -420,29 +420,6 @@ wpa_supplicant_build_filter_ssids(struct wpa_config *conf, size_t *num_ssids)
 }
 
 
-#ifdef CONFIG_P2P
-static bool is_6ghz_supported(struct wpa_supplicant *wpa_s)
-{
-       struct hostapd_channel_data *chnl;
-       int i, j;
-
-       for (i = 0; i < wpa_s->hw.num_modes; i++) {
-               if (wpa_s->hw.modes[i].mode == HOSTAPD_MODE_IEEE80211A) {
-                       chnl = wpa_s->hw.modes[i].channels;
-                       for (j = 0; j < wpa_s->hw.modes[i].num_channels; j++) {
-                               if (chnl[j].flag & HOSTAPD_CHAN_DISABLED)
-                                       continue;
-                               if (is_6ghz_freq(chnl[j].freq))
-                                       return true;
-                       }
-               }
-       }
-
-       return false;
-}
-#endif /* CONFIG_P2P */
-
-
 static void wpa_supplicant_optimize_freqs(
        struct wpa_supplicant *wpa_s, struct wpa_driver_scan_params *params)
 {
@@ -1555,7 +1532,7 @@ scan:
                }
        }
 
-       if (!params.freqs && is_6ghz_supported(wpa_s) &&
+       if (!params.freqs && wpas_is_6ghz_supported(wpa_s, true) &&
            (wpa_s->p2p_in_invitation || wpa_s->p2p_in_provisioning))
                wpas_p2p_scan_freqs(wpa_s, &params, true);
 #endif /* CONFIG_P2P */
index d769dbd09e58e73ea8e7b28510d1f22617e5f6ae..f288f3fa1b4c7c775b52b4101f7e308bb17ded46 100644 (file)
@@ -7118,6 +7118,7 @@ static int wpa_supplicant_init_iface(struct wpa_supplicant *wpa_s,
                                 wpa_s->hw_capab == CAPAB_NO_HT_VHT)
                                wpa_s->hw_capab = CAPAB_HT;
                }
+               wpa_s->support_6ghz = wpas_is_6ghz_supported(wpa_s, false);
        }
 
        capa_res = wpa_drv_get_capa(wpa_s, &capa);
@@ -9245,3 +9246,25 @@ int wpa_drv_send_action(struct wpa_supplicant *wpa_s, unsigned int freq,
        return wpa_s->driver->send_action(wpa_s->drv_priv, freq, wait, dst, src,
                                          bssid, data, data_len, no_cck);
 }
+
+
+bool wpas_is_6ghz_supported(struct wpa_supplicant *wpa_s, bool only_enabled)
+{
+       struct hostapd_channel_data *chnl;
+       int i, j;
+
+       for (i = 0; i < wpa_s->hw.num_modes; i++) {
+               if (wpa_s->hw.modes[i].mode == HOSTAPD_MODE_IEEE80211A) {
+                       chnl = wpa_s->hw.modes[i].channels;
+                       for (j = 0; j < wpa_s->hw.modes[i].num_channels; j++) {
+                               if (only_enabled &&
+                                   (chnl[j].flag & HOSTAPD_CHAN_DISABLED))
+                                       continue;
+                               if (is_6ghz_freq(chnl[j].freq))
+                                       return true;
+                       }
+               }
+       }
+
+       return false;
+}
index a7d748ca948a4920c0899521de05f24d67c2059a..89f078ca0a8612b9497d25bb4e96fbc12c024c22 100644 (file)
@@ -1566,6 +1566,7 @@ struct wpa_supplicant {
        unsigned int enable_dscp_policy_capa:1;
        unsigned int connection_dscp:1;
        unsigned int wait_for_dscp_req:1;
+       bool support_6ghz;
 
        struct wpa_signal_info last_signal_info;
 
@@ -1959,6 +1960,7 @@ int wpas_pasn_deauthenticate(struct wpa_supplicant *wpa_s, const u8 *own_addr,
 void wpas_pasn_auth_trigger(struct wpa_supplicant *wpa_s,
                            struct pasn_auth *pasn_auth);
 void wpas_pasn_auth_work_done(struct wpa_supplicant *wpa_s, int status);
+bool wpas_is_6ghz_supported(struct wpa_supplicant *wpa_s, bool only_enabled);
 
 bool wpa_is_non_eht_scs_traffic_desc_supported(struct wpa_bss *bss);