net/bnxt: fix ring group free

Message ID 20210830035811.24206-1-kalesh-anakkur.purayil@broadcom.com (mailing list archive)
State Accepted, archived
Delegated to: Ajit Khaparde
Headers
Series net/bnxt: fix ring group free |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/github-robot: build success github build: passed
ci/iol-broadcom-Performance success Performance Testing PASS
ci/iol-broadcom-Functional success Functional Testing PASS
ci/iol-intel-Functional success Functional Testing PASS
ci/iol-intel-Performance success Performance Testing PASS
ci/iol-mellanox-Performance success Performance 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-aarch64-unit-testing fail Testing issues
ci/Intel-compilation success Compilation OK
ci/intel-Testing success Testing PASS

Commit Message

Kalesh A P Aug. 30, 2021, 3:58 a.m. UTC
  From: Kalesh AP <kalesh-anakkur.purayil@broadcom.com>

Added an invalid fw_grp_id check inside bnxt_hwrm_ring_grp_free().
This will prevent invalid fw_grp_id to be passed to the FW which can
result in an error.
This fixes the following failure in the "port stop" -> "port start"
sequence:

bnxt_hwrm_ring_grp_free(): error 2:0:00000000:0204
bnxt_hwrm_ring_grp_free(): error 2:0:00000000:0204

Fixes: 5803d86b87df ("net/bnxt: update ring group after ring stop start")
Cc: stable@dpdk.org

Signed-off-by: Kalesh AP <kalesh-anakkur.purayil@broadcom.com>
Reviewed-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
Reviewed-by: Lance Richardson <lance.richardson@broadcom.com>
Reviewed-by: Somnath Kotur <somnath.kotur@broadcom.com>
---
 drivers/net/bnxt/bnxt_hwrm.c | 3 +++
 1 file changed, 3 insertions(+)
  

Comments

Ajit Khaparde Sept. 2, 2021, 12:38 a.m. UTC | #1
On Sun, Aug 29, 2021 at 8:37 PM Kalesh A P
<kalesh-anakkur.purayil@broadcom.com> wrote:
>
> From: Kalesh AP <kalesh-anakkur.purayil@broadcom.com>
>
> Added an invalid fw_grp_id check inside bnxt_hwrm_ring_grp_free().
> This will prevent invalid fw_grp_id to be passed to the FW which can
> result in an error.
> This fixes the following failure in the "port stop" -> "port start"
> sequence:
>
> bnxt_hwrm_ring_grp_free(): error 2:0:00000000:0204
> bnxt_hwrm_ring_grp_free(): error 2:0:00000000:0204
>
> Fixes: 5803d86b87df ("net/bnxt: update ring group after ring stop start")
> Cc: stable@dpdk.org
>
> Signed-off-by: Kalesh AP <kalesh-anakkur.purayil@broadcom.com>
> Reviewed-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
> Reviewed-by: Lance Richardson <lance.richardson@broadcom.com>
> Reviewed-by: Somnath Kotur <somnath.kotur@broadcom.com>
Patch applied to dpdk-next-net-brcm.

> ---
>  drivers/net/bnxt/bnxt_hwrm.c | 3 +++
>  1 file changed, 3 insertions(+)
>
> diff --git a/drivers/net/bnxt/bnxt_hwrm.c b/drivers/net/bnxt/bnxt_hwrm.c
> index f29d574..d092fdc 100644
> --- a/drivers/net/bnxt/bnxt_hwrm.c
> +++ b/drivers/net/bnxt/bnxt_hwrm.c
> @@ -1888,6 +1888,9 @@ int bnxt_hwrm_ring_grp_free(struct bnxt *bp, unsigned int idx)
>         struct hwrm_ring_grp_free_input req = {.req_type = 0 };
>         struct hwrm_ring_grp_free_output *resp = bp->hwrm_cmd_resp_addr;
>
> +       if (bp->grp_info[idx].fw_grp_id == INVALID_HW_RING_ID)
> +               return 0;
> +
>         HWRM_PREP(&req, HWRM_RING_GRP_FREE, BNXT_USE_CHIMP_MB);
>
>         req.ring_group_id = rte_cpu_to_le_16(bp->grp_info[idx].fw_grp_id);
> --
> 2.10.1
>
  

Patch

diff --git a/drivers/net/bnxt/bnxt_hwrm.c b/drivers/net/bnxt/bnxt_hwrm.c
index f29d574..d092fdc 100644
--- a/drivers/net/bnxt/bnxt_hwrm.c
+++ b/drivers/net/bnxt/bnxt_hwrm.c
@@ -1888,6 +1888,9 @@  int bnxt_hwrm_ring_grp_free(struct bnxt *bp, unsigned int idx)
 	struct hwrm_ring_grp_free_input req = {.req_type = 0 };
 	struct hwrm_ring_grp_free_output *resp = bp->hwrm_cmd_resp_addr;
 
+	if (bp->grp_info[idx].fw_grp_id == INVALID_HW_RING_ID)
+		return 0;
+
 	HWRM_PREP(&req, HWRM_RING_GRP_FREE, BNXT_USE_CHIMP_MB);
 
 	req.ring_group_id = rte_cpu_to_le_16(bp->grp_info[idx].fw_grp_id);