From 02ec62b2079a7ff6bdbd0bc59c9493f1d293e88b Mon Sep 17 00:00:00 2001 From: Ganesh Kondabattini Date: Wed, 24 Jan 2018 18:22:24 +0530 Subject: [PATCH] qcacld-3.0: Correct the logic to decrement the beacon count in CSA IE Beacon template may get updated from many use cases like change in protection mode, update in CSA count and etc. Make sure that the driver maintains the beacon count which is same as in beacon template, otherwise there may be duplicate/missing beacon count due to inconsistency. Decrement the beacon count value before updating the beacon template. Change-Id: I0c4552445071dd6ab5322191c04d4f7d32c9a987 CRs-Fixed: 2170097 --- core/mac/src/pe/lim/lim_process_sme_req_messages.c | 1 - core/mac/src/pe/lim/lim_send_sme_rsp_messages.c | 10 ++++++++-- 2 files changed, 8 insertions(+), 3 deletions(-) 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 b1a52829033f..d19d53dd667d 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 @@ -5849,7 +5849,6 @@ skip_vht: send_extended_chan_switch_action_frame(mac_ctx, session_entry->gLimChannelSwitch.primaryChannel, ch_offset, session_entry); - session_entry->gLimChannelSwitch.switchCount--; } /** 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 13f72e613fcf..93757ca1911e 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 @@ -2591,6 +2591,14 @@ lim_process_beacon_tx_success_ind(tpAniSirGlobal pMac, uint16_t msgType, void *e if (LIM_IS_AP_ROLE(psessionEntry) && true == psessionEntry->dfsIncludeChanSwIe) { + + if (psessionEntry->gLimChannelSwitch.switchCount) { + /* Decrement the beacon switch count */ + psessionEntry->gLimChannelSwitch.switchCount--; + pe_debug("current beacon count %d", + psessionEntry->gLimChannelSwitch.switchCount); + } + /* Send only 5 beacons with CSA IE Set in when a radar is detected */ if (psessionEntry->gLimChannelSwitch.switchCount > 0) { /* @@ -2605,8 +2613,6 @@ lim_process_beacon_tx_success_ind(tpAniSirGlobal pMac, uint16_t msgType, void *e lim_send_chan_switch_action_frame(pMac, ch, ch_width, psessionEntry); - /* Decrement the IE count */ - psessionEntry->gLimChannelSwitch.switchCount--; } else { /* Done with CSA IE update, send response back to SME */ psessionEntry->gLimChannelSwitch.switchCount = 0;