[v2] eventdev: fix Rx adapter stalls on event device backpressure

Message ID 20211110111400.21475-1-mattias.ronnblom@ericsson.com (mailing list archive)
State Accepted, archived
Delegated to: Jerin Jacob
Headers
Series [v2] eventdev: fix Rx adapter stalls on event device backpressure |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/Intel-compilation success Compilation OK
ci/github-robot: build success github build: passed
ci/intel-Testing success Testing PASS
ci/iol-mellanox-Performance success Performance Testing PASS
ci/iol-broadcom-Functional success Functional Testing PASS
ci/iol-broadcom-Performance success Performance Testing PASS
ci/iol-aarch64-unit-testing success Testing PASS
ci/iol-x86_64-compile-testing success Testing PASS
ci/iol-x86_64-unit-testing success Testing PASS
ci/iol-aarch64-compile-testing success Testing PASS
ci/iol-intel-Performance success Performance Testing PASS
ci/iol-intel-Functional fail Functional Testing issues

Commit Message

Mattias Rönnblom Nov. 10, 2021, 11:14 a.m. UTC
  In the Eventdev Ethernet RX Adapter, correctly handle the case where
the circular enqueue buffer head and last index point to the same
element.

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

v2:
* Corrected bug description

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

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

Comments

Jayatheerthan, Jay Nov. 10, 2021, 11:23 a.m. UTC | #1
Looks good. Thanks for posting this change!

Acked-by: Jay Jayatheerthan <jay.jayatheerthan@intel.com>

> -----Original Message-----
> From: Mattias Rönnblom <mattias.ronnblom@ericsson.com>
> Sent: Wednesday, November 10, 2021 4:44 PM
> To: jerinjacobk@gmail.com; Jayatheerthan, Jay <jay.jayatheerthan@intel.com>; Kundapura, Ganapati
> <ganapati.kundapura@intel.com>; jerinj@marvell.com
> Cc: dev @ dpdk . org <dev@dpdk.org>; mattias.ronnblom <mattias.ronnblom@ericsson.com>
> Subject: [PATCH v2] eventdev: fix Rx adapter stalls on event device backpressure
> 
> In the Eventdev Ethernet RX Adapter, correctly handle the case where
> the circular enqueue buffer head and last index point to the same
> element.
> 
> This bug may be triggered in case there is backpressure from the event
> device to the RX adapter.
> 
> v2:
> * Corrected bug description
> 
> Fixes: 8113fd15e229 ("eventdev/eth_rx: make enqueue buffer circular")
> Cc: ganapati.kundapura@intel.com
> 
> 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
  
Jerin Jacob Nov. 10, 2021, 6:56 p.m. UTC | #2
On Wed, Nov 10, 2021 at 4:53 PM Jayatheerthan, Jay
<jay.jayatheerthan@intel.com> wrote:
>
> Looks good. Thanks for posting this change!
>
> Acked-by: Jay Jayatheerthan <jay.jayatheerthan@intel.com>


Changed the subject to: eventdev/eth_rx: fix stalls on event device backpressure

Applied to dpdk-next-net-eventdev/for-main. Thanks

>
> > -----Original Message-----
> > From: Mattias Rönnblom <mattias.ronnblom@ericsson.com>
> > Sent: Wednesday, November 10, 2021 4:44 PM
> > To: jerinjacobk@gmail.com; Jayatheerthan, Jay <jay.jayatheerthan@intel.com>; Kundapura, Ganapati
> > <ganapati.kundapura@intel.com>; jerinj@marvell.com
> > Cc: dev @ dpdk . org <dev@dpdk.org>; mattias.ronnblom <mattias.ronnblom@ericsson.com>
> > Subject: [PATCH v2] eventdev: fix Rx adapter stalls on event device backpressure
> >
> > In the Eventdev Ethernet RX Adapter, correctly handle the case where
> > the circular enqueue buffer head and last index point to the same
> > element.
> >
> > This bug may be triggered in case there is backpressure from the event
> > device to the RX adapter.
> >
> > v2:
> > * Corrected bug description
> >
> > Fixes: 8113fd15e229 ("eventdev/eth_rx: make enqueue buffer circular")
> > Cc: ganapati.kundapura@intel.com
> >
> > 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
>
  

Patch

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;