diff mbox series

[2/2] raw/skeleton: implement queue count API

Message ID 20180731103303.14988-3-shreyansh.jain@nxp.com (mailing list archive)
State Accepted, archived
Headers show
Series Adding a missing queue count API in rawdev | expand

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/Intel-compilation success Compilation OK

Commit Message

Shreyansh Jain July 31, 2018, 10:33 a.m. UTC
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(+)

Comments

Wiles, Keith Aug. 7, 2018, 4:15 a.m. UTC | #1
> 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
diff mbox series

Patch

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