]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
Clean up VHT override max A-MPDU override calculation
authorJouni Malinen <j@w1.fi>
Sun, 14 Dec 2014 16:44:10 +0000 (18:44 +0200)
committerJouni Malinen <j@w1.fi>
Sun, 14 Dec 2014 16:48:59 +0000 (18:48 +0200)
There is no need to use runtime call to find_first_bit() to determine
shift amount for a constant integer.

Signed-off-by: Jouni Malinen <j@w1.fi>
src/common/ieee802_11_defs.h
wpa_supplicant/wpa_supplicant.c

index 26b1493f5f62286437c385e6c97385930d74081a..191bed2231bf450bb4174ddb3b81f4a53c2841e6 100644 (file)
@@ -833,6 +833,7 @@ struct ieee80211_ampe_ie {
 #define VHT_CAP_MAX_A_MPDU_LENGTH_EXPONENT_6        ((u32) BIT(24) | BIT(25))
 #define VHT_CAP_MAX_A_MPDU_LENGTH_EXPONENT_MAX      ((u32) BIT(23) | \
                                                           BIT(24) | BIT(25))
+#define VHT_CAP_MAX_A_MPDU_LENGTH_EXPONENT_MAX_SHIFT 23
 #define VHT_CAP_VHT_LINK_ADAPTATION_VHT_UNSOL_MFB   ((u32) BIT(27))
 #define VHT_CAP_VHT_LINK_ADAPTATION_VHT_MRQ_MFB     ((u32) BIT(26) | BIT(27))
 #define VHT_CAP_RX_ANTENNA_PATTERN                  ((u32) BIT(28))
index 04d6d2f55441ed555b0a176149127fca95e9dbb2..5e3b35bfb9be87aed5261a534868b2eb5f54690a 100644 (file)
@@ -3204,10 +3204,6 @@ void wpa_supplicant_apply_vht_overrides(
 {
        struct ieee80211_vht_capabilities *vhtcaps;
        struct ieee80211_vht_capabilities *vhtcaps_mask;
-#ifdef CONFIG_HT_OVERRIDES
-       int max_ampdu;
-       const u32 max_ampdu_mask = VHT_CAP_MAX_A_MPDU_LENGTH_EXPONENT_MAX;
-#endif /* CONFIG_HT_OVERRIDES */
 
        if (!ssid)
                return;
@@ -3225,9 +3221,12 @@ void wpa_supplicant_apply_vht_overrides(
 
 #ifdef CONFIG_HT_OVERRIDES
        /* if max ampdu is <= 3, we have to make the HT cap the same */
-       if (ssid->vht_capa_mask & max_ampdu_mask) {
-               max_ampdu = (ssid->vht_capa & max_ampdu_mask) >>
-                       find_first_bit(max_ampdu_mask);
+       if (ssid->vht_capa_mask & VHT_CAP_MAX_A_MPDU_LENGTH_EXPONENT_MAX) {
+               int max_ampdu;
+
+               max_ampdu = (ssid->vht_capa &
+                            VHT_CAP_MAX_A_MPDU_LENGTH_EXPONENT_MAX) >>
+                       VHT_CAP_MAX_A_MPDU_LENGTH_EXPONENT_MAX_SHIFT;
 
                max_ampdu = max_ampdu < 3 ? max_ampdu : 3;
                wpa_set_ampdu_factor(wpa_s,