From a1501cd13816749b151b3a51756bc762c9afe4c3 Mon Sep 17 00:00:00 2001 From: Pavan Nikhilesh Date: Thu, 11 Jan 2018 15:51:47 +0530 Subject: [PATCH] eventdev: add API to perform self test Add API to perform self test on the underlying event device driver. Signed-off-by: Pavan Nikhilesh Acked-by: Harry van Haaren Acked-by: Jerin Jacob --- lib/librte_eventdev/rte_eventdev.c | 10 ++++++++++ lib/librte_eventdev/rte_eventdev.h | 12 ++++++++++++ lib/librte_eventdev/rte_eventdev_pmd.h | 10 ++++++++++ lib/librte_eventdev/rte_eventdev_version.map | 6 ++++++ 4 files changed, 38 insertions(+) diff --git a/lib/librte_eventdev/rte_eventdev.c b/lib/librte_eventdev/rte_eventdev.c index 3a8f9fd47a..851a1190c0 100644 --- a/lib/librte_eventdev/rte_eventdev.c +++ b/lib/librte_eventdev/rte_eventdev.c @@ -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) { diff --git a/lib/librte_eventdev/rte_eventdev.h b/lib/librte_eventdev/rte_eventdev.h index 6ff3443254..b21c27179e 100644 --- a/lib/librte_eventdev/rte_eventdev.h +++ b/lib/librte_eventdev/rte_eventdev.h @@ -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 diff --git a/lib/librte_eventdev/rte_eventdev_pmd.h b/lib/librte_eventdev/rte_eventdev_pmd.h index 399a17a19e..31343b51d8 100644 --- a/lib/librte_eventdev/rte_eventdev_pmd.h +++ b/lib/librte_eventdev/rte_eventdev_pmd.h @@ -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 */ }; /** diff --git a/lib/librte_eventdev/rte_eventdev_version.map b/lib/librte_eventdev/rte_eventdev_version.map index 108ae61fb8..2aef470b52 100644 --- a/lib/librte_eventdev/rte_eventdev_version.map +++ b/lib/librte_eventdev/rte_eventdev_version.map @@ -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;