Clean up VHT configuration validation
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>
This commit is contained in:
parent
b0f33467a5
commit
9ae52e7034
2 changed files with 11 additions and 6 deletions
|
@ -852,16 +852,16 @@ static int ieee80211ac_cap_check(u32 hw, u32 conf, u32 cap, const char *name)
|
|||
}
|
||||
|
||||
|
||||
static int ieee80211ac_cap_check_max(u32 hw, u32 conf, u32 cap,
|
||||
static int ieee80211ac_cap_check_max(u32 hw, u32 conf, u32 mask,
|
||||
unsigned int shift,
|
||||
const char *name)
|
||||
{
|
||||
u32 hw_max = hw & cap;
|
||||
u32 conf_val = conf & cap;
|
||||
u32 hw_max = hw & mask;
|
||||
u32 conf_val = conf & mask;
|
||||
|
||||
if (conf_val > hw_max) {
|
||||
int offset = find_first_bit(cap);
|
||||
wpa_printf(MSG_ERROR, "Configured VHT capability [%s] exceeds max value supported by the driver (%d > %d)",
|
||||
name, conf_val >> offset, hw_max >> offset);
|
||||
name, conf_val >> shift, hw_max >> shift);
|
||||
return 0;
|
||||
}
|
||||
return 1;
|
||||
|
@ -884,7 +884,8 @@ static int ieee80211ac_supported_vht_capab(struct hostapd_iface *iface)
|
|||
|
||||
#define VHT_CAP_CHECK_MAX(cap) \
|
||||
do { \
|
||||
if (!ieee80211ac_cap_check_max(hw, conf, cap, #cap)) \
|
||||
if (!ieee80211ac_cap_check_max(hw, conf, cap, cap ## _SHIFT, \
|
||||
#cap)) \
|
||||
return 0; \
|
||||
} while (0)
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue