[dpdk-dev,v4,4/4] eventdev: add device started attribute

Message ID 1505405343-18234-5-git-send-email-harry.van.haaren@intel.com (mailing list archive)
State Superseded, archived
Delegated to: Jerin Jacob
Headers

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/Intel-compilation success Compilation OK

Commit Message

Van Haaren, Harry Sept. 14, 2017, 4:09 p.m. UTC
  This commit adds an attribute to the eventdev, allowing applications
to retrieve if the eventdev is running or stopped. Note that no API
or ABI changes were required in adding the statistic, and code changes
are minimal.

Signed-off-by: Harry van Haaren <harry.van.haaren@intel.com>
Acked-by: Jerin Jacob <jerin.jacob@caviumnetworks.com>
---
 lib/librte_eventdev/rte_eventdev.c | 3 +++
 lib/librte_eventdev/rte_eventdev.h | 4 ++++
 2 files changed, 7 insertions(+)
  

Patch

diff --git a/lib/librte_eventdev/rte_eventdev.c b/lib/librte_eventdev/rte_eventdev.c
index 73e1df0..480b26e 100644
--- a/lib/librte_eventdev/rte_eventdev.c
+++ b/lib/librte_eventdev/rte_eventdev.c
@@ -740,6 +740,9 @@  rte_event_dev_attr_get(uint8_t dev_id, uint32_t attr_id,
 	case RTE_EVENT_DEV_ATTR_QUEUE_COUNT:
 		*attr_value = dev->data->nb_queues;
 		break;
+	case RTE_EVENT_DEV_ATTR_STARTED:
+		*attr_value = dev->data->dev_started;
+		break;
 	default:
 		return -EINVAL;
 	}
diff --git a/lib/librte_eventdev/rte_eventdev.h b/lib/librte_eventdev/rte_eventdev.h
index 3fd447a..1b629fc 100644
--- a/lib/librte_eventdev/rte_eventdev.h
+++ b/lib/librte_eventdev/rte_eventdev.h
@@ -407,6 +407,10 @@  rte_event_dev_info_get(uint8_t dev_id, struct rte_event_dev_info *dev_info);
  * The count of queues.
  */
 #define RTE_EVENT_DEV_ATTR_QUEUE_COUNT 1
+/**
+ * The status of the device, zero for stopped, non-zero for started.
+ */
+#define RTE_EVENT_DEV_ATTR_STARTED 2
 
 /**
  * Get an attribute from a device.