Browse Source

qcacld-3.0: Refactor AGG_RETRY 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_AGG_RETRY

Change-Id: Ibda27586afb6daf7745c2a98cb947a22975e0453
CRs-Fixed: 2371569
Jeff Johnson 6 years ago
parent
commit
b902100ff3
1 changed files with 21 additions and 13 deletions
  1. 21 13
      core/hdd/src/wlan_hdd_cfg80211.c

+ 21 - 13
core/hdd/src/wlan_hdd_cfg80211.c

@@ -5718,6 +5718,25 @@ static int hdd_config_non_agg_retry(struct hdd_adapter *adapter,
 				   retry, PDEV_CMD);
 }
 
+static int hdd_config_agg_retry(struct hdd_adapter *adapter,
+				const struct nlattr *attr)
+{
+	uint8_t retry;
+	int param_id;
+
+	retry = nla_get_u8(attr);
+	retry = retry > CFG_AGG_RETRY_MAX ?
+		CFG_AGG_RETRY_MAX : retry;
+
+	/* Value less than CFG_AGG_RETRY_MIN has side effect to t-put */
+	retry = ((retry > 0) && (retry < CFG_AGG_RETRY_MIN)) ?
+		CFG_AGG_RETRY_MIN : retry;
+	param_id = WMI_PDEV_PARAM_AGG_SW_RETRY_TH;
+
+	return wma_cli_set_command(adapter->session_id, param_id,
+				   retry, PDEV_CMD);
+}
+
 static int hdd_config_guard_time(struct hdd_adapter *adapter,
 				 const struct nlattr *attr)
 {
@@ -5826,6 +5845,8 @@ static const struct independent_setters independent_setters[] = {
 	 hdd_config_guard_time},
 	{QCA_WLAN_VENDOR_ATTR_CONFIG_NON_AGG_RETRY,
 	 hdd_config_non_agg_retry},
+	{QCA_WLAN_VENDOR_ATTR_CONFIG_AGG_RETRY,
+	 hdd_config_agg_retry},
 };
 
 /**
@@ -6024,19 +6045,6 @@ __wlan_hdd_cfg80211_wifi_configuration_set(struct wiphy *wiphy,
 			access_policy);
 	}
 
-	if (tb[QCA_WLAN_VENDOR_ATTR_CONFIG_AGG_RETRY]) {
-		retry = nla_get_u8(tb[QCA_WLAN_VENDOR_ATTR_CONFIG_AGG_RETRY]);
-		retry = retry > CFG_AGG_RETRY_MAX ?
-			CFG_AGG_RETRY_MAX : retry;
-
-		/* Value less than CFG_AGG_RETRY_MIN has side effect to t-put */
-		retry = ((retry > 0) && (retry < CFG_AGG_RETRY_MIN)) ?
-				CFG_AGG_RETRY_MIN : retry;
-		param_id = WMI_PDEV_PARAM_AGG_SW_RETRY_TH;
-		ret_val = wma_cli_set_command(adapter->session_id, param_id,
-					      retry, PDEV_CMD);
-	}
-
 	if (tb[QCA_WLAN_VENDOR_ATTR_CONFIG_MGMT_RETRY]) {
 		retry = nla_get_u8(tb[QCA_WLAN_VENDOR_ATTR_CONFIG_MGMT_RETRY]);
 		retry = retry > CFG_MGMT_RETRY_MAX ?