qcacld-3.0: Refactor IGNORE_ASSOC_DISALLOWED configuration

One of the HDD functions with the highest cyclomatic complexity is
__wlan_hdd_cfg80211_wifi_configuration_set(). In order to reduce the
complexity there is a plan to replace the inline attribute handling
with a vtable-based approach.

As part of that goal refactor the following independent attribute
handling into a separate function and add that function to the vtable:
- QCA_WLAN_VENDOR_ATTR_CONFIG_IGNORE_ASSOC_DISALLOWED

Change-Id: I3f91195a7b26ea248d57f608936e79761890dc1b
CRs-Fixed: 2371577
This commit is contained in:
Jeff Johnson
2018-11-16 07:26:46 -08:00
parent f9871e4c06
commit 3a25de856b

View File

@@ -5913,6 +5913,26 @@ static int hdd_config_ant_div_ena(struct hdd_adapter *adapter,
return errno;
}
static int hdd_config_ignore_assoc_disallowed(struct hdd_adapter *adapter,
const struct nlattr *attr)
{
struct hdd_context *hdd_ctx = WLAN_HDD_GET_CTX(adapter);
uint8_t ignore_assoc_disallowed;
ignore_assoc_disallowed = nla_get_u8(attr);
hdd_debug("%u", ignore_assoc_disallowed);
if ((ignore_assoc_disallowed < QCA_IGNORE_ASSOC_DISALLOWED_DISABLE) ||
(ignore_assoc_disallowed > QCA_IGNORE_ASSOC_DISALLOWED_ENABLE))
return -EINVAL;
sme_update_session_param(hdd_ctx->mac_handle,
adapter->session_id,
SIR_PARAM_IGNORE_ASSOC_DISALLOWED,
ignore_assoc_disallowed);
return 0;
}
/**
* typedef independent_setter_fn - independent attribute handler
* @adapter: The adapter being configured
@@ -5973,6 +5993,8 @@ static const struct independent_setters independent_setters[] = {
hdd_config_channel_avoidance_ind},
{QCA_WLAN_VENDOR_ATTR_CONFIG_ANT_DIV_ENA,
hdd_config_ant_div_ena},
{QCA_WLAN_VENDOR_ATTR_CONFIG_IGNORE_ASSOC_DISALLOWED,
hdd_config_ignore_assoc_disallowed},
};
/**
@@ -6218,26 +6240,6 @@ __wlan_hdd_cfg80211_wifi_configuration_set(struct wiphy *wiphy,
}
}
if (tb[QCA_WLAN_VENDOR_ATTR_CONFIG_IGNORE_ASSOC_DISALLOWED]) {
uint8_t ignore_assoc_disallowed;
ignore_assoc_disallowed
= nla_get_u8(tb[
QCA_WLAN_VENDOR_ATTR_CONFIG_IGNORE_ASSOC_DISALLOWED]);
hdd_debug("Set ignore_assoc_disallowed value - %d",
ignore_assoc_disallowed);
if ((ignore_assoc_disallowed <
QCA_IGNORE_ASSOC_DISALLOWED_DISABLE) ||
(ignore_assoc_disallowed >
QCA_IGNORE_ASSOC_DISALLOWED_ENABLE))
return -EPERM;
sme_update_session_param(mac_handle,
adapter->session_id,
SIR_PARAM_IGNORE_ASSOC_DISALLOWED,
ignore_assoc_disallowed);
}
#define ANT_DIV_SET_PERIOD(probe_period, stay_period) \
((1<<26)|((probe_period&0x1fff)<<13)|(stay_period&0x1fff))