From: Kalesh AP Date: Fri, 28 Aug 2020 05:01:09 +0000 (+0530) Subject: net/bnxt: fix structure variable initialization X-Git-Url: http://git.droids-corp.org/?a=commitdiff_plain;h=ce41561d1b998d9e15f74f9c3a6aff78e0f99871;p=dpdk.git net/bnxt: fix structure variable initialization During port start if bnxt_alloc_all_hwrm_stat_ctxs() fails, in the cleanup path we do see errors like below: bnxt_hwrm_ring_free(): hwrm_ring_free cp failed. rc:2 bnxt_hwrm_ring_free(): hwrm_ring_free rx failed. rc:2 The reason for this is in bnxt_free_all_hwrm_rings(), the check is made against "ring->fw_ring_id != INVALID_HW_RING_ID" which always return true as ring->fw_ring_id is not set to INVALID_HW_RING_ID while initialising the ring structs. Fixes: 6eb3cc2294fd ("net/bnxt: add initial Tx code") Fixes: 2eb53b134aae ("net/bnxt: add initial Rx code") Cc: stable@dpdk.org Signed-off-by: Kalesh AP Reviewed-by: Lance Richardson Reviewed-by: Ajit Khaparde --- diff --git a/drivers/net/bnxt/bnxt_ring.c b/drivers/net/bnxt/bnxt_ring.c index 54f6547442..8f2296b293 100644 --- a/drivers/net/bnxt/bnxt_ring.c +++ b/drivers/net/bnxt/bnxt_ring.c @@ -451,6 +451,7 @@ int bnxt_alloc_rxtx_nq_ring(struct bnxt *bp) ring->ring_mask = ring->ring_size - 1; ring->vmem_size = 0; ring->vmem = NULL; + ring->fw_ring_id = INVALID_HW_RING_ID; nqr->cp_ring_struct = ring; rc = bnxt_alloc_rings(bp, 0, NULL, NULL, nqr, NULL, "l2_nqr"); diff --git a/drivers/net/bnxt/bnxt_rxr.c b/drivers/net/bnxt/bnxt_rxr.c index 43b1256dcc..b086898148 100644 --- a/drivers/net/bnxt/bnxt_rxr.c +++ b/drivers/net/bnxt/bnxt_rxr.c @@ -962,6 +962,7 @@ int bnxt_init_rx_ring_struct(struct bnxt_rx_queue *rxq, unsigned int socket_id) ring->bd_dma = rxr->rx_desc_mapping; ring->vmem_size = ring->ring_size * sizeof(struct bnxt_sw_rx_bd); ring->vmem = (void **)&rxr->rx_buf_ring; + ring->fw_ring_id = INVALID_HW_RING_ID; cpr = rte_zmalloc_socket("bnxt_rx_ring", sizeof(struct bnxt_cp_ring_info), @@ -983,6 +984,7 @@ int bnxt_init_rx_ring_struct(struct bnxt_rx_queue *rxq, unsigned int socket_id) ring->bd_dma = cpr->cp_desc_mapping; ring->vmem_size = 0; ring->vmem = NULL; + ring->fw_ring_id = INVALID_HW_RING_ID; /* Allocate Aggregator rings */ ring = rte_zmalloc_socket("bnxt_rx_ring_struct", @@ -998,6 +1000,7 @@ int bnxt_init_rx_ring_struct(struct bnxt_rx_queue *rxq, unsigned int socket_id) ring->bd_dma = rxr->ag_desc_mapping; ring->vmem_size = ring->ring_size * sizeof(struct bnxt_sw_rx_bd); ring->vmem = (void **)&rxr->ag_buf_ring; + ring->fw_ring_id = INVALID_HW_RING_ID; return 0; } diff --git a/drivers/net/bnxt/bnxt_txr.c b/drivers/net/bnxt/bnxt_txr.c index c7a2de67c7..20683315ed 100644 --- a/drivers/net/bnxt/bnxt_txr.c +++ b/drivers/net/bnxt/bnxt_txr.c @@ -78,6 +78,7 @@ int bnxt_init_tx_ring_struct(struct bnxt_tx_queue *txq, unsigned int socket_id) ring->bd_dma = txr->tx_desc_mapping; ring->vmem_size = ring->ring_size * sizeof(struct bnxt_sw_tx_bd); ring->vmem = (void **)&txr->tx_buf_ring; + ring->fw_ring_id = INVALID_HW_RING_ID; cpr = rte_zmalloc_socket("bnxt_tx_ring", sizeof(struct bnxt_cp_ring_info), @@ -98,6 +99,7 @@ int bnxt_init_tx_ring_struct(struct bnxt_tx_queue *txq, unsigned int socket_id) ring->bd_dma = cpr->cp_desc_mapping; ring->vmem_size = 0; ring->vmem = NULL; + ring->fw_ring_id = INVALID_HW_RING_ID; return 0; }