A new API to allow power monitoring condition on event port to optimize power when no events are arriving on an event port for the worker core to process in an eventdev based pipelined application.
Signed-off-by: Sivaprasad Tummala <sivaprasad.tumm...@amd.com> --- lib/eventdev/eventdev_pmd.h | 23 +++++++++++++++++++++++ lib/eventdev/rte_eventdev.c | 24 ++++++++++++++++++++++++ lib/eventdev/rte_eventdev.h | 25 +++++++++++++++++++++++++ 3 files changed, 72 insertions(+) diff --git a/lib/eventdev/eventdev_pmd.h b/lib/eventdev/eventdev_pmd.h index aebab26852..7b12f80f57 100644 --- a/lib/eventdev/eventdev_pmd.h +++ b/lib/eventdev/eventdev_pmd.h @@ -481,6 +481,26 @@ typedef int (*eventdev_port_unlink_t)(struct rte_eventdev *dev, void *port, typedef int (*eventdev_port_unlinks_in_progress_t)(struct rte_eventdev *dev, void *port); +/** + * @internal + * Get address of memory location whose contents will change whenever there is + * new data to be received on an Event port. + * + * @param port + * Eventdev port pointer. + * @param pmc + * The pointer to power-optimized monitoring condition structure. + * @return + * Negative errno value on error, 0 on success. + * + * @retval 0 + * Success + * @retval -EINVAL + * Invalid parameters + */ +typedef int (*event_get_monitor_addr_t)(void *port, + struct rte_power_monitor_cond *pmc); + /** * Converts nanoseconds to *timeout_ticks* value for rte_event_dequeue() * @@ -1376,6 +1396,9 @@ struct eventdev_ops { eventdev_dump_t dump; /* Dump internal information */ + /** Get power monitoring condition for event port */ + event_get_monitor_addr_t get_monitor_addr; + eventdev_xstats_get_t xstats_get; /**< Get extended device statistics. */ eventdev_xstats_get_names_t xstats_get_names; diff --git a/lib/eventdev/rte_eventdev.c b/lib/eventdev/rte_eventdev.c index 6ab4524332..ff77194783 100644 --- a/lib/eventdev/rte_eventdev.c +++ b/lib/eventdev/rte_eventdev.c @@ -860,6 +860,30 @@ rte_event_port_attr_get(uint8_t dev_id, uint8_t port_id, uint32_t attr_id, return 0; } +int +rte_event_port_get_monitor_addr(uint8_t dev_id, uint8_t port_id, + struct rte_power_monitor_cond *pmc) +{ + struct rte_eventdev *dev; + + RTE_EVENTDEV_VALID_DEVID_OR_ERR_RET(dev_id, -EINVAL); + dev = &rte_eventdevs[dev_id]; + if (!is_valid_port(dev, port_id)) { + RTE_EDEV_LOG_ERR("Invalid port_id=%" PRIu8, port_id); + return -EINVAL; + } + + if (pmc == NULL) { + RTE_EDEV_LOG_ERR("devid %u port %u power monitor condition is NULL\n", + dev_id, port_id); + return -EINVAL; + } + + if (*dev->dev_ops->get_monitor_addr == NULL) + return -ENOTSUP; + return (*dev->dev_ops->get_monitor_addr)(dev->data->ports[port_id], pmc); +} + int rte_event_queue_attr_get(uint8_t dev_id, uint8_t queue_id, uint32_t attr_id, uint32_t *attr_value) diff --git a/lib/eventdev/rte_eventdev.h b/lib/eventdev/rte_eventdev.h index a90e23ac8b..841b1fb9b5 100644 --- a/lib/eventdev/rte_eventdev.h +++ b/lib/eventdev/rte_eventdev.h @@ -215,6 +215,7 @@ extern "C" { #include <rte_errno.h> #include <rte_mbuf_pool_ops.h> #include <rte_mempool.h> +#include <rte_power_intrinsics.h> #include "rte_eventdev_trace_fp.h" @@ -984,6 +985,30 @@ int rte_event_port_attr_get(uint8_t dev_id, uint8_t port_id, uint32_t attr_id, uint32_t *attr_value); +/** + * @warning + * @b EXPERIMENTAL: this API may change without prior notice. + * + * Retrieve the monitor condition for a given event port. + * + * @param dev_id + * Eventdev id + * @param port_id + * Eventdev port id + * @param pmc + * The pointer to power-optimized monitoring condition structure. + * + * @return + * - 0: Success. + * -ENOTSUP: Operation not supported. + * -EINVAL: Invalid parameters. + * -ENODEV: Invalid device ID. + */ +__rte_experimental +int +rte_event_port_get_monitor_addr(uint8_t dev_id, uint8_t port_id, + struct rte_power_monitor_cond *pmc); + /** * Start an event device. * -- 2.34.1