[3/4] eventdev: have ethernet Tx adapter appropriately report idle

Message ID 20221010145406.118880-4-mattias.ronnblom@ericsson.com (mailing list archive)
State Accepted, archived
Delegated to: Jerin Jacob
Headers
Series Have event adapters report idle status |

Checks

Context Check Description
ci/checkpatch success coding style OK

Commit Message

Mattias Rönnblom Oct. 10, 2022, 2:54 p.m. UTC
  Update the Event Ethernet Tx Adapter's service function to report as
idle (i.e., return -EAGAIN) in case no events were dequeued from the
event device and no Ethernet frames were sent out on the wire.

Signed-off-by: Mattias Rönnblom <mattias.ronnblom@ericsson.com>
---
 lib/eventdev/rte_event_eth_tx_adapter.c | 13 +++++++++----
 1 file changed, 9 insertions(+), 4 deletions(-)
  

Comments

Jayatheerthan, Jay Oct. 11, 2022, 7:10 a.m. UTC | #1
@Harish, could you review the patch ?

-Jay



> -----Original Message-----
> From: Mattias Rönnblom <mattias.ronnblom@ericsson.com>
> Sent: Monday, October 10, 2022 8:24 PM
> To: Jayatheerthan, Jay <jay.jayatheerthan@intel.com>; Carrillo, Erik G <erik.g.carrillo@intel.com>; Gujjar, Abhinandan S
> <abhinandan.gujjar@intel.com>; Jerin Jacob <jerinj@marvell.com>
> Cc: dev@dpdk.org; Van Haaren, Harry <harry.van.haaren@intel.com>; hofors@lysator.liu.se; mattias.ronnblom
> <mattias.ronnblom@ericsson.com>
> Subject: [PATCH 3/4] eventdev: have ethernet Tx adapter appropriately report idle
> 
> Update the Event Ethernet Tx Adapter's service function to report as
> idle (i.e., return -EAGAIN) in case no events were dequeued from the
> event device and no Ethernet frames were sent out on the wire.
> 
> Signed-off-by: Mattias Rönnblom <mattias.ronnblom@ericsson.com>
> ---
>  lib/eventdev/rte_event_eth_tx_adapter.c | 13 +++++++++----
>  1 file changed, 9 insertions(+), 4 deletions(-)
> 
> diff --git a/lib/eventdev/rte_event_eth_tx_adapter.c b/lib/eventdev/rte_event_eth_tx_adapter.c
> index 7f7d86f683..c2a848103b 100644
> --- a/lib/eventdev/rte_event_eth_tx_adapter.c
> +++ b/lib/eventdev/rte_event_eth_tx_adapter.c
> @@ -639,6 +639,7 @@ txa_service_func(void *args)
>  	struct txa_service_data *txa = args;
>  	uint8_t dev_id;
>  	uint8_t port;
> +	int ret = -EAGAIN;
>  	uint16_t n;
>  	uint32_t nb_tx, max_nb_tx;
>  	struct rte_event ev[TXA_BATCH_SIZE];
> @@ -648,10 +649,10 @@ txa_service_func(void *args)
>  	port = txa->port_id;
> 
>  	if (txa->nb_queues == 0)
> -		return 0;
> +		return ret;
> 
>  	if (!rte_spinlock_trylock(&txa->tx_lock))
> -		return 0;
> +		return ret;
> 
>  	for (nb_tx = 0; nb_tx < max_nb_tx; nb_tx += n) {
> 
> @@ -659,6 +660,7 @@ txa_service_func(void *args)
>  		if (!n)
>  			break;
>  		txa_service_tx(txa, ev, n);
> +		ret = 0;
>  	}
> 
>  	if ((txa->loop_cnt++ & (TXA_FLUSH_THRESHOLD - 1)) == 0) {
> @@ -692,10 +694,13 @@ txa_service_func(void *args)
>  			}
>  		}
> 
> -		txa->stats.tx_packets += nb_tx;
> +		if (likely(nb_tx > 0)) {
> +			txa->stats.tx_packets += nb_tx;
> +			ret = 0;
> +		}
>  	}
>  	rte_spinlock_unlock(&txa->tx_lock);
> -	return 0;
> +	return ret;
>  }
> 
>  static int
> --
> 2.34.1
  
