Browse Source

qcacld-3.0: Create wrapper API for sme pending & active nonscan cmds

To make convergence easier, create wrapper API to process active and
pending queue operations for non-scan cmd list.

Change-Id: Ie62a2c23b797c5f4011c11879e1ef00b705d7586
CRs-Fixed: 2005532
Krunal Soni 8 years ago
parent
commit
72dba66ab3

+ 30 - 0
core/sme/inc/csr_internal.h

@@ -1405,6 +1405,36 @@ void csr_nonscan_pending_ll_unlock(struct sAniSirGlobal *mac_ctx);
 void csr_nonscan_active_ll_unlock(struct sAniSirGlobal *mac_ctx);
 void csr_nonscan_pending_ll_lock(struct sAniSirGlobal *mac_ctx);
 void csr_nonscan_active_ll_lock(struct sAniSirGlobal *mac_ctx);
+bool csr_nonscan_active_ll_is_list_empty(struct sAniSirGlobal *mac_ctx,
+			bool fInterlocked);
+bool csr_nonscan_pending_ll_is_list_empty(struct sAniSirGlobal *mac_ctx,
+			bool fInterlocked);
+bool csr_nonscan_active_ll_remove_entry(struct sAniSirGlobal *mac_ctx,
+			tListElem *pEntryToRemove, bool fInterlocked);
+bool csr_nonscan_pending_ll_remove_entry(struct sAniSirGlobal *mac_ctx,
+			tListElem *pEntryToRemove, bool fInterlocked);
+tListElem *csr_nonscan_active_ll_peak_head(struct sAniSirGlobal *mac_ctx,
+			bool fInterlocked);
+tListElem *csr_nonscan_pending_ll_peak_head(struct sAniSirGlobal *mac_ctx,
+			bool fInterlocked);
+tListElem *csr_nonscan_active_ll_remove_head(struct sAniSirGlobal *mac_ctx,
+			bool fInterlocked);
+tListElem *csr_nonscan_pending_ll_remove_head(struct sAniSirGlobal *mac_ctx,
+			bool fInterlocked);
+uint32_t csr_nonscan_pending_ll_count(struct sAniSirGlobal *mac_ctx);
+void csr_nonscan_pending_ll_insert_head(struct sAniSirGlobal *mac_ctx,
+		tListElem *entry, bool fInterlocked);
+void csr_nonscan_pending_ll_insert_tail(struct sAniSirGlobal *mac_ctx,
+		tListElem *entry, bool fInterlocked);
+uint32_t csr_nonscan_active_ll_count(struct sAniSirGlobal *mac_ctx);
+void csr_nonscan_active_ll_insert_head(struct sAniSirGlobal *mac_ctx,
+		tListElem *entry, bool fInterlocked);
+tListElem *csr_nonscan_pending_ll_next(struct sAniSirGlobal *mac_ctx,
+		tListElem *entry, bool fInterlocked);
+void purge_sme_session_pending_cmd_list(struct sAniSirGlobal *mac_ctx,
+		uint32_t session_id);
+void purge_sme_session_active_cmd_list(struct sAniSirGlobal *mac_ctx,
+		uint32_t session_id);
 
 bool csr_wait_for_connection_update(tpAniSirGlobal mac,
 		bool do_release_reacquire_lock);

+ 46 - 60
core/sme/src/common/sme_api.c

@@ -154,8 +154,7 @@ static QDF_STATUS sme_process_set_hw_mode_resp(tpAniSirGlobal mac, uint8_t *msg)
 		 */
 	}
 
-	entry = csr_ll_peek_head(&mac->sme.smeCmdActiveList,
-			LL_ACCESS_LOCK);
+	entry = csr_nonscan_active_ll_peak_head(mac, LL_ACCESS_LOCK);
 	if (!entry) {
 		sms_log(mac, LOGE, FL("No cmd found in active list"));
 		return QDF_STATUS_E_FAILURE;
@@ -241,7 +240,7 @@ static QDF_STATUS sme_process_set_hw_mode_resp(tpAniSirGlobal mac, uint8_t *msg)
 	}
 
 end:
