bnxt_en: Set up the chip specific RSS table size.
authorMichael Chan <michael.chan@broadcom.com>
Wed, 8 Jul 2020 11:53:53 +0000 (07:53 -0400)
committerDavid S. Miller <davem@davemloft.net>
Wed, 8 Jul 2020 22:21:13 +0000 (15:21 -0700)
Currently, we allocate one page for the hardware DMA RSS indirection
table.  While the size is currently big enough for all chips, future
chip variations may support bigger sizes, so it is better to calculate
and store the chip specific size and allocate accordingly.

Signed-off-by: Michael Chan <michael.chan@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/broadcom/bnxt/bnxt.c
drivers/net/ethernet/broadcom/bnxt/bnxt.h

index 6a884df44612aa4b0779e7d9747990b48e71d563..4afc1df7412906a805eb48741f4e79b10a9d8351 100644 (file)
@@ -3538,7 +3538,7 @@ static void bnxt_free_vnic_attributes(struct bnxt *bp)
                }
 
                if (vnic->rss_table) {
-                       dma_free_coherent(&pdev->dev, PAGE_SIZE,
+                       dma_free_coherent(&pdev->dev, vnic->rss_table_size,
                                          vnic->rss_table,
                                          vnic->rss_table_dma_addr);
                        vnic->rss_table = NULL;
@@ -3603,7 +3603,13 @@ vnic_skip_grps:
                        continue;
 
                /* Allocate rss table and hash key */
-               vnic->rss_table = dma_alloc_coherent(&pdev->dev, PAGE_SIZE,
+               size = L1_CACHE_ALIGN(HW_HASH_INDEX_SIZE * sizeof(u16));
+               if (bp->flags & BNXT_FLAG_CHIP_P5)
+                       size = L1_CACHE_ALIGN(BNXT_MAX_RSS_TABLE_SIZE_P5);
+
+               vnic->rss_table_size = size + HW_HASH_KEY_SIZE;
+               vnic->rss_table = dma_alloc_coherent(&pdev->dev,
+                                                    vnic->rss_table_size,
                                                     &vnic->rss_table_dma_addr,
                                                     GFP_KERNEL);
                if (!vnic->rss_table) {
@@ -3611,8 +3617,6 @@ vnic_skip_grps:
                        goto out;
                }
 
-               size = L1_CACHE_ALIGN(HW_HASH_INDEX_SIZE * sizeof(u16));
-
                vnic->rss_hash_key = ((void *)vnic->rss_table) + size;
                vnic->rss_hash_key_dma_addr = vnic->rss_table_dma_addr + size;
        }
index 78e2fd63ac3d565aad90e761ebc003d1c4f6a2f0..5883b2462db262d34b00eaf3988d4eba149dcb6c 100644 (file)
@@ -1017,6 +1017,13 @@ struct bnxt_vnic_info {
        __le16          *rss_table;
        dma_addr_t      rss_hash_key_dma_addr;
        u64             *rss_hash_key;
+       int             rss_table_size;
+#define BNXT_RSS_TABLE_ENTRIES_P5      64
+#define BNXT_RSS_TABLE_SIZE_P5         (BNXT_RSS_TABLE_ENTRIES_P5 * 4)
+#define BNXT_RSS_TABLE_MAX_TBL_P5      8
+#define BNXT_MAX_RSS_TABLE_SIZE_P5                             \
+       (BNXT_RSS_TABLE_SIZE_P5 * BNXT_RSS_TABLE_MAX_TBL_P5)
+
        u32             rx_mask;
 
        u8              *mc_list;