diff options
| author | CNSS_WLAN Service <cnssbldsw@qualcomm.com> | 2018-09-06 02:27:28 -0700 |
|---|---|---|
| committer | Gerrit - the friendly Code Review server <code-review@localhost> | 2018-09-06 02:27:28 -0700 |
| commit | cc91fdf60c41f164a99ad0914c0ce49ed9401bbb (patch) | |
| tree | 1651f8e76e6c212dad14596d93d5969fc775a5e1 | |
| parent | e6bda9f180aec8690bf8eab37d5c2e60850be65c (diff) | |
| parent | 859aea917d790c3538dea6fa9be1d68214c7057f (diff) | |
Merge "qcacld-2.0: Drop mgmt frames if no.of RX mgmt packets reaches to threshold" into wlan-cld2.driver.lnx.1.0
| -rw-r--r-- | CORE/MAC/src/include/sysGlobal.h | 4 | ||||
| -rw-r--r-- | CORE/MAC/src/pe/lim/limApi.c | 55 | ||||
| -rw-r--r-- | CORE/MAC/src/pe/lim/limProcessMessageQueue.c | 5 | ||||
| -rw-r--r-- | CORE/MAC/src/pe/lim/limUtils.c | 14 | ||||
| -rw-r--r-- | CORE/MAC/src/pe/lim/limUtils.h | 16 |
5 files changed, 91 insertions, 3 deletions
diff --git a/CORE/MAC/src/include/sysGlobal.h b/CORE/MAC/src/include/sysGlobal.h index 375df2221f98..a78f04ad3ed0 100644 --- a/CORE/MAC/src/include/sysGlobal.h +++ b/CORE/MAC/src/include/sysGlobal.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013 The Linux Foundation. All rights reserved. + * Copyright (c) 2013, 2018 The Linux Foundation. All rights reserved. * * Previously licensed under the ISC license by Qualcomm Atheros, Inc. * @@ -35,6 +35,7 @@ typedef struct sAniSirSys tANI_U32 gSysFrameCount[4][16]; tANI_U32 gSysBbtReceived; + tANI_U32 sys_bbt_pending_mgmt_count; tANI_U32 gSysBbtPostedToLim; tANI_U32 gSysBbtPostedToSch; tANI_U32 gSysBbtPostedToPmm; @@ -50,6 +51,7 @@ typedef struct sAniSirSys tANI_U32 gSysEnableLearnMode; tANI_U32 gSysEnableScanMode; tANI_U32 gSysEnableLinkMonitorMode; + adf_os_spinlock_t bbt_mgmt_lock; } tAniSirSys, *tpAniSirSys; #endif diff --git a/CORE/MAC/src/pe/lim/limApi.c b/CORE/MAC/src/pe/lim/limApi.c index 1ca8e1106e94..1c02b7eb6a71 100644 --- a/CORE/MAC/src/pe/lim/limApi.c +++ b/CORE/MAC/src/pe/lim/limApi.c @@ -914,6 +914,7 @@ tSirRetStatus peOpen(tpAniSirGlobal pMac, tMacOpenParameters *pMacOpenParam) pMac->lim.maxBssId = pMacOpenParam->maxBssId; pMac->lim.maxStation = pMacOpenParam->maxStation; + adf_os_spinlock_init(&pMac->sys.bbt_mgmt_lock); if ((pMac->lim.maxBssId == 0) || (pMac->lim.maxStation == 0)) { PELOGE(limLog(pMac, LOGE, @@ -1018,6 +1019,7 @@ tSirRetStatus peClose(tpAniSirGlobal pMac) if (ANI_DRIVER_TYPE(pMac) == eDRIVER_TYPE_MFG) return eSIR_SUCCESS; + adf_os_spinlock_destroy(&pMac->sys.bbt_mgmt_lock); for(i =0; i < pMac->lim.maxBssId; i++) { if(pMac->lim.gpSession[i].valid == TRUE) @@ -1272,6 +1274,51 @@ tSirRetStatus peProcessMessages(tpAniSirGlobal pMac, tSirMsgQ* pMsg) return eSIR_SUCCESS; } +/** + * pe_drop_pending_rx_mgmt_frames: To drop pending RX mgmt frames + * @mac_ctx: Pointer to global MAC structure + * @hdr: Management header + * @vos_pkt: Packet + * + * This function is used to drop RX pending mgmt frames if pe mgmt queue + * reaches threshold + * + * Return: VOS_STATUS_SUCCESS on success or VOS_STATUS_E_FAILURE on failure + */ +static VOS_STATUS pe_drop_pending_rx_mgmt_frames(tpAniSirGlobal mac_ctx, + tpSirMacMgmtHdr hdr, vos_pkt_t *vos_pkt) +{ + adf_os_spin_lock(&mac_ctx->sys.bbt_mgmt_lock); + if (mac_ctx->sys.sys_bbt_pending_mgmt_count >= + MGMT_RX_PACKETS_THRESHOLD) { + adf_os_spin_unlock(&mac_ctx->sys.bbt_mgmt_lock); + limLog(mac_ctx, LOGW, + FL("No.of pending RX management frames reaches to threshold, dropping management frames")); + vos_pkt_return_packet(vos_pkt); + vos_pkt = NULL; + return VOS_STATUS_E_FAILURE; + } else if (mac_ctx->sys.sys_bbt_pending_mgmt_count > + (MGMT_RX_PACKETS_THRESHOLD / 2)) { + /* drop all probereq, proberesp and beacons */ + if (hdr->fc.subType == SIR_MAC_MGMT_BEACON || + hdr->fc.subType == SIR_MAC_MGMT_PROBE_REQ || + hdr->fc.subType == SIR_MAC_MGMT_PROBE_RSP) { + adf_os_spin_unlock(&mac_ctx->sys.bbt_mgmt_lock); + limLog(mac_ctx, LOGW, + FL("No.of pending RX management frames reaches to half of threshold, dropping probe req, probe resp or beacon frames")); + vos_pkt_return_packet(vos_pkt); + vos_pkt = NULL; + return VOS_STATUS_E_FAILURE; + } + } + mac_ctx->sys.sys_bbt_pending_mgmt_count++; + adf_os_spin_unlock(&mac_ctx->sys.bbt_mgmt_lock); + if (mac_ctx->sys.sys_bbt_pending_mgmt_count == + (MGMT_RX_PACKETS_THRESHOLD / 4)) + limLog(mac_ctx, LOGW, + FL("No.of pending RX management frames reaches to 1/4th of threshold")); + return VOS_STATUS_SUCCESS; +} // --------------------------------------------------------------------------- @@ -1354,6 +1401,9 @@ VOS_STATUS peHandleMgmtFrame( v_PVOID_t pvosGCtx, v_PVOID_t vosBuff) pVosPkt->pkt_meta.sessionId, RX_MGMT_PKT); } + if (VOS_STATUS_SUCCESS != + pe_drop_pending_rx_mgmt_frames(pMac, mHdr, pVosPkt)) + return VOS_STATUS_E_FAILURE; // Forward to MAC via mesg = SIR_BB_XPORT_MGMT_MSG msg.type = SIR_BB_XPORT_MGMT_MSG; @@ -1367,6 +1417,11 @@ VOS_STATUS peHandleMgmtFrame( v_PVOID_t pvosGCtx, v_PVOID_t vosBuff) { vos_pkt_return_packet(pVosPkt); pVosPkt = NULL; + /* + * Decrement sys_bbt_pending_mgmt_count if packet + * is dropped before posting to LIM + */ + lim_decrement_pending_mgmt_count(pMac); return VOS_STATUS_E_FAILURE; } diff --git a/CORE/MAC/src/pe/lim/limProcessMessageQueue.c b/CORE/MAC/src/pe/lim/limProcessMessageQueue.c index b7dc0c9618c2..c44899f18480 100644 --- a/CORE/MAC/src/pe/lim/limProcessMessageQueue.c +++ b/CORE/MAC/src/pe/lim/limProcessMessageQueue.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011-2017 The Linux Foundation. All rights reserved. + * Copyright (c) 2011-2018 The Linux Foundation. All rights reserved. * * Previously licensed under the ISC license by Qualcomm Atheros, Inc. * @@ -1332,6 +1332,7 @@ limProcessMessages(tpAniSirGlobal pMac, tpSirMsgQ limMsg) if( !VOS_IS_STATUS_SUCCESS(vosStatus) ) { + lim_decrement_pending_mgmt_count(pMac); vos_pkt_return_packet(pVosPkt); break; @@ -1358,6 +1359,7 @@ limProcessMessages(tpAniSirGlobal pMac, tpSirMsgQ limMsg) limMsg->type, pMac->lim.gLimSmeState, pMac->lim.gLimPrevSmeState, pMac->lim.gLimSystemRole, pMac->lim.gLimMlmState, pMac->lim.gLimPrevMlmState);) limLogSessionStates(pMac); + lim_decrement_pending_mgmt_count(pMac); vos_pkt_return_packet(pVosPkt); } } @@ -1367,6 +1369,7 @@ limProcessMessages(tpAniSirGlobal pMac, tpSirMsgQ limMsg) * Asumption here is when Rx mgmt frame processing is done, * voss packet could be freed here. */ + lim_decrement_pending_mgmt_count(pMac); vos_pkt_return_packet(pVosPkt); } } diff --git a/CORE/MAC/src/pe/lim/limUtils.c b/CORE/MAC/src/pe/lim/limUtils.c index 5f24b26f14cf..0877b3df505c 100644 --- a/CORE/MAC/src/pe/lim/limUtils.c +++ b/CORE/MAC/src/pe/lim/limUtils.c @@ -6205,6 +6205,7 @@ void limHandleDeferMsgError(tpAniSirGlobal pMac, tpSirMsgQ pLimMsg) { if(SIR_BB_XPORT_MGMT_MSG == pLimMsg->type) { + lim_decrement_pending_mgmt_count(pMac); vos_pkt_return_packet((vos_pkt_t*)pLimMsg->bodyptr); pLimMsg->bodyptr = NULL; } @@ -8237,3 +8238,16 @@ bool lim_check_if_vendor_oui_match(tpAniSirGlobal mac_ctx, else return false; } + +void lim_decrement_pending_mgmt_count(tpAniSirGlobal mac_ctx) +{ + adf_os_spin_lock(&mac_ctx->sys.bbt_mgmt_lock); + if (!mac_ctx->sys.sys_bbt_pending_mgmt_count) { + adf_os_spin_unlock(&mac_ctx->sys.bbt_mgmt_lock); + limLog(mac_ctx, LOGW, + FL("sys_bbt_pending_mgmt_count value is 0")); + return; + } + mac_ctx->sys.sys_bbt_pending_mgmt_count--; + adf_os_spin_unlock(&mac_ctx->sys.bbt_mgmt_lock); +} diff --git a/CORE/MAC/src/pe/lim/limUtils.h b/CORE/MAC/src/pe/lim/limUtils.h index e36c9132edeb..0965d91e3dce 100644 --- a/CORE/MAC/src/pe/lim/limUtils.h +++ b/CORE/MAC/src/pe/lim/limUtils.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012-2017 The Linux Foundation. All rights reserved. + * Copyright (c) 2012-2018 The Linux Foundation. All rights reserved. * * Previously licensed under the ISC license by Qualcomm Atheros, Inc. * @@ -80,6 +80,8 @@ typedef struct sAddBaCandidate tAddBaInfo baInfo[STACFG_MAX_TC]; }tAddBaCandidate, *tpAddBaCandidate; +#define MGMT_RX_PACKETS_THRESHOLD 200 + #ifdef WLAN_FEATURE_11W typedef union uPmfSaQueryTimerId { @@ -651,4 +653,16 @@ void lim_send_chan_switch_action_frame(tpAniSirGlobal mac_ctx, bool lim_check_if_vendor_oui_match(tpAniSirGlobal mac_ctx, uint8_t *oui, uint8_t oui_len, uint8_t *ie, uint8_t ie_len); + +/** + * lim_decrement_pending_mgmt_count: Decrement mgmt frame count + * @mac_ctx: Pointer to global MAC structure + * + * This function is used to decrement pe mgmt count once frame + * removed from queue + * + * Return: None + */ +void lim_decrement_pending_mgmt_count(tpAniSirGlobal mac_ctx); + #endif /* __LIM_UTILS_H */ |
