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]
This commit is contained in:
Edhar, Mahesh Kumar
2021-10-10 23:46:47 +02:00
committed by Francescodario Cuzzocrea
parent c623a40841
commit 0d545e358e
4 changed files with 45 additions and 109 deletions
@@ -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.
@@ -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() ***/
@@ -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);
}
@@ -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)
{