DPDK patches and discussions
 help / color / mirror / Atom feed
From: "Mattias Rönnblom" <mattias.ronnblom@ericsson.com>
To: jerin.jacob@caviumnetworks.com
Cc: bruce.richardson@intel.com, dev@dpdk.org,
	"Mattias Rönnblom" <mattias.ronnblom@ericsson.com>
Subject: [dpdk-dev] [PATCH v3 03/10] event/dsw: add DSW port configuration
Date: Tue, 11 Sep 2018 10:02:09 +0200	[thread overview]
Message-ID: <20180911080216.3017-4-mattias.ronnblom@ericsson.com> (raw)
In-Reply-To: <20180911080216.3017-1-mattias.ronnblom@ericsson.com>

Allow port setup and release in the DSW event device.

Signed-off-by: Mattias Rönnblom <mattias.ronnblom@ericsson.com>
---
 drivers/event/dsw/dsw_evdev.c | 60 +++++++++++++++++++++++++++++++++++
 drivers/event/dsw/dsw_evdev.h | 28 ++++++++++++++++
 2 files changed, 88 insertions(+)

diff --git a/drivers/event/dsw/dsw_evdev.c b/drivers/event/dsw/dsw_evdev.c
index 1500d2426..91b1a2449 100644
--- a/drivers/event/dsw/dsw_evdev.c
+++ b/drivers/event/dsw/dsw_evdev.c
@@ -9,6 +9,62 @@
 
 #define EVENTDEV_NAME_DSW_PMD event_dsw
 
+static int
+dsw_port_setup(struct rte_eventdev *dev, uint8_t port_id,
+	       const struct rte_event_port_conf *conf)
+{
+	struct dsw_evdev *dsw = dsw_pmd_priv(dev);
+	struct dsw_port *port;
+	struct rte_event_ring *in_ring;
+	char ring_name[RTE_RING_NAMESIZE];
+
+	port = &dsw->ports[port_id];
+
+	*port = (struct dsw_port) {
+		.id = port_id,
+		.dsw = dsw,
+		.dequeue_depth = conf->dequeue_depth,
+		.enqueue_depth = conf->enqueue_depth,
+		.new_event_threshold = conf->new_event_threshold
+	};
+
+	snprintf(ring_name, sizeof(ring_name), "dsw%d_p%u", dev->data->dev_id,
+		 port_id);
+
+	in_ring = rte_event_ring_create(ring_name, DSW_IN_RING_SIZE,
+					dev->data->socket_id,
+					RING_F_SC_DEQ|RING_F_EXACT_SZ);
+
+	if (in_ring == NULL)
+		return -ENOMEM;
+
+	port->in_ring = in_ring;
+
+	dev->data->ports[port_id] = port;
+
+	return 0;
+}
+
+static void
+dsw_port_def_conf(struct rte_eventdev *dev __rte_unused,
+		  uint8_t port_id __rte_unused,
+		  struct rte_event_port_conf *port_conf)
+{
+	*port_conf = (struct rte_event_port_conf) {
+		.new_event_threshold = 1024,
+		.dequeue_depth = DSW_MAX_PORT_DEQUEUE_DEPTH / 4,
+		.enqueue_depth = DSW_MAX_PORT_ENQUEUE_DEPTH / 4
+	};
+}
+
+static void
+dsw_port_release(void *p)
+{
+	struct dsw_port *port = p;
+
+	rte_event_ring_free(port->in_ring);
+}
+
 static int
 dsw_queue_setup(struct rte_eventdev *dev, uint8_t queue_id,
 		const struct rte_event_queue_conf *conf)
@@ -81,12 +137,16 @@ dsw_configure(const struct rte_eventdev *dev)
 	struct dsw_evdev *dsw = dsw_pmd_priv(dev);
 	const struct rte_event_dev_config *conf = &dev->data->dev_conf;
 
