[v3] common/cnxk/roc_npa: unlock mbox in error cases

Message ID 20230620094337.3127595-1-thierry.herbelot@6wind.com (mailing list archive)
State Accepted, archived
Delegated to: Jerin Jacob
Headers
Series [v3] common/cnxk/roc_npa: unlock mbox in error cases |

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/iol-mellanox-Performance success Performance Testing PASS
ci/github-robot: build success github build: passed
ci/iol-abi-testing success Testing PASS
ci/iol-intel-Performance success Performance Testing PASS
ci/iol-aarch-unit-testing success Testing PASS
ci/iol-unit-testing success Testing PASS
ci/iol-x86_64-compile-testing success Testing PASS
ci/intel-Functional success Functional PASS
ci/iol-broadcom-Performance success Performance Testing PASS
ci/iol-aarch64-compile-testing success Testing PASS
ci/iol-intel-Functional success Functional Testing PASS
ci/iol-broadcom-Functional success Functional Testing PASS
ci/iol-testing success Testing PASS
ci/iol-x86_64-unit-testing success Testing PASS

Commit Message

Thierry Herbelot June 20, 2023, 9:43 a.m. UTC
  In npa_aura_pool_fini and in npa_aura_fini, Unlock mbox when an error is
detected.

Fixes: ea4d70cc4f0b46d5 ('common/cnxk: add NPA aura create/destroy ROC APIs')
Signed-off-by: Thierry Herbelot <thierry.herbelot@6wind.com>
--
V2: also patch npa_aura_pool_fini
V3: add missing space
---
 drivers/common/cnxk/roc_npa.c | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)
  

Comments

Ashwin Sekhar T K June 21, 2023, 4:46 a.m. UTC | #1
Acked-by: Ashwin Sekhar T K <asekhar@marvell.com>

