From 23ec077ed46a015a4b3c71a2234088bbd7f0799f Mon Sep 17 00:00:00 2001 From: Abhishek Ambure Date: Sat, 5 Sep 2020 18:02:40 +0530 Subject: [PATCH] qcacld-3.0: Update user PS config after STA connection For the user power save enable/disable request, host doesn't send power config to FW if STA is not in connected state. Host remembers users power save config in MAC context's "usr_cfg_ps_enable" member. So use this "usr_cfg_ps_enable" to send power save config to FW after STA associates to AP. Problem scenario: 1) User brings STA interface up and sends power save enable to host. 2) As kernel expects power save config command success even in the STA is in disconnected state, host doesn't send power save config to FW and returns success to kernel. 3) If user doesn't send power save enable command to host after STA connects to AP. STA remains in full power mode. Fix: 1) Use "usr_cfg_ps_enable" to send power save config to FW after STA connects to AP. Change-Id: I412567e2bb40a7b2d9566106e50a422f173a86d1 CRs-Fixed: 2767543 --- core/hdd/src/wlan_hdd_power.c | 30 ++++++++++++++++++++++++++++ core/sme/src/common/sme_power_save.c | 2 -- 2 files changed, 30 insertions(+), 2 deletions(-) diff --git a/core/hdd/src/wlan_hdd_power.c b/core/hdd/src/wlan_hdd_power.c index ed45963c109b..c9aa79c045e2 100644 --- a/core/hdd/src/wlan_hdd_power.c +++ b/core/hdd/src/wlan_hdd_power.c @@ -527,6 +527,34 @@ out: } +/** + * hdd_send_ps_config_to_fw() - Check user pwr save config set/reset PS + * @adapter: pointer to hdd adapter + * + * This function checks the power save configuration saved in MAC context + * and sends power save config to FW. + * + * Return: None + */ +static void hdd_send_ps_config_to_fw(struct hdd_adapter *adapter) +{ + struct mac_context *mac_ctx; + struct hdd_context *hdd_ctx; + + if (hdd_validate_adapter(adapter)) + return; + + hdd_ctx = WLAN_HDD_GET_CTX(adapter); + mac_ctx = MAC_CONTEXT(hdd_ctx->mac_handle); + + if (mac_ctx->usr_cfg_ps_enable) + sme_ps_enable_disable(hdd_ctx->mac_handle, adapter->vdev_id, + SME_PS_ENABLE); + else + sme_ps_enable_disable(hdd_ctx->mac_handle, adapter->vdev_id, + SME_PS_DISABLE); +} + /** * __hdd_ipv6_notifier_work_queue() - IPv6 notification work function * @adapter: adapter whose IP address changed @@ -556,6 +584,7 @@ static void __hdd_ipv6_notifier_work_queue(struct hdd_adapter *adapter) hdd_enable_ns_offload(adapter, pmo_ipv6_change_notify); + hdd_send_ps_config_to_fw(adapter); exit: hdd_exit(); } @@ -920,6 +949,7 @@ static void __hdd_ipv4_notifier_work_queue(struct hdd_adapter *adapter) if (ifa && hdd_ctx->is_fils_roaming_supported) sme_send_hlp_ie_info(hdd_ctx->mac_handle, adapter->vdev_id, roam_profile, ifa->ifa_local); + hdd_send_ps_config_to_fw(adapter); exit: hdd_exit(); } diff --git a/core/sme/src/common/sme_power_save.c b/core/sme/src/common/sme_power_save.c index d3ba3ab8fbb0..403b76d83035 100644 --- a/core/sme/src/common/sme_power_save.c +++ b/core/sme/src/common/sme_power_save.c @@ -391,8 +391,6 @@ QDF_STATUS sme_ps_enable_disable(mac_handle_t mac_handle, uint32_t session_id, * In non associated state driver wont handle the power save * But kernel expects return status success even * in the disconnected state. - * TODO: If driver to remember the ps state to further use - * after connection. */ if (!csr_is_conn_state_connected_infra(mac_ctx, session_id)) status = QDF_STATUS_SUCCESS;