Browse Source

qcacld-3.0: Refactor MODULATED_DTIM 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_MODULATED_DTIM

Change-Id: Iebadf68ec920ab4198feb5b8ee99ec3d8b961173
CRs-Fixed: 2371561
Jeff Johnson 6 years ago
parent
commit
bcaeafb9f6
1 changed files with 23 additions and 15 deletions
  1. 23 15
      core/hdd/src/wlan_hdd_cfg80211.c

+ 23 - 15
core/hdd/src/wlan_hdd_cfg80211.c

@@ -5603,6 +5603,26 @@ static int hdd_config_fine_time_measurement(struct hdd_adapter *adapter,
 	return 0;
 }
 
+static int hdd_config_modulated_dtim(struct hdd_adapter *adapter,
+				     const struct nlattr *attr)
+{
+	struct wlan_objmgr_vdev *vdev;
+	uint32_t modulated_dtim;
+	QDF_STATUS status;
+
+	modulated_dtim = nla_get_u32(attr);
+
+	vdev = hdd_objmgr_get_vdev(adapter);
+	if (!vdev)
+		return -EINVAL;
+
+	status = ucfg_pmo_config_modulated_dtim(vdev, modulated_dtim);
+
+	hdd_objmgr_put_vdev(adapter);
+
+	return qdf_status_to_os_return(status);
+}
+
 static int hdd_config_scan_default_ies(struct hdd_adapter *adapter,
 				       const struct nlattr *attr)
 {
@@ -5680,6 +5700,8 @@ static const struct independent_setters independent_setters[] = {
 	 hdd_config_scan_default_ies},
 	{QCA_WLAN_VENDOR_ATTR_CONFIG_FINE_TIME_MEASUREMENT,
 	 hdd_config_fine_time_measurement},
+	{QCA_WLAN_VENDOR_ATTR_CONFIG_MODULATED_DTIM,
+	 hdd_config_modulated_dtim},
 };
 
 /**
@@ -5793,7 +5815,7 @@ __wlan_hdd_cfg80211_wifi_configuration_set(struct wiphy *wiphy,
 	int errno;
 	int ret;
 	int ret_val = 0;
-	u32 modulated_dtim, override_li;
+	u32 override_li;
 	u16 stats_avg_factor;
 	u32 guard_time;
 	uint8_t set_value;
@@ -5850,20 +5872,6 @@ __wlan_hdd_cfg80211_wifi_configuration_set(struct wiphy *wiphy,
 
 	mac_handle = hdd_ctx->mac_handle;
 
-	if (tb[QCA_WLAN_VENDOR_ATTR_CONFIG_MODULATED_DTIM]) {
-		modulated_dtim = nla_get_u32(
-			tb[QCA_WLAN_VENDOR_ATTR_CONFIG_MODULATED_DTIM]);
-
-		vdev = hdd_objmgr_get_vdev(adapter);
-		if (!vdev)
-			return -EINVAL;
-		status = ucfg_pmo_config_modulated_dtim(vdev,
-							modulated_dtim);
-		hdd_objmgr_put_vdev(adapter);
-		if (QDF_STATUS_SUCCESS != status)
-			ret_val = -EPERM;
-	}
-
 	if (tb[QCA_WLAN_VENDOR_ATTR_CONFIG_LISTEN_INTERVAL]) {
 		override_li = nla_get_u32(
 			tb[QCA_WLAN_VENDOR_ATTR_CONFIG_LISTEN_INTERVAL]);