Parcourir la source

qcacld-3.0: synchronize PE and HDD initiated disconnects

qcacld-2.0 to qcacld-3.0 propagation

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
Edhar, Mahesh Kumar il y a 9 ans
Parent
commit
e3c8d35f4a

+ 15 - 7
core/mac/src/pe/lim/lim_assoc_utils.c

@@ -742,13 +742,21 @@ lim_send_del_sta_cnf(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) ||
-	    (mlmStaContext.cleanupTrigger == eLIM_PROMISCUOUS_MODE_DISASSOC)) {
+					eLIM_HOST_DISASSOC) ||
+		(mlmStaContext.cleanupTrigger ==
+					eLIM_LINK_MONITORING_DISASSOC) ||
+		(mlmStaContext.cleanupTrigger ==
+					eLIM_PROMISCUOUS_MODE_DISASSOC)) {
 		/**
 		 * Host or LMM driven Disassociation.
 		 * Issue Disassoc Confirm to SME.
@@ -768,9 +776,9 @@ lim_send_del_sta_cnf(tpAniSirGlobal pMac, tSirMacAddr staDsAddr,
 				     LIM_MLM_DISASSOC_CNF,
 				     (uint32_t *) &mlmDisassocCnf);
 	} else if ((mlmStaContext.cleanupTrigger ==
-		    eLIM_HOST_DEAUTH) ||
-		   (mlmStaContext.cleanupTrigger ==
-		    eLIM_LINK_MONITORING_DEAUTH)) {
+					eLIM_HOST_DEAUTH) ||
+			(mlmStaContext.cleanupTrigger ==
+					eLIM_LINK_MONITORING_DEAUTH)) {
 		/**
 		 * Host or LMM driven Deauthentication.
 		 * Issue Deauth Confirm to SME.

+ 37 - 84
core/mac/src/pe/lim/lim_link_monitoring_algo.c

@@ -127,6 +127,9 @@ static void lim_delete_sta_util(tpAniSirGlobal mac_ctx, tpDeleteStaContext msg,
 			cdf_mem_free(msg);
 			return;
 		} else {
+			lim_send_disassoc_mgmt_frame(mac_ctx,
+				eSIR_MAC_DISASSOC_DUE_TO_INACTIVITY_REASON,
+				stads->staAddr, session_entry, false);
 			lim_trigger_sta_deletion(mac_ctx, stads, session_entry);
 		}
 	} else {
@@ -252,101 +255,51 @@ void lim_delete_sta_context(tpAniSirGlobal mac_ctx, tpSirMsgQ lim_msg)
 }
 
 /**
- * lim_trigger_sta_deletion()
+ * lim_trigger_sta_deletion() -
+ *          This function is called to trigger STA context deletion.
  *
- ***FUNCTION:
- * This function is called to trigger STA context deletion
- *
- ***LOGIC:
- *
- ***ASSUMPTIONS:
- *
- ***NOTE:
- * NA
- *
- * @param  pMac   - Pointer to global MAC structure
- * @param  pStaDs - Pointer to internal STA Datastructure
+ * @param  mac_ctx   - Pointer to global MAC structure
+ * @param  sta_ds - Pointer to internal STA Datastructure
+ * @session_entry: PE session entry
+
  * @return None
  */
 void
-lim_trigger_sta_deletion(tpAniSirGlobal pMac, tpDphHashNode pStaDs,
-			 tpPESession psessionEntry)
+lim_trigger_sta_deletion(tpAniSirGlobal mac_ctx, tpDphHashNode sta_ds,
+			 tpPESession session_entry)
 {
-	tSirSmeDeauthReq *pSmeDeauthReq;
-	uint8_t *pBuf;
-	uint8_t *pLen;
-	uint16_t msgLength = 0;
-
-	if (!pStaDs) {
-		PELOGW(lim_log
-			       (pMac, LOGW, FL("Skip STA deletion (invalid STA)"));
-		       )
+	tLimMlmDisassocInd mlm_disassoc_ind;
+
+	if (!sta_ds) {
+		lim_log(mac_ctx, LOGW, FL("Skip STA deletion (invalid STA)"));
 		return;
 	}
-	/**
-	 * MAC based Authentication was used. Trigger
-	 * Deauthentication frame to peer since it will
-	 * take care of disassociation as well.
-	 */
 
-	pSmeDeauthReq = cdf_mem_malloc(sizeof(tSirSmeDeauthReq));
-	if (NULL == pSmeDeauthReq) {
-		lim_log(pMac, LOGP,
-			FL("AllocateMemory failed for eWNI_SME_DEAUTH_REQ "));
+	if ((sta_ds->mlmStaContext.mlmState == eLIM_MLM_WT_DEL_STA_RSP_STATE) ||
+		(sta_ds->mlmStaContext.mlmState ==
+			eLIM_MLM_WT_DEL_BSS_RSP_STATE)) {
+		/* Already in the process of deleting context for the peer */
+		lim_log(mac_ctx, LOGE,
+			FL("Deletion is in progress for peer:%pM"),
+			sta_ds->staAddr);
 		return;
 	}
 
-	pBuf = (uint8_t *) &pSmeDeauthReq->messageType;
-
-	/* messageType */
-	lim_copy_u16((uint8_t *) pBuf, eWNI_SME_DISASSOC_REQ);
-	pBuf += sizeof(uint16_t);
-	msgLength += sizeof(uint16_t);
-
-	/* length */
-	pLen = pBuf;
-	pBuf += sizeof(uint16_t);
-	msgLength += sizeof(uint16_t);
-
-	/* sessionId */
-	*pBuf = psessionEntry->smeSessionId;
-	pBuf++;
-	msgLength++;
-
-	/* transactionId */
-	lim_copy_u16((uint8_t *) pBuf, psessionEntry->transactionId);
-	pBuf += sizeof(uint16_t);
-	msgLength += sizeof(uint16_t);
-
-	/* bssId */
-	cdf_mem_copy(pBuf, psessionEntry->bssId, sizeof(tSirMacAddr));
-	pBuf += sizeof(tSirMacAddr);
-	msgLength += sizeof(tSirMacAddr);
-
-	/* peerMacAddr */
-	cdf_mem_copy(pBuf, pStaDs->staAddr, sizeof(tSirMacAddr));
-	pBuf += sizeof(tSirMacAddr);
-	msgLength += sizeof(tSirMacAddr);
-
-	/* reasonCode */
-	lim_copy_u16((uint8_t *) pBuf, (uint16_t) eLIM_LINK_MONITORING_DISASSOC);
-	pBuf += sizeof(uint16_t);
-	msgLength += sizeof(uint16_t);
-
-	/* 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(uint8_t);
-	msgLength += sizeof(uint8_t);
-
-	/* Fill in length */
-	lim_copy_u16((uint8_t *) pLen, msgLength);
-
-	lim_post_sme_message(pMac, eWNI_SME_DISASSOC_REQ,
-			     (uint32_t *) pSmeDeauthReq);
-	cdf_mem_free(pSmeDeauthReq);
-
+	sta_ds->mlmStaContext.disassocReason =
+		eSIR_MAC_DISASSOC_DUE_TO_INACTIVITY_REASON;
+	sta_ds->mlmStaContext.cleanupTrigger = eLIM_LINK_MONITORING_DISASSOC;
+	cdf_mem_copy(&mlm_disassoc_ind.peerMacAddr, sta_ds->staAddr,
+		sizeof(tSirMacAddr));
+	mlm_disassoc_ind.reasonCode =
+		eSIR_MAC_DISASSOC_DUE_TO_INACTIVITY_REASON;
+	mlm_disassoc_ind.disassocTrigger = eLIM_LINK_MONITORING_DISASSOC;
+
+	/* Update PE session Id */
+	mlm_disassoc_ind.sessionId = session_entry->peSessionId;
+	lim_post_sme_message(mac_ctx, LIM_MLM_DISASSOC_IND,
+			(uint32_t *) &mlm_disassoc_ind);
+	/* Issue Disassoc Indication to SME */
+	lim_send_sme_disassoc_ind(mac_ctx, sta_ds, session_entry);
 } /*** end lim_trigger_st_adeletion() ***/
 
 /**

+ 7 - 22
core/mac/src/pe/lim/lim_process_mlm_req_messages.c

@@ -1711,30 +1711,15 @@ lim_process_mlm_disassoc_req_ntf(tpAniSirGlobal mac_ctx,
 		 */
 		stads->mlmStaContext.mlmState = eLIM_MLM_WT_DEL_STA_RSP_STATE;
 
+		lim_send_disassoc_mgmt_frame(mac_ctx,
+			mlm_disassocreq->reasonCode,
+			mlm_disassocreq->peerMacAddr, session, true);
 		/*
-		 * If the reason for disassociation is inactivity of STA, then
-		 * dont wait for acknowledgement
+		 * Abort Tx so that data frames won't be sent to the AP
+		 * after sending Disassoc.
 		 */
-		if ((mlm_disassocreq->reasonCode ==
-		    eSIR_MAC_DISASSOC_DUE_TO_INACTIVITY_REASON) &&
-		    LIM_IS_AP_ROLE(session)) {
-			lim_send_disassoc_mgmt_frame(mac_ctx,
-				mlm_disassocreq->reasonCode,
-				mlm_disassocreq->peerMacAddr, session, false);
-
-			/* Send Disassoc CNF and receive path cleanup */
-			lim_send_disassoc_cnf(mac_ctx);
-		} else {
-			lim_send_disassoc_mgmt_frame(mac_ctx,
-				mlm_disassocreq->reasonCode,
-				mlm_disassocreq->peerMacAddr, session, true);
-			/*
-			 * Abort Tx so that data frames won't be sent to the AP
-			 * after sending Disassoc.
-			 */
-			if (LIM_IS_STA_ROLE(session))
-				wma_tx_abort(session->smeSessionId);
-		}
+		if (LIM_IS_STA_ROLE(session))
+			wma_tx_abort(session->smeSessionId);
 	} else {
 		/* Disassoc frame is not sent OTA */
 		send_disassoc_frame = 1;

+ 2 - 10
core/mac/src/pe/lim/lim_process_sme_req_messages.c

@@ -2591,16 +2591,8 @@ static void __lim_process_sme_disassoc_req(tpAniSirGlobal pMac, uint32_t *pMsgBu
 		goto sendDisassoc;
 	} /* end switch (pMac->lim.gLimSystemRole) */
 
-	if (smeDisassocReq.reasonCode == eLIM_LINK_MONITORING_DISASSOC) {
-		/* / Disassociation is triggered by Link Monitoring */
-		lim_log(pMac, LOG1,
-			FL("Sending Disasscoc with reason Link Monitoring"));
-		disassocTrigger = eLIM_LINK_MONITORING_DISASSOC;
-		reasonCode = eSIR_MAC_DISASSOC_DUE_TO_INACTIVITY_REASON;
-	} else {
-		disassocTrigger = eLIM_HOST_DISASSOC;
-		reasonCode = smeDisassocReq.reasonCode;
-	}
+	disassocTrigger = eLIM_HOST_DISASSOC;
+	reasonCode = smeDisassocReq.reasonCode;
 
 	if (smeDisassocReq.doNotSendOverTheAir) {
 		lim_log(pMac, LOG1, FL("do not send dissoc over the air"));