]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
Limit throughput estimation for HE 40 MHz based on HT info
authorJouni Malinen <j@w1.fi>
Sat, 23 Dec 2023 15:30:18 +0000 (17:30 +0200)
committerJouni Malinen <j@w1.fi>
Sat, 23 Dec 2023 15:41:00 +0000 (17:41 +0200)
The current operating channel bandwidth in an HE BSS is determined with
the combination of elements, include the HT Operation element. Use HT
Operation element to check whether the 40 MHz case is enabled if the AP
claims to be capable of operating a 40 MHz BSS.

Signed-off-by: Jouni Malinen <j@w1.fi>
wpa_supplicant/scan.c

index a8555579916ef8a3b4180f975d420538683d8a72..822a9858e4a2e114fc5907b7efe098b92c260df6 100644 (file)
@@ -2907,6 +2907,7 @@ unsigned int wpas_get_est_tpt(const struct wpa_supplicant *wpa_s,
         * been taken into account.
         */
        int adjusted_snr;
+       bool ht40 = false;
 
        /* Limit based on estimated SNR */
        if (rate > 1 * 2 && snr < 1)
@@ -2962,11 +2963,14 @@ unsigned int wpas_get_est_tpt(const struct wpa_supplicant *wpa_s,
                }
        }
 
+       ie = get_ie(ies, ies_len, WLAN_EID_HT_OPERATION);
+       if (ie && ie[1] >= 2 &&
+           (ie[3] & HT_INFO_HT_PARAM_SECONDARY_CHNL_OFF_MASK))
+               ht40 = true;
+
        if (hw_mode &&
            (hw_mode->ht_capab & HT_CAP_INFO_SUPP_CHANNEL_WIDTH_SET)) {
-               ie = get_ie(ies, ies_len, WLAN_EID_HT_OPERATION);
-               if (ie && ie[1] >= 2 &&
-                   (ie[3] & HT_INFO_HT_PARAM_SECONDARY_CHNL_OFF_MASK)) {
+               if (ht40) {
                        *max_cw = CHAN_WIDTH_40;
                        adjusted_snr = snr +
                                wpas_channel_width_rssi_bump(ies, ies_len,
@@ -2989,10 +2993,7 @@ unsigned int wpas_get_est_tpt(const struct wpa_supplicant *wpa_s,
                        if (tmp > est)
                                est = tmp;
 
-                       ie = get_ie(ies, ies_len, WLAN_EID_HT_OPERATION);
-                       if (ie && ie[1] >= 2 &&
-                           (ie[3] &
-                            HT_INFO_HT_PARAM_SECONDARY_CHNL_OFF_MASK)) {
+                       if (ht40) {
                                *max_cw = CHAN_WIDTH_40;
                                adjusted_snr = snr +
                                        wpas_channel_width_rssi_bump(
@@ -3081,9 +3082,10 @@ unsigned int wpas_get_est_tpt(const struct wpa_supplicant *wpa_s,
 
                cw = he->he_phy_capab_info[HE_PHYCAP_CHANNEL_WIDTH_SET_IDX] &
                        own_he->phy_cap[HE_PHYCAP_CHANNEL_WIDTH_SET_IDX];
-               if (cw &
-                   (IS_2P4GHZ(freq) ? HE_PHYCAP_CHANNEL_WIDTH_SET_40MHZ_IN_2G :
-                    HE_PHYCAP_CHANNEL_WIDTH_SET_40MHZ_80MHZ_IN_5G)) {
+               if ((cw &
+                    (IS_2P4GHZ(freq) ?
+                     HE_PHYCAP_CHANNEL_WIDTH_SET_40MHZ_IN_2G :
+                     HE_PHYCAP_CHANNEL_WIDTH_SET_40MHZ_80MHZ_IN_5G)) && ht40) {
                        if (*max_cw == CHAN_WIDTH_UNKNOWN ||
                            *max_cw < CHAN_WIDTH_40)
                                *max_cw = CHAN_WIDTH_40;