Эх сурвалжийг харах

qcacmn: Add API to peek vdev active queue

Add API to peek into the vdev active queue
and return the command type present in the
active queue of a given vdev

Change-Id: I4a4dc419f4a51645cc7e611ffb7053a8c8240381
CRs-Fixed: 2354133
Vivek 6 жил өмнө
parent
commit
c4f335719b

+ 13 - 0
umac/cmn_services/serialization/inc/wlan_serialization_api.h

@@ -983,5 +983,18 @@ void *wlan_serialization_get_active_cmd(
 		struct wlan_objmgr_psoc *psoc,
 		uint8_t vdev_id,
 		enum wlan_serialization_cmd_type cmd_type);
+
+/**
+ * wlan_serialization_get_active_cmd() - Return active umac command which
+ *  matches vdev and cmd type
+ * @vdev: vdev object
+ *
+ * This API fetches command type of the command in the vdev active queue
+ *
+ * Return: command type of the command in the vdev active queue
+ */
+
+enum wlan_serialization_cmd_type
+wlan_serialization_get_vdev_active_cmd_type(struct wlan_objmgr_vdev *vdev);
 #endif
 #endif

+ 47 - 0
umac/cmn_services/serialization/src/wlan_serialization_api.c

@@ -1009,4 +1009,51 @@ error:
 	ser_exit();
 	return umac_cmd;
 }
+
+enum wlan_serialization_cmd_type
+wlan_serialization_get_vdev_active_cmd_type(struct wlan_objmgr_vdev *vdev)
+{
+	enum wlan_serialization_cmd_type cmd_type = WLAN_SER_CMD_MAX;
+	struct wlan_ser_pdev_obj *ser_pdev_obj;
+	struct wlan_ser_vdev_obj *ser_vdev_obj;
+	struct wlan_serialization_pdev_queue *pdev_queue;
+	struct wlan_serialization_vdev_queue *vdev_queue;
+	struct wlan_serialization_command_list *cmd_list = NULL;
+	qdf_list_node_t *node;
+
+	ser_pdev_obj = wlan_serialization_get_pdev_obj(
+			wlan_vdev_get_pdev(vdev));
+
+	if (!ser_pdev_obj) {
+		ser_err("invalid ser_pdev_obj");
+		goto error;
+	}
+	pdev_queue = wlan_serialization_get_pdev_queue_obj(
+			ser_pdev_obj, cmd_type);
+
+	ser_vdev_obj = wlan_serialization_get_vdev_obj(vdev);
+	if (!ser_vdev_obj) {
+		ser_err("invalid ser_vdev_obj");
+		goto error;
+	}
+	vdev_queue = wlan_serialization_get_vdev_queue_obj(
+			ser_vdev_obj, WLAN_SER_CMD_NONSCAN);
+
+	wlan_serialization_acquire_lock(&pdev_queue->pdev_queue_lock);
+
+	if (wlan_serialization_peek_front(
+		&vdev_queue->active_list, &node) == QDF_STATUS_SUCCESS) {
+		cmd_list = qdf_container_of(
+				node,
+				struct wlan_serialization_command_list,
+				vdev_node);
+
+		cmd_type = cmd_list->cmd.cmd_type;
+	}
+
+	wlan_serialization_release_lock(&pdev_queue->pdev_queue_lock);
+
+error:
+	return cmd_type;
+}
 #endif

+ 1 - 1
umac/cmn_services/serialization/src/wlan_serialization_utils.c

@@ -1396,7 +1396,7 @@ wlan_serialization_remove_cmd_from_queue(
 	if (!cmd)
 		goto error;
 
-	if (wlan_serialization_list_empty(queue)) {
+	if (!queue || wlan_serialization_list_empty(queue)) {
 		ser_err("Empty queue");
 		goto error;
 	}