From: Shahaji Bhosle <sbho...@broadcom.com>

* Updated defines and data types to allow 256 VFRs.
* Increased the encap record cache to support 256 to 4K entries. So
  vxlan connections can be scaled to 4k entries.

Signed-off-by: Shahaji Bhosle <sbho...@broadcom.com>
Signed-off-by: Kishore Padmanabha <kishore.padmana...@broadcom.com>
Signed-off-by: Venkat Duvvuru <venkatkumar.duvv...@broadcom.com>
Reviewed-by: Kishore Padmanabha <kishore.padmana...@broadcom.com>
Reviewed-by: Randy Schacher <stuart.schac...@broadcom.com>
---
 drivers/net/bnxt/bnxt.h                        |  6 +++++-
 drivers/net/bnxt/bnxt_cpr.c                    |  2 +-
 drivers/net/bnxt/bnxt_ethdev.c                 | 18 +++++++++---------
 drivers/net/bnxt/bnxt_reps.c                   |  3 +--
 drivers/net/bnxt/tf_ulp/bnxt_ulp.h             |  2 +-
 .../generic_templates/ulp_template_db_tbl.c    |  8 ++++----
 drivers/net/bnxt/tf_ulp/ulp_def_rules.c        |  6 +++---
 7 files changed, 24 insertions(+), 21 deletions(-)

