summaryrefslogtreecommitdiff
path: root/lib/librte_rawdev
diff options
context:
space:
mode:
authorShreyansh Jain <shreyansh.jain@nxp.com>2018-01-31 14:43:14 +0530
committerThomas Monjalon <thomas@monjalon.net>2018-01-31 15:35:56 +0100
commit7ae53626e4bc26257970ca9fbb14fd7cae74497d (patch)
tree70644afc4ab278d83a2df56c7d6417b4100a243f /lib/librte_rawdev
parentada90a80f59a380fd7de5e02a6c85585ee20b317 (diff)
downloaddpdk-next-eventdev-7ae53626e4bc26257970ca9fbb14fd7cae74497d.zip
dpdk-next-eventdev-7ae53626e4bc26257970ca9fbb14fd7cae74497d.tar.gz
dpdk-next-eventdev-7ae53626e4bc26257970ca9fbb14fd7cae74497d.tar.xz
rawdev: add self test
Signed-off-by: Shreyansh Jain <shreyansh.jain@nxp.com>
Diffstat (limited to 'lib/librte_rawdev')
-rw-r--r--lib/librte_rawdev/rte_rawdev.c10
-rw-r--r--lib/librte_rawdev/rte_rawdev.h13
-rw-r--r--lib/librte_rawdev/rte_rawdev_pmd.h11
-rw-r--r--lib/librte_rawdev/rte_rawdev_version.map1
4 files changed, 35 insertions, 0 deletions
diff --git a/lib/librte_rawdev/rte_rawdev.c b/lib/librte_rawdev/rte_rawdev.c
index b52293c..d314ef9 100644
--- a/lib/librte_rawdev/rte_rawdev.c
+++ b/lib/librte_rawdev/rte_rawdev.c
@@ -364,6 +364,16 @@ rte_rawdev_firmware_unload(uint16_t dev_id)
}
int __rte_experimental
+rte_rawdev_selftest(uint16_t dev_id)
+{
+ RTE_RAWDEV_VALID_DEVID_OR_ERR_RET(dev_id, -EINVAL);
+ struct rte_rawdev *dev = &rte_rawdevs[dev_id];
+
+ RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->dev_selftest, -ENOTSUP);
+ return (*dev->dev_ops->dev_selftest)();
+}
+
+int __rte_experimental
rte_rawdev_start(uint16_t dev_id)
{
struct rte_rawdev *dev;
diff --git a/lib/librte_rawdev/rte_rawdev.h b/lib/librte_rawdev/rte_rawdev.h
index faa13f8..2e14919 100644
--- a/lib/librte_rawdev/rte_rawdev.h
+++ b/lib/librte_rawdev/rte_rawdev.h
@@ -589,6 +589,19 @@ rte_rawdev_firmware_load(uint16_t dev_id, rte_rawdev_obj_t firmware_image);
int __rte_experimental
rte_rawdev_firmware_unload(uint16_t dev_id);
+/**
+ * Trigger the rawdev self test.
+ *
+ * @param dev_id
+ * The identifier of the device
+ * @return
+ * - 0: Selftest successful
+ * - -ENOTSUP if the device doesn't support selftest
+ * - other values < 0 on failure.
+ */
+int __rte_experimental
+rte_rawdev_selftest(uint16_t dev_id);
+
#ifdef __cplusplus
}
#endif
diff --git a/lib/librte_rawdev/rte_rawdev_pmd.h b/lib/librte_rawdev/rte_rawdev_pmd.h
index 41b3a3b..408adf0 100644
--- a/lib/librte_rawdev/rte_rawdev_pmd.h
+++ b/lib/librte_rawdev/rte_rawdev_pmd.h
@@ -477,6 +477,14 @@ typedef int (*rawdev_firmware_load_t)(struct rte_rawdev *dev,
*/
typedef int (*rawdev_firmware_unload_t)(struct rte_rawdev *dev);
+/**
+ * Start rawdev selftest
+ *
+ * @return
+ * Return 0 on success
+ */
+typedef int (*rawdev_selftest_t)(void);
+
/** Rawdevice operations function pointer table */
struct rte_rawdev_ops {
/**< Get device info. */
@@ -530,6 +538,9 @@ struct rte_rawdev_ops {
rawdev_firmware_load_t firmware_load;
/**< Unload firmware */
rawdev_firmware_unload_t firmware_unload;
+
+ /**< Device selftest function */
+ rawdev_selftest_t dev_selftest;
};
/**
diff --git a/lib/librte_rawdev/rte_rawdev_version.map b/lib/librte_rawdev/rte_rawdev_version.map
index 8de9abd..af4465e 100644
--- a/lib/librte_rawdev/rte_rawdev_version.map
+++ b/lib/librte_rawdev/rte_rawdev_version.map
@@ -19,6 +19,7 @@ EXPERIMENTAL {
rte_rawdev_queue_setup;
rte_rawdev_queue_release;
rte_rawdev_reset;
+ rte_rawdev_selftest;
rte_rawdev_set_attr;
rte_rawdev_socket_id;
rte_rawdev_start;