瀏覽代碼

qcacld-3.0: Maintain driver state in CDS

Driver state of loading, unloading, logp are maintained in
multiple modules like HDD, CDS. Change to maintain the driver
state in CDS and provide CDS APIs to find out the state of the
driver so that any of the module can query it.
Also rename the logp to recovery in progress for clarity purpose.

Change-Id: I8e1864e1bc7f3b1dd6f4eb804ce2578c6695967d
CRs-fixed: 958659
Prashanth Bhatta 9 年之前
父節點
當前提交
dfcae6ba35

+ 0 - 2
config/WCNSS_qcom_cfg.ini

@@ -311,8 +311,6 @@ gEnableDFSChnlScan=1
 gAllowDFSChannelRoam=1
 
 gVhtChannelWidth=2
-gEnableLogp=1
-
 
 # Enable Automatic Tx Power control
 

+ 4 - 4
core/bmi/src/ol_fw.c

@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014-2015 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2014-2016 The Linux Foundation. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
@@ -618,8 +618,8 @@ void ol_target_failure(void *instance, CDF_STATUS status)
 	}
 	scn->target_status = OL_TRGET_STATUS_RESET;
 
-	if (cds_is_logp_in_progress()) {
-		BMI_ERR("%s: LOGP is in progress, ignore!\n", __func__);
+	if (cds_is_driver_recovering()) {
+		BMI_ERR("%s: Recovery in progress, ignore!\n", __func__);
 		return;
 	}
 
@@ -628,7 +628,7 @@ void ol_target_failure(void *instance, CDF_STATUS status)
 		       __func__);
 		return;
 	}
-	cds_set_logp_in_progress(true);
+	cds_set_recovery_in_progress(true);
 
 #ifdef CONFIG_CNSS
 	ret = hif_check_fw_reg(scn);

+ 128 - 9
core/cds/inc/cds_api.h

@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014-2015 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2014-2016 The Linux Foundation. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
@@ -55,6 +55,133 @@
  */
 #define CDS_WMA_TIMEOUT  (15000)
 
+/**
+ * enum cds_driver_state - Driver state
+ * @CDS_DRIVER_STATE_UNINITIALIZED: Driver is in uninitialized state.
+ * CDS_DRIVER_STATE_LOADED: Driver is loaded and functional.
+ * CDS_DRIVER_STATE_LOADING: Driver probe is in progress.
+ * CDS_DRIVER_STATE_UNLOADING: Driver remove is in progress.
+ * CDS_DRIVER_STATE_RECOVERING: Recovery in progress.
+ */
+enum cds_driver_state {
+	CDS_DRIVER_STATE_UNINITIALIZED	= 0,
+	CDS_DRIVER_STATE_LOADED		= BIT(0),
+	CDS_DRIVER_STATE_LOADING	= BIT(1),
+	CDS_DRIVER_STATE_UNLOADING	= BIT(2),
+	CDS_DRIVER_STATE_RECOVERING	= BIT(3),
+};
+
+#define __CDS_IS_DRIVER_STATE(_state, _mask) (((_state) & (_mask)) == (_mask))
+
+void cds_set_driver_state(enum cds_driver_state);
+void cds_clear_driver_state(enum cds_driver_state);
+enum cds_driver_state cds_get_driver_state(void);
+
+/**
+ * cds_is_driver_loading() - Is driver load in progress
+ *
+ * Return: true if driver is loading and false otherwise.
+ */
+static inline bool cds_is_driver_loading(void)
+{
+	enum cds_driver_state state = cds_get_driver_state();
+
+	return __CDS_IS_DRIVER_STATE(state, CDS_DRIVER_STATE_LOADING);
+}
+
+/**
+ * cds_is_driver_unloading() - Is driver unload in progress
+ *
+ * Return: true if driver is unloading and false otherwise.
+ */
+static inline bool cds_is_driver_unloading(void)
+{
+	enum cds_driver_state state = cds_get_driver_state();
+
+	return __CDS_IS_DRIVER_STATE(state, CDS_DRIVER_STATE_UNLOADING);
+}
+
+/**
+ * cds_is_driver_recovering() - Is recovery in progress
+ *
+ * Return: true if recovery in progress  and false otherwise.
+ */
+static inline bool cds_is_driver_recovering(void)
+{
+	enum cds_driver_state state = cds_get_driver_state();
+
+	return __CDS_IS_DRIVER_STATE(state, CDS_DRIVER_STATE_RECOVERING);
+}
+
+/**
+ * cds_is_load_unload_in_progress() - Is driver load/unload in progress
+ *
+ * Return: true if driver is loading or unloading and false otherwise.
+ */
+static inline bool cds_is_load_unload_in_progress(void)
+{
+	enum cds_driver_state state = cds_get_driver_state();
+
+	return __CDS_IS_DRIVER_STATE(state, CDS_DRIVER_STATE_LOADING |
+				     CDS_DRIVER_STATE_UNLOADING);
+}
+
+/**
+ * cds_set_recovery_in_progress() - Set recovery in progress
+ * @value: value to set
+ *
+ * Return: none
+ */
+static inline void cds_set_recovery_in_progress(uint8_t value)
+{
+	if (value)
+		cds_set_driver_state(CDS_DRIVER_STATE_RECOVERING);
+	else
+		cds_clear_driver_state(CDS_DRIVER_STATE_RECOVERING);
+}
+
+/**
+ * cds_set_load_in_progress() - Set load in progress
+ * @value: value to set
+ *
+ * Return: none
+ */
+static inline void cds_set_load_in_progress(uint8_t value)
+{
+	if (value)
+		cds_set_driver_state(CDS_DRIVER_STATE_LOADING);
+	else
+		cds_clear_driver_state(CDS_DRIVER_STATE_LOADING);
+}
+
+/**
+ * cds_set_driver_loaded() - Set load completed
+ * @value: value to set
+ *
+ * Return: none
+ */
+static inline void cds_set_driver_loaded(uint8_t value)
+{
+	if (value)
+		cds_set_driver_state(CDS_DRIVER_STATE_LOADED);
+	else
+		cds_clear_driver_state(CDS_DRIVER_STATE_LOADED);
+}
+
+/**
+ * cds_set_unload_in_progress() - Set unload in progress
+ * @value: value to set
+ *
+ * Return: none
+ */
+static inline void cds_set_unload_in_progress(uint8_t value)
+{
+	if (value)
+		cds_set_driver_state(CDS_DRIVER_STATE_UNLOADING);
+	else
+		cds_clear_driver_state(CDS_DRIVER_STATE_UNLOADING);
+}
+
 v_CONTEXT_t cds_init(void);
 void cds_deinit(void);
 
