DPDK patches and discussions
 help / color / mirror / Atom feed
From: Shreyansh Jain <shreyansh.jain@nxp.com>
To: ferruh.yigit@intel.com
Cc: keith.wiles@intel.com, hemant.agrawal@nxp.com, dev@dpdk.org,
	Shreyansh Jain <shreyansh.jain@nxp.com>
Subject: [dpdk-dev] [PATCH 1/2] rawdev: fix missing queue count API
Date: Tue, 31 Jul 2018 16:03:02 +0530	[thread overview]
Message-ID: <20180731103303.14988-2-shreyansh.jain@nxp.com> (raw)
In-Reply-To: <20180731103303.14988-1-shreyansh.jain@nxp.com>

Rawdev queue count API prototype was declared, but the definition was
missing from the library. This patch implements the function.

This API is used to query the device about the count of queues it has
been configured with.

Fixes: c88b3f2558ed ("rawdev: introduce raw device library")
Cc: shreyansh.jain@nxp.com

Signed-off-by: Shreyansh Jain <shreyansh.jain@nxp.com>
Suggested-by: Keith Wiles <keith.wiles@intel.com>
---
 lib/librte_rawdev/rte_rawdev.c           | 12 ++++++++++++
 lib/librte_rawdev/rte_rawdev.h           |  1 +
 lib/librte_rawdev/rte_rawdev_pmd.h       | 20 ++++++++++++++++++++
 lib/librte_rawdev/rte_rawdev_version.map |  1 +
 4 files changed, 34 insertions(+)

diff --git a/lib/librte_rawdev/rte_rawdev.c b/lib/librte_rawdev/rte_rawdev.c
index 7378bfede..62b6b97ef 100644
--- a/lib/librte_rawdev/rte_rawdev.c
+++ b/lib/librte_rawdev/rte_rawdev.c
@@ -172,6 +172,18 @@ rte_rawdev_queue_release(uint16_t dev_id, uint16_t queue_id)
 	return (*dev->dev_ops->queue_release)(dev, queue_id);
 }
 
+uint16_t
+rte_rawdev_queue_count(uint16_t dev_id)
+{
+	struct rte_rawdev *dev;
+
+	RTE_RAWDEV_VALID_DEVID_OR_ERR_RET(dev_id, -EINVAL);
+	dev = &rte_rawdevs[dev_id];
+
+	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->queue_count, -ENOTSUP);
+	return (*dev->dev_ops->queue_count)(dev);
+}
+
 int
 rte_rawdev_get_attr(uint16_t dev_id,
 		    const char *attr_name,
diff --git a/lib/librte_rawdev/rte_rawdev.h b/lib/librte_rawdev/rte_rawdev.h
index 7988e76af..684bfdb81 100644
--- a/lib/librte_rawdev/rte_rawdev.h
+++ b/lib/librte_rawdev/rte_rawdev.h
@@ -182,6 +182,7 @@ rte_rawdev_queue_setup(uint16_t dev_id,
  */
 int
 rte_rawdev_queue_release(uint16_t dev_id, uint16_t queue_id);
+
 /**
  * Get the number of raw queues on a specific raw device
  *
diff --git a/lib/librte_rawdev/rte_rawdev_pmd.h b/lib/librte_rawdev/rte_rawdev_pmd.h
index 6d6cf14a1..bb9bbc350 100644
--- a/lib/librte_rawdev/rte_rawdev_pmd.h
+++ b/lib/librte_rawdev/rte_rawdev_pmd.h
@@ -250,6 +250,24 @@ typedef int (*rawdev_queue_setup_t)(struct rte_rawdev *dev,
 typedef int (*rawdev_queue_release_t)(struct rte_rawdev *dev,
 				      uint16_t queue_id);
 
+/**
+ * Get the count of number of queues configured on this device.
+ *
+ * Another way to fetch this information is to fetch the device configuration.
+ * But, that assumes that the device configuration managed by the driver has
+ * that kind of information.
+ *
+ * This function helps in getting queue count supported, independently. It
+ * can help in cases where iterator needs to be implemented.
+ *
+ * @param
+ *   Raw device pointer
+ * @return
+ *   Number of queues; 0 is assumed to be a valid response.
+ *
+ */
+typedef uint16_t (*rawdev_queue_count_t)(struct rte_rawdev *dev);
+
 /**
  * Enqueue an array of raw buffers to the device.
  *
@@ -506,6 +524,8 @@ struct rte_rawdev_ops {
 	rawdev_queue_setup_t queue_setup;
 	/**< Release an raw queue. */
 	rawdev_queue_release_t queue_release;
+	/**< Get the number of queues attached to the device */
+	rawdev_queue_count_t queue_count;
 
 	/**< Enqueue an array of raw buffers to device. */
 	rawdev_enqueue_bufs_t enqueue_bufs;
diff --git a/lib/librte_rawdev/rte_rawdev_version.map b/lib/librte_rawdev/rte_rawdev_version.map
index f5be52df9..b61dbff11 100644
--- a/lib/librte_rawdev/rte_rawdev_version.map
+++ b/lib/librte_rawdev/rte_rawdev_version.map
@@ -16,6 +16,7 @@ DPDK_18.08 {
 	rte_rawdev_pmd_allocate;
 	rte_rawdev_pmd_release;
 	rte_rawdev_queue_conf_get;
+	rte_rawdev_queue_count;
 	rte_rawdev_queue_setup;
 	rte_rawdev_queue_release;
 	rte_rawdev_reset;
-- 
2.17.1

  reply	other threads:[~2018-07-31 10:34 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-07-31 10:33 [dpdk-dev] [PATCH 0/2] Adding a missing queue count API in rawdev Shreyansh Jain
2018-07-31 10:33 ` Shreyansh Jain [this message]
2018-08-07  4:13   ` [dpdk-dev] [PATCH 1/2] rawdev: fix missing queue count API Wiles, Keith
2018-07-31 10:33 ` [dpdk-dev] [PATCH 2/2] raw/skeleton: implement " Shreyansh Jain
2018-08-07  4:15   ` Wiles, Keith
2018-08-01 16:26 ` [dpdk-dev] [PATCH 0/2] Adding a missing queue count API in rawdev Thomas Monjalon

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=20180731103303.14988-2-shreyansh.jain@nxp.com \
    --to=shreyansh.jain@nxp.com \
    --cc=dev@dpdk.org \
    --cc=ferruh.yigit@intel.com \
    --cc=hemant.agrawal@nxp.com \
    --cc=keith.wiles@intel.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).