Browse Source

qcacld-3.0: Stop MC thread on module close

Currently, the MC thread is started once, on the transition from the
uninitialized to the open driver state, and is stopped only during
unload or recovery. Instead, start the MC thread on the transition from
closed to open and stop the MC thread of the transition from open to
closed driver states.

Change-Id: I2b45f95afb99b79f2515275776fe11c9e97bc150
CRs-Fixed: 2113596
Dustin Brown 7 years ago
parent
commit
0707ddfedb
3 changed files with 22 additions and 46 deletions
  1. 12 19
      core/cds/src/cds_api.c
  2. 10 20
      core/hdd/src/wlan_hdd_main.c
  3. 0 7
      core/hdd/src/wlan_hdd_power.c

+ 12 - 19
core/cds/src/cds_api.c

@@ -490,19 +490,15 @@ QDF_STATUS cds_open(struct wlan_objmgr_psoc *psoc)
 	}
 
 	/* Now Open the CDS Scheduler */
-	if (hdd_ctx->driver_status == DRIVER_MODULES_UNINITIALIZED ||
-	    cds_is_driver_recovering()) {
-		status = cds_sched_open(gp_cds_context,
-					&gp_cds_context->qdf_sched,
-					sizeof(cds_sched_context));
-
-		if (QDF_IS_STATUS_ERROR(status)) {
-			/* Critical Error ...  Cannot proceed further */
-			QDF_TRACE(QDF_MODULE_ID_QDF, QDF_TRACE_LEVEL_FATAL,
-				  "%s: Failed to open CDS Scheduler", __func__);
-			QDF_ASSERT(0);
-			goto err_wma_complete_event;
-		}
+	status = cds_sched_open(gp_cds_context,
+				&gp_cds_context->qdf_sched,
+				sizeof(cds_sched_context));
+
+	if (QDF_IS_STATUS_ERROR(status)) {
+		/* Critical Error ...  Cannot proceed further */
+		cds_alert("Failed to open CDS Scheduler");
+		QDF_ASSERT(0);
+		goto err_wma_complete_event;
 	}
 
 	scn = cds_get_context(QDF_MODULE_ID_HIF);
@@ -681,12 +677,9 @@ err_bmi_close:
 	bmi_cleanup(ol_ctx);
 
 err_sched_close:
-	if (hdd_ctx->driver_status == DRIVER_MODULES_UNINITIALIZED ||
-	    cds_is_driver_recovering()) {
-		if (QDF_IS_STATUS_ERROR(cds_sched_close())) {
-			cds_err("Failed to close CDS Scheduler");
-			QDF_ASSERT(false);
-		}
+	if (QDF_IS_STATUS_ERROR(cds_sched_close())) {
+		cds_err("Failed to close CDS Scheduler");
+		QDF_ASSERT(false);
 	}
 
 err_wma_complete_event:

+ 10 - 20
core/hdd/src/wlan_hdd_main.c

@@ -5972,7 +5972,6 @@ static void wlan_destroy_bug_report_lock(void)
  */
 static void hdd_wlan_exit(struct hdd_context *hdd_ctx)
 {
-	QDF_STATUS qdf_status;
 	struct wiphy *wiphy = hdd_ctx->wiphy;
 	int driver_status;
 
@@ -6047,17 +6046,6 @@ static void hdd_wlan_exit(struct hdd_context *hdd_ctx)
 		hdd_deinit_all_adapters(hdd_ctx, false);
 	}
 
-	/*
-	 * Close the scheduler before calling cds_close to make sure
-	 * no thread is scheduled after the each module close is
-	 * is called i.e after all the data structures are freed.
-	 */
-	qdf_status = cds_sched_close();
-	if (!QDF_IS_STATUS_SUCCESS(qdf_status)) {
-		hdd_alert("Failed to close CDS Scheduler");
-		QDF_ASSERT(QDF_IS_STATUS_SUCCESS(qdf_status));
-	}
-
 	unregister_netdevice_notifier(&hdd_netdev_notifier);
 
 	hdd_wlan_stop_modules(hdd_ctx, false);
@@ -9647,6 +9635,16 @@ int hdd_wlan_stop_modules(struct hdd_context *hdd_ctx, bool ftm_mode)
 		QDF_ASSERT(0);
 	}
 
+	/*
+	 * Close the scheduler before calling cds_close to make sure
+	 * no thread is scheduled after the each module close is
+	 * is called i.e after all the data structures are freed.
+	 */
+	qdf_status = cds_sched_close();
+	QDF_ASSERT(QDF_IS_STATUS_SUCCESS(qdf_status));
+	if (QDF_IS_STATUS_ERROR(qdf_status))
+		hdd_alert("Failed to close CDS Scheduler");
+
 	qdf_status = cds_close(hdd_ctx->hdd_psoc);
 	if (!QDF_IS_STATUS_SUCCESS(qdf_status)) {
 		hdd_warn("Failed to stop CDS: %d", qdf_status);
@@ -9982,14 +9980,6 @@ err_stop_modules:
 	hdd_objmgr_release_and_destroy_pdev(hdd_ctx);
 
 err_hdd_free_psoc:
-	if (DRIVER_MODULES_CLOSED == hdd_ctx->driver_status) {
-		status = cds_sched_close();
-		if (!QDF_IS_STATUS_SUCCESS(status)) {
-			hdd_err("Failed to close CDS Scheduler");
-			QDF_ASSERT(QDF_IS_STATUS_SUCCESS(status));
-		}
-	}
-
 	hdd_green_ap_deinit(hdd_ctx);
 	hdd_request_manager_deinit();
 	hdd_exit_netlink_services(hdd_ctx);

+ 0 - 7
core/hdd/src/wlan_hdd_power.c

@@ -1257,7 +1257,6 @@ QDF_STATUS hdd_wlan_shutdown(void)
 {
 	struct hdd_context *hdd_ctx;
 	p_cds_sched_context cds_sched_context = NULL;
-	QDF_STATUS qdf_status;
 	void *soc = cds_get_context(QDF_MODULE_ID_SOC);
 
 	hdd_info("WLAN driver shutting down!");
@@ -1297,12 +1296,6 @@ QDF_STATUS hdd_wlan_shutdown(void)
 	}
 #endif
 
-	qdf_status = cds_sched_close();
-	if (!QDF_IS_STATUS_SUCCESS(qdf_status)) {
-		hdd_err("Failed to close CDS Scheduler");
-		QDF_ASSERT(false);
-	}
-
 	hdd_ipa_uc_ssr_deinit();
 
 	hdd_bus_bandwidth_destroy(hdd_ctx);