DPDK patches and discussions
 help / color / mirror / Atom feed
From: Gage Eads <gage.eads@intel.com>
To: dev@dpdk.org
Cc: harry.van.haaren@intel.com, jerin.jacon@caviumnetworks.com
Subject: [dpdk-dev] [PATCH] event/sw: allow fwd and rel when out of credits
Date: Fri,  8 Sep 2017 13:07:52 -0500	[thread overview]
Message-ID: <1504894072-15735-1-git-send-email-gage.eads@intel.com> (raw)

When forwarding or releasing events, the operation would fail if the port
has 0 inflight credits and cannot acquire more, or the inflight count
exceeds the port's new event threshold.

This patch fixes that by counting the number of new events in the burst,
and applying the credit and new event threshold checks accordingly.

Signed-off-by: Gage Eads <gage.eads@intel.com>
---
 drivers/event/sw/sw_evdev_worker.c | 14 +++++++++-----
 1 file changed, 9 insertions(+), 5 deletions(-)

diff --git a/drivers/event/sw/sw_evdev_worker.c b/drivers/event/sw/sw_evdev_worker.c
index d76d3d5..b3b3b17 100644
--- a/drivers/event/sw/sw_evdev_worker.c
+++ b/drivers/event/sw/sw_evdev_worker.c
@@ -85,14 +85,18 @@ sw_event_enqueue_burst(void *port, const struct rte_event ev[], uint16_t num)
 	struct sw_port *p = port;
 	struct sw_evdev *sw = (void *)p->sw;
 	uint32_t sw_inflights = rte_atomic32_read(&sw->inflights);
-
-	if (unlikely(p->inflight_max < sw_inflights))
-		return 0;
+	int new = 0;
 
 	if (num > PORT_ENQUEUE_MAX_BURST_SIZE)
 		num = PORT_ENQUEUE_MAX_BURST_SIZE;
 
-	if (p->inflight_credits < num) {
+	for (i = 0; i < num; i++)
+		new += (ev[i].op == RTE_EVENT_OP_NEW);
+
+	if (unlikely(new > 0 && p->inflight_max < sw_inflights))
+		return 0;
+
+	if (p->inflight_credits < new) {
 		/* check if event enqueue brings port over max threshold */
 		uint32_t credit_update_quanta = sw->credit_update_quanta;
 		if (sw_inflights + credit_update_quanta > sw->nb_events_limit)
@@ -101,7 +105,7 @@ sw_event_enqueue_burst(void *port, const struct rte_event ev[], uint16_t num)
 		rte_atomic32_add(&sw->inflights, credit_update_quanta);
 		p->inflight_credits += (credit_update_quanta);
 
-		if (p->inflight_credits < num)
+		if (p->inflight_credits < new)
 			return 0;
 	}
 
-- 
2.7.4

             reply	other threads:[~2017-09-08 18:08 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-09-08 18:07 Gage Eads [this message]
2017-09-11  8:52 ` Van Haaren, Harry
2017-10-16 11:33   ` Jerin Jacob
2017-09-11  8:55 ` Van Haaren, Harry

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=1504894072-15735-1-git-send-email-gage.eads@intel.com \
    --to=gage.eads@intel.com \
    --cc=dev@dpdk.org \
    --cc=harry.van.haaren@intel.com \
    --cc=jerin.jacon@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).