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
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 f6cd604..a408684 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
@@ -5719,6 +5719,13 @@
wider_bw_ch_switch->newCenterChanFreq0 =
dfs_csa_ie_req->ch_params.center_freq_seg0;
skip_vht:
+
+ /* Take a wakelock for CSA for 5 seconds and release in vdev start */
+
+ 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);
+
/* Send CSA IE request from here */
lim_send_dfs_chan_sw_ie_update(mac_ctx, session_entry);
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 064def0..76f8de0 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
@@ -1937,6 +1937,9 @@
enum phy_ch_width ch_width;
uint8_t ch_center_freq_seg1;
+ qdf_runtime_pm_allow_suspend(&pe_session->ap_ecsa_runtime_lock);
+ qdf_wake_lock_release(&pe_session->ap_ecsa_wakelock, 0);
+
pSmeSwithChnlParams = qdf_mem_malloc(sizeof(tSwitchChannelParams));
if (!pSmeSwithChnlParams)
return;
diff --git a/core/mac/src/pe/lim/lim_session.c b/core/mac/src/pe/lim/lim_session.c
index 25d9a3d..31e5fec 100644
--- a/core/mac/src/pe/lim/lim_session.c
+++ b/core/mac/src/pe/lim/lim_session.c
@@ -664,6 +664,9 @@
else
session_ptr->is_obss_reset_timer_initialized = true;
+ 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,
@@ -873,6 +876,8 @@
}
if (LIM_IS_AP_ROLE(session)) {
+ qdf_runtime_lock_deinit(&session->ap_ecsa_runtime_lock);
+ qdf_wake_lock_destroy(&session->ap_ecsa_wakelock);
qdf_mc_timer_stop(&session->protection_fields_reset_timer);
qdf_mc_timer_destroy(&session->protection_fields_reset_timer);
session->dfsIncludeChanSwIe = 0;
diff --git a/core/mac/src/pe/lim/lim_utils.h b/core/mac/src/pe/lim/lim_utils.h
index c31748e..77bc75e 100644
--- a/core/mac/src/pe/lim/lim_utils.h
+++ b/core/mac/src/pe/lim/lim_utils.h
@@ -102,6 +102,7 @@
#define OBSS_DETECTION_IS_HT_20MHZ(_m) ((_m) & OBSS_DETECTION_HT_20MHZ_BIT_MASK)
#define MAX_WAIT_FOR_BCN_TX_COMPLETE 4000
+#define MAX_WAKELOCK_FOR_CSA 5000
#ifdef WLAN_FEATURE_11W
typedef union uPmfSaQueryTimerId {