Skip to contentSkip to conversation

bnxt patchset

PATCH Superseded Ajit Khaparde 1 participant 20 messages Dec 27, 2023 – Dec 29, 2023 Network drivers

lore
Share & tools
lore
#0 lore raw

v3 cover bnxt patchset

This patchset contains more code fixes and reafctoring, apart from extending more support for the newer P7 device family.
The patchset adds vector mode support for compressed Rx CQE. This patchset includes support for checksum and XOR RSS hash mode. It also adds support for forced speeds and autoneg support upto 400G.

v1->v2:
- Fixed a redefinition of page size and used rte variant instead.
- Fixed typo in some commit logs

v2->v3:
- Fixed some warnings
- Fixed the use of __builtin helpers
- Renamed a function in patch 16

Ajit Khaparde (9):
net/bnxt: add support for UDP GSO
net/bnxt: add support for compressed Rx CQE net/bnxt: reattempt mbuf allocation for Rx and AGG rings net/bnxt: refactor Rx doorbell during Rx flush net/bnxt: extend RSS hash support for P7 devices net/bnxt: add ESP and AH header based RSS support net/bnxt: set allmulti mode if multicast filter fails net/bnxt: add AVX2 support for compressed CQE net/bnxt: enable SSE mode for compressed CQE

Damodharam Ammepalli (4):
net/bnxt: add flow query callback
net/bnxt: add tunnel TPA support
net/bnxt: add 400G get support for P7 devices
net/bnxt: query extended stats from firmware

Jay Ding (1):
net/bnxt: add VF FLR async event handler

Kalesh AP (4):
net/bnxt: fix a typo while parsing link speed net/bnxt: fix setting 50G and 100G forced speed net/bnxt: fix speed change from 200G to 25G on Thor net/bnxt: support backward compatibility

 drivers/net/bnxt/bnxt.h                | 106 ++-
 drivers/net/bnxt/bnxt_cpr.c            |  20 +
 drivers/net/bnxt/bnxt_cpr.h            |   3 +-
 drivers/net/bnxt/bnxt_ethdev.c         | 253 ++++++--
 drivers/net/bnxt/bnxt_flow.c           |  98 ++-
 drivers/net/bnxt/bnxt_hwrm.c           | 853 +++++++++++++++++++++++--
 drivers/net/bnxt/bnxt_hwrm.h           |  16 +-
 drivers/net/bnxt/bnxt_reps.c           |   2 +-
 drivers/net/bnxt/bnxt_ring.c           |  19 +-
 drivers/net/bnxt/bnxt_rxq.c            |   8 +-
 drivers/net/bnxt/bnxt_rxq.h            |   1 +
 drivers/net/bnxt/bnxt_rxr.c            | 320 ++++++++--
 drivers/net/bnxt/bnxt_rxr.h            |  59 ++
 drivers/net/bnxt/bnxt_rxtx_vec_avx2.c  | 309 +++++++++
 drivers/net/bnxt/bnxt_rxtx_vec_sse.c   | 167 ++++-
 drivers/net/bnxt/bnxt_stats.c          | 279 +++++++-
 drivers/net/bnxt/bnxt_txq.c            |   2 +
 drivers/net/bnxt/bnxt_txr.c            |   7 +-
 drivers/net/bnxt/bnxt_vnic.c           | 195 +++++-
 drivers/net/bnxt/bnxt_vnic.h           |  20 +-
 drivers/net/bnxt/hsi_struct_def_dpdk.h |  10 +-
 21 files changed, 2542 insertions(+), 205 deletions(-)
Signature · 1 line
2.39.2 (Apple Git-143)
#1 lore raw

PATCH v3 1/18 net/bnxt: add support for UDP GSO

UDP GSO aka UDP Fragmentation Offload allows an application or stack to provide a data payload larger than the MTU. The application then updates the mbuf ol_flags and sets the PKT_TX_UDP_SEG flag. Then based on the tso_segs and tso_mss fields in the mbuf the PMD can indicate the UDP GSO transmit request to the hardware.
This feature is supported on Thor2 and will be enabled when the firmware sets the UDP GSO support via the HWRM_FUNC_QCAPS.

---
 drivers/net/bnxt/bnxt.h      | 1 +
 drivers/net/bnxt/bnxt_hwrm.c | 2 ++
 drivers/net/bnxt/bnxt_txq.c  | 2 ++
 drivers/net/bnxt/bnxt_txr.c  | 7 ++++++-
 4 files changed, 11 insertions(+), 1 deletion(-)
drivers/net/bnxt/bnxt.h +1 -0
index 7aed4c3da3..4b5c2c4b8f 100644
@@ -801,6 +801,7 @@ struct bnxt {
 	(BNXT_CHIP_P5_P7((bp)) && \
 	 (bp)->hwrm_spec_code >= HWRM_VERSION_1_9_2 && \
 	 !BNXT_VF((bp)))
+#define BNXT_FW_CAP_UDP_GSO		BIT(13)
 #define BNXT_TRUFLOW_EN(bp)	((bp)->fw_cap & BNXT_FW_CAP_TRUFLOW_EN &&\
 				 (bp)->app_id != 0xFF)
 
drivers/net/bnxt/bnxt_hwrm.c +2 -0
index e56f7693af..37cf179938 100644
@@ -950,6 +950,8 @@ static int __bnxt_hwrm_func_qcaps(struct bnxt *bp)
 	flags_ext2 = rte_le_to_cpu_32(resp->flags_ext2);
 	if (flags_ext2 & HWRM_FUNC_QCAPS_OUTPUT_FLAGS_EXT2_RX_ALL_PKTS_TIMESTAMPS_SUPPORTED)
 		bp->fw_cap |= BNXT_FW_CAP_RX_ALL_PKT_TS;
+	if (flags_ext2 & HWRM_FUNC_QCAPS_OUTPUT_FLAGS_EXT2_UDP_GSO_SUPPORTED)
+		bp->fw_cap |= BNXT_FW_CAP_UDP_GSO;
 
 unlock:
 	HWRM_UNLOCK();
drivers/net/bnxt/bnxt_txq.c +2 -0
index 4df4604975..f99ad211db 100644
@@ -42,6 +42,8 @@ uint64_t bnxt_get_tx_port_offloads(struct bnxt *bp)
 		tx_offload_capa |= RTE_ETH_TX_OFFLOAD_GENEVE_TNL_TSO;
 	if (BNXT_TUNNELED_OFFLOADS_CAP_IPINIP_EN(bp))
 		tx_offload_capa |= RTE_ETH_TX_OFFLOAD_IPIP_TNL_TSO;
+	if (bp->fw_cap & BNXT_FW_CAP_UDP_GSO)
+		tx_offload_capa |= RTE_ETH_TX_OFFLOAD_UDP_TSO;
 
 	return tx_offload_capa;
 }
drivers/net/bnxt/bnxt_txr.c +6 -1
index 899986764f..38da2d2829 100644
@@ -123,6 +123,10 @@ bnxt_xmit_need_long_bd(struct rte_mbuf *tx_pkt, struct bnxt_tx_queue *txq)
 	return false;
 }
 
