DPDK patches and discussions
 help / color / mirror / Atom feed
* [PATCH] net/i40e: avx512 fast-free path bug fix
@ 2023-03-07 19:32 Kamalakshitha Aligeri
  2023-03-07 20:26 ` Morten Brørup
  0 siblings, 1 reply; 3+ messages in thread
From: Kamalakshitha Aligeri @ 2023-03-07 19:32 UTC (permalink / raw)
  To: Yuying.Zhang, beilei.xing, leyi.rong, ruifeng.wang, feifei.wang2; +Cc: nd, dev

In i40e_tx_free_bufs_avx512 fast-free path, when cache is NULL,
non fast-free path is being executed. Fixed the bug by calling
rte_mempool_generic_put API that handles the cache==NULL case.

Fixes: 5171b4ee6b6b ("net/i40e: optimize Tx by using AVX512")
Cc: leyi.rong@intel.com
Cc: stable@dpdk.org

Signed-off-by: Kamalakshitha Aligeri <kamalakshitha.aligeri@arm.com>
Reviewed-by: Ruifeng Wang <ruifeng.wang@arm.com>
Reviewed-by: Feifei Wang <feifei.wang2@arm.com>
---
 .mailmap                                |  1 +
 drivers/net/i40e/i40e_rxtx_vec_avx512.c | 12 ++++--------
 2 files changed, 5 insertions(+), 8 deletions(-)

diff --git a/.mailmap b/.mailmap
index a9f4f28fba..2581d0efe7 100644
--- a/.mailmap
+++ b/.mailmap
@@ -677,6 +677,7 @@ Kai Ji <kai.ji@intel.com>
 Kaiwen Deng <kaiwenx.deng@intel.com>
 Kalesh AP <kalesh-anakkur.purayil@broadcom.com>
 Kamalakannan R <kamalakannan.r@intel.com>
+Kamalakshitha Aligeri <kamalakshitha.aligeri@arm.com>
 Kamil Bednarczyk <kamil.bednarczyk@intel.com>
 Kamil Chalupnik <kamilx.chalupnik@intel.com>
 Kamil Rytarowski <kamil.rytarowski@caviumnetworks.com>
diff --git a/drivers/net/i40e/i40e_rxtx_vec_avx512.c b/drivers/net/i40e/i40e_rxtx_vec_avx512.c
index d3c7bfd121..ad0893324d 100644
--- a/drivers/net/i40e/i40e_rxtx_vec_avx512.c
+++ b/drivers/net/i40e/i40e_rxtx_vec_avx512.c
@@ -783,16 +783,13 @@ i40e_tx_free_bufs_avx512(struct i40e_tx_queue *txq)
 		struct rte_mempool_cache *cache = rte_mempool_default_cache(mp,
 				rte_lcore_id());

-		if (!cache || cache->len == 0)
-			goto normal;
-
-		cache_objs = &cache->objs[cache->len];
-
-		if (n > RTE_MEMPOOL_CACHE_MAX_SIZE) {
-			rte_mempool_ops_enqueue_bulk(mp, (void *)txep, n);
+		if (!cache || n > RTE_MEMPOOL_CACHE_MAX_SIZE) {
+			rte_mempool_generic_put(mp, (void *)txep, n, cache);
 			goto done;
 		}

+		cache_objs = &cache->objs[cache->len];
+
 		/* The cache follows the following algorithm
 		 *   1. Add the objects to the cache
 		 *   2. Anything greater than the cache min value (if it
@@ -824,7 +821,6 @@ i40e_tx_free_bufs_avx512(struct i40e_tx_queue *txq)
 		goto done;
 	}

-normal:
 	m = rte_pktmbuf_prefree_seg(txep[0].mbuf);
 	if (likely(m)) {
 		free[0] = m;
--
2.25.1


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

* RE: [PATCH] net/i40e: avx512 fast-free path bug fix
  2023-03-07 19:32 [PATCH] net/i40e: avx512 fast-free path bug fix Kamalakshitha Aligeri
@ 2023-03-07 20:26 ` Morten Brørup
  2023-03-13  6:52   ` Zhang, Qi Z
  0 siblings, 1 reply; 3+ messages in thread
From: Morten Brørup @ 2023-03-07 20:26 UTC (permalink / raw)
  To: Kamalakshitha Aligeri, Yuying.Zhang, beilei.xing, leyi.rong,
	ruifeng.wang, feifei.wang2
  Cc: nd, dev

> From: Kamalakshitha Aligeri [mailto:kamalakshitha.aligeri@arm.com]
> Sent: Tuesday, 7 March 2023 20.32
> 
> In i40e_tx_free_bufs_avx512 fast-free path, when cache is NULL,
> non fast-free path is being executed. Fixed the bug by calling
> rte_mempool_generic_put API that handles the cache==NULL case.
> 
> Fixes: 5171b4ee6b6b ("net/i40e: optimize Tx by using AVX512")
> Cc: leyi.rong@intel.com
> Cc: stable@dpdk.org
> 
> Signed-off-by: Kamalakshitha Aligeri <kamalakshitha.aligeri@arm.com>
> Reviewed-by: Ruifeng Wang <ruifeng.wang@arm.com>
> Reviewed-by: Feifei Wang <feifei.wang2@arm.com>
> ---
>  .mailmap                                |  1 +
>  drivers/net/i40e/i40e_rxtx_vec_avx512.c | 12 ++++--------
>  2 files changed, 5 insertions(+), 8 deletions(-)
> 
> diff --git a/.mailmap b/.mailmap
> index a9f4f28fba..2581d0efe7 100644
> --- a/.mailmap
> +++ b/.mailmap
> @@ -677,6 +677,7 @@ Kai Ji <kai.ji@intel.com>
>  Kaiwen Deng <kaiwenx.deng@intel.com>
>  Kalesh AP <kalesh-anakkur.purayil@broadcom.com>
>  Kamalakannan R <kamalakannan.r@intel.com>
> +Kamalakshitha Aligeri <kamalakshitha.aligeri@arm.com>
>  Kamil Bednarczyk <kamil.bednarczyk@intel.com>
>  Kamil Chalupnik <kamilx.chalupnik@intel.com>
>  Kamil Rytarowski <kamil.rytarowski@caviumnetworks.com>
> diff --git a/drivers/net/i40e/i40e_rxtx_vec_avx512.c
> b/drivers/net/i40e/i40e_rxtx_vec_avx512.c
> index d3c7bfd121..ad0893324d 100644
> --- a/drivers/net/i40e/i40e_rxtx_vec_avx512.c
> +++ b/drivers/net/i40e/i40e_rxtx_vec_avx512.c
> @@ -783,16 +783,13 @@ i40e_tx_free_bufs_avx512(struct i40e_tx_queue
> *txq)
>  		struct rte_mempool_cache *cache =
> rte_mempool_default_cache(mp,
>  				rte_lcore_id());
> 
> -		if (!cache || cache->len == 0)
> -			goto normal;
> -
> -		cache_objs = &cache->objs[cache->len];
> -
> -		if (n > RTE_MEMPOOL_CACHE_MAX_SIZE) {
> -			rte_mempool_ops_enqueue_bulk(mp, (void *)txep, n);
> +		if (!cache || n > RTE_MEMPOOL_CACHE_MAX_SIZE) {
> +			rte_mempool_generic_put(mp, (void *)txep, n, cache);
>  			goto done;
>  		}
> 
> +		cache_objs = &cache->objs[cache->len];
> +
>  		/* The cache follows the following algorithm
>  		 *   1. Add the objects to the cache
>  		 *   2. Anything greater than the cache min value (if it
> @@ -824,7 +821,6 @@ i40e_tx_free_bufs_avx512(struct i40e_tx_queue *txq)
>  		goto done;
>  	}
> 
> -normal:
>  	m = rte_pktmbuf_prefree_seg(txep[0].mbuf);
>  	if (likely(m)) {
>  		free[0] = m;
> --
> 2.25.1
> 

An improvement of the copy-paste code we are aiming to replace by proper use of the mempool API.

But still an improvement.

Acked-by: Morten Brørup <mb@smartsharesystems.com>


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

* RE: [PATCH] net/i40e: avx512 fast-free path bug fix
  2023-03-07 20:26 ` Morten Brørup
