DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH 0/3] Extend port and queue attribute get functions
@ 2017-09-20 15:21 Gage Eads
  2017-09-20 15:21 ` [dpdk-dev] [PATCH 1/3] eventdev: extend queue attribute get function Gage Eads
                   ` (3 more replies)
  0 siblings, 4 replies; 6+ messages in thread
From: Gage Eads @ 2017-09-20 15:21 UTC (permalink / raw)
  To: dev; +Cc: jerin.jacob, harry.van.haaren

This patchset makes the full queue and port configuration structures accessible
through the attribute get functions, adds tests for the new attributes, and
fixes one bug in a port attribute get test.

This patchset is based on patches 29019 through 29023.

Gage Eads (3):
  eventdev: extend queue attribute get function
  eventdev: extend port attribute get function
  test/eventdev: fix bug in port enqueue depth test

 lib/librte_eventdev/rte_eventdev.c | 125 ++++++++++++--------------
 lib/librte_eventdev/rte_eventdev.h |  26 ++++--
 test/test/test_eventdev.c          | 179 +++++++++++++++++++++++++++++++++++--
 3 files changed, 245 insertions(+), 85 deletions(-)

-- 
2.7.4

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [dpdk-dev] [PATCH 1/3] eventdev: extend queue attribute get function
  2017-09-20 15:21 [dpdk-dev] [PATCH 0/3] Extend port and queue attribute get functions Gage Eads
@ 2017-09-20 15:21 ` Gage Eads
  2017-09-20 15:21 ` [dpdk-dev] [PATCH 2/3] eventdev: extend port " Gage Eads
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 6+ messages in thread
From: Gage Eads @ 2017-09-20 15:21 UTC (permalink / raw)
  To: dev; +Cc: jerin.jacob, harry.van.haaren

This commit adds three new queue attributes, so that the entire queue
configuration structure passed to rte_event_queue_setup can be queried.

Signed-off-by: Gage Eads <gage.eads@intel.com>
---
 lib/librte_eventdev/rte_eventdev.c |  54 +++++++++------
 lib/librte_eventdev/rte_eventdev.h |  16 ++++-
 test/test/test_eventdev.c          | 138 ++++++++++++++++++++++++++++++++++++-
 3 files changed, 183 insertions(+), 25 deletions(-)