Naga Harish K, S V Oct. 13, 2022, 1:30 a.m. UTC | #2
> -----Original Message-----
> From: Jayatheerthan, Jay <jay.jayatheerthan@intel.com>
> Sent: Tuesday, October 11, 2022 12:41 PM
> To: mattias.ronnblom <mattias.ronnblom@ericsson.com>; Carrillo, Erik G
> <erik.g.carrillo@intel.com>; Gujjar, Abhinandan S
> <abhinandan.gujjar@intel.com>; Jerin Jacob <jerinj@marvell.com>; Naga
> Harish K, S V <s.v.naga.harish.k@intel.com>
> Cc: dev@dpdk.org; Van Haaren, Harry <harry.van.haaren@intel.com>;
> hofors@lysator.liu.se; mattias.ronnblom <mattias.ronnblom@ericsson.com>
> Subject: RE: [PATCH 3/4] eventdev: have ethernet Tx adapter appropriately
> report idle
> 
> @Harish, could you review the patch ?
> 
> -Jay
> 
> 
> 
> > -----Original Message-----
> > From: Mattias Rönnblom <mattias.ronnblom@ericsson.com>
> > Sent: Monday, October 10, 2022 8:24 PM
> > To: Jayatheerthan, Jay <jay.jayatheerthan@intel.com>; Carrillo, Erik G
> > <erik.g.carrillo@intel.com>; Gujjar, Abhinandan S
> > <abhinandan.gujjar@intel.com>; Jerin Jacob <jerinj@marvell.com>
> > Cc: dev@dpdk.org; Van Haaren, Harry <harry.van.haaren@intel.com>;
> > hofors@lysator.liu.se; mattias.ronnblom
> > <mattias.ronnblom@ericsson.com>
> > Subject: [PATCH 3/4] eventdev: have ethernet Tx adapter appropriately
> > report idle
> >
> > Update the Event Ethernet Tx Adapter's service function to report as
> > idle (i.e., return -EAGAIN) in case no events were dequeued from the
> > event device and no Ethernet frames were sent out on the wire.
> >
> > Signed-off-by: Mattias Rönnblom <mattias.ronnblom@ericsson.com>
> > ---
> >  lib/eventdev/rte_event_eth_tx_adapter.c | 13 +++++++++----
> >  1 file changed, 9 insertions(+), 4 deletions(-)
> >
> > diff --git a/lib/eventdev/rte_event_eth_tx_adapter.c
> > b/lib/eventdev/rte_event_eth_tx_adapter.c
> > index 7f7d86f683..c2a848103b 100644
> > --- a/lib/eventdev/rte_event_eth_tx_adapter.c
> > +++ b/lib/eventdev/rte_event_eth_tx_adapter.c
> > @@ -639,6 +639,7 @@ txa_service_func(void *args)
> >  	struct txa_service_data *txa = args;
> >  	uint8_t dev_id;
> >  	uint8_t port;
> > +	int ret = -EAGAIN;
> >  	uint16_t n;
> >  	uint32_t nb_tx, max_nb_tx;
> >  	struct rte_event ev[TXA_BATCH_SIZE]; @@ -648,10 +649,10 @@
> > txa_service_func(void *args)
> >  	port = txa->port_id;
> >
> >  	if (txa->nb_queues == 0)
> > -		return 0;
> > +		return ret;
> >
> >  	if (!rte_spinlock_trylock(&txa->tx_lock))
> > -		return 0;
> > +		return ret;
> >
> >  	for (nb_tx = 0; nb_tx < max_nb_tx; nb_tx += n) {
> >
> > @@ -659,6 +660,7 @@ txa_service_func(void *args)
> >  		if (!n)
> >  			break;
> >  		txa_service_tx(txa, ev, n);
> > +		ret = 0;
> >  	}
> >
> >  	if ((txa->loop_cnt++ & (TXA_FLUSH_THRESHOLD - 1)) == 0) { @@ -
> 692,10
> > +694,13 @@ txa_service_func(void *args)
> >  			}
> >  		}
> >
> > -		txa->stats.tx_packets += nb_tx;
> > +		if (likely(nb_tx > 0)) {

How are the performance numbers before and after this patch?
Trying to understand the performance impact, as new condition is added to the service function Datapath.

> > +			txa->stats.tx_packets += nb_tx;
> > +			ret = 0;
> > +		}
> >  	}
> >  	rte_spinlock_unlock(&txa->tx_lock);
> > -	return 0;
> > +	return ret;
> >  }
> >
> >  static int
> > --
> > 2.34.1
  
