From 06ccbd73937af4bf0e48e5f5eb463a407198237f Mon Sep 17 00:00:00 2001 From: Kalesh AP Date: Wed, 1 Sep 2021 09:30:01 +0530 Subject: [PATCH] net/bnxt: fix double allocation of ring groups [ upstream commit 36a97cd23fc916ac475a0b827074b5645fff0cfe ] 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: 9b63c6fd70e3 ("net/bnxt: support Rx/Tx queue start/stop") Signed-off-by: Kalesh AP Reviewed-by: Ajit Khaparde Reviewed-by: Lance Richardson --- 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 9904d5117f..6e7e3117b9 100644 --- a/drivers/net/bnxt/bnxt_hwrm.c +++ b/drivers/net/bnxt/bnxt_hwrm.c @@ -1562,6 +1562,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, RING_GRP_ALLOC, BNXT_USE_CHIMP_MB); req.cr = rte_cpu_to_le_16(bp->grp_info[idx].cp_fw_ring_id);