From: Shreyansh Jain Date: Tue, 31 Jul 2018 10:33:03 +0000 (+0530) Subject: raw/skeleton: implement queue count API X-Git-Url: http://git.droids-corp.org/?a=commitdiff_plain;h=fc4a4860ba242bddc5039d77d376a34ea2f0e173;p=dpdk.git raw/skeleton: implement queue count API Use the rte_rawdev_queue_count API in skeleton and add its unit test case. Signed-off-by: Shreyansh Jain --- diff --git a/drivers/raw/skeleton_rawdev/skeleton_rawdev.c b/drivers/raw/skeleton_rawdev/skeleton_rawdev.c index d1489f8ec0..6518a2d9ab 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 3eb5c3a7b9..3405b89849 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);