[v2] event/cnxk: fix LMTST write for single event mode

Message ID 20230531103233.3476875-1-schalla@marvell.com (mailing list archive)
State Accepted, archived
Delegated to: Jerin Jacob
Headers
Series [v2] event/cnxk: fix LMTST write for single event mode |

Checks

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

Commit Message

Srujana Challa May 31, 2023, 10:32 a.m. UTC
  LMTST area can be overwritten before read by HW between to consecutive
steorl operations. Hence, add wmb() after steorl op to make sure
the LMTST operation is complete.

Fixes: 313e884a22fd ("event/cnxk: support Tx adapter fast path")
Cc: pbhagavatula@marvell.com

Signed-off-by: Srujana Challa <schalla@marvell.com>
---
 drivers/event/cnxk/cn10k_tx_worker.h | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)
  

Comments

Pavan Nikhilesh Bhagavatula May 31, 2023, 10:55 a.m. UTC | #1
> -----Original Message-----
> From: Srujana Challa <schalla@marvell.com>
> Sent: Wednesday, May 31, 2023 4:03 PM
> To: Pavan Nikhilesh Bhagavatula <pbhagavatula@marvell.com>; Shijith
> Thotton <sthotton@marvell.com>; Rahul Bhansali <rbhansali@marvell.com>;
> Jerin Jacob Kollanukkaran <jerinj@marvell.com>
> Cc: dev@dpdk.org; Srujana Challa <schalla@marvell.com>; Nithin Kumar
> Dabilpuram <ndabilpuram@marvell.com>
> Subject: [PATCH v2] event/cnxk: fix LMTST write for single event mode
> 
> LMTST area can be overwritten before read by HW between to consecutive
> steorl operations. Hence, add wmb() after steorl op to make sure
> the LMTST operation is complete.
> 
> Fixes: 313e884a22fd ("event/cnxk: support Tx adapter fast path")
> Cc: pbhagavatula@marvell.com
> 
> Signed-off-by: Srujana Challa <schalla@marvell.com>

Acked-by: Pavan Nikhilesh <pbhagavatula@marvell.com>

