diff mbox series

[dpdk-dev,18/20] eventdev: add routine to access event queue for eth Tx

Message ID 1528478659-15859-19-git-send-email-anoob.joseph@caviumnetworks.com (mailing list archive)
State Changes Requested, archived
Delegated to: Jerin Jacob
Headers show
Series add eventmode helper functions | expand

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/Intel-compilation fail apply issues

Commit Message

Anoob Joseph June 8, 2018, 5:24 p.m. UTC
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 <anoob.joseph@caviumnetworks.com>
---
 lib/librte_eventdev/rte_eventmode_helper.c | 35 ++++++++++++++++++++++++++++++
 lib/librte_eventdev/rte_eventmode_helper.h | 21 ++++++++++++++++++
 2 files changed, 56 insertions(+)
diff mbox series

Patch

diff --git a/lib/librte_eventdev/rte_eventmode_helper.c b/lib/librte_eventdev/rte_eventmode_helper.c
index 7827ea6..7f2d269 100644
--- a/lib/librte_eventdev/rte_eventmode_helper.c
+++ b/lib/librte_eventdev/rte_eventmode_helper.c
@@ -957,3 +957,38 @@  rte_eventmode_helper_get_event_lcore_links(uint32_t lcore_id,
 	return lcore_nb_link;
 }
 
+uint8_t
+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;
+}
+
diff --git a/lib/librte_eventdev/rte_eventmode_helper.h b/lib/librte_eventdev/rte_eventmode_helper.h
index 1d8af44..be2fe8d 100644
--- a/lib/librte_eventdev/rte_eventmode_helper.h
+++ b/lib/librte_eventdev/rte_eventmode_helper.h
@@ -132,4 +132,25 @@  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 stage is in non-atomic scheduling mode, then it would be
+ * required to submit the events to an atomic queue before tx, so that the
+ * ingress order of the packets would be maintained. This tx queue would be
+ * created internally by the eventmode helper subsystem, and application
+ * would 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_eventmode_helper_get_tx_queue(struct rte_eventmode_helper_conf *mode_conf,
+		uint8_t eventdev_id);
+
+
 #endif /* _RTE_EVENTMODE_HELPER_H_ */