Browse Source

qcacld-3.0: Utilise new APIs for waiting on events

With current implementation in case of an SSR/PDR threads that are
waiting on events will only get purged after the wait timeout has
occurred, increasing the recovery time for the driver. Utilize new
APIs that maintain a list of events. In case of an SSR/PDR
forcefully set these events.

Change-Id: I83b4f576a65f8da5762288ac8dfccdef7d05d82a
CRs-Fixed: 2045156
Nachiket Kukade 7 years ago
parent
commit
0396b736a8

+ 3 - 3
components/pmo/core/src/wlan_pmo_suspend_resume.c

@@ -620,7 +620,7 @@ QDF_STATUS pmo_core_enable_wow_in_fw(struct wlan_objmgr_psoc *psoc,
 
 	pmo_tgt_update_target_suspend_flag(psoc, true);
 
-	if (qdf_wait_single_event(&psoc_ctx->wow.target_suspend,
+	if (qdf_wait_for_event_completion(&psoc_ctx->wow.target_suspend,
 				  PMO_TGT_SUSPEND_COMPLETE_TIMEOUT)
 	    != QDF_STATUS_SUCCESS) {
 		pmo_err("Failed to receive WoW Enable Ack from FW");
@@ -678,7 +678,7 @@ QDF_STATUS pmo_core_psoc_suspend_target(struct wlan_objmgr_psoc *psoc,
 
 	pmo_tgt_update_target_suspend_flag(psoc, true);
 
-	if (qdf_wait_single_event(&psoc_ctx->wow.target_suspend,
+	if (qdf_wait_for_event_completion(&psoc_ctx->wow.target_suspend,
 				  PMO_TGT_SUSPEND_COMPLETE_TIMEOUT)
 	    != QDF_STATUS_SUCCESS) {
 		status = QDF_STATUS_E_TIMEOUT;
@@ -935,7 +935,7 @@ QDF_STATUS pmo_core_psoc_send_host_wakeup_ind_to_fw(
 	}
 	pmo_debug("Host wakeup indication sent to fw");
 
-	status = qdf_wait_single_event(&psoc_ctx->wow.target_resume,
+	status = qdf_wait_for_event_completion(&psoc_ctx->wow.target_resume,
 					PMO_RESUME_TIMEOUT);
 	if (status != QDF_STATUS_SUCCESS) {
 		pmo_err("Timeout waiting for resume event from FW");

+ 9 - 5
core/cds/src/cds_api.c

@@ -171,6 +171,7 @@ QDF_STATUS cds_init(void)
 	qdf_lock_stats_init();
 	qdf_mem_init();
 	qdf_mc_timer_manager_init();
+	qdf_event_list_init();
 	qdf_cpuhp_init();
 	qdf_register_self_recovery_callback(cds_trigger_recovery);
 
@@ -223,6 +224,7 @@ void cds_deinit(void)
 	qdf_mem_exit();
 	qdf_lock_stats_deinit();
 	qdf_debugfs_exit();
+	qdf_event_list_destroy();
 
 	gp_cds_context->qdf_ctx = NULL;
 	gp_cds_context = NULL;
@@ -796,8 +798,9 @@ QDF_STATUS cds_pre_enable(void)
 	}
 
 	/* Need to update time out of complete */
-	qdf_status = qdf_wait_single_event(&gp_cds_context->wmaCompleteEvent,
-					   CDS_WMA_TIMEOUT);
+	qdf_status = qdf_wait_for_event_completion(
+					&gp_cds_context->wmaCompleteEvent,
+					CDS_WMA_TIMEOUT);
 	if (qdf_status != QDF_STATUS_SUCCESS) {
 		if (qdf_status == QDF_STATUS_E_TIMEOUT) {
 			QDF_TRACE(QDF_MODULE_ID_QDF, QDF_TRACE_LEVEL_ERROR,
@@ -962,8 +965,9 @@ err_wma_stop:
 		wma_setneedshutdown();
 	} else {
 		qdf_status =
-			qdf_wait_single_event(&(gp_cds_context->wmaCompleteEvent),
-					      CDS_WMA_TIMEOUT);
+			qdf_wait_for_event_completion(
+					&gp_cds_context->wmaCompleteEvent,
+					CDS_WMA_TIMEOUT);
 		if (qdf_status != QDF_STATUS_SUCCESS) {
 			if (qdf_status == QDF_STATUS_E_TIMEOUT) {
 				QDF_TRACE(QDF_MODULE_ID_QDF,
@@ -1810,7 +1814,7 @@ static QDF_STATUS cds_force_assert_target_via_wmi(qdf_device_t qdf)
 		return status;
 	}
 
-	status = qdf_wait_single_event(&wma->recovery_event,
+	status = qdf_wait_for_event_completion(&wma->recovery_event,
 				       WMA_CRASH_INJECT_TIMEOUT);
 	if (QDF_IS_STATUS_ERROR(status)) {
 		cds_err("Failed target force assert wait; status %d", status);

+ 1 - 1
core/dp/txrx/ol_txrx.c

@@ -2595,7 +2595,7 @@ ol_txrx_peer_attach(struct cdp_vdev *pvdev, uint8_t *peer_mac_addr)
 			sizeof(union ol_txrx_align_mac_addr_t));
 	if (wait_on_deletion) {
 		/* wait for peer deletion */
-		rc = qdf_wait_single_event(&vdev->wait_delete_comp,
+		rc = qdf_wait_for_event_completion(&vdev->wait_delete_comp,
 					   PEER_DELETION_TIMEOUT);
 		if (QDF_STATUS_SUCCESS != rc) {
 			ol_txrx_err("error waiting for peer_id(%d) deletion, status %d\n",

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

@@ -15653,7 +15653,7 @@ static bool wlan_hdd_handle_sap_sta_dfs_conc(struct hdd_adapter *adapter,
 	 * machine from disconnected to started and set this event.
 	 * wait for 10 secs to finish this.
 	 */
-	status = qdf_wait_single_event(&hostapd_state->qdf_event, 10000);
+	status = qdf_wait_for_event_completion(&hostapd_state->qdf_event, 10000);
 	if (!QDF_IS_STATUS_SUCCESS(status)) {
 		hdd_err("wait for qdf_event failed, STA not allowed!!");
 		return false;
@@ -18515,7 +18515,7 @@ int __wlan_hdd_cfg80211_del_station(struct wiphy *wiphy,
 						adapter->sta_info[i].
 						is_deauth_in_progress = true;
 						qdf_status =
-							qdf_wait_single_event(
+							qdf_wait_for_event_completion(
 							 &hapd_state->
 							 qdf_sta_disassoc_event,
 							 SME_CMD_TIMEOUT_VALUE);
@@ -18580,7 +18580,7 @@ int __wlan_hdd_cfg80211_del_station(struct wiphy *wiphy,
 				       MAC_ADDR_ARRAY(mac));
 				return -ENOENT;
 			}
-			qdf_status = qdf_wait_single_event(
+			qdf_status = qdf_wait_for_event_completion(
 					&hapd_state->
 					qdf_sta_disassoc_event,
 					SME_CMD_TIMEOUT_VALUE);

+ 1 - 0
core/hdd/src/wlan_hdd_driver_ops.c

@@ -1455,6 +1455,7 @@ static void wlan_hdd_pld_uevent(struct device *dev,
 		break;
 	case PLD_FW_DOWN:
 		cds_set_fw_state(CDS_FW_STATE_DOWN);
+		qdf_complete_wait_events();
 		cds_set_target_ready(false);
 		break;
 	case PLD_FW_READY:

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

@@ -5073,7 +5073,7 @@ __iw_softap_stopbss(struct net_device *dev,
 			WLAN_HDD_GET_SAP_CTX_PTR(adapter));
 		if (QDF_IS_STATUS_SUCCESS(status)) {
 			status =
-				qdf_wait_single_event(&hostapd_state->
+				qdf_wait_for_event_completion(&hostapd_state->
 					qdf_stop_bss_event,
 					SME_CMD_TIMEOUT_VALUE);
 
@@ -8075,7 +8075,7 @@ int wlan_hdd_cfg80211_start_bss(struct hdd_adapter *adapter,
 
 	hdd_debug("Waiting for Scan to complete(auto mode) and BSS to start");
 
-	qdf_status = qdf_wait_single_event(&hostapd_state->qdf_event,
+	qdf_status = qdf_wait_for_event_completion(&hostapd_state->qdf_event,
 						SME_CMD_TIMEOUT_VALUE);
 
 	wlansap_reset_sap_config_add_ie(pConfig, eUPDATE_IE_ALL);
@@ -8254,7 +8254,7 @@ static int __wlan_hdd_cfg80211_stop_ap(struct wiphy *wiphy,
 		status = wlansap_stop_bss(WLAN_HDD_GET_SAP_CTX_PTR(adapter));
 		if (QDF_IS_STATUS_SUCCESS(status)) {
 			qdf_status =
-				qdf_wait_single_event(&hostapd_state->
+				qdf_wait_for_event_completion(&hostapd_state->
 					qdf_stop_bss_event,
 					SME_CMD_TIMEOUT_VALUE);
 

+ 6 - 6
core/hdd/src/wlan_hdd_main.c

@@ -4492,8 +4492,8 @@ QDF_STATUS hdd_stop_adapter(struct hdd_context *hdd_ctx, struct hdd_adapter *ada
 				qdf_event_reset(&hostapd_state->
 						qdf_stop_bss_event);
 				qdf_status =
-					qdf_wait_single_event(&hostapd_state->
-					qdf_stop_bss_event,
+					qdf_wait_for_event_completion(
+					&hostapd_state->qdf_stop_bss_event,
 					SME_CMD_TIMEOUT_VALUE);
 
 				if (!QDF_IS_STATUS_SUCCESS(qdf_status)) {
@@ -10963,7 +10963,7 @@ void wlan_hdd_stop_sap(struct hdd_adapter *ap_adapter)
 		qdf_event_reset(&hostapd_state->qdf_stop_bss_event);
 		if (QDF_STATUS_SUCCESS == wlansap_stop_bss(hdd_ap_ctx->
 							sap_context)) {
-			qdf_status = qdf_wait_single_event(&hostapd_state->
+			qdf_status = qdf_wait_for_event_completion(&hostapd_state->
 					qdf_stop_bss_event,
 					SME_CMD_TIMEOUT_VALUE);
 			if (!QDF_IS_STATUS_SUCCESS(qdf_status)) {
@@ -11032,7 +11032,7 @@ void wlan_hdd_start_sap(struct hdd_adapter *ap_adapter, bool reinit)
 		goto end;
 
 	hdd_debug("Waiting for SAP to start");
-	qdf_status = qdf_wait_single_event(&hostapd_state->qdf_event,
+	qdf_status = qdf_wait_for_event_completion(&hostapd_state->qdf_event,
 					SME_CMD_TIMEOUT_VALUE);
 	if (!QDF_IS_STATUS_SUCCESS(qdf_status)) {
 		hdd_err("SAP Start failed");
@@ -12626,7 +12626,7 @@ void hdd_restart_sap(struct hdd_adapter *ap_adapter)
 		qdf_event_reset(&hostapd_state->qdf_stop_bss_event);
 		if (QDF_STATUS_SUCCESS == wlansap_stop_bss(sap_ctx)) {
 			qdf_status =
-				qdf_wait_single_event(&hostapd_state->
+				qdf_wait_for_event_completion(&hostapd_state->
 					qdf_stop_bss_event,
 					SME_CMD_TIMEOUT_VALUE);
 
@@ -12659,7 +12659,7 @@ void hdd_restart_sap(struct hdd_adapter *ap_adapter)
 
 		hdd_info("Waiting for SAP to start");
 		qdf_status =
-			qdf_wait_single_event(&hostapd_state->qdf_event,
+			qdf_wait_for_event_completion(&hostapd_state->qdf_event,
 					SME_CMD_TIMEOUT_VALUE);
 		wlansap_reset_sap_config_add_ie(sap_config,
 				eUPDATE_IE_ALL);

+ 1 - 1
core/hdd/src/wlan_hdd_request_manager.c

@@ -168,7 +168,7 @@ int hdd_request_wait_for_response(struct hdd_request *request)
 {
 	QDF_STATUS status;
 
-	status = qdf_wait_single_event(&request->completed,
+	status = qdf_wait_for_event_completion(&request->completed,
 				       request->params.timeout_ms);
 
 	return qdf_status_to_os_return(status);

+ 4 - 3
core/hdd/src/wlan_hdd_wext.c

@@ -9854,9 +9854,10 @@ static int __iw_get_statistics(struct net_device *dev,
 
 		pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(adapter);
 
-		qdf_status =
-			qdf_wait_single_event(&pWextState->hdd_qdf_event,
-					      WLAN_WAIT_TIME_STATS);
+		qdf_status = qdf_wait_for_event_completion(
+				&pWextState->hdd_qdf_event,
+				WLAN_WAIT_TIME_STATS);
+
 		if (!QDF_IS_STATUS_SUCCESS(qdf_status)) {
 			hdd_err("SME timeout while retrieving statistics");
 			/* Remove the SME statistics list by

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

@@ -2789,7 +2789,7 @@ QDF_STATUS wma_tx_packet(void *wma_context, void *tx_frame, uint16_t frmLen,
 		 * @ Discrete : Target Download Complete
 		 */
 		qdf_status =
-			qdf_wait_single_event(&wma_handle->
+			qdf_wait_for_event_completion(&wma_handle->
 					      tx_frm_download_comp_event,
 					      WMA_TX_FRAME_COMPLETE_TIMEOUT);
 

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

@@ -5093,7 +5093,7 @@ static void wma_wait_tx_complete(tp_wma_handle wma,
 
 	while (cdp_get_tx_pending(soc, pdev) && max_wait_iterations) {
 		WMA_LOGW(FL("Waiting for outstanding packet to drain."));
-		qdf_wait_single_event(&wma->tx_queue_empty_event,
+		qdf_wait_for_event_completion(&wma->tx_queue_empty_event,
 				      WMA_TX_Q_RECHECK_TIMER_WAIT);
 		max_wait_iterations--;
 	}

+ 3 - 2
core/wma/src/wma_main.c

@@ -6267,8 +6267,9 @@ QDF_STATUS wma_wait_for_ready_event(WMA_HANDLE handle)
 	QDF_STATUS qdf_status;
 
 	/* wait until WMI_READY_EVENTID received from FW */
-	qdf_status = qdf_wait_single_event(&(wma_handle->wma_ready_event),
-					   WMA_READY_EVENTID_TIMEOUT);
+	qdf_status = qdf_wait_for_event_completion(
+					&wma_handle->wma_ready_event,
+					WMA_READY_EVENTID_TIMEOUT);
 
 	if (QDF_STATUS_SUCCESS != qdf_status) {
 		WMA_LOGE("%s: Timeout waiting for ready event from FW",