Skip to contentSkip to conversation

support new 5760X P7 devices

PATCH New Ajit Khaparde 1 participant 15 messages Dec 11, 2023 Network drivers

lore
Share & tools
lore
#0 lore raw

v3 cover support new 5760X P7 devices

While some of the patches refactor and improve existing code, this series adds support for the new 5760X P7 device family. Follow-on patches will incrementally add more functionality.

v1->v2:
- Fixed unused variable error
- Fixed some spellings
- Code refactoring and fixes in backing store v2

v2->v3:
- Addressed review comments
- Fixed unused arg error

Ajit Khaparde (12):
net/bnxt: refactor epoch setting
net/bnxt: update HWRM API
net/bnxt: use the correct COS queue for Tx net/bnxt: refactor mem zone allocation net/bnxt: add support for p7 device family net/bnxt: refactor code to support P7 devices net/bnxt: fix array overflow
net/bnxt: add support for backing store v2 net/bnxt: modify sending new HWRM commands to firmware net/bnxt: retry HWRM ver get if the command fails net/bnxt: cap ring resources for P7 devices net/bnxt: add support for v3 Rx completion

Kalesh AP (1):
net/bnxt: log a message when multicast promisc mode changes

Kishore Padmanabha (1):
net/bnxt: refactor the ulp initialization

 drivers/net/bnxt/bnxt.h                |   97 +-
 drivers/net/bnxt/bnxt_cpr.h            |    5 +-
 drivers/net/bnxt/bnxt_ethdev.c         |  321 ++++-
 drivers/net/bnxt/bnxt_flow.c           |    2 +-
 drivers/net/bnxt/bnxt_hwrm.c           |  414 ++++++-
 drivers/net/bnxt/bnxt_hwrm.h           |   15 +
 drivers/net/bnxt/bnxt_ring.c           |   15 +-
 drivers/net/bnxt/bnxt_rxq.c            |    2 +-
 drivers/net/bnxt/bnxt_rxr.c            |   93 +-
 drivers/net/bnxt/bnxt_rxr.h            |   92 ++
 drivers/net/bnxt/bnxt_util.c           |   10 +
 drivers/net/bnxt/bnxt_util.h           |    1 +
 drivers/net/bnxt/bnxt_vnic.c           |   58 +-
 drivers/net/bnxt/bnxt_vnic.h           |    1 -
 drivers/net/bnxt/hsi_struct_def_dpdk.h | 1531 ++++++++++++++++++++++--
 15 files changed, 2407 insertions(+), 250 deletions(-)
Signature · 1 line
2.39.2 (Apple Git-143)
#1 lore raw

PATCH v3 1/14 net/bnxt: refactor epoch setting

Fix epoch bit setting when we ring the doorbell.
Epoch bit needs to toggle alternatively from 0 to 1 every time the ring indices wrap.
Currently its value is everything but an alternating 0 and 1.

Remove unnecessary field db_epoch_shift from
bnxt_db_info structure.

---
 drivers/net/bnxt/bnxt_cpr.h  | 5 ++---
 drivers/net/bnxt/bnxt_ring.c | 9 ++-------
 2 files changed, 4 insertions(+), 10 deletions(-)
drivers/net/bnxt/bnxt_cpr.h +2 -3
index 2de154322d..26e81a6a7e 100644
@@ -53,11 +53,10 @@ struct bnxt_db_info {
 	bool                    db_64;
 	uint32_t		db_ring_mask;
 	uint32_t		db_epoch_mask;
-	uint32_t		db_epoch_shift;
 };
 
-#define DB_EPOCH(db, idx)	(((idx) & (db)->db_epoch_mask) <<	\
-				 ((db)->db_epoch_shift))
+#define DB_EPOCH(db, idx)	(!!((idx) & (db)->db_epoch_mask) <<	\
+				 DBR_EPOCH_SFT)
 #define DB_RING_IDX(db, idx)	(((idx) & (db)->db_ring_mask) |		\
 				 DB_EPOCH(db, idx))
 
drivers/net/bnxt/bnxt_ring.c +2 -7
index 34b2510d54..6dacb1b37f 100644
@@ -371,9 +371,10 @@ static void bnxt_set_db(struct bnxt *bp,
 			db->db_key64 = DBR_PATH_L2;
 			break;
 		}
