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);