From ed1a9c418fd4dfd657495d3230c4dc8db043ca57 Mon Sep 17 00:00:00 2001 From: gaurank kathpalia Date: Tue, 13 Aug 2019 16:31:29 +0530 Subject: qcacld-3.0: Take a wakelock till CSA complete Currently the driver sends the CSA IEs in the beacon every beacon interval, and updates the CSA IE count in every beacon. If the wlan gets suspended in between the updation of CSA IEs, the CSA is delayed till the next resume, which could lead to STA kickout event, if there is delay between the CSA period, and the channel switch time. Fix is to take a wakelock till CSA is completed in order to avoid the STA kickout. Change-Id: Iff03476433c755cbddc7568ffbd24ddb81fd1c90 CRs-Fixed: 2504039 --- core/mac/src/pe/include/lim_session.h | 3 ++- core/mac/src/pe/lim/lim_process_sme_req_messages.c | 5 +++++ core/mac/src/pe/lim/lim_send_sme_rsp_messages.c | 3 +++ core/mac/src/pe/lim/lim_session.c | 5 +++++ 4 files changed, 15 insertions(+), 1 deletion(-) diff --git a/core/mac/src/pe/include/lim_session.h b/core/mac/src/pe/include/lim_session.h index 74188d03867d..4287b55930b9 100644 --- a/core/mac/src/pe/include/lim_session.h +++ b/core/mac/src/pe/include/lim_session.h @@ -94,7 +94,8 @@ typedef struct sPESession /* Added to Support BT-AMP */ uint16_t peSessionId; uint8_t smeSessionId; uint16_t transactionId; - + qdf_wake_lock_t ap_ecsa_wakelock; + qdf_runtime_lock_t ap_ecsa_runtime_lock; /* In AP role: BSSID and selfMacAddr will be the same. */ /* In STA role: they will be different */ tSirMacAddr bssId; diff --git a/core/mac/src/pe/lim/lim_process_sme_req_messages.c b/core/mac/src/pe/lim/lim_process_sme_req_messages.c index 37f0f62ab5c5..1aebd0ac2253 100644 --- a/core/mac/src/pe/lim/lim_process_sme_req_messages.c +++ b/core/mac/src/pe/lim/lim_process_sme_req_messages.c @@ -6011,6 +6011,8 @@ void lim_send_chan_switch_action_frame(tpAniSirGlobal mac_ctx, } +#define MAX_WAKELOCK_FOR_CSA 5000 + /** * lim_process_sme_dfs_csa_ie_request() - process sme dfs csa ie req * @@ -6130,6 +6132,9 @@ static void lim_process_sme_dfs_csa_ie_request(tpAniSirGlobal mac_ctx, dfs_csa_ie_req->ch_params.center_freq_seg0; skip_vht: /* Send CSA IE request from here */ + qdf_wake_lock_timeout_acquire(&session_entry->ap_ecsa_wakelock, + MAX_WAKELOCK_FOR_CSA); + qdf_runtime_pm_prevent_suspend(&session_entry->ap_ecsa_runtime_lock); lim_send_dfs_chan_sw_ie_update(mac_ctx, session_entry); if (dfs_csa_ie_req->ch_params.ch_width == CH_WIDTH_80MHZ) diff --git a/core/mac/src/pe/lim/lim_send_sme_rsp_messages.c b/core/mac/src/pe/lim/lim_send_sme_rsp_messages.c index 3daffcbd866f..7958083003ea 100644 --- a/core/mac/src/pe/lim/lim_send_sme_rsp_messages.c +++ b/core/mac/src/pe/lim/lim_send_sme_rsp_messages.c @@ -2519,6 +2519,9 @@ lim_send_sme_ap_channel_switch_resp(tpAniSirGlobal pMac, enum phy_ch_width ch_width; uint8_t ch_center_freq_seg1; + qdf_runtime_pm_allow_suspend(&psessionEntry->ap_ecsa_runtime_lock); + qdf_wake_lock_release(&psessionEntry->ap_ecsa_wakelock, 0); + pSmeSwithChnlParams = (tSwitchChannelParams *) qdf_mem_malloc(sizeof(tSwitchChannelParams)); if (NULL == pSmeSwithChnlParams) { diff --git a/core/mac/src/pe/lim/lim_session.c b/core/mac/src/pe/lim/lim_session.c index 7f9e83624d68..2d8309be693f 100644 --- a/core/mac/src/pe/lim/lim_session.c +++ b/core/mac/src/pe/lim/lim_session.c @@ -509,6 +509,9 @@ pe_create_session(tpAniSirGlobal pMac, uint8_t *bssid, uint8_t *sessionId, } if (status != QDF_STATUS_SUCCESS) pe_err("cannot create or start protectionFieldsResetTimer"); + qdf_wake_lock_create(&session_ptr->ap_ecsa_wakelock, + "ap_ecsa_wakelock"); + qdf_runtime_lock_init(&session_ptr->ap_ecsa_runtime_lock); status = qdf_mc_timer_init(&session_ptr->ap_ecsa_timer, QDF_TIMER_TYPE_WAKE_APPS, lim_process_ap_ecsa_timeout, (void *)&pMac->lim.gpSession[i]); @@ -686,6 +689,8 @@ void pe_delete_session(tpAniSirGlobal mac_ctx, tpPESession session) session->dfsIncludeChanSwIe = 0; qdf_mc_timer_stop(&session->ap_ecsa_timer); qdf_mc_timer_destroy(&session->ap_ecsa_timer); + qdf_runtime_lock_deinit(&session->ap_ecsa_runtime_lock); + qdf_wake_lock_destroy(&session->ap_ecsa_wakelock); lim_del_pmf_sa_query_timer(mac_ctx, session); } -- cgit v1.2.3