summaryrefslogtreecommitdiff
path: root/lib/librte_rawdev
diff options
context:
space:
mode:
authorShreyansh Jain <shreyansh.jain@nxp.com>2018-07-31 16:03:02 +0530
committerThomas Monjalon <thomas@monjalon.net>2018-08-01 18:25:10 +0200
commite728f9d92c21604ccda993c6ce856c7503041685 (patch)
tree2c7166e30eb162b823b80d737dd6802bd9bbdb73 /lib/librte_rawdev
parent8224b9d682d436c3d9f5f448e9f8a19fb872ed40 (diff)
downloaddpdk-e728f9d92c21604ccda993c6ce856c7503041685.zip
dpdk-e728f9d92c21604ccda993c6ce856c7503041685.tar.gz
dpdk-e728f9d92c21604ccda993c6ce856c7503041685.tar.xz
rawdev: fix missing queue count API
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: stable@dpdk.org Suggested-by: Keith Wiles <keith.wiles@intel.com> Signed-off-by: Shreyansh Jain <shreyansh.jain@nxp.com>
Diffstat (limited to 'lib/librte_rawdev')
-rw-r--r--lib/librte_rawdev/rte_rawdev.c12
-rw-r--r--lib/librte_rawdev/rte_rawdev.h1
-rw-r--r--lib/librte_rawdev/rte_rawdev_pmd.h20
-rw-r--r--lib/librte_rawdev/rte_rawdev_version.map1
4 files changed, 34 insertions, 0 deletions
diff --git a/lib/librte_rawdev/rte_rawdev.c b/lib/librte_rawdev/rte_rawdev.c
index 7378bfe..62b6b97 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 7988e76..684bfdb 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 6d6cf14..bb9bbc3 100644
--- a/lib/librte_rawdev/rte_rawdev_pmd.h
+++ b/lib/librte_rawdev/rte_rawdev_pmd.h
@@ -251,6 +251,24 @@ 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.
*
* Buffer being used is opaque - it can be obtained from mempool or from
@@ -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 f5be52d..b61dbff 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;