Jayatheerthan, Jay Oct. 18, 2022, 9:19 a.m. UTC | #3
Looks good to me. Thanks for submitting this!

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

-Jay

> -----Original Message-----
> From: Naga Harish K, S V <s.v.naga.harish.k@intel.com>
> Sent: Thursday, October 13, 2022 7:00 AM
> To: Jayatheerthan, Jay <jay.jayatheerthan@intel.com>; mattias.ronnblom <mattias.ronnblom@ericsson.com>; Carrillo, Erik G
> <erik.g.carrillo@intel.com>; Gujjar, Abhinandan S <abhinandan.gujjar@intel.com>; Jerin Jacob <jerinj@marvell.com>
> Cc: dev@dpdk.org; Van Haaren, Harry <harry.van.haaren@intel.com>; hofors@lysator.liu.se; mattias.ronnblom
> <mattias.ronnblom@ericsson.com>
> Subject: RE: [PATCH 3/4] eventdev: have ethernet Tx adapter appropriately report idle
> 
> 
> 
> > -----Original Message-----
> > From: Jayatheerthan, Jay <jay.jayatheerthan@intel.com>
> > Sent: Tuesday, October 11, 2022 12:41 PM
> > To: mattias.ronnblom <mattias.ronnblom@ericsson.com>; Carrillo, Erik G
> > <erik.g.carrillo@intel.com>; Gujjar, Abhinandan S
> > <abhinandan.gujjar@intel.com>; Jerin Jacob <jerinj@marvell.com>; Naga
> > Harish K, S V <s.v.naga.harish.k@intel.com>
> > Cc: dev@dpdk.org; Van Haaren, Harry <harry.van.haaren@intel.com>;
> > hofors@lysator.liu.se; mattias.ronnblom <mattias.ronnblom@ericsson.com>
> > Subject: RE: [PATCH 3/4] eventdev: have ethernet Tx adapter appropriately
> > report idle
> >
> > @Harish, could you review the patch ?
> >
> > -Jay
> >
> >
> >
> > > -----Original Message-----
> > > From: Mattias Rönnblom <mattias.ronnblom@ericsson.com>
> > > Sent: Monday, October 10, 2022 8:24 PM
> > > To: Jayatheerthan, Jay <jay.jayatheerthan@intel.com>; Carrillo, Erik G
> > > <erik.g.carrillo@intel.com>; Gujjar, Abhinandan S
> > > <abhinandan.gujjar@intel.com>; Jerin Jacob <jerinj@marvell.com>
> > > Cc: dev@dpdk.org; Van Haaren, Harry <harry.van.haaren@intel.com>;
> > > hofors@lysator.liu.se; mattias.ronnblom
> > > <mattias.ronnblom@ericsson.com>
> > > Subject: [PATCH 3/4] eventdev: have ethernet Tx adapter appropriately
> > > report idle
> > >
> > > Update the Event Ethernet Tx Adapter's service function to report as
> > > idle (i.e., return -EAGAIN) in case no events were dequeued from the
> > > event device and no Ethernet frames were sent out on the wire.
> > >
> > > Signed-off-by: Mattias Rönnblom <mattias.ronnblom@ericsson.com>
> > > ---
> > >  lib/eventdev/rte_event_eth_tx_adapter.c | 13 +++++++++----
> > >  1 file changed, 9 insertions(+), 4 deletions(-)
> > >
> > > diff --git a/lib/eventdev/rte_event_eth_tx_adapter.c
> > > b/lib/eventdev/rte_event_eth_tx_adapter.c
> > > index 7f7d86f683..c2a848103b 100644
> > > --- a/lib/eventdev/rte_event_eth_tx_adapter.c
> > > +++ b/lib/eventdev/rte_event_eth_tx_adapter.c
> > > @@ -639,6 +639,7 @@ txa_service_func(void *args)
> > >  	struct txa_service_data *txa = args;
> > >  	uint8_t dev_id;
> > >  	uint8_t port;
> > > +	int ret = -EAGAIN;
> > >  	uint16_t n;
> > >  	uint32_t nb_tx, max_nb_tx;
> > >  	struct rte_event ev[TXA_BATCH_SIZE]; @@ -648,10 +649,10 @@
> > > txa_service_func(void *args)
> > >  	port = txa->port_id;
> > >
> > >  	if (txa->nb_queues == 0)
> > > -		return 0;
> > > +		return ret;
> > >
> > >  	if (!rte_spinlock_trylock(&txa->tx_lock))
> > > -		return 0;
> > > +		return ret;
> > >
> > >  	for (nb_tx = 0; nb_tx < max_nb_tx; nb_tx += n) {
> > >
> > > @@ -659,6 +660,7 @@ txa_service_func(void *args)
> > >  		if (!n)
> > >  			break;
> > >  		txa_service_tx(txa, ev, n);
> > > +		ret = 0;
> > >  	}
> > >
> > >  	if ((txa->loop_cnt++ & (TXA_FLUSH_THRESHOLD - 1)) == 0) { @@ -
> > 692,10
> > > +694,13 @@ txa_service_func(void *args)
> > >  			}
> > >  		}
> > >
> > > -		txa->stats.tx_packets += nb_tx;
> > > +		if (likely(nb_tx > 0)) {
> 
> How are the performance numbers before and after this patch?
> Trying to understand the performance impact, as new condition is added to the service function Datapath.
> 
> > > +			txa->stats.tx_packets += nb_tx;
> > > +			ret = 0;
> > > +		}
> > >  	}
> > >  	rte_spinlock_unlock(&txa->tx_lock);
> > > -	return 0;
> > > +	return ret;
> > >  }
> > >
> > >  static int
> > > --
> > > 2.34.1
  
