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 04/10] eventdev: add support in DSW for linking/unlinking ports
Date: Thu, 30 Aug 2018 16:27:13 +0200	[thread overview]
Message-ID: <20180830142719.28569-5-mattias.ronnblom@ericsson.com> (raw)
In-Reply-To: <20180830142719.28569-1-mattias.ronnblom@ericsson.com>

Added support for linking and unlinking ports to queues in a DSW event
device.

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

diff --git a/drivers/event/dsw/dsw_evdev.c b/drivers/event/dsw/dsw_evdev.c
index 91b1a2449..5dccc232a 100644
--- a/drivers/event/dsw/dsw_evdev.c
+++ b/drivers/event/dsw/dsw_evdev.c
@@ -2,6 +2,8 @@
  * Copyright(c) 2018 Ericsson AB
  */
 
+#include <stdbool.h>
+
 #include <rte_eventdev_pmd.h>
 #include <rte_eventdev_pmd_vdev.h>
 
@@ -112,6 +114,69 @@ dsw_queue_release(struct rte_eventdev *dev __rte_unused,
 {
 }
 
+static void
+queue_add_port(struct dsw_queue *queue, uint16_t port_id)
+{
+	queue->serving_ports[queue->num_serving_ports] = port_id;
+	queue->num_serving_ports++;
+}
+
+static bool
+queue_remove_port(struct dsw_queue *queue, uint16_t port_id)
+{
+	uint16_t i;
+
+	for (i = 0; i < queue->num_serving_ports; i++)
+		if (queue->serving_ports[i] == port_id) {
+			uint16_t last_idx = queue->num_serving_ports - 1;
+			if (i != last_idx)
+				queue->serving_ports[i] =
+					queue->serving_ports[last_idx];
+			queue->num_serving_ports--;
+			return true;
+		}
+	return false;
+}
+
+static int
+dsw_port_link_unlink(struct rte_eventdev *dev, void *port,
+		     const uint8_t queues[], uint16_t num, bool link)
+{
+	struct dsw_evdev *dsw = dsw_pmd_priv(dev);
+	struct dsw_port *p = port;
+	uint16_t i;
+	uint16_t count = 0;
+
+	for (i = 0; i < num; i++) {
+		uint8_t qid = queues[i];
+		struct dsw_queue *q = &dsw->queues[qid];
+		if (link) {
+			queue_add_port(q, p->id);
+			count++;
+		} else {
+			bool removed = queue_remove_port(q, p->id);
+			if (removed)
+				count++;
+		}
+	}
+
+	return count;
+}
+
+static int
+dsw_port_link(struct rte_eventdev *dev, void *port, const uint8_t queues[],
+	      const uint8_t priorities[] __rte_unused, uint16_t num)
+{
+	return dsw_port_link_unlink(dev, port, queues, num, true);
+}
+
+static int
+dsw_port_unlink(struct rte_eventdev *dev, void *port, uint8_t queues[],
+		uint16_t num)
+{
+	return dsw_port_link_unlink(dev, port, queues, num, false);
+}
+
 static void
 dsw_info_get(struct rte_eventdev *dev __rte_unused,
 	     struct rte_event_dev_info *info)
@@ -150,6 +215,8 @@ static struct rte_eventdev_ops dsw_evdev_ops = {
 	.queue_setup = dsw_queue_setup,
 	.queue_def_conf = dsw_queue_def_conf,
 	.queue_release = dsw_queue_release,
+	.port_link = dsw_port_link,
+	.port_unlink = dsw_port_unlink,
 	.dev_infos_get = dsw_info_get,
 	.dev_configure = dsw_configure,
 };
diff --git a/drivers/event/dsw/dsw_evdev.h b/drivers/event/dsw/dsw_evdev.h
index 2a4f10421..ad0f857cc 100644
--- a/drivers/event/dsw/dsw_evdev.h
+++ b/drivers/event/dsw/dsw_evdev.h
@@ -51,6 +51,7 @@ struct dsw_port {
 
 struct dsw_queue {
 	uint8_t schedule_type;
+	uint8_t serving_ports[DSW_MAX_PORTS];
 	uint16_t num_serving_ports;
 };
 
-- 
2.17.1

  parent reply	other threads:[~2018-08-30 14:27 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-08-30 14:27 [dpdk-dev] [PATCH 00/10] Add the Distributed Software Event Device Mattias Rönnblom
2018-08-30 14:27 ` [dpdk-dev] [PATCH 01/10] eventdev: add DSW device registration and build system Mattias Rönnblom
2018-08-30 14:27 ` [dpdk-dev] [PATCH 02/10] eventdev: add DSW device and queue configuration Mattias Rönnblom
2018-08-30 14:27 ` [dpdk-dev] [PATCH 03/10] eventdev: add DSW port configuration Mattias Rönnblom
2018-08-30 14:27 ` Mattias Rönnblom [this message]
2018-08-30 14:27 ` [dpdk-dev] [PATCH 05/10] eventdev: add DSW event scheduling and device start/stop Mattias Rönnblom
2018-08-30 14:27 ` [dpdk-dev] [PATCH 06/10] eventdev: add DSW port load measurements Mattias Rönnblom
2018-08-30 14:27 ` [dpdk-dev] [PATCH 07/10] eventdev: add load balancing to the DSW event device Mattias Rönnblom
2018-08-30 14:27 ` [dpdk-dev] [PATCH 08/10] eventdev: let DSW event device sort events on dequeue Mattias Rönnblom
2018-08-30 14:27 ` [dpdk-dev] [PATCH 09/10] eventdev: implement eventdev 'xstats' counters in DSW Mattias Rönnblom
2018-08-30 14:27 ` [dpdk-dev] [PATCH 10/10] eventdev: include DSW event device documentation Mattias Rönnblom
2018-09-10 12:59   ` Mattias Rönnblom
2018-09-10 13:20     ` 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=20180830142719.28569-5-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).