Skip to contentSkip to conversation

eventdev: add dev id checks to config functions

PATCH In review Harry van Haaren 3 participants 35 messages Jul 24, 2017 – Sep 21, 2017

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 eventdev: add dev id checks to config functions

This commit adds checks to verify the device ID is valid to the following functions. Given that they are non-datapath, these checks are always performed.

This commit also updates the event/octeontx test-cases to have the correct signed-ness, as the API has changes this change is required in order to compile.

---
 lib/librte_eventdev/rte_eventdev.c | 36 +++++++++++++++++++++++++-----------
 lib/librte_eventdev/rte_eventdev.h | 36 ++++++++++++++++++------------------
 test/test/test_eventdev_octeontx.c | 32 +++++++++++++++++++-------------
 3 files changed, 62 insertions(+), 42 deletions(-)
lib/librte_eventdev/rte_eventdev.c +25 -11
index bbb3805..e71f20c 100644
@@ -609,21 +609,26 @@ rte_event_queue_setup(uint8_t dev_id, uint8_t queue_id,
 	return (*dev->dev_ops->queue_setup)(dev, queue_id, queue_conf);
 }
 
-uint8_t
+int16_t
 rte_event_queue_count(uint8_t dev_id)
 {
 	struct rte_eventdev *dev;
+	RTE_EVENTDEV_VALID_DEVID_OR_ERR_RET(dev_id, -EINVAL);
 
 	dev = &rte_eventdevs[dev_id];
 	return dev->data->nb_queues;
 }
 
