From 6de46458642422eec635d31f1a1746ca306ddd3f Mon Sep 17 00:00:00 2001 From: Naveen Rawat Date: Wed, 8 Jun 2016 10:02:26 -0700 Subject: [PATCH] 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 --- core/sap/src/sap_api_link_cntl.c | 2 +- core/sap/src/sap_fsm.c | 14 ++++++++++++-- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/core/sap/src/sap_api_link_cntl.c b/core/sap/src/sap_api_link_cntl.c index d0b3a00582c0..4f7f7f7660f6 100644 --- a/core/sap/src/sap_api_link_cntl.c +++ b/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; diff --git a/core/sap/src/sap_fsm.c b/core/sap/src/sap_fsm.c index dd439e790da3..1c67501ea970 100644 --- a/core/sap/src/sap_fsm.c +++ b/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; } }