From: Pavan Nikhilesh Date: Wed, 25 Oct 2017 14:50:27 +0000 (+0530) Subject: eventdev: add API to get service id X-Git-Tag: spdx-start~1046 X-Git-Url: http://git.droids-corp.org/?a=commitdiff_plain;h=6325c62dca399d664f4af5b2b428dc291c98424d;p=dpdk.git eventdev: add API to get service id In case of sw event device the scheduling can be done on a service core using the service registered at the time of probe. This patch adds a helper function to get the service id that can be used by the application to assign a lcore for the service to run on. Signed-off-by: Pavan Nikhilesh Acked-by: Harry van Haaren --- diff --git a/lib/librte_eventdev/rte_eventdev.c b/lib/librte_eventdev/rte_eventdev.c index 250bfc8dc9..ce6a5dc12b 100644 --- a/lib/librte_eventdev/rte_eventdev.c +++ b/lib/librte_eventdev/rte_eventdev.c @@ -962,6 +962,23 @@ rte_event_dequeue_timeout_ticks(uint8_t dev_id, uint64_t ns, return (*dev->dev_ops->timeout_ticks)(dev, ns, timeout_ticks); } +int +rte_event_dev_service_id_get(uint8_t dev_id, uint32_t *service_id) +{ + struct rte_eventdev *dev; + + RTE_EVENTDEV_VALID_DEVID_OR_ERR_RET(dev_id, -EINVAL); + dev = &rte_eventdevs[dev_id]; + + if (service_id == NULL) + return -EINVAL; + + if (dev->data->service_inited) + *service_id = dev->data->service_id; + + return dev->data->service_inited ? 0 : -ESRCH; +} + int rte_event_dev_dump(uint8_t dev_id, FILE *f) { diff --git a/lib/librte_eventdev/rte_eventdev.h b/lib/librte_eventdev/rte_eventdev.h index b9d1b986be..a7973a93c2 100644 --- a/lib/librte_eventdev/rte_eventdev.h +++ b/lib/librte_eventdev/rte_eventdev.h @@ -1103,6 +1103,10 @@ struct rte_eventdev_data { /**< Event device capabilities(RTE_EVENT_DEV_CAP_)*/ struct rte_event_dev_config dev_conf; /**< Configuration applied to device. */ + uint8_t service_inited; + /* Service initialization state */ + uint32_t service_id; + /* Service ID*/ RTE_STD_C11 uint8_t dev_started : 1; @@ -1605,6 +1609,24 @@ int rte_event_port_links_get(uint8_t dev_id, uint8_t port_id, uint8_t queues[], uint8_t priorities[]); +/** + * Retrieve the service ID of the event dev. If the adapter doesn't use + * a rte_service function, this function returns -ESRCH. + * + * @param dev_id + * The identifier of the device. + * + * @param [out] service_id + * A pointer to a uint32_t, to be filled in with the service id. + * + * @return + * - 0: Success + * - <0: Error code on failure, if the event dev doesn't use a rte_service + * function, this function returns -ESRCH. + */ +int +rte_event_dev_service_id_get(uint8_t dev_id, uint32_t *service_id); + /** * Dump internal information about *dev_id* to the FILE* provided in *f*. * diff --git a/lib/librte_eventdev/rte_eventdev_version.map b/lib/librte_eventdev/rte_eventdev_version.map index 800ca6e926..108ae61fb8 100644 --- a/lib/librte_eventdev/rte_eventdev_version.map +++ b/lib/librte_eventdev/rte_eventdev_version.map @@ -51,6 +51,7 @@ DPDK_17.11 { global: rte_event_dev_attr_get; + rte_event_dev_service_id_get; rte_event_port_attr_get; rte_event_queue_attr_get;