+/* Used for verifying TSO segments during TCP Segmentation Offload or
+ * UDP Fragmentation Offload. tx_pkt->tso_segsz stores the number of
+ * segments or fragments in those cases.
+ */
 static bool
 bnxt_zero_data_len_tso_segsz(struct rte_mbuf *tx_pkt, uint8_t data_len_chk)
 {
@@ -308,7 +312,8 @@ static uint16_t bnxt_start_xmit(struct rte_mbuf *tx_pkt,
 		else
 			txbd1->cfa_action = txq->bp->tx_cfa_action;
 
-		if (tx_pkt->ol_flags & RTE_MBUF_F_TX_TCP_SEG) {
+		if (tx_pkt->ol_flags & RTE_MBUF_F_TX_TCP_SEG ||
+		    tx_pkt->ol_flags & RTE_MBUF_F_TX_UDP_SEG) {
 			uint16_t hdr_size;
 
 			/* TSO */
Signature · 1 line
2.39.2 (Apple Git-143)
#2 lore raw

PATCH v3 2/18 net/bnxt: add support for compressed Rx CQE

In reply to Ajit Khaparde

Thor2 supports compressed Rx completions instead of the full featured 32-byte Rx completions.
Add support for these compressed CQEs in scalar mode. Unlike in the typical Rx completions, the hardware does not provide the opaque field to index into the aggregator descriptor ring. So maintain the consumer index for the aggregation ring in the driver.

---
 drivers/net/bnxt/bnxt.h        |  17 +++
 drivers/net/bnxt/bnxt_ethdev.c |  51 +++++++++
 drivers/net/bnxt/bnxt_hwrm.c   |  16 +++
 drivers/net/bnxt/bnxt_ring.c   |  13 ++-
 drivers/net/bnxt/bnxt_rxr.c    | 201 +++++++++++++++++++++++++++++++++
 drivers/net/bnxt/bnxt_rxr.h    |  55 +++++++++
 6 files changed, 352 insertions(+), 1 deletion(-)
drivers/net/bnxt/bnxt.h +17 -0
index 4b5c2c4b8f..cfdbfd3f54 100644
@@ -782,6 +782,7 @@ struct bnxt {
 #define	BNXT_MULTIROOT_EN(bp)			\
 	((bp)->flags2 & BNXT_FLAGS2_MULTIROOT_EN)
 
+#define	BNXT_FLAGS2_COMPRESSED_RX_CQE		BIT(5)
 	uint32_t		fw_cap;
 #define BNXT_FW_CAP_HOT_RESET		BIT(0)
 #define BNXT_FW_CAP_IF_CHANGE		BIT(1)
@@ -814,6 +815,7 @@ struct bnxt {
 #define BNXT_VNIC_CAP_VLAN_RX_STRIP	BIT(3)
 #define BNXT_RX_VLAN_STRIP_EN(bp)	((bp)->vnic_cap_flags & BNXT_VNIC_CAP_VLAN_RX_STRIP)
 #define BNXT_VNIC_CAP_OUTER_RSS_TRUSTED_VF	BIT(4)
+#define BNXT_VNIC_CAP_L2_CQE_MODE		BIT(8)
 	unsigned int		rx_nr_rings;
 	unsigned int		rx_cp_nr_rings;
 	unsigned int		rx_num_qs_per_vnic;
@@ -1013,6 +1015,21 @@ inline uint16_t bnxt_max_rings(struct bnxt *bp)
 	return max_rings;
 }
 
+static inline bool
+bnxt_compressed_rx_cqe_mode_enabled(struct bnxt *bp)
+{
+	uint64_t rx_offloads = bp->eth_dev->data->dev_conf.rxmode.offloads;
+
+	if (bp->vnic_cap_flags & BNXT_VNIC_CAP_L2_CQE_MODE &&
+		bp->flags2 & BNXT_FLAGS2_COMPRESSED_RX_CQE &&
+		!(rx_offloads & RTE_ETH_RX_OFFLOAD_TCP_LRO) &&
+		!(rx_offloads & RTE_ETH_RX_OFFLOAD_BUFFER_SPLIT) &&
+		!bp->num_reps && !bp->ieee_1588)
+		return true;
+
+	return false;
+}
+
 #define BNXT_FC_TIMER	1 /* Timer freq in Sec Flow Counters */
 
 /**
drivers/net/bnxt/bnxt_ethdev.c +51 -0

78 lines not on this page · raw message

drivers/net/bnxt/bnxt_hwrm.c +16 -0
index 37cf179938..378be997d3 100644
@@ -2228,6 +2228,12 @@ int bnxt_hwrm_vnic_cfg(struct bnxt *bp, struct bnxt_vnic_info *vnic)
 	req.lb_rule = rte_cpu_to_le_16(vnic->lb_rule);
 
 config_mru:
+	if (bnxt_compressed_rx_cqe_mode_enabled(bp)) {
+		req.l2_cqe_mode = HWRM_VNIC_CFG_INPUT_L2_CQE_MODE_COMPRESSED;
+		enables |= HWRM_VNIC_CFG_INPUT_ENABLES_L2_CQE_MODE;
+		PMD_DRV_LOG(DEBUG, "Enabling compressed Rx CQE\n");
+	}
+
 	req.enables = rte_cpu_to_le_32(enables);
 	req.vnic_id = rte_cpu_to_le_16(vnic->fw_vnic_id);
 	req.mru = rte_cpu_to_le_16(vnic->mru);
@@ -2604,6 +2610,16 @@ 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_compressed_rx_cqe_mode_enabled(bp)) {
+		/* Don't worry if disabling TPA */
+		if (!enable)
+			return 0;
+
+		/* Return an error if enabling TPA w/ compressed Rx CQE. */
+		PMD_DRV_LOG(ERR, "No HW support for LRO with compressed Rx\n");
+		return -ENOTSUP;
+	}
+
 	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");
drivers/net/bnxt/bnxt_ring.c +12 -1
index 90cad6c9c6..4bf0b9c6ed 100644
@@ -573,6 +573,7 @@ static int bnxt_alloc_rx_agg_ring(struct bnxt *bp, int queue_index)
 		return rc;
 
 	rxr->ag_raw_prod = 0;
+	rxr->ag_cons = 0;
 	if (BNXT_HAS_RING_GRPS(bp))
 		bp->grp_info[queue_index].ag_fw_ring_id = ring->fw_ring_id;
 	bnxt_set_db(bp, &rxr->ag_db, ring_type, map_idx, ring->fw_ring_id,
@@ -595,7 +596,17 @@ int bnxt_alloc_hwrm_rx_ring(struct bnxt *bp, int queue_index)
 	 * Storage for the cp ring is allocated based on worst-case
 	 * usage, the actual size to be used by hw is computed here.
 	 */
-	cp_ring->ring_size = rxr->rx_ring_struct->ring_size * 2;
+	if (bnxt_compressed_rx_cqe_mode_enabled(bp)) {
+		if (bnxt_need_agg_ring(bp->eth_dev))
+			/* Worst case scenario, needed to accommodate Rx flush
+			 * completion during RING_FREE.
+			 */
+			cp_ring->ring_size = rxr->rx_ring_struct->ring_size * 2;
+		else
+			cp_ring->ring_size = rxr->rx_ring_struct->ring_size;
+	} else {
+		cp_ring->ring_size = rxr->rx_ring_struct->ring_size * 2;
+	}
 
 	if (bnxt_need_agg_ring(bp->eth_dev))
 		cp_ring->ring_size *= AGG_RING_SIZE_FACTOR;
drivers/net/bnxt/bnxt_rxr.c +201 -0

213 lines not on this page · raw message

drivers/net/bnxt/bnxt_rxr.h +55 -0

79 lines not on this page · raw message

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

PATCH v3 3/18 net/bnxt: fix a typo while parsing link speed

In reply to Ajit Khaparde

From: Kalesh AP <[email protected]>

While setting forced speed, the speed should have mapped to macro "HWRM_PORT_PHY_CFG_INPUT_FORCE_xxx" instead of "HWRM_PORT_PHY_CFG_INPUT_AUTO_xxx". We do not see any issue as both these macros are defined to the same value.

Fixing it for better convey the intent.

---
 drivers/net/bnxt/bnxt_hwrm.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)
drivers/net/bnxt/bnxt_hwrm.c +5 -5
index 378be997d3..8f99582819 100644
@@ -3168,15 +3168,15 @@ static uint16_t bnxt_parse_eth_link_speed(uint32_t conf_link_speed,
 	case RTE_ETH_LINK_SPEED_100M_HD:
 		/* FALLTHROUGH */
 		eth_link_speed =
-			HWRM_PORT_PHY_CFG_INPUT_AUTO_LINK_SPEED_100MB;
+			HWRM_PORT_PHY_CFG_INPUT_FORCE_LINK_SPEED_100MB;
 		break;
 	case RTE_ETH_LINK_SPEED_1G:
 		eth_link_speed =
-			HWRM_PORT_PHY_CFG_INPUT_AUTO_LINK_SPEED_1GB;
+			HWRM_PORT_PHY_CFG_INPUT_FORCE_LINK_SPEED_1GB;
 		break;
 	case RTE_ETH_LINK_SPEED_2_5G:
 		eth_link_speed =
-			HWRM_PORT_PHY_CFG_INPUT_AUTO_LINK_SPEED_2_5GB;
+			HWRM_PORT_PHY_CFG_INPUT_FORCE_LINK_SPEED_2_5GB;
 		break;
 	case RTE_ETH_LINK_SPEED_10G:
 		eth_link_speed =
@@ -3184,11 +3184,11 @@ static uint16_t bnxt_parse_eth_link_speed(uint32_t conf_link_speed,
 		break;
 	case RTE_ETH_LINK_SPEED_20G:
 		eth_link_speed =
-			HWRM_PORT_PHY_CFG_INPUT_AUTO_LINK_SPEED_20GB;
+			HWRM_PORT_PHY_CFG_INPUT_FORCE_LINK_SPEED_20GB;
 		break;
 	case RTE_ETH_LINK_SPEED_25G:
 		eth_link_speed =
-			HWRM_PORT_PHY_CFG_INPUT_AUTO_LINK_SPEED_25GB;
+			HWRM_PORT_PHY_CFG_INPUT_FORCE_LINK_SPEED_25GB;
 		break;
 	case RTE_ETH_LINK_SPEED_40G:
 		eth_link_speed =
Signature · 1 line
2.39.2 (Apple Git-143)
#4 lore raw

PATCH v3 4/18 net/bnxt: fix setting 50G and 100G forced speed

In reply to Ajit Khaparde

From: Kalesh AP <[email protected]>

Thor based NICs can support PAM4 as well as NRZ link negotiation. While PAM4 can negotiate speeds at 50G, 100G and 200G, the PMD will use NRZ signaling for 50G and 100G speeds. PAM4 signaling will be used only for 200G speed negotiations.

Driver has to check for NRZ speed support first while forcing speed.

Fixes c23f9ded0391 ("net/bnxt: support 200G PAM4 link")
---
 drivers/net/bnxt/bnxt_hwrm.c | 22 ++++++++++++----------
 1 file changed, 12 insertions(+), 10 deletions(-)
drivers/net/bnxt/bnxt_hwrm.c +12 -10
index 8f99582819..c31a5d4226 100644
@@ -3158,6 +3158,8 @@ static uint16_t bnxt_check_eth_link_autoneg(uint32_t conf_link)
 static uint16_t bnxt_parse_eth_link_speed(uint32_t conf_link_speed,
 					  struct bnxt_link_info *link_info)
 {
+	uint16_t support_pam4_speeds = link_info->support_pam4_speeds;
+	uint16_t support_speeds = link_info->support_speeds;
 	uint16_t eth_link_speed = 0;
 
 	if (conf_link_speed == RTE_ETH_LINK_SPEED_AUTONEG)
@@ -3195,23 +3197,23 @@ static uint16_t bnxt_parse_eth_link_speed(uint32_t conf_link_speed,
 			HWRM_PORT_PHY_CFG_INPUT_FORCE_LINK_SPEED_40GB;
 		break;
 	case RTE_ETH_LINK_SPEED_50G:
-		if (link_info->support_pam4_speeds &
-		    HWRM_PORT_PHY_QCFG_OUTPUT_SUPPORT_PAM4_SPEEDS_50G) {
-			eth_link_speed = HWRM_PORT_PHY_CFG_INPUT_FORCE_PAM4_LINK_SPEED_50GB;
-			link_info->link_signal_mode = BNXT_SIG_MODE_PAM4;
-		} else {
+		if (support_speeds & HWRM_PORT_PHY_QCFG_OUTPUT_SUPPORT_SPEEDS_50GB) {
 			eth_link_speed = HWRM_PORT_PHY_CFG_INPUT_FORCE_LINK_SPEED_50GB;
 			link_info->link_signal_mode = BNXT_SIG_MODE_NRZ;
+		} else if (support_pam4_speeds &
+			   HWRM_PORT_PHY_QCFG_OUTPUT_SUPPORT_PAM4_SPEEDS_50G) {
+			eth_link_speed = HWRM_PORT_PHY_CFG_INPUT_FORCE_PAM4_LINK_SPEED_50GB;
+			link_info->link_signal_mode = BNXT_SIG_MODE_PAM4;
 		}
 		break;
 	case RTE_ETH_LINK_SPEED_100G:
-		if (link_info->support_pam4_speeds &
-		    HWRM_PORT_PHY_QCFG_OUTPUT_SUPPORT_PAM4_SPEEDS_100G) {
-			eth_link_speed = HWRM_PORT_PHY_CFG_INPUT_FORCE_PAM4_LINK_SPEED_100GB;
-			link_info->link_signal_mode = BNXT_SIG_MODE_PAM4;
-		} else {
+		if (support_speeds & HWRM_PORT_PHY_QCFG_OUTPUT_SUPPORT_SPEEDS_100GB) {
 			eth_link_speed = HWRM_PORT_PHY_CFG_INPUT_FORCE_LINK_SPEED_100GB;
 			link_info->link_signal_mode = BNXT_SIG_MODE_NRZ;
+		} else if (support_pam4_speeds &
+			   HWRM_PORT_PHY_QCFG_OUTPUT_SUPPORT_PAM4_SPEEDS_100G) {
+			eth_link_speed = HWRM_PORT_PHY_CFG_INPUT_FORCE_PAM4_LINK_SPEED_100GB;
+			link_info->link_signal_mode = BNXT_SIG_MODE_PAM4;
 		}
 		break;
 	case RTE_ETH_LINK_SPEED_200G:
Signature · 1 line
2.39.2 (Apple Git-143)
#5 lore raw

PATCH v3 5/18 net/bnxt: fix speed change from 200G to 25G on Thor

In reply to Ajit Khaparde

From: Kalesh AP <[email protected]>

While forcing speed to 200G, driver sets the structure variable "bp->link_info->link_signal_mode" value to BNXT_SIG_MODE_PAM4. After that when the user forces the speed back to 25G, this cached value is not set back to BNXT_SIG_MODE_NRZ which results in issuing the HWRM_PORT_PHY_CFG command with wrong inputs.

Fixes c23f9ded0391 ("net/bnxt: support 200G PAM4 link")
---
 drivers/net/bnxt/bnxt_hwrm.c | 1 +
 1 file changed, 1 insertion(+)
drivers/net/bnxt/bnxt_hwrm.c +1 -0
index c31a5d4226..a1f3a8251f 100644
@@ -3191,6 +3191,7 @@ static uint16_t bnxt_parse_eth_link_speed(uint32_t conf_link_speed,
 	case RTE_ETH_LINK_SPEED_25G:
 		eth_link_speed =
 			HWRM_PORT_PHY_CFG_INPUT_FORCE_LINK_SPEED_25GB;
+		link_info->link_signal_mode = BNXT_SIG_MODE_NRZ;
 		break;
 	case RTE_ETH_LINK_SPEED_40G:
 		eth_link_speed =
Signature · 1 line
2.39.2 (Apple Git-143)
#6 lore raw

PATCH v3 6/18 net/bnxt: support backward compatibility

In reply to Ajit Khaparde

From: Kalesh AP <[email protected]>

On older firmware versions, HWRM_FUNC_QCAPS response is not returning the maximum number of multicast filters that can be supported by the function. As a result, memory allocation with size 0 fails.

Bugzilla ID: 1309
Cc: [email protected]

---
 drivers/net/bnxt/bnxt.h      | 1 +
 drivers/net/bnxt/bnxt_hwrm.c | 2 ++
 2 files changed, 3 insertions(+)
drivers/net/bnxt/bnxt.h +1 -0
index cfdbfd3f54..cd85a944e8 100644
@@ -974,6 +974,7 @@ struct bnxt {
 	struct rte_ether_addr	*mcast_addr_list;
 	rte_iova_t		mc_list_dma_addr;
 	uint32_t		nb_mc_addr;
+#define BNXT_DFLT_MAX_MC_ADDR	16 /* for compatibility with older firmware */
 	uint32_t		max_mcast_addr; /* maximum number of mcast filters supported */
 
 	struct rte_eth_rss_conf	rss_conf; /* RSS configuration. */
drivers/net/bnxt/bnxt_hwrm.c +2 -0
index a1f3a8251f..d649f217ec 100644
@@ -901,6 +901,8 @@ static int __bnxt_hwrm_func_qcaps(struct bnxt *bp)
 		    bp->max_l2_ctx, bp->max_vnics);
 	bp->max_stat_ctx = rte_le_to_cpu_16(resp->max_stat_ctx);
 	bp->max_mcast_addr = rte_le_to_cpu_32(resp->max_mcast_filters);
+	if (!bp->max_mcast_addr)
+		bp->max_mcast_addr = BNXT_DFLT_MAX_MC_ADDR;
 	memcpy(bp->dsn, resp->device_serial_number, sizeof(bp->dsn));
 
 	if (BNXT_PF(bp))
Signature · 1 line
2.39.2 (Apple Git-143)
#7 lore raw

PATCH v3 7/18 net/bnxt: reattempt mbuf allocation for Rx and AGG rings

In reply to Ajit Khaparde

Normally the PMD allocates a new mbuf for every mbuf consumed. In case of mbuf alloc failure, that slot in the Rx or AGG ring remains empty till a new mbuf is not allocated for that slot. If this happens too frequently the Rx ring or the aggregation ring could be completely drained of mbufs and can cause unexpected behavior.

To prevent this, in case of an mbuf allocation failure, set a bit and try to reattempt mbuf allocation to fill the empty slots. Since this should not happen under normal circumstances, it should not impact regular Rx performance.

The need_realloc bit is set in the RxQ if mbuf allocation fails for Rx ring or the AGG ring.

As long as the application calls the Rx burst function even in cases where the Rx rings became completely empty, the logic should be able to reattempt buffer allocation for the associated Rx and aggregation rings.

---
 drivers/net/bnxt/bnxt_rxq.h |   1 +
 drivers/net/bnxt/bnxt_rxr.c | 101 ++++++++++++++++++++++--------------
 2 files changed, 64 insertions(+), 38 deletions(-)
drivers/net/bnxt/bnxt_rxq.h +1 -0
index b9908be5f4..77bc382a1d 100644
@@ -41,6 +41,7 @@ struct bnxt_rx_queue {
 	struct bnxt_cp_ring_info	*cp_ring;
 	struct rte_mbuf			fake_mbuf;
 	uint64_t			rx_mbuf_alloc_fail;
+	uint8_t				need_realloc;
 	const struct rte_memzone *mz;
 };
 
drivers/net/bnxt/bnxt_rxr.c +63 -38

169 lines not on this page · raw message

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

PATCH v3 8/18 net/bnxt: refactor Rx doorbell during Rx flush

In reply to Ajit Khaparde

Ring the Rx doorbell during the Rx ring flush processing only if there is a valid completion.

---
 drivers/net/bnxt/bnxt_rxr.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)
drivers/net/bnxt/bnxt_rxr.c +5 -4
index c5c9f9e6e6..d0706874a6 100644
@@ -1713,10 +1713,11 @@ int bnxt_flush_rx_cmp(struct bnxt_cp_ring_info *cpr)
 		nb_rx++;
 	} while (nb_rx < ring_mask);
 
-	cpr->cp_raw_cons = raw_cons;
-
-	/* Ring the completion queue doorbell. */
-	bnxt_db_cq(cpr);
+	if (nb_rx) {
+		cpr->cp_raw_cons = raw_cons;
+		/* Ring the completion queue doorbell. */
+		bnxt_db_cq(cpr);
+	}
 
 	return 0;
 }
Signature · 1 line
2.39.2 (Apple Git-143)
#9 lore raw

PATCH v3 9/18 net/bnxt: extend RSS hash support for P7 devices

In reply to Ajit Khaparde

P7 adapters support XOR based and checksum based RSS hashing. Add support for checksum and XOR based RSS hash for these adapters.

---
 drivers/net/bnxt/bnxt.h        |  15 +--
 drivers/net/bnxt/bnxt_ethdev.c |  72 ++++++---------
 drivers/net/bnxt/bnxt_flow.c   |  37 +++++++-
 drivers/net/bnxt/bnxt_hwrm.c   |   6 ++
 drivers/net/bnxt/bnxt_reps.c   |   2 +-
 drivers/net/bnxt/bnxt_vnic.c   | 161 +++++++++++++++++++++++++++++++--
 drivers/net/bnxt/bnxt_vnic.h   |  18 +++-
 7 files changed, 242 insertions(+), 69 deletions(-)
drivers/net/bnxt/bnxt.h +5 -10
index cd85a944e8..e7b288c849 100644
@@ -638,15 +638,6 @@ struct bnxt_rep_info {
 #define BNXT_FW_STATUS_HEALTHY		0x8000
 #define BNXT_FW_STATUS_SHUTDOWN		0x100000
 
-#define BNXT_ETH_RSS_SUPPORT (	\
-	RTE_ETH_RSS_IPV4 |		\
-	RTE_ETH_RSS_NONFRAG_IPV4_TCP |	\
-	RTE_ETH_RSS_NONFRAG_IPV4_UDP |	\
-	RTE_ETH_RSS_IPV6 |		\
-	RTE_ETH_RSS_NONFRAG_IPV6_TCP |	\
-	RTE_ETH_RSS_NONFRAG_IPV6_UDP |	\
-	RTE_ETH_RSS_LEVEL_MASK)
-
 #define BNXT_HWRM_SHORT_REQ_LEN		sizeof(struct hwrm_short_input)
 
 struct bnxt_flow_stat_info {
@@ -815,7 +806,10 @@ struct bnxt {
 #define BNXT_VNIC_CAP_VLAN_RX_STRIP	BIT(3)
 #define BNXT_RX_VLAN_STRIP_EN(bp)	((bp)->vnic_cap_flags & BNXT_VNIC_CAP_VLAN_RX_STRIP)
 #define BNXT_VNIC_CAP_OUTER_RSS_TRUSTED_VF	BIT(4)
-#define BNXT_VNIC_CAP_L2_CQE_MODE		BIT(8)
+#define BNXT_VNIC_CAP_XOR_MODE		BIT(5)
+#define BNXT_VNIC_CAP_CHKSM_MODE	BIT(6)
+#define BNXT_VNIC_CAP_L2_CQE_MODE	BIT(8)
+
 	unsigned int		rx_nr_rings;
 	unsigned int		rx_cp_nr_rings;
 	unsigned int		rx_num_qs_per_vnic;
@@ -1176,4 +1170,5 @@ void bnxt_handle_vf_cfg_change(void *arg);
 int bnxt_flow_meter_ops_get(struct rte_eth_dev *eth_dev, void *arg);
 struct bnxt_vnic_info *bnxt_get_default_vnic(struct bnxt *bp);
 struct tf *bnxt_get_tfp_session(struct bnxt *bp, enum bnxt_session_type type);
+uint64_t bnxt_eth_rss_support(struct bnxt *bp);
 #endif
drivers/net/bnxt/bnxt_ethdev.c +29 -43

115 lines not on this page · raw message

drivers/net/bnxt/bnxt_flow.c +33 -4
index 15f0e1b308..2d707b48d2 100644
@@ -881,6 +881,7 @@ static void bnxt_vnic_cleanup(struct bnxt *bp, struct bnxt_vnic_info *vnic)
 	vnic->fw_grp_ids = NULL;
 
 	vnic->rx_queue_cnt = 0;
+	vnic->hash_type = 0;
 }
 
 static int bnxt_vnic_prep(struct bnxt *bp, struct bnxt_vnic_info *vnic,
@@ -1067,7 +1068,7 @@ bnxt_vnic_rss_cfg_update(struct bnxt *bp,
 {
 	const struct rte_flow_action_rss *rss;
 	unsigned int rss_idx, i, j, fw_idx;
-	uint16_t hash_type;
+	uint32_t hash_type;
 	uint64_t types;
 	int rc;
 
@@ -1115,9 +1116,9 @@ bnxt_vnic_rss_cfg_update(struct bnxt *bp,
 		}
 	}
 
-	/* Currently only Toeplitz hash is supported. */
-	if (rss->func != RTE_ETH_HASH_FUNCTION_DEFAULT &&
-	    rss->func != RTE_ETH_HASH_FUNCTION_TOEPLITZ) {
+	if (BNXT_IS_HASH_FUNC_DEFAULT(rss->func) &&
+	    BNXT_IS_HASH_FUNC_TOEPLITZ(rss->func) &&
+	    BNXT_IS_HASH_FUNC_SIMPLE_XOR(bp, rss->func)) {
 		rte_flow_error_set(error,
 				   ENOTSUP,
 				   RTE_FLOW_ERROR_TYPE_ACTION,
@@ -1175,6 +1176,34 @@ bnxt_vnic_rss_cfg_update(struct bnxt *bp,
 	vnic->hash_mode =
 		bnxt_rte_to_hwrm_hash_level(bp, rss->types, rss->level);
 
+	/* For P7 chips update the hash_type if hash_type not explicitly passed.
+	 * TODO: For P5 chips.
+	 */
+	if (BNXT_CHIP_P7(bp) &&
+	    vnic->hash_mode == BNXT_HASH_MODE_DEFAULT && !hash_type)
+		vnic->hash_type = HWRM_VNIC_RSS_CFG_INPUT_HASH_TYPE_IPV4 |
+			HWRM_VNIC_RSS_CFG_INPUT_HASH_TYPE_IPV6;
+
+	/* TODO:
+	 * hash will be performed on the L3 and L4 packet headers.
+	 * specific RSS hash types like IPv4-TCP etc... or L4-chksum or IPV4-chksum
+	 * will NOT have any bearing and will not be honored.
+	 * Check and reject flow create accordingly. TODO.
+	 */
+
+	rc = bnxt_rte_flow_to_hwrm_ring_select_mode(rss->func,
+						    rss->types,
+						    bp, vnic);
+	if (rc) {
+		rte_flow_error_set(error,
+				   ENOTSUP,
+				   RTE_FLOW_ERROR_TYPE_ACTION,
+				   act,
+				   "Unsupported RSS hash parameters");
+		rc = -rte_errno;
+		goto ret;
+	}
+
 	/* Update RSS key only if key_len != 0 */
 	if (rss->key_len != 0)
 		memcpy(vnic->rss_hash_key, rss->key, rss->key_len);
drivers/net/bnxt/bnxt_hwrm.c +6 -0
index d649f217ec..587433a878 100644
@@ -1025,6 +1025,12 @@ int bnxt_hwrm_vnic_qcaps(struct bnxt *bp)
 		PMD_DRV_LOG(DEBUG, "Rx VLAN strip capability enabled\n");
 	}
 
+	if (flags & HWRM_VNIC_QCAPS_OUTPUT_FLAGS_RING_SELECT_MODE_XOR_CAP)
+		bp->vnic_cap_flags |= BNXT_VNIC_CAP_XOR_MODE;
+
+	if (flags & HWRM_VNIC_QCAPS_OUTPUT_FLAGS_RING_SELECT_MODE_TOEPLITZ_CHKSM_CAP)
+		bp->vnic_cap_flags |= BNXT_VNIC_CAP_CHKSM_MODE;
+
 	bp->max_tpa_v2 = rte_le_to_cpu_16(resp->max_aggs_supported);
 
 	HWRM_UNLOCK();
drivers/net/bnxt/bnxt_reps.c +1 -1
index 78337431af..d96d972904 100644
@@ -569,7 +569,7 @@ int bnxt_rep_dev_info_get_op(struct rte_eth_dev *eth_dev,
 
 	dev_info->rx_offload_capa = bnxt_get_rx_port_offloads(parent_bp);
 	dev_info->tx_offload_capa = bnxt_get_tx_port_offloads(parent_bp);
-	dev_info->flow_type_rss_offloads = BNXT_ETH_RSS_SUPPORT;
+	dev_info->flow_type_rss_offloads = bnxt_eth_rss_support(parent_bp);
 
 	dev_info->switch_info.name = eth_dev->device->name;
 	dev_info->switch_info.domain_id = rep_bp->switch_domain_id;
drivers/net/bnxt/bnxt_vnic.c +152 -9

226 lines not on this page · raw message

drivers/net/bnxt/bnxt_vnic.h +16 -2
index 7a6a0aa739..d01c9ebdb4 100644
@@ -31,6 +31,11 @@
 	 (BNXT_VF(bp) && BNXT_VF_IS_TRUSTED(bp) &&				\
 	  !((bp)->vnic_cap_flags & BNXT_VNIC_CAP_OUTER_RSS_TRUSTED_VF)) ||	\
 	 (BNXT_VF(bp) && !BNXT_VF_IS_TRUSTED(bp)))
+#define BNXT_IS_HASH_FUNC_DEFAULT(f)	((f) != RTE_ETH_HASH_FUNCTION_DEFAULT)
+#define BNXT_IS_HASH_FUNC_TOEPLITZ(f)	((f) != RTE_ETH_HASH_FUNCTION_TOEPLITZ)
+#define BNXT_IS_HASH_FUNC_SIMPLE_XOR(b, f)	\
+	((b)->vnic_cap_flags & BNXT_VNIC_CAP_XOR_MODE && \
+	 ((f) != RTE_ETH_HASH_FUNCTION_SIMPLE_XOR))
 
 struct bnxt_vnic_info {
 	STAILQ_ENTRY(bnxt_vnic_info)	next;
@@ -73,6 +78,7 @@ struct bnxt_vnic_info {
 
 	STAILQ_HEAD(, bnxt_filter_info)	filter;
 	STAILQ_HEAD(, rte_flow)	flow_list;
+	uint8_t		ring_select_mode;
 };
 
 struct bnxt_vnic_queue_db {
@@ -83,6 +89,7 @@ struct bnxt_vnic_queue_db {
 
 /* RSS structure to pass values as an structure argument*/
 struct bnxt_vnic_rss_info {
+	uint32_t rss_func;
 	uint32_t rss_level;
 	uint64_t rss_types;
 	uint32_t key_len; /**< Hash key length in bytes. */
@@ -102,7 +109,7 @@ void bnxt_free_vnic_mem(struct bnxt *bp);
 int bnxt_alloc_vnic_mem(struct bnxt *bp);
 int bnxt_vnic_grp_alloc(struct bnxt *bp, struct bnxt_vnic_info *vnic);
 void bnxt_prandom_bytes(void *dest_ptr, size_t len);
-uint16_t bnxt_rte_to_hwrm_hash_types(uint64_t rte_type);
+uint32_t bnxt_rte_to_hwrm_hash_types(uint64_t rte_type);
 int bnxt_rte_to_hwrm_hash_level(struct bnxt *bp, uint64_t hash_f, uint32_t lvl);
 uint64_t bnxt_hwrm_to_rte_rss_level(struct bnxt *bp, uint32_t mode);
 
@@ -139,5 +146,12 @@ struct bnxt_vnic_info *
 bnxt_vnic_queue_id_get_next(struct bnxt *bp, uint16_t queue_id,
 			    uint16_t *vnic_idx);
 void bnxt_vnic_tpa_cfg(struct bnxt *bp, uint16_t queue_id, bool flag);
-
+uint8_t _bnxt_rte_to_hwrm_ring_select_mode(enum rte_eth_hash_function hash_f);
+int bnxt_rte_flow_to_hwrm_ring_select_mode(enum rte_eth_hash_function hash_f,
+					   uint64_t types, struct bnxt *bp,
+					   struct bnxt_vnic_info *vnic);
+int bnxt_rte_eth_to_hwrm_ring_select_mode(struct bnxt *bp, uint64_t types,
+					  struct bnxt_vnic_info *vnic);
+void bnxt_hwrm_rss_to_rte_hash_conf(struct bnxt_vnic_info *vnic,
+				    uint64_t *rss_conf);
 #endif
Signature · 1 line
2.39.2 (Apple Git-143)
#10 lore raw

PATCH v3 10/18 net/bnxt: add flow query callback

In reply to Ajit Khaparde

From: Damodharam Ammepalli <[email protected]>

This patch addsbnxt query callback to rte_flow_ops in non TruFlow mode. At this point only the RSS hash function type is displayed.

---
 drivers/net/bnxt/bnxt_flow.c | 61 ++++++++++++++++++++++++++++++++++++
 drivers/net/bnxt/bnxt_vnic.c | 11 +++++++
 drivers/net/bnxt/bnxt_vnic.h |  2 ++
 3 files changed, 74 insertions(+)
drivers/net/bnxt/bnxt_flow.c +61 -0
index 2d707b48d2..f25bc6ff78 100644
@@ -1917,6 +1917,66 @@ void bnxt_flow_cnt_alarm_cb(void *arg)
 			  (void *)bp);
 }
 
+/* Query an requested flow rule. */
+static int
+bnxt_flow_query_all(struct rte_flow *flow,
+		    const struct rte_flow_action *actions, void *data,
+		    struct rte_flow_error *error)
+{
+	struct rte_flow_action_rss *rss_conf;
+	struct bnxt_vnic_info *vnic;
+
+	vnic = flow->vnic;
+	if (vnic == NULL)
+		return rte_flow_error_set(error, EINVAL,
+					  RTE_FLOW_ERROR_TYPE_HANDLE, flow,
+					  "Invalid flow: failed to query flow.");
+
+	for (; actions->type != RTE_FLOW_ACTION_TYPE_END; actions++) {
+		switch (actions->type) {
+		case RTE_FLOW_ACTION_TYPE_VOID:
+			break;
+		case RTE_FLOW_ACTION_TYPE_COUNT:
+			break;
+		case RTE_FLOW_ACTION_TYPE_RSS:
+			/* Full details of rte_flow_action_rss not available yet TBD*/
+			rss_conf = (struct rte_flow_action_rss *)data;
+
+			/* toeplitz is default */
+			if (vnic->ring_select_mode ==
+					HWRM_VNIC_RSS_CFG_INPUT_RING_SELECT_MODE_TOEPLITZ)
+				rss_conf->func = vnic->hash_f_local;
+			else
+				rss_conf->func = RTE_ETH_HASH_FUNCTION_SIMPLE_XOR;
+
+			break;
+		default:
+			return rte_flow_error_set(error, ENOTSUP,
+						  RTE_FLOW_ERROR_TYPE_ACTION, actions,
+						  "action is not supported");
+		}
+	}
+
+	return 0;
+}
+
+static int
+bnxt_flow_query(struct rte_eth_dev *dev, struct rte_flow *flow,
+		const struct rte_flow_action *actions, void *data,
+		struct rte_flow_error *error)
+{
+	struct bnxt *bp = dev->data->dev_private;
+	int ret = 0;
+
+	if (bp == NULL)
+		return -ENODEV;
+
+	bnxt_acquire_flow_lock(bp);
+	ret = bnxt_flow_query_all(flow, actions, data, error);
+	bnxt_release_flow_lock(bp);
+
+	return ret;
+}
 
 static struct rte_flow *
 bnxt_flow_create(struct rte_eth_dev *dev,
@@ -2374,4 +2434,5 @@ const struct rte_flow_ops bnxt_flow_ops = {
 	.create = bnxt_flow_create,
 	.destroy = bnxt_flow_destroy,
 	.flush = bnxt_flow_flush,
+	.query = bnxt_flow_query,
 };
drivers/net/bnxt/bnxt_vnic.c +11 -0
index 6a57f85ea7..bf1f0ea09f 100644
@@ -1335,6 +1335,9 @@ int bnxt_rte_flow_to_hwrm_ring_select_mode(enum rte_eth_hash_function hash_f,
 	}
 
 	vnic->ring_select_mode = _bnxt_rte_to_hwrm_ring_select_mode(hash_f);
+	vnic->hash_f_local = hash_f;
+	/* shadow copy types as !hash_f is always true with default func */
+	vnic->rss_types_local = types;
 	return 0;
 }
 
@@ -1359,6 +1362,8 @@ int bnxt_rte_eth_to_hwrm_ring_select_mode(struct bnxt *bp, uint64_t types,
 	 */
 	vnic->ring_select_mode =
 		HWRM_VNIC_RSS_CFG_INPUT_RING_SELECT_MODE_TOEPLITZ;
+	vnic->hash_f_local =
+		HWRM_VNIC_RSS_CFG_INPUT_RING_SELECT_MODE_TOEPLITZ;
 	return 0;
 }
 
@@ -1367,6 +1372,12 @@ void bnxt_hwrm_rss_to_rte_hash_conf(struct bnxt_vnic_info *vnic,
 {
 	uint32_t hash_types;
 
+	/* check for local shadow rte types */
+	if (vnic->rss_types_local != 0) {
+		*rss_conf = vnic->rss_types_local;
+		return;
+	}
+
 	hash_types = vnic->hash_type;
 	*rss_conf = 0;
 	if (hash_types & HWRM_VNIC_RSS_CFG_INPUT_HASH_TYPE_IPV4)
drivers/net/bnxt/bnxt_vnic.h +2 -0
index d01c9ebdb4..93155648e2 100644
@@ -79,6 +79,8 @@ struct bnxt_vnic_info {
 	STAILQ_HEAD(, bnxt_filter_info)	filter;
 	STAILQ_HEAD(, rte_flow)	flow_list;
 	uint8_t		ring_select_mode;
+	enum rte_eth_hash_function hash_f_local;
+	uint64_t	rss_types_local;
 };
 
 struct bnxt_vnic_queue_db {
Signature · 1 line
2.39.2 (Apple Git-143)
#11 lore raw

PATCH v3 11/18 net/bnxt: add ESP and AH header based RSS support

In reply to Ajit Khaparde

Check if the firmware can support RSS based on these types and program the hardware accordingly when requested when the firmware indicates that the underlying hardware supports the functionality.

---
 drivers/net/bnxt/bnxt.h        |   6 ++
 drivers/net/bnxt/bnxt_ethdev.c |   8 ++-
 drivers/net/bnxt/bnxt_hwrm.c   | 104 +++++++++++++++++++++++++--------
 drivers/net/bnxt/bnxt_hwrm.h   |   1 +
 drivers/net/bnxt/bnxt_vnic.c   |  13 ++++-
 5 files changed, 102 insertions(+), 30 deletions(-)
drivers/net/bnxt/bnxt.h +6 -0
index e7b288c849..576688bbff 100644
@@ -809,6 +809,12 @@ struct bnxt {
 #define BNXT_VNIC_CAP_XOR_MODE		BIT(5)
 #define BNXT_VNIC_CAP_CHKSM_MODE	BIT(6)
 #define BNXT_VNIC_CAP_L2_CQE_MODE	BIT(8)
+#define BNXT_VNIC_CAP_AH_SPI4_CAP	BIT(9)
+#define BNXT_VNIC_CAP_AH_SPI6_CAP	BIT(10)
+#define BNXT_VNIC_CAP_ESP_SPI4_CAP	BIT(11)
+#define BNXT_VNIC_CAP_ESP_SPI6_CAP	BIT(12)
+#define BNXT_VNIC_CAP_AH_SPI_CAP	(BNXT_VNIC_CAP_AH_SPI4_CAP | BNXT_VNIC_CAP_AH_SPI6_CAP)
+#define BNXT_VNIC_CAP_ESP_SPI_CAP	(BNXT_VNIC_CAP_ESP_SPI4_CAP | BNXT_VNIC_CAP_ESP_SPI6_CAP)
 
 	unsigned int		rx_nr_rings;
 	unsigned int		rx_cp_nr_rings;
drivers/net/bnxt/bnxt_ethdev.c +6 -2
index ef5e65ff16..5b775e7716 100644
@@ -995,8 +995,12 @@ uint64_t bnxt_eth_rss_support(struct bnxt *bp)
 		  RTE_ETH_RSS_LEVEL_MASK;
 
 	if (bp->vnic_cap_flags & BNXT_VNIC_CAP_CHKSM_MODE)
-		support |= (RTE_ETH_RSS_IPV4_CHKSUM |
-			    RTE_ETH_RSS_L4_CHKSUM);
+		support |= RTE_ETH_RSS_IPV4_CHKSUM |
+			   RTE_ETH_RSS_L4_CHKSUM;
+	if (bp->vnic_cap_flags & BNXT_VNIC_CAP_AH_SPI_CAP)
+		support |= RTE_ETH_RSS_AH;
+	if (bp->vnic_cap_flags & BNXT_VNIC_CAP_ESP_SPI_CAP)
+		support |= RTE_ETH_RSS_ESP;
 
 	return support;
 }
drivers/net/bnxt/bnxt_hwrm.c +79 -25

149 lines not on this page · raw message

drivers/net/bnxt/bnxt_hwrm.h +1 -0
index 3d5194257b..56b232d7de 100644
@@ -357,6 +357,7 @@ 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_vnic_rss_configure_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);
drivers/net/bnxt/bnxt_vnic.c +10 -3
index bf1f0ea09f..5ea34f7cb6 100644
@@ -268,6 +268,8 @@ uint32_t bnxt_rte_to_hwrm_hash_types(uint64_t rte_type)
 	if ((rte_type & RTE_ETH_RSS_IPV4) ||
 	    (rte_type & RTE_ETH_RSS_ECPRI))
 		hwrm_type |= HWRM_VNIC_RSS_CFG_INPUT_HASH_TYPE_IPV4;
+	if (rte_type & RTE_ETH_RSS_ECPRI)
+		hwrm_type |= HWRM_VNIC_RSS_CFG_INPUT_HASH_TYPE_IPV4;
 	if (rte_type & RTE_ETH_RSS_NONFRAG_IPV4_TCP)
 		hwrm_type |= HWRM_VNIC_RSS_CFG_INPUT_HASH_TYPE_TCP_IPV4;
 	if (rte_type & RTE_ETH_RSS_NONFRAG_IPV4_UDP)
@@ -278,9 +280,12 @@ uint32_t bnxt_rte_to_hwrm_hash_types(uint64_t rte_type)
 		hwrm_type |= HWRM_VNIC_RSS_CFG_INPUT_HASH_TYPE_TCP_IPV6;
 	if (rte_type & RTE_ETH_RSS_NONFRAG_IPV6_UDP)
 		hwrm_type |= HWRM_VNIC_RSS_CFG_INPUT_HASH_TYPE_UDP_IPV6;
-	if (rte_type & RTE_ETH_RSS_IPV4_CHKSUM)
-		hwrm_type |=
-			HWRM_VNIC_RSS_CFG_INPUT_RING_SELECT_MODE_TOEPLITZ_CHECKSUM;
+	if (rte_type & RTE_ETH_RSS_ESP)
+		hwrm_type |= HWRM_VNIC_RSS_CFG_INPUT_HASH_TYPE_ESP_SPI_IPV4 |
+			     HWRM_VNIC_RSS_CFG_INPUT_HASH_TYPE_ESP_SPI_IPV6;
+	if (rte_type & RTE_ETH_RSS_AH)
+		hwrm_type |= HWRM_VNIC_RSS_CFG_INPUT_HASH_TYPE_AH_SPI_IPV4 |
+			     HWRM_VNIC_RSS_CFG_INPUT_HASH_TYPE_AH_SPI_IPV6;
 
 	return hwrm_type;
 }
@@ -1327,7 +1332,9 @@ int bnxt_rte_flow_to_hwrm_ring_select_mode(enum rte_eth_hash_function hash_f,
 			/* Checksum mode cannot with hash func makes no sense */
 			vnic->ring_select_mode =
 				HWRM_VNIC_RSS_CFG_INPUT_RING_SELECT_MODE_TOEPLITZ_CHECKSUM;
+			vnic->hash_f_local = RTE_ETH_HASH_FUNCTION_TOEPLITZ;
 			/* shadow copy types as !hash_f is always true with default func */
+			vnic->rss_types_local = types;
 			return 0;
 		}
 		PMD_DRV_LOG(ERR, "Hash function not supported with checksun type\n");
Signature · 1 line
2.39.2 (Apple Git-143)
#12 lore raw

PATCH v3 12/18 net/bnxt: set allmulti mode if multicast filter fails

In reply to Ajit Khaparde

Fallback to all multicast mode if FW rejects multicast filter programming.

The firmware can reject the MC filter programming request if it is running low in resources when there is a large number of functions. The driver must be prepared to fallback to the all-multicast mode if the original MC filter programming request is rejected.

---
 drivers/net/bnxt/bnxt_ethdev.c | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)
drivers/net/bnxt/bnxt_ethdev.c +11 -1
index 5b775e7716..7aed6d3ab6 100644
@@ -2947,7 +2947,17 @@ bnxt_dev_set_mc_addr_list_op(struct rte_eth_dev *eth_dev,
 		vnic->flags &= ~BNXT_VNIC_INFO_MCAST;
 
 allmulti:
-	return bnxt_hwrm_cfa_l2_set_rx_mask(bp, vnic, 0, NULL);
+	rc = bnxt_hwrm_cfa_l2_set_rx_mask(bp, vnic, 0, NULL);
+	if (rc == -ENOSPC && (vnic->flags & BNXT_VNIC_INFO_MCAST)) {
+		/* If MCAST addition failed because FW ran out of
+		 * multicast filters, enable all multicast mode.
+		 */
+		vnic->flags &= ~BNXT_VNIC_INFO_MCAST;
+		vnic->flags |= BNXT_VNIC_INFO_ALLMULTI;
+		goto allmulti;
+	}
+
+	return rc;
 }
 
 static int
Signature · 1 line
2.39.2 (Apple Git-143)
#13 lore raw

PATCH v3 13/18 net/bnxt: add VF FLR async event handler

In reply to Ajit Khaparde

From: Jay Ding <[email protected]>

When a VF undergoes an FLR, the firmware indicates this via an async notification to the PF. Note that the PF driver needs to register for the notification with the firmware. Add support for VF_FLR async event handling when the driver is running on a PF.

---
 drivers/net/bnxt/bnxt_cpr.c  | 20 ++++++++++++++++++++
 drivers/net/bnxt/bnxt_hwrm.c |  6 ++++--
 drivers/net/bnxt/bnxt_hwrm.h |  2 ++
 3 files changed, 26 insertions(+), 2 deletions(-)
drivers/net/bnxt/bnxt_cpr.c +20 -0
index 0733cf4df2..fb43bc58da 100644
@@ -127,6 +127,23 @@ void bnxt_handle_vf_cfg_change(void *arg)
 	}
 }
 
+static void
+bnxt_process_vf_flr(struct bnxt *bp, uint32_t data1)
+{
+	uint16_t pfid, vfid;
+
+	if (!BNXT_TRUFLOW_EN(bp))
+		return;
+
+	pfid = (data1 & HWRM_ASYNC_EVENT_CMPL_VF_FLR_EVENT_DATA1_PF_ID_MASK) >>
+		HWRM_ASYNC_EVENT_CMPL_VF_FLR_EVENT_DATA1_PF_ID_SFT;
+	vfid = (data1 & HWRM_ASYNC_EVENT_CMPL_VF_FLR_EVENT_DATA1_VF_ID_MASK) >>
+		HWRM_ASYNC_EVENT_CMPL_VF_FLR_EVENT_DATA1_VF_ID_SFT;
+
+	PMD_DRV_LOG(INFO, "VF FLR async event received pfid: %u, vfid: %u\n",
+		    pfid, vfid);
+}
+
 /*
  * Async event handling
  */
@@ -264,6 +281,9 @@ void bnxt_handle_async_event(struct bnxt *bp,
 	case HWRM_ASYNC_EVENT_CMPL_EVENT_ID_ERROR_REPORT:
 		bnxt_handle_event_error_report(bp, data1, data2);
 		break;
+	case HWRM_ASYNC_EVENT_CMPL_EVENT_ID_VF_FLR:
+		bnxt_process_vf_flr(bp, data1);
+		break;
 	default:
 		PMD_DRV_LOG(DEBUG, "handle_async_event id = 0x%x\n", event_id);
 		break;
drivers/net/bnxt/bnxt_hwrm.c +4 -2
index 1ac3f30074..3c16abea69 100644
@@ -1125,9 +1125,11 @@ int bnxt_hwrm_func_driver_register(struct bnxt *bp)
 		req.async_event_fwd[1] |=
 			rte_cpu_to_le_32(ASYNC_CMPL_EVENT_ID_DBG_NOTIFICATION);
 
-	if (BNXT_PF(bp) || BNXT_VF_IS_TRUSTED(bp))
+	if (BNXT_PF(bp) || BNXT_VF_IS_TRUSTED(bp)) {
 		req.async_event_fwd[1] |=
-		rte_cpu_to_le_32(ASYNC_CMPL_EVENT_ID_DEFAULT_VNIC_CHANGE);
+		rte_cpu_to_le_32(ASYNC_CMPL_EVENT_ID_DEFAULT_VNIC_CHANGE |
+				 ASYNC_CMPL_EVENT_ID_VF_FLR);
+	}
 
 	req.async_event_fwd[2] |=
 		rte_cpu_to_le_32(ASYNC_CMPL_EVENT_ID_ECHO_REQUEST |
drivers/net/bnxt/bnxt_hwrm.h +2 -0
index 56b232d7de..6116253787 100644
@@ -29,6 +29,8 @@ struct hwrm_func_qstats_output;
 	(1 << HWRM_ASYNC_EVENT_CMPL_EVENT_ID_ERROR_RECOVERY)
 #define ASYNC_CMPL_EVENT_ID_PF_DRVR_UNLOAD	\
 	(1 << (HWRM_ASYNC_EVENT_CMPL_EVENT_ID_PF_DRVR_UNLOAD - 32))
+#define ASYNC_CMPL_EVENT_ID_VF_FLR \
+	(1 << (HWRM_ASYNC_EVENT_CMPL_EVENT_ID_VF_FLR - 32))
 #define ASYNC_CMPL_EVENT_ID_VF_CFG_CHANGE	\
 	(1 << (HWRM_ASYNC_EVENT_CMPL_EVENT_ID_VF_CFG_CHANGE - 32))
 #define ASYNC_CMPL_EVENT_ID_DBG_NOTIFICATION	\
Signature · 1 line
2.39.2 (Apple Git-143)
#14 lore raw

PATCH v3 14/18 net/bnxt: add tunnel TPA support

In reply to Ajit Khaparde

From: Damodharam Ammepalli <[email protected]>

This patch adds support for tunnel TPA type.
The tunnel TPA support is brought in by the updated bit_field tnl_tpa_en(4) in hwrm_vnic_tpa_cfg_input->enables, which is used by the firmware to indicate the capability of the underlying hardware.

This patch updates hwrm HWRM_VNIC_TPA_CFG request for vxlan, geneve and default tunnel type bit_fields.

The patch also updates to use the V3 TPA completion which the P7 devices support.

---
 drivers/net/bnxt/bnxt.h      |  4 ++
 drivers/net/bnxt/bnxt_hwrm.c | 74 ++++++++++++++++++++++++++++++++++++
 drivers/net/bnxt/bnxt_rxr.c  |  9 +++--
 drivers/net/bnxt/bnxt_vnic.c | 16 ++++++++
 4 files changed, 100 insertions(+), 3 deletions(-)
drivers/net/bnxt/bnxt.h +4 -0
index 576688bbff..2357e9f747 100644
@@ -18,6 +18,7 @@
 #include <rte_lcore.h>
 #include <rte_spinlock.h>
 #include <rte_time.h>
+#include <rte_eal_paging.h>
 
 #include "bnxt_cpr.h"
 #include "bnxt_util.h"
@@ -119,6 +120,8 @@
 	(BNXT_CHIP_P5_P7(bp) ? TPA_MAX_SEGS_TH : \
 			      TPA_MAX_SEGS)
 
+#define BNXT_TPA_MAX_PAGES	65536
+
 /*
  * Define the number of async completion rings to be used. Set to zero for
  * configurations in which the maximum number of packet completion rings
@@ -815,6 +818,7 @@ struct bnxt {
 #define BNXT_VNIC_CAP_ESP_SPI6_CAP	BIT(12)
 #define BNXT_VNIC_CAP_AH_SPI_CAP	(BNXT_VNIC_CAP_AH_SPI4_CAP | BNXT_VNIC_CAP_AH_SPI6_CAP)
 #define BNXT_VNIC_CAP_ESP_SPI_CAP	(BNXT_VNIC_CAP_ESP_SPI4_CAP | BNXT_VNIC_CAP_ESP_SPI6_CAP)
+#define BNXT_VNIC_CAP_VNIC_TUNNEL_TPA	BIT(13)
 
 	unsigned int		rx_nr_rings;
 	unsigned int		rx_cp_nr_rings;
drivers/net/bnxt/bnxt_hwrm.c +74 -0

110 lines not on this page · raw message

drivers/net/bnxt/bnxt_rxr.c +6 -3
index d0706874a6..3542975600 100644
@@ -153,7 +153,8 @@ static void bnxt_rx_ring_reset(void *arg)
 		rxr = rxq->rx_ring;
 		/* Disable and flush TPA before resetting the RX ring */
 		if (rxr->tpa_info)
-			bnxt_hwrm_vnic_tpa_cfg(bp, rxq->vnic, false);
+			bnxt_vnic_tpa_cfg(bp, rxq->queue_id, false);
+
 		rc = bnxt_hwrm_rx_ring_reset(bp, i);
 		if (rc) {
 			PMD_DRV_LOG(ERR, "Rx ring%d reset failed\n", i);
@@ -163,12 +164,13 @@ static void bnxt_rx_ring_reset(void *arg)
 		bnxt_rx_queue_release_mbufs(rxq);
 		rxr->rx_raw_prod = 0;
 		rxr->ag_raw_prod = 0;
+		rxr->ag_cons = 0;
 		rxr->rx_next_cons = 0;
 		bnxt_init_one_rx_ring(rxq);
 		bnxt_db_write(&rxr->rx_db, rxr->rx_raw_prod);
 		bnxt_db_write(&rxr->ag_db, rxr->ag_raw_prod);
 		if (rxr->tpa_info)
-			bnxt_hwrm_vnic_tpa_cfg(bp, rxq->vnic, true);
+			bnxt_vnic_tpa_cfg(bp, rxq->queue_id, true);
 
 		rxq->in_reset = 0;
 	}
@@ -1151,7 +1153,8 @@ static int bnxt_rx_pkt(struct rte_mbuf **rx_pkt,
 		return -EBUSY;
 
 	if (cmp_type == RX_TPA_START_CMPL_TYPE_RX_TPA_START ||
-	    cmp_type == RX_TPA_START_V2_CMPL_TYPE_RX_TPA_START_V2) {
+	    cmp_type == RX_TPA_START_V2_CMPL_TYPE_RX_TPA_START_V2 ||
+	    cmp_type == RX_TPA_START_V3_CMPL_TYPE_RX_TPA_START_V3) {
 		bnxt_tpa_start(rxq, (struct rx_tpa_start_cmpl *)rxcmp,
 			       (struct rx_tpa_start_cmpl_hi *)rxcmp1);
 		rc = -EINVAL; /* Continue w/o new mbuf */
drivers/net/bnxt/bnxt_vnic.c +16 -0
index 5ea34f7cb6..5092a7d774 100644
@@ -464,7 +464,9 @@ bnxt_vnic_queue_delete(struct bnxt *bp, uint16_t vnic_idx)
 static struct bnxt_vnic_info*
 bnxt_vnic_queue_create(struct bnxt *bp, int32_t vnic_id, uint16_t q_index)
 {
+	struct rte_eth_conf *dev_conf = &bp->eth_dev->data->dev_conf;
 	uint8_t *rx_queue_state = bp->eth_dev->data->rx_queue_state;
+	uint64_t rx_offloads = dev_conf->rxmode.offloads;
 	struct bnxt_vnic_info *vnic;
 	struct bnxt_rx_queue *rxq = NULL;
 	int32_t rc = -EINVAL;
@@ -523,6 +525,12 @@ bnxt_vnic_queue_create(struct bnxt *bp, int32_t vnic_id, uint16_t q_index)
 		goto cleanup;
 	}
 
+	rc = bnxt_hwrm_vnic_tpa_cfg(bp, vnic,
+				   (rx_offloads & RTE_ETH_RX_OFFLOAD_TCP_LRO) ?
+				    true : false);
+	if (rc)
+		PMD_DRV_LOG(DEBUG, "Failed to configure TPA on this vnic %d\n", q_index);
+
 	rc = bnxt_hwrm_vnic_plcmode_cfg(bp, vnic);
 	if (rc) {
 		PMD_DRV_LOG(DEBUG, "Failed to configure vnic plcmode %d\n",
@@ -658,7 +666,9 @@ bnxt_vnic_rss_create(struct bnxt *bp,
 		     struct bnxt_vnic_rss_info *rss_info,
 		     uint16_t vnic_id)
 {
+	struct rte_eth_conf *dev_conf = &bp->eth_dev->data->dev_conf;
 	uint8_t *rx_queue_state = bp->eth_dev->data->rx_queue_state;
+	uint64_t rx_offloads = dev_conf->rxmode.offloads;
 	struct bnxt_vnic_info *vnic;
 	struct bnxt_rx_queue *rxq = NULL;
 	uint32_t idx, nr_ctxs, config_rss = 0;
@@ -741,6 +751,12 @@ bnxt_vnic_rss_create(struct bnxt *bp,
 		goto fail_cleanup;
 	}
 
+	rc = bnxt_hwrm_vnic_tpa_cfg(bp, vnic,
+				   (rx_offloads & RTE_ETH_RX_OFFLOAD_TCP_LRO) ?
+				    true : false);
+	if (rc)
+		PMD_DRV_LOG(DEBUG, "Failed to configure TPA on this vnic %d\n", idx);
+
 	rc = bnxt_hwrm_vnic_plcmode_cfg(bp, vnic);
 	if (rc) {
 		PMD_DRV_LOG(ERR, "Failed to configure vnic plcmode %d\n",
Signature · 1 line
2.39.2 (Apple Git-143)
#15 lore raw

PATCH v3 15/18 net/bnxt: add 400G get support for P7 devices

In reply to Ajit Khaparde

From: Damodharam Ammepalli <[email protected]>

P7 devices report speeds over speeds2 hsi fields. Adding required support to capture the capability from phy_qcap and save the speeds2 fields into driver priv structure.
In fixed mode update the link_speed from force_link_speeds2 field. Updates to logging to provide more info regarding numbers of lanes and the link signal mode.

Some code refactoring done for PHY auto detect and displaying XCVR information.

---
 drivers/net/bnxt/bnxt.h                |  15 +
 drivers/net/bnxt/bnxt_ethdev.c         |  57 ++-
 drivers/net/bnxt/bnxt_hwrm.c           | 493 ++++++++++++++++++++++++-
 drivers/net/bnxt/bnxt_hwrm.h           |   1 +
 drivers/net/bnxt/hsi_struct_def_dpdk.h |  10 +-
 5 files changed, 568 insertions(+), 8 deletions(-)
drivers/net/bnxt/bnxt.h +15 -0
index 2357e9f747..858689533b 100644
@@ -318,6 +318,16 @@ struct bnxt_link_info {
 	uint16_t		support_pam4_auto_speeds;
 	uint8_t			req_signal_mode;
 	uint8_t			module_status;
+	/* P7 speeds2 fields */
+	bool                    support_speeds_v2;
+	uint16_t                supported_speeds2_force_mode;
+	uint16_t                supported_speeds2_auto_mode;
+	uint16_t                support_speeds2;
+	uint16_t                force_link_speeds2;
+	uint16_t                auto_link_speeds2;
+	uint16_t                cfg_auto_link_speeds2_mask;
+	uint8_t                 active_lanes;
+	uint8_t			option_flags;
 };
 
 #define BNXT_COS_QUEUE_COUNT	8
@@ -1156,6 +1166,11 @@ extern int bnxt_logtype_driver;
 #define PMD_DRV_LOG(level, fmt, args...) \
 	  PMD_DRV_LOG_RAW(level, fmt, ## args)
 
+#define BNXT_LINK_SPEEDS_V2_OPTIONS(f) \
+	((f) & HWRM_PORT_PHY_QCFG_OUTPUT_OPTION_FLAGS_SPEEDS2_SUPPORTED)
+#define BNXT_LINK_SPEEDS_V2_VF(bp) (BNXT_VF((bp)) && ((bp)->link_info->option_flags))
+#define BNXT_LINK_SPEEDS_V2(bp) (((bp)->link_info) && (((bp)->link_info->support_speeds_v2) || \
+						       BNXT_LINK_SPEEDS_V2_VF((bp))))
 extern const struct rte_flow_ops bnxt_ulp_rte_flow_ops;
 int32_t bnxt_ulp_port_init(struct bnxt *bp);
 void bnxt_ulp_port_deinit(struct bnxt *bp);
drivers/net/bnxt/bnxt_ethdev.c +56 -1

88 lines not on this page · raw message

drivers/net/bnxt/bnxt_hwrm.c +488 -5

588 lines not on this page · raw message

drivers/net/bnxt/bnxt_hwrm.h +1 -0
index 6116253787..179d5dc1f0 100644
@@ -145,6 +145,7 @@ struct bnxt_pf_resource_info {
 
 #define BNXT_SIG_MODE_NRZ	HWRM_PORT_PHY_QCFG_OUTPUT_SIGNAL_MODE_NRZ
 #define BNXT_SIG_MODE_PAM4	HWRM_PORT_PHY_QCFG_OUTPUT_SIGNAL_MODE_PAM4
+#define BNXT_SIG_MODE_PAM4_112	HWRM_PORT_PHY_QCFG_OUTPUT_SIGNAL_MODE_PAM4_112
 
 #define BNXT_TUNNELED_OFFLOADS_CAP_VXLAN_EN(bp)		\
 	(!((bp)->tunnel_disable_flag & HWRM_FUNC_QCAPS_OUTPUT_TUNNEL_DISABLE_FLAG_DISABLE_VXLAN))
drivers/net/bnxt/hsi_struct_def_dpdk.h +8 -2
index 65f3f0576b..b012a84d36 100644
@@ -27273,11 +27273,17 @@ struct hwrm_port_phy_qcfg_output {
 	/* QSFP+ */
 	#define HWRM_PORT_PHY_QCFG_OUTPUT_XCVR_IDENTIFIER_TYPE_QSFPPLUS \
 		(UINT32_C(0xd) << 24)
-	/* QSFP28 */
+	/* QSFP28/QSFP56 or later */
 	#define HWRM_PORT_PHY_QCFG_OUTPUT_XCVR_IDENTIFIER_TYPE_QSFP28 \
 		(UINT32_C(0x11) << 24)
+	/* QSFP-DD */
+	#define HWRM_PORT_PHY_QCFG_OUTPUT_XCVR_IDENTIFIER_TYPE_QSFPDD \
+		(UINT32_C(0x18) << 24)
+	/* QSFP112 */
+	#define HWRM_PORT_PHY_QCFG_OUTPUT_XCVR_IDENTIFIER_TYPE_QSFP112 \
+		(UINT32_C(0x1e) << 24)
 	#define HWRM_PORT_PHY_QCFG_OUTPUT_XCVR_IDENTIFIER_TYPE_LAST \
-		HWRM_PORT_PHY_QCFG_OUTPUT_XCVR_IDENTIFIER_TYPE_QSFP28
+		HWRM_PORT_PHY_QCFG_OUTPUT_XCVR_IDENTIFIER_TYPE_QSFP112
 	/*
 	 * This value represents the current configuration of
 	 * Forward Error Correction (FEC) on the port.
Signature · 1 line
2.39.2 (Apple Git-143)
#16 lore raw

PATCH v3 16/18 net/bnxt: query extended stats from firmware

In reply to Ajit Khaparde

From: Damodharam Ammepalli <[email protected]>

Add the driver support for HWRM_STAT_EXT_CTX_QUERY HWRM msg. In this patch only P7 chipset is enabled for this HWRM while P5 and previous generation remain with HWRM_STAT_CTX_QUERY.

---
 drivers/net/bnxt/bnxt.h        |  49 ++++++
 drivers/net/bnxt/bnxt_cpr.h    |   3 +-
 drivers/net/bnxt/bnxt_ethdev.c |  36 ++++-
 drivers/net/bnxt/bnxt_hwrm.c   | 117 ++++++++++++++
 drivers/net/bnxt/bnxt_hwrm.h   |  12 +-
 drivers/net/bnxt/bnxt_ring.c   |   6 +-
 drivers/net/bnxt/bnxt_rxq.c    |   8 +-
 drivers/net/bnxt/bnxt_stats.c  | 279 ++++++++++++++++++++++++++++++---
 8 files changed, 483 insertions(+), 27 deletions(-)
drivers/net/bnxt/bnxt.h +49 -0
index 858689533b..d91f0e427d 100644
@@ -705,6 +705,53 @@ struct bnxt_ring_stats {
 	uint64_t	rx_agg_aborts;
 };
 
+struct bnxt_ring_stats_ext {
+	/* Number of received unicast packets */
+	uint64_t        rx_ucast_pkts;
+	/* Number of received multicast packets */
+	uint64_t        rx_mcast_pkts;
+	/* Number of received broadcast packets */
+	uint64_t        rx_bcast_pkts;
+	/* Number of discarded packets on receive path */
+	uint64_t        rx_discard_pkts;
+	/* Number of packets on receive path with error */
+	uint64_t        rx_error_pkts;
+	/* Number of received bytes for unicast traffic */
+	uint64_t        rx_ucast_bytes;
+	/* Number of received bytes for multicast traffic */
+	uint64_t        rx_mcast_bytes;
+	/* Number of received bytes for broadcast traffic */
+	uint64_t        rx_bcast_bytes;
+	/* Number of transmitted unicast packets */
+	uint64_t        tx_ucast_pkts;
+	/* Number of transmitted multicast packets */
+	uint64_t        tx_mcast_pkts;
+	/* Number of transmitted broadcast packets */
+	uint64_t        tx_bcast_pkts;
+	/* Number of packets on transmit path with error */
+	uint64_t        tx_error_pkts;
+	/* Number of discarded packets on transmit path */
+	uint64_t        tx_discard_pkts;
+	/* Number of transmitted bytes for unicast traffic */
+	uint64_t        tx_ucast_bytes;
+	/* Number of transmitted bytes for multicast traffic */
+	uint64_t        tx_mcast_bytes;
+	/* Number of transmitted bytes for broadcast traffic */
+	uint64_t        tx_bcast_bytes;
+	/* Number of TPA eligible packets */
+	uint64_t        rx_tpa_eligible_pkt;
+	/* Number of TPA eligible bytes */
+	uint64_t        rx_tpa_eligible_bytes;
+	/* Number of TPA packets */
+	uint64_t        rx_tpa_pkt;
+	/* Number of TPA bytes */
+	uint64_t        rx_tpa_bytes;
+	/* Number of TPA errors */
+	uint64_t        rx_tpa_errors;
+	/* Number of TPA events */
+	uint64_t        rx_tpa_events;
+};
+
 enum bnxt_session_type {
 	BNXT_SESSION_TYPE_REGULAR = 0,
 	BNXT_SESSION_TYPE_SHARED_COMMON,
@@ -982,6 +1029,8 @@ struct bnxt {
 	uint16_t		tx_cfa_action;
 	struct bnxt_ring_stats	*prev_rx_ring_stats;
 	struct bnxt_ring_stats	*prev_tx_ring_stats;
+	struct bnxt_ring_stats_ext	*prev_rx_ring_stats_ext;
+	struct bnxt_ring_stats_ext	*prev_tx_ring_stats_ext;
 	struct bnxt_vnic_queue_db vnic_queue_db;
 
 #define BNXT_MAX_MC_ADDRS	((bp)->max_mcast_addr)
drivers/net/bnxt/bnxt_cpr.h +2 -1
index 26e81a6a7e..c7b3480dc9 100644
@@ -68,7 +68,8 @@ struct bnxt_cp_ring_info {
 	struct bnxt_db_info     cp_db;
 	rte_iova_t		cp_desc_mapping;
 
-	struct ctx_hw_stats	*hw_stats;
+	char			*hw_stats;
+	uint16_t		hw_ring_stats_size;
 	rte_iova_t		hw_stats_map;
 	uint32_t		hw_stats_ctx_id;
 
drivers/net/bnxt/bnxt_ethdev.c +35 -1
index 625e5f1f9a..031028eda1 100644
@@ -732,15 +732,49 @@ static int bnxt_update_phy_setting(struct bnxt *bp)
 
 static void bnxt_free_prev_ring_stats(struct bnxt *bp)
 {
+	/* tpa v2 devices use ext variant local struct */
+	if (BNXT_TPA_V2_P7(bp)) {
+		rte_free(bp->prev_rx_ring_stats_ext);
+		rte_free(bp->prev_tx_ring_stats_ext);
+		bp->prev_rx_ring_stats_ext = NULL;
+		bp->prev_tx_ring_stats_ext = NULL;
+		return;
+	}
 	rte_free(bp->prev_rx_ring_stats);
 	rte_free(bp->prev_tx_ring_stats);
-
 	bp->prev_rx_ring_stats = NULL;
 	bp->prev_tx_ring_stats = NULL;
 }
 
+static int bnxt_alloc_prev_ring_ext_stats(struct bnxt *bp)
+{
+	bp->prev_rx_ring_stats_ext = rte_zmalloc("bnxt_prev_rx_ring_stats_ext",
+						 sizeof(struct bnxt_ring_stats_ext) *
+						 bp->rx_cp_nr_rings,
+						 0);
+	if (bp->prev_rx_ring_stats_ext == NULL)
+		return -ENOMEM;
+
+	bp->prev_tx_ring_stats_ext = rte_zmalloc("bnxt_prev_tx_ring_stats_ext",
+						 sizeof(struct bnxt_ring_stats_ext) *
+						 bp->tx_cp_nr_rings,
+						 0);
+
+	if (bp->tx_cp_nr_rings > 0 && bp->prev_tx_ring_stats_ext == NULL)
+		goto error;
+
+	return 0;
+
+error:
+	bnxt_free_prev_ring_stats(bp);
+	return -ENOMEM;
+}
+
 static int bnxt_alloc_prev_ring_stats(struct bnxt *bp)
 {
+	if (BNXT_TPA_V2_P7(bp))
+		return bnxt_alloc_prev_ring_ext_stats(bp);
+
 	bp->prev_rx_ring_stats =  rte_zmalloc("bnxt_prev_rx_ring_stats",
 					      sizeof(struct bnxt_ring_stats) *
 					      bp->rx_cp_nr_rings,
drivers/net/bnxt/bnxt_hwrm.c +117 -0

135 lines not on this page · raw message

drivers/net/bnxt/bnxt_hwrm.h +10 -2
index 179d5dc1f0..19fb35f223 100644
@@ -167,8 +167,14 @@ struct bnxt_pf_resource_info {
 	 BNXT_TUNNELED_OFFLOADS_CAP_GRE_EN(bp)   &&		\
 	 BNXT_TUNNELED_OFFLOADS_CAP_IPINIP_EN(bp))
 
-#define BNXT_SIG_MODE_NRZ	HWRM_PORT_PHY_QCFG_OUTPUT_SIGNAL_MODE_NRZ
-#define BNXT_SIG_MODE_PAM4	HWRM_PORT_PHY_QCFG_OUTPUT_SIGNAL_MODE_PAM4
+/* Is this tpa_v2 and P7
+ * Just add P5 to this once we validate on Thor FW
+ */
+#define BNXT_TPA_V2_P7(bp) ((bp)->max_tpa_v2 && BNXT_CHIP_P7(bp))
+/* Get the size of the stat context size for DMA from HW */
+#define BNXT_HWRM_CTX_GET_SIZE(bp)  (BNXT_TPA_V2_P7(bp) ?	\
+	sizeof(struct ctx_hw_stats_ext) :			\
+	sizeof(struct ctx_hw_stats))
 
 int bnxt_hwrm_cfa_l2_clear_rx_mask(struct bnxt *bp,
 				   struct bnxt_vnic_info *vnic);
@@ -352,6 +358,8 @@ int bnxt_hwrm_poll_ver_get(struct bnxt *bp);
 int bnxt_hwrm_rx_ring_reset(struct bnxt *bp, int queue_index);
 int bnxt_hwrm_ring_stats(struct bnxt *bp, uint32_t cid, int idx,
 			 struct bnxt_ring_stats *stats, bool rx);
+int bnxt_hwrm_ring_stats_ext(struct bnxt *bp, uint32_t cid, int idx,
+			     struct bnxt_ring_stats_ext *ring_stats, bool rx);
 int bnxt_hwrm_read_sfp_module_eeprom_info(struct bnxt *bp, uint16_t i2c_addr,
 					  uint16_t page_number, uint16_t start_addr,
 					  uint16_t data_length, uint8_t *buf);
drivers/net/bnxt/bnxt_ring.c +3 -3
index 4bf0b9c6ed..9e512321d9 100644
@@ -119,8 +119,7 @@ int bnxt_alloc_rings(struct bnxt *bp, unsigned int socket_id, uint16_t qidx,
 	int ag_ring_len = 0;
 
 	int stats_len = (tx_ring_info || rx_ring_info) ?
-	    RTE_CACHE_LINE_ROUNDUP(sizeof(struct hwrm_stat_ctx_query_output) -
-				   sizeof (struct hwrm_resp_hdr)) : 0;
+	    RTE_CACHE_LINE_ROUNDUP(BNXT_HWRM_CTX_GET_SIZE(bp)) : 0;
 	stats_len = RTE_ALIGN(stats_len, 128);
 
 	int cp_vmem_start = stats_len;
@@ -305,8 +304,9 @@ int bnxt_alloc_rings(struct bnxt *bp, unsigned int socket_id, uint16_t qidx,
 		*cp_ring->vmem = ((char *)mz->addr + stats_len);
 	if (stats_len) {
 		cp_ring_info->hw_stats = mz->addr;
-		cp_ring_info->hw_stats_map = mz_phys_addr;
 	}
+	cp_ring_info->hw_stats_map = mz_phys_addr;
+
 	cp_ring_info->hw_stats_ctx_id = HWRM_NA_SIGNATURE;
 
 	if (nq_ring_info) {
drivers/net/bnxt/bnxt_rxq.c +6 -2
index 575e7f193f..913856e6eb 100644
@@ -483,8 +483,12 @@ int bnxt_rx_queue_start(struct rte_eth_dev *dev, uint16_t rx_queue_id)
 	/* reset the previous stats for the rx_queue since the counters
 	 * will be cleared when the queue is started.
 	 */
-	memset(&bp->prev_rx_ring_stats[rx_queue_id], 0,
-	       sizeof(struct bnxt_ring_stats));
+	if (BNXT_TPA_V2_P7(bp))
+		memset(&bp->prev_rx_ring_stats_ext[rx_queue_id], 0,
+		       sizeof(struct bnxt_ring_stats_ext));
+	else
+		memset(&bp->prev_rx_ring_stats[rx_queue_id], 0,
+		       sizeof(struct bnxt_ring_stats));
 
 	/* Set the queue state to started here.
 	 * We check the status of the queue while posting buffer.
drivers/net/bnxt/bnxt_stats.c +261 -18

396 lines not on this page · raw message

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

PATCH v3 17/18 net/bnxt: add AVX2 support for compressed CQE

In reply to Ajit Khaparde

P7 device family supports 16 byte Rx completions.
Add AVX2 vector mode for compressed Rx CQE.

---
 drivers/net/bnxt/bnxt_ethdev.c        |   5 +
 drivers/net/bnxt/bnxt_rxr.h           |   2 +
 drivers/net/bnxt/bnxt_rxtx_vec_avx2.c | 309 ++++++++++++++++++++++++++
 3 files changed, 316 insertions(+)
drivers/net/bnxt/bnxt_ethdev.c +5 -0
index 031028eda1..bd8c7557dd 100644
@@ -1406,6 +1406,8 @@ bnxt_receive_function(struct rte_eth_dev *eth_dev)
 			    "Using AVX2 vector mode receive for port %d\n",
 			    eth_dev->data->port_id);
 		bp->flags |= BNXT_FLAG_RX_VECTOR_PKT_MODE;
+		if (bnxt_compressed_rx_cqe_mode_enabled(bp))
+			return bnxt_crx_pkts_vec_avx2;
 		return bnxt_recv_pkts_vec_avx2;
 	}
  #endif
@@ -3124,6 +3126,9 @@ static const struct {
 	{bnxt_recv_pkts,		"Scalar"},
 #if defined(RTE_ARCH_X86)
 	{bnxt_recv_pkts_vec,		"Vector SSE"},
+#endif
+#if defined(RTE_ARCH_X86) && defined(CC_AVX2_SUPPORT)
+	{bnxt_crx_pkts_vec_avx2,	"Vector AVX2"},
 	{bnxt_recv_pkts_vec_avx2,	"Vector AVX2"},
 #endif
 #if defined(RTE_ARCH_ARM64)
drivers/net/bnxt/bnxt_rxr.h +2 -0
index c51bb2d62c..a474a69ae3 100644
@@ -162,6 +162,8 @@ int bnxt_rxq_vec_setup(struct bnxt_rx_queue *rxq);
 #if defined(RTE_ARCH_X86)
 uint16_t bnxt_recv_pkts_vec_avx2(void *rx_queue, struct rte_mbuf **rx_pkts,
 				 uint16_t nb_pkts);
+uint16_t bnxt_crx_pkts_vec_avx2(void *rx_queue, struct rte_mbuf **rx_pkts,
+				uint16_t nb_pkts);
 #endif
 void bnxt_set_mark_in_mbuf(struct bnxt *bp,
 			   struct rx_pkt_cmpl_hi *rxcmp1,
drivers/net/bnxt/bnxt_rxtx_vec_avx2.c +309 -0

321 lines not on this page · raw message

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

PATCH v3 18/18 net/bnxt: enable SSE mode for compressed CQE

In reply to Ajit Khaparde

P7 device family supports 16 byte Rx completions. Enable SSE vector mode for compressed Rx CQE processing.

---
 drivers/net/bnxt/bnxt_ethdev.c       |  16 ++-
 drivers/net/bnxt/bnxt_rxr.h          |   2 +
 drivers/net/bnxt/bnxt_rxtx_vec_sse.c | 167 +++++++++++++++++++++++++--
 3 files changed, 173 insertions(+), 12 deletions(-)
drivers/net/bnxt/bnxt_ethdev.c +13 -3
index bd8c7557dd..f9cd234bb6 100644
@@ -1377,7 +1377,8 @@ bnxt_receive_function(struct rte_eth_dev *eth_dev)
 	 * asynchronous completions and receive completions can be placed in
 	 * the same completion ring.
 	 */
-	if (BNXT_TRUFLOW_EN(bp) || !BNXT_NUM_ASYNC_CPR(bp))
+	if ((BNXT_TRUFLOW_EN(bp) && !BNXT_CHIP_P7(bp)) ||
+	    !BNXT_NUM_ASYNC_CPR(bp))
 		goto use_scalar_rx;
 
 	/*
@@ -1410,12 +1411,19 @@ bnxt_receive_function(struct rte_eth_dev *eth_dev)
 			return bnxt_crx_pkts_vec_avx2;
 		return bnxt_recv_pkts_vec_avx2;
 	}
- #endif
+#endif
 	if (rte_vect_get_max_simd_bitwidth() >= RTE_VECT_SIMD_128) {
 		PMD_DRV_LOG(INFO,
 			    "Using SSE vector mode receive for port %d\n",
 			    eth_dev->data->port_id);
 		bp->flags |= BNXT_FLAG_RX_VECTOR_PKT_MODE;
+		if (bnxt_compressed_rx_cqe_mode_enabled(bp)) {
+#if defined(RTE_ARCH_ARM64)
+			goto use_scalar_rx;
+#else
+			return bnxt_crx_pkts_vec;
+#endif
+		}
 		return bnxt_recv_pkts_vec;
 	}
 
@@ -1445,7 +1453,8 @@ bnxt_transmit_function(__rte_unused struct rte_eth_dev *eth_dev)
 	 */
 	if (eth_dev->data->scattered_rx ||
 	    (offloads & ~RTE_ETH_TX_OFFLOAD_MBUF_FAST_FREE) ||
-	    BNXT_TRUFLOW_EN(bp) || bp->ieee_1588)
+	    (BNXT_TRUFLOW_EN(bp) && !BNXT_CHIP_P7(bp)) ||
+	    bp->ieee_1588)
 		goto use_scalar_tx;
 
 #if defined(RTE_ARCH_X86)
@@ -3125,6 +3134,7 @@ static const struct {
 } bnxt_rx_burst_info[] = {
 	{bnxt_recv_pkts,		"Scalar"},
 #if defined(RTE_ARCH_X86)
+	{bnxt_crx_pkts_vec,		"Vector SSE"},
 	{bnxt_recv_pkts_vec,		"Vector SSE"},
 #endif
 #if defined(RTE_ARCH_X86) && defined(CC_AVX2_SUPPORT)
drivers/net/bnxt/bnxt_rxr.h +2 -0
index a474a69ae3..d36cbded1d 100644
@@ -156,6 +156,8 @@ int bnxt_flush_rx_cmp(struct bnxt_cp_ring_info *cpr);
 #if defined(RTE_ARCH_X86) || defined(RTE_ARCH_ARM64)
 uint16_t bnxt_recv_pkts_vec(void *rx_queue, struct rte_mbuf **rx_pkts,
 			    uint16_t nb_pkts);
+uint16_t bnxt_crx_pkts_vec(void *rx_queue, struct rte_mbuf **rx_pkts,
+			   uint16_t nb_pkts);
 int bnxt_rxq_vec_setup(struct bnxt_rx_queue *rxq);
 #endif
 
drivers/net/bnxt/bnxt_rxtx_vec_sse.c +158 -9

198 lines not on this page · raw message

Signature · 1 line
2.39.2 (Apple Git-143)
#19 lore raw
In reply to Ajit Khaparde
Quoted 7 lines · Ajit Khaparde

This patchset contains more code fixes and reafctoring, apart from extending more support for the newer P7 device family.
The patchset adds vector mode support for compressed Rx CQE. This patchset includes support for checksum and XOR RSS hash mode. It also adds support for forced speeds and autoneg support upto 400G.

Quoted 8 lines

v1->v2:
- Fixed a redefinition of page size and used rte variant instead.
- Fixed typo in some commit logs

v2->v3:
- Fixed some warnings
- Fixed the use of __builtin helpers
- Renamed a function in patch 16

Patchset merged in the dpdk-next-net-brcm for-next-net branch. Thanks

Quoted 53 lines

Ajit Khaparde (9):
net/bnxt: add support for UDP GSO
net/bnxt: add support for compressed Rx CQE net/bnxt: reattempt mbuf allocation for Rx and AGG rings net/bnxt: refactor Rx doorbell during Rx flush net/bnxt: extend RSS hash support for P7 devices net/bnxt: add ESP and AH header based RSS support net/bnxt: set allmulti mode if multicast filter fails net/bnxt: add AVX2 support for compressed CQE net/bnxt: enable SSE mode for compressed CQE

Damodharam Ammepalli (4):
net/bnxt: add flow query callback
net/bnxt: add tunnel TPA support
net/bnxt: add 400G get support for P7 devices
net/bnxt: query extended stats from firmware

Jay Ding (1):
net/bnxt: add VF FLR async event handler

Kalesh AP (4):
net/bnxt: fix a typo while parsing link speed net/bnxt: fix setting 50G and 100G forced speed net/bnxt: fix speed change from 200G to 25G on Thor net/bnxt: support backward compatibility

 drivers/net/bnxt/bnxt.h                | 106 ++-
 drivers/net/bnxt/bnxt_cpr.c            |  20 +
 drivers/net/bnxt/bnxt_cpr.h            |   3 +-
 drivers/net/bnxt/bnxt_ethdev.c         | 253 ++++++--
 drivers/net/bnxt/bnxt_flow.c           |  98 ++-
 drivers/net/bnxt/bnxt_hwrm.c           | 853 +++++++++++++++++++++++--
 drivers/net/bnxt/bnxt_hwrm.h           |  16 +-
 drivers/net/bnxt/bnxt_reps.c           |   2 +-
 drivers/net/bnxt/bnxt_ring.c           |  19 +-
 drivers/net/bnxt/bnxt_rxq.c            |   8 +-
 drivers/net/bnxt/bnxt_rxq.h            |   1 +
 drivers/net/bnxt/bnxt_rxr.c            | 320 ++++++++--
 drivers/net/bnxt/bnxt_rxr.h            |  59 ++
 drivers/net/bnxt/bnxt_rxtx_vec_avx2.c  | 309 +++++++++
 drivers/net/bnxt/bnxt_rxtx_vec_sse.c   | 167 ++++-
 drivers/net/bnxt/bnxt_stats.c          | 279 +++++++-
 drivers/net/bnxt/bnxt_txq.c            |   2 +
 drivers/net/bnxt/bnxt_txr.c            |   7 +-
 drivers/net/bnxt/bnxt_vnic.c           | 195 +++++-
 drivers/net/bnxt/bnxt_vnic.h           |  20 +-
 drivers/net/bnxt/hsi_struct_def_dpdk.h |  10 +-
 21 files changed, 2542 insertions(+), 205 deletions(-)

--
2.39.2 (Apple Git-143)