+	dsw->num_ports = conf->nb_event_ports;
 	dsw->num_queues = conf->nb_event_queues;
 
 	return 0;
 }
 
 static struct rte_eventdev_ops dsw_evdev_ops = {
+	.port_setup = dsw_port_setup,
+	.port_def_conf = dsw_port_def_conf,
+	.port_release = dsw_port_release,
 	.queue_setup = dsw_queue_setup,
 	.queue_def_conf = dsw_queue_def_conf,
 	.queue_release = dsw_queue_release,
diff --git a/drivers/event/dsw/dsw_evdev.h b/drivers/event/dsw/dsw_evdev.h
index 5eda8d114..2a4f10421 100644
--- a/drivers/event/dsw/dsw_evdev.h
+++ b/drivers/event/dsw/dsw_evdev.h
@@ -5,6 +5,7 @@
 #ifndef _DSW_EVDEV_H_
 #define _DSW_EVDEV_H_
 
+#include <rte_event_ring.h>
 #include <rte_eventdev.h>
 
 #define DSW_PMD_NAME RTE_STR(event_dsw)
@@ -23,6 +24,31 @@
 #define DSW_MAX_FLOWS (1<<(DSW_MAX_FLOWS_BITS))
 #define DSW_MAX_FLOWS_MASK (DSW_MAX_FLOWS-1)
 
+/* The rings are dimensioned so that all in-flight events can reside
+ * on any one of the port rings, to avoid the trouble of having to
+ * care about the case where there's no room on the destination port's
+ * input ring.
+ */
+#define DSW_IN_RING_SIZE (DSW_MAX_EVENTS)
+
+struct dsw_port {
+	uint16_t id;
+
+	/* Keeping a pointer here to avoid container_of() calls, which
+	 * are expensive since they are very frequent and will result
+	 * in an integer multiplication (since the port id is an index
+	 * into the dsw_evdev port array).
+	 */
+	struct dsw_evdev *dsw;
+
+	uint16_t dequeue_depth;
+	uint16_t enqueue_depth;
+
+	int32_t new_event_threshold;
+
+	struct rte_event_ring *in_ring __rte_cache_aligned;
+} __rte_cache_aligned;
+
 struct dsw_queue {
 	uint8_t schedule_type;
 	uint16_t num_serving_ports;
@@ -31,6 +57,8 @@ struct dsw_queue {
 struct dsw_evdev {
 	struct rte_eventdev_data *data;
 
+	struct dsw_port ports[DSW_MAX_PORTS];
+	uint16_t num_ports;
 	struct dsw_queue queues[DSW_MAX_QUEUES];
 	uint8_t num_queues;
 };
-- 
2.17.1

  parent reply	other threads:[~2018-09-11  8:03 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-09-11  8:02 [dpdk-dev] [PATCH v3 00/10] A Distributed Software Event Device Mattias Rönnblom
2018-09-11  8:02 ` [dpdk-dev] [PATCH v3 01/10] event/dsw: add DSW device registration and build system Mattias Rönnblom
2018-09-17 11:41   ` Jerin Jacob
2018-09-11  8:02 ` [dpdk-dev] [PATCH v3 02/10] event/dsw: add DSW device and queue configuration Mattias Rönnblom
2018-09-11  8:02 ` Mattias Rönnblom [this message]
2018-09-17 12:12   ` [dpdk-dev] [PATCH v3 03/10] event/dsw: add DSW port configuration Jerin Jacob
2018-09-11  8:02 ` [dpdk-dev] [PATCH v3 04/10] event/dsw: add support in DSW for linking/unlinking ports Mattias Rönnblom
2018-09-17 12:14   ` Jerin Jacob
2018-09-11  8:02 ` [dpdk-dev] [PATCH v3 05/10] event/dsw: add DSW event scheduling and device start/stop Mattias Rönnblom
2018-09-17 12:22   ` Jerin Jacob
2018-09-11  8:02 ` [dpdk-dev] [PATCH v3 06/10] event/dsw: add DSW port load measurements Mattias Rönnblom
2018-09-11  8:02 ` [dpdk-dev] [PATCH v3 07/10] event/dsw: add load balancing to the DSW event device Mattias Rönnblom
2018-09-11  8:02 ` [dpdk-dev] [PATCH v3 08/10] event/dsw: let DSW event device sort events on dequeue Mattias Rönnblom
2018-09-11  8:02 ` [dpdk-dev] [PATCH v3 09/10] event/dsw: implement eventdev 'xstats' counters in DSW Mattias Rönnblom
2018-09-17 12:23   ` Jerin Jacob
2018-09-11  8:02 ` [dpdk-dev] [PATCH v3 10/10] event/dsw: include DSW event device documentation Mattias Rönnblom
2018-09-17 12:29   ` Jerin Jacob
2018-09-17 19:17     ` Mattias Rönnblom
2018-09-18  5:28       ` 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=20180911080216.3017-4-mattias.ronnblom@ericsson.com \
    --to=mattias.ronnblom@ericsson.com \
    --cc=bruce.richardson@intel.com \
    --cc=dev@dpdk.org \
    --cc=jerin.jacob@caviumnetworks.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).