Bläddra i källkod

qcacld-3.0: Refactor NON_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_NON_AGG_RETRY

Change-Id: I607335f5975d45f2a38503cbaaa557e02818cbdb
CRs-Fixed: 2371568
Jeff Johnson 6 år sedan
förälder
incheckning
f3827507dd
1 ändrade filer med 17 tillägg och 10 borttagningar
  1. 17 10
      core/hdd/src/wlan_hdd_cfg80211.c

+ 17 - 10
core/hdd/src/wlan_hdd_cfg80211.c

@@ -5703,6 +5703,21 @@ static int hdd_config_stats_avg_factor(struct hdd_adapter *adapter,
 	return qdf_status_to_os_return(status);
 }
 
+static int hdd_config_non_agg_retry(struct hdd_adapter *adapter,
+				    const struct nlattr *attr)
+{
+	uint8_t retry;
+	int param_id;
+
+	retry = nla_get_u8(attr);
+	retry = retry > CFG_NON_AGG_RETRY_MAX ?
+		CFG_NON_AGG_RETRY_MAX : retry;
+	param_id = WMI_PDEV_PARAM_NON_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)
 {
@@ -5809,6 +5824,8 @@ static const struct independent_setters independent_setters[] = {
 	 hdd_config_stats_avg_factor},
 	{QCA_WLAN_VENDOR_ATTR_CONFIG_GUARD_TIME,
 	 hdd_config_guard_time},
+	{QCA_WLAN_VENDOR_ATTR_CONFIG_NON_AGG_RETRY,
+	 hdd_config_non_agg_retry},
 };
 
 /**
@@ -6007,16 +6024,6 @@ __wlan_hdd_cfg80211_wifi_configuration_set(struct wiphy *wiphy,
 			access_policy);
 	}
 
-	if (tb[QCA_WLAN_VENDOR_ATTR_CONFIG_NON_AGG_RETRY]) {
-		retry = nla_get_u8(tb[
-				QCA_WLAN_VENDOR_ATTR_CONFIG_NON_AGG_RETRY]);
-		retry = retry > CFG_NON_AGG_RETRY_MAX ?
-				CFG_NON_AGG_RETRY_MAX : retry;
-		param_id = WMI_PDEV_PARAM_NON_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_AGG_RETRY]) {
 		retry = nla_get_u8(tb[QCA_WLAN_VENDOR_ATTR_CONFIG_AGG_RETRY]);
 		retry = retry > CFG_AGG_RETRY_MAX ?