From 9381d0329f125a85e68c0c287d611d2ff586cf77 Mon Sep 17 00:00:00 2001 From: Jeff Johnson Date: Wed, 14 Nov 2018 12:42:22 -0800 Subject: [PATCH] qcacld-3.0: Refactor LRO 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_LRO Change-Id: I5627292f84cefe79b1a89d1be84cea5d8a7c6cc1 CRs-Fixed: 2371563 --- core/hdd/src/wlan_hdd_cfg80211.c | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/core/hdd/src/wlan_hdd_cfg80211.c b/core/hdd/src/wlan_hdd_cfg80211.c index de55ddc35b5b..0ac12965fffa 100644 --- a/core/hdd/src/wlan_hdd_cfg80211.c +++ b/core/hdd/src/wlan_hdd_cfg80211.c @@ -5648,6 +5648,17 @@ static int hdd_config_listen_interval(struct hdd_adapter *adapter, return qdf_status_to_os_return(status); } +static int hdd_config_lro(struct hdd_adapter *adapter, + const struct nlattr *attr) +{ + struct hdd_context *hdd_ctx = WLAN_HDD_GET_CTX(adapter); + uint8_t enable_flag; + + enable_flag = nla_get_u8(attr); + + return hdd_lro_set_reset(hdd_ctx, adapter, enable_flag); +} + static int hdd_config_scan_default_ies(struct hdd_adapter *adapter, const struct nlattr *attr) { @@ -5729,6 +5740,8 @@ static const struct independent_setters independent_setters[] = { hdd_config_modulated_dtim}, {QCA_WLAN_VENDOR_ATTR_CONFIG_LISTEN_INTERVAL, hdd_config_listen_interval}, + {QCA_WLAN_VENDOR_ATTR_CONFIG_LRO, + hdd_config_lro}, }; /** @@ -5897,12 +5910,6 @@ __wlan_hdd_cfg80211_wifi_configuration_set(struct wiphy *wiphy, mac_handle = hdd_ctx->mac_handle; - if (tb[QCA_WLAN_VENDOR_ATTR_CONFIG_LRO]) { - enable_flag = nla_get_u8(tb[QCA_WLAN_VENDOR_ATTR_CONFIG_LRO]); - ret_val = hdd_lro_set_reset(hdd_ctx, adapter, - enable_flag); - } - if (tb[QCA_WLAN_VENDOR_ATTR_CONFIG_SCAN_ENABLE]) { enable_flag = nla_get_u8(tb[QCA_WLAN_VENDOR_ATTR_CONFIG_SCAN_ENABLE]);