-uint8_t
+int16_t
 rte_event_queue_priority(uint8_t dev_id, uint8_t queue_id)
 {
-	struct rte_eventdev *dev;
+	struct rte_eventdev *dev = &rte_eventdevs[dev_id];
+	RTE_EVENTDEV_VALID_DEVID_OR_ERR_RET(dev_id, -EINVAL);
+	if (!is_valid_queue(dev, queue_id)) {
+		RTE_EDEV_LOG_ERR("Invalid queue_id=%" PRIu8, queue_id);
+		return -EINVAL;
+	}
 
-	dev = &rte_eventdevs[dev_id];
 	if (dev->data->event_dev_cap & RTE_EVENT_DEV_CAP_QUEUE_QOS)
 		return dev->data->queues_prio[queue_id];
 	else
@@ -743,28 +748,37 @@ rte_event_port_setup(uint8_t dev_id, uint8_t port_id,
 	return 0;
 }
 
-uint8_t
+int16_t
 rte_event_port_dequeue_depth(uint8_t dev_id, uint8_t port_id)
 {
-	struct rte_eventdev *dev;
+	RTE_EVENTDEV_VALID_DEVID_OR_ERR_RET(dev_id, -EINVAL);
+	struct rte_eventdev *dev = &rte_eventdevs[dev_id];
+	if (!is_valid_port(dev, port_id)) {
+		RTE_EDEV_LOG_ERR("Invalid port_id=%" PRIu8, port_id);
+		return -EINVAL;
+	}
 
-	dev = &rte_eventdevs[dev_id];
 	return dev->data->ports_dequeue_depth[port_id];
 }
 
-uint8_t
+int16_t
 rte_event_port_enqueue_depth(uint8_t dev_id, uint8_t port_id)
 {
-	struct rte_eventdev *dev;
+	RTE_EVENTDEV_VALID_DEVID_OR_ERR_RET(dev_id, -EINVAL);
+	struct rte_eventdev *dev = &rte_eventdevs[dev_id];
+	if (!is_valid_port(dev, port_id)) {
+		RTE_EDEV_LOG_ERR("Invalid port_id=%" PRIu8, port_id);
+		return -EINVAL;
+	}
 
-	dev = &rte_eventdevs[dev_id];
 	return dev->data->ports_enqueue_depth[port_id];
 }
 
-uint8_t
+int16_t
 rte_event_port_count(uint8_t dev_id)
 {
 	struct rte_eventdev *dev;
+	RTE_EVENTDEV_VALID_DEVID_OR_ERR_RET(dev_id, -EINVAL);
 
 	dev = &rte_eventdevs[dev_id];
 	return dev->data->nb_ports;
lib/librte_eventdev/rte_eventdev.h +18 -18
index 128bc52..204ff82 100644
@@ -611,10 +611,10 @@ rte_event_queue_setup(uint8_t dev_id, uint8_t queue_id,
  *
  * @param dev_id
  *   Event device identifier.
- * @return
- *   - The number of configured event queues
+ * @retval Positive The number of configured event queues
+ * @retval -EINVAL Invalid device id
  */
-uint8_t
+int16_t
 rte_event_queue_count(uint8_t dev_id);
 
 /**
@@ -624,13 +624,13 @@ rte_event_queue_count(uint8_t dev_id);
  *   Event device identifier.
  * @param queue_id
  *   Event queue identifier.
- * @return
- *   - If the device has RTE_EVENT_DEV_CAP_QUEUE_QOS capability then the
- *    configured priority of the event queue in
- *    [RTE_EVENT_DEV_PRIORITY_HIGHEST, RTE_EVENT_DEV_PRIORITY_LOWEST] range
- *    else the value RTE_EVENT_DEV_PRIORITY_NORMAL
+ * @retval Positive If the device has RTE_EVENT_DEV_CAP_QUEUE_QOS capability
+ *         then the configured priority of the event queue in
+ *         [RTE_EVENT_DEV_PRIORITY_HIGHEST, RTE_EVENT_DEV_PRIORITY_LOWEST]
+ *         range else the value RTE_EVENT_DEV_PRIORITY_NORMAL
+ * @retval -EINVAL Invalid device id or queue id
  */
-uint8_t
+int16_t
 rte_event_queue_priority(uint8_t dev_id, uint8_t queue_id);
 
 /* Event port specific APIs */
@@ -722,12 +722,12 @@ rte_event_port_setup(uint8_t dev_id, uint8_t port_id,
  *   Event device identifier.
  * @param port_id
  *   Event port identifier.
- * @return
- *   - The number of configured dequeue queue depth
+ * @retval Positive The dequeue queue depth
+ * @retval -EINVAL Invalid device ID or port ID
  *
  * @see rte_event_dequeue_burst()
  */
-uint8_t
+int16_t
 rte_event_port_dequeue_depth(uint8_t dev_id, uint8_t port_id);
 
 /**
@@ -738,12 +738,12 @@ rte_event_port_dequeue_depth(uint8_t dev_id, uint8_t port_id);
  *   Event device identifier.
  * @param port_id
  *   Event port identifier.
- * @return
- *   - The number of configured enqueue queue depth
+ * @retval Positive The enqueue queue depth
+ * @retval -EINVAL Invalid device ID or port ID
  *
  * @see rte_event_enqueue_burst()
  */
-uint8_t
+int16_t
 rte_event_port_enqueue_depth(uint8_t dev_id, uint8_t port_id);
 
 /**
@@ -751,10 +751,10 @@ rte_event_port_enqueue_depth(uint8_t dev_id, uint8_t port_id);
  *
  * @param dev_id
  *   Event device identifier.
- * @return
- *   - The number of configured ports
+ * @retval Positive The number of configured ports
+ * @retval -EINVAL Invalid device id
  */
-uint8_t
+int16_t
 rte_event_port_count(uint8_t dev_id);
 
 /**
test/test/test_eventdev_octeontx.c +19 -13
index 774d030..6794f1f 100644
@@ -591,7 +591,7 @@ wait_workers_to_join(int lcore, const rte_atomic32_t *count)
 static inline int
 launch_workers_and_wait(int (*master_worker)(void *),
 			int (*slave_workers)(void *), uint32_t total_events,
-			uint8_t nb_workers, uint8_t sched_type)
+			int16_t nb_workers, uint8_t sched_type)
 {
 	uint8_t port = 0;
 	int w_lcore;
@@ -651,14 +651,15 @@ static int
 test_multi_queue_enq_multi_port_deq(void)
 {
 	const unsigned int total_events = MAX_EVENTS;
-	uint8_t nr_ports;
+	int16_t nr_ports;
 	int ret;
 
 	ret = generate_random_events(total_events);
 	if (ret)
 		return TEST_FAILED;
 
-	nr_ports = RTE_MIN(rte_event_port_count(evdev), rte_lcore_count() - 1);
+	nr_ports = RTE_MIN(rte_event_port_count(evdev),
+			(int)rte_lcore_count() - 1);
 
 	if (!nr_ports) {
 		printf("%s: Not enough ports=%d or workers=%d\n", __func__,
@@ -698,7 +699,7 @@ test_queue_to_port_single_link(void)
 	}
 
 	nr_links = RTE_MIN(rte_event_port_count(evdev),
-				rte_event_queue_count(evdev));
+				(int)rte_event_queue_count(evdev));
 	const unsigned int total_events = MAX_EVENTS / nr_links;
 
 	/* Link queue x to port x and inject events to queue x through port x */
@@ -750,7 +751,8 @@ static int
 test_queue_to_port_multi_link(void)
 {
 	int ret, port0_events = 0, port1_events = 0;
-	uint8_t nr_queues, nr_ports, queue, port;
+	int16_t nr_queues, nr_ports, port;
+	uint8_t queue;
 
 	nr_queues = rte_event_queue_count(evdev);
 	nr_ports = rte_event_port_count(evdev);
@@ -854,10 +856,11 @@ test_multiport_flow_sched_type_test(uint8_t in_sched_type,
 			uint8_t out_sched_type)
 {
 	const unsigned int total_events = MAX_EVENTS;
-	uint8_t nr_ports;
+	int16_t nr_ports;
 	int ret;
 
-	nr_ports = RTE_MIN(rte_event_port_count(evdev), rte_lcore_count() - 1);
+	nr_ports = RTE_MIN(rte_event_port_count(evdev),
+			(int)rte_lcore_count() - 1);
 
 	if (!nr_ports) {
 		printf("%s: Not enough ports=%d or workers=%d\n", __func__,
@@ -1007,10 +1010,11 @@ test_multiport_queue_sched_type_test(uint8_t in_sched_type,
 			uint8_t out_sched_type)
 {
 	const unsigned int total_events = MAX_EVENTS;
-	uint8_t nr_ports;
+	int16_t nr_ports;
 	int ret;
 
-	nr_ports = RTE_MIN(rte_event_port_count(evdev), rte_lcore_count() - 1);
+	nr_ports = RTE_MIN(rte_event_port_count(evdev),
+			(int)rte_lcore_count() - 1);
 
 	if (rte_event_queue_count(evdev) < 2 ||  !nr_ports) {
 		printf("%s: Not enough queues=%d ports=%d or workers=%d\n",
@@ -1142,10 +1146,11 @@ worker_flow_based_pipeline_max_stages_rand_sched_type(void *arg)
 static int
 launch_multi_port_max_stages_random_sched_type(int (*fn)(void *))
 {
-	uint8_t nr_ports;
+	int16_t nr_ports;
 	int ret;
 
-	nr_ports = RTE_MIN(rte_event_port_count(evdev), rte_lcore_count() - 1);
+	nr_ports = RTE_MIN(rte_event_port_count(evdev),
+			(int)rte_lcore_count() - 1);
 
 	if (!nr_ports) {
 		printf("%s: Not enough ports=%d or workers=%d\n", __func__,
@@ -1288,9 +1293,10 @@ worker_ordered_flow_producer(void *arg)
 static inline int
 test_producer_consumer_ingress_order_test(int (*fn)(void *))
 {
-	uint8_t nr_ports;
+	int16_t nr_ports;
 
-	nr_ports = RTE_MIN(rte_event_port_count(evdev), rte_lcore_count() - 1);
+	nr_ports = RTE_MIN(rte_event_port_count(evdev),
+			(int)rte_lcore_count() - 1);
 
 	if (rte_lcore_count() < 3 || nr_ports < 2) {
 		printf("### Not enough cores for %s test.\n", __func__);
Signature · 1 line
2.7.4
#1 lore raw

-----Original Message-----

Quoted 11 lines

Date: Mon, 24 Jul 2017 13:48:20 +0100
From: Harry van Haaren <[email protected]>
To: [email protected]
CC: [email protected], Harry van Haaren
<[email protected]>
Subject: [PATCH] eventdev: add dev id checks to config functions
X-Mailer: git-send-email 2.7.4

This commit adds checks to verify the device ID is valid to the following functions. Given that they are non-datapath, these checks are always performed.

Makes sense.

Quoted 10 lines

This commit also updates the event/octeontx test-cases to have the correct signed-ness, as the API has changes this change is required in order to compile.

---

test/test/test_eventdev_octeontx.c worker_ordered_flow_producer(void *arg) · line 1299

Quoted 9 lines
test/test/test_eventdev_octeontx.c +3 -2
@@ -1288,9 +1293,10 @@ worker_ordered_flow_producer(void *arg)
 static inline int
 test_producer_consumer_ingress_order_test(int (*fn)(void *))
 {
-	uint8_t nr_ports;
+	int16_t nr_ports;
 
-	nr_ports = RTE_MIN(rte_event_port_count(evdev), rte_lcore_count() - 1);
+	nr_ports = RTE_MIN(rte_event_port_count(evdev),
+			(int)rte_lcore_count() - 1);

While I agree on the problem statement, I am trying to see
1/ an API symmetrical to ethdev APIs. Similar problem solved in a differently in ethdev. see rte_eth_dev_adjust_nb_rx_tx_desc().
Just want to make sure, all the APIs across ethdev, eventdev looks same

2/ How to get rid of above typecasting

Considering above two points and following the rte_eth_dev_adjust_nb_rx_tx_desc() pattern. How about,

Removing,
rte_event_port_dequeue_depth()
rte_event_port_enqueue_depth()
rte_event_port_count()

rte_event_queue_count()
rte_event_queue_priority()

and change to,

int rte_event_port_attr_get(uint8_t dev_id, uint8_t port_id,
uint8_t *enqueue_depth /*out */, uint8_t *dequeue_depth /* out*/, uin8_t *count /*out*/);

int rte_event_queue_attr_get(uint8_t dev_id, uint8_t port_id, uin8_t *prio /* out */, uint8_t *count /*out */);

or something similar.

#2 lore raw
Quoted 15 lines

From: Jerin Jacob [mailto:[email protected]]
Sent: Monday, September 4, 2017 6:21 AM
To: Van Haaren, Harry <[email protected]>
Cc: [email protected]
Subject: Re: [PATCH] eventdev: add dev id checks to config functions

-----Original Message-----

Quoted 8 lines

Date: Mon, 24 Jul 2017 13:48:20 +0100
From: Harry van Haaren <[email protected]>
To: [email protected]
CC: [email protected], Harry van Haaren
<[email protected]>
Subject: [PATCH] eventdev: add dev id checks to config functions
X-Mailer: git-send-email 2.7.4

Quoted 5 lines
Quoted 3 lines

This commit adds checks to verify the device ID is valid to the following functions. Given that they are non-datapath, these checks are always performed.

Makes sense.

Great - lets discuss implementation ;)

Quoted 39 lines
Quoted 9 lines

This commit also updates the event/octeontx test-cases to have the correct signed-ness, as the API has changes this change is required in order to compile.

---

test/test/test_eventdev_octeontx.c worker_ordered_flow_producer(void *arg) · line 1299

Quoted 9 lines
test/test/test_eventdev_octeontx.c +3 -2
@@ -1288,9 +1293,10 @@ worker_ordered_flow_producer(void *arg)
 static inline int
 test_producer_consumer_ingress_order_test(int (*fn)(void *))
 {
-	uint8_t nr_ports;
+	int16_t nr_ports;
 
-	nr_ports = RTE_MIN(rte_event_port_count(evdev), rte_lcore_count() - 1);
+	nr_ports = RTE_MIN(rte_event_port_count(evdev),
+			(int)rte_lcore_count() - 1);

While I agree on the problem statement, I am trying to see
1/ an API symmetrical to ethdev APIs. Similar problem solved in a differently in ethdev. see rte_eth_dev_adjust_nb_rx_tx_desc().
Just want to make sure, all the APIs across ethdev, eventdev looks same

2/ How to get rid of above typecasting

Considering above two points and following the rte_eth_dev_adjust_nb_rx_tx_desc() pattern. How about,

Removing,
rte_event_port_dequeue_depth()
rte_event_port_enqueue_depth()
rte_event_port_count()

rte_event_queue_count()
rte_event_queue_priority()

and change to,

Quoted 7 lines

int rte_event_port_attr_get(uint8_t dev_id, uint8_t port_id,
uint8_t *enqueue_depth /*out */, uint8_t *dequeue_depth /* out*/, uin8_t *count /*out*/);

int rte_event_queue_attr_get(uint8_t dev_id, uint8_t port_id, uin8_t *prio /* out */, uint8_t *count /*out */);

or something similar.

Hmm, I don't like that we'd have to break ABI every time we want to add an item to attr_get().. so adding a parameter "attr_id" would allow adding events in future. This solution feels a bit like a re-implementation of the xstats API..

Thoughts? -H

enum {
PORT_COUNT,
PORT_DEQUEUE_DEPTH,
PORT_ENQUEUE_DEPTH,
}

/* retrieve value of port
int rte_event_port_attr_get(uint8_t dev_id, uint8_t port_id, uint32_t attr_id, uint32_t *attr_value /* out */);

#3 lore raw

-----Original Message-----

Quoted 82 lines

Date: Wed, 6 Sep 2017 14:45:29 +0000
From: "Van Haaren, Harry" <[email protected]>
To: Jerin Jacob <[email protected]>
CC: "[email protected]" <[email protected]>
Subject: RE: [PATCH] eventdev: add dev id checks to config functions

Quoted 15 lines

From: Jerin Jacob [mailto:[email protected]]
Sent: Monday, September 4, 2017 6:21 AM
To: Van Haaren, Harry <[email protected]>
Cc: [email protected]
Subject: Re: [PATCH] eventdev: add dev id checks to config functions

-----Original Message-----

Quoted 8 lines

Date: Mon, 24 Jul 2017 13:48:20 +0100
From: Harry van Haaren <[email protected]>
To: [email protected]
CC: [email protected], Harry van Haaren
<[email protected]>
Subject: [PATCH] eventdev: add dev id checks to config functions
X-Mailer: git-send-email 2.7.4

Quoted 5 lines
Quoted 3 lines

This commit adds checks to verify the device ID is valid to the following functions. Given that they are non-datapath, these checks are always performed.

Makes sense.

Great - lets discuss implementation ;)

Quoted 39 lines
Quoted 9 lines

This commit also updates the event/octeontx test-cases to have the correct signed-ness, as the API has changes this change is required in order to compile.

---

test/test/test_eventdev_octeontx.c worker_ordered_flow_producer(void *arg) · line 1299

Quoted 9 lines
test/test/test_eventdev_octeontx.c +3 -2
@@ -1288,9 +1293,10 @@ worker_ordered_flow_producer(void *arg)
 static inline int
 test_producer_consumer_ingress_order_test(int (*fn)(void *))
 {
-	uint8_t nr_ports;
+	int16_t nr_ports;
 
-	nr_ports = RTE_MIN(rte_event_port_count(evdev), rte_lcore_count() - 1);
+	nr_ports = RTE_MIN(rte_event_port_count(evdev),
+			(int)rte_lcore_count() - 1);

While I agree on the problem statement, I am trying to see
1/ an API symmetrical to ethdev APIs. Similar problem solved in a differently in ethdev. see rte_eth_dev_adjust_nb_rx_tx_desc().
Just want to make sure, all the APIs across ethdev, eventdev looks same

2/ How to get rid of above typecasting

Considering above two points and following the rte_eth_dev_adjust_nb_rx_tx_desc() pattern. How about,

Removing,
rte_event_port_dequeue_depth()
rte_event_port_enqueue_depth()
rte_event_port_count()

rte_event_queue_count()
rte_event_queue_priority()

and change to,

Quoted 7 lines

int rte_event_port_attr_get(uint8_t dev_id, uint8_t port_id,
uint8_t *enqueue_depth /*out */, uint8_t *dequeue_depth /* out*/, uin8_t *count /*out*/);

int rte_event_queue_attr_get(uint8_t dev_id, uint8_t port_id, uin8_t *prio /* out */, uint8_t *count /*out */);

or something similar.

Hmm, I don't like that we'd have to break ABI every time we want to add an item to attr_get().. so adding a parameter "attr_id" would allow adding events in future. This solution feels a bit like a re-implementation of the xstats API..

Thoughts? -H

Quoted 8 lines

enum {
PORT_COUNT,
PORT_DEQUEUE_DEPTH,
PORT_ENQUEUE_DEPTH,
}

/* retrieve value of port
int rte_event_port_attr_get(uint8_t dev_id, uint8_t port_id, uint32_t attr_id, uint32_t *attr_value /* out */);

Looks good to me.

Quoted 2 lines
#4 lore raw

v2 cover eventdev: add attribute based get APIs

In reply to Harry van Haaren

This patchset refactors the eventdev API to be more flexible and capable. In particular, the API is capable of returning an error value if an invalid device, port or attribute ID is passed in, which was not possible with the previous APIs.

The implementation of this patchset is based on a v1 patch[1], and after some discussion this API was seen as the best solution.

In terms of flexibility, the attribute id allows addition of new common eventdev layer attributes without breaking ABI or adding new functions. Note that these attributes are not data-path, and that PMDs should continue to use the xstats API for reporting any unique PMD statistics that are available.

Regarding API/ABI compatibility, I have removed the functions from the .map files - please review the .map file changes for ABI issues carefully.

The last patch of this series adds a started attribute to the device, allowing the application to query if a device is currently running.

-Harry

[1] http://dpdk.org/dev/patchwork/patch/27152/

Harry van Haaren (3):
eventdev: add port attribute function
eventdev: add dev attribute get function
eventdev: add queue attribute function

 lib/librte_eventdev/rte_eventdev.c           |  88 +++++++++++------
 lib/librte_eventdev/rte_eventdev.h           | 115 ++++++++++-----------
 lib/librte_eventdev/rte_eventdev_version.map |  12 ++-
 test/test/test_eventdev.c                    | 132 +++++++++++++++++++------
 test/test/test_eventdev_octeontx.c           | 143 ++++++++++++++++++++-------
 5 files changed, 334 insertions(+), 156 deletions(-)
Signature · 1 line
2.7.4
#5 lore raw

PATCH v2 1/4 eventdev: add port attribute function

This commit reworks the port functions to retrieve information about the port, like the enq or deq depths. Note that "port count" is a device attribute, and is added in a later patch for dev attributes.

---
 lib/librte_eventdev/rte_eventdev.c           | 33 +++++++++++--------
 lib/librte_eventdev/rte_eventdev.h           | 49 ++++++++++++----------------
 lib/librte_eventdev/rte_eventdev_version.map |  7 ++++
 test/test/test_eventdev.c                    | 16 ++++++---
 4 files changed, 59 insertions(+), 46 deletions(-)
lib/librte_eventdev/rte_eventdev.c +19 -14
index bbb3805..6b867b3 100644
@@ -744,30 +744,35 @@ rte_event_port_setup(uint8_t dev_id, uint8_t port_id,
 }
 
 uint8_t
-rte_event_port_dequeue_depth(uint8_t dev_id, uint8_t port_id)
+rte_event_port_count(uint8_t dev_id)
 {
 	struct rte_eventdev *dev;
 
 	dev = &rte_eventdevs[dev_id];
-	return dev->data->ports_dequeue_depth[port_id];
+	return dev->data->nb_ports;
 }
 
-uint8_t
-rte_event_port_enqueue_depth(uint8_t dev_id, uint8_t port_id)
+int
+rte_event_port_attr_get(uint8_t dev_id, uint8_t port_id, uint32_t attr_id,
+			uint32_t *attr_value /*out */)
 {
 	struct rte_eventdev *dev;
-
+	RTE_EVENTDEV_VALID_DEVID_OR_ERR_RET(dev_id, -EINVAL);
 	dev = &rte_eventdevs[dev_id];
-	return dev->data->ports_enqueue_depth[port_id];
-}
-
-uint8_t
-rte_event_port_count(uint8_t dev_id)
-{
-	struct rte_eventdev *dev;
+	if (!is_valid_port(dev, port_id)) {
+		RTE_EDEV_LOG_ERR("Invalid port_id=%" PRIu8, port_id);
+		return -EINVAL;
+	}
 
-	dev = &rte_eventdevs[dev_id];
-	return dev->data->nb_ports;
+	switch(attr_id) {
+	case RTE_EVENT_PORT_ATTR_ENQ_DEPTH:
+		*attr_value = dev->data->ports_enqueue_depth[port_id];
+		break;
+	case RTE_EVENT_PORT_ATTR_DEQ_DEPTH:
+		*attr_value = dev->data->ports_dequeue_depth[port_id];
+		break;
+	};
+	return 0;
 }
 
 int
lib/librte_eventdev/rte_eventdev.h +21 -28

68 lines not on this page · raw message

lib/librte_eventdev/rte_eventdev_version.map +7 -0
index 4c48e5f..a0adde3 100644
@@ -51,3 +51,10 @@ DPDK_17.08 {
 	rte_event_ring_init;
 	rte_event_ring_lookup;
 } DPDK_17.05;
+
+EXPERIMENTAL {
+	global:
+
+	rte_event_port_attr_get;
+
+} DPDK_17.08;
test/test/test_eventdev.c +12 -4
index f766191..f3ec470 100644
@@ -460,8 +460,12 @@ test_eventdev_dequeue_depth(void)
 	ret = rte_event_port_setup(TEST_DEV_ID, 0, &pconf);
 	TEST_ASSERT_SUCCESS(ret, "Failed to setup port0");
 
-	TEST_ASSERT_EQUAL(rte_event_port_dequeue_depth(TEST_DEV_ID, 0),
-		 pconf.dequeue_depth, "Wrong port dequeue depth");
+	uint32_t value;
+	TEST_ASSERT_EQUAL(rte_event_port_attr_get(TEST_DEV_ID, 0,
+			RTE_EVENT_PORT_ATTR_DEQ_DEPTH, &value),
+			0, "Call to port dequeue depth failed");
+	TEST_ASSERT_EQUAL(value, pconf.dequeue_depth,
+			"Wrong port dequeue depth");
 
 	return TEST_SUCCESS;
 }
@@ -481,8 +485,12 @@ test_eventdev_enqueue_depth(void)
 	ret = rte_event_port_setup(TEST_DEV_ID, 0, &pconf);
 	TEST_ASSERT_SUCCESS(ret, "Failed to setup port0");
 
-	TEST_ASSERT_EQUAL(rte_event_port_enqueue_depth(TEST_DEV_ID, 0),
-		 pconf.enqueue_depth, "Wrong port enqueue depth");
+	uint32_t value;
+	TEST_ASSERT_EQUAL(rte_event_port_attr_get(TEST_DEV_ID, 0,
+			RTE_EVENT_PORT_ATTR_ENQ_DEPTH, &value),
+			0, "Call to port enqueue depth failed");
+	TEST_ASSERT_EQUAL(value, pconf.dequeue_depth,
+			"Wrong port enqueue depth");
 
 	return TEST_SUCCESS;
 }
Signature · 1 line
2.7.4
#6 lore raw

PATCH v2 2/4 eventdev: add dev attribute get function

In reply to Harry van Haaren

This commit adds a device attribute function, allowing flexible fetching of device attributes, like port count or queue count. The unit tests and .map file are updated to the new function.

---
 lib/librte_eventdev/rte_eventdev.c           | 24 ++++++++--
 lib/librte_eventdev/rte_eventdev.h           | 28 ++++++++---
 lib/librte_eventdev/rte_eventdev_version.map |  2 +-
 test/test/test_eventdev.c                    | 36 +++++++++++---
 test/test/test_eventdev_octeontx.c           | 72 ++++++++++++++++++++--------
 5 files changed, 124 insertions(+), 38 deletions(-)
lib/librte_eventdev/rte_eventdev.c +21 -3
index 6b867b3..177dc6b 100644
@@ -743,13 +743,27 @@ rte_event_port_setup(uint8_t dev_id, uint8_t port_id,
 	return 0;
 }
 
-uint8_t
-rte_event_port_count(uint8_t dev_id)
+int
+rte_event_dev_attr_get(uint8_t dev_id, uint32_t attr_id,
+		       uint32_t *attr_value /*out */)
 {
 	struct rte_eventdev *dev;
 
+	if(!attr_value)
+		return -EINVAL;
+	RTE_EVENTDEV_VALID_DEVID_OR_ERR_RET(dev_id, -EINVAL);
 	dev = &rte_eventdevs[dev_id];
-	return dev->data->nb_ports;
+
+	switch(attr_id) {
+	case RTE_EVENT_DEV_ATTR_PORT_COUNT:
+		*attr_value = dev->data->nb_ports;
+		break;
+	case RTE_EVENT_DEV_ATTR_QUEUE_COUNT:
+		*attr_value = dev->data->nb_queues;
+		break;
+	}
+
+	return 0;
 }
 
 int
@@ -757,6 +771,10 @@ rte_event_port_attr_get(uint8_t dev_id, uint8_t port_id, uint32_t attr_id,
 			uint32_t *attr_value /*out */)
 {
 	struct rte_eventdev *dev;
+
+	if(!attr_value)
+		return -EINVAL;
+
 	RTE_EVENTDEV_VALID_DEVID_OR_ERR_RET(dev_id, -EINVAL);
 	dev = &rte_eventdevs[dev_id];
 	if (!is_valid_port(dev, port_id)) {
lib/librte_eventdev/rte_eventdev.h +21 -7
index fadc209..e931eb2 100644
@@ -715,15 +715,29 @@ rte_event_port_setup(uint8_t dev_id, uint8_t port_id,
 		     const struct rte_event_port_conf *port_conf);
 
 /**
- * Get the number of ports on a specific event device
+ * The count of ports.
+ */
+#define RTE_EVENT_DEV_ATTR_PORT_COUNT 0
+/**
+ * The count of queues.
+ */
+#define RTE_EVENT_DEV_ATTR_QUEUE_COUNT 1
+
+/**
+ * Get an attribute from a device.
  *
- * @param dev_id
- *   Event device identifier.
- * @return
- *   - The number of configured ports
+ * @param dev_id Eventdev id
+ * @param attr_id The attribute ID to retrieve
+ * @param[out] attr_value A pointer that will be filled in with the attribute
+ *             value if successful.
+ *
+ * @retval 0 Successfully retrieved attribute value
+ *         -EINVAL Invalid device or  *attr_id* provided, or *attr_value*
+ *         is NULL
  */
-uint8_t
-rte_event_port_count(uint8_t dev_id);
+int
+rte_event_dev_attr_get(uint8_t dev_id, uint32_t attr_id,
+		       uint32_t *attr_value /*out */);
 
 /**
  * The queue depth of the port on the enqueue side
lib/librte_eventdev/rte_eventdev_version.map +1 -1
index a0adde3..484a071 100644
@@ -21,7 +21,6 @@ DPDK_17.05 {
 	rte_event_port_setup;
 	rte_event_port_dequeue_depth;
 	rte_event_port_enqueue_depth;
-	rte_event_port_count;
 	rte_event_port_link;
 	rte_event_port_unlink;
 	rte_event_port_links_get;
@@ -55,6 +54,7 @@ DPDK_17.08 {
 EXPERIMENTAL {
 	global:
 
+	rte_event_dev_attr_get;
 	rte_event_port_attr_get;
 
 } DPDK_17.08;
test/test/test_eventdev.c +29 -7
index f3ec470..a87b113 100644
@@ -386,11 +386,16 @@ test_eventdev_port_default_conf_get(void)
 	ret = rte_event_port_default_conf_get(TEST_DEV_ID, 0, NULL);
 	TEST_ASSERT(ret == -EINVAL, "Expected -EINVAL, %d", ret);
 
+	uint32_t port_count;
+	TEST_ASSERT_SUCCESS(rte_event_dev_attr_get(TEST_DEV_ID,
+				RTE_EVENT_DEV_ATTR_PORT_COUNT,
+				&port_count), "Port count get failed");
+
 	ret = rte_event_port_default_conf_get(TEST_DEV_ID,
-			rte_event_port_count(TEST_DEV_ID) + 1, NULL);
+			port_count + 1, NULL);
 	TEST_ASSERT(ret == -EINVAL, "Expected -EINVAL, %d", ret);
 
-	for (i = 0; i < rte_event_port_count(TEST_DEV_ID); i++) {
+	for (i = 0; i < (int)port_count; i++) {
 		ret = rte_event_port_default_conf_get(TEST_DEV_ID, i,
 							&pconf);
 		TEST_ASSERT_SUCCESS(ret, "Failed to get port%d info", i);
@@ -436,8 +441,12 @@ test_eventdev_port_setup(void)
 	ret = rte_event_port_setup(TEST_DEV_ID, 0, &pconf);
 	TEST_ASSERT_SUCCESS(ret, "Failed to setup port0");
 
+	uint32_t port_count;
+	TEST_ASSERT_SUCCESS(rte_event_dev_attr_get(TEST_DEV_ID,
+				RTE_EVENT_DEV_ATTR_PORT_COUNT,
+				&port_count), "Port count get failed");
 
-	for (i = 0; i < rte_event_port_count(TEST_DEV_ID); i++) {
+	for (i = 0; i < (int)port_count; i++) {
 		ret = rte_event_port_setup(TEST_DEV_ID, i, NULL);
 		TEST_ASSERT_SUCCESS(ret, "Failed to setup port%d", i);
 	}
@@ -504,8 +513,11 @@ test_eventdev_port_count(void)
 	ret = rte_event_dev_info_get(TEST_DEV_ID, &info);
 	TEST_ASSERT_SUCCESS(ret, "Failed to get event dev info");
 
-	TEST_ASSERT_EQUAL(rte_event_port_count(TEST_DEV_ID),
-		 info.max_event_ports, "Wrong port count");
+	uint32_t port_count;
+	TEST_ASSERT_SUCCESS(rte_event_dev_attr_get(TEST_DEV_ID,
+				RTE_EVENT_DEV_ATTR_PORT_COUNT,
+				&port_count), "Port count get failed");
+	TEST_ASSERT_EQUAL(port_count, info.max_event_ports, "Wrong port count");
 
 	return TEST_SUCCESS;
 }
@@ -537,7 +549,12 @@ test_eventdev_start_stop(void)
 		TEST_ASSERT_SUCCESS(ret, "Failed to setup queue%d", i);
 	}
 
-	for (i = 0; i < rte_event_port_count(TEST_DEV_ID); i++) {
+	uint32_t port_count;
+	TEST_ASSERT_SUCCESS(rte_event_dev_attr_get(TEST_DEV_ID,
+				RTE_EVENT_DEV_ATTR_PORT_COUNT,
+				&port_count), "Port count get failed");
+
+	for (i = 0; i < (int)port_count; i++) {
 		ret = rte_event_port_setup(TEST_DEV_ID, i, NULL);
 		TEST_ASSERT_SUCCESS(ret, "Failed to setup port%d", i);
 	}
@@ -567,7 +584,12 @@ eventdev_setup_device(void)
 		TEST_ASSERT_SUCCESS(ret, "Failed to setup queue%d", i);
 	}
 
-	for (i = 0; i < rte_event_port_count(TEST_DEV_ID); i++) {
+	uint32_t port_count;
+	TEST_ASSERT_SUCCESS(rte_event_dev_attr_get(TEST_DEV_ID,
+				RTE_EVENT_DEV_ATTR_PORT_COUNT,
+				&port_count), "Port count get failed");
+
+	for (i = 0; i < (int)port_count; i++) {
 		ret = rte_event_port_setup(TEST_DEV_ID, i, NULL);
 		TEST_ASSERT_SUCCESS(ret, "Failed to setup port%d", i);
 	}
test/test/test_eventdev_octeontx.c +52 -20

153 lines not on this page · raw message

Signature · 1 line
2.7.4
#7 lore raw

PATCH v2 3/4 eventdev: add queue attribute function

In reply to Harry van Haaren

This commit adds a generic queue attribute function. It also removes the previous rte_event_queue_priority() and priority() functions, and updates the map files and unit tests to use the new attr functions.

---
 lib/librte_eventdev/rte_eventdev.c           | 47 ++++++++--------
 lib/librte_eventdev/rte_eventdev.h           | 49 ++++++++---------
 lib/librte_eventdev/rte_eventdev_version.map |  3 +-
 test/test/test_eventdev.c                    | 80 +++++++++++++++++++++-------
 test/test/test_eventdev_octeontx.c           | 75 +++++++++++++++++++-------
 5 files changed, 166 insertions(+), 88 deletions(-)
lib/librte_eventdev/rte_eventdev.c +26 -21
index 177dc6b..85c0960 100644
@@ -609,27 +609,6 @@ rte_event_queue_setup(uint8_t dev_id, uint8_t queue_id,
 	return (*dev->dev_ops->queue_setup)(dev, queue_id, queue_conf);
 }
 
-uint8_t
-rte_event_queue_count(uint8_t dev_id)
-{
-	struct rte_eventdev *dev;
-
-	dev = &rte_eventdevs[dev_id];
-	return dev->data->nb_queues;
-}
-
-uint8_t
-rte_event_queue_priority(uint8_t dev_id, uint8_t queue_id)
-{
-	struct rte_eventdev *dev;
-
-	dev = &rte_eventdevs[dev_id];
-	if (dev->data->event_dev_cap & RTE_EVENT_DEV_CAP_QUEUE_QOS)
-		return dev->data->queues_prio[queue_id];
-	else
-		return RTE_EVENT_DEV_PRIORITY_NORMAL;
-}
-
 static inline int
 is_valid_port(struct rte_eventdev *dev, uint8_t port_id)
 {
@@ -794,6 +773,32 @@ rte_event_port_attr_get(uint8_t dev_id, uint8_t port_id, uint32_t attr_id,
 }
 
 int
+rte_event_queue_attr_get(uint8_t dev_id, uint8_t queue_id, uint32_t attr_id,
+			uint32_t *attr_value /*out */)
+{
+	struct rte_eventdev *dev;
+
+	if(!attr_value)
+		return -EINVAL;
+
+	RTE_EVENTDEV_VALID_DEVID_OR_ERR_RET(dev_id, -EINVAL);
+	dev = &rte_eventdevs[dev_id];
+	if (!is_valid_queue(dev, queue_id)) {
+		RTE_EDEV_LOG_ERR("Invalid queue_id=%" PRIu8, queue_id);
+		return -EINVAL;
+	}
+
+	switch(attr_id) {
+	case RTE_EVENT_QUEUE_ATTR_PRIORITY:
+		*attr_value = RTE_EVENT_DEV_PRIORITY_NORMAL;
+		if (dev->data->event_dev_cap & RTE_EVENT_DEV_CAP_QUEUE_QOS)
+			*attr_value = dev->data->queues_prio[queue_id];
+		break;
+	};
+	return 0;
+}
+
+int
 rte_event_port_link(uint8_t dev_id, uint8_t port_id,
 		    const uint8_t queues[], const uint8_t priorities[],
 		    uint16_t nb_links)
lib/librte_eventdev/rte_eventdev.h +22 -27

61 lines not on this page · raw message

lib/librte_eventdev/rte_eventdev_version.map +1 -2
index 484a071..c3854f4 100644
@@ -27,8 +27,6 @@ DPDK_17.05 {
 
 	rte_event_queue_default_conf_get;
 	rte_event_queue_setup;
-	rte_event_queue_count;
-	rte_event_queue_priority;
 
 	rte_event_dequeue_timeout_ticks;
 
@@ -56,5 +54,6 @@ EXPERIMENTAL {
 
 	rte_event_dev_attr_get;
 	rte_event_port_attr_get;
+	rte_event_queue_attr_get;
 
 } DPDK_17.08;
test/test/test_eventdev.c +61 -19

172 lines not on this page · raw message

test/test/test_eventdev_octeontx.c +56 -19

167 lines not on this page · raw message

Signature · 1 line
2.7.4
#8 lore raw

PATCH v2 4/4 eventdev: add device started attribute

In reply to Harry van Haaren

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.

---
 lib/librte_eventdev/rte_eventdev.c | 3 +++
 lib/librte_eventdev/rte_eventdev.h | 4 ++++
 2 files changed, 7 insertions(+)
lib/librte_eventdev/rte_eventdev.c +3 -0
index 85c0960..9ec5d42 100644
@@ -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;
 	}
 
 	return 0;
lib/librte_eventdev/rte_eventdev.h +4 -0
index cd3026d..f76d9f9 100644
@@ -695,6 +695,10 @@ rte_event_port_setup(uint8_t dev_id, uint8_t port_id,
  * The count of queues.
  */
 #define RTE_EVENT_DEV_ATTR_QUEUE_COUNT 1
+/**
+ * The state of the device, returns zero if stopped, non-zero when running.
+ */
+#define RTE_EVENT_DEV_ATTR_STARTED 2
 
 /**
  * Get an attribute from a device.
Signature · 1 line
2.7.4
#9 lore raw

v3 cover eventdev: add attribute based get APIs

In reply to Harry van Haaren

This patchset refactors the eventdev API to be more flexible and capable. In particular, the API is capable of returning an error value if an invalid device, port or attribute ID is passed in, which was not possible with the previous APIs.

The implementation of this patchset is based on a v1 patch[1], and after some discussion this API was seen as the best solution.

In terms of flexibility, the attribute id allows addition of new common eventdev layer attributes without breaking ABI or adding new functions. Note that these attributes are not data-path, and that PMDs should continue to use the xstats API for reporting any unique PMD statistics that are available.

Regarding API/ABI compatibility, I have removed the functions from the .map files - please review the .map file changes for ABI issues carefully.

The last patch of this series adds a started attribute to the device, allowing the application to query if a device is currently running.

-Harry

[1] http://dpdk.org/dev/patchwork/patch/27152/

---

v3:
- Fix checkpatch issues... somehow I broke my checkpatch script :/

v2:
- New APIs design based on discussion of initial patch.

Harry van Haaren (4):
eventdev: add port attribute function
eventdev: add dev attribute get function
eventdev: add queue attribute function
eventdev: add device started attribute

 lib/librte_eventdev/rte_eventdev.c           |  91 +++++++++++------
 lib/librte_eventdev/rte_eventdev.h           | 118 +++++++++++-----------
 lib/librte_eventdev/rte_eventdev_version.map |  12 ++-
 test/test/test_eventdev.c                    | 132 +++++++++++++++++++------
 test/test/test_eventdev_octeontx.c           | 143 ++++++++++++++++++++-------
 5 files changed, 340 insertions(+), 156 deletions(-)
Signature · 1 line
2.7.4
#10 lore raw

PATCH v3 1/4 eventdev: add port attribute function

This commit reworks the port functions to retrieve information about the port, like the enq or deq depths. Note that "port count" is a device attribute, and is added in a later patch for dev attributes.

---
 lib/librte_eventdev/rte_eventdev.c           | 33 +++++++++++--------
 lib/librte_eventdev/rte_eventdev.h           | 49 ++++++++++++----------------
 lib/librte_eventdev/rte_eventdev_version.map |  7 ++++
 test/test/test_eventdev.c                    | 16 ++++++---
 4 files changed, 59 insertions(+), 46 deletions(-)
lib/librte_eventdev/rte_eventdev.c +19 -14
index bbb3805..a02ff0a 100644
@@ -744,30 +744,35 @@ rte_event_port_setup(uint8_t dev_id, uint8_t port_id,
 }
 
 uint8_t
-rte_event_port_dequeue_depth(uint8_t dev_id, uint8_t port_id)
+rte_event_port_count(uint8_t dev_id)
 {
 	struct rte_eventdev *dev;
 
 	dev = &rte_eventdevs[dev_id];
-	return dev->data->ports_dequeue_depth[port_id];
+	return dev->data->nb_ports;
 }
 
-uint8_t
-rte_event_port_enqueue_depth(uint8_t dev_id, uint8_t port_id)
+int
+rte_event_port_attr_get(uint8_t dev_id, uint8_t port_id, uint32_t attr_id,
+			uint32_t *attr_value /*out */)
 {
 	struct rte_eventdev *dev;
-
+	RTE_EVENTDEV_VALID_DEVID_OR_ERR_RET(dev_id, -EINVAL);
 	dev = &rte_eventdevs[dev_id];
-	return dev->data->ports_enqueue_depth[port_id];
-}
-
-uint8_t
-rte_event_port_count(uint8_t dev_id)
-{
-	struct rte_eventdev *dev;
+	if (!is_valid_port(dev, port_id)) {
+		RTE_EDEV_LOG_ERR("Invalid port_id=%" PRIu8, port_id);
+		return -EINVAL;
+	}
 
-	dev = &rte_eventdevs[dev_id];
-	return dev->data->nb_ports;
+	switch (attr_id) {
+	case RTE_EVENT_PORT_ATTR_ENQ_DEPTH:
+		*attr_value = dev->data->ports_enqueue_depth[port_id];
+		break;
+	case RTE_EVENT_PORT_ATTR_DEQ_DEPTH:
+		*attr_value = dev->data->ports_dequeue_depth[port_id];
+		break;
+	};
+	return 0;
 }
 
 int
lib/librte_eventdev/rte_eventdev.h +21 -28

68 lines not on this page · raw message

lib/librte_eventdev/rte_eventdev_version.map +7 -0
index 4c48e5f..a0adde3 100644
@@ -51,3 +51,10 @@ DPDK_17.08 {
 	rte_event_ring_init;
 	rte_event_ring_lookup;
 } DPDK_17.05;
+
+EXPERIMENTAL {
+	global:
+
+	rte_event_port_attr_get;
+
+} DPDK_17.08;
test/test/test_eventdev.c +12 -4
index f766191..f3ec470 100644
@@ -460,8 +460,12 @@ test_eventdev_dequeue_depth(void)
 	ret = rte_event_port_setup(TEST_DEV_ID, 0, &pconf);
 	TEST_ASSERT_SUCCESS(ret, "Failed to setup port0");
 
-	TEST_ASSERT_EQUAL(rte_event_port_dequeue_depth(TEST_DEV_ID, 0),
-		 pconf.dequeue_depth, "Wrong port dequeue depth");
+	uint32_t value;
+	TEST_ASSERT_EQUAL(rte_event_port_attr_get(TEST_DEV_ID, 0,
+			RTE_EVENT_PORT_ATTR_DEQ_DEPTH, &value),
+			0, "Call to port dequeue depth failed");
+	TEST_ASSERT_EQUAL(value, pconf.dequeue_depth,
+			"Wrong port dequeue depth");
 
 	return TEST_SUCCESS;
 }
@@ -481,8 +485,12 @@ test_eventdev_enqueue_depth(void)
 	ret = rte_event_port_setup(TEST_DEV_ID, 0, &pconf);
 	TEST_ASSERT_SUCCESS(ret, "Failed to setup port0");
 
-	TEST_ASSERT_EQUAL(rte_event_port_enqueue_depth(TEST_DEV_ID, 0),
-		 pconf.enqueue_depth, "Wrong port enqueue depth");
+	uint32_t value;
+	TEST_ASSERT_EQUAL(rte_event_port_attr_get(TEST_DEV_ID, 0,
+			RTE_EVENT_PORT_ATTR_ENQ_DEPTH, &value),
+			0, "Call to port enqueue depth failed");
+	TEST_ASSERT_EQUAL(value, pconf.dequeue_depth,
+			"Wrong port enqueue depth");
 
 	return TEST_SUCCESS;
 }
Signature · 1 line
2.7.4
#11 lore raw

Re: [PATCH v3 1/4] eventdev: add port attribute function

-----Original Message-----

Quoted 29 lines

Date: Fri, 8 Sep 2017 16:36:52 +0100
From: Harry van Haaren <[email protected]>
To: [email protected]
CC: [email protected], Harry van Haaren
<[email protected]>
Subject: [PATCH v3 1/4] eventdev: add port attribute function
X-Mailer: git-send-email 2.7.4

This commit reworks the port functions to retrieve information about the port, like the enq or deq depths. Note that "port count" is a device attribute, and is added in a later patch for dev attributes.

---
 lib/librte_eventdev/rte_eventdev.c           | 33 +++++++++++--------
 lib/librte_eventdev/rte_eventdev.h           | 49 ++++++++++++----------------
 lib/librte_eventdev/rte_eventdev_version.map |  7 ++++
 test/test/test_eventdev.c                    | 16 ++++++---
 4 files changed, 59 insertions(+), 46 deletions(-)
lib/librte_eventdev/rte_eventdev.c +4 -5
-
-uint8_t
-rte_event_port_count(uint8_t dev_id)
-{
-	struct rte_eventdev *dev;
+	if (!is_valid_port(dev, port_id)) {
+		RTE_EDEV_LOG_ERR("Invalid port_id=%" PRIu8, port_id);
+		return -EINVAL;
+	}

lib/librte_eventdev/rte_eventdev.c rte_event_port_setup(uint8_t dev_id, uint8_t port_id, · line 773

Quoted 10 lines
lib/librte_eventdev/rte_eventdev.c +7 -2
 
-	dev = &rte_eventdevs[dev_id];
-	return dev->data->nb_ports;
+	switch (attr_id) {
+	case RTE_EVENT_PORT_ATTR_ENQ_DEPTH:
+		*attr_value = dev->data->ports_enqueue_depth[port_id];
+		break;
+	case RTE_EVENT_PORT_ATTR_DEQ_DEPTH:
+		*attr_value = dev->data->ports_dequeue_depth[port_id];
+		break;

IMO, We should have "default:" case here to detect invalid attr_id here and return the error code accordingly in the header file as well.

lib/librte_eventdev/rte_eventdev_version.map DPDK_17.08 { · line 52

Quoted 12 lines
lib/librte_eventdev/rte_eventdev.c +2 -0
+	};
+	return 0;
 }
 /**
  * Start an event device.
lib/librte_eventdev/rte_eventdev_version.map +0 -0
index 4c48e5f..a0adde3 100644
@@ -51,3 +51,10 @@ DPDK_17.08 {
 	rte_event_ring_init;
 	rte_event_ring_lookup;

We should delete the remove functions from here.
like rte_event_port_dequeue_depth() and rte_event_port_enqueue_depth;

lib/librte_eventdev/rte_eventdev_version.map DPDK_17.08 { · line 55

Quoted 3 lines
lib/librte_eventdev/rte_eventdev_version.map +2 -0
 } DPDK_17.05;
+
+EXPERIMENTAL {

Note sure we need to add EXPERIMENTAL here.(i.e other section don't have this)

Quoted 5 lines
lib/librte_eventdev/rte_eventdev_version.map +5 -0
+	global:
+
+	rte_event_port_attr_get;
+
+} DPDK_17.08;
#12 lore raw

PATCH v3 2/4 eventdev: add dev attribute get function

In reply to Harry van Haaren

This commit adds a device attribute function, allowing flexible fetching of device attributes, like port count or queue count. The unit tests and .map file are updated to the new function.

---
 lib/librte_eventdev/rte_eventdev.c           | 24 ++++++++--
 lib/librte_eventdev/rte_eventdev.h           | 28 ++++++++---
 lib/librte_eventdev/rte_eventdev_version.map |  2 +-
 test/test/test_eventdev.c                    | 36 +++++++++++---
 test/test/test_eventdev_octeontx.c           | 72 ++++++++++++++++++++--------
 5 files changed, 124 insertions(+), 38 deletions(-)
lib/librte_eventdev/rte_eventdev.c +21 -3
index a02ff0a..4b1c0be 100644
@@ -743,13 +743,27 @@ rte_event_port_setup(uint8_t dev_id, uint8_t port_id,
 	return 0;
 }
 
-uint8_t
-rte_event_port_count(uint8_t dev_id)
+int
+rte_event_dev_attr_get(uint8_t dev_id, uint32_t attr_id,
+		       uint32_t *attr_value /*out */)
 {
 	struct rte_eventdev *dev;
 
+	if (!attr_value)
+		return -EINVAL;
+	RTE_EVENTDEV_VALID_DEVID_OR_ERR_RET(dev_id, -EINVAL);
 	dev = &rte_eventdevs[dev_id];
-	return dev->data->nb_ports;
+
+	switch (attr_id) {
+	case RTE_EVENT_DEV_ATTR_PORT_COUNT:
+		*attr_value = dev->data->nb_ports;
+		break;
+	case RTE_EVENT_DEV_ATTR_QUEUE_COUNT:
+		*attr_value = dev->data->nb_queues;
+		break;
+	}
+
+	return 0;
 }
 
 int
@@ -757,6 +771,10 @@ rte_event_port_attr_get(uint8_t dev_id, uint8_t port_id, uint32_t attr_id,
 			uint32_t *attr_value /*out */)
 {
 	struct rte_eventdev *dev;
+
+	if (!attr_value)
+		return -EINVAL;
+
 	RTE_EVENTDEV_VALID_DEVID_OR_ERR_RET(dev_id, -EINVAL);
 	dev = &rte_eventdevs[dev_id];
 	if (!is_valid_port(dev, port_id)) {
lib/librte_eventdev/rte_eventdev.h +21 -7
index fadc209..e931eb2 100644
@@ -715,15 +715,29 @@ rte_event_port_setup(uint8_t dev_id, uint8_t port_id,
 		     const struct rte_event_port_conf *port_conf);
 
 /**
- * Get the number of ports on a specific event device
+ * The count of ports.
+ */
+#define RTE_EVENT_DEV_ATTR_PORT_COUNT 0
+/**
+ * The count of queues.
+ */
+#define RTE_EVENT_DEV_ATTR_QUEUE_COUNT 1
+
+/**
+ * Get an attribute from a device.
  *
- * @param dev_id
- *   Event device identifier.
- * @return
- *   - The number of configured ports
+ * @param dev_id Eventdev id
+ * @param attr_id The attribute ID to retrieve
+ * @param[out] attr_value A pointer that will be filled in with the attribute
+ *             value if successful.
+ *
+ * @retval 0 Successfully retrieved attribute value
+ *         -EINVAL Invalid device or  *attr_id* provided, or *attr_value*
+ *         is NULL
  */
-uint8_t
-rte_event_port_count(uint8_t dev_id);
+int
+rte_event_dev_attr_get(uint8_t dev_id, uint32_t attr_id,
+		       uint32_t *attr_value /*out */);
 
 /**
  * The queue depth of the port on the enqueue side
lib/librte_eventdev/rte_eventdev_version.map +1 -1
index a0adde3..484a071 100644
@@ -21,7 +21,6 @@ DPDK_17.05 {
 	rte_event_port_setup;
 	rte_event_port_dequeue_depth;
 	rte_event_port_enqueue_depth;
-	rte_event_port_count;
 	rte_event_port_link;
 	rte_event_port_unlink;
 	rte_event_port_links_get;
@@ -55,6 +54,7 @@ DPDK_17.08 {
 EXPERIMENTAL {
 	global:
 
+	rte_event_dev_attr_get;
 	rte_event_port_attr_get;
 
 } DPDK_17.08;
test/test/test_eventdev.c +29 -7
index f3ec470..a87b113 100644
@@ -386,11 +386,16 @@ test_eventdev_port_default_conf_get(void)
 	ret = rte_event_port_default_conf_get(TEST_DEV_ID, 0, NULL);
 	TEST_ASSERT(ret == -EINVAL, "Expected -EINVAL, %d", ret);
 
+	uint32_t port_count;
+	TEST_ASSERT_SUCCESS(rte_event_dev_attr_get(TEST_DEV_ID,
+				RTE_EVENT_DEV_ATTR_PORT_COUNT,
+				&port_count), "Port count get failed");
+
 	ret = rte_event_port_default_conf_get(TEST_DEV_ID,
-			rte_event_port_count(TEST_DEV_ID) + 1, NULL);
+			port_count + 1, NULL);
 	TEST_ASSERT(ret == -EINVAL, "Expected -EINVAL, %d", ret);
 
-	for (i = 0; i < rte_event_port_count(TEST_DEV_ID); i++) {
+	for (i = 0; i < (int)port_count; i++) {
 		ret = rte_event_port_default_conf_get(TEST_DEV_ID, i,
 							&pconf);
 		TEST_ASSERT_SUCCESS(ret, "Failed to get port%d info", i);
@@ -436,8 +441,12 @@ test_eventdev_port_setup(void)
 	ret = rte_event_port_setup(TEST_DEV_ID, 0, &pconf);
 	TEST_ASSERT_SUCCESS(ret, "Failed to setup port0");
 
+	uint32_t port_count;
+	TEST_ASSERT_SUCCESS(rte_event_dev_attr_get(TEST_DEV_ID,
+				RTE_EVENT_DEV_ATTR_PORT_COUNT,
+				&port_count), "Port count get failed");
 
-	for (i = 0; i < rte_event_port_count(TEST_DEV_ID); i++) {
+	for (i = 0; i < (int)port_count; i++) {
 		ret = rte_event_port_setup(TEST_DEV_ID, i, NULL);
 		TEST_ASSERT_SUCCESS(ret, "Failed to setup port%d", i);
 	}
@@ -504,8 +513,11 @@ test_eventdev_port_count(void)
 	ret = rte_event_dev_info_get(TEST_DEV_ID, &info);
 	TEST_ASSERT_SUCCESS(ret, "Failed to get event dev info");
 
-	TEST_ASSERT_EQUAL(rte_event_port_count(TEST_DEV_ID),
-		 info.max_event_ports, "Wrong port count");
+	uint32_t port_count;
+	TEST_ASSERT_SUCCESS(rte_event_dev_attr_get(TEST_DEV_ID,
+				RTE_EVENT_DEV_ATTR_PORT_COUNT,
+				&port_count), "Port count get failed");
+	TEST_ASSERT_EQUAL(port_count, info.max_event_ports, "Wrong port count");
 
 	return TEST_SUCCESS;
 }
@@ -537,7 +549,12 @@ test_eventdev_start_stop(void)
 		TEST_ASSERT_SUCCESS(ret, "Failed to setup queue%d", i);
 	}
 
-	for (i = 0; i < rte_event_port_count(TEST_DEV_ID); i++) {
+	uint32_t port_count;
+	TEST_ASSERT_SUCCESS(rte_event_dev_attr_get(TEST_DEV_ID,
+				RTE_EVENT_DEV_ATTR_PORT_COUNT,
+				&port_count), "Port count get failed");
+
+	for (i = 0; i < (int)port_count; i++) {
 		ret = rte_event_port_setup(TEST_DEV_ID, i, NULL);
 		TEST_ASSERT_SUCCESS(ret, "Failed to setup port%d", i);
 	}
@@ -567,7 +584,12 @@ eventdev_setup_device(void)
 		TEST_ASSERT_SUCCESS(ret, "Failed to setup queue%d", i);
 	}
 
-	for (i = 0; i < rte_event_port_count(TEST_DEV_ID); i++) {
+	uint32_t port_count;
+	TEST_ASSERT_SUCCESS(rte_event_dev_attr_get(TEST_DEV_ID,
+				RTE_EVENT_DEV_ATTR_PORT_COUNT,
+				&port_count), "Port count get failed");
+
+	for (i = 0; i < (int)port_count; i++) {
 		ret = rte_event_port_setup(TEST_DEV_ID, i, NULL);
 		TEST_ASSERT_SUCCESS(ret, "Failed to setup port%d", i);
 	}
test/test/test_eventdev_octeontx.c +52 -20

153 lines not on this page · raw message

Signature · 1 line
2.7.4
Acked-by on v3 2/4
#13 lore raw

Re: [PATCH v3 2/4] eventdev: add dev attribute get function

-----Original Message-----

Quoted 40 lines

Date: Fri, 8 Sep 2017 16:36:53 +0100
From: Harry van Haaren <[email protected]>
To: [email protected]
CC: [email protected], Harry van Haaren
<[email protected]>
Subject: [PATCH v3 2/4] eventdev: add dev attribute get function
X-Mailer: git-send-email 2.7.4

This commit adds a device attribute function, allowing flexible fetching of device attributes, like port count or queue count. The unit tests and .map file are updated to the new function.

---
 lib/librte_eventdev/rte_eventdev.c           | 24 ++++++++--
 lib/librte_eventdev/rte_eventdev.h           | 28 ++++++++---
 lib/librte_eventdev/rte_eventdev_version.map |  2 +-
 test/test/test_eventdev.c                    | 36 +++++++++++---
 test/test/test_eventdev_octeontx.c           | 72 ++++++++++++++++++++--------
 5 files changed, 124 insertions(+), 38 deletions(-)
lib/librte_eventdev/rte_eventdev.c +6 -2
index a02ff0a..4b1c0be 100644
@@ -743,13 +743,27 @@ rte_event_port_setup(uint8_t dev_id, uint8_t port_id,
 	return 0;
 }
 
-uint8_t
-rte_event_port_count(uint8_t dev_id)
+int
+rte_event_dev_attr_get(uint8_t dev_id, uint32_t attr_id,
+		       uint32_t *attr_value /*out */)
 {
 	struct rte_eventdev *dev;
 
+	if (!attr_value)
+		return -EINVAL;
+	RTE_EVENTDEV_VALID_DEVID_OR_ERR_RET(dev_id, -EINVAL);

lib/librte_eventdev/rte_eventdev.c rte_event_port_setup(uint8_t dev_id, uint8_t port_id, · line 763

Quoted 10 lines
lib/librte_eventdev/rte_eventdev.c +8 -1
 	dev = &rte_eventdevs[dev_id];
-	return dev->data->nb_ports;
+
+	switch (attr_id) {
+	case RTE_EVENT_DEV_ATTR_PORT_COUNT:
+		*attr_value = dev->data->nb_ports;
+		break;
+	case RTE_EVENT_DEV_ATTR_QUEUE_COUNT:
+		*attr_value = dev->data->nb_queues;
+		break;

Same as previous "default case" comment.

lib/librte_eventdev/rte_eventdev.c rte_event_port_setup(uint8_t dev_id, uint8_t port_id, · line 766

Quoted 3 lines
lib/librte_eventdev/rte_eventdev.c +3 -0
+	}
+
+	return 0;

With above change:

#14 lore raw

PATCH v3 3/4 eventdev: add queue attribute function

In reply to Harry van Haaren

This commit adds a generic queue attribute function. It also removes the previous rte_event_queue_priority() and priority() functions, and updates the map files and unit tests to use the new attr functions.

---
 lib/librte_eventdev/rte_eventdev.c           | 47 ++++++++--------
 lib/librte_eventdev/rte_eventdev.h           | 49 ++++++++---------
 lib/librte_eventdev/rte_eventdev_version.map |  3 +-
 test/test/test_eventdev.c                    | 80 +++++++++++++++++++++-------
 test/test/test_eventdev_octeontx.c           | 75 +++++++++++++++++++-------
 5 files changed, 166 insertions(+), 88 deletions(-)
lib/librte_eventdev/rte_eventdev.c +26 -21
index 4b1c0be..3756ec7 100644
@@ -609,27 +609,6 @@ rte_event_queue_setup(uint8_t dev_id, uint8_t queue_id,
 	return (*dev->dev_ops->queue_setup)(dev, queue_id, queue_conf);
 }
 
-uint8_t
-rte_event_queue_count(uint8_t dev_id)
-{
-	struct rte_eventdev *dev;
-
-	dev = &rte_eventdevs[dev_id];
-	return dev->data->nb_queues;
-}
-
-uint8_t
-rte_event_queue_priority(uint8_t dev_id, uint8_t queue_id)
-{
-	struct rte_eventdev *dev;
-
-	dev = &rte_eventdevs[dev_id];
-	if (dev->data->event_dev_cap & RTE_EVENT_DEV_CAP_QUEUE_QOS)
-		return dev->data->queues_prio[queue_id];
-	else
-		return RTE_EVENT_DEV_PRIORITY_NORMAL;
-}
-
 static inline int
 is_valid_port(struct rte_eventdev *dev, uint8_t port_id)
 {
@@ -794,6 +773,32 @@ rte_event_port_attr_get(uint8_t dev_id, uint8_t port_id, uint32_t attr_id,
 }
 
 int
+rte_event_queue_attr_get(uint8_t dev_id, uint8_t queue_id, uint32_t attr_id,
+			uint32_t *attr_value /*out */)
+{
+	struct rte_eventdev *dev;
+
+	if (!attr_value)
+		return -EINVAL;
+
+	RTE_EVENTDEV_VALID_DEVID_OR_ERR_RET(dev_id, -EINVAL);
+	dev = &rte_eventdevs[dev_id];
+	if (!is_valid_queue(dev, queue_id)) {
+		RTE_EDEV_LOG_ERR("Invalid queue_id=%" PRIu8, queue_id);
+		return -EINVAL;
+	}
+
+	switch (attr_id) {
+	case RTE_EVENT_QUEUE_ATTR_PRIORITY:
+		*attr_value = RTE_EVENT_DEV_PRIORITY_NORMAL;
+		if (dev->data->event_dev_cap & RTE_EVENT_DEV_CAP_QUEUE_QOS)
+			*attr_value = dev->data->queues_prio[queue_id];
+		break;
+	};
+	return 0;
+}
+
+int
 rte_event_port_link(uint8_t dev_id, uint8_t port_id,
 		    const uint8_t queues[], const uint8_t priorities[],
 		    uint16_t nb_links)
lib/librte_eventdev/rte_eventdev.h +22 -27

61 lines not on this page · raw message

lib/librte_eventdev/rte_eventdev_version.map +1 -2
index 484a071..c3854f4 100644
@@ -27,8 +27,6 @@ DPDK_17.05 {
 
 	rte_event_queue_default_conf_get;
 	rte_event_queue_setup;
-	rte_event_queue_count;
-	rte_event_queue_priority;
 
 	rte_event_dequeue_timeout_ticks;
 
@@ -56,5 +54,6 @@ EXPERIMENTAL {
 
 	rte_event_dev_attr_get;
 	rte_event_port_attr_get;
+	rte_event_queue_attr_get;
 
 } DPDK_17.08;
test/test/test_eventdev.c +61 -19

172 lines not on this page · raw message

test/test/test_eventdev_octeontx.c +56 -19

167 lines not on this page · raw message

Signature · 1 line
2.7.4
#15 lore raw

Re: [PATCH v3 3/4] eventdev: add queue attribute function

-----Original Message-----

Quoted 47 lines

Date: Fri, 8 Sep 2017 16:36:54 +0100
From: Harry van Haaren <[email protected]>
To: [email protected]
CC: [email protected], Harry van Haaren
<[email protected]>
Subject: [PATCH v3 3/4] eventdev: add queue attribute function
X-Mailer: git-send-email 2.7.4

This commit adds a generic queue attribute function. It also removes the previous rte_event_queue_priority() and priority() functions, and updates the map files and unit tests to use the new attr functions.

---
 lib/librte_eventdev/rte_eventdev.c           | 47 ++++++++--------
 lib/librte_eventdev/rte_eventdev.h           | 49 ++++++++---------
 lib/librte_eventdev/rte_eventdev_version.map |  3 +-
 test/test/test_eventdev.c                    | 80 +++++++++++++++++++++-------
 test/test/test_eventdev_octeontx.c           | 75 +++++++++++++++++++-------
 5 files changed, 166 insertions(+), 88 deletions(-)
lib/librte_eventdev/rte_eventdev.c +11 -0
index 4b1c0be..3756ec7 100644
@@ -609,27 +609,6 @@ rte_event_queue_setup(uint8_t dev_id, uint8_t queue_id,
 	return (*dev->dev_ops->queue_setup)(dev, queue_id, queue_conf);
 }
 
 static inline int
 is_valid_port(struct rte_eventdev *dev, uint8_t port_id)
 {
@@ -794,6 +773,32 @@ rte_event_port_attr_get(uint8_t dev_id, uint8_t port_id, uint32_t attr_id,
 }
 
 int
+rte_event_queue_attr_get(uint8_t dev_id, uint8_t queue_id, uint32_t attr_id,
+			uint32_t *attr_value /*out */)
+{
+	struct rte_eventdev *dev;
+
+	if (!attr_value)
+		return -EINVAL;
+
+	RTE_EVENTDEV_VALID_DEVID_OR_ERR_RET(dev_id, -EINVAL);
+	dev = &rte_eventdevs[dev_id];
+	if (!is_valid_queue(dev, queue_id)) {

lib/librte_eventdev/rte_eventdev.c rte_event_port_attr_get(uint8_t dev_id, uint8_t port_id, uint32_t attr_id, · line 796

Quoted 10 lines
lib/librte_eventdev/rte_eventdev.c +10 -0
+		RTE_EDEV_LOG_ERR("Invalid queue_id=%" PRIu8, queue_id);
+		return -EINVAL;
+	}
+
+	switch (attr_id) {
+	case RTE_EVENT_QUEUE_ATTR_PRIORITY:
+		*attr_value = RTE_EVENT_DEV_PRIORITY_NORMAL;
+		if (dev->data->event_dev_cap & RTE_EVENT_DEV_CAP_QUEUE_QOS)
+			*attr_value = dev->data->queues_prio[queue_id];
+		break;

The same switch case comment.

Quoted 47 lines
lib/librte_eventdev/rte_eventdev.c +5 -0
+	};
+	return 0;
+}
+
+int
 rte_event_port_link(uint8_t dev_id, uint8_t port_id,
 		    const uint8_t queues[], const uint8_t priorities[],
 		    uint16_t nb_links)
lib/librte_eventdev/rte_eventdev.h +0 -27
index e931eb2..cd3026d 100644
@@ -606,33 +606,6 @@ int
 rte_event_queue_setup(uint8_t dev_id, uint8_t queue_id,
 		      const struct rte_event_queue_conf *queue_conf);
 
-/**
- * Get the number of event queues on a specific event device
- *
- * @param dev_id
- *   Event device identifier.
- * @return
- *   - The number of configured event queues
- */
-uint8_t
-rte_event_queue_count(uint8_t dev_id);
-
-/**
- * Get the priority of the event queue on a specific event device
- *
- * @param dev_id
- *   Event device identifier.
- * @param queue_id
- *   Event queue identifier.
- * @return
- *   - If the device has RTE_EVENT_DEV_CAP_QUEUE_QOS capability then the
- *    configured priority of the event queue in
- *    [RTE_EVENT_DEV_PRIORITY_HIGHEST, RTE_EVENT_DEV_PRIORITY_LOWEST] range
- *    else the value RTE_EVENT_DEV_PRIORITY_NORMAL
- */
-uint8_t
-rte_event_queue_priority(uint8_t dev_id, uint8_t queue_id);
-
 /* Event port specific APIs */
 
 /** Event port configuration structure */

lib/librte_eventdev/rte_eventdev.h rte_event_port_attr_get(uint8_t dev_id, uint8_t port_id, uint32_t attr_id, · line 738

Quoted 1 line
lib/librte_eventdev/rte_eventdev.h +0 -0
@@ -765,6 +738,28 @@ rte_event_port_attr_get(uint8_t dev_id, uint8_t port_id, uint32_t attr_id,
 			uint32_t *attr_value /*out */);

We can remove explicit /* out */.

Quoted 13 lines
lib/librte_eventdev/rte_eventdev.h +11 -0
 /**
+ * The priority of the queue.
+ */
+#define RTE_EVENT_QUEUE_ATTR_PRIORITY 0
+
+/**
+ * Get an attribute from a queue.
+ *
+ * @param dev_id Eventdev id
+ * @param queue_id Eventdev queue id
+ * @param attr_id The attribute ID to retrieve
+ * @param[out] attr_value A pointer that will be filled in with the attribute

lib/librte_eventdev/rte_eventdev.h rte_event_port_attr_get(uint8_t dev_id, uint8_t port_id, uint32_t attr_id, · line 761

Quoted 10 lines
lib/librte_eventdev/rte_eventdev.h +10 -0
+ *             value if successful
+ *
+ * @retval 0 Successfully returned value
+ *         -EINVAL invalid device, queue or attr_id provided, or attr_value
+ *         was NULL
+ */
+int
+rte_event_queue_attr_get(uint8_t dev_id, uint8_t queue_id, uint32_t attr_id,
+			uint32_t *attr_value /*out */);
+

We can remove explicit /* out */.

#16 lore raw

PATCH v3 4/4 eventdev: add device started attribute

In reply to Harry van Haaren

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.

---
 lib/librte_eventdev/rte_eventdev.c | 3 +++
 lib/librte_eventdev/rte_eventdev.h | 4 ++++
 2 files changed, 7 insertions(+)
lib/librte_eventdev/rte_eventdev.c +3 -0
index 3756ec7..87a1e19 100644
@@ -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;
 	}
 
 	return 0;
lib/librte_eventdev/rte_eventdev.h +4 -0
index cd3026d..f76d9f9 100644
@@ -695,6 +695,10 @@ rte_event_port_setup(uint8_t dev_id, uint8_t port_id,
  * The count of queues.
  */
 #define RTE_EVENT_DEV_ATTR_QUEUE_COUNT 1
+/**
+ * The state of the device, returns zero if stopped, non-zero when running.
+ */
+#define RTE_EVENT_DEV_ATTR_STARTED 2
 
 /**
  * Get an attribute from a device.
Signature · 1 line
2.7.4
Acked-by on v3 4/4
#17 lore raw

Re: [PATCH v3 4/4] eventdev: add device started attribute

-----Original Message-----

lib/librte_eventdev/rte_eventdev.c rte_event_dev_attr_get(uint8_t dev_id, uint32_t attr_id,

Quoted 24 lines

Date: Fri, 8 Sep 2017 16:36:55 +0100
From: Harry van Haaren <[email protected]>
To: [email protected]
CC: [email protected], Harry van Haaren
<[email protected]>
Subject: [PATCH v3 4/4] eventdev: add device started attribute
X-Mailer: git-send-email 2.7.4

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.

---
 lib/librte_eventdev/rte_eventdev.c | 3 +++
 lib/librte_eventdev/rte_eventdev.h | 4 ++++
 2 files changed, 7 insertions(+)
lib/librte_eventdev/rte_eventdev.c +0 -0
index 3756ec7..87a1e19 100644
@@ -740,6 +740,9 @@ rte_event_dev_attr_get(uint8_t dev_id, uint32_t attr_id,

I think, the new rte_event_dev_attr_get function, we can move up so that all device specific functions comes back to back in API documentation.

Check the output of "make doc-api-html"

Other than that, it looks good.

#18 lore raw

Re: [PATCH v3 4/4] eventdev: add device started attribute

Quoted 36 lines

From: Jerin Jacob [mailto:[email protected]]
Sent: Monday, September 11, 2017 6:53 PM
To: Van Haaren, Harry <[email protected]>
Cc: [email protected]
Subject: Re: [PATCH v3 4/4] eventdev: add device started attribute

-----Original Message-----

Quoted 13 lines

Date: Fri, 8 Sep 2017 16:36:55 +0100
From: Harry van Haaren <[email protected]>
To: [email protected]
CC: [email protected], Harry van Haaren
<[email protected]>
Subject: [PATCH v3 4/4] eventdev: add device started attribute
X-Mailer: git-send-email 2.7.4

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.

Review

Quoted 7 lines
---
 lib/librte_eventdev/rte_eventdev.c | 3 +++
 lib/librte_eventdev/rte_eventdev.h | 4 ++++
 2 files changed, 7 insertions(+)
(quoted diff) +0 -0

b/lib/librte_eventdev/rte_eventdev.c

lib/librte_eventdev/rte_eventdev.c rte_event_dev_attr_get(uint8_t dev_id, uint32_t attr_id,

Quoted 4 lines

index 3756ec7..87a1e19 100644

lib/librte_eventdev/rte_eventdev.c +0 -0
@@ -740,6 +740,9 @@ rte_event_dev_attr_get(uint8_t dev_id, uint32_t attr_id,

I think, the new rte_event_dev_attr_get function, we can move up so that all device specific functions comes back to back in API documentation.

Quoted 5 lines

Check the output of "make doc-api-html"

Other than that, it looks good.

Thanks for the review - all comments make sense. Will respin with comments addressed, and include Acks.

#19 lore raw

Re: [PATCH v3 0/4] eventdev: add attribute based get APIs

In reply to Harry van Haaren

-----Original Message-----

Quoted 22 lines

Date: Fri, 8 Sep 2017 16:36:51 +0100
From: Harry van Haaren <[email protected]>
To: [email protected]
CC: [email protected], Harry van Haaren
<[email protected]>
Subject: [PATCH v3 0/4] eventdev: add attribute based get APIs
X-Mailer: git-send-email 2.7.4

This patchset refactors the eventdev API to be more flexible and capable. In particular, the API is capable of returning an error value if an invalid device, port or attribute ID is passed in, which was not possible with the previous APIs.

The implementation of this patchset is based on a v1 patch[1], and after some discussion this API was seen as the best solution.

In terms of flexibility, the attribute id allows addition of new common eventdev layer attributes without breaking ABI or adding new functions. Note that these attributes are not data-path, and that PMDs should continue to use the xstats API for reporting any unique PMD statistics that are available.

Quoted 3 lines

Regarding API/ABI compatibility, I have removed the functions from the .map files - please review the .map file changes for ABI issues carefully.

Please update the LIBABIVER in the Makefile.

Reference:

http://dpdk.org/browse/dpdk/commit/?id=945081a76ab0bb481f1d62125aa5b547fcc000bd

#20 lore raw

v4 cover eventdev: add attribute based get APIs

In reply to Harry van Haaren

This patchset refactors the eventdev API to be more flexible and capable. In particular, the API is capable of returning an error value if an invalid device, port or attribute ID is passed in, which was not possible with the previous APIs.

The implementation of this patchset is based on a v1 patch[1], and after some discussion this API was seen as the best solution.

In terms of flexibility, the attribute id allows addition of new common eventdev layer attributes without breaking ABI or adding new functions. Note that these attributes are not data-path, and that PMDs should continue to use the xstats API for reporting any unique PMD statistics that are available.

Regarding API/ABI compatibility, I have removed the functions from the .map files - please review the .map file changes for ABI issues carefully.

The last patch of this series adds a started attribute to the device, allowing the application to query if a device is currently running.

-Harry

[1] http://dpdk.org/dev/patchwork/patch/27152/

---

v4:
- Rework based on review by Jerin
- default: cases into switches
- Remove old functions from .map file
- Remove /* out */ parameters
- Rework header file definitions to match logical order
- Rework patch split
- Cleaner removal of queue_count() function

v3:
- Fix checkpatch issues... somehow I broke my checkpatch script :/

v2:
- New APIs design based on discussion of initial patch.

Harry van Haaren (4):
eventdev: add port attribute function
eventdev: add dev attribute get function
eventdev: add queue attribute function
eventdev: add device started attribute

 lib/librte_eventdev/rte_eventdev.c           |  97 ++++++++++++------
 lib/librte_eventdev/rte_eventdev.h           | 115 +++++++++++----------
 lib/librte_eventdev/rte_eventdev_version.map |  14 ++-
 test/test/test_eventdev.c                    | 132 +++++++++++++++++++------
 test/test/test_eventdev_octeontx.c           | 143 ++++++++++++++++++++-------
 5 files changed, 345 insertions(+), 156 deletions(-)
Signature · 1 line
2.7.4
#21 lore raw

PATCH v4 1/4 eventdev: add port attribute function

This commit reworks the port functions to retrieve information about the port, like the enq or deq depths. Note that "port count" is a device attribute, and is added in a later patch for dev attributes.

---

v4: feedback from http://dpdk.org/dev/patchwork/patch/28520/
- Added default: case into switch, returns -EINVAL as per header file (Jerin)
- Reworked .map file, removed old functions (Jerin)
- Renamed EXPERIMENTAL section of map file to 17.11 (Jerin)
- Removed /* out */ comments in .h and .c (Jerin)

---
 lib/librte_eventdev/rte_eventdev.c           | 35 ++++++++++++--------
 lib/librte_eventdev/rte_eventdev.h           | 49 ++++++++++++----------------
 lib/librte_eventdev/rte_eventdev_version.map |  9 +++--
 test/test/test_eventdev.c                    | 16 ++++++---
 4 files changed, 61 insertions(+), 48 deletions(-)
lib/librte_eventdev/rte_eventdev.c +21 -14
index bbb3805..9eacc73 100644
@@ -744,30 +744,37 @@ rte_event_port_setup(uint8_t dev_id, uint8_t port_id,
 }
 
 uint8_t
-rte_event_port_dequeue_depth(uint8_t dev_id, uint8_t port_id)
+rte_event_port_count(uint8_t dev_id)
 {
 	struct rte_eventdev *dev;
 
 	dev = &rte_eventdevs[dev_id];
-	return dev->data->ports_dequeue_depth[port_id];
+	return dev->data->nb_ports;
 }
 
-uint8_t
-rte_event_port_enqueue_depth(uint8_t dev_id, uint8_t port_id)
+int
+rte_event_port_attr_get(uint8_t dev_id, uint8_t port_id, uint32_t attr_id,
+			uint32_t *attr_value)
 {
 	struct rte_eventdev *dev;
-
+	RTE_EVENTDEV_VALID_DEVID_OR_ERR_RET(dev_id, -EINVAL);
 	dev = &rte_eventdevs[dev_id];
-	return dev->data->ports_enqueue_depth[port_id];
-}
-
-uint8_t
-rte_event_port_count(uint8_t dev_id)
-{
-	struct rte_eventdev *dev;
+	if (!is_valid_port(dev, port_id)) {
+		RTE_EDEV_LOG_ERR("Invalid port_id=%" PRIu8, port_id);
+		return -EINVAL;
+	}
 
-	dev = &rte_eventdevs[dev_id];
-	return dev->data->nb_ports;
+	switch (attr_id) {
+	case RTE_EVENT_PORT_ATTR_ENQ_DEPTH:
+		*attr_value = dev->data->ports_enqueue_depth[port_id];
+		break;
+	case RTE_EVENT_PORT_ATTR_DEQ_DEPTH:
+		*attr_value = dev->data->ports_dequeue_depth[port_id];
+		break;
+	default:
+		return -EINVAL;
+	};
+	return 0;
 }
 
 int
lib/librte_eventdev/rte_eventdev.h +21 -28

68 lines not on this page · raw message

lib/librte_eventdev/rte_eventdev_version.map +7 -2
index 4c48e5f..57d0b72 100644
@@ -19,8 +19,6 @@ DPDK_17.05 {
 
 	rte_event_port_default_conf_get;
 	rte_event_port_setup;
-	rte_event_port_dequeue_depth;
-	rte_event_port_enqueue_depth;
 	rte_event_port_count;
 	rte_event_port_link;
 	rte_event_port_unlink;
@@ -51,3 +49,10 @@ DPDK_17.08 {
 	rte_event_ring_init;
 	rte_event_ring_lookup;
 } DPDK_17.05;
+
+DPDK_17.11 {
+	global:
+
+	rte_event_port_attr_get;
+
+} DPDK_17.08;
test/test/test_eventdev.c +12 -4
index f766191..f3ec470 100644
@@ -460,8 +460,12 @@ test_eventdev_dequeue_depth(void)
 	ret = rte_event_port_setup(TEST_DEV_ID, 0, &pconf);
 	TEST_ASSERT_SUCCESS(ret, "Failed to setup port0");
 
-	TEST_ASSERT_EQUAL(rte_event_port_dequeue_depth(TEST_DEV_ID, 0),
-		 pconf.dequeue_depth, "Wrong port dequeue depth");
+	uint32_t value;
+	TEST_ASSERT_EQUAL(rte_event_port_attr_get(TEST_DEV_ID, 0,
+			RTE_EVENT_PORT_ATTR_DEQ_DEPTH, &value),
+			0, "Call to port dequeue depth failed");
+	TEST_ASSERT_EQUAL(value, pconf.dequeue_depth,
+			"Wrong port dequeue depth");
 
 	return TEST_SUCCESS;
 }
@@ -481,8 +485,12 @@ test_eventdev_enqueue_depth(void)
 	ret = rte_event_port_setup(TEST_DEV_ID, 0, &pconf);
 	TEST_ASSERT_SUCCESS(ret, "Failed to setup port0");
 
-	TEST_ASSERT_EQUAL(rte_event_port_enqueue_depth(TEST_DEV_ID, 0),
-		 pconf.enqueue_depth, "Wrong port enqueue depth");
+	uint32_t value;
+	TEST_ASSERT_EQUAL(rte_event_port_attr_get(TEST_DEV_ID, 0,
+			RTE_EVENT_PORT_ATTR_ENQ_DEPTH, &value),
+			0, "Call to port enqueue depth failed");
+	TEST_ASSERT_EQUAL(value, pconf.dequeue_depth,
+			"Wrong port enqueue depth");
 
 	return TEST_SUCCESS;
 }
Signature · 1 line
2.7.4
#22 lore raw

Re: [PATCH v4 1/4] eventdev: add port attribute function

Quoted 10 lines

From: Van Haaren, Harry
Sent: Thursday, September 14, 2017 5:09 PM
To: [email protected]
Cc: [email protected]; Van Haaren, Harry <[email protected]>
Subject: [PATCH v4 1/4] eventdev: add port attribute function

This commit reworks the port functions to retrieve information about the port, like the enq or deq depths. Note that "port count" is a device attribute, and is added in a later patch for dev attributes.

Just to clarify the "Note", the rte_event_port_count() function exists before this patchset. This patch itself doesn't change/update it to the new style attr API yet, the 2/4 patch does. Based on how git made the diff, it *looks* like the port_count() function is changed.

See patch 2/4 where the function is *actually* updated to dev_attr() API :)

#23 lore raw

PATCH v4 2/4 eventdev: add dev attribute get function

In reply to Harry van Haaren

This commit adds a device attribute function, allowing flexible fetching of device attributes, like port count or queue count. The unit tests and .map file are updated to the new function.

---

v4: [feedback http://dpdk.org/dev/patchwork/patch/28521/ ]
- Fixed default case comment (Jerin)
- Removed /* out */ comment in .h and .c (Jerin)
- Move function declaration in .h file to dev area (Jerin)
- Fix inconsistent removal of queue_count() function (Harry)

---
 lib/librte_eventdev/rte_eventdev.c           |  35 ++++---
 lib/librte_eventdev/rte_eventdev.h           |  37 ++++---
 lib/librte_eventdev/rte_eventdev_version.map |   3 +-
 test/test/test_eventdev.c                    | 110 ++++++++++++++++-----
 test/test/test_eventdev_octeontx.c           | 143 ++++++++++++++++++++-------
 5 files changed, 241 insertions(+), 87 deletions(-)
lib/librte_eventdev/rte_eventdev.c +23 -12
index 9eacc73..ea76444 100644
@@ -610,15 +610,6 @@ rte_event_queue_setup(uint8_t dev_id, uint8_t queue_id,
 }
 
 uint8_t
-rte_event_queue_count(uint8_t dev_id)
-{
-	struct rte_eventdev *dev;
-
-	dev = &rte_eventdevs[dev_id];
-	return dev->data->nb_queues;
-}
-
-uint8_t
 rte_event_queue_priority(uint8_t dev_id, uint8_t queue_id)
 {
 	struct rte_eventdev *dev;
@@ -743,13 +734,29 @@ rte_event_port_setup(uint8_t dev_id, uint8_t port_id,
 	return 0;
 }
 
-uint8_t
-rte_event_port_count(uint8_t dev_id)
+int
+rte_event_dev_attr_get(uint8_t dev_id, uint32_t attr_id,
+		       uint32_t *attr_value)
 {
 	struct rte_eventdev *dev;
 
+	if (!attr_value)
+		return -EINVAL;
+	RTE_EVENTDEV_VALID_DEVID_OR_ERR_RET(dev_id, -EINVAL);
 	dev = &rte_eventdevs[dev_id];
-	return dev->data->nb_ports;
+
+	switch (attr_id) {
+	case RTE_EVENT_DEV_ATTR_PORT_COUNT:
+		*attr_value = dev->data->nb_ports;
+		break;
+	case RTE_EVENT_DEV_ATTR_QUEUE_COUNT:
+		*attr_value = dev->data->nb_queues;
+		break;
+	default:
+		return -EINVAL;
+	}
+
+	return 0;
 }
 
 int
@@ -757,6 +764,10 @@ rte_event_port_attr_get(uint8_t dev_id, uint8_t port_id, uint32_t attr_id,
 			uint32_t *attr_value)
 {
 	struct rte_eventdev *dev;
+
+	if (!attr_value)
+		return -EINVAL;
+
 	RTE_EVENTDEV_VALID_DEVID_OR_ERR_RET(dev_id, -EINVAL);
 	dev = &rte_eventdevs[dev_id];
 	if (!is_valid_port(dev, port_id)) {
lib/librte_eventdev/rte_eventdev.h +26 -11
index e1febfa..0f7f10a 100644
@@ -399,6 +399,32 @@ struct rte_event_dev_info {
 int
 rte_event_dev_info_get(uint8_t dev_id, struct rte_event_dev_info *dev_info);
 
+/**
+ * The count of ports.
+ */
+#define RTE_EVENT_DEV_ATTR_PORT_COUNT 0
+/**
+ * The count of queues.
+ */
+#define RTE_EVENT_DEV_ATTR_QUEUE_COUNT 1
+
+/**
+ * Get an attribute from a device.
+ *
+ * @param dev_id Eventdev id
+ * @param attr_id The attribute ID to retrieve
+ * @param[out] attr_value A pointer that will be filled in with the attribute
+ *             value if successful.
+ *
+ * @retval 0 Successfully retrieved attribute value
+ *         -EINVAL Invalid device or  *attr_id* provided, or *attr_value*
+ *         is NULL
+ */
+int
+rte_event_dev_attr_get(uint8_t dev_id, uint32_t attr_id,
+		       uint32_t *attr_value);
+
+
 /* Event device configuration bitmap flags */
 #define RTE_EVENT_DEV_CFG_PER_DEQUEUE_TIMEOUT (1ULL << 0)
 /**< Override the global *dequeue_timeout_ns* and use per dequeue timeout in ns.
@@ -715,17 +741,6 @@ rte_event_port_setup(uint8_t dev_id, uint8_t port_id,
 		     const struct rte_event_port_conf *port_conf);
 
 /**
- * Get the number of ports on a specific event device
- *
- * @param dev_id
- *   Event device identifier.
- * @return
- *   - The number of configured ports
- */
-uint8_t
-rte_event_port_count(uint8_t dev_id);
-
-/**
  * The queue depth of the port on the enqueue side
  */
 #define RTE_EVENT_PORT_ATTR_ENQ_DEPTH 0
lib/librte_eventdev/rte_eventdev_version.map +1 -2
index 57d0b72..1353a6d 100644
@@ -19,14 +19,12 @@ DPDK_17.05 {
 
 	rte_event_port_default_conf_get;
 	rte_event_port_setup;
-	rte_event_port_count;
 	rte_event_port_link;
 	rte_event_port_unlink;
 	rte_event_port_links_get;
 
 	rte_event_queue_default_conf_get;
 	rte_event_queue_setup;
-	rte_event_queue_count;
 	rte_event_queue_priority;
 
 	rte_event_dequeue_timeout_ticks;
@@ -53,6 +51,7 @@ DPDK_17.08 {
 DPDK_17.11 {
 	global:
 
+	rte_event_dev_attr_get;
 	rte_event_port_attr_get;
 
 } DPDK_17.08;
test/test/test_eventdev.c +85 -25

231 lines not on this page · raw message

test/test/test_eventdev_octeontx.c +106 -37

293 lines not on this page · raw message

Signature · 1 line
2.7.4
#24 lore raw

PATCH v4 3/4 eventdev: add queue attribute function

In reply to Harry van Haaren

This commit adds a generic queue attribute function. It also removes the previous rte_event_queue_priority() and priority() functions, and updates the map files and unit tests to use the new attr functions.

---

v4: [feedback http://dpdk.org/dev/patchwork/patch/28522/ ]
- Add default case with -EINVAL (Jerin)
- Remove explicity /* out */ comments on parameters (Jerin)
- Move queue_attr function in header to queue area (Jerin)
- Remove queue_count() fixes, should be in 2/4 patch (Harry)

---
 lib/librte_eventdev/rte_eventdev.c           | 40 +++++++++++++++++++---------
 lib/librte_eventdev/rte_eventdev.h           | 35 +++++++++++-------------
 lib/librte_eventdev/rte_eventdev_version.map |  2 +-
 test/test/test_eventdev.c                    |  6 ++++-
 4 files changed, 49 insertions(+), 34 deletions(-)
lib/librte_eventdev/rte_eventdev.c +28 -12
index ea76444..73e1df0 100644
@@ -609,18 +609,6 @@ rte_event_queue_setup(uint8_t dev_id, uint8_t queue_id,
 	return (*dev->dev_ops->queue_setup)(dev, queue_id, queue_conf);
 }
 
-uint8_t
-rte_event_queue_priority(uint8_t dev_id, uint8_t queue_id)
-{
-	struct rte_eventdev *dev;
-
-	dev = &rte_eventdevs[dev_id];
-	if (dev->data->event_dev_cap & RTE_EVENT_DEV_CAP_QUEUE_QOS)
-		return dev->data->queues_prio[queue_id];
-	else
-		return RTE_EVENT_DEV_PRIORITY_NORMAL;
-}
-
 static inline int
 is_valid_port(struct rte_eventdev *dev, uint8_t port_id)
 {
@@ -789,6 +777,34 @@ rte_event_port_attr_get(uint8_t dev_id, uint8_t port_id, uint32_t attr_id,
 }
 
 int
+rte_event_queue_attr_get(uint8_t dev_id, uint8_t queue_id, uint32_t attr_id,
+			uint32_t *attr_value)
+{
+	struct rte_eventdev *dev;
+
+	if (!attr_value)
+		return -EINVAL;
+
+	RTE_EVENTDEV_VALID_DEVID_OR_ERR_RET(dev_id, -EINVAL);
+	dev = &rte_eventdevs[dev_id];
+	if (!is_valid_queue(dev, queue_id)) {
+		RTE_EDEV_LOG_ERR("Invalid queue_id=%" PRIu8, queue_id);
+		return -EINVAL;
+	}
+
+	switch (attr_id) {
+	case RTE_EVENT_QUEUE_ATTR_PRIORITY:
+		*attr_value = RTE_EVENT_DEV_PRIORITY_NORMAL;
+		if (dev->data->event_dev_cap & RTE_EVENT_DEV_CAP_QUEUE_QOS)
+			*attr_value = dev->data->queues_prio[queue_id];
+		break;
+	default:
+		return -EINVAL;
+	};
+	return 0;
+}
+
+int
 rte_event_port_link(uint8_t dev_id, uint8_t port_id,
 		    const uint8_t queues[], const uint8_t priorities[],
 		    uint16_t nb_links)
lib/librte_eventdev/rte_eventdev.h +15 -20
index 0f7f10a..3fd447a 100644
@@ -633,31 +633,26 @@ rte_event_queue_setup(uint8_t dev_id, uint8_t queue_id,
 		      const struct rte_event_queue_conf *queue_conf);
 
 /**
- * Get the number of event queues on a specific event device
- *
- * @param dev_id
- *   Event device identifier.
- * @return
- *   - The number of configured event queues
+ * The priority of the queue.
  */
-uint8_t
-rte_event_queue_count(uint8_t dev_id);
+#define RTE_EVENT_QUEUE_ATTR_PRIORITY 0
 
 /**
- * Get the priority of the event queue on a specific event device
+ * Get an attribute from a queue.
  *
- * @param dev_id
- *   Event device identifier.
- * @param queue_id
- *   Event queue identifier.
- * @return
- *   - If the device has RTE_EVENT_DEV_CAP_QUEUE_QOS capability then the
- *    configured priority of the event queue in
- *    [RTE_EVENT_DEV_PRIORITY_HIGHEST, RTE_EVENT_DEV_PRIORITY_LOWEST] range
- *    else the value RTE_EVENT_DEV_PRIORITY_NORMAL
+ * @param dev_id Eventdev id
+ * @param queue_id Eventdev queue id
+ * @param attr_id The attribute ID to retrieve
+ * @param[out] attr_value A pointer that will be filled in with the attribute
+ *             value if successful
+ *
+ * @retval 0 Successfully returned value
+ *         -EINVAL invalid device, queue or attr_id provided, or attr_value
+ *         was NULL
  */
-uint8_t
-rte_event_queue_priority(uint8_t dev_id, uint8_t queue_id);
+int
+rte_event_queue_attr_get(uint8_t dev_id, uint8_t queue_id, uint32_t attr_id,
+			uint32_t *attr_value);
 
 /* Event port specific APIs */
 
lib/librte_eventdev/rte_eventdev_version.map +1 -1
index 1353a6d..90266a8 100644
@@ -25,7 +25,6 @@ DPDK_17.05 {
 
 	rte_event_queue_default_conf_get;
 	rte_event_queue_setup;
-	rte_event_queue_priority;
 
 	rte_event_dequeue_timeout_ticks;
 
@@ -53,5 +52,6 @@ DPDK_17.11 {
 
 	rte_event_dev_attr_get;
 	rte_event_port_attr_get;
+	rte_event_queue_attr_get;
 
 } DPDK_17.08;
test/test/test_eventdev.c +5 -1
index 0c612be..2d34435 100644
@@ -381,7 +381,11 @@ test_eventdev_queue_priority(void)
 	}
 
 	for (i = 0; i < (int)queue_count; i++) {
-		priority =  rte_event_queue_priority(TEST_DEV_ID, i);
+		uint32_t tmp;
+		TEST_ASSERT_SUCCESS(rte_event_queue_attr_get(TEST_DEV_ID, i,
+				    RTE_EVENT_QUEUE_ATTR_PRIORITY, &tmp),
+				    "Queue priority get failed");
+		priority = tmp;
 
 		if (info.event_dev_cap & RTE_EVENT_DEV_CAP_QUEUE_QOS)
 			TEST_ASSERT_EQUAL(priority,
Signature · 1 line
2.7.4
#25 lore raw

PATCH v4 4/4 eventdev: add device started attribute

In reply to Harry van Haaren

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.

---
 lib/librte_eventdev/rte_eventdev.c | 3 +++
 lib/librte_eventdev/rte_eventdev.h | 4 ++++
 2 files changed, 7 insertions(+)
lib/librte_eventdev/rte_eventdev.c +3 -0
index 73e1df0..480b26e 100644
@@ -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;
 	}
lib/librte_eventdev/rte_eventdev.h +4 -0
index 3fd447a..1b629fc 100644
@@ -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.
Signature · 1 line
2.7.4
#26 lore raw

Re: [PATCH v4 0/4] eventdev: add attribute based get APIs

In reply to Harry van Haaren
Quoted 67 lines

-----Original Message-----
From: dev [mailto:[email protected]] On Behalf Of Harry van Haaren
Sent: Thursday, September 14, 2017 21:39
To: [email protected]
Cc: [email protected]; Harry van Haaren <[email protected]>
Subject: [dpdk-dev] [PATCH v4 0/4] eventdev: add attribute based get APIs

This patchset refactors the eventdev API to be more flexible and capable. In particular, the API is capable of returning an error value if an invalid device, port or attribute ID is passed in, which was not possible with the previous APIs.

The implementation of this patchset is based on a v1 patch[1], and after some discussion this API was seen as the best solution.

In terms of flexibility, the attribute id allows addition of new common eventdev layer attributes without breaking ABI or adding new functions. Note that these attributes are not data-path, and that PMDs should continue to use the xstats API for reporting any unique PMD statistics that are available.

Regarding API/ABI compatibility, I have removed the functions from the .map files - please review the .map file changes for ABI issues carefully.

The last patch of this series adds a started attribute to the device, allowing the application to query if a device is currently running.

-Harry

[1] http://dpdk.org/dev/patchwork/patch/27152/

---

v4:
- Rework based on review by Jerin
- default: cases into switches
- Remove old functions from .map file
- Remove /* out */ parameters
- Rework header file definitions to match logical order
- Rework patch split
- Cleaner removal of queue_count() function

v3:
- Fix checkpatch issues... somehow I broke my checkpatch script :/

v2:
- New APIs design based on discussion of initial patch.

Harry van Haaren (4):
eventdev: add port attribute function
eventdev: add dev attribute get function
eventdev: add queue attribute function
eventdev: add device started attribute

 lib/librte_eventdev/rte_eventdev.c           |  97 ++++++++++++------
 lib/librte_eventdev/rte_eventdev.h           | 115 +++++++++++----------
 lib/librte_eventdev/rte_eventdev_version.map |  14 ++-
 test/test/test_eventdev.c                    | 132 +++++++++++++++++++------
 test/test/test_eventdev_octeontx.c           | 143 ++++++++++++++++++++-------
 5 files changed, 345 insertions(+), 156 deletions(-)
Quoted 2 lines

--
2.7.4

Changes look good.
Series Acked-by: Nipun Gupta <[email protected]>

#27 lore raw

Re: [PATCH v4 0/4] eventdev: add attribute based get APIs

-----Original Message-----

Quoted 10 lines

Date: Fri, 15 Sep 2017 06:14:26 +0000
From: Nipun Gupta <[email protected]>
To: Harry van Haaren <[email protected]>, "[email protected]"
<[email protected]>
CC: "[email protected]" <[email protected]>
Subject: RE: [dpdk-dev] [PATCH v4 0/4] eventdev: add attribute based get
APIs

Quoted 5 lines
Quoted 2 lines

--
2.7.4

Changes look good.
Series Acked-by: Nipun Gupta <[email protected]>

Applied the v5 series to dpdk-next-eventdev/master. Thanks.

Quoted 1 line
#28 lore raw

Re: [PATCH v4 0/4] eventdev: add attribute based get APIs

In reply to Harry van Haaren

-----Original Message-----

Quoted 35 lines

Date: Thu, 14 Sep 2017 17:08:59 +0100
From: Harry van Haaren <[email protected]>
To: [email protected]
CC: [email protected], Harry van Haaren
<[email protected]>
Subject: [PATCH v4 0/4] eventdev: add attribute based get APIs
X-Mailer: git-send-email 2.7.4

This patchset refactors the eventdev API to be more flexible and capable. In particular, the API is capable of returning an error value if an invalid device, port or attribute ID is passed in, which was not possible with the previous APIs.

The implementation of this patchset is based on a v1 patch[1], and after some discussion this API was seen as the best solution.

In terms of flexibility, the attribute id allows addition of new common eventdev layer attributes without breaking ABI or adding new functions. Note that these attributes are not data-path, and that PMDs should continue to use the xstats API for reporting any unique PMD statistics that are available.

Regarding API/ABI compatibility, I have removed the functions from the .map files - please review the .map file changes for ABI issues carefully.

The last patch of this series adds a started attribute to the device, allowing the application to query if a device is currently running.

-Harry

[1] http://dpdk.org/dev/patchwork/patch/27152/

---

Quoted 8 lines

v4:
- Rework based on review by Jerin
- default: cases into switches
- Remove old functions from .map file
- Remove /* out */ parameters
- Rework header file definitions to match logical order
- Rework patch split
- Cleaner removal of queue_count() function

The changes looks good.

Since the functions are removed, we need to update .so version. Please update LIBABIVER(file: lib/librte_eventdev/Makefile) and update the release notes

reference to the similar change:
http://dpdk.org/browse/dpdk/commit/?id=945081a76ab0bb481f1d62125aa5b547fcc000bd

#29 lore raw

v5 cover [PATCH v5 0/5]

In reply to Harry van Haaren

This patchset refactors the eventdev API to be more flexible and capable. In particular, the API is capable of returning an error value if an invalid device, port or attribute ID is passed in, which was not possible with the previous APIs.

The implementation of this patchset is based on a v1 patch[1], and after some discussion this API was seen as the best solution.

In terms of flexibility, the attribute id allows addition of new common eventdev layer attributes without breaking ABI or adding new functions. Note that these attributes are not data-path, and that PMDs should continue to use the xstats API for reporting any unique PMD statistics that are available.

Regarding API/ABI compatibility, I have removed the functions from the .map files - please review the .map file changes for ABI issues carefully.

The last patch of this series adds a started attribute to the device, allowing the application to query if a device is currently running.

-Harry

[1] http://dpdk.org/dev/patchwork/patch/27152/

---

v5:
- Bump library version of Eventdev (Jerin)
- http://dpdk.org/ml/archives/dev/2017-September/075551.html

v4:
- Rework based on review by Jerin
- default: cases into switches
- Remove old functions from .map file
- Remove /* out */ parameters
- Rework header file definitions to match logical order
- Rework patch split
- Cleaner removal of queue_count() function

v3:
- Fix checkpatch issues... somehow I broke my checkpatch script :/

v2:
- New APIs design based on discussion of initial patch.

Harry van Haaren (5):
eventdev: add port attribute function
eventdev: add dev attribute get function
eventdev: add queue attribute function
eventdev: add device started attribute
eventdev: bump library version

 doc/guides/rel_notes/release_17_11.rst       |   2 +-
 lib/librte_eventdev/Makefile                 |   2 +-
 lib/librte_eventdev/rte_eventdev.c           |  97 ++++++++++++------
 lib/librte_eventdev/rte_eventdev.h           | 115 +++++++++++----------
 lib/librte_eventdev/rte_eventdev_version.map |  14 ++-
 test/test/test_eventdev.c                    | 132 +++++++++++++++++++------
 test/test/test_eventdev_octeontx.c           | 143 ++++++++++++++++++++-------
 7 files changed, 347 insertions(+), 158 deletions(-)
Signature · 1 line
2.7.4
#30 lore raw

PATCH v5 1/5 eventdev: add port attribute function

This commit reworks the port functions to retrieve information about the port, like the enq or deq depths. Note that "port count" is a device attribute, and is added in a later patch for dev attributes.

---

v4: feedback from http://dpdk.org/dev/patchwork/patch/28520/
- Added default: case into switch, returns -EINVAL as per header file (Jerin)
- Reworked .map file, removed old functions (Jerin)
- Renamed EXPERIMENTAL section of map file to 17.11 (Jerin)
- Removed /* out */ comments in .h and .c (Jerin)

---
 lib/librte_eventdev/rte_eventdev.c           | 35 ++++++++++++--------
 lib/librte_eventdev/rte_eventdev.h           | 49 ++++++++++++----------------
 lib/librte_eventdev/rte_eventdev_version.map |  9 +++--
 test/test/test_eventdev.c                    | 16 ++++++---
 4 files changed, 61 insertions(+), 48 deletions(-)
lib/librte_eventdev/rte_eventdev.c +21 -14
index bbb3805..9eacc73 100644
@@ -744,30 +744,37 @@ rte_event_port_setup(uint8_t dev_id, uint8_t port_id,
 }
 
 uint8_t
-rte_event_port_dequeue_depth(uint8_t dev_id, uint8_t port_id)
+rte_event_port_count(uint8_t dev_id)
 {
 	struct rte_eventdev *dev;
 
 	dev = &rte_eventdevs[dev_id];
-	return dev->data->ports_dequeue_depth[port_id];
+	return dev->data->nb_ports;
 }
 
-uint8_t
-rte_event_port_enqueue_depth(uint8_t dev_id, uint8_t port_id)
+int
+rte_event_port_attr_get(uint8_t dev_id, uint8_t port_id, uint32_t attr_id,
+			uint32_t *attr_value)
 {
 	struct rte_eventdev *dev;
-
+	RTE_EVENTDEV_VALID_DEVID_OR_ERR_RET(dev_id, -EINVAL);
 	dev = &rte_eventdevs[dev_id];
-	return dev->data->ports_enqueue_depth[port_id];
-}
-
-uint8_t
-rte_event_port_count(uint8_t dev_id)
-{
-	struct rte_eventdev *dev;
+	if (!is_valid_port(dev, port_id)) {
+		RTE_EDEV_LOG_ERR("Invalid port_id=%" PRIu8, port_id);
+		return -EINVAL;
+	}
 
-	dev = &rte_eventdevs[dev_id];
-	return dev->data->nb_ports;
+	switch (attr_id) {
+	case RTE_EVENT_PORT_ATTR_ENQ_DEPTH:
+		*attr_value = dev->data->ports_enqueue_depth[port_id];
+		break;
+	case RTE_EVENT_PORT_ATTR_DEQ_DEPTH:
+		*attr_value = dev->data->ports_dequeue_depth[port_id];
+		break;
+	default:
+		return -EINVAL;
+	};
+	return 0;
 }
 
 int
lib/librte_eventdev/rte_eventdev.h +21 -28

68 lines not on this page · raw message

lib/librte_eventdev/rte_eventdev_version.map +7 -2
index 4c48e5f..57d0b72 100644
@@ -19,8 +19,6 @@ DPDK_17.05 {
 
 	rte_event_port_default_conf_get;
 	rte_event_port_setup;
-	rte_event_port_dequeue_depth;
-	rte_event_port_enqueue_depth;
 	rte_event_port_count;
 	rte_event_port_link;
 	rte_event_port_unlink;
@@ -51,3 +49,10 @@ DPDK_17.08 {
 	rte_event_ring_init;
 	rte_event_ring_lookup;
 } DPDK_17.05;
+
+DPDK_17.11 {
+	global:
+
+	rte_event_port_attr_get;
+
+} DPDK_17.08;
test/test/test_eventdev.c +12 -4
index f766191..f3ec470 100644
@@ -460,8 +460,12 @@ test_eventdev_dequeue_depth(void)
 	ret = rte_event_port_setup(TEST_DEV_ID, 0, &pconf);
 	TEST_ASSERT_SUCCESS(ret, "Failed to setup port0");
 
-	TEST_ASSERT_EQUAL(rte_event_port_dequeue_depth(TEST_DEV_ID, 0),
-		 pconf.dequeue_depth, "Wrong port dequeue depth");
+	uint32_t value;
+	TEST_ASSERT_EQUAL(rte_event_port_attr_get(TEST_DEV_ID, 0,
+			RTE_EVENT_PORT_ATTR_DEQ_DEPTH, &value),
+			0, "Call to port dequeue depth failed");
+	TEST_ASSERT_EQUAL(value, pconf.dequeue_depth,
+			"Wrong port dequeue depth");
 
 	return TEST_SUCCESS;
 }
@@ -481,8 +485,12 @@ test_eventdev_enqueue_depth(void)
 	ret = rte_event_port_setup(TEST_DEV_ID, 0, &pconf);
 	TEST_ASSERT_SUCCESS(ret, "Failed to setup port0");
 
-	TEST_ASSERT_EQUAL(rte_event_port_enqueue_depth(TEST_DEV_ID, 0),
-		 pconf.enqueue_depth, "Wrong port enqueue depth");
+	uint32_t value;
+	TEST_ASSERT_EQUAL(rte_event_port_attr_get(TEST_DEV_ID, 0,
+			RTE_EVENT_PORT_ATTR_ENQ_DEPTH, &value),
+			0, "Call to port enqueue depth failed");
+	TEST_ASSERT_EQUAL(value, pconf.dequeue_depth,
+			"Wrong port enqueue depth");
 
 	return TEST_SUCCESS;
 }
Signature · 1 line
2.7.4
#31 lore raw

PATCH v5 2/5 eventdev: add dev attribute get function

In reply to Harry van Haaren

This commit adds a device attribute function, allowing flexible fetching of device attributes, like port count or queue count. The unit tests and .map file are updated to the new function.

---

v4: [feedback http://dpdk.org/dev/patchwork/patch/28521/ ]
- Fixed default case comment (Jerin)
- Removed /* out */ comment in .h and .c (Jerin)
- Move function declaration in .h file to dev area (Jerin)
- Fix inconsistent removal of queue_count() function (Harry)

---
 lib/librte_eventdev/rte_eventdev.c           |  35 ++++---
 lib/librte_eventdev/rte_eventdev.h           |  37 ++++---
 lib/librte_eventdev/rte_eventdev_version.map |   3 +-
 test/test/test_eventdev.c                    | 110 ++++++++++++++++-----
 test/test/test_eventdev_octeontx.c           | 143 ++++++++++++++++++++-------
 5 files changed, 241 insertions(+), 87 deletions(-)
lib/librte_eventdev/rte_eventdev.c +23 -12
index 9eacc73..ea76444 100644
@@ -610,15 +610,6 @@ rte_event_queue_setup(uint8_t dev_id, uint8_t queue_id,
 }
 
 uint8_t
-rte_event_queue_count(uint8_t dev_id)
-{
-	struct rte_eventdev *dev;
-
-	dev = &rte_eventdevs[dev_id];
-	return dev->data->nb_queues;
-}
-
-uint8_t
 rte_event_queue_priority(uint8_t dev_id, uint8_t queue_id)
 {
 	struct rte_eventdev *dev;
@@ -743,13 +734,29 @@ rte_event_port_setup(uint8_t dev_id, uint8_t port_id,
 	return 0;
 }
 
-uint8_t
-rte_event_port_count(uint8_t dev_id)
+int
+rte_event_dev_attr_get(uint8_t dev_id, uint32_t attr_id,
+		       uint32_t *attr_value)
 {
 	struct rte_eventdev *dev;
 
+	if (!attr_value)
+		return -EINVAL;
+	RTE_EVENTDEV_VALID_DEVID_OR_ERR_RET(dev_id, -EINVAL);
 	dev = &rte_eventdevs[dev_id];
-	return dev->data->nb_ports;
+
+	switch (attr_id) {
+	case RTE_EVENT_DEV_ATTR_PORT_COUNT:
+		*attr_value = dev->data->nb_ports;
+		break;
+	case RTE_EVENT_DEV_ATTR_QUEUE_COUNT:
+		*attr_value = dev->data->nb_queues;
+		break;
+	default:
+		return -EINVAL;
+	}
+
+	return 0;
 }
 
 int
@@ -757,6 +764,10 @@ rte_event_port_attr_get(uint8_t dev_id, uint8_t port_id, uint32_t attr_id,
 			uint32_t *attr_value)
 {
 	struct rte_eventdev *dev;
+
+	if (!attr_value)
+		return -EINVAL;
+
 	RTE_EVENTDEV_VALID_DEVID_OR_ERR_RET(dev_id, -EINVAL);
 	dev = &rte_eventdevs[dev_id];
 	if (!is_valid_port(dev, port_id)) {
lib/librte_eventdev/rte_eventdev.h +26 -11
index e1febfa..0f7f10a 100644
@@ -399,6 +399,32 @@ struct rte_event_dev_info {
 int
 rte_event_dev_info_get(uint8_t dev_id, struct rte_event_dev_info *dev_info);
 
+/**
+ * The count of ports.
+ */
+#define RTE_EVENT_DEV_ATTR_PORT_COUNT 0
+/**
+ * The count of queues.
+ */
+#define RTE_EVENT_DEV_ATTR_QUEUE_COUNT 1
+
+/**
+ * Get an attribute from a device.
+ *
+ * @param dev_id Eventdev id
+ * @param attr_id The attribute ID to retrieve
+ * @param[out] attr_value A pointer that will be filled in with the attribute
+ *             value if successful.
+ *
+ * @retval 0 Successfully retrieved attribute value
+ *         -EINVAL Invalid device or  *attr_id* provided, or *attr_value*
+ *         is NULL
+ */
+int
+rte_event_dev_attr_get(uint8_t dev_id, uint32_t attr_id,
+		       uint32_t *attr_value);
+
+
 /* Event device configuration bitmap flags */
 #define RTE_EVENT_DEV_CFG_PER_DEQUEUE_TIMEOUT (1ULL << 0)
 /**< Override the global *dequeue_timeout_ns* and use per dequeue timeout in ns.
@@ -715,17 +741,6 @@ rte_event_port_setup(uint8_t dev_id, uint8_t port_id,
 		     const struct rte_event_port_conf *port_conf);
 
 /**
- * Get the number of ports on a specific event device
- *
- * @param dev_id
- *   Event device identifier.
- * @return
- *   - The number of configured ports
- */
-uint8_t
-rte_event_port_count(uint8_t dev_id);
-
-/**
  * The queue depth of the port on the enqueue side
  */
 #define RTE_EVENT_PORT_ATTR_ENQ_DEPTH 0
lib/librte_eventdev/rte_eventdev_version.map +1 -2
index 57d0b72..1353a6d 100644
@@ -19,14 +19,12 @@ DPDK_17.05 {
 
 	rte_event_port_default_conf_get;
 	rte_event_port_setup;
-	rte_event_port_count;
 	rte_event_port_link;
 	rte_event_port_unlink;
 	rte_event_port_links_get;
 
 	rte_event_queue_default_conf_get;
 	rte_event_queue_setup;
-	rte_event_queue_count;
 	rte_event_queue_priority;
 
 	rte_event_dequeue_timeout_ticks;
@@ -53,6 +51,7 @@ DPDK_17.08 {
 DPDK_17.11 {
 	global:
 
+	rte_event_dev_attr_get;
 	rte_event_port_attr_get;
 
 } DPDK_17.08;
test/test/test_eventdev.c +85 -25

231 lines not on this page · raw message

test/test/test_eventdev_octeontx.c +106 -37

293 lines not on this page · raw message

Signature · 1 line
2.7.4
#32 lore raw

PATCH v5 3/5 eventdev: add queue attribute function

In reply to Harry van Haaren

This commit adds a generic queue attribute function. It also removes the previous rte_event_queue_priority() and priority() functions, and updates the map files and unit tests to use the new attr functions.

---

v4: [feedback http://dpdk.org/dev/patchwork/patch/28522/ ]
- Add default case with -EINVAL (Jerin)
- Remove explicity /* out */ comments on parameters (Jerin)
- Move queue_attr function in header to queue area (Jerin)
- Remove queue_count() fixes, should be in 2/4 patch (Harry)

---
 lib/librte_eventdev/rte_eventdev.c           | 40 +++++++++++++++++++---------
 lib/librte_eventdev/rte_eventdev.h           | 35 +++++++++++-------------
 lib/librte_eventdev/rte_eventdev_version.map |  2 +-
 test/test/test_eventdev.c                    |  6 ++++-
 4 files changed, 49 insertions(+), 34 deletions(-)
lib/librte_eventdev/rte_eventdev.c +28 -12
index ea76444..73e1df0 100644
@@ -609,18 +609,6 @@ rte_event_queue_setup(uint8_t dev_id, uint8_t queue_id,
 	return (*dev->dev_ops->queue_setup)(dev, queue_id, queue_conf);
 }
 
-uint8_t
-rte_event_queue_priority(uint8_t dev_id, uint8_t queue_id)
-{
-	struct rte_eventdev *dev;
-
-	dev = &rte_eventdevs[dev_id];
-	if (dev->data->event_dev_cap & RTE_EVENT_DEV_CAP_QUEUE_QOS)
-		return dev->data->queues_prio[queue_id];
-	else
-		return RTE_EVENT_DEV_PRIORITY_NORMAL;
-}
-
 static inline int
 is_valid_port(struct rte_eventdev *dev, uint8_t port_id)
 {
@@ -789,6 +777,34 @@ rte_event_port_attr_get(uint8_t dev_id, uint8_t port_id, uint32_t attr_id,
 }
 
 int
+rte_event_queue_attr_get(uint8_t dev_id, uint8_t queue_id, uint32_t attr_id,
+			uint32_t *attr_value)
+{
+	struct rte_eventdev *dev;
+
+	if (!attr_value)
+		return -EINVAL;
+
+	RTE_EVENTDEV_VALID_DEVID_OR_ERR_RET(dev_id, -EINVAL);
+	dev = &rte_eventdevs[dev_id];
+	if (!is_valid_queue(dev, queue_id)) {
+		RTE_EDEV_LOG_ERR("Invalid queue_id=%" PRIu8, queue_id);
+		return -EINVAL;
+	}
+
+	switch (attr_id) {
+	case RTE_EVENT_QUEUE_ATTR_PRIORITY:
+		*attr_value = RTE_EVENT_DEV_PRIORITY_NORMAL;
+		if (dev->data->event_dev_cap & RTE_EVENT_DEV_CAP_QUEUE_QOS)
+			*attr_value = dev->data->queues_prio[queue_id];
+		break;
+	default:
+		return -EINVAL;
+	};
+	return 0;
+}
+
+int
 rte_event_port_link(uint8_t dev_id, uint8_t port_id,
 		    const uint8_t queues[], const uint8_t priorities[],
 		    uint16_t nb_links)
lib/librte_eventdev/rte_eventdev.h +15 -20
index 0f7f10a..3fd447a 100644
@@ -633,31 +633,26 @@ rte_event_queue_setup(uint8_t dev_id, uint8_t queue_id,
 		      const struct rte_event_queue_conf *queue_conf);
 
 /**
- * Get the number of event queues on a specific event device
- *
- * @param dev_id
- *   Event device identifier.
- * @return
- *   - The number of configured event queues
+ * The priority of the queue.
  */
-uint8_t
-rte_event_queue_count(uint8_t dev_id);
+#define RTE_EVENT_QUEUE_ATTR_PRIORITY 0
 
 /**
- * Get the priority of the event queue on a specific event device
+ * Get an attribute from a queue.
  *
- * @param dev_id
- *   Event device identifier.
- * @param queue_id
- *   Event queue identifier.
- * @return
- *   - If the device has RTE_EVENT_DEV_CAP_QUEUE_QOS capability then the
- *    configured priority of the event queue in
- *    [RTE_EVENT_DEV_PRIORITY_HIGHEST, RTE_EVENT_DEV_PRIORITY_LOWEST] range
- *    else the value RTE_EVENT_DEV_PRIORITY_NORMAL
+ * @param dev_id Eventdev id
+ * @param queue_id Eventdev queue id
+ * @param attr_id The attribute ID to retrieve
+ * @param[out] attr_value A pointer that will be filled in with the attribute
+ *             value if successful
+ *
+ * @retval 0 Successfully returned value
+ *         -EINVAL invalid device, queue or attr_id provided, or attr_value
+ *         was NULL
  */
-uint8_t
-rte_event_queue_priority(uint8_t dev_id, uint8_t queue_id);
+int
+rte_event_queue_attr_get(uint8_t dev_id, uint8_t queue_id, uint32_t attr_id,
+			uint32_t *attr_value);
 
 /* Event port specific APIs */
 
lib/librte_eventdev/rte_eventdev_version.map +1 -1
index 1353a6d..90266a8 100644
@@ -25,7 +25,6 @@ DPDK_17.05 {
 
 	rte_event_queue_default_conf_get;
 	rte_event_queue_setup;
-	rte_event_queue_priority;
 
 	rte_event_dequeue_timeout_ticks;
 
@@ -53,5 +52,6 @@ DPDK_17.11 {
 
 	rte_event_dev_attr_get;
 	rte_event_port_attr_get;
+	rte_event_queue_attr_get;
 
 } DPDK_17.08;
test/test/test_eventdev.c +5 -1
index 0c612be..2d34435 100644
@@ -381,7 +381,11 @@ test_eventdev_queue_priority(void)
 	}
 
 	for (i = 0; i < (int)queue_count; i++) {
-		priority =  rte_event_queue_priority(TEST_DEV_ID, i);
+		uint32_t tmp;
+		TEST_ASSERT_SUCCESS(rte_event_queue_attr_get(TEST_DEV_ID, i,
+				    RTE_EVENT_QUEUE_ATTR_PRIORITY, &tmp),
+				    "Queue priority get failed");
+		priority = tmp;
 
 		if (info.event_dev_cap & RTE_EVENT_DEV_CAP_QUEUE_QOS)
 			TEST_ASSERT_EQUAL(priority,
Signature · 1 line
2.7.4
#33 lore raw

PATCH v5 4/5 eventdev: add device started attribute

In reply to Harry van Haaren

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.

---
 lib/librte_eventdev/rte_eventdev.c | 3 +++
 lib/librte_eventdev/rte_eventdev.h | 4 ++++
 2 files changed, 7 insertions(+)
lib/librte_eventdev/rte_eventdev.c +3 -0
index 73e1df0..480b26e 100644
@@ -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;
 	}
lib/librte_eventdev/rte_eventdev.h +4 -0
index 3fd447a..1b629fc 100644
@@ -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.
Signature · 1 line
2.7.4
#34 lore raw

PATCH v5 5/5 eventdev: bump library version

In reply to Harry van Haaren

This commit bumps the library version to refect the ABI change caused by removing the individual rte_event_port_count, queue_count, and other get functions. These functions are superseded by the get-attribute style API, which allows fetching values without API/ABI changes.

---
 doc/guides/rel_notes/release_17_11.rst | 2 +-
 lib/librte_eventdev/Makefile           | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
doc/guides/rel_notes/release_17_11.rst +1 -1
index 170f4f9..c09b1a1 100644
@@ -152,7 +152,7 @@ The libraries prepended with a plus sign were incremented in this version.
      librte_distributor.so.1
      librte_eal.so.5
      librte_ethdev.so.7
-     librte_eventdev.so.2
+   + librte_eventdev.so.3
      librte_gro.so.1
      librte_hash.so.2
      librte_ip_frag.so.1
lib/librte_eventdev/Makefile +1 -1
index 410578a..7d73ca9 100644
@@ -34,7 +34,7 @@ include $(RTE_SDK)/mk/rte.vars.mk
 LIB = librte_eventdev.a
 
 # library version
-LIBABIVER := 2
+LIBABIVER := 3
 
 # build flags
 CFLAGS += -O3
Signature · 1 line
2.7.4