From 8fb9dedf60cb538488cd4fcf89c58989b0b04e48 Mon Sep 17 00:00:00 2001 From: Jeff Johnson Date: Thu, 15 Nov 2018 20:44:56 -0800 Subject: [PATCH] qcacld-3.0: Refactor PROPAGATION_ABS_DELAY 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_PROPAGATION_ABS_DELAY Change-Id: I789a46ab7baf2719de25c7e3c1531192c3e663a7 CRs-Fixed: 2371573 --- core/hdd/src/wlan_hdd_cfg80211.c | 27 +++++++++++++++++---------- 1 file changed, 17 insertions(+), 10 deletions(-) diff --git a/core/hdd/src/wlan_hdd_cfg80211.c b/core/hdd/src/wlan_hdd_cfg80211.c index 6cd94d9bbb9d..eb925d1d90e3 100644 --- a/core/hdd/src/wlan_hdd_cfg80211.c +++ b/core/hdd/src/wlan_hdd_cfg80211.c @@ -5216,6 +5216,8 @@ wlan_hdd_wifi_config_policy[QCA_WLAN_VENDOR_ATTR_CONFIG_MAX + 1] = { [QCA_WLAN_VENDOR_ATTR_CONFIG_MGMT_RETRY] = {.type = NLA_U8 }, [QCA_WLAN_VENDOR_ATTR_CONFIG_CTRL_RETRY] = {.type = NLA_U8 }, [QCA_WLAN_VENDOR_ATTR_CONFIG_PROPAGATION_DELAY] = {.type = NLA_U8 }, + [QCA_WLAN_VENDOR_ATTR_CONFIG_PROPAGATION_ABS_DELAY] = { + .type = NLA_U32 }, [QCA_WLAN_VENDOR_ATTR_CONFIG_TX_FAIL_COUNT] = {.type = NLA_U32 }, [ANT_DIV_PROBE_PERIOD] = {.type = NLA_U32}, [ANT_DIV_STAY_PERIOD] = {.type = NLA_U32}, @@ -5784,6 +5786,19 @@ static int hdd_config_propagation_delay(struct hdd_adapter *adapter, abs_delay, PDEV_CMD); } +static int hdd_config_propagation_abs_delay(struct hdd_adapter *adapter, + const struct nlattr *attr) +{ + uint32_t abs_delay; + int param_id; + + abs_delay = nla_get_u32(attr); + param_id = WMI_PDEV_PARAM_PROPAGATION_DELAY; + + return wma_cli_set_command(adapter->session_id, param_id, + abs_delay, PDEV_CMD); +} + static int hdd_config_guard_time(struct hdd_adapter *adapter, const struct nlattr *attr) { @@ -5900,6 +5915,8 @@ static const struct independent_setters independent_setters[] = { hdd_config_ctrl_retry}, {QCA_WLAN_VENDOR_ATTR_CONFIG_PROPAGATION_DELAY, hdd_config_propagation_delay}, + {QCA_WLAN_VENDOR_ATTR_CONFIG_PROPAGATION_ABS_DELAY, + hdd_config_propagation_abs_delay}, }; /** @@ -6021,8 +6038,6 @@ __wlan_hdd_cfg80211_wifi_configuration_set(struct wiphy *wiphy, bool vendor_ie_present = false, access_policy_present = false; struct sir_set_tx_rx_aggregation_size request; QDF_STATUS qdf_status; - uint32_t abs_delay; - int param_id; uint32_t tx_fail_count; uint32_t ant_div_usrcfg; uint32_t antdiv_enable, antdiv_chain; @@ -6097,14 +6112,6 @@ __wlan_hdd_cfg80211_wifi_configuration_set(struct wiphy *wiphy, access_policy); } - if (tb[QCA_WLAN_VENDOR_ATTR_CONFIG_PROPAGATION_ABS_DELAY]) { - abs_delay = nla_get_u8(tb[ - QCA_WLAN_VENDOR_ATTR_CONFIG_PROPAGATION_ABS_DELAY]); - param_id = WMI_PDEV_PARAM_PROPAGATION_DELAY; - ret_val = wma_cli_set_command(adapter->session_id, param_id, - abs_delay, PDEV_CMD); - } - if (tb[QCA_WLAN_VENDOR_ATTR_CONFIG_TX_FAIL_COUNT]) { tx_fail_count = nla_get_u32( tb[QCA_WLAN_VENDOR_ATTR_CONFIG_TX_FAIL_COUNT]);