From 0d545e358e57382436d0436de30bdffc93689cee Mon Sep 17 00:00:00 2001 From: "Edhar, Mahesh Kumar" Date: Thu, 26 Nov 2015 17:59:29 +0530 Subject: [PATCH] MAC: synchronize PE and HDD initiated disconnects PE generated disassoc request is not serialized in SME queue. This results in corrupting 'lim.limDisassocDeauthCnfReq.pMlmDisassocReq' which is a global context to save disassoc request. Address the above by indicating all the PE generated disassoc requests to SME and process disconnection request only after receiving eWNI_SME_DISASSOC_CNF from SME(similar to that of processing disassoc request from peer). Change-Id: I2b93925ba64c4d9ff22b071dd2e5c7681be59e15 CRs-Fixed: 934183 (cherry picked from commit 03cf7ff1db9f7ec73b1b0dff42d05e943113f64f) [FP2: re-apply https://github.com/LineageOS/android_kernel_huawei_msm8916/commit/71b1c1ed51d3d9b79773e7027ff8fb8e0e406e9d] --- .../prima/CORE/MAC/src/pe/lim/limAssocUtils.c | 16 +-- .../MAC/src/pe/lim/limLinkMonitoringAlgo.c | 106 +++++------------- .../MAC/src/pe/lim/limProcessMlmReqMessages.c | 21 +--- .../MAC/src/pe/lim/limProcessSmeReqMessages.c | 11 +- 4 files changed, 45 insertions(+), 109 deletions(-) diff --git a/drivers/staging/prima/CORE/MAC/src/pe/lim/limAssocUtils.c b/drivers/staging/prima/CORE/MAC/src/pe/lim/limAssocUtils.c index 787d1b1a9e7..93cf853bbdc 100644 --- a/drivers/staging/prima/CORE/MAC/src/pe/lim/limAssocUtils.c +++ b/drivers/staging/prima/CORE/MAC/src/pe/lim/limAssocUtils.c @@ -823,15 +823,19 @@ limSendDelStaCnf(tpAniSirGlobal pMac, tSirMacAddr staDsAddr, psessionEntry->limAID = 0; - + } else if ( + (mlmStaContext.cleanupTrigger == eLIM_LINK_MONITORING_DISASSOC) || + (mlmStaContext.cleanupTrigger == eLIM_LINK_MONITORING_DEAUTH)) { + /* only for non-STA cases PE/SME is serialized */ + return; } if ((mlmStaContext.cleanupTrigger == eLIM_HOST_DISASSOC) || (mlmStaContext.cleanupTrigger == - eLIM_LINK_MONITORING_DISASSOC) || + eLIM_PROMISCUOUS_MODE_DISASSOC) || (mlmStaContext.cleanupTrigger == - eLIM_PROMISCUOUS_MODE_DISASSOC)) + eLIM_LINK_MONITORING_DISASSOC)) { /** * Host or LMM driven Disassociation. @@ -854,10 +858,8 @@ limSendDelStaCnf(tpAniSirGlobal pMac, tSirMacAddr staDsAddr, LIM_MLM_DISASSOC_CNF, (tANI_U32 *) &mlmDisassocCnf); } - else if ((mlmStaContext.cleanupTrigger == - eLIM_HOST_DEAUTH) || - (mlmStaContext.cleanupTrigger == - eLIM_LINK_MONITORING_DEAUTH)) + else if ((mlmStaContext.cleanupTrigger == eLIM_HOST_DEAUTH) || + (mlmStaContext.cleanupTrigger == eLIM_LINK_MONITORING_DEAUTH)) { /** * Host or LMM driven Deauthentication. diff --git a/drivers/staging/prima/CORE/MAC/src/pe/lim/limLinkMonitoringAlgo.c b/drivers/staging/prima/CORE/MAC/src/pe/lim/limLinkMonitoringAlgo.c index 25fc44bdbac..7d15c142145 100644 --- a/drivers/staging/prima/CORE/MAC/src/pe/lim/limLinkMonitoringAlgo.c +++ b/drivers/staging/prima/CORE/MAC/src/pe/lim/limLinkMonitoringAlgo.c @@ -166,7 +166,12 @@ limDeleteStaContext(tpAniSirGlobal pMac, tpSirMsgQ limMsg) return; } else + { + limSendDisassocMgmtFrame(pMac, + eSIR_MAC_DISASSOC_DUE_TO_INACTIVITY_REASON, + pStaDs->staAddr, psessionEntry, FALSE); limTriggerSTAdeletion(pMac, pStaDs, psessionEntry); + } } else { @@ -290,93 +295,40 @@ limDeleteStaContext(tpAniSirGlobal pMac, tpSirMsgQ limMsg) void limTriggerSTAdeletion(tpAniSirGlobal pMac, tpDphHashNode pStaDs, tpPESession psessionEntry) { - tSirSmeDeauthReq *pSmeDeauthReq; - tANI_U8 *pBuf; - tANI_U8 *pLen; - tANI_U16 msgLength = 0; + tLimMlmDisassocInd mlmDisassocInd; - if (! pStaDs) - { - PELOGW(limLog(pMac, LOGW, FL("Skip STA deletion (invalid STA)"));) - return; - } - if (pStaDs->sta_deletion_in_progress) { + if (!pStaDs) + { + PELOGW(limLog(pMac, LOGW, FL("Skip STA deletion (invalid STA)"));) + return; + } + + if ((pStaDs->mlmStaContext.mlmState == eLIM_MLM_WT_DEL_STA_RSP_STATE) || + (pStaDs->mlmStaContext.mlmState == eLIM_MLM_WT_DEL_BSS_RSP_STATE)|| + pStaDs->sta_deletion_in_progress) { /* Already in the process of deleting context for the peer */ limLog(pMac, LOG1, - FL("Deletion is in progress (%d) for peer:%pK in mlmState %d"), + FL("Deletion is in progress (%d) for peer:%p in mlmState %d"), pStaDs->sta_deletion_in_progress, pStaDs->staAddr, pStaDs->mlmStaContext.mlmState); return; } pStaDs->sta_deletion_in_progress = true; + pStaDs->mlmStaContext.disassocReason = + eSIR_MAC_DISASSOC_DUE_TO_INACTIVITY_REASON; + pStaDs->mlmStaContext.cleanupTrigger = eLIM_LINK_MONITORING_DISASSOC; + vos_mem_copy(&mlmDisassocInd.peerMacAddr, pStaDs->staAddr, + sizeof(tSirMacAddr)); + mlmDisassocInd.reasonCode = eSIR_MAC_DISASSOC_DUE_TO_INACTIVITY_REASON; + mlmDisassocInd.disassocTrigger = eLIM_LINK_MONITORING_DISASSOC; - /** - * MAC based Authentication was used. Trigger - * Deauthentication frame to peer since it will - * take care of disassociation as well. - */ - - pSmeDeauthReq = vos_mem_malloc(sizeof(tSirSmeDeauthReq)); - if (NULL == pSmeDeauthReq) - { - limLog(pMac, LOGP, FL("AllocateMemory failed for eWNI_SME_DEAUTH_REQ ")); - return; - } - - pBuf = (tANI_U8 *) &pSmeDeauthReq->messageType; - - //messageType - limCopyU16((tANI_U8*)pBuf, eWNI_SME_DISASSOC_REQ); - pBuf += sizeof(tANI_U16); - msgLength += sizeof(tANI_U16); - - //length - pLen = pBuf; - pBuf += sizeof(tANI_U16); - msgLength += sizeof(tANI_U16); - - //sessionId - *pBuf = psessionEntry->smeSessionId; - pBuf++; - msgLength++; - - //transactionId - limCopyU16((tANI_U8*)pBuf, psessionEntry->transactionId); - pBuf += sizeof(tANI_U16); - msgLength += sizeof(tANI_U16); - - //bssId - vos_mem_copy(pBuf, psessionEntry->bssId, sizeof(tSirMacAddr)); - pBuf += sizeof(tSirMacAddr); - msgLength += sizeof(tSirMacAddr); - - //peerMacAddr - vos_mem_copy(pBuf, pStaDs->staAddr, sizeof(tSirMacAddr)); - pBuf += sizeof(tSirMacAddr); - msgLength += sizeof(tSirMacAddr); - - //reasonCode - limCopyU16((tANI_U8*)pBuf, - (tANI_U16)eSIR_MAC_DISASSOC_DUE_TO_INACTIVITY_REASON); - pBuf += sizeof(tANI_U16); - msgLength += sizeof(tANI_U16); - - //Do not send disassoc OTA - //pBuf[0] = 1 means do not send the disassoc frame over the air - //pBuf[0] = 0 means send the disassoc frame over the air - pBuf[0]= 0; - pBuf += sizeof(tANI_U8); - msgLength += sizeof(tANI_U8); - - - - //Fill in length - limCopyU16((tANI_U8*)pLen , msgLength); - - limPostSmeMessage(pMac, eWNI_SME_DISASSOC_REQ, (tANI_U32 *) pSmeDeauthReq); - vos_mem_free(pSmeDeauthReq); - + /* Update PE session Id */ + mlmDisassocInd.sessionId = psessionEntry->peSessionId; + limPostSmeMessage(pMac, LIM_MLM_DISASSOC_IND, + (tANI_U32 *) &mlmDisassocInd); + // Issue Disassoc Indication to SME. + limSendSmeDisassocInd(pMac, pStaDs, psessionEntry); } /*** end limTriggerSTAdeletion() ***/ diff --git a/drivers/staging/prima/CORE/MAC/src/pe/lim/limProcessMlmReqMessages.c b/drivers/staging/prima/CORE/MAC/src/pe/lim/limProcessMlmReqMessages.c index 0a61d6886f7..c913fa6f1cc 100644 --- a/drivers/staging/prima/CORE/MAC/src/pe/lim/limProcessMlmReqMessages.c +++ b/drivers/staging/prima/CORE/MAC/src/pe/lim/limProcessMlmReqMessages.c @@ -3000,28 +3000,17 @@ limProcessMlmDisassocReqNtf(tpAniSirGlobal pMac, eHalStatus suspendStatus, tANI_ if (sendDisassocFrame && (pMlmDisassocReq->reasonCode != eSIR_MAC_DISASSOC_DUE_TO_FTHANDOFF_REASON)) { pMac->lim.limDisassocDeauthCnfReq.pMlmDisassocReq = pMlmDisassocReq; - - - /* If the reason for disassociation is inactivity of STA, then - dont wait for acknowledgement. Also, if FW_IN_TX_PATH feature - is enabled do not wait for ACK */ - if (((pMlmDisassocReq->reasonCode == eSIR_MAC_DISASSOC_DUE_TO_INACTIVITY_REASON) && - (psessionEntry->limSystemRole == eLIM_AP_ROLE)) || - IS_FW_IN_TX_PATH_FEATURE_ENABLE ) + if (IS_FW_IN_TX_PATH_FEATURE_ENABLE) { - - limSendDisassocMgmtFrame(pMac, - pMlmDisassocReq->reasonCode, + limSendDisassocMgmtFrame(pMac, pMlmDisassocReq->reasonCode, pMlmDisassocReq->peerMacAddr, psessionEntry, FALSE); - - /* Send Disassoc CNF and receive path cleanup */ - limSendDisassocCnf(pMac); + /* Send Disassoc CNF and receive path cleanup */ + limSendDisassocCnf(pMac); } else { - limSendDisassocMgmtFrame(pMac, - pMlmDisassocReq->reasonCode, + limSendDisassocMgmtFrame(pMac, pMlmDisassocReq->reasonCode, pMlmDisassocReq->peerMacAddr, psessionEntry, TRUE); } diff --git a/drivers/staging/prima/CORE/MAC/src/pe/lim/limProcessSmeReqMessages.c b/drivers/staging/prima/CORE/MAC/src/pe/lim/limProcessSmeReqMessages.c index f0d9c7e8c4f..34f945fc8e4 100644 --- a/drivers/staging/prima/CORE/MAC/src/pe/lim/limProcessSmeReqMessages.c +++ b/drivers/staging/prima/CORE/MAC/src/pe/lim/limProcessSmeReqMessages.c @@ -2703,15 +2703,8 @@ __limProcessSmeDisassocReq(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf) goto sendDisassoc; } // end switch (pMac->lim.gLimSystemRole) - if (smeDisassocReq.reasonCode == eSIR_MAC_DISASSOC_DUE_TO_INACTIVITY_REASON) - { - /// Disassociation is triggered by Link Monitoring - limLog(pMac, LOG1, FL("Sending Disasscoc with reason Link Monitoring")); - disassocTrigger = eLIM_LINK_MONITORING_DISASSOC; - } - else - disassocTrigger = eLIM_HOST_DISASSOC; - reasonCode = smeDisassocReq.reasonCode; + disassocTrigger = eLIM_HOST_DISASSOC; + reasonCode = smeDisassocReq.reasonCode; if (smeDisassocReq.doNotSendOverTheAir) {