Browse Source

qcacld-3.0: Destroy sap_dfs_cac_timer properly

This is qcacld-2.0 to qcacld-3.0 propagation.

Destroy sap_dfs_cac_timer at callback function based on check if timer
is still valid.

Change-Id: Ib8b92ac11444b63a0d8002edff35cd9238bb2573
CRs-Fixed: 967907
Naveen Rawat 8 years ago
parent
commit
6de4645864
2 changed files with 13 additions and 3 deletions
  1. 1 1
      core/sap/src/sap_api_link_cntl.c
  2. 12 2
      core/sap/src/sap_fsm.c

+ 1 - 1
core/sap/src/sap_api_link_cntl.c

@@ -675,6 +675,7 @@ wlansap_roam_process_dfs_radar_found(tpAniSirGlobal mac_ctx,
 		 */
 		qdf_mc_timer_stop(&mac_ctx->sap.SapDfsInfo.sap_dfs_cac_timer);
 		qdf_mc_timer_destroy(&mac_ctx->sap.SapDfsInfo.sap_dfs_cac_timer);
+		mac_ctx->sap.SapDfsInfo.is_dfs_cac_timer_running = false;
 
 		/*
 		 * User space is already indicated the CAC start and if
@@ -692,7 +693,6 @@ wlansap_roam_process_dfs_radar_found(tpAniSirGlobal mac_ctx,
 			 */
 		}
 
-		mac_ctx->sap.SapDfsInfo.is_dfs_cac_timer_running = 0;
 		sap_event.event = eSAP_DFS_CHANNEL_CAC_RADAR_FOUND;
 		sap_event.params = 0;
 		sap_event.u1 = 0;

+ 12 - 2
core/sap/src/sap_fsm.c

@@ -4655,11 +4655,18 @@ void sap_dfs_cac_timer_callback(void *data)
 		return;
 	}
 
-	/* Check to ensure that SAP is in DFS WAIT state */
-	if (sapContext->sapsMachine == eSAP_DFS_CAC_WAIT) {
+	/*
+	 * SAP may not be in CAC wait state, when the timer runs out.
+	 * if following flag is set, then timer is in initialized state,
+	 * destroy timer here.
+	 */
+	if (pMac->sap.SapDfsInfo.is_dfs_cac_timer_running == true) {
 		qdf_mc_timer_destroy(&pMac->sap.SapDfsInfo.sap_dfs_cac_timer);
 		pMac->sap.SapDfsInfo.is_dfs_cac_timer_running = false;
+	}
 
+	/* Check to ensure that SAP is in DFS WAIT state */
+	if (sapContext->sapsMachine == eSAP_DFS_CAC_WAIT) {
 		/*
 		 * CAC Complete, post eSAP_DFS_CHANNEL_CAC_END to sap_fsm
 		 */
@@ -4703,6 +4710,7 @@ static int sap_stop_dfs_cac_timer(ptSapContext sapContext)
 
 	qdf_mc_timer_stop(&pMac->sap.SapDfsInfo.sap_dfs_cac_timer);
 	pMac->sap.SapDfsInfo.is_dfs_cac_timer_running = 0;
+	qdf_mc_timer_destroy(&pMac->sap.SapDfsInfo.sap_dfs_cac_timer);
 
 	return 0;
 }
@@ -4783,6 +4791,8 @@ int sap_start_dfs_cac_timer(ptSapContext sapContext)
 		pMac->sap.SapDfsInfo.is_dfs_cac_timer_running = true;
 		return 1;
 	} else {
+		pMac->sap.SapDfsInfo.is_dfs_cac_timer_running = false;
+		qdf_mc_timer_destroy(&pMac->sap.SapDfsInfo.sap_dfs_cac_timer);
 		return 0;
 	}
 }