Jerin Jacob Oct. 19, 2022, 11:32 a.m. UTC | #4
On Tue, Oct 18, 2022 at 2:49 PM Jayatheerthan, Jay
<jay.jayatheerthan@intel.com> wrote:
>
> Looks good to me. Thanks for submitting this!
>
> Acked by: Jay Jayatheerthan <jay.jayatheerthan@intel.com>


Updated the git commit as follows and series applied to
dpdk-next-net-eventdev/for-main. Thanks

commit 76d97b8d05b62da1a15c0716d15f1179dd77369e (HEAD -> for-main,
origin/for-main, origin/HEAD)
Author: Mattias Rönnblom <mattias.ronnblom@ericsson.com>
Date:   Mon Oct 10 16:54:06 2022 +0200

    eventdev/timer: support appropriately report idle

    Update the Event Timer Adapter's service function to report as idle
    (i.e., return -EAGAIN) in case no timer events were enqueued to the
    event device.

    Signed-off-by: Mattias Rönnblom <mattias.ronnblom@ericsson.com>
    Acked-by: Erik Gabriel Carrillo <erik.g.carrillo@intel.com>

commit a7f9687a436a5e0af2512bca9bf430f1d28085f6
Author: Mattias Rönnblom <mattias.ronnblom@ericsson.com>
Date:   Mon Oct 10 16:54:05 2022 +0200

    eventdev/eth_tx: support appropriately report idle

    Update the Event Ethernet Tx Adapter's service function to report as
    idle (i.e., return -EAGAIN) in case no events were dequeued from the
    event device and no Ethernet frames were sent out on the wire.

    Signed-off-by: Mattias Rönnblom <mattias.ronnblom@ericsson.com>
    Reviewed-by: Naga Harish K S V <s.v.naga.harish.k@intel.com>
    Acked-by: Jay Jayatheerthan <jay.jayatheerthan@intel.com>

commit 0474cb12be6a4d82d0019db1621050af959f908e
Author: Mattias Rönnblom <mattias.ronnblom@ericsson.com>
Date:   Mon Oct 10 16:54:04 2022 +0200

    eventdev/eth_rx: support appropriately report idle

    Update the Event Ethernet Rx Adapter's service function to report as
    idle (i.e., return -EAGAIN) in case no Ethernet frames were received
    from the ethdev and no events were enqueued to the event device.

    Signed-off-by: Mattias Rönnblom <mattias.ronnblom@ericsson.com>
    Reviewed-by: Naga Harish K S V <s.v.naga.harish.k@intel.com>
    Acked-by: Jay Jayatheerthan <jay.jayatheerthan@intel.com>

