Skip to contentSkip to conversation

event/sw: allow fwd and rel when out of credits

PATCH Applied Gage Eads 3 participants 4 messages Sep 8, 2017 – Oct 16, 2017

lore
Share & tools
lore

Gage Eads

author
#0 lore raw

PATCH 1/1 event/sw: allow fwd and rel when out of credits

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.

---
 drivers/event/sw/sw_evdev_worker.c | 14 +++++++++-----
 1 file changed, 9 insertions(+), 5 deletions(-)
drivers/event/sw/sw_evdev_worker.c +9 -5
index d76d3d5..b3b3b17 100644
@@ -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;
 	}
 
Signature · 1 line
2.7.4
Acked-by on v1 1/1
#1 lore raw
Quoted 7 lines

From: Eads, Gage
Sent: Friday, September 8, 2017 7:08 PM
To: [email protected]
Cc: Van Haaren, Harry <[email protected]>; [email protected]
Subject: [PATCH] event/sw: allow fwd and rel when out of credits

Quoted 8 lines

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.

Applied
#2 lore raw

-----Original Message-----

Quoted 18 lines

Date: Mon, 11 Sep 2017 08:52:44 +0000
From: "Van Haaren, Harry" <[email protected]>
To: "Eads, Gage" <[email protected]>, "[email protected]" <[email protected]>
CC: "[email protected]" <[email protected]>
Subject: Re: [dpdk-dev] [PATCH] event/sw: allow fwd and rel when out of
credits

Quoted 11 lines

From: Eads, Gage
Sent: Friday, September 8, 2017 7:08 PM
To: [email protected]
Cc: Van Haaren, Harry <[email protected]>; [email protected]
Subject: [PATCH] event/sw: allow fwd and rel when out of credits

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.

Quoted 6 lines
Quoted 4 lines

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

Applied to dpdk-next-eventdev/master. Thanks.

#3 lore raw
In reply to Gage Eads

Re-send fixing Jerin's email;

Quoted 23 lines

From: Van Haaren, Harry
Sent: Monday, September 11, 2017 9:53 AM
To: Eads, Gage <[email protected]>; [email protected]
Cc: [email protected]
Subject: RE: [PATCH] event/sw: allow fwd and rel when out of credits

Quoted 7 lines

From: Eads, Gage
Sent: Friday, September 8, 2017 7:08 PM
To: [email protected]
Cc: Van Haaren, Harry <[email protected]>; [email protected]
Subject: [PATCH] event/sw: allow fwd and rel when out of credits

Quoted 8 lines

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.