diff --git a/drivers/net/bnxt/bnxt.h b/drivers/net/bnxt/bnxt.h
index 9bf6697006..0209bb5c39 100644
--- a/drivers/net/bnxt/bnxt.h
+++ b/drivers/net/bnxt/bnxt.h
@@ -240,7 +240,11 @@ struct bnxt_parent_info {
 struct bnxt_pf_info {
 #define BNXT_FIRST_PF_FID      1
 #define BNXT_MAX_VFS(bp)       ((bp)->pf->max_vfs)
-#define BNXT_MAX_VF_REPS       64
+#define BNXT_MAX_VF_REPS_WH     64
+#define BNXT_MAX_VF_REPS_TH     256
+#define BNXT_MAX_VF_REPS(bp) \
+                               (BNXT_CHIP_P5(bp) ? BNXT_MAX_VF_REPS_TH : \
+                               BNXT_MAX_VF_REPS_WH)
 #define BNXT_TOTAL_VFS(bp)     ((bp)->pf->total_vfs)
 #define BNXT_FIRST_VF_FID      128
 #define BNXT_PF_RINGS_USED(bp) bnxt_get_num_queues(bp)
diff --git a/drivers/net/bnxt/bnxt_cpr.c b/drivers/net/bnxt/bnxt_cpr.c
index 63ff02a198..6bb70d516e 100644
--- a/drivers/net/bnxt/bnxt_cpr.c
+++ b/drivers/net/bnxt/bnxt_cpr.c
@@ -74,7 +74,7 @@ bnxt_process_default_vnic_change(struct bnxt *bp,
                        BNXT_DEFAULT_VNIC_CHANGE_VF_ID_SFT;
        PMD_DRV_LOG(INFO, "async event received vf_id 0x%x\n", vf_fid);
 
-       for (vf_id = 0; vf_id < BNXT_MAX_VF_REPS; vf_id++) {
+       for (vf_id = 0; vf_id < BNXT_MAX_VF_REPS(bp); vf_id++) {
                eth_dev = bp->rep_info[vf_id].vfr_eth_dev;
                if (!eth_dev)
                        continue;
diff --git a/drivers/net/bnxt/bnxt_ethdev.c b/drivers/net/bnxt/bnxt_ethdev.c
index 63d764f968..034f4cdcaa 100644
--- a/drivers/net/bnxt/bnxt_ethdev.c
+++ b/drivers/net/bnxt/bnxt_ethdev.c
@@ -1185,7 +1185,7 @@ void bnxt_print_link_info(struct rte_eth_dev *eth_dev)
        struct rte_eth_link *link = &eth_dev->data->dev_link;
 
        if (link->link_status)
-               PMD_DRV_LOG(INFO, "Port %d Link Up - speed %u Mbps - %s\n",
+               PMD_DRV_LOG(DEBUG, "Port %d Link Up - speed %u Mbps - %s\n",
                        eth_dev->data->port_id,
                        (uint32_t)link->link_speed,
                        (link->link_duplex == ETH_LINK_FULL_DUPLEX) ?
@@ -6046,7 +6046,7 @@ static int bnxt_init_rep_info(struct bnxt *bp)
                return 0;
 
        bp->rep_info = rte_zmalloc("bnxt_rep_info",
-                                  sizeof(bp->rep_info[0]) * BNXT_MAX_VF_REPS,
+                                  sizeof(bp->rep_info[0]) * 
BNXT_MAX_VF_REPS(bp),
                                   0);
        if (!bp->rep_info) {
                PMD_DRV_LOG(ERR, "Failed to alloc memory for rep info\n");
@@ -6088,7 +6088,9 @@ static int bnxt_rep_port_probe(struct rte_pci_device 
*pci_dev,
 {
        struct rte_eth_dev *vf_rep_eth_dev;
        char name[RTE_ETH_NAME_MAX_LEN];
-       struct bnxt *backing_bp;
+       struct bnxt *backing_bp = backing_eth_dev->data->dev_private;
+       uint16_t max_vf_reps = BNXT_MAX_VF_REPS(backing_bp);
+
        uint16_t num_rep;
        int i, ret = 0;
        struct rte_kvargs *kvlist = NULL;
@@ -6101,9 +6103,9 @@ static int bnxt_rep_port_probe(struct rte_pci_device 
*pci_dev,
                return -ENOTSUP;
        }
        num_rep = eth_da->nb_representor_ports;
-       if (num_rep > BNXT_MAX_VF_REPS) {
+       if (num_rep > max_vf_reps) {
                PMD_DRV_LOG(ERR, "nb_representor_ports = %d > %d MAX VF REPS\n",
-                           num_rep, BNXT_MAX_VF_REPS);
+                           num_rep, max_vf_reps);
                return -EINVAL;
        }
 
@@ -6114,8 +6116,6 @@ static int bnxt_rep_port_probe(struct rte_pci_device 
*pci_dev,
                return -EINVAL;
        }
 
-       backing_bp = backing_eth_dev->data->dev_private;
-
        if (!(BNXT_PF(backing_bp) || BNXT_VF_IS_TRUSTED(backing_bp))) {
                PMD_DRV_LOG(ERR,
                            "Not a PF or trusted VF. No Representor support\n");
@@ -6135,9 +6135,9 @@ static int bnxt_rep_port_probe(struct rte_pci_device 
*pci_dev,
                        .parent_dev = backing_eth_dev
                };
 
-               if (representor.vf_id >= BNXT_MAX_VF_REPS) {
+               if (representor.vf_id >= max_vf_reps) {
                        PMD_DRV_LOG(ERR, "VF-Rep id %d >= %d MAX VF ID\n",
-                                   representor.vf_id, BNXT_MAX_VF_REPS);
+                                   representor.vf_id, max_vf_reps);
                        continue;
                }
 
diff --git a/drivers/net/bnxt/bnxt_reps.c b/drivers/net/bnxt/bnxt_reps.c
index bdbad53b7d..0feefe156c 100644
--- a/drivers/net/bnxt/bnxt_reps.c
+++ b/drivers/net/bnxt/bnxt_reps.c
@@ -209,7 +209,6 @@ int bnxt_representor_init(struct rte_eth_dev *eth_dev, void 
*params)
        eth_dev->data->dev_link.link_status = link->link_status;
        eth_dev->data->dev_link.link_autoneg = link->link_autoneg;
 
-       PMD_DRV_LOG(INFO, "calling bnxt_print_link_info\n");
        bnxt_print_link_info(eth_dev);
 
        PMD_DRV_LOG(INFO,
@@ -818,7 +817,7 @@ int bnxt_rep_stop_all(struct bnxt *bp)
        if (!bp->rep_info)
                return 0;
 
-       for (vf_id = 0; vf_id < BNXT_MAX_VF_REPS; vf_id++) {
+       for (vf_id = 0; vf_id < BNXT_MAX_VF_REPS(bp); vf_id++) {
                rep_eth_dev = bp->rep_info[vf_id].vfr_eth_dev;
                if (!rep_eth_dev)
                        continue;
diff --git a/drivers/net/bnxt/tf_ulp/bnxt_ulp.h 
b/drivers/net/bnxt/tf_ulp/bnxt_ulp.h
index 68f1470c61..960a5a0c93 100644
--- a/drivers/net/bnxt/tf_ulp/bnxt_ulp.h
+++ b/drivers/net/bnxt/tf_ulp/bnxt_ulp.h
@@ -262,7 +262,7 @@ bnxt_ulp_cntxt_ptr2_ulp_flags_get(struct bnxt_ulp_context 
*ulp_ctx,
                                  uint32_t *flags);
 
 int32_t
-bnxt_ulp_get_df_rule_info(uint8_t port_id, struct bnxt_ulp_context *ulp_ctx,
+bnxt_ulp_get_df_rule_info(uint16_t port_id, struct bnxt_ulp_context *ulp_ctx,
                          struct bnxt_ulp_df_rule_info *info);
 
 struct bnxt_ulp_vfr_rule_info*
diff --git a/drivers/net/bnxt/tf_ulp/generic_templates/ulp_template_db_tbl.c 
b/drivers/net/bnxt/tf_ulp/generic_templates/ulp_template_db_tbl.c
index 5383e2cd70..e43e341927 100644
--- a/drivers/net/bnxt/tf_ulp/generic_templates/ulp_template_db_tbl.c
+++ b/drivers/net/bnxt/tf_ulp/generic_templates/ulp_template_db_tbl.c
@@ -3,7 +3,7 @@
  * All rights reserved.
  */
 
-/* date: Thu Sep  9 11:11:05 2021 */
+/* date: Thu Sep 16 11:49:55 2021 */
 
 #include "ulp_template_db_enum.h"
 #include "ulp_template_db_field.h"
@@ -164,12 +164,12 @@ struct bnxt_ulp_generic_tbl_params 
ulp_generic_tbl_params[] = {
        },
        [BNXT_ULP_RESOURCE_SUB_TYPE_GENERIC_TABLE_VXLAN_ENCAP_REC_CACHE << 1 |
                BNXT_ULP_DIRECTION_EGRESS] = {
-       .name                    = "INGRESS GEN_TABLE_VXLAN_ENCAP_REC_CACHE",
-       .result_num_entries      = 256,
+       .name                    = "EGRESS GEN_TABLE_VXLAN_ENCAP_REC_CACHE",
+       .result_num_entries      = 4096,
        .result_num_bytes        = 6,
        .key_num_bytes           = 17,
        .num_buckets             = 8,
-       .hash_tbl_entries        = 1024,
+       .hash_tbl_entries        = 16384,
        .result_byte_order       = BNXT_ULP_BYTE_ORDER_LE
        }
 };
diff --git a/drivers/net/bnxt/tf_ulp/ulp_def_rules.c 
b/drivers/net/bnxt/tf_ulp/ulp_def_rules.c
index d8336d164e..01233c0f5e 100644
--- a/drivers/net/bnxt/tf_ulp/ulp_def_rules.c
+++ b/drivers/net/bnxt/tf_ulp/ulp_def_rules.c
@@ -441,7 +441,7 @@ void
 bnxt_ulp_destroy_df_rules(struct bnxt *bp, bool global)
 {
        struct bnxt_ulp_df_rule_info *info;
-       uint8_t port_id;
+       uint16_t port_id;
 
        if (!BNXT_TRUFLOW_EN(bp) ||
            BNXT_ETH_DEV_IS_REPRESENTOR(bp->eth_dev))
@@ -505,7 +505,7 @@ int32_t
 bnxt_ulp_create_df_rules(struct bnxt *bp)
 {
        struct bnxt_ulp_df_rule_info *info;
-       uint8_t port_id;
+       uint16_t port_id;
        int rc = 0;
 
        if (!BNXT_TRUFLOW_EN(bp) ||
@@ -562,7 +562,7 @@ bnxt_ulp_create_vfr_default_rules(struct rte_eth_dev 
*vfr_ethdev)
        struct rte_eth_dev *parent_dev = vfr->parent_dev;
        struct bnxt *bp = parent_dev->data->dev_private;
        uint16_t vfr_port_id = vfr_ethdev->data->port_id;
-       uint8_t port_id;
+       uint16_t port_id;
        int rc;
 
        if (!bp || !BNXT_TRUFLOW_EN(bp))
-- 
2.17.1

Reply via email to