-		if (BNXT_CHIP_SR2(bp)) {
+		if (BNXT_CHIP_P7(bp)) {
 			db->db_key64 |= DBR_VALID;
 			db_offset = bp->legacy_db_size;
+			db->db_epoch_mask = ring_mask + 1;
 		} else if (BNXT_VF(bp)) {
 			db_offset = DB_VF_OFFSET;
 		}
@@ -397,12 +398,6 @@ static void bnxt_set_db(struct bnxt *bp,
 		db->db_64 = false;
 	}
 	db->db_ring_mask = ring_mask;
-
-	if (BNXT_CHIP_SR2(bp)) {
-		db->db_epoch_mask = db->db_ring_mask + 1;
-		db->db_epoch_shift = DBR_EPOCH_SFT -
-					rte_log2_u32(db->db_epoch_mask);
-	}
 }
 
 static int bnxt_alloc_cmpl_ring(struct bnxt *bp, int queue_index,
Signature · 1 line
2.39.2 (Apple Git-143)
#2 lore raw

PATCH v3 2/14 net/bnxt: update HWRM API

In reply to Ajit Khaparde

Update HWRM API to version 1.10.2.158

---
 drivers/net/bnxt/bnxt_hwrm.c           |    3 -
 drivers/net/bnxt/hsi_struct_def_dpdk.h | 1531 ++++++++++++++++++++++--
 2 files changed, 1429 insertions(+), 105 deletions(-)
drivers/net/bnxt/bnxt_hwrm.c +0 -3
index 06f196760f..0a31b984e6 100644
@@ -5175,9 +5175,6 @@ int bnxt_hwrm_set_ntuple_filter(struct bnxt *bp,
 	if (enables &
 	    HWRM_CFA_NTUPLE_FILTER_ALLOC_INPUT_ENABLES_DST_PORT_MASK)
 		req.dst_port_mask = rte_cpu_to_le_16(filter->dst_port_mask);
-	if (enables &
-	    HWRM_CFA_NTUPLE_FILTER_ALLOC_INPUT_ENABLES_MIRROR_VNIC_ID)
-		req.mirror_vnic_id = filter->mirror_vnic_id;
 
 	req.enables = rte_cpu_to_le_32(enables);
 
drivers/net/bnxt/hsi_struct_def_dpdk.h +1429 -102

1,959 lines not on this page · raw message

Signature · 1 line
2.39.2 (Apple Git-143)
#3 lore raw

PATCH v3 3/14 net/bnxt: log a message when multicast promisc mode changes

In reply to Ajit Khaparde

From: Kalesh AP <[email protected]>

When the user tries to add more number of Mcast MAC addresses than supported by the port, driver puts port into Mcast promiscuous mode. It may be useful to the user to know that Mcast promiscuous mode is turned on.

Similarly added a log when Mcast promiscuous mode is turned off.

---
 drivers/net/bnxt/bnxt_ethdev.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)
drivers/net/bnxt/bnxt_ethdev.c +7 -1
index acf7e6e46e..f398838ea8 100644
@@ -2931,12 +2931,18 @@ bnxt_dev_set_mc_addr_list_op(struct rte_eth_dev *eth_dev,
 	bp->nb_mc_addr = nb_mc_addr;
 
 	if (nb_mc_addr > BNXT_MAX_MC_ADDRS) {
+		PMD_DRV_LOG(INFO, "Number of Mcast MACs added (%u) exceeded Max supported (%u)\n",
+			    nb_mc_addr, BNXT_MAX_MC_ADDRS);
+		PMD_DRV_LOG(INFO, "Turning on Mcast promiscuous mode\n");
 		vnic->flags |= BNXT_VNIC_INFO_ALLMULTI;
 		goto allmulti;
 	}
 
 	/* TODO Check for Duplicate mcast addresses */
-	vnic->flags &= ~BNXT_VNIC_INFO_ALLMULTI;
+	if (vnic->flags & BNXT_VNIC_INFO_ALLMULTI) {
+		PMD_DRV_LOG(INFO, "Turning off Mcast promiscuous mode\n");
+		vnic->flags &= ~BNXT_VNIC_INFO_ALLMULTI;
+	}
 	for (i = 0; i < nb_mc_addr; i++)
 		rte_ether_addr_copy(&mc_addr_set[i], &bp->mcast_addr_list[i]);
 
Signature · 1 line
2.39.2 (Apple Git-143)
#4 lore raw

PATCH v3 4/14 net/bnxt: use the correct COS queue for Tx

In reply to Ajit Khaparde

Earlier the firmware was configuring single lossy COS profiles for Tx. But now more than one profiles is possible.
Identify the profile a NIC driver should use based on the profile type hint provided in queue_cfg_info.

If the firmware does not set the bit to use profile type, then we will use the older method to pick the COS queue for Tx.

---
 drivers/net/bnxt/bnxt.h      |  1 +
 drivers/net/bnxt/bnxt_hwrm.c | 56 ++++++++++++++++++++++++++++++++++--
 drivers/net/bnxt/bnxt_hwrm.h |  7 +++++
 3 files changed, 62 insertions(+), 2 deletions(-)
drivers/net/bnxt/bnxt.h +1 -0
index 0e01b1d4ba..542ef13f7c 100644
@@ -311,6 +311,7 @@ struct bnxt_link_info {
 struct bnxt_cos_queue_info {
 	uint8_t	id;
 	uint8_t	profile;
+	uint8_t	profile_type;
 };
 
 struct rte_flow {
drivers/net/bnxt/bnxt_hwrm.c +54 -2

100 lines not on this page · raw message

drivers/net/bnxt/bnxt_hwrm.h +7 -0
index 68384bc757..f9fa6cf73a 100644
@@ -46,6 +46,9 @@ struct hwrm_func_qstats_output;
 #define HWRM_QUEUE_SERVICE_PROFILE_UNKNOWN \
 	HWRM_QUEUE_QPORTCFG_OUTPUT_QUEUE_ID0_SERVICE_PROFILE_UNKNOWN
 
+#define HWRM_QUEUE_SERVICE_PROFILE_TYPE_NIC \
+	HWRM_QUEUE_QPORTCFG_OUTPUT_QUEUE_ID0_SERVICE_PROFILE_TYPE_NIC
+
 #define HWRM_FUNC_RESOURCE_QCAPS_OUTPUT_VF_RESV_STRATEGY_MINIMAL_STATIC \
 	HWRM_FUNC_RESOURCE_QCAPS_OUTPUT_VF_RESERVATION_STRATEGY_MINIMAL_STATIC
 #define HWRM_FUNC_RESOURCE_QCAPS_OUTPUT_VF_RESV_STRATEGY_MAXIMAL \
@@ -74,6 +77,10 @@ struct hwrm_func_qstats_output;
 	bp->tx_cos_queue[x].profile =	\
 		resp->queue_id##x##_service_profile
 
+#define GET_TX_QUEUE_TYPE_INFO(x) \
+	bp->tx_cos_queue[x].profile_type =	\
+		resp->queue_id##x##_service_profile_type
+
 #define GET_RX_QUEUE_INFO(x) \
 	bp->rx_cos_queue[x].id = resp->queue_id##x; \
 	bp->rx_cos_queue[x].profile =	\
Signature · 1 line
2.39.2 (Apple Git-143)
#5 lore raw

PATCH v3 5/14 net/bnxt: refactor mem zone allocation

In reply to Ajit Khaparde

Currently we are allocating memzone for VNIC attributes per VNIC. In cases where the firmware supports a higher VNIC count, this could lead to a higher number of memzone segments than supported.

Move the memzone for VNIC attributes per function instead of per VNIC. Divide the memzone per VNIC as needed.

---
 drivers/net/bnxt/bnxt.h      |  1 +
 drivers/net/bnxt/bnxt_vnic.c | 52 +++++++++++++++++++-----------------
 drivers/net/bnxt/bnxt_vnic.h |  1 -
 3 files changed, 28 insertions(+), 26 deletions(-)
drivers/net/bnxt/bnxt.h +1 -0
index 542ef13f7c..6af668e92f 100644
@@ -772,6 +772,7 @@ struct bnxt {
 
 	struct bnxt_vnic_info	*vnic_info;
 	STAILQ_HEAD(, bnxt_vnic_info)	free_vnic_list;
+	const struct rte_memzone *vnic_rss_mz;
 
 	struct bnxt_filter_info	*filter_info;
 	STAILQ_HEAD(, bnxt_filter_info)	free_filter_list;
drivers/net/bnxt/bnxt_vnic.c +27 -25

71 lines not on this page · raw message

drivers/net/bnxt/bnxt_vnic.h +0 -1
index 4396d95bda..7a6a0aa739 100644
@@ -47,7 +47,6 @@ struct bnxt_vnic_info {
 	uint16_t	hash_type;
 	uint8_t		hash_mode;
 	uint8_t		prev_hash_mode;
-	const struct rte_memzone *rss_mz;
 	rte_iova_t	rss_table_dma_addr;
 	uint16_t	*rss_table;
 	rte_iova_t	rss_hash_key_dma_addr;
Signature · 1 line
2.39.2 (Apple Git-143)
#6 lore raw

PATCH v3 6/14 net/bnxt: add support for p7 device family

In reply to Ajit Khaparde

Add support for the P7 device family.

---
 drivers/net/bnxt/bnxt.h        | 14 ++++++++++++--
 drivers/net/bnxt/bnxt_ethdev.c | 25 +++++++++++++++++++++++++
 2 files changed, 37 insertions(+), 2 deletions(-)
drivers/net/bnxt/bnxt.h +12 -2
index 6af668e92f..3a1d8a6ff6 100644
@@ -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)
drivers/net/bnxt/bnxt_ethdev.c +25 -0
index f398838ea8..bd30e9fd3e 100644
@@ -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 ||
Signature · 1 line
2.39.2 (Apple Git-143)
#7 lore raw

PATCH v3 7/14 net/bnxt: refactor code to support P7 devices

In reply to Ajit Khaparde

Refactor code to support the P7 device family.
The changes include support for RSS, VNIC allocation, TPA. Remove unnecessary check to disable vector mode support for some device families.

---
 drivers/net/bnxt/bnxt.h        |  6 +++---
 drivers/net/bnxt/bnxt_ethdev.c | 29 +++++++++--------------------
 drivers/net/bnxt/bnxt_flow.c   |  2 +-
 drivers/net/bnxt/bnxt_hwrm.c   | 26 ++++++++++++++------------
 drivers/net/bnxt/bnxt_ring.c   |  6 +++---
 drivers/net/bnxt/bnxt_rxq.c    |  2 +-
 drivers/net/bnxt/bnxt_rxr.c    |  6 +++---
 drivers/net/bnxt/bnxt_vnic.c   |  6 +++---
 8 files changed, 37 insertions(+), 46 deletions(-)
drivers/net/bnxt/bnxt.h +3 -3
index 3a1d8a6ff6..7439ecf4fa 100644
@@ -107,11 +107,11 @@
 #define TPA_MAX_SEGS		5 /* 32 segments in log2 units */
 
 #define BNXT_TPA_MAX_AGGS(bp) \
-	(BNXT_CHIP_P5(bp) ? TPA_MAX_AGGS_TH : \
+	(BNXT_CHIP_P5_P7(bp) ? TPA_MAX_AGGS_TH : \
 			     TPA_MAX_AGGS)
 
 #define BNXT_TPA_MAX_SEGS(bp) \
-	(BNXT_CHIP_P5(bp) ? TPA_MAX_SEGS_TH : \
+	(BNXT_CHIP_P5_P7(bp) ? TPA_MAX_SEGS_TH : \
 			      TPA_MAX_SEGS)
 
 /*
@@ -938,7 +938,7 @@ inline uint16_t bnxt_max_rings(struct bnxt *bp)
 	 * RSS table size in P5 is 512.
 	 * Cap max Rx rings to the same value for RSS.
 	 */
-	if (BNXT_CHIP_P5(bp))
+	if (BNXT_CHIP_P5_P7(bp))
 		max_rx_rings = RTE_MIN(max_rx_rings, BNXT_RSS_TBL_SIZE_P5);
 
 	max_tx_rings = RTE_MIN(max_tx_rings, max_rx_rings);
drivers/net/bnxt/bnxt_ethdev.c +9 -20
index bd30e9fd3e..d79396b009 100644
@@ -212,7 +212,7 @@ uint16_t bnxt_rss_ctxts(const struct bnxt *bp)
 	unsigned int num_rss_rings = RTE_MIN(bp->rx_nr_rings,
 					     BNXT_RSS_TBL_SIZE_P5);
 
-	if (!BNXT_CHIP_P5(bp))
+	if (!BNXT_CHIP_P5_P7(bp))
 		return 1;
 
 	return RTE_ALIGN_MUL_CEIL(num_rss_rings,
@@ -222,7 +222,7 @@ uint16_t bnxt_rss_ctxts(const struct bnxt *bp)
 
 uint16_t bnxt_rss_hash_tbl_size(const struct bnxt *bp)
 {
-	if (!BNXT_CHIP_P5(bp))
+	if (!BNXT_CHIP_P5_P7(bp))
 		return HW_HASH_INDEX_SIZE;
 
 	return bnxt_rss_ctxts(bp) * BNXT_RSS_ENTRIES_PER_CTX_P5;
@@ -765,7 +765,7 @@ static int bnxt_start_nic(struct bnxt *bp)
 	/* P5 does not support ring groups.
 	 * But we will use the array to save RSS context IDs.
 	 */
-	if (BNXT_CHIP_P5(bp))
+	if (BNXT_CHIP_P5_P7(bp))
 		bp->max_ring_grps = BNXT_MAX_RSS_CTXTS_P5;
 
 	rc = bnxt_vnic_queue_db_init(bp);
@@ -1247,12 +1247,6 @@ bnxt_receive_function(struct rte_eth_dev *eth_dev)
 {
 	struct bnxt *bp = eth_dev->data->dev_private;
 
-	/* Disable vector mode RX for Stingray2 for now */
-	if (BNXT_CHIP_SR2(bp)) {
-		bp->flags &= ~BNXT_FLAG_RX_VECTOR_PKT_MODE;
-		return bnxt_recv_pkts;
-	}
-
 #if defined(RTE_ARCH_X86) || defined(RTE_ARCH_ARM64)
 	/* Vector mode receive cannot be enabled if scattered rx is in use. */
 	if (eth_dev->data->scattered_rx)
@@ -1317,16 +1311,11 @@ bnxt_receive_function(struct rte_eth_dev *eth_dev)
 }
 
 static eth_tx_burst_t
-bnxt_transmit_function(struct rte_eth_dev *eth_dev)
+bnxt_transmit_function(__rte_unused struct rte_eth_dev *eth_dev)
 {
-	struct bnxt *bp = eth_dev->data->dev_private;
-
-	/* Disable vector mode TX for Stingray2 for now */
-	if (BNXT_CHIP_SR2(bp))
-		return bnxt_xmit_pkts;
-
 #if defined(RTE_ARCH_X86) || defined(RTE_ARCH_ARM64)
 	uint64_t offloads = eth_dev->data->dev_conf.txmode.offloads;
+	struct bnxt *bp = eth_dev->data->dev_private;
 
 	/*
 	 * Vector mode transmit can be enabled only if not using scatter rx
@@ -2091,7 +2080,7 @@ static int bnxt_reta_update_op(struct rte_eth_dev *eth_dev,
 			continue;
 
 		rxq = bnxt_qid_to_rxq(bp, reta_conf[idx].reta[sft]);
-		if (BNXT_CHIP_P5(bp)) {
+		if (BNXT_CHIP_P5_P7(bp)) {
 			vnic->rss_table[i * 2] =
 				rxq->rx_ring->rx_ring_struct->fw_ring_id;
 			vnic->rss_table[i * 2 + 1] =
@@ -2138,7 +2127,7 @@ static int bnxt_reta_query_op(struct rte_eth_dev *eth_dev,
 		if (reta_conf[idx].mask & (1ULL << sft)) {
 			uint16_t qid;
 
-			if (BNXT_CHIP_P5(bp))
+			if (BNXT_CHIP_P5_P7(bp))
 				qid = bnxt_rss_to_qid(bp,
 						      vnic->rss_table[i * 2]);
 			else
@@ -3224,7 +3213,7 @@ bnxt_rx_queue_count_op(void *rx_queue)
 			break;
 
 		case CMPL_BASE_TYPE_RX_TPA_END:
-			if (BNXT_CHIP_P5(rxq->bp)) {
+			if (BNXT_CHIP_P5_P7(rxq->bp)) {
 				struct rx_tpa_v2_end_cmpl_hi *p5_tpa_end;
 
 				p5_tpa_end = (void *)rxcmp;
@@ -3335,7 +3324,7 @@ bnxt_rx_descriptor_status_op(void *rx_queue, uint16_t offset)
 			if (desc == offset)
 				return RTE_ETH_RX_DESC_DONE;
 
-			if (BNXT_CHIP_P5(rxq->bp)) {
+			if (BNXT_CHIP_P5_P7(rxq->bp)) {
 				struct rx_tpa_v2_end_cmpl_hi *p5_tpa_end;
 
 				p5_tpa_end = (void *)rxcmp;
drivers/net/bnxt/bnxt_flow.c +1 -1
index 28dd5ae6cb..15f0e1b308 100644
@@ -1199,7 +1199,7 @@ bnxt_vnic_rss_cfg_update(struct bnxt *bp,
 		if (i == bp->rx_cp_nr_rings)
 			return 0;
 
-		if (BNXT_CHIP_P5(bp)) {
+		if (BNXT_CHIP_P5_P7(bp)) {
 			rxq = bp->rx_queues[idx];
 			vnic->rss_table[rss_idx * 2] =
 				rxq->rx_ring->rx_ring_struct->fw_ring_id;
drivers/net/bnxt/bnxt_hwrm.c +14 -12
index fe9e629892..2d0a7a2731 100644
@@ -853,7 +853,7 @@ static int __bnxt_hwrm_func_qcaps(struct bnxt *bp)
 	bp->first_vf_id = rte_le_to_cpu_16(resp->first_vf_id);
 	bp->max_rx_em_flows = rte_le_to_cpu_16(resp->max_rx_em_flows);
 	bp->max_l2_ctx = rte_le_to_cpu_16(resp->max_l2_ctxs);
-	if (!BNXT_CHIP_P5(bp) && !bp->pdev->max_vfs)
+	if (!BNXT_CHIP_P5_P7(bp) && !bp->pdev->max_vfs)
 		bp->max_l2_ctx += bp->max_rx_em_flows;
 	if (bp->vnic_cap_flags & BNXT_VNIC_CAP_COS_CLASSIFY)
 		bp->max_vnics = rte_le_to_cpu_16(BNXT_MAX_VNICS_COS_CLASSIFY);
@@ -1187,7 +1187,7 @@ int bnxt_hwrm_func_resc_qcaps(struct bnxt *bp)
 	 * So use the value provided by func_qcaps.
 	 */
 	bp->max_l2_ctx = rte_le_to_cpu_16(resp->max_l2_ctxs);
-	if (!BNXT_CHIP_P5(bp) && !bp->pdev->max_vfs)
+	if (!BNXT_CHIP_P5_P7(bp) && !bp->pdev->max_vfs)
 		bp->max_l2_ctx += bp->max_rx_em_flows;
 	if (bp->vnic_cap_flags & BNXT_VNIC_CAP_COS_CLASSIFY)
 		bp->max_vnics = rte_le_to_cpu_16(BNXT_MAX_VNICS_COS_CLASSIFY);
@@ -1744,7 +1744,7 @@ int bnxt_hwrm_ring_alloc(struct bnxt *bp,
 		req.ring_type = ring_type;
 		req.cmpl_ring_id = rte_cpu_to_le_16(cmpl_ring_id);
 		req.stat_ctx_id = rte_cpu_to_le_32(stats_ctx_id);
-		if (BNXT_CHIP_P5(bp)) {
+		if (BNXT_CHIP_P5_P7(bp)) {
 			mb_pool = bp->rx_queues[0]->mb_pool;
 			rx_buf_size = rte_pktmbuf_data_room_size(mb_pool) -
 				      RTE_PKTMBUF_HEADROOM;
@@ -2118,7 +2118,7 @@ int bnxt_hwrm_vnic_cfg(struct bnxt *bp, struct bnxt_vnic_info *vnic)
 
 	HWRM_PREP(&req, HWRM_VNIC_CFG, BNXT_USE_CHIMP_MB);
 
-	if (BNXT_CHIP_P5(bp)) {
+	if (BNXT_CHIP_P5_P7(bp)) {
 		int dflt_rxq = vnic->start_grp_id;
 		struct bnxt_rx_ring_info *rxr;
 		struct bnxt_cp_ring_info *cpr;
@@ -2304,7 +2304,7 @@ int bnxt_hwrm_vnic_ctx_free(struct bnxt *bp, struct bnxt_vnic_info *vnic)
 {
 	int rc = 0;
 
-	if (BNXT_CHIP_P5(bp)) {
+	if (BNXT_CHIP_P5_P7(bp)) {
 		int j;
 
 		for (j = 0; j < vnic->num_lb_ctxts; j++) {
@@ -2556,7 +2556,7 @@ int bnxt_hwrm_vnic_tpa_cfg(struct bnxt *bp,
 	struct hwrm_vnic_tpa_cfg_input req = {.req_type = 0 };
 	struct hwrm_vnic_tpa_cfg_output *resp = bp->hwrm_cmd_resp_addr;
 
-	if (BNXT_CHIP_P5(bp) && !bp->max_tpa_v2) {
+	if ((BNXT_CHIP_P5(bp) || BNXT_CHIP_P7(bp)) && !bp->max_tpa_v2) {
 		if (enable)
 			PMD_DRV_LOG(ERR, "No HW support for LRO\n");
 		return -ENOTSUP;
@@ -2584,6 +2584,9 @@ int bnxt_hwrm_vnic_tpa_cfg(struct bnxt *bp,
 		req.max_aggs = rte_cpu_to_le_16(BNXT_TPA_MAX_AGGS(bp));
 		req.max_agg_segs = rte_cpu_to_le_16(BNXT_TPA_MAX_SEGS(bp));
 		req.min_agg_len = rte_cpu_to_le_32(512);
+
+		if (BNXT_CHIP_P5_P7(bp))
+			req.max_aggs = rte_cpu_to_le_16(bp->max_tpa_v2);
 	}
 	req.vnic_id = rte_cpu_to_le_16(vnic->fw_vnic_id);
 
@@ -2836,7 +2839,7 @@ void bnxt_free_hwrm_rx_ring(struct bnxt *bp, int queue_index)
 	ring = rxr ? rxr->ag_ring_struct : NULL;
 	if (ring != NULL && cpr != NULL) {
 		bnxt_hwrm_ring_free(bp, ring,
-				    BNXT_CHIP_P5(bp) ?
+				    BNXT_CHIP_P5_P7(bp) ?
 				    HWRM_RING_FREE_INPUT_RING_TYPE_RX_AGG :
 				    HWRM_RING_FREE_INPUT_RING_TYPE_RX,
 				    cpr->cp_ring_struct->fw_ring_id);
@@ -3356,8 +3359,7 @@ int bnxt_set_hwrm_link_config(struct bnxt *bp, bool link_up)
 
 	/* Get user requested autoneg setting */
 	autoneg = bnxt_check_eth_link_autoneg(dev_conf->link_speeds);
-
-	if (BNXT_CHIP_P5(bp) &&
+	if (BNXT_CHIP_P5_P7(bp) &&
 	    dev_conf->link_speeds & RTE_ETH_LINK_SPEED_40G) {
 		/* 40G is not supported as part of media auto detect.
 		 * The speed should be forced and autoneg disabled
@@ -5348,7 +5350,7 @@ int bnxt_vnic_rss_configure(struct bnxt *bp, struct bnxt_vnic_info *vnic)
 	if (!(vnic->rss_table && vnic->hash_type))
 		return 0;
 
-	if (BNXT_CHIP_P5(bp))
+	if (BNXT_CHIP_P5_P7(bp))
 		return bnxt_vnic_rss_configure_p5(bp, vnic);
 
 	/*
@@ -5440,7 +5442,7 @@ int bnxt_hwrm_set_ring_coal(struct bnxt *bp,
 	int rc;
 
 	/* Set ring coalesce parameters only for 100G NICs */
-	if (BNXT_CHIP_P5(bp)) {
+	if (BNXT_CHIP_P5_P7(bp)) {
 		if (bnxt_hwrm_set_coal_params_p5(bp, &req))
 			return -1;
 	} else if (bnxt_stratus_device(bp)) {
@@ -5470,7 +5472,7 @@ int bnxt_hwrm_func_backing_store_qcaps(struct bnxt *bp)
 	int total_alloc_len;
 	int rc, i, tqm_rings;
 
-	if (!BNXT_CHIP_P5(bp) ||
+	if (!BNXT_CHIP_P5_P7(bp) ||
 	    bp->hwrm_spec_code < HWRM_VERSION_1_9_2 ||
 	    BNXT_VF(bp) ||
 	    bp->ctx)
drivers/net/bnxt/bnxt_ring.c +3 -3
index 6dacb1b37f..90cad6c9c6 100644
@@ -57,7 +57,7 @@ int bnxt_alloc_ring_grps(struct bnxt *bp)
 	/* P5 does not support ring groups.
 	 * But we will use the array to save RSS context IDs.
 	 */
-	if (BNXT_CHIP_P5(bp)) {
+	if (BNXT_CHIP_P5_P7(bp)) {
 		bp->max_ring_grps = BNXT_MAX_RSS_CTXTS_P5;
 	} else if (bp->max_ring_grps < bp->rx_cp_nr_rings) {
 		/* 1 ring is for default completion ring */
@@ -354,7 +354,7 @@ static void bnxt_set_db(struct bnxt *bp,
 			uint32_t fid,
 			uint32_t ring_mask)
 {
-	if (BNXT_CHIP_P5(bp)) {
+	if (BNXT_CHIP_P5_P7(bp)) {
 		int db_offset = DB_PF_OFFSET;
 		switch (ring_type) {
 		case HWRM_RING_ALLOC_INPUT_RING_TYPE_TX:
@@ -559,7 +559,7 @@ static int bnxt_alloc_rx_agg_ring(struct bnxt *bp, int queue_index)
 
 	ring->fw_rx_ring_id = rxr->rx_ring_struct->fw_ring_id;
 
-	if (BNXT_CHIP_P5(bp)) {
+	if (BNXT_CHIP_P5_P7(bp)) {
 		ring_type = HWRM_RING_ALLOC_INPUT_RING_TYPE_RX_AGG;
 		hw_stats_ctx_id = cpr->hw_stats_ctx_id;
 	} else {
drivers/net/bnxt/bnxt_rxq.c +1 -1
index 0d0b5e28e4..575e7f193f 100644
@@ -600,7 +600,7 @@ int bnxt_rx_queue_stop(struct rte_eth_dev *dev, uint16_t rx_queue_id)
 			if (bp->rx_queues[i]->rx_started)
 				active_queue_cnt++;
 
-		if (BNXT_CHIP_P5(bp)) {
+		if (BNXT_CHIP_P5_P7(bp)) {
 			/*
 			 * For P5, we need to ensure that the VNIC default
 			 * receive ring corresponds to an active receive queue.
drivers/net/bnxt/bnxt_rxr.c +3 -3
index 0cabfb583c..9d45065f28 100644
@@ -334,7 +334,7 @@ static int bnxt_rx_pages(struct bnxt_rx_queue *rxq,
 	uint16_t cp_cons, ag_cons;
 	struct rx_pkt_cmpl *rxcmp;
 	struct rte_mbuf *last = mbuf;
-	bool is_p5_tpa = tpa_info && BNXT_CHIP_P5(rxq->bp);
+	bool is_p5_tpa = tpa_info && BNXT_CHIP_P5_P7(rxq->bp);
 
 	for (i = 0; i < agg_buf; i++) {
 		struct rte_mbuf **ag_buf;
@@ -395,7 +395,7 @@ static int bnxt_discard_rx(struct bnxt *bp, struct bnxt_cp_ring_info *cpr,
 	} else if (cmp_type == RX_TPA_END_CMPL_TYPE_RX_TPA_END) {
 		struct rx_tpa_end_cmpl *tpa_end = cmp;
 
-		if (BNXT_CHIP_P5(bp))
+		if (BNXT_CHIP_P5_P7(bp))
 			return 0;
 
 		agg_bufs = BNXT_TPA_END_AGG_BUFS(tpa_end);
@@ -430,7 +430,7 @@ static inline struct rte_mbuf *bnxt_tpa_end(
 		return NULL;
 	}
 
-	if (BNXT_CHIP_P5(rxq->bp)) {
+	if (BNXT_CHIP_P5_P7(rxq->bp)) {
 		struct rx_tpa_v2_end_cmpl *th_tpa_end;
 		struct rx_tpa_v2_end_cmpl_hi *th_tpa_end1;
 
drivers/net/bnxt/bnxt_vnic.c +3 -3
index d40daf631e..bf93120d28 100644
@@ -143,7 +143,7 @@ int bnxt_alloc_vnic_attributes(struct bnxt *bp, bool reconfig)
 
 	entry_length = HW_HASH_KEY_SIZE;
 
-	if (BNXT_CHIP_P5(bp))
+	if (BNXT_CHIP_P5_P7(bp))
 		rss_table_size = BNXT_RSS_TBL_SIZE_P5 *
 				 2 * sizeof(*vnic->rss_table);
 	else
@@ -418,8 +418,8 @@ static
 int32_t bnxt_vnic_populate_rss_table(struct bnxt *bp,
 				     struct bnxt_vnic_info *vnic)
 {
-	/* RSS table population is different for p4 and p5 platforms */
-	if (BNXT_CHIP_P5(bp))
+	/* RSS table population is different for p4 and p5, p7 platforms */
+	if (BNXT_CHIP_P5_P7(bp))
 		return bnxt_vnic_populate_rss_table_p5(bp, vnic);
 
 	return bnxt_vnic_populate_rss_table_p4(bp, vnic);
Signature · 1 line
2.39.2 (Apple Git-143)
#8 lore raw

PATCH v3 8/14 net/bnxt: fix array overflow

In reply to Ajit Khaparde

In some cases the number of elements in the context memory array can exceed the MAX_CTX_PAGES and that can cause the static members ctx_pg_arr and ctx_dma_arr to overflow.
Allocate them dynamically to prevent this overflow.

Fixes f8168ca0e690 ("net/bnxt: support thor controller")
---
 drivers/net/bnxt/bnxt.h        |  4 ++--
 drivers/net/bnxt/bnxt_ethdev.c | 42 +++++++++++++++++++++++++++-------
 2 files changed, 36 insertions(+), 10 deletions(-)
drivers/net/bnxt/bnxt.h +2 -2
index 7439ecf4fa..3fbdf1ddcc 100644
@@ -455,8 +455,8 @@ struct bnxt_ring_mem_info {
 
 struct bnxt_ctx_pg_info {
 	uint32_t	entries;
-	void		*ctx_pg_arr[MAX_CTX_PAGES];
-	rte_iova_t	ctx_dma_arr[MAX_CTX_PAGES];
+	void		**ctx_pg_arr;
+	rte_iova_t	*ctx_dma_arr;
 	struct bnxt_ring_mem_info ring_mem;
 };
 
drivers/net/bnxt/bnxt_ethdev.c +34 -8

83 lines not on this page · raw message

Signature · 1 line
2.39.2 (Apple Git-143)
#9 lore raw

PATCH v3 9/14 net/bnxt: add support for backing store v2

In reply to Ajit Khaparde

Add backing store v2 changes.
The firmware supports the new backing store scheme for P7 and newer devices.

To support this, the driver queries the different types of chip contexts the firmware supports and allocates the appropriate size of memory for the firmware and hardware to use.
The code then goes ahead and frees up the memory during cleanup.

Older P5 device family continues to support the version 1 of backing store. While the P4 device family does not need any backing store memory.

---
 drivers/net/bnxt/bnxt.h        |  69 ++++++-
 drivers/net/bnxt/bnxt_ethdev.c | 177 ++++++++++++++++--
 drivers/net/bnxt/bnxt_hwrm.c   | 319 +++++++++++++++++++++++++++++++--
 drivers/net/bnxt/bnxt_hwrm.h   |   8 +
 drivers/net/bnxt/bnxt_util.c   |  10 ++
 drivers/net/bnxt/bnxt_util.h   |   1 +
 6 files changed, 545 insertions(+), 39 deletions(-)
drivers/net/bnxt/bnxt.h +65 -4
index 3fbdf1ddcc..68c4778dc3 100644
@@ -81,6 +81,11 @@
 #define BROADCOM_DEV_957508_N2100	0x5208
 #define BROADCOM_DEV_957414_N225	0x4145
 
+#define HWRM_SPEC_CODE_1_8_3		0x10803
+#define HWRM_VERSION_1_9_1		0x10901
+#define HWRM_VERSION_1_9_2		0x10903
+#define HWRM_VERSION_1_10_2_13		0x10a020d
+
 #define BNXT_MAX_MTU		9574
 #define BNXT_NUM_VLANS		2
 #define BNXT_MAX_PKT_LEN	(BNXT_MAX_MTU + RTE_ETHER_HDR_LEN +\
@@ -430,16 +435,26 @@ struct bnxt_coal {
 #define BNXT_PAGE_SIZE (1 << BNXT_PAGE_SHFT)
 #define MAX_CTX_PAGES  (BNXT_PAGE_SIZE / 8)
 
+#define BNXT_RTE_MEMZONE_FLAG  (RTE_MEMZONE_1GB | RTE_MEMZONE_IOVA_CONTIG)
+
 #define PTU_PTE_VALID             0x1UL
 #define PTU_PTE_LAST              0x2UL
 #define PTU_PTE_NEXT_TO_LAST      0x4UL
 
+#define BNXT_CTX_MIN		1
+#define BNXT_CTX_INV		0xffff
+
+#define BNXT_CTX_INIT_VALID(flags)	\
+	((flags) &			\
+	 HWRM_FUNC_BACKING_STORE_QCAPS_V2_OUTPUT_FLAGS_ENABLE_CTX_KIND_INIT)
+
 struct bnxt_ring_mem_info {
 	int				nr_pages;
 	int				page_size;
 	uint32_t			flags;
 #define BNXT_RMEM_VALID_PTE_FLAG	1
 #define BNXT_RMEM_RING_PTE_FLAG		2
+#define BNXT_RMEM_USE_FULL_PAGE_FLAG	4
 
 	void				**pg_arr;
 	rte_iova_t			*dma_arr;
@@ -460,7 +475,50 @@ struct bnxt_ctx_pg_info {
 	struct bnxt_ring_mem_info ring_mem;
 };
 
+struct bnxt_ctx_mem {
+	uint16_t	type;
+	uint16_t	entry_size;
+	uint32_t	flags;
+#define BNXT_CTX_MEM_TYPE_VALID \
+	HWRM_FUNC_BACKING_STORE_QCAPS_V2_OUTPUT_FLAGS_TYPE_VALID
+	uint32_t	instance_bmap;
+	uint8_t		init_value;
+	uint8_t		entry_multiple;
+	uint16_t	init_offset;
+#define	BNXT_CTX_INIT_INVALID_OFFSET	0xffff
+	uint32_t	max_entries;
+	uint32_t	min_entries;
+	uint8_t		last:1;
+	uint8_t		split_entry_cnt;
+#define BNXT_MAX_SPLIT_ENTRY	4
+	union {
+		struct {
+			uint32_t	qp_l2_entries;
+			uint32_t	qp_qp1_entries;
+			uint32_t	qp_fast_qpmd_entries;
+		};
+		uint32_t	srq_l2_entries;
+		uint32_t	cq_l2_entries;
+		uint32_t	vnic_entries;
+		struct {
+			uint32_t	mrav_av_entries;
+			uint32_t	mrav_num_entries_units;
+		};
+		uint32_t	split[BNXT_MAX_SPLIT_ENTRY];
+	};
+	struct bnxt_ctx_pg_info	*pg_info;
+};
+
+#define BNXT_CTX_FLAG_INITED    0x01
+
 struct bnxt_ctx_mem_info {
+	struct bnxt_ctx_mem	*ctx_arr;
+	uint32_t	supported_types;
+	uint32_t	flags;
+	uint16_t	types;
+	uint8_t		tqm_fp_rings_count;
+
+	/* The following are used for V1 */
 	uint32_t        qp_max_entries;
 	uint16_t        qp_min_qp1_entries;
 	uint16_t        qp_max_l2_entries;
@@ -484,10 +542,6 @@ struct bnxt_ctx_mem_info {
 	uint16_t        tim_entry_size;
 	uint32_t        tim_max_entries;
 	uint8_t         tqm_entries_multiple;
-	uint8_t         tqm_fp_rings_count;
-
-	uint32_t        flags;
-#define BNXT_CTX_FLAG_INITED    0x01
 
 	struct bnxt_ctx_pg_info qp_mem;
 	struct bnxt_ctx_pg_info srq_mem;
@@ -739,6 +793,13 @@ struct bnxt {
 #define BNXT_FW_CAP_TRUFLOW_EN		BIT(8)
 #define BNXT_FW_CAP_VLAN_TX_INSERT	BIT(9)
 #define BNXT_FW_CAP_RX_ALL_PKT_TS	BIT(10)
+#define BNXT_FW_CAP_BACKING_STORE_V2	BIT(12)
+#define BNXT_FW_BACKING_STORE_V2_EN(bp)	\
+	((bp)->fw_cap & BNXT_FW_CAP_BACKING_STORE_V2)
+#define BNXT_FW_BACKING_STORE_V1_EN(bp)	\
+	(BNXT_CHIP_P5_P7((bp)) && \
+	 (bp)->hwrm_spec_code >= HWRM_VERSION_1_9_2 && \
+	 !BNXT_VF((bp)))
 #define BNXT_TRUFLOW_EN(bp)	((bp)->fw_cap & BNXT_FW_CAP_TRUFLOW_EN &&\
 				 (bp)->app_id != 0xFF)
 
drivers/net/bnxt/bnxt_ethdev.c +160 -17

295 lines not on this page · raw message

drivers/net/bnxt/bnxt_hwrm.c +301 -18

377 lines not on this page · raw message

drivers/net/bnxt/bnxt_hwrm.h +8 -0
index f9fa6cf73a..3d5194257b 100644
@@ -60,6 +60,8 @@ struct hwrm_func_qstats_output;
 	HWRM_PORT_PHY_CFG_INPUT_ENABLES_AUTO_PAM4_LINK_SPEED_MASK
 #define HWRM_PORT_PHY_CFG_IN_EN_AUTO_LINK_SPEED_MASK \
 	HWRM_PORT_PHY_CFG_INPUT_ENABLES_AUTO_LINK_SPEED_MASK
+#define BACKING_STORE_CFG_V2_IN_FLG_CFG_ALL_DONE \
+	HWRM_FUNC_BACKING_STORE_CFG_V2_INPUT_FLAGS_BS_CFG_ALL_DONE
 
 #define HWRM_SPEC_CODE_1_8_4		0x10804
 #define HWRM_SPEC_CODE_1_9_0		0x10900
@@ -355,4 +357,10 @@ void bnxt_free_hwrm_tx_ring(struct bnxt *bp, int queue_index);
 int bnxt_alloc_hwrm_tx_ring(struct bnxt *bp, int queue_index);
 int bnxt_hwrm_config_host_mtu(struct bnxt *bp);
 int bnxt_vnic_rss_clear_p5(struct bnxt *bp, struct bnxt_vnic_info *vnic);
+int bnxt_hwrm_func_backing_store_qcaps_v2(struct bnxt *bp);
+int bnxt_hwrm_func_backing_store_cfg_v2(struct bnxt *bp,
+					struct bnxt_ctx_mem *ctxm);
+int bnxt_hwrm_func_backing_store_types_count(struct bnxt *bp);
+int bnxt_hwrm_func_backing_store_ctx_alloc(struct bnxt *bp, uint16_t types);
+int bnxt_alloc_ctx_pg_tbls(struct bnxt *bp);
 #endif
drivers/net/bnxt/bnxt_util.c +10 -0
index 47dd5fa6ff..aa184496c2 100644
@@ -27,3 +27,13 @@ void bnxt_eth_hw_addr_random(uint8_t *mac_addr)
 	mac_addr[1] = 0x0a;
 	mac_addr[2] = 0xf7;
 }
+
+uint8_t hweight32(uint32_t word32)
+{
+	uint32_t res = word32 - ((word32 >> 1) & 0x55555555);
+
+	res = (res & 0x33333333) + ((res >> 2) & 0x33333333);
+	res = (res + (res >> 4)) & 0x0F0F0F0F;
+	res = res + (res >> 8);
+	return (res + (res >> 16)) & 0x000000FF;
+}
drivers/net/bnxt/bnxt_util.h +1 -0
index 7f5b4c160e..b265f5841b 100644
@@ -17,4 +17,5 @@
 
 int bnxt_check_zero_bytes(const uint8_t *bytes, int len);
 void bnxt_eth_hw_addr_random(uint8_t *mac_addr);
+uint8_t hweight32(uint32_t word32);
 #endif /* _BNXT_UTIL_H_ */
Signature · 1 line
2.39.2 (Apple Git-143)
#10 lore raw

PATCH v3 10/14 net/bnxt: refactor the ulp initialization

In reply to Ajit Khaparde

From: Kishore Padmanabha <[email protected]>

Add new method to consider all the conditions to
check before the ulp could be initialized.

---
 drivers/net/bnxt/bnxt_ethdev.c | 28 +++++++++++++++++++++++-----
 1 file changed, 23 insertions(+), 5 deletions(-)
drivers/net/bnxt/bnxt_ethdev.c +23 -5
index 004b2df4f4..81a30eb983 100644
@@ -190,6 +190,7 @@ static void bnxt_dev_recover(void *arg);
 static void bnxt_free_error_recovery_info(struct bnxt *bp);
 static void bnxt_free_rep_info(struct bnxt *bp);
 static int bnxt_check_fw_ready(struct bnxt *bp);
+static bool bnxt_enable_ulp(struct bnxt *bp);
 
 int is_bnxt_in_error(struct bnxt *bp)
 {
@@ -1520,7 +1521,8 @@ static int bnxt_dev_stop(struct rte_eth_dev *eth_dev)
 		return ret;
 
 	/* delete the bnxt ULP port details */
-	bnxt_ulp_port_deinit(bp);
+	if (bnxt_enable_ulp(bp))
+		bnxt_ulp_port_deinit(bp);
 
 	bnxt_cancel_fw_health_check(bp);
 
@@ -1641,9 +1643,11 @@ int bnxt_dev_start_op(struct rte_eth_dev *eth_dev)
 		goto error;
 
 	/* Initialize bnxt ULP port details */
-	rc = bnxt_ulp_port_init(bp);
-	if (rc)
-		goto error;
+	if (bnxt_enable_ulp(bp)) {
+		rc = bnxt_ulp_port_init(bp);
+		if (rc)
+			goto error;
+	}
 
 	eth_dev->rx_pkt_burst = bnxt_receive_function(eth_dev);
 	eth_dev->tx_pkt_burst = bnxt_transmit_function(eth_dev);
@@ -3426,7 +3430,7 @@ bnxt_flow_ops_get_op(struct rte_eth_dev *dev,
 	 */
 	dev->data->dev_flags |= RTE_ETH_DEV_FLOW_OPS_THREAD_SAFE;
 
-	if (BNXT_TRUFLOW_EN(bp))
+	if (bnxt_enable_ulp(bp))
 		*ops = &bnxt_ulp_rte_flow_ops;
 	else
 		*ops = &bnxt_flow_ops;
@@ -6666,6 +6670,20 @@ struct tf *bnxt_get_tfp_session(struct bnxt *bp, enum bnxt_session_type type)
 		&bp->tfp[BNXT_SESSION_TYPE_REGULAR] : &bp->tfp[type];
 }
 
+/* check if ULP should be enabled or not */
+static bool bnxt_enable_ulp(struct bnxt *bp)
+{
+	/* truflow and MPC should be enabled */
+	/* not enabling ulp for cli and no truflow apps */
+	if (BNXT_TRUFLOW_EN(bp) && bp->app_id != 254 &&
+	    bp->app_id != 255) {
+		if (BNXT_CHIP_P7(bp))
+			return false;
+		return true;
+	}
+	return false;
+}
+
 RTE_LOG_REGISTER_SUFFIX(bnxt_logtype_driver, driver, NOTICE);
 RTE_PMD_REGISTER_PCI(net_bnxt, bnxt_rte_pmd);
 RTE_PMD_REGISTER_PCI_TABLE(net_bnxt, bnxt_pci_id_map);
Signature · 1 line
2.39.2 (Apple Git-143)
#11 lore raw

PATCH v3 11/14 net/bnxt: modify sending new HWRM commands to firmware

In reply to Ajit Khaparde

If the firmware fails to respond a HWRM command in a certain time, it may be because the firmware is in a bad state.
Do not send any new HWRM commands in such a scenario.

---
 drivers/net/bnxt/bnxt.h      | 1 +
 drivers/net/bnxt/bnxt_hwrm.c | 5 +++++
 2 files changed, 6 insertions(+)
drivers/net/bnxt/bnxt.h +1 -0
index 68c4778dc3..f7a60eb9a1 100644
@@ -745,6 +745,7 @@ struct bnxt {
 #define BNXT_FLAG_DFLT_MAC_SET			BIT(26)
 #define BNXT_FLAG_GFID_ENABLE			BIT(27)
 #define BNXT_FLAG_CHIP_P7			BIT(30)
+#define BNXT_FLAG_FW_TIMEDOUT			BIT(31)
 #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)
drivers/net/bnxt/bnxt_hwrm.c +5 -0
index a2182af036..1cc2c532dd 100644
@@ -215,6 +215,10 @@ static int bnxt_hwrm_send_message(struct bnxt *bp, void *msg,
 	if (bp->flags & BNXT_FLAG_FATAL_ERROR)
 		return 0;
 
+	/* If previous HWRM command timed out, donot send new HWRM command */
+	if (bp->flags & BNXT_FLAG_FW_TIMEDOUT)
+		return 0;
+
 	timeout = bp->hwrm_cmd_timeout;
 
 	/* Update the message length for backing store config for new FW. */
@@ -315,6 +319,7 @@ static int bnxt_hwrm_send_message(struct bnxt *bp, void *msg,
 		PMD_DRV_LOG(ERR,
 			    "Error(timeout) sending msg 0x%04x, seq_id %d\n",
 			    req->req_type, req->seq_id);
+		bp->flags |= BNXT_FLAG_FW_TIMEDOUT;
 		return -ETIMEDOUT;
 	}
 	return 0;
Signature · 1 line
2.39.2 (Apple Git-143)
#12 lore raw

PATCH v3 12/14 net/bnxt: retry HWRM ver get if the command fails

In reply to Ajit Khaparde

Retry HWRM ver get if the command timesout because of PCI FLR. When the PCI driver issues an FLR during device initialization, the firmware may have to block the PXP target traffic till the FLR is complete.

HWRM_VER_GET command issued during that window may time out. So retry the command again in such a scenario.

---
 drivers/net/bnxt/bnxt.h        |  1 +
 drivers/net/bnxt/bnxt_ethdev.c | 12 +++++++++++-
 2 files changed, 12 insertions(+), 1 deletion(-)
drivers/net/bnxt/bnxt.h +1 -0
index f7a60eb9a1..7aed4c3da3 100644
@@ -879,6 +879,7 @@ struct bnxt {
 
 	 /* default command timeout value of 500ms */
 #define DFLT_HWRM_CMD_TIMEOUT		500000
+#define PCI_FUNC_RESET_WAIT_TIMEOUT	1500000
 	 /* short command timeout value of 50ms */
 #define SHORT_HWRM_CMD_TIMEOUT		50000
 	/* default HWRM request timeout value */
drivers/net/bnxt/bnxt_ethdev.c +11 -1
index 81a30eb983..75e968394f 100644
@@ -5441,6 +5441,7 @@ static int bnxt_map_hcomm_fw_status_reg(struct bnxt *bp)
 static int bnxt_get_config(struct bnxt *bp)
 {
 	uint16_t mtu;
+	int timeout;
 	int rc = 0;
 
 	bp->fw_cap = 0;
@@ -5449,8 +5450,17 @@ static int bnxt_get_config(struct bnxt *bp)
 	if (rc)
 		return rc;
 
-	rc = bnxt_hwrm_ver_get(bp, DFLT_HWRM_CMD_TIMEOUT);
+	timeout = BNXT_CHIP_P7(bp) ?
+		  PCI_FUNC_RESET_WAIT_TIMEOUT :
+		  DFLT_HWRM_CMD_TIMEOUT;
+try_again:
+	rc = bnxt_hwrm_ver_get(bp, timeout);
 	if (rc) {
+		if (rc == -ETIMEDOUT && timeout == PCI_FUNC_RESET_WAIT_TIMEOUT) {
+			bp->flags &= ~BNXT_FLAG_FW_TIMEDOUT;
+			timeout = DFLT_HWRM_CMD_TIMEOUT;
+			goto try_again;
+		}
 		bnxt_check_fw_status(bp);
 		return rc;
 	}
Signature · 1 line
2.39.2 (Apple Git-143)
#13 lore raw

PATCH v3 13/14 net/bnxt: cap ring resources for P7 devices

In reply to Ajit Khaparde

Cap the NQ count for P7 devices.
Driver does not need a high NQ ring count anyway since we operate in poll mode.

---
 drivers/net/bnxt/bnxt_hwrm.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/net/bnxt/bnxt_hwrm.c +4 -1
index 1cc2c532dd..e56f7693af 100644
@@ -1237,7 +1237,10 @@ int bnxt_hwrm_func_resc_qcaps(struct bnxt *bp)
 	else
 		bp->max_vnics = rte_le_to_cpu_16(resp->max_vnics);
 	bp->max_stat_ctx = rte_le_to_cpu_16(resp->max_stat_ctx);
-	bp->max_nq_rings = rte_le_to_cpu_16(resp->max_msix);
+	if (BNXT_CHIP_P7(bp))
+		bp->max_nq_rings = BNXT_P7_MAX_NQ_RING_CNT;
+	else
+		bp->max_nq_rings = rte_le_to_cpu_16(resp->max_msix);
 	bp->vf_resv_strategy = rte_le_to_cpu_16(resp->vf_reservation_strategy);
 	if (bp->vf_resv_strategy >
 	    HWRM_FUNC_RESOURCE_QCAPS_OUTPUT_VF_RESV_STRATEGY_MINIMAL_STATIC)
Signature · 1 line
2.39.2 (Apple Git-143)
#14 lore raw

PATCH v3 14/14 net/bnxt: add support for v3 Rx completion

In reply to Ajit Khaparde

P7 devices support the newer Rx completion version. This Rx completion though similar to the previous generation, provides some extra information for flow offload scenarios apart from the normal information.

---
 drivers/net/bnxt/bnxt_rxr.c | 87 ++++++++++++++++++++++++++++++++++-
 drivers/net/bnxt/bnxt_rxr.h | 92 +++++++++++++++++++++++++++++++++++++
 2 files changed, 177 insertions(+), 2 deletions(-)
drivers/net/bnxt/bnxt_rxr.c +85 -2
index 9d45065f28..59ea0121de 100644
@@ -553,6 +553,41 @@ bnxt_parse_pkt_type(struct rx_pkt_cmpl *rxcmp, struct rx_pkt_cmpl_hi *rxcmp1)
 	return bnxt_ptype_table[index];
 }
 
+static void
+bnxt_parse_pkt_type_v3(struct rte_mbuf *mbuf,
+		       struct rx_pkt_cmpl *rxcmp_v1,
+		       struct rx_pkt_cmpl_hi *rxcmp1_v1)
+{
+	uint32_t flags_type, flags2, meta;
+	struct rx_pkt_v3_cmpl_hi *rxcmp1;
+	struct rx_pkt_v3_cmpl *rxcmp;
+	uint8_t index;
+
+	rxcmp = (void *)rxcmp_v1;
+	rxcmp1 = (void *)rxcmp1_v1;
+
+	flags_type = rte_le_to_cpu_16(rxcmp->flags_type);
+	flags2 = rte_le_to_cpu_32(rxcmp1->flags2);
+	meta = rte_le_to_cpu_32(rxcmp->metadata1_payload_offset);
+
+	/* TODO */
+	/* Validate ptype table indexing at build time. */
+	/* bnxt_check_ptype_constants_v3(); */
+
+	/*
+	 * Index format:
+	 *     bit 0: Set if IP tunnel encapsulated packet.
+	 *     bit 1: Set if IPv6 packet, clear if IPv4.
+	 *     bit 2: Set if VLAN tag present.
+	 *     bits 3-6: Four-bit hardware packet type field.
+	 */
+	index = BNXT_CMPL_V3_ITYPE_TO_IDX(flags_type) |
+		BNXT_CMPL_V3_VLAN_TO_IDX(meta) |
+		BNXT_CMPL_V3_IP_VER_TO_IDX(flags2);
+
+	mbuf->packet_type = bnxt_ptype_table[index];
+}
+
 static void __rte_cold
 bnxt_init_ol_flags_tables(struct bnxt_rx_queue *rxq)
 {
@@ -716,6 +751,43 @@ bnxt_get_rx_ts_p5(struct bnxt *bp, uint32_t rx_ts_cmpl)
 	ptp->rx_timestamp = pkt_time;
 }
 
+static uint32_t
+bnxt_ulp_set_mark_in_mbuf_v3(struct bnxt *bp, struct rx_pkt_cmpl_hi *rxcmp1,
+			     struct rte_mbuf *mbuf, uint32_t *vfr_flag)
+{
+	struct rx_pkt_v3_cmpl_hi *rxcmp1_v3 = (void *)rxcmp1;
+	uint32_t flags2, meta, mark_id = 0;
+	/* revisit the usage of gfid/lfid if mark action is supported.
+	 * for now, only VFR is using mark and the metadata is the SVIF
+	 * (a small number)
+	 */
+	bool gfid = false;
+	int rc = 0;
+
+	flags2 = rte_le_to_cpu_32(rxcmp1_v3->flags2);
+
+	switch (flags2 & RX_PKT_V3_CMPL_HI_FLAGS2_META_FORMAT_MASK) {
+	case RX_PKT_V3_CMPL_HI_FLAGS2_META_FORMAT_CHDR_DATA:
+		/* Only supporting Metadata for ulp now */
+		meta = rxcmp1_v3->metadata2;
+		break;
+	default:
+		goto skip_mark;
+	}
+
+	rc = ulp_mark_db_mark_get(bp->ulp_ctx, gfid, meta, vfr_flag, &mark_id);
+	if (!rc) {
+		/* Only supporting VFR for now, no Mark actions */
+		if (vfr_flag && *vfr_flag)
+			return mark_id;
+	}
+
+skip_mark:
+	mbuf->hash.fdir.hi = 0;
+
+	return 0;
+}
+
 static uint32_t
 bnxt_ulp_set_mark_in_mbuf(struct bnxt *bp, struct rx_pkt_cmpl_hi *rxcmp1,
 			  struct rte_mbuf *mbuf, uint32_t *vfr_flag)
@@ -892,7 +964,8 @@ static int bnxt_rx_pkt(struct rte_mbuf **rx_pkt,
 		*rx_pkt = mbuf;
 		goto next_rx;
 	} else if ((cmp_type != CMPL_BASE_TYPE_RX_L2) &&
-		   (cmp_type != CMPL_BASE_TYPE_RX_L2_V2)) {
+		   (cmp_type != CMPL_BASE_TYPE_RX_L2_V2) &&
+		   (cmp_type != CMPL_BASE_TYPE_RX_L2_V3)) {
 		rc = -EINVAL;
 		goto next_rx;
 	}
@@ -929,6 +1002,16 @@ static int bnxt_rx_pkt(struct rte_mbuf **rx_pkt,
 		      bp->ptp_all_rx_tstamp)
 		bnxt_get_rx_ts_p5(rxq->bp, rxcmp1->reorder);
 
+	if (cmp_type == CMPL_BASE_TYPE_RX_L2_V3) {
+		bnxt_parse_csum_v3(mbuf, rxcmp1);
+		bnxt_parse_pkt_type_v3(mbuf, rxcmp, rxcmp1);
+		bnxt_rx_vlan_v3(mbuf, rxcmp, rxcmp1);
+		if (BNXT_TRUFLOW_EN(bp))
+			mark_id = bnxt_ulp_set_mark_in_mbuf_v3(rxq->bp, rxcmp1,
+							       mbuf, &vfr_flag);
+		goto reuse_rx_mbuf;
+	}
+
 	if (cmp_type == CMPL_BASE_TYPE_RX_L2_V2) {
 		bnxt_parse_csum_v2(mbuf, rxcmp1);
 		bnxt_parse_pkt_type_v2(mbuf, rxcmp, rxcmp1);
@@ -1066,7 +1149,7 @@ uint16_t bnxt_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts,
 		if (CMP_TYPE(rxcmp) == CMPL_BASE_TYPE_HWRM_DONE) {
 			PMD_DRV_LOG(ERR, "Rx flush done\n");
 		} else if ((CMP_TYPE(rxcmp) >= CMPL_BASE_TYPE_RX_TPA_START_V2) &&
-		     (CMP_TYPE(rxcmp) <= RX_TPA_V2_ABUF_CMPL_TYPE_RX_TPA_AGG)) {
+			   (CMP_TYPE(rxcmp) <= CMPL_BASE_TYPE_RX_TPA_START_V3)) {
 			rc = bnxt_rx_pkt(&rx_pkts[nb_rx_pkts], rxq, &raw_cons);
 			if (!rc)
 				nb_rx_pkts++;
drivers/net/bnxt/bnxt_rxr.h +92 -0

96 lines not on this page · raw message

Signature · 1 line
2.39.2 (Apple Git-143)