DPDK patches and discussions
 help / color / mirror / Atom feed
From: Anoob Joseph <anoobj@marvell.com>
To: Jerin Jacob <jerinj@marvell.com>,
	Nikhil Rao <nikhil.rao@intel.com>,
	"Erik Gabriel Carrillo" <erik.g.carrillo@intel.com>,
	Abhinandan Gujjar <abhinandan.gujjar@intel.com>,
	Bruce Richardson <bruce.richardson@intel.com>,
	Pablo de Lara <pablo.de.lara.guarch@intel.com>
Cc: "Anoob Joseph" <anoobj@marvell.com>,
	"Narayana Prasad" <pathreya@marvell.com>,
	dev@dpdk.org, "Lukasz Bartosik" <lbartosik@marvell.com>,
	"Pavan Nikhilesh" <pbhagavatula@marvell.com>,
	"Hemant Agrawal" <hemant.agrawal@nxp.com>,
	"Nipun Gupta" <nipun.gupta@nxp.com>,
	"Harry van Haaren" <harry.van.haaren@intel.com>,
	"Mattias Rönnblom" <mattias.ronnblom@ericsson.com>,
	"Liang Ma" <liang.j.ma@intel.com>
Subject: [dpdk-dev] [PATCH 20/39] eventdev: add eventdevice init for eventmode
Date: Mon, 3 Jun 2019 23:02:20 +0530	[thread overview]
Message-ID: <1559583160-13944-21-git-send-email-anoobj@marvell.com> (raw)
In-Reply-To: <1559583160-13944-1-git-send-email-anoobj@marvell.com>

Adding routines to initialize event devs. The internal conf structure
would be used to track device configuration.

Signed-off-by: Anoob Joseph <anoobj@marvell.com>
Signed-off-by: Lukasz Bartosik <lbartosik@marvell.com>
---
 lib/librte_eventdev/rte_eventmode_helper.c         | 131 +++++++++++++++++++++
 .../rte_eventmode_helper_internal.h                |  16 ++-
 2 files changed, 146 insertions(+), 1 deletion(-)

diff --git a/lib/librte_eventdev/rte_eventmode_helper.c b/lib/librte_eventdev/rte_eventmode_helper.c
index d1a569b..bebcfb9 100644
--- a/lib/librte_eventdev/rte_eventmode_helper.c
+++ b/lib/librte_eventdev/rte_eventmode_helper.c
@@ -4,6 +4,7 @@
 #include <getopt.h>
 
 #include <rte_ethdev.h>
+#include <rte_eventdev.h>
 #include <rte_eventmode_helper.h>
 #include <rte_malloc.h>
 
@@ -154,12 +155,134 @@ rte_eventmode_helper_parse_args(int argc, char **argv)
 	return NULL;
 }
 
