eventdev: add API to perform self test
authorPavan Nikhilesh <pbhagavatula@caviumnetworks.com>
Thu, 11 Jan 2018 10:21:47 +0000 (15:51 +0530)
committerJerin Jacob <jerin.jacob@caviumnetworks.com>
Fri, 19 Jan 2018 15:09:56 +0000 (16:09 +0100)
Add API to perform self test on the underlying event device driver.

Signed-off-by: Pavan Nikhilesh <pbhagavatula@caviumnetworks.com>
Acked-by: Harry van Haaren <harry.van.haaren@intel.com>
Acked-by: Jerin Jacob <jerin.jacob@caviumnetworks.com>
lib/librte_eventdev/rte_eventdev.c
lib/librte_eventdev/rte_eventdev.h
lib/librte_eventdev/rte_eventdev_pmd.h
lib/librte_eventdev/rte_eventdev_version.map

index 3a8f9fd..851a119 100644 (file)
@@ -1086,6 +1086,16 @@ int rte_event_dev_xstats_reset(uint8_t dev_id,
        return -ENOTSUP;
 }
 
+int rte_event_dev_selftest(uint8_t dev_id)
+{
+       RTE_EVENTDEV_VALID_DEVID_OR_ERR_RET(dev_id, -EINVAL);
+       struct rte_eventdev *dev = &rte_eventdevs[dev_id];
+
+       if (dev->dev_ops->dev_selftest != NULL)
+               return (*dev->dev_ops->dev_selftest)();
+       return -ENOTSUP;
+}
+
 int
 rte_event_dev_start(uint8_t dev_id)
 {
index 6ff3443..b21c271 100644 (file)
@@ -1810,6 +1810,18 @@ rte_event_dev_xstats_reset(uint8_t dev_id,
                           const uint32_t ids[],
                           uint32_t nb_ids);
 
+/**
+ * Trigger the eventdev 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_event_dev_selftest(uint8_t dev_id);
+
 #ifdef __cplusplus
 }
 #endif
index 399a17a..31343b5 100644 (file)
@@ -577,6 +577,13 @@ typedef int (*eventdev_eth_rx_adapter_stats_get)
 typedef int (*eventdev_eth_rx_adapter_stats_reset)
                        (const struct rte_eventdev *dev,
                        const struct rte_eth_dev *eth_dev);
+/**
+ * Start eventdev selftest.
+ *
+ * @return
+ *   Return 0 on success.
+ */
+typedef int (*eventdev_selftest)(void);
 
 /** Event device operations function pointer table */
 struct rte_eventdev_ops {
@@ -632,6 +639,9 @@ struct rte_eventdev_ops {
        /**< Get ethernet Rx stats */
        eventdev_eth_rx_adapter_stats_reset eth_rx_adapter_stats_reset;
        /**< Reset ethernet Rx stats */
+
+       eventdev_selftest dev_selftest;
+       /**< Start eventdev Selftest */
 };
 
 /**
index 108ae61..2aef470 100644 (file)
@@ -68,3 +68,9 @@ DPDK_17.11 {
        rte_event_eth_rx_adapter_stop;
 
 } DPDK_17.08;
+
+DPDK_18.02 {
+       global:
+
+       rte_event_dev_selftest;
+} DPDK_17.11;