DPDK patches and discussions
 help / color / mirror / Atom feed
From: Harry van Haaren <harry.van.haaren@intel.com>
To: dev@dpdk.org
Cc: jerin.jacob@caviumnetworks.com,
	Harry van Haaren <harry.van.haaren@intel.com>
Subject: [dpdk-dev] [PATCH v5 3/5] eventdev: add queue attribute function
Date: Wed, 20 Sep 2017 14:36:01 +0100	[thread overview]
Message-ID: <1505914563-182552-4-git-send-email-harry.van.haaren@intel.com> (raw)
In-Reply-To: <1505914563-182552-1-git-send-email-harry.van.haaren@intel.com>

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.

Signed-off-by: Harry van Haaren <harry.van.haaren@intel.com>

---

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(-)

diff --git a/lib/librte_eventdev/rte_eventdev.c b/lib/librte_eventdev/rte_eventdev.c
index ea76444..73e1df0 100644
--- a/lib/librte_eventdev/rte_eventdev.c
+++ b/lib/librte_eventdev/rte_eventdev.c
@@ -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)
diff --git a/lib/librte_eventdev/rte_eventdev.h b/lib/librte_eventdev/rte_eventdev.h
index 0f7f10a..3fd447a 100644
--- a/lib/librte_eventdev/rte_eventdev.h
+++ b/lib/librte_eventdev/rte_eventdev.h
@@ -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 */
 
diff --git a/lib/librte_eventdev/rte_eventdev_version.map b/lib/librte_eventdev/rte_eventdev_version.map
index 1353a6d..90266a8 100644
--- a/lib/librte_eventdev/rte_eventdev_version.map
+++ b/lib/librte_eventdev/rte_eventdev_version.map
@@ -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;
diff --git a/test/test/test_eventdev.c b/test/test/test_eventdev.c
index 0c612be..2d34435 100644
--- a/test/test/test_eventdev.c
+++ b/test/test/test_eventdev.c
@@ -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,
-- 
2.7.4

  parent reply	other threads:[~2017-09-20 13:35 UTC|newest]

Thread overview: 35+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-07-24 12:48 [dpdk-dev] [PATCH] eventdev: add dev id checks to config functions Harry van Haaren
2017-09-04  5:20 ` Jerin Jacob
2017-09-06 14:45   ` Van Haaren, Harry
2017-09-06 14:57     ` Jerin Jacob
2017-09-08 15:18 ` [dpdk-dev] [PATCH v2 0/3] eventdev: add attribute based get APIs Harry van Haaren
2017-09-08 15:18   ` [dpdk-dev] [PATCH v2 1/4] eventdev: add port attribute function Harry van Haaren
2017-09-08 15:18   ` [dpdk-dev] [PATCH v2 2/4] eventdev: add dev attribute get function Harry van Haaren
2017-09-08 15:18   ` [dpdk-dev] [PATCH v2 3/4] eventdev: add queue attribute function Harry van Haaren
2017-09-08 15:18   ` [dpdk-dev] [PATCH v2 4/4] eventdev: add device started attribute Harry van Haaren
2017-09-08 15:36   ` [dpdk-dev] [PATCH v3 0/4] eventdev: add attribute based get APIs Harry van Haaren
2017-09-08 15:36     ` [dpdk-dev] [PATCH v3 1/4] eventdev: add port attribute function Harry van Haaren
2017-09-11 16:35       ` Jerin Jacob
2017-09-08 15:36     ` [dpdk-dev] [PATCH v3 2/4] eventdev: add dev attribute get function Harry van Haaren
2017-09-11 16:51       ` Jerin Jacob
2017-09-08 15:36     ` [dpdk-dev] [PATCH v3 3/4] eventdev: add queue attribute function Harry van Haaren
2017-09-11 17:36       ` Jerin Jacob
2017-09-08 15:36     ` [dpdk-dev] [PATCH v3 4/4] eventdev: add device started attribute Harry van Haaren
2017-09-11 17:52       ` Jerin Jacob
2017-09-12  8:07         ` Van Haaren, Harry
2017-09-11 16:16     ` [dpdk-dev] [PATCH v3 0/4] eventdev: add attribute based get APIs Jerin Jacob
2017-09-14 16:08     ` [dpdk-dev] [PATCH v4 " Harry van Haaren
2017-09-14 16:09       ` [dpdk-dev] [PATCH v4 1/4] eventdev: add port attribute function Harry van Haaren
2017-09-14 16:19         ` Van Haaren, Harry
2017-09-14 16:09       ` [dpdk-dev] [PATCH v4 2/4] eventdev: add dev attribute get function Harry van Haaren
2017-09-14 16:09       ` [dpdk-dev] [PATCH v4 3/4] eventdev: add queue attribute function Harry van Haaren
2017-09-14 16:09       ` [dpdk-dev] [PATCH v4 4/4] eventdev: add device started attribute Harry van Haaren
2017-09-15  6:14       ` [dpdk-dev] [PATCH v4 0/4] eventdev: add attribute based get APIs Nipun Gupta
2017-09-21  9:57         ` Jerin Jacob
2017-09-15 12:33       ` Jerin Jacob
2017-09-20 13:35       ` [dpdk-dev] [PATCH v5 0/5] Harry van Haaren
2017-09-20 13:35         ` [dpdk-dev] [PATCH v5 1/5] eventdev: add port attribute function Harry van Haaren
2017-09-20 13:36         ` [dpdk-dev] [PATCH v5 2/5] eventdev: add dev attribute get function Harry van Haaren
2017-09-20 13:36         ` Harry van Haaren [this message]
2017-09-20 13:36         ` [dpdk-dev] [PATCH v5 4/5] eventdev: add device started attribute Harry van Haaren
2017-09-20 13:36         ` [dpdk-dev] [PATCH v5 5/5] eventdev: bump library version Harry van Haaren

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1505914563-182552-4-git-send-email-harry.van.haaren@intel.com \
    --to=harry.van.haaren@intel.com \
    --cc=dev@dpdk.org \
    --cc=jerin.jacob@caviumnetworks.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).