Browse Source

qcacmn: Make API's generic for moving cmds from pending to active

The movement of serialization non scan commands from pending to active
could be one or multiple commands, and it could be done by looking up
the vdev or pdev serialization non scan queues.

There were separate API's implemented for these movement
and activating the commands, moved to active queue as
part of the movement.

Implement a generic API for the movement of non scan commands from
pending to active, instead of having multiple API's either for either
single or multiple commands and do the lookup either from pdev
or vdev queues based on required checks.

Change-Id: I39864611cf019757e44f35d1e267458d35243cc2
CRs-Fixed: 2327461
Vivek 6 years ago
parent
commit
b2af62b892

+ 23 - 157
umac/cmn_services/serialization/src/wlan_serialization_internal.c

@@ -229,92 +229,16 @@ error:
 	return status;
 }
 
-QDF_STATUS
-wlan_serialization_activate_multiple_cmd(
-		struct wlan_ser_pdev_obj *ser_pdev_obj)
-{
-	struct wlan_serialization_pdev_queue *pdev_queue;
-	qdf_list_t *active_queue;
-	QDF_STATUS peek_status = QDF_STATUS_E_FAILURE;
-	struct wlan_serialization_command_list *active_cmd_list;
-	uint32_t qsize;
-	uint32_t vdev_id;
-	qdf_list_node_t *nnode = NULL;
-	QDF_STATUS status = QDF_STATUS_SUCCESS;
-	struct wlan_objmgr_psoc *psoc = NULL;
-
-	pdev_queue = &ser_pdev_obj->pdev_q[SER_PDEV_QUEUE_COMP_NON_SCAN];
-
-	wlan_serialization_acquire_lock(&pdev_queue->pdev_queue_lock);
-
-	active_queue = &pdev_queue->active_list;
-	qsize =  wlan_serialization_list_size(active_queue);
-
-	while (qsize--) {
-		peek_status = wlan_serialization_get_cmd_from_queue(
-				active_queue, &nnode);
-
-		if (peek_status != QDF_STATUS_SUCCESS) {
-			ser_err("can't peek cmd");
-			break;
-		}
-
-		active_cmd_list = qdf_container_of(
-				nnode, struct wlan_serialization_command_list,
-				pdev_node);
-
-		if (!qdf_atomic_test_bit(CMD_MARKED_FOR_ACTIVATION,
-					 &active_cmd_list->cmd_in_use)) {
-			continue;
-		}
-
-		qdf_atomic_clear_bit(CMD_MARKED_FOR_ACTIVATION,
-				     &active_cmd_list->cmd_in_use);
-
-		qdf_atomic_set_bit(CMD_IS_ACTIVE,
-				   &active_cmd_list->cmd_in_use);
-
-		vdev_id = wlan_vdev_get_id(active_cmd_list->cmd.vdev);
-		pdev_queue->vdev_active_cmd_bitmap |= (1 << vdev_id);
-
-		if (active_cmd_list->cmd.is_blocking)
-			pdev_queue->blocking_cmd_active = 1;
-
-		/*
-		 * Command is already pushed to active queue.
-		 * Now start the timer.
-		 */
-		psoc = wlan_vdev_get_psoc(active_cmd_list->cmd.vdev);
-		wlan_serialization_find_and_start_timer(psoc,
-							&active_cmd_list->cmd);
-
-		ser_debug("cmd cb: type[%d] id[%d] : reason: %s",
-			  active_cmd_list->cmd.cmd_type,
-			  active_cmd_list->cmd.cmd_id,
-			  "WLAN_SER_CB_ACTIVATE_CMD");
-
-		wlan_serialization_release_lock(&pdev_queue->pdev_queue_lock);
-
-		status = active_cmd_list->cmd.cmd_cb(&active_cmd_list->cmd,
-					    WLAN_SER_CB_ACTIVATE_CMD);
-
-		if (QDF_IS_STATUS_ERROR(status))
-			wlan_serialization_dequeue_cmd(&active_cmd_list->cmd,
-						       true);
-
-		wlan_serialization_acquire_lock(&pdev_queue->pdev_queue_lock);
-	}
-
-	wlan_serialization_release_lock(&pdev_queue->pdev_queue_lock);
-	return status;
-}
-
 QDF_STATUS wlan_serialization_activate_cmd(
 			struct wlan_serialization_command_list *cmd_list,
 			struct wlan_ser_pdev_obj *ser_pdev_obj)
 {
 	QDF_STATUS status = QDF_STATUS_E_FAILURE;
 	struct wlan_objmgr_psoc *psoc = NULL;
+	struct wlan_serialization_pdev_queue *pdev_queue;
+
+	pdev_queue = wlan_serialization_get_pdev_queue_obj(
+			ser_pdev_obj, cmd_list->cmd.cmd_type);
 
 	psoc = wlan_vdev_get_psoc(cmd_list->cmd.vdev);
 	if (!psoc) {
@@ -343,11 +267,15 @@ QDF_STATUS wlan_serialization_activate_cmd(
 	status = cmd_list->cmd.cmd_cb(&cmd_list->cmd,
 				WLAN_SER_CB_ACTIVATE_CMD);
 
+	wlan_serialization_acquire_lock(&pdev_queue->pdev_queue_lock);
+
 	qdf_atomic_clear_bit(CMD_MARKED_FOR_ACTIVATION,
 			     &cmd_list->cmd_in_use);
 	qdf_atomic_set_bit(CMD_IS_ACTIVE,
 			   &cmd_list->cmd_in_use);
 
+	wlan_serialization_release_lock(&pdev_queue->pdev_queue_lock);
+
 	if (QDF_IS_STATUS_ERROR(status))
 		wlan_serialization_dequeue_cmd(&cmd_list->cmd, true);
 
@@ -386,34 +314,22 @@ error:
 enum wlan_serialization_status
 wlan_serialization_move_pending_to_active(
 		enum wlan_serialization_cmd_type cmd_type,
-		struct wlan_serialization_command_list **pcmd_list,
 		struct wlan_ser_pdev_obj *ser_pdev_obj,
 		struct wlan_objmgr_vdev *vdev,
-		bool blocking_cmd_removed,
-		bool blocking_cmd_waiting)
+		bool blocking_cmd_removed)
 {
 	enum wlan_serialization_status status;
-	struct wlan_serialization_pdev_queue *pdev_queue;
 
 	if (cmd_type < WLAN_SER_CMD_NONSCAN) {
 		status =
 		wlan_ser_move_scan_pending_to_active(
-				pcmd_list,
 				ser_pdev_obj);
 	} else {
-		pdev_queue =
-			&ser_pdev_obj->pdev_q[SER_PDEV_QUEUE_COMP_NON_SCAN];
-
-		if (!blocking_cmd_removed && !blocking_cmd_waiting)
-			status =
-			wlan_ser_move_non_scan_pending_to_active(
-				pcmd_list,
+		status =
+		wlan_ser_move_non_scan_pending_to_active(
 				ser_pdev_obj,
-				vdev);
-		else
-			status =
-			wlan_ser_move_multiple_non_scan_pending_to_active(
-				ser_pdev_obj);
+				vdev,
+				blocking_cmd_removed);
 	}
 
 	return status;
@@ -434,10 +350,8 @@ wlan_serialization_dequeue_cmd(struct wlan_serialization_command *cmd,
 	struct wlan_ser_pdev_obj *ser_pdev_obj;
 	struct wlan_serialization_command cmd_bkup;
 	struct wlan_serialization_command_list *cmd_list;
-	struct wlan_serialization_command_list *pcmd_list;
 	struct wlan_serialization_pdev_queue *pdev_queue;
 	bool blocking_cmd_removed = 0;
-	bool blocking_cmd_waiting = 0;
 
 	ser_enter();
 
@@ -490,12 +404,13 @@ wlan_serialization_dequeue_cmd(struct wlan_serialization_command *cmd,
 	}
 
 	if (active_cmd) {
-		wlan_serialization_find_and_stop_timer(psoc, &cmd_list->cmd);
-
 		if (cmd_list->cmd.cmd_type >= WLAN_SER_CMD_NONSCAN)
 			blocking_cmd_removed = cmd_list->cmd.is_blocking;
 	}
 
+	if (active_cmd)
+		wlan_serialization_find_and_stop_timer(psoc, &cmd_list->cmd);
+
 	qdf_mem_copy(&cmd_bkup, &cmd_list->cmd,
 		     sizeof(struct wlan_serialization_command));
 	qdf_mem_zero(&cmd_list->cmd,
@@ -504,32 +419,6 @@ wlan_serialization_dequeue_cmd(struct wlan_serialization_command *cmd,
 			&pdev_queue->cmd_pool_list,
 			&cmd_list->pdev_node);
 
-	/*
-	 * For NON SCAN commands, the following is possible:
-	 *
-	 * If the remove is for non blocking command,
-	 * and there is no blocking command waiting,
-	 * look at vdev pending queue and
-	 * only one command moves from pending
-	 * to active
-	 *
-	 * If the remove is for blocking comamnd,
-	 * look at the pdev queue and
-	 * either single blocking command
-	 * or multiple non blocking commands moves
-	 * from pending to active
-	 */
-
-	blocking_cmd_waiting = pdev_queue->blocking_cmd_waiting;
-
-	if (active_cmd) {
-		ser_status = wlan_serialization_move_pending_to_active(
-			cmd_bkup.cmd_type, &pcmd_list, ser_pdev_obj,
-			cmd_bkup.vdev,
-			blocking_cmd_removed,
-			blocking_cmd_waiting);
-	}
-
 	wlan_serialization_release_lock(&pdev_queue->pdev_queue_lock);
 
 	/* Call cmd cb for remove request*/
@@ -543,31 +432,13 @@ wlan_serialization_dequeue_cmd(struct wlan_serialization_command *cmd,
 				     WLAN_SER_CB_RELEASE_MEM_CMD);
 	}
 
-	/*
-	 * If the remove is for non blocking command,
-	 * and there is no blocking command waiting,
-	 * look at vdev pending queue and
-	 * only one command moves from pending
-	 * to active and gets activated
-	 */
-	if (WLAN_SER_CMD_ACTIVE == ser_status && !blocking_cmd_removed &&
-	    !blocking_cmd_waiting) {
-		ser_debug("cmd type[%d] id[%d] moved from pending to active",
-			  pcmd_list->cmd.cmd_type,
-			  pcmd_list->cmd.cmd_id);
-		wlan_serialization_activate_cmd(pcmd_list,
-						ser_pdev_obj);
-	} else if (ser_status == WLAN_SER_CMD_ACTIVE) {
-		/* If the remove is for blocking command
-		 * either one or multiple commands can move
-		 * from pending to active and gets activated
-		 */
-		wlan_serialization_activate_multiple_cmd(ser_pdev_obj);
-	} else {
-		goto exit;
+	if (active_cmd) {
+		ser_status = wlan_serialization_move_pending_to_active(
+			cmd_bkup.cmd_type, ser_pdev_obj,
+			cmd_bkup.vdev,
+			blocking_cmd_removed);
 	}
 
-exit:
 	if (active_cmd)
 		status = WLAN_SER_CMD_IN_ACTIVE_LIST;
 	else
@@ -665,7 +536,7 @@ wlan_serialization_find_and_stop_timer(struct wlan_objmgr_psoc *psoc,
 
 	if (!psoc || !cmd) {
 		ser_err("invalid param");
-		goto error;
+		goto exit;
 	}
 
 	if (cmd->cmd_timeout_duration == 0) {
@@ -680,9 +551,7 @@ wlan_serialization_find_and_stop_timer(struct wlan_objmgr_psoc *psoc,
 	psoc_ser_obj = wlan_serialization_get_psoc_obj(psoc);
 	/*
 	 * Here cmd_id and cmd_type are used to locate the timer being
-	 * associated with command. For scan command, cmd_id is expected to
-	 * be unique and For non-scan command, there should be only one active
-	 * command per pdev
+	 * associated with command.
 	 */
 	wlan_serialization_acquire_lock(&psoc_ser_obj->timer_lock);
 
@@ -708,10 +577,7 @@ wlan_serialization_find_and_stop_timer(struct wlan_objmgr_psoc *psoc,
 		ser_err("Can't find timer for cmd_type[%d]", cmd->cmd_type);
 	}
 
-
-error:
 exit:
-
 	return status;
 }
 

+ 1 - 14
umac/cmn_services/serialization/src/wlan_serialization_internal_i.h

@@ -83,17 +83,6 @@ wlan_serialization_activate_cmd(
 		struct wlan_serialization_command_list *cmd_list,
 		struct wlan_ser_pdev_obj *ser_pdev_obj);
 
-/**
- * wlan_serialization_activate_multiple_cmd() - Activate multiple cmd in
- *			active queue
- * @ser_pdev_obj: Serialization private pdev object
- *
- * Return: Status of activation of the command
- */
-QDF_STATUS
-wlan_serialization_activate_multiple_cmd(
-		struct wlan_ser_pdev_obj *ser_pdev_obj);
-
 /**
  * wlan_serialization_move_pending_to_active() - Move a cmd from pending
  *			queue to active queue
@@ -109,11 +98,9 @@ wlan_serialization_activate_multiple_cmd(
 enum wlan_serialization_status
 wlan_serialization_move_pending_to_active(
 		enum wlan_serialization_cmd_type cmd_type,
-		struct wlan_serialization_command_list **pcmd_list,
 		struct wlan_ser_pdev_obj *ser_pdev_obj,
 		struct wlan_objmgr_vdev *vdev,
-		bool blocking_cmd_removed,
-		bool blocking_cmd_waiting);
+		bool blocking_cmd_removed);
 
 /**
  * wlan_serialization_dequeue_cmd() - dequeue the cmd to pending/active Queue

+ 85 - 144
umac/cmn_services/serialization/src/wlan_serialization_non_scan.c

@@ -182,105 +182,104 @@ vdev_error:
 	return status;
 }
 
-static
-struct wlan_serialization_command_list*
-wlan_serialization_get_next_non_scan_active_cmd(
+enum wlan_serialization_status
+wlan_ser_move_non_scan_pending_to_active(
 		struct wlan_ser_pdev_obj *ser_pdev_obj,
-		struct wlan_objmgr_vdev *vdev)
+		struct wlan_objmgr_vdev *vdev,
+		bool blocking_cmd_removed)
 {
-	qdf_list_t *pending_queue;
-	qdf_list_node_t *pending_node = NULL;
 	struct wlan_serialization_command_list *pending_cmd_list = NULL;
+	struct wlan_serialization_command_list *active_cmd_list;
+	struct wlan_serialization_command cmd_to_remove;
+	enum wlan_serialization_status status = WLAN_SER_CMD_DENIED_UNSPECIFIED;
+	struct wlan_serialization_pdev_queue *pdev_queue;
+	struct wlan_serialization_vdev_queue *vdev_queue;
+
 	struct wlan_ser_vdev_obj *ser_vdev_obj;
-	struct wlan_serialization_vdev_queue *vdev_q_obj;
-	QDF_STATUS status;
 
-	ser_vdev_obj = wlan_serialization_get_vdev_obj(vdev);
+	qdf_list_t *pending_queue;
+	qdf_list_node_t *pending_node = NULL;
+	QDF_STATUS qdf_status = QDF_STATUS_E_FAILURE;
+	uint32_t blocking_cmd_waiting = 0;
+	uint32_t vdev_id;
+	uint32_t qsize;
+	bool vdev_cmd_active = 0;
+	bool vdev_queue_lookup = false;
 
-	vdev_q_obj = &ser_vdev_obj->vdev_q[SER_VDEV_QUEUE_COMP_NON_SCAN];
-	pending_queue = &vdev_q_obj->pending_list;
+	pdev_queue = &ser_pdev_obj->pdev_q[SER_PDEV_QUEUE_COMP_NON_SCAN];
 
-	if (wlan_serialization_list_empty(pending_queue)) {
-		ser_debug("nothing to move from pending to active queue");
-		goto error;
-	}
+	ser_vdev_obj = wlan_serialization_get_vdev_obj(vdev);
+	vdev_queue = &ser_vdev_obj->vdev_q[SER_VDEV_QUEUE_COMP_NON_SCAN];
 
-	status = wlan_serialization_get_cmd_from_queue(pending_queue,
-						       &pending_node);
+	ser_enter();
 
-	if (status != QDF_STATUS_SUCCESS) {
-		ser_err("can't read cmd from queue");
-		pending_cmd_list = NULL;
+	if (!ser_pdev_obj) {
+		ser_err("Can't find ser_pdev_obj");
 		goto error;
 	}
 
-	pending_cmd_list =
-		qdf_container_of(pending_node,
-				 struct wlan_serialization_command_list,
-				 vdev_node);
-
-	if (pending_cmd_list)
-		ser_debug("next non scan active cmd found from pending queue");
-
-error:
-	return pending_cmd_list;
-}
+	wlan_serialization_acquire_lock(&pdev_queue->pdev_queue_lock);
 
-enum wlan_serialization_status
-wlan_ser_move_multiple_non_scan_pending_to_active(
-		struct wlan_ser_pdev_obj *ser_pdev_obj)
-{
-	struct wlan_serialization_pdev_queue *pdev_queue;
-	qdf_list_t *active_queue;
-	qdf_list_t *pending_queue;
-	qdf_list_node_t *nnode = NULL;
-	struct wlan_serialization_command_list *pending_cmd_list;
-	struct wlan_serialization_command_list *active_cmd_list;
-	struct wlan_serialization_command cmd_to_remove;
-	uint32_t blocking_cmd_waiting;
-	uint32_t vdev_id;
-	uint32_t qsize;
-	bool vdev_cmd_active = 0;
-
-	enum wlan_serialization_status status = WLAN_SER_CMD_DENIED_UNSPECIFIED;
-	QDF_STATUS peek_status = QDF_STATUS_E_FAILURE;
-	QDF_STATUS qdf_status = QDF_STATUS_E_FAILURE;
-
-	pdev_queue = &ser_pdev_obj->pdev_q[SER_PDEV_QUEUE_COMP_NON_SCAN];
-	active_queue = &pdev_queue->active_list;
-	pending_queue = &pdev_queue->pending_list;
 	blocking_cmd_waiting = pdev_queue->blocking_cmd_waiting;
 
+	if (!blocking_cmd_removed && !blocking_cmd_waiting) {
+		pending_queue = &vdev_queue->pending_list;
+		vdev_queue_lookup = true;
+	} else {
+		pending_queue = &pdev_queue->pending_list;
+	}
+
 	qsize =  wlan_serialization_list_size(pending_queue);
+	if (!qsize) {
+		wlan_serialization_release_lock(
+			&pdev_queue->pdev_queue_lock);
+		ser_err("Pending Queue is empty");
+		goto error;
+	}
+
 	while (qsize--) {
-		peek_status = wlan_serialization_get_cmd_from_queue(
-				pending_queue, &nnode);
-		if (peek_status != QDF_STATUS_SUCCESS) {
+		qdf_status = wlan_serialization_get_cmd_from_queue(
+				pending_queue, &pending_node);
+		if (qdf_status != QDF_STATUS_SUCCESS) {
 			ser_err("can't peek cmd");
 			break;
 		}
 
-		pending_cmd_list = qdf_container_of(
-				nnode, struct wlan_serialization_command_list,
+		if (vdev_queue_lookup) {
+			pending_cmd_list =
+				qdf_container_of(
+				pending_node,
+				struct wlan_serialization_command_list,
+				vdev_node);
+		} else {
+			pending_cmd_list =
+				qdf_container_of(
+				pending_node,
+				struct wlan_serialization_command_list,
 				pdev_node);
+		}
+
 		if (!pending_cmd_list) {
+			wlan_serialization_release_lock(
+				&pdev_queue->pdev_queue_lock);
 			ser_debug(
-				"non scan cmd cannot move from pending to active");
+				"non scan cmd cannot move frm pendin to actv");
 			goto error;
 		}
 
-		if (pending_cmd_list->cmd.is_blocking &&
-		    pdev_queue->vdev_active_cmd_bitmap) {
-			break;
-		}
-
-		vdev_id = wlan_vdev_get_id(pending_cmd_list->cmd.vdev);
-		vdev_cmd_active =
-			pdev_queue->vdev_active_cmd_bitmap & (1 << vdev_id);
-		if (vdev_cmd_active)
-			continue;
+		if (!vdev_queue_lookup) {
+			if (pending_cmd_list->cmd.is_blocking &&
+			    pdev_queue->vdev_active_cmd_bitmap) {
+				break;
+			}
 
-		status = WLAN_SER_CMD_ACTIVE;
+			vdev_id = wlan_vdev_get_id(pending_cmd_list->cmd.vdev);
+			vdev_cmd_active =
+				pdev_queue->vdev_active_cmd_bitmap &
+				(1 << vdev_id);
+			if (vdev_cmd_active)
+				continue;
+		}
 
 		qdf_mem_copy(&cmd_to_remove, &pending_cmd_list->cmd,
 			     sizeof(struct wlan_serialization_command));
@@ -291,6 +290,8 @@ wlan_ser_move_multiple_non_scan_pending_to_active(
 							  false);
 
 		if (QDF_STATUS_SUCCESS != qdf_status) {
+			wlan_serialization_release_lock(
+					&pdev_queue->pdev_queue_lock);
 			ser_err("Can't remove cmd from pendingQ id-%d type-%d",
 				pending_cmd_list->cmd.cmd_id,
 				pending_cmd_list->cmd.cmd_type);
@@ -305,6 +306,8 @@ wlan_ser_move_multiple_non_scan_pending_to_active(
 				ser_pdev_obj, active_cmd_list, true);
 
 		if (WLAN_SER_CMD_ACTIVE != status) {
+			wlan_serialization_release_lock(
+					&pdev_queue->pdev_queue_lock);
 			ser_err("Can't move cmd to activeQ id-%d type-%d",
 				pending_cmd_list->cmd.cmd_id,
 				pending_cmd_list->cmd.cmd_type);
@@ -318,86 +321,24 @@ wlan_ser_move_multiple_non_scan_pending_to_active(
 		qdf_atomic_set_bit(CMD_MARKED_FOR_ACTIVATION,
 				   &active_cmd_list->cmd_in_use);
 
-		nnode = NULL;
-		if (active_cmd_list->cmd.is_blocking)
-			pdev_queue->blocking_cmd_waiting--;
-
-		if (pending_cmd_list->cmd.is_blocking)
-			break;
-	}
-
-error:
-	return status;
-}
-
-enum wlan_serialization_status
-wlan_ser_move_non_scan_pending_to_active(
-		struct wlan_serialization_command_list **pcmd_list,
-		struct wlan_ser_pdev_obj *ser_pdev_obj,
-		struct wlan_objmgr_vdev *vdev)
-{
-	struct wlan_serialization_command_list *pending_cmd_list;
-	struct wlan_serialization_command_list *active_cmd_list;
-	struct wlan_serialization_command cmd_to_remove;
-	enum wlan_serialization_status status = WLAN_SER_CMD_DENIED_UNSPECIFIED;
-	QDF_STATUS qdf_status;
-	struct wlan_serialization_pdev_queue *pdev_queue;
-
-	pdev_queue = &ser_pdev_obj->pdev_q[SER_PDEV_QUEUE_COMP_NON_SCAN];
+		wlan_serialization_release_lock(&pdev_queue->pdev_queue_lock);
 
-	ser_enter();
-
-	if (!ser_pdev_obj) {
-		ser_err("Can't find ser_pdev_obj");
-		goto error;
-	}
-
-	pending_cmd_list =
-		wlan_serialization_get_next_non_scan_active_cmd(
-						ser_pdev_obj,
-						vdev);
-
-	if (!pending_cmd_list) {
-		ser_debug("non scan cmd cannot move from pending to active");
-		goto error;
-	}
+		wlan_serialization_activate_cmd(active_cmd_list, ser_pdev_obj);
 
-	qdf_mem_copy(&cmd_to_remove, &pending_cmd_list->cmd,
-		     sizeof(struct wlan_serialization_command));
+		wlan_serialization_acquire_lock(&pdev_queue->pdev_queue_lock);
 
-	qdf_status = wlan_ser_remove_non_scan_cmd(ser_pdev_obj,
-						  &pending_cmd_list,
-						  &cmd_to_remove, false);
-
-	if (QDF_STATUS_SUCCESS != qdf_status) {
-		ser_err("Can't remove cmd from pendingQ id-%d type-%d",
-			pending_cmd_list->cmd.cmd_id,
-			pending_cmd_list->cmd.cmd_type);
-		QDF_ASSERT(0);
-		status = WLAN_SER_CMD_DENIED_UNSPECIFIED;
-		goto error;
-	}
-
-	active_cmd_list = pending_cmd_list;
+		if (vdev_queue_lookup)
+			break;
 
-	status = wlan_ser_add_non_scan_cmd(
-				ser_pdev_obj, active_cmd_list, true);
+		pending_node = NULL;
 
-	if (WLAN_SER_CMD_ACTIVE != status) {
-		ser_err("Can't move cmd to activeQ id-%d type-%d",
-			pending_cmd_list->cmd.cmd_id,
-			pending_cmd_list->cmd.cmd_type);
-		wlan_serialization_insert_back(
-			&pdev_queue->cmd_pool_list,
-			&active_cmd_list->pdev_node);
-		goto error;
+		if (active_cmd_list->cmd.is_blocking) {
+			pdev_queue->blocking_cmd_waiting--;
+			break;
+		}
 	}
 
-	qdf_atomic_set_bit(CMD_MARKED_FOR_ACTIVATION,
-			   &active_cmd_list->cmd_in_use);
-
-	*pcmd_list = active_cmd_list;
-
+	wlan_serialization_release_lock(&pdev_queue->pdev_queue_lock);
 error:
 	ser_exit();
 	return status;

+ 2 - 13
umac/cmn_services/serialization/src/wlan_serialization_non_scan_i.h

@@ -73,20 +73,9 @@ wlan_ser_add_non_scan_cmd(
  */
 enum wlan_serialization_status
 wlan_ser_move_non_scan_pending_to_active(
-		struct wlan_serialization_command_list **pcmd_list,
 		struct wlan_ser_pdev_obj *ser_pdev_obj,
-		struct wlan_objmgr_vdev *vdev);
-
-/**
- * wlan_ser_move_multiple_non_scan_pending_to_active() - Move multiple non-scan
- *			cmd from pending queue to active queue
- * @ser_pdev_obj: Serialization private pdev object
- *
- * Return: Status of the cmd's serialization request
- */
-enum wlan_serialization_status
-wlan_ser_move_multiple_non_scan_pending_to_active(
-		struct wlan_ser_pdev_obj *ser_pdev_obj);
+		struct wlan_objmgr_vdev *vdev,
+		bool blocking_cmd_removed);
 
 /**
  * wlan_ser_remove_non_scan_cmd() - Remove a non-scan cmd from the given queue

+ 30 - 41
umac/cmn_services/serialization/src/wlan_serialization_scan.c

@@ -317,28 +317,41 @@ error:
 	return status;
 }
 
-static struct wlan_serialization_command_list*
-wlan_serialization_get_next_scan_active_cmd(
+enum wlan_serialization_status wlan_ser_move_scan_pending_to_active(
 		struct wlan_ser_pdev_obj *ser_pdev_obj)
 {
+	struct wlan_serialization_command_list *pending_cmd_list = NULL;
+	struct wlan_serialization_command_list *active_cmd_list;
+	struct wlan_serialization_command cmd_to_remove;
+	enum wlan_serialization_status status = WLAN_SER_CMD_DENIED_UNSPECIFIED;
+	QDF_STATUS qdf_status;
+	struct wlan_serialization_pdev_queue *pdev_queue;
 	qdf_list_t *pending_queue;
 	qdf_list_node_t *pending_node = NULL;
-	struct wlan_serialization_command_list *pending_cmd_list = NULL;
-	struct wlan_serialization_pdev_queue *pdev_q;
-	QDF_STATUS status;
 
-	pdev_q = &ser_pdev_obj->pdev_q[SER_PDEV_QUEUE_COMP_SCAN];
+	pdev_queue = &ser_pdev_obj->pdev_q[SER_PDEV_QUEUE_COMP_SCAN];
+
+	ser_enter();
+
+	if (!ser_pdev_obj) {
+		ser_err("Can't find ser_pdev_obj");
+		goto error;
+	}
 
-	pending_queue = &pdev_q->pending_list;
+	wlan_serialization_acquire_lock(&pdev_queue->pdev_queue_lock);
+
+	pending_queue = &pdev_queue->pending_list;
 
 	if (wlan_serialization_list_empty(pending_queue)) {
+		wlan_serialization_release_lock(&pdev_queue->pdev_queue_lock);
 		ser_debug("nothing to move from pend to active que");
 		goto error;
 	}
 
-	status = wlan_serialization_peek_front(pending_queue,
-					       &pending_node);
-	if (QDF_STATUS_SUCCESS != status) {
+	qdf_status = wlan_serialization_peek_front(pending_queue,
+						   &pending_node);
+	if (QDF_STATUS_SUCCESS != qdf_status) {
+		wlan_serialization_release_lock(&pdev_queue->pdev_queue_lock);
 		ser_err("can't read from pending queue");
 		goto error;
 	}
@@ -348,37 +361,11 @@ wlan_serialization_get_next_scan_active_cmd(
 				 struct wlan_serialization_command_list,
 				 pdev_node);
 
-	ser_debug("next active scan cmd found from pending queue");
-error:
-	return pending_cmd_list;
-}
-
-enum wlan_serialization_status wlan_ser_move_scan_pending_to_active(
-		struct wlan_serialization_command_list **pcmd_list,
-		struct wlan_ser_pdev_obj *ser_pdev_obj)
-{
-	struct wlan_serialization_command_list *pending_cmd_list;
-	struct wlan_serialization_command_list *active_cmd_list;
-	struct wlan_serialization_command cmd_to_remove;
-	enum wlan_serialization_status status = WLAN_SER_CMD_DENIED_UNSPECIFIED;
-	QDF_STATUS qdf_status;
-	struct wlan_serialization_pdev_queue *pdev_q;
-
-	pdev_q = &ser_pdev_obj->pdev_q[SER_PDEV_QUEUE_COMP_SCAN];
-
-	ser_enter();
-
-	if (!ser_pdev_obj) {
-		ser_err("Can't find ser_pdev_obj");
+	if (!pending_cmd_list) {
+		wlan_serialization_release_lock(&pdev_queue->pdev_queue_lock);
 		goto error;
 	}
 
-	pending_cmd_list =
-		wlan_serialization_get_next_scan_active_cmd(ser_pdev_obj);
-
-	if (!pending_cmd_list)
-		goto error;
-
 	qdf_mem_copy(&cmd_to_remove, &pending_cmd_list->cmd,
 		     sizeof(struct wlan_serialization_command));
 
@@ -388,6 +375,7 @@ enum wlan_serialization_status wlan_ser_move_scan_pending_to_active(
 					 &cmd_to_remove, false);
 
 	if (QDF_STATUS_SUCCESS != qdf_status) {
+		wlan_serialization_release_lock(&pdev_queue->pdev_queue_lock);
 		ser_err("Can't remove cmd from pendingQ id-%d type-%d",
 			pending_cmd_list->cmd.cmd_id,
 			pending_cmd_list->cmd.cmd_type);
@@ -403,9 +391,9 @@ enum wlan_serialization_status wlan_ser_move_scan_pending_to_active(
 
 	if (WLAN_SER_CMD_ACTIVE != status) {
 		wlan_serialization_insert_back(
-			&pdev_q->cmd_pool_list,
+			&pdev_queue->cmd_pool_list,
 			&active_cmd_list->pdev_node);
-
+		wlan_serialization_release_lock(&pdev_queue->pdev_queue_lock);
 		status = WLAN_SER_CMD_DENIED_UNSPECIFIED;
 		ser_err("Can't add cmd to activeQ id-%d type-%d",
 			active_cmd_list->cmd.cmd_id,
@@ -417,8 +405,9 @@ enum wlan_serialization_status wlan_ser_move_scan_pending_to_active(
 	qdf_atomic_set_bit(CMD_MARKED_FOR_ACTIVATION,
 			   &active_cmd_list->cmd_in_use);
 
-	*pcmd_list = active_cmd_list;
+	wlan_serialization_release_lock(&pdev_queue->pdev_queue_lock);
 
+	wlan_serialization_activate_cmd(active_cmd_list, ser_pdev_obj);
 error:
 	ser_exit();
 	return status;

+ 0 - 2
umac/cmn_services/serialization/src/wlan_serialization_scan_i.h

@@ -134,14 +134,12 @@ wlan_ser_cancel_scan_cmd(struct wlan_ser_pdev_obj *ser_obj,
 /**
  * wlan_ser_move_scan_pending_to_active() - Move a scan cmd from pending
  *			queue to active queue
- * @pcmd_list: Pointer to command list containing the command
  * @ser_pdev_obj: Serialization private pdev object
  *
  * Return: Status of the cmd's serialization request
  */
 enum wlan_serialization_status
 wlan_ser_move_scan_pending_to_active(
-		struct wlan_serialization_command_list **pcmd_list,
 		struct wlan_ser_pdev_obj *ser_pdev_obj);
 #endif