From 97fa4f692b7dab4791e2226064b46298f898a196 Mon Sep 17 00:00:00 2001 From: Nishank Aggarwal Date: Tue, 10 Jan 2017 11:13:06 +0530 Subject: qcacld-2.0: Do not queue multiple setMaxTxPower cmd in SME pending queue prima to qcacld-2.0 propagation Currently multiple setMaxTxPower are allowed and thus if some command is present in sme active queue it can lead to overflow of the sme pending queue. Fix is to allow only one setMaxTxPower command at a time to get processed. Change-Id: I1c2d21c78bef74fad01ca1010b124c8dd7608fe2 CRs-Fixed: 1107777 --- CORE/MAC/inc/aniGlobal.h | 3 ++- CORE/SME/src/sme_common/sme_Api.c | 20 +++++++++++++++++++- 2 files changed, 21 insertions(+), 2 deletions(-) diff --git a/CORE/MAC/inc/aniGlobal.h b/CORE/MAC/inc/aniGlobal.h index e6069b00d761..e838794259ec 100644 --- a/CORE/MAC/inc/aniGlobal.h +++ b/CORE/MAC/inc/aniGlobal.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012-2016 The Linux Foundation. All rights reserved. + * Copyright (c) 2012-2017 The Linux Foundation. All rights reserved. * * Previously licensed under the ISC license by Qualcomm Atheros, Inc. * @@ -1291,6 +1291,7 @@ typedef struct sAniSirGlobal uint8_t sub20_config_info; uint8_t sub20_channelwidth; uint8_t sub20_dynamic_channelwidth; + bool max_power_cmd_pending; } tAniSirGlobal; typedef enum diff --git a/CORE/SME/src/sme_common/sme_Api.c b/CORE/SME/src/sme_common/sme_Api.c index 789b441bb0ab..0d8e5e4759b2 100644 --- a/CORE/SME/src/sme_common/sme_Api.c +++ b/CORE/SME/src/sme_common/sme_Api.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012-2016 The Linux Foundation. All rights reserved. + * Copyright (c) 2012-2017 The Linux Foundation. All rights reserved. * * Previously licensed under the ISC license by Qualcomm Atheros, Inc. * @@ -1080,6 +1080,7 @@ sme_process_cmd: &pCommand->Link, LL_ACCESS_LOCK)) { csrReleaseCommand(pMac, pCommand); } + pMac->max_power_cmd_pending = false; break; case eSmeCommandSetMaxTxPowerPerBand: csrLLUnlock(&pMac->sme.smeCmdActiveList); @@ -1092,6 +1093,7 @@ sme_process_cmd: &pCommand->Link, LL_ACCESS_LOCK)) { csrReleaseCommand(pMac, pCommand); } + pMac->max_power_cmd_pending = false; break; #ifdef FEATURE_OEM_DATA_SUPPORT @@ -9766,6 +9768,12 @@ eHalStatus sme_SetMaxTxPowerPerBand(eCsrBand band, v_S7_t dB, tSmeCmd *set_max_tx_pwr_per_band; tpAniSirGlobal mac_ctx = PMAC_STRUCT(hal); + if (mac_ctx->max_power_cmd_pending) { + smsLog(mac_ctx, LOG1, + FL("set max tx power already in progress")); + return eHAL_STATUS_RESOURCES; + } + smsLog(mac_ctx, LOG1, FL("band : %d power %d dB"), band, dB); @@ -9783,6 +9791,7 @@ eHalStatus sme_SetMaxTxPowerPerBand(eCsrBand band, v_S7_t dB, set_tx_max_pwr_per_band.band = band; set_max_tx_pwr_per_band->u. set_tx_max_pwr_per_band.power = dB; + mac_ctx->max_power_cmd_pending = true; status = csrQueueSmeCommand(mac_ctx, set_max_tx_pwr_per_band, eANI_BOOLEAN_TRUE); @@ -9792,6 +9801,7 @@ eHalStatus sme_SetMaxTxPowerPerBand(eCsrBand band, v_S7_t dB, status); csrReleaseCommand(mac_ctx, set_max_tx_pwr_per_band); + mac_ctx->max_power_cmd_pending = false; } } else { smsLog(mac_ctx, LOGE, @@ -9823,6 +9833,12 @@ eHalStatus sme_SetMaxTxPower(tHalHandle hHal, tSirMacAddr bssid, eHalStatus status = eHAL_STATUS_SUCCESS; tSmeCmd *set_max_tx_pwr; + if (mac_ptr->max_power_cmd_pending) { + smsLog(mac_ptr, LOG1, + FL("set max tx power already in progress")); + return eHAL_STATUS_RESOURCES; + } + MTRACE(vos_trace(VOS_MODULE_ID_SME, TRACE_CODE_SME_RX_HDD_SET_MAXTXPOW, NO_SESSION, 0)); smsLog(mac_ptr, LOG1, @@ -9839,6 +9855,7 @@ eHalStatus sme_SetMaxTxPower(tHalHandle hHal, tSirMacAddr bssid, vos_mem_copy(set_max_tx_pwr->u.set_tx_max_pwr.self_sta_mac_addr, self_mac_addr, SIR_MAC_ADDR_LENGTH); set_max_tx_pwr->u.set_tx_max_pwr.power = db; + mac_ptr->max_power_cmd_pending = true; status = csrQueueSmeCommand(mac_ptr, set_max_tx_pwr, eANI_BOOLEAN_TRUE); if (!HAL_STATUS_SUCCESS(status)) { @@ -9846,6 +9863,7 @@ eHalStatus sme_SetMaxTxPower(tHalHandle hHal, tSirMacAddr bssid, FL("fail to send msg status = %d"), status); csrReleaseCommandScan(mac_ptr, set_max_tx_pwr); + mac_ptr->max_power_cmd_pending = false; } } else -- cgit v1.2.3