DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH] eventdev: fix Rx adapter stalls on event device backpressure
@ 2021-11-08 13:25 Mattias Rönnblom
  2021-11-08 13:43 ` Mattias Rönnblom
  0 siblings, 1 reply; 9+ messages in thread
From: Mattias Rönnblom @ 2021-11-08 13:25 UTC (permalink / raw)
  To: jerinj, jay.jayatheerthan
  Cc: dev, Mattias Rönnblom, ganapati.kundapura, stable

In the Eventdev Ethernet RX Adapter, correctly handle the case where
the circular enqueue buffer head and tail index points to the same
element (i.e., the buffer is full) and the buffer has wrapped.

This bug may be triggered in case there is backpressure from the event
device to the RX adapter.

Fixes: 8113fd15e229 ("eventdev/eth_rx: make enqueue buffer circular")
Cc: ganapati.kundapura@intel.com
Cc: stable@dpdk.org

Signed-off-by: Mattias Rönnblom <mattias.ronnblom@ericsson.com>
---
 lib/eventdev/rte_event_eth_rx_adapter.c | 22 ++++++++++++++--------
 1 file changed, 14 insertions(+), 8 deletions(-)

diff --git a/lib/eventdev/rte_event_eth_rx_adapter.c b/lib/eventdev/rte_event_eth_rx_adapter.c
index 56318b5a6f..809416d9b7 100644
--- a/lib/eventdev/rte_event_eth_rx_adapter.c
+++ b/lib/eventdev/rte_event_eth_rx_adapter.c
@@ -777,19 +777,25 @@ rxa_flush_event_buffer(struct event_eth_rx_adapter *rx_adapter,
 		       struct eth_event_enqueue_buffer *buf,
 		       struct rte_event_eth_rx_adapter_stats *stats)
 {
-	uint16_t count = buf->last ? buf->last - buf->head : buf->count;
+	uint16_t count = buf->count;
+	uint16_t n = 0;
 
 	if (!count)
 		return 0;
 
-	uint16_t n = rte_event_enqueue_new_burst(rx_adapter->eventdev_id,
-					rx_adapter->event_port_id,
-					&buf->events[buf->head],
-					count);
-	if (n != count)
-		stats->rx_enq_retry++;
+	if (buf->last)
+		count = buf->last - buf->head;
+
+	if (count) {
+		n = rte_event_enqueue_new_burst(rx_adapter->eventdev_id,
+						rx_adapter->event_port_id,
+						&buf->events[buf->head],
+						count);
+		if (n != count)
+			stats->rx_enq_retry++;
 
-	buf->head += n;
+		buf->head += n;
+	}
 
 	if (buf->last && n == count) {
 		uint16_t n1;
-- 
2.25.1


^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2021-11-10 11:11 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-11-08 13:25 [dpdk-dev] [PATCH] eventdev: fix Rx adapter stalls on event device backpressure Mattias Rönnblom
2021-11-08 13:43 ` Mattias Rönnblom
2021-11-09  6:26   ` Kundapura, Ganapati
2021-11-09  8:28     ` Mattias Rönnblom
2021-11-09 11:09       ` Kundapura, Ganapati
2021-11-09 11:43         ` Mattias Rönnblom
2021-11-10  8:26       ` Kundapura, Ganapati
2021-11-10 10:08         ` Jayatheerthan, Jay
2021-11-10 11:11           ` Mattias Rönnblom

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).