raw/skeleton: implement queue count API
authorShreyansh Jain <shreyansh.jain@nxp.com>
Tue, 31 Jul 2018 10:33:03 +0000 (16:03 +0530)
committerThomas Monjalon <thomas@monjalon.net>
Wed, 1 Aug 2018 16:25:30 +0000 (18:25 +0200)
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
drivers/raw/skeleton_rawdev/skeleton_rawdev_test.c

index d1489f8..6518a2d 100644 (file)
@@ -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,
index 3eb5c3a..3405b89 100644 (file)
@@ -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);