From ceeed83aa2f128e8e69072404137c9540deb6981 Mon Sep 17 00:00:00 2001 From: Kiran Kumar Lokere Date: Wed, 5 Dec 2018 18:36:01 -0800 Subject: [PATCH] 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 --- core/hdd/src/wlan_hdd_wext.c | 4 +++- core/mac/inc/ani_global.h | 3 ++- core/sme/inc/sme_power_save_api.h | 11 ++++++++++- core/sme/src/common/sme_power_save.c | 14 ++++++++++++-- 4 files changed, 27 insertions(+), 5 deletions(-) diff --git a/core/hdd/src/wlan_hdd_wext.c b/core/hdd/src/wlan_hdd_wext.c index e736afa69fad..13d089f64757 100644 --- a/core/hdd/src/wlan_hdd_wext.c +++ b/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; diff --git a/core/mac/inc/ani_global.h b/core/mac/inc/ani_global.h index 857c0a4ffe31..318f47b7ce16 100644 --- a/core/mac/inc/ani_global.h +++ b/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]; diff --git a/core/sme/inc/sme_power_save_api.h b/core/sme/inc/sme_power_save_api.h index 512f279be6e2..ceda0cff7f62 100644 --- a/core/sme/inc/sme_power_save_api.h +++ b/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) */ diff --git a/core/sme/src/common/sme_power_save.c b/core/sme/src/common/sme_power_save.c index 1ca89e335fcc..a5504e4a81e8 100644 --- a/core/sme/src/common/sme_power_save.c +++ b/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);