-	found = csr_ll_remove_entry(&mac->sme.smeCmdActiveList, entry,
+	found = csr_nonscan_active_ll_remove_entry(mac, entry,
 			LL_ACCESS_LOCK);
 	if (found) {
 		/* Now put this command back on the avilable command list */
@@ -544,8 +543,7 @@ tSmeCmd *sme_get_command_buffer(tpAniSirGlobal pMac)
 		int idx = 1;
 
 		/* Cannot change pRetCmd here since it needs to return later. */
-		pEntry =
-			csr_ll_peek_head(&pMac->sme.smeCmdActiveList, LL_ACCESS_LOCK);
+		pEntry = csr_nonscan_active_ll_peak_head(pMac, LL_ACCESS_LOCK);
 		if (pEntry) {
 			pTempCmd = GET_BASE_ADDR(pEntry, tSmeCmd, Link);
 		}
@@ -562,7 +560,7 @@ tSmeCmd *sme_get_command_buffer(tpAniSirGlobal pMac)
 		/* dump what is in the pending queue */
 		csr_nonscan_pending_ll_lock(pMac);
 		pEntry =
-			csr_ll_peek_head(&pMac->sme.smeCmdPendingList,
+			csr_nonscan_pending_ll_peak_head(pMac,
 					 LL_ACCESS_NOLOCK);
 		while (pEntry && !sme_command_queue_full) {
 			pTempCmd = GET_BASE_ADDR(pEntry, tSmeCmd, Link);
@@ -576,8 +574,7 @@ tSmeCmd *sme_get_command_buffer(tpAniSirGlobal pMac)
 				/* CSR command is stuck. See what the reason code is for that command */
 				dump_csr_command_info(pMac, pTempCmd);
 			}
-			pEntry =
-				csr_ll_next(&pMac->sme.smeCmdPendingList, pEntry,
+			pEntry = csr_nonscan_pending_ll_next(pMac, pEntry,
 					    LL_ACCESS_NOLOCK);
 		}
 		csr_nonscan_pending_ll_unlock(pMac);
@@ -615,10 +612,10 @@ void sme_push_command(tpAniSirGlobal pMac, tSmeCmd *pCmd, bool fHighPriority)
 	}
 
 	if (fHighPriority) {
-		csr_ll_insert_head(&pMac->sme.smeCmdPendingList, &pCmd->Link,
+		csr_nonscan_pending_ll_insert_head(pMac, &pCmd->Link,
 				   LL_ACCESS_LOCK);
 	} else {
-		csr_ll_insert_tail(&pMac->sme.smeCmdPendingList, &pCmd->Link,
+		csr_nonscan_pending_ll_insert_tail(pMac, &pCmd->Link,
 				   LL_ACCESS_LOCK);
 	}
 
@@ -663,15 +660,15 @@ static void sme_abort_command(tpAniSirGlobal pMac, tSmeCmd *pCommand,
 }
 
 static
-tListElem *csr_get_cmd_to_process(tpAniSirGlobal pMac, tDblLinkList *pList,
-				  uint8_t sessionId, bool fInterlocked)
+tListElem *csr_get_pending_cmd_to_process(tpAniSirGlobal pMac,
+				uint8_t sessionId, bool fInterlocked)
 {
 	tListElem *pCurEntry = NULL;
 	tSmeCmd *pCommand;
 
 	/* Go through the list and return the command whose session id is not
 	 * matching with the current ongoing scan cmd sessionId */
-	pCurEntry = csr_ll_peek_head(pList, LL_ACCESS_LOCK);
+	pCurEntry = csr_nonscan_pending_ll_peak_head(pMac, LL_ACCESS_LOCK);
 	while (pCurEntry) {
 		pCommand = GET_BASE_ADDR(pCurEntry, tSmeCmd, Link);
 		if (pCommand->sessionId != sessionId) {
@@ -680,7 +677,8 @@ tListElem *csr_get_cmd_to_process(tpAniSirGlobal pMac, tDblLinkList *pList,
 			return pCurEntry;
 		}
 
-		pCurEntry = csr_ll_next(pList, pCurEntry, fInterlocked);
+		pCurEntry = csr_nonscan_pending_ll_next(pMac,
+					pCurEntry, fInterlocked);
 	}
 
 	sms_log(pMac, LOG1, "No command pending with different sessionId");
@@ -695,9 +693,9 @@ static bool sme_process_scan_queue(tpAniSirGlobal pMac)
 	tSmeCmd *pSmeCommand = NULL;
 	bool status = true;
 
-	if ((!csr_ll_is_list_empty(&pMac->sme.smeCmdActiveList,
+	if ((!csr_nonscan_active_ll_is_list_empty(pMac,
 				   LL_ACCESS_LOCK))) {
-		pSmeEntry = csr_ll_peek_head(&pMac->sme.smeCmdActiveList,
+		pSmeEntry = csr_nonscan_active_ll_peak_head(pMac,
 					LL_ACCESS_LOCK);
 		if (pSmeEntry)
 			pSmeCommand = GET_BASE_ADDR(pSmeEntry, tSmeCmd, Link);
@@ -799,14 +797,12 @@ static bool sme_process_command(tpAniSirGlobal pMac)
 	 * alwasy lock active list before locking pending list
 	 */
 	csr_nonscan_active_ll_lock(pMac);
-	if (!csr_ll_is_list_empty(&pMac->sme.smeCmdActiveList,
-				 LL_ACCESS_NOLOCK)) {
+	if (!csr_nonscan_active_ll_is_list_empty(pMac, LL_ACCESS_NOLOCK)) {
 		csr_nonscan_active_ll_unlock(pMac);
 		goto process_scan_q;
 	}
 
-	if (csr_ll_is_list_empty(&pMac->sme.smeCmdPendingList,
-				 LL_ACCESS_LOCK)) {
+	if (csr_nonscan_pending_ll_is_list_empty(pMac, LL_ACCESS_LOCK)) {
 		/* No command waiting */
 		csr_nonscan_active_ll_unlock(pMac);
 		goto process_scan_q;
@@ -824,8 +820,7 @@ static bool sme_process_command(tpAniSirGlobal pMac)
 					     LL_ACCESS_LOCK);
 		if (pSmeEntry) {
 			pSmeCommand = GET_BASE_ADDR(pSmeEntry, tSmeCmd, Link);
-			pEntry = csr_get_cmd_to_process(pMac,
-					&pMac->sme.smeCmdPendingList,
+			pEntry = csr_get_pending_cmd_to_process(pMac,
 					pSmeCommand->sessionId,
 					LL_ACCESS_LOCK);
 			goto sme_process_cmd;
@@ -833,7 +828,7 @@ static bool sme_process_command(tpAniSirGlobal pMac)
 	}
 
 	/* Peek the command */
-	pEntry = csr_ll_peek_head(&pMac->sme.smeCmdPendingList, LL_ACCESS_LOCK);
+	pEntry = csr_nonscan_pending_ll_peak_head(pMac, LL_ACCESS_LOCK);
 sme_process_cmd:
 	if (!pEntry) {
 		csr_nonscan_active_ll_unlock(pMac);
@@ -856,15 +851,15 @@ sme_process_cmd:
 		goto process_scan_q;
 	}
 
-	if (!csr_ll_remove_entry(&pMac->sme.smeCmdPendingList, pEntry,
+	if (!csr_nonscan_pending_ll_remove_entry(pMac, pEntry,
 				LL_ACCESS_LOCK)) {
 		/* This is odd. Some one else pull off the command. */
 		csr_nonscan_active_ll_unlock(pMac);
 		goto process_scan_q;
 	}
 	/* we can reuse the pCommand. Insert the command onto the ActiveList */
-	csr_ll_insert_head(&pMac->sme.smeCmdActiveList, &pCommand->Link,
-			   LL_ACCESS_NOLOCK);
+	csr_nonscan_active_ll_insert_head(pMac, &pCommand->Link,
+				LL_ACCESS_NOLOCK);
 	/* .... and process the command. */
 	MTRACE(qdf_trace(QDF_MODULE_ID_SME, TRACE_CODE_SME_COMMAND,
 			 pCommand->sessionId, pCommand->command));
@@ -878,7 +873,7 @@ sme_process_cmd:
 		csr_nonscan_active_ll_unlock(pMac);
 		status = csr_roam_process_command(pMac, pCommand);
 		if (!QDF_IS_STATUS_SUCCESS(status)
-		    && csr_ll_remove_entry(&pMac->sme.smeCmdActiveList,
+		    && csr_nonscan_active_ll_remove_entry(pMac,
 				&pCommand->Link, LL_ACCESS_LOCK))
 			csr_release_command(pMac, pCommand);
 		break;
@@ -890,7 +885,7 @@ sme_process_cmd:
 		csr_nonscan_active_ll_unlock(pMac);
 		status = csr_roam_process_set_key_command(pMac, pCommand);
 		if (!QDF_IS_STATUS_SUCCESS(status)
-		    && csr_ll_remove_entry(&pMac->sme.smeCmdActiveList,
+		    && csr_nonscan_active_ll_remove_entry(pMac,
 				&pCommand->Link, LL_ACCESS_LOCK)) {
 			csr_release_command(pMac, pCommand);
 		}
@@ -899,16 +894,15 @@ sme_process_cmd:
 		csr_nonscan_active_ll_unlock(pMac);
 		if (csr_process_ndp_initiator_request(pMac, pCommand) !=
 			QDF_STATUS_SUCCESS)
-			if (csr_ll_remove_entry(
-				&pMac->sme.smeCmdActiveList,
-				&pCommand->Link, LL_ACCESS_LOCK))
+			if (csr_nonscan_active_ll_remove_entry(
+					pMac, &pCommand->Link, LL_ACCESS_LOCK))
 				csr_release_command(pMac, pCommand);
 		break;
 	case eSmeCommandNdpResponderRequest:
 		csr_nonscan_active_ll_unlock(pMac);
 		status = csr_process_ndp_responder_request(pMac, pCommand);
 		if (status != QDF_STATUS_SUCCESS) {
-			if (csr_ll_remove_entry(&pMac->sme.smeCmdActiveList,
+			if (csr_nonscan_active_ll_remove_entry(pMac,
 					&pCommand->Link, LL_ACCESS_LOCK))
 				csr_release_command(pMac, pCommand);
 		}
@@ -917,7 +911,7 @@ sme_process_cmd:
 		csr_nonscan_active_ll_unlock(pMac);
 		status = csr_process_ndp_data_end_request(pMac, pCommand);
 		if (status != QDF_STATUS_SUCCESS) {
-			if (csr_ll_remove_entry(&pMac->sme.smeCmdActiveList,
+			if (csr_nonscan_active_ll_remove_entry(pMac,
 					&pCommand->Link, LL_ACCESS_LOCK))
 				csr_release_command(pMac, pCommand);
 		}
@@ -926,7 +920,7 @@ sme_process_cmd:
 		csr_nonscan_active_ll_unlock(pMac);
 		status = p2p_process_remain_on_channel_cmd(pMac, pCommand);
 		if (!QDF_IS_STATUS_SUCCESS(status)
-		    && csr_ll_remove_entry(&pMac->sme.smeCmdActiveList,
+		    && csr_nonscan_active_ll_remove_entry(pMac,
 				&pCommand->Link, LL_ACCESS_LOCK))
 			csr_release_command(pMac, pCommand);
 		break;
@@ -941,9 +935,8 @@ sme_process_cmd:
 		csr_nonscan_active_ll_unlock(pMac);
 #ifndef WLAN_MDM_CODE_REDUCTION_OPT
 		fContinue = qos_process_command(pMac, pCommand);
-		if (fContinue && csr_ll_remove_entry(
-			&pMac->sme.smeCmdActiveList,
-			&pCommand->Link, LL_ACCESS_NOLOCK)) {
+		if (fContinue && csr_nonscan_active_ll_remove_entry(
+			pMac, &pCommand->Link, LL_ACCESS_NOLOCK)) {
 			/* The command failed, remove it */
 			qos_release_command(pMac, pCommand);
 		}
@@ -960,8 +953,8 @@ sme_process_cmd:
 		csr_nonscan_active_ll_unlock(pMac);
 		status = csr_tdls_process_cmd(pMac, pCommand);
 		if (!QDF_IS_STATUS_SUCCESS(status)) {
-			if (csr_ll_remove_entry(&pMac->sme.smeCmdActiveList,
-						&pCommand->Link,
+			if (csr_nonscan_active_ll_remove_entry(
+					pMac, &pCommand->Link,
 						LL_ACCESS_LOCK)) {
 				qdf_mem_zero(&pCommand->u.tdlsCmd,
 					     sizeof(tTdlsCmd));
@@ -991,7 +984,7 @@ sme_process_cmd:
 		/* remove it from the active list */
 		sms_log(pMac, LOGE, FL("unknown command %d"),
 			pCommand->command);
-		pEntry = csr_ll_remove_head(&pMac->sme.smeCmdActiveList,
+		pEntry = csr_nonscan_active_ll_remove_head(pMac,
 					    LL_ACCESS_NOLOCK);
 		csr_nonscan_active_ll_unlock(pMac);
 		pCommand = GET_BASE_ADDR(pEntry, tSmeCmd, Link);
@@ -1028,7 +1021,7 @@ static uint32_t sme_get_sessionid_from_activelist(tpAniSirGlobal mac)
 	tSmeCmd *command;
 	uint32_t session_id = CSR_SESSION_ID_INVALID;
 
-	entry = csr_ll_peek_head(&mac->sme.smeCmdActiveList, LL_ACCESS_LOCK);
+	entry = csr_nonscan_active_ll_peak_head(mac, LL_ACCESS_LOCK);
 	if (entry) {
 		command = GET_BASE_ADDR(entry, tSmeCmd, Link);
 		session_id = command->sessionId;
@@ -2365,8 +2358,7 @@ static QDF_STATUS sme_process_dual_mac_config_resp(tpAniSirGlobal mac,
 		 */
 	}
 
-	entry = csr_ll_peek_head(&mac->sme.smeCmdActiveList,
-			LL_ACCESS_LOCK);
+	entry = csr_nonscan_active_ll_peak_head(mac, LL_ACCESS_LOCK);
 	if (!entry) {
 		sms_log(mac, LOGE, FL("No cmd found in active list"));
 		return QDF_STATUS_E_FAILURE;
@@ -2399,8 +2391,7 @@ static QDF_STATUS sme_process_dual_mac_config_resp(tpAniSirGlobal mac,
 		sms_log(mac, LOGE, FL("Callback does not exist"));
 	}
 
-	found = csr_ll_remove_entry(&mac->sme.smeCmdActiveList, entry,
-			LL_ACCESS_LOCK);
+	found = csr_nonscan_active_ll_remove_entry(mac, entry, LL_ACCESS_LOCK);
 	if (found)
 		/* Now put this command back on the available command list */
 		csr_release_command(mac, command);
@@ -2435,8 +2426,7 @@ static QDF_STATUS sme_process_antenna_mode_resp(tpAniSirGlobal mac,
 		 */
 	}
 
-	entry = csr_ll_peek_head(&mac->sme.smeCmdActiveList,
-			LL_ACCESS_LOCK);
+	entry = csr_nonscan_active_ll_peak_head(mac, LL_ACCESS_LOCK);
 	if (!entry) {
 		sms_log(mac, LOGE, FL("No cmd found in active list"));
 		return QDF_STATUS_E_FAILURE;
@@ -2468,8 +2458,7 @@ static QDF_STATUS sme_process_antenna_mode_resp(tpAniSirGlobal mac,
 		sms_log(mac, LOGE, FL("Callback does not exist"));
 	}
 
-	found = csr_ll_remove_entry(&mac->sme.smeCmdActiveList, entry,
-			LL_ACCESS_LOCK);
+	found = csr_nonscan_active_ll_remove_entry(mac, entry, LL_ACCESS_LOCK);
 	if (found)
 		/* Now put this command back on the available command list */
 		csr_release_command(mac, command);
@@ -3099,8 +3088,7 @@ QDF_STATUS sme_process_nss_update_resp(tpAniSirGlobal mac, uint8_t *msg)
 		 */
 	}
 
-	entry = csr_ll_peek_head(&mac->sme.smeCmdActiveList,
-			LL_ACCESS_LOCK);
+	entry = csr_nonscan_active_ll_peak_head(mac, LL_ACCESS_LOCK);
 	if (!entry) {
 		sms_log(mac, LOGE, FL("No cmd found in active list"));
 		return QDF_STATUS_E_FAILURE;
@@ -3135,8 +3123,7 @@ QDF_STATUS sme_process_nss_update_resp(tpAniSirGlobal mac, uint8_t *msg)
 		sms_log(mac, LOGE, FL("Callback does not exisit"));
 	}
 
-	found = csr_ll_remove_entry(&mac->sme.smeCmdActiveList, entry,
-			LL_ACCESS_LOCK);
+	found = csr_nonscan_active_ll_remove_entry(mac, entry, LL_ACCESS_LOCK);
 	if (found) {
 		/* Now put this command back on the avilable command list */
 		csr_release_command(mac, command);
@@ -11186,7 +11173,7 @@ void sme_get_command_q_status(tHalHandle hHal)
 		return;
 	}
 
-	pEntry = csr_ll_peek_head(&pMac->sme.smeCmdActiveList, LL_ACCESS_LOCK);
+	pEntry = csr_nonscan_active_ll_peak_head(pMac, LL_ACCESS_LOCK);
 	if (pEntry) {
 		pTempCmd = GET_BASE_ADDR(pEntry, tSmeCmd, Link);
 	}
@@ -11200,7 +11187,7 @@ void sme_get_command_q_status(tHalHandle hHal)
 	} /* if(pTempCmd) */
 
 	sms_log(pMac, LOGE, "Currently smeCmdPendingList has %d commands",
-		csr_ll_count(&pMac->sme.smeCmdPendingList));
+		csr_nonscan_pending_ll_count(pMac));
 
 	return;
 }
@@ -11833,7 +11820,7 @@ static void sme_save_active_cmd_stats(tHalHandle hHal)
 		return;
 	}
 
-	pEntry = csr_ll_peek_head(&pMac->sme.smeCmdActiveList, LL_ACCESS_LOCK);
+	pEntry = csr_nonscan_active_ll_peak_head(pMac, LL_ACCESS_LOCK);
 	if (pEntry)
 		pTempCmd = GET_BASE_ADDR(pEntry, tSmeCmd, Link);
 
@@ -11875,11 +11862,11 @@ void active_list_cmd_timeout_handle(void *userData)
 	/* Return if no cmd pending in active list as
 	 * in this case we should not be here.
 	 */
-	if (0 == csr_ll_count(&mac_ctx->sme.smeCmdActiveList))
+	if (0 == csr_nonscan_active_ll_count(mac_ctx))
 		return;
 	sms_log(mac_ctx, LOGE,
 		FL("Active List command timeout Cmd List Count %d"),
-		  csr_ll_count(&mac_ctx->sme.smeCmdActiveList));
+		  csr_nonscan_active_ll_count(mac_ctx));
 	sme_get_command_q_status(hal);
 
 	if (mac_ctx->roam.configParam.enable_fatal_event)
@@ -11891,8 +11878,7 @@ void active_list_cmd_timeout_handle(void *userData)
 	else
 		qdf_trace_dump_all(mac_ctx, 0, 0, 500, 0);
 
-	entry = csr_ll_peek_head(&mac_ctx->sme.smeCmdActiveList,
-				 LL_ACCESS_LOCK);
+	entry = csr_nonscan_active_ll_peak_head(mac_ctx, LL_ACCESS_LOCK);
 	if (entry)
 		temp_cmd = GET_BASE_ADDR(entry, tSmeCmd, Link);
 	/* Ignore if ROC took more than 120 sec */

+ 39 - 51
core/sme/src/csr/csr_api_roam.c

@@ -3199,8 +3199,9 @@ QDF_STATUS csr_init_channel_power_list(tpAniSirGlobal pMac, tCsr11dinfo *ps11din
  *
  * Return: void
  */
-static void csr_roam_remove_duplicate_cmd_from_list(tpAniSirGlobal mac_ctx,
-			uint32_t session_id, tDblLinkList *list,
+static void csr_roam_remove_duplicate_pending_cmd_from_list(
+			tpAniSirGlobal mac_ctx,
+			uint32_t session_id,
 			tSmeCmd *command, eCsrRoamReason roam_reason)
 {
 	tListElem *entry, *next_entry;
@@ -3212,10 +3213,11 @@ static void csr_roam_remove_duplicate_cmd_from_list(tpAniSirGlobal mac_ctx,
 		sms_log(mac_ctx, LOGE, FL(" failed to open list"));
 		return;
 	}
-	csr_ll_lock(list);
-	entry = csr_ll_peek_head(list, LL_ACCESS_NOLOCK);
+	csr_nonscan_pending_ll_lock(mac_ctx);
+	entry = csr_nonscan_pending_ll_peak_head(mac_ctx, LL_ACCESS_NOLOCK);
 	while (entry) {
-		next_entry = csr_ll_next(list, entry, LL_ACCESS_NOLOCK);
+		next_entry = csr_nonscan_pending_ll_next(mac_ctx, entry,
+						LL_ACCESS_NOLOCK);
 		dup_cmd = GET_BASE_ADDR(entry, tSmeCmd, Link);
 		/*
 		 * Remove the previous command if..
@@ -3250,13 +3252,14 @@ static void csr_roam_remove_duplicate_cmd_from_list(tpAniSirGlobal mac_ctx,
 			sms_log(mac_ctx, LOGW, FL("RoamReason = %d"),
 					dup_cmd->u.roamCmd.roamReason);
 			/* Remove the roam command from the pending list */
-			if (csr_ll_remove_entry(list, entry, LL_ACCESS_NOLOCK))
+			if (csr_nonscan_pending_ll_remove_entry(mac_ctx,
+						entry, LL_ACCESS_NOLOCK))
 				csr_ll_insert_tail(&local_list, entry,
 							LL_ACCESS_NOLOCK);
 		}
 		entry = next_entry;
 	}
-	csr_ll_unlock(list);
+	csr_nonscan_pending_ll_unlock(mac_ctx);
 
 	while ((entry = csr_ll_remove_head(&local_list, LL_ACCESS_NOLOCK))) {
 		dup_cmd = GET_BASE_ADDR(entry, tSmeCmd, Link);
@@ -3288,9 +3291,8 @@ void csr_roam_remove_duplicate_command(tpAniSirGlobal mac_ctx,
 {
 	/* Always lock active list before locking pending lists */
 	csr_nonscan_active_ll_lock(mac_ctx);
-	csr_roam_remove_duplicate_cmd_from_list(mac_ctx,
-		session_id, &mac_ctx->sme.smeCmdPendingList,
-		command, roam_reason);
+	csr_roam_remove_duplicate_pending_cmd_from_list(mac_ctx,
+		session_id, command, roam_reason);
 	csr_nonscan_active_ll_unlock(mac_ctx);
 }
 
@@ -4682,7 +4684,7 @@ void csr_roam_ccm_cfg_set_callback(tpAniSirGlobal pMac, int32_t result,
 					uint8_t session_id)
 {
 	tListElem *pEntry =
-		csr_ll_peek_head(&pMac->sme.smeCmdActiveList, LL_ACCESS_LOCK);
+		csr_nonscan_active_ll_peak_head(pMac, LL_ACCESS_LOCK);
 	uint32_t sessionId;
 	tSmeCmd *pCommand = NULL;
 #ifdef WLAN_FEATURE_ROAM_OFFLOAD
@@ -5774,7 +5776,7 @@ void csr_roam_complete(tpAniSirGlobal pMac, eCsrRoamCompleteResult Result,
 	bool fReleaseCommand = true;
 	QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_DEBUG,
 		  "%s: Roam Completion ...", __func__);
-	pEntry = csr_ll_peek_head(&pMac->sme.smeCmdActiveList, LL_ACCESS_LOCK);
+	pEntry = csr_nonscan_active_ll_peak_head(pMac, LL_ACCESS_LOCK);
 	if (pEntry) {
 		pCommand = GET_BASE_ADDR(pEntry, tSmeCmd, Link);
 		/* If the head of the queue is Active and it is a ROAM command, remove */
@@ -5786,9 +5788,8 @@ void csr_roam_complete(tpAniSirGlobal pMac, eCsrRoamCompleteResult Result,
 				csr_roam_process_results(pMac, pCommand, Result,
 							 Context);
 			if (fReleaseCommand) {
-				if (csr_ll_remove_entry
-					    (&pMac->sme.smeCmdActiveList, pEntry,
-					    LL_ACCESS_LOCK)) {
+				if (csr_nonscan_active_ll_remove_entry(pMac,
+						pEntry, LL_ACCESS_LOCK)) {
 					csr_release_command(pMac, pCommand);
 				} else {
 					sms_log(pMac, LOGE,
@@ -7611,7 +7612,7 @@ QDF_STATUS csr_dequeue_roam_command(tpAniSirGlobal pMac, eCsrRoamReason reason,
 {
 	tListElem *pEntry;
 	tSmeCmd *pCommand;
-	pEntry = csr_ll_peek_head(&pMac->sme.smeCmdActiveList, LL_ACCESS_LOCK);
+	pEntry = csr_nonscan_active_ll_peak_head(pMac, LL_ACCESS_LOCK);
 	if (pEntry) {
 		pCommand = GET_BASE_ADDR(pEntry, tSmeCmd, Link);
 		if ((eSmeCommandRoam == pCommand->command) &&
@@ -7619,8 +7620,7 @@ QDF_STATUS csr_dequeue_roam_command(tpAniSirGlobal pMac, eCsrRoamReason reason,
 			sms_log(pMac, LOG1, FL("DQ-Command = %d, Reason = %d"),
 				pCommand->command,
 				pCommand->u.roamCmd.roamReason);
-			if (csr_ll_remove_entry
-				    (&pMac->sme.smeCmdActiveList, pEntry,
+			if (csr_nonscan_active_ll_remove_entry(pMac, pEntry,
 				    LL_ACCESS_LOCK)) {
 				csr_release_command_preauth(pMac, pCommand);
 			}
@@ -7629,8 +7629,7 @@ QDF_STATUS csr_dequeue_roam_command(tpAniSirGlobal pMac, eCsrRoamReason reason,
 			sms_log(pMac, LOG1, FL("DQ-Command = %d, Reason = %d"),
 				pCommand->command,
 				pCommand->u.roamCmd.roamReason);
-			if (csr_ll_remove_entry
-				    (&pMac->sme.smeCmdActiveList, pEntry,
+			if (csr_nonscan_active_ll_remove_entry(pMac, pEntry,
 				    LL_ACCESS_LOCK)) {
 				csr_release_command(pMac, pCommand);
 			}
@@ -8474,9 +8473,9 @@ bool is_disconnect_pending(tpAniSirGlobal pmac,
 	bool disconnect_cmd_exist = false;
 
 	csr_nonscan_pending_ll_lock(pmac);
-	entry = csr_ll_peek_head(&pmac->sme.smeCmdPendingList, LL_ACCESS_NOLOCK);
+	entry = csr_nonscan_pending_ll_peak_head(pmac, LL_ACCESS_NOLOCK);
 	while (entry) {
-		next_entry = csr_ll_next(&pmac->sme.smeCmdPendingList,
+		next_entry = csr_nonscan_pending_ll_next(pmac,
 					entry, LL_ACCESS_NOLOCK);
 
 		command = GET_BASE_ADDR(entry, tSmeCmd, Link);
@@ -8511,7 +8510,7 @@ static void csr_roam_join_rsp_processor(tpAniSirGlobal pMac,
 		return;
 	}
 	/* The head of the active list is the request we sent */
-	pEntry = csr_ll_peek_head(&pMac->sme.smeCmdActiveList, LL_ACCESS_LOCK);
+	pEntry = csr_nonscan_active_ll_peak_head(pMac, LL_ACCESS_LOCK);
 	if (pEntry) {
 		pCommand = GET_BASE_ADDR(pEntry, tSmeCmd, Link);
 	}
@@ -8631,7 +8630,7 @@ csr_roam_reissue_roam_command(tpAniSirGlobal pMac, uint8_t session_id)
 	uint32_t sessionId;
 	tCsrRoamSession *pSession;
 
-	pEntry = csr_ll_peek_head(&pMac->sme.smeCmdActiveList, LL_ACCESS_LOCK);
+	pEntry = csr_nonscan_active_ll_peak_head(pMac, LL_ACCESS_LOCK);
 	if (NULL == pEntry) {
 		sms_log(pMac, LOGE,
 			FL("Disassoc rsp can't continue, no active CMD"));
@@ -8696,7 +8695,7 @@ bool csr_is_roam_command_waiting_for_session(tpAniSirGlobal pMac, uint32_t sessi
 	tSmeCmd *pCommand = NULL;
 	/* alwasy lock active list before locking pending list */
 	csr_nonscan_active_ll_lock(pMac);
-	pEntry = csr_ll_peek_head(&pMac->sme.smeCmdActiveList, LL_ACCESS_NOLOCK);
+	pEntry = csr_nonscan_active_ll_peak_head(pMac, LL_ACCESS_NOLOCK);
 	if (pEntry) {
 		pCommand = GET_BASE_ADDR(pEntry, tSmeCmd, Link);
 		if ((eSmeCommandRoam == pCommand->command)
@@ -8706,8 +8705,7 @@ bool csr_is_roam_command_waiting_for_session(tpAniSirGlobal pMac, uint32_t sessi
 	}
 	if (false == fRet) {
 		csr_nonscan_pending_ll_lock(pMac);
-		pEntry =
-			csr_ll_peek_head(&pMac->sme.smeCmdPendingList,
+		pEntry = csr_nonscan_pending_ll_peak_head(pMac,
 					 LL_ACCESS_NOLOCK);
 		while (pEntry) {
 			pCommand = GET_BASE_ADDR(pEntry, tSmeCmd, Link);
@@ -8716,9 +8714,8 @@ bool csr_is_roam_command_waiting_for_session(tpAniSirGlobal pMac, uint32_t sessi
 				fRet = true;
 				break;
 			}
-			pEntry =
-				csr_ll_next(&pMac->sme.smeCmdPendingList, pEntry,
-					    LL_ACCESS_NOLOCK);
+			pEntry = csr_nonscan_pending_ll_next(pMac, pEntry,
+							LL_ACCESS_NOLOCK);
 		}
 		csr_nonscan_pending_ll_unlock(pMac);
 	}
@@ -8749,7 +8746,7 @@ bool csr_is_scan_for_roam_command_active(tpAniSirGlobal pMac,
 	tSmeCmd *pCommand;
 	/* alwasy lock active list before locking pending list */
 	csr_nonscan_active_ll_lock(pMac);
-	pEntry = csr_ll_peek_head(&pMac->sme.smeCmdActiveList, LL_ACCESS_NOLOCK);
+	pEntry = csr_nonscan_active_ll_peak_head(pMac, LL_ACCESS_NOLOCK);
 	if (pEntry) {
 		pCommand = GET_BASE_ADDR(pEntry, tSmeCmd, Link);
 		if ((eSmeCommandScan == pCommand->command) &&
@@ -8766,7 +8763,7 @@ static void
 csr_roaming_state_config_cnf_processor(tpAniSirGlobal mac_ctx,
 			uint32_t result, uint8_t sme_session_id)
 {
-	tListElem *entry = csr_ll_peek_head(&mac_ctx->sme.smeCmdActiveList,
+	tListElem *entry = csr_nonscan_active_ll_peak_head(mac_ctx,
 					     LL_ACCESS_LOCK);
 	tCsrScanResult *scan_result = NULL;
 	tSirBssDescription *bss_desc = NULL;
@@ -9101,7 +9098,7 @@ csr_dequeue_command(tpAniSirGlobal mac_ctx)
 {
 	bool fRemoveCmd;
 	tSmeCmd *cmd = NULL;
-	tListElem *entry = csr_ll_peek_head(&mac_ctx->sme.smeCmdActiveList,
+	tListElem *entry = csr_nonscan_active_ll_peak_head(mac_ctx,
 					    LL_ACCESS_LOCK);
 	if (!entry) {
 		sms_log(mac_ctx, LOGE, FL("NO commands are active"));
@@ -9122,7 +9119,7 @@ csr_dequeue_command(tpAniSirGlobal mac_ctx)
 	 * list because state changes still happening insides
 	 * roamQProcessRoamResults so no other roam command should be issued.
 	 */
-	fRemoveCmd = csr_ll_remove_entry(&mac_ctx->sme.smeCmdActiveList, entry,
+	fRemoveCmd = csr_nonscan_active_ll_remove_entry(mac_ctx, entry,
 					 LL_ACCESS_LOCK);
 	if (cmd->u.roamCmd.fReleaseProfile) {
 		csr_release_profile(mac_ctx, &cmd->u.roamCmd.roamProfile);
@@ -9480,10 +9477,8 @@ void csr_roaming_state_msg_processor(tpAniSirGlobal pMac, void *pMsgBuf)
 	case eWNI_SME_DEAUTH_RSP:
 		/* or the Deauthentication response message... */
 		if (CSR_IS_ROAM_SUBSTATE_DEAUTH_REQ(pMac, pSmeRsp->sessionId)) {
-			csr_remove_cmd_from_pending_list(pMac,
+			csr_remove_nonscan_cmd_from_pending_list(pMac,
 					pSmeRsp->sessionId,
-					INVALID_SCAN_ID,
-					&pMac->sme.smeCmdPendingList,
 					eSmeCommandWmStatusChange);
 			csr_roam_roaming_state_deauth_rsp_processor(pMac,
 						(tSirSmeDeauthRsp *) pSmeRsp);
@@ -11186,8 +11181,7 @@ csr_roam_chk_lnk_set_ctx_rsp(tpAniSirGlobal mac_ctx, tSirSmeRsp *msg_ptr)
 	tListElem *entry;
 
 	qdf_mem_set(&roam_info, sizeof(roam_info), 0);
-	entry = csr_ll_peek_head(&mac_ctx->sme.smeCmdActiveList,
-				 LL_ACCESS_LOCK);
+	entry = csr_nonscan_active_ll_peak_head(mac_ctx, LL_ACCESS_LOCK);
 	if (!entry) {
 		sms_log(mac_ctx, LOGE, FL("CSR: NO commands are ACTIVE ..."));
 		goto process_pending_n_exit;
@@ -11299,7 +11293,7 @@ csr_roam_chk_lnk_set_ctx_rsp(tpAniSirGlobal mac_ctx, tSirSmeRsp *msg_ptr)
 	}
 #endif
 remove_entry_n_process_pending:
-	if (csr_ll_remove_entry(&mac_ctx->sme.smeCmdActiveList, entry,
+	if (csr_nonscan_active_ll_remove_entry(mac_ctx, entry,
 				LL_ACCESS_LOCK))
 		csr_release_command(mac_ctx, cmd);
 
@@ -11837,14 +11831,13 @@ static void csr_roam_wm_status_change_complete(tpAniSirGlobal pMac,
 {
 	tListElem *pEntry;
 	tSmeCmd *pCommand;
-	pEntry = csr_ll_peek_head(&pMac->sme.smeCmdActiveList, LL_ACCESS_LOCK);
+	pEntry = csr_nonscan_active_ll_peak_head(pMac, LL_ACCESS_LOCK);
 	if (pEntry) {
 		pCommand = GET_BASE_ADDR(pEntry, tSmeCmd, Link);
 		if (eSmeCommandWmStatusChange == pCommand->command) {
 			/* Nothing to process in a Lost Link completion....  It just kicks off a */
 			/* roaming sequence. */
-			if (csr_ll_remove_entry
-				    (&pMac->sme.smeCmdActiveList, pEntry,
+			if (csr_nonscan_active_ll_remove_entry(pMac, pEntry,
 				    LL_ACCESS_LOCK)) {
 				csr_release_command(pMac, pCommand);
 			} else {
@@ -15623,8 +15616,7 @@ void csr_cleanup_session(tpAniSirGlobal pMac, uint32_t sessionId)
 #ifdef FEATURE_WLAN_BTAMP_UT_RF
 		qdf_mc_timer_destroy(&pSession->hTimerJoinRetry);
 #endif
-		purge_sme_session_cmd_list(pMac, sessionId,
-					   &pMac->sme.smeCmdPendingList);
+		purge_sme_session_pending_cmd_list(pMac, sessionId);
 		purge_sme_session_cmd_list(pMac, sessionId,
 						   &pMac->sme.
 						   smeScanCmdPendingList);
@@ -15645,14 +15637,10 @@ QDF_STATUS csr_roam_close_session(tpAniSirGlobal pMac, uint32_t sessionId,
 		if (fSync) {
 			csr_cleanup_session(pMac, sessionId);
 		} else {
-			purge_sme_session_cmd_list(pMac, sessionId,
-						   &pMac->sme.smeCmdPendingList);
+			purge_sme_session_pending_cmd_list(pMac, sessionId);
+			purge_sme_session_active_cmd_list(pMac, sessionId);
 			purge_sme_session_cmd_list(pMac, sessionId,
 					   &pMac->sme.smeScanCmdPendingList);
-
-			purge_sme_session_cmd_list(pMac, sessionId,
-					   &pMac->sme.smeScanCmdActiveList);
-
 			status = csr_issue_del_sta_for_session_req(pMac,
 						 sessionId,
 						 pSession->selfMacAddr.bytes,

+ 54 - 0
core/sme/src/csr/csr_api_scan.c

@@ -6755,6 +6755,60 @@ QDF_STATUS csr_scan_abort_mac_scan(tpAniSirGlobal pMac, uint8_t sessionId,
 	}
 	return status;
 }
+QDF_STATUS csr_remove_nonscan_cmd_from_pending_list(tpAniSirGlobal pMac,
+						uint8_t sessionId,
+						eSmeCommandType commandType)
+{
+	tDblLinkList localList;
+	tListElem *pEntry;
+	tSmeCmd *pCommand;
+	tListElem *pEntryToRemove;
+	QDF_STATUS status = QDF_STATUS_E_FAILURE;
+
+	qdf_mem_zero(&localList, sizeof(tDblLinkList));
+	if (!QDF_IS_STATUS_SUCCESS(csr_ll_open(pMac->hHdd, &localList))) {
+		sms_log(pMac, LOGE, FL("failed to open list"));
+		return status;
+	}
+
+	csr_nonscan_pending_ll_lock(pMac);
+	pEntry = csr_nonscan_pending_ll_peak_head(pMac, LL_ACCESS_NOLOCK);
+
+	/*
+	 * Have to make sure we don't loop back to the head of the list,
+	 * which will happen if the entry is NOT on the list
+	 */
+	while (pEntry) {
+		pEntryToRemove = pEntry;
+		pEntry = csr_nonscan_pending_ll_next(pMac,
+					pEntry, LL_ACCESS_NOLOCK);
+		pCommand = GET_BASE_ADDR(pEntryToRemove, tSmeCmd, Link);
+
+		if ((pCommand->command == commandType) &&
+		    (pCommand->sessionId == sessionId)) {
+			/* Remove that entry only */
+			if (csr_nonscan_pending_ll_remove_entry(pMac,
+						pEntryToRemove,
+			    LL_ACCESS_NOLOCK)) {
+				csr_ll_insert_tail(&localList, pEntryToRemove,
+						   LL_ACCESS_NOLOCK);
+				status = QDF_STATUS_SUCCESS;
+			}
+		}
+	}
+	csr_nonscan_pending_ll_unlock(pMac);
+
+	while ((pEntry = csr_ll_remove_head(&localList, LL_ACCESS_NOLOCK))) {
+		pCommand = GET_BASE_ADDR(pEntry, tSmeCmd, Link);
+		sms_log(pMac, LOG1, FL("Sending abort for command ID %d"),
+			(commandType == eSmeCommandScan) ? pCommand->u.
+			scanCmd.scanID : sessionId);
+		csr_abort_command(pMac, pCommand, false);
+	}
+
+	csr_ll_close(&localList);
+	return status;
+}
 
 QDF_STATUS csr_remove_cmd_from_pending_list(tpAniSirGlobal pMac,
 						uint8_t sessionId,

+ 2 - 3
core/sme/src/csr/csr_host_scan_roam.c

@@ -77,7 +77,7 @@ QDF_STATUS csr_roam_issue_reassociate_cmd(tpAniSirGlobal pMac,
 	bool fHighPriority = true;
 	bool fRemoveCmd = false;
 	tListElem *pEntry;
-	pEntry = csr_ll_peek_head(&pMac->sme.smeCmdActiveList, LL_ACCESS_LOCK);
+	pEntry = csr_nonscan_active_ll_peak_head(pMac, LL_ACCESS_LOCK);
 	if (pEntry) {
 		pCommand = GET_BASE_ADDR(pEntry, tSmeCmd, Link);
 		if (!pCommand) {
@@ -88,8 +88,7 @@ QDF_STATUS csr_roam_issue_reassociate_cmd(tpAniSirGlobal pMac,
 			if (pCommand->u.roamCmd.roamReason ==
 			    eCsrSmeIssuedAssocToSimilarAP)
 				fRemoveCmd =
-					csr_ll_remove_entry(&pMac->sme.
-							    smeCmdActiveList,
+					csr_nonscan_active_ll_remove_entry(pMac,
 							    pEntry,
 							    LL_ACCESS_LOCK);
 			else

+ 2 - 0
core/sme/src/csr/csr_inside_api.h

@@ -289,6 +289,8 @@ QDF_STATUS csr_remove_cmd_from_pending_list(tpAniSirGlobal pMac,
 						      uint32_t scan_id,
 						      tDblLinkList *pList,
 						      eSmeCommandType commandType);
+QDF_STATUS csr_remove_nonscan_cmd_from_pending_list(tpAniSirGlobal pMac,
+			uint8_t sessionId, eSmeCommandType commandType);
 QDF_STATUS csr_scan_abort_mac_scan_not_for_connect(tpAniSirGlobal pMac,
 						   uint8_t sessionId);
 QDF_STATUS csr_scan_abort_scan_for_ssid(tpAniSirGlobal pMac, uint32_t sessionId);

+ 2 - 2
core/sme/src/csr/csr_tdls_process.c

@@ -57,11 +57,11 @@ static QDF_STATUS csr_tdls_remove_sme_cmd(tpAniSirGlobal pMac,
 	tListElem *pEntry;
 	tSmeCmd *pCommand;
 
-	pEntry = csr_ll_peek_head(&pMac->sme.smeCmdActiveList, LL_ACCESS_LOCK);
+	pEntry = csr_nonscan_active_ll_peak_head(pMac, LL_ACCESS_LOCK);
 	if (pEntry) {
 		pCommand = GET_BASE_ADDR(pEntry, tSmeCmd, Link);
 		if (cmdType == pCommand->command) {
-			if (csr_ll_remove_entry(&pMac->sme.smeCmdActiveList,
+			if (csr_nonscan_active_ll_remove_entry(pMac,
 						pEntry, LL_ACCESS_LOCK)) {
 				qdf_mem_zero(&pCommand->u.tdlsCmd,
 					     sizeof(tTdlsCmd));

+ 97 - 0
core/sme/src/csr/csr_util.c

@@ -281,6 +281,103 @@ bool csr_get_bss_id_bss_desc(tHalHandle hHal, tSirBssDescription *pSirBssDesc,
 			sizeof(struct qdf_mac_addr));
 	return true;
 }
+bool csr_nonscan_active_ll_is_list_empty(struct sAniSirGlobal *mac_ctx,
+				bool fInterlocked)
+{
+	return csr_ll_is_list_empty(&mac_ctx->sme.smeCmdActiveList,
+					fInterlocked);
+}
+bool csr_nonscan_pending_ll_is_list_empty(struct sAniSirGlobal *mac_ctx,
+				bool fInterlocked)
+{
+	return csr_ll_is_list_empty(&mac_ctx->sme.smeCmdPendingList,
+					fInterlocked);
+}
+bool csr_nonscan_active_ll_remove_entry(struct sAniSirGlobal *mac_ctx,
+		tListElem *entry, bool fInterlocked)
+{
+	return csr_ll_remove_entry(&mac_ctx->sme.smeCmdActiveList, entry,
+					fInterlocked);
+}
+bool csr_nonscan_pending_ll_remove_entry(struct sAniSirGlobal *mac_ctx,
+		tListElem *entry, bool fInterlocked)
+{
+	return csr_ll_remove_entry(&mac_ctx->sme.smeCmdPendingList, entry,
+					fInterlocked);
+}
+tListElem *csr_nonscan_active_ll_peak_head(struct sAniSirGlobal *mac_ctx,
+		bool fInterlocked)
+{
+	return csr_ll_peek_head(&mac_ctx->sme.smeCmdActiveList, fInterlocked);
+}
+tListElem *csr_nonscan_pending_ll_peak_head(struct sAniSirGlobal *mac_ctx,
+		bool fInterlocked)
+{
+	return csr_ll_peek_head(&mac_ctx->sme.smeCmdPendingList, fInterlocked);
+}
+tListElem *csr_nonscan_active_ll_remove_head(struct sAniSirGlobal *mac_ctx,
+		bool fInterlocked)
+{
+	return csr_ll_remove_head(&mac_ctx->sme.smeCmdActiveList,
+				fInterlocked);
+}
+tListElem *csr_nonscan_pending_ll_remove_head(struct sAniSirGlobal *mac_ctx,
+		bool fInterlocked)
+{
+	return csr_ll_remove_head(&mac_ctx->sme.smeCmdPendingList,
+				fInterlocked);
+}
+
+uint32_t csr_nonscan_active_ll_count(struct sAniSirGlobal *mac_ctx)
+{
+	return csr_ll_count(&mac_ctx->sme.smeCmdActiveList);
+}
+
+void csr_nonscan_active_ll_insert_head(struct sAniSirGlobal *mac_ctx,
+			tListElem *entry, bool fInterlocked)
+{
+	csr_ll_insert_head(&mac_ctx->sme.smeCmdActiveList, entry,
+			fInterlocked);
+}
+uint32_t csr_nonscan_pending_ll_count(struct sAniSirGlobal *mac_ctx)
+{
+	return csr_ll_count(&mac_ctx->sme.smeCmdPendingList);
+}
+
+void csr_nonscan_pending_ll_insert_head(struct sAniSirGlobal *mac_ctx,
+		tListElem *entry, bool fInterlocked)
+{
+	csr_ll_insert_head(&mac_ctx->sme.smeCmdPendingList, entry,
+			fInterlocked);
+}
+
+void csr_nonscan_pending_ll_insert_tail(struct sAniSirGlobal *mac_ctx,
+		tListElem *entry, bool fInterlocked)
+{
+	csr_ll_insert_tail(&mac_ctx->sme.smeCmdPendingList, entry,
+				fInterlocked);
+}
+
+tListElem *csr_nonscan_pending_ll_next(struct sAniSirGlobal *mac_ctx,
+				tListElem *entry, bool fInterlocked)
+{
+	return csr_ll_next(&mac_ctx->sme.smeCmdPendingList, entry,
+						fInterlocked);
+}
+
+void purge_sme_session_pending_cmd_list(struct sAniSirGlobal *mac_ctx,
+				uint32_t session_id)
+{
+	purge_sme_session_cmd_list(mac_ctx, session_id,
+				&mac_ctx->sme.smeCmdPendingList);
+}
+
+void purge_sme_session_active_cmd_list(struct sAniSirGlobal *mac_ctx,
+				uint32_t session_id)
+{
+	purge_sme_session_cmd_list(mac_ctx, session_id,
+				&mac_ctx->sme.smeCmdActiveList);
+}
 
 bool csr_is_bss_id_equal(tHalHandle hHal, tSirBssDescription *pSirBssDesc1,
 			 tSirBssDescription *pSirBssDesc2)

+ 2 - 2
core/sme/src/nan/nan_datapath_api.c

@@ -625,7 +625,7 @@ void sme_ndp_msg_processor(tpAniSirGlobal mac_ctx, struct scheduler_msg *msg)
 	eSmeCommandType cmd_to_rel = eSmeNoCommand;
 	bool send_to_user = true;
 
-	entry = csr_ll_peek_head(&mac_ctx->sme.smeCmdActiveList,
+	entry = csr_nonscan_active_ll_peak_head(mac_ctx,
 				 LL_ACCESS_LOCK);
 	if (entry != NULL)
 		cmd = GET_BASE_ADDR(entry, tSmeCmd, Link);
@@ -775,7 +775,7 @@ void sme_ndp_msg_processor(tpAniSirGlobal mac_ctx, struct scheduler_msg *msg)
 
 	if (release_active_cmd && cmd && cmd_to_rel == cmd->command) {
 		/* Now put this cmd back on the avilable command list */
-		if (csr_ll_remove_entry(&mac_ctx->sme.smeCmdActiveList,
+		if (csr_nonscan_active_ll_remove_entry(mac_ctx,
 				     entry, LL_ACCESS_LOCK))
 			csr_release_command(mac_ctx, cmd);
 		sme_process_pending_queue(mac_ctx);

+ 6 - 9
core/sme/src/qos/sme_qos.c

@@ -810,33 +810,30 @@ QDF_STATUS sme_qos_msg_processor(tpAniSirGlobal mac_ctx,
 	/* switch on the msg type & make the state transition accordingly */
 	switch (msg_type) {
 	case eWNI_SME_ADDTS_RSP:
-		entry = csr_ll_peek_head(&mac_ctx->sme.smeCmdActiveList,
+		entry = csr_nonscan_active_ll_peak_head(mac_ctx,
 				LL_ACCESS_LOCK);
 		if (NULL == entry)
 			break;
 		command = GET_BASE_ADDR(entry, tSmeCmd, Link);
 		if (eSmeCommandAddTs == command->command) {
 			status = sme_qos_process_add_ts_rsp(mac_ctx, msg);
-			if (csr_ll_remove_entry
-				(&mac_ctx->sme.smeCmdActiveList, entry,
-				LL_ACCESS_LOCK)) {
+			if (csr_nonscan_active_ll_remove_entry(mac_ctx, entry,
+					LL_ACCESS_LOCK)) {
 				qos_release_command(mac_ctx, command);
 			}
 			sme_process_pending_queue(mac_ctx);
 		}
 		break;
 	case eWNI_SME_DELTS_RSP:
-		entry =
-			csr_ll_peek_head(&mac_ctx->sme.smeCmdActiveList,
+		entry = csr_nonscan_active_ll_peak_head(mac_ctx,
 				LL_ACCESS_LOCK);
 		if (NULL == entry)
 			break;
 		command = GET_BASE_ADDR(entry, tSmeCmd, Link);
 		if (eSmeCommandDelTs == command->command) {
 			status = sme_qos_process_del_ts_rsp(mac_ctx, msg);
-			if (csr_ll_remove_entry
-				(&mac_ctx->sme.smeCmdActiveList, entry,
-				LL_ACCESS_LOCK)) {
+			if (csr_nonscan_active_ll_remove_entry(mac_ctx, entry,
+					LL_ACCESS_LOCK)) {
 				qos_release_command(mac_ctx, command);
 			}
 			sme_process_pending_queue(mac_ctx);