When the application is drafted for single stage eventmode, it will be efficient to have the loop in the application space, rather than passing it on to the helper.
When the application's stage is in ORDERED sched mode, the application will have to change the sched type of the event to ATOMIC before sending it, to ensure ingress ordering is maintained. Since, it is application who would do the tx, this info is required in it's space. Signed-off-by: Anoob Joseph <ano...@marvell.com> Signed-off-by: Lukasz Bartosik <lbarto...@marvell.com> --- lib/librte_eventdev/rte_eventdev_version.map | 1 + lib/librte_eventdev/rte_eventmode_helper.c | 53 ++++++++++++++++++++++++++++ lib/librte_eventdev/rte_eventmode_helper.h | 21 +++++++++++ 3 files changed, 75 insertions(+) diff --git a/lib/librte_eventdev/rte_eventdev_version.map b/lib/librte_eventdev/rte_eventdev_version.map index 8137cb5..3cf926a 100644 --- a/lib/librte_eventdev/rte_eventdev_version.map +++ b/lib/librte_eventdev/rte_eventdev_version.map @@ -134,4 +134,5 @@ EXPERIMENTAL { rte_eventmode_helper_initialize_devs; rte_eventmode_helper_display_conf; rte_eventmode_helper_get_event_lcore_links; + rte_eventmode_helper_get_tx_queue; }; diff --git a/lib/librte_eventdev/rte_eventmode_helper.c b/lib/librte_eventdev/rte_eventmode_helper.c index 6c853f6..e7670e0 100644 --- a/lib/librte_eventdev/rte_eventmode_helper.c +++ b/lib/librte_eventdev/rte_eventmode_helper.c @@ -93,6 +93,24 @@ internal_get_next_active_core(struct eventmode_conf *em_conf, return next_core; } +static struct eventdev_params * +internal_get_eventdev_params(struct eventmode_conf *em_conf, + uint8_t eventdev_id) +{ + int i; + + for (i = 0; i < em_conf->nb_eventdev; i++) { + if (em_conf->eventdev_config[i].eventdev_id == eventdev_id) + break; + } + + /* No match */ + if (i == em_conf->nb_eventdev) + return NULL; + + return &(em_conf->eventdev_config[i]); +} + /* Global functions */ void __rte_experimental @@ -927,3 +945,38 @@ rte_eventmode_helper_get_event_lcore_links(uint32_t lcore_id, return lcore_nb_link; } +uint8_t __rte_experimental +rte_eventmode_helper_get_tx_queue(struct rte_eventmode_helper_conf *mode_conf, + uint8_t eventdev_id) +{ + struct eventdev_params *eventdev_config; + struct eventmode_conf *em_conf; + + if (mode_conf == NULL) { + RTE_EM_HLPR_LOG_ERR("Invalid conf"); + return (uint8_t)(-1); + } + + if (mode_conf->mode_params == NULL) { + RTE_EM_HLPR_LOG_ERR("Invalid mode params"); + return (uint8_t)(-1); + } + + /* Get eventmode conf */ + em_conf = (struct eventmode_conf *)(mode_conf->mode_params); + + /* Get event device conf */ + eventdev_config = internal_get_eventdev_params(em_conf, eventdev_id); + + if (eventdev_config == NULL) { + RTE_EM_HLPR_LOG_ERR("Error reading eventdev conf"); + return (uint8_t)(-1); + } + + /* + * The last queue would be reserved to be used as atomic queue for the + * last stage (eth packet tx stage) + */ + return eventdev_config->nb_eventqueue - 1; +} + diff --git a/lib/librte_eventdev/rte_eventmode_helper.h b/lib/librte_eventdev/rte_eventmode_helper.h index 925b660..cd6d708 100644 --- a/lib/librte_eventdev/rte_eventmode_helper.h +++ b/lib/librte_eventdev/rte_eventmode_helper.h @@ -136,6 +136,27 @@ rte_eventmode_helper_get_event_lcore_links(uint32_t lcore_id, struct rte_eventmode_helper_conf *mode_conf, struct rte_eventmode_helper_event_link_info **links); +/** + * Get eventdev tx queue + * + * If the application uses event device which does not support internal port + * then it needs to submit the events to an atomic Tx queue before final + * transmission. The Tx queue will be atomic to make sure that ingress order of + * the packets is maintained. This Tx queue will be created internally by the + * eventmode helper subsystem, and application will need it's queue ID when it + * is running the execution loop. + * + * @param mode_conf + * Configuration of the mode in which app is doing packet handling + * @param eventdev_id + * Event device ID + * @return + * Tx queue ID + */ +uint8_t __rte_experimental +rte_eventmode_helper_get_tx_queue(struct rte_eventmode_helper_conf *mode_conf, + uint8_t eventdev_id); + #ifdef __cplusplus } #endif -- 2.7.4