From 67d3041bccfbf0fce06a14c588c942282a039117 Mon Sep 17 00:00:00 2001 From: Dustin Brown Date: Thu, 20 Sep 2018 12:10:22 -0700 Subject: [PATCH] qcacld-3.0: Integrate DSC (driver mode change) The Driver Synchronization Core (DSC) is a set of synchronization primitives for use by the driver's orchestration layer. It provides APIs for ensuring safe state transitions (including bring up and tear down) of major driver objects: a single driver, associated psocs, and their associated vdevs. As part of integrating the DSC APIs into HDD, protect driver mode change. Change-Id: I28ae8a61f9ffa7e129cf81ade539df8adc72d853 CRs-Fixed: 2347024 --- core/hdd/src/wlan_hdd_main.c | 35 ++++++++++++++++++++++++++++------- 1 file changed, 28 insertions(+), 7 deletions(-) diff --git a/core/hdd/src/wlan_hdd_main.c b/core/hdd/src/wlan_hdd_main.c index 45389734c705..4592afdf96ba 100644 --- a/core/hdd/src/wlan_hdd_main.c +++ b/core/hdd/src/wlan_hdd_main.c @@ -13493,24 +13493,45 @@ unlock: static int con_mode_handler(const char *kmessage, const struct kernel_param *kp) { - int ret; + struct hdd_driver *hdd_driver = hdd_driver_get(); struct hdd_context *hdd_ctx; + QDF_STATUS status; + int errno; + + hdd_enter(); + + status = dsc_driver_trans_start_wait(hdd_driver->dsc_driver, + "mode change"); + if (QDF_IS_STATUS_ERROR(status)) { + hdd_err("Failed to start 'mode change'; status:%u", status); + errno = qdf_status_to_os_return(status); + goto exit; + } + + dsc_driver_wait_for_ops(hdd_driver->dsc_driver); hdd_ctx = cds_get_context(QDF_MODULE_ID_HDD); - ret = wlan_hdd_validate_context(hdd_ctx); - if (ret) - return ret; + errno = wlan_hdd_validate_context(hdd_ctx); + if (errno) + goto trans_stop; if (!cds_wait_for_external_threads_completion(__func__)) { hdd_warn("External threads are still active, can not change mode"); - return -EAGAIN; + errno = -EAGAIN; + goto trans_stop; } cds_ssr_protect(__func__); - ret = __con_mode_handler(kmessage, kp, hdd_ctx); + errno = __con_mode_handler(kmessage, kp, hdd_ctx); cds_ssr_unprotect(__func__); - return ret; +trans_stop: + dsc_driver_trans_stop(hdd_driver->dsc_driver); + +exit: + hdd_exit(); + + return errno; } static int con_mode_handler_ftm(const char *kmessage,