diff --git a/lib/librte_eventdev/rte_eventdev.c b/lib/librte_eventdev/rte_eventdev.c
index c5db32f..06c184c 100644
--- a/lib/librte_eventdev/rte_eventdev.c
+++ b/lib/librte_eventdev/rte_eventdev.c
@@ -132,51 +132,51 @@ static inline int
 rte_event_dev_queue_config(struct rte_eventdev *dev, uint8_t nb_queues)
 {
 	uint8_t old_nb_queues = dev->data->nb_queues;
-	uint8_t *queues_prio;
+	struct rte_event_queue_conf *queues_cfg;
 	unsigned int i;
 
 	RTE_EDEV_LOG_DEBUG("Setup %d queues on device %u", nb_queues,
 			 dev->data->dev_id);
 
 	/* First time configuration */
-	if (dev->data->queues_prio == NULL && nb_queues != 0) {
-		/* Allocate memory to store queue priority */
-		dev->data->queues_prio = rte_zmalloc_socket(
-				"eventdev->data->queues_prio",
-				sizeof(dev->data->queues_prio[0]) * nb_queues,
+	if (dev->data->queues_cfg == NULL && nb_queues != 0) {
+		/* Allocate memory to store queue configuration */
+		dev->data->queues_cfg = rte_zmalloc_socket(
+				"eventdev->data->queues_cfg",
+				sizeof(dev->data->queues_cfg[0]) * nb_queues,
 				RTE_CACHE_LINE_SIZE, dev->data->socket_id);
-		if (dev->data->queues_prio == NULL) {
+		if (dev->data->queues_cfg == NULL) {
 			dev->data->nb_queues = 0;
-			RTE_EDEV_LOG_ERR("failed to get mem for queue priority,"
+			RTE_EDEV_LOG_ERR("failed to get mem for queue cfg,"
 					"nb_queues %u", nb_queues);
 			return -(ENOMEM);
 		}
 	/* Re-configure */
-	} else if (dev->data->queues_prio != NULL && nb_queues != 0) {
+	} else if (dev->data->queues_cfg != NULL && nb_queues != 0) {
 		RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->queue_release, -ENOTSUP);
 
 		for (i = nb_queues; i < old_nb_queues; i++)
 			(*dev->dev_ops->queue_release)(dev, i);
 
-		/* Re allocate memory to store queue priority */
-		queues_prio = dev->data->queues_prio;
-		queues_prio = rte_realloc(queues_prio,
-				sizeof(queues_prio[0]) * nb_queues,
+		/* Re allocate memory to store queue configuration */
+		queues_cfg = dev->data->queues_cfg;
+		queues_cfg = rte_realloc(queues_cfg,
+				sizeof(queues_cfg[0]) * nb_queues,
 				RTE_CACHE_LINE_SIZE);
-		if (queues_prio == NULL) {
-			RTE_EDEV_LOG_ERR("failed to realloc queue priority,"
+		if (queues_cfg == NULL) {
+			RTE_EDEV_LOG_ERR("failed to realloc queue cfg memory,"
 						" nb_queues %u", nb_queues);
 			return -(ENOMEM);
 		}
-		dev->data->queues_prio = queues_prio;
+		dev->data->queues_cfg = queues_cfg;
 
 		if (nb_queues > old_nb_queues) {
 			uint8_t new_qs = nb_queues - old_nb_queues;
 
-			memset(queues_prio + old_nb_queues, 0,
-				sizeof(queues_prio[0]) * new_qs);
+			memset(queues_cfg + old_nb_queues, 0,
+				sizeof(queues_cfg[0]) * new_qs);
 		}
-	} else if (dev->data->queues_prio != NULL && nb_queues == 0) {
+	} else if (dev->data->queues_cfg != NULL && nb_queues == 0) {
 		RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->queue_release, -ENOTSUP);
 
 		for (i = nb_queues; i < old_nb_queues; i++)
@@ -609,7 +609,7 @@ rte_event_queue_setup(uint8_t dev_id, uint8_t queue_id,
 		queue_conf = &def_conf;
 	}
 
-	dev->data->queues_prio[queue_id] = queue_conf->priority;
+	dev->data->queues_cfg[queue_id] = *queue_conf;
 	return (*dev->dev_ops->queue_setup)(dev, queue_id, queue_conf);
 }
 
@@ -787,6 +787,7 @@ int
 rte_event_queue_attr_get(uint8_t dev_id, uint8_t queue_id, uint32_t attr_id,
 			uint32_t *attr_value)
 {
+	struct rte_event_queue_conf *conf;
 	struct rte_eventdev *dev;
 
 	if (!attr_value)
@@ -799,11 +800,22 @@ rte_event_queue_attr_get(uint8_t dev_id, uint8_t queue_id, uint32_t attr_id,
 		return -EINVAL;
 	}
 
+	conf = &dev->data->queues_cfg[queue_id];
+
 	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];
+			*attr_value = conf->priority;
+		break;
+	case RTE_EVENT_QUEUE_ATTR_NB_ATOMIC_FLOWS:
+		*attr_value = conf->nb_atomic_flows;
+		break;
+	case RTE_EVENT_QUEUE_ATTR_NB_ATOMIC_ORDER_SEQUENCES:
+		*attr_value = conf->nb_atomic_order_sequences;
+		break;
+	case RTE_EVENT_QUEUE_ATTR_EVENT_QUEUE_CFG:
+		*attr_value = conf->event_queue_cfg;
 		break;
 	default:
 		return -EINVAL;
diff --git a/lib/librte_eventdev/rte_eventdev.h b/lib/librte_eventdev/rte_eventdev.h
index ec7aabd..8ad06dd 100644
--- a/lib/librte_eventdev/rte_eventdev.h
+++ b/lib/librte_eventdev/rte_eventdev.h
@@ -640,6 +640,18 @@ rte_event_queue_setup(uint8_t dev_id, uint8_t queue_id,
  * The priority of the queue.
  */
 #define RTE_EVENT_QUEUE_ATTR_PRIORITY 0
+/**
+ * The number of atomic flows configured for the queue.
+ */
+#define RTE_EVENT_QUEUE_ATTR_NB_ATOMIC_FLOWS 1
+/**
+ * The number of atomic order sequences configured for the queue.
+ */
+#define RTE_EVENT_QUEUE_ATTR_NB_ATOMIC_ORDER_SEQUENCES 2
+/**
+ * The cfg flags for the queue.
+ */
+#define RTE_EVENT_QUEUE_ATTR_EVENT_QUEUE_CFG 3
 
 /**
  * Get an attribute from a queue.
@@ -1051,8 +1063,8 @@ struct rte_eventdev_data {
 	/**< Array of port dequeue depth. */
 	uint8_t *ports_enqueue_depth;
 	/**< Array of port enqueue depth. */
-	uint8_t *queues_prio;
-	/**< Array of queue priority. */
+	struct rte_event_queue_conf *queues_cfg;
+	/**< Array of queue configuration structures. */
 	uint16_t *links_map;
 	/**< Memory to store queues to port connections. */
 	void *dev_private;
diff --git a/test/test/test_eventdev.c b/test/test/test_eventdev.c
index 2d34435..1d9e9fe 100644
--- a/test/test/test_eventdev.c
+++ b/test/test/test_eventdev.c
@@ -356,7 +356,7 @@ test_eventdev_queue_count(void)
 }
 
 static int
-test_eventdev_queue_priority(void)
+test_eventdev_queue_attr_priority(void)
 {
 	int i, ret;
 	struct rte_event_dev_info info;
@@ -401,6 +401,134 @@ test_eventdev_queue_priority(void)
 }
 
 static int
+test_eventdev_queue_attr_nb_atomic_flows(void)
+{
+	int i, ret;
+	struct rte_event_dev_info info;
+	struct rte_event_queue_conf qconf;
+	uint32_t nb_atomic_flows;
+
+	ret = rte_event_dev_info_get(TEST_DEV_ID, &info);
+	TEST_ASSERT_SUCCESS(ret, "Failed to get event dev info");
+
+	uint32_t queue_count;
+	TEST_ASSERT_SUCCESS(rte_event_dev_attr_get(TEST_DEV_ID,
+			    RTE_EVENT_DEV_ATTR_QUEUE_COUNT, &queue_count),
+			    "Queue count get failed");
+
+	ret = rte_event_queue_default_conf_get(TEST_DEV_ID, 0, &qconf);
+	TEST_ASSERT_SUCCESS(ret, "Failed to get queue 0's def conf");
+
+	if (qconf.nb_atomic_flows == 0)
+		/* Assume PMD doesn't support atomic flows, return early */
+		return -ENOTSUP;
+
+	qconf.event_queue_cfg = RTE_EVENT_QUEUE_CFG_ATOMIC_ONLY;
+
+	for (i = 0; i < (int)queue_count; i++) {
+		ret = rte_event_queue_setup(TEST_DEV_ID, i, &qconf);
+		TEST_ASSERT_SUCCESS(ret, "Failed to setup queue%d", i);
+	}
+
+	for (i = 0; i < (int)queue_count; i++) {
+		TEST_ASSERT_SUCCESS(rte_event_queue_attr_get(TEST_DEV_ID, i,
+				    RTE_EVENT_QUEUE_ATTR_NB_ATOMIC_FLOWS,
+				    &nb_atomic_flows),
+				    "Queue nb_atomic_flows get failed");
+
+		TEST_ASSERT_EQUAL(nb_atomic_flows, qconf.nb_atomic_flows,
+				  "Wrong atomic flows value for queue%d", i);
+	}
+
+	return TEST_SUCCESS;
+}
+
+static int
+test_eventdev_queue_attr_nb_atomic_order_sequences(void)
+{
+	int i, ret;
+	struct rte_event_dev_info info;
+	struct rte_event_queue_conf qconf;
+	uint32_t nb_atomic_order_sequences;
+
+	ret = rte_event_dev_info_get(TEST_DEV_ID, &info);
+	TEST_ASSERT_SUCCESS(ret, "Failed to get event dev info");
+
+	uint32_t queue_count;
+	TEST_ASSERT_SUCCESS(rte_event_dev_attr_get(TEST_DEV_ID,
+			    RTE_EVENT_DEV_ATTR_QUEUE_COUNT, &queue_count),
+			    "Queue count get failed");
+
+	ret = rte_event_queue_default_conf_get(TEST_DEV_ID, 0, &qconf);
+	TEST_ASSERT_SUCCESS(ret, "Failed to get queue 0's def conf");
+
+	if (qconf.nb_atomic_order_sequences == 0)
+		/* Assume PMD doesn't support reordering */
+		return -ENOTSUP;
+
+	qconf.event_queue_cfg = RTE_EVENT_QUEUE_CFG_ORDERED_ONLY;
+
+	for (i = 0; i < (int)queue_count; i++) {
+		ret = rte_event_queue_setup(TEST_DEV_ID, i, &qconf);
+		TEST_ASSERT_SUCCESS(ret, "Failed to setup queue%d", i);
+	}
+
+	for (i = 0; i < (int)queue_count; i++) {
+		TEST_ASSERT_SUCCESS(rte_event_queue_attr_get(TEST_DEV_ID, i,
+			    RTE_EVENT_QUEUE_ATTR_NB_ATOMIC_ORDER_SEQUENCES,
+			    &nb_atomic_order_sequences),
+			    "Queue nb_atomic_order_sequencess get failed");
+
+		TEST_ASSERT_EQUAL(nb_atomic_order_sequences,
+				  qconf.nb_atomic_order_sequences,
+				  "Wrong atomic order sequences value for queue%d",
+				  i);
+	}
+
+	return TEST_SUCCESS;
+}
+
+static int
+test_eventdev_queue_attr_event_queue_cfg(void)
+{
+	int i, ret;
+	struct rte_event_dev_info info;
+	struct rte_event_queue_conf qconf;
+	uint32_t event_queue_cfg;
+
+	ret = rte_event_dev_info_get(TEST_DEV_ID, &info);
+	TEST_ASSERT_SUCCESS(ret, "Failed to get event dev info");
+
+	uint32_t queue_count;
+	TEST_ASSERT_SUCCESS(rte_event_dev_attr_get(TEST_DEV_ID,
+			    RTE_EVENT_DEV_ATTR_QUEUE_COUNT, &queue_count),
+			    "Queue count get failed");
+
+	ret = rte_event_queue_default_conf_get(TEST_DEV_ID, 0, &qconf);
+	TEST_ASSERT_SUCCESS(ret, "Failed to get queue%d def conf", i);
+
+	qconf.event_queue_cfg = RTE_EVENT_QUEUE_CFG_PARALLEL_ONLY;
+
+	for (i = 0; i < (int)queue_count; i++) {
+		ret = rte_event_queue_setup(TEST_DEV_ID, i, &qconf);
+		TEST_ASSERT_SUCCESS(ret, "Failed to setup queue%d", i);
+	}
+
+	for (i = 0; i < (int)queue_count; i++) {
+		TEST_ASSERT_SUCCESS(rte_event_queue_attr_get(TEST_DEV_ID, i,
+				    RTE_EVENT_QUEUE_ATTR_EVENT_QUEUE_CFG,
+				    &event_queue_cfg),
+				    "Queue event_queue_cfg get failed");
+
+		TEST_ASSERT_EQUAL(event_queue_cfg, qconf.event_queue_cfg,
+				  "Wrong event_queue_cfg value for queue%d",
+				  i);
+	}
+
+	return TEST_SUCCESS;
+}
+
+static int
 test_eventdev_port_default_conf_get(void)
 {
 	int i, ret;
@@ -813,7 +941,13 @@ static struct unit_test_suite eventdev_common_testsuite  = {
 		TEST_CASE_ST(eventdev_configure_setup, NULL,
 			test_eventdev_queue_count),
 		TEST_CASE_ST(eventdev_configure_setup, NULL,
-			test_eventdev_queue_priority),
+			test_eventdev_queue_attr_priority),
+		TEST_CASE_ST(eventdev_configure_setup, NULL,
+			test_eventdev_queue_attr_nb_atomic_flows),
+		TEST_CASE_ST(eventdev_configure_setup, NULL,
+			test_eventdev_queue_attr_nb_atomic_order_sequences),
+		TEST_CASE_ST(eventdev_configure_setup, NULL,
+			test_eventdev_queue_attr_event_queue_cfg),
 		TEST_CASE_ST(eventdev_configure_setup, NULL,
 			test_eventdev_port_default_conf_get),
 		TEST_CASE_ST(eventdev_configure_setup, NULL,
-- 
2.7.4

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [dpdk-dev] [PATCH 2/3] eventdev: extend port attribute get function
  2017-09-20 15:21 [dpdk-dev] [PATCH 0/3] Extend port and queue attribute get functions Gage Eads
  2017-09-20 15:21 ` [dpdk-dev] [PATCH 1/3] eventdev: extend queue attribute get function Gage Eads
@ 2017-09-20 15:21 ` Gage Eads
  2017-09-20 15:21 ` [dpdk-dev] [PATCH 3/3] test/eventdev: fix bug in port enqueue depth test Gage Eads
  2017-10-04 14:12 ` [dpdk-dev] [PATCH 0/3] Extend port and queue attribute get functions Van Haaren, Harry
  3 siblings, 0 replies; 6+ messages in thread
From: Gage Eads @ 2017-09-20 15:21 UTC (permalink / raw)
  To: dev; +Cc: jerin.jacob, harry.van.haaren

This commit adds the new_event_threshold port attribute, so the entire port
configuration structure passed to rte_event_queue_setup can be queried.

Signed-off-by: Gage Eads <gage.eads@intel.com>
---
 lib/librte_eventdev/rte_eventdev.c | 71 ++++++++++++--------------------------
 lib/librte_eventdev/rte_eventdev.h | 10 +++---
 test/test/test_eventdev.c          | 39 +++++++++++++++++----
 3 files changed, 61 insertions(+), 59 deletions(-)

diff --git a/lib/librte_eventdev/rte_eventdev.c b/lib/librte_eventdev/rte_eventdev.c
index 06c184c..e6ed0a3 100644
--- a/lib/librte_eventdev/rte_eventdev.c
+++ b/lib/librte_eventdev/rte_eventdev.c
@@ -195,8 +195,7 @@ rte_event_dev_port_config(struct rte_eventdev *dev, uint8_t nb_ports)
 	uint8_t old_nb_ports = dev->data->nb_ports;
 	void **ports;
 	uint16_t *links_map;
-	uint8_t *ports_dequeue_depth;
-	uint8_t *ports_enqueue_depth;
+	struct rte_event_port_conf *ports_cfg;
 	unsigned int i;
 
 	RTE_EDEV_LOG_DEBUG("Setup %d ports on device %u", nb_ports,
@@ -214,26 +213,14 @@ rte_event_dev_port_config(struct rte_eventdev *dev, uint8_t nb_ports)
 			return -(ENOMEM);
 		}
 
-		/* Allocate memory to store ports dequeue depth */
-		dev->data->ports_dequeue_depth =
-			rte_zmalloc_socket("eventdev->ports_dequeue_depth",
-			sizeof(dev->data->ports_dequeue_depth[0]) * nb_ports,
+		/* Allocate memory to store port configurations */
+		dev->data->ports_cfg =
+			rte_zmalloc_socket("eventdev->ports_cfg",
+			sizeof(dev->data->ports_cfg[0]) * nb_ports,
 			RTE_CACHE_LINE_SIZE, dev->data->socket_id);
-		if (dev->data->ports_dequeue_depth == NULL) {
+		if (dev->data->ports_cfg == NULL) {
 			dev->data->nb_ports = 0;
-			RTE_EDEV_LOG_ERR("failed to get mem for port deq meta,"
-					"nb_ports %u", nb_ports);
-			return -(ENOMEM);
-		}
-
-		/* Allocate memory to store ports enqueue depth */
-		dev->data->ports_enqueue_depth =
-			rte_zmalloc_socket("eventdev->ports_enqueue_depth",
-			sizeof(dev->data->ports_enqueue_depth[0]) * nb_ports,
-			RTE_CACHE_LINE_SIZE, dev->data->socket_id);
-		if (dev->data->ports_enqueue_depth == NULL) {
-			dev->data->nb_ports = 0;
-			RTE_EDEV_LOG_ERR("failed to get mem for port enq meta,"
+			RTE_EDEV_LOG_ERR("failed to get mem for port cfg,"
 					"nb_ports %u", nb_ports);
 			return -(ENOMEM);
 		}
@@ -257,8 +244,7 @@ rte_event_dev_port_config(struct rte_eventdev *dev, uint8_t nb_ports)
 		RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->port_release, -ENOTSUP);
 
 		ports = dev->data->ports;
-		ports_dequeue_depth = dev->data->ports_dequeue_depth;
-		ports_enqueue_depth = dev->data->ports_enqueue_depth;
+		ports_cfg = dev->data->ports_cfg;
 		links_map = dev->data->links_map;
 
 		for (i = nb_ports; i < old_nb_ports; i++)
@@ -273,22 +259,12 @@ rte_event_dev_port_config(struct rte_eventdev *dev, uint8_t nb_ports)
 			return -(ENOMEM);
 		}
 
-		/* Realloc memory for ports_dequeue_depth */
-		ports_dequeue_depth = rte_realloc(ports_dequeue_depth,
-			sizeof(ports_dequeue_depth[0]) * nb_ports,
+		/* Realloc memory for ports_cfg */
+		ports_cfg = rte_realloc(ports_cfg,
+			sizeof(ports_cfg[0]) * nb_ports,
 			RTE_CACHE_LINE_SIZE);
-		if (ports_dequeue_depth == NULL) {
-			RTE_EDEV_LOG_ERR("failed to realloc port dequeue meta,"
-						" nb_ports %u", nb_ports);
-			return -(ENOMEM);
-		}
-
-		/* Realloc memory for ports_enqueue_depth */
-		ports_enqueue_depth = rte_realloc(ports_enqueue_depth,
-			sizeof(ports_enqueue_depth[0]) * nb_ports,
-			RTE_CACHE_LINE_SIZE);
-		if (ports_enqueue_depth == NULL) {
-			RTE_EDEV_LOG_ERR("failed to realloc port enqueue meta,"
+		if (ports_cfg == NULL) {
+			RTE_EDEV_LOG_ERR("failed to realloc port cfg mem,"
 						" nb_ports %u", nb_ports);
 			return -(ENOMEM);
 		}
@@ -314,18 +290,15 @@ rte_event_dev_port_config(struct rte_eventdev *dev, uint8_t nb_ports)
 
 			memset(ports + old_nb_ports, 0,
 				sizeof(ports[0]) * new_ps);
-			memset(ports_dequeue_depth + old_nb_ports, 0,
-				sizeof(ports_dequeue_depth[0]) * new_ps);
-			memset(ports_enqueue_depth + old_nb_ports, 0,
-				sizeof(ports_enqueue_depth[0]) * new_ps);
+			memset(ports_cfg + old_nb_ports, 0,
+				sizeof(ports_cfg[0]) * new_ps);
 			for (i = old_links_map_end; i < links_map_end; i++)
 				links_map[i] =
 					EVENT_QUEUE_SERVICE_PRIORITY_INVALID;
 		}
 
 		dev->data->ports = ports;
-		dev->data->ports_dequeue_depth = ports_dequeue_depth;
-		dev->data->ports_enqueue_depth = ports_enqueue_depth;
+		dev->data->ports_cfg = ports_cfg;
 		dev->data->links_map = links_map;
 	} else if (dev->data->ports != NULL && nb_ports == 0) {
 		RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->port_release, -ENOTSUP);
@@ -709,10 +682,7 @@ rte_event_port_setup(uint8_t dev_id, uint8_t port_id,
 		port_conf = &def_conf;
 	}
 
-	dev->data->ports_dequeue_depth[port_id] =
-			port_conf->dequeue_depth;
-	dev->data->ports_enqueue_depth[port_id] =
-			port_conf->enqueue_depth;
+	dev->data->ports_cfg[port_id] = *port_conf;
 
 	diag = (*dev->dev_ops->port_setup)(dev, port_id, port_conf);
 
@@ -772,10 +742,13 @@ rte_event_port_attr_get(uint8_t dev_id, uint8_t port_id, uint32_t attr_id,
 
 	switch (attr_id) {
 	case RTE_EVENT_PORT_ATTR_ENQ_DEPTH:
-		*attr_value = dev->data->ports_enqueue_depth[port_id];
+		*attr_value = dev->data->ports_cfg[port_id].enqueue_depth;
 		break;
 	case RTE_EVENT_PORT_ATTR_DEQ_DEPTH:
-		*attr_value = dev->data->ports_dequeue_depth[port_id];
+		*attr_value = dev->data->ports_cfg[port_id].dequeue_depth;
+		break;
+	case RTE_EVENT_PORT_ATTR_NEW_EVENT_THRESHOLD:
+		*attr_value = dev->data->ports_cfg[port_id].new_event_threshold;
 		break;
 	default:
 		return -EINVAL;
diff --git a/lib/librte_eventdev/rte_eventdev.h b/lib/librte_eventdev/rte_eventdev.h
index 8ad06dd..ca858cc 100644
--- a/lib/librte_eventdev/rte_eventdev.h
+++ b/lib/librte_eventdev/rte_eventdev.h
@@ -759,6 +759,10 @@ rte_event_port_setup(uint8_t dev_id, uint8_t port_id,
  * The queue depth of the port on the dequeue side
  */
 #define RTE_EVENT_PORT_ATTR_DEQ_DEPTH 1
+/**
+ * The new event threshold of the port
+ */
+#define RTE_EVENT_PORT_ATTR_NEW_EVENT_THRESHOLD 2
 
 /**
  * Get an attribute from a port.
@@ -1059,10 +1063,8 @@ struct rte_eventdev_data {
 	/**< Number of event ports. */
 	void **ports;
 	/**< Array of pointers to ports. */
-	uint8_t *ports_dequeue_depth;
-	/**< Array of port dequeue depth. */
-	uint8_t *ports_enqueue_depth;
-	/**< Array of port enqueue depth. */
+	struct rte_event_port_conf *ports_cfg;
+	/**< Array of port configuration structures. */
 	struct rte_event_queue_conf *queues_cfg;
 	/**< Array of queue configuration structures. */
 	uint16_t *links_map;
diff --git a/test/test/test_eventdev.c b/test/test/test_eventdev.c
index 1d9e9fe..5fd0357 100644
--- a/test/test/test_eventdev.c
+++ b/test/test/test_eventdev.c
@@ -606,7 +606,7 @@ test_eventdev_port_setup(void)
 }
 
 static int
-test_eventdev_dequeue_depth(void)
+test_eventdev_port_attr_dequeue_depth(void)
 {
 	int ret;
 	struct rte_event_dev_info info;
@@ -623,7 +623,7 @@ test_eventdev_dequeue_depth(void)
 	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");
+			0, "Call to get port dequeue depth failed");
 	TEST_ASSERT_EQUAL(value, pconf.dequeue_depth,
 			"Wrong port dequeue depth");
 
@@ -631,7 +631,7 @@ test_eventdev_dequeue_depth(void)
 }
 
 static int
-test_eventdev_enqueue_depth(void)
+test_eventdev_port_attr_enqueue_depth(void)
 {
 	int ret;
 	struct rte_event_dev_info info;
@@ -648,7 +648,7 @@ test_eventdev_enqueue_depth(void)
 	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");
+			0, "Call to get port enqueue depth failed");
 	TEST_ASSERT_EQUAL(value, pconf.dequeue_depth,
 			"Wrong port enqueue depth");
 
@@ -656,6 +656,31 @@ test_eventdev_enqueue_depth(void)
 }
 
 static int
+test_eventdev_port_attr_new_event_threshold(void)
+{
+	int ret;
+	struct rte_event_dev_info info;
+	struct rte_event_port_conf pconf;
+
+	ret = rte_event_dev_info_get(TEST_DEV_ID, &info);
+	TEST_ASSERT_SUCCESS(ret, "Failed to get event dev info");
+
+	ret = rte_event_port_default_conf_get(TEST_DEV_ID, 0, &pconf);
+	TEST_ASSERT_SUCCESS(ret, "Failed to get port0 info");
+	ret = rte_event_port_setup(TEST_DEV_ID, 0, &pconf);
+	TEST_ASSERT_SUCCESS(ret, "Failed to setup port0");
+
+	uint32_t value;
+	TEST_ASSERT_EQUAL(rte_event_port_attr_get(TEST_DEV_ID, 0,
+			RTE_EVENT_PORT_ATTR_NEW_EVENT_THRESHOLD, &value),
+			0, "Call to get port new event threshold failed");
+	TEST_ASSERT_EQUAL((int32_t) value, pconf.new_event_threshold,
+			"Wrong port new event threshold");
+
+	return TEST_SUCCESS;
+}
+
+static int
 test_eventdev_port_count(void)
 {
 	int ret;
@@ -953,9 +978,11 @@ static struct unit_test_suite eventdev_common_testsuite  = {
 		TEST_CASE_ST(eventdev_configure_setup, NULL,
 			test_eventdev_port_setup),
 		TEST_CASE_ST(eventdev_configure_setup, NULL,
-			test_eventdev_dequeue_depth),
+			test_eventdev_port_attr_dequeue_depth),
+		TEST_CASE_ST(eventdev_configure_setup, NULL,
+			test_eventdev_port_attr_enqueue_depth),
 		TEST_CASE_ST(eventdev_configure_setup, NULL,
-			test_eventdev_enqueue_depth),
+			test_eventdev_port_attr_new_event_threshold),
 		TEST_CASE_ST(eventdev_configure_setup, NULL,
 			test_eventdev_port_count),
 		TEST_CASE_ST(eventdev_configure_setup, NULL,
-- 
2.7.4

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [dpdk-dev] [PATCH 3/3] test/eventdev: fix bug in port enqueue depth test
  2017-09-20 15:21 [dpdk-dev] [PATCH 0/3] Extend port and queue attribute get functions Gage Eads
  2017-09-20 15:21 ` [dpdk-dev] [PATCH 1/3] eventdev: extend queue attribute get function Gage Eads
  2017-09-20 15:21 ` [dpdk-dev] [PATCH 2/3] eventdev: extend port " Gage Eads
@ 2017-09-20 15:21 ` Gage Eads
  2017-10-04 14:12 ` [dpdk-dev] [PATCH 0/3] Extend port and queue attribute get functions Van Haaren, Harry
  3 siblings, 0 replies; 6+ messages in thread
From: Gage Eads @ 2017-09-20 15:21 UTC (permalink / raw)
  To: dev; +Cc: jerin.jacob, harry.van.haaren

The enqueue depth test was comparing the port's dequeue depth against its
enqueue depth.

Fixes: 410c5bccdadc ("eventdev: add port attribute function")
Signed-off-by: Gage Eads <gage.eads@intel.com>
---
 test/test/test_eventdev.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/test/test/test_eventdev.c b/test/test/test_eventdev.c
index 5fd0357..0e8bd7d 100644
--- a/test/test/test_eventdev.c
+++ b/test/test/test_eventdev.c
@@ -649,7 +649,7 @@ test_eventdev_port_attr_enqueue_depth(void)
 	TEST_ASSERT_EQUAL(rte_event_port_attr_get(TEST_DEV_ID, 0,
 			RTE_EVENT_PORT_ATTR_ENQ_DEPTH, &value),
 			0, "Call to get port enqueue depth failed");
-	TEST_ASSERT_EQUAL(value, pconf.dequeue_depth,
+	TEST_ASSERT_EQUAL(value, pconf.enqueue_depth,
 			"Wrong port enqueue depth");
 
 	return TEST_SUCCESS;
-- 
2.7.4

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [dpdk-dev] [PATCH 0/3] Extend port and queue attribute get functions
  2017-09-20 15:21 [dpdk-dev] [PATCH 0/3] Extend port and queue attribute get functions Gage Eads
                   ` (2 preceding siblings ...)
  2017-09-20 15:21 ` [dpdk-dev] [PATCH 3/3] test/eventdev: fix bug in port enqueue depth test Gage Eads
@ 2017-10-04 14:12 ` Van Haaren, Harry
  2017-10-08 13:53   ` Jerin Jacob
  3 siblings, 1 reply; 6+ messages in thread
From: Van Haaren, Harry @ 2017-10-04 14:12 UTC (permalink / raw)
  To: Eads, Gage, dev; +Cc: jerin.jacob

> From: Eads, Gage
> Sent: Wednesday, September 20, 2017 4:21 PM
> To: dev@dpdk.org
> Cc: jerin.jacob@caviumnetworks.com; Van Haaren, Harry
> <harry.van.haaren@intel.com>
> Subject: [PATCH 0/3] Extend port and queue attribute get functions
> 
> This patchset makes the full queue and port configuration structures
> accessible
> through the attribute get functions, adds tests for the new attributes, and
> fixes one bug in a port attribute get test.
> 
> This patchset is based on patches 29019 through 29023.
> 
> Gage Eads (3):
>   eventdev: extend queue attribute get function
>   eventdev: extend port attribute get function
>   test/eventdev: fix bug in port enqueue depth test
> 
>  lib/librte_eventdev/rte_eventdev.c | 125 ++++++++++++--------------
>  lib/librte_eventdev/rte_eventdev.h |  26 ++++--
>  test/test/test_eventdev.c          | 179
> +++++++++++++++++++++++++++++++++++--
>  3 files changed, 245 insertions(+), 85 deletions(-)

Thanks - good to see the attrs API get more value!

Series-Reviewed-by: Harry van Haaren <harry.van.haaren@intel.com>

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [dpdk-dev] [PATCH 0/3] Extend port and queue attribute get functions
  2017-10-04 14:12 ` [dpdk-dev] [PATCH 0/3] Extend port and queue attribute get functions Van Haaren, Harry
@ 2017-10-08 13:53   ` Jerin Jacob
  0 siblings, 0 replies; 6+ messages in thread
From: Jerin Jacob @ 2017-10-08 13:53 UTC (permalink / raw)
  To: Van Haaren, Harry; +Cc: Eads, Gage, dev

-----Original Message-----
> Date: Wed, 4 Oct 2017 14:12:50 +0000
> From: "Van Haaren, Harry" <harry.van.haaren@intel.com>
> To: "Eads, Gage" <gage.eads@intel.com>, "dev@dpdk.org" <dev@dpdk.org>
> CC: "jerin.jacob@caviumnetworks.com" <jerin.jacob@caviumnetworks.com>
> Subject: RE: [PATCH 0/3] Extend port and queue attribute get functions
> 
> > From: Eads, Gage
> > Sent: Wednesday, September 20, 2017 4:21 PM
> > To: dev@dpdk.org
> > Cc: jerin.jacob@caviumnetworks.com; Van Haaren, Harry
> > <harry.van.haaren@intel.com>
> > Subject: [PATCH 0/3] Extend port and queue attribute get functions
> > 
> > This patchset makes the full queue and port configuration structures
> > accessible
> > through the attribute get functions, adds tests for the new attributes, and
> > fixes one bug in a port attribute get test.
> > 
> > This patchset is based on patches 29019 through 29023.
> > 
> > Gage Eads (3):
> >   eventdev: extend queue attribute get function
> >   eventdev: extend port attribute get function
> >   test/eventdev: fix bug in port enqueue depth test
> > 
> >  lib/librte_eventdev/rte_eventdev.c | 125 ++++++++++++--------------
> >  lib/librte_eventdev/rte_eventdev.h |  26 ++++--
> >  test/test/test_eventdev.c          | 179
> > +++++++++++++++++++++++++++++++++++--
> >  3 files changed, 245 insertions(+), 85 deletions(-)
> 
> Thanks - good to see the attrs API get more value!
> 
> Series-Reviewed-by: Harry van Haaren <harry.van.haaren@intel.com>

Applied after fixing the build issue found in my system(gcc 7.2.0) to dpdk-next-eventdev/master. Thanks.


== Build test/cmdline_test
  CC test_eventdev.o
In file included from
/export/dpdk-next-eventdev/test/test/test_eventdev.c:41:0:
/export/dpdk-next-eventdev/test/test/test_eventdev.c: In function
‘test_eventdev_queue_attr_event_queue_cfg’:
/export/dpdk-next-eventdev/test/test/test.h:149:4: error: ‘i’ may be
used uninitialized in this function [-Werror=maybe-uninitialized]
    printf("TestCase %s() line %d failed (err %d): "     \
    ^~~~~~
/export/dpdk-next-eventdev/test/test/test_eventdev.c:494:6: note: ‘i’
was declared here
  int i, ret;
      ^

➜ [master][dpdk-next-eventdev] $ git diff
diff --git a/test/test/test_eventdev.c b/test/test/test_eventdev.c
index 1d9e9fe4c..de3a964c2 100644
--- a/test/test/test_eventdev.c
+++ b/test/test/test_eventdev.c
@@ -505,7 +505,7 @@ test_eventdev_queue_attr_event_queue_cfg(void)
                            "Queue count get failed");
 
        ret = rte_event_queue_default_conf_get(TEST_DEV_ID, 0, &qconf);
-       TEST_ASSERT_SUCCESS(ret, "Failed to get queue%d def conf", i);
+       TEST_ASSERT_SUCCESS(ret, "Failed to get queue0 def conf");
 
        qconf.event_queue_cfg = RTE_EVENT_QUEUE_CFG_PARALLEL_ONLY;
 

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2017-10-08 13:53 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-09-20 15:21 [dpdk-dev] [PATCH 0/3] Extend port and queue attribute get functions Gage Eads
2017-09-20 15:21 ` [dpdk-dev] [PATCH 1/3] eventdev: extend queue attribute get function Gage Eads
2017-09-20 15:21 ` [dpdk-dev] [PATCH 2/3] eventdev: extend port " Gage Eads
2017-09-20 15:21 ` [dpdk-dev] [PATCH 3/3] test/eventdev: fix bug in port enqueue depth test Gage Eads
2017-10-04 14:12 ` [dpdk-dev] [PATCH 0/3] Extend port and queue attribute get functions Van Haaren, Harry
2017-10-08 13:53   ` Jerin Jacob

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).