Quellcode durchsuchen

qcacld-3.0: Enable BMPS power save for emulation

For emulation builds, remove ps timer stop and
reduce timeout to 11ms, allowing BMPS for
emulation.

Change-Id: Ib633f716ce4bd792a12a08652abe0eb1d36a5750
CRs-Fixed: 3526207
Mohammed Ahmed vor 1 Jahr
Ursprung
Commit
d6cc451bfb
2 geänderte Dateien mit 65 neuen und 8 gelöschten Zeilen
  1. 8 0
      core/sme/inc/sme_power_save.h
  2. 57 8
      core/sme/src/common/sme_power_save.c

+ 8 - 0
core/sme/inc/sme_power_save.h

@@ -1,5 +1,6 @@
 /*
  * Copyright (c) 2015-2019, 2021 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2023 Qualcomm Innovation Center, Inc. All rights reserved.
  *
  * Permission to use, copy, modify, and/or distribute this software for
  * any purpose with or without fee is hereby granted, provided that the
@@ -33,6 +34,13 @@
 #define AUTO_PS_ENTRY_TIMER_DEFAULT_VALUE 1000
 #define AUTO_PS_DEFER_TIMEOUT_MS 1500
 
+#ifdef QCA_WIFI_EMULATION
+/*
+ * Auto Ps timeout for emulation targets.
+ */
+#define AUTO_PS_EMULATION_TIMEOUT 11
+#endif
+
 /**
  * struct ps_global_info - global struct for Power save information
  * @ps_params: maintain power save state and USAPD params

+ 57 - 8
core/sme/src/common/sme_power_save.c

@@ -1,6 +1,6 @@
 /*
  * Copyright (c) 2015-2021 The Linux Foundation. All rights reserved.
- * Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved.
+ * Copyright (c) 2022-2023 Qualcomm Innovation Center, Inc. All rights reserved.
  *
  * Permission to use, copy, modify, and/or distribute this software for
  * any purpose with or without fee is hereby granted, provided that the
@@ -313,6 +313,27 @@ QDF_STATUS sme_ps_process_command(struct mac_context *mac_ctx, uint32_t session_
 	return status;
 }
 
+#ifdef QCA_WIFI_EMULATION
+static QDF_STATUS sme_ps_enable_user_check(bool usr_cfg_ps_enable,
+					   enum sme_ps_cmd command,
+					   uint32_t session_id)
+{
+	return QDF_STATUS_SUCCESS;
+}
+#else
+static QDF_STATUS sme_ps_enable_user_check(bool usr_cfg_ps_enable,
+					   enum sme_ps_cmd command,
+					   uint32_t session_id)
+{
+	if (command == SME_PS_ENABLE && !usr_cfg_ps_enable) {
+		sme_debug("vdev:%d Cannot initiate PS. PS is disabled by usr(ioctl)",
+			  session_id);
+		return QDF_STATUS_E_FAILURE;
+	}
+	return QDF_STATUS_SUCCESS;
+}
+#endif
+
 /**
  * sme_enable_sta_ps_check(): Checks if it is ok to enable power save or not.
  * @mac_ctx: global mac context
@@ -342,11 +363,10 @@ QDF_STATUS sme_enable_sta_ps_check(struct mac_context *mac_ctx,
 	}
 
 	usr_cfg_ps_enable = mlme_get_user_ps(mac_ctx->psoc, session_id);
-	if (command == SME_PS_ENABLE && !usr_cfg_ps_enable) {
-		sme_debug("vdev:%d Cannot initiate PS. PS is disabled by usr(ioctl)",
-			  session_id);
+
+	if (sme_ps_enable_user_check(usr_cfg_ps_enable, command, session_id)
+	    != QDF_STATUS_SUCCESS)
 		return QDF_STATUS_E_FAILURE;
-	}
 
 	/* Check whether the given session is Infra and in Connected State
 	 * also if command is power save disable  there is not need to check
@@ -421,6 +441,23 @@ QDF_STATUS sme_ps_update(mac_handle_t mac_handle, uint32_t vdev_id)
 	return status;
 }
 
+#ifdef QCA_WIFI_EMULATION
+static
+QDF_STATUS sme_ps_set_powersave_disable_auto_timer(mac_handle_t mac_handle,
+						   uint8_t vdev_id)
+{
+	return QDF_STATUS_SUCCESS;
+}
+#else
+static
+QDF_STATUS sme_ps_set_powersave_disable_auto_timer(mac_handle_t mac_handle,
+						   uint8_t vdev_id)
+{
+	return sme_ps_disable_auto_ps_timer(mac_handle,
+					      vdev_id);
+}
+#endif
+
 QDF_STATUS sme_ps_set_powersave(mac_handle_t mac_handle,
 				uint8_t vdev_id, bool allow_power_save,
 				uint32_t timeout,
@@ -497,9 +534,8 @@ QDF_STATUS sme_ps_set_powersave(mac_handle_t mac_handle,
 		 * Enter Full power command received from GUI
 		 * this means we are disconnected
 		 */
-		status = sme_ps_disable_auto_ps_timer(mac_handle,
-						      vdev_id);
-
+		status = sme_ps_set_powersave_disable_auto_timer(mac_handle,
+								 vdev_id);
 		if (status != QDF_STATUS_SUCCESS)
 			goto end;
 
@@ -871,6 +907,18 @@ QDF_STATUS sme_post_pe_message(struct mac_context *mac_ctx,
 	return QDF_STATUS_SUCCESS;
 }
 
+#ifdef QCA_WIFI_EMULATION
+static QDF_STATUS sme_ps_scale_auto_ps_timeout(uint32_t timeout)
+{
+	return AUTO_PS_EMULATION_TIMEOUT;
+}
+#else
+static QDF_STATUS sme_ps_scale_auto_ps_timeout(uint32_t timeout)
+{
+	return timeout;
+}
+#endif
+
 QDF_STATUS sme_ps_enable_auto_ps_timer(mac_handle_t mac_handle,
 				       uint32_t session_id, uint32_t timeout)
 {
@@ -898,6 +946,7 @@ QDF_STATUS sme_ps_enable_auto_ps_timer(mac_handle_t mac_handle,
 		return QDF_STATUS_SUCCESS;
 	}
 
+	timeout = sme_ps_scale_auto_ps_timeout(timeout);
 	sme_debug("Start auto_ps_timer for %d ms", timeout);
 	qdf_status = qdf_mc_timer_start(&ps_param->auto_ps_enable_timer,
 		timeout);