net/bnxt: fix structure variable initialization
authorKalesh AP <kalesh-anakkur.purayil@broadcom.com>
Fri, 28 Aug 2020 05:01:09 +0000 (10:31 +0530)
committerFerruh Yigit <ferruh.yigit@intel.com>
Fri, 18 Sep 2020 16:55:07 +0000 (18:55 +0200)
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 <kalesh-anakkur.purayil@broadcom.com>
Reviewed-by: Lance Richardson <lance.richardson@broadcom.com>
Reviewed-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
drivers/net/bnxt/bnxt_ring.c
drivers/net/bnxt/bnxt_rxr.c
drivers/net/bnxt/bnxt_txr.c

index 54f6547..8f2296b 100644 (file)
@@ -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");
index 43b1256..b086898 100644 (file)
@@ -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;
 }
index c7a2de6..2068331 100644 (file)
@@ -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;
 }