When the event timer adapter uses a software implementation, timer management is performed on a service core using a service registered at the time of adapter creation. This commit adds a helper function to get the service id that can be used by an application to assign an lcore for the service to run on.
Signed-off-by: Erik Gabriel Carrillo <erik.g.carri...@intel.com> --- lib/librte_eventdev/rte_event_timer_adapter.c | 20 ++++++++++++++++++++ lib/librte_eventdev/rte_event_timer_adapter.h | 19 +++++++++++++++++++ lib/librte_eventdev/rte_event_timer_adapter_pmd.h | 4 ++++ lib/librte_eventdev/rte_eventdev_version.map | 1 + 4 files changed, 44 insertions(+) diff --git a/lib/librte_eventdev/rte_event_timer_adapter.c b/lib/librte_eventdev/rte_event_timer_adapter.c index 27e6226..68748be 100644 --- a/lib/librte_eventdev/rte_event_timer_adapter.c +++ b/lib/librte_eventdev/rte_event_timer_adapter.c @@ -378,6 +378,23 @@ rte_event_timer_adapter_free(struct rte_event_timer_adapter *adapter) } int +rte_event_timer_adapter_service_id_get(struct rte_event_timer_adapter *adapter, + uint32_t *service_id) +{ + ADAPTER_VALID_OR_ERR_RET(adapter, -EINVAL); + + if (service_id == NULL) + return -EINVAL; + + if (adapter->data->service_inited) { + *service_id = adapter->data->service_id; + return 0; + } + + return -ESRCH; +} + +int rte_event_timer_arm_burst(const struct rte_event_timer_adapter *adapter, struct rte_event_timer **evtims, uint16_t nb_evtims) @@ -521,6 +538,9 @@ sw_event_timer_adapter_init(struct rte_event_timer_adapter *adapter) if (ret < 0) return ret; + adapter->data->service_id = sw_data->service_id; + adapter->data->service_inited = 1; + return 0; } diff --git a/lib/librte_eventdev/rte_event_timer_adapter.h b/lib/librte_eventdev/rte_event_timer_adapter.h index d1e4d18..84d3c39 100644 --- a/lib/librte_eventdev/rte_event_timer_adapter.h +++ b/lib/librte_eventdev/rte_event_timer_adapter.h @@ -402,6 +402,25 @@ struct rte_event_timer_adapter *rte_event_timer_adapter_lookup( int rte_event_timer_adapter_free(struct rte_event_timer_adapter *adapter); /** + * Retrieve the service ID of the event timer adapter. If the adapter doesn't + * use an rte_service function, this function returns -ESRCH. + * + * @param adapter + * A pointer to an event timer adapter. + * + * @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_timer_adapter_service_id_get(struct rte_event_timer_adapter *adapter, + uint32_t *service_id); + +/** * @warning * @b EXPERIMENTAL: this structure may change without prior notice * diff --git a/lib/librte_eventdev/rte_event_timer_adapter_pmd.h b/lib/librte_eventdev/rte_event_timer_adapter_pmd.h index 485fad1..6c65c36 100644 --- a/lib/librte_eventdev/rte_event_timer_adapter_pmd.h +++ b/lib/librte_eventdev/rte_event_timer_adapter_pmd.h @@ -125,6 +125,10 @@ struct rte_event_timer_adapter_data { /**< Adapter capabilities */ void *adapter_priv; /**< Timer adapter private data*/ + uint8_t service_inited; + /**< Service initialization state */ + uint32_t service_id; + /**< Service ID*/ RTE_STD_C11 uint8_t started : 1; diff --git a/lib/librte_eventdev/rte_eventdev_version.map b/lib/librte_eventdev/rte_eventdev_version.map index f56ca0f..a35a668 100644 --- a/lib/librte_eventdev/rte_eventdev_version.map +++ b/lib/librte_eventdev/rte_eventdev_version.map @@ -75,6 +75,7 @@ DPDK_18.02 { rte_event_timer_adapter_create_ext; rte_event_timer_adapter_free; rte_event_timer_adapter_get_info; + rte_event_timer_adapter_service_id_get; rte_event_timer_adapter_start; rte_event_timer_adapter_stop; rte_event_timer_arm_burst; -- 2.6.4