Kaynağa Gözat

qcacld-3.0: Consider def roam scan periods only if not conf'd explicitly

Roam control enable sends default values for roam scan period and
full roam scan period to make sure undesirable values are not
used. But user might want to update values dynamically through
vendor cmd/DRIVER cmd before issuing roam control enable and
doesn't want to overwrite these values with default values.
So, consider default values sent only if user hasn't configured
already. This can be done by comparing configured value with
ini values.

Change-Id: I68ac6a9afbe4a45c1a1ade3286c57f36303c49e9
CRs-Fixed: 2530344
Srinivas Dasari 5 yıl önce
ebeveyn
işleme
240d327763

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

@@ -4125,7 +4125,12 @@ roam_control_policy[QCA_ATTR_ROAM_CONTROL_MAX + 1] = {
  * @hdd_ctx: HDD context
  * @vdev_id: vdev id
  * @full_roam_scan_period: Idle period in seconds between two successive
- * full channel roam scans
+ *			   full channel roam scans
+ * @check_and_update: If this is true/set, update the value only if the current
+ *		      configured value is not same as global value read from
+ *		      ini param. This is to give priority to the user configured
+ *		      values and retain the value, if updated already.
+ *		      If this is not set, update the value without any check.
  *
  * Validate the full roam scan period and send it to firmware
  *
@@ -4134,9 +4139,11 @@ roam_control_policy[QCA_ATTR_ROAM_CONTROL_MAX + 1] = {
 static QDF_STATUS
 hdd_send_roam_full_scan_period_to_sme(struct hdd_context *hdd_ctx,
 				      uint8_t vdev_id,
-				      uint32_t full_roam_scan_period)
+				      uint32_t full_roam_scan_period,
+				      bool check_and_update)
 {
 	QDF_STATUS status;
+	uint32_t full_roam_scan_period_current, full_roam_scan_period_global;
 
 	if (!ucfg_mlme_validate_full_roam_scan_period(full_roam_scan_period))
 		return QDF_STATUS_E_INVAL;
@@ -4144,6 +4151,19 @@ hdd_send_roam_full_scan_period_to_sme(struct hdd_context *hdd_ctx,
 	hdd_debug("Received Command to Set full roam scan period = %u",
 		  full_roam_scan_period);
 
+	status = sme_get_full_roam_scan_period(hdd_ctx->mac_handle, vdev_id,
+					       &full_roam_scan_period_current);
+	if (QDF_IS_STATUS_ERROR(status))
+		return status;
+
+	full_roam_scan_period_global =
+		sme_get_full_roam_scan_period_global(hdd_ctx->mac_handle);
+	if (check_and_update &&
+	    full_roam_scan_period_current != full_roam_scan_period_global) {
+		hdd_debug("Full roam scan period is already updated, value: %u",
+			  full_roam_scan_period_current);
+		return QDF_STATUS_SUCCESS;
+	}
 	status = sme_update_full_roam_scan_period(hdd_ctx->mac_handle, vdev_id,
 						  full_roam_scan_period);
 	if (QDF_IS_STATUS_ERROR(status))
@@ -4287,6 +4307,11 @@ hdd_send_roam_cand_sel_criteria_to_sme(struct hdd_context *hdd_ctx,
  * @hdd_ctx: HDD context
  * @vdev_id: vdev id
  * @roam_scan_period: Roam scan period in seconds
+ * @check_and_update: If this is true/set, update the value only if the current
+ *		      configured value is not same as global value read from
+ *		      ini param. This is to give priority to the user configured
+ *		      values and retain the value, if updated already.
+ *		      If this is not set, update the value without any check.
  *
  * Validate the roam scan period and send it to firmware if valid.
  *
@@ -4295,9 +4320,11 @@ hdd_send_roam_cand_sel_criteria_to_sme(struct hdd_context *hdd_ctx,
 static QDF_STATUS
 hdd_send_roam_scan_period_to_sme(struct hdd_context *hdd_ctx,
 				 uint8_t vdev_id,
-				 uint32_t roam_scan_period)
+				 uint32_t roam_scan_period,
+				 bool check_and_update)
 {
 	QDF_STATUS status;
+	uint16_t roam_scan_period_current, roam_scan_period_global;
 
 	if (!ucfg_mlme_validate_scan_period(roam_scan_period * 1000))
 		return QDF_STATUS_E_INVAL;
@@ -4305,6 +4332,19 @@ hdd_send_roam_scan_period_to_sme(struct hdd_context *hdd_ctx,
 	hdd_debug("Received Command to Set roam scan period (Empty Scan refresh period) = %d",
 		  roam_scan_period);
 
+	status = sme_get_empty_scan_refresh_period(hdd_ctx->mac_handle, vdev_id,
+						   &roam_scan_period_current);
+	if (QDF_IS_STATUS_ERROR(status))
+		return status;
+
+	roam_scan_period_global =
+		sme_get_empty_scan_refresh_period_global(hdd_ctx->mac_handle);
+	if (check_and_update &&
+	    roam_scan_period_current != roam_scan_period_global) {
+		hdd_debug("roam scan period is already updated, value: %u",
+			  roam_scan_period_current / 1000);
+		return QDF_STATUS_SUCCESS;
+	}
 	status = sme_update_empty_scan_refresh_period(hdd_ctx->mac_handle,
 						      vdev_id,
 						      roam_scan_period * 1000);
@@ -4357,17 +4397,6 @@ hdd_set_roam_with_control_config(struct hdd_context *hdd_ctx,
 			hdd_err("failed to config roam control");
 	}
 
-	attr = tb2[QCA_ATTR_ROAM_CONTROL_FULL_SCAN_PERIOD];
-	if (attr) {
-		hdd_debug("Parse and send full scan period to firmware");
-		value = nla_get_u32(attr);
-		status = hdd_send_roam_full_scan_period_to_sme(hdd_ctx,
-							       vdev_id,
-							       value);
-		if (status)
-			hdd_err("failed to config full scan period");
-	}
-
 	if (tb2[QCA_ATTR_ROAM_CONTROL_TRIGGERS]) {
 		hdd_debug("Parse and send roam triggers to firmware");
 		value = nla_get_u32(tb2[QCA_ATTR_ROAM_CONTROL_TRIGGERS]);
@@ -4387,6 +4416,62 @@ hdd_set_roam_with_control_config(struct hdd_context *hdd_ctx,
 						    nla_get_u8(attr));
 		if (QDF_IS_STATUS_ERROR(status))
 			hdd_err("failed to enable/disable roam control config");
+
+		attr = tb2[QCA_ATTR_ROAM_CONTROL_SCAN_PERIOD];
+		if (attr) {
+			hdd_debug("Parse and send scan period to firmware");
+			/* Default value received as part of Roam control enable
+			 * Set this only if user hasn't configured any value so
+			 * far.
+			 */
+			value = nla_get_u32(attr);
+			status = hdd_send_roam_scan_period_to_sme(hdd_ctx,
+								  vdev_id,
+								  value, true);
+			if (QDF_IS_STATUS_ERROR(status))
+				hdd_err("failed to send scan period to firmware");
+		}
+
+		attr = tb2[QCA_ATTR_ROAM_CONTROL_FULL_SCAN_PERIOD];
+		if (attr) {
+			hdd_debug("Parse and send full scan period to firmware");
+			value = nla_get_u32(attr);
+			/* Default value received as part of Roam control enable
+			 * Set this only if user hasn't configured any value so
+			 * far.
+			 */
+			status = hdd_send_roam_full_scan_period_to_sme(hdd_ctx,
+								       vdev_id,
+								       value,
+								       true);
+			if (status)
+				hdd_err("failed to config full scan period");
+		}
+	} else {
+		attr = tb2[QCA_ATTR_ROAM_CONTROL_SCAN_PERIOD];
+		if (attr) {
+			hdd_debug("Parse and send scan period to firmware");
+			/* User configured value, cache the value directly */
+			value = nla_get_u32(attr);
+			status = hdd_send_roam_scan_period_to_sme(hdd_ctx,
+								  vdev_id,
+								  value, false);
+			if (QDF_IS_STATUS_ERROR(status))
+				hdd_err("failed to send scan period to firmware");
+		}
+
+		attr = tb2[QCA_ATTR_ROAM_CONTROL_FULL_SCAN_PERIOD];
+		if (attr) {
+			hdd_debug("Parse and send full scan period to firmware");
+			value = nla_get_u32(attr);
+			/* User configured value, cache the value directly */
+			status = hdd_send_roam_full_scan_period_to_sme(hdd_ctx,
+								       vdev_id,
+								       value,
+								       false);
+			if (status)
+				hdd_err("failed to config full scan period");
+		}
 	}
 
 	/* Scoring and roam candidate selection criteria */
@@ -4399,15 +4484,6 @@ hdd_set_roam_with_control_config(struct hdd_context *hdd_ctx,
 			hdd_err("failed to set candidate selection criteria");
 	}
 
-	attr = tb2[QCA_ATTR_ROAM_CONTROL_SCAN_PERIOD];
-	if (attr) {
-		hdd_debug("Parse and send scan period to firmware");
-		status = hdd_send_roam_scan_period_to_sme(hdd_ctx, vdev_id,
-							  nla_get_u32(attr));
-		if (QDF_IS_STATUS_ERROR(status))
-			hdd_err("failed to send scan period to firmware");
-	}
-
 	return qdf_status_to_os_return(status);
 }
 

+ 16 - 0
core/sme/inc/sme_api.h

@@ -890,6 +890,14 @@ QDF_STATUS sme_set_neighbor_scan_refresh_period(mac_handle_t mac_handle,
 		uint8_t sessionId, uint16_t neighborScanResultsRefreshPeriod);
 uint16_t sme_get_neighbor_scan_refresh_period(mac_handle_t mac_handle);
 
+/**
+ * sme_get_empty_scan_refresh_period_global() - get global scan refresh period
+ * @mac_handle: The handle returned by mac_open
+ *
+ * Return: Empty scan refresh period configured through ini
+ */
+uint16_t sme_get_empty_scan_refresh_period_global(mac_handle_t mac_handle);
+
 /**
  * sme_get_empty_scan_refresh_period() - get empty scan refresh period
  * @mac_handle: The handle returned by mac_open.
@@ -3820,6 +3828,14 @@ QDF_STATUS sme_set_roam_config_enable(mac_handle_t mac_handle,
 QDF_STATUS sme_get_roam_config_status(mac_handle_t mac_handle, uint8_t vdev_id,
 				      uint8_t *config_status);
 
+/**
+ * sme_get_full_roam_scan_period_global() - get global full scan refresh period
+ * @mac_handle: The handle returned by mac_open
+ *
+ * Return: Full roam scan period configured through ini
+ */
+uint16_t sme_get_full_roam_scan_period_global(mac_handle_t mac_handle);
+
 /**
  * sme_get_full_roam_scan_period() - Get full roam scan period
  * @mac_handle: Opaque handle to the MAC context

+ 14 - 0
core/sme/src/common/sme_api.c

@@ -6757,6 +6757,13 @@ uint16_t sme_get_neighbor_scan_refresh_period(mac_handle_t mac_handle)
 	return mac->mlme_cfg->lfr.neighbor_scan_results_refresh_period;
 }
 
+uint16_t sme_get_empty_scan_refresh_period_global(mac_handle_t mac_handle)
+{
+	struct mac_context *mac = MAC_CONTEXT(mac_handle);
+
+	return mac->mlme_cfg->lfr.empty_scan_refresh_period;
+}
+
 QDF_STATUS sme_get_empty_scan_refresh_period(mac_handle_t mac_handle,
 					     uint8_t vdev_id,
 					     uint16_t *refresh_threshold)
@@ -16283,6 +16290,13 @@ QDF_STATUS sme_get_roam_config_status(mac_handle_t mac_handle,
 	return status;
 }
 
+uint16_t sme_get_full_roam_scan_period_global(mac_handle_t mac_handle)
+{
+	struct mac_context *mac = MAC_CONTEXT(mac_handle);
+
+	return mac->mlme_cfg->lfr.roam_full_scan_period;
+}
+
 QDF_STATUS
 sme_get_full_roam_scan_period(mac_handle_t mac_handle, uint8_t vdev_id,
 			      uint32_t *full_roam_scan_period)