commit 855d32d7af3c7ef4e2231edf6d2d3ffe943ff15d
Author: Mattias Rönnblom <mattias.ronnblom@ericsson.com>
Date:   Mon Oct 10 16:54:03 2022 +0200

    eventdev/crypto: support appropriately report idle

    Update the event crypto adapter's service function to report as idle
    (i.e., return -EAGAIN) in case no crypto operations were performed.

    Signed-off-by: Mattias Rönnblom <mattias.ronnblom@ericsson.com>
    Acked-by: Abhinandan Gujjar <abhinandan.gujjar@intel.com>

>
> -Jay
>
> > -----Original Message-----
> > From: Naga Harish K, S V <s.v.naga.harish.k@intel.com>
> > Sent: Thursday, October 13, 2022 7:00 AM
> > To: Jayatheerthan, Jay <jay.jayatheerthan@intel.com>; mattias.ronnblom <mattias.ronnblom@ericsson.com>; Carrillo, Erik G
> > <erik.g.carrillo@intel.com>; Gujjar, Abhinandan S <abhinandan.gujjar@intel.com>; Jerin Jacob <jerinj@marvell.com>
> > Cc: dev@dpdk.org; Van Haaren, Harry <harry.van.haaren@intel.com>; hofors@lysator.liu.se; mattias.ronnblom
> > <mattias.ronnblom@ericsson.com>
> > Subject: RE: [PATCH 3/4] eventdev: have ethernet Tx adapter appropriately report idle
> >
> >
> >
> > > -----Original Message-----
> > > From: Jayatheerthan, Jay <jay.jayatheerthan@intel.com>
> > > Sent: Tuesday, October 11, 2022 12:41 PM
> > > To: mattias.ronnblom <mattias.ronnblom@ericsson.com>; Carrillo, Erik G
> > > <erik.g.carrillo@intel.com>; Gujjar, Abhinandan S
> > > <abhinandan.gujjar@intel.com>; Jerin Jacob <jerinj@marvell.com>; Naga
> > > Harish K, S V <s.v.naga.harish.k@intel.com>
> > > Cc: dev@dpdk.org; Van Haaren, Harry <harry.van.haaren@intel.com>;
> > > hofors@lysator.liu.se; mattias.ronnblom <mattias.ronnblom@ericsson.com>
> > > Subject: RE: [PATCH 3/4] eventdev: have ethernet Tx adapter appropriately
> > > report idle
> > >
> > > @Harish, could you review the patch ?
> > >
> > > -Jay
> > >
> > >
> > >
> > > > -----Original Message-----
> > > > From: Mattias Rönnblom <mattias.ronnblom@ericsson.com>
> > > > Sent: Monday, October 10, 2022 8:24 PM
> > > > To: Jayatheerthan, Jay <jay.jayatheerthan@intel.com>; Carrillo, Erik G
> > > > <erik.g.carrillo@intel.com>; Gujjar, Abhinandan S
> > > > <abhinandan.gujjar@intel.com>; Jerin Jacob <jerinj@marvell.com>
> > > > Cc: dev@dpdk.org; Van Haaren, Harry <harry.van.haaren@intel.com>;
> > > > hofors@lysator.liu.se; mattias.ronnblom
> > > > <mattias.ronnblom@ericsson.com>
> > > > Subject: [PATCH 3/4] eventdev: have ethernet Tx adapter appropriately
> > > > report idle
> > > >
> > > > Update the Event Ethernet Tx Adapter's service function to report as
> > > > idle (i.e., return -EAGAIN) in case no events were dequeued from the
> > > > event device and no Ethernet frames were sent out on the wire.
> > > >
> > > > Signed-off-by: Mattias Rönnblom <mattias.ronnblom@ericsson.com>
> > > > ---
> > > >  lib/eventdev/rte_event_eth_tx_adapter.c | 13 +++++++++----
> > > >  1 file changed, 9 insertions(+), 4 deletions(-)
> > > >
> > > > diff --git a/lib/eventdev/rte_event_eth_tx_adapter.c
> > > > b/lib/eventdev/rte_event_eth_tx_adapter.c
> > > > index 7f7d86f683..c2a848103b 100644
> > > > --- a/lib/eventdev/rte_event_eth_tx_adapter.c
> > > > +++ b/lib/eventdev/rte_event_eth_tx_adapter.c
> > > > @@ -639,6 +639,7 @@ txa_service_func(void *args)
> > > >   struct txa_service_data *txa = args;
> > > >   uint8_t dev_id;
> > > >   uint8_t port;
> > > > + int ret = -EAGAIN;
> > > >   uint16_t n;
> > > >   uint32_t nb_tx, max_nb_tx;
> > > >   struct rte_event ev[TXA_BATCH_SIZE]; @@ -648,10 +649,10 @@
> > > > txa_service_func(void *args)
> > > >   port = txa->port_id;
> > > >
> > > >   if (txa->nb_queues == 0)
> > > > -         return 0;
> > > > +         return ret;
> > > >
> > > >   if (!rte_spinlock_trylock(&txa->tx_lock))
> > > > -         return 0;
> > > > +         return ret;
> > > >
> > > >   for (nb_tx = 0; nb_tx < max_nb_tx; nb_tx += n) {
> > > >
> > > > @@ -659,6 +660,7 @@ txa_service_func(void *args)
> > > >           if (!n)
> > > >                   break;
> > > >           txa_service_tx(txa, ev, n);
> > > > +         ret = 0;
> > > >   }
> > > >
> > > >   if ((txa->loop_cnt++ & (TXA_FLUSH_THRESHOLD - 1)) == 0) { @@ -
> > > 692,10
> > > > +694,13 @@ txa_service_func(void *args)
> > > >                   }
> > > >           }
> > > >
> > > > -         txa->stats.tx_packets += nb_tx;
> > > > +         if (likely(nb_tx > 0)) {
> >
> > How are the performance numbers before and after this patch?
> > Trying to understand the performance impact, as new condition is added to the service function Datapath.
> >
> > > > +                 txa->stats.tx_packets += nb_tx;
> > > > +                 ret = 0;
> > > > +         }
> > > >   }
> > > >   rte_spinlock_unlock(&txa->tx_lock);
> > > > - return 0;
> > > > + return ret;
> > > >  }
> > > >
> > > >  static int
> > > > --
> > > > 2.34.1
>
  

