From 9f46158146695ef4c23cbd54f52c0bfd4e395fd3 Mon Sep 17 00:00:00 2001 From: Rajeev Kumar Date: Thu, 27 Sep 2018 18:24:47 -0700 Subject: [PATCH] qcacld-3.0: Resume wlan threads during shutdown before adapter reset Resume wlan threads during wlan shutdown process before adapter reset because adapter reset triggers vdev destroy and vdev destroy sends del sta self message to lower layers and in absence of wlan threads this message will not be processed leading to timeout and vdev peer object leak. Hence add fix to make sure wlan threads are resumed before resetting adapters during wlan shutdown process. Change-Id: Idc31b7e41e5d9734b5f6b96fba24948dbfb45c3d CRs-Fixed: 2321503 --- core/cds/inc/cds_sched.h | 10 ++++++++++ core/cds/src/cds_sched.c | 13 +++++++++++++ core/hdd/src/wlan_hdd_power.c | 26 ++++++++++++-------------- 3 files changed, 35 insertions(+), 14 deletions(-) diff --git a/core/cds/inc/cds_sched.h b/core/cds/inc/cds_sched.h index 537dabd8830d..d62f03f95c56 100644 --- a/core/cds/inc/cds_sched.h +++ b/core/cds/inc/cds_sched.h @@ -493,4 +493,14 @@ void cds_shutdown_notifier_purge(void); * shutdown. */ void cds_shutdown_notifier_call(void); + +/** + * cds_resume_rx_thread() - resume rx thread by completing its resume event + * + * Resume RX thread by completing RX thread resume event + * + * Return: None + */ +void cds_resume_rx_thread(void); + #endif /* #if !defined __CDS_SCHED_H */ diff --git a/core/cds/src/cds_sched.c b/core/cds/src/cds_sched.c index 4d44b2d62f90..0dec9dfbd9f6 100644 --- a/core/cds/src/cds_sched.c +++ b/core/cds/src/cds_sched.c @@ -1105,3 +1105,16 @@ int cds_get_gfp_flags(void) return flags; } + +void cds_resume_rx_thread(void) +{ + p_cds_sched_context cds_sched_context = NULL; + + cds_sched_context = get_cds_sched_ctxt(); + if (NULL == cds_sched_context) { + cds_err("cds_sched_context is NULL"); + return; + } + + complete(&cds_sched_context->ol_resume_rx_event); +} diff --git a/core/hdd/src/wlan_hdd_power.c b/core/hdd/src/wlan_hdd_power.c index 81c330fd3204..85e5d83b2f50 100644 --- a/core/hdd/src/wlan_hdd_power.c +++ b/core/hdd/src/wlan_hdd_power.c @@ -1197,7 +1197,6 @@ static void hdd_ssr_restart_sap(struct hdd_context *hdd_ctx) QDF_STATUS hdd_wlan_shutdown(void) { struct hdd_context *hdd_ctx; - p_cds_sched_context cds_sched_context = NULL; void *soc = cds_get_context(QDF_MODULE_ID_SOC); hdd_info("WLAN driver shutting down!"); @@ -1215,6 +1214,18 @@ QDF_STATUS hdd_wlan_shutdown(void) hdd_debug("Invoking packetdump deregistration API"); wlan_deregister_txrx_packetdump(); + /* resume wlan threads before adapter reset which does vdev destroy */ + if (hdd_ctx->is_scheduler_suspended) { + scheduler_resume(); + hdd_ctx->is_scheduler_suspended = false; + hdd_ctx->is_wiphy_suspended = false; + } + + if (hdd_ctx->is_ol_rx_thread_suspended) { + cds_resume_rx_thread(); + hdd_ctx->is_ol_rx_thread_suspended = false; + } + /* * After SSR, FW clear its txrx stats. In host, * as adapter is intact so those counts are still @@ -1240,19 +1251,6 @@ QDF_STATUS hdd_wlan_shutdown(void) /* De-register the HDD callbacks */ hdd_deregister_cb(hdd_ctx); - cds_sched_context = get_cds_sched_ctxt(); - - if (hdd_ctx->is_scheduler_suspended) { - scheduler_resume(); - hdd_ctx->is_scheduler_suspended = false; - hdd_ctx->is_wiphy_suspended = false; - } - - if (true == hdd_ctx->is_ol_rx_thread_suspended) { - complete(&cds_sched_context->ol_resume_rx_event); - hdd_ctx->is_ol_rx_thread_suspended = false; - } - hdd_wlan_stop_modules(hdd_ctx, false); hdd_bus_bandwidth_deinit(hdd_ctx);