@@ -76,14 +203,6 @@ void *cds_get_context(CDF_MODULE_ID moduleId);
 
 v_CONTEXT_t cds_get_global_context(void);
 
-uint8_t cds_is_logp_in_progress(void);
-void cds_set_logp_in_progress(uint8_t value);
-
-uint8_t cds_is_load_unload_in_progress(void);
-uint8_t cds_is_unload_in_progress(void);
-
-void cds_set_load_unload_in_progress(uint8_t value);
-
 CDF_STATUS cds_alloc_context(void *p_cds_context, CDF_MODULE_ID moduleID,
 			     void **ppModuleContext, uint32_t size);
 

+ 2 - 4
core/cds/inc/cds_sched.h

@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014-2015 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2014-2016 The Linux Foundation. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
@@ -257,7 +257,7 @@ typedef struct _cds_context_type {
 
 	cdf_event_t ProbeEvent;
 
-	volatile uint8_t isLogpInProgress;
+	uint32_t driver_state;
 
 	cdf_event_t wmaCompleteEvent;
 
@@ -281,8 +281,6 @@ typedef struct _cds_context_type {
 	/* Configuration handle used to get system configuration */
 	void *cfg_ctx;
 
-	volatile uint8_t isLoadUnloadInProgress;
-
 	bool is_wakelock_log_enabled;
 	uint32_t wakelock_log_level;
 	uint32_t connectivity_log_level;

+ 35 - 79
core/cds/src/cds_api.c

@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014-2015 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2014-2016 The Linux Foundation. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
@@ -122,6 +122,8 @@ void cds_deinit(void)
 	gp_cds_context->cdf_ctx = NULL;
 	gp_cds_context = NULL;
 
+	cdf_mem_zero(&g_cds_context, sizeof(g_cds_context));
+
 	cdf_mc_timer_exit();
 	cdf_mem_exit();
 
@@ -966,113 +968,67 @@ v_CONTEXT_t cds_get_global_context(void)
 } /* cds_get_global_context() */
 
 /**
- * cds_is_logp_in_progress() - check if ssr/self recovery is going on
+ * cds_get_driver_state() - Get current driver state
  *
- * Return: true if ssr/self recvoery is going on else false
- */
-uint8_t cds_is_logp_in_progress(void)
-{
-	if (gp_cds_context == NULL) {
-		CDF_TRACE(CDF_MODULE_ID_CDF, CDF_TRACE_LEVEL_ERROR,
-			  "%s: global cds context is NULL", __func__);
-		return 1;
-	}
-
-	return gp_cds_context->isLogpInProgress;
-}
-
-/**
- * cds_set_logp_in_progress() - set ssr/self recovery in progress
- * @value: value to set
+ * This API returns current driver state stored in global context.
  *
- * Return: none
+ * Return: Driver state enum
  */
-void cds_set_logp_in_progress(uint8_t value)
+enum cds_driver_state cds_get_driver_state(void)
 {
-	hdd_context_t *pHddCtx = NULL;
-
 	if (gp_cds_context == NULL) {
 		CDF_TRACE(CDF_MODULE_ID_CDF, CDF_TRACE_LEVEL_ERROR,
 			  "%s: global cds context is NULL", __func__);
-		return;
-	}
-	gp_cds_context->isLogpInProgress = value;
 
-	/* HDD uses it's own context variable to check if SSR in progress,
-	 * instead of modifying all HDD APIs set the HDD context variable
-	 * here
-	 */
-	pHddCtx = cds_get_context(CDF_MODULE_ID_HDD);
-	if (!pHddCtx) {
-		CDF_TRACE(CDF_MODULE_ID_CDF, CDF_TRACE_LEVEL_FATAL,
-			  "%s: HDD context is Null", __func__);
-		return;
+		return CDS_DRIVER_STATE_UNINITIALIZED;
 	}
-	pHddCtx->isLogpInProgress = value;
-}
 
-/**
- * cds_is_load_unload_in_progress() - check if driver load/unload in progress
- *
- * Return: true if load/unload is going on else false
- */
-uint8_t cds_is_load_unload_in_progress(void)
-{
-	if (gp_cds_context == NULL) {
-		CDF_TRACE(CDF_MODULE_ID_CDF, CDF_TRACE_LEVEL_ERROR,
-			  "%s: global cds context is NULL", __func__);
-		return 0;
-	}
-
-	return gp_cds_context->isLoadUnloadInProgress;
+	return gp_cds_context->driver_state;
 }
 
 /**
- * cds_is_unload_in_progress() - check if driver unload in
- * progress
+ * cds_set_driver_state() - Set current driver state
+ * @state:	Driver state to be set to.
+ *
+ * This API sets driver state to state. This API only sets the state and doesn't
+ * clear states, please make sure to use cds_clear_driver_state to clear any
+ * state if required.
  *
- * Return: true if unload is going on else false
+ * Return: None
  */
-uint8_t cds_is_unload_in_progress(void)
+void cds_set_driver_state(enum cds_driver_state state)
 {
-	hdd_context_t *hdd_ctx = NULL;
 	if (gp_cds_context == NULL) {
 		CDF_TRACE(CDF_MODULE_ID_CDF, CDF_TRACE_LEVEL_ERROR,
-			  "%s: global cds context is NULL", __func__);
-		return 0;
-	}
-	hdd_ctx = cds_get_context(CDF_MODULE_ID_HDD);
+			  "%s: global cds context is NULL: %x", __func__,
+			  state);
 
-	if (hdd_ctx == NULL) {
-		CDF_TRACE(CDF_MODULE_ID_CDF, CDF_TRACE_LEVEL_ERROR,
-			  "%s: HDD context is NULL", __func__);
-		return 0;
+		return;
 	}
 
-	return hdd_ctx->isUnloadInProgress;
+	gp_cds_context->driver_state |= state;
 }
 
 /**
- * cds_set_load_unload_in_progress() - set load/unload in progress
- * @value: value to set
+ * cds_clear_driver_state() - Clear current driver state
+ * @state:	Driver state to be cleared.
  *
- * Return: none
+ * This API clears driver state. This API only clears the state, please make
+ * sure to use cds_set_driver_state to set any new states.
+ *
+ * Return: None
  */
