Explorar o código

qcacmn: Add API to fetch activation status for active cmd

Add change to fetch the activation status for the command in the
active queue of a given vdev.

Change-Id: I2ef87b5423f3749eb68e50147c9a30115492197c
CRs-Fixed: 2415236
Santosh Anbu %!s(int64=6) %!d(string=hai) anos
pai
achega
3f0962833f

+ 15 - 2
umac/cmn_services/serialization/inc/wlan_serialization_api.h

@@ -552,8 +552,8 @@ void *wlan_serialization_get_active_cmd(
 		enum wlan_serialization_cmd_type cmd_type);
 
 /**
- * wlan_serialization_get_active_cmd() - Return active umac command which
- *  matches vdev and cmd type
+ * wlan_serialization_get_vdev_active_cmd_type() - Return cmd type of the
+ *  active command for the given vdev
  * @vdev: vdev object
  *
  * This API fetches command type of the command in the vdev active queue
@@ -563,4 +563,17 @@ void *wlan_serialization_get_active_cmd(
 
 enum wlan_serialization_cmd_type
 wlan_serialization_get_vdev_active_cmd_type(struct wlan_objmgr_vdev *vdev);
+
+/**
+ * wlan_ser_get_cmd_activation_status - Return active command status
+ * @vdev: vdev object
+ *
+ * This API fetches active command state in the vdev active queue
+ *
+ * Return: success if CMD_MARKED_FOR_ACTIVATION bit is set, else fail
+ */
+
+QDF_STATUS
+wlan_ser_get_cmd_activation_status(struct wlan_objmgr_vdev *vdev);
+
 #endif

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

@@ -675,3 +675,52 @@ wlan_serialization_get_vdev_active_cmd_type(struct wlan_objmgr_vdev *vdev)
 error:
 	return cmd_type;
 }
+
+QDF_STATUS
+wlan_ser_get_cmd_activation_status(struct wlan_objmgr_vdev *vdev)
+{
+	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;
+	QDF_STATUS status = QDF_STATUS_E_FAILURE;
+
+	ser_pdev_obj = wlan_serialization_get_pdev_obj(
+			wlan_vdev_get_pdev(vdev));
+
+	if (!ser_pdev_obj) {
+		ser_err("invalid ser_pdev_obj");
+		return QDF_STATUS_E_FAILURE;
+	}
+
+	pdev_queue = wlan_serialization_get_pdev_queue_obj(
+			ser_pdev_obj, WLAN_SER_CMD_NONSCAN);
+
+	ser_vdev_obj = wlan_serialization_get_vdev_obj(vdev);
+	if (!ser_vdev_obj) {
+		ser_err("invalid ser_vdev_obj");
+		return QDF_STATUS_E_FAILURE;
+	}
+	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);
+
+		if (qdf_atomic_test_bit(CMD_MARKED_FOR_ACTIVATION,
+					&cmd_list->cmd_in_use))
+			status = QDF_STATUS_SUCCESS;
+	}
+
+	wlan_serialization_release_lock(&pdev_queue->pdev_queue_lock);
+
+	return status;
+}