DPDK patches and discussions
 help / color / mirror / Atom feed
From: Harry van Haaren <harry.van.haaren@intel.com>
To: dev@dpdk.org
Cc: jerin.jacob@caviumnetworks.com, matias.elo@nokia.com,
	Harry van Haaren <harry.van.haaren@intel.com>
Subject: [dpdk-dev] [PATCH v2 2/3] event/sw: implement unlinks in progress function
Date: Thu, 20 Sep 2018 12:22:50 +0100	[thread overview]
Message-ID: <20180920112251.47854-2-harry.van.haaren@intel.com> (raw)
In-Reply-To: <20180920112251.47854-1-harry.van.haaren@intel.com>

This commit adds a counter to each port, which counts the
number of unlinks that have been performed. When the scheduler
thread starts its scheduling routine, it "acks" all unlinks that
have been requested, and the application is gauranteed that no
more events will be scheduled to the port from the unlinked queue.

Signed-off-by: Harry van Haaren <harry.van.haaren@intel.com>

---

v2:
- Fix unused "dev" variable (Jerin)
---
 drivers/event/sw/sw_evdev.c           | 12 ++++++++++++
 drivers/event/sw/sw_evdev.h           |  8 ++++++++
 drivers/event/sw/sw_evdev_scheduler.c |  7 ++++++-
 3 files changed, 26 insertions(+), 1 deletion(-)

diff --git a/drivers/event/sw/sw_evdev.c b/drivers/event/sw/sw_evdev.c
index a6bb91388..9e1412537 100644
--- a/drivers/event/sw/sw_evdev.c
+++ b/drivers/event/sw/sw_evdev.c
@@ -113,9 +113,20 @@ sw_port_unlink(struct rte_eventdev *dev, void *port, uint8_t queues[],
 			}
 		}
 	}
+
+	p->unlinks_in_progress += unlinked;
+	rte_smp_mb();
+
 	return unlinked;
 }
 
+static int
+sw_port_unlinks_in_progress(struct rte_eventdev *dev, void *port)
+{
+	struct sw_port *p = port;
+	return p->unlinks_in_progress;
+}
+
 static int
 sw_port_setup(struct rte_eventdev *dev, uint8_t port_id,
 		const struct rte_event_port_conf *conf)
@@ -925,6 +936,7 @@ sw_probe(struct rte_vdev_device *vdev)
 			.port_release = sw_port_release,
 			.port_link = sw_port_link,
 			.port_unlink = sw_port_unlink,
+			.port_unlinks_in_progress = sw_port_unlinks_in_progress,
 
 			.eth_rx_adapter_caps_get = sw_eth_rx_adapter_caps_get,
 
diff --git a/drivers/event/sw/sw_evdev.h b/drivers/event/sw/sw_evdev.h
index d90b96d4b..7c77b2495 100644
--- a/drivers/event/sw/sw_evdev.h
+++ b/drivers/event/sw/sw_evdev.h
@@ -148,6 +148,14 @@ struct sw_port {
 	/* A numeric ID for the port */
 	uint8_t id;
 
+	/* An atomic counter for when the port has been unlinked, and the
+	 * scheduler has not yet acked this unlink - hence there may still be
+	 * events in the buffers going to the port. When the unlinks in
+	 * progress is read by the scheduler, no more events will be pushed to
+	 * the port - hence the scheduler core can just assign zero.
+	 */
+	uint8_t unlinks_in_progress;
+
 	int16_t is_directed; /** Takes from a single directed QID */
 	/**
 	 * For loadbalanced we can optimise pulling packets from
diff --git a/drivers/event/sw/sw_evdev_scheduler.c b/drivers/event/sw/sw_evdev_scheduler.c
index e3a41e02f..9b54d5ce7 100644
--- a/drivers/event/sw/sw_evdev_scheduler.c
+++ b/drivers/event/sw/sw_evdev_scheduler.c
@@ -517,13 +517,18 @@ sw_event_schedule(struct rte_eventdev *dev)
 		/* Pull from rx_ring for ports */
 		do {
 			in_pkts = 0;
-			for (i = 0; i < sw->port_count; i++)
+			for (i = 0; i < sw->port_count; i++) {
+				/* ack the unlinks in progress as done */
+				if (sw->ports[i].unlinks_in_progress)
+					sw->ports[i].unlinks_in_progress = 0;
+
 				if (sw->ports[i].is_directed)
 					in_pkts += sw_schedule_pull_port_dir(sw, i);
 				else if (sw->ports[i].num_ordered_qids > 0)
 					in_pkts += sw_schedule_pull_port_lb(sw, i);
 				else
 					in_pkts += sw_schedule_pull_port_no_reorder(sw, i);
+			}
 
 			/* QID scan for re-ordered */
 			in_pkts += sw_schedule_reorder(sw, 0,
-- 
2.17.1

  reply	other threads:[~2018-09-20 11:22 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-09-12 16:16 [dpdk-dev] [PATCH 1/3] event: add function for reading unlink in progress Harry van Haaren
2018-09-12 16:16 ` [dpdk-dev] [PATCH 2/3] event/sw: implement unlinks in progress function Harry van Haaren
2018-09-12 16:16 ` [dpdk-dev] [PATCH 3/3] event/sw: add unit test for unlinks in progress Harry van Haaren
2018-09-13 14:45 ` [dpdk-dev] [PATCH 1/3] event: add function for reading unlink " Jerin Jacob
2018-09-18 12:05 ` Elo, Matias (Nokia - FI/Espoo)
2018-09-20 11:22 ` [dpdk-dev] [PATCH v2 " Harry van Haaren
2018-09-20 11:22   ` Harry van Haaren [this message]
2018-09-23 11:08     ` [dpdk-dev] [PATCH v2 2/3] event/sw: implement unlinks in progress function Jerin Jacob
2018-09-20 11:22   ` [dpdk-dev] [PATCH v2 3/3] event/sw: add unit test for unlinks in progress Harry van Haaren
2018-09-24  8:23   ` [dpdk-dev] [PATCH v3 1/3] event: add function for reading unlink " Harry van Haaren
2018-09-24  8:23     ` [dpdk-dev] [PATCH v3 2/3] event/sw: implement unlinks in progress function Harry van Haaren
2018-09-24  8:23     ` [dpdk-dev] [PATCH v3 3/3] event/sw: add unit test for unlinks in progress Harry van Haaren
2018-09-24 14:56     ` [dpdk-dev] [PATCH v3 1/3] event: add function for reading unlink " 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=20180920112251.47854-2-harry.van.haaren@intel.com \
    --to=harry.van.haaren@intel.com \
    --cc=dev@dpdk.org \
    --cc=jerin.jacob@caviumnetworks.com \
    --cc=matias.elo@nokia.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).