From 8c54e38f56c01e6edb8f3aa324198f0928e26a56 Mon Sep 17 00:00:00 2001 From: Abhishek Singh Date: Tue, 19 Mar 2019 17:43:43 +0530 Subject: [PATCH] qcacld-3.0: Limit the wait for first CSA beacon TX completion During channel switch in AP, Driver send beacon with CSA count and wait for first beacon tx complete to initiate the host timer every beacon interval to send the beacon template with updated CSA count till CSA count become 0 and then do the vdev restart. If driver doesn't get first beacon tx complete, the state machine get stuck waiting for CSA to complete and can lead to functional and stability issues. So wait maximum for MAX_WAIT_FOR_BCN_TX_COMPLETE time for first beacon tx complete and if not received, start the timer for every beacon interval to send the beacon template with updated CSA count. Change-Id: I90fab62d0851144906a7e7bd56285e64729c568c CRs-Fixed: 2423079 --- .../src/pe/lim/lim_process_sme_req_messages.c | 19 +++++++++++++++++++ core/mac/src/pe/lim/lim_utils.c | 3 +++ core/mac/src/pe/lim/lim_utils.h | 2 ++ 3 files changed, 24 insertions(+) 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 4c6792c88c257..356c73c8985e0 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 @@ -5571,6 +5571,7 @@ static void lim_process_sme_dfs_csa_ie_request(struct mac_context *mac_ctx, uint8_t session_id; tLimWiderBWChannelSwitchInfo *wider_bw_ch_switch; enum offset_t ch_offset; + QDF_STATUS status; if (!msg_buf) { pe_err("Buffer is Pointing to NULL"); @@ -5673,6 +5674,24 @@ skip_vht: /* Send CSA IE request from here */ lim_send_dfs_chan_sw_ie_update(mac_ctx, session_entry); + /* + * Wait for MAX_WAIT_FOR_BCN_TX_COMPLETE ms for tx complete for beacon. + * If tx complete for beacon is received before this timer expire, + * stop this timer and then this will be restarted for every beacon + * interval until switchCount become 0 and bcn template with new + * switchCount will be sent to firmware. + * OR + * If no tx complete for beacon is recived till this timer expire + * this will be restarted for every beacon interval until switchCount + * become 0 and bcn template with new switchCount will be sent to + * firmware. + */ + pe_debug("start ap_ecsa_timer for %d ms", MAX_WAIT_FOR_BCN_TX_COMPLETE); + status = qdf_mc_timer_start(&session_entry->ap_ecsa_timer, + MAX_WAIT_FOR_BCN_TX_COMPLETE); + if (QDF_IS_STATUS_ERROR(status)) + pe_err("cannot start ap_ecsa_timer"); + if (dfs_csa_ie_req->ch_params.ch_width == CH_WIDTH_80MHZ) ch_offset = BW80; else diff --git a/core/mac/src/pe/lim/lim_utils.c b/core/mac/src/pe/lim/lim_utils.c index 921ffbc5d5c75..d4d06765f6450 100644 --- a/core/mac/src/pe/lim/lim_utils.c +++ b/core/mac/src/pe/lim/lim_utils.c @@ -7787,6 +7787,9 @@ void lim_process_ap_ecsa_timeout(void *data) return; } + /* Stop the timer if already running */ + qdf_mc_timer_stop(&session->ap_ecsa_timer); + if (session->gLimChannelSwitch.switchCount) { /* Decrement the beacon switch count */ session->gLimChannelSwitch.switchCount--; diff --git a/core/mac/src/pe/lim/lim_utils.h b/core/mac/src/pe/lim/lim_utils.h index 5da2f6bbcd03a..3e6bbbf0fa5c7 100644 --- a/core/mac/src/pe/lim/lim_utils.h +++ b/core/mac/src/pe/lim/lim_utils.h @@ -101,6 +101,8 @@ typedef enum { /* To check if HT 20mhz detection bit set */ #define OBSS_DETECTION_IS_HT_20MHZ(_m) ((_m) & OBSS_DETECTION_HT_20MHZ_BIT_MASK) +#define MAX_WAIT_FOR_BCN_TX_COMPLETE 4000 + #ifdef WLAN_FEATURE_11W typedef union uPmfSaQueryTimerId { struct {