From 3545e64d4aaaef192976c6934d3e33398cb6cbda Mon Sep 17 00:00:00 2001 From: Wu Gao Date: Fri, 14 Jul 2017 19:24:41 +0800 Subject: [PATCH] qcacld-3.0: Cleanup DFS CAC timer when SSR and reset all adapters In SAP and SSR case, it won't cleanup DFS CAC timer until up layer kill hostapd. It will call wlansap close when hostapd exit. If enable sap internal restart in this case, it will double init DFS CAC timer, which cause abnormal in kernel. Solution is cleanup DFS CAC timer when reset all adapters. Change-Id: I96962349af548074e226976c8c01cd5a8710ed3f CRs-fixed: 2075904 --- core/hdd/src/wlan_hdd_main.c | 14 +++++++++----- core/sap/inc/sap_api.h | 12 ++++++++++++ core/sap/src/sap_module.c | 23 +++++++++++++++++++++++ 3 files changed, 44 insertions(+), 5 deletions(-) diff --git a/core/hdd/src/wlan_hdd_main.c b/core/hdd/src/wlan_hdd_main.c index 9807393bc68e..157defa6d0eb 100644 --- a/core/hdd/src/wlan_hdd_main.c +++ b/core/hdd/src/wlan_hdd_main.c @@ -4316,14 +4316,18 @@ QDF_STATUS hdd_reset_all_adapters(hdd_context_t *hdd_ctx) clear_bit(WMM_INIT_DONE, &adapter->event_flags); } - /* - * If adapter is SAP, set session ID to invalid since SAP - * session will be cleanup during SSR. - */ - if (adapter->device_mode == QDF_SAP_MODE) + if (adapter->device_mode == QDF_SAP_MODE) { + /* + * If adapter is SAP, set session ID to invalid + * since SAP session will be cleanup during SSR. + */ wlansap_set_invalid_session( WLAN_HDD_GET_SAP_CTX_PTR(adapter)); + wlansap_cleanup_cac_timer( + WLAN_HDD_GET_SAP_CTX_PTR(adapter)); + } + /* Delete peers if any for STA and P2P client modes */ if (adapter->device_mode == QDF_STA_MODE || adapter->device_mode == QDF_P2P_CLIENT_MODE) { diff --git a/core/sap/inc/sap_api.h b/core/sap/inc/sap_api.h index c3eb015cc873..e6cd4932b965 100644 --- a/core/sap/inc/sap_api.h +++ b/core/sap/inc/sap_api.h @@ -1055,6 +1055,18 @@ QDF_STATUS wlansap_set_invalid_session(void *cds_ctx); * Return: None */ void sap_dfs_set_current_channel(void *sap_ctx); + +/** + * wlansap_cleanup_cac_timer() - Force cleanup DFS CAC timer + * @sap_ctx: sap context + * + * Force cleanup DFS CAC timer when reset all adapters. It will not + * check concurrency SAP since just called when reset all adapters. + * + * Return: None + */ +void wlansap_cleanup_cac_timer(void *sap_ctx); + #ifdef __cplusplus } #endif diff --git a/core/sap/src/sap_module.c b/core/sap/src/sap_module.c index 55d2e24fd68a..2c810ea32cab 100644 --- a/core/sap/src/sap_module.c +++ b/core/sap/src/sap_module.c @@ -3745,3 +3745,26 @@ wlansap_set_invalid_session(void *cds_ctx) return QDF_STATUS_SUCCESS; } + +void wlansap_cleanup_cac_timer(void *sap_ctx) +{ + tHalHandle hal; + ptSapContext psap_ctx; + tpAniSirGlobal pmac; + + if (!sap_ctx) + return; + + psap_ctx = CDS_GET_SAP_CB(sap_ctx); + hal = CDS_GET_HAL_CB(psap_ctx->p_cds_gctx); + pmac = PMAC_STRUCT(hal); + if (pmac->sap.SapDfsInfo.is_dfs_cac_timer_running) { + 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); + QDF_TRACE(QDF_MODULE_ID_SAP, QDF_TRACE_LEVEL_ERROR, + FL("sapdfs, force cleanup running dfs cac timer")); + } +}