From d03b22c36f3c8243b8dd68809a3e08dd12668040 Mon Sep 17 00:00:00 2001 From: Vevek Venkatesan Date: Wed, 31 Mar 2021 12:16:19 +0530 Subject: [PATCH] qcacld-3.0: add CDS API to check if driver state module stop Add a CDS API to check if the driver state is module stop and also register for QDF wrapper for the same. Change-Id: I99fbdda593ca229ef8db956c609735ae6509d511 CRs-Fixed: 2912747 --- core/cds/inc/cds_api.h | 26 +++++++++++++++++++------- core/cds/src/cds_api.c | 3 +++ core/hdd/src/wlan_hdd_main.c | 9 +++++---- 3 files changed, 27 insertions(+), 11 deletions(-) diff --git a/core/cds/inc/cds_api.h b/core/cds/inc/cds_api.h index 266a5824feb3..58ccfe78758d 100644 --- a/core/cds/inc/cds_api.h +++ b/core/cds/inc/cds_api.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014-2020 The Linux Foundation. All rights reserved. + * Copyright (c) 2014-2021 The Linux Foundation. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for * any purpose with or without fee is hereby granted, provided that the @@ -60,7 +60,7 @@ * CDS_DRIVER_STATE_UNLOADING: Driver remove is in progress. * CDS_DRIVER_STATE_RECOVERING: Recovery in progress. * CDS_DRIVER_STATE_BAD: Driver in bad state. - * CDS_DRIVER_STATE_MODULE_STOPPING: Module stop in progress. + * CDS_DRIVER_STATE_MODULE_STOP: Module stop in progress or done. * CDS_DRIVER_STATE_ASSERTING_TARGET: Driver assert target in progress. */ enum cds_driver_state { @@ -71,7 +71,7 @@ enum cds_driver_state { CDS_DRIVER_STATE_RECOVERING = BIT(3), CDS_DRIVER_STATE_BAD = BIT(4), CDS_DRIVER_STATE_FW_READY = BIT(5), - CDS_DRIVER_STATE_MODULE_STOPPING = BIT(6), + CDS_DRIVER_STATE_MODULE_STOP = BIT(6), CDS_DRIVER_STATE_ASSERTING_TARGET = BIT(7), }; @@ -163,6 +163,18 @@ static inline bool cds_is_target_ready(void) return __CDS_IS_DRIVER_STATE(state, CDS_DRIVER_STATE_FW_READY); } +/** + * cds_is_driver_state_module_stop - Is module stop is in-progress or done + * + * Return: true if driver state is module stop and false otherwise. + */ +static inline bool cds_is_driver_state_module_stop(void) +{ + enum cds_driver_state state = cds_get_driver_state(); + + return __CDS_IS_DRIVER_STATE(state, CDS_DRIVER_STATE_MODULE_STOP); +} + /** * cds_set_recovery_in_progress() - Set recovery in progress * @value: value to set @@ -248,18 +260,18 @@ static inline void cds_set_unload_in_progress(uint8_t value) } /** - * cds_set_module_stop_in_progress() - Setting module stop in progress + * cds_set_driver_state_module_stop() - Setting module stop in progress or done * * @value: value to set * * Return: none */ -static inline void cds_set_module_stop_in_progress(bool value) +static inline void cds_set_driver_state_module_stop(bool value) { if (value) - cds_set_driver_state(CDS_DRIVER_STATE_MODULE_STOPPING); + cds_set_driver_state(CDS_DRIVER_STATE_MODULE_STOP); else - cds_clear_driver_state(CDS_DRIVER_STATE_MODULE_STOPPING); + cds_clear_driver_state(CDS_DRIVER_STATE_MODULE_STOP); } /** diff --git a/core/cds/src/cds_api.c b/core/cds/src/cds_api.c index 7f7b2a734ef1..271a6ec15bcb 100644 --- a/core/cds/src/cds_api.c +++ b/core/cds/src/cds_api.c @@ -248,6 +248,8 @@ QDF_STATUS cds_init(void) qdf_register_self_recovery_callback(cds_trigger_recovery_psoc); qdf_register_fw_down_callback(cds_is_fw_down); qdf_register_is_driver_unloading_callback(cds_is_driver_unloading); + qdf_register_is_driver_state_module_stop_callback( + cds_is_driver_state_module_stop); qdf_register_recovering_state_query_callback(cds_is_driver_recovering); qdf_register_drv_connected_callback(cds_is_drv_connected); qdf_register_drv_supported_callback(cds_is_drv_supported); @@ -276,6 +278,7 @@ void cds_deinit(void) qdf_register_recovering_state_query_callback(NULL); qdf_register_fw_down_callback(NULL); qdf_register_is_driver_unloading_callback(NULL); + qdf_register_is_driver_state_module_stop_callback(NULL); qdf_register_self_recovery_callback(NULL); qdf_register_wmi_send_recv_qmi_callback(NULL); diff --git a/core/hdd/src/wlan_hdd_main.c b/core/hdd/src/wlan_hdd_main.c index a5b59835804e..df0aad46f8ee 100644 --- a/core/hdd/src/wlan_hdd_main.c +++ b/core/hdd/src/wlan_hdd_main.c @@ -3900,6 +3900,8 @@ int hdd_wlan_start_modules(struct hdd_context *hdd_ctx, bool reinit) return 0; } + cds_set_driver_state_module_stop(false); + switch (hdd_ctx->driver_status) { case DRIVER_MODULES_UNINITIALIZED: hdd_nofl_debug("Wlan transitioning (UNINITIALIZED -> CLOSED)"); @@ -4176,6 +4178,7 @@ release_lock: cds_shutdown_notifier_purge(); hdd_check_for_leaks(hdd_ctx, reinit); hdd_debug_domain_set(QDF_DEBUG_DOMAIN_INIT); + cds_set_driver_state_module_stop(true); hdd_exit(); @@ -14298,7 +14301,7 @@ int hdd_wlan_stop_modules(struct hdd_context *hdd_ctx, bool ftm_mode) return -EINVAL; } - cds_set_module_stop_in_progress(true); + cds_set_driver_state_module_stop(true); debugfs_threads = hdd_return_debugfs_threads_count(); @@ -14308,7 +14311,7 @@ int hdd_wlan_stop_modules(struct hdd_context *hdd_ctx, bool ftm_mode) if (IS_IDLE_STOP && !ftm_mode) { hdd_psoc_idle_timer_start(hdd_ctx); - cds_set_module_stop_in_progress(false); + cds_set_driver_state_module_stop(false); hdd_bus_bw_compute_timer_stop(hdd_ctx); return -EAGAIN; @@ -14477,8 +14480,6 @@ int hdd_wlan_stop_modules(struct hdd_context *hdd_ctx, bool ftm_mode) hdd_debug("Wlan transitioned (now CLOSED)"); done: - cds_set_module_stop_in_progress(false); - hdd_exit(); return ret;