From e675ca784d30e2a8f31eed94a0422cd92c0411ef Mon Sep 17 00:00:00 2001 From: Prashanth Bhatta Date: Thu, 20 Oct 2016 18:42:37 -0700 Subject: qcacld-3.0: Complete resume if FW crashed If WLAN FW crashes while in suspend mode then kernel tries to resume the driver and WMA sends resume indication to WLAN FW and waits for the response from WLAN FW. Since FW is already crashed, there will not be any response from WLAN FW and wait logic waits for the timeout before bailing out. This may cause delay in completing the recovery and may cause other race conditions becuase of that. Register for shutdown notification so that call back would be called during recovery and resume event can be set to make sure resume thread doesn't just wait for the FW response. Change-Id: Icdd78479dd4072eabf29e7b0664d328553bfa1ad CRs-fixed: 1079299 (cherry picked from commit 9e493ade1c08204fcfff51c66d135803d830fa60) --- core/wma/src/wma_main.c | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/core/wma/src/wma_main.c b/core/wma/src/wma_main.c index 3962513329ea..98eadc66cbb8 100644 --- a/core/wma/src/wma_main.c +++ b/core/wma/src/wma_main.c @@ -1672,6 +1672,25 @@ static void wma_init_max_no_of_peers(tp_wma_handle wma_handle, cfg->max_no_of_peers = max_peers; } +/** + * wma_shutdown_notifier_cb - Shutdown notifer call back + * @priv : WMA handle + * + * During recovery, WMA may wait for resume to complete if the crash happens + * while in suspend. This may cause delays in completing the recovery. This call + * back would be called during recovery and the event is completed so that if + * the resume is waiting on FW to respond then it can get out of the wait so + * that recovery thread can start bringing down all the modules. + * + * Return: None + */ +static void wma_shutdown_notifier_cb(void *priv) +{ + tp_wma_handle wma_handle = priv; + + qdf_event_set(&wma_handle->wma_resume_event); +} + struct wma_version_info g_wmi_version_info; /** @@ -2097,6 +2116,14 @@ QDF_STATUS wma_open(void *cds_context, goto err_event_init; } + qdf_status = cds_shutdown_notifier_register(wma_shutdown_notifier_cb, + wma_handle); + if (qdf_status != QDF_STATUS_SUCCESS) { + WMA_LOGP("%s: Shutdown notifier register failed: %d", + __func__, qdf_status); + goto err_event_init; + } + qdf_status = qdf_event_create(&wma_handle->runtime_suspend); if (qdf_status != QDF_STATUS_SUCCESS) { WMA_LOGP("%s: runtime_suspend event initialization failed", -- cgit v1.2.3