> ---
>  drivers/event/cnxk/cn10k_tx_worker.h | 8 +++-----
>  1 file changed, 3 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/event/cnxk/cn10k_tx_worker.h
> b/drivers/event/cnxk/cn10k_tx_worker.h
> index c18786a14c..81fe31c4b9 100644
> --- a/drivers/event/cnxk/cn10k_tx_worker.h
> +++ b/drivers/event/cnxk/cn10k_tx_worker.h
> @@ -43,7 +43,6 @@ cn10k_sso_tx_one(struct cn10k_sso_hws *ws, struct
> rte_mbuf *m, uint64_t *cmd,
>  		 const uint64_t *txq_data, const uint32_t flags)
>  {
>  	uint8_t lnum = 0, loff = 0, shft = 0;
> -	uint16_t ref_cnt = m->refcnt;
>  	struct cn10k_eth_txq *txq;
>  	uintptr_t laddr;
>  	uint16_t segdw;
> @@ -98,10 +97,9 @@ cn10k_sso_tx_one(struct cn10k_sso_hws *ws, struct
> rte_mbuf *m, uint64_t *cmd,
> 
>  	roc_lmt_submit_steorl(lmt_id, pa);
> 
> -	if (flags & NIX_TX_OFFLOAD_MBUF_NOFF_F) {
> -		if (ref_cnt > 1)
> -			rte_io_wmb();
> -	}
> +	/* Memory barrier to make sure lmtst store completes */
> +	rte_io_wmb();
> +
>  	return 1;
>  }
> 
> --
> 2.25.1
  
Jerin Jacob May 31, 2023, 1:24 p.m. UTC | #2
On Wed, May 31, 2023 at 4:25 PM Pavan Nikhilesh Bhagavatula
<pbhagavatula@marvell.com> wrote:
>
>
>
> > -----Original Message-----
> > From: Srujana Challa <schalla@marvell.com>
> > Sent: Wednesday, May 31, 2023 4:03 PM
> > To: Pavan Nikhilesh Bhagavatula <pbhagavatula@marvell.com>; Shijith
> > Thotton <sthotton@marvell.com>; Rahul Bhansali <rbhansali@marvell.com>;
> > Jerin Jacob Kollanukkaran <jerinj@marvell.com>
> > Cc: dev@dpdk.org; Srujana Challa <schalla@marvell.com>; Nithin Kumar
> > Dabilpuram <ndabilpuram@marvell.com>
> > Subject: [PATCH v2] event/cnxk: fix LMTST write for single event mode
> >
> > LMTST area can be overwritten before read by HW between to consecutive
> > steorl operations. Hence, add wmb() after steorl op to make sure
> > the LMTST operation is complete.
> >
> > Fixes: 313e884a22fd ("event/cnxk: support Tx adapter fast path")
> > Cc: pbhagavatula@marvell.com
> >
> > Signed-off-by: Srujana Challa <schalla@marvell.com>
>
> Acked-by: Pavan Nikhilesh <pbhagavatula@marvell.com>

Applied to dpdk-next-net-mrvl/for-next-net. Thanks


>
> > ---
> >  drivers/event/cnxk/cn10k_tx_worker.h | 8 +++-----
> >  1 file changed, 3 insertions(+), 5 deletions(-)
> >
> > diff --git a/drivers/event/cnxk/cn10k_tx_worker.h
> > b/drivers/event/cnxk/cn10k_tx_worker.h
> > index c18786a14c..81fe31c4b9 100644
> > --- a/drivers/event/cnxk/cn10k_tx_worker.h
> > +++ b/drivers/event/cnxk/cn10k_tx_worker.h
> > @@ -43,7 +43,6 @@ cn10k_sso_tx_one(struct cn10k_sso_hws *ws, struct
> > rte_mbuf *m, uint64_t *cmd,
> >                const uint64_t *txq_data, const uint32_t flags)
> >  {
> >       uint8_t lnum = 0, loff = 0, shft = 0;
> > -     uint16_t ref_cnt = m->refcnt;
> >       struct cn10k_eth_txq *txq;
> >       uintptr_t laddr;
> >       uint16_t segdw;
> > @@ -98,10 +97,9 @@ cn10k_sso_tx_one(struct cn10k_sso_hws *ws, struct
> > rte_mbuf *m, uint64_t *cmd,
> >
> >       roc_lmt_submit_steorl(lmt_id, pa);
> >
> > -     if (flags & NIX_TX_OFFLOAD_MBUF_NOFF_F) {
> > -             if (ref_cnt > 1)
> > -                     rte_io_wmb();
> > -     }
> > +     /* Memory barrier to make sure lmtst store completes */
> > +     rte_io_wmb();
> > +
> >       return 1;
> >  }
> >
> > --
> > 2.25.1
>
  

Patch

diff --git a/drivers/event/cnxk/cn10k_tx_worker.h b/drivers/event/cnxk/cn10k_tx_worker.h
index c18786a14c..81fe31c4b9 100644
--- a/drivers/event/cnxk/cn10k_tx_worker.h
+++ b/drivers/event/cnxk/cn10k_tx_worker.h
@@ -43,7 +43,6 @@  cn10k_sso_tx_one(struct cn10k_sso_hws *ws, struct rte_mbuf *m, uint64_t *cmd,
 		 const uint64_t *txq_data, const uint32_t flags)
 {
 	uint8_t lnum = 0, loff = 0, shft = 0;
-	uint16_t ref_cnt = m->refcnt;
 	struct cn10k_eth_txq *txq;
 	uintptr_t laddr;
 	uint16_t segdw;
@@ -98,10 +97,9 @@  cn10k_sso_tx_one(struct cn10k_sso_hws *ws, struct rte_mbuf *m, uint64_t *cmd,
 
 	roc_lmt_submit_steorl(lmt_id, pa);
 
-	if (flags & NIX_TX_OFFLOAD_MBUF_NOFF_F) {
-		if (ref_cnt > 1)
-			rte_io_wmb();
-	}
+	/* Memory barrier to make sure lmtst store completes */
+	rte_io_wmb();
+
 	return 1;
 }