From: Gage Eads <gage.eads@intel.com>
Date: Mon, 12 Mar 2018 14:55:22 +0000 (-0500)
Subject: event/sw: perform partial burst enqueues
X-Git-Url: http://git.droids-corp.org/?a=commitdiff_plain;h=4deeb214ac0b33c61ebc1722ef31510f8e9492e6;p=dpdk.git

event/sw: perform partial burst enqueues

Previously, the sw PMD would enqueue either all or no events, depending on
if enough inflight credits were available for the new events in the burst.
If a port is enqueueing a large burst (i.e. a multiple of the credit update
quanta), this can result in suboptimal performance, and requires an
understanding of the sw PMD implementation (in particular, its credit
scheme) to tune an application's burst size.

This affects software that enqueues large bursts of new events, such as the
ethernet event adapter which uses a 128-deep event buffer, when the input
packet rate is sufficiently high.

This change makes the sw PMD enqueue as many events as it has credits, if
there are any new events in the burst.

Signed-off-by: Gage Eads <gage.eads@intel.com>
Acked-by: Harry van Haaren <harry.van.haaren@intel.com>
---

diff --git a/drivers/event/sw/sw_evdev_worker.c b/drivers/event/sw/sw_evdev_worker.c
index 67151f7768..063b919c7e 100644
--- a/drivers/event/sw/sw_evdev_worker.c
+++ b/drivers/event/sw/sw_evdev_worker.c
@@ -77,8 +77,10 @@ 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 < new)
-			return 0;
+		/* If there are fewer inflight credits than new events, limit
+		 * the number of enqueued events.
+		 */
+		num = (p->inflight_credits < new) ? p->inflight_credits : new;
 	}
 
 	for (i = 0; i < num; i++) {