> -----Original Message-----
> From: Thierry Herbelot <thierry.herbelot@6wind.com>
> Sent: Tuesday, June 20, 2023 3:14 PM
> To: dev@dpdk.org
> Cc: Thierry Herbelot <thierry.herbelot@6wind.com>; Thomas Monjalon
> <thomas@monjalon.net>; Nithin Kumar Dabilpuram
> <ndabilpuram@marvell.com>; Satha Koteswara Rao Kottidi
> <skoteshwar@marvell.com>; Jerin Jacob Kollanukkaran
> <jerinj@marvell.com>
> Subject: [EXT] [PATCH v3] common/cnxk/roc_npa: unlock mbox in error
> cases
> 
> External Email
> 
> ----------------------------------------------------------------------
> In npa_aura_pool_fini and in npa_aura_fini, Unlock mbox when an error is
> detected.
> 
> Fixes: ea4d70cc4f0b46d5 ('common/cnxk: add NPA aura create/destroy ROC
> APIs')
> Signed-off-by: Thierry Herbelot <thierry.herbelot@6wind.com>
> --
> V2: also patch npa_aura_pool_fini
> V3: add missing space
> ---
>  drivers/common/cnxk/roc_npa.c | 12 ++++++++----
>  1 file changed, 8 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/common/cnxk/roc_npa.c
> b/drivers/common/cnxk/roc_npa.c index 377439c2baaf..3b9a70028ba2
> 100644
> --- a/drivers/common/cnxk/roc_npa.c
> +++ b/drivers/common/cnxk/roc_npa.c
> @@ -197,8 +197,10 @@ npa_aura_pool_fini(struct mbox *m_box, uint32_t
> aura_id, uint64_t aura_handle)
>  	off = mbox->rx_start + pool_rsp->hdr.next_msgoff;
>  	aura_rsp = (struct npa_aq_enq_rsp *)((uintptr_t)mdev->mbase +
> off);
> 
> -	if (aura_rsp->hdr.rc != 0 || pool_rsp->hdr.rc != 0)
> -		return NPA_ERR_AURA_POOL_FINI;
> +	if (aura_rsp->hdr.rc != 0 || pool_rsp->hdr.rc != 0) {
> +		rc = NPA_ERR_AURA_POOL_FINI;
> +		goto exit;
> +	}
> 
>  	/* Sync NDC-NPA for LF */
>  	ndc_req = mbox_alloc_msg_ndc_sync_op(mbox); @@ -245,8
> +247,10 @@ npa_aura_fini(struct mbox *m_box, uint32_t aura_id)
>  	if (rc < 0)
>  		goto exit;
> 
> -	if (aura_rsp->hdr.rc != 0)
> -		return NPA_ERR_AURA_POOL_FINI;
> +	if (aura_rsp->hdr.rc != 0) {
> +		rc = NPA_ERR_AURA_POOL_FINI;
> +		goto exit;
> +	}
> 
>  	/* Sync NDC-NPA for LF */
>  	ndc_req = mbox_alloc_msg_ndc_sync_op(mbox);
> --
> 2.39.2
  
Jerin Jacob June 21, 2023, 5 a.m. UTC | #2
On Wed, Jun 21, 2023 at 10:17 AM Ashwin Sekhar T K <asekhar@marvell.com> wrote:
>
> Acked-by: Ashwin Sekhar T K <asekhar@marvell.com>
>
> > -----Original Message-----
> > From: Thierry Herbelot <thierry.herbelot@6wind.com>
> > Sent: Tuesday, June 20, 2023 3:14 PM
> > To: dev@dpdk.org
> > Cc: Thierry Herbelot <thierry.herbelot@6wind.com>; Thomas Monjalon
> > <thomas@monjalon.net>; Nithin Kumar Dabilpuram
> > <ndabilpuram@marvell.com>; Satha Koteswara Rao Kottidi
> > <skoteshwar@marvell.com>; Jerin Jacob Kollanukkaran
> > <jerinj@marvell.com>
> > Subject: [EXT] [PATCH v3] common/cnxk/roc_npa: unlock mbox in error
> > cases
> >
> > External Email
> >
> > ----------------------------------------------------------------------
> > In npa_aura_pool_fini and in npa_aura_fini, Unlock mbox when an error is
> > detected.
> >
> > Fixes: ea4d70cc4f0b46d5 ('common/cnxk: add NPA aura create/destroy ROC
> > APIs')
> > Signed-off-by: Thierry Herbelot <thierry.herbelot@6wind.com>


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


    common/cnxk: fix mbox unlocking in error cases

    Fix mbox unlock issues in npa_aura_pool_fini() and in npa_aura_fini(),
    when an error is detected.

    Fixes: ea4d70cc4f0b ("common/cnxk: add NPA aura create/destroy ROC API")
    Cc: stable@dpdk.org

    Signed-off-by: Thierry Herbelot <thierry.herbelot@6wind.com>
    Acked-by: Ashwin Sekhar T K <asekhar@marvell.com>


> > --
> > V2: also patch npa_aura_pool_fini
> > V3: add missing space
> > ---
> >  drivers/common/cnxk/roc_npa.c | 12 ++++++++----
> >  1 file changed, 8 insertions(+), 4 deletions(-)
> >
> > diff --git a/drivers/common/cnxk/roc_npa.c
> > b/drivers/common/cnxk/roc_npa.c index 377439c2baaf..3b9a70028ba2
> > 100644
> > --- a/drivers/common/cnxk/roc_npa.c
> > +++ b/drivers/common/cnxk/roc_npa.c
> > @@ -197,8 +197,10 @@ npa_aura_pool_fini(struct mbox *m_box, uint32_t
> > aura_id, uint64_t aura_handle)
> >       off = mbox->rx_start + pool_rsp->hdr.next_msgoff;
> >       aura_rsp = (struct npa_aq_enq_rsp *)((uintptr_t)mdev->mbase +
> > off);
> >
> > -     if (aura_rsp->hdr.rc != 0 || pool_rsp->hdr.rc != 0)
> > -             return NPA_ERR_AURA_POOL_FINI;
> > +     if (aura_rsp->hdr.rc != 0 || pool_rsp->hdr.rc != 0) {
> > +             rc = NPA_ERR_AURA_POOL_FINI;
> > +             goto exit;
> > +     }
> >
> >       /* Sync NDC-NPA for LF */
> >       ndc_req = mbox_alloc_msg_ndc_sync_op(mbox); @@ -245,8
> > +247,10 @@ npa_aura_fini(struct mbox *m_box, uint32_t aura_id)
> >       if (rc < 0)
> >               goto exit;
> >
> > -     if (aura_rsp->hdr.rc != 0)
> > -             return NPA_ERR_AURA_POOL_FINI;
> > +     if (aura_rsp->hdr.rc != 0) {
> > +             rc = NPA_ERR_AURA_POOL_FINI;
> > +             goto exit;
> > +     }
> >
> >       /* Sync NDC-NPA for LF */
> >       ndc_req = mbox_alloc_msg_ndc_sync_op(mbox);
> > --
> > 2.39.2
>
  

Patch

diff --git a/drivers/common/cnxk/roc_npa.c b/drivers/common/cnxk/roc_npa.c
index 377439c2baaf..3b9a70028ba2 100644
--- a/drivers/common/cnxk/roc_npa.c
+++ b/drivers/common/cnxk/roc_npa.c
@@ -197,8 +197,10 @@  npa_aura_pool_fini(struct mbox *m_box, uint32_t aura_id, uint64_t aura_handle)
 	off = mbox->rx_start + pool_rsp->hdr.next_msgoff;
 	aura_rsp = (struct npa_aq_enq_rsp *)((uintptr_t)mdev->mbase + off);
 
-	if (aura_rsp->hdr.rc != 0 || pool_rsp->hdr.rc != 0)
-		return NPA_ERR_AURA_POOL_FINI;
+	if (aura_rsp->hdr.rc != 0 || pool_rsp->hdr.rc != 0) {
+		rc = NPA_ERR_AURA_POOL_FINI;
+		goto exit;
+	}
 
 	/* Sync NDC-NPA for LF */
 	ndc_req = mbox_alloc_msg_ndc_sync_op(mbox);
@@ -245,8 +247,10 @@  npa_aura_fini(struct mbox *m_box, uint32_t aura_id)
 	if (rc < 0)
 		goto exit;
 
-	if (aura_rsp->hdr.rc != 0)
-		return NPA_ERR_AURA_POOL_FINI;
+	if (aura_rsp->hdr.rc != 0) {
+		rc = NPA_ERR_AURA_POOL_FINI;
+		goto exit;
+	}
 
 	/* Sync NDC-NPA for LF */
 	ndc_req = mbox_alloc_msg_ndc_sync_op(mbox);