diff options
| author | Mukul Sharma <mukul@qti.qualcomm.com> | 2016-04-07 19:46:40 +0530 |
|---|---|---|
| committer | Anjaneedevi Kapparapu <akappa@codeaurora.org> | 2016-04-17 21:55:01 +0530 |
| commit | 4959aa158ecb489bed099e3d717e054bb5e81659 (patch) | |
| tree | 6f15aa91331807e8db62e3f24ebc9c5fff06538b | |
| parent | 6461c913b7bf19d7372a75451fcec62fc720ad84 (diff) | |
qcacld-2.0: Ensure host access updated WMA handle
Host waits for response from firmware during suspend & resume.
Consider a case during wait for response if SSR happens
then host have old WMA handle. So after time out host
should ensure it has latest WMA handle. If caller has
old handler then they should return gracefully.
Change-Id: I180fe936af87efa6e1538a874af9d07bcfc758b0
CRs-Fixed: 1000615
| -rw-r--r-- | CORE/SERVICES/WMA/wma.c | 52 |
1 files changed, 31 insertions, 21 deletions
diff --git a/CORE/SERVICES/WMA/wma.c b/CORE/SERVICES/WMA/wma.c index 34a2cdb4aa1e..10f9b2106dd6 100644 --- a/CORE/SERVICES/WMA/wma.c +++ b/CORE/SERVICES/WMA/wma.c @@ -456,6 +456,24 @@ static inline u_int8_t wma_get_vdev_count(tp_wma_handle wma) return vdev_count; } +/** + * wma_did_ssr_happen() - Check if SSR happened by comparing current + * wma handle and new wma handle + * @wma: Pointer to wma handle + * + * This API will compare saved wma handle and new wma handle using global + * vos context. If both doesn't match implies that WMA handle got changed + * while waiting for command which will happen in SSR. + * + * Return: True if SSR happened else false + */ +static bool wma_did_ssr_happen(tp_wma_handle wma) +{ + return vos_get_context(VOS_MODULE_ID_WDA, + vos_get_global_context(VOS_MODULE_ID_VOSS, NULL)) != wma; +} + + /* Function : wma_is_vdev_in_ap_mode * Description : Helper function to know whether given vdev id * is in AP mode or not. @@ -21485,6 +21503,11 @@ int wma_enable_wow_in_fw(WMA_HANDLE handle, int runtime_pm) WMA_TGT_SUSPEND_COMPLETE_TIMEOUT) != VOS_STATUS_SUCCESS) { WMA_LOGE("Failed to receive WoW Enable Ack from FW"); + if (wma_did_ssr_happen(wma)) { + WMA_LOGE("%s: SSR happened while waiting for response", + __func__); + return VOS_STATUS_E_FAILURE; + } WMA_LOGE("Credits:%d; Pending_Cmds: %d", wmi_get_host_credits(wma->wmi_handle), wmi_get_pending_cmds(wma->wmi_handle)); @@ -22454,23 +22477,6 @@ send_ready_to_suspend: return VOS_STATUS_SUCCESS; } -/** - * wma_did_ssr_happen() - Check if SSR happened by comparing current - * wma handle and new wma handle - * @wma: Pointer to wma handle - * - * This API will compare saved wma handle and new wma handle using global - * vos context. If both doesn't match implies that WMA handle got changed - * while waiting for command which will happen in SSR. - * - * Return: True if SSR happened else false - */ -static bool wma_did_ssr_happen(tp_wma_handle wma) -{ - return vos_get_context(VOS_MODULE_ID_WDA, - vos_get_global_context(VOS_MODULE_ID_VOSS, NULL)) != wma; -} - /* * Sends host wakeup indication to FW. On receiving this indication, * FW will come out of WOW. @@ -22517,20 +22523,19 @@ static VOS_STATUS wma_send_host_wakeup_ind_to_fw(tp_wma_handle wma) } WMA_LOGD("Host wakeup indication sent to fw"); - vos_status = vos_wait_single_event(&(wma->wma_resume_event), WMA_RESUME_TIMEOUT); if (VOS_STATUS_SUCCESS != vos_status) { WMA_LOGE("%s: Timeout waiting for resume event from FW", __func__); - WMA_LOGE("%s: Pending commands %d credits %d", __func__, - wmi_get_pending_cmds(wma->wmi_handle), - wmi_get_host_credits(wma->wmi_handle)); if (wma_did_ssr_happen(wma)) { WMA_LOGE("%s: SSR happened while waiting for response", __func__); return VOS_STATUS_E_ALREADY; } + WMA_LOGE("%s: Pending commands %d credits %d", __func__, + wmi_get_pending_cmds(wma->wmi_handle), + wmi_get_host_credits(wma->wmi_handle)); if (!vos_is_logp_in_progress(VOS_MODULE_ID_WDA, NULL)) { #ifdef CONFIG_CNSS if (pMac->sme.enableSelfRecovery) { @@ -33554,6 +33559,11 @@ int wma_suspend_target(WMA_HANDLE handle, int disable_target_intr) timeout) != VOS_STATUS_SUCCESS) { WMA_LOGE("Failed to get ACK from firmware for pdev suspend"); + if (wma_did_ssr_happen(wma_handle)) { + WMA_LOGE("%s: SSR happened while waiting for response", + __func__); + return VOS_STATUS_E_FAILURE; + } wmi_set_target_suspend(wma_handle->wmi_handle, FALSE); #ifdef CONFIG_CNSS if (vos_is_load_unload_in_progress(VOS_MODULE_ID_WDA, NULL) || |