@ 2023-03-13  6:52   ` Zhang, Qi Z
  0 siblings, 0 replies; 3+ messages in thread
From: Zhang, Qi Z @ 2023-03-13  6:52 UTC (permalink / raw)
  To: Morten Brørup, Kamalakshitha Aligeri, Zhang, Yuying, Xing,
	Beilei, Rong, Leyi, ruifeng.wang, feifei.wang2
  Cc: nd, dev



> -----Original Message-----
> From: Morten Brørup <mb@smartsharesystems.com>
> Sent: Wednesday, March 8, 2023 4:26 AM
> To: Kamalakshitha Aligeri <kamalakshitha.aligeri@arm.com>; Zhang, Yuying
> <yuying.zhang@intel.com>; Xing, Beilei <beilei.xing@intel.com>; Rong, Leyi
> <leyi.rong@intel.com>; ruifeng.wang@arm.com; feifei.wang2@arm.com
> Cc: nd@arm.com; dev@dpdk.org
> Subject: RE: [PATCH] net/i40e: avx512 fast-free path bug fix
> 
> > From: Kamalakshitha Aligeri [mailto:kamalakshitha.aligeri@arm.com]
> > Sent: Tuesday, 7 March 2023 20.32
> >
> > In i40e_tx_free_bufs_avx512 fast-free path, when cache is NULL, non
> > fast-free path is being executed. Fixed the bug by calling
> > rte_mempool_generic_put API that handles the cache==NULL case.
> >
> > Fixes: 5171b4ee6b6b ("net/i40e: optimize Tx by using AVX512")
> > Cc: leyi.rong@intel.com
> > Cc: stable@dpdk.org
> >
> > Signed-off-by: Kamalakshitha Aligeri <kamalakshitha.aligeri@arm.com>
> > Reviewed-by: Ruifeng Wang <ruifeng.wang@arm.com>
> > Reviewed-by: Feifei Wang <feifei.wang2@arm.com>
> > ---
> >  .mailmap                                |  1 +
> >  drivers/net/i40e/i40e_rxtx_vec_avx512.c | 12 ++++--------
> >  2 files changed, 5 insertions(+), 8 deletions(-)
> >
> > diff --git a/.mailmap b/.mailmap
> > index a9f4f28fba..2581d0efe7 100644
> > --- a/.mailmap
> > +++ b/.mailmap
> > @@ -677,6 +677,7 @@ Kai Ji <kai.ji@intel.com>  Kaiwen Deng
> > <kaiwenx.deng@intel.com>  Kalesh AP
> > <kalesh-anakkur.purayil@broadcom.com>
> >  Kamalakannan R <kamalakannan.r@intel.com>
> > +Kamalakshitha Aligeri <kamalakshitha.aligeri@arm.com>
> >  Kamil Bednarczyk <kamil.bednarczyk@intel.com>  Kamil Chalupnik
> > <kamilx.chalupnik@intel.com>  Kamil Rytarowski
> > <kamil.rytarowski@caviumnetworks.com>
> > diff --git a/drivers/net/i40e/i40e_rxtx_vec_avx512.c
> > b/drivers/net/i40e/i40e_rxtx_vec_avx512.c
> > index d3c7bfd121..ad0893324d 100644
> > --- a/drivers/net/i40e/i40e_rxtx_vec_avx512.c
> > +++ b/drivers/net/i40e/i40e_rxtx_vec_avx512.c
> > @@ -783,16 +783,13 @@ i40e_tx_free_bufs_avx512(struct i40e_tx_queue
> > *txq)
> >  		struct rte_mempool_cache *cache =
> > rte_mempool_default_cache(mp,
> >  				rte_lcore_id());
> >
> > -		if (!cache || cache->len == 0)
> > -			goto normal;
> > -
> > -		cache_objs = &cache->objs[cache->len];
> > -
> > -		if (n > RTE_MEMPOOL_CACHE_MAX_SIZE) {
> > -			rte_mempool_ops_enqueue_bulk(mp, (void *)txep,
> n);
> > +		if (!cache || n > RTE_MEMPOOL_CACHE_MAX_SIZE) {
> > +			rte_mempool_generic_put(mp, (void *)txep, n,
> cache);
> >  			goto done;
> >  		}
> >
> > +		cache_objs = &cache->objs[cache->len];
> > +
> >  		/* The cache follows the following algorithm
> >  		 *   1. Add the objects to the cache
> >  		 *   2. Anything greater than the cache min value (if it
> > @@ -824,7 +821,6 @@ i40e_tx_free_bufs_avx512(struct i40e_tx_queue
> *txq)
> >  		goto done;
> >  	}
> >
> > -normal:
> >  	m = rte_pktmbuf_prefree_seg(txep[0].mbuf);
> >  	if (likely(m)) {
> >  		free[0] = m;
> > --
> > 2.25.1
> >
> 
> An improvement of the copy-paste code we are aiming to replace by proper
> use of the mempool API.
> 
> But still an improvement.
> 
> Acked-by: Morten Brørup <mb@smartsharesystems.com>

Applied to dpdk-next-net-intel.

Thanks
Qi


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

end of thread, other threads:[~2023-03-13  6:52 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-03-07 19:32 [PATCH] net/i40e: avx512 fast-free path bug fix Kamalakshitha Aligeri
2023-03-07 20:26 ` Morten Brørup
2023-03-13  6:52   ` Zhang, Qi Z

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