From 7c5e6dc43e356c48da28e1e8470271ed1a5dfe47 Mon Sep 17 00:00:00 2001 From: Jeff Johnson Date: Thu, 15 Nov 2018 21:20:18 -0800 Subject: [PATCH] qcacld-3.0: Refactor TX_FAIL_COUNT 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_TX_FAIL_COUNT Change-Id: I138b6cee0df42a8ca375092eccc103412544ba2a CRs-Fixed: 2371574 --- core/hdd/src/wlan_hdd_cfg80211.c | 38 +++++++++++++++++++------------- 1 file changed, 23 insertions(+), 15 deletions(-) diff --git a/core/hdd/src/wlan_hdd_cfg80211.c b/core/hdd/src/wlan_hdd_cfg80211.c index eb925d1d90e3..c848858034f9 100644 --- a/core/hdd/src/wlan_hdd_cfg80211.c +++ b/core/hdd/src/wlan_hdd_cfg80211.c @@ -5799,6 +5799,27 @@ static int hdd_config_propagation_abs_delay(struct hdd_adapter *adapter, abs_delay, PDEV_CMD); } +static int hdd_config_tx_fail_count(struct hdd_adapter *adapter, + const struct nlattr *attr) +{ + struct hdd_context *hdd_ctx = WLAN_HDD_GET_CTX(adapter); + uint32_t tx_fail_count; + QDF_STATUS status; + + tx_fail_count = nla_get_u32(attr); + if (!tx_fail_count) + return 0; + + status = sme_update_tx_fail_cnt_threshold(hdd_ctx->mac_handle, + adapter->session_id, + tx_fail_count); + if (QDF_IS_STATUS_ERROR(status)) + hdd_err("sme_update_tx_fail_cnt_threshold (err=%d)", + status); + + return qdf_status_to_os_return(status); +} + static int hdd_config_guard_time(struct hdd_adapter *adapter, const struct nlattr *attr) { @@ -5917,6 +5938,8 @@ static const struct independent_setters independent_setters[] = { hdd_config_propagation_delay}, {QCA_WLAN_VENDOR_ATTR_CONFIG_PROPAGATION_ABS_DELAY, hdd_config_propagation_abs_delay}, + {QCA_WLAN_VENDOR_ATTR_CONFIG_TX_FAIL_COUNT, + hdd_config_tx_fail_count}, }; /** @@ -6038,7 +6061,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 tx_fail_count; uint32_t ant_div_usrcfg; uint32_t antdiv_enable, antdiv_chain; uint32_t antdiv_selftest, antdiv_selftest_intvl; @@ -6112,20 +6134,6 @@ __wlan_hdd_cfg80211_wifi_configuration_set(struct wiphy *wiphy, access_policy); } - 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]); - if (tx_fail_count) { - status = sme_update_tx_fail_cnt_threshold(mac_handle, - adapter->session_id, tx_fail_count); - if (QDF_STATUS_SUCCESS != status) { - hdd_err("sme_update_tx_fail_cnt_threshold (err=%d)", - status); - return -EINVAL; - } - } - } - if (vendor_ie_present && access_policy_present) { if (access_policy == QCA_ACCESS_POLICY_DENY_UNLESS_LISTED) { access_policy =