-void cds_set_load_unload_in_progress(uint8_t value)
+void cds_clear_driver_state(enum cds_driver_state state)
 {
 	if (gp_cds_context == NULL) {
 		CDF_TRACE(CDF_MODULE_ID_CDF, CDF_TRACE_LEVEL_ERROR,
-			  "%s: global cds context is NULL", __func__);
+			  "%s: global cds context is NULL: %x", __func__,
+			  state);
+
 		return;
 	}
-	gp_cds_context->isLoadUnloadInProgress = value;
 
-#ifdef CONFIG_CNSS
-	if (value)
-		cnss_set_driver_status(CNSS_LOAD_UNLOAD);
-	else
-		cnss_set_driver_status(CNSS_INITIALIZED);
-#endif
+	gp_cds_context->driver_state &= ~state;
 }
 
 /**
@@ -1663,12 +1619,12 @@ void cds_trigger_recovery(void)
 		CDF_TRACE(CDF_MODULE_ID_CDF, CDF_TRACE_LEVEL_ERROR,
 			"CRASH_INJECT command is timed out!");
  #ifdef CONFIG_CNSS
-		if (cds_is_logp_in_progress()) {
+		if (cds_is_driver_recovering()) {
 			CDF_TRACE(CDF_MODULE_ID_CDF, CDF_TRACE_LEVEL_ERROR,
-				"LOGP is in progress, ignore!");
+				"Recovery is in progress, ignore!");
 			return;
 		}
-		cds_set_logp_in_progress(true);
+		cds_set_recovery_in_progress(true);
 		cnss_schedule_recovery_work();
  #endif
 

+ 3 - 3
core/cds/src/cds_reg_service.c

@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014-2015 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2014-2016 The Linux Foundation. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
@@ -896,7 +896,7 @@ CDF_STATUS cds_get_reg_domain_from_country_code(v_REGDOMAIN_t *reg_domain_ptr,
 
 	wiphy = hdd_ctx->wiphy;
 
-	if (cds_is_logp_in_progress()) {
+	if (cds_is_driver_recovering()) {
 		CDF_TRACE(CDF_MODULE_ID_CDF, CDF_TRACE_LEVEL_ERROR,
 			  "SSR in progress, return");
 		*reg_domain_ptr = temp_reg_domain;
@@ -1243,7 +1243,7 @@ void __hdd_reg_notifier(struct wiphy *wiphy,
 		return;
 	}
 
-	if (hdd_ctx->isUnloadInProgress || hdd_ctx->isLogpInProgress) {
+	if (cds_is_driver_unloading() || cds_is_driver_recovering()) {
 		CDF_TRACE(CDF_MODULE_ID_CDF, CDF_TRACE_LEVEL_ERROR,
 			  "%s: Unloading or SSR in Progress, Ignore!!!",
 			  __func__);

+ 2 - 2
core/dp/txrx/ol_rx.c

@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011-2015 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2011-2016 The Linux Foundation. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
@@ -98,7 +98,7 @@ void ol_rx_trigger_restore(htt_pdev_handle htt_pdev, cdf_nbuf_t head_msdu,
 	}
 
 	if (!htt_pdev->rx_ring.htt_rx_restore) {
-		cds_set_logp_in_progress(true);
+		cds_set_recovery_in_progress(true);
 		htt_pdev->rx_ring.htt_rx_restore = 1;
 		schedule_work(&ol_rx_restore_work);
 	}

+ 1 - 7
core/hdd/inc/wlan_hdd_cfg.h

@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012-2015 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012-2016 The Linux Foundation. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
@@ -847,11 +847,6 @@ typedef enum {
 #define CFG_QOS_IMPLICIT_SETUP_ENABLED_MAX                  (1)
 #define CFG_QOS_IMPLICIT_SETUP_ENABLED_DEFAULT              (1)
 
-#define CFG_ENABLE_LOGP_NAME                                "gEnableLogp"
-#define CFG_ENABLE_LOGP_MIN                                 (0)
-#define CFG_ENABLE_LOGP_MAX                                 (1)
-#define CFG_ENABLE_LOGP_DEFAULT                             (0)
-
 #if defined WLAN_FEATURE_VOWIFI_11R
 #define CFG_FT_RESOURCE_REQ_NAME                        "gFTResourceReqSupported"
 #define CFG_FT_RESOURCE_REQ_MIN                         (0)
@@ -2880,7 +2875,6 @@ struct hdd_config {
 	bool fSupplicantCountryCodeHasPriority;
 	uint32_t HeartbeatThresh24;
 	char PowerUsageControl[4];
-	bool fIsLogpEnabled;
 	bool fIsImpsEnabled;
 	bool is_ps_enabled;
 	uint32_t nBmpsModListenInterval;

+ 1 - 7
core/hdd/inc/wlan_hdd_main.h

@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012-2015 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012-2016 The Linux Foundation. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
@@ -1138,12 +1138,6 @@ struct hdd_context_s {
 	bool is_ol_rx_thread_suspended;
 #endif
 
-	volatile bool isLogpInProgress;
-
-	bool isLoadInProgress;
-
-	bool isUnloadInProgress;
-
 	/* Track whether Mcast/Bcast Filter is enabled. */
 	bool hdd_mcastbcast_filter_set;
 

+ 2 - 4
core/hdd/src/wlan_hdd_assoc.c

