diff mbox series

[dpdk-dev,08/20] eventdev: add eventdev port-lcore link

Message ID 1528478659-15859-9-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
Adding eventdev port-lcore link. In addition, this will also specify
which event queue need to be connected to the event port.

Signed-off-by: Anoob Joseph <anoob.joseph@caviumnetworks.com>
---
 lib/librte_eventdev/rte_eventmode_helper.c         | 56 ++++++++++++++++++++++
 lib/librte_eventdev/rte_eventmode_helper.h         | 12 +++++
 .../rte_eventmode_helper_internal.h                | 12 +++++
 3 files changed, 80 insertions(+)
diff mbox series

Patch

diff --git a/lib/librte_eventdev/rte_eventmode_helper.c b/lib/librte_eventdev/rte_eventmode_helper.c
index e55d4aa..b3469f9 100644
--- a/lib/librte_eventdev/rte_eventmode_helper.c
+++ b/lib/librte_eventdev/rte_eventmode_helper.c
@@ -46,6 +46,24 @@  internal_parse_decimal(const char *str)
 	return num;
 }
 
+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
@@ -165,10 +183,12 @@  rte_eventmode_helper_initialize_eventdev(struct eventmode_conf *em_conf)
 	struct rte_event_dev_config eventdev_conf;
 	struct rte_event_dev_info evdev_default_conf;
 	struct rte_event_queue_conf eventq_conf = {0};
+	struct rte_eventmode_helper_event_link_info *link;
 	struct eventdev_params *eventdev_config;
 	int nb_eventdev = em_conf->nb_eventdev;
 	int nb_eventqueue;
 	uint8_t eventdev_id;
+	uint8_t *queue = NULL;
 
 	for (i = 0; i < nb_eventdev; i++) {
 
@@ -257,6 +277,42 @@  rte_eventmode_helper_initialize_eventdev(struct eventmode_conf *em_conf)
 		}
 	}
 
+	/* Make event queue - event port link */
+	for (j = 0; j <  em_conf->nb_link; j++) {
+
+		/* Get link info */
+		link = &(em_conf->link[j]);
+
+		/* Get event dev ID */
+		eventdev_id = link->eventdev_id;
+
+		queue = &(link->eventq_id);
+
+		/* Link queue to port */
+		ret = rte_event_port_link(eventdev_id, link->event_portid,
+				queue, NULL, 1);
+		if (ret < 0) {
+			RTE_EM_HLPR_LOG_ERR("Error in event port linking");
+			return ret;
+		}
+
+		/* Link ATOMIC eth tx queue also to the port */
+
+		/* Get the corresponding eventdev config */
+		eventdev_config = internal_get_eventdev_params(em_conf,
+				eventdev_id);
+
+		/* Last queue would be reserved for eth tx */
+		ret = rte_event_port_link(eventdev_id,
+				link->event_portid,
+				&(eventdev_config->nb_eventqueue), NULL, 1);
+
+		if (ret < 0) {
+			RTE_EM_HLPR_LOG_ERR("Error in event port linking");
+			return ret;
+		}
+	}
+
 	/* Start event devices */
 	for (i = 0; i < nb_eventdev; i++) {
 
diff --git a/lib/librte_eventdev/rte_eventmode_helper.h b/lib/librte_eventdev/rte_eventmode_helper.h
index e1e8a3b..1ade32f 100644
--- a/lib/librte_eventdev/rte_eventmode_helper.h
+++ b/lib/librte_eventdev/rte_eventmode_helper.h
@@ -24,6 +24,18 @@  struct rte_eventmode_helper_conf {
 		/**< Mode specific parameters */
 };
 
+/* Event-lcore link conf */
+struct rte_eventmode_helper_event_link_info {
+	uint8_t eventdev_id;
+		/**< Event device ID */
+	uint8_t event_portid;
+		/**< Event port ID */
+	uint8_t eventq_id;
+		/**< Event queue to be linked to the port */
+	uint8_t lcore_id;
+		/**< Lcore to be polling on this port */
+};
+
 /* Common helper functions for command line parsing */
 
 /**
diff --git a/lib/librte_eventdev/rte_eventmode_helper_internal.h b/lib/librte_eventdev/rte_eventmode_helper_internal.h
index 4cd5ac4..36e2a5f 100644
--- a/lib/librte_eventdev/rte_eventmode_helper_internal.h
+++ b/lib/librte_eventdev/rte_eventmode_helper_internal.h
@@ -30,6 +30,13 @@ 
 /* Max event devices supported */
 #define EVENT_MODE_MAX_EVENT_DEVS RTE_EVENT_MAX_DEVS
 
+/* Max event queues supported per event device */
+#define EVENT_MODE_MAX_EVENT_QUEUES_PER_DEV RTE_EVENT_MAX_QUEUES_PER_DEV
+
+/* Max event-lcore links */
+#define EVENT_MODE_MAX_LCORE_LINKS \
+	(EVENT_MODE_MAX_EVENT_DEVS * EVENT_MODE_MAX_EVENT_QUEUES_PER_DEV)
+
 /* Event dev params */
 struct eventdev_params {
 	uint8_t eventdev_id;
@@ -44,6 +51,11 @@  struct eventmode_conf {
 		/**< No of event devs */
 	struct eventdev_params eventdev_config[EVENT_MODE_MAX_EVENT_DEVS];
 		/**< Per event dev conf */
+	uint8_t nb_link;
+		/**< No of links */
+	struct rte_eventmode_helper_event_link_info
+			link[EVENT_MODE_MAX_LCORE_LINKS];
+		/**< Per link conf */
 };
 
 #endif /* _RTE_EVENTMODE_HELPER_INTERNAL_H_ */