+/* Setup eventmode devs */
+
+static int
+rte_eventmode_helper_initialize_eventdev(struct eventmode_conf *em_conf)
+{
+	int ret = -1;
+	uint8_t i, j;
+	struct rte_event_dev_config eventdev_conf;
+	struct rte_event_dev_info evdev_default_conf;
+	struct rte_event_queue_conf eventq_conf = {0};
+	struct eventdev_params *eventdev_config;
+	int nb_eventdev = em_conf->nb_eventdev;
+	int nb_eventqueue;
+	uint8_t eventdev_id;
+
+	for (i = 0; i < nb_eventdev; i++) {
+
+		/* Get eventdev config */
+		eventdev_config = &(em_conf->eventdev_config[i]);
+
+		/* Get event dev ID */
+		eventdev_id = eventdev_config->eventdev_id;
+
+		/* Get the number of queues */
+		nb_eventqueue = eventdev_config->nb_eventqueue;
+
+		/* One queue is reserved for the final stage (doing eth tx) */
+		/* TODO handles only one Tx adapter. Fix this */
+		nb_eventqueue += 1;
+
+		/* Reset the default conf */
+		memset(&evdev_default_conf, 0,
+			sizeof(struct rte_event_dev_info));
+
+		/* Get default conf of eventdev */
+		ret = rte_event_dev_info_get(eventdev_id, &evdev_default_conf);
+		if (ret < 0) {
+			RTE_EM_HLPR_LOG_ERR(
+				"Error in getting event device info[devID:%d]",
+				eventdev_id);
+			return ret;
+		}
+
+		memset(&eventdev_conf, 0, sizeof(struct rte_event_dev_config));
+		eventdev_conf.nb_events_limit =
+				evdev_default_conf.max_num_events;
+		eventdev_conf.nb_event_queues = nb_eventqueue;
+		eventdev_conf.nb_event_ports =
+				eventdev_config->nb_eventport;
+		eventdev_conf.nb_event_queue_flows =
+				evdev_default_conf.max_event_queue_flows;
+		eventdev_conf.nb_event_port_dequeue_depth =
+				evdev_default_conf.max_event_port_dequeue_depth;
+		eventdev_conf.nb_event_port_enqueue_depth =
+				evdev_default_conf.max_event_port_enqueue_depth;
+
+		/* Configure event device */
+		ret = rte_event_dev_configure(eventdev_id, &eventdev_conf);
+		if (ret < 0) {
+			RTE_EM_HLPR_LOG_ERR(
+				"Error in configuring event device");
+			return ret;
+		}
+
+		/* Configure event queues */
+		for (j = 0; j < nb_eventqueue; j++) {
+
+			memset(&eventq_conf, 0,
+					sizeof(struct rte_event_queue_conf));
+
+			/* Read the requested conf */
+
+			/* Per event dev queues can be ATQ or SINGLE LINK */
+			eventq_conf.event_queue_cfg =
+					eventdev_config->ev_queue_mode;
+
+			/* Set schedule type as ATOMIC */
+			eventq_conf.schedule_type = RTE_SCHED_TYPE_ATOMIC;
+
+			/* Set max atomic flows to 1024 */
+			eventq_conf.nb_atomic_flows = 1024;
+			eventq_conf.nb_atomic_order_sequences = 1024;
+
+			/* Setup the queue */
+			ret = rte_event_queue_setup(eventdev_id, j,
+					&eventq_conf);
+			if (ret < 0) {
+				RTE_EM_HLPR_LOG_ERR(
+					"Error in event queue setup");
+				return ret;
+			}
+		}
+
+		/* Configure event ports */
+		for (j = 0; j <  eventdev_config->nb_eventport; j++) {
+			ret = rte_event_port_setup(eventdev_id, j, NULL);
+			if (ret < 0) {
+				RTE_EM_HLPR_LOG_ERR(
+					"Error setting up event port");
+				return ret;
+			}
+		}
+	}
+
+	/* Start event devices */
+	for (i = 0; i < nb_eventdev; i++) {
+
+		/* Get eventdev config */
+		eventdev_config = &(em_conf->eventdev_config[i]);
+
+		ret = rte_event_dev_start(eventdev_config->eventdev_id);
+		if (ret < 0) {
+			RTE_EM_HLPR_LOG_ERR(
+				"Error in starting event device[devID: %d]",
+				eventdev_config->eventdev_id);
+			return ret;
+		}
+	}
+	return 0;
+}
+
 int32_t __rte_experimental
 rte_eventmode_helper_initialize_devs(
 		struct rte_eventmode_helper_conf *mode_conf)
 {
 	int ret;
 	uint16_t portid;
+	struct eventmode_conf *em_conf;
 
 	if (mode_conf == NULL) {
 		RTE_EM_HLPR_LOG_ERR("Invalid conf");
@@ -174,6 +297,9 @@ rte_eventmode_helper_initialize_devs(
 		return -1;
 	}
 
+	/* Get eventmode conf */
+	em_conf = (struct eventmode_conf *)(mode_conf->mode_params);
+
 	/* Stop eth devices before setting up adapter */
 	RTE_ETH_FOREACH_DEV(portid) {
 
@@ -184,6 +310,11 @@ rte_eventmode_helper_initialize_devs(
 		rte_eth_dev_stop(portid);
 	}
 
+	/* Setup eventdev */
+	ret = rte_eventmode_helper_initialize_eventdev(em_conf);
+	if (ret != 0)
+		return ret;
+
 	/* Start eth devices after setting up adapter */
 	RTE_ETH_FOREACH_DEV(portid) {
 
diff --git a/lib/librte_eventdev/rte_eventmode_helper_internal.h b/lib/librte_eventdev/rte_eventmode_helper_internal.h
index 2ee7711..0b4ec59 100644
--- a/lib/librte_eventdev/rte_eventmode_helper_internal.h
+++ b/lib/librte_eventdev/rte_eventmode_helper_internal.h
@@ -32,9 +32,23 @@
 #define RTE_EM_HLPR_LOG_DEBUG(...) (void)0
 #endif
 
+/* Max event devices supported */
+#define EVENT_MODE_MAX_EVENT_DEVS RTE_EVENT_MAX_DEVS
+
+/* Event dev params */
+struct eventdev_params {
+	uint8_t eventdev_id;
+	uint8_t nb_eventqueue;
+	uint8_t nb_eventport;
+	uint8_t ev_queue_mode;
+};
+
 /* Eventmode conf data */
 struct eventmode_conf {
-	uint64_t dummy;
+	int nb_eventdev;
+		/**< No of event devs */
+	struct eventdev_params eventdev_config[EVENT_MODE_MAX_EVENT_DEVS];
+		/**< Per event dev conf */
 };
 
 #endif /* _RTE_EVENTMODE_HELPER_INTERNAL_H_ */
-- 
2.7.4


  parent reply	other threads:[~2019-06-03 17:37 UTC|newest]

Thread overview: 70+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-06-03 17:32 [dpdk-dev] [PATCH 00/39] adding eventmode helper library Anoob Joseph
2019-06-03 17:32 ` [dpdk-dev] [PATCH 01/39] examples/l2fwd-event: create copy of l2fwd Anoob Joseph
2019-06-03 17:32 ` [dpdk-dev] [PATCH 02/39] examples/l2fwd-event: move macros to common header Anoob Joseph
2019-06-03 17:32 ` [dpdk-dev] [PATCH 03/39] examples/l2fwd-event: move structures " Anoob Joseph
2019-06-03 17:32 ` [dpdk-dev] [PATCH 04/39] examples/l2fwd-event: move global vars " Anoob Joseph
2019-06-07 10:02   ` Jerin Jacob Kollanukkaran
2019-06-07 10:45     ` Anoob Joseph
2019-06-07 12:47       ` Jerin Jacob Kollanukkaran
2019-06-03 17:32 ` [dpdk-dev] [PATCH 05/39] examples/l2fwd-event: move dataplane code to new file Anoob Joseph
2019-06-03 17:32 ` [dpdk-dev] [PATCH 06/39] examples/l2fwd-event: remove unused header includes Anoob Joseph
2019-06-03 17:32 ` [dpdk-dev] [PATCH 07/39] examples/l2fwd-event: move drain buffers to new function Anoob Joseph
2019-06-03 17:32 ` [dpdk-dev] [PATCH 08/39] examples/l2fwd-event: optimize check for master core Anoob Joseph
2019-06-03 17:32 ` [dpdk-dev] [PATCH 09/39] examples/l2fwd-event: move periodic tasks to new func Anoob Joseph
2019-06-03 17:32 ` [dpdk-dev] [PATCH 10/39] examples/l2fwd-event: do timer updates only on master Anoob Joseph
2019-06-03 17:32 ` [dpdk-dev] [PATCH 11/39] examples/l2fwd-event: move pkt send code to a new func Anoob Joseph
2019-06-03 17:32 ` [dpdk-dev] [PATCH 12/39] examples/l2fwd-event: use fprintf in usage print Anoob Joseph
2019-06-03 17:32 ` [dpdk-dev] [PATCH 13/39] examples/l2fwd-event: improvements to the " Anoob Joseph
2019-06-03 17:32 ` [dpdk-dev] [PATCH 14/39] eventdev: add files for eventmode helper Anoob Joseph
2019-06-10 10:10   ` Jerin Jacob Kollanukkaran
2019-06-03 17:32 ` [dpdk-dev] [PATCH 15/39] eventdev: add routines for logging " Anoob Joseph
2019-06-10 10:12   ` Jerin Jacob Kollanukkaran
2019-06-17  9:09     ` Anoob Joseph
2019-06-03 17:32 ` [dpdk-dev] [PATCH 16/39] eventdev: add eventmode CL options framework Anoob Joseph
2019-06-10 10:19   ` Jerin Jacob Kollanukkaran
2019-06-17 10:14     ` Anoob Joseph
2019-06-11  8:58   ` [dpdk-dev] [EXT] " Sunil Kumar Kori
2019-06-03 17:32 ` [dpdk-dev] [PATCH 17/39] eventdev: allow application to set ethernet portmask Anoob Joseph
2019-06-03 17:32 ` [dpdk-dev] [PATCH 18/39] eventdev: add framework for eventmode conf Anoob Joseph
2019-06-10 10:06   ` Jerin Jacob Kollanukkaran
2019-06-20  7:26     ` Anoob Joseph
2019-06-03 17:32 ` [dpdk-dev] [PATCH 19/39] eventdev: add common initialize routine for eventmode devs Anoob Joseph
2019-06-10 10:23   ` Jerin Jacob Kollanukkaran
2019-06-17 10:22     ` Anoob Joseph
2019-06-11  8:58   ` [dpdk-dev] [EXT] " Sunil Kumar Kori
2019-06-03 17:32 ` Anoob Joseph [this message]
2019-06-03 17:32 ` [dpdk-dev] [PATCH 21/39] eventdev: add eventdev port-lcore link Anoob Joseph
2019-06-03 17:32 ` [dpdk-dev] [PATCH 22/39] eventdev: add option to specify schedule mode for app stage Anoob Joseph
2019-06-03 17:32 ` [dpdk-dev] [PATCH 23/39] eventdev: add placeholder for ethdev init Anoob Joseph
2019-06-03 17:32 ` [dpdk-dev] [PATCH 24/39] eventdev: add Rx adapter init in eventmode Anoob Joseph
2019-06-10 14:56   ` Carrillo, Erik G
2019-06-11  3:45     ` [dpdk-dev] [EXT] " Anoob Joseph
2019-06-03 17:32 ` [dpdk-dev] [PATCH 25/39] eventdev: add routine to validate conf Anoob Joseph
2019-06-10 10:25   ` Jerin Jacob Kollanukkaran
2019-06-17 10:23     ` Anoob Joseph
2019-06-03 17:32 ` [dpdk-dev] [PATCH 26/39] eventdev: add default conf for event devs field in conf Anoob Joseph
2019-06-03 17:32 ` [dpdk-dev] [PATCH 27/39] eventdev: add default conf for Rx adapter conf Anoob Joseph
2019-06-03 17:32 ` [dpdk-dev] [PATCH 28/39] eventdev: add default conf for event port-lcore link Anoob Joseph
2019-06-03 17:32 ` [dpdk-dev] [PATCH 29/39] eventdev: add routines to display the eventmode conf Anoob Joseph
2019-06-03 17:32 ` [dpdk-dev] [PATCH 30/39] eventdev: add routine to access eventmode link info Anoob Joseph
2019-06-03 17:32 ` [dpdk-dev] [PATCH 31/39] eventdev: add routine to access event queue for eth Tx Anoob Joseph
2019-06-03 17:32 ` [dpdk-dev] [PATCH 32/39] eventdev: add routine to launch eventmode workers Anoob Joseph
2019-06-10 14:31   ` Carrillo, Erik G
2019-06-17 10:34     ` [dpdk-dev] [EXT] " Anoob Joseph
2019-06-10 14:46   ` [dpdk-dev] " Carrillo, Erik G
2019-06-27  5:50     ` Anoob Joseph
2019-06-11  8:58   ` [dpdk-dev] [EXT] " Sunil Kumar Kori
2019-06-03 17:32 ` [dpdk-dev] [PATCH 33/39] eventdev: add Tx adapter support Anoob Joseph
2019-06-11  8:58   ` [dpdk-dev] [EXT] " Sunil Kumar Kori
2019-06-03 17:32 ` [dpdk-dev] [PATCH 34/39] eventdev: add support for internal ports Anoob Joseph
2019-06-03 17:32 ` [dpdk-dev] [PATCH 35/39] eventdev: display Tx adapter conf Anoob Joseph
2019-06-03 17:32 ` [dpdk-dev] [PATCH 36/39] examples/l2fwd-event: add eventmode for l2fwd Anoob Joseph
2019-06-03 17:32 ` [dpdk-dev] [PATCH 37/39] examples/l2fwd-event: add eventmode worker Anoob Joseph
2019-06-03 17:32 ` [dpdk-dev] [PATCH 38/39] " Anoob Joseph
2019-06-03 17:32 ` [dpdk-dev] [PATCH 39/39] " Anoob Joseph
2019-06-07  9:48 ` [dpdk-dev] [PATCH 00/39] adding eventmode helper library Jerin Jacob Kollanukkaran
2019-06-11 10:44   ` Mattias Rönnblom
2019-06-14  9:18     ` [dpdk-dev] [EXT] " Anoob Joseph
2019-06-17 13:23       ` Mattias Rönnblom
2019-06-20  3:44         ` Anoob Joseph
     [not found] <1559580584-5728-1-git-send-email-anoobj@marvell.com>
2019-06-03 16:49 ` [dpdk-dev] [PATCH 20/39] eventdev: add eventdevice init for eventmode Anoob Joseph

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=1559583160-13944-21-git-send-email-anoobj@marvell.com \
    --to=anoobj@marvell.com \
    --cc=abhinandan.gujjar@intel.com \
    --cc=bruce.richardson@intel.com \
    --cc=dev@dpdk.org \
    --cc=erik.g.carrillo@intel.com \
    --cc=harry.van.haaren@intel.com \
    --cc=hemant.agrawal@nxp.com \
    --cc=jerinj@marvell.com \
    --cc=lbartosik@marvell.com \
    --cc=liang.j.ma@intel.com \
    --cc=mattias.ronnblom@ericsson.com \
    --cc=nikhil.rao@intel.com \
    --cc=nipun.gupta@nxp.com \
    --cc=pablo.de.lara.guarch@intel.com \
    --cc=pathreya@marvell.com \
    --cc=pbhagavatula@marvell.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).