From 4ab48e8241e67f691b210d83029a339efa7ff344 Mon Sep 17 00:00:00 2001 From: Lance Richardson Date: Thu, 18 Jul 2019 09:06:09 +0530 Subject: [PATCH] net/bnxt: fix RSS table sizes RSS table size is variable with BCM57500-based adapters. Use correct size when allocating memory for RSS state. Fixes: 38412304b50a ("net/bnxt: enable RSS for thor-based controllers") Signed-off-by: Lance Richardson Reviewed-by: Ajit Khaparde Reviewed-by: Somnath Kotur --- drivers/net/bnxt/bnxt_vnic.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/drivers/net/bnxt/bnxt_vnic.c b/drivers/net/bnxt/bnxt_vnic.c index c652b8f03e..98415633e4 100644 --- a/drivers/net/bnxt/bnxt_vnic.c +++ b/drivers/net/bnxt/bnxt_vnic.c @@ -117,6 +117,7 @@ int bnxt_alloc_vnic_attributes(struct bnxt *bp) const struct rte_memzone *mz; char mz_name[RTE_MEMZONE_NAMESIZE]; uint32_t entry_length; + size_t rss_table_size; uint16_t max_vnics; int i; rte_iova_t mz_phys_addr; @@ -125,11 +126,12 @@ int bnxt_alloc_vnic_attributes(struct bnxt *bp) BNXT_MAX_MC_ADDRS * RTE_ETHER_ADDR_LEN; if (BNXT_CHIP_THOR(bp)) - entry_length += BNXT_RSS_TBL_SIZE_THOR * - 2 * sizeof(*vnic->rss_table); + rss_table_size = BNXT_RSS_TBL_SIZE_THOR * + 2 * sizeof(*vnic->rss_table); else - entry_length += HW_HASH_INDEX_SIZE * sizeof(*vnic->rss_table); - entry_length = RTE_CACHE_LINE_ROUNDUP(entry_length); + rss_table_size = HW_HASH_INDEX_SIZE * sizeof(*vnic->rss_table); + + entry_length = RTE_CACHE_LINE_ROUNDUP(entry_length + rss_table_size); max_vnics = bp->max_vnics; snprintf(mz_name, RTE_MEMZONE_NAMESIZE, @@ -170,10 +172,10 @@ int bnxt_alloc_vnic_attributes(struct bnxt *bp) vnic->rss_table_dma_addr = mz_phys_addr + (entry_length * i); vnic->rss_hash_key = (void *)((char *)vnic->rss_table + - HW_HASH_INDEX_SIZE * sizeof(*vnic->rss_table)); + rss_table_size); vnic->rss_hash_key_dma_addr = vnic->rss_table_dma_addr + - HW_HASH_INDEX_SIZE * sizeof(*vnic->rss_table); + rss_table_size; vnic->mc_list = (void *)((char *)vnic->rss_hash_key + HW_HASH_KEY_SIZE); vnic->mc_list_dma_addr = vnic->rss_hash_key_dma_addr + -- 2.20.1