net/bnxt: fix double allocation of ring groups

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

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-aarch64-compile-testing success 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-unit-testing fail Testing issues

Commit Message

Kalesh A P Sept. 1, 2021, 4 a.m. UTC
  From: Kalesh AP <kalesh-anakkur.purayil@broadcom.com>

After commit "d68249f88266", driver allocates ring groups in
bnxt_alloc_hwrm_rx_ring(). But during port start, driver invokes
bnxt_alloc_hwrm_rx_ring() followed by bnxt_alloc_all_hwrm_ring_grps().
This will cause the FW command failure in bnxt_alloc_all_hwrm_ring_grps().

To fix this, just don't create the ring group if it is already created.

Fixes: d68249f88266 ("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>
---
 drivers/net/bnxt/bnxt_hwrm.c | 4 ++++
 1 file changed, 4 insertions(+)
  

Comments

Ajit Khaparde Sept. 2, 2021, 12:40 a.m. UTC | #1
On Tue, Aug 31, 2021 at 8:39 PM Kalesh A P
<kalesh-anakkur.purayil@broadcom.com> wrote:
>
> From: Kalesh AP <kalesh-anakkur.purayil@broadcom.com>
>
> After commit "d68249f88266", driver allocates ring groups in
> bnxt_alloc_hwrm_rx_ring(). But during port start, driver invokes
> bnxt_alloc_hwrm_rx_ring() followed by bnxt_alloc_all_hwrm_ring_grps().
> This will cause the FW command failure in bnxt_alloc_all_hwrm_ring_grps().
>
> To fix this, just don't create the ring group if it is already created.
>
> Fixes: d68249f88266 ("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>
Patch applied to dpdk-next-net-brcm. Thanks

> ---
>  drivers/net/bnxt/bnxt_hwrm.c | 4 ++++
>  1 file changed, 4 insertions(+)
>
> diff --git a/drivers/net/bnxt/bnxt_hwrm.c b/drivers/net/bnxt/bnxt_hwrm.c
> index f29d574..f65dc72 100644
> --- a/drivers/net/bnxt/bnxt_hwrm.c
> +++ b/drivers/net/bnxt/bnxt_hwrm.c
> @@ -1864,6 +1864,10 @@ int bnxt_hwrm_ring_grp_alloc(struct bnxt *bp, unsigned int idx)
>         struct hwrm_ring_grp_alloc_input req = {.req_type = 0 };
>         struct hwrm_ring_grp_alloc_output *resp = bp->hwrm_cmd_resp_addr;
>
> +       /* Don't attempt to re-create the ring group if it is already created */
> +       if (bp->grp_info[idx].fw_grp_id != INVALID_HW_RING_ID)
> +               return 0;
> +
>         HWRM_PREP(&req, HWRM_RING_GRP_ALLOC, BNXT_USE_CHIMP_MB);
>
>         req.cr = rte_cpu_to_le_16(bp->grp_info[idx].cp_fw_ring_id);
> --
> 2.10.1
>
  

Patch

diff --git a/drivers/net/bnxt/bnxt_hwrm.c b/drivers/net/bnxt/bnxt_hwrm.c
index f29d574..f65dc72 100644
--- a/drivers/net/bnxt/bnxt_hwrm.c
+++ b/drivers/net/bnxt/bnxt_hwrm.c
@@ -1864,6 +1864,10 @@  int bnxt_hwrm_ring_grp_alloc(struct bnxt *bp, unsigned int idx)
 	struct hwrm_ring_grp_alloc_input req = {.req_type = 0 };
 	struct hwrm_ring_grp_alloc_output *resp = bp->hwrm_cmd_resp_addr;
 
+	/* Don't attempt to re-create the ring group if it is already created */
+	if (bp->grp_info[idx].fw_grp_id != INVALID_HW_RING_ID)
+		return 0;
+
 	HWRM_PREP(&req, HWRM_RING_GRP_ALLOC, BNXT_USE_CHIMP_MB);
 
 	req.cr = rte_cpu_to_le_16(bp->grp_info[idx].cp_fw_ring_id);