net/thunderx: fix memory alloc issue when changing ring size
[dpdk.git] / drivers / net / thunderx / nicvf_ethdev.c
index 68a72e4..4f875c0 100644 (file)
@@ -492,7 +492,7 @@ nicvf_qset_cq_alloc(struct nicvf *nic, struct nicvf_rxq *rxq, uint16_t qidx,
                    uint32_t desc_cnt)
 {
        const struct rte_memzone *rz;
-       uint32_t ring_size = desc_cnt * sizeof(union cq_entry_t);
+       uint32_t ring_size = CMP_QUEUE_SZ_MAX * sizeof(union cq_entry_t);
 
        rz = rte_eth_dma_zone_reserve(nic->eth_dev, "cq_ring", qidx, ring_size,
                                        NICVF_CQ_BASE_ALIGN_BYTES, nic->node);
@@ -515,7 +515,7 @@ nicvf_qset_sq_alloc(struct nicvf *nic,  struct nicvf_txq *sq, uint16_t qidx,
                    uint32_t desc_cnt)
 {
        const struct rte_memzone *rz;
-       uint32_t ring_size = desc_cnt * sizeof(union sq_entry_t);
+       uint32_t ring_size = SND_QUEUE_SZ_MAX * sizeof(union sq_entry_t);
 
        rz = rte_eth_dma_zone_reserve(nic->eth_dev, "sq", qidx, ring_size,
                                NICVF_SQ_BASE_ALIGN_BYTES, nic->node);
@@ -548,7 +548,7 @@ nicvf_qset_rbdr_alloc(struct nicvf *nic, uint32_t desc_cnt, uint32_t buffsz)
                return -ENOMEM;
        }
 
-       ring_size = sizeof(struct rbdr_entry_t) * desc_cnt;
+       ring_size = sizeof(struct rbdr_entry_t) * RBDR_QUEUE_SZ_MAX;
        rz = rte_eth_dma_zone_reserve(nic->eth_dev, "rbdr", 0, ring_size,
                                   NICVF_RBDR_BASE_ALIGN_BYTES, nic->node);
        if (rz == NULL) {