@@ -878,8 +878,7 @@ static void hdd_send_association_event(struct net_device *dev,
 	msg = NULL;
 	/*During the WLAN uninitialization,supplicant is stopped before the
 	   driver so not sending the status of the connection to supplicant */
-	if ((pHddCtx->isLoadInProgress != true) &&
-	    (pHddCtx->isUnloadInProgress != true)) {
+	if (cds_is_load_unload_in_progress()) {
 		wireless_send_event(dev, we_event, &wrqu, msg);
 #ifdef FEATURE_WLAN_ESE
 		if (eConnectionState_Associated ==
@@ -1068,8 +1067,7 @@ static CDF_STATUS hdd_dis_connect_handler(hdd_adapter_t *pAdapter,
 		 * before the driver so not sending the status of the
 		 * connection to supplicant.
 		 */
-		if ((pHddCtx->isLoadInProgress != true) &&
-		    (pHddCtx->isUnloadInProgress != true)) {
+		if (cds_is_load_unload_in_progress()) {
 #ifdef WLAN_FEATURE_P2P_DEBUG
 			if (pAdapter->device_mode == WLAN_HDD_P2P_CLIENT) {
 				if (global_p2p_connection_status ==

+ 1 - 8
core/hdd/src/wlan_hdd_cfg.c

@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012-2015 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012-2016 The Linux Foundation. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
@@ -427,13 +427,6 @@ REG_TABLE_ENTRY g_registry_table[] = {
 			    VAR_FLAGS_OPTIONAL,
 			    (void *)CFG_POWER_USAGE_DEFAULT),
 
-	REG_VARIABLE(CFG_ENABLE_LOGP_NAME, WLAN_PARAM_Integer,
-		     struct hdd_config, fIsLogpEnabled,
-		     VAR_FLAGS_OPTIONAL | VAR_FLAGS_RANGE_CHECK_ASSUME_DEFAULT,
-		     CFG_ENABLE_LOGP_DEFAULT,
-		     CFG_ENABLE_LOGP_MIN,
-		     CFG_ENABLE_LOGP_MAX),
-
 	REG_VARIABLE(CFG_ENABLE_IMPS_NAME, WLAN_PARAM_Integer,
 		     struct hdd_config, fIsImpsEnabled,
 		     VAR_FLAGS_OPTIONAL | VAR_FLAGS_RANGE_CHECK_ASSUME_DEFAULT,

+ 35 - 6
core/hdd/src/wlan_hdd_driver_ops.c

@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2015-2016 The Linux Foundation. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
@@ -73,7 +73,7 @@
 #define WLAN_HDD_UNREGISTER_DRIVER(wlan_drv_ops) \
 	icnss_unregister_driver(wlan_drv_ops)
 #endif /* HIF_PCI */
-#define DISABLE_KRAIT_IDLE_PS_VAL	200
+#define DISABLE_KRAIT_IDLE_PS_VAL	1
 
 /*
  * In BMI Phase we are only sending small chunk (256 bytes) of the FW image at
@@ -213,11 +213,14 @@ static int wlan_hdd_probe(struct device *dev, void *bdev, const hif_bus_id *bid,
 	*/
 	hdd_request_pm_qos(DISABLE_KRAIT_IDLE_PS_VAL);
 
-	if (!reinit) {
+	if (reinit) {
+		cds_set_recovery_in_progress(true);
+	} else {
 		ret = hdd_init();
 
 		if (ret)
 			goto out;
+		cds_set_load_in_progress(true);
 	}
 
 	if (WLAN_IS_EPPING_ENABLED(cds_get_conparam())) {
@@ -242,8 +245,12 @@ static int wlan_hdd_probe(struct device *dev, void *bdev, const hif_bus_id *bid,
 		goto err_hif_close;
 
 
-	if (reinit)
-		cds_set_logp_in_progress(false);
+	if (reinit) {
+		cds_set_recovery_in_progress(false);
+	} else {
+		cds_set_load_in_progress(false);
+		cds_set_driver_loaded(true);
+	}
 
 	hdd_allow_suspend(WIFI_POWER_EVENT_WAKELOCK_DRIVER_INIT);
 	hdd_remove_pm_qos();
@@ -256,6 +263,7 @@ err_epping_close:
 	if (WLAN_IS_EPPING_ENABLED(cds_get_conparam()))
 		epping_close();
 err_hdd_deinit:
+	cds_set_load_in_progress(false);
 	hdd_deinit();
 out:
 	hdd_allow_suspend(WIFI_POWER_EVENT_WAKELOCK_DRIVER_INIT);
@@ -263,6 +271,16 @@ out:
 	return ret;
 }
 
+#ifdef CONFIG_CNSS
+static inline void hdd_cnss_driver_unloading(void)
+{
+	cnss_set_driver_status(CNSS_LOAD_UNLOAD);
+}
+#else
+static inline void hdd_cnss_driver_unloading(void) { }
+#endif
+
+
 /**
  * wlan_hdd_remove() - wlan_hdd_remove
  *
@@ -278,6 +296,17 @@ static void wlan_hdd_remove(void)
 	pr_info("%s: Removing driver v%s\n", WLAN_MODULE_NAME,
 		QWLAN_VERSIONSTR);
 
+	/* Wait for recovery to complete */
+	while (cds_is_driver_recovering()) {
+		hdd_alert("Recovery in progress; wait here!!!");
+		msleep(1000);
+	}
+
+	cds_set_driver_loaded(false);
+	cds_set_unload_in_progress(true);
+
+	hdd_cnss_driver_unloading();
+
 	hif_ctx = cds_get_context(CDF_MODULE_ID_HIF);
 
 	hif_pktlogmod_exit(hif_ctx);
@@ -314,7 +343,7 @@ static void wlan_hdd_shutdown(void)
 		return;
 	}
 	/* this is for cases, where shutdown invoked from CNSS */
-	cds_set_logp_in_progress(true);
+	cds_set_recovery_in_progress(true);
 
 	if (cds_get_conparam() != CDF_GLOBAL_FTM_MODE &&
 	    !WLAN_IS_EPPING_ENABLED(cds_get_conparam()))

+ 4 - 4
core/hdd/src/wlan_hdd_hostapd.c

@@ -222,12 +222,12 @@ static int __hdd_hostapd_open(struct net_device *dev)
 	MTRACE(cdf_trace(CDF_MODULE_ID_HDD,
 			 TRACE_CODE_HDD_HOSTAPD_OPEN_REQUEST, NO_SESSION, 0));
 
-	if (WLAN_HDD_GET_CTX(pAdapter)->isLoadInProgress ||
-		WLAN_HDD_GET_CTX(pAdapter)->isUnloadInProgress) {
-		hddLog(LOGE,
-		       FL("Driver load/unload in progress, ignore adapter open"));
+	if (cds_is_load_unload_in_progress()) {
+		hdd_err("Driver load/unload in progress, ignore, state: 0x%x",
+			cds_get_driver_state());
 		goto done;
 	}
+
 	/* Enable all Tx queues */
 	hddLog(LOG1, FL("Enabling queues"));
 	wlan_hdd_netif_queue_control(pAdapter,

+ 3 - 3
core/hdd/src/wlan_hdd_ioctl.c

@@ -2112,15 +2112,15 @@ static void hdd_get_link_status_cb(uint8_t status, void *context)
 static int wlan_hdd_get_link_status(hdd_adapter_t *adapter)
 {
 
-	hdd_context_t *hdd_ctx = WLAN_HDD_GET_CTX(adapter);
 	hdd_station_ctx_t *pHddStaCtx =
 				WLAN_HDD_GET_STATION_CTX_PTR(adapter);
 	struct statsContext context;
 	CDF_STATUS hstatus;
 	unsigned long rc;
 
-	if (hdd_ctx->isLogpInProgress) {
-		hddLog(LOGW, FL("LOGP in Progress. Ignore!!!"));
+	if (cds_is_driver_recovering()) {
+		hdd_warn("Recovery in Progress. State: 0x%x Ignore!!!",
+			 cds_get_driver_state());
 		return 0;
 	}
 

+ 3 - 3
core/hdd/src/wlan_hdd_ipa.c

@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013-2015 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2013-2016 The Linux Foundation. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
@@ -2454,7 +2454,7 @@ static void hdd_ipa_send_skb_to_network(cdf_nbuf_t skb,
 		return;
 	}
 
-	if (hdd_ipa->hdd_ctx->isUnloadInProgress) {
+	if (cds_is_driver_unloading()) {
 		HDD_IPA_INCREASE_INTERNAL_DROP_COUNT(hdd_ipa);
 		cdf_nbuf_free(skb);
 		return;
@@ -3745,7 +3745,7 @@ int hdd_ipa_wlan_evt(hdd_adapter_t *adapter, uint8_t sta_id,
 		if ((!hdd_ipa->num_iface) &&
 			(HDD_IPA_UC_NUM_WDI_PIPE ==
 				hdd_ipa->activated_fw_pipe)) {
-			if (hdd_ipa->hdd_ctx->isUnloadInProgress) {
+			if (cds_is_driver_unloading()) {
 				/*
 				 * We disable WDI pipes directly here since
 				 * IPA_OPCODE_TX/RX_SUSPEND message will not be

+ 9 - 24
core/hdd/src/wlan_hdd_main.c

@@ -265,7 +265,7 @@ static int __hdd_netdev_notifier_call(struct notifier_block *nb,
 		CDF_ASSERT(0);
 		return NOTIFY_DONE;
 	}
-	if (hdd_ctx->isLogpInProgress)
+	if (cds_is_driver_recovering())
 		return NOTIFY_DONE;
 
 	hddLog(CDF_TRACE_LEVEL_INFO, FL("%s New Net Device State = %lu"),
@@ -417,13 +417,15 @@ int wlan_hdd_validate_context(hdd_context_t *hdd_ctx)
 		return -ENODEV;
 	}
 
-	if (hdd_ctx->isLogpInProgress) {
-		hddLog(LOGE, FL("LOGP in Progress. Ignore!!!"));
+	if (cds_is_driver_recovering()) {
+		hdd_err("Recovery in Progress. State: 0x%x Ignore!!!",
+			 cds_get_driver_state());
 		return -EAGAIN;
 	}
 
-	if ((hdd_ctx->isLoadInProgress) || (hdd_ctx->isUnloadInProgress)) {
-		hddLog(LOGE, FL("Unloading/Loading in Progress. Ignore!!!"));
+	if (cds_is_load_unload_in_progress()) {
+		hdd_err("Unloading/Loading in Progress. Ignore!!!: 0x%x",
+			cds_get_driver_state());
 		return -EAGAIN;
 	}
 	return 0;
@@ -1189,7 +1191,7 @@ void hdd_update_tgt_cfg(void *context, void *param)
 		       FL("ini BandCapability not supported by the target"));
 	}
 
-	if (!cds_is_logp_in_progress()) {
+	if (!cds_is_driver_recovering()) {
 		hdd_ctx->reg.reg_domain = cfg->reg_domain;
 		hdd_ctx->reg.eeprom_rd_ext = cfg->eeprom_rd_ext;
 	}
@@ -3627,17 +3629,6 @@ void __hdd_wlan_exit(void)
 		return;
 	}
 
-	/* module exit should never proceed if SSR is not completed */
-	while (hdd_ctx->isLogpInProgress) {
-		hddLog(CDF_TRACE_LEVEL_FATAL,
-		       FL("SSR in Progress; block rmmod for 1 second!!!"));
-		msleep(1000);
-	}
-
-	hdd_ctx->isUnloadInProgress = true;
-
-	cds_set_load_unload_in_progress(true);
-
 	/* Check IPA HW Pipe shutdown */
 	hdd_ipa_uc_force_pipe_shutdown(hdd_ctx);
 
@@ -4786,12 +4777,9 @@ int hdd_wlan_startup(struct device *dev, void *hif_sc)
 	cdf_mem_zero(hdd_ctx, sizeof(hdd_context_t));
 
 	hdd_ctx->wiphy = wiphy;
-	hdd_ctx->isLoadInProgress = true;
 	hdd_ctx->ioctl_scan_mode = eSIR_ACTIVE_SCAN;
 	cds_set_wakelock_logging(false);
 
-	cds_set_load_unload_in_progress(true);
-
 	/* Get cds context here bcoz cds_open requires it */
 	p_cds_context = cds_get_global_context();
 
@@ -4949,8 +4937,7 @@ int hdd_wlan_startup(struct device *dev, void *hif_sc)
 		goto success;
 	}
 
-	hdd_ctx->isLogpInProgress = false;
-	cds_set_logp_in_progress(false);
+	cds_set_recovery_in_progress(false);
 
 	cds_set_connection_in_progress(false);
 
@@ -5538,8 +5525,6 @@ err_free_hdd_context:
 	return -EIO;
 
 success:
-	hdd_ctx->isLoadInProgress = false;
-	cds_set_load_unload_in_progress(false);
 	EXIT();
 	return 0;
 }

+ 3 - 3
core/hdd/src/wlan_hdd_p2p.c

@@ -1166,9 +1166,9 @@ int __wlan_hdd_cfg80211_cancel_remain_on_channel(struct wiphy *wiphy,
 		       "%s: timeout waiting for remain on channel ready indication",
 		       __func__);
 
-		if (pHddCtx->isLogpInProgress) {
-			CDF_TRACE(CDF_MODULE_ID_HDD, CDF_TRACE_LEVEL_ERROR,
-				  "%s: LOGP in Progress. Ignore!!!", __func__);
+		if (cds_is_driver_recovering()) {
+			hdd_err("Recovery in Progress. State: 0x%x Ignore!!!",
+				 cds_get_driver_state());
 			return -EAGAIN;
 		}
 	}

+ 8 - 10
core/hdd/src/wlan_hdd_power.c

@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012-2015 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012-2016 The Linux Foundation. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
@@ -1115,9 +1115,9 @@ hdd_suspend_wlan(void (*callback)(void *callbackContext, bool suspended),
 		return;
 	}
 
-	if (pHddCtx->isLogpInProgress) {
-		hddLog(CDF_TRACE_LEVEL_ERROR,
-		       "%s: Ignore suspend wlan, LOGP in progress!", __func__);
+	if (cds_is_driver_recovering()) {
+		hdd_err("Recovery in Progress. State: 0x%x Ignore suspend!!!",
+			 cds_get_driver_state());
 		return;
 	}
 
@@ -1171,9 +1171,9 @@ static void hdd_resume_wlan(void)
 		return;
 	}
 
-	if (pHddCtx->isLogpInProgress) {
-		hddLog(CDF_TRACE_LEVEL_INFO,
-		       "%s: Ignore resume wlan, LOGP in progress!", __func__);
+	if (cds_is_driver_recovering()) {
+		hdd_warn("Recovery in Progress. State: 0x%x Ignore resume!!!",
+			 cds_get_driver_state());
 		return;
 	}
 
@@ -1305,8 +1305,7 @@ CDF_STATUS hdd_wlan_shutdown(void)
 		return CDF_STATUS_E_FAILURE;
 	}
 
-	pHddCtx->isLogpInProgress = true;
-	cds_set_logp_in_progress(true);
+	cds_set_recovery_in_progress(true);
 
 	cds_clear_concurrent_session_count();
 
@@ -1656,7 +1655,6 @@ err_re_init:
 	return -EPERM;
 
 success:
-	pHddCtx->isLogpInProgress = false;
 	return CDF_STATUS_SUCCESS;
 }
 

+ 8 - 6
core/hdd/src/wlan_hdd_scan.c

@@ -2314,8 +2314,8 @@ static int __wlan_hdd_cfg80211_sched_scan_stop(struct wiphy *wiphy,
 		return -ENODEV;
 	}
 
-	/* The return 0 is intentional when isLogpInProgress and
-	 * isLoadUnloadInProgress. We did observe a crash due to a return of
+	/* The return 0 is intentional when Recovery and Load/Unload in
+	 * progress. We did observe a crash due to a return of
 	 * failure in sched_scan_stop , especially for a case where the unload
 	 * of the happens at the same time. The function __cfg80211_stop_sched_scan
 	 * was clearing rdev->sched_scan_req only when the sched_scan_stop returns
@@ -2323,13 +2323,15 @@ static int __wlan_hdd_cfg80211_sched_scan_stop(struct wiphy *wiphy,
 	 * clean up of the second interface will have the dev pointer corresponding
 	 * to the first one leading to a crash.
 	 */
-	if (pHddCtx->isLogpInProgress) {
-		hddLog(LOGE, FL("LOGP in Progress. Ignore!!!"));
+	if (cds_is_driver_recovering()) {
+		hdd_err("Recovery in Progress. State: 0x%x Ignore!!!",
+			 cds_get_driver_state());
 		return ret;
 	}
 
-	if ((pHddCtx->isLoadInProgress) || (pHddCtx->isUnloadInProgress)) {
-		hddLog(LOGE, FL("Unloading/Loading in Progress. Ignore!!!"));
+	if (cds_is_load_unload_in_progress()) {
+		hdd_err("Unload/Load in Progress, state: 0x%x.  Ignore!!!",
+			cds_get_driver_state());
 		return ret;
 	}
 

+ 7 - 8
core/hdd/src/wlan_hdd_softap_tx_rx.c

@@ -168,7 +168,6 @@ int hdd_softap_hard_start_xmit(struct sk_buff *skb, struct net_device *dev)
 	sme_ac_enum_type ac = SME_AC_BE;
 	hdd_adapter_t *pAdapter = (hdd_adapter_t *) netdev_priv(dev);
 	hdd_ap_ctx_t *pHddApCtx = WLAN_HDD_GET_AP_CTX_PTR(pAdapter);
-	hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pAdapter);
 	struct cdf_mac_addr *pDestMacAddress;
 	uint8_t STAId;
 	uint8_t proto_type = 0;
@@ -181,9 +180,9 @@ int hdd_softap_hard_start_xmit(struct sk_buff *skb, struct net_device *dev)
 	 * context may not be reinitialized at this time which may
 	 * lead to a crash.
 	 */
-	if (pHddCtx->isLogpInProgress) {
+	if (cds_is_driver_recovering()) {
 		CDF_TRACE(CDF_MODULE_ID_HDD_SAP_DATA, CDF_TRACE_LEVEL_INFO_HIGH,
-			  "%s: LOGP in Progress. Ignore!!!", __func__);
+			  "%s: Recovery in Progress. Ignore!!!", __func__);
 		goto drop_pkt;
 	}
 
@@ -368,9 +367,9 @@ static void __hdd_softap_tx_timeout(struct net_device *dev)
 	 * recovery here
 	 */
 	hdd_ctx = WLAN_HDD_GET_CTX(adapter);
-	if (hdd_ctx->isLogpInProgress) {
+	if (cds_is_driver_recovering()) {
 		CDF_TRACE(CDF_MODULE_ID_HDD_SAP_DATA, CDF_TRACE_LEVEL_ERROR,
-			 "%s: LOGP in Progress. Ignore!!!", __func__);
+			 "%s: Recovery in Progress. Ignore!!!", __func__);
 		return;
 	}
 }
@@ -810,10 +809,10 @@ CDF_STATUS hdd_softap_stop_bss(hdd_adapter_t *pAdapter)
 	/* bss deregister is not allowed during wlan driver loading or
 	 * unloading
 	 */
-	if ((pHddCtx->isLoadInProgress) || (pHddCtx->isUnloadInProgress)) {
+	if (cds_is_load_unload_in_progress()) {
 		CDF_TRACE(CDF_MODULE_ID_HDD_SAP_DATA, CDF_TRACE_LEVEL_ERROR,
-			  "%s:Loading_unloading in Progress. Ignore!!!",
-			  __func__);
+			  "%s: Loading_unloading in Progress, state: 0x%x. Ignore!!!",
+			  __func__, cds_get_driver_state());
 		return CDF_STATUS_E_PERM;
 	}
 

+ 2 - 2
core/hdd/src/wlan_hdd_stats.c

@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012-2015 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012-2016 The Linux Foundation. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
@@ -1753,7 +1753,7 @@ static int __wlan_hdd_cfg80211_get_station(struct wiphy *wiphy,
 #ifdef WLAN_FEATURE_LPSS
 	if (!pAdapter->rssi_send) {
 		pAdapter->rssi_send = true;
-		if (pHddCtx->isUnloadInProgress != true)
+		if (cds_is_driver_unloading())
 			wlan_hdd_send_status_pkg(pAdapter, pHddStaCtx, 1, 1);
 	}
 #endif

+ 8 - 9
core/hdd/src/wlan_hdd_tdls.c

@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012-2015 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012-2016 The Linux Foundation. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
@@ -771,7 +771,7 @@ void wlan_hdd_tdls_exit(hdd_adapter_t *pAdapter)
 
 	/* No need to post message during driver unlaod because MC thread is
 	   already shutdown */
-	if (!pHddCtx->isUnloadInProgress) {
+	if (!cds_is_driver_unloading()) {
 		tInfo = cdf_mem_malloc(sizeof(tdlsInfo_t));
 		if (NULL != tInfo) {
 			tInfo->vdev_id = pAdapter->sessionId;
@@ -3871,16 +3871,15 @@ static int __wlan_hdd_cfg80211_tdls_mgmt(struct wiphy *wiphy,
 			  "%s: Mgmt Tx Completion timed out TxCompletion %u",
 			  __func__, pAdapter->mgmtTxCompletionStatus);
 
-		if (pHddCtx->isLogpInProgress) {
-			CDF_TRACE(CDF_MODULE_ID_HDD, CDF_TRACE_LEVEL_ERROR,
-				  "%s: LOGP in Progress. Ignore!!!", __func__);
+		if (cds_is_driver_recovering()) {
+			hdd_err("Recovery in Progress. State: 0x%x Ignore!!!",
+				cds_get_driver_state());
 			return -EAGAIN;
 		}
 
-		if (pHddCtx->isUnloadInProgress) {
-			CDF_TRACE(CDF_MODULE_ID_HDD, CDF_TRACE_LEVEL_ERROR,
-				  "%s: Unloading/Loading in Progress. Ignore!!!",
-				  __func__);
+		if (cds_is_driver_unloading()) {
+			hdd_err("Unload in progress. State: 0x%x Ignore!!!",
+				cds_get_driver_state());
 			return -EAGAIN;
 		}
 

+ 2 - 2
core/hdd/src/wlan_hdd_tx_rx.c

@@ -312,9 +312,9 @@ int hdd_hard_start_xmit(struct sk_buff *skb, struct net_device *dev)
 #endif
 
 	++pAdapter->hdd_stats.hddTxRxStats.txXmitCalled;
-	if (cds_is_logp_in_progress()) {
+	if (cds_is_driver_recovering()) {
 		CDF_TRACE(CDF_MODULE_ID_HDD_DATA, CDF_TRACE_LEVEL_WARN,
-			"LOPG in progress, dropping the packet");
+			"Recovery in progress, dropping the packet");
 		++pAdapter->stats.tx_dropped;
 		++pAdapter->hdd_stats.hddTxRxStats.txXmitDropped;
 		kfree_skb(skb);

+ 9 - 9
core/hdd/src/wlan_hdd_wext.c

@@ -1109,9 +1109,9 @@ CDF_STATUS wlan_hdd_get_rssi(hdd_adapter_t *pAdapter, int8_t *rssi_value)
 		       "%s: Invalid context, pAdapter", __func__);
 		return CDF_STATUS_E_FAULT;
 	}
-	if ((WLAN_HDD_GET_CTX(pAdapter))->isLogpInProgress) {
-		CDF_TRACE(CDF_MODULE_ID_HDD, CDF_TRACE_LEVEL_ERROR,
-			  "%s:LOGP in Progress. Ignore!!!", __func__);
+	if (cds_is_driver_recovering()) {
+		hdd_err("Recovery in Progress. State: 0x%x Ignore!!!",
+			cds_get_driver_state());
 		/* return a cached value */
 		*rssi_value = pAdapter->rssi;
 		return CDF_STATUS_SUCCESS;
@@ -2248,9 +2248,9 @@ static int __iw_get_bitrate(struct net_device *dev,
 	if (0 != ret)
 		return ret;
 
-	if ((WLAN_HDD_GET_CTX(pAdapter))->isLogpInProgress) {
-		CDF_TRACE(CDF_MODULE_ID_HDD, CDF_TRACE_LEVEL_FATAL,
-			  "%s:LOGP in Progress. Ignore!!!", __func__);
+	if (cds_is_driver_recovering()) {
+		hdd_alert("Recovery in Progress. State: 0x%x Ignore!!!",
+			  cds_get_driver_state());
 		return status;
 	}
 
@@ -3352,9 +3352,9 @@ CDF_STATUS wlan_hdd_get_class_astats(hdd_adapter_t *pAdapter)
 		hddLog(CDF_TRACE_LEVEL_ERROR, "%s: pAdapter is NULL", __func__);
 		return CDF_STATUS_E_FAULT;
 	}
-	if ((WLAN_HDD_GET_CTX(pAdapter))->isLogpInProgress) {
-		CDF_TRACE(CDF_MODULE_ID_HDD, CDF_TRACE_LEVEL_ERROR,
-			  "%s:LOGP in Progress. Ignore!!!", __func__);
+	if (cds_is_driver_recovering()) {
+		hdd_err("Recovery in Progress. State: 0x%x Ignore!!!",
+			 cds_get_driver_state());
 		return CDF_STATUS_SUCCESS;
 	}
 

+ 2 - 2
core/hif/src/ce/ce_main.c

@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013-2015 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2013-2016 The Linux Foundation. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
@@ -1494,7 +1494,7 @@ static void hif_sleep_entry(void *arg)
 	if (scn->recovery)
 		return;
 
-	if (cds_is_unload_in_progress())
+	if (cds_is_driver_unloading())
 		return;
 
 	cdf_spin_lock_irqsave(&hif_state->keep_awake_lock);

+ 2 - 2
core/hif/src/pcie/if_pci.c

@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013-2015 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2013-2016 The Linux Foundation. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
@@ -1824,7 +1824,7 @@ hif_target_sleep_state_adjust(struct ol_softc *scn,
 					if (!sc->ol_sc->enable_self_recovery)
 						CDF_BUG(0);
 					scn->recovery = true;
-					cds_set_logp_in_progress(true);
+					cds_set_recovery_in_progress(true);
 					cnss_wlan_pci_link_down();
 					return -EACCES;
 				}

+ 2 - 2
core/mac/src/pe/lim/lim_utils.c

@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011-2015 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2011-2016 The Linux Foundation. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
@@ -734,7 +734,7 @@ void lim_cleanup_mlm(tpAniSirGlobal mac_ctx)
 	 * each STA associated per BSSId and deactivate/delete
 	 * the pmfSaQueryTimer for it
 	 */
-	if (cds_is_logp_in_progress()) {
+	if (cds_is_driver_recovering()) {
 		CDF_TRACE(CDF_MODULE_ID_PE, CDF_TRACE_LEVEL_ERROR,
 				FL("SSR is detected, proceed to clean up pmfSaQueryTimer"));
 		for (bss_entry = 0; bss_entry < mac_ctx->lim.maxBssId;

+ 5 - 5
core/wma/src/wma_features.c

@@ -3573,7 +3573,7 @@ CDF_STATUS wma_enable_wow_in_fw(WMA_HANDLE handle)
 		WMA_LOGE("Credits:%d; Pending_Cmds: %d",
 			 wmi_get_host_credits(wma->wmi_handle),
 			 wmi_get_pending_cmds(wma->wmi_handle));
-		if (!cds_is_logp_in_progress()) {
+		if (!cds_is_driver_recovering()) {
 #ifdef CONFIG_CNSS
 			if (pMac->sme.enableSelfRecovery) {
 				cds_trigger_recovery();
@@ -3605,7 +3605,7 @@ CDF_STATUS wma_enable_wow_in_fw(WMA_HANDLE handle)
 			 "cannot resume back", __func__, host_credits,
 			 wmi_pending_cmds);
 		htc_dump_counter_info(wma->htc_handle);
-		if (!cds_is_logp_in_progress())
+		if (!cds_is_driver_recovering())
 			CDF_BUG(0);
 		else
 			WMA_LOGE("%s: SSR in progress, ignore no credit issue",
@@ -4131,7 +4131,7 @@ static CDF_STATUS wma_send_host_wakeup_ind_to_fw(tp_wma_handle wma)
 		WMA_LOGP("%s: Pending commands %d credits %d", __func__,
 			 wmi_get_pending_cmds(wma->wmi_handle),
 			 wmi_get_host_credits(wma->wmi_handle));
-		if (!cds_is_logp_in_progress()) {
+		if (!cds_is_driver_recovering()) {
 #ifdef CONFIG_CNSS
 			if (pMac->sme.enableSelfRecovery) {
 				cds_trigger_recovery();
@@ -6285,7 +6285,7 @@ int wma_suspend_target(WMA_HANDLE handle, int disable_target_intr)
 		WMA_LOGE("Failed to get ACK from firmware for pdev suspend");
 		wmi_set_target_suspend(wma_handle->wmi_handle, false);
 #ifdef CONFIG_CNSS
-		if (!cds_is_logp_in_progress()) {
+		if (!cds_is_driver_recovering()) {
 			if (pmac->sme.enableSelfRecovery) {
 				cds_trigger_recovery();
 			} else {
@@ -6382,7 +6382,7 @@ int wma_resume_target(WMA_HANDLE handle)
 		WMA_LOGP("%s: Pending commands %d credits %d", __func__,
 			wmi_get_pending_cmds(wma->wmi_handle),
 			wmi_get_host_credits(wma->wmi_handle));
-		if (!cds_is_logp_in_progress()) {
+		if (!cds_is_driver_recovering()) {
 #ifdef CONFIG_CNSS
 			if (pMac->sme.enableSelfRecovery) {
 				cds_trigger_recovery();

+ 1 - 1
core/wma/src/wma_main.c

@@ -2802,7 +2802,7 @@ CDF_STATUS wma_stop(void *cds_ctx, uint8_t reason)
 	}
 
 	/* There's no need suspend target which is already down during SSR. */
-	if (!cds_is_logp_in_progress()) {
+	if (!cds_is_driver_recovering()) {
 #ifdef HIF_USB
 		/* Suspend the target and enable interrupt */
 		if (wma_suspend_target(wma_handle, 0))