Переглянути джерело

qcacld-3.0: Handle module stop properly for FTM mode

In FTM mode con mode change handler does module stop
after holding SSR protect and module stop bails
out assuming its idle mode module stop. Make sure to
do module stop properly for FTM mode even if SSR
protect lock is taken by con mode change handler.

Change-Id: I5d2d7006bb9f4897a5dd22893cdf6a7a864de97b
CRs-Fixed: 2027020
Rajeev Kumar 8 роки тому
батько
коміт
3fef4e875d

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

@@ -2147,7 +2147,7 @@ int hdd_start_ftm_adapter(hdd_adapter_t *adapter);
 int hdd_set_fw_params(hdd_adapter_t *adapter);
 int hdd_wlan_start_modules(hdd_context_t *hdd_ctx, hdd_adapter_t *adapter,
 			   bool reinit);
-int hdd_wlan_stop_modules(hdd_context_t *hdd_ctx);
+int hdd_wlan_stop_modules(hdd_context_t *hdd_ctx, bool ftm_mode);
 int hdd_start_adapter(hdd_adapter_t *adapter);
 
 /**

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

@@ -5367,7 +5367,7 @@ static void hdd_wlan_exit(hdd_context_t *hdd_ctx)
 		QDF_ASSERT(QDF_IS_STATUS_SUCCESS(qdf_status));
 	}
 
-	hdd_wlan_stop_modules(hdd_ctx);
+	hdd_wlan_stop_modules(hdd_ctx, false);
 
 	qdf_spinlock_destroy(&hdd_ctx->hdd_adapter_lock);
 	qdf_spinlock_destroy(&hdd_ctx->sta_update_info_lock);
@@ -8740,6 +8740,7 @@ static void hdd_deregister_policy_manager_callback(
 /**
  * hdd_wlan_stop_modules - Single driver state machine for stoping modules
  * @hdd_ctx: HDD context
+ * @ftm_mode: ftm mode
  *
  * This function maintains the driver state machine it will be invoked from
  * exit, shutdown and con_mode change handler. Depending on the driver state
@@ -8747,7 +8748,7 @@ static void hdd_deregister_policy_manager_callback(
  *
  * Return: 0 for success; non-zero for failure
  */
-int hdd_wlan_stop_modules(hdd_context_t *hdd_ctx)
+int hdd_wlan_stop_modules(hdd_context_t *hdd_ctx, bool ftm_mode)
 {
 	void *hif_ctx;
 	qdf_device_t qdf_ctx;
@@ -8783,10 +8784,11 @@ int hdd_wlan_stop_modules(hdd_context_t *hdd_ctx)
 
 		cds_print_external_threads();
 
-		if (is_idle_stop) {
+		if (is_idle_stop && !ftm_mode) {
 			mutex_unlock(&hdd_ctx->iface_change_lock);
 			qdf_mc_timer_start(&hdd_ctx->iface_change_timer,
-				       hdd_ctx->config->iface_change_wait_time);
+				hdd_ctx->config->iface_change_wait_time);
+			hdd_ctx->stop_modules_in_progress = false;
 			return 0;
 		}
 	}
@@ -8882,7 +8884,7 @@ static void hdd_iface_change_callback(void *priv)
 
 	ENTER();
 	hdd_info("Interface change timer expired close the modules!");
-	ret = hdd_wlan_stop_modules(hdd_ctx);
+	ret = hdd_wlan_stop_modules(hdd_ctx, false);
 	if (ret)
 		hdd_alert("Failed to stop modules");
 	EXIT();
@@ -9119,7 +9121,7 @@ err_wiphy_unregister:
 	wiphy_unregister(hdd_ctx->wiphy);
 
 err_stop_modules:
-	hdd_wlan_stop_modules(hdd_ctx);
+	hdd_wlan_stop_modules(hdd_ctx, false);
 
 err_exit_nl_srv:
 	status = cds_sched_close(hdd_ctx->pcds_context);
@@ -10602,7 +10604,7 @@ static int __con_mode_handler(const char *kmessage, struct kernel_param *kp,
 	/* Cleanup present mode before switching to new mode */
 	hdd_cleanup_present_mode(hdd_ctx, curr_mode);
 
-	ret = hdd_wlan_stop_modules(hdd_ctx);
+	ret = hdd_wlan_stop_modules(hdd_ctx, true);
 	if (ret) {
 		hdd_err("Stop wlan modules failed");
 		goto reset_flags;

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

@@ -1310,7 +1310,7 @@ QDF_STATUS hdd_wlan_shutdown(void)
 
 	hdd_bus_bandwidth_destroy(pHddCtx);
 
-	hdd_wlan_stop_modules(pHddCtx);
+	hdd_wlan_stop_modules(pHddCtx, false);
 
 	hdd_lpass_notify_stop(pHddCtx);
 
@@ -1430,7 +1430,7 @@ QDF_STATUS hdd_wlan_re_init(void)
 	goto success;
 
 err_cds_disable:
-	hdd_wlan_stop_modules(pHddCtx);
+	hdd_wlan_stop_modules(pHddCtx, false);
 
 err_wiphy_unregister:
 	if (pHddCtx) {