Browse Source

qcacld-3.0: Enable power save with user cfg request

Currently power save enable request user command is not
processed if the station is not in connected state and the
configuration is not saved hence station do not enter into
power save mode until the user command is issued after
connection.
Save the power save user configuration setting if the station
is not connected and start the auto power save timer for one
second timeout value after the station is connected to enable
the power save.

Change-Id: I6e17a8e989ca731ca008dcb46ca79c3a181ddff0
CRs-Fixed: 2371045
Kiran Kumar Lokere 6 years ago
parent
commit
ceeed83aa2

+ 3 - 1
core/hdd/src/wlan_hdd_wext.c

@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011-2018 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2011-2019 The Linux Foundation. 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
@@ -4129,11 +4129,13 @@ static int hdd_we_set_power(struct hdd_adapter *adapter, int value)
 	switch (value) {
 	case 1:
 		/* Enable PowerSave */
+		sme_save_usr_ps_cfg(mac_handle, true);
 		sme_ps_enable_disable(mac_handle, adapter->session_id,
 				      SME_PS_ENABLE);
 		return 0;
 	case 2:
 		/* Disable PowerSave */
+		sme_save_usr_ps_cfg(mac_handle, false);
 		sme_ps_enable_disable(mac_handle, adapter->session_id,
 				      SME_PS_DISABLE);
 		return 0;

+ 2 - 1
core/mac/inc/ani_global.h

@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012-2018 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012-2019 The Linux Foundation. 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
@@ -835,6 +835,7 @@ struct mac_context {
 	/* 11k Offload Support */
 	bool is_11k_offload_supported;
 	uint8_t reject_addba_req;
+	bool usr_cfg_ps_enable;
 	uint16_t usr_cfg_ba_buff_size;
 	bool is_usr_cfg_amsdu_enabled;
 	uint8_t no_ack_policy_cfg[MAX_NUM_AC];

+ 10 - 1
core/sme/inc/sme_power_save_api.h

@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015-2018 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2015-2019 The Linux Foundation. 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
@@ -87,5 +87,14 @@ QDF_STATUS sme_ps_close(mac_handle_t mac_handle);
 QDF_STATUS sme_ps_close_per_session(mac_handle_t mac_handle,
 				    uint32_t session_id);
 
+/**
+ * sme_save_usr_ps_cfg(): saves user power save config
+ * @mac_handle: Opaque handle to the global MAC context
+ * @val: set val
+ *
+ * Returns: QDF_STATUS
+ */
+void sme_save_usr_ps_cfg(mac_handle_t mac_handle, bool val);
+
 #endif /* #if !defined(__SME_POWER_SAVE_API_H) */
 

+ 12 - 2
core/sme/src/common/sme_power_save.c

@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015-2018 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2015-2019 The Linux Foundation. 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
@@ -360,6 +360,14 @@ QDF_STATUS sme_enable_sta_ps_check(struct mac_context *mac_ctx, uint32_t session
 	return QDF_STATUS_SUCCESS;
 }
 
+void sme_save_usr_ps_cfg(mac_handle_t mac_handle, bool val)
+{
+	struct mac_context *mac_ctx = MAC_CONTEXT(mac_handle);
+
+	mac_ctx->usr_cfg_ps_enable = val;
+	sme_debug("usr_cfg_ps_enable  %d", val);
+}
+
 /**
  * sme_ps_enable_disable(): function to enable/disable PS.
  * @mac_handle: Opaque handle to the global MAC context
@@ -747,10 +755,12 @@ QDF_STATUS sme_ps_enable_auto_ps_timer(mac_handle_t mac_handle,
 	struct ps_params *ps_param = &ps_global_info->ps_params[session_id];
 	QDF_STATUS qdf_status;
 
-	if (!timeout) {
+	if (!timeout && !mac_ctx->usr_cfg_ps_enable) {
 		sme_debug("auto_ps_timer called with timeout 0; ignore");
 		return QDF_STATUS_SUCCESS;
 	}
+	if (!timeout)
+		timeout = AUTO_PS_ENTRY_TIMER_DEFAULT_VALUE;
 
 	sme_debug("Start auto_ps_timer for %d ms", timeout);