* [dpdk-dev] [PATCH 1/2] rawdev: fix missing queue count API
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
2018-08-07 4:13 ` Wiles, Keith
2018-07-31 10:33 ` [dpdk-dev] [PATCH 2/2] raw/skeleton: implement " Shreyansh Jain
2018-08-01 16:26 ` [dpdk-dev] [PATCH 0/2] Adding a missing queue count API in rawdev Thomas Monjalon
2 siblings, 1 reply; 6+ messages in thread
From: Shreyansh Jain @ 2018-07-31 10:33 UTC (permalink / raw)
To: ferruh.yigit; +Cc: keith.wiles, hemant.agrawal, dev, Shreyansh Jain
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
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [dpdk-dev] [PATCH 1/2] rawdev: fix missing queue count API
2018-07-31 10:33 ` [dpdk-dev] [PATCH 1/2] rawdev: fix missing queue count API Shreyansh Jain
@ 2018-08-07 4:13 ` Wiles, Keith
0 siblings, 0 replies; 6+ messages in thread
From: Wiles, Keith @ 2018-08-07 4:13 UTC (permalink / raw)
To: Shreyansh Jain; +Cc: Yigit, Ferruh, hemant.agrawal, dev
> On Jul 31, 2018, at 5:33 AM, Shreyansh Jain <shreyansh.jain@nxp.com> wrote:
>
> 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(+)
>
Acked-by Keith Wiles<keith.wiles@intel.com>
Regards,
Keith
^ permalink raw reply [flat|nested] 6+ messages in thread
* [dpdk-dev] [PATCH 2/2] raw/skeleton: implement queue count API
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 ` [dpdk-dev] [PATCH 1/2] rawdev: fix missing queue count API Shreyansh Jain
@ 2018-07-31 10:33 ` 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
2 siblings, 1 reply; 6+ messages in thread
From: Shreyansh Jain @ 2018-07-31 10:33 UTC (permalink / raw)
To: ferruh.yigit; +Cc: keith.wiles, hemant.agrawal, dev, Shreyansh Jain
Use the rte_rawdev_queue_count API in skeleton and add its unit test
case.
Signed-off-by: Shreyansh Jain <shreyansh.jain@nxp.com>
---
drivers/raw/skeleton_rawdev/skeleton_rawdev.c | 13 +++++++++++++
drivers/raw/skeleton_rawdev/skeleton_rawdev_test.c | 13 +++++++++++++
2 files changed, 26 insertions(+)
diff --git a/drivers/raw/skeleton_rawdev/skeleton_rawdev.c b/drivers/raw/skeleton_rawdev/skeleton_rawdev.c
index d1489f8ec..6518a2d9a 100644
--- a/drivers/raw/skeleton_rawdev/skeleton_rawdev.c
+++ b/drivers/raw/skeleton_rawdev/skeleton_rawdev.c
@@ -305,6 +305,18 @@ static int skeleton_rawdev_queue_release(struct rte_rawdev *dev,
return ret;
}
+static uint16_t skeleton_rawdev_queue_count(struct rte_rawdev *dev)
+{
+ struct skeleton_rawdev *skeldev;
+
+ SKELETON_PMD_FUNC_TRACE();
+
+ RTE_FUNC_PTR_OR_ERR_RET(dev, -EINVAL);
+
+ skeldev = skeleton_rawdev_get_priv(dev);
+ return skeldev->num_queues;
+}
+
static int skeleton_rawdev_get_attr(struct rte_rawdev *dev,
const char *attr_name,
uint64_t *attr_value)
@@ -524,6 +536,7 @@ static const struct rte_rawdev_ops skeleton_rawdev_ops = {
.queue_def_conf = skeleton_rawdev_queue_def_conf,
.queue_setup = skeleton_rawdev_queue_setup,
.queue_release = skeleton_rawdev_queue_release,
+ .queue_count = skeleton_rawdev_queue_count,
.attr_get = skeleton_rawdev_get_attr,
.attr_set = skeleton_rawdev_set_attr,
diff --git a/drivers/raw/skeleton_rawdev/skeleton_rawdev_test.c b/drivers/raw/skeleton_rawdev/skeleton_rawdev_test.c
index 3eb5c3a7b..3405b8984 100644
--- a/drivers/raw/skeleton_rawdev/skeleton_rawdev_test.c
+++ b/drivers/raw/skeleton_rawdev/skeleton_rawdev_test.c
@@ -193,6 +193,18 @@ test_rawdev_queue_default_conf_get(void)
return TEST_SUCCESS;
}
+static int
+test_rawdev_queue_count(void)
+{
+ unsigned int q_count;
+
+ /* Get the current configuration */
+ q_count = rte_rawdev_queue_count(TEST_DEV_ID);
+ RTE_TEST_ASSERT_EQUAL(q_count, 1, "Invalid queue count (%d)", q_count);
+
+ return TEST_SUCCESS;
+}
+
static int
test_rawdev_queue_setup(void)
{
@@ -429,6 +441,7 @@ test_rawdev_skeldev(void)
SKELDEV_TEST_RUN(test_rawdev_configure, NULL,
test_rawdev_queue_default_conf_get);
SKELDEV_TEST_RUN(test_rawdev_configure, NULL, test_rawdev_queue_setup);
+ SKELDEV_TEST_RUN(NULL, NULL, test_rawdev_queue_count);
SKELDEV_TEST_RUN(test_rawdev_queue_setup, NULL,
test_rawdev_queue_release);
SKELDEV_TEST_RUN(NULL, NULL, test_rawdev_attr_set_get);
--
2.17.1
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [dpdk-dev] [PATCH 2/2] raw/skeleton: implement queue count API
2018-07-31 10:33 ` [dpdk-dev] [PATCH 2/2] raw/skeleton: implement " Shreyansh Jain
@ 2018-08-07 4:15 ` Wiles, Keith
0 siblings, 0 replies; 6+ messages in thread
From: Wiles, Keith @ 2018-08-07 4:15 UTC (permalink / raw)
To: Shreyansh Jain; +Cc: Yigit, Ferruh, hemant.agrawal, dev
> On Jul 31, 2018, at 5:33 AM, Shreyansh Jain <shreyansh.jain@nxp.com> wrote:
>
> Use the rte_rawdev_queue_count API in skeleton and add its unit test
> case.
>
> Signed-off-by: Shreyansh Jain <shreyansh.jain@nxp.com>
> ---
> drivers/raw/skeleton_rawdev/skeleton_rawdev.c | 13 +++++++++++++
> drivers/raw/skeleton_rawdev/skeleton_rawdev_test.c | 13 +++++++++++++
> 2 files changed, 26 insertions(+)
>
Acked-by Keith Wiles <keith.wiles@intel.com>
Regards,
Keith
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [dpdk-dev] [PATCH 0/2] Adding a missing queue count API in rawdev
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 ` [dpdk-dev] [PATCH 1/2] rawdev: fix missing queue count API Shreyansh Jain
2018-07-31 10:33 ` [dpdk-dev] [PATCH 2/2] raw/skeleton: implement " Shreyansh Jain
@ 2018-08-01 16:26 ` Thomas Monjalon
2 siblings, 0 replies; 6+ messages in thread
From: Thomas Monjalon @ 2018-08-01 16:26 UTC (permalink / raw)
To: Shreyansh Jain; +Cc: dev, ferruh.yigit, keith.wiles, hemant.agrawal
31/07/2018 12:33, Shreyansh Jain:
> Recently, off the list, Keith pointed out that the rte_rawdev_queue_count
> API was incomplete - only the declaration existed but no definition. This
> is an old miss (and embarassingly, almost two release cycle long miss!)
>
> This patch adds that and the relevant unit test case.
>
> Ferruh: Though I am sending it as a fix hoping it would be possible to
> merge as 'fix' for 18.08, if not, I will resend with map file changes
> for early merge in 1811 window.
> The changes are completely independent of any other API or driver impl.
>
> Shreyansh Jain (2):
> rawdev: fix missing queue count API
> raw/skeleton: implement queue count API
Applied, thanks
^ permalink raw reply [flat|nested] 6+ messages in thread