DPDK patches and discussions
 help / color / mirror / Atom feed
From: Anoob Joseph <anoob.joseph@caviumnetworks.com>
To: Bruce Richardson <bruce.richardson@intel.com>,
	Jerin Jacob <jerin.jacob@caviumnetworks.com>,
	Pablo de Lara <pablo.de.lara.guarch@intel.com>
Cc: Anoob Joseph <anoob.joseph@caviumnetworks.com>,
	Hemant Agrawal <hemant.agrawal@nxp.com>,
	Narayana Prasad <narayanaprasad.athreya@caviumnetworks.com>,
	Nikhil Rao <nikhil.rao@intel.com>,
	Pavan Nikhilesh <pbhagavatula@caviumnetworks.com>,
	Sunil Kumar Kori <sunil.kori@nxp.com>,
	dev@dpdk.org
Subject: [dpdk-dev] [PATCH 15/20] eventdev: add default conf for event port-lcore link
Date: Fri,  8 Jun 2018 22:54:14 +0530	[thread overview]
Message-ID: <1528478659-15859-16-git-send-email-anoob.joseph@caviumnetworks.com> (raw)
In-Reply-To: <1528478659-15859-1-git-send-email-anoob.joseph@caviumnetworks.com>

Generate a default conf for event port-lcore link, if not specified in
the conf. This routine will check the number of available ports and then
create links according to the number of cores available.

This patch also adds a new entry in the eventmode conf to denote that
all queues is to be linked with every port. This enables one core to
receive packets from every port.

Signed-off-by: Anoob Joseph <anoob.joseph@caviumnetworks.com>
---
 lib/librte_eventdev/rte_eventmode_helper.c         | 109 ++++++++++++++++++++-
 .../rte_eventmode_helper_internal.h                |   5 +
 2 files changed, 113 insertions(+), 1 deletion(-)

diff --git a/lib/librte_eventdev/rte_eventmode_helper.c b/lib/librte_eventdev/rte_eventmode_helper.c
index bec893c..6bdd64c 100644
--- a/lib/librte_eventdev/rte_eventmode_helper.c
+++ b/lib/librte_eventdev/rte_eventmode_helper.c
@@ -87,6 +87,28 @@ internal_get_next_rx_core(struct eventmode_conf *em_conf, unsigned prev_core)
 	return next_core;
 }
 
+static inline unsigned
+internal_get_next_active_core(struct eventmode_conf *em_conf,
+		unsigned prev_core)
+{
+	unsigned next_core;
+
+get_next_core:
+	/* Get the next core */
+	next_core = rte_get_next_lcore(prev_core, 0, 0);
+
+	/* Check if we have reached max lcores */
+	if (next_core == RTE_MAX_LCORE)
+		return next_core;
+
+	/* Some cores would be reserved as rx cores. Skip them */
+	if (em_conf->rx_core_mask & (1 << next_core)) {
+		prev_core = next_core;
+		goto get_next_core;
+	}
+
+	return next_core;
+}
 
 /* Global functions */
 
@@ -367,6 +389,74 @@ rte_eventmode_helper_set_default_conf_adapter(struct eventmode_conf *em_conf)
 }
 
 static int
+rte_eventmode_helper_set_default_conf_link(struct eventmode_conf *em_conf)
+{
+	int i, j;
+	struct eventdev_params *eventdev_config;
+	unsigned lcore_id = -1;
+	int link_index;
+	struct rte_eventmode_helper_event_link_info *link;
+
+	/*
+	 * Create a 1:1 mapping from event ports to cores. If the number
+	 * of event ports is lesser than the cores, some cores won't
+	 * execute worker. If event ports are more, then some ports won't
+	 * be used.
+	 *
+	 */
+
+	/*
+	 * The event queue-port mapping is done according to the link. Since
+	 * we are falling back to the default link conf, enabling
+	 * "all_ev_queue_to_ev_port" mode flag. This will map all queues to the
+	 * port.
+	 */
+	em_conf->ext_params.all_ev_queue_to_ev_port = 1;
+
+	for (i = 0; i < em_conf->nb_eventdev; i++) {
+
+		/* Get event dev conf */
+		eventdev_config = &(em_conf->eventdev_config[i]);
+
+		/* Loop through the ports */
+		for (j = 0; j < eventdev_config->nb_eventport; j++) {
+
+			/* Get next active core id */
+			lcore_id = internal_get_next_active_core(em_conf,
+					lcore_id);
+
+			if (lcore_id == RTE_MAX_LCORE) {
+				/* Reached max cores */
+				return 0;
+			}
+
+			/* Save the current combination as one link */
+
+			/* Get the index */
+			link_index = em_conf->nb_link;
+
+			/* Get the corresponding link */
+			link = &(em_conf->link[link_index]);
+
+			/* Save link */
+			link->eventdev_id = eventdev_config->eventdev_id;
+			link->event_portid = j;
+			link->lcore_id = lcore_id;
+
+			/*
+			 * Not setting eventq_id as by default all queues
+			 * need to be mapped to the port, and is controlled
+			 * by the operating mode.
+			 */
+
+			/* Update number of links */
+			em_conf->nb_link++;
+		}
+	}
+	return 0;
+}
+
+static int
 rte_eventmode_helper_validate_conf(struct eventmode_conf *em_conf)
 {
 	int ret;
@@ -396,6 +486,16 @@ rte_eventmode_helper_validate_conf(struct eventmode_conf *em_conf)
 			return ret;
 	}
 
+	/*
+	 * See if links are specified. Else generate a default conf for
+	 * the event ports used.
+	 */
+	if (em_conf->nb_link == 0) {
+		ret = rte_eventmode_helper_set_default_conf_link(em_conf);
+		if (ret != 0)
+			return ret;
+	}
+
 	return 0;
 }
 
