From: Kishore Padmanabha <[email protected]> The number of max vfs per pf is 128 for thor2. Fixed the vnic hash table creation if the number of max vnics is less than 8.
Signed-off-by: Kishore Padmanabha <[email protected]> Reviewed-by: Ajit Khaparde <[email protected]> --- drivers/net/bnxt/bnxt.h | 2 ++ drivers/net/bnxt/bnxt_vnic.c | 11 +++++++++++ 2 files changed, 13 insertions(+) diff --git a/drivers/net/bnxt/bnxt.h b/drivers/net/bnxt/bnxt.h index 00bdb53215..90352d537c 100644 --- a/drivers/net/bnxt/bnxt.h +++ b/drivers/net/bnxt/bnxt.h @@ -260,8 +260,10 @@ struct bnxt_pf_info { #define BNXT_MAX_VFS(bp) ((bp)->pf->max_vfs) #define BNXT_MAX_VF_REPS_P4 64 #define BNXT_MAX_VF_REPS_P5 256 +#define BNXT_MAX_VF_REPS_P7 128 #define BNXT_MAX_VF_REPS(bp) \ (BNXT_CHIP_P5(bp) ? BNXT_MAX_VF_REPS_P5 : \ + BNXT_CHIP_P7(bp) ? BNXT_MAX_VF_REPS_P7 : \ BNXT_MAX_VF_REPS_P4) #define BNXT_TOTAL_VFS(bp) ((bp)->pf->total_vfs) #define BNXT_FIRST_VF_FID 128 diff --git a/drivers/net/bnxt/bnxt_vnic.c b/drivers/net/bnxt/bnxt_vnic.c index 7b028f2ee5..637e9b9aa4 100644 --- a/drivers/net/bnxt/bnxt_vnic.c +++ b/drivers/net/bnxt/bnxt_vnic.c @@ -16,6 +16,11 @@ #include "hsi_struct_def_dpdk.h" #include "bnxt_hwrm.h" +#ifndef RTE_HASH_BUCKET_ENTRIES +/* it is defined in lib/hash/rte_cuckoo_hash.h */ +#define RTE_HASH_BUCKET_ENTRIES 8 +#endif /* RTE_HASH_BUCKET_ENTRIES */ + /* Macros to manipulate vnic bitmaps*/ #define BNXT_VNIC_BITMAP_SIZE 64 #define BNXT_VNIC_BITMAP_SET(b, i) ((b[(i) / BNXT_VNIC_BITMAP_SIZE]) |= \ @@ -978,6 +983,12 @@ int32_t bnxt_vnic_queue_db_init(struct bnxt *bp) hash_tbl_params.name = hash_tbl_name; hash_tbl_params.entries = (bp->max_vnics > BNXT_VNIC_MAX_SUPPORTED_ID) ? BNXT_VNIC_MAX_SUPPORTED_ID : bp->max_vnics; + + /* if the number of max vnis is less than bucket size */ + /* then let the max entries size be the least value */ + if (hash_tbl_params.entries <= RTE_HASH_BUCKET_ENTRIES) + hash_tbl_params.entries = RTE_HASH_BUCKET_ENTRIES; + hash_tbl_params.key_len = BNXT_VNIC_MAX_QUEUE_SZ_IN_8BITS; hash_tbl_params.socket_id = rte_socket_id(); bp->vnic_queue_db.rss_q_db = rte_hash_create(&hash_tbl_params); -- 2.39.5 (Apple Git-154)