Patch

diff --git a/lib/eventdev/rte_event_eth_tx_adapter.c b/lib/eventdev/rte_event_eth_tx_adapter.c
index 7f7d86f683..c2a848103b 100644
--- a/lib/eventdev/rte_event_eth_tx_adapter.c
+++ b/lib/eventdev/rte_event_eth_tx_adapter.c
@@ -639,6 +639,7 @@  txa_service_func(void *args)
 	struct txa_service_data *txa = args;
 	uint8_t dev_id;
 	uint8_t port;
+	int ret = -EAGAIN;
 	uint16_t n;
 	uint32_t nb_tx, max_nb_tx;
 	struct rte_event ev[TXA_BATCH_SIZE];
@@ -648,10 +649,10 @@  txa_service_func(void *args)
 	port = txa->port_id;
 
 	if (txa->nb_queues == 0)
-		return 0;
+		return ret;
 
 	if (!rte_spinlock_trylock(&txa->tx_lock))
-		return 0;
+		return ret;
 
 	for (nb_tx = 0; nb_tx < max_nb_tx; nb_tx += n) {
 
@@ -659,6 +660,7 @@  txa_service_func(void *args)
 		if (!n)
 			break;
 		txa_service_tx(txa, ev, n);
+		ret = 0;
 	}
 
 	if ((txa->loop_cnt++ & (TXA_FLUSH_THRESHOLD - 1)) == 0) {
@@ -692,10 +694,13 @@  txa_service_func(void *args)
 			}
 		}
 
-		txa->stats.tx_packets += nb_tx;
+		if (likely(nb_tx > 0)) {
+			txa->stats.tx_packets += nb_tx;
+			ret = 0;
+		}
 	}
 	rte_spinlock_unlock(&txa->tx_lock);
-	return 0;
+	return ret;
 }
 
 static int