@@ -523,7 +623,14 @@ rte_eventmode_helper_initialize_eventdev(struct eventmode_conf *em_conf)
 		/* Get event dev ID */
 		eventdev_id = link->eventdev_id;
 
-		queue = &(link->eventq_id);
+		/*
+		 * If "all_ev_queue_to_ev_port" params flag is selected, all
+		 * queues need to be mapped to the port.
+		 */
+		if (em_conf->ext_params.all_ev_queue_to_ev_port)
+			queue = NULL;
+		else
+			queue = &(link->eventq_id);
 
 		/* Link queue to port */
 		ret = rte_event_port_link(eventdev_id, link->event_portid,
diff --git a/lib/librte_eventdev/rte_eventmode_helper_internal.h b/lib/librte_eventdev/rte_eventmode_helper_internal.h
index 9db9684..3a4e52f 100644
--- a/lib/librte_eventdev/rte_eventmode_helper_internal.h
+++ b/lib/librte_eventdev/rte_eventmode_helper_internal.h
@@ -93,6 +93,11 @@ struct eventmode_conf {
 		/**< Stage 1 schedule type */
 			uint64_t s2_sched_type			: 2;
 		/**< Stage 2 schedule type */
+			uint64_t all_ev_queue_to_ev_port	: 1;
+		/**<
+		 * When enabled, all event queues need to be mapped to
+		 * each event port
+		 */
 		};
 		uint64_t u64;
 	} ext_params;
-- 
2.7.4

  parent reply	other threads:[~2018-06-08 17:25 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-06-08 17:23 [dpdk-dev] [PATCH 00/20] add eventmode helper functions Anoob Joseph
2018-06-08 17:24 ` [dpdk-dev] [PATCH 01/20] eventdev: add files for eventmode helper Anoob Joseph
2018-06-27  6:20   ` Sunil Kumar Kori
2018-06-28 10:43     ` Joseph, Anoob
2018-06-28 10:47       ` Ananyev, Konstantin
2018-06-28 10:58         ` Joseph, Anoob
2018-06-28 11:44           ` Ananyev, Konstantin
2018-06-28 11:54             ` Joseph, Anoob
2018-07-03  6:27       ` Sunil Kumar Kori
2018-07-03 13:13         ` Joseph, Anoob
2018-07-04 10:49           ` Sunil Kumar Kori
2018-06-08 17:24 ` [dpdk-dev] [PATCH 02/20] eventdev: add routines for logging " Anoob Joseph
2018-06-08 17:24 ` [dpdk-dev] [PATCH 03/20] eventdev: add eventmode CL options framework Anoob Joseph
2018-06-08 17:24 ` [dpdk-dev] [PATCH 04/20] eventdev: allow application to set ethernet portmask Anoob Joseph
2018-06-08 17:24 ` [dpdk-dev] [PATCH 05/20] eventdev: add framework for eventmode conf Anoob Joseph
2018-06-08 17:24 ` [dpdk-dev] [PATCH 06/20] eventdev: add common initialize routine for eventmode devs Anoob Joseph
2018-06-08 17:24 ` [dpdk-dev] [PATCH 07/20] eventdev: add eventdevice init for eventmode Anoob Joseph
2018-06-08 17:24 ` [dpdk-dev] [PATCH 08/20] eventdev: add eventdev port-lcore link Anoob Joseph
2018-06-08 17:24 ` [dpdk-dev] [PATCH 09/20] eventdev: add option to specify schedule mode for app stage Anoob Joseph
2018-06-08 17:24 ` [dpdk-dev] [PATCH 10/20] eventdev: add placeholder for ethdev init Anoob Joseph
2018-06-08 17:24 ` [dpdk-dev] [PATCH 11/20] eventdev: add Rx adapter init in eventmode Anoob Joseph
2018-06-08 17:24 ` [dpdk-dev] [PATCH 12/20] eventdev: add routine to validate conf Anoob Joseph
2018-06-08 17:24 ` [dpdk-dev] [PATCH 13/20] eventdev: add default conf for event devs field in conf Anoob Joseph
2018-06-08 17:24 ` [dpdk-dev] [PATCH 14/20] eventdev: add default conf for Rx adapter conf Anoob Joseph
2018-06-08 17:24 ` Anoob Joseph [this message]
2018-06-08 17:24 ` [dpdk-dev] [PATCH 16/20] eventdev: add routines to display the eventmode conf Anoob Joseph
2018-06-08 17:24 ` [dpdk-dev] [PATCH 17/20] eventdev: add routine to access eventmode link info Anoob Joseph
2018-06-08 17:24 ` [dpdk-dev] [PATCH 18/20] eventdev: add routine to access event queue for eth Tx Anoob Joseph
2018-06-08 17:24 ` [dpdk-dev] [PATCH 19/20] eventdev: add routine to launch eventmode workers Anoob Joseph
2018-06-08 17:24 ` [dpdk-dev] [PATCH 20/20] examples/l2fwd: add eventmode for l2fwd Anoob Joseph
2018-06-11  8:32 ` [dpdk-dev] [PATCH 00/20] add eventmode helper functions Jerin Jacob

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1528478659-15859-16-git-send-email-anoob.joseph@caviumnetworks.com \
    --to=anoob.joseph@caviumnetworks.com \
    --cc=bruce.richardson@intel.com \
    --cc=dev@dpdk.org \
    --cc=hemant.agrawal@nxp.com \
    --cc=jerin.jacob@caviumnetworks.com \
    --cc=narayanaprasad.athreya@caviumnetworks.com \
    --cc=nikhil.rao@intel.com \
    --cc=pablo.de.lara.guarch@intel.com \
    --cc=pbhagavatula@caviumnetworks.com \
    --cc=sunil.kori@nxp.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).