[06/14] net/bnxt: add support for p7 device family

Message ID 20231204183710.86921-7-ajit.khaparde@broadcom.com (mailing list archive)
State Superseded
Delegated to: Ajit Khaparde
Headers
Series support new 5760X P7 devices |

Checks

Context Check Description
ci/checkpatch warning coding style issues

Commit Message

Ajit Khaparde Dec. 4, 2023, 6:37 p.m. UTC
  Add support for the P7 device family.

Signed-off-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
---
 drivers/net/bnxt/bnxt.h        | 14 ++++++++++++--
 drivers/net/bnxt/bnxt_ethdev.c | 25 +++++++++++++++++++++++++
 2 files changed, 37 insertions(+), 2 deletions(-)
  

Patch

diff --git a/drivers/net/bnxt/bnxt.h b/drivers/net/bnxt/bnxt.h
index 6af668e92f..3a1d8a6ff6 100644
--- a/drivers/net/bnxt/bnxt.h
+++ b/drivers/net/bnxt/bnxt.h
@@ -72,6 +72,11 @@ 
 #define BROADCOM_DEV_ID_58814		0xd814
 #define BROADCOM_DEV_ID_58818		0xd818
 #define BROADCOM_DEV_ID_58818_VF	0xd82e
+#define BROADCOM_DEV_ID_57608		0x1760
+#define BROADCOM_DEV_ID_57604		0x1761
+#define BROADCOM_DEV_ID_57602		0x1762
+#define BROADCOM_DEV_ID_57601		0x1763
+#define BROADCOM_DEV_ID_5760X_VF	0x1819
 
 #define BROADCOM_DEV_957508_N2100	0x5208
 #define BROADCOM_DEV_957414_N225	0x4145
@@ -685,6 +690,7 @@  struct bnxt {
 #define BNXT_FLAG_FLOW_XSTATS_EN		BIT(25)
 #define BNXT_FLAG_DFLT_MAC_SET			BIT(26)
 #define BNXT_FLAG_GFID_ENABLE			BIT(27)
+#define BNXT_FLAG_CHIP_P7			BIT(30)
 #define BNXT_PF(bp)		(!((bp)->flags & BNXT_FLAG_VF))
 #define BNXT_VF(bp)		((bp)->flags & BNXT_FLAG_VF)
 #define BNXT_NPAR(bp)		((bp)->flags & BNXT_FLAG_NPAR_PF)
@@ -694,12 +700,16 @@  struct bnxt {
 #define BNXT_USE_KONG(bp)	((bp)->flags & BNXT_FLAG_KONG_MB_EN)
 #define BNXT_VF_IS_TRUSTED(bp)	((bp)->flags & BNXT_FLAG_TRUSTED_VF_EN)
 #define BNXT_CHIP_P5(bp)	((bp)->flags & BNXT_FLAG_CHIP_P5)
+#define BNXT_CHIP_P7(bp)	((bp)->flags & BNXT_FLAG_CHIP_P7)
+#define BNXT_CHIP_P5_P7(bp)	(BNXT_CHIP_P5(bp) || BNXT_CHIP_P7(bp))
 #define BNXT_STINGRAY(bp)	((bp)->flags & BNXT_FLAG_STINGRAY)
-#define BNXT_HAS_NQ(bp)		BNXT_CHIP_P5(bp)
-#define BNXT_HAS_RING_GRPS(bp)	(!BNXT_CHIP_P5(bp))
+#define BNXT_HAS_NQ(bp)		BNXT_CHIP_P5_P7(bp)
+#define BNXT_HAS_RING_GRPS(bp)	(!BNXT_CHIP_P5_P7(bp))
 #define BNXT_FLOW_XSTATS_EN(bp)	((bp)->flags & BNXT_FLAG_FLOW_XSTATS_EN)
 #define BNXT_HAS_DFLT_MAC_SET(bp)	((bp)->flags & BNXT_FLAG_DFLT_MAC_SET)
 #define BNXT_GFID_ENABLED(bp)	((bp)->flags & BNXT_FLAG_GFID_ENABLE)
+#define BNXT_P7_MAX_NQ_RING_CNT	512
+#define BNXT_P7_CQ_MAX_L2_ENT	8192
 
 	uint32_t			flags2;
 #define BNXT_FLAGS2_PTP_TIMESYNC_ENABLED	BIT(0)
diff --git a/drivers/net/bnxt/bnxt_ethdev.c b/drivers/net/bnxt/bnxt_ethdev.c
index 999e4f1398..1e4182071a 100644
--- a/drivers/net/bnxt/bnxt_ethdev.c
+++ b/drivers/net/bnxt/bnxt_ethdev.c
@@ -84,6 +84,11 @@  static const struct rte_pci_id bnxt_pci_id_map[] = {
 	{ RTE_PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, BROADCOM_DEV_ID_58814) },
 	{ RTE_PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, BROADCOM_DEV_ID_58818) },
 	{ RTE_PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, BROADCOM_DEV_ID_58818_VF) },
+	{ RTE_PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, BROADCOM_DEV_ID_57608) },
+	{ RTE_PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, BROADCOM_DEV_ID_57604) },
+	{ RTE_PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, BROADCOM_DEV_ID_57602) },
+	{ RTE_PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, BROADCOM_DEV_ID_57601) },
+	{ RTE_PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, BROADCOM_DEV_ID_5760X_VF) },
 	{ .vendor_id = 0, /* sentinel */ },
 };
 
@@ -4681,6 +4686,7 @@  static bool bnxt_vf_pciid(uint16_t device_id)
 	case BROADCOM_DEV_ID_57500_VF1:
 	case BROADCOM_DEV_ID_57500_VF2:
 	case BROADCOM_DEV_ID_58818_VF:
+	case BROADCOM_DEV_ID_5760X_VF:
 		/* FALLTHROUGH */
 		return true;
 	default:
@@ -4706,7 +4712,23 @@  static bool bnxt_p5_device(uint16_t device_id)
 	case BROADCOM_DEV_ID_58812:
 	case BROADCOM_DEV_ID_58814:
 	case BROADCOM_DEV_ID_58818:
+		/* FALLTHROUGH */
+		return true;
+	default:
+		return false;
+	}
+}
+
+/* Phase 7 device */
+static bool bnxt_p7_device(uint16_t device_id)
+{
+	switch (device_id) {
 	case BROADCOM_DEV_ID_58818_VF:
+	case BROADCOM_DEV_ID_57608:
+	case BROADCOM_DEV_ID_57604:
+	case BROADCOM_DEV_ID_57602:
+	case BROADCOM_DEV_ID_57601:
+	case BROADCOM_DEV_ID_5760X_VF:
 		/* FALLTHROUGH */
 		return true;
 	default:
@@ -5874,6 +5896,9 @@  static int bnxt_drv_init(struct rte_eth_dev *eth_dev)
 	if (bnxt_p5_device(pci_dev->id.device_id))
 		bp->flags |= BNXT_FLAG_CHIP_P5;
 
+	if (bnxt_p7_device(pci_dev->id.device_id))
+		bp->flags |= BNXT_FLAG_CHIP_P7;
+
 	if (pci_dev->id.device_id == BROADCOM_DEV_ID_58802 ||
 	    pci_dev->id.device_id == BROADCOM_DEV_ID_58804 ||
 	    pci_dev->id.device_id == BROADCOM_DEV_ID_58808 ||