Skip to contentSkip to conversation

net/enetc: add new features for ENETC4 VF on i.MX95

PATCH Superseded Gagandeep Singh 3 participants 238 messages Aug 6 – Sep 10 Network drivers Page 1 of 3

lore
Share & tools
lore
#0 lore raw

cover net/enetc: add new features for ENETC4 VF on i.MX95

This series adds new PMD features to the ENETC4 driver targeting the NXP i.MX95 NETC IP.

The series covers:

- KEEP_CRC Rx offload: preserve the Ethernet FCS in the receive buffer.
- TSO: TCP Segmentation Offload for the VF Tx path.
- RSC/LRO: hardware Receive Segment Coalesce for PF and VF Rx paths.
- Link speed code: extend the PF-to-VF mailbox field from 4-bit to 8-bit to support speeds beyond 10G.
- Firmware version: report the NETC IP version via fw_version_get.
- Register dump: dump SI, port (PF) and BD ring registers.
- Ring parameters: implement rxq_info_get / txq_info_get for the VF.
- Link-up interrupt: refresh the cached link speed on each VF link-up interrupt so that link_update returns the current speed immediately.
- Stats reset: software snapshot/delta approach for VF counter reset.
- Per-queue Rx interrupt: MSI-X per-queue Rx interrupts for the VF, enabling interrupt-driven receive with l3fwd-power.
- SI VLAN: hardware port VLAN insertion/removal for PF and VF.
- VF link status bitmask: switch VF link status to bitmask encoding to align with the PF and newer kernel driver conventions.
- TX PAUSE: VF sets Rx congestion mode when the PF signals TX PAUSE negotiated on the wire; adds Flow control = Y to enetc4.ini.
- WRR Tx scheduler: per-ring WRR weights via enetc4_txq_wrr devarg.

Gagandeep Singh (14):
net/enetc: add KEEP_CRC offload support for ENETC4 net/enetc: add TSO support for ENETC4 VF
net/enetc: add RSC (hardware LRO) support for ENETC4 net/enetc: extend link speed code field to 8-bit for PF-to-VF message net/enetc: support firmware version get for VF
net/enetc: support registers dump
net/enetc: support ethtool ring parameters
net/enetc: refresh link speed on VF link-up interrupt net/enetc: support stats reset for VF
net/enetc4: add per-queue Rx interrupt support for VF net/enetc4: add SI-based port VLAN insertion and removal net/enetc4: update VF link status to bitmask encoding net/enetc4: enable TX PAUSE via VF RX congestion mode net/enetc4: add WRR Tx scheduler devarg for VF rings

 doc/guides/nics/enetc4.rst             |  81 ++-
 doc/guides/nics/features/enetc4.ini    |   8 +
 doc/guides/rel_notes/release_26_11.rst |  19 +
 drivers/net/enetc/base/enetc4_hw.h     | 129 +++-
 drivers/net/enetc/base/enetc_hw.h      |   6 +
 drivers/net/enetc/enetc.h              | 135 ++++-
 drivers/net/enetc/enetc4_ethdev.c      | 394 ++++++++++++-
 drivers/net/enetc/enetc4_vf.c          | 780 ++++++++++++++++++++++---
 drivers/net/enetc/enetc_rxtx.c         | 531 ++++++++++++++++-
 9 files changed, 1950 insertions(+), 133 deletions(-)
#1 lore raw

PATCH 1/14 net/enetc: add KEEP_CRC offload support for ENETC4

The legacy ENETC (LS1028A) driver already supports the RTE_ETH_RX_OFFLOAD_KEEP_CRC offload, but ENETC4 (i.MX95 NETC) did not.

Add KEEP_CRC support for ENETC4 (both PF and VF):

- Advertise RTE_ETH_RX_OFFLOAD_KEEP_CRC in the supported Rx offloads for the ENETC4 PF and VF. The VF reuses the PF Rx queue setup, so the HW configuration and datapath handling apply to both.
- Configure the per-ring RBaMR[CRC] bit in the Rx queue setup so that HW preserves the Ethernet FCS in the receive buffer when the offload is requested (0 = FCS removed, 1 = FCS preserved).
- Follow the DPDK convention used by the legacy ENETC and ixgbe drivers:
set crc_len to RTE_ETHER_CRC_LEN when KEEP_CRC is enabled and have the datapath subtract crc_len from pkt_len/data_len. ENETC and ENETC4 share the same datapath (enetc_rxtx.c), so the semantics stay consistent.
- Handle the scatter-gather boundary case where the 4-byte FCS straddles the last two segments: drop the trailing segment, decrement nb_segs and trim the carry-over from its predecessor.

Update the enetc4 feature matrix to list CRC offload.

---
 doc/guides/nics/features/enetc4.ini    |  1 +
 doc/guides/rel_notes/release_26_11.rst |  6 ++++
 drivers/net/enetc/base/enetc4_hw.h     |  4 +++
 drivers/net/enetc/enetc4_ethdev.c      | 31 ++++++++++++++++++--
 drivers/net/enetc/enetc4_vf.c          |  1 +
 drivers/net/enetc/enetc_rxtx.c         | 39 +++++++++++++++++++++++---
 6 files changed, 75 insertions(+), 7 deletions(-)
doc/guides/nics/features/enetc4.ini +1 -0
index 698140e30b..91b18d979e 100644
@@ -16,6 +16,7 @@ Packet type parsing  = Y
 Basic stats          = Y
 L3 checksum offload  = Y
 L4 checksum offload  = Y
+CRC offload          = Y
 Queue start/stop     = Y
 Scattered Rx         = Y
 Linux                = Y
doc/guides/rel_notes/release_26_11.rst +6 -0
index c8cc86295d..3678dd6894 100644
@@ -56,6 +56,12 @@ New Features
      =======================================================
 
 
+* **Updated NXP ENETC4 PMD.**
+
+  Updated the NXP ENETC4 poll mode driver for i.MX95:
+
+  * Added KEEP_CRC Rx offload support for the ENETC4 PMD to preserve the Ethernet FCS.
+
 Removed Items
 -------------
 
drivers/net/enetc/base/enetc4_hw.h +4 -0
index 9685e7e1e5..0105549857 100644
@@ -68,6 +68,10 @@ struct enetc_msg_swbd {
 #define PM_CMD_CFG_TX_EN		BIT(0)
 #define PM_CMD_CFG_RX_EN		BIT(1)
 
+/* RBaMR[CRC]: 0 = FCS removed, 1 = FCS preserved (KEEP_CRC) */
+#define ENETC4_RBMR_CRC			BIT(8)
+
+
 /* i.MX95 supports jumbo frame, but it is recommended to set the max frame
  * size to 2000 bytes.
  */
drivers/net/enetc/enetc4_ethdev.c +28 -3
index 2ddd63dafb..1a8056580c 100644
@@ -11,6 +11,19 @@
 #include "enetc_logs.h"
 #include "enetc.h"
 
+/* Supported Rx offloads */
+static uint64_t dev_rx_offloads_sup =
+	RTE_ETH_RX_OFFLOAD_IPV4_CKSUM |
+	RTE_ETH_RX_OFFLOAD_UDP_CKSUM |
+	RTE_ETH_RX_OFFLOAD_TCP_CKSUM |
+	RTE_ETH_RX_OFFLOAD_KEEP_CRC;
+
+/* Supported Tx offloads */
+static uint64_t dev_tx_offloads_sup =
+	RTE_ETH_TX_OFFLOAD_IPV4_CKSUM |
+	RTE_ETH_TX_OFFLOAD_UDP_CKSUM |
+	RTE_ETH_TX_OFFLOAD_TCP_CKSUM;
+
 #define ENETC4_TXQ_PRIORITIES	"enetc4_txq_prior"
 #define ENETC4_NC_MEMORY	"nc"
 
@@ -536,6 +549,8 @@ enetc4_rx_queue_setup(struct rte_eth_dev *dev,
 	struct enetc_eth_adapter *adapter =
 			ENETC_DEV_PRIVATE(data->dev_private);
 	uint64_t rx_offloads = data->dev_conf.rxmode.offloads;
+	uint32_t rx_enable;
+	bool keep_crc;
 
 	PMD_INIT_FUNC_TRACE();
 	if (nb_rx_desc > MAX_BD_COUNT)
@@ -549,6 +564,9 @@ enetc4_rx_queue_setup(struct rte_eth_dev *dev,
 	}
 
 	rx_ring->index = rx_queue_id;
+	keep_crc = !!(rx_offloads & RTE_ETH_RX_OFFLOAD_KEEP_CRC);
+	rx_ring->crc_len = (uint8_t)(keep_crc ? RTE_ETHER_CRC_LEN : 0);
+
 	err = enetc4_alloc_rxbdr(rx_ring, nb_rx_desc);
 	if (err)
 		goto fail;
@@ -562,19 +580,25 @@ enetc4_rx_queue_setup(struct rte_eth_dev *dev,
 	data->rx_queues[rx_queue_id] = rx_ring;
 	rx_ring->rx_deferred_start = rx_conf->rx_deferred_start;
 
+	if (keep_crc)
+		rx_enable |= ENETC4_RBMR_CRC;
+	else
+		rx_enable &= ~ENETC4_RBMR_CRC;
+
 	if (!rx_conf->rx_deferred_start) {
 		/* enable ring */
+		rx_enable |= ENETC_RBMR_EN;
 		enetc4_rxbdr_wr(&adapter->hw.hw, rx_ring->index, ENETC_RBMR,
-			       ENETC_RBMR_EN);
+			       rx_enable);
 		dev->data->rx_queue_state[rx_ring->index] =
 			       RTE_ETH_QUEUE_STATE_STARTED;
 	} else {
+		enetc4_rxbdr_wr(&adapter->hw.hw, rx_ring->index, ENETC_RBMR,
+			       rx_enable);
 		dev->data->rx_queue_state[rx_ring->index] =
 			       RTE_ETH_QUEUE_STATE_STOPPED;
 	}
 
-	rx_ring->crc_len = (uint8_t)((rx_offloads & RTE_ETH_RX_OFFLOAD_KEEP_CRC) ?
-				     RTE_ETHER_CRC_LEN : 0);
 	return 0;
 fail:
 	rte_free(rx_ring);
@@ -582,6 +606,7 @@ enetc4_rx_queue_setup(struct rte_eth_dev *dev,
 	return err;
 }
 
+
 void
 enetc4_rx_queue_release(struct rte_eth_dev *dev, uint16_t qid)
 {
drivers/net/enetc/enetc4_vf.c +1 -0
index ef5f1e6d66..83a1e4931f 100644
@@ -52,6 +52,7 @@ static uint64_t dev_rx_offloads_sup =
 	RTE_ETH_RX_OFFLOAD_UDP_CKSUM |
 	RTE_ETH_RX_OFFLOAD_TCP_CKSUM |
 	RTE_ETH_RX_OFFLOAD_VLAN_FILTER |
+	RTE_ETH_RX_OFFLOAD_KEEP_CRC |
 	RTE_ETH_RX_OFFLOAD_SCATTER;
 
 /* Supported Tx offloads */
drivers/net/enetc/enetc_rxtx.c +35 -4
index 8678bafece..e3bef607dd 100644
@@ -530,6 +530,28 @@ enetc_clean_rx_ring(struct enetc_bdr *rx_ring,
 	return rx_frm_cnt;
 }
 
+/*
+ * Trim the Ethernet FCS from a received cluster when HW CRC strip is
+ * disabled. pkt_len is reduced by crc_len. If the FCS straddles the last
+ * two segments (last seg holds fewer bytes than crc_len), drop the trailing
+ * segment and trim the carry-over from its predecessor. prev_seg is the
+ * segment preceding last_seg in the chain (the caller already tracks it).
+ */
+static inline void
+enetc_rx_crc_trim(struct rte_mbuf *first_seg, struct rte_mbuf *prev_seg,
+		  struct rte_mbuf *last_seg, uint16_t crc_len)
+{
+	first_seg->pkt_len -= crc_len;
+	if (likely(last_seg->data_len > crc_len)) {
+		last_seg->data_len -= crc_len;
+	} else if (prev_seg != NULL) {
+		first_seg->nb_segs--;
+		prev_seg->data_len -= crc_len - last_seg->data_len;
+		prev_seg->next = NULL;
+		rte_pktmbuf_free_seg(last_seg);
+	}
+}
+
 static int
 enetc_clean_rx_ring_nc(struct enetc_bdr *rx_ring,
 		    struct rte_mbuf **rx_pkts,
@@ -539,7 +561,7 @@ enetc_clean_rx_ring_nc(struct enetc_bdr *rx_ring,
 	int cleaned_cnt, i;
 	struct enetc_swbd *rx_swbd;
 	union enetc_rx_bd *rxbd, rxbd_temp;
-	struct rte_mbuf *first_seg, *cur_seg;
+	struct rte_mbuf *first_seg = NULL, *cur_seg = NULL;
 	uint32_t bd_status;
 	uint8_t *data;
 	uint32_t j;
@@ -572,6 +594,7 @@ enetc_clean_rx_ring_nc(struct enetc_bdr *rx_ring,
 		if (!first_seg) {
 			first_seg = seg;
 			cur_seg = seg;
+			prev_seg = NULL;
 			first_seg->pkt_len = data_len;
 			enetc_dev_rx_parse(first_seg, rxbd_temp.r.parse_summary);
 			first_seg->hash.rss = rxbd_temp.r.rss_hash;
@@ -579,6 +602,7 @@ enetc_clean_rx_ring_nc(struct enetc_bdr *rx_ring,
 			first_seg->pkt_len += data_len;
 			first_seg->nb_segs++;
 			cur_seg->next = seg;
+			prev_seg = cur_seg;
 			cur_seg = seg;
 		}
 
@@ -590,7 +614,9 @@ enetc_clean_rx_ring_nc(struct enetc_bdr *rx_ring,
 
 		if (bd_status & ENETC_RXBD_LSTATUS_F) {
 			seg->next = NULL;
-			first_seg->pkt_len -= rx_ring->crc_len;
+			if (rx_ring->crc_len)
+				enetc_rx_crc_trim(first_seg, prev_seg, seg,
+						  rx_ring->crc_len);
 			rx_pkts[rx_frm_cnt] = first_seg;
 			rx_frm_cnt++;
 			first_seg = NULL;
@@ -760,7 +786,7 @@ enetc_clean_rx_ring_cacheable(struct enetc_bdr *rx_ring,
 	int cleaned_cnt, i;
 	struct enetc_swbd *rx_swbd;
 	union enetc_rx_bd *rxbd;
-	struct rte_mbuf *first_seg, *cur_seg;
+	struct rte_mbuf *first_seg = NULL, *cur_seg = NULL;
 	uint32_t bd_status;
 	uint8_t *data;
 	uint32_t j;
@@ -815,6 +841,7 @@ enetc_clean_rx_ring_cacheable(struct enetc_bdr *rx_ring,
 		if (!first_seg) {
 			first_seg = seg;
 			cur_seg = seg;
+			prev_seg = NULL;
 			first_seg->pkt_len = data_len;
 			enetc_dev_rx_parse(first_seg,
 					   rxbd->r.parse_summary);
@@ -823,6 +850,7 @@ enetc_clean_rx_ring_cacheable(struct enetc_bdr *rx_ring,
 			first_seg->pkt_len += data_len;
 			first_seg->nb_segs++;
 			cur_seg->next = seg;
+			prev_seg = cur_seg;
 			cur_seg = seg;
 		}
 
@@ -838,7 +866,10 @@ enetc_clean_rx_ring_cacheable(struct enetc_bdr *rx_ring,
 
 		if (bd_status & ENETC_RXBD_LSTATUS_F) {
 			seg->next = NULL;
-			first_seg->pkt_len -= rx_ring->crc_len;
+			if (rx_ring->crc_len)
+				enetc_rx_crc_trim(first_seg, prev_seg, seg,
+						  rx_ring->crc_len);
+
 			rx_pkts[rx_frm_cnt] = first_seg;
 			rx_frm_cnt++;
 			first_seg = NULL;
#2 lore raw

PATCH 2/14 net/enetc: add TSO support for ENETC4 VF

In reply to Gagandeep Singh

Add TCP and UDP segmentation offload (TSO) for the ENETC4 virtual function. The offload is advertised through the VF Tx capabilities and is enabled on a per-queue basis when an application requests the TSO offload flags during Tx queue setup.

A dedicated Tx burst, enetc_xmit_pkts_lso(), builds the large-send descriptor chain: a standard header BD, a 16B extension BD carrying the segment size and frame length extension, and one BD per payload buffer with the final-frame flag on the last BD. To make room for the extra extension BD, an LSO-enabled Tx ring is allocated with twice the number of descriptors. The existing non-TSO Tx paths are left unchanged.

Update the ENETC4 feature list and documentation accordingly.

---
 doc/guides/nics/enetc4.rst             |   2 +
 doc/guides/nics/features/enetc4.ini    |   1 +
 doc/guides/rel_notes/release_26_11.rst |   1 +
 drivers/net/enetc/base/enetc4_hw.h     |  35 +++-
 drivers/net/enetc/enetc.h              |   5 +
 drivers/net/enetc/enetc4_ethdev.c      |  45 ++++-
 drivers/net/enetc/enetc4_vf.c          |   2 +
 drivers/net/enetc/enetc_rxtx.c         | 256 +++++++++++++++++++++++++
 8 files changed, 342 insertions(+), 5 deletions(-)
doc/guides/nics/enetc4.rst +2 -0
index f0dd039f6e..4d27e4048e 100644
@@ -53,6 +53,8 @@ Key functionality includes:
 - Receive processing: Upon packet reception, the BD Ring status bit is set,
   facilitating packet processing.
 - Transmission: Packet transmission precedes reception, ensuring efficient data transfer.
+- TCP and UDP segmentation offload (TSO) on VFs, enabled per Tx queue
+  when the TSO offload flag is requested.
 
 
 Prerequisites
doc/guides/nics/features/enetc4.ini +1 -0
index 91b18d979e..8ec1e8d00f 100644
@@ -7,6 +7,7 @@
 Link status event    = Y
 Speed capabilities   = Y
 Link status          = Y
+TSO                  = Y
 Promiscuous mode     = Y
 Allmulticast mode    = Y
 Unicast MAC filter   = Y
doc/guides/rel_notes/release_26_11.rst +1 -0
index 3678dd6894..6a348ab4e0 100644
@@ -61,6 +61,7 @@ New Features
   Updated the NXP ENETC4 poll mode driver for i.MX95:
 
   * Added KEEP_CRC Rx offload support for the ENETC4 PMD to preserve the Ethernet FCS.
+  * Added TCP Segmentation Offload (TSO) support for the ENETC4 VF.
 
 Removed Items
 -------------
drivers/net/enetc/base/enetc4_hw.h +34 -1
index 0105549857..64c1a5e750 100644
@@ -1,5 +1,5 @@
 /* SPDX-License-Identifier: BSD-3-Clause
- * Copyright 2024 NXP
+ * Copyright 2024-2026 NXP
  *
  * This header file defines the register offsets and bit fields
  * of ENETC4 PF and VFs.
@@ -24,8 +24,14 @@ struct enetc_msg_swbd {
 
 /* enetc4 txbd flags */
 #define ENETC4_TXBD_FLAGS_L4CS		BIT(0)
+/* Request LSO (Large Send Offload) segmentation for this frame */
+#define ENETC4_TXBD_FLAGS_LSO		BIT(1)
+/* L4 checksum insertion (also used for checksum update on LSO) */
 #define ENETC4_TXBD_FLAGS_L_TX_CKSUM	BIT(3)
+/* Extended descriptor: the next 16B ring entry is an extension BD */
+#define ENETC4_TXBD_FLAGS_EXT		BIT(6)
 #define ENETC4_TXBD_FLAGS_F		BIT(7)
+
 /* L4 type */
 #define ENETC4_TXBD_L4T_UDP		BIT(0)
 #define ENETC4_TXBD_L4T_TCP		BIT(1)
@@ -34,6 +40,33 @@ struct enetc_msg_swbd {
 /* IPv4 checksum */
 #define ENETC4_TXBD_IPCS		1
 
+/*
+ * Extension Transmit Buffer Descriptor (16B). When the standard BD has the
+ * extended flag set, this occupies the next ring entry and carries the extra
+ * fields required by LSO.
+ */
+struct enetc_tx_bd_ext {
+	uint32_t timestamp;	/* PTP timestamp, unused for LSO */
+	uint32_t vlan;		/* VLAN insert, unused for LSO */
+	uint32_t lso;		/* LSO_MAX_SEG_SIZE and FRM_LEN_EXT */
+	uint32_t flags;		/* extension flags */
+};
+
+/* LSO_MAX_SEG_SIZE occupies bits 13-0 of the LSO word */
+#define ENETC4_TXBD_EXT_LSO_SEG_MASK	0x3fff
+#define ENETC4_TXBD_EXT_LSO_SEG(mss) \
+		((uint32_t)((mss) & ENETC4_TXBD_EXT_LSO_SEG_MASK))
+/* FRM_LEN_EXT occupies bits 19-16 of the LSO word (top 4 bits of data len) */
+#define ENETC4_TXBD_EXT_FRM_LEN_EXT(x) \
+		(((uint32_t)((x) & 0xf)) << 16)
+/* Final flag in the extension flags word (bit 127 -> local bit 31) */
+#define ENETC4_TXBD_EXT_FLAGS_F		BIT(31)
+
+/* NETC does not create LSO frames larger than this many bytes */
+#define ENETC4_LSO_MAX_FRAME		9600
+/* Maximum LSO data unit (payload to be segmented) supported by HW: 256KB */
+#define ENETC4_LSO_MAX_DATA_UNIT	(256 * 1024)
+
 /***************************ENETC port registers**************************/
 #define ENETC4_PMR		0x10
 #define ENETC4_PMR_EN		(BIT(16) | BIT(17) | BIT(18))
drivers/net/enetc/enetc.h +5 -0
index d3a8b8e34a..db349e051b 100644
@@ -91,6 +91,7 @@ struct enetc_bdr {
 		void *tcisr; /* Tx */
 		int next_to_alloc; /* Rx */
 	};
+
 	struct rte_mempool *mb_pool;   /* mbuf pool to populate RX ring. */
 	/* Partial scatter-gather chain persisted across burst calls. */
 	struct rte_mbuf *pkt_first_seg; /* first segment of in-progress frame */
@@ -99,6 +100,7 @@ struct enetc_bdr {
 	uint64_t ierrors;
 	uint8_t rx_deferred_start;
 	uint8_t tx_deferred_start;
+	uint8_t lso_enable;
 };
 
 struct enetc_eth_hw {
@@ -312,6 +314,9 @@ uint16_t enetc_xmit_pkts(void *txq, struct rte_mbuf **tx_pkts,
 		uint16_t nb_pkts);
 uint16_t enetc_xmit_pkts_nc(void *txq, struct rte_mbuf **tx_pkts,
 		uint16_t nb_pkts);
+uint16_t enetc_xmit_pkts_lso(void *txq, struct rte_mbuf **tx_pkts,
+		uint16_t nb_pkts);
+
 uint16_t enetc_recv_pkts(void *rxq, struct rte_mbuf **rx_pkts,
 		uint16_t nb_pkts);
 uint16_t enetc_recv_pkts_nc(void *rxq, struct rte_mbuf **rx_pkts,
drivers/net/enetc/enetc4_ethdev.c +41 -4

94 lines not on this page · raw message

drivers/net/enetc/enetc4_vf.c +2 -0
index 83a1e4931f..3083a56335 100644
@@ -60,6 +60,8 @@ static uint64_t dev_tx_offloads_sup =
 	RTE_ETH_TX_OFFLOAD_IPV4_CKSUM |
 	RTE_ETH_TX_OFFLOAD_UDP_CKSUM |
 	RTE_ETH_TX_OFFLOAD_TCP_CKSUM |
+	RTE_ETH_TX_OFFLOAD_TCP_TSO |
+	RTE_ETH_TX_OFFLOAD_UDP_TSO |
 	RTE_ETH_TX_OFFLOAD_MULTI_SEGS;
 
 static void
drivers/net/enetc/enetc_rxtx.c +256 -0

262 lines not on this page · raw message

#3 lore raw

PATCH 3/14 net/enetc: add RSC (hardware LRO) support for ENETC4

In reply to Gagandeep Singh

Add Receive Segment Coalesce (RSC) support, exposed as the DPDK RTE_ETH_RX_OFFLOAD_TCP_LRO Rx offload, for the ENETC4 PF and VF on i.MX95. RSC lets the HW coalesce multiple in-order TCP segments of a flow into a single receive frame, reducing per-packet overhead.

RSC is a port-level offload driven by a dedicated Rx burst (enetc_recv_pkts_rsc). When TCP LRO is requested the ring is switched to 32B extended receive descriptors (RBaMR[BDS] = 1), the FCS is stripped (RBaMR[CRC] = 0, so RSC is incompatible with KEEP_CRC), interrupt coalescing is enabled (RBaICR0[ICEN] with a non-zero RBaICR1[ICTT] hold timer that doubles as the RSC flush window), and RBaRSCR[EN] is set with the coalesced-frame size clamped to the HW maximum.

Because a 32B descriptor spans two 16B ring slots, the ring length register (RBaLENR) and the consumer-index register are programmed in HW-descriptor units (slot count / 2), while the internal SW indices continue to track 16B slots. Coalesced clusters are delivered with the RTE_MBUF_F_RX_LRO flag set when RSC_FRAMES > 1.

---
 doc/guides/nics/enetc4.rst             |   4 +
 doc/guides/nics/features/enetc4.ini    |   1 +
 doc/guides/rel_notes/release_26_11.rst |   1 +
 drivers/net/enetc/base/enetc4_hw.h     |  74 ++++++++
 drivers/net/enetc/enetc.h              |   5 +
 drivers/net/enetc/enetc4_ethdev.c      | 102 ++++++++++-
 drivers/net/enetc/enetc4_vf.c          |   1 +
 drivers/net/enetc/enetc_rxtx.c         | 236 +++++++++++++++++++++++++
 8 files changed, 417 insertions(+), 7 deletions(-)
doc/guides/nics/enetc4.rst +4 -0
index 4d27e4048e..e7f4348603 100644
@@ -55,6 +55,10 @@ Key functionality includes:
 - Transmission: Packet transmission precedes reception, ensuring efficient data transfer.
 - TCP and UDP segmentation offload (TSO) on VFs, enabled per Tx queue
   when the TSO offload flag is requested.
+- Large receive offload (LRO) on the receive path via hardware Receive
+  Segment Coalesce (RSC), enabled when the TCP LRO Rx offload flag is
+  requested. RSC requires the FCS to be stripped, so it cannot be combined
+  with the KEEP_CRC Rx offload.
 
 
 Prerequisites
doc/guides/nics/features/enetc4.ini +1 -0
index 8ec1e8d00f..aae398e210 100644
@@ -7,6 +7,7 @@
 Link status event    = Y
 Speed capabilities   = Y
 Link status          = Y
+LRO                  = Y
 TSO                  = Y
 Promiscuous mode     = Y
 Allmulticast mode    = Y
doc/guides/rel_notes/release_26_11.rst +1 -0
index 6a348ab4e0..0dd08e0259 100644
@@ -62,6 +62,7 @@ New Features
 
   * Added KEEP_CRC Rx offload support for the ENETC4 PMD to preserve the Ethernet FCS.
   * Added TCP Segmentation Offload (TSO) support for the ENETC4 VF.
+  * Added Receive Segment Coalesce (RSC / hardware LRO) support for ENETC4 PF and VF.
 
 Removed Items
 -------------
drivers/net/enetc/base/enetc4_hw.h +74 -0

81 lines not on this page · raw message

drivers/net/enetc/enetc.h +5 -0
index db349e051b..67f8ce1919 100644
@@ -101,6 +101,8 @@ struct enetc_bdr {
 	uint8_t rx_deferred_start;
 	uint8_t tx_deferred_start;
 	uint8_t lso_enable;
+	void *rbidr;
+	uint8_t rsc_enable;
 };
 
 struct enetc_eth_hw {
@@ -321,12 +323,15 @@ uint16_t enetc_recv_pkts(void *rxq, struct rte_mbuf **rx_pkts,
 		uint16_t nb_pkts);
 uint16_t enetc_recv_pkts_nc(void *rxq, struct rte_mbuf **rx_pkts,
 		uint16_t nb_pkts);
+uint16_t enetc_recv_pkts_rsc(void *rxq, struct rte_mbuf **rx_pkts,
+		uint16_t nb_pkts);
 uint16_t enetc_xmit_pkts_cacheable(void *txq, struct rte_mbuf **tx_pkts,
 		uint16_t nb_pkts);
 uint16_t enetc_recv_pkts_cacheable(void *rxq, struct rte_mbuf **rx_pkts,
 		uint16_t nb_pkts);
 
 int enetc_refill_rx_ring(struct enetc_bdr *rx_ring, const int buff_cnt);
+int enetc_refill_rx_ring_rsc(struct enetc_bdr *rx_ring, const int buff_cnt);
 
 /*
  * Cache-maintenance constants for cacheable BD ring mode.
drivers/net/enetc/enetc4_ethdev.c +95 -7

169 lines not on this page · raw message

drivers/net/enetc/enetc4_vf.c +1 -0
index 3083a56335..be79a18a39 100644
@@ -53,6 +53,7 @@ static uint64_t dev_rx_offloads_sup =
 	RTE_ETH_RX_OFFLOAD_TCP_CKSUM |
 	RTE_ETH_RX_OFFLOAD_VLAN_FILTER |
 	RTE_ETH_RX_OFFLOAD_KEEP_CRC |
+	RTE_ETH_RX_OFFLOAD_TCP_LRO |
 	RTE_ETH_RX_OFFLOAD_SCATTER;
 
 /* Supported Tx offloads */
drivers/net/enetc/enetc_rxtx.c +236 -0

242 lines not on this page · raw message

#4 lore raw

PATCH 4/14 net/enetc: extend link speed code field to 8-bit for PF-to-VF message

In reply to Gagandeep Singh

The PF-to-VF message is only 16-bit wide, where the upper 8-bit is the class_id and the lower 8-bit carries the message content. For the link speed message, the lower 4-bit was previously occupied by the cookie field, leaving only 4-bit for the speed code, which allows at most 15 distinct speed values.

As the NETC IP evolves and supports more and more link speeds, 15 speed values are clearly insufficient. Since the cookie field is designed for non-blocking messages and has no meaningful use in link speed messages, remove it and expand the speed code field from 4-bit to 8-bit, allowing up to 255 speed values (ENETC_SPEED_MAX = 0xff).

Instead of enumerating every speed value greater than 5Gbps explicitly, introduce a formula-based approach:

	speed_code = (link_speed - 5000) / 1000 + ENETC_SPEED_5000

This removes the explicit enum entries for 10G, 25G, 50G and 100G, and replaces the individual switch-case branches with a generic implementation to get the speed, making it easy to support any future high speed without modifying the enum or the switch statement.

For backward compatibility with a PF running an older kernel (before 6.18.37) that still uses the legacy 4-bit speed code / 4-bit cookie message layout, add a "vf_link_legacy" devarg. When set to 1, the VF extracts the message result from the upper 4 bits of the lower byte and decodes speeds greater than 5Gbps using the legacy fixed class codes (10G/25G/50G/100G). The default (0) uses the new 8-bit layout.

	Usage: -a <pci_addr>,vf_link_legacy=1
---
 doc/guides/rel_notes/release_26_11.rst |   1 +
 drivers/net/enetc/enetc.h              |  32 ++++-
 drivers/net/enetc/enetc4_vf.c          | 175 +++++++++++++++++++++----
 3 files changed, 175 insertions(+), 33 deletions(-)
doc/guides/rel_notes/release_26_11.rst +1 -0
index 0dd08e0259..d7961d3c85 100644
@@ -63,6 +63,7 @@ New Features
   * Added KEEP_CRC Rx offload support for the ENETC4 PMD to preserve the Ethernet FCS.
   * Added TCP Segmentation Offload (TSO) support for the ENETC4 VF.
   * Added Receive Segment Coalesce (RSC / hardware LRO) support for ENETC4 PF and VF.
+  * Extended the PF-to-VF link speed code field from 4-bit to 8-bit in ENETC4.
 
 Removed Items
 -------------
drivers/net/enetc/enetc.h +27 -5
index 67f8ce1919..c983cb059e 100644
@@ -120,6 +120,10 @@ struct enetc_eth_hw {
 	uint32_t vsi_delay;   /* VSI-PSI message wait delay (us) */
 	uint32_t *txq_prior;  /* per-queue TX priority (TBMR priority bits) */
 	uint8_t nc_mode;      /* 1 = non-cacheable BD memory, use _nc ops */
+	/* 1 = legacy PF-to-VF link message layout (4-bit speed / 4-bit cookie),
+	 * for PF kernel versions before 6.18.37. Set via vf_link_legacy devarg.
+	 */
+	uint8_t vf_link_legacy;
 };
 
 /*
@@ -211,11 +215,29 @@ enum speed {
 	ENETC_SPEED_1000 = 0x5,
 	ENETC_SPEED_2500 = 0x6,
 	ENETC_SPEED_5000 = 0x7,
-	ENETC_SPEED_10G = 0x8,
-	ENETC_SPEED_25G = 0x9,
-	ENETC_SPEED_50G = 0xA,
-	ENETC_SPEED_100G = 0xB,
-	ENETC_SPEED_NOT_SUPPORTED = 0xF
+	/* Base speed class code used by the >5Gbps formula below */
+	/* Do not add enumeration values for any speed greater than
+	 * 5Gbps. For any speed greater than 5Gbps, its speed class
+	 * code should follow the formula below.
+	 *
+	 * SPEED = (link_speed - 5000) / 1000 + ENETC_SPEED_5000
+	 *
+	 * The unit of link_speed should be Mbps, the max SPEED
+	 * should <= ENETC_SPEED_MAX.
+	 */
+	ENETC_SPEED_MAX = 0xff,
+};
+
+/* Legacy speed class codes for backward compatibility with an older kernel PF
+ * (before 6.18.37) that encoded a 4-bit speed code and 4-bit cookie in the
+ * message's lower byte. Used only when the vf_link_legacy devarg is set.
+ */
+enum speed_legacy {
+	ENETC_SPEED_LEGACY_10G = 0x8,
+	ENETC_SPEED_LEGACY_25G = 0x9,
+	ENETC_SPEED_LEGACY_50G = 0xA,
+	ENETC_SPEED_LEGACY_100G = 0xB,
+	ENETC_SPEED_LEGACY_NOT_SUPPORTED = 0xF
 };
 
 /* PSI-VSI command header format */
drivers/net/enetc/enetc4_vf.c +147 -28

248 lines not on this page · raw message

#5 lore raw

PATCH 5/14 net/enetc: support firmware version get for VF

In reply to Gagandeep Singh

Implement the ``.fw_version_get`` eth_dev op for the ENETC4 VF PMD to report the NETC IP revision.

The NETC IP major revision is read from the PCI revision ID register, while the IP minor revision is retrieved from the PSI over VSI-PSI messaging using the "Get IP version" command class (class ID 0xF0, command ID 0x1). The version is reported in the "<major>.<minor>" format.

The PSI firmware only implements the IP_MN command of this class, so the major revision is obtained from the PCI revision ID, matching the behaviour of the kernel PF/VF drivers.

---
 doc/guides/nics/enetc4.rst             |   1 +
 doc/guides/nics/features/enetc4.ini    |   1 +
 doc/guides/rel_notes/release_26_11.rst |   1 +
 drivers/net/enetc/enetc.h              |  19 +++-
 drivers/net/enetc/enetc4_vf.c          | 135 +++++++++++++++++++++++++
 5 files changed, 155 insertions(+), 2 deletions(-)
doc/guides/nics/enetc4.rst +1 -0
index e7f4348603..ea0e37896d 100644
@@ -59,6 +59,7 @@ Key functionality includes:
   Segment Coalesce (RSC), enabled when the TCP LRO Rx offload flag is
   requested. RSC requires the FCS to be stripped, so it cannot be combined
   with the KEEP_CRC Rx offload.
+- Firmware version: The NETC IP version is reported via ``rte_eth_dev_fw_version_get``.
 
 
 Prerequisites
doc/guides/nics/features/enetc4.ini +1 -0
index aae398e210..eaf474e7ba 100644
@@ -16,6 +16,7 @@ VLAN filter          = Y
 RSS hash             = Y
 Packet type parsing  = Y
 Basic stats          = Y
+FW version           = Y
 L3 checksum offload  = Y
 L4 checksum offload  = Y
 CRC offload          = Y
doc/guides/rel_notes/release_26_11.rst +1 -0
index d7961d3c85..5ac2bb4de0 100644
@@ -64,6 +64,7 @@ New Features
   * Added TCP Segmentation Offload (TSO) support for the ENETC4 VF.
   * Added Receive Segment Coalesce (RSC / hardware LRO) support for ENETC4 PF and VF.
   * Extended the PF-to-VF link speed code field from 4-bit to 8-bit in ENETC4.
+  * Added firmware version reporting for the ENETC4 VF.
 
 Removed Items
 -------------
drivers/net/enetc/enetc.h +17 -2
index c983cb059e..b1428f1bca 100644
@@ -170,7 +170,8 @@ enum enetc_msg_cmd_class_id {
 	ENETC_CLASS_ID_MAC_FILTER = 0x20,
 	ENETC_CLASS_ID_VLAN_FILTER = 0x21,
 	ENETC_CLASS_ID_LINK_STATUS = 0x80,
-	ENETC_CLASS_ID_LINK_SPEED = 0x81
+	ENETC_CLASS_ID_LINK_SPEED = 0x81,
+	ENETC_CLASS_ID_GET_IP_VER = 0xF0
 };
 
 /* Enum for command IDs */
@@ -184,9 +185,18 @@ enum enetc_msg_cmd_id {
 	ENETC_CMD_ID_GET_LINK_STATUS = 0,
 	ENETC_CMD_ID_REGISTER_LINK_NOTIF = 1,
 	ENETC_CMD_ID_UNREGISTER_LINK_NOTIF = 2,
-	ENETC_CMD_ID_GET_LINK_SPEED = 0
+	ENETC_CMD_ID_GET_LINK_SPEED = 0,
+	/* Get IP version command IDs (class ID 0xF0) */
+	ENETC_CMD_ID_GET_IP_MJ = 0,
+	ENETC_CMD_ID_GET_IP_MN = 1,
+	ENETC_CMD_ID_GET_IP_INT = 2,
+	ENETC_CMD_ID_GET_IP_MNT = 3,
+	ENETC_CMD_ID_GET_IP_CFG = 4
 };
 
+/* IP_VER value returned when the version is not available */
+#define ENETC_IP_VER_NOT_AVAILABLE	0xFF
+
 enum mac_addr_status {
 	ENETC_INVALID_MAC_ADDR = 0x0,
 	ENETC_DUPLICATE_MAC_ADDR = 0X1,
@@ -274,6 +284,11 @@ struct enetc_msg_cmd_get_link_speed {
 	struct enetc_msg_cmd_header header;
 };
 
+/* Get IP version command message format (class ID 0xF0) */
+struct enetc_msg_cmd_get_ip_ver {
+	struct enetc_msg_cmd_header header;
+};
+
 struct enetc_msg_cmd_set_vlan_promisc {
 	struct enetc_msg_cmd_header header;
 	uint8_t op;
drivers/net/enetc/enetc4_vf.c +135 -0

159 lines not on this page · raw message

#6 lore raw

PATCH 6/14 net/enetc: support registers dump

In reply to Gagandeep Singh

Implement the .get_reg operation for the ENETC4 PF and VF PMDs to dump the device registers via rte_eth_dev_get_reg_info.

The VF dumps the registers reachable by a virtual station interface (VSI): the station interface and per-ring BD ring registers. Port registers are not accessible by a VF.

The PF additionally dumps the port registers, which are only accessible by the physical station interface (PSI).

---
 doc/guides/nics/enetc4.rst             |  1 +
 doc/guides/nics/features/enetc4.ini    |  1 +
 doc/guides/rel_notes/release_26_11.rst |  1 +
 drivers/net/enetc/enetc.h              | 13 +++++
 drivers/net/enetc/enetc4_ethdev.c      | 70 ++++++++++++++++++++++++++
 drivers/net/enetc/enetc4_vf.c          | 62 +++++++++++++++++++++++
 6 files changed, 148 insertions(+)
doc/guides/nics/enetc4.rst +1 -0
index ea0e37896d..cd757be12f 100644
@@ -60,6 +60,7 @@ Key functionality includes:
   requested. RSC requires the FCS to be stripped, so it cannot be combined
   with the KEEP_CRC Rx offload.
 - Firmware version: The NETC IP version is reported via ``rte_eth_dev_fw_version_get``.
+- Registers dump: The station interface, port (PF only) and BD ring registers are dumped via ``rte_eth_dev_get_reg_info``.
 
 
 Prerequisites
doc/guides/nics/features/enetc4.ini +1 -0
index eaf474e7ba..6540a43909 100644
@@ -17,6 +17,7 @@ RSS hash             = Y
 Packet type parsing  = Y
 Basic stats          = Y
 FW version           = Y
+Registers dump       = Y
 L3 checksum offload  = Y
 L4 checksum offload  = Y
 CRC offload          = Y
doc/guides/rel_notes/release_26_11.rst +1 -0
index 5ac2bb4de0..deb3bc5d52 100644
@@ -65,6 +65,7 @@ New Features
   * Added Receive Segment Coalesce (RSC / hardware LRO) support for ENETC4 PF and VF.
   * Extended the PF-to-VF link speed code field from 4-bit to 8-bit in ENETC4.
   * Added firmware version reporting for the ENETC4 VF.
+  * Added register dump support for ENETC4 PF and VF.
 
 Removed Items
 -------------
drivers/net/enetc/enetc.h +13 -0
index b1428f1bca..73404308fe 100644
@@ -397,6 +397,19 @@ enetc_bd_unused(struct enetc_bdr *bdr)
 	return bdr->bd_count + bdr->next_to_clean - bdr->next_to_use - 1;
 }
 
+/* Per-ring Tx BDR registers dumped by .get_reg (shared by PF and VF) */
+static const uint32_t enetc4_txbdr_regs[] = {
+	ENETC_TBMR, ENETC_TBSR, ENETC_TBBAR0, ENETC_TBBAR1,
+	ENETC_TBCIR, ENETC_TBLENR,
+};
+
+/* Per-ring Rx BDR registers dumped by .get_reg (shared by PF and VF) */
+static const uint32_t enetc4_rxbdr_regs[] = {
+	ENETC_RBMR, ENETC_RBSR, ENETC_RBBSR, ENETC_RBCIR,
+	ENETC_RBBAR0, ENETC_RBBAR1, ENETC_RBPIR, ENETC_RBLENR,
+};
+
+
 /* CBDR prototypes */
 int enetc4_setup_cbdr(struct rte_eth_dev *dev, struct enetc_hw *hw,
 			int bd_count, struct netc_cbdr *cbdr);
drivers/net/enetc/enetc4_ethdev.c +70 -0

82 lines not on this page · raw message

drivers/net/enetc/enetc4_vf.c +62 -0

80 lines not on this page · raw message

#7 lore raw

PATCH 7/14 net/enetc: support ethtool ring parameters

In reply to Gagandeep Singh

The ethtool ring parameter query relies on the queue info ethdev ops (.rxq_info_get/.txq_info_get) together with the descriptor limits reported in dev_info. The PF already registered these ops, but the VF ops tables did not, so ring parameter queries failed on the VF.

Make enetc4_rxq_info_get() and enetc4_txq_info_get() non-static and register them in both VF ops tables so ring parameters are reported for both the PF and VF.

---
 doc/guides/rel_notes/release_26_11.rst | 1 +
 drivers/net/enetc/enetc.h              | 4 ++++
 drivers/net/enetc/enetc4_ethdev.c      | 4 ++--
 drivers/net/enetc/enetc4_vf.c          | 4 ++++
 4 files changed, 11 insertions(+), 2 deletions(-)
doc/guides/rel_notes/release_26_11.rst +1 -0
index deb3bc5d52..9e333edf4f 100644
@@ -66,6 +66,7 @@ New Features
   * Extended the PF-to-VF link speed code field from 4-bit to 8-bit in ENETC4.
   * Added firmware version reporting for the ENETC4 VF.
   * Added register dump support for ENETC4 PF and VF.
+  * Added ring parameters support for the ENETC4 VF (rxq_info_get / txq_info_get).
 
 Removed Items
 -------------
drivers/net/enetc/enetc.h +4 -0
index 73404308fe..367d350dde 100644
@@ -339,6 +339,10 @@ int enetc4_tx_queue_stop(struct rte_eth_dev *dev, uint16_t qidx);
 void enetc4_tx_queue_release(struct rte_eth_dev *dev, uint16_t qid);
 const uint32_t *enetc4_supported_ptypes_get(struct rte_eth_dev *dev __rte_unused,
 			size_t *no_of_elements);
+void enetc4_rxq_info_get(struct rte_eth_dev *dev, uint16_t queue_id,
+			 struct rte_eth_rxq_info *qinfo);
+void enetc4_txq_info_get(struct rte_eth_dev *dev, uint16_t queue_id,
+			 struct rte_eth_txq_info *qinfo);
 
 /*
  * enetc4_vf function prototype
drivers/net/enetc/enetc4_ethdev.c +2 -2
index 681bac3ecc..afee0b90a3 100644
@@ -1125,7 +1125,7 @@ enetc4_tx_queue_stop(struct rte_eth_dev *dev, uint16_t qidx)
 	return 0;
 }
 
-static void
+void
 enetc4_rxq_info_get(struct rte_eth_dev *dev, uint16_t queue_id,
 			struct rte_eth_rxq_info *qinfo)
 {
@@ -1139,7 +1139,7 @@ enetc4_rxq_info_get(struct rte_eth_dev *dev, uint16_t queue_id,
 	qinfo->conf.rx_drop_en = 0;
 }
 
-static void
+void
 enetc4_txq_info_get(struct rte_eth_dev *dev, uint16_t queue_id,
 			struct rte_eth_txq_info *qinfo)
 {
drivers/net/enetc/enetc4_vf.c +4 -0
index 8af22f069b..7623a66e98 100644
@@ -1508,10 +1508,12 @@ static const struct eth_dev_ops enetc4_vf_ops_no_vsi_m = {
 	.rx_queue_start       = enetc4_rx_queue_start,
 	.rx_queue_stop        = enetc4_rx_queue_stop,
 	.rx_queue_release     = enetc4_rx_queue_release,
+	.rxq_info_get         = enetc4_rxq_info_get,
 	.tx_queue_setup       = enetc4_tx_queue_setup,
 	.tx_queue_start       = enetc4_tx_queue_start,
 	.tx_queue_stop        = enetc4_tx_queue_stop,
 	.tx_queue_release     = enetc4_tx_queue_release,
+	.txq_info_get         = enetc4_txq_info_get,
 	.dev_supported_ptypes_get = enetc4_supported_ptypes_get,
 };
 
@@ -1537,10 +1539,12 @@ static const struct eth_dev_ops enetc4_vf_ops = {
 	.rx_queue_start       = enetc4_rx_queue_start,
 	.rx_queue_stop        = enetc4_rx_queue_stop,
 	.rx_queue_release     = enetc4_rx_queue_release,
+	.rxq_info_get         = enetc4_rxq_info_get,
 	.tx_queue_setup       = enetc4_tx_queue_setup,
 	.tx_queue_start       = enetc4_tx_queue_start,
 	.tx_queue_stop        = enetc4_tx_queue_stop,
 	.tx_queue_release     = enetc4_tx_queue_release,
+	.txq_info_get         = enetc4_txq_info_get,
 	.dev_supported_ptypes_get = enetc4_supported_ptypes_get,
 };
 
#8 lore raw

PATCH 8/14 net/enetc: refresh link speed on VF link-up interrupt

In reply to Gagandeep Singh

The interrupt-driven link-status path (enetc4_process_psi_msg) only updated link_status when a PSI-to-VSI notification arrived; it never re-queried the link speed from the PF. As a result, after a link-down followed by a link-up the cached link_speed showed the speed from the previous session rather than the freshly negotiated one.

Fix this by:

1. Introducing enetc4_decode_link_speed() - a shared helper that maps a PF-to-VF speed status code to the corresponding RTE_ETH_SPEED_NUM_* / RTE_ETH_LINK_*_DUPLEX values, handling both the current and the legacy (vf_link_legacy) 4-bit message layout.

2. Calling enetc4_vf_get_link_speed() inside enetc4_process_psi_msg() on ENETC_LINK_UP so the negotiated speed is fetched from the PF and decoded immediately, before rte_eth_linkstatus_set() is called and the LSC callback is fired.

---
 doc/guides/rel_notes/release_26_11.rst |   1 +
 drivers/net/enetc/enetc4_vf.c          | 197 +++++++++++++------------
 2 files changed, 107 insertions(+), 91 deletions(-)
doc/guides/rel_notes/release_26_11.rst +1 -0
index 9e333edf4f..eca0dc1dea 100644
@@ -67,6 +67,7 @@ New Features
   * Added firmware version reporting for the ENETC4 VF.
   * Added register dump support for ENETC4 PF and VF.
   * Added ring parameters support for the ENETC4 VF (rxq_info_get / txq_info_get).
+  * Refreshed VF link speed on the link-up interrupt in the ENETC4 VF driver.
 
 Removed Items
 -------------
drivers/net/enetc/enetc4_vf.c +106 -91

218 lines not on this page · raw message

#9 lore raw

PATCH 9/14 net/enetc: support stats reset for VF

In reply to Gagandeep Singh

The NETC SI-level hardware counters (SIROCT0, SIRFRM0, SITOCT0, SITFRM0, SITDFCR) are read-only for a VF and cannot be directly zeroed. No VSI-PSI command class exists for stats reset, and using FLR/soft-reset to clear counters is not reliable due to a known hardware erratum on some NETC platforms.

Implement stats_reset for the enetc4 VF PMD using a software snapshot/delta approach: on stats_reset, the current HW counter values are captured as a baseline in a new per-device enetc4_vf_stats_saved struct. stats_get then reports the delta (current_hw_value - saved_baseline), so counters appear to start from zero after each reset call. Per-ring software Rx error accumulators (ierrors) are zeroed directly on reset.

Register the stats_reset callback in both VF ops tables (enetc4_vf_ops and enetc4_vf_ops_no_vsi_m) so the feature is available regardless of whether the VSI messaging path is enabled.

---
 doc/guides/rel_notes/release_26_11.rst |  1 +
 drivers/net/enetc/enetc.h              | 17 +++++++
 drivers/net/enetc/enetc4_vf.c          | 61 +++++++++++++++++++++++---
 3 files changed, 74 insertions(+), 5 deletions(-)
doc/guides/rel_notes/release_26_11.rst +1 -0
index eca0dc1dea..b88e2825a6 100644
@@ -68,6 +68,7 @@ New Features
   * Added register dump support for ENETC4 PF and VF.
   * Added ring parameters support for the ENETC4 VF (rxq_info_get / txq_info_get).
   * Refreshed VF link speed on the link-up interrupt in the ENETC4 VF driver.
+  * Added stats reset for the ENETC4 VF using a software snapshot/delta approach.
 
 Removed Items
 -------------
drivers/net/enetc/enetc.h +17 -0
index 367d350dde..3590cf6639 100644
@@ -105,6 +105,21 @@ struct enetc_bdr {
 	uint8_t rsc_enable;
 };
 
+/*
+ * Saved SI counter baseline for VF stats reset. Since the SI-level
+ * hardware counters (SIROCT0, SIRFRM0, SITOCT0, SITFRM0, SITDFCR)
+ * are read-only for a VF and cannot be directly zeroed, stats_reset
+ * captures the current counter values as a baseline. stats_get then
+ * reports the delta: current_hw_value - baseline.
+ */
+struct enetc4_vf_stats_saved {
+	uint64_t ipackets;
+	uint64_t opackets;
+	uint64_t ibytes;
+	uint64_t obytes;
+	uint64_t oerrors;
+};
+
 struct enetc_eth_hw {
 	struct rte_eth_dev *ndev;
 	struct enetc_hw hw;
@@ -124,6 +139,8 @@ struct enetc_eth_hw {
 	 * for PF kernel versions before 6.18.37. Set via vf_link_legacy devarg.
 	 */
 	uint8_t vf_link_legacy;
+	/* Baseline snapshot for VF stats reset (software delta approach). */
+	struct enetc4_vf_stats_saved vf_stats_saved;
 };
 
 /*
drivers/net/enetc/enetc4_vf.c +56 -5

83 lines not on this page · raw message

#10 lore raw

PATCH 10/14 net/enetc4: add per-queue Rx interrupt support for VF

In reply to Gagandeep Singh

Add MSI-X per-queue Rx interrupt support to the ENETC4 VF PMD on the cacheable (default) Rx path. This allows applications such as l3fwd-power to block in epoll_wait when no traffic is present, reducing CPU utilization to near zero.

MSI-X vector 0 is reserved for the PSI-to-VSI mailbox. Rx queue i is mapped to MSI-X vector i + 1 via ENETC_SIMSIRRV. Per-ring coalescing is enabled with ICPT=1 so the first arriving packet fires the interrupt immediately. The SIRXIDR W1C detect bit is cleared before re-arming ENETC_RBIER to prevent spurious interrupts after traffic stops.

The interrupt infrastructure (rte_intr_efd_enable + rte_intr_vec_list_alloc) is set up before rte_intr_enable() so that vfio-pci can wire each MSI-X vector to its eventfd when programming the MSI-X table.

enetc4_dev_configure() is updated to trigger interrupt setup when intr_conf.rxq is set (not only when intr_conf.lsc is set), as applications like l3fwd-power set intr_conf.rxq without setting lsc.

Documentation is updated to describe the feature, list the kernel and host setup steps, and provide an example l3fwd-power command for single queue/core interrupt-driven operation.

---
 doc/guides/nics/enetc4.rst             | 69 +++++++++++++++++++-
 doc/guides/nics/features/enetc4.ini    |  1 +
 doc/guides/rel_notes/release_26_11.rst |  1 +
 drivers/net/enetc/base/enetc4_hw.h     |  2 +
 drivers/net/enetc/enetc.h              |  1 +
 drivers/net/enetc/enetc4_ethdev.c      |  9 +--
 drivers/net/enetc/enetc4_vf.c          | 89 +++++++++++++++++++++++++-
 7 files changed, 166 insertions(+), 6 deletions(-)
doc/guides/nics/enetc4.rst +68 -1
index cd757be12f..d8e323d614 100644
@@ -59,6 +59,10 @@ Key functionality includes:
   Segment Coalesce (RSC), enabled when the TCP LRO Rx offload flag is
   requested. RSC requires the FCS to be stripped, so it cannot be combined
   with the KEEP_CRC Rx offload.
+- Per-queue Rx interrupts on VFs (cacheable Rx path only), enabling
+  interrupt-driven receive with ``vfio-pci``. Applications set
+  ``intr_conf.rxq = 1`` in ``rte_eth_conf`` to activate this feature.
+  See `Rx Interrupt Mode (VF)`_ for setup details.
 - Firmware version: The NETC IP version is reported via ``rte_eth_dev_fw_version_get``.
 - Registers dump: The station interface, port (PF only) and BD ring registers are dumped via ``rte_eth_dev_get_reg_info``.
 
@@ -95,7 +99,9 @@ The following dependencies are not part of DPDK and must be installed separately
 Driver compilation and testing
 ------------------------------
 
-Follow instructions available in the document :doc:`build_and_test` to launch **testpmd**.
+Follow instructions available in the document
+:ref:`compiling and testing a PMD for a NIC <pmd_build_and_test>`
+to launch **testpmd**.
 
 
 Driver Arguments (devargs)
@@ -156,3 +162,64 @@ PF/Common devargs
   Usage example::
 
     dpdk-testpmd -a 0000:00:00.0,nc=1 -- -i
+
+
+Rx Interrupt Mode (VF)
+----------------------
+
+The ENETC4 VF PMD supports per-queue MSI-X Rx interrupts on the cacheable
+(default) Rx path. This allows applications to block in ``epoll_wait``
+instead of busy-polling, reducing CPU utilization when traffic is absent.
+
+**MSI-X vector assignment**
+
+ENETC4 VF MSI-X vector 0 is reserved for the PSI-to-VSI mailbox interrupt
+(link status notifications). Rx queue ``i`` is mapped to vector ``i + 1``.
+The driver allocates all required eventfds before calling
+``rte_intr_enable()`` so that ``vfio-pci`` can wire each MSI-X vector to
+its eventfd when it programs the MSI-X table.
+
+**Kernel and driver requirements**
+
+- ``vfio-pci`` kernel module with no-IOMMU mode enabled (no SMMU required).
+- The non-cacheable memory mode (``nc=1`` devarg) does **not** support
+  Rx interrupts and returns ``-ENOTSUP`` from ``rx_queue_intr_enable``.
+
+**Host setup**
+
+.. code-block:: console
+
+   # Enable vfio-pci no-IOMMU mode (if SMMU is not available)
+   modprobe vfio enable_unsafe_noiommu_mode=1
+   modprobe vfio-pci
+
+   # Bind the VF to vfio-pci
+   echo vfio-pci > /sys/bus/pci/devices/<vf_pci_addr>/driver_override
+   echo <vf_pci_addr> > /sys/bus/pci/drivers_probe
+
+**Running l3fwd-power with a single queue and core**
+
+The ``l3fwd-power`` sample application demonstrates interrupt-driven Rx.
+It sets ``intr_conf.rxq = 1`` in ``rte_eth_conf``, which triggers the VF
+interrupt setup in the driver. The ``--vfio-intr=msix`` EAL flag instructs
+DPDK to use MSI-X eventfds for interrupt signalling.
+
+.. code-block:: console
+
+   ./dpdk-l3fwd-power -l 0-1 -n 1 --vfio-intr=msix \
+       -a <vf_pci_addr> -- \
+       -p 0x1 --config="(0,0,1)" --no-numa --interrupt-only
+
+Where:
+
+- ``-l 0-1`` assigns the main thread to core 0 and the forwarding lcore to
+  core 1.
+- ``-a <vf_pci_addr>`` specifies the VF PCI address (e.g. ``0000:01:00.1``).
+- ``--config="(0,0,1)"`` maps port 0, queue 0 to lcore 1.
+- ``--interrupt-only`` enables pure interrupt mode (no busy-poll fallback).
+
+With no incoming traffic the forwarding lcore sleeps in ``epoll_wait``;
+CPU utilization drops to near zero. On the first arriving packet the MSI-X
+interrupt fires, the lcore wakes, drains the ring, disables the interrupt,
+processes the burst, then re-enables and re-arms the interrupt before
+returning to sleep.
doc/guides/nics/features/enetc4.ini +1 -0
index 6540a43909..812c215b15 100644
@@ -5,6 +5,7 @@
 ;
 [Features]
 Link status event    = Y
+Queue interrupt      = Y
 Speed capabilities   = Y
 Link status          = Y
 LRO                  = Y
doc/guides/rel_notes/release_26_11.rst +1 -0
index b88e2825a6..9b39debc1d 100644
@@ -69,6 +69,7 @@ New Features
   * Added ring parameters support for the ENETC4 VF (rxq_info_get / txq_info_get).
   * Refreshed VF link speed on the link-up interrupt in the ENETC4 VF driver.
   * Added stats reset for the ENETC4 VF using a software snapshot/delta approach.
+  * Added per-queue MSI-X Rx interrupt support for the ENETC4 VF.
 
 Removed Items
 -------------
drivers/net/enetc/base/enetc4_hw.h +2 -0
index 8ad8f169d2..9543e982a2 100644
@@ -250,6 +250,8 @@ struct enetc_rx_bd_ext {
 #define ENETC4_VSIIDR            0xA08
 #define ENETC4_VSIIER_MRIE       BIT(9)
 #define ENETC4_SI_INT_IDX        0
+/* MSI-X vector base for per-Rx-queue interrupts; vector 0 is the mailbox. */
+#define ENETC4_VF_RX_VEC_BASE    1
 
 /* VSI Registers */
 #define ENETC4_VSIMSGSR  0x204   /* RO */
drivers/net/enetc/enetc.h +1 -0
index 3590cf6639..903829323e 100644
@@ -135,6 +135,7 @@ struct enetc_eth_hw {
 	uint32_t vsi_delay;   /* VSI-PSI message wait delay (us) */
 	uint32_t *txq_prior;  /* per-queue TX priority (TBMR priority bits) */
 	uint8_t nc_mode;      /* 1 = non-cacheable BD memory, use _nc ops */
+	uint8_t rxq_intr_en;  /* 1 = per-queue Rx MSI-X interrupts enabled */
 	/* 1 = legacy PF-to-VF link message layout (4-bit speed / 4-bit cookie),
 	 * for PF kernel versions before 6.18.37. Set via vf_link_legacy devarg.
 	 */
drivers/net/enetc/enetc4_ethdev.c +5 -4
index afee0b90a3..d987f1288c 100644
@@ -839,7 +839,8 @@ enetc4_dev_close(struct rte_eth_dev *dev)
 		return 0;
 
 	if (hw->device_id == ENETC4_DEV_ID_VF) {
-		if (dev->data->dev_conf.intr_conf.lsc != 0)
+		if (dev->data->dev_conf.intr_conf.lsc != 0 ||
+		    dev->data->dev_conf.intr_conf.rxq != 0)
 			enetc4_vf_dev_intr(dev, false);
 		ret = enetc4_vf_dev_stop(dev);
 	} else {
@@ -961,12 +962,12 @@ enetc4_dev_configure(struct rte_eth_dev *dev)
 	if (hw->device_id != ENETC4_DEV_ID_VF)
 		enetc4_port_wr(enetc_hw, ENETC4_PARCSCR, checksum);
 
-	/* Enable interrupts */
 	if (hw->device_id == ENETC4_DEV_ID_VF) {
-		if (dev->data->dev_conf.intr_conf.lsc != 0) {
+		if (dev->data->dev_conf.intr_conf.lsc != 0 ||
+		    dev->data->dev_conf.intr_conf.rxq != 0) {
 			ret = enetc4_vf_dev_intr(dev, true);
 			if (ret)
-				ENETC_PMD_WARN("Failed to setup link interrupts");
+				ENETC_PMD_WARN("Failed to setup VF interrupts: %d", ret);
 		}
 	}
 
drivers/net/enetc/enetc4_vf.c +88 -1

126 lines not on this page · raw message

#11 lore raw

PATCH 11/14 net/enetc4: add SI-based port VLAN insertion and removal

In reply to Gagandeep Singh

Implement hardware VLAN tag insertion on Tx and removal on Rx via the per-SI VLAN isolation (pvid) mechanism on ENETC4.

On a PF, the driver writes directly to PSIaVLANR(0) (VID + enable bit) and PSIaCFGR0(0) (SIVIE for Tx insertion, VTE for Rx removal, SIVC_CVLAN to allow C-VLAN 0x8100 TPID).

On a privileged VF, the request is forwarded to the kernel PF via the VSI-PSI mailbox using a new command class 0x24 (SI VLAN isolation, cmd ID 0x1). The kernel PF handler programs the same registers on behalf of the VF's station interface. The class 0x24 reply is added to the pass-through list in enetc4_msg_vsi_send() so it is handled correctly alongside the existing command classes.

New additions:
- ENETC4_PSIVLANR(a) and ENETC4_PSICFGR0(a) register macros with field definitions in enetc4_hw.h
- ENETC_CLASS_ID_SI_VLAN_ISO (0x24) and ENETC_CMD_ID_SET_SI_VLAN_ISO enum values, plus struct enetc_msg_si_vlan_iso message layout and bit definitions in enetc.h
- enetc4_vlan_pvid_set() for PF in enetc4_ethdev.c
- enetc4_vf_vlan_pvid_set() for VF in enetc4_vf.c, registered as .vlan_pvid_set in both enetc4_ops and enetc4_vf_ops

The feature is activated in testpmd with:
tx_vlan set pvid <port_id> <vlan_id> on|off

---
 doc/guides/nics/enetc4.rst             |  4 ++
 doc/guides/nics/features/enetc4.ini    |  1 +
 doc/guides/rel_notes/release_26_11.rst |  1 +
 drivers/net/enetc/base/enetc4_hw.h     | 14 +++++
 drivers/net/enetc/enetc.h              | 23 +++++++
 drivers/net/enetc/enetc4_ethdev.c      | 39 ++++++++++++
 drivers/net/enetc/enetc4_vf.c          | 85 ++++++++++++++++++++++++++
 7 files changed, 167 insertions(+)
doc/guides/nics/enetc4.rst +4 -0
index d8e323d614..bb0628ccf6 100644
@@ -65,6 +65,10 @@ Key functionality includes:
   See `Rx Interrupt Mode (VF)`_ for setup details.
 - Firmware version: The NETC IP version is reported via ``rte_eth_dev_fw_version_get``.
 - Registers dump: The station interface, port (PF only) and BD ring registers are dumped via ``rte_eth_dev_get_reg_info``.
+- SI-based port VLAN (pvid): Hardware VLAN tag insertion on Tx and removal on Rx, configured
+  via ``rte_eth_dev_set_vlan_pvid``. On a PF the registers are written directly; on a privileged
+  VF the request is forwarded to the kernel PF through the VSI-PSI mailbox (class 0x24).
+  Use the testpmd command ``tx_vlan set pvid <port_id> <vlan_id> on|off`` to enable or disable.
 
 
 Prerequisites
doc/guides/nics/features/enetc4.ini +1 -0
index 812c215b15..9dc8fd33f8 100644
@@ -14,6 +14,7 @@ Promiscuous mode     = Y
 Allmulticast mode    = Y
 Unicast MAC filter   = Y
 VLAN filter          = Y
+VLAN offload         = Y
 RSS hash             = Y
 Packet type parsing  = Y
 Basic stats          = Y
doc/guides/rel_notes/release_26_11.rst +1 -0
index 9b39debc1d..e6d96b2a50 100644
@@ -70,6 +70,7 @@ New Features
   * Refreshed VF link speed on the link-up interrupt in the ENETC4 VF driver.
   * Added stats reset for the ENETC4 VF using a software snapshot/delta approach.
   * Added per-queue MSI-X Rx interrupt support for the ENETC4 VF.
+  * Added SI-based port VLAN insertion (Tx) and removal (Rx) for ENETC4 PF and VF.
 
 Removed Items
 -------------
drivers/net/enetc/base/enetc4_hw.h +14 -0
index 9543e982a2..a9552f21f4 100644
@@ -277,6 +277,20 @@ struct enetc_rx_bd_ext {
 #define ENETC4_SICTR0		0x18
 #define ENETC4_SICTR1		0x1c
 
+/* PSI SI VLAN register: per-SI VLAN tag for insertion/removal */
+#define ENETC4_PSIVLANR(a)		((a) * 0x80 + 0x2008)
+#define ENETC4_PSIVLANR_E		BIT(31)  /* enable SI VLAN processing */
+#define ENETC4_PSIVLANR_VTEA		BIT(30)  /* 0=strip tag, 1=zero VID */
+#define ENETC4_PSIVLANR_PCP(v)		(((uint32_t)(v) & 0x7) << 13)
+#define ENETC4_PSIVLANR_DEI		BIT(12)
+#define ENETC4_PSIVLANR_VID(v)		((uint32_t)(v) & 0xfff)
+
+/* PSI SI configuration register 0 */
+#define ENETC4_PSICFGR0(a)		((a) * 0x80 + 0x2010)
+#define ENETC4_PSICFGR0_SIVC_CVLAN	BIT(24)  /* allow C-VLAN 0x8100 */
+#define ENETC4_PSICFGR0_SIVIE		BIT(14)  /* SI VLAN insertion enable */
+#define ENETC4_PSICFGR0_VTE		BIT(12)  /* SI VLAN removal enable */
+
 /* general register accessors */
 #define enetc4_rd_reg(reg)	rte_read32((void *)(reg))
 #define enetc4_wr_reg(reg, val)  rte_write32((val), (void *)(reg))
drivers/net/enetc/enetc.h +23 -0
index 903829323e..72e43572f7 100644
@@ -187,6 +187,8 @@ struct enetc_eth_adapter {
 enum enetc_msg_cmd_class_id {
 	ENETC_CLASS_ID_MAC_FILTER = 0x20,
 	ENETC_CLASS_ID_VLAN_FILTER = 0x21,
+	/* Configure SI VLAN isolation (insert / remove) */
+	ENETC_CLASS_ID_SI_VLAN_ISO = 0x24,
 	ENETC_CLASS_ID_LINK_STATUS = 0x80,
 	ENETC_CLASS_ID_LINK_SPEED = 0x81,
 	ENETC_CLASS_ID_GET_IP_VER = 0xF0
@@ -212,6 +214,11 @@ enum enetc_msg_cmd_id {
 	ENETC_CMD_ID_GET_IP_CFG = 4
 };
 
+/* Command IDs for class ID 0x24 (SI VLAN isolation) */
+enum enetc_msg_si_vlan_cmd_id {
+	ENETC_CMD_ID_SET_SI_VLAN_ISO = 1,
+};
+
 /* IP_VER value returned when the version is not available */
 #define ENETC_IP_VER_NOT_AVAILABLE	0xFF
 
@@ -323,6 +330,22 @@ struct enetc_msg_vlan_exact_filter {
 	uint8_t reserved2;
 };
 
+/* VSI-PSI SI VLAN isolation message (class 0x24, cmd 0x1) */
+struct enetc_msg_si_vlan_iso {
+	struct enetc_msg_cmd_header header;
+	uint8_t ctrl;          /* E[7], VTEA[6], TPID[1:0] */
+	uint8_t pcp_dei_vid_hi; /* PCP[7:5], DEI[4], VID[11:8] */
+	uint8_t vid_lo;        /* VID[7:0] */
+	uint8_t reserved_0;
+	uint8_t flags;         /* SVIE[2], VTE[1] */
+	uint8_t reserved_1[3];
+};
+
+#define ENETC_SI_VLAN_ISO_E	BIT(7)  /* ctrl: enable SI VLAN */
+#define ENETC_SI_VLAN_ISO_VTEA	BIT(6)  /* ctrl: 0=strip, 1=zero VID */
+#define ENETC_SI_VLAN_ISO_SVIE	BIT(2)  /* flags: Tx insertion enable */
+#define ENETC_SI_VLAN_ISO_VTE	BIT(1)  /* flags: Rx removal enable */
+
 struct enetc_psi_reply_msg {
 	uint8_t class_id;
 	uint8_t status;
drivers/net/enetc/enetc4_ethdev.c +39 -0
index d987f1288c..ae40cc69e0 100644
@@ -872,6 +872,44 @@ enetc4_dev_close(struct rte_eth_dev *dev)
 	return ret;
 }
 
+/* Configure SI-based VLAN insertion (Tx) and removal (Rx) for the PF. */
+static int
+enetc4_vlan_pvid_set(struct rte_eth_dev *dev, uint16_t vlan_id, int on)
+{
+	struct enetc_eth_hw *hw =
+		ENETC_DEV_PRIVATE_TO_HW(dev->data->dev_private);
+	struct enetc_hw *enetc_hw = &hw->hw;
+	uint32_t psivlanr, psicfgr0;
+
+	PMD_INIT_FUNC_TRACE();
+
+	psicfgr0 = enetc4_port_rd(enetc_hw, ENETC4_PSICFGR0(0));
+
+	if (on) {
+		/* Build the VLAN register: enable bit + VID (PCP/DEI left 0) */
+		psivlanr = (uint32_t)ENETC4_PSIVLANR_E |
+			   ENETC4_PSIVLANR_VID(vlan_id);
+		enetc4_port_wr(enetc_hw, ENETC4_PSIVLANR(0), psivlanr);
+
+		/* Allow C-VLAN TPID, enable Tx insertion and Rx removal */
+		psicfgr0 |= ENETC4_PSICFGR0_SIVC_CVLAN |
+			    ENETC4_PSICFGR0_SIVIE |
+			    ENETC4_PSICFGR0_VTE;
+		enetc4_port_wr(enetc_hw, ENETC4_PSICFGR0(0), psicfgr0);
+	} else {
+		/* Clear Tx insertion, Rx removal and C-VLAN allow bits */
+		psicfgr0 &= ~(ENETC4_PSICFGR0_SIVC_CVLAN |
+			      ENETC4_PSICFGR0_SIVIE |
+			      ENETC4_PSICFGR0_VTE);
+		enetc4_port_wr(enetc_hw, ENETC4_PSICFGR0(0), psicfgr0);
+
+		/* Clear the VLAN register (disable SI VLAN processing) */
+		enetc4_port_wr(enetc_hw, ENETC4_PSIVLANR(0), 0);
+	}
+
+	return 0;
+}
+
 static int
 enetc4_promiscuous_enable(struct rte_eth_dev *dev)
 {
@@ -1267,6 +1305,7 @@ static const struct eth_dev_ops enetc4_ops = {
 	.get_reg              = enetc4_get_regs,
 	.promiscuous_enable   = enetc4_promiscuous_enable,
 	.promiscuous_disable  = enetc4_promiscuous_disable,
+	.vlan_pvid_set        = enetc4_vlan_pvid_set,
 	.rx_queue_setup       = enetc4_rx_queue_setup,
 	.rx_queue_start       = enetc4_rx_queue_start,
 	.rx_queue_stop        = enetc4_rx_queue_stop,
drivers/net/enetc/enetc4_vf.c +85 -0

105 lines not on this page · raw message

#12 lore raw

PATCH 12/14 net/enetc4: update VF link status to bitmask encoding

In reply to Gagandeep Singh

The PF-to-VF link status notification code was previously a two-value enum (UP=0x0, DOWN=0x1). Change this to a bitmask so future bits can carry additional state alongside the link up/down indication:

ENETC_LINK_DOWN BIT(0) -- set when link is down

Link up is now encoded as the DOWN bit being clear, which keeps the wire value for link-down identical (0x1) and ensures backward compatibility with older kernel PFs.

Changes:
- enetc.h: replace enum link_status with a #define bitmask; drop ENETC_LINK_UP (no longer a named constant).
- enetc4_vf.c enetc4_process_psi_msg(): replace switch/case on ENETC_LINK_UP/DOWN with bitmask decode.
- enetc4_vf.c enetc4_vf_link_update(): same bitmask decode.

---
 doc/guides/rel_notes/release_26_11.rst |  1 +
 drivers/net/enetc/enetc.h              |  8 ++++----
 drivers/net/enetc/enetc4_vf.c          | 27 +++++++-------------------
 3 files changed, 12 insertions(+), 24 deletions(-)
doc/guides/rel_notes/release_26_11.rst +1 -0
index e6d96b2a50..5323f4fea3 100644
@@ -71,6 +71,7 @@ New Features
   * Added stats reset for the ENETC4 VF using a software snapshot/delta approach.
   * Added per-queue MSI-X Rx interrupt support for the ENETC4 VF.
   * Added SI-based port VLAN insertion (Tx) and removal (Rx) for ENETC4 PF and VF.
+  * Updated ENETC4 VF link status reporting to use bitmask encoding.
 
 Removed Items
 -------------
drivers/net/enetc/enetc.h +4 -4
index 72e43572f7..40bad56341 100644
@@ -236,10 +236,10 @@ enum vlan_status {
 	ENETC_VLAN_NO_RESOURCE = 0x3
 };
 
-enum link_status {
-	ENETC_LINK_UP = 0x0,
-	ENETC_LINK_DOWN = 0x1
-};
+/* Link status bitmask in PF-to-VF mailbox notification.
+ * Link up is encoded as the DOWN bit being clear.
+ */
+#define ENETC_LINK_DOWN  (1u << 0)
 
 enum speed {
 	ENETC_SPEED_UNKNOWN = 0x0,
drivers/net/enetc/enetc4_vf.c +7 -20
index 208543e2da..d38b31c10a 100644
@@ -480,8 +480,10 @@ enetc4_process_psi_msg(struct rte_eth_dev *eth_dev, struct enetc_hw *enetc_hw)
 	enetc4_msg_get_psi_msg(enetc_hw, msg);
 
 	if (msg->class_id == ENETC_CLASS_ID_LINK_STATUS) {
-		switch (msg->status) {
-		case ENETC_LINK_UP:
+		if (msg->status & ENETC_LINK_DOWN) {
+			ENETC_PMD_DEBUG("Link is down");
+			link.link_status = RTE_ETH_LINK_DOWN;
+		} else {
 			ENETC_PMD_DEBUG("Link is up");
 			link.link_status = RTE_ETH_LINK_UP;
 			/* Re-query speed from PF so the cached value reflects
@@ -498,14 +500,6 @@ enetc4_process_psi_msg(struct rte_eth_dev *eth_dev, struct enetc_hw *enetc_hw)
 			} else {
 				ENETC_PMD_WARN("Failed to alloc msg for speed query");
 			}
-			break;
-		case ENETC_LINK_DOWN:
-			ENETC_PMD_DEBUG("Link is down");
-			link.link_status = RTE_ETH_LINK_DOWN;
-			break;
-		default:
-			ENETC_PMD_ERR("Unknown link status 0x%x", msg->status);
-			break;
 		}
 		ret = rte_eth_linkstatus_set(eth_dev, &link);
 		if (!ret)
@@ -1180,17 +1174,10 @@ enetc4_vf_link_update(struct rte_eth_dev *dev, int wait_to_complete __rte_unused
 	}
 
 	if (reply_msg->class_id == ENETC_CLASS_ID_LINK_STATUS) {
-		switch (reply_msg->status) {
-		case ENETC_LINK_UP:
-			link.link_status = RTE_ETH_LINK_UP;
-			break;
-		case ENETC_LINK_DOWN:
+		if (reply_msg->status & ENETC_LINK_DOWN)
 			link.link_status = RTE_ETH_LINK_DOWN;
-			break;
-		default:
-			ENETC_PMD_ERR("Unknown link status");
-			break;
-		}
+		else
+			link.link_status = RTE_ETH_LINK_UP;
 	} else {
 		ENETC_PMD_ERR("Wrong reply message");
 		return -1;
#13 lore raw

PATCH 13/14 net/enetc4: enable TX PAUSE via VF RX congestion mode

In reply to Gagandeep Singh

When the PF negotiates TX PAUSE on the port it signals this to the VF via BIT(1) of the PF-to-VF link status mailbox message. The VF PMD must respond by setting RBMR_CM (BIT(4)) on all active RX rings so the MAC emits PAUSE frames on ingress pressure.

Add ENETC_RBMR_CM register definition, ENETC_LINK_TX_PAUSE bitmask, and tx_pause_active state flag. Add enetc4_vf_set_congestion_mode() to update all active RX rings and persist the state for rings started later. Hook it into both the interrupt and poll link-update paths, and apply the saved state in rx_queue_setup() and rx_queue_start().

RX PAUSE (honoring received PAUSE frames) is handled at the MAC level by the PF and requires no VF PMD changes.

---
 doc/guides/nics/features/enetc4.ini    |  1 +
 doc/guides/rel_notes/release_26_11.rst |  1 +
 drivers/net/enetc/base/enetc_hw.h      |  1 +
 drivers/net/enetc/enetc.h              |  9 +++-
 drivers/net/enetc/enetc4_ethdev.c      | 13 +++++-
 drivers/net/enetc/enetc4_vf.c          | 59 ++++++++++++++++++++++++--
 6 files changed, 78 insertions(+), 6 deletions(-)
doc/guides/nics/features/enetc4.ini +1 -0
index 9dc8fd33f8..d4e186559e 100644
@@ -14,6 +14,7 @@ Promiscuous mode     = Y
 Allmulticast mode    = Y
 Unicast MAC filter   = Y
 VLAN filter          = Y
+Flow control         = Y
 VLAN offload         = Y
 RSS hash             = Y
 Packet type parsing  = Y
doc/guides/rel_notes/release_26_11.rst +1 -0
index 5323f4fea3..d69888aafb 100644
@@ -72,6 +72,7 @@ New Features
   * Added per-queue MSI-X Rx interrupt support for the ENETC4 VF.
   * Added SI-based port VLAN insertion (Tx) and removal (Rx) for ENETC4 PF and VF.
   * Updated ENETC4 VF link status reporting to use bitmask encoding.
+  * Added TX PAUSE support for the ENETC4 VF via RX congestion mode.
 
 Removed Items
 -------------
drivers/net/enetc/base/enetc_hw.h +1 -0
index 6e96562850..33d075fe59 100644
@@ -51,6 +51,7 @@ enum enetc_bdr_type {TX, RX};
 							+ (off))
 /* RX BDR reg offsets */
 #define ENETC_RBMR		0x0 /* RX BDR mode register*/
+#define ENETC_RBMR_CM		BIT(4)  /* congestion mode: assert congestion to emit TX PAUSE */
 #define ENETC_RBMR_EN		BIT(31)
 
 #define ENETC_BMR_RESET		0x0 /* BDR reset*/
drivers/net/enetc/enetc.h +8 -1
index 40bad56341..8aaf8a7eb1 100644
@@ -140,6 +140,10 @@ struct enetc_eth_hw {
 	 * for PF kernel versions before 6.18.37. Set via vf_link_legacy devarg.
 	 */
 	uint8_t vf_link_legacy;
+	/* 1 = TX PAUSE negotiated on port; VF RX rings must have RBMR_CM set.
+	 * Updated from the PF-to-VF link status mailbox message (BIT(1)).
+	 */
+	uint8_t tx_pause_active;
 	/* Baseline snapshot for VF stats reset (software delta approach). */
 	struct enetc4_vf_stats_saved vf_stats_saved;
 };
@@ -238,8 +242,11 @@ enum vlan_status {
 
 /* Link status bitmask in PF-to-VF mailbox notification.
  * Link up is encoded as the DOWN bit being clear.
+ * TX_PAUSE is set when the port has negotiated TX PAUSE; VF must enable
+ * congestion mode (ENETC_RBMR_CM) on its RX rings accordingly.
  */
-#define ENETC_LINK_DOWN  (1u << 0)
+#define ENETC_LINK_DOWN      (1u << 0)
+#define ENETC_LINK_TX_PAUSE  (1u << 1)
 
 enum speed {
 	ENETC_SPEED_UNKNOWN = 0x0,
drivers/net/enetc/enetc4_ethdev.c +11 -2
index ae40cc69e0..2355522515 100644
@@ -712,8 +712,12 @@ enetc4_rx_queue_setup(struct rte_eth_dev *dev,
 	}
 
 	if (!rx_conf->rx_deferred_start) {
-		/* enable ring */
+		/* Enable ring; apply congestion mode if TX PAUSE is already active. */
 		rx_enable |= ENETC_RBMR_EN;
+		if (adapter->hw.tx_pause_active)
+			rx_enable |= ENETC_RBMR_CM;
+		else
+			rx_enable &= ~(uint32_t)ENETC_RBMR_CM;
 		enetc4_rxbdr_wr(&adapter->hw.hw, rx_ring->index, ENETC_RBMR,
 			       rx_enable);
 		dev->data->rx_queue_state[rx_ring->index] =
@@ -1089,7 +1093,12 @@ enetc4_rx_queue_start(struct rte_eth_dev *dev, uint16_t qidx)
 	if (dev->data->rx_queue_state[qidx] == RTE_ETH_QUEUE_STATE_STOPPED) {
 		rx_data = enetc4_rxbdr_rd(&priv->hw.hw, rx_ring->index,
 					 ENETC_RBMR);
-		rx_data = rx_data | ENETC_RBMR_EN;
+		rx_data |= ENETC_RBMR_EN;
+		/* Restore congestion mode if TX PAUSE is active. */
+		if (priv->hw.tx_pause_active)
+			rx_data |= ENETC_RBMR_CM;
+		else
+			rx_data &= ~(uint32_t)ENETC_RBMR_CM;
 		enetc4_rxbdr_wr(&priv->hw.hw, rx_ring->index, ENETC_RBMR,
 			       rx_data);
 		dev->data->rx_queue_state[qidx] = RTE_ETH_QUEUE_STATE_STARTED;
drivers/net/enetc/enetc4_vf.c +56 -3

87 lines not on this page · raw message

#14 lore raw

PATCH 14/14 net/enetc4: add WRR Tx scheduler devarg for VF rings

In reply to Gagandeep Singh

Add enetc4_txq_wrr devarg to configure per-ring WRR weights in the NETC LEAF-level Tx scheduler (TBaMR register, bits [6:4]).

The NETC Tx scheduler has three levels:
- ROOT (port/TC): strict priority + CBS (PF/port space)
- MID (SI/VSI): WBFS shaping (PF space)
- LEAF (Tx BDR): strict priority + frame-based WRR (VF/SI space)

TBaMR is in the VF own SI space, so no Linux PF involvement is needed for PRIO or WRR configuration.

Changes:
- enetc_hw.h: add ENETC_TBMR_WRR_MASK, ENETC_TBMR_WRR(n) macros for TBaMR bits [6:4], and ENETC_TBMR_PRIO_MASK for bits [2:0]
- enetc.h: add txq_wrr pointer to enetc_eth_hw struct
- enetc4_ethdev.c: add parse_txq_wrr() and wire ENETC4_TXQ_WRR devarg through enetc4_get_devargs() and enetc4_dev_configure(); apply WRR bits in enetc4_tx_queue_setup() and enetc4_tx_queue_start()

Usage:

  # strict priority: ring 0 highest
  -a 0002:00:12.0,enetc4_txq_prior="3|2|1"

# WRR 2:4:1 on same-priority rings
-a 0002:00:12.0,enetc4_txq_prior="1|1|1",enetc4_txq_wrr="2|4|1"

---
 doc/guides/rel_notes/release_26_11.rst |  1 +
 drivers/net/enetc/base/enetc_hw.h      |  5 ++
 drivers/net/enetc/enetc.h              |  1 +
 drivers/net/enetc/enetc4_ethdev.c      | 87 +++++++++++++++++++++++---
 4 files changed, 86 insertions(+), 8 deletions(-)
doc/guides/rel_notes/release_26_11.rst +1 -0
index d69888aafb..3ea34523fe 100644
@@ -73,6 +73,7 @@ New Features
   * Added SI-based port VLAN insertion (Tx) and removal (Rx) for ENETC4 PF and VF.
   * Updated ENETC4 VF link status reporting to use bitmask encoding.
   * Added TX PAUSE support for the ENETC4 VF via RX congestion mode.
+  * Added WRR Tx scheduler devarg (``enetc4_txq_wrr``) for ENETC4 VF ring weights.
 
 Removed Items
 -------------
drivers/net/enetc/base/enetc_hw.h +5 -0
index 33d075fe59..5a71f01db9 100644
@@ -86,6 +86,11 @@ enum enetc_bdr_type {TX, RX};
 
 #define ENETC_RTBLENR_LEN(n)		((n) & ~0x7)
 #define ENETC_TBMR_EN			BIT(31)
+/* TBaMR[WRR] bits [6:4]: weight for same-priority ring arbitration (0=1x .. 7=8x). */
+#define ENETC_TBMR_WRR_MASK		GENMASK(6, 4)
+#define ENETC_TBMR_WRR(n)		((((n) - 1) & 0x7) << 4)
+/* TBaMR[PRIO] bits [2:0]: strict priority (0=lowest, 7=highest). */
+#define ENETC_TBMR_PRIO_MASK		GENMASK(2, 0)
 
 /* Port regs, offset: 1_0000h */
 #define ENETC_PORT_BASE			0x10000
drivers/net/enetc/enetc.h +1 -0
index 8aaf8a7eb1..e0943d093a 100644
@@ -134,6 +134,7 @@ struct enetc_eth_hw {
 	uint32_t vsi_timeout; /* VSI-PSI message wait timeout (iterations) */
 	uint32_t vsi_delay;   /* VSI-PSI message wait delay (us) */
 	uint32_t *txq_prior;  /* per-queue TX priority (TBMR priority bits) */
+	uint32_t *txq_wrr;    /* per-queue TX WRR weight pre-shifted for TBMR[WRR] */
 	uint8_t nc_mode;      /* 1 = non-cacheable BD memory, use _nc ops */
 	uint8_t rxq_intr_en;  /* 1 = per-queue Rx MSI-X interrupts enabled */
 	/* 1 = legacy PF-to-VF link message layout (4-bit speed / 4-bit cookie),
drivers/net/enetc/enetc4_ethdev.c +79 -8

146 lines not on this page · raw message

#15 lore raw
In reply to Gagandeep Singh
Quoted 41 lines · On Thu, 6 Aug 2026 16:58:22 +0530 Gagandeep Singh <[email protected]> wrote:

This series adds new PMD features to the ENETC4 driver targeting the NXP i.MX95 NETC IP.

The series covers:

- KEEP_CRC Rx offload: preserve the Ethernet FCS in the receive buffer.
- TSO: TCP Segmentation Offload for the VF Tx path.
- RSC/LRO: hardware Receive Segment Coalesce for PF and VF Rx paths.
- Link speed code: extend the PF-to-VF mailbox field from 4-bit to 8-bit to support speeds beyond 10G.
- Firmware version: report the NETC IP version via fw_version_get.
- Register dump: dump SI, port (PF) and BD ring registers.
- Ring parameters: implement rxq_info_get / txq_info_get for the VF.
- Link-up interrupt: refresh the cached link speed on each VF link-up interrupt so that link_update returns the current speed immediately.
- Stats reset: software snapshot/delta approach for VF counter reset.
- Per-queue Rx interrupt: MSI-X per-queue Rx interrupts for the VF, enabling interrupt-driven receive with l3fwd-power.
- SI VLAN: hardware port VLAN insertion/removal for PF and VF.
- VF link status bitmask: switch VF link status to bitmask encoding to align with the PF and newer kernel driver conventions.
- TX PAUSE: VF sets Rx congestion mode when the PF signals TX PAUSE negotiated on the wire; adds Flow control = Y to enetc4.ini.
- WRR Tx scheduler: per-ring WRR weights via enetc4_txq_wrr devarg.

Gagandeep Singh (14):
net/enetc: add KEEP_CRC offload support for ENETC4 net/enetc: add TSO support for ENETC4 VF
net/enetc: add RSC (hardware LRO) support for ENETC4 net/enetc: extend link speed code field to 8-bit for PF-to-VF message net/enetc: support firmware version get for VF
net/enetc: support registers dump
net/enetc: support ethtool ring parameters
net/enetc: refresh link speed on VF link-up interrupt net/enetc: support stats reset for VF
net/enetc4: add per-queue Rx interrupt support for VF net/enetc4: add SI-based port VLAN insertion and removal net/enetc4: update VF link status to bitmask encoding net/enetc4: enable TX PAUSE via VF RX congestion mode net/enetc4: add WRR Tx scheduler devarg for VF rings

Quoted 10 lines
 doc/guides/nics/enetc4.rst             |  81 ++-
 doc/guides/nics/features/enetc4.ini    |   8 +
 doc/guides/rel_notes/release_26_11.rst |  19 +
 drivers/net/enetc/base/enetc4_hw.h     | 129 +++-
 drivers/net/enetc/base/enetc_hw.h      |   6 +
 drivers/net/enetc/enetc.h              | 135 ++++-
 drivers/net/enetc/enetc4_ethdev.c      | 394 ++++++++++++-
 drivers/net/enetc/enetc4_vf.c          | 780 ++++++++++++++++++++++---
 drivers/net/enetc/enetc_rxtx.c         | 531 ++++++++++++++++-
 9 files changed, 1950 insertions(+), 133 deletions(-)

Lots of build errors, please send your patches based off main branch and do local build tests (ideally with gcc, clang) before sending.

#16 lore raw

v2 cover net/enetc: add new features for ENETC4 VF on i.MX9

In reply to Gagandeep Singh

V2-changes:
- compilation fixes.

V1-changes:
This series adds new PMD features to the ENETC4 driver targeting the NXP i.MX95 NETC IP.

The series covers:

- KEEP_CRC Rx offload: preserve the Ethernet FCS in the receive buffer.
- TSO: TCP Segmentation Offload for the VF Tx path.
- RSC/LRO: hardware Receive Segment Coalesce for PF and VF Rx paths.
- Link speed code: extend the PF-to-VF mailbox field from 4-bit to 8-bit to support speeds beyond 10G.
- Firmware version: report the NETC IP version via fw_version_get.
- Register dump: dump SI, port (PF) and BD ring registers.
- Ring parameters: implement rxq_info_get / txq_info_get for the VF.
- Link-up interrupt: refresh the cached link speed on each VF link-up interrupt so that link_update returns the current speed immediately.
- Stats reset: software snapshot/delta approach for VF counter reset.
- Per-queue Rx interrupt: MSI-X per-queue Rx interrupts for the VF, enabling interrupt-driven receive with l3fwd-power.
- SI VLAN: hardware port VLAN insertion/removal for PF and VF.
- VF link status bitmask: switch VF link status to bitmask encoding to align with the PF and newer kernel driver conventions.
- TX PAUSE: VF sets Rx congestion mode when the PF signals TX PAUSE negotiated on the wire; adds Flow control = Y to enetc4.ini.
- WRR Tx scheduler: per-ring WRR weights via enetc4_txq_wrr devarg.

Gagandeep Singh (14):
net/enetc: add KEEP_CRC offload support for ENETC4 net/enetc: add TSO support for ENETC4 VF
net/enetc: add RSC (hardware LRO) support for ENETC4 net/enetc: extend link speed code field to 8-bit for PF-to-VF message net/enetc: support firmware version get for VF
net/enetc: support registers dump
net/enetc: support ethtool ring parameters
net/enetc: refresh link speed on VF link-up interrupt net/enetc: support stats reset for VF
net/enetc4: add per-queue Rx interrupt support for VF net/enetc4: add SI-based port VLAN insertion and removal net/enetc4: update VF link status to bitmask encoding net/enetc4: enable TX PAUSE via VF RX congestion mode net/enetc4: add WRR Tx scheduler devarg for VF rings

 doc/guides/nics/enetc4.rst             |  81 ++-
 doc/guides/nics/features/enetc4.ini    |   8 +
 doc/guides/rel_notes/release_26_11.rst |  19 +
 drivers/net/enetc/base/enetc4_hw.h     | 129 +++-
 drivers/net/enetc/base/enetc_hw.h      |   6 +
 drivers/net/enetc/enetc.h              | 135 ++++-
 drivers/net/enetc/enetc4_ethdev.c      | 402 +++++++++++--
 drivers/net/enetc/enetc4_vf.c          | 779 ++++++++++++++++++++++---
 drivers/net/enetc/enetc_rxtx.c         | 529 ++++++++++++++++-
 9 files changed, 1942 insertions(+), 146 deletions(-)
Signature · 1 line
2.25.1
#17 lore raw

PATCH v2 1/14 net/enetc: add KEEP_CRC offload support for ENETC4

The legacy ENETC (LS1028A) driver already supports the RTE_ETH_RX_OFFLOAD_KEEP_CRC offload, but ENETC4 (i.MX95 NETC) did not.

Add KEEP_CRC support for ENETC4 (both PF and VF):

- Advertise RTE_ETH_RX_OFFLOAD_KEEP_CRC in the supported Rx offloads for the ENETC4 PF and VF. The VF reuses the PF Rx queue setup, so the HW configuration and datapath handling apply to both.
- Configure the per-ring RBaMR[CRC] bit in the Rx queue setup so that HW preserves the Ethernet FCS in the receive buffer when the offload is requested (0 = FCS removed, 1 = FCS preserved).
- Follow the DPDK convention used by the legacy ENETC and ixgbe drivers:
set crc_len to RTE_ETHER_CRC_LEN when KEEP_CRC is enabled and have the datapath subtract crc_len from pkt_len/data_len. ENETC and ENETC4 share the same datapath (enetc_rxtx.c), so the semantics stay consistent.
- Handle the scatter-gather boundary case where the 4-byte FCS straddles the last two segments: drop the trailing segment, decrement nb_segs and trim the carry-over from its predecessor.

Update the enetc4 feature matrix to list CRC offload.

---
 doc/guides/nics/features/enetc4.ini    |  1 +
 doc/guides/rel_notes/release_26_11.rst |  6 ++++
 drivers/net/enetc/base/enetc4_hw.h     |  4 +++
 drivers/net/enetc/enetc4_ethdev.c      | 31 ++++++++++++++++++--
 drivers/net/enetc/enetc4_vf.c          |  1 +
 drivers/net/enetc/enetc_rxtx.c         | 39 +++++++++++++++++++++++---
 6 files changed, 75 insertions(+), 7 deletions(-)
doc/guides/nics/features/enetc4.ini +1 -0
index 698140e30b..91b18d979e 100644
@@ -16,6 +16,7 @@ Packet type parsing  = Y
 Basic stats          = Y
 L3 checksum offload  = Y
 L4 checksum offload  = Y
+CRC offload          = Y
 Queue start/stop     = Y
 Scattered Rx         = Y
 Linux                = Y
doc/guides/rel_notes/release_26_11.rst +6 -0
index c8cc86295d..3678dd6894 100644
@@ -56,6 +56,12 @@ New Features
      =======================================================
 
 
+* **Updated NXP ENETC4 PMD.**
+
+  Updated the NXP ENETC4 poll mode driver for i.MX95:
+
+  * Added KEEP_CRC Rx offload support for the ENETC4 PMD to preserve the Ethernet FCS.
+
 Removed Items
 -------------
 
drivers/net/enetc/base/enetc4_hw.h +4 -0
index 9685e7e1e5..0105549857 100644
@@ -68,6 +68,10 @@ struct enetc_msg_swbd {
 #define PM_CMD_CFG_TX_EN		BIT(0)
 #define PM_CMD_CFG_RX_EN		BIT(1)
 
+/* RBaMR[CRC]: 0 = FCS removed, 1 = FCS preserved (KEEP_CRC) */
+#define ENETC4_RBMR_CRC			BIT(8)
+
+
 /* i.MX95 supports jumbo frame, but it is recommended to set the max frame
  * size to 2000 bytes.
  */
drivers/net/enetc/enetc4_ethdev.c +28 -3
index 2ddd63dafb..1a8056580c 100644
@@ -11,6 +11,19 @@
 #include "enetc_logs.h"
 #include "enetc.h"
 
+/* Supported Rx offloads */
+static uint64_t dev_rx_offloads_sup =
+	RTE_ETH_RX_OFFLOAD_IPV4_CKSUM |
+	RTE_ETH_RX_OFFLOAD_UDP_CKSUM |
+	RTE_ETH_RX_OFFLOAD_TCP_CKSUM |
+	RTE_ETH_RX_OFFLOAD_KEEP_CRC;
+
+/* Supported Tx offloads */
+static uint64_t dev_tx_offloads_sup =
+	RTE_ETH_TX_OFFLOAD_IPV4_CKSUM |
+	RTE_ETH_TX_OFFLOAD_UDP_CKSUM |
+	RTE_ETH_TX_OFFLOAD_TCP_CKSUM;
+
 #define ENETC4_TXQ_PRIORITIES	"enetc4_txq_prior"
 #define ENETC4_NC_MEMORY	"nc"
 
@@ -536,6 +549,8 @@ enetc4_rx_queue_setup(struct rte_eth_dev *dev,
 	struct enetc_eth_adapter *adapter =
 			ENETC_DEV_PRIVATE(data->dev_private);
 	uint64_t rx_offloads = data->dev_conf.rxmode.offloads;
+	uint32_t rx_enable;
+	bool keep_crc;
 
 	PMD_INIT_FUNC_TRACE();
 	if (nb_rx_desc > MAX_BD_COUNT)
@@ -549,6 +564,9 @@ enetc4_rx_queue_setup(struct rte_eth_dev *dev,
 	}
 
 	rx_ring->index = rx_queue_id;
+	keep_crc = !!(rx_offloads & RTE_ETH_RX_OFFLOAD_KEEP_CRC);
+	rx_ring->crc_len = (uint8_t)(keep_crc ? RTE_ETHER_CRC_LEN : 0);
+
 	err = enetc4_alloc_rxbdr(rx_ring, nb_rx_desc);
 	if (err)
 		goto fail;
@@ -562,19 +580,25 @@ enetc4_rx_queue_setup(struct rte_eth_dev *dev,
 	data->rx_queues[rx_queue_id] = rx_ring;
 	rx_ring->rx_deferred_start = rx_conf->rx_deferred_start;
 
+	if (keep_crc)
+		rx_enable |= ENETC4_RBMR_CRC;
+	else
+		rx_enable &= ~ENETC4_RBMR_CRC;
+
 	if (!rx_conf->rx_deferred_start) {
 		/* enable ring */
+		rx_enable |= ENETC_RBMR_EN;
 		enetc4_rxbdr_wr(&adapter->hw.hw, rx_ring->index, ENETC_RBMR,
-			       ENETC_RBMR_EN);
+			       rx_enable);
 		dev->data->rx_queue_state[rx_ring->index] =
 			       RTE_ETH_QUEUE_STATE_STARTED;
 	} else {
+		enetc4_rxbdr_wr(&adapter->hw.hw, rx_ring->index, ENETC_RBMR,
+			       rx_enable);
 		dev->data->rx_queue_state[rx_ring->index] =
 			       RTE_ETH_QUEUE_STATE_STOPPED;
 	}
 
-	rx_ring->crc_len = (uint8_t)((rx_offloads & RTE_ETH_RX_OFFLOAD_KEEP_CRC) ?
-				     RTE_ETHER_CRC_LEN : 0);
 	return 0;
 fail:
 	rte_free(rx_ring);
@@ -582,6 +606,7 @@ enetc4_rx_queue_setup(struct rte_eth_dev *dev,
 	return err;
 }
 
+
 void
 enetc4_rx_queue_release(struct rte_eth_dev *dev, uint16_t qid)
 {
drivers/net/enetc/enetc4_vf.c +1 -0
index ef5f1e6d66..83a1e4931f 100644
@@ -52,6 +52,7 @@ static uint64_t dev_rx_offloads_sup =
 	RTE_ETH_RX_OFFLOAD_UDP_CKSUM |
 	RTE_ETH_RX_OFFLOAD_TCP_CKSUM |
 	RTE_ETH_RX_OFFLOAD_VLAN_FILTER |
+	RTE_ETH_RX_OFFLOAD_KEEP_CRC |
 	RTE_ETH_RX_OFFLOAD_SCATTER;
 
 /* Supported Tx offloads */
drivers/net/enetc/enetc_rxtx.c +35 -4
index 8678bafece..e3bef607dd 100644
@@ -530,6 +530,28 @@ enetc_clean_rx_ring(struct enetc_bdr *rx_ring,
 	return rx_frm_cnt;
 }
 
+/*
+ * Trim the Ethernet FCS from a received cluster when HW CRC strip is
+ * disabled. pkt_len is reduced by crc_len. If the FCS straddles the last
+ * two segments (last seg holds fewer bytes than crc_len), drop the trailing
+ * segment and trim the carry-over from its predecessor. prev_seg is the
+ * segment preceding last_seg in the chain (the caller already tracks it).
+ */
+static inline void
+enetc_rx_crc_trim(struct rte_mbuf *first_seg, struct rte_mbuf *prev_seg,
+		  struct rte_mbuf *last_seg, uint16_t crc_len)
+{
+	first_seg->pkt_len -= crc_len;
+	if (likely(last_seg->data_len > crc_len)) {
+		last_seg->data_len -= crc_len;
+	} else if (prev_seg != NULL) {
+		first_seg->nb_segs--;
+		prev_seg->data_len -= crc_len - last_seg->data_len;
+		prev_seg->next = NULL;
+		rte_pktmbuf_free_seg(last_seg);
+	}
+}
+
 static int
 enetc_clean_rx_ring_nc(struct enetc_bdr *rx_ring,
 		    struct rte_mbuf **rx_pkts,
@@ -539,7 +561,7 @@ enetc_clean_rx_ring_nc(struct enetc_bdr *rx_ring,
 	int cleaned_cnt, i;
 	struct enetc_swbd *rx_swbd;
 	union enetc_rx_bd *rxbd, rxbd_temp;
-	struct rte_mbuf *first_seg, *cur_seg;
+	struct rte_mbuf *first_seg = NULL, *cur_seg = NULL;
 	uint32_t bd_status;
 	uint8_t *data;
 	uint32_t j;
@@ -572,6 +594,7 @@ enetc_clean_rx_ring_nc(struct enetc_bdr *rx_ring,
 		if (!first_seg) {
 			first_seg = seg;
 			cur_seg = seg;
+			prev_seg = NULL;
 			first_seg->pkt_len = data_len;
 			enetc_dev_rx_parse(first_seg, rxbd_temp.r.parse_summary);
 			first_seg->hash.rss = rxbd_temp.r.rss_hash;
@@ -579,6 +602,7 @@ enetc_clean_rx_ring_nc(struct enetc_bdr *rx_ring,
 			first_seg->pkt_len += data_len;
 			first_seg->nb_segs++;
 			cur_seg->next = seg;
+			prev_seg = cur_seg;
 			cur_seg = seg;
 		}
 
@@ -590,7 +614,9 @@ enetc_clean_rx_ring_nc(struct enetc_bdr *rx_ring,
 
 		if (bd_status & ENETC_RXBD_LSTATUS_F) {
 			seg->next = NULL;
-			first_seg->pkt_len -= rx_ring->crc_len;
+			if (rx_ring->crc_len)
+				enetc_rx_crc_trim(first_seg, prev_seg, seg,
+						  rx_ring->crc_len);
 			rx_pkts[rx_frm_cnt] = first_seg;
 			rx_frm_cnt++;
 			first_seg = NULL;
@@ -760,7 +786,7 @@ enetc_clean_rx_ring_cacheable(struct enetc_bdr *rx_ring,
 	int cleaned_cnt, i;
 	struct enetc_swbd *rx_swbd;
 	union enetc_rx_bd *rxbd;
-	struct rte_mbuf *first_seg, *cur_seg;
+	struct rte_mbuf *first_seg = NULL, *cur_seg = NULL;
 	uint32_t bd_status;
 	uint8_t *data;
 	uint32_t j;
@@ -815,6 +841,7 @@ enetc_clean_rx_ring_cacheable(struct enetc_bdr *rx_ring,
 		if (!first_seg) {
 			first_seg = seg;
 			cur_seg = seg;
+			prev_seg = NULL;
 			first_seg->pkt_len = data_len;
 			enetc_dev_rx_parse(first_seg,
 					   rxbd->r.parse_summary);
@@ -823,6 +850,7 @@ enetc_clean_rx_ring_cacheable(struct enetc_bdr *rx_ring,
 			first_seg->pkt_len += data_len;
 			first_seg->nb_segs++;
 			cur_seg->next = seg;
+			prev_seg = cur_seg;
 			cur_seg = seg;
 		}
 
@@ -838,7 +866,10 @@ enetc_clean_rx_ring_cacheable(struct enetc_bdr *rx_ring,
 
 		if (bd_status & ENETC_RXBD_LSTATUS_F) {
 			seg->next = NULL;
-			first_seg->pkt_len -= rx_ring->crc_len;
+			if (rx_ring->crc_len)
+				enetc_rx_crc_trim(first_seg, prev_seg, seg,
+						  rx_ring->crc_len);
+
 			rx_pkts[rx_frm_cnt] = first_seg;
 			rx_frm_cnt++;
 			first_seg = NULL;
Signature · 1 line
2.25.1
#18 lore raw

PATCH v2 2/14 net/enetc: add TSO support for ENETC4 VF

In reply to Gagandeep Singh

Add TCP and UDP segmentation offload (TSO) for the ENETC4 virtual function. The offload is advertised through the VF Tx capabilities and is enabled on a per-queue basis when an application requests the TSO offload flags during Tx queue setup.

A dedicated Tx burst, enetc_xmit_pkts_lso(), builds the large-send descriptor chain: a standard header BD, a 16B extension BD carrying the segment size and frame length extension, and one BD per payload buffer with the final-frame flag on the last BD. To make room for the extra extension BD, an LSO-enabled Tx ring is allocated with twice the number of descriptors. The existing non-TSO Tx paths are left unchanged.

Update the ENETC4 feature list and documentation accordingly.

---
 doc/guides/nics/enetc4.rst             |   2 +
 doc/guides/nics/features/enetc4.ini    |   1 +
 doc/guides/rel_notes/release_26_11.rst |   1 +
 drivers/net/enetc/base/enetc4_hw.h     |  35 +++-
 drivers/net/enetc/enetc.h              |   5 +
 drivers/net/enetc/enetc4_ethdev.c      |  45 ++++-
 drivers/net/enetc/enetc4_vf.c          |   2 +
 drivers/net/enetc/enetc_rxtx.c         | 255 +++++++++++++++++++++++++
 8 files changed, 341 insertions(+), 5 deletions(-)
doc/guides/nics/enetc4.rst +2 -0
index f0dd039f6e..4d27e4048e 100644
@@ -53,6 +53,8 @@ Key functionality includes:
 - Receive processing: Upon packet reception, the BD Ring status bit is set,
   facilitating packet processing.
 - Transmission: Packet transmission precedes reception, ensuring efficient data transfer.
+- TCP and UDP segmentation offload (TSO) on VFs, enabled per Tx queue
+  when the TSO offload flag is requested.
 
 
 Prerequisites
doc/guides/nics/features/enetc4.ini +1 -0
index 91b18d979e..8ec1e8d00f 100644
@@ -7,6 +7,7 @@
 Link status event    = Y
 Speed capabilities   = Y
 Link status          = Y
+TSO                  = Y
 Promiscuous mode     = Y
 Allmulticast mode    = Y
 Unicast MAC filter   = Y
doc/guides/rel_notes/release_26_11.rst +1 -0
index 3678dd6894..6a348ab4e0 100644
@@ -61,6 +61,7 @@ New Features
   Updated the NXP ENETC4 poll mode driver for i.MX95:
 
   * Added KEEP_CRC Rx offload support for the ENETC4 PMD to preserve the Ethernet FCS.
+  * Added TCP Segmentation Offload (TSO) support for the ENETC4 VF.
 
 Removed Items
 -------------
drivers/net/enetc/base/enetc4_hw.h +34 -1
index 0105549857..64c1a5e750 100644
@@ -1,5 +1,5 @@
 /* SPDX-License-Identifier: BSD-3-Clause
- * Copyright 2024 NXP
+ * Copyright 2024-2026 NXP
  *
  * This header file defines the register offsets and bit fields
  * of ENETC4 PF and VFs.
@@ -24,8 +24,14 @@ struct enetc_msg_swbd {
 
 /* enetc4 txbd flags */
 #define ENETC4_TXBD_FLAGS_L4CS		BIT(0)
+/* Request LSO (Large Send Offload) segmentation for this frame */
+#define ENETC4_TXBD_FLAGS_LSO		BIT(1)
+/* L4 checksum insertion (also used for checksum update on LSO) */
 #define ENETC4_TXBD_FLAGS_L_TX_CKSUM	BIT(3)
+/* Extended descriptor: the next 16B ring entry is an extension BD */
+#define ENETC4_TXBD_FLAGS_EXT		BIT(6)
 #define ENETC4_TXBD_FLAGS_F		BIT(7)
+
 /* L4 type */
 #define ENETC4_TXBD_L4T_UDP		BIT(0)
 #define ENETC4_TXBD_L4T_TCP		BIT(1)
@@ -34,6 +40,33 @@ struct enetc_msg_swbd {
 /* IPv4 checksum */
 #define ENETC4_TXBD_IPCS		1
 
+/*
+ * Extension Transmit Buffer Descriptor (16B). When the standard BD has the
+ * extended flag set, this occupies the next ring entry and carries the extra
+ * fields required by LSO.
+ */
+struct enetc_tx_bd_ext {
+	uint32_t timestamp;	/* PTP timestamp, unused for LSO */
+	uint32_t vlan;		/* VLAN insert, unused for LSO */
+	uint32_t lso;		/* LSO_MAX_SEG_SIZE and FRM_LEN_EXT */
+	uint32_t flags;		/* extension flags */
+};
+
+/* LSO_MAX_SEG_SIZE occupies bits 13-0 of the LSO word */
+#define ENETC4_TXBD_EXT_LSO_SEG_MASK	0x3fff
+#define ENETC4_TXBD_EXT_LSO_SEG(mss) \
+		((uint32_t)((mss) & ENETC4_TXBD_EXT_LSO_SEG_MASK))
+/* FRM_LEN_EXT occupies bits 19-16 of the LSO word (top 4 bits of data len) */
+#define ENETC4_TXBD_EXT_FRM_LEN_EXT(x) \
+		(((uint32_t)((x) & 0xf)) << 16)
+/* Final flag in the extension flags word (bit 127 -> local bit 31) */
+#define ENETC4_TXBD_EXT_FLAGS_F		BIT(31)
+
+/* NETC does not create LSO frames larger than this many bytes */
+#define ENETC4_LSO_MAX_FRAME		9600
+/* Maximum LSO data unit (payload to be segmented) supported by HW: 256KB */
+#define ENETC4_LSO_MAX_DATA_UNIT	(256 * 1024)
+
 /***************************ENETC port registers**************************/
 #define ENETC4_PMR		0x10
 #define ENETC4_PMR_EN		(BIT(16) | BIT(17) | BIT(18))
drivers/net/enetc/enetc.h +5 -0
index d3a8b8e34a..db349e051b 100644
@@ -91,6 +91,7 @@ struct enetc_bdr {
 		void *tcisr; /* Tx */
 		int next_to_alloc; /* Rx */
 	};
+
 	struct rte_mempool *mb_pool;   /* mbuf pool to populate RX ring. */
 	/* Partial scatter-gather chain persisted across burst calls. */
 	struct rte_mbuf *pkt_first_seg; /* first segment of in-progress frame */
@@ -99,6 +100,7 @@ struct enetc_bdr {
 	uint64_t ierrors;
 	uint8_t rx_deferred_start;
 	uint8_t tx_deferred_start;
+	uint8_t lso_enable;
 };
 
 struct enetc_eth_hw {
@@ -312,6 +314,9 @@ uint16_t enetc_xmit_pkts(void *txq, struct rte_mbuf **tx_pkts,
 		uint16_t nb_pkts);
 uint16_t enetc_xmit_pkts_nc(void *txq, struct rte_mbuf **tx_pkts,
 		uint16_t nb_pkts);
+uint16_t enetc_xmit_pkts_lso(void *txq, struct rte_mbuf **tx_pkts,
+		uint16_t nb_pkts);
+
 uint16_t enetc_recv_pkts(void *rxq, struct rte_mbuf **rx_pkts,
 		uint16_t nb_pkts);
 uint16_t enetc_recv_pkts_nc(void *rxq, struct rte_mbuf **rx_pkts,
drivers/net/enetc/enetc4_ethdev.c +41 -4

94 lines not on this page · raw message

drivers/net/enetc/enetc4_vf.c +2 -0
index 83a1e4931f..3083a56335 100644
@@ -60,6 +60,8 @@ static uint64_t dev_tx_offloads_sup =
 	RTE_ETH_TX_OFFLOAD_IPV4_CKSUM |
 	RTE_ETH_TX_OFFLOAD_UDP_CKSUM |
 	RTE_ETH_TX_OFFLOAD_TCP_CKSUM |
+	RTE_ETH_TX_OFFLOAD_TCP_TSO |
+	RTE_ETH_TX_OFFLOAD_UDP_TSO |
 	RTE_ETH_TX_OFFLOAD_MULTI_SEGS;
 
 static void
drivers/net/enetc/enetc_rxtx.c +255 -0

261 lines not on this page · raw message

Signature · 1 line
2.25.1
#19 lore raw

PATCH v2 3/14 net/enetc: add RSC (hardware LRO) support for ENETC4

In reply to Gagandeep Singh

Add Receive Segment Coalesce (RSC) support, exposed as the DPDK RTE_ETH_RX_OFFLOAD_TCP_LRO Rx offload, for the ENETC4 PF and VF on i.MX95. RSC lets the HW coalesce multiple in-order TCP segments of a flow into a single receive frame, reducing per-packet overhead.

RSC is a port-level offload driven by a dedicated Rx burst (enetc_recv_pkts_rsc). When TCP LRO is requested the ring is switched to 32B extended receive descriptors (RBaMR[BDS] = 1), the FCS is stripped (RBaMR[CRC] = 0, so RSC is incompatible with KEEP_CRC), interrupt coalescing is enabled (RBaICR0[ICEN] with a non-zero RBaICR1[ICTT] hold timer that doubles as the RSC flush window), and RBaRSCR[EN] is set with the coalesced-frame size clamped to the HW maximum.

Because a 32B descriptor spans two 16B ring slots, the ring length register (RBaLENR) and the consumer-index register are programmed in HW-descriptor units (slot count / 2), while the internal SW indices continue to track 16B slots. Coalesced clusters are delivered with the RTE_MBUF_F_RX_LRO flag set when RSC_FRAMES > 1.

---
 doc/guides/nics/enetc4.rst             |   4 +
 doc/guides/nics/features/enetc4.ini    |   1 +
 doc/guides/rel_notes/release_26_11.rst |   1 +
 drivers/net/enetc/base/enetc4_hw.h     |  74 ++++++++
 drivers/net/enetc/enetc.h              |   5 +
 drivers/net/enetc/enetc4_ethdev.c      | 102 ++++++++++-
 drivers/net/enetc/enetc4_vf.c          |   1 +
 drivers/net/enetc/enetc_rxtx.c         | 239 ++++++++++++++++++++++++-
 8 files changed, 418 insertions(+), 9 deletions(-)
doc/guides/nics/enetc4.rst +4 -0
index 4d27e4048e..e7f4348603 100644
@@ -55,6 +55,10 @@ Key functionality includes:
 - Transmission: Packet transmission precedes reception, ensuring efficient data transfer.
 - TCP and UDP segmentation offload (TSO) on VFs, enabled per Tx queue
   when the TSO offload flag is requested.
+- Large receive offload (LRO) on the receive path via hardware Receive
+  Segment Coalesce (RSC), enabled when the TCP LRO Rx offload flag is
+  requested. RSC requires the FCS to be stripped, so it cannot be combined
+  with the KEEP_CRC Rx offload.
 
 
 Prerequisites
doc/guides/nics/features/enetc4.ini +1 -0
index 8ec1e8d00f..aae398e210 100644
@@ -7,6 +7,7 @@
 Link status event    = Y
 Speed capabilities   = Y
 Link status          = Y
+LRO                  = Y
 TSO                  = Y
 Promiscuous mode     = Y
 Allmulticast mode    = Y
doc/guides/rel_notes/release_26_11.rst +1 -0
index 6a348ab4e0..0dd08e0259 100644
@@ -62,6 +62,7 @@ New Features
 
   * Added KEEP_CRC Rx offload support for the ENETC4 PMD to preserve the Ethernet FCS.
   * Added TCP Segmentation Offload (TSO) support for the ENETC4 VF.
+  * Added Receive Segment Coalesce (RSC / hardware LRO) support for ENETC4 PF and VF.
 
 Removed Items
 -------------
drivers/net/enetc/base/enetc4_hw.h +74 -0

81 lines not on this page · raw message

drivers/net/enetc/enetc.h +5 -0
index db349e051b..67f8ce1919 100644
@@ -101,6 +101,8 @@ struct enetc_bdr {
 	uint8_t rx_deferred_start;
 	uint8_t tx_deferred_start;
 	uint8_t lso_enable;
+	void *rbidr;
+	uint8_t rsc_enable;
 };
 
 struct enetc_eth_hw {
@@ -321,12 +323,15 @@ uint16_t enetc_recv_pkts(void *rxq, struct rte_mbuf **rx_pkts,
 		uint16_t nb_pkts);
 uint16_t enetc_recv_pkts_nc(void *rxq, struct rte_mbuf **rx_pkts,
 		uint16_t nb_pkts);
+uint16_t enetc_recv_pkts_rsc(void *rxq, struct rte_mbuf **rx_pkts,
+		uint16_t nb_pkts);
 uint16_t enetc_xmit_pkts_cacheable(void *txq, struct rte_mbuf **tx_pkts,
 		uint16_t nb_pkts);
 uint16_t enetc_recv_pkts_cacheable(void *rxq, struct rte_mbuf **rx_pkts,
 		uint16_t nb_pkts);
 
 int enetc_refill_rx_ring(struct enetc_bdr *rx_ring, const int buff_cnt);
+int enetc_refill_rx_ring_rsc(struct enetc_bdr *rx_ring, const int buff_cnt);
 
 /*
  * Cache-maintenance constants for cacheable BD ring mode.
drivers/net/enetc/enetc4_ethdev.c +95 -7

169 lines not on this page · raw message

drivers/net/enetc/enetc4_vf.c +1 -0
index 3083a56335..be79a18a39 100644
@@ -53,6 +53,7 @@ static uint64_t dev_rx_offloads_sup =
 	RTE_ETH_RX_OFFLOAD_TCP_CKSUM |
 	RTE_ETH_RX_OFFLOAD_VLAN_FILTER |
 	RTE_ETH_RX_OFFLOAD_KEEP_CRC |
+	RTE_ETH_RX_OFFLOAD_TCP_LRO |
 	RTE_ETH_RX_OFFLOAD_SCATTER;
 
 /* Supported Tx offloads */
drivers/net/enetc/enetc_rxtx.c +237 -2

257 lines not on this page · raw message

Signature · 1 line
2.25.1
#20 lore raw

PATCH v2 4/14 net/enetc: extend link speed code field to 8-bit for PF-to-VF message

In reply to Gagandeep Singh

The PF-to-VF message is only 16-bit wide, where the upper 8-bit is the class_id and the lower 8-bit carries the message content. For the link speed message, the lower 4-bit was previously occupied by the cookie field, leaving only 4-bit for the speed code, which allows at most 15 distinct speed values.

As the NETC IP evolves and supports more and more link speeds, 15 speed values are clearly insufficient. Since the cookie field is designed for non-blocking messages and has no meaningful use in link speed messages, remove it and expand the speed code field from 4-bit to 8-bit, allowing up to 255 speed values (ENETC_SPEED_MAX = 0xff).

Instead of enumerating every speed value greater than 5Gbps explicitly, introduce a formula-based approach:

	speed_code = (link_speed - 5000) / 1000 + ENETC_SPEED_5000

This removes the explicit enum entries for 10G, 25G, 50G and 100G, and replaces the individual switch-case branches with a generic implementation to get the speed, making it easy to support any future high speed without modifying the enum or the switch statement.

For backward compatibility with a PF running an older kernel (before 6.18.37) that still uses the legacy 4-bit speed code / 4-bit cookie message layout, add a "vf_link_legacy" devarg. When set to 1, the VF extracts the message result from the upper 4 bits of the lower byte and decodes speeds greater than 5Gbps using the legacy fixed class codes (10G/25G/50G/100G). The default (0) uses the new 8-bit layout.

	Usage: -a <pci_addr>,vf_link_legacy=1
---
 doc/guides/rel_notes/release_26_11.rst |   1 +
 drivers/net/enetc/enetc.h              |  32 ++++-
 drivers/net/enetc/enetc4_vf.c          | 175 +++++++++++++++++++++----
 3 files changed, 175 insertions(+), 33 deletions(-)
doc/guides/rel_notes/release_26_11.rst +1 -0
index 0dd08e0259..d7961d3c85 100644
@@ -63,6 +63,7 @@ New Features
   * Added KEEP_CRC Rx offload support for the ENETC4 PMD to preserve the Ethernet FCS.
   * Added TCP Segmentation Offload (TSO) support for the ENETC4 VF.
   * Added Receive Segment Coalesce (RSC / hardware LRO) support for ENETC4 PF and VF.
+  * Extended the PF-to-VF link speed code field from 4-bit to 8-bit in ENETC4.
 
 Removed Items
 -------------
drivers/net/enetc/enetc.h +27 -5
index 67f8ce1919..c983cb059e 100644
@@ -120,6 +120,10 @@ struct enetc_eth_hw {
 	uint32_t vsi_delay;   /* VSI-PSI message wait delay (us) */
 	uint32_t *txq_prior;  /* per-queue TX priority (TBMR priority bits) */
 	uint8_t nc_mode;      /* 1 = non-cacheable BD memory, use _nc ops */
+	/* 1 = legacy PF-to-VF link message layout (4-bit speed / 4-bit cookie),
+	 * for PF kernel versions before 6.18.37. Set via vf_link_legacy devarg.
+	 */
+	uint8_t vf_link_legacy;
 };
 
 /*
@@ -211,11 +215,29 @@ enum speed {
 	ENETC_SPEED_1000 = 0x5,
 	ENETC_SPEED_2500 = 0x6,
 	ENETC_SPEED_5000 = 0x7,
-	ENETC_SPEED_10G = 0x8,
-	ENETC_SPEED_25G = 0x9,
-	ENETC_SPEED_50G = 0xA,
-	ENETC_SPEED_100G = 0xB,
-	ENETC_SPEED_NOT_SUPPORTED = 0xF
+	/* Base speed class code used by the >5Gbps formula below */
+	/* Do not add enumeration values for any speed greater than
+	 * 5Gbps. For any speed greater than 5Gbps, its speed class
+	 * code should follow the formula below.
+	 *
+	 * SPEED = (link_speed - 5000) / 1000 + ENETC_SPEED_5000
+	 *
+	 * The unit of link_speed should be Mbps, the max SPEED
+	 * should <= ENETC_SPEED_MAX.
+	 */
+	ENETC_SPEED_MAX = 0xff,
+};
+
+/* Legacy speed class codes for backward compatibility with an older kernel PF
+ * (before 6.18.37) that encoded a 4-bit speed code and 4-bit cookie in the
+ * message's lower byte. Used only when the vf_link_legacy devarg is set.
+ */
+enum speed_legacy {
+	ENETC_SPEED_LEGACY_10G = 0x8,
+	ENETC_SPEED_LEGACY_25G = 0x9,
+	ENETC_SPEED_LEGACY_50G = 0xA,
+	ENETC_SPEED_LEGACY_100G = 0xB,
+	ENETC_SPEED_LEGACY_NOT_SUPPORTED = 0xF
 };
 
 /* PSI-VSI command header format */
drivers/net/enetc/enetc4_vf.c +147 -28

248 lines not on this page · raw message

Signature · 1 line
2.25.1
#21 lore raw

PATCH v2 5/14 net/enetc: support firmware version get for VF

In reply to Gagandeep Singh

Implement the ``.fw_version_get`` eth_dev op for the ENETC4 VF PMD to report the NETC IP revision.

The NETC IP major revision is read from the PCI revision ID register, while the IP minor revision is retrieved from the PSI over VSI-PSI messaging using the "Get IP version" command class (class ID 0xF0, command ID 0x1). The version is reported in the "<major>.<minor>" format.

The PSI firmware only implements the IP_MN command of this class, so the major revision is obtained from the PCI revision ID, matching the behaviour of the kernel PF/VF drivers.

---
 doc/guides/nics/enetc4.rst             |   1 +
 doc/guides/nics/features/enetc4.ini    |   1 +
 doc/guides/rel_notes/release_26_11.rst |   1 +
 drivers/net/enetc/enetc.h              |  19 +++-
 drivers/net/enetc/enetc4_vf.c          | 135 +++++++++++++++++++++++++
 5 files changed, 155 insertions(+), 2 deletions(-)
doc/guides/nics/enetc4.rst +1 -0
index e7f4348603..ea0e37896d 100644
@@ -59,6 +59,7 @@ Key functionality includes:
   Segment Coalesce (RSC), enabled when the TCP LRO Rx offload flag is
   requested. RSC requires the FCS to be stripped, so it cannot be combined
   with the KEEP_CRC Rx offload.
+- Firmware version: The NETC IP version is reported via ``rte_eth_dev_fw_version_get``.
 
 
 Prerequisites
doc/guides/nics/features/enetc4.ini +1 -0
index aae398e210..eaf474e7ba 100644
@@ -16,6 +16,7 @@ VLAN filter          = Y
 RSS hash             = Y
 Packet type parsing  = Y
 Basic stats          = Y
+FW version           = Y
 L3 checksum offload  = Y
 L4 checksum offload  = Y
 CRC offload          = Y
doc/guides/rel_notes/release_26_11.rst +1 -0
index d7961d3c85..5ac2bb4de0 100644
@@ -64,6 +64,7 @@ New Features
   * Added TCP Segmentation Offload (TSO) support for the ENETC4 VF.
   * Added Receive Segment Coalesce (RSC / hardware LRO) support for ENETC4 PF and VF.
   * Extended the PF-to-VF link speed code field from 4-bit to 8-bit in ENETC4.
+  * Added firmware version reporting for the ENETC4 VF.
 
 Removed Items
 -------------
drivers/net/enetc/enetc.h +17 -2
index c983cb059e..b1428f1bca 100644
@@ -170,7 +170,8 @@ enum enetc_msg_cmd_class_id {
 	ENETC_CLASS_ID_MAC_FILTER = 0x20,
 	ENETC_CLASS_ID_VLAN_FILTER = 0x21,
 	ENETC_CLASS_ID_LINK_STATUS = 0x80,
-	ENETC_CLASS_ID_LINK_SPEED = 0x81
+	ENETC_CLASS_ID_LINK_SPEED = 0x81,
+	ENETC_CLASS_ID_GET_IP_VER = 0xF0
 };
 
 /* Enum for command IDs */
@@ -184,9 +185,18 @@ enum enetc_msg_cmd_id {
 	ENETC_CMD_ID_GET_LINK_STATUS = 0,
 	ENETC_CMD_ID_REGISTER_LINK_NOTIF = 1,
 	ENETC_CMD_ID_UNREGISTER_LINK_NOTIF = 2,
-	ENETC_CMD_ID_GET_LINK_SPEED = 0
+	ENETC_CMD_ID_GET_LINK_SPEED = 0,
+	/* Get IP version command IDs (class ID 0xF0) */
+	ENETC_CMD_ID_GET_IP_MJ = 0,
+	ENETC_CMD_ID_GET_IP_MN = 1,
+	ENETC_CMD_ID_GET_IP_INT = 2,
+	ENETC_CMD_ID_GET_IP_MNT = 3,
+	ENETC_CMD_ID_GET_IP_CFG = 4
 };
 
+/* IP_VER value returned when the version is not available */
+#define ENETC_IP_VER_NOT_AVAILABLE	0xFF
+
 enum mac_addr_status {
 	ENETC_INVALID_MAC_ADDR = 0x0,
 	ENETC_DUPLICATE_MAC_ADDR = 0X1,
@@ -274,6 +284,11 @@ struct enetc_msg_cmd_get_link_speed {
 	struct enetc_msg_cmd_header header;
 };
 
+/* Get IP version command message format (class ID 0xF0) */
+struct enetc_msg_cmd_get_ip_ver {
+	struct enetc_msg_cmd_header header;
+};
+
 struct enetc_msg_cmd_set_vlan_promisc {
 	struct enetc_msg_cmd_header header;
 	uint8_t op;
drivers/net/enetc/enetc4_vf.c +135 -0

159 lines not on this page · raw message

Signature · 1 line
2.25.1
#22 lore raw

PATCH v2 6/14 net/enetc: support registers dump

In reply to Gagandeep Singh

Implement the .get_reg operation for the ENETC4 PF and VF PMDs to dump the device registers via rte_eth_dev_get_reg_info.

The VF dumps the registers reachable by a virtual station interface (VSI): the station interface and per-ring BD ring registers. Port registers are not accessible by a VF.

The PF additionally dumps the port registers, which are only accessible by the physical station interface (PSI).

---
 doc/guides/nics/enetc4.rst             |  1 +
 doc/guides/nics/features/enetc4.ini    |  1 +
 doc/guides/rel_notes/release_26_11.rst |  1 +
 drivers/net/enetc/enetc.h              | 13 +++++
 drivers/net/enetc/enetc4_ethdev.c      | 70 ++++++++++++++++++++++++++
 drivers/net/enetc/enetc4_vf.c          | 62 +++++++++++++++++++++++
 6 files changed, 148 insertions(+)
doc/guides/nics/enetc4.rst +1 -0
index ea0e37896d..cd757be12f 100644
@@ -60,6 +60,7 @@ Key functionality includes:
   requested. RSC requires the FCS to be stripped, so it cannot be combined
   with the KEEP_CRC Rx offload.
 - Firmware version: The NETC IP version is reported via ``rte_eth_dev_fw_version_get``.
+- Registers dump: The station interface, port (PF only) and BD ring registers are dumped via ``rte_eth_dev_get_reg_info``.
 
 
 Prerequisites
doc/guides/nics/features/enetc4.ini +1 -0
index eaf474e7ba..6540a43909 100644
@@ -17,6 +17,7 @@ RSS hash             = Y
 Packet type parsing  = Y
 Basic stats          = Y
 FW version           = Y
+Registers dump       = Y
 L3 checksum offload  = Y
 L4 checksum offload  = Y
 CRC offload          = Y
doc/guides/rel_notes/release_26_11.rst +1 -0
index 5ac2bb4de0..deb3bc5d52 100644
@@ -65,6 +65,7 @@ New Features
   * Added Receive Segment Coalesce (RSC / hardware LRO) support for ENETC4 PF and VF.
   * Extended the PF-to-VF link speed code field from 4-bit to 8-bit in ENETC4.
   * Added firmware version reporting for the ENETC4 VF.
+  * Added register dump support for ENETC4 PF and VF.
 
 Removed Items
 -------------
drivers/net/enetc/enetc.h +13 -0
index b1428f1bca..73404308fe 100644
@@ -397,6 +397,19 @@ enetc_bd_unused(struct enetc_bdr *bdr)
 	return bdr->bd_count + bdr->next_to_clean - bdr->next_to_use - 1;
 }
 
+/* Per-ring Tx BDR registers dumped by .get_reg (shared by PF and VF) */
+static const uint32_t enetc4_txbdr_regs[] = {
+	ENETC_TBMR, ENETC_TBSR, ENETC_TBBAR0, ENETC_TBBAR1,
+	ENETC_TBCIR, ENETC_TBLENR,
+};
+
+/* Per-ring Rx BDR registers dumped by .get_reg (shared by PF and VF) */
+static const uint32_t enetc4_rxbdr_regs[] = {
+	ENETC_RBMR, ENETC_RBSR, ENETC_RBBSR, ENETC_RBCIR,
+	ENETC_RBBAR0, ENETC_RBBAR1, ENETC_RBPIR, ENETC_RBLENR,
+};
+
+
 /* CBDR prototypes */
 int enetc4_setup_cbdr(struct rte_eth_dev *dev, struct enetc_hw *hw,
 			int bd_count, struct netc_cbdr *cbdr);
drivers/net/enetc/enetc4_ethdev.c +70 -0

82 lines not on this page · raw message

drivers/net/enetc/enetc4_vf.c +62 -0

80 lines not on this page · raw message

Signature · 1 line
2.25.1
#23 lore raw

PATCH v2 7/14 net/enetc: support ethtool ring parameters

In reply to Gagandeep Singh

The ethtool ring parameter query relies on the queue info ethdev ops (.rxq_info_get/.txq_info_get) together with the descriptor limits reported in dev_info. The PF already registered these ops, but the VF ops tables did not, so ring parameter queries failed on the VF.

Make enetc4_rxq_info_get() and enetc4_txq_info_get() non-static and register them in both VF ops tables so ring parameters are reported for both the PF and VF.

---
 doc/guides/rel_notes/release_26_11.rst | 1 +
 drivers/net/enetc/enetc.h              | 4 ++++
 drivers/net/enetc/enetc4_ethdev.c      | 4 ++--
 drivers/net/enetc/enetc4_vf.c          | 4 ++++
 4 files changed, 11 insertions(+), 2 deletions(-)
doc/guides/rel_notes/release_26_11.rst +1 -0
index deb3bc5d52..9e333edf4f 100644
@@ -66,6 +66,7 @@ New Features
   * Extended the PF-to-VF link speed code field from 4-bit to 8-bit in ENETC4.
   * Added firmware version reporting for the ENETC4 VF.
   * Added register dump support for ENETC4 PF and VF.
+  * Added ring parameters support for the ENETC4 VF (rxq_info_get / txq_info_get).
 
 Removed Items
 -------------
drivers/net/enetc/enetc.h +4 -0
index 73404308fe..367d350dde 100644
@@ -339,6 +339,10 @@ int enetc4_tx_queue_stop(struct rte_eth_dev *dev, uint16_t qidx);
 void enetc4_tx_queue_release(struct rte_eth_dev *dev, uint16_t qid);
 const uint32_t *enetc4_supported_ptypes_get(struct rte_eth_dev *dev __rte_unused,
 			size_t *no_of_elements);
+void enetc4_rxq_info_get(struct rte_eth_dev *dev, uint16_t queue_id,
+			 struct rte_eth_rxq_info *qinfo);
+void enetc4_txq_info_get(struct rte_eth_dev *dev, uint16_t queue_id,
+			 struct rte_eth_txq_info *qinfo);
 
 /*
  * enetc4_vf function prototype
drivers/net/enetc/enetc4_ethdev.c +2 -2
index 681bac3ecc..afee0b90a3 100644
@@ -1125,7 +1125,7 @@ enetc4_tx_queue_stop(struct rte_eth_dev *dev, uint16_t qidx)
 	return 0;
 }
 
-static void
+void
 enetc4_rxq_info_get(struct rte_eth_dev *dev, uint16_t queue_id,
 			struct rte_eth_rxq_info *qinfo)
 {
@@ -1139,7 +1139,7 @@ enetc4_rxq_info_get(struct rte_eth_dev *dev, uint16_t queue_id,
 	qinfo->conf.rx_drop_en = 0;
 }
 
-static void
+void
 enetc4_txq_info_get(struct rte_eth_dev *dev, uint16_t queue_id,
 			struct rte_eth_txq_info *qinfo)
 {
drivers/net/enetc/enetc4_vf.c +4 -0
index 77bec0425a..90b7b99e9a 100644
@@ -1508,10 +1508,12 @@ static const struct eth_dev_ops enetc4_vf_ops_no_vsi_m = {
 	.rx_queue_start       = enetc4_rx_queue_start,
 	.rx_queue_stop        = enetc4_rx_queue_stop,
 	.rx_queue_release     = enetc4_rx_queue_release,
+	.rxq_info_get         = enetc4_rxq_info_get,
 	.tx_queue_setup       = enetc4_tx_queue_setup,
 	.tx_queue_start       = enetc4_tx_queue_start,
 	.tx_queue_stop        = enetc4_tx_queue_stop,
 	.tx_queue_release     = enetc4_tx_queue_release,
+	.txq_info_get         = enetc4_txq_info_get,
 	.dev_supported_ptypes_get = enetc4_supported_ptypes_get,
 };
 
@@ -1537,10 +1539,12 @@ static const struct eth_dev_ops enetc4_vf_ops = {
 	.rx_queue_start       = enetc4_rx_queue_start,
 	.rx_queue_stop        = enetc4_rx_queue_stop,
 	.rx_queue_release     = enetc4_rx_queue_release,
+	.rxq_info_get         = enetc4_rxq_info_get,
 	.tx_queue_setup       = enetc4_tx_queue_setup,
 	.tx_queue_start       = enetc4_tx_queue_start,
 	.tx_queue_stop        = enetc4_tx_queue_stop,
 	.tx_queue_release     = enetc4_tx_queue_release,
+	.txq_info_get         = enetc4_txq_info_get,
 	.dev_supported_ptypes_get = enetc4_supported_ptypes_get,
 };
 
Signature · 1 line
2.25.1
#24 lore raw

PATCH v2 8/14 net/enetc: refresh link speed on VF link-up interrupt

In reply to Gagandeep Singh

The interrupt-driven link-status path (enetc4_process_psi_msg) only updated link_status when a PSI-to-VSI notification arrived; it never re-queried the link speed from the PF. As a result, after a link-down followed by a link-up the cached link_speed showed the speed from the previous session rather than the freshly negotiated one.

Fix this by:

1. Introducing enetc4_decode_link_speed() - a shared helper that maps a PF-to-VF speed status code to the corresponding RTE_ETH_SPEED_NUM_* / RTE_ETH_LINK_*_DUPLEX values, handling both the current and the legacy (vf_link_legacy) 4-bit message layout.

2. Calling enetc4_vf_get_link_speed() inside enetc4_process_psi_msg() on ENETC_LINK_UP so the negotiated speed is fetched from the PF and decoded immediately, before rte_eth_linkstatus_set() is called and the LSC callback is fired.

---
 doc/guides/rel_notes/release_26_11.rst |   1 +
 drivers/net/enetc/enetc4_vf.c          | 197 +++++++++++++------------
 2 files changed, 107 insertions(+), 91 deletions(-)
doc/guides/rel_notes/release_26_11.rst +1 -0
index 9e333edf4f..eca0dc1dea 100644
@@ -67,6 +67,7 @@ New Features
   * Added firmware version reporting for the ENETC4 VF.
   * Added register dump support for ENETC4 PF and VF.
   * Added ring parameters support for the ENETC4 VF (rxq_info_get / txq_info_get).
+  * Refreshed VF link speed on the link-up interrupt in the ENETC4 VF driver.
 
 Removed Items
 -------------
drivers/net/enetc/enetc4_vf.c +106 -91

218 lines not on this page · raw message

Signature · 1 line
2.25.1
#25 lore raw

PATCH v2 9/14 net/enetc: support stats reset for VF

In reply to Gagandeep Singh

The NETC SI-level hardware counters (SIROCT0, SIRFRM0, SITOCT0, SITFRM0, SITDFCR) are read-only for a VF and cannot be directly zeroed. No VSI-PSI command class exists for stats reset, and using FLR/soft-reset to clear counters is not reliable due to a known hardware erratum on some NETC platforms.

Implement stats_reset for the enetc4 VF PMD using a software snapshot/delta approach: on stats_reset, the current HW counter values are captured as a baseline in a new per-device enetc4_vf_stats_saved struct. stats_get then reports the delta (current_hw_value - saved_baseline), so counters appear to start from zero after each reset call. Per-ring software Rx error accumulators (ierrors) are zeroed directly on reset.

Register the stats_reset callback in both VF ops tables (enetc4_vf_ops and enetc4_vf_ops_no_vsi_m) so the feature is available regardless of whether the VSI messaging path is enabled.

---
 doc/guides/rel_notes/release_26_11.rst |  1 +
 drivers/net/enetc/enetc.h              | 17 +++++++
 drivers/net/enetc/enetc4_vf.c          | 61 +++++++++++++++++++++++---
 3 files changed, 74 insertions(+), 5 deletions(-)
doc/guides/rel_notes/release_26_11.rst +1 -0
index eca0dc1dea..b88e2825a6 100644
@@ -68,6 +68,7 @@ New Features
   * Added register dump support for ENETC4 PF and VF.
   * Added ring parameters support for the ENETC4 VF (rxq_info_get / txq_info_get).
   * Refreshed VF link speed on the link-up interrupt in the ENETC4 VF driver.
+  * Added stats reset for the ENETC4 VF using a software snapshot/delta approach.
 
 Removed Items
 -------------
drivers/net/enetc/enetc.h +17 -0
index 367d350dde..3590cf6639 100644
@@ -105,6 +105,21 @@ struct enetc_bdr {
 	uint8_t rsc_enable;
 };
 
+/*
+ * Saved SI counter baseline for VF stats reset. Since the SI-level
+ * hardware counters (SIROCT0, SIRFRM0, SITOCT0, SITFRM0, SITDFCR)
+ * are read-only for a VF and cannot be directly zeroed, stats_reset
+ * captures the current counter values as a baseline. stats_get then
+ * reports the delta: current_hw_value - baseline.
+ */
+struct enetc4_vf_stats_saved {
+	uint64_t ipackets;
+	uint64_t opackets;
+	uint64_t ibytes;
+	uint64_t obytes;
+	uint64_t oerrors;
+};
+
 struct enetc_eth_hw {
 	struct rte_eth_dev *ndev;
 	struct enetc_hw hw;
@@ -124,6 +139,8 @@ struct enetc_eth_hw {
 	 * for PF kernel versions before 6.18.37. Set via vf_link_legacy devarg.
 	 */
 	uint8_t vf_link_legacy;
+	/* Baseline snapshot for VF stats reset (software delta approach). */
+	struct enetc4_vf_stats_saved vf_stats_saved;
 };
 
 /*
drivers/net/enetc/enetc4_vf.c +56 -5

83 lines not on this page · raw message

Signature · 1 line
2.25.1
#26 lore raw

PATCH v2 10/14 net/enetc4: add per-queue Rx interrupt support for VF

In reply to Gagandeep Singh

Add MSI-X per-queue Rx interrupt support to the ENETC4 VF PMD on the cacheable (default) Rx path. This allows applications such as l3fwd-power to block in epoll_wait when no traffic is present, reducing CPU utilization to near zero.

MSI-X vector 0 is reserved for the PSI-to-VSI mailbox. Rx queue i is mapped to MSI-X vector i + 1 via ENETC_SIMSIRRV. Per-ring coalescing is enabled with ICPT=1 so the first arriving packet fires the interrupt immediately. The SIRXIDR W1C detect bit is cleared before re-arming ENETC_RBIER to prevent spurious interrupts after traffic stops.

The interrupt infrastructure (rte_intr_efd_enable + rte_intr_vec_list_alloc) is set up before rte_intr_enable() so that vfio-pci can wire each MSI-X vector to its eventfd when programming the MSI-X table.

enetc4_dev_configure() is updated to trigger interrupt setup when intr_conf.rxq is set (not only when intr_conf.lsc is set), as applications like l3fwd-power set intr_conf.rxq without setting lsc.

Documentation is updated to describe the feature, list the kernel and host setup steps, and provide an example l3fwd-power command for single queue/core interrupt-driven operation.

---
 doc/guides/nics/enetc4.rst             | 69 +++++++++++++++++++-
 doc/guides/nics/features/enetc4.ini    |  1 +
 doc/guides/rel_notes/release_26_11.rst |  1 +
 drivers/net/enetc/base/enetc4_hw.h     |  2 +
 drivers/net/enetc/enetc.h              |  1 +
 drivers/net/enetc/enetc4_ethdev.c      |  9 +--
 drivers/net/enetc/enetc4_vf.c          | 88 +++++++++++++++++++++++++-
 7 files changed, 165 insertions(+), 6 deletions(-)
doc/guides/nics/enetc4.rst +68 -1
index cd757be12f..d8e323d614 100644
@@ -59,6 +59,10 @@ Key functionality includes:
   Segment Coalesce (RSC), enabled when the TCP LRO Rx offload flag is
   requested. RSC requires the FCS to be stripped, so it cannot be combined
   with the KEEP_CRC Rx offload.
+- Per-queue Rx interrupts on VFs (cacheable Rx path only), enabling
+  interrupt-driven receive with ``vfio-pci``. Applications set
+  ``intr_conf.rxq = 1`` in ``rte_eth_conf`` to activate this feature.
+  See `Rx Interrupt Mode (VF)`_ for setup details.
 - Firmware version: The NETC IP version is reported via ``rte_eth_dev_fw_version_get``.
 - Registers dump: The station interface, port (PF only) and BD ring registers are dumped via ``rte_eth_dev_get_reg_info``.
 
@@ -95,7 +99,9 @@ The following dependencies are not part of DPDK and must be installed separately
 Driver compilation and testing
 ------------------------------
 
-Follow instructions available in the document :doc:`build_and_test` to launch **testpmd**.
+Follow instructions available in the document
+:ref:`compiling and testing a PMD for a NIC <pmd_build_and_test>`
+to launch **testpmd**.
 
 
 Driver Arguments (devargs)
@@ -156,3 +162,64 @@ PF/Common devargs
   Usage example::
 
     dpdk-testpmd -a 0000:00:00.0,nc=1 -- -i
+
+
+Rx Interrupt Mode (VF)
+----------------------
+
+The ENETC4 VF PMD supports per-queue MSI-X Rx interrupts on the cacheable
+(default) Rx path. This allows applications to block in ``epoll_wait``
+instead of busy-polling, reducing CPU utilization when traffic is absent.
+
+**MSI-X vector assignment**
+
+ENETC4 VF MSI-X vector 0 is reserved for the PSI-to-VSI mailbox interrupt
+(link status notifications). Rx queue ``i`` is mapped to vector ``i + 1``.
+The driver allocates all required eventfds before calling
+``rte_intr_enable()`` so that ``vfio-pci`` can wire each MSI-X vector to
+its eventfd when it programs the MSI-X table.
+
+**Kernel and driver requirements**
+
+- ``vfio-pci`` kernel module with no-IOMMU mode enabled (no SMMU required).
+- The non-cacheable memory mode (``nc=1`` devarg) does **not** support
+  Rx interrupts and returns ``-ENOTSUP`` from ``rx_queue_intr_enable``.
+
+**Host setup**
+
+.. code-block:: console
+
+   # Enable vfio-pci no-IOMMU mode (if SMMU is not available)
+   modprobe vfio enable_unsafe_noiommu_mode=1
+   modprobe vfio-pci
+
+   # Bind the VF to vfio-pci
+   echo vfio-pci > /sys/bus/pci/devices/<vf_pci_addr>/driver_override
+   echo <vf_pci_addr> > /sys/bus/pci/drivers_probe
+
+**Running l3fwd-power with a single queue and core**
+
+The ``l3fwd-power`` sample application demonstrates interrupt-driven Rx.
+It sets ``intr_conf.rxq = 1`` in ``rte_eth_conf``, which triggers the VF
+interrupt setup in the driver. The ``--vfio-intr=msix`` EAL flag instructs
+DPDK to use MSI-X eventfds for interrupt signalling.
+
+.. code-block:: console
+
+   ./dpdk-l3fwd-power -l 0-1 -n 1 --vfio-intr=msix \
+       -a <vf_pci_addr> -- \
+       -p 0x1 --config="(0,0,1)" --no-numa --interrupt-only
+
+Where:
+
+- ``-l 0-1`` assigns the main thread to core 0 and the forwarding lcore to
+  core 1.
+- ``-a <vf_pci_addr>`` specifies the VF PCI address (e.g. ``0000:01:00.1``).
+- ``--config="(0,0,1)"`` maps port 0, queue 0 to lcore 1.
+- ``--interrupt-only`` enables pure interrupt mode (no busy-poll fallback).
+
+With no incoming traffic the forwarding lcore sleeps in ``epoll_wait``;
+CPU utilization drops to near zero. On the first arriving packet the MSI-X
+interrupt fires, the lcore wakes, drains the ring, disables the interrupt,
+processes the burst, then re-enables and re-arms the interrupt before
+returning to sleep.
doc/guides/nics/features/enetc4.ini +1 -0
index 6540a43909..812c215b15 100644
@@ -5,6 +5,7 @@
 ;
 [Features]
 Link status event    = Y
+Queue interrupt      = Y
 Speed capabilities   = Y
 Link status          = Y
 LRO                  = Y
doc/guides/rel_notes/release_26_11.rst +1 -0
index b88e2825a6..9b39debc1d 100644
@@ -69,6 +69,7 @@ New Features
   * Added ring parameters support for the ENETC4 VF (rxq_info_get / txq_info_get).
   * Refreshed VF link speed on the link-up interrupt in the ENETC4 VF driver.
   * Added stats reset for the ENETC4 VF using a software snapshot/delta approach.
+  * Added per-queue MSI-X Rx interrupt support for the ENETC4 VF.
 
 Removed Items
 -------------
drivers/net/enetc/base/enetc4_hw.h +2 -0
index 8ad8f169d2..9543e982a2 100644
@@ -250,6 +250,8 @@ struct enetc_rx_bd_ext {
 #define ENETC4_VSIIDR            0xA08
 #define ENETC4_VSIIER_MRIE       BIT(9)
 #define ENETC4_SI_INT_IDX        0
+/* MSI-X vector base for per-Rx-queue interrupts; vector 0 is the mailbox. */
+#define ENETC4_VF_RX_VEC_BASE    1
 
 /* VSI Registers */
 #define ENETC4_VSIMSGSR  0x204   /* RO */
drivers/net/enetc/enetc.h +1 -0
index 3590cf6639..903829323e 100644
@@ -135,6 +135,7 @@ struct enetc_eth_hw {
 	uint32_t vsi_delay;   /* VSI-PSI message wait delay (us) */
 	uint32_t *txq_prior;  /* per-queue TX priority (TBMR priority bits) */
 	uint8_t nc_mode;      /* 1 = non-cacheable BD memory, use _nc ops */
+	uint8_t rxq_intr_en;  /* 1 = per-queue Rx MSI-X interrupts enabled */
 	/* 1 = legacy PF-to-VF link message layout (4-bit speed / 4-bit cookie),
 	 * for PF kernel versions before 6.18.37. Set via vf_link_legacy devarg.
 	 */
drivers/net/enetc/enetc4_ethdev.c +5 -4
index afee0b90a3..d987f1288c 100644
@@ -839,7 +839,8 @@ enetc4_dev_close(struct rte_eth_dev *dev)
 		return 0;
 
 	if (hw->device_id == ENETC4_DEV_ID_VF) {
-		if (dev->data->dev_conf.intr_conf.lsc != 0)
+		if (dev->data->dev_conf.intr_conf.lsc != 0 ||
+		    dev->data->dev_conf.intr_conf.rxq != 0)
 			enetc4_vf_dev_intr(dev, false);
 		ret = enetc4_vf_dev_stop(dev);
 	} else {
@@ -961,12 +962,12 @@ enetc4_dev_configure(struct rte_eth_dev *dev)
 	if (hw->device_id != ENETC4_DEV_ID_VF)
 		enetc4_port_wr(enetc_hw, ENETC4_PARCSCR, checksum);
 
-	/* Enable interrupts */
 	if (hw->device_id == ENETC4_DEV_ID_VF) {
-		if (dev->data->dev_conf.intr_conf.lsc != 0) {
+		if (dev->data->dev_conf.intr_conf.lsc != 0 ||
+		    dev->data->dev_conf.intr_conf.rxq != 0) {
 			ret = enetc4_vf_dev_intr(dev, true);
 			if (ret)
-				ENETC_PMD_WARN("Failed to setup link interrupts");
+				ENETC_PMD_WARN("Failed to setup VF interrupts: %d", ret);
 		}
 	}
 
drivers/net/enetc/enetc4_vf.c +87 -1

125 lines not on this page · raw message

Signature · 1 line
2.25.1
#27 lore raw

PATCH v2 11/14 net/enetc4: add SI-based port VLAN insertion and removal

In reply to Gagandeep Singh

Implement hardware VLAN tag insertion on Tx and removal on Rx via the per-SI VLAN isolation (pvid) mechanism on ENETC4.

On a PF, the driver writes directly to PSIaVLANR(0) (VID + enable bit) and PSIaCFGR0(0) (SIVIE for Tx insertion, VTE for Rx removal, SIVC_CVLAN to allow C-VLAN 0x8100 TPID).

On a privileged VF, the request is forwarded to the kernel PF via the VSI-PSI mailbox using a new command class 0x24 (SI VLAN isolation, cmd ID 0x1). The kernel PF handler programs the same registers on behalf of the VF's station interface. The class 0x24 reply is added to the pass-through list in enetc4_msg_vsi_send() so it is handled correctly alongside the existing command classes.

New additions:
- ENETC4_PSIVLANR(a) and ENETC4_PSICFGR0(a) register macros with field definitions in enetc4_hw.h
- ENETC_CLASS_ID_SI_VLAN_ISO (0x24) and ENETC_CMD_ID_SET_SI_VLAN_ISO enum values, plus struct enetc_msg_si_vlan_iso message layout and bit definitions in enetc.h
- enetc4_vlan_pvid_set() for PF in enetc4_ethdev.c
- enetc4_vf_vlan_pvid_set() for VF in enetc4_vf.c, registered as .vlan_pvid_set in both enetc4_ops and enetc4_vf_ops

The feature is activated in testpmd with:
tx_vlan set pvid <port_id> <vlan_id> on|off

---
 doc/guides/nics/enetc4.rst             |  4 ++
 doc/guides/nics/features/enetc4.ini    |  1 +
 doc/guides/rel_notes/release_26_11.rst |  1 +
 drivers/net/enetc/base/enetc4_hw.h     | 14 +++++
 drivers/net/enetc/enetc.h              | 23 +++++++
 drivers/net/enetc/enetc4_ethdev.c      | 39 ++++++++++++
 drivers/net/enetc/enetc4_vf.c          | 85 ++++++++++++++++++++++++++
 7 files changed, 167 insertions(+)
doc/guides/nics/enetc4.rst +4 -0
index d8e323d614..bb0628ccf6 100644
@@ -65,6 +65,10 @@ Key functionality includes:
   See `Rx Interrupt Mode (VF)`_ for setup details.
 - Firmware version: The NETC IP version is reported via ``rte_eth_dev_fw_version_get``.
 - Registers dump: The station interface, port (PF only) and BD ring registers are dumped via ``rte_eth_dev_get_reg_info``.
+- SI-based port VLAN (pvid): Hardware VLAN tag insertion on Tx and removal on Rx, configured
+  via ``rte_eth_dev_set_vlan_pvid``. On a PF the registers are written directly; on a privileged
+  VF the request is forwarded to the kernel PF through the VSI-PSI mailbox (class 0x24).
+  Use the testpmd command ``tx_vlan set pvid <port_id> <vlan_id> on|off`` to enable or disable.
 
 
 Prerequisites
doc/guides/nics/features/enetc4.ini +1 -0
index 812c215b15..9dc8fd33f8 100644
@@ -14,6 +14,7 @@ Promiscuous mode     = Y
 Allmulticast mode    = Y
 Unicast MAC filter   = Y
 VLAN filter          = Y
+VLAN offload         = Y
 RSS hash             = Y
 Packet type parsing  = Y
 Basic stats          = Y
doc/guides/rel_notes/release_26_11.rst +1 -0
index 9b39debc1d..e6d96b2a50 100644
@@ -70,6 +70,7 @@ New Features
   * Refreshed VF link speed on the link-up interrupt in the ENETC4 VF driver.
   * Added stats reset for the ENETC4 VF using a software snapshot/delta approach.
   * Added per-queue MSI-X Rx interrupt support for the ENETC4 VF.
+  * Added SI-based port VLAN insertion (Tx) and removal (Rx) for ENETC4 PF and VF.
 
 Removed Items
 -------------
drivers/net/enetc/base/enetc4_hw.h +14 -0
index 9543e982a2..a9552f21f4 100644
@@ -277,6 +277,20 @@ struct enetc_rx_bd_ext {
 #define ENETC4_SICTR0		0x18
 #define ENETC4_SICTR1		0x1c
 
+/* PSI SI VLAN register: per-SI VLAN tag for insertion/removal */
+#define ENETC4_PSIVLANR(a)		((a) * 0x80 + 0x2008)
+#define ENETC4_PSIVLANR_E		BIT(31)  /* enable SI VLAN processing */
+#define ENETC4_PSIVLANR_VTEA		BIT(30)  /* 0=strip tag, 1=zero VID */
+#define ENETC4_PSIVLANR_PCP(v)		(((uint32_t)(v) & 0x7) << 13)
+#define ENETC4_PSIVLANR_DEI		BIT(12)
+#define ENETC4_PSIVLANR_VID(v)		((uint32_t)(v) & 0xfff)
+
+/* PSI SI configuration register 0 */
+#define ENETC4_PSICFGR0(a)		((a) * 0x80 + 0x2010)
+#define ENETC4_PSICFGR0_SIVC_CVLAN	BIT(24)  /* allow C-VLAN 0x8100 */
+#define ENETC4_PSICFGR0_SIVIE		BIT(14)  /* SI VLAN insertion enable */
+#define ENETC4_PSICFGR0_VTE		BIT(12)  /* SI VLAN removal enable */
+
 /* general register accessors */
 #define enetc4_rd_reg(reg)	rte_read32((void *)(reg))
 #define enetc4_wr_reg(reg, val)  rte_write32((val), (void *)(reg))
drivers/net/enetc/enetc.h +23 -0
index 903829323e..72e43572f7 100644
@@ -187,6 +187,8 @@ struct enetc_eth_adapter {
 enum enetc_msg_cmd_class_id {
 	ENETC_CLASS_ID_MAC_FILTER = 0x20,
 	ENETC_CLASS_ID_VLAN_FILTER = 0x21,
+	/* Configure SI VLAN isolation (insert / remove) */
+	ENETC_CLASS_ID_SI_VLAN_ISO = 0x24,
 	ENETC_CLASS_ID_LINK_STATUS = 0x80,
 	ENETC_CLASS_ID_LINK_SPEED = 0x81,
 	ENETC_CLASS_ID_GET_IP_VER = 0xF0
@@ -212,6 +214,11 @@ enum enetc_msg_cmd_id {
 	ENETC_CMD_ID_GET_IP_CFG = 4
 };
 
+/* Command IDs for class ID 0x24 (SI VLAN isolation) */
+enum enetc_msg_si_vlan_cmd_id {
+	ENETC_CMD_ID_SET_SI_VLAN_ISO = 1,
+};
+
 /* IP_VER value returned when the version is not available */
 #define ENETC_IP_VER_NOT_AVAILABLE	0xFF
 
@@ -323,6 +330,22 @@ struct enetc_msg_vlan_exact_filter {
 	uint8_t reserved2;
 };
 
+/* VSI-PSI SI VLAN isolation message (class 0x24, cmd 0x1) */
+struct enetc_msg_si_vlan_iso {
+	struct enetc_msg_cmd_header header;
+	uint8_t ctrl;          /* E[7], VTEA[6], TPID[1:0] */
+	uint8_t pcp_dei_vid_hi; /* PCP[7:5], DEI[4], VID[11:8] */
+	uint8_t vid_lo;        /* VID[7:0] */
+	uint8_t reserved_0;
+	uint8_t flags;         /* SVIE[2], VTE[1] */
+	uint8_t reserved_1[3];
+};
+
+#define ENETC_SI_VLAN_ISO_E	BIT(7)  /* ctrl: enable SI VLAN */
+#define ENETC_SI_VLAN_ISO_VTEA	BIT(6)  /* ctrl: 0=strip, 1=zero VID */
+#define ENETC_SI_VLAN_ISO_SVIE	BIT(2)  /* flags: Tx insertion enable */
+#define ENETC_SI_VLAN_ISO_VTE	BIT(1)  /* flags: Rx removal enable */
+
 struct enetc_psi_reply_msg {
 	uint8_t class_id;
 	uint8_t status;
drivers/net/enetc/enetc4_ethdev.c +39 -0
index d987f1288c..ae40cc69e0 100644
@@ -872,6 +872,44 @@ enetc4_dev_close(struct rte_eth_dev *dev)
 	return ret;
 }
 
+/* Configure SI-based VLAN insertion (Tx) and removal (Rx) for the PF. */
+static int
+enetc4_vlan_pvid_set(struct rte_eth_dev *dev, uint16_t vlan_id, int on)
+{
+	struct enetc_eth_hw *hw =
+		ENETC_DEV_PRIVATE_TO_HW(dev->data->dev_private);
+	struct enetc_hw *enetc_hw = &hw->hw;
+	uint32_t psivlanr, psicfgr0;
+
+	PMD_INIT_FUNC_TRACE();
+
+	psicfgr0 = enetc4_port_rd(enetc_hw, ENETC4_PSICFGR0(0));
+
+	if (on) {
+		/* Build the VLAN register: enable bit + VID (PCP/DEI left 0) */
+		psivlanr = (uint32_t)ENETC4_PSIVLANR_E |
+			   ENETC4_PSIVLANR_VID(vlan_id);
+		enetc4_port_wr(enetc_hw, ENETC4_PSIVLANR(0), psivlanr);
+
+		/* Allow C-VLAN TPID, enable Tx insertion and Rx removal */
+		psicfgr0 |= ENETC4_PSICFGR0_SIVC_CVLAN |
+			    ENETC4_PSICFGR0_SIVIE |
+			    ENETC4_PSICFGR0_VTE;
+		enetc4_port_wr(enetc_hw, ENETC4_PSICFGR0(0), psicfgr0);
+	} else {
+		/* Clear Tx insertion, Rx removal and C-VLAN allow bits */
+		psicfgr0 &= ~(ENETC4_PSICFGR0_SIVC_CVLAN |
+			      ENETC4_PSICFGR0_SIVIE |
+			      ENETC4_PSICFGR0_VTE);
+		enetc4_port_wr(enetc_hw, ENETC4_PSICFGR0(0), psicfgr0);
+
+		/* Clear the VLAN register (disable SI VLAN processing) */
+		enetc4_port_wr(enetc_hw, ENETC4_PSIVLANR(0), 0);
+	}
+
+	return 0;
+}
+
 static int
 enetc4_promiscuous_enable(struct rte_eth_dev *dev)
 {
@@ -1267,6 +1305,7 @@ static const struct eth_dev_ops enetc4_ops = {
 	.get_reg              = enetc4_get_regs,
 	.promiscuous_enable   = enetc4_promiscuous_enable,
 	.promiscuous_disable  = enetc4_promiscuous_disable,
+	.vlan_pvid_set        = enetc4_vlan_pvid_set,
 	.rx_queue_setup       = enetc4_rx_queue_setup,
 	.rx_queue_start       = enetc4_rx_queue_start,
 	.rx_queue_stop        = enetc4_rx_queue_stop,
drivers/net/enetc/enetc4_vf.c +85 -0

105 lines not on this page · raw message

Signature · 1 line
2.25.1
#28 lore raw

PATCH v2 12/14 net/enetc4: update VF link status to bitmask encoding

In reply to Gagandeep Singh

The PF-to-VF link status notification code was previously a two-value enum (UP=0x0, DOWN=0x1). Change this to a bitmask so future bits can carry additional state alongside the link up/down indication:

ENETC_LINK_DOWN BIT(0) -- set when link is down

Link up is now encoded as the DOWN bit being clear, which keeps the wire value for link-down identical (0x1) and ensures backward compatibility with older kernel PFs.

Changes:
- enetc.h: replace enum link_status with a #define bitmask; drop ENETC_LINK_UP (no longer a named constant).
- enetc4_vf.c enetc4_process_psi_msg(): replace switch/case on ENETC_LINK_UP/DOWN with bitmask decode.
- enetc4_vf.c enetc4_vf_link_update(): same bitmask decode.

---
 doc/guides/rel_notes/release_26_11.rst |  1 +
 drivers/net/enetc/enetc.h              |  8 ++++----
 drivers/net/enetc/enetc4_vf.c          | 27 +++++++-------------------
 3 files changed, 12 insertions(+), 24 deletions(-)
doc/guides/rel_notes/release_26_11.rst +1 -0
index e6d96b2a50..5323f4fea3 100644
@@ -71,6 +71,7 @@ New Features
   * Added stats reset for the ENETC4 VF using a software snapshot/delta approach.
   * Added per-queue MSI-X Rx interrupt support for the ENETC4 VF.
   * Added SI-based port VLAN insertion (Tx) and removal (Rx) for ENETC4 PF and VF.
+  * Updated ENETC4 VF link status reporting to use bitmask encoding.
 
 Removed Items
 -------------
drivers/net/enetc/enetc.h +4 -4
index 72e43572f7..40bad56341 100644
@@ -236,10 +236,10 @@ enum vlan_status {
 	ENETC_VLAN_NO_RESOURCE = 0x3
 };
 
-enum link_status {
-	ENETC_LINK_UP = 0x0,
-	ENETC_LINK_DOWN = 0x1
-};
+/* Link status bitmask in PF-to-VF mailbox notification.
+ * Link up is encoded as the DOWN bit being clear.
+ */
+#define ENETC_LINK_DOWN  (1u << 0)
 
 enum speed {
 	ENETC_SPEED_UNKNOWN = 0x0,
drivers/net/enetc/enetc4_vf.c +7 -20
index fc5ea4d609..1b93835dd7 100644
@@ -480,8 +480,10 @@ enetc4_process_psi_msg(struct rte_eth_dev *eth_dev, struct enetc_hw *enetc_hw)
 	enetc4_msg_get_psi_msg(enetc_hw, msg);
 
 	if (msg->class_id == ENETC_CLASS_ID_LINK_STATUS) {
-		switch (msg->status) {
-		case ENETC_LINK_UP:
+		if (msg->status & ENETC_LINK_DOWN) {
+			ENETC_PMD_DEBUG("Link is down");
+			link.link_status = RTE_ETH_LINK_DOWN;
+		} else {
 			ENETC_PMD_DEBUG("Link is up");
 			link.link_status = RTE_ETH_LINK_UP;
 			/* Re-query speed from PF so the cached value reflects
@@ -498,14 +500,6 @@ enetc4_process_psi_msg(struct rte_eth_dev *eth_dev, struct enetc_hw *enetc_hw)
 			} else {
 				ENETC_PMD_WARN("Failed to alloc msg for speed query");
 			}
-			break;
-		case ENETC_LINK_DOWN:
-			ENETC_PMD_DEBUG("Link is down");
-			link.link_status = RTE_ETH_LINK_DOWN;
-			break;
-		default:
-			ENETC_PMD_ERR("Unknown link status 0x%x", msg->status);
-			break;
 		}
 		ret = rte_eth_linkstatus_set(eth_dev, &link);
 		if (!ret)
@@ -1180,17 +1174,10 @@ enetc4_vf_link_update(struct rte_eth_dev *dev, int wait_to_complete __rte_unused
 	}
 
 	if (reply_msg->class_id == ENETC_CLASS_ID_LINK_STATUS) {
-		switch (reply_msg->status) {
-		case ENETC_LINK_UP:
-			link.link_status = RTE_ETH_LINK_UP;
-			break;
-		case ENETC_LINK_DOWN:
+		if (reply_msg->status & ENETC_LINK_DOWN)
 			link.link_status = RTE_ETH_LINK_DOWN;
-			break;
-		default:
-			ENETC_PMD_ERR("Unknown link status");
-			break;
-		}
+		else
+			link.link_status = RTE_ETH_LINK_UP;
 	} else {
 		ENETC_PMD_ERR("Wrong reply message");
 		return -1;
Signature · 1 line
2.25.1
#29 lore raw

PATCH v2 13/14 net/enetc4: enable TX PAUSE via VF RX congestion mode

In reply to Gagandeep Singh

When the PF negotiates TX PAUSE on the port it signals this to the VF via BIT(1) of the PF-to-VF link status mailbox message. The VF PMD must respond by setting RBMR_CM (BIT(4)) on all active RX rings so the MAC emits PAUSE frames on ingress pressure.

Add ENETC_RBMR_CM register definition, ENETC_LINK_TX_PAUSE bitmask, and tx_pause_active state flag. Add enetc4_vf_set_congestion_mode() to update all active RX rings and persist the state for rings started later. Hook it into both the interrupt and poll link-update paths, and apply the saved state in rx_queue_setup() and rx_queue_start().

RX PAUSE (honoring received PAUSE frames) is handled at the MAC level by the PF and requires no VF PMD changes.

---
 doc/guides/nics/features/enetc4.ini    |  1 +
 doc/guides/rel_notes/release_26_11.rst |  1 +
 drivers/net/enetc/base/enetc_hw.h      |  1 +
 drivers/net/enetc/enetc.h              |  9 +++-
 drivers/net/enetc/enetc4_ethdev.c      | 13 +++++-
 drivers/net/enetc/enetc4_vf.c          | 59 ++++++++++++++++++++++++--
 6 files changed, 78 insertions(+), 6 deletions(-)
doc/guides/nics/features/enetc4.ini +1 -0
index 9dc8fd33f8..d4e186559e 100644
@@ -14,6 +14,7 @@ Promiscuous mode     = Y
 Allmulticast mode    = Y
 Unicast MAC filter   = Y
 VLAN filter          = Y
+Flow control         = Y
 VLAN offload         = Y
 RSS hash             = Y
 Packet type parsing  = Y
doc/guides/rel_notes/release_26_11.rst +1 -0
index 5323f4fea3..d69888aafb 100644
@@ -72,6 +72,7 @@ New Features
   * Added per-queue MSI-X Rx interrupt support for the ENETC4 VF.
   * Added SI-based port VLAN insertion (Tx) and removal (Rx) for ENETC4 PF and VF.
   * Updated ENETC4 VF link status reporting to use bitmask encoding.
+  * Added TX PAUSE support for the ENETC4 VF via RX congestion mode.
 
 Removed Items
 -------------
drivers/net/enetc/base/enetc_hw.h +1 -0
index 6e96562850..33d075fe59 100644
@@ -51,6 +51,7 @@ enum enetc_bdr_type {TX, RX};
 							+ (off))
 /* RX BDR reg offsets */
 #define ENETC_RBMR		0x0 /* RX BDR mode register*/
+#define ENETC_RBMR_CM		BIT(4)  /* congestion mode: assert congestion to emit TX PAUSE */
 #define ENETC_RBMR_EN		BIT(31)
 
 #define ENETC_BMR_RESET		0x0 /* BDR reset*/
drivers/net/enetc/enetc.h +8 -1
index 40bad56341..8aaf8a7eb1 100644
@@ -140,6 +140,10 @@ struct enetc_eth_hw {
 	 * for PF kernel versions before 6.18.37. Set via vf_link_legacy devarg.
 	 */
 	uint8_t vf_link_legacy;
+	/* 1 = TX PAUSE negotiated on port; VF RX rings must have RBMR_CM set.
+	 * Updated from the PF-to-VF link status mailbox message (BIT(1)).
+	 */
+	uint8_t tx_pause_active;
 	/* Baseline snapshot for VF stats reset (software delta approach). */
 	struct enetc4_vf_stats_saved vf_stats_saved;
 };
@@ -238,8 +242,11 @@ enum vlan_status {
 
 /* Link status bitmask in PF-to-VF mailbox notification.
  * Link up is encoded as the DOWN bit being clear.
+ * TX_PAUSE is set when the port has negotiated TX PAUSE; VF must enable
+ * congestion mode (ENETC_RBMR_CM) on its RX rings accordingly.
  */
-#define ENETC_LINK_DOWN  (1u << 0)
+#define ENETC_LINK_DOWN      (1u << 0)
+#define ENETC_LINK_TX_PAUSE  (1u << 1)
 
 enum speed {
 	ENETC_SPEED_UNKNOWN = 0x0,
drivers/net/enetc/enetc4_ethdev.c +11 -2
index ae40cc69e0..2355522515 100644
@@ -712,8 +712,12 @@ enetc4_rx_queue_setup(struct rte_eth_dev *dev,
 	}
 
 	if (!rx_conf->rx_deferred_start) {
-		/* enable ring */
+		/* Enable ring; apply congestion mode if TX PAUSE is already active. */
 		rx_enable |= ENETC_RBMR_EN;
+		if (adapter->hw.tx_pause_active)
+			rx_enable |= ENETC_RBMR_CM;
+		else
+			rx_enable &= ~(uint32_t)ENETC_RBMR_CM;
 		enetc4_rxbdr_wr(&adapter->hw.hw, rx_ring->index, ENETC_RBMR,
 			       rx_enable);
 		dev->data->rx_queue_state[rx_ring->index] =
@@ -1089,7 +1093,12 @@ enetc4_rx_queue_start(struct rte_eth_dev *dev, uint16_t qidx)
 	if (dev->data->rx_queue_state[qidx] == RTE_ETH_QUEUE_STATE_STOPPED) {
 		rx_data = enetc4_rxbdr_rd(&priv->hw.hw, rx_ring->index,
 					 ENETC_RBMR);
-		rx_data = rx_data | ENETC_RBMR_EN;
+		rx_data |= ENETC_RBMR_EN;
+		/* Restore congestion mode if TX PAUSE is active. */
+		if (priv->hw.tx_pause_active)
+			rx_data |= ENETC_RBMR_CM;
+		else
+			rx_data &= ~(uint32_t)ENETC_RBMR_CM;
 		enetc4_rxbdr_wr(&priv->hw.hw, rx_ring->index, ENETC_RBMR,
 			       rx_data);
 		dev->data->rx_queue_state[qidx] = RTE_ETH_QUEUE_STATE_STARTED;
drivers/net/enetc/enetc4_vf.c +56 -3

87 lines not on this page · raw message

Signature · 1 line
2.25.1
#30 lore raw

PATCH v2 14/14 net/enetc4: add WRR Tx scheduler devarg for VF rings

In reply to Gagandeep Singh

Add enetc4_txq_wrr devarg to configure per-ring WRR weights in the NETC LEAF-level Tx scheduler (TBaMR register, bits [6:4]).

The NETC Tx scheduler has three levels:
- ROOT (port/TC): strict priority + CBS (PF/port space)
- MID (SI/VSI): WBFS shaping (PF space)
- LEAF (Tx BDR): strict priority + frame-based WRR (VF/SI space)

TBaMR is in the VF own SI space, so no Linux PF involvement is needed for PRIO or WRR configuration.

Changes:
- enetc_hw.h: add ENETC_TBMR_WRR_MASK, ENETC_TBMR_WRR(n) macros for TBaMR bits [6:4], and ENETC_TBMR_PRIO_MASK for bits [2:0]
- enetc.h: add txq_wrr pointer to enetc_eth_hw struct
- enetc4_ethdev.c: add parse_txq_wrr() and wire ENETC4_TXQ_WRR devarg through enetc4_get_devargs() and enetc4_dev_configure(); apply WRR bits in enetc4_tx_queue_setup() and enetc4_tx_queue_start()

Usage:

  # strict priority: ring 0 highest
  -a 0002:00:12.0,enetc4_txq_prior="3|2|1"

# WRR 2:4:1 on same-priority rings
-a 0002:00:12.0,enetc4_txq_prior="1|1|1",enetc4_txq_wrr="2|4|1"

---
 doc/guides/rel_notes/release_26_11.rst |  1 +
 drivers/net/enetc/base/enetc_hw.h      |  5 ++
 drivers/net/enetc/enetc.h              |  1 +
 drivers/net/enetc/enetc4_ethdev.c      | 97 ++++++++++++++++++++------
 4 files changed, 82 insertions(+), 22 deletions(-)
doc/guides/rel_notes/release_26_11.rst +1 -0
index d69888aafb..3ea34523fe 100644
@@ -73,6 +73,7 @@ New Features
   * Added SI-based port VLAN insertion (Tx) and removal (Rx) for ENETC4 PF and VF.
   * Updated ENETC4 VF link status reporting to use bitmask encoding.
   * Added TX PAUSE support for the ENETC4 VF via RX congestion mode.
+  * Added WRR Tx scheduler devarg (``enetc4_txq_wrr``) for ENETC4 VF ring weights.
 
 Removed Items
 -------------
drivers/net/enetc/base/enetc_hw.h +5 -0
index 33d075fe59..5a71f01db9 100644
@@ -86,6 +86,11 @@ enum enetc_bdr_type {TX, RX};
 
 #define ENETC_RTBLENR_LEN(n)		((n) & ~0x7)
 #define ENETC_TBMR_EN			BIT(31)
+/* TBaMR[WRR] bits [6:4]: weight for same-priority ring arbitration (0=1x .. 7=8x). */
+#define ENETC_TBMR_WRR_MASK		GENMASK(6, 4)
+#define ENETC_TBMR_WRR(n)		((((n) - 1) & 0x7) << 4)
+/* TBaMR[PRIO] bits [2:0]: strict priority (0=lowest, 7=highest). */
+#define ENETC_TBMR_PRIO_MASK		GENMASK(2, 0)
 
 /* Port regs, offset: 1_0000h */
 #define ENETC_PORT_BASE			0x10000
drivers/net/enetc/enetc.h +1 -0
index 8aaf8a7eb1..e0943d093a 100644
@@ -134,6 +134,7 @@ struct enetc_eth_hw {
 	uint32_t vsi_timeout; /* VSI-PSI message wait timeout (iterations) */
 	uint32_t vsi_delay;   /* VSI-PSI message wait delay (us) */
 	uint32_t *txq_prior;  /* per-queue TX priority (TBMR priority bits) */
+	uint32_t *txq_wrr;    /* per-queue TX WRR weight pre-shifted for TBMR[WRR] */
 	uint8_t nc_mode;      /* 1 = non-cacheable BD memory, use _nc ops */
 	uint8_t rxq_intr_en;  /* 1 = per-queue Rx MSI-X interrupts enabled */
 	/* 1 = legacy PF-to-VF link message layout (4-bit speed / 4-bit cookie),
drivers/net/enetc/enetc4_ethdev.c +75 -22

168 lines not on this page · raw message

Signature · 1 line
2.25.1
#31 lore raw

v3 cover net/enetc: add new features for ENETC4 VF on i.MX9

In reply to Gagandeep Singh

V3-changes:
- fix doc build issue.
- fix compilation issue on fedore:43-gcc-minsize

V2-changes:
- compilation fixes.

V1-changes:
This series adds new PMD features to the ENETC4 driver targeting the NXP i.MX95 NETC IP.

The series covers:

- KEEP_CRC Rx offload: preserve the Ethernet FCS in the receive buffer.
- TSO: TCP Segmentation Offload for the VF Tx path.
- RSC/LRO: hardware Receive Segment Coalesce for PF and VF Rx paths.
- Link speed code: extend the PF-to-VF mailbox field from 4-bit to 8-bit to support speeds beyond 10G.
- Firmware version: report the NETC IP version via fw_version_get.
- Register dump: dump SI, port (PF) and BD ring registers.
- Ring parameters: implement rxq_info_get / txq_info_get for the VF.
- Link-up interrupt: refresh the cached link speed on each VF link-up interrupt so that link_update returns the current speed immediately.
- Stats reset: software snapshot/delta approach for VF counter reset.
- Per-queue Rx interrupt: MSI-X per-queue Rx interrupts for the VF, enabling interrupt-driven receive with l3fwd-power.
- SI VLAN: hardware port VLAN insertion/removal for PF and VF.
- VF link status bitmask: switch VF link status to bitmask encoding to align with the PF and newer kernel driver conventions.
- TX PAUSE: VF sets Rx congestion mode when the PF signals TX PAUSE negotiated on the wire; adds Flow control = Y to enetc4.ini.
- WRR Tx scheduler: per-ring WRR weights via enetc4_txq_wrr devarg.

Gagandeep Singh (14):
net/enetc: add KEEP_CRC offload support for ENETC4 net/enetc: add TSO support for ENETC4 VF
net/enetc: add RSC (hardware LRO) support for ENETC4 net/enetc: extend link speed code field to 8-bit for PF-to-VF message net/enetc: support firmware version get for VF
net/enetc: support registers dump
net/enetc: support ethtool ring parameters
net/enetc: refresh link speed on VF link-up interrupt net/enetc: support stats reset for VF
net/enetc4: add per-queue Rx interrupt support for VF net/enetc4: add SI-based port VLAN insertion and removal net/enetc4: update VF link status to bitmask encoding net/enetc4: enable TX PAUSE via VF RX congestion mode net/enetc4: add WRR Tx scheduler devarg for VF rings

 doc/guides/nics/enetc4.rst             |  81 ++-
 doc/guides/nics/features/enetc4.ini    |   8 +
 doc/guides/rel_notes/release_26_11.rst |  19 +
 drivers/net/enetc/base/enetc4_hw.h     | 129 +++-
 drivers/net/enetc/base/enetc_hw.h      |   6 +
 drivers/net/enetc/enetc.h              | 135 ++++-
 drivers/net/enetc/enetc4_ethdev.c      | 402 +++++++++++--
 drivers/net/enetc/enetc4_vf.c          | 779 ++++++++++++++++++++++---
 drivers/net/enetc/enetc_rxtx.c         | 529 ++++++++++++++++-
 9 files changed, 1942 insertions(+), 146 deletions(-)
Signature · 1 line
2.25.1
#32 lore raw

PATCH v3 1/14 net/enetc: add KEEP_CRC offload support for ENETC4

The legacy ENETC (LS1028A) driver already supports the RTE_ETH_RX_OFFLOAD_KEEP_CRC offload, but ENETC4 (i.MX95 NETC) did not.

Add KEEP_CRC support for ENETC4 (both PF and VF):

- Advertise RTE_ETH_RX_OFFLOAD_KEEP_CRC in the supported Rx offloads for the ENETC4 PF and VF. The VF reuses the PF Rx queue setup, so the HW configuration and datapath handling apply to both.
- Configure the per-ring RBaMR[CRC] bit in the Rx queue setup so that HW preserves the Ethernet FCS in the receive buffer when the offload is requested (0 = FCS removed, 1 = FCS preserved).
- Follow the DPDK convention used by the legacy ENETC and ixgbe drivers:
set crc_len to RTE_ETHER_CRC_LEN when KEEP_CRC is enabled and have the datapath subtract crc_len from pkt_len/data_len. ENETC and ENETC4 share the same datapath (enetc_rxtx.c), so the semantics stay consistent.
- Handle the scatter-gather boundary case where the 4-byte FCS straddles the last two segments: drop the trailing segment, decrement nb_segs and trim the carry-over from its predecessor.

Update the enetc4 feature matrix to list CRC offload.

---
 doc/guides/nics/features/enetc4.ini    |  1 +
 doc/guides/rel_notes/release_26_11.rst |  6 ++++
 drivers/net/enetc/base/enetc4_hw.h     |  4 +++
 drivers/net/enetc/enetc4_ethdev.c      | 31 ++++++++++++++++++--
 drivers/net/enetc/enetc4_vf.c          |  1 +
 drivers/net/enetc/enetc_rxtx.c         | 39 +++++++++++++++++++++++---
 6 files changed, 75 insertions(+), 7 deletions(-)
doc/guides/nics/features/enetc4.ini +1 -0
index 698140e30b..91b18d979e 100644
@@ -16,6 +16,7 @@ Packet type parsing  = Y
 Basic stats          = Y
 L3 checksum offload  = Y
 L4 checksum offload  = Y
+CRC offload          = Y
 Queue start/stop     = Y
 Scattered Rx         = Y
 Linux                = Y
doc/guides/rel_notes/release_26_11.rst +6 -0
index c8cc86295d..3678dd6894 100644
@@ -56,6 +56,12 @@ New Features
      =======================================================
 
 
+* **Updated NXP ENETC4 PMD.**
+
+  Updated the NXP ENETC4 poll mode driver for i.MX95:
+
+  * Added KEEP_CRC Rx offload support for the ENETC4 PMD to preserve the Ethernet FCS.
+
 Removed Items
 -------------
 
drivers/net/enetc/base/enetc4_hw.h +4 -0
index 9685e7e1e5..0105549857 100644
@@ -68,6 +68,10 @@ struct enetc_msg_swbd {
 #define PM_CMD_CFG_TX_EN		BIT(0)
 #define PM_CMD_CFG_RX_EN		BIT(1)
 
+/* RBaMR[CRC]: 0 = FCS removed, 1 = FCS preserved (KEEP_CRC) */
+#define ENETC4_RBMR_CRC			BIT(8)
+
+
 /* i.MX95 supports jumbo frame, but it is recommended to set the max frame
  * size to 2000 bytes.
  */
drivers/net/enetc/enetc4_ethdev.c +28 -3
index 2ddd63dafb..1a8056580c 100644
@@ -11,6 +11,19 @@
 #include "enetc_logs.h"
 #include "enetc.h"
 
+/* Supported Rx offloads */
+static uint64_t dev_rx_offloads_sup =
+	RTE_ETH_RX_OFFLOAD_IPV4_CKSUM |
+	RTE_ETH_RX_OFFLOAD_UDP_CKSUM |
+	RTE_ETH_RX_OFFLOAD_TCP_CKSUM |
+	RTE_ETH_RX_OFFLOAD_KEEP_CRC;
+
+/* Supported Tx offloads */
+static uint64_t dev_tx_offloads_sup =
+	RTE_ETH_TX_OFFLOAD_IPV4_CKSUM |
+	RTE_ETH_TX_OFFLOAD_UDP_CKSUM |
+	RTE_ETH_TX_OFFLOAD_TCP_CKSUM;
+
 #define ENETC4_TXQ_PRIORITIES	"enetc4_txq_prior"
 #define ENETC4_NC_MEMORY	"nc"
 
@@ -536,6 +549,8 @@ enetc4_rx_queue_setup(struct rte_eth_dev *dev,
 	struct enetc_eth_adapter *adapter =
 			ENETC_DEV_PRIVATE(data->dev_private);
 	uint64_t rx_offloads = data->dev_conf.rxmode.offloads;
+	uint32_t rx_enable;
+	bool keep_crc;
 
 	PMD_INIT_FUNC_TRACE();
 	if (nb_rx_desc > MAX_BD_COUNT)
@@ -549,6 +564,9 @@ enetc4_rx_queue_setup(struct rte_eth_dev *dev,
 	}
 
 	rx_ring->index = rx_queue_id;
+	keep_crc = !!(rx_offloads & RTE_ETH_RX_OFFLOAD_KEEP_CRC);
+	rx_ring->crc_len = (uint8_t)(keep_crc ? RTE_ETHER_CRC_LEN : 0);
+
 	err = enetc4_alloc_rxbdr(rx_ring, nb_rx_desc);
 	if (err)
 		goto fail;
@@ -562,19 +580,25 @@ enetc4_rx_queue_setup(struct rte_eth_dev *dev,
 	data->rx_queues[rx_queue_id] = rx_ring;
 	rx_ring->rx_deferred_start = rx_conf->rx_deferred_start;
 
+	if (keep_crc)
+		rx_enable |= ENETC4_RBMR_CRC;
+	else
+		rx_enable &= ~ENETC4_RBMR_CRC;
+
 	if (!rx_conf->rx_deferred_start) {
 		/* enable ring */
+		rx_enable |= ENETC_RBMR_EN;
 		enetc4_rxbdr_wr(&adapter->hw.hw, rx_ring->index, ENETC_RBMR,
-			       ENETC_RBMR_EN);
+			       rx_enable);
 		dev->data->rx_queue_state[rx_ring->index] =
 			       RTE_ETH_QUEUE_STATE_STARTED;
 	} else {
+		enetc4_rxbdr_wr(&adapter->hw.hw, rx_ring->index, ENETC_RBMR,
+			       rx_enable);
 		dev->data->rx_queue_state[rx_ring->index] =
 			       RTE_ETH_QUEUE_STATE_STOPPED;
 	}
 
-	rx_ring->crc_len = (uint8_t)((rx_offloads & RTE_ETH_RX_OFFLOAD_KEEP_CRC) ?
-				     RTE_ETHER_CRC_LEN : 0);
 	return 0;
 fail:
 	rte_free(rx_ring);
@@ -582,6 +606,7 @@ enetc4_rx_queue_setup(struct rte_eth_dev *dev,
 	return err;
 }
 
+
 void
 enetc4_rx_queue_release(struct rte_eth_dev *dev, uint16_t qid)
 {
drivers/net/enetc/enetc4_vf.c +1 -0
index ef5f1e6d66..83a1e4931f 100644
@@ -52,6 +52,7 @@ static uint64_t dev_rx_offloads_sup =
 	RTE_ETH_RX_OFFLOAD_UDP_CKSUM |
 	RTE_ETH_RX_OFFLOAD_TCP_CKSUM |
 	RTE_ETH_RX_OFFLOAD_VLAN_FILTER |
+	RTE_ETH_RX_OFFLOAD_KEEP_CRC |
 	RTE_ETH_RX_OFFLOAD_SCATTER;
 
 /* Supported Tx offloads */
drivers/net/enetc/enetc_rxtx.c +35 -4
index 8678bafece..e3bef607dd 100644
@@ -530,6 +530,28 @@ enetc_clean_rx_ring(struct enetc_bdr *rx_ring,
 	return rx_frm_cnt;
 }
 
+/*
+ * Trim the Ethernet FCS from a received cluster when HW CRC strip is
+ * disabled. pkt_len is reduced by crc_len. If the FCS straddles the last
+ * two segments (last seg holds fewer bytes than crc_len), drop the trailing
+ * segment and trim the carry-over from its predecessor. prev_seg is the
+ * segment preceding last_seg in the chain (the caller already tracks it).
+ */
+static inline void
+enetc_rx_crc_trim(struct rte_mbuf *first_seg, struct rte_mbuf *prev_seg,
+		  struct rte_mbuf *last_seg, uint16_t crc_len)
+{
+	first_seg->pkt_len -= crc_len;
+	if (likely(last_seg->data_len > crc_len)) {
+		last_seg->data_len -= crc_len;
+	} else if (prev_seg != NULL) {
+		first_seg->nb_segs--;
+		prev_seg->data_len -= crc_len - last_seg->data_len;
+		prev_seg->next = NULL;
+		rte_pktmbuf_free_seg(last_seg);
+	}
+}
+
 static int
 enetc_clean_rx_ring_nc(struct enetc_bdr *rx_ring,
 		    struct rte_mbuf **rx_pkts,
@@ -539,7 +561,7 @@ enetc_clean_rx_ring_nc(struct enetc_bdr *rx_ring,
 	int cleaned_cnt, i;
 	struct enetc_swbd *rx_swbd;
 	union enetc_rx_bd *rxbd, rxbd_temp;
-	struct rte_mbuf *first_seg, *cur_seg;
+	struct rte_mbuf *first_seg = NULL, *cur_seg = NULL;
 	uint32_t bd_status;
 	uint8_t *data;
 	uint32_t j;
@@ -572,6 +594,7 @@ enetc_clean_rx_ring_nc(struct enetc_bdr *rx_ring,
 		if (!first_seg) {
 			first_seg = seg;
 			cur_seg = seg;
+			prev_seg = NULL;
 			first_seg->pkt_len = data_len;
 			enetc_dev_rx_parse(first_seg, rxbd_temp.r.parse_summary);
 			first_seg->hash.rss = rxbd_temp.r.rss_hash;
@@ -579,6 +602,7 @@ enetc_clean_rx_ring_nc(struct enetc_bdr *rx_ring,
 			first_seg->pkt_len += data_len;
 			first_seg->nb_segs++;
 			cur_seg->next = seg;
+			prev_seg = cur_seg;
 			cur_seg = seg;
 		}
 
@@ -590,7 +614,9 @@ enetc_clean_rx_ring_nc(struct enetc_bdr *rx_ring,
 
 		if (bd_status & ENETC_RXBD_LSTATUS_F) {
 			seg->next = NULL;
-			first_seg->pkt_len -= rx_ring->crc_len;
+			if (rx_ring->crc_len)
+				enetc_rx_crc_trim(first_seg, prev_seg, seg,
+						  rx_ring->crc_len);
 			rx_pkts[rx_frm_cnt] = first_seg;
 			rx_frm_cnt++;
 			first_seg = NULL;
@@ -760,7 +786,7 @@ enetc_clean_rx_ring_cacheable(struct enetc_bdr *rx_ring,
 	int cleaned_cnt, i;
 	struct enetc_swbd *rx_swbd;
 	union enetc_rx_bd *rxbd;
-	struct rte_mbuf *first_seg, *cur_seg;
+	struct rte_mbuf *first_seg = NULL, *cur_seg = NULL;
 	uint32_t bd_status;
 	uint8_t *data;
 	uint32_t j;
@@ -815,6 +841,7 @@ enetc_clean_rx_ring_cacheable(struct enetc_bdr *rx_ring,
 		if (!first_seg) {
 			first_seg = seg;
 			cur_seg = seg;
+			prev_seg = NULL;
 			first_seg->pkt_len = data_len;
 			enetc_dev_rx_parse(first_seg,
 					   rxbd->r.parse_summary);
@@ -823,6 +850,7 @@ enetc_clean_rx_ring_cacheable(struct enetc_bdr *rx_ring,
 			first_seg->pkt_len += data_len;
 			first_seg->nb_segs++;
 			cur_seg->next = seg;
+			prev_seg = cur_seg;
 			cur_seg = seg;
 		}
 
@@ -838,7 +866,10 @@ enetc_clean_rx_ring_cacheable(struct enetc_bdr *rx_ring,
 
 		if (bd_status & ENETC_RXBD_LSTATUS_F) {
 			seg->next = NULL;
-			first_seg->pkt_len -= rx_ring->crc_len;
+			if (rx_ring->crc_len)
+				enetc_rx_crc_trim(first_seg, prev_seg, seg,
+						  rx_ring->crc_len);
+
 			rx_pkts[rx_frm_cnt] = first_seg;
 			rx_frm_cnt++;
 			first_seg = NULL;
Signature · 1 line
2.25.1
#33 lore raw

PATCH v3 2/14 net/enetc: add TSO support for ENETC4 VF

In reply to Gagandeep Singh

Add TCP and UDP segmentation offload (TSO) for the ENETC4 virtual function. The offload is advertised through the VF Tx capabilities and is enabled on a per-queue basis when an application requests the TSO offload flags during Tx queue setup.

A dedicated Tx burst, enetc_xmit_pkts_lso(), builds the large-send descriptor chain: a standard header BD, a 16B extension BD carrying the segment size and frame length extension, and one BD per payload buffer with the final-frame flag on the last BD. To make room for the extra extension BD, an LSO-enabled Tx ring is allocated with twice the number of descriptors. The existing non-TSO Tx paths are left unchanged.

Update the ENETC4 feature list and documentation accordingly.

---
 doc/guides/nics/enetc4.rst             |   2 +
 doc/guides/nics/features/enetc4.ini    |   1 +
 doc/guides/rel_notes/release_26_11.rst |   1 +
 drivers/net/enetc/base/enetc4_hw.h     |  35 +++-
 drivers/net/enetc/enetc.h              |   5 +
 drivers/net/enetc/enetc4_ethdev.c      |  45 ++++-
 drivers/net/enetc/enetc4_vf.c          |   2 +
 drivers/net/enetc/enetc_rxtx.c         | 255 +++++++++++++++++++++++++
 8 files changed, 341 insertions(+), 5 deletions(-)
doc/guides/nics/enetc4.rst +2 -0
index f0dd039f6e..4d27e4048e 100644
@@ -53,6 +53,8 @@ Key functionality includes:
 - Receive processing: Upon packet reception, the BD Ring status bit is set,
   facilitating packet processing.
 - Transmission: Packet transmission precedes reception, ensuring efficient data transfer.
+- TCP and UDP segmentation offload (TSO) on VFs, enabled per Tx queue
+  when the TSO offload flag is requested.
 
 
 Prerequisites
doc/guides/nics/features/enetc4.ini +1 -0
index 91b18d979e..8ec1e8d00f 100644
@@ -7,6 +7,7 @@
 Link status event    = Y
 Speed capabilities   = Y
 Link status          = Y
+TSO                  = Y
 Promiscuous mode     = Y
 Allmulticast mode    = Y
 Unicast MAC filter   = Y
doc/guides/rel_notes/release_26_11.rst +1 -0
index 3678dd6894..6a348ab4e0 100644
@@ -61,6 +61,7 @@ New Features
   Updated the NXP ENETC4 poll mode driver for i.MX95:
 
   * Added KEEP_CRC Rx offload support for the ENETC4 PMD to preserve the Ethernet FCS.
+  * Added TCP Segmentation Offload (TSO) support for the ENETC4 VF.
 
 Removed Items
 -------------
drivers/net/enetc/base/enetc4_hw.h +34 -1
index 0105549857..64c1a5e750 100644
@@ -1,5 +1,5 @@
 /* SPDX-License-Identifier: BSD-3-Clause
- * Copyright 2024 NXP
+ * Copyright 2024-2026 NXP
  *
  * This header file defines the register offsets and bit fields
  * of ENETC4 PF and VFs.
@@ -24,8 +24,14 @@ struct enetc_msg_swbd {
 
 /* enetc4 txbd flags */
 #define ENETC4_TXBD_FLAGS_L4CS		BIT(0)
+/* Request LSO (Large Send Offload) segmentation for this frame */
+#define ENETC4_TXBD_FLAGS_LSO		BIT(1)
+/* L4 checksum insertion (also used for checksum update on LSO) */
 #define ENETC4_TXBD_FLAGS_L_TX_CKSUM	BIT(3)
+/* Extended descriptor: the next 16B ring entry is an extension BD */
+#define ENETC4_TXBD_FLAGS_EXT		BIT(6)
 #define ENETC4_TXBD_FLAGS_F		BIT(7)
+
 /* L4 type */
 #define ENETC4_TXBD_L4T_UDP		BIT(0)
 #define ENETC4_TXBD_L4T_TCP		BIT(1)
@@ -34,6 +40,33 @@ struct enetc_msg_swbd {
 /* IPv4 checksum */
 #define ENETC4_TXBD_IPCS		1
 
+/*
+ * Extension Transmit Buffer Descriptor (16B). When the standard BD has the
+ * extended flag set, this occupies the next ring entry and carries the extra
+ * fields required by LSO.
+ */
+struct enetc_tx_bd_ext {
+	uint32_t timestamp;	/* PTP timestamp, unused for LSO */
+	uint32_t vlan;		/* VLAN insert, unused for LSO */
+	uint32_t lso;		/* LSO_MAX_SEG_SIZE and FRM_LEN_EXT */
+	uint32_t flags;		/* extension flags */
+};
+
+/* LSO_MAX_SEG_SIZE occupies bits 13-0 of the LSO word */
+#define ENETC4_TXBD_EXT_LSO_SEG_MASK	0x3fff
+#define ENETC4_TXBD_EXT_LSO_SEG(mss) \
+		((uint32_t)((mss) & ENETC4_TXBD_EXT_LSO_SEG_MASK))
+/* FRM_LEN_EXT occupies bits 19-16 of the LSO word (top 4 bits of data len) */
+#define ENETC4_TXBD_EXT_FRM_LEN_EXT(x) \
+		(((uint32_t)((x) & 0xf)) << 16)
+/* Final flag in the extension flags word (bit 127 -> local bit 31) */
+#define ENETC4_TXBD_EXT_FLAGS_F		BIT(31)
+
+/* NETC does not create LSO frames larger than this many bytes */
+#define ENETC4_LSO_MAX_FRAME		9600
+/* Maximum LSO data unit (payload to be segmented) supported by HW: 256KB */
+#define ENETC4_LSO_MAX_DATA_UNIT	(256 * 1024)
+
 /***************************ENETC port registers**************************/
 #define ENETC4_PMR		0x10
 #define ENETC4_PMR_EN		(BIT(16) | BIT(17) | BIT(18))
drivers/net/enetc/enetc.h +5 -0
index d3a8b8e34a..db349e051b 100644
@@ -91,6 +91,7 @@ struct enetc_bdr {
 		void *tcisr; /* Tx */
 		int next_to_alloc; /* Rx */
 	};
+
 	struct rte_mempool *mb_pool;   /* mbuf pool to populate RX ring. */
 	/* Partial scatter-gather chain persisted across burst calls. */
 	struct rte_mbuf *pkt_first_seg; /* first segment of in-progress frame */
@@ -99,6 +100,7 @@ struct enetc_bdr {
 	uint64_t ierrors;
 	uint8_t rx_deferred_start;
 	uint8_t tx_deferred_start;
+	uint8_t lso_enable;
 };
 
 struct enetc_eth_hw {
@@ -312,6 +314,9 @@ uint16_t enetc_xmit_pkts(void *txq, struct rte_mbuf **tx_pkts,
 		uint16_t nb_pkts);
 uint16_t enetc_xmit_pkts_nc(void *txq, struct rte_mbuf **tx_pkts,
 		uint16_t nb_pkts);
+uint16_t enetc_xmit_pkts_lso(void *txq, struct rte_mbuf **tx_pkts,
+		uint16_t nb_pkts);
+
 uint16_t enetc_recv_pkts(void *rxq, struct rte_mbuf **rx_pkts,
 		uint16_t nb_pkts);
 uint16_t enetc_recv_pkts_nc(void *rxq, struct rte_mbuf **rx_pkts,
drivers/net/enetc/enetc4_ethdev.c +41 -4

94 lines not on this page · raw message

drivers/net/enetc/enetc4_vf.c +2 -0
index 83a1e4931f..3083a56335 100644
@@ -60,6 +60,8 @@ static uint64_t dev_tx_offloads_sup =
 	RTE_ETH_TX_OFFLOAD_IPV4_CKSUM |
 	RTE_ETH_TX_OFFLOAD_UDP_CKSUM |
 	RTE_ETH_TX_OFFLOAD_TCP_CKSUM |
+	RTE_ETH_TX_OFFLOAD_TCP_TSO |
+	RTE_ETH_TX_OFFLOAD_UDP_TSO |
 	RTE_ETH_TX_OFFLOAD_MULTI_SEGS;
 
 static void
drivers/net/enetc/enetc_rxtx.c +255 -0

261 lines not on this page · raw message

Signature · 1 line
2.25.1
#34 lore raw

PATCH v3 3/14 net/enetc: add RSC (hardware LRO) support for ENETC4

In reply to Gagandeep Singh

Add Receive Segment Coalesce (RSC) support, exposed as the DPDK RTE_ETH_RX_OFFLOAD_TCP_LRO Rx offload, for the ENETC4 PF and VF on i.MX95. RSC lets the HW coalesce multiple in-order TCP segments of a flow into a single receive frame, reducing per-packet overhead.

RSC is a port-level offload driven by a dedicated Rx burst (enetc_recv_pkts_rsc). When TCP LRO is requested the ring is switched to 32B extended receive descriptors (RBaMR[BDS] = 1), the FCS is stripped (RBaMR[CRC] = 0, so RSC is incompatible with KEEP_CRC), interrupt coalescing is enabled (RBaICR0[ICEN] with a non-zero RBaICR1[ICTT] hold timer that doubles as the RSC flush window), and RBaRSCR[EN] is set with the coalesced-frame size clamped to the HW maximum.

Because a 32B descriptor spans two 16B ring slots, the ring length register (RBaLENR) and the consumer-index register are programmed in HW-descriptor units (slot count / 2), while the internal SW indices continue to track 16B slots. Coalesced clusters are delivered with the RTE_MBUF_F_RX_LRO flag set when RSC_FRAMES > 1.

---
 doc/guides/nics/enetc4.rst             |   4 +
 doc/guides/nics/features/enetc4.ini    |   1 +
 doc/guides/rel_notes/release_26_11.rst |   1 +
 drivers/net/enetc/base/enetc4_hw.h     |  74 ++++++++
 drivers/net/enetc/enetc.h              |   5 +
 drivers/net/enetc/enetc4_ethdev.c      | 102 ++++++++++-
 drivers/net/enetc/enetc4_vf.c          |   1 +
 drivers/net/enetc/enetc_rxtx.c         | 239 ++++++++++++++++++++++++-
 8 files changed, 418 insertions(+), 9 deletions(-)
doc/guides/nics/enetc4.rst +4 -0
index 4d27e4048e..e7f4348603 100644
@@ -55,6 +55,10 @@ Key functionality includes:
 - Transmission: Packet transmission precedes reception, ensuring efficient data transfer.
 - TCP and UDP segmentation offload (TSO) on VFs, enabled per Tx queue
   when the TSO offload flag is requested.
+- Large receive offload (LRO) on the receive path via hardware Receive
+  Segment Coalesce (RSC), enabled when the TCP LRO Rx offload flag is
+  requested. RSC requires the FCS to be stripped, so it cannot be combined
+  with the KEEP_CRC Rx offload.
 
 
 Prerequisites
doc/guides/nics/features/enetc4.ini +1 -0
index 8ec1e8d00f..aae398e210 100644
@@ -7,6 +7,7 @@
 Link status event    = Y
 Speed capabilities   = Y
 Link status          = Y
+LRO                  = Y
 TSO                  = Y
 Promiscuous mode     = Y
 Allmulticast mode    = Y
doc/guides/rel_notes/release_26_11.rst +1 -0
index 6a348ab4e0..0dd08e0259 100644
@@ -62,6 +62,7 @@ New Features
 
   * Added KEEP_CRC Rx offload support for the ENETC4 PMD to preserve the Ethernet FCS.
   * Added TCP Segmentation Offload (TSO) support for the ENETC4 VF.
+  * Added Receive Segment Coalesce (RSC / hardware LRO) support for ENETC4 PF and VF.
 
 Removed Items
 -------------
drivers/net/enetc/base/enetc4_hw.h +74 -0

81 lines not on this page · raw message

drivers/net/enetc/enetc.h +5 -0
index db349e051b..67f8ce1919 100644
@@ -101,6 +101,8 @@ struct enetc_bdr {
 	uint8_t rx_deferred_start;
 	uint8_t tx_deferred_start;
 	uint8_t lso_enable;
+	void *rbidr;
+	uint8_t rsc_enable;
 };
 
 struct enetc_eth_hw {
@@ -321,12 +323,15 @@ uint16_t enetc_recv_pkts(void *rxq, struct rte_mbuf **rx_pkts,
 		uint16_t nb_pkts);
 uint16_t enetc_recv_pkts_nc(void *rxq, struct rte_mbuf **rx_pkts,
 		uint16_t nb_pkts);
+uint16_t enetc_recv_pkts_rsc(void *rxq, struct rte_mbuf **rx_pkts,
+		uint16_t nb_pkts);
 uint16_t enetc_xmit_pkts_cacheable(void *txq, struct rte_mbuf **tx_pkts,
 		uint16_t nb_pkts);
 uint16_t enetc_recv_pkts_cacheable(void *rxq, struct rte_mbuf **rx_pkts,
 		uint16_t nb_pkts);
 
 int enetc_refill_rx_ring(struct enetc_bdr *rx_ring, const int buff_cnt);
+int enetc_refill_rx_ring_rsc(struct enetc_bdr *rx_ring, const int buff_cnt);
 
 /*
  * Cache-maintenance constants for cacheable BD ring mode.
drivers/net/enetc/enetc4_ethdev.c +95 -7

169 lines not on this page · raw message

drivers/net/enetc/enetc4_vf.c +1 -0
index 3083a56335..be79a18a39 100644
@@ -53,6 +53,7 @@ static uint64_t dev_rx_offloads_sup =
 	RTE_ETH_RX_OFFLOAD_TCP_CKSUM |
 	RTE_ETH_RX_OFFLOAD_VLAN_FILTER |
 	RTE_ETH_RX_OFFLOAD_KEEP_CRC |
+	RTE_ETH_RX_OFFLOAD_TCP_LRO |
 	RTE_ETH_RX_OFFLOAD_SCATTER;
 
 /* Supported Tx offloads */
drivers/net/enetc/enetc_rxtx.c +237 -2

257 lines not on this page · raw message

Signature · 1 line
2.25.1
#35 lore raw

PATCH v3 4/14 net/enetc: extend link speed code field to 8-bit for PF-to-VF message

In reply to Gagandeep Singh

The PF-to-VF message is only 16-bit wide, where the upper 8-bit is the class_id and the lower 8-bit carries the message content. For the link speed message, the lower 4-bit was previously occupied by the cookie field, leaving only 4-bit for the speed code, which allows at most 15 distinct speed values.

As the NETC IP evolves and supports more and more link speeds, 15 speed values are clearly insufficient. Since the cookie field is designed for non-blocking messages and has no meaningful use in link speed messages, remove it and expand the speed code field from 4-bit to 8-bit, allowing up to 255 speed values (ENETC_SPEED_MAX = 0xff).

Instead of enumerating every speed value greater than 5Gbps explicitly, introduce a formula-based approach:

	speed_code = (link_speed - 5000) / 1000 + ENETC_SPEED_5000

This removes the explicit enum entries for 10G, 25G, 50G and 100G, and replaces the individual switch-case branches with a generic implementation to get the speed, making it easy to support any future high speed without modifying the enum or the switch statement.

For backward compatibility with a PF running an older kernel (before 6.18.37) that still uses the legacy 4-bit speed code / 4-bit cookie message layout, add a "vf_link_legacy" devarg. When set to 1, the VF extracts the message result from the upper 4 bits of the lower byte and decodes speeds greater than 5Gbps using the legacy fixed class codes (10G/25G/50G/100G). The default (0) uses the new 8-bit layout.

	Usage: -a <pci_addr>,vf_link_legacy=1
---
 doc/guides/rel_notes/release_26_11.rst |   1 +
 drivers/net/enetc/enetc.h              |  32 ++++-
 drivers/net/enetc/enetc4_vf.c          | 175 +++++++++++++++++++++----
 3 files changed, 175 insertions(+), 33 deletions(-)
doc/guides/rel_notes/release_26_11.rst +1 -0
index 0dd08e0259..d7961d3c85 100644
@@ -63,6 +63,7 @@ New Features
   * Added KEEP_CRC Rx offload support for the ENETC4 PMD to preserve the Ethernet FCS.
   * Added TCP Segmentation Offload (TSO) support for the ENETC4 VF.
   * Added Receive Segment Coalesce (RSC / hardware LRO) support for ENETC4 PF and VF.
+  * Extended the PF-to-VF link speed code field from 4-bit to 8-bit in ENETC4.
 
 Removed Items
 -------------
drivers/net/enetc/enetc.h +27 -5
index 67f8ce1919..c983cb059e 100644
@@ -120,6 +120,10 @@ struct enetc_eth_hw {
 	uint32_t vsi_delay;   /* VSI-PSI message wait delay (us) */
 	uint32_t *txq_prior;  /* per-queue TX priority (TBMR priority bits) */
 	uint8_t nc_mode;      /* 1 = non-cacheable BD memory, use _nc ops */
+	/* 1 = legacy PF-to-VF link message layout (4-bit speed / 4-bit cookie),
+	 * for PF kernel versions before 6.18.37. Set via vf_link_legacy devarg.
+	 */
+	uint8_t vf_link_legacy;
 };
 
 /*
@@ -211,11 +215,29 @@ enum speed {
 	ENETC_SPEED_1000 = 0x5,
 	ENETC_SPEED_2500 = 0x6,
 	ENETC_SPEED_5000 = 0x7,
-	ENETC_SPEED_10G = 0x8,
-	ENETC_SPEED_25G = 0x9,
-	ENETC_SPEED_50G = 0xA,
-	ENETC_SPEED_100G = 0xB,
-	ENETC_SPEED_NOT_SUPPORTED = 0xF
+	/* Base speed class code used by the >5Gbps formula below */
+	/* Do not add enumeration values for any speed greater than
+	 * 5Gbps. For any speed greater than 5Gbps, its speed class
+	 * code should follow the formula below.
+	 *
+	 * SPEED = (link_speed - 5000) / 1000 + ENETC_SPEED_5000
+	 *
+	 * The unit of link_speed should be Mbps, the max SPEED
+	 * should <= ENETC_SPEED_MAX.
+	 */
+	ENETC_SPEED_MAX = 0xff,
+};
+
+/* Legacy speed class codes for backward compatibility with an older kernel PF
+ * (before 6.18.37) that encoded a 4-bit speed code and 4-bit cookie in the
+ * message's lower byte. Used only when the vf_link_legacy devarg is set.
+ */
+enum speed_legacy {
+	ENETC_SPEED_LEGACY_10G = 0x8,
+	ENETC_SPEED_LEGACY_25G = 0x9,
+	ENETC_SPEED_LEGACY_50G = 0xA,
+	ENETC_SPEED_LEGACY_100G = 0xB,
+	ENETC_SPEED_LEGACY_NOT_SUPPORTED = 0xF
 };
 
 /* PSI-VSI command header format */
drivers/net/enetc/enetc4_vf.c +147 -28

248 lines not on this page · raw message

Signature · 1 line
2.25.1
#36 lore raw

PATCH v3 5/14 net/enetc: support firmware version get for VF

In reply to Gagandeep Singh

Implement the ``.fw_version_get`` eth_dev op for the ENETC4 VF PMD to report the NETC IP revision.

The NETC IP major revision is read from the PCI revision ID register, while the IP minor revision is retrieved from the PSI over VSI-PSI messaging using the "Get IP version" command class (class ID 0xF0, command ID 0x1). The version is reported in the "<major>.<minor>" format.

The PSI firmware only implements the IP_MN command of this class, so the major revision is obtained from the PCI revision ID, matching the behaviour of the kernel PF/VF drivers.

---
 doc/guides/nics/enetc4.rst             |   1 +
 doc/guides/nics/features/enetc4.ini    |   1 +
 doc/guides/rel_notes/release_26_11.rst |   1 +
 drivers/net/enetc/enetc.h              |  19 +++-
 drivers/net/enetc/enetc4_vf.c          | 135 +++++++++++++++++++++++++
 5 files changed, 155 insertions(+), 2 deletions(-)
doc/guides/nics/enetc4.rst +1 -0
index e7f4348603..ea0e37896d 100644
@@ -59,6 +59,7 @@ Key functionality includes:
   Segment Coalesce (RSC), enabled when the TCP LRO Rx offload flag is
   requested. RSC requires the FCS to be stripped, so it cannot be combined
   with the KEEP_CRC Rx offload.
+- Firmware version: The NETC IP version is reported via ``rte_eth_dev_fw_version_get``.
 
 
 Prerequisites
doc/guides/nics/features/enetc4.ini +1 -0
index aae398e210..eaf474e7ba 100644
@@ -16,6 +16,7 @@ VLAN filter          = Y
 RSS hash             = Y
 Packet type parsing  = Y
 Basic stats          = Y
+FW version           = Y
 L3 checksum offload  = Y
 L4 checksum offload  = Y
 CRC offload          = Y
doc/guides/rel_notes/release_26_11.rst +1 -0
index d7961d3c85..5ac2bb4de0 100644
@@ -64,6 +64,7 @@ New Features
   * Added TCP Segmentation Offload (TSO) support for the ENETC4 VF.
   * Added Receive Segment Coalesce (RSC / hardware LRO) support for ENETC4 PF and VF.
   * Extended the PF-to-VF link speed code field from 4-bit to 8-bit in ENETC4.
+  * Added firmware version reporting for the ENETC4 VF.
 
 Removed Items
 -------------
drivers/net/enetc/enetc.h +17 -2
index c983cb059e..b1428f1bca 100644
@@ -170,7 +170,8 @@ enum enetc_msg_cmd_class_id {
 	ENETC_CLASS_ID_MAC_FILTER = 0x20,
 	ENETC_CLASS_ID_VLAN_FILTER = 0x21,
 	ENETC_CLASS_ID_LINK_STATUS = 0x80,
-	ENETC_CLASS_ID_LINK_SPEED = 0x81
+	ENETC_CLASS_ID_LINK_SPEED = 0x81,
+	ENETC_CLASS_ID_GET_IP_VER = 0xF0
 };
 
 /* Enum for command IDs */
@@ -184,9 +185,18 @@ enum enetc_msg_cmd_id {
 	ENETC_CMD_ID_GET_LINK_STATUS = 0,
 	ENETC_CMD_ID_REGISTER_LINK_NOTIF = 1,
 	ENETC_CMD_ID_UNREGISTER_LINK_NOTIF = 2,
-	ENETC_CMD_ID_GET_LINK_SPEED = 0
+	ENETC_CMD_ID_GET_LINK_SPEED = 0,
+	/* Get IP version command IDs (class ID 0xF0) */
+	ENETC_CMD_ID_GET_IP_MJ = 0,
+	ENETC_CMD_ID_GET_IP_MN = 1,
+	ENETC_CMD_ID_GET_IP_INT = 2,
+	ENETC_CMD_ID_GET_IP_MNT = 3,
+	ENETC_CMD_ID_GET_IP_CFG = 4
 };
 
+/* IP_VER value returned when the version is not available */
+#define ENETC_IP_VER_NOT_AVAILABLE	0xFF
+
 enum mac_addr_status {
 	ENETC_INVALID_MAC_ADDR = 0x0,
 	ENETC_DUPLICATE_MAC_ADDR = 0X1,
@@ -274,6 +284,11 @@ struct enetc_msg_cmd_get_link_speed {
 	struct enetc_msg_cmd_header header;
 };
 
+/* Get IP version command message format (class ID 0xF0) */
+struct enetc_msg_cmd_get_ip_ver {
+	struct enetc_msg_cmd_header header;
+};
+
 struct enetc_msg_cmd_set_vlan_promisc {
 	struct enetc_msg_cmd_header header;
 	uint8_t op;
drivers/net/enetc/enetc4_vf.c +135 -0

159 lines not on this page · raw message

Signature · 1 line
2.25.1
#37 lore raw

PATCH v3 6/14 net/enetc: support registers dump

In reply to Gagandeep Singh

Implement the .get_reg operation for the ENETC4 PF and VF PMDs to dump the device registers via rte_eth_dev_get_reg_info.

The VF dumps the registers reachable by a virtual station interface (VSI): the station interface and per-ring BD ring registers. Port registers are not accessible by a VF.

The PF additionally dumps the port registers, which are only accessible by the physical station interface (PSI).

---
 doc/guides/nics/enetc4.rst             |  1 +
 doc/guides/nics/features/enetc4.ini    |  1 +
 doc/guides/rel_notes/release_26_11.rst |  1 +
 drivers/net/enetc/enetc.h              | 13 +++++
 drivers/net/enetc/enetc4_ethdev.c      | 70 ++++++++++++++++++++++++++
 drivers/net/enetc/enetc4_vf.c          | 62 +++++++++++++++++++++++
 6 files changed, 148 insertions(+)
doc/guides/nics/enetc4.rst +1 -0
index ea0e37896d..cd757be12f 100644
@@ -60,6 +60,7 @@ Key functionality includes:
   requested. RSC requires the FCS to be stripped, so it cannot be combined
   with the KEEP_CRC Rx offload.
 - Firmware version: The NETC IP version is reported via ``rte_eth_dev_fw_version_get``.
+- Registers dump: The station interface, port (PF only) and BD ring registers are dumped via ``rte_eth_dev_get_reg_info``.
 
 
 Prerequisites
doc/guides/nics/features/enetc4.ini +1 -0
index eaf474e7ba..6540a43909 100644
@@ -17,6 +17,7 @@ RSS hash             = Y
 Packet type parsing  = Y
 Basic stats          = Y
 FW version           = Y
+Registers dump       = Y
 L3 checksum offload  = Y
 L4 checksum offload  = Y
 CRC offload          = Y
doc/guides/rel_notes/release_26_11.rst +1 -0
index 5ac2bb4de0..deb3bc5d52 100644
@@ -65,6 +65,7 @@ New Features
   * Added Receive Segment Coalesce (RSC / hardware LRO) support for ENETC4 PF and VF.
   * Extended the PF-to-VF link speed code field from 4-bit to 8-bit in ENETC4.
   * Added firmware version reporting for the ENETC4 VF.
+  * Added register dump support for ENETC4 PF and VF.
 
 Removed Items
 -------------
drivers/net/enetc/enetc.h +13 -0
index b1428f1bca..73404308fe 100644
@@ -397,6 +397,19 @@ enetc_bd_unused(struct enetc_bdr *bdr)
 	return bdr->bd_count + bdr->next_to_clean - bdr->next_to_use - 1;
 }
 
+/* Per-ring Tx BDR registers dumped by .get_reg (shared by PF and VF) */
+static const uint32_t enetc4_txbdr_regs[] = {
+	ENETC_TBMR, ENETC_TBSR, ENETC_TBBAR0, ENETC_TBBAR1,
+	ENETC_TBCIR, ENETC_TBLENR,
+};
+
+/* Per-ring Rx BDR registers dumped by .get_reg (shared by PF and VF) */
+static const uint32_t enetc4_rxbdr_regs[] = {
+	ENETC_RBMR, ENETC_RBSR, ENETC_RBBSR, ENETC_RBCIR,
+	ENETC_RBBAR0, ENETC_RBBAR1, ENETC_RBPIR, ENETC_RBLENR,
+};
+
+
 /* CBDR prototypes */
 int enetc4_setup_cbdr(struct rte_eth_dev *dev, struct enetc_hw *hw,
 			int bd_count, struct netc_cbdr *cbdr);
drivers/net/enetc/enetc4_ethdev.c +70 -0

82 lines not on this page · raw message

drivers/net/enetc/enetc4_vf.c +62 -0

80 lines not on this page · raw message

Signature · 1 line
2.25.1
#38 lore raw

PATCH v3 7/14 net/enetc: support ethtool ring parameters

In reply to Gagandeep Singh

The ethtool ring parameter query relies on the queue info ethdev ops (.rxq_info_get/.txq_info_get) together with the descriptor limits reported in dev_info. The PF already registered these ops, but the VF ops tables did not, so ring parameter queries failed on the VF.

Make enetc4_rxq_info_get() and enetc4_txq_info_get() non-static and register them in both VF ops tables so ring parameters are reported for both the PF and VF.

---
 doc/guides/rel_notes/release_26_11.rst | 1 +
 drivers/net/enetc/enetc.h              | 4 ++++
 drivers/net/enetc/enetc4_ethdev.c      | 4 ++--
 drivers/net/enetc/enetc4_vf.c          | 4 ++++
 4 files changed, 11 insertions(+), 2 deletions(-)
doc/guides/rel_notes/release_26_11.rst +1 -0
index deb3bc5d52..9e333edf4f 100644
@@ -66,6 +66,7 @@ New Features
   * Extended the PF-to-VF link speed code field from 4-bit to 8-bit in ENETC4.
   * Added firmware version reporting for the ENETC4 VF.
   * Added register dump support for ENETC4 PF and VF.
+  * Added ring parameters support for the ENETC4 VF (rxq_info_get / txq_info_get).
 
 Removed Items
 -------------
drivers/net/enetc/enetc.h +4 -0
index 73404308fe..367d350dde 100644
@@ -339,6 +339,10 @@ int enetc4_tx_queue_stop(struct rte_eth_dev *dev, uint16_t qidx);
 void enetc4_tx_queue_release(struct rte_eth_dev *dev, uint16_t qid);
 const uint32_t *enetc4_supported_ptypes_get(struct rte_eth_dev *dev __rte_unused,
 			size_t *no_of_elements);
+void enetc4_rxq_info_get(struct rte_eth_dev *dev, uint16_t queue_id,
+			 struct rte_eth_rxq_info *qinfo);
+void enetc4_txq_info_get(struct rte_eth_dev *dev, uint16_t queue_id,
+			 struct rte_eth_txq_info *qinfo);
 
 /*
  * enetc4_vf function prototype
drivers/net/enetc/enetc4_ethdev.c +2 -2
index 681bac3ecc..afee0b90a3 100644
@@ -1125,7 +1125,7 @@ enetc4_tx_queue_stop(struct rte_eth_dev *dev, uint16_t qidx)
 	return 0;
 }
 
-static void
+void
 enetc4_rxq_info_get(struct rte_eth_dev *dev, uint16_t queue_id,
 			struct rte_eth_rxq_info *qinfo)
 {
@@ -1139,7 +1139,7 @@ enetc4_rxq_info_get(struct rte_eth_dev *dev, uint16_t queue_id,
 	qinfo->conf.rx_drop_en = 0;
 }
 
-static void
+void
 enetc4_txq_info_get(struct rte_eth_dev *dev, uint16_t queue_id,
 			struct rte_eth_txq_info *qinfo)
 {
drivers/net/enetc/enetc4_vf.c +4 -0
index 77bec0425a..90b7b99e9a 100644
@@ -1508,10 +1508,12 @@ static const struct eth_dev_ops enetc4_vf_ops_no_vsi_m = {
 	.rx_queue_start       = enetc4_rx_queue_start,
 	.rx_queue_stop        = enetc4_rx_queue_stop,
 	.rx_queue_release     = enetc4_rx_queue_release,
+	.rxq_info_get         = enetc4_rxq_info_get,
 	.tx_queue_setup       = enetc4_tx_queue_setup,
 	.tx_queue_start       = enetc4_tx_queue_start,
 	.tx_queue_stop        = enetc4_tx_queue_stop,
 	.tx_queue_release     = enetc4_tx_queue_release,
+	.txq_info_get         = enetc4_txq_info_get,
 	.dev_supported_ptypes_get = enetc4_supported_ptypes_get,
 };
 
@@ -1537,10 +1539,12 @@ static const struct eth_dev_ops enetc4_vf_ops = {
 	.rx_queue_start       = enetc4_rx_queue_start,
 	.rx_queue_stop        = enetc4_rx_queue_stop,
 	.rx_queue_release     = enetc4_rx_queue_release,
+	.rxq_info_get         = enetc4_rxq_info_get,
 	.tx_queue_setup       = enetc4_tx_queue_setup,
 	.tx_queue_start       = enetc4_tx_queue_start,
 	.tx_queue_stop        = enetc4_tx_queue_stop,
 	.tx_queue_release     = enetc4_tx_queue_release,
+	.txq_info_get         = enetc4_txq_info_get,
 	.dev_supported_ptypes_get = enetc4_supported_ptypes_get,
 };
 
Signature · 1 line
2.25.1
#39 lore raw

PATCH v3 8/14 net/enetc: refresh link speed on VF link-up interrupt

In reply to Gagandeep Singh

The interrupt-driven link-status path (enetc4_process_psi_msg) only updated link_status when a PSI-to-VSI notification arrived; it never re-queried the link speed from the PF. As a result, after a link-down followed by a link-up the cached link_speed showed the speed from the previous session rather than the freshly negotiated one.

Fix this by:

1. Introducing enetc4_decode_link_speed() - a shared helper that maps a PF-to-VF speed status code to the corresponding RTE_ETH_SPEED_NUM_* / RTE_ETH_LINK_*_DUPLEX values, handling both the current and the legacy (vf_link_legacy) 4-bit message layout.

2. Calling enetc4_vf_get_link_speed() inside enetc4_process_psi_msg() on ENETC_LINK_UP so the negotiated speed is fetched from the PF and decoded immediately, before rte_eth_linkstatus_set() is called and the LSC callback is fired.

---
 doc/guides/rel_notes/release_26_11.rst |   1 +
 drivers/net/enetc/enetc4_vf.c          | 197 +++++++++++++------------
 2 files changed, 107 insertions(+), 91 deletions(-)
doc/guides/rel_notes/release_26_11.rst +1 -0
index 9e333edf4f..eca0dc1dea 100644
@@ -67,6 +67,7 @@ New Features
   * Added firmware version reporting for the ENETC4 VF.
   * Added register dump support for ENETC4 PF and VF.
   * Added ring parameters support for the ENETC4 VF (rxq_info_get / txq_info_get).
+  * Refreshed VF link speed on the link-up interrupt in the ENETC4 VF driver.
 
 Removed Items
 -------------
drivers/net/enetc/enetc4_vf.c +106 -91

218 lines not on this page · raw message

Signature · 1 line
2.25.1
#40 lore raw

PATCH v3 9/14 net/enetc: support stats reset for VF

In reply to Gagandeep Singh

The NETC SI-level hardware counters (SIROCT0, SIRFRM0, SITOCT0, SITFRM0, SITDFCR) are read-only for a VF and cannot be directly zeroed. No VSI-PSI command class exists for stats reset, and using FLR/soft-reset to clear counters is not reliable due to a known hardware erratum on some NETC platforms.

Implement stats_reset for the enetc4 VF PMD using a software snapshot/delta approach: on stats_reset, the current HW counter values are captured as a baseline in a new per-device enetc4_vf_stats_saved struct. stats_get then reports the delta (current_hw_value - saved_baseline), so counters appear to start from zero after each reset call. Per-ring software Rx error accumulators (ierrors) are zeroed directly on reset.

Register the stats_reset callback in both VF ops tables (enetc4_vf_ops and enetc4_vf_ops_no_vsi_m) so the feature is available regardless of whether the VSI messaging path is enabled.

---
 doc/guides/rel_notes/release_26_11.rst |  1 +
 drivers/net/enetc/enetc.h              | 17 +++++++
 drivers/net/enetc/enetc4_vf.c          | 61 +++++++++++++++++++++++---
 3 files changed, 74 insertions(+), 5 deletions(-)
doc/guides/rel_notes/release_26_11.rst +1 -0
index eca0dc1dea..b88e2825a6 100644
@@ -68,6 +68,7 @@ New Features
   * Added register dump support for ENETC4 PF and VF.
   * Added ring parameters support for the ENETC4 VF (rxq_info_get / txq_info_get).
   * Refreshed VF link speed on the link-up interrupt in the ENETC4 VF driver.
+  * Added stats reset for the ENETC4 VF using a software snapshot/delta approach.
 
 Removed Items
 -------------
drivers/net/enetc/enetc.h +17 -0
index 367d350dde..3590cf6639 100644
@@ -105,6 +105,21 @@ struct enetc_bdr {
 	uint8_t rsc_enable;
 };
 
+/*
+ * Saved SI counter baseline for VF stats reset. Since the SI-level
+ * hardware counters (SIROCT0, SIRFRM0, SITOCT0, SITFRM0, SITDFCR)
+ * are read-only for a VF and cannot be directly zeroed, stats_reset
+ * captures the current counter values as a baseline. stats_get then
+ * reports the delta: current_hw_value - baseline.
+ */
+struct enetc4_vf_stats_saved {
+	uint64_t ipackets;
+	uint64_t opackets;
+	uint64_t ibytes;
+	uint64_t obytes;
+	uint64_t oerrors;
+};
+
 struct enetc_eth_hw {
 	struct rte_eth_dev *ndev;
 	struct enetc_hw hw;
@@ -124,6 +139,8 @@ struct enetc_eth_hw {
 	 * for PF kernel versions before 6.18.37. Set via vf_link_legacy devarg.
 	 */
 	uint8_t vf_link_legacy;
+	/* Baseline snapshot for VF stats reset (software delta approach). */
+	struct enetc4_vf_stats_saved vf_stats_saved;
 };
 
 /*
drivers/net/enetc/enetc4_vf.c +56 -5

83 lines not on this page · raw message

Signature · 1 line
2.25.1
#41 lore raw

PATCH v3 10/14 net/enetc4: add per-queue Rx interrupt support for VF

In reply to Gagandeep Singh

Add MSI-X per-queue Rx interrupt support to the ENETC4 VF PMD on the cacheable (default) Rx path. This allows applications such as l3fwd-power to block in epoll_wait when no traffic is present, reducing CPU utilization to near zero.

MSI-X vector 0 is reserved for the PSI-to-VSI mailbox. Rx queue i is mapped to MSI-X vector i + 1 via ENETC_SIMSIRRV. Per-ring coalescing is enabled with ICPT=1 so the first arriving packet fires the interrupt immediately. The SIRXIDR W1C detect bit is cleared before re-arming ENETC_RBIER to prevent spurious interrupts after traffic stops.

The interrupt infrastructure (rte_intr_efd_enable + rte_intr_vec_list_alloc) is set up before rte_intr_enable() so that vfio-pci can wire each MSI-X vector to its eventfd when programming the MSI-X table.

enetc4_dev_configure() is updated to trigger interrupt setup when intr_conf.rxq is set (not only when intr_conf.lsc is set), as applications like l3fwd-power set intr_conf.rxq without setting lsc.

Documentation is updated to describe the feature, list the kernel and host setup steps, and provide an example l3fwd-power command for single queue/core interrupt-driven operation.

---
 doc/guides/nics/enetc4.rst             | 69 +++++++++++++++++++-
 doc/guides/nics/features/enetc4.ini    |  1 +
 doc/guides/rel_notes/release_26_11.rst |  1 +
 drivers/net/enetc/base/enetc4_hw.h     |  2 +
 drivers/net/enetc/enetc.h              |  1 +
 drivers/net/enetc/enetc4_ethdev.c      |  9 +--
 drivers/net/enetc/enetc4_vf.c          | 88 +++++++++++++++++++++++++-
 7 files changed, 165 insertions(+), 6 deletions(-)
doc/guides/nics/enetc4.rst +68 -1
index cd757be12f..d8e323d614 100644
@@ -59,6 +59,10 @@ Key functionality includes:
   Segment Coalesce (RSC), enabled when the TCP LRO Rx offload flag is
   requested. RSC requires the FCS to be stripped, so it cannot be combined
   with the KEEP_CRC Rx offload.
+- Per-queue Rx interrupts on VFs (cacheable Rx path only), enabling
+  interrupt-driven receive with ``vfio-pci``. Applications set
+  ``intr_conf.rxq = 1`` in ``rte_eth_conf`` to activate this feature.
+  See `Rx Interrupt Mode (VF)`_ for setup details.
 - Firmware version: The NETC IP version is reported via ``rte_eth_dev_fw_version_get``.
 - Registers dump: The station interface, port (PF only) and BD ring registers are dumped via ``rte_eth_dev_get_reg_info``.
 
@@ -95,7 +99,9 @@ The following dependencies are not part of DPDK and must be installed separately
 Driver compilation and testing
 ------------------------------
 
-Follow instructions available in the document :doc:`build_and_test` to launch **testpmd**.
+Follow instructions available in the document
+:ref:`compiling and testing a PMD for a NIC <pmd_build_and_test>`
+to launch **testpmd**.
 
 
 Driver Arguments (devargs)
@@ -156,3 +162,64 @@ PF/Common devargs
   Usage example::
 
     dpdk-testpmd -a 0000:00:00.0,nc=1 -- -i
+
+
+Rx Interrupt Mode (VF)
+----------------------
+
+The ENETC4 VF PMD supports per-queue MSI-X Rx interrupts on the cacheable
+(default) Rx path. This allows applications to block in ``epoll_wait``
+instead of busy-polling, reducing CPU utilization when traffic is absent.
+
+**MSI-X vector assignment**
+
+ENETC4 VF MSI-X vector 0 is reserved for the PSI-to-VSI mailbox interrupt
+(link status notifications). Rx queue ``i`` is mapped to vector ``i + 1``.
+The driver allocates all required eventfds before calling
+``rte_intr_enable()`` so that ``vfio-pci`` can wire each MSI-X vector to
+its eventfd when it programs the MSI-X table.
+
+**Kernel and driver requirements**
+
+- ``vfio-pci`` kernel module with no-IOMMU mode enabled (no SMMU required).
+- The non-cacheable memory mode (``nc=1`` devarg) does **not** support
+  Rx interrupts and returns ``-ENOTSUP`` from ``rx_queue_intr_enable``.
+
+**Host setup**
+
+.. code-block:: console
+
+   # Enable vfio-pci no-IOMMU mode (if SMMU is not available)
+   modprobe vfio enable_unsafe_noiommu_mode=1
+   modprobe vfio-pci
+
+   # Bind the VF to vfio-pci
+   echo vfio-pci > /sys/bus/pci/devices/<vf_pci_addr>/driver_override
+   echo <vf_pci_addr> > /sys/bus/pci/drivers_probe
+
+**Running l3fwd-power with a single queue and core**
+
+The ``l3fwd-power`` sample application demonstrates interrupt-driven Rx.
+It sets ``intr_conf.rxq = 1`` in ``rte_eth_conf``, which triggers the VF
+interrupt setup in the driver. The ``--vfio-intr=msix`` EAL flag instructs
+DPDK to use MSI-X eventfds for interrupt signalling.
+
+.. code-block:: console
+
+   ./dpdk-l3fwd-power -l 0-1 -n 1 --vfio-intr=msix \
+       -a <vf_pci_addr> -- \
+       -p 0x1 --config="(0,0,1)" --no-numa --interrupt-only
+
+Where:
+
+- ``-l 0-1`` assigns the main thread to core 0 and the forwarding lcore to
+  core 1.
+- ``-a <vf_pci_addr>`` specifies the VF PCI address (e.g. ``0000:01:00.1``).
+- ``--config="(0,0,1)"`` maps port 0, queue 0 to lcore 1.
+- ``--interrupt-only`` enables pure interrupt mode (no busy-poll fallback).
+
+With no incoming traffic the forwarding lcore sleeps in ``epoll_wait``;
+CPU utilization drops to near zero. On the first arriving packet the MSI-X
+interrupt fires, the lcore wakes, drains the ring, disables the interrupt,
+processes the burst, then re-enables and re-arms the interrupt before
+returning to sleep.
doc/guides/nics/features/enetc4.ini +1 -0
index 6540a43909..005c64a3ca 100644
@@ -5,6 +5,7 @@
 ;
 [Features]
 Link status event    = Y
+Rx interrupt         = Y
 Speed capabilities   = Y
 Link status          = Y
 LRO                  = Y
doc/guides/rel_notes/release_26_11.rst +1 -0
index b88e2825a6..9b39debc1d 100644
@@ -69,6 +69,7 @@ New Features
   * Added ring parameters support for the ENETC4 VF (rxq_info_get / txq_info_get).
   * Refreshed VF link speed on the link-up interrupt in the ENETC4 VF driver.
   * Added stats reset for the ENETC4 VF using a software snapshot/delta approach.
+  * Added per-queue MSI-X Rx interrupt support for the ENETC4 VF.
 
 Removed Items
 -------------
drivers/net/enetc/base/enetc4_hw.h +2 -0
index 8ad8f169d2..9543e982a2 100644
@@ -250,6 +250,8 @@ struct enetc_rx_bd_ext {
 #define ENETC4_VSIIDR            0xA08
 #define ENETC4_VSIIER_MRIE       BIT(9)
 #define ENETC4_SI_INT_IDX        0
+/* MSI-X vector base for per-Rx-queue interrupts; vector 0 is the mailbox. */
+#define ENETC4_VF_RX_VEC_BASE    1
 
 /* VSI Registers */
 #define ENETC4_VSIMSGSR  0x204   /* RO */
drivers/net/enetc/enetc.h +1 -0
index 3590cf6639..903829323e 100644
@@ -135,6 +135,7 @@ struct enetc_eth_hw {
 	uint32_t vsi_delay;   /* VSI-PSI message wait delay (us) */
 	uint32_t *txq_prior;  /* per-queue TX priority (TBMR priority bits) */
 	uint8_t nc_mode;      /* 1 = non-cacheable BD memory, use _nc ops */
+	uint8_t rxq_intr_en;  /* 1 = per-queue Rx MSI-X interrupts enabled */
 	/* 1 = legacy PF-to-VF link message layout (4-bit speed / 4-bit cookie),
 	 * for PF kernel versions before 6.18.37. Set via vf_link_legacy devarg.
 	 */
drivers/net/enetc/enetc4_ethdev.c +5 -4
index afee0b90a3..d987f1288c 100644
@@ -839,7 +839,8 @@ enetc4_dev_close(struct rte_eth_dev *dev)
 		return 0;
 
 	if (hw->device_id == ENETC4_DEV_ID_VF) {
-		if (dev->data->dev_conf.intr_conf.lsc != 0)
+		if (dev->data->dev_conf.intr_conf.lsc != 0 ||
+		    dev->data->dev_conf.intr_conf.rxq != 0)
 			enetc4_vf_dev_intr(dev, false);
 		ret = enetc4_vf_dev_stop(dev);
 	} else {
@@ -961,12 +962,12 @@ enetc4_dev_configure(struct rte_eth_dev *dev)
 	if (hw->device_id != ENETC4_DEV_ID_VF)
 		enetc4_port_wr(enetc_hw, ENETC4_PARCSCR, checksum);
 
-	/* Enable interrupts */
 	if (hw->device_id == ENETC4_DEV_ID_VF) {
-		if (dev->data->dev_conf.intr_conf.lsc != 0) {
+		if (dev->data->dev_conf.intr_conf.lsc != 0 ||
+		    dev->data->dev_conf.intr_conf.rxq != 0) {
 			ret = enetc4_vf_dev_intr(dev, true);
 			if (ret)
-				ENETC_PMD_WARN("Failed to setup link interrupts");
+				ENETC_PMD_WARN("Failed to setup VF interrupts: %d", ret);
 		}
 	}
 
drivers/net/enetc/enetc4_vf.c +87 -1

125 lines not on this page · raw message

Signature · 1 line
2.25.1
#42 lore raw

PATCH v3 11/14 net/enetc4: add SI-based port VLAN insertion and removal

In reply to Gagandeep Singh

Implement hardware VLAN tag insertion on Tx and removal on Rx via the per-SI VLAN isolation (pvid) mechanism on ENETC4.

On a PF, the driver writes directly to PSIaVLANR(0) (VID + enable bit) and PSIaCFGR0(0) (SIVIE for Tx insertion, VTE for Rx removal, SIVC_CVLAN to allow C-VLAN 0x8100 TPID).

On a privileged VF, the request is forwarded to the kernel PF via the VSI-PSI mailbox using a new command class 0x24 (SI VLAN isolation, cmd ID 0x1). The kernel PF handler programs the same registers on behalf of the VF's station interface. The class 0x24 reply is added to the pass-through list in enetc4_msg_vsi_send() so it is handled correctly alongside the existing command classes.

New additions:
- ENETC4_PSIVLANR(a) and ENETC4_PSICFGR0(a) register macros with field definitions in enetc4_hw.h
- ENETC_CLASS_ID_SI_VLAN_ISO (0x24) and ENETC_CMD_ID_SET_SI_VLAN_ISO enum values, plus struct enetc_msg_si_vlan_iso message layout and bit definitions in enetc.h
- enetc4_vlan_pvid_set() for PF in enetc4_ethdev.c
- enetc4_vf_vlan_pvid_set() for VF in enetc4_vf.c, registered as .vlan_pvid_set in both enetc4_ops and enetc4_vf_ops

The feature is activated in testpmd with:
tx_vlan set pvid <port_id> <vlan_id> on|off

---
 doc/guides/nics/enetc4.rst             |  4 ++
 doc/guides/nics/features/enetc4.ini    |  1 +
 doc/guides/rel_notes/release_26_11.rst |  1 +
 drivers/net/enetc/base/enetc4_hw.h     | 14 +++++
 drivers/net/enetc/enetc.h              | 23 +++++++
 drivers/net/enetc/enetc4_ethdev.c      | 39 ++++++++++++
 drivers/net/enetc/enetc4_vf.c          | 85 ++++++++++++++++++++++++++
 7 files changed, 167 insertions(+)
doc/guides/nics/enetc4.rst +4 -0
index d8e323d614..bb0628ccf6 100644
@@ -65,6 +65,10 @@ Key functionality includes:
   See `Rx Interrupt Mode (VF)`_ for setup details.
 - Firmware version: The NETC IP version is reported via ``rte_eth_dev_fw_version_get``.
 - Registers dump: The station interface, port (PF only) and BD ring registers are dumped via ``rte_eth_dev_get_reg_info``.
+- SI-based port VLAN (pvid): Hardware VLAN tag insertion on Tx and removal on Rx, configured
+  via ``rte_eth_dev_set_vlan_pvid``. On a PF the registers are written directly; on a privileged
+  VF the request is forwarded to the kernel PF through the VSI-PSI mailbox (class 0x24).
+  Use the testpmd command ``tx_vlan set pvid <port_id> <vlan_id> on|off`` to enable or disable.
 
 
 Prerequisites
doc/guides/nics/features/enetc4.ini +1 -0
index 005c64a3ca..01b0dc5b80 100644
@@ -14,6 +14,7 @@ Promiscuous mode     = Y
 Allmulticast mode    = Y
 Unicast MAC filter   = Y
 VLAN filter          = Y
+VLAN offload         = Y
 RSS hash             = Y
 Packet type parsing  = Y
 Basic stats          = Y
doc/guides/rel_notes/release_26_11.rst +1 -0
index 9b39debc1d..e6d96b2a50 100644
@@ -70,6 +70,7 @@ New Features
   * Refreshed VF link speed on the link-up interrupt in the ENETC4 VF driver.
   * Added stats reset for the ENETC4 VF using a software snapshot/delta approach.
   * Added per-queue MSI-X Rx interrupt support for the ENETC4 VF.
+  * Added SI-based port VLAN insertion (Tx) and removal (Rx) for ENETC4 PF and VF.
 
 Removed Items
 -------------
drivers/net/enetc/base/enetc4_hw.h +14 -0
index 9543e982a2..a9552f21f4 100644
@@ -277,6 +277,20 @@ struct enetc_rx_bd_ext {
 #define ENETC4_SICTR0		0x18
 #define ENETC4_SICTR1		0x1c
 
+/* PSI SI VLAN register: per-SI VLAN tag for insertion/removal */
+#define ENETC4_PSIVLANR(a)		((a) * 0x80 + 0x2008)
+#define ENETC4_PSIVLANR_E		BIT(31)  /* enable SI VLAN processing */
+#define ENETC4_PSIVLANR_VTEA		BIT(30)  /* 0=strip tag, 1=zero VID */
+#define ENETC4_PSIVLANR_PCP(v)		(((uint32_t)(v) & 0x7) << 13)
+#define ENETC4_PSIVLANR_DEI		BIT(12)
+#define ENETC4_PSIVLANR_VID(v)		((uint32_t)(v) & 0xfff)
+
+/* PSI SI configuration register 0 */
+#define ENETC4_PSICFGR0(a)		((a) * 0x80 + 0x2010)
+#define ENETC4_PSICFGR0_SIVC_CVLAN	BIT(24)  /* allow C-VLAN 0x8100 */
+#define ENETC4_PSICFGR0_SIVIE		BIT(14)  /* SI VLAN insertion enable */
+#define ENETC4_PSICFGR0_VTE		BIT(12)  /* SI VLAN removal enable */
+
 /* general register accessors */
 #define enetc4_rd_reg(reg)	rte_read32((void *)(reg))
 #define enetc4_wr_reg(reg, val)  rte_write32((val), (void *)(reg))
drivers/net/enetc/enetc.h +23 -0
index 903829323e..72e43572f7 100644
@@ -187,6 +187,8 @@ struct enetc_eth_adapter {
 enum enetc_msg_cmd_class_id {
 	ENETC_CLASS_ID_MAC_FILTER = 0x20,
 	ENETC_CLASS_ID_VLAN_FILTER = 0x21,
+	/* Configure SI VLAN isolation (insert / remove) */
+	ENETC_CLASS_ID_SI_VLAN_ISO = 0x24,
 	ENETC_CLASS_ID_LINK_STATUS = 0x80,
 	ENETC_CLASS_ID_LINK_SPEED = 0x81,
 	ENETC_CLASS_ID_GET_IP_VER = 0xF0
@@ -212,6 +214,11 @@ enum enetc_msg_cmd_id {
 	ENETC_CMD_ID_GET_IP_CFG = 4
 };
 
+/* Command IDs for class ID 0x24 (SI VLAN isolation) */
+enum enetc_msg_si_vlan_cmd_id {
+	ENETC_CMD_ID_SET_SI_VLAN_ISO = 1,
+};
+
 /* IP_VER value returned when the version is not available */
 #define ENETC_IP_VER_NOT_AVAILABLE	0xFF
 
@@ -323,6 +330,22 @@ struct enetc_msg_vlan_exact_filter {
 	uint8_t reserved2;
 };
 
+/* VSI-PSI SI VLAN isolation message (class 0x24, cmd 0x1) */
+struct enetc_msg_si_vlan_iso {
+	struct enetc_msg_cmd_header header;
+	uint8_t ctrl;          /* E[7], VTEA[6], TPID[1:0] */
+	uint8_t pcp_dei_vid_hi; /* PCP[7:5], DEI[4], VID[11:8] */
+	uint8_t vid_lo;        /* VID[7:0] */
+	uint8_t reserved_0;
+	uint8_t flags;         /* SVIE[2], VTE[1] */
+	uint8_t reserved_1[3];
+};
+
+#define ENETC_SI_VLAN_ISO_E	BIT(7)  /* ctrl: enable SI VLAN */
+#define ENETC_SI_VLAN_ISO_VTEA	BIT(6)  /* ctrl: 0=strip, 1=zero VID */
+#define ENETC_SI_VLAN_ISO_SVIE	BIT(2)  /* flags: Tx insertion enable */
+#define ENETC_SI_VLAN_ISO_VTE	BIT(1)  /* flags: Rx removal enable */
+
 struct enetc_psi_reply_msg {
 	uint8_t class_id;
 	uint8_t status;
drivers/net/enetc/enetc4_ethdev.c +39 -0
index d987f1288c..ae40cc69e0 100644
@@ -872,6 +872,44 @@ enetc4_dev_close(struct rte_eth_dev *dev)
 	return ret;
 }
 
+/* Configure SI-based VLAN insertion (Tx) and removal (Rx) for the PF. */
+static int
+enetc4_vlan_pvid_set(struct rte_eth_dev *dev, uint16_t vlan_id, int on)
+{
+	struct enetc_eth_hw *hw =
+		ENETC_DEV_PRIVATE_TO_HW(dev->data->dev_private);
+	struct enetc_hw *enetc_hw = &hw->hw;
+	uint32_t psivlanr, psicfgr0;
+
+	PMD_INIT_FUNC_TRACE();
+
+	psicfgr0 = enetc4_port_rd(enetc_hw, ENETC4_PSICFGR0(0));
+
+	if (on) {
+		/* Build the VLAN register: enable bit + VID (PCP/DEI left 0) */
+		psivlanr = (uint32_t)ENETC4_PSIVLANR_E |
+			   ENETC4_PSIVLANR_VID(vlan_id);
+		enetc4_port_wr(enetc_hw, ENETC4_PSIVLANR(0), psivlanr);
+
+		/* Allow C-VLAN TPID, enable Tx insertion and Rx removal */
+		psicfgr0 |= ENETC4_PSICFGR0_SIVC_CVLAN |
+			    ENETC4_PSICFGR0_SIVIE |
+			    ENETC4_PSICFGR0_VTE;
+		enetc4_port_wr(enetc_hw, ENETC4_PSICFGR0(0), psicfgr0);
+	} else {
+		/* Clear Tx insertion, Rx removal and C-VLAN allow bits */
+		psicfgr0 &= ~(ENETC4_PSICFGR0_SIVC_CVLAN |
+			      ENETC4_PSICFGR0_SIVIE |
+			      ENETC4_PSICFGR0_VTE);
+		enetc4_port_wr(enetc_hw, ENETC4_PSICFGR0(0), psicfgr0);
+
+		/* Clear the VLAN register (disable SI VLAN processing) */
+		enetc4_port_wr(enetc_hw, ENETC4_PSIVLANR(0), 0);
+	}
+
+	return 0;
+}
+
 static int
 enetc4_promiscuous_enable(struct rte_eth_dev *dev)
 {
@@ -1267,6 +1305,7 @@ static const struct eth_dev_ops enetc4_ops = {
 	.get_reg              = enetc4_get_regs,
 	.promiscuous_enable   = enetc4_promiscuous_enable,
 	.promiscuous_disable  = enetc4_promiscuous_disable,
+	.vlan_pvid_set        = enetc4_vlan_pvid_set,
 	.rx_queue_setup       = enetc4_rx_queue_setup,
 	.rx_queue_start       = enetc4_rx_queue_start,
 	.rx_queue_stop        = enetc4_rx_queue_stop,
drivers/net/enetc/enetc4_vf.c +85 -0

105 lines not on this page · raw message

Signature · 1 line
2.25.1
#43 lore raw

PATCH v3 12/14 net/enetc4: update VF link status to bitmask encoding

In reply to Gagandeep Singh

The PF-to-VF link status notification code was previously a two-value enum (UP=0x0, DOWN=0x1). Change this to a bitmask so future bits can carry additional state alongside the link up/down indication:

ENETC_LINK_DOWN BIT(0) -- set when link is down

Link up is now encoded as the DOWN bit being clear, which keeps the wire value for link-down identical (0x1) and ensures backward compatibility with older kernel PFs.

Changes:
- enetc.h: replace enum link_status with a #define bitmask; drop ENETC_LINK_UP (no longer a named constant).
- enetc4_vf.c enetc4_process_psi_msg(): replace switch/case on ENETC_LINK_UP/DOWN with bitmask decode.
- enetc4_vf.c enetc4_vf_link_update(): same bitmask decode.

---
 doc/guides/rel_notes/release_26_11.rst |  1 +
 drivers/net/enetc/enetc.h              |  8 ++++----
 drivers/net/enetc/enetc4_vf.c          | 27 +++++++-------------------
 3 files changed, 12 insertions(+), 24 deletions(-)
doc/guides/rel_notes/release_26_11.rst +1 -0
index e6d96b2a50..5323f4fea3 100644
@@ -71,6 +71,7 @@ New Features
   * Added stats reset for the ENETC4 VF using a software snapshot/delta approach.
   * Added per-queue MSI-X Rx interrupt support for the ENETC4 VF.
   * Added SI-based port VLAN insertion (Tx) and removal (Rx) for ENETC4 PF and VF.
+  * Updated ENETC4 VF link status reporting to use bitmask encoding.
 
 Removed Items
 -------------
drivers/net/enetc/enetc.h +4 -4
index 72e43572f7..40bad56341 100644
@@ -236,10 +236,10 @@ enum vlan_status {
 	ENETC_VLAN_NO_RESOURCE = 0x3
 };
 
-enum link_status {
-	ENETC_LINK_UP = 0x0,
-	ENETC_LINK_DOWN = 0x1
-};
+/* Link status bitmask in PF-to-VF mailbox notification.
+ * Link up is encoded as the DOWN bit being clear.
+ */
+#define ENETC_LINK_DOWN  (1u << 0)
 
 enum speed {
 	ENETC_SPEED_UNKNOWN = 0x0,
drivers/net/enetc/enetc4_vf.c +7 -20
index fc5ea4d609..1b93835dd7 100644
@@ -480,8 +480,10 @@ enetc4_process_psi_msg(struct rte_eth_dev *eth_dev, struct enetc_hw *enetc_hw)
 	enetc4_msg_get_psi_msg(enetc_hw, msg);
 
 	if (msg->class_id == ENETC_CLASS_ID_LINK_STATUS) {
-		switch (msg->status) {
-		case ENETC_LINK_UP:
+		if (msg->status & ENETC_LINK_DOWN) {
+			ENETC_PMD_DEBUG("Link is down");
+			link.link_status = RTE_ETH_LINK_DOWN;
+		} else {
 			ENETC_PMD_DEBUG("Link is up");
 			link.link_status = RTE_ETH_LINK_UP;
 			/* Re-query speed from PF so the cached value reflects
@@ -498,14 +500,6 @@ enetc4_process_psi_msg(struct rte_eth_dev *eth_dev, struct enetc_hw *enetc_hw)
 			} else {
 				ENETC_PMD_WARN("Failed to alloc msg for speed query");
 			}
-			break;
-		case ENETC_LINK_DOWN:
-			ENETC_PMD_DEBUG("Link is down");
-			link.link_status = RTE_ETH_LINK_DOWN;
-			break;
-		default:
-			ENETC_PMD_ERR("Unknown link status 0x%x", msg->status);
-			break;
 		}
 		ret = rte_eth_linkstatus_set(eth_dev, &link);
 		if (!ret)
@@ -1180,17 +1174,10 @@ enetc4_vf_link_update(struct rte_eth_dev *dev, int wait_to_complete __rte_unused
 	}
 
 	if (reply_msg->class_id == ENETC_CLASS_ID_LINK_STATUS) {
-		switch (reply_msg->status) {
-		case ENETC_LINK_UP:
-			link.link_status = RTE_ETH_LINK_UP;
-			break;
-		case ENETC_LINK_DOWN:
+		if (reply_msg->status & ENETC_LINK_DOWN)
 			link.link_status = RTE_ETH_LINK_DOWN;
-			break;
-		default:
-			ENETC_PMD_ERR("Unknown link status");
-			break;
-		}
+		else
+			link.link_status = RTE_ETH_LINK_UP;
 	} else {
 		ENETC_PMD_ERR("Wrong reply message");
 		return -1;
Signature · 1 line
2.25.1
#44 lore raw

PATCH v3 13/14 net/enetc4: enable TX PAUSE via VF RX congestion mode

In reply to Gagandeep Singh

When the PF negotiates TX PAUSE on the port it signals this to the VF via BIT(1) of the PF-to-VF link status mailbox message. The VF PMD must respond by setting RBMR_CM (BIT(4)) on all active RX rings so the MAC emits PAUSE frames on ingress pressure.

Add ENETC_RBMR_CM register definition, ENETC_LINK_TX_PAUSE bitmask, and tx_pause_active state flag. Add enetc4_vf_set_congestion_mode() to update all active RX rings and persist the state for rings started later. Hook it into both the interrupt and poll link-update paths, and apply the saved state in rx_queue_setup() and rx_queue_start().

RX PAUSE (honoring received PAUSE frames) is handled at the MAC level by the PF and requires no VF PMD changes.

---
 doc/guides/nics/features/enetc4.ini    |  1 +
 doc/guides/rel_notes/release_26_11.rst |  1 +
 drivers/net/enetc/base/enetc_hw.h      |  1 +
 drivers/net/enetc/enetc.h              |  9 +++-
 drivers/net/enetc/enetc4_ethdev.c      | 13 +++++-
 drivers/net/enetc/enetc4_vf.c          | 59 ++++++++++++++++++++++++--
 6 files changed, 78 insertions(+), 6 deletions(-)
doc/guides/nics/features/enetc4.ini +1 -0
index 01b0dc5b80..1f599dace7 100644
@@ -14,6 +14,7 @@ Promiscuous mode     = Y
 Allmulticast mode    = Y
 Unicast MAC filter   = Y
 VLAN filter          = Y
+Flow control         = Y
 VLAN offload         = Y
 RSS hash             = Y
 Packet type parsing  = Y
doc/guides/rel_notes/release_26_11.rst +1 -0
index 5323f4fea3..d69888aafb 100644
@@ -72,6 +72,7 @@ New Features
   * Added per-queue MSI-X Rx interrupt support for the ENETC4 VF.
   * Added SI-based port VLAN insertion (Tx) and removal (Rx) for ENETC4 PF and VF.
   * Updated ENETC4 VF link status reporting to use bitmask encoding.
+  * Added TX PAUSE support for the ENETC4 VF via RX congestion mode.
 
 Removed Items
 -------------
drivers/net/enetc/base/enetc_hw.h +1 -0
index 6e96562850..33d075fe59 100644
@@ -51,6 +51,7 @@ enum enetc_bdr_type {TX, RX};
 							+ (off))
 /* RX BDR reg offsets */
 #define ENETC_RBMR		0x0 /* RX BDR mode register*/
+#define ENETC_RBMR_CM		BIT(4)  /* congestion mode: assert congestion to emit TX PAUSE */
 #define ENETC_RBMR_EN		BIT(31)
 
 #define ENETC_BMR_RESET		0x0 /* BDR reset*/
drivers/net/enetc/enetc.h +8 -1
index 40bad56341..8aaf8a7eb1 100644
@@ -140,6 +140,10 @@ struct enetc_eth_hw {
 	 * for PF kernel versions before 6.18.37. Set via vf_link_legacy devarg.
 	 */
 	uint8_t vf_link_legacy;
+	/* 1 = TX PAUSE negotiated on port; VF RX rings must have RBMR_CM set.
+	 * Updated from the PF-to-VF link status mailbox message (BIT(1)).
+	 */
+	uint8_t tx_pause_active;
 	/* Baseline snapshot for VF stats reset (software delta approach). */
 	struct enetc4_vf_stats_saved vf_stats_saved;
 };
@@ -238,8 +242,11 @@ enum vlan_status {
 
 /* Link status bitmask in PF-to-VF mailbox notification.
  * Link up is encoded as the DOWN bit being clear.
+ * TX_PAUSE is set when the port has negotiated TX PAUSE; VF must enable
+ * congestion mode (ENETC_RBMR_CM) on its RX rings accordingly.
  */
-#define ENETC_LINK_DOWN  (1u << 0)
+#define ENETC_LINK_DOWN      (1u << 0)
+#define ENETC_LINK_TX_PAUSE  (1u << 1)
 
 enum speed {
 	ENETC_SPEED_UNKNOWN = 0x0,
drivers/net/enetc/enetc4_ethdev.c +11 -2
index ae40cc69e0..2355522515 100644
@@ -712,8 +712,12 @@ enetc4_rx_queue_setup(struct rte_eth_dev *dev,
 	}
 
 	if (!rx_conf->rx_deferred_start) {
-		/* enable ring */
+		/* Enable ring; apply congestion mode if TX PAUSE is already active. */
 		rx_enable |= ENETC_RBMR_EN;
+		if (adapter->hw.tx_pause_active)
+			rx_enable |= ENETC_RBMR_CM;
+		else
+			rx_enable &= ~(uint32_t)ENETC_RBMR_CM;
 		enetc4_rxbdr_wr(&adapter->hw.hw, rx_ring->index, ENETC_RBMR,
 			       rx_enable);
 		dev->data->rx_queue_state[rx_ring->index] =
@@ -1089,7 +1093,12 @@ enetc4_rx_queue_start(struct rte_eth_dev *dev, uint16_t qidx)
 	if (dev->data->rx_queue_state[qidx] == RTE_ETH_QUEUE_STATE_STOPPED) {
 		rx_data = enetc4_rxbdr_rd(&priv->hw.hw, rx_ring->index,
 					 ENETC_RBMR);
-		rx_data = rx_data | ENETC_RBMR_EN;
+		rx_data |= ENETC_RBMR_EN;
+		/* Restore congestion mode if TX PAUSE is active. */
+		if (priv->hw.tx_pause_active)
+			rx_data |= ENETC_RBMR_CM;
+		else
+			rx_data &= ~(uint32_t)ENETC_RBMR_CM;
 		enetc4_rxbdr_wr(&priv->hw.hw, rx_ring->index, ENETC_RBMR,
 			       rx_data);
 		dev->data->rx_queue_state[qidx] = RTE_ETH_QUEUE_STATE_STARTED;
drivers/net/enetc/enetc4_vf.c +56 -3

87 lines not on this page · raw message

Signature · 1 line
2.25.1
#45 lore raw

PATCH v3 14/14 net/enetc4: add WRR Tx scheduler devarg for VF rings

In reply to Gagandeep Singh

Add enetc4_txq_wrr devarg to configure per-ring WRR weights in the NETC LEAF-level Tx scheduler (TBaMR register, bits [6:4]).

The NETC Tx scheduler has three levels:
- ROOT (port/TC): strict priority + CBS (PF/port space)
- MID (SI/VSI): WBFS shaping (PF space)
- LEAF (Tx BDR): strict priority + frame-based WRR (VF/SI space)

TBaMR is in the VF own SI space, so no Linux PF involvement is needed for PRIO or WRR configuration.

Changes:
- enetc_hw.h: add ENETC_TBMR_WRR_MASK, ENETC_TBMR_WRR(n) macros for TBaMR bits [6:4], and ENETC_TBMR_PRIO_MASK for bits [2:0]
- enetc.h: add txq_wrr pointer to enetc_eth_hw struct
- enetc4_ethdev.c: add parse_txq_wrr() and wire ENETC4_TXQ_WRR devarg through enetc4_get_devargs() and enetc4_dev_configure(); apply WRR bits in enetc4_tx_queue_setup() and enetc4_tx_queue_start()

Usage:

  # strict priority: ring 0 highest
  -a 0002:00:12.0,enetc4_txq_prior="3|2|1"

# WRR 2:4:1 on same-priority rings
-a 0002:00:12.0,enetc4_txq_prior="1|1|1",enetc4_txq_wrr="2|4|1"

---
 doc/guides/rel_notes/release_26_11.rst |  1 +
 drivers/net/enetc/base/enetc_hw.h      |  5 ++
 drivers/net/enetc/enetc.h              |  1 +
 drivers/net/enetc/enetc4_ethdev.c      | 97 ++++++++++++++++++++------
 4 files changed, 82 insertions(+), 22 deletions(-)
doc/guides/rel_notes/release_26_11.rst +1 -0
index d69888aafb..3ea34523fe 100644
@@ -73,6 +73,7 @@ New Features
   * Added SI-based port VLAN insertion (Tx) and removal (Rx) for ENETC4 PF and VF.
   * Updated ENETC4 VF link status reporting to use bitmask encoding.
   * Added TX PAUSE support for the ENETC4 VF via RX congestion mode.
+  * Added WRR Tx scheduler devarg (``enetc4_txq_wrr``) for ENETC4 VF ring weights.
 
 Removed Items
 -------------
drivers/net/enetc/base/enetc_hw.h +5 -0
index 33d075fe59..5a71f01db9 100644
@@ -86,6 +86,11 @@ enum enetc_bdr_type {TX, RX};
 
 #define ENETC_RTBLENR_LEN(n)		((n) & ~0x7)
 #define ENETC_TBMR_EN			BIT(31)
+/* TBaMR[WRR] bits [6:4]: weight for same-priority ring arbitration (0=1x .. 7=8x). */
+#define ENETC_TBMR_WRR_MASK		GENMASK(6, 4)
+#define ENETC_TBMR_WRR(n)		((((n) - 1) & 0x7) << 4)
+/* TBaMR[PRIO] bits [2:0]: strict priority (0=lowest, 7=highest). */
+#define ENETC_TBMR_PRIO_MASK		GENMASK(2, 0)
 
 /* Port regs, offset: 1_0000h */
 #define ENETC_PORT_BASE			0x10000
drivers/net/enetc/enetc.h +1 -0
index 8aaf8a7eb1..e0943d093a 100644
@@ -134,6 +134,7 @@ struct enetc_eth_hw {
 	uint32_t vsi_timeout; /* VSI-PSI message wait timeout (iterations) */
 	uint32_t vsi_delay;   /* VSI-PSI message wait delay (us) */
 	uint32_t *txq_prior;  /* per-queue TX priority (TBMR priority bits) */
+	uint32_t *txq_wrr;    /* per-queue TX WRR weight pre-shifted for TBMR[WRR] */
 	uint8_t nc_mode;      /* 1 = non-cacheable BD memory, use _nc ops */
 	uint8_t rxq_intr_en;  /* 1 = per-queue Rx MSI-X interrupts enabled */
 	/* 1 = legacy PF-to-VF link message layout (4-bit speed / 4-bit cookie),
drivers/net/enetc/enetc4_ethdev.c +75 -22

168 lines not on this page · raw message

Signature · 1 line
2.25.1
#46 lore raw

v4 cover net/enetc: add new features for ENETC4 on i.MX95

In reply to Gagandeep Singh

V4-changes:
- fix doc build issue: WARNING: undefined label: pmd_build_and_test

v3-changes:
- fix doc build issue.
- fix compilation issue on fedore:43-gcc-minsize

V2-changes:
- compilation fixes.

V1-changes:
This series adds new PMD features to the ENETC4 driver targeting the NXP i.MX95 NETC IP.

The series covers:

- KEEP_CRC Rx offload: preserve the Ethernet FCS in the receive buffer.
- TSO: TCP Segmentation Offload for the VF Tx path.
- RSC/LRO: hardware Receive Segment Coalesce for PF and VF Rx paths.
- Link speed code: extend the PF-to-VF mailbox field from 4-bit to 8-bit to support speeds beyond 10G.
- Firmware version: report the NETC IP version via fw_version_get.
- Register dump: dump SI, port (PF) and BD ring registers.
- Ring parameters: implement rxq_info_get / txq_info_get for the VF.
- Link-up interrupt: refresh the cached link speed on each VF link-up interrupt so that link_update returns the current speed immediately.
- Stats reset: software snapshot/delta approach for VF counter reset.
- Per-queue Rx interrupt: MSI-X per-queue Rx interrupts for the VF, enabling interrupt-driven receive with l3fwd-power.
- SI VLAN: hardware port VLAN insertion/removal for PF and VF.
- VF link status bitmask: switch VF link status to bitmask encoding to align with the PF and newer kernel driver conventions.
- TX PAUSE: VF sets Rx congestion mode when the PF signals TX PAUSE negotiated on the wire; adds Flow control = Y to enetc4.ini.
- WRR Tx scheduler: per-ring WRR weights via enetc4_txq_wrr devarg.

Gagandeep Singh (14):
net/enetc: add KEEP_CRC offload support for ENETC4 net/enetc: add TSO support for ENETC4 VF
net/enetc: add RSC (hardware LRO) support for ENETC4 net/enetc: extend link speed code field to 8-bit for PF-to-VF message net/enetc: support firmware version get for VF
net/enetc: support registers dump
net/enetc: support ethtool ring parameters
net/enetc: refresh link speed on VF link-up interrupt net/enetc: support stats reset for VF
net/enetc4: add per-queue Rx interrupt support for VF net/enetc4: add SI-based port VLAN insertion and removal net/enetc4: update VF link status to bitmask encoding net/enetc4: enable TX PAUSE via VF RX congestion mode net/enetc4: add WRR Tx scheduler devarg for VF rings

 doc/guides/nics/enetc4.rst             |  77 +++
 doc/guides/nics/features/enetc4.ini    |   8 +
 doc/guides/rel_notes/release_26_11.rst |  19 +
 drivers/net/enetc/base/enetc4_hw.h     | 129 +++-
 drivers/net/enetc/base/enetc_hw.h      |   6 +
 drivers/net/enetc/enetc.h              | 135 ++++-
 drivers/net/enetc/enetc4_ethdev.c      | 402 +++++++++++--
 drivers/net/enetc/enetc4_vf.c          | 779 ++++++++++++++++++++++---
 drivers/net/enetc/enetc_rxtx.c         | 529 ++++++++++++++++-
 9 files changed, 1939 insertions(+), 145 deletions(-)
Signature · 1 line
2.25.1
#47 lore raw

PATCH v4 1/14 net/enetc: add KEEP_CRC offload support for ENETC4

The legacy ENETC (LS1028A) driver already supports the RTE_ETH_RX_OFFLOAD_KEEP_CRC offload, but ENETC4 (i.MX95 NETC) did not.

Add KEEP_CRC support for ENETC4 (both PF and VF):

- Advertise RTE_ETH_RX_OFFLOAD_KEEP_CRC in the supported Rx offloads for the ENETC4 PF and VF. The VF reuses the PF Rx queue setup, so the HW configuration and datapath handling apply to both.
- Configure the per-ring RBaMR[CRC] bit in the Rx queue setup so that HW preserves the Ethernet FCS in the receive buffer when the offload is requested (0 = FCS removed, 1 = FCS preserved).
- Follow the DPDK convention used by the legacy ENETC and ixgbe drivers:
set crc_len to RTE_ETHER_CRC_LEN when KEEP_CRC is enabled and have the datapath subtract crc_len from pkt_len/data_len. ENETC and ENETC4 share the same datapath (enetc_rxtx.c), so the semantics stay consistent.
- Handle the scatter-gather boundary case where the 4-byte FCS straddles the last two segments: drop the trailing segment, decrement nb_segs and trim the carry-over from its predecessor.

Update the enetc4 feature matrix to list CRC offload.

---
 doc/guides/nics/features/enetc4.ini    |  1 +
 doc/guides/rel_notes/release_26_11.rst |  6 ++++
 drivers/net/enetc/base/enetc4_hw.h     |  4 +++
 drivers/net/enetc/enetc4_ethdev.c      | 31 ++++++++++++++++++--
 drivers/net/enetc/enetc4_vf.c          |  1 +
 drivers/net/enetc/enetc_rxtx.c         | 39 +++++++++++++++++++++++---
 6 files changed, 75 insertions(+), 7 deletions(-)
doc/guides/nics/features/enetc4.ini +1 -0
index 698140e30b..91b18d979e 100644
@@ -16,6 +16,7 @@ Packet type parsing  = Y
 Basic stats          = Y
 L3 checksum offload  = Y
 L4 checksum offload  = Y
+CRC offload          = Y
 Queue start/stop     = Y
 Scattered Rx         = Y
 Linux                = Y
doc/guides/rel_notes/release_26_11.rst +6 -0
index c8cc86295d..3678dd6894 100644
@@ -56,6 +56,12 @@ New Features
      =======================================================
 
 
+* **Updated NXP ENETC4 PMD.**
+
+  Updated the NXP ENETC4 poll mode driver for i.MX95:
+
+  * Added KEEP_CRC Rx offload support for the ENETC4 PMD to preserve the Ethernet FCS.
+
 Removed Items
 -------------
 
drivers/net/enetc/base/enetc4_hw.h +4 -0
index 9685e7e1e5..0105549857 100644
@@ -68,6 +68,10 @@ struct enetc_msg_swbd {
 #define PM_CMD_CFG_TX_EN		BIT(0)
 #define PM_CMD_CFG_RX_EN		BIT(1)
 
+/* RBaMR[CRC]: 0 = FCS removed, 1 = FCS preserved (KEEP_CRC) */
+#define ENETC4_RBMR_CRC			BIT(8)
+
+
 /* i.MX95 supports jumbo frame, but it is recommended to set the max frame
  * size to 2000 bytes.
  */
drivers/net/enetc/enetc4_ethdev.c +28 -3
index 2ddd63dafb..1a8056580c 100644
@@ -11,6 +11,19 @@
 #include "enetc_logs.h"
 #include "enetc.h"
 
+/* Supported Rx offloads */
+static uint64_t dev_rx_offloads_sup =
+	RTE_ETH_RX_OFFLOAD_IPV4_CKSUM |
+	RTE_ETH_RX_OFFLOAD_UDP_CKSUM |
+	RTE_ETH_RX_OFFLOAD_TCP_CKSUM |
+	RTE_ETH_RX_OFFLOAD_KEEP_CRC;
+
+/* Supported Tx offloads */
+static uint64_t dev_tx_offloads_sup =
+	RTE_ETH_TX_OFFLOAD_IPV4_CKSUM |
+	RTE_ETH_TX_OFFLOAD_UDP_CKSUM |
+	RTE_ETH_TX_OFFLOAD_TCP_CKSUM;
+
 #define ENETC4_TXQ_PRIORITIES	"enetc4_txq_prior"
 #define ENETC4_NC_MEMORY	"nc"
 
@@ -536,6 +549,8 @@ enetc4_rx_queue_setup(struct rte_eth_dev *dev,
 	struct enetc_eth_adapter *adapter =
 			ENETC_DEV_PRIVATE(data->dev_private);
 	uint64_t rx_offloads = data->dev_conf.rxmode.offloads;
+	uint32_t rx_enable;
+	bool keep_crc;
 
 	PMD_INIT_FUNC_TRACE();
 	if (nb_rx_desc > MAX_BD_COUNT)
@@ -549,6 +564,9 @@ enetc4_rx_queue_setup(struct rte_eth_dev *dev,
 	}
 
 	rx_ring->index = rx_queue_id;
+	keep_crc = !!(rx_offloads & RTE_ETH_RX_OFFLOAD_KEEP_CRC);
+	rx_ring->crc_len = (uint8_t)(keep_crc ? RTE_ETHER_CRC_LEN : 0);
+
 	err = enetc4_alloc_rxbdr(rx_ring, nb_rx_desc);
 	if (err)
 		goto fail;
@@ -562,19 +580,25 @@ enetc4_rx_queue_setup(struct rte_eth_dev *dev,
 	data->rx_queues[rx_queue_id] = rx_ring;
 	rx_ring->rx_deferred_start = rx_conf->rx_deferred_start;
 
+	if (keep_crc)
+		rx_enable |= ENETC4_RBMR_CRC;
+	else
+		rx_enable &= ~ENETC4_RBMR_CRC;
+
 	if (!rx_conf->rx_deferred_start) {
 		/* enable ring */
+		rx_enable |= ENETC_RBMR_EN;
 		enetc4_rxbdr_wr(&adapter->hw.hw, rx_ring->index, ENETC_RBMR,
-			       ENETC_RBMR_EN);
+			       rx_enable);
 		dev->data->rx_queue_state[rx_ring->index] =
 			       RTE_ETH_QUEUE_STATE_STARTED;
 	} else {
+		enetc4_rxbdr_wr(&adapter->hw.hw, rx_ring->index, ENETC_RBMR,
+			       rx_enable);
 		dev->data->rx_queue_state[rx_ring->index] =
 			       RTE_ETH_QUEUE_STATE_STOPPED;
 	}
 
-	rx_ring->crc_len = (uint8_t)((rx_offloads & RTE_ETH_RX_OFFLOAD_KEEP_CRC) ?
-				     RTE_ETHER_CRC_LEN : 0);
 	return 0;
 fail:
 	rte_free(rx_ring);
@@ -582,6 +606,7 @@ enetc4_rx_queue_setup(struct rte_eth_dev *dev,
 	return err;
 }
 
+
 void
 enetc4_rx_queue_release(struct rte_eth_dev *dev, uint16_t qid)
 {
drivers/net/enetc/enetc4_vf.c +1 -0
index ef5f1e6d66..83a1e4931f 100644
@@ -52,6 +52,7 @@ static uint64_t dev_rx_offloads_sup =
 	RTE_ETH_RX_OFFLOAD_UDP_CKSUM |
 	RTE_ETH_RX_OFFLOAD_TCP_CKSUM |
 	RTE_ETH_RX_OFFLOAD_VLAN_FILTER |
+	RTE_ETH_RX_OFFLOAD_KEEP_CRC |
 	RTE_ETH_RX_OFFLOAD_SCATTER;
 
 /* Supported Tx offloads */
drivers/net/enetc/enetc_rxtx.c +35 -4
index 8678bafece..e3bef607dd 100644
@@ -530,6 +530,28 @@ enetc_clean_rx_ring(struct enetc_bdr *rx_ring,
 	return rx_frm_cnt;
 }
 
+/*
+ * Trim the Ethernet FCS from a received cluster when HW CRC strip is
+ * disabled. pkt_len is reduced by crc_len. If the FCS straddles the last
+ * two segments (last seg holds fewer bytes than crc_len), drop the trailing
+ * segment and trim the carry-over from its predecessor. prev_seg is the
+ * segment preceding last_seg in the chain (the caller already tracks it).
+ */
+static inline void
+enetc_rx_crc_trim(struct rte_mbuf *first_seg, struct rte_mbuf *prev_seg,
+		  struct rte_mbuf *last_seg, uint16_t crc_len)
+{
+	first_seg->pkt_len -= crc_len;
+	if (likely(last_seg->data_len > crc_len)) {
+		last_seg->data_len -= crc_len;
+	} else if (prev_seg != NULL) {
+		first_seg->nb_segs--;
+		prev_seg->data_len -= crc_len - last_seg->data_len;
+		prev_seg->next = NULL;
+		rte_pktmbuf_free_seg(last_seg);
+	}
+}
+
 static int
 enetc_clean_rx_ring_nc(struct enetc_bdr *rx_ring,
 		    struct rte_mbuf **rx_pkts,
@@ -539,7 +561,7 @@ enetc_clean_rx_ring_nc(struct enetc_bdr *rx_ring,
 	int cleaned_cnt, i;
 	struct enetc_swbd *rx_swbd;
 	union enetc_rx_bd *rxbd, rxbd_temp;
-	struct rte_mbuf *first_seg, *cur_seg;
+	struct rte_mbuf *first_seg = NULL, *cur_seg = NULL;
 	uint32_t bd_status;
 	uint8_t *data;
 	uint32_t j;
@@ -572,6 +594,7 @@ enetc_clean_rx_ring_nc(struct enetc_bdr *rx_ring,
 		if (!first_seg) {
 			first_seg = seg;
 			cur_seg = seg;
+			prev_seg = NULL;
 			first_seg->pkt_len = data_len;
 			enetc_dev_rx_parse(first_seg, rxbd_temp.r.parse_summary);
 			first_seg->hash.rss = rxbd_temp.r.rss_hash;
@@ -579,6 +602,7 @@ enetc_clean_rx_ring_nc(struct enetc_bdr *rx_ring,
 			first_seg->pkt_len += data_len;
 			first_seg->nb_segs++;
 			cur_seg->next = seg;
+			prev_seg = cur_seg;
 			cur_seg = seg;
 		}
 
@@ -590,7 +614,9 @@ enetc_clean_rx_ring_nc(struct enetc_bdr *rx_ring,
 
 		if (bd_status & ENETC_RXBD_LSTATUS_F) {
 			seg->next = NULL;
-			first_seg->pkt_len -= rx_ring->crc_len;
+			if (rx_ring->crc_len)
+				enetc_rx_crc_trim(first_seg, prev_seg, seg,
+						  rx_ring->crc_len);
 			rx_pkts[rx_frm_cnt] = first_seg;
 			rx_frm_cnt++;
 			first_seg = NULL;
@@ -760,7 +786,7 @@ enetc_clean_rx_ring_cacheable(struct enetc_bdr *rx_ring,
 	int cleaned_cnt, i;
 	struct enetc_swbd *rx_swbd;
 	union enetc_rx_bd *rxbd;
-	struct rte_mbuf *first_seg, *cur_seg;
+	struct rte_mbuf *first_seg = NULL, *cur_seg = NULL;
 	uint32_t bd_status;
 	uint8_t *data;
 	uint32_t j;
@@ -815,6 +841,7 @@ enetc_clean_rx_ring_cacheable(struct enetc_bdr *rx_ring,
 		if (!first_seg) {
 			first_seg = seg;
 			cur_seg = seg;
+			prev_seg = NULL;
 			first_seg->pkt_len = data_len;
 			enetc_dev_rx_parse(first_seg,
 					   rxbd->r.parse_summary);
@@ -823,6 +850,7 @@ enetc_clean_rx_ring_cacheable(struct enetc_bdr *rx_ring,
 			first_seg->pkt_len += data_len;
 			first_seg->nb_segs++;
 			cur_seg->next = seg;
+			prev_seg = cur_seg;
 			cur_seg = seg;
 		}
 
@@ -838,7 +866,10 @@ enetc_clean_rx_ring_cacheable(struct enetc_bdr *rx_ring,
 
 		if (bd_status & ENETC_RXBD_LSTATUS_F) {
 			seg->next = NULL;
-			first_seg->pkt_len -= rx_ring->crc_len;
+			if (rx_ring->crc_len)
+				enetc_rx_crc_trim(first_seg, prev_seg, seg,
+						  rx_ring->crc_len);
+
 			rx_pkts[rx_frm_cnt] = first_seg;
 			rx_frm_cnt++;
 			first_seg = NULL;
Signature · 1 line
2.25.1
#48 lore raw

PATCH v4 2/14 net/enetc: add TSO support for ENETC4 VF

In reply to Gagandeep Singh

Add TCP and UDP segmentation offload (TSO) for the ENETC4 virtual function. The offload is advertised through the VF Tx capabilities and is enabled on a per-queue basis when an application requests the TSO offload flags during Tx queue setup.

A dedicated Tx burst, enetc_xmit_pkts_lso(), builds the large-send descriptor chain: a standard header BD, a 16B extension BD carrying the segment size and frame length extension, and one BD per payload buffer with the final-frame flag on the last BD. To make room for the extra extension BD, an LSO-enabled Tx ring is allocated with twice the number of descriptors. The existing non-TSO Tx paths are left unchanged.

Update the ENETC4 feature list and documentation accordingly.

---
 doc/guides/nics/enetc4.rst             |   2 +
 doc/guides/nics/features/enetc4.ini    |   1 +
 doc/guides/rel_notes/release_26_11.rst |   1 +
 drivers/net/enetc/base/enetc4_hw.h     |  35 +++-
 drivers/net/enetc/enetc.h              |   5 +
 drivers/net/enetc/enetc4_ethdev.c      |  45 ++++-
 drivers/net/enetc/enetc4_vf.c          |   2 +
 drivers/net/enetc/enetc_rxtx.c         | 255 +++++++++++++++++++++++++
 8 files changed, 341 insertions(+), 5 deletions(-)
doc/guides/nics/enetc4.rst +2 -0
index f0dd039f6e..4d27e4048e 100644
@@ -53,6 +53,8 @@ Key functionality includes:
 - Receive processing: Upon packet reception, the BD Ring status bit is set,
   facilitating packet processing.
 - Transmission: Packet transmission precedes reception, ensuring efficient data transfer.
+- TCP and UDP segmentation offload (TSO) on VFs, enabled per Tx queue
+  when the TSO offload flag is requested.
 
 
 Prerequisites
doc/guides/nics/features/enetc4.ini +1 -0
index 91b18d979e..8ec1e8d00f 100644
@@ -7,6 +7,7 @@
 Link status event    = Y
 Speed capabilities   = Y
 Link status          = Y
+TSO                  = Y
 Promiscuous mode     = Y
 Allmulticast mode    = Y
 Unicast MAC filter   = Y
doc/guides/rel_notes/release_26_11.rst +1 -0
index 3678dd6894..6a348ab4e0 100644
@@ -61,6 +61,7 @@ New Features
   Updated the NXP ENETC4 poll mode driver for i.MX95:
 
   * Added KEEP_CRC Rx offload support for the ENETC4 PMD to preserve the Ethernet FCS.
+  * Added TCP Segmentation Offload (TSO) support for the ENETC4 VF.
 
 Removed Items
 -------------
drivers/net/enetc/base/enetc4_hw.h +34 -1
index 0105549857..64c1a5e750 100644
@@ -1,5 +1,5 @@
 /* SPDX-License-Identifier: BSD-3-Clause
- * Copyright 2024 NXP
+ * Copyright 2024-2026 NXP
  *
  * This header file defines the register offsets and bit fields
  * of ENETC4 PF and VFs.
@@ -24,8 +24,14 @@ struct enetc_msg_swbd {
 
 /* enetc4 txbd flags */
 #define ENETC4_TXBD_FLAGS_L4CS		BIT(0)
+/* Request LSO (Large Send Offload) segmentation for this frame */
+#define ENETC4_TXBD_FLAGS_LSO		BIT(1)
+/* L4 checksum insertion (also used for checksum update on LSO) */
 #define ENETC4_TXBD_FLAGS_L_TX_CKSUM	BIT(3)
+/* Extended descriptor: the next 16B ring entry is an extension BD */
+#define ENETC4_TXBD_FLAGS_EXT		BIT(6)
 #define ENETC4_TXBD_FLAGS_F		BIT(7)
+
 /* L4 type */
 #define ENETC4_TXBD_L4T_UDP		BIT(0)
 #define ENETC4_TXBD_L4T_TCP		BIT(1)
@@ -34,6 +40,33 @@ struct enetc_msg_swbd {
 /* IPv4 checksum */
 #define ENETC4_TXBD_IPCS		1
 
+/*
+ * Extension Transmit Buffer Descriptor (16B). When the standard BD has the
+ * extended flag set, this occupies the next ring entry and carries the extra
+ * fields required by LSO.
+ */
+struct enetc_tx_bd_ext {
+	uint32_t timestamp;	/* PTP timestamp, unused for LSO */
+	uint32_t vlan;		/* VLAN insert, unused for LSO */
+	uint32_t lso;		/* LSO_MAX_SEG_SIZE and FRM_LEN_EXT */
+	uint32_t flags;		/* extension flags */
+};
+
+/* LSO_MAX_SEG_SIZE occupies bits 13-0 of the LSO word */
+#define ENETC4_TXBD_EXT_LSO_SEG_MASK	0x3fff
+#define ENETC4_TXBD_EXT_LSO_SEG(mss) \
+		((uint32_t)((mss) & ENETC4_TXBD_EXT_LSO_SEG_MASK))
+/* FRM_LEN_EXT occupies bits 19-16 of the LSO word (top 4 bits of data len) */
+#define ENETC4_TXBD_EXT_FRM_LEN_EXT(x) \
+		(((uint32_t)((x) & 0xf)) << 16)
+/* Final flag in the extension flags word (bit 127 -> local bit 31) */
+#define ENETC4_TXBD_EXT_FLAGS_F		BIT(31)
+
+/* NETC does not create LSO frames larger than this many bytes */
+#define ENETC4_LSO_MAX_FRAME		9600
+/* Maximum LSO data unit (payload to be segmented) supported by HW: 256KB */
+#define ENETC4_LSO_MAX_DATA_UNIT	(256 * 1024)
+
 /***************************ENETC port registers**************************/
 #define ENETC4_PMR		0x10
 #define ENETC4_PMR_EN		(BIT(16) | BIT(17) | BIT(18))
drivers/net/enetc/enetc.h +5 -0
index d3a8b8e34a..db349e051b 100644
@@ -91,6 +91,7 @@ struct enetc_bdr {
 		void *tcisr; /* Tx */
 		int next_to_alloc; /* Rx */
 	};
+
 	struct rte_mempool *mb_pool;   /* mbuf pool to populate RX ring. */
 	/* Partial scatter-gather chain persisted across burst calls. */
 	struct rte_mbuf *pkt_first_seg; /* first segment of in-progress frame */
@@ -99,6 +100,7 @@ struct enetc_bdr {
 	uint64_t ierrors;
 	uint8_t rx_deferred_start;
 	uint8_t tx_deferred_start;
+	uint8_t lso_enable;
 };
 
 struct enetc_eth_hw {
@@ -312,6 +314,9 @@ uint16_t enetc_xmit_pkts(void *txq, struct rte_mbuf **tx_pkts,
 		uint16_t nb_pkts);
 uint16_t enetc_xmit_pkts_nc(void *txq, struct rte_mbuf **tx_pkts,
 		uint16_t nb_pkts);
+uint16_t enetc_xmit_pkts_lso(void *txq, struct rte_mbuf **tx_pkts,
+		uint16_t nb_pkts);
+
 uint16_t enetc_recv_pkts(void *rxq, struct rte_mbuf **rx_pkts,
 		uint16_t nb_pkts);
 uint16_t enetc_recv_pkts_nc(void *rxq, struct rte_mbuf **rx_pkts,
drivers/net/enetc/enetc4_ethdev.c +41 -4

94 lines not on this page · raw message

drivers/net/enetc/enetc4_vf.c +2 -0
index 83a1e4931f..3083a56335 100644
@@ -60,6 +60,8 @@ static uint64_t dev_tx_offloads_sup =
 	RTE_ETH_TX_OFFLOAD_IPV4_CKSUM |
 	RTE_ETH_TX_OFFLOAD_UDP_CKSUM |
 	RTE_ETH_TX_OFFLOAD_TCP_CKSUM |
+	RTE_ETH_TX_OFFLOAD_TCP_TSO |
+	RTE_ETH_TX_OFFLOAD_UDP_TSO |
 	RTE_ETH_TX_OFFLOAD_MULTI_SEGS;
 
 static void
drivers/net/enetc/enetc_rxtx.c +255 -0

261 lines not on this page · raw message

Signature · 1 line
2.25.1
#49 lore raw

PATCH v4 3/14 net/enetc: add RSC (hardware LRO) support for ENETC4

In reply to Gagandeep Singh

Add Receive Segment Coalesce (RSC) support, exposed as the DPDK RTE_ETH_RX_OFFLOAD_TCP_LRO Rx offload, for the ENETC4 PF and VF on i.MX95. RSC lets the HW coalesce multiple in-order TCP segments of a flow into a single receive frame, reducing per-packet overhead.

RSC is a port-level offload driven by a dedicated Rx burst (enetc_recv_pkts_rsc). When TCP LRO is requested the ring is switched to 32B extended receive descriptors (RBaMR[BDS] = 1), the FCS is stripped (RBaMR[CRC] = 0, so RSC is incompatible with KEEP_CRC), interrupt coalescing is enabled (RBaICR0[ICEN] with a non-zero RBaICR1[ICTT] hold timer that doubles as the RSC flush window), and RBaRSCR[EN] is set with the coalesced-frame size clamped to the HW maximum.

Because a 32B descriptor spans two 16B ring slots, the ring length register (RBaLENR) and the consumer-index register are programmed in HW-descriptor units (slot count / 2), while the internal SW indices continue to track 16B slots. Coalesced clusters are delivered with the RTE_MBUF_F_RX_LRO flag set when RSC_FRAMES > 1.

---
 doc/guides/nics/enetc4.rst             |   4 +
 doc/guides/nics/features/enetc4.ini    |   1 +
 doc/guides/rel_notes/release_26_11.rst |   1 +
 drivers/net/enetc/base/enetc4_hw.h     |  74 ++++++++
 drivers/net/enetc/enetc.h              |   5 +
 drivers/net/enetc/enetc4_ethdev.c      | 102 ++++++++++-
 drivers/net/enetc/enetc4_vf.c          |   1 +
 drivers/net/enetc/enetc_rxtx.c         | 239 ++++++++++++++++++++++++-
 8 files changed, 418 insertions(+), 9 deletions(-)
doc/guides/nics/enetc4.rst +4 -0
index 4d27e4048e..e7f4348603 100644
@@ -55,6 +55,10 @@ Key functionality includes:
 - Transmission: Packet transmission precedes reception, ensuring efficient data transfer.
 - TCP and UDP segmentation offload (TSO) on VFs, enabled per Tx queue
   when the TSO offload flag is requested.
+- Large receive offload (LRO) on the receive path via hardware Receive
+  Segment Coalesce (RSC), enabled when the TCP LRO Rx offload flag is
+  requested. RSC requires the FCS to be stripped, so it cannot be combined
+  with the KEEP_CRC Rx offload.
 
 
 Prerequisites
doc/guides/nics/features/enetc4.ini +1 -0
index 8ec1e8d00f..aae398e210 100644
@@ -7,6 +7,7 @@
 Link status event    = Y
 Speed capabilities   = Y
 Link status          = Y
+LRO                  = Y
 TSO                  = Y
 Promiscuous mode     = Y
 Allmulticast mode    = Y
doc/guides/rel_notes/release_26_11.rst +1 -0
index 6a348ab4e0..0dd08e0259 100644
@@ -62,6 +62,7 @@ New Features
 
   * Added KEEP_CRC Rx offload support for the ENETC4 PMD to preserve the Ethernet FCS.
   * Added TCP Segmentation Offload (TSO) support for the ENETC4 VF.
+  * Added Receive Segment Coalesce (RSC / hardware LRO) support for ENETC4 PF and VF.
 
 Removed Items
 -------------
drivers/net/enetc/base/enetc4_hw.h +74 -0

81 lines not on this page · raw message

drivers/net/enetc/enetc.h +5 -0
index db349e051b..67f8ce1919 100644
@@ -101,6 +101,8 @@ struct enetc_bdr {
 	uint8_t rx_deferred_start;
 	uint8_t tx_deferred_start;
 	uint8_t lso_enable;
+	void *rbidr;
+	uint8_t rsc_enable;
 };
 
 struct enetc_eth_hw {
@@ -321,12 +323,15 @@ uint16_t enetc_recv_pkts(void *rxq, struct rte_mbuf **rx_pkts,
 		uint16_t nb_pkts);
 uint16_t enetc_recv_pkts_nc(void *rxq, struct rte_mbuf **rx_pkts,
 		uint16_t nb_pkts);
+uint16_t enetc_recv_pkts_rsc(void *rxq, struct rte_mbuf **rx_pkts,
+		uint16_t nb_pkts);
 uint16_t enetc_xmit_pkts_cacheable(void *txq, struct rte_mbuf **tx_pkts,
 		uint16_t nb_pkts);
 uint16_t enetc_recv_pkts_cacheable(void *rxq, struct rte_mbuf **rx_pkts,
 		uint16_t nb_pkts);
 
 int enetc_refill_rx_ring(struct enetc_bdr *rx_ring, const int buff_cnt);
+int enetc_refill_rx_ring_rsc(struct enetc_bdr *rx_ring, const int buff_cnt);
 
 /*
  * Cache-maintenance constants for cacheable BD ring mode.
drivers/net/enetc/enetc4_ethdev.c +95 -7

169 lines not on this page · raw message

drivers/net/enetc/enetc4_vf.c +1 -0
index 3083a56335..be79a18a39 100644
@@ -53,6 +53,7 @@ static uint64_t dev_rx_offloads_sup =
 	RTE_ETH_RX_OFFLOAD_TCP_CKSUM |
 	RTE_ETH_RX_OFFLOAD_VLAN_FILTER |
 	RTE_ETH_RX_OFFLOAD_KEEP_CRC |
+	RTE_ETH_RX_OFFLOAD_TCP_LRO |
 	RTE_ETH_RX_OFFLOAD_SCATTER;
 
 /* Supported Tx offloads */
drivers/net/enetc/enetc_rxtx.c +237 -2

257 lines not on this page · raw message

Signature · 1 line
2.25.1
#50 lore raw

PATCH v4 4/14 net/enetc: extend link speed code field to 8-bit for PF-to-VF message

In reply to Gagandeep Singh

The PF-to-VF message is only 16-bit wide, where the upper 8-bit is the class_id and the lower 8-bit carries the message content. For the link speed message, the lower 4-bit was previously occupied by the cookie field, leaving only 4-bit for the speed code, which allows at most 15 distinct speed values.

As the NETC IP evolves and supports more and more link speeds, 15 speed values are clearly insufficient. Since the cookie field is designed for non-blocking messages and has no meaningful use in link speed messages, remove it and expand the speed code field from 4-bit to 8-bit, allowing up to 255 speed values (ENETC_SPEED_MAX = 0xff).

Instead of enumerating every speed value greater than 5Gbps explicitly, introduce a formula-based approach:

	speed_code = (link_speed - 5000) / 1000 + ENETC_SPEED_5000

This removes the explicit enum entries for 10G, 25G, 50G and 100G, and replaces the individual switch-case branches with a generic implementation to get the speed, making it easy to support any future high speed without modifying the enum or the switch statement.

For backward compatibility with a PF running an older kernel (before 6.18.37) that still uses the legacy 4-bit speed code / 4-bit cookie message layout, add a "vf_link_legacy" devarg. When set to 1, the VF extracts the message result from the upper 4 bits of the lower byte and decodes speeds greater than 5Gbps using the legacy fixed class codes (10G/25G/50G/100G). The default (0) uses the new 8-bit layout.

	Usage: -a <pci_addr>,vf_link_legacy=1
---
 doc/guides/rel_notes/release_26_11.rst |   1 +
 drivers/net/enetc/enetc.h              |  32 ++++-
 drivers/net/enetc/enetc4_vf.c          | 175 +++++++++++++++++++++----
 3 files changed, 175 insertions(+), 33 deletions(-)
doc/guides/rel_notes/release_26_11.rst +1 -0
index 0dd08e0259..d7961d3c85 100644
@@ -63,6 +63,7 @@ New Features
   * Added KEEP_CRC Rx offload support for the ENETC4 PMD to preserve the Ethernet FCS.
   * Added TCP Segmentation Offload (TSO) support for the ENETC4 VF.
   * Added Receive Segment Coalesce (RSC / hardware LRO) support for ENETC4 PF and VF.
+  * Extended the PF-to-VF link speed code field from 4-bit to 8-bit in ENETC4.
 
 Removed Items
 -------------
drivers/net/enetc/enetc.h +27 -5
index 67f8ce1919..c983cb059e 100644
@@ -120,6 +120,10 @@ struct enetc_eth_hw {
 	uint32_t vsi_delay;   /* VSI-PSI message wait delay (us) */
 	uint32_t *txq_prior;  /* per-queue TX priority (TBMR priority bits) */
 	uint8_t nc_mode;      /* 1 = non-cacheable BD memory, use _nc ops */
+	/* 1 = legacy PF-to-VF link message layout (4-bit speed / 4-bit cookie),
+	 * for PF kernel versions before 6.18.37. Set via vf_link_legacy devarg.
+	 */
+	uint8_t vf_link_legacy;
 };
 
 /*
@@ -211,11 +215,29 @@ enum speed {
 	ENETC_SPEED_1000 = 0x5,
 	ENETC_SPEED_2500 = 0x6,
 	ENETC_SPEED_5000 = 0x7,
-	ENETC_SPEED_10G = 0x8,
-	ENETC_SPEED_25G = 0x9,
-	ENETC_SPEED_50G = 0xA,
-	ENETC_SPEED_100G = 0xB,
-	ENETC_SPEED_NOT_SUPPORTED = 0xF
+	/* Base speed class code used by the >5Gbps formula below */
+	/* Do not add enumeration values for any speed greater than
+	 * 5Gbps. For any speed greater than 5Gbps, its speed class
+	 * code should follow the formula below.
+	 *
+	 * SPEED = (link_speed - 5000) / 1000 + ENETC_SPEED_5000
+	 *
+	 * The unit of link_speed should be Mbps, the max SPEED
+	 * should <= ENETC_SPEED_MAX.
+	 */
+	ENETC_SPEED_MAX = 0xff,
+};
+
+/* Legacy speed class codes for backward compatibility with an older kernel PF
+ * (before 6.18.37) that encoded a 4-bit speed code and 4-bit cookie in the
+ * message's lower byte. Used only when the vf_link_legacy devarg is set.
+ */
+enum speed_legacy {
+	ENETC_SPEED_LEGACY_10G = 0x8,
+	ENETC_SPEED_LEGACY_25G = 0x9,
+	ENETC_SPEED_LEGACY_50G = 0xA,
+	ENETC_SPEED_LEGACY_100G = 0xB,
+	ENETC_SPEED_LEGACY_NOT_SUPPORTED = 0xF
 };
 
 /* PSI-VSI command header format */
drivers/net/enetc/enetc4_vf.c +147 -28

248 lines not on this page · raw message

Signature · 1 line
2.25.1
#51 lore raw

PATCH v4 5/14 net/enetc: support firmware version get for VF

In reply to Gagandeep Singh

Implement the ``.fw_version_get`` eth_dev op for the ENETC4 VF PMD to report the NETC IP revision.

The NETC IP major revision is read from the PCI revision ID register, while the IP minor revision is retrieved from the PSI over VSI-PSI messaging using the "Get IP version" command class (class ID 0xF0, command ID 0x1). The version is reported in the "<major>.<minor>" format.

The PSI firmware only implements the IP_MN command of this class, so the major revision is obtained from the PCI revision ID, matching the behaviour of the kernel PF/VF drivers.

---
 doc/guides/nics/enetc4.rst             |   1 +
 doc/guides/nics/features/enetc4.ini    |   1 +
 doc/guides/rel_notes/release_26_11.rst |   1 +
 drivers/net/enetc/enetc.h              |  19 +++-
 drivers/net/enetc/enetc4_vf.c          | 135 +++++++++++++++++++++++++
 5 files changed, 155 insertions(+), 2 deletions(-)
doc/guides/nics/enetc4.rst +1 -0
index e7f4348603..ea0e37896d 100644
@@ -59,6 +59,7 @@ Key functionality includes:
   Segment Coalesce (RSC), enabled when the TCP LRO Rx offload flag is
   requested. RSC requires the FCS to be stripped, so it cannot be combined
   with the KEEP_CRC Rx offload.
+- Firmware version: The NETC IP version is reported via ``rte_eth_dev_fw_version_get``.
 
 
 Prerequisites
doc/guides/nics/features/enetc4.ini +1 -0
index aae398e210..eaf474e7ba 100644
@@ -16,6 +16,7 @@ VLAN filter          = Y
 RSS hash             = Y
 Packet type parsing  = Y
 Basic stats          = Y
+FW version           = Y
 L3 checksum offload  = Y
 L4 checksum offload  = Y
 CRC offload          = Y
doc/guides/rel_notes/release_26_11.rst +1 -0
index d7961d3c85..5ac2bb4de0 100644
@@ -64,6 +64,7 @@ New Features
   * Added TCP Segmentation Offload (TSO) support for the ENETC4 VF.
   * Added Receive Segment Coalesce (RSC / hardware LRO) support for ENETC4 PF and VF.
   * Extended the PF-to-VF link speed code field from 4-bit to 8-bit in ENETC4.
+  * Added firmware version reporting for the ENETC4 VF.
 
 Removed Items
 -------------
drivers/net/enetc/enetc.h +17 -2
index c983cb059e..b1428f1bca 100644
@@ -170,7 +170,8 @@ enum enetc_msg_cmd_class_id {
 	ENETC_CLASS_ID_MAC_FILTER = 0x20,
 	ENETC_CLASS_ID_VLAN_FILTER = 0x21,
 	ENETC_CLASS_ID_LINK_STATUS = 0x80,
-	ENETC_CLASS_ID_LINK_SPEED = 0x81
+	ENETC_CLASS_ID_LINK_SPEED = 0x81,
+	ENETC_CLASS_ID_GET_IP_VER = 0xF0
 };
 
 /* Enum for command IDs */
@@ -184,9 +185,18 @@ enum enetc_msg_cmd_id {
 	ENETC_CMD_ID_GET_LINK_STATUS = 0,
 	ENETC_CMD_ID_REGISTER_LINK_NOTIF = 1,
 	ENETC_CMD_ID_UNREGISTER_LINK_NOTIF = 2,
-	ENETC_CMD_ID_GET_LINK_SPEED = 0
+	ENETC_CMD_ID_GET_LINK_SPEED = 0,
+	/* Get IP version command IDs (class ID 0xF0) */
+	ENETC_CMD_ID_GET_IP_MJ = 0,
+	ENETC_CMD_ID_GET_IP_MN = 1,
+	ENETC_CMD_ID_GET_IP_INT = 2,
+	ENETC_CMD_ID_GET_IP_MNT = 3,
+	ENETC_CMD_ID_GET_IP_CFG = 4
 };
 
+/* IP_VER value returned when the version is not available */
+#define ENETC_IP_VER_NOT_AVAILABLE	0xFF
+
 enum mac_addr_status {
 	ENETC_INVALID_MAC_ADDR = 0x0,
 	ENETC_DUPLICATE_MAC_ADDR = 0X1,
@@ -274,6 +284,11 @@ struct enetc_msg_cmd_get_link_speed {
 	struct enetc_msg_cmd_header header;
 };
 
+/* Get IP version command message format (class ID 0xF0) */
+struct enetc_msg_cmd_get_ip_ver {
+	struct enetc_msg_cmd_header header;
+};
+
 struct enetc_msg_cmd_set_vlan_promisc {
 	struct enetc_msg_cmd_header header;
 	uint8_t op;
drivers/net/enetc/enetc4_vf.c +135 -0

159 lines not on this page · raw message

Signature · 1 line
2.25.1
#52 lore raw

PATCH v4 6/14 net/enetc: support registers dump

In reply to Gagandeep Singh

Implement the .get_reg operation for the ENETC4 PF and VF PMDs to dump the device registers via rte_eth_dev_get_reg_info.

The VF dumps the registers reachable by a virtual station interface (VSI): the station interface and per-ring BD ring registers. Port registers are not accessible by a VF.

The PF additionally dumps the port registers, which are only accessible by the physical station interface (PSI).

---
 doc/guides/nics/enetc4.rst             |  1 +
 doc/guides/nics/features/enetc4.ini    |  1 +
 doc/guides/rel_notes/release_26_11.rst |  1 +
 drivers/net/enetc/enetc.h              | 13 +++++
 drivers/net/enetc/enetc4_ethdev.c      | 70 ++++++++++++++++++++++++++
 drivers/net/enetc/enetc4_vf.c          | 62 +++++++++++++++++++++++
 6 files changed, 148 insertions(+)
doc/guides/nics/enetc4.rst +1 -0
index ea0e37896d..cd757be12f 100644
@@ -60,6 +60,7 @@ Key functionality includes:
   requested. RSC requires the FCS to be stripped, so it cannot be combined
   with the KEEP_CRC Rx offload.
 - Firmware version: The NETC IP version is reported via ``rte_eth_dev_fw_version_get``.
+- Registers dump: The station interface, port (PF only) and BD ring registers are dumped via ``rte_eth_dev_get_reg_info``.
 
 
 Prerequisites
doc/guides/nics/features/enetc4.ini +1 -0
index eaf474e7ba..6540a43909 100644
@@ -17,6 +17,7 @@ RSS hash             = Y
 Packet type parsing  = Y
 Basic stats          = Y
 FW version           = Y
+Registers dump       = Y
 L3 checksum offload  = Y
 L4 checksum offload  = Y
 CRC offload          = Y
doc/guides/rel_notes/release_26_11.rst +1 -0
index 5ac2bb4de0..deb3bc5d52 100644
@@ -65,6 +65,7 @@ New Features
   * Added Receive Segment Coalesce (RSC / hardware LRO) support for ENETC4 PF and VF.
   * Extended the PF-to-VF link speed code field from 4-bit to 8-bit in ENETC4.
   * Added firmware version reporting for the ENETC4 VF.
+  * Added register dump support for ENETC4 PF and VF.
 
 Removed Items
 -------------
drivers/net/enetc/enetc.h +13 -0
index b1428f1bca..73404308fe 100644
@@ -397,6 +397,19 @@ enetc_bd_unused(struct enetc_bdr *bdr)
 	return bdr->bd_count + bdr->next_to_clean - bdr->next_to_use - 1;
 }
 
+/* Per-ring Tx BDR registers dumped by .get_reg (shared by PF and VF) */
+static const uint32_t enetc4_txbdr_regs[] = {
+	ENETC_TBMR, ENETC_TBSR, ENETC_TBBAR0, ENETC_TBBAR1,
+	ENETC_TBCIR, ENETC_TBLENR,
+};
+
+/* Per-ring Rx BDR registers dumped by .get_reg (shared by PF and VF) */
+static const uint32_t enetc4_rxbdr_regs[] = {
+	ENETC_RBMR, ENETC_RBSR, ENETC_RBBSR, ENETC_RBCIR,
+	ENETC_RBBAR0, ENETC_RBBAR1, ENETC_RBPIR, ENETC_RBLENR,
+};
+
+
 /* CBDR prototypes */
 int enetc4_setup_cbdr(struct rte_eth_dev *dev, struct enetc_hw *hw,
 			int bd_count, struct netc_cbdr *cbdr);
drivers/net/enetc/enetc4_ethdev.c +70 -0

82 lines not on this page · raw message

drivers/net/enetc/enetc4_vf.c +62 -0

80 lines not on this page · raw message

Signature · 1 line
2.25.1
#53 lore raw

PATCH v4 7/14 net/enetc: support ethtool ring parameters

In reply to Gagandeep Singh

The ethtool ring parameter query relies on the queue info ethdev ops (.rxq_info_get/.txq_info_get) together with the descriptor limits reported in dev_info. The PF already registered these ops, but the VF ops tables did not, so ring parameter queries failed on the VF.

Make enetc4_rxq_info_get() and enetc4_txq_info_get() non-static and register them in both VF ops tables so ring parameters are reported for both the PF and VF.

---
 doc/guides/rel_notes/release_26_11.rst | 1 +
 drivers/net/enetc/enetc.h              | 4 ++++
 drivers/net/enetc/enetc4_ethdev.c      | 4 ++--
 drivers/net/enetc/enetc4_vf.c          | 4 ++++
 4 files changed, 11 insertions(+), 2 deletions(-)
doc/guides/rel_notes/release_26_11.rst +1 -0
index deb3bc5d52..9e333edf4f 100644
@@ -66,6 +66,7 @@ New Features
   * Extended the PF-to-VF link speed code field from 4-bit to 8-bit in ENETC4.
   * Added firmware version reporting for the ENETC4 VF.
   * Added register dump support for ENETC4 PF and VF.
+  * Added ring parameters support for the ENETC4 VF (rxq_info_get / txq_info_get).
 
 Removed Items
 -------------
drivers/net/enetc/enetc.h +4 -0
index 73404308fe..367d350dde 100644
@@ -339,6 +339,10 @@ int enetc4_tx_queue_stop(struct rte_eth_dev *dev, uint16_t qidx);
 void enetc4_tx_queue_release(struct rte_eth_dev *dev, uint16_t qid);
 const uint32_t *enetc4_supported_ptypes_get(struct rte_eth_dev *dev __rte_unused,
 			size_t *no_of_elements);
+void enetc4_rxq_info_get(struct rte_eth_dev *dev, uint16_t queue_id,
+			 struct rte_eth_rxq_info *qinfo);
+void enetc4_txq_info_get(struct rte_eth_dev *dev, uint16_t queue_id,
+			 struct rte_eth_txq_info *qinfo);
 
 /*
  * enetc4_vf function prototype
drivers/net/enetc/enetc4_ethdev.c +2 -2
index 681bac3ecc..afee0b90a3 100644
@@ -1125,7 +1125,7 @@ enetc4_tx_queue_stop(struct rte_eth_dev *dev, uint16_t qidx)
 	return 0;
 }
 
-static void
+void
 enetc4_rxq_info_get(struct rte_eth_dev *dev, uint16_t queue_id,
 			struct rte_eth_rxq_info *qinfo)
 {
@@ -1139,7 +1139,7 @@ enetc4_rxq_info_get(struct rte_eth_dev *dev, uint16_t queue_id,
 	qinfo->conf.rx_drop_en = 0;
 }
 
-static void
+void
 enetc4_txq_info_get(struct rte_eth_dev *dev, uint16_t queue_id,
 			struct rte_eth_txq_info *qinfo)
 {
drivers/net/enetc/enetc4_vf.c +4 -0
index 77bec0425a..90b7b99e9a 100644
@@ -1508,10 +1508,12 @@ static const struct eth_dev_ops enetc4_vf_ops_no_vsi_m = {
 	.rx_queue_start       = enetc4_rx_queue_start,
 	.rx_queue_stop        = enetc4_rx_queue_stop,
 	.rx_queue_release     = enetc4_rx_queue_release,
+	.rxq_info_get         = enetc4_rxq_info_get,
 	.tx_queue_setup       = enetc4_tx_queue_setup,
 	.tx_queue_start       = enetc4_tx_queue_start,
 	.tx_queue_stop        = enetc4_tx_queue_stop,
 	.tx_queue_release     = enetc4_tx_queue_release,
+	.txq_info_get         = enetc4_txq_info_get,
 	.dev_supported_ptypes_get = enetc4_supported_ptypes_get,
 };
 
@@ -1537,10 +1539,12 @@ static const struct eth_dev_ops enetc4_vf_ops = {
 	.rx_queue_start       = enetc4_rx_queue_start,
 	.rx_queue_stop        = enetc4_rx_queue_stop,
 	.rx_queue_release     = enetc4_rx_queue_release,
+	.rxq_info_get         = enetc4_rxq_info_get,
 	.tx_queue_setup       = enetc4_tx_queue_setup,
 	.tx_queue_start       = enetc4_tx_queue_start,
 	.tx_queue_stop        = enetc4_tx_queue_stop,
 	.tx_queue_release     = enetc4_tx_queue_release,
+	.txq_info_get         = enetc4_txq_info_get,
 	.dev_supported_ptypes_get = enetc4_supported_ptypes_get,
 };
 
Signature · 1 line
2.25.1
#54 lore raw

PATCH v4 8/14 net/enetc: refresh link speed on VF link-up interrupt

In reply to Gagandeep Singh

The interrupt-driven link-status path (enetc4_process_psi_msg) only updated link_status when a PSI-to-VSI notification arrived; it never re-queried the link speed from the PF. As a result, after a link-down followed by a link-up the cached link_speed showed the speed from the previous session rather than the freshly negotiated one.

Fix this by:

1. Introducing enetc4_decode_link_speed() - a shared helper that maps a PF-to-VF speed status code to the corresponding RTE_ETH_SPEED_NUM_* / RTE_ETH_LINK_*_DUPLEX values, handling both the current and the legacy (vf_link_legacy) 4-bit message layout.

2. Calling enetc4_vf_get_link_speed() inside enetc4_process_psi_msg() on ENETC_LINK_UP so the negotiated speed is fetched from the PF and decoded immediately, before rte_eth_linkstatus_set() is called and the LSC callback is fired.

---
 doc/guides/rel_notes/release_26_11.rst |   1 +
 drivers/net/enetc/enetc4_vf.c          | 197 +++++++++++++------------
 2 files changed, 107 insertions(+), 91 deletions(-)
doc/guides/rel_notes/release_26_11.rst +1 -0
index 9e333edf4f..eca0dc1dea 100644
@@ -67,6 +67,7 @@ New Features
   * Added firmware version reporting for the ENETC4 VF.
   * Added register dump support for ENETC4 PF and VF.
   * Added ring parameters support for the ENETC4 VF (rxq_info_get / txq_info_get).
+  * Refreshed VF link speed on the link-up interrupt in the ENETC4 VF driver.
 
 Removed Items
 -------------
drivers/net/enetc/enetc4_vf.c +106 -91

218 lines not on this page · raw message

Signature · 1 line
2.25.1
#55 lore raw

PATCH v4 9/14 net/enetc: support stats reset for VF

In reply to Gagandeep Singh

The NETC SI-level hardware counters (SIROCT0, SIRFRM0, SITOCT0, SITFRM0, SITDFCR) are read-only for a VF and cannot be directly zeroed. No VSI-PSI command class exists for stats reset, and using FLR/soft-reset to clear counters is not reliable due to a known hardware erratum on some NETC platforms.

Implement stats_reset for the enetc4 VF PMD using a software snapshot/delta approach: on stats_reset, the current HW counter values are captured as a baseline in a new per-device enetc4_vf_stats_saved struct. stats_get then reports the delta (current_hw_value - saved_baseline), so counters appear to start from zero after each reset call. Per-ring software Rx error accumulators (ierrors) are zeroed directly on reset.

Register the stats_reset callback in both VF ops tables (enetc4_vf_ops and enetc4_vf_ops_no_vsi_m) so the feature is available regardless of whether the VSI messaging path is enabled.

---
 doc/guides/rel_notes/release_26_11.rst |  1 +
 drivers/net/enetc/enetc.h              | 17 +++++++
 drivers/net/enetc/enetc4_vf.c          | 61 +++++++++++++++++++++++---
 3 files changed, 74 insertions(+), 5 deletions(-)
doc/guides/rel_notes/release_26_11.rst +1 -0
index eca0dc1dea..b88e2825a6 100644
@@ -68,6 +68,7 @@ New Features
   * Added register dump support for ENETC4 PF and VF.
   * Added ring parameters support for the ENETC4 VF (rxq_info_get / txq_info_get).
   * Refreshed VF link speed on the link-up interrupt in the ENETC4 VF driver.
+  * Added stats reset for the ENETC4 VF using a software snapshot/delta approach.
 
 Removed Items
 -------------
drivers/net/enetc/enetc.h +17 -0
index 367d350dde..3590cf6639 100644
@@ -105,6 +105,21 @@ struct enetc_bdr {
 	uint8_t rsc_enable;
 };
 
+/*
+ * Saved SI counter baseline for VF stats reset. Since the SI-level
+ * hardware counters (SIROCT0, SIRFRM0, SITOCT0, SITFRM0, SITDFCR)
+ * are read-only for a VF and cannot be directly zeroed, stats_reset
+ * captures the current counter values as a baseline. stats_get then
+ * reports the delta: current_hw_value - baseline.
+ */
+struct enetc4_vf_stats_saved {
+	uint64_t ipackets;
+	uint64_t opackets;
+	uint64_t ibytes;
+	uint64_t obytes;
+	uint64_t oerrors;
+};
+
 struct enetc_eth_hw {
 	struct rte_eth_dev *ndev;
 	struct enetc_hw hw;
@@ -124,6 +139,8 @@ struct enetc_eth_hw {
 	 * for PF kernel versions before 6.18.37. Set via vf_link_legacy devarg.
 	 */
 	uint8_t vf_link_legacy;
+	/* Baseline snapshot for VF stats reset (software delta approach). */
+	struct enetc4_vf_stats_saved vf_stats_saved;
 };
 
 /*
drivers/net/enetc/enetc4_vf.c +56 -5

83 lines not on this page · raw message

Signature · 1 line
2.25.1
#56 lore raw

PATCH v4 10/14 net/enetc4: add per-queue Rx interrupt support for VF

In reply to Gagandeep Singh

Add MSI-X per-queue Rx interrupt support to the ENETC4 VF PMD on the cacheable (default) Rx path. This allows applications such as l3fwd-power to block in epoll_wait when no traffic is present, reducing CPU utilization to near zero.

MSI-X vector 0 is reserved for the PSI-to-VSI mailbox. Rx queue i is mapped to MSI-X vector i + 1 via ENETC_SIMSIRRV. Per-ring coalescing is enabled with ICPT=1 so the first arriving packet fires the interrupt immediately. The SIRXIDR W1C detect bit is cleared before re-arming ENETC_RBIER to prevent spurious interrupts after traffic stops.

The interrupt infrastructure (rte_intr_efd_enable + rte_intr_vec_list_alloc) is set up before rte_intr_enable() so that vfio-pci can wire each MSI-X vector to its eventfd when programming the MSI-X table.

enetc4_dev_configure() is updated to trigger interrupt setup when intr_conf.rxq is set (not only when intr_conf.lsc is set), as applications like l3fwd-power set intr_conf.rxq without setting lsc.

Documentation is updated to describe the feature, list the kernel and host setup steps, and provide an example l3fwd-power command for single queue/core interrupt-driven operation.

---
 doc/guides/nics/enetc4.rst             | 65 +++++++++++++++++++
 doc/guides/nics/features/enetc4.ini    |  1 +
 doc/guides/rel_notes/release_26_11.rst |  1 +
 drivers/net/enetc/base/enetc4_hw.h     |  2 +
 drivers/net/enetc/enetc.h              |  1 +
 drivers/net/enetc/enetc4_ethdev.c      |  9 +--
 drivers/net/enetc/enetc4_vf.c          | 88 +++++++++++++++++++++++++-
 7 files changed, 162 insertions(+), 5 deletions(-)
doc/guides/nics/enetc4.rst +65 -0
index cd757be12f..96bca8f0fb 100644
@@ -59,6 +59,10 @@ Key functionality includes:
   Segment Coalesce (RSC), enabled when the TCP LRO Rx offload flag is
   requested. RSC requires the FCS to be stripped, so it cannot be combined
   with the KEEP_CRC Rx offload.
+- Per-queue Rx interrupts on VFs (cacheable Rx path only), enabling
+  interrupt-driven receive with ``vfio-pci``. Applications set
+  ``intr_conf.rxq = 1`` in ``rte_eth_conf`` to activate this feature.
+  See `Rx Interrupt Mode (VF)`_ for setup details.
 - Firmware version: The NETC IP version is reported via ``rte_eth_dev_fw_version_get``.
 - Registers dump: The station interface, port (PF only) and BD ring registers are dumped via ``rte_eth_dev_get_reg_info``.
 
@@ -156,3 +160,64 @@ PF/Common devargs
   Usage example::
 
     dpdk-testpmd -a 0000:00:00.0,nc=1 -- -i
+
+
+Rx Interrupt Mode (VF)
+----------------------
+
+The ENETC4 VF PMD supports per-queue MSI-X Rx interrupts on the cacheable
+(default) Rx path. This allows applications to block in ``epoll_wait``
+instead of busy-polling, reducing CPU utilization when traffic is absent.
+
+**MSI-X vector assignment**
+
+ENETC4 VF MSI-X vector 0 is reserved for the PSI-to-VSI mailbox interrupt
+(link status notifications). Rx queue ``i`` is mapped to vector ``i + 1``.
+The driver allocates all required eventfds before calling
+``rte_intr_enable()`` so that ``vfio-pci`` can wire each MSI-X vector to
+its eventfd when it programs the MSI-X table.
+
+**Kernel and driver requirements**
+
+- ``vfio-pci`` kernel module with no-IOMMU mode enabled (no SMMU required).
+- The non-cacheable memory mode (``nc=1`` devarg) does **not** support
+  Rx interrupts and returns ``-ENOTSUP`` from ``rx_queue_intr_enable``.
+
+**Host setup**
+
+.. code-block:: console
+
+   # Enable vfio-pci no-IOMMU mode (if SMMU is not available)
+   modprobe vfio enable_unsafe_noiommu_mode=1
+   modprobe vfio-pci
+
+   # Bind the VF to vfio-pci
+   echo vfio-pci > /sys/bus/pci/devices/<vf_pci_addr>/driver_override
+   echo <vf_pci_addr> > /sys/bus/pci/drivers_probe
+
+**Running l3fwd-power with a single queue and core**
+
+The ``l3fwd-power`` sample application demonstrates interrupt-driven Rx.
+It sets ``intr_conf.rxq = 1`` in ``rte_eth_conf``, which triggers the VF
+interrupt setup in the driver. The ``--vfio-intr=msix`` EAL flag instructs
+DPDK to use MSI-X eventfds for interrupt signalling.
+
+.. code-block:: console
+
+   ./dpdk-l3fwd-power -l 0-1 -n 1 --vfio-intr=msix \
+       -a <vf_pci_addr> -- \
+       -p 0x1 --config="(0,0,1)" --no-numa --interrupt-only
+
+Where:
+
+- ``-l 0-1`` assigns the main thread to core 0 and the forwarding lcore to
+  core 1.
+- ``-a <vf_pci_addr>`` specifies the VF PCI address (e.g. ``0000:01:00.1``).
+- ``--config="(0,0,1)"`` maps port 0, queue 0 to lcore 1.
+- ``--interrupt-only`` enables pure interrupt mode (no busy-poll fallback).
+
+With no incoming traffic the forwarding lcore sleeps in ``epoll_wait``;
+CPU utilization drops to near zero. On the first arriving packet the MSI-X
+interrupt fires, the lcore wakes, drains the ring, disables the interrupt,
+processes the burst, then re-enables and re-arms the interrupt before
+returning to sleep.
doc/guides/nics/features/enetc4.ini +1 -0
index 6540a43909..005c64a3ca 100644
@@ -5,6 +5,7 @@
 ;
 [Features]
 Link status event    = Y
+Rx interrupt         = Y
 Speed capabilities   = Y
 Link status          = Y
 LRO                  = Y
doc/guides/rel_notes/release_26_11.rst +1 -0
index b88e2825a6..9b39debc1d 100644
@@ -69,6 +69,7 @@ New Features
   * Added ring parameters support for the ENETC4 VF (rxq_info_get / txq_info_get).
   * Refreshed VF link speed on the link-up interrupt in the ENETC4 VF driver.
   * Added stats reset for the ENETC4 VF using a software snapshot/delta approach.
+  * Added per-queue MSI-X Rx interrupt support for the ENETC4 VF.
 
 Removed Items
 -------------
drivers/net/enetc/base/enetc4_hw.h +2 -0
index 8ad8f169d2..9543e982a2 100644
@@ -250,6 +250,8 @@ struct enetc_rx_bd_ext {
 #define ENETC4_VSIIDR            0xA08
 #define ENETC4_VSIIER_MRIE       BIT(9)
 #define ENETC4_SI_INT_IDX        0
+/* MSI-X vector base for per-Rx-queue interrupts; vector 0 is the mailbox. */
+#define ENETC4_VF_RX_VEC_BASE    1
 
 /* VSI Registers */
 #define ENETC4_VSIMSGSR  0x204   /* RO */
drivers/net/enetc/enetc.h +1 -0
index 3590cf6639..903829323e 100644
@@ -135,6 +135,7 @@ struct enetc_eth_hw {
 	uint32_t vsi_delay;   /* VSI-PSI message wait delay (us) */
 	uint32_t *txq_prior;  /* per-queue TX priority (TBMR priority bits) */
 	uint8_t nc_mode;      /* 1 = non-cacheable BD memory, use _nc ops */
+	uint8_t rxq_intr_en;  /* 1 = per-queue Rx MSI-X interrupts enabled */
 	/* 1 = legacy PF-to-VF link message layout (4-bit speed / 4-bit cookie),
 	 * for PF kernel versions before 6.18.37. Set via vf_link_legacy devarg.
 	 */
drivers/net/enetc/enetc4_ethdev.c +5 -4
index afee0b90a3..d987f1288c 100644
@@ -839,7 +839,8 @@ enetc4_dev_close(struct rte_eth_dev *dev)
 		return 0;
 
 	if (hw->device_id == ENETC4_DEV_ID_VF) {
-		if (dev->data->dev_conf.intr_conf.lsc != 0)
+		if (dev->data->dev_conf.intr_conf.lsc != 0 ||
+		    dev->data->dev_conf.intr_conf.rxq != 0)
 			enetc4_vf_dev_intr(dev, false);
 		ret = enetc4_vf_dev_stop(dev);
 	} else {
@@ -961,12 +962,12 @@ enetc4_dev_configure(struct rte_eth_dev *dev)
 	if (hw->device_id != ENETC4_DEV_ID_VF)
 		enetc4_port_wr(enetc_hw, ENETC4_PARCSCR, checksum);
 
-	/* Enable interrupts */
 	if (hw->device_id == ENETC4_DEV_ID_VF) {
-		if (dev->data->dev_conf.intr_conf.lsc != 0) {
+		if (dev->data->dev_conf.intr_conf.lsc != 0 ||
+		    dev->data->dev_conf.intr_conf.rxq != 0) {
 			ret = enetc4_vf_dev_intr(dev, true);
 			if (ret)
-				ENETC_PMD_WARN("Failed to setup link interrupts");
+				ENETC_PMD_WARN("Failed to setup VF interrupts: %d", ret);
 		}
 	}
 
drivers/net/enetc/enetc4_vf.c +87 -1

125 lines not on this page · raw message

Signature · 1 line
2.25.1
#57 lore raw

PATCH v4 11/14 net/enetc4: add SI-based port VLAN insertion and removal

In reply to Gagandeep Singh

Implement hardware VLAN tag insertion on Tx and removal on Rx via the per-SI VLAN isolation (pvid) mechanism on ENETC4.

On a PF, the driver writes directly to PSIaVLANR(0) (VID + enable bit) and PSIaCFGR0(0) (SIVIE for Tx insertion, VTE for Rx removal, SIVC_CVLAN to allow C-VLAN 0x8100 TPID).

On a privileged VF, the request is forwarded to the kernel PF via the VSI-PSI mailbox using a new command class 0x24 (SI VLAN isolation, cmd ID 0x1). The kernel PF handler programs the same registers on behalf of the VF's station interface. The class 0x24 reply is added to the pass-through list in enetc4_msg_vsi_send() so it is handled correctly alongside the existing command classes.

New additions:
- ENETC4_PSIVLANR(a) and ENETC4_PSICFGR0(a) register macros with field definitions in enetc4_hw.h
- ENETC_CLASS_ID_SI_VLAN_ISO (0x24) and ENETC_CMD_ID_SET_SI_VLAN_ISO enum values, plus struct enetc_msg_si_vlan_iso message layout and bit definitions in enetc.h
- enetc4_vlan_pvid_set() for PF in enetc4_ethdev.c
- enetc4_vf_vlan_pvid_set() for VF in enetc4_vf.c, registered as .vlan_pvid_set in both enetc4_ops and enetc4_vf_ops

The feature is activated in testpmd with:
tx_vlan set pvid <port_id> <vlan_id> on|off

---
 doc/guides/nics/enetc4.rst             |  4 ++
 doc/guides/nics/features/enetc4.ini    |  1 +
 doc/guides/rel_notes/release_26_11.rst |  1 +
 drivers/net/enetc/base/enetc4_hw.h     | 14 +++++
 drivers/net/enetc/enetc.h              | 23 +++++++
 drivers/net/enetc/enetc4_ethdev.c      | 39 ++++++++++++
 drivers/net/enetc/enetc4_vf.c          | 85 ++++++++++++++++++++++++++
 7 files changed, 167 insertions(+)
doc/guides/nics/enetc4.rst +4 -0
index 96bca8f0fb..5ac1d03f74 100644
@@ -65,6 +65,10 @@ Key functionality includes:
   See `Rx Interrupt Mode (VF)`_ for setup details.
 - Firmware version: The NETC IP version is reported via ``rte_eth_dev_fw_version_get``.
 - Registers dump: The station interface, port (PF only) and BD ring registers are dumped via ``rte_eth_dev_get_reg_info``.
+- SI-based port VLAN (pvid): Hardware VLAN tag insertion on Tx and removal on Rx, configured
+  via ``rte_eth_dev_set_vlan_pvid``. On a PF the registers are written directly; on a privileged
+  VF the request is forwarded to the kernel PF through the VSI-PSI mailbox (class 0x24).
+  Use the testpmd command ``tx_vlan set pvid <port_id> <vlan_id> on|off`` to enable or disable.
 
 
 Prerequisites
doc/guides/nics/features/enetc4.ini +1 -0
index 005c64a3ca..01b0dc5b80 100644
@@ -14,6 +14,7 @@ Promiscuous mode     = Y
 Allmulticast mode    = Y
 Unicast MAC filter   = Y
 VLAN filter          = Y
+VLAN offload         = Y
 RSS hash             = Y
 Packet type parsing  = Y
 Basic stats          = Y
doc/guides/rel_notes/release_26_11.rst +1 -0
index 9b39debc1d..e6d96b2a50 100644
@@ -70,6 +70,7 @@ New Features
   * Refreshed VF link speed on the link-up interrupt in the ENETC4 VF driver.
   * Added stats reset for the ENETC4 VF using a software snapshot/delta approach.
   * Added per-queue MSI-X Rx interrupt support for the ENETC4 VF.
+  * Added SI-based port VLAN insertion (Tx) and removal (Rx) for ENETC4 PF and VF.
 
 Removed Items
 -------------
drivers/net/enetc/base/enetc4_hw.h +14 -0
index 9543e982a2..a9552f21f4 100644
@@ -277,6 +277,20 @@ struct enetc_rx_bd_ext {
 #define ENETC4_SICTR0		0x18
 #define ENETC4_SICTR1		0x1c
 
+/* PSI SI VLAN register: per-SI VLAN tag for insertion/removal */
+#define ENETC4_PSIVLANR(a)		((a) * 0x80 + 0x2008)
+#define ENETC4_PSIVLANR_E		BIT(31)  /* enable SI VLAN processing */
+#define ENETC4_PSIVLANR_VTEA		BIT(30)  /* 0=strip tag, 1=zero VID */
+#define ENETC4_PSIVLANR_PCP(v)		(((uint32_t)(v) & 0x7) << 13)
+#define ENETC4_PSIVLANR_DEI		BIT(12)
+#define ENETC4_PSIVLANR_VID(v)		((uint32_t)(v) & 0xfff)
+
+/* PSI SI configuration register 0 */
+#define ENETC4_PSICFGR0(a)		((a) * 0x80 + 0x2010)
+#define ENETC4_PSICFGR0_SIVC_CVLAN	BIT(24)  /* allow C-VLAN 0x8100 */
+#define ENETC4_PSICFGR0_SIVIE		BIT(14)  /* SI VLAN insertion enable */
+#define ENETC4_PSICFGR0_VTE		BIT(12)  /* SI VLAN removal enable */
+
 /* general register accessors */
 #define enetc4_rd_reg(reg)	rte_read32((void *)(reg))
 #define enetc4_wr_reg(reg, val)  rte_write32((val), (void *)(reg))
drivers/net/enetc/enetc.h +23 -0
index 903829323e..72e43572f7 100644
@@ -187,6 +187,8 @@ struct enetc_eth_adapter {
 enum enetc_msg_cmd_class_id {
 	ENETC_CLASS_ID_MAC_FILTER = 0x20,
 	ENETC_CLASS_ID_VLAN_FILTER = 0x21,
+	/* Configure SI VLAN isolation (insert / remove) */
+	ENETC_CLASS_ID_SI_VLAN_ISO = 0x24,
 	ENETC_CLASS_ID_LINK_STATUS = 0x80,
 	ENETC_CLASS_ID_LINK_SPEED = 0x81,
 	ENETC_CLASS_ID_GET_IP_VER = 0xF0
@@ -212,6 +214,11 @@ enum enetc_msg_cmd_id {
 	ENETC_CMD_ID_GET_IP_CFG = 4
 };
 
+/* Command IDs for class ID 0x24 (SI VLAN isolation) */
+enum enetc_msg_si_vlan_cmd_id {
+	ENETC_CMD_ID_SET_SI_VLAN_ISO = 1,
+};
+
 /* IP_VER value returned when the version is not available */
 #define ENETC_IP_VER_NOT_AVAILABLE	0xFF
 
@@ -323,6 +330,22 @@ struct enetc_msg_vlan_exact_filter {
 	uint8_t reserved2;
 };
 
+/* VSI-PSI SI VLAN isolation message (class 0x24, cmd 0x1) */
+struct enetc_msg_si_vlan_iso {
+	struct enetc_msg_cmd_header header;
+	uint8_t ctrl;          /* E[7], VTEA[6], TPID[1:0] */
+	uint8_t pcp_dei_vid_hi; /* PCP[7:5], DEI[4], VID[11:8] */
+	uint8_t vid_lo;        /* VID[7:0] */
+	uint8_t reserved_0;
+	uint8_t flags;         /* SVIE[2], VTE[1] */
+	uint8_t reserved_1[3];
+};
+
+#define ENETC_SI_VLAN_ISO_E	BIT(7)  /* ctrl: enable SI VLAN */
+#define ENETC_SI_VLAN_ISO_VTEA	BIT(6)  /* ctrl: 0=strip, 1=zero VID */
+#define ENETC_SI_VLAN_ISO_SVIE	BIT(2)  /* flags: Tx insertion enable */
+#define ENETC_SI_VLAN_ISO_VTE	BIT(1)  /* flags: Rx removal enable */
+
 struct enetc_psi_reply_msg {
 	uint8_t class_id;
 	uint8_t status;
drivers/net/enetc/enetc4_ethdev.c +39 -0
index d987f1288c..ae40cc69e0 100644
@@ -872,6 +872,44 @@ enetc4_dev_close(struct rte_eth_dev *dev)
 	return ret;
 }
 
+/* Configure SI-based VLAN insertion (Tx) and removal (Rx) for the PF. */
+static int
+enetc4_vlan_pvid_set(struct rte_eth_dev *dev, uint16_t vlan_id, int on)
+{
+	struct enetc_eth_hw *hw =
+		ENETC_DEV_PRIVATE_TO_HW(dev->data->dev_private);
+	struct enetc_hw *enetc_hw = &hw->hw;
+	uint32_t psivlanr, psicfgr0;
+
+	PMD_INIT_FUNC_TRACE();
+
+	psicfgr0 = enetc4_port_rd(enetc_hw, ENETC4_PSICFGR0(0));
+
+	if (on) {
+		/* Build the VLAN register: enable bit + VID (PCP/DEI left 0) */
+		psivlanr = (uint32_t)ENETC4_PSIVLANR_E |
+			   ENETC4_PSIVLANR_VID(vlan_id);
+		enetc4_port_wr(enetc_hw, ENETC4_PSIVLANR(0), psivlanr);
+
+		/* Allow C-VLAN TPID, enable Tx insertion and Rx removal */
+		psicfgr0 |= ENETC4_PSICFGR0_SIVC_CVLAN |
+			    ENETC4_PSICFGR0_SIVIE |
+			    ENETC4_PSICFGR0_VTE;
+		enetc4_port_wr(enetc_hw, ENETC4_PSICFGR0(0), psicfgr0);
+	} else {
+		/* Clear Tx insertion, Rx removal and C-VLAN allow bits */
+		psicfgr0 &= ~(ENETC4_PSICFGR0_SIVC_CVLAN |
+			      ENETC4_PSICFGR0_SIVIE |
+			      ENETC4_PSICFGR0_VTE);
+		enetc4_port_wr(enetc_hw, ENETC4_PSICFGR0(0), psicfgr0);
+
+		/* Clear the VLAN register (disable SI VLAN processing) */
+		enetc4_port_wr(enetc_hw, ENETC4_PSIVLANR(0), 0);
+	}
+
+	return 0;
+}
+
 static int
 enetc4_promiscuous_enable(struct rte_eth_dev *dev)
 {
@@ -1267,6 +1305,7 @@ static const struct eth_dev_ops enetc4_ops = {
 	.get_reg              = enetc4_get_regs,
 	.promiscuous_enable   = enetc4_promiscuous_enable,
 	.promiscuous_disable  = enetc4_promiscuous_disable,
+	.vlan_pvid_set        = enetc4_vlan_pvid_set,
 	.rx_queue_setup       = enetc4_rx_queue_setup,
 	.rx_queue_start       = enetc4_rx_queue_start,
 	.rx_queue_stop        = enetc4_rx_queue_stop,
drivers/net/enetc/enetc4_vf.c +85 -0

105 lines not on this page · raw message

Signature · 1 line
2.25.1
#58 lore raw

PATCH v4 12/14 net/enetc4: update VF link status to bitmask encoding

In reply to Gagandeep Singh

The PF-to-VF link status notification code was previously a two-value enum (UP=0x0, DOWN=0x1). Change this to a bitmask so future bits can carry additional state alongside the link up/down indication:

ENETC_LINK_DOWN BIT(0) -- set when link is down

Link up is now encoded as the DOWN bit being clear, which keeps the wire value for link-down identical (0x1) and ensures backward compatibility with older kernel PFs.

Changes:
- enetc.h: replace enum link_status with a #define bitmask; drop ENETC_LINK_UP (no longer a named constant).
- enetc4_vf.c enetc4_process_psi_msg(): replace switch/case on ENETC_LINK_UP/DOWN with bitmask decode.
- enetc4_vf.c enetc4_vf_link_update(): same bitmask decode.

---
 doc/guides/rel_notes/release_26_11.rst |  1 +
 drivers/net/enetc/enetc.h              |  8 ++++----
 drivers/net/enetc/enetc4_vf.c          | 27 +++++++-------------------
 3 files changed, 12 insertions(+), 24 deletions(-)
doc/guides/rel_notes/release_26_11.rst +1 -0
index e6d96b2a50..5323f4fea3 100644
@@ -71,6 +71,7 @@ New Features
   * Added stats reset for the ENETC4 VF using a software snapshot/delta approach.
   * Added per-queue MSI-X Rx interrupt support for the ENETC4 VF.
   * Added SI-based port VLAN insertion (Tx) and removal (Rx) for ENETC4 PF and VF.
+  * Updated ENETC4 VF link status reporting to use bitmask encoding.
 
 Removed Items
 -------------
drivers/net/enetc/enetc.h +4 -4
index 72e43572f7..40bad56341 100644
@@ -236,10 +236,10 @@ enum vlan_status {
 	ENETC_VLAN_NO_RESOURCE = 0x3
 };
 
-enum link_status {
-	ENETC_LINK_UP = 0x0,
-	ENETC_LINK_DOWN = 0x1
-};
+/* Link status bitmask in PF-to-VF mailbox notification.
+ * Link up is encoded as the DOWN bit being clear.
+ */
+#define ENETC_LINK_DOWN  (1u << 0)
 
 enum speed {
 	ENETC_SPEED_UNKNOWN = 0x0,
drivers/net/enetc/enetc4_vf.c +7 -20
index fc5ea4d609..1b93835dd7 100644
@@ -480,8 +480,10 @@ enetc4_process_psi_msg(struct rte_eth_dev *eth_dev, struct enetc_hw *enetc_hw)
 	enetc4_msg_get_psi_msg(enetc_hw, msg);
 
 	if (msg->class_id == ENETC_CLASS_ID_LINK_STATUS) {
-		switch (msg->status) {
-		case ENETC_LINK_UP:
+		if (msg->status & ENETC_LINK_DOWN) {
+			ENETC_PMD_DEBUG("Link is down");
+			link.link_status = RTE_ETH_LINK_DOWN;
+		} else {
 			ENETC_PMD_DEBUG("Link is up");
 			link.link_status = RTE_ETH_LINK_UP;
 			/* Re-query speed from PF so the cached value reflects
@@ -498,14 +500,6 @@ enetc4_process_psi_msg(struct rte_eth_dev *eth_dev, struct enetc_hw *enetc_hw)
 			} else {
 				ENETC_PMD_WARN("Failed to alloc msg for speed query");
 			}
-			break;
-		case ENETC_LINK_DOWN:
-			ENETC_PMD_DEBUG("Link is down");
-			link.link_status = RTE_ETH_LINK_DOWN;
-			break;
-		default:
-			ENETC_PMD_ERR("Unknown link status 0x%x", msg->status);
-			break;
 		}
 		ret = rte_eth_linkstatus_set(eth_dev, &link);
 		if (!ret)
@@ -1180,17 +1174,10 @@ enetc4_vf_link_update(struct rte_eth_dev *dev, int wait_to_complete __rte_unused
 	}
 
 	if (reply_msg->class_id == ENETC_CLASS_ID_LINK_STATUS) {
-		switch (reply_msg->status) {
-		case ENETC_LINK_UP:
-			link.link_status = RTE_ETH_LINK_UP;
-			break;
-		case ENETC_LINK_DOWN:
+		if (reply_msg->status & ENETC_LINK_DOWN)
 			link.link_status = RTE_ETH_LINK_DOWN;
-			break;
-		default:
-			ENETC_PMD_ERR("Unknown link status");
-			break;
-		}
+		else
+			link.link_status = RTE_ETH_LINK_UP;
 	} else {
 		ENETC_PMD_ERR("Wrong reply message");
 		return -1;
Signature · 1 line
2.25.1
#59 lore raw

PATCH v4 13/14 net/enetc4: enable TX PAUSE via VF RX congestion mode

In reply to Gagandeep Singh

When the PF negotiates TX PAUSE on the port it signals this to the VF via BIT(1) of the PF-to-VF link status mailbox message. The VF PMD must respond by setting RBMR_CM (BIT(4)) on all active RX rings so the MAC emits PAUSE frames on ingress pressure.

Add ENETC_RBMR_CM register definition, ENETC_LINK_TX_PAUSE bitmask, and tx_pause_active state flag. Add enetc4_vf_set_congestion_mode() to update all active RX rings and persist the state for rings started later. Hook it into both the interrupt and poll link-update paths, and apply the saved state in rx_queue_setup() and rx_queue_start().

RX PAUSE (honoring received PAUSE frames) is handled at the MAC level by the PF and requires no VF PMD changes.

---
 doc/guides/nics/features/enetc4.ini    |  1 +
 doc/guides/rel_notes/release_26_11.rst |  1 +
 drivers/net/enetc/base/enetc_hw.h      |  1 +
 drivers/net/enetc/enetc.h              |  9 +++-
 drivers/net/enetc/enetc4_ethdev.c      | 13 +++++-
 drivers/net/enetc/enetc4_vf.c          | 59 ++++++++++++++++++++++++--
 6 files changed, 78 insertions(+), 6 deletions(-)
doc/guides/nics/features/enetc4.ini +1 -0
index 01b0dc5b80..1f599dace7 100644
@@ -14,6 +14,7 @@ Promiscuous mode     = Y
 Allmulticast mode    = Y
 Unicast MAC filter   = Y
 VLAN filter          = Y
+Flow control         = Y
 VLAN offload         = Y
 RSS hash             = Y
 Packet type parsing  = Y
doc/guides/rel_notes/release_26_11.rst +1 -0
index 5323f4fea3..d69888aafb 100644
@@ -72,6 +72,7 @@ New Features
   * Added per-queue MSI-X Rx interrupt support for the ENETC4 VF.
   * Added SI-based port VLAN insertion (Tx) and removal (Rx) for ENETC4 PF and VF.
   * Updated ENETC4 VF link status reporting to use bitmask encoding.
+  * Added TX PAUSE support for the ENETC4 VF via RX congestion mode.
 
 Removed Items
 -------------
drivers/net/enetc/base/enetc_hw.h +1 -0
index 6e96562850..33d075fe59 100644
@@ -51,6 +51,7 @@ enum enetc_bdr_type {TX, RX};
 							+ (off))
 /* RX BDR reg offsets */
 #define ENETC_RBMR		0x0 /* RX BDR mode register*/
+#define ENETC_RBMR_CM		BIT(4)  /* congestion mode: assert congestion to emit TX PAUSE */
 #define ENETC_RBMR_EN		BIT(31)
 
 #define ENETC_BMR_RESET		0x0 /* BDR reset*/
drivers/net/enetc/enetc.h +8 -1
index 40bad56341..8aaf8a7eb1 100644
@@ -140,6 +140,10 @@ struct enetc_eth_hw {
 	 * for PF kernel versions before 6.18.37. Set via vf_link_legacy devarg.
 	 */
 	uint8_t vf_link_legacy;
+	/* 1 = TX PAUSE negotiated on port; VF RX rings must have RBMR_CM set.
+	 * Updated from the PF-to-VF link status mailbox message (BIT(1)).
+	 */
+	uint8_t tx_pause_active;
 	/* Baseline snapshot for VF stats reset (software delta approach). */
 	struct enetc4_vf_stats_saved vf_stats_saved;
 };
@@ -238,8 +242,11 @@ enum vlan_status {
 
 /* Link status bitmask in PF-to-VF mailbox notification.
  * Link up is encoded as the DOWN bit being clear.
+ * TX_PAUSE is set when the port has negotiated TX PAUSE; VF must enable
+ * congestion mode (ENETC_RBMR_CM) on its RX rings accordingly.
  */
-#define ENETC_LINK_DOWN  (1u << 0)
+#define ENETC_LINK_DOWN      (1u << 0)
+#define ENETC_LINK_TX_PAUSE  (1u << 1)
 
 enum speed {
 	ENETC_SPEED_UNKNOWN = 0x0,
drivers/net/enetc/enetc4_ethdev.c +11 -2
index ae40cc69e0..2355522515 100644
@@ -712,8 +712,12 @@ enetc4_rx_queue_setup(struct rte_eth_dev *dev,
 	}
 
 	if (!rx_conf->rx_deferred_start) {
-		/* enable ring */
+		/* Enable ring; apply congestion mode if TX PAUSE is already active. */
 		rx_enable |= ENETC_RBMR_EN;
+		if (adapter->hw.tx_pause_active)
+			rx_enable |= ENETC_RBMR_CM;
+		else
+			rx_enable &= ~(uint32_t)ENETC_RBMR_CM;
 		enetc4_rxbdr_wr(&adapter->hw.hw, rx_ring->index, ENETC_RBMR,
 			       rx_enable);
 		dev->data->rx_queue_state[rx_ring->index] =
@@ -1089,7 +1093,12 @@ enetc4_rx_queue_start(struct rte_eth_dev *dev, uint16_t qidx)
 	if (dev->data->rx_queue_state[qidx] == RTE_ETH_QUEUE_STATE_STOPPED) {
 		rx_data = enetc4_rxbdr_rd(&priv->hw.hw, rx_ring->index,
 					 ENETC_RBMR);
-		rx_data = rx_data | ENETC_RBMR_EN;
+		rx_data |= ENETC_RBMR_EN;
+		/* Restore congestion mode if TX PAUSE is active. */
+		if (priv->hw.tx_pause_active)
+			rx_data |= ENETC_RBMR_CM;
+		else
+			rx_data &= ~(uint32_t)ENETC_RBMR_CM;
 		enetc4_rxbdr_wr(&priv->hw.hw, rx_ring->index, ENETC_RBMR,
 			       rx_data);
 		dev->data->rx_queue_state[qidx] = RTE_ETH_QUEUE_STATE_STARTED;
drivers/net/enetc/enetc4_vf.c +56 -3

87 lines not on this page · raw message

Signature · 1 line
2.25.1
#60 lore raw

PATCH v4 14/14 net/enetc4: add WRR Tx scheduler devarg for VF rings

In reply to Gagandeep Singh

Add enetc4_txq_wrr devarg to configure per-ring WRR weights in the NETC LEAF-level Tx scheduler (TBaMR register, bits [6:4]).

The NETC Tx scheduler has three levels:
- ROOT (port/TC): strict priority + CBS (PF/port space)
- MID (SI/VSI): WBFS shaping (PF space)
- LEAF (Tx BDR): strict priority + frame-based WRR (VF/SI space)

TBaMR is in the VF own SI space, so no Linux PF involvement is needed for PRIO or WRR configuration.

Changes:
- enetc_hw.h: add ENETC_TBMR_WRR_MASK, ENETC_TBMR_WRR(n) macros for TBaMR bits [6:4], and ENETC_TBMR_PRIO_MASK for bits [2:0]
- enetc.h: add txq_wrr pointer to enetc_eth_hw struct
- enetc4_ethdev.c: add parse_txq_wrr() and wire ENETC4_TXQ_WRR devarg through enetc4_get_devargs() and enetc4_dev_configure(); apply WRR bits in enetc4_tx_queue_setup() and enetc4_tx_queue_start()

Usage:

  # strict priority: ring 0 highest
  -a 0002:00:12.0,enetc4_txq_prior="3|2|1"

# WRR 2:4:1 on same-priority rings
-a 0002:00:12.0,enetc4_txq_prior="1|1|1",enetc4_txq_wrr="2|4|1"

---
 doc/guides/rel_notes/release_26_11.rst |  1 +
 drivers/net/enetc/base/enetc_hw.h      |  5 ++
 drivers/net/enetc/enetc.h              |  1 +
 drivers/net/enetc/enetc4_ethdev.c      | 97 ++++++++++++++++++++------
 4 files changed, 82 insertions(+), 22 deletions(-)
doc/guides/rel_notes/release_26_11.rst +1 -0
index d69888aafb..3ea34523fe 100644
@@ -73,6 +73,7 @@ New Features
   * Added SI-based port VLAN insertion (Tx) and removal (Rx) for ENETC4 PF and VF.
   * Updated ENETC4 VF link status reporting to use bitmask encoding.
   * Added TX PAUSE support for the ENETC4 VF via RX congestion mode.
+  * Added WRR Tx scheduler devarg (``enetc4_txq_wrr``) for ENETC4 VF ring weights.
 
 Removed Items
 -------------
drivers/net/enetc/base/enetc_hw.h +5 -0
index 33d075fe59..5a71f01db9 100644
@@ -86,6 +86,11 @@ enum enetc_bdr_type {TX, RX};
 
 #define ENETC_RTBLENR_LEN(n)		((n) & ~0x7)
 #define ENETC_TBMR_EN			BIT(31)
+/* TBaMR[WRR] bits [6:4]: weight for same-priority ring arbitration (0=1x .. 7=8x). */
+#define ENETC_TBMR_WRR_MASK		GENMASK(6, 4)
+#define ENETC_TBMR_WRR(n)		((((n) - 1) & 0x7) << 4)
+/* TBaMR[PRIO] bits [2:0]: strict priority (0=lowest, 7=highest). */
+#define ENETC_TBMR_PRIO_MASK		GENMASK(2, 0)
 
 /* Port regs, offset: 1_0000h */
 #define ENETC_PORT_BASE			0x10000
drivers/net/enetc/enetc.h +1 -0
index 8aaf8a7eb1..e0943d093a 100644
@@ -134,6 +134,7 @@ struct enetc_eth_hw {
 	uint32_t vsi_timeout; /* VSI-PSI message wait timeout (iterations) */
 	uint32_t vsi_delay;   /* VSI-PSI message wait delay (us) */
 	uint32_t *txq_prior;  /* per-queue TX priority (TBMR priority bits) */
+	uint32_t *txq_wrr;    /* per-queue TX WRR weight pre-shifted for TBMR[WRR] */
 	uint8_t nc_mode;      /* 1 = non-cacheable BD memory, use _nc ops */
 	uint8_t rxq_intr_en;  /* 1 = per-queue Rx MSI-X interrupts enabled */
 	/* 1 = legacy PF-to-VF link message layout (4-bit speed / 4-bit cookie),
drivers/net/enetc/enetc4_ethdev.c +75 -22

168 lines not on this page · raw message

Signature · 1 line
2.25.1
#61 lore raw

Re: [PATCH v4 00/14] net/enetc: add new features for ENETC4 on i.MX95

In reply to Gagandeep Singh
Quoted 52 lines · On Fri, 7 Aug 2026 16:56:09 +0530 Gagandeep Singh <[email protected]> wrote:

V4-changes:
- fix doc build issue: WARNING: undefined label: pmd_build_and_test

v3-changes:
- fix doc build issue.
- fix compilation issue on fedore:43-gcc-minsize

V2-changes:
- compilation fixes.

V1-changes:
This series adds new PMD features to the ENETC4 driver targeting the NXP i.MX95 NETC IP.

The series covers:

- KEEP_CRC Rx offload: preserve the Ethernet FCS in the receive buffer.
- TSO: TCP Segmentation Offload for the VF Tx path.
- RSC/LRO: hardware Receive Segment Coalesce for PF and VF Rx paths.
- Link speed code: extend the PF-to-VF mailbox field from 4-bit to 8-bit to support speeds beyond 10G.
- Firmware version: report the NETC IP version via fw_version_get.
- Register dump: dump SI, port (PF) and BD ring registers.
- Ring parameters: implement rxq_info_get / txq_info_get for the VF.
- Link-up interrupt: refresh the cached link speed on each VF link-up interrupt so that link_update returns the current speed immediately.
- Stats reset: software snapshot/delta approach for VF counter reset.
- Per-queue Rx interrupt: MSI-X per-queue Rx interrupts for the VF, enabling interrupt-driven receive with l3fwd-power.
- SI VLAN: hardware port VLAN insertion/removal for PF and VF.
- VF link status bitmask: switch VF link status to bitmask encoding to align with the PF and newer kernel driver conventions.
- TX PAUSE: VF sets Rx congestion mode when the PF signals TX PAUSE negotiated on the wire; adds Flow control = Y to enetc4.ini.
- WRR Tx scheduler: per-ring WRR weights via enetc4_txq_wrr devarg.

Gagandeep Singh (14):
net/enetc: add KEEP_CRC offload support for ENETC4 net/enetc: add TSO support for ENETC4 VF
net/enetc: add RSC (hardware LRO) support for ENETC4 net/enetc: extend link speed code field to 8-bit for PF-to-VF message net/enetc: support firmware version get for VF
net/enetc: support registers dump
net/enetc: support ethtool ring parameters
net/enetc: refresh link speed on VF link-up interrupt net/enetc: support stats reset for VF
net/enetc4: add per-queue Rx interrupt support for VF net/enetc4: add SI-based port VLAN insertion and removal net/enetc4: update VF link status to bitmask encoding net/enetc4: enable TX PAUSE via VF RX congestion mode net/enetc4: add WRR Tx scheduler devarg for VF rings

Quoted 11 lines
 doc/guides/nics/enetc4.rst             |  77 +++
 doc/guides/nics/features/enetc4.ini    |   8 +
 doc/guides/rel_notes/release_26_11.rst |  19 +
 drivers/net/enetc/base/enetc4_hw.h     | 129 +++-
 drivers/net/enetc/base/enetc_hw.h      |   6 +
 drivers/net/enetc/enetc.h              | 135 ++++-
 drivers/net/enetc/enetc4_ethdev.c      | 402 +++++++++++--
 drivers/net/enetc/enetc4_vf.c          | 779 ++++++++++++++++++++++---
 drivers/net/enetc/enetc_rxtx.c         | 529 ++++++++++++++++-
 9 files changed, 1939 insertions(+), 145 deletions(-)

Still lots of issues, the biggest one is that not each patch builds; not bisectable.

More extensive AI review.

ENETC4 v4 series review - 14 patches

No Reviewed-by. The headline finding from the previous round is
unchanged: 13 of the 14 commits fail to build. Only the final commit is clean, so git bisect is broken across essentially the whole series.

Build (applied on c1a46b9, gcc 13.3, -Dwerror=true):

[1] 8a0a793 01/14 add KEEP_CRC offload support for ENETC4
[1] 63cae7e 02/14 add TSO support for ENETC4 VF
[1] b28e1a8 03/14 add RSC (hardware LRO) support

      ... all fail ...

[1] e334f6c 13/14 enable TX PAUSE via VF RX congestion mode
[0] b5e71d6 14/14 add WRR Tx scheduler devarg for VF rings

Three distinct causes, all introduced in patch 01.

Patch 01

Error: prev_seg used but never declared (fails commits 01-02).

enetc_rxtx.c:597:25: error: 'prev_seg' undeclared enetc_rxtx.c:844:25: error: 'prev_seg' undeclared

Patch 01 assigns prev_seg and passes it to enetc_rx_crc_trim() in both enetc_clean_rx_ring_nc() and enetc_clean_rx_ring_cacheable(), but the declaration hunk only changes first_seg/cur_seg to = NULL. The *prev_seg = NULL declaration does not arrive until patch 03. Move it to patch 01.

Error: duplicate offload arrays (fails commits 01-13).

enetc4_ethdev.c:110:17: error: redefinition of 'dev_rx_offloads_sup' enetc4_ethdev.c:117:17: error: redefinition of 'dev_tx_offloads_sup'

Patch 01 adds a second copy of both arrays at the top of enetc4_ethdev.c; the pre-existing ones near line 97 are not deleted until patch 14. The deletion hunk belongs in patch 01.

Error: duplicate rx_enable declaration (fails commits 01-13).

enetc4_ethdev.c:552:18: error: redeclaration of 'rx_enable' with no linkage

enetc4_rx_queue_setup() already declares uint32_t rx_enable upstream. Patch 01 adds a second one; the removal is in patch 14.

This is the signature of building only the squashed series. Please run devtools/test-meson-builds.sh, or at minimum a -Dwerror=true build at each commit, before v5.

Error: PF loses Scattered Rx and Multi-segment Tx.

The old arrays deleted in patch 14 contained RTE_ETH_RX_OFFLOAD_SCATTER and RTE_ETH_TX_OFFLOAD_MULTI_SEGS. The replacements added in patch 01 do not. Net result at the tip:

  upstream                      after the series
  RX: IPV4|UDP|TCP|SCATTER      RX: IPV4|UDP|TCP|KEEP_CRC|TCP_LRO
  TX: IPV4|UDP|TCP|MULTI_SEGS   TX: IPV4|UDP|TCP|TCP_TSO|UDP_TSO

Nothing in any commit message says this is intentional. enetc4.ini still declares "Scattered Rx = Y", and the new RSC path builds multi-segment clusters, so the capability is still needed. The VF arrays keep both - only the PF regresses.

Patch 02

Error: mbuf leak in enetc_xmit_pkts_lso().

Two validation paths drop a TSO frame with "start++; continue;":

- hdr_len >= pkt_len || hdr_len > data_len
- tso_segsz == 0 || data_unit > ENETC4_LSO_MAX_DATA_UNIT || hdr_len + tso_segsz > ENETC4_LSO_MAX_FRAME

Neither writes q_swbd[i].buffer_addr, and neither frees the mbuf, but both count the packet in the burst return value. The application considers it transmitted; enetc_clean_tx_ring() never sees it. Free-and-continue is the right shape here - add rte_pktmbuf_free(seg) before each start++.

Error: 16-bit byte swap on a uint8_t field.

In the non-TSO path of the same function:

  txbd->flags |= rte_cpu_to_le_16(ENETC4_TXBD_FLAGS_F);

struct enetc_tx_bd.flags is uint8_t. On big-endian this evaluates to 0x8000 and truncates to 0, so the frame-last flag is never set and Tx stalls. Upstream and the LSO path in this very function both use plain "txbd->flags |= ENETC4_TXBD_FLAGS_F;". Drop the conversion.

Warning: ring doubling bypasses MAX_BD_COUNT.

Both enetc4_alloc_txbdr() (LSO, patch 02) and enetc4_alloc_rxbdr() (RSC, patch 03) double nb_desc, but the nb_desc > MAX_BD_COUNT check runs before the doubling. With MAX_BD_COUNT at 64000 the effective ring reaches 128000 descriptors, and ENETC_RTBLENR_LEN(n) is just ((n) & ~0x7) with no upper clamp. Validate the post-doubling count, or halve the accepted nb_desc when LSO/RSC is on.

Patch 04

Warning: link speed decode has no upper bound.

  link.link_speed = (reply_msg->status - ENETC_SPEED_5000) * 1000 + 5000;

status is uint8_t and the default arm now catches everything from 8 to 255, so a garbage or unrecognized code yields a fabricated speed (0xFF -> 253000 Mbps) rather than RTE_ETH_SPEED_NUM_UNKNOWN. Note also that 0xF, previously ENETC_SPEED_NOT_SUPPORTED, now decodes as 13000 Mbps in non-legacy mode. Bound the result, or reject codes that do not map to a defined RTE_ETH_SPEED_NUM_* value.

Warning: flipping the reply-status extraction from 4-bit to 8-bit by default is a wire-protocol compatibility break. Users on a PF kernel older than 6.18.37 must add vf_link_legacy=1 or link reporting breaks silently. That deserves an explicit line in the release notes, not just "extended the field to 8-bit".

Info: adds a second #include <rte_kvargs.h> immediately below the existing one.

Series-wide

Warning: mailbox ops added to the no-VSI ops table.

enetc4_vf_ops_no_vsi_m is selected when the user passes enetc4_vsi_disable, that is, explicitly asks for no VSI-PSI messaging. The series adds fw_version_get, mac_addr_set, mac_addr_add, promiscuous_*, allmulticast_*, vlan_filter_set, vlan_offload_set, vlan_pvid_set and stats_reset to it. Most of those reach enetc4_msg_vsi_send() directly or through a helper, so they will now attempt a transaction on the disabled mailbox and stall until vsi_timeout. Previously ethdev returned -ENOTSUP immediately. Only the genuinely register-local ops (get_reg, rxq_info_get, txq_info_get, and stats_reset if it stays direct-register) belong in that table.

Warning: new devargs undocumented.

vf_link_legacy (patch 04) and enetc4_txq_wrr (patch 14) are both in RTE_PMD_REGISTER_PARAM_STRING but absent from doc/guides/nics/enetc4.rst, which documents every pre-existing devarg. Same gap flagged in the previous round.

Info: patch 01 adds two stray blank lines in enetc4_ethdev.c (one before enetc4_rx_queue_release, later removed in patch 03); patch 02 adds three more around enetc4_alloc_txbdr/enetc4_free_bdr and in struct enetc_bdr.

Info: enetc_recv_pkts_rsc is assigned to dev->rx_pkt_burst from enetc4_rx_queue_setup(), which will silently override the nc=1 burst selection made in dev_init. Worth a guard or at least a comment on precedence.

I stopped short of a full read of patches 05-14 since the build breakage has to be resolved first and several of these findings will shift hunks around. I can go back through 05-14 in detail once there is a v5, or now if you would rather have the complete list before the author respins.

#62 lore raw

RE: [PATCH v4 00/14] net/enetc: add new features for ENETC4 on i.MX95

Hi

Quoted 228 lines

-----Original Message-----
From: Stephen Hemminger <[email protected]>
Sent: Monday, August 10, 2026 2:30 AM
To: Gagandeep Singh <[email protected]>
Cc: [email protected]; Hemant Agrawal <[email protected]>
Subject: Re: [PATCH v4 00/14] net/enetc: add new features for ENETC4 on i.MX95

Quoted 52 lines · On Fri, 7 Aug 2026 16:56:09 +0530 Gagandeep Singh <[email protected]> wrote:

V4-changes:
- fix doc build issue: WARNING: undefined label: pmd_build_and_test

v3-changes:
- fix doc build issue.
- fix compilation issue on fedore:43-gcc-minsize

V2-changes:
- compilation fixes.

V1-changes:
This series adds new PMD features to the ENETC4 driver targeting the NXP i.MX95 NETC IP.

The series covers:

- KEEP_CRC Rx offload: preserve the Ethernet FCS in the receive buffer.
- TSO: TCP Segmentation Offload for the VF Tx path.
- RSC/LRO: hardware Receive Segment Coalesce for PF and VF Rx paths.
- Link speed code: extend the PF-to-VF mailbox field from 4-bit to 8-bit to support speeds beyond 10G.
- Firmware version: report the NETC IP version via fw_version_get.
- Register dump: dump SI, port (PF) and BD ring registers.
- Ring parameters: implement rxq_info_get / txq_info_get for the VF.
- Link-up interrupt: refresh the cached link speed on each VF link-up interrupt so that link_update returns the current speed immediately.
- Stats reset: software snapshot/delta approach for VF counter reset.
- Per-queue Rx interrupt: MSI-X per-queue Rx interrupts for the VF, enabling interrupt-driven receive with l3fwd-power.
- SI VLAN: hardware port VLAN insertion/removal for PF and VF.
- VF link status bitmask: switch VF link status to bitmask encoding to align with the PF and newer kernel driver conventions.
- TX PAUSE: VF sets Rx congestion mode when the PF signals TX PAUSE negotiated on the wire; adds Flow control = Y to enetc4.ini.
- WRR Tx scheduler: per-ring WRR weights via enetc4_txq_wrr devarg.

Gagandeep Singh (14):
net/enetc: add KEEP_CRC offload support for ENETC4 net/enetc: add TSO support for ENETC4 VF
net/enetc: add RSC (hardware LRO) support for ENETC4 net/enetc: extend link speed code field to 8-bit for PF-to-VF message net/enetc: support firmware version get for VF
net/enetc: support registers dump
net/enetc: support ethtool ring parameters
net/enetc: refresh link speed on VF link-up interrupt net/enetc: support stats reset for VF
net/enetc4: add per-queue Rx interrupt support for VF net/enetc4: add SI-based port VLAN insertion and removal net/enetc4: update VF link status to bitmask encoding net/enetc4: enable TX PAUSE via VF RX congestion mode net/enetc4: add WRR Tx scheduler devarg for VF rings

Quoted 11 lines
 doc/guides/nics/enetc4.rst             |  77 +++
 doc/guides/nics/features/enetc4.ini    |   8 +
 doc/guides/rel_notes/release_26_11.rst |  19 +
 drivers/net/enetc/base/enetc4_hw.h     | 129 +++-
 drivers/net/enetc/base/enetc_hw.h      |   6 +
 drivers/net/enetc/enetc.h              | 135 ++++-
 drivers/net/enetc/enetc4_ethdev.c      | 402 +++++++++++--
 drivers/net/enetc/enetc4_vf.c          | 779 ++++++++++++++++++++++---
 drivers/net/enetc/enetc_rxtx.c         | 529 ++++++++++++++++-
 9 files changed, 1939 insertions(+), 145 deletions(-)

Still lots of issues, the biggest one is that not each patch builds; not bisectable.

More extensive AI review.

ENETC4 v4 series review - 14 patches

No Reviewed-by. The headline finding from the previous round is
unchanged: 13 of the 14 commits fail to build. Only the final commit is clean, so git bisect is broken across essentially the whole series.

Build (applied on c1a46b9, gcc 13.3, -Dwerror=true):

[1] 8a0a793 01/14 add KEEP_CRC offload support for ENETC4
[1] 63cae7e 02/14 add TSO support for ENETC4 VF
[1] b28e1a8 03/14 add RSC (hardware LRO) support

      ... all fail ...

[1] e334f6c 13/14 enable TX PAUSE via VF RX congestion mode
[0] b5e71d6 14/14 add WRR Tx scheduler devarg for VF rings

Three distinct causes, all introduced in patch 01.

Patch 01

Error: prev_seg used but never declared (fails commits 01-02).

enetc_rxtx.c:597:25: error: 'prev_seg' undeclared enetc_rxtx.c:844:25: error: 'prev_seg' undeclared

Patch 01 assigns prev_seg and passes it to enetc_rx_crc_trim() in both enetc_clean_rx_ring_nc() and enetc_clean_rx_ring_cacheable(), but the declaration hunk only changes first_seg/cur_seg to = NULL. The *prev_seg = NULL declaration does not arrive until patch 03. Move it to patch 01.

Error: duplicate offload arrays (fails commits 01-13).

enetc4_ethdev.c:110:17: error: redefinition of 'dev_rx_offloads_sup' enetc4_ethdev.c:117:17: error: redefinition of 'dev_tx_offloads_sup'

Patch 01 adds a second copy of both arrays at the top of enetc4_ethdev.c; the pre-existing ones near line 97 are not deleted until patch 14. The deletion hunk belongs in patch 01.

Error: duplicate rx_enable declaration (fails commits 01-13).

enetc4_ethdev.c:552:18: error: redeclaration of 'rx_enable' with no linkage

enetc4_rx_queue_setup() already declares uint32_t rx_enable upstream. Patch 01 adds a second one; the removal is in patch 14.

This is the signature of building only the squashed series. Please run devtools/test-meson-builds.sh, or at minimum a -Dwerror=true build at each commit, before v5.

Error: PF loses Scattered Rx and Multi-segment Tx.

The old arrays deleted in patch 14 contained RTE_ETH_RX_OFFLOAD_SCATTER and RTE_ETH_TX_OFFLOAD_MULTI_SEGS. The replacements added in patch 01 do not. Net result at the tip:

  upstream                      after the series
  RX: IPV4|UDP|TCP|SCATTER      RX: IPV4|UDP|TCP|KEEP_CRC|TCP_LRO
  TX: IPV4|UDP|TCP|MULTI_SEGS   TX: IPV4|UDP|TCP|TCP_TSO|UDP_TSO

Nothing in any commit message says this is intentional. enetc4.ini still declares "Scattered Rx = Y", and the new RSC path builds multi-segment clusters, so the capability is still needed. The VF arrays keep both - only the PF regresses.

Patch 02

Error: mbuf leak in enetc_xmit_pkts_lso().

Two validation paths drop a TSO frame with "start++; continue;":

- hdr_len >= pkt_len || hdr_len > data_len
- tso_segsz == 0 || data_unit > ENETC4_LSO_MAX_DATA_UNIT || hdr_len + tso_segsz > ENETC4_LSO_MAX_FRAME

Neither writes q_swbd[i].buffer_addr, and neither frees the mbuf, but both count the packet in the burst return value. The application considers it transmitted; enetc_clean_tx_ring() never sees it.
Free-and-continue is the right shape here - add rte_pktmbuf_free(seg) before each start++.

Error: 16-bit byte swap on a uint8_t field.

In the non-TSO path of the same function:

  txbd->flags |= rte_cpu_to_le_16(ENETC4_TXBD_FLAGS_F);

struct enetc_tx_bd.flags is uint8_t. On big-endian this evaluates to 0x8000 and truncates to 0, so the frame-last flag is never set and Tx stalls. Upstream and the LSO path in this very function both use plain "txbd->flags |= ENETC4_TXBD_FLAGS_F;". Drop the conversion.

Warning: ring doubling bypasses MAX_BD_COUNT.

Both enetc4_alloc_txbdr() (LSO, patch 02) and enetc4_alloc_rxbdr() (RSC, patch
03) double nb_desc, but the nb_desc > MAX_BD_COUNT check runs before the doubling. With MAX_BD_COUNT at 64000 the effective ring reaches 128000 descriptors, and ENETC_RTBLENR_LEN(n) is just
((n) & ~0x7) with no upper clamp. Validate the post-doubling count, or halve the accepted nb_desc when LSO/RSC is on.

Patch 04

Warning: link speed decode has no upper bound.

  link.link_speed = (reply_msg->status - ENETC_SPEED_5000) * 1000 + 5000;

status is uint8_t and the default arm now catches everything from 8 to 255, so a garbage or unrecognized code yields a fabricated speed (0xFF -> 253000 Mbps) rather than RTE_ETH_SPEED_NUM_UNKNOWN. Note also that 0xF, previously ENETC_SPEED_NOT_SUPPORTED, now decodes as 13000 Mbps in non-legacy mode. Bound the result, or reject codes that do not map to a defined RTE_ETH_SPEED_NUM_* value.

Warning: flipping the reply-status extraction from 4-bit to 8-bit by default is a wire-protocol compatibility break. Users on a PF kernel older than 6.18.37 must add vf_link_legacy=1 or link reporting breaks silently. That deserves an explicit line in the release notes, not just "extended the field to 8-bit".

Info: adds a second #include <rte_kvargs.h> immediately below the existing one.

Series-wide

Warning: mailbox ops added to the no-VSI ops table.

enetc4_vf_ops_no_vsi_m is selected when the user passes enetc4_vsi_disable, that is, explicitly asks for no VSI-PSI messaging.
The series adds fw_version_get, mac_addr_set, mac_addr_add, promiscuous_*, allmulticast_*, vlan_filter_set, vlan_offload_set, vlan_pvid_set and stats_reset to it. Most of those reach
enetc4_msg_vsi_send() directly or through a helper, so they will now attempt a transaction on the disabled mailbox and stall until vsi_timeout. Previously ethdev returned -ENOTSUP immediately. Only the genuinely register-local ops (get_reg, rxq_info_get, txq_info_get, and stats_reset if it stays direct-register) belong in that table.

Warning: new devargs undocumented.

vf_link_legacy (patch 04) and enetc4_txq_wrr (patch 14) are both in RTE_PMD_REGISTER_PARAM_STRING but absent from doc/guides/nics/enetc4.rst, which documents every pre-existing devarg. Same gap flagged in the previous round.

Info: patch 01 adds two stray blank lines in enetc4_ethdev.c (one before enetc4_rx_queue_release, later removed in patch 03); patch 02 adds three more around enetc4_alloc_txbdr/enetc4_free_bdr and in struct enetc_bdr.

Quoted 8 lines

Info: enetc_recv_pkts_rsc is assigned to dev->rx_pkt_burst from enetc4_rx_queue_setup(), which will silently override the nc=1 burst selection made in dev_init. Worth a guard or at least a comment on precedence.

I stopped short of a full read of patches 05-14 since the build breakage has to be resolved first and several of these findings will shift hunks around. I can go back through 05-14 in detail once there is a v5, or now if you would rather have the complete list before the author respins.

V5 sent. I missed to mention V5-changes in the cover letter. The changes are:
- Patch 1 Build fixes which includes:
'prev_seg' undeclared fixed.
redefinition of 'dev_rx_offloads_sup' fixed.
Error: duplicate rx_enable declaration fixed.
PF loses Scattered Rx and Multi-segment Tx
- mbuf leak in enetc_xmit_pkts_lso() fixed.
- fixed conversion on ENETC4_TXBD_FLAGS_F issue.
- fixed link speed decode has no upper bound.
- fixed mailbox ops added to the no-VSI ops table.
- new devargs documented.

Regards,
Gagan

#63 lore raw

v5 cover net/enetc: add new features for ENETC4 on i.MX95

In reply to Gagandeep Singh

V4-changes:
- fix doc build issue: WARNING: undefined label: pmd_build_and_test

v3-changes:
- fix doc build issue.
- fix compilation issue on fedore:43-gcc-minsize

V2-changes:
- compilation fixes.

V1-changes:
This series adds new PMD features to the ENETC4 driver targeting the NXP i.MX95 NETC IP.

The series covers:

- KEEP_CRC Rx offload: preserve the Ethernet FCS in the receive buffer.
- TSO: TCP Segmentation Offload for the VF Tx path.
- RSC/LRO: hardware Receive Segment Coalesce for PF and VF Rx paths.
- Link speed code: extend the PF-to-VF mailbox field from 4-bit to 8-bit to support speeds beyond 10G.
- Firmware version: report the NETC IP version via fw_version_get.
- Register dump: dump SI, port (PF) and BD ring registers.
- Ring parameters: implement rxq_info_get / txq_info_get for the VF.
- Link-up interrupt: refresh the cached link speed on each VF link-up interrupt so that link_update returns the current speed immediately.
- Stats reset: software snapshot/delta approach for VF counter reset.
- Per-queue Rx interrupt: MSI-X per-queue Rx interrupts for the VF, enabling interrupt-driven receive with l3fwd-power.
- SI VLAN: hardware port VLAN insertion/removal for PF and VF.
- VF link status bitmask: switch VF link status to bitmask encoding to align with the PF and newer kernel driver conventions.
- TX PAUSE: VF sets Rx congestion mode when the PF signals TX PAUSE negotiated on the wire; adds Flow control = Y to enetc4.ini.
- WRR Tx scheduler: per-ring WRR weights via enetc4_txq_wrr devarg.

Gagandeep Singh (14):
net/enetc: add keep-CRC Rx offload for ENETC4 net/enetc: add TSO support for ENETC4 VF net/enetc: add RSC (hardware LRO) support for ENETC4 net/enetc: extend PF-VF link speed field to 8 bits net/enetc: support firmware version get for VF net/enetc: support registers dump
net/enetc: support ethtool ring parameters net/enetc: refresh link speed on VF link-up interrupt net/enetc: support stats reset for VF net/enetc4: add per-queue Rx interrupt support for VF net/enetc4: add SI-based port VLAN insertion and removal net/enetc4: update VF link status to bitmask encoding net/enetc4: enable Tx PAUSE via VF Rx congestion mode net/enetc4: add WRR Tx scheduler devarg for VF rings

 doc/guides/nics/enetc4.rst             | 100 +++
 doc/guides/nics/features/enetc4.ini    |   8 +
 doc/guides/rel_notes/release_26_11.rst |  21 +
 drivers/net/enetc/base/enetc4_hw.h     | 129 +++-
 drivers/net/enetc/base/enetc_hw.h      |   6 +
 drivers/net/enetc/enetc.h              | 134 ++++-
 drivers/net/enetc/enetc4_ethdev.c      | 413 +++++++++++--
 drivers/net/enetc/enetc4_vf.c          | 801 ++++++++++++++++++++++---
 drivers/net/enetc/enetc_rxtx.c         | 531 +++++++++++++++-
 9 files changed, 1998 insertions(+), 145 deletions(-)
Signature · 1 line
2.25.1
#64 lore raw

PATCH v5 1/14 net/enetc: add keep-CRC Rx offload for ENETC4

The legacy ENETC (LS1028A) driver already supports the RTE_ETH_RX_OFFLOAD_KEEP_CRC offload, but ENETC4 (i.MX95 NETC) did not.

Add KEEP_CRC support for ENETC4 (both PF and VF):

- Advertise RTE_ETH_RX_OFFLOAD_KEEP_CRC in the supported Rx offloads for the ENETC4 PF and VF. The VF reuses the PF Rx queue setup, so the HW configuration and datapath handling apply to both.
- Configure the per-ring RBaMR[CRC] bit in the Rx queue setup so that HW preserves the Ethernet FCS in the receive buffer when the offload is requested (0 = FCS removed, 1 = FCS preserved).
- Follow the DPDK convention used by the legacy ENETC and ixgbe drivers:
set crc_len to RTE_ETHER_CRC_LEN when KEEP_CRC is enabled and have the datapath subtract crc_len from pkt_len/data_len. ENETC and ENETC4 share the same datapath (enetc_rxtx.c), so the semantics stay consistent.
- Handle the scatter-gather boundary case where the 4-byte FCS straddles the last two segments: drop the trailing segment, decrement nb_segs and trim the carry-over from its predecessor.

---
 doc/guides/nics/features/enetc4.ini    |  1 +
 doc/guides/rel_notes/release_26_11.rst |  6 ++++
 drivers/net/enetc/base/enetc4_hw.h     |  4 +++
 drivers/net/enetc/enetc4_ethdev.c      | 45 ++++++++++++++++----------
 drivers/net/enetc/enetc4_vf.c          |  1 +
 drivers/net/enetc/enetc_rxtx.c         | 39 +++++++++++++++++++---
 6 files changed, 75 insertions(+), 21 deletions(-)
doc/guides/nics/features/enetc4.ini +1 -0
index 698140e30b..91b18d979e 100644
@@ -16,6 +16,7 @@ Packet type parsing  = Y
 Basic stats          = Y
 L3 checksum offload  = Y
 L4 checksum offload  = Y
+CRC offload          = Y
 Queue start/stop     = Y
 Scattered Rx         = Y
 Linux                = Y
doc/guides/rel_notes/release_26_11.rst +6 -0
index c8cc86295d..3678dd6894 100644
@@ -56,6 +56,12 @@ New Features
      =======================================================
 
 
+* **Updated NXP ENETC4 PMD.**
+
+  Updated the NXP ENETC4 poll mode driver for i.MX95:
+
+  * Added KEEP_CRC Rx offload support for the ENETC4 PMD to preserve the Ethernet FCS.
+
 Removed Items
 -------------
 
drivers/net/enetc/base/enetc4_hw.h +4 -0
index 9685e7e1e5..0105549857 100644
@@ -68,6 +68,10 @@ struct enetc_msg_swbd {
 #define PM_CMD_CFG_TX_EN		BIT(0)
 #define PM_CMD_CFG_RX_EN		BIT(1)
 
+/* RBaMR[CRC]: 0 = FCS removed, 1 = FCS preserved (KEEP_CRC) */
+#define ENETC4_RBMR_CRC			BIT(8)
+
+
 /* i.MX95 supports jumbo frame, but it is recommended to set the max frame
  * size to 2000 bytes.
  */
drivers/net/enetc/enetc4_ethdev.c +28 -17

85 lines not on this page · raw message

drivers/net/enetc/enetc4_vf.c +1 -0
index ef5f1e6d66..83a1e4931f 100644
@@ -52,6 +52,7 @@ static uint64_t dev_rx_offloads_sup =
 	RTE_ETH_RX_OFFLOAD_UDP_CKSUM |
 	RTE_ETH_RX_OFFLOAD_TCP_CKSUM |
 	RTE_ETH_RX_OFFLOAD_VLAN_FILTER |
+	RTE_ETH_RX_OFFLOAD_KEEP_CRC |
 	RTE_ETH_RX_OFFLOAD_SCATTER;
 
 /* Supported Tx offloads */
drivers/net/enetc/enetc_rxtx.c +35 -4
index 8678bafece..d5855e69a3 100644
@@ -530,6 +530,28 @@ enetc_clean_rx_ring(struct enetc_bdr *rx_ring,
 	return rx_frm_cnt;
 }
 
+/*
+ * Trim the Ethernet FCS from a received cluster when HW CRC strip is
+ * disabled. pkt_len is reduced by crc_len. If the FCS straddles the last
+ * two segments (last seg holds fewer bytes than crc_len), drop the trailing
+ * segment and trim the carry-over from its predecessor. prev_seg is the
+ * segment preceding last_seg in the chain (the caller already tracks it).
+ */
+static inline void
+enetc_rx_crc_trim(struct rte_mbuf *first_seg, struct rte_mbuf *prev_seg,
+		  struct rte_mbuf *last_seg, uint16_t crc_len)
+{
+	first_seg->pkt_len -= crc_len;
+	if (likely(last_seg->data_len > crc_len)) {
+		last_seg->data_len -= crc_len;
+	} else if (prev_seg != NULL) {
+		first_seg->nb_segs--;
+		prev_seg->data_len -= crc_len - last_seg->data_len;
+		prev_seg->next = NULL;
+		rte_pktmbuf_free_seg(last_seg);
+	}
+}
+
 static int
 enetc_clean_rx_ring_nc(struct enetc_bdr *rx_ring,
 		    struct rte_mbuf **rx_pkts,
@@ -539,7 +561,7 @@ enetc_clean_rx_ring_nc(struct enetc_bdr *rx_ring,
 	int cleaned_cnt, i;
 	struct enetc_swbd *rx_swbd;
 	union enetc_rx_bd *rxbd, rxbd_temp;
-	struct rte_mbuf *first_seg, *cur_seg;
+	struct rte_mbuf *first_seg = NULL, *cur_seg = NULL, *prev_seg = NULL;
 	uint32_t bd_status;
 	uint8_t *data;
 	uint32_t j;
@@ -572,6 +594,7 @@ enetc_clean_rx_ring_nc(struct enetc_bdr *rx_ring,
 		if (!first_seg) {
 			first_seg = seg;
 			cur_seg = seg;
+			prev_seg = NULL;
 			first_seg->pkt_len = data_len;
 			enetc_dev_rx_parse(first_seg, rxbd_temp.r.parse_summary);
 			first_seg->hash.rss = rxbd_temp.r.rss_hash;
@@ -579,6 +602,7 @@ enetc_clean_rx_ring_nc(struct enetc_bdr *rx_ring,
 			first_seg->pkt_len += data_len;
 			first_seg->nb_segs++;
 			cur_seg->next = seg;
+			prev_seg = cur_seg;
 			cur_seg = seg;
 		}
 
@@ -590,7 +614,9 @@ enetc_clean_rx_ring_nc(struct enetc_bdr *rx_ring,
 
 		if (bd_status & ENETC_RXBD_LSTATUS_F) {
 			seg->next = NULL;
-			first_seg->pkt_len -= rx_ring->crc_len;
+			if (rx_ring->crc_len)
+				enetc_rx_crc_trim(first_seg, prev_seg, seg,
+						  rx_ring->crc_len);
 			rx_pkts[rx_frm_cnt] = first_seg;
 			rx_frm_cnt++;
 			first_seg = NULL;
@@ -760,7 +786,7 @@ enetc_clean_rx_ring_cacheable(struct enetc_bdr *rx_ring,
 	int cleaned_cnt, i;
 	struct enetc_swbd *rx_swbd;
 	union enetc_rx_bd *rxbd;
-	struct rte_mbuf *first_seg, *cur_seg;
+	struct rte_mbuf *first_seg = NULL, *cur_seg = NULL, *prev_seg = NULL;
 	uint32_t bd_status;
 	uint8_t *data;
 	uint32_t j;
@@ -815,6 +841,7 @@ enetc_clean_rx_ring_cacheable(struct enetc_bdr *rx_ring,
 		if (!first_seg) {
 			first_seg = seg;
 			cur_seg = seg;
+			prev_seg = NULL;
 			first_seg->pkt_len = data_len;
 			enetc_dev_rx_parse(first_seg,
 					   rxbd->r.parse_summary);
@@ -823,6 +850,7 @@ enetc_clean_rx_ring_cacheable(struct enetc_bdr *rx_ring,
 			first_seg->pkt_len += data_len;
 			first_seg->nb_segs++;
 			cur_seg->next = seg;
+			prev_seg = cur_seg;
 			cur_seg = seg;
 		}
 
@@ -838,7 +866,10 @@ enetc_clean_rx_ring_cacheable(struct enetc_bdr *rx_ring,
 
 		if (bd_status & ENETC_RXBD_LSTATUS_F) {
 			seg->next = NULL;
-			first_seg->pkt_len -= rx_ring->crc_len;
+			if (rx_ring->crc_len)
+				enetc_rx_crc_trim(first_seg, prev_seg, seg,
+						  rx_ring->crc_len);
+
 			rx_pkts[rx_frm_cnt] = first_seg;
 			rx_frm_cnt++;
 			first_seg = NULL;
Signature · 1 line
2.25.1
#65 lore raw

PATCH v5 2/14 net/enetc: add TSO support for ENETC4 VF

In reply to Gagandeep Singh

Add TCP and UDP segmentation offload (TSO) for the ENETC4 virtual function. The offload is advertised through the VF Tx capabilities and is enabled on a per-queue basis when an application requests the TSO offload flags during Tx queue setup.

A dedicated Tx burst, enetc_xmit_pkts_lso(), builds the large-send descriptor chain: a standard header BD, a 16B extension BD carrying the segment size and frame length extension, and one BD per payload buffer with the final-frame flag on the last BD. To make room for the extra extension BD, an LSO-enabled Tx ring is allocated with twice the number of descriptors. The existing non-TSO Tx paths are left unchanged.

---
 doc/guides/nics/enetc4.rst             |   2 +
 doc/guides/nics/features/enetc4.ini    |   1 +
 doc/guides/rel_notes/release_26_11.rst |   1 +
 drivers/net/enetc/base/enetc4_hw.h     |  35 +++-
 drivers/net/enetc/enetc.h              |   4 +
 drivers/net/enetc/enetc4_ethdev.c      |  49 ++++-
 drivers/net/enetc/enetc4_vf.c          |   2 +
 drivers/net/enetc/enetc_rxtx.c         | 257 +++++++++++++++++++++++++
 8 files changed, 346 insertions(+), 5 deletions(-)
doc/guides/nics/enetc4.rst +2 -0
index f0dd039f6e..4d27e4048e 100644
@@ -53,6 +53,8 @@ Key functionality includes:
 - Receive processing: Upon packet reception, the BD Ring status bit is set,
   facilitating packet processing.
 - Transmission: Packet transmission precedes reception, ensuring efficient data transfer.
+- TCP and UDP segmentation offload (TSO) on VFs, enabled per Tx queue
+  when the TSO offload flag is requested.
 
 
 Prerequisites
doc/guides/nics/features/enetc4.ini +1 -0
index 91b18d979e..8ec1e8d00f 100644
@@ -7,6 +7,7 @@
 Link status event    = Y
 Speed capabilities   = Y
 Link status          = Y
+TSO                  = Y
 Promiscuous mode     = Y
 Allmulticast mode    = Y
 Unicast MAC filter   = Y
doc/guides/rel_notes/release_26_11.rst +1 -0
index 3678dd6894..6a348ab4e0 100644
@@ -61,6 +61,7 @@ New Features
   Updated the NXP ENETC4 poll mode driver for i.MX95:
 
   * Added KEEP_CRC Rx offload support for the ENETC4 PMD to preserve the Ethernet FCS.
+  * Added TCP Segmentation Offload (TSO) support for the ENETC4 VF.
 
 Removed Items
 -------------
drivers/net/enetc/base/enetc4_hw.h +34 -1
index 0105549857..64c1a5e750 100644
@@ -1,5 +1,5 @@
 /* SPDX-License-Identifier: BSD-3-Clause
- * Copyright 2024 NXP
+ * Copyright 2024-2026 NXP
  *
  * This header file defines the register offsets and bit fields
  * of ENETC4 PF and VFs.
@@ -24,8 +24,14 @@ struct enetc_msg_swbd {
 
 /* enetc4 txbd flags */
 #define ENETC4_TXBD_FLAGS_L4CS		BIT(0)
+/* Request LSO (Large Send Offload) segmentation for this frame */
+#define ENETC4_TXBD_FLAGS_LSO		BIT(1)
+/* L4 checksum insertion (also used for checksum update on LSO) */
 #define ENETC4_TXBD_FLAGS_L_TX_CKSUM	BIT(3)
+/* Extended descriptor: the next 16B ring entry is an extension BD */
+#define ENETC4_TXBD_FLAGS_EXT		BIT(6)
 #define ENETC4_TXBD_FLAGS_F		BIT(7)
+
 /* L4 type */
 #define ENETC4_TXBD_L4T_UDP		BIT(0)
 #define ENETC4_TXBD_L4T_TCP		BIT(1)
@@ -34,6 +40,33 @@ struct enetc_msg_swbd {
 /* IPv4 checksum */
 #define ENETC4_TXBD_IPCS		1
 
+/*
+ * Extension Transmit Buffer Descriptor (16B). When the standard BD has the
+ * extended flag set, this occupies the next ring entry and carries the extra
+ * fields required by LSO.
+ */
+struct enetc_tx_bd_ext {
+	uint32_t timestamp;	/* PTP timestamp, unused for LSO */
+	uint32_t vlan;		/* VLAN insert, unused for LSO */
+	uint32_t lso;		/* LSO_MAX_SEG_SIZE and FRM_LEN_EXT */
+	uint32_t flags;		/* extension flags */
+};
+
+/* LSO_MAX_SEG_SIZE occupies bits 13-0 of the LSO word */
+#define ENETC4_TXBD_EXT_LSO_SEG_MASK	0x3fff
+#define ENETC4_TXBD_EXT_LSO_SEG(mss) \
+		((uint32_t)((mss) & ENETC4_TXBD_EXT_LSO_SEG_MASK))
+/* FRM_LEN_EXT occupies bits 19-16 of the LSO word (top 4 bits of data len) */
+#define ENETC4_TXBD_EXT_FRM_LEN_EXT(x) \
+		(((uint32_t)((x) & 0xf)) << 16)
+/* Final flag in the extension flags word (bit 127 -> local bit 31) */
+#define ENETC4_TXBD_EXT_FLAGS_F		BIT(31)
+
+/* NETC does not create LSO frames larger than this many bytes */
+#define ENETC4_LSO_MAX_FRAME		9600
+/* Maximum LSO data unit (payload to be segmented) supported by HW: 256KB */
+#define ENETC4_LSO_MAX_DATA_UNIT	(256 * 1024)
+
 /***************************ENETC port registers**************************/
 #define ENETC4_PMR		0x10
 #define ENETC4_PMR_EN		(BIT(16) | BIT(17) | BIT(18))
drivers/net/enetc/enetc.h +4 -0
index d3a8b8e34a..62bedc2854 100644
@@ -99,6 +99,7 @@ struct enetc_bdr {
 	uint64_t ierrors;
 	uint8_t rx_deferred_start;
 	uint8_t tx_deferred_start;
+	uint8_t lso_enable;
 };
 
 struct enetc_eth_hw {
@@ -312,6 +313,9 @@ uint16_t enetc_xmit_pkts(void *txq, struct rte_mbuf **tx_pkts,
 		uint16_t nb_pkts);
 uint16_t enetc_xmit_pkts_nc(void *txq, struct rte_mbuf **tx_pkts,
 		uint16_t nb_pkts);
+uint16_t enetc_xmit_pkts_lso(void *txq, struct rte_mbuf **tx_pkts,
+		uint16_t nb_pkts);
+
 uint16_t enetc_recv_pkts(void *rxq, struct rte_mbuf **rx_pkts,
 		uint16_t nb_pkts);
 uint16_t enetc_recv_pkts_nc(void *rxq, struct rte_mbuf **rx_pkts,
drivers/net/enetc/enetc4_ethdev.c +45 -4

86 lines not on this page · raw message

drivers/net/enetc/enetc4_vf.c +2 -0
index 83a1e4931f..3083a56335 100644
@@ -60,6 +60,8 @@ static uint64_t dev_tx_offloads_sup =
 	RTE_ETH_TX_OFFLOAD_IPV4_CKSUM |
 	RTE_ETH_TX_OFFLOAD_UDP_CKSUM |
 	RTE_ETH_TX_OFFLOAD_TCP_CKSUM |
+	RTE_ETH_TX_OFFLOAD_TCP_TSO |
+	RTE_ETH_TX_OFFLOAD_UDP_TSO |
 	RTE_ETH_TX_OFFLOAD_MULTI_SEGS;
 
 static void
drivers/net/enetc/enetc_rxtx.c +257 -0

263 lines not on this page · raw message

Signature · 1 line
2.25.1
#66 lore raw

PATCH v5 3/14 net/enetc: add RSC (hardware LRO) support for ENETC4

In reply to Gagandeep Singh

Add Receive Segment Coalesce (RSC) support, exposed as the DPDK RTE_ETH_RX_OFFLOAD_TCP_LRO Rx offload, for the ENETC4 PF and VF on i.MX95. RSC lets the HW coalesce multiple in-order TCP segments of a flow into a single receive frame, reducing per-packet overhead.

RSC is a port-level offload driven by a dedicated Rx burst (enetc_recv_pkts_rsc). When TCP LRO is requested the ring is switched to 32B extended receive descriptors (RBaMR[BDS] = 1), the FCS is stripped (RBaMR[CRC] = 0, so RSC is incompatible with KEEP_CRC), interrupt coalescing is enabled (RBaICR0[ICEN] with a non-zero RBaICR1[ICTT] hold timer that doubles as the RSC flush window), and RBaRSCR[EN] is set with the coalesced-frame size clamped to the HW maximum.

Because a 32B descriptor spans two 16B ring slots, the ring length register (RBaLENR) and the consumer-index register are programmed in HW-descriptor units (slot count / 2), while the internal SW indices continue to track 16B slots. Coalesced clusters are delivered with the RTE_MBUF_F_RX_LRO flag set when RSC_FRAMES > 1.

---
 doc/guides/nics/enetc4.rst             |   4 +
 doc/guides/nics/features/enetc4.ini    |   1 +
 doc/guides/rel_notes/release_26_11.rst |   1 +
 drivers/net/enetc/base/enetc4_hw.h     |  74 ++++++++
 drivers/net/enetc/enetc.h              |   5 +
 drivers/net/enetc/enetc4_ethdev.c      | 106 ++++++++++-
 drivers/net/enetc/enetc4_vf.c          |   1 +
 drivers/net/enetc/enetc_rxtx.c         | 235 +++++++++++++++++++++++++
 8 files changed, 421 insertions(+), 6 deletions(-)
doc/guides/nics/enetc4.rst +4 -0
index 4d27e4048e..e7f4348603 100644
@@ -55,6 +55,10 @@ Key functionality includes:
 - Transmission: Packet transmission precedes reception, ensuring efficient data transfer.
 - TCP and UDP segmentation offload (TSO) on VFs, enabled per Tx queue
   when the TSO offload flag is requested.
+- Large receive offload (LRO) on the receive path via hardware Receive
+  Segment Coalesce (RSC), enabled when the TCP LRO Rx offload flag is
+  requested. RSC requires the FCS to be stripped, so it cannot be combined
+  with the KEEP_CRC Rx offload.
 
 
 Prerequisites
doc/guides/nics/features/enetc4.ini +1 -0
index 8ec1e8d00f..aae398e210 100644
@@ -7,6 +7,7 @@
 Link status event    = Y
 Speed capabilities   = Y
 Link status          = Y
+LRO                  = Y
 TSO                  = Y
 Promiscuous mode     = Y
 Allmulticast mode    = Y
doc/guides/rel_notes/release_26_11.rst +1 -0
index 6a348ab4e0..0dd08e0259 100644
@@ -62,6 +62,7 @@ New Features
 
   * Added KEEP_CRC Rx offload support for the ENETC4 PMD to preserve the Ethernet FCS.
   * Added TCP Segmentation Offload (TSO) support for the ENETC4 VF.
+  * Added Receive Segment Coalesce (RSC / hardware LRO) support for ENETC4 PF and VF.
 
 Removed Items
 -------------
drivers/net/enetc/base/enetc4_hw.h +74 -0

81 lines not on this page · raw message

drivers/net/enetc/enetc.h +5 -0
index 62bedc2854..2dc4ab2a0b 100644
@@ -100,6 +100,8 @@ struct enetc_bdr {
 	uint8_t rx_deferred_start;
 	uint8_t tx_deferred_start;
 	uint8_t lso_enable;
+	void *rbidr;
+	uint8_t rsc_enable;
 };
 
 struct enetc_eth_hw {
@@ -320,12 +322,15 @@ uint16_t enetc_recv_pkts(void *rxq, struct rte_mbuf **rx_pkts,
 		uint16_t nb_pkts);
 uint16_t enetc_recv_pkts_nc(void *rxq, struct rte_mbuf **rx_pkts,
 		uint16_t nb_pkts);
+uint16_t enetc_recv_pkts_rsc(void *rxq, struct rte_mbuf **rx_pkts,
+		uint16_t nb_pkts);
 uint16_t enetc_xmit_pkts_cacheable(void *txq, struct rte_mbuf **tx_pkts,
 		uint16_t nb_pkts);
 uint16_t enetc_recv_pkts_cacheable(void *rxq, struct rte_mbuf **rx_pkts,
 		uint16_t nb_pkts);
 
 int enetc_refill_rx_ring(struct enetc_bdr *rx_ring, const int buff_cnt);
+int enetc_refill_rx_ring_rsc(struct enetc_bdr *rx_ring, const int buff_cnt);
 
 /*
  * Cache-maintenance constants for cacheable BD ring mode.
drivers/net/enetc/enetc4_ethdev.c +100 -6

167 lines not on this page · raw message

drivers/net/enetc/enetc4_vf.c +1 -0
index 3083a56335..be79a18a39 100644
@@ -53,6 +53,7 @@ static uint64_t dev_rx_offloads_sup =
 	RTE_ETH_RX_OFFLOAD_TCP_CKSUM |
 	RTE_ETH_RX_OFFLOAD_VLAN_FILTER |
 	RTE_ETH_RX_OFFLOAD_KEEP_CRC |
+	RTE_ETH_RX_OFFLOAD_TCP_LRO |
 	RTE_ETH_RX_OFFLOAD_SCATTER;
 
 /* Supported Tx offloads */
drivers/net/enetc/enetc_rxtx.c +235 -0

241 lines not on this page · raw message

Signature · 1 line
2.25.1
#67 lore raw

PATCH v5 4/14 net/enetc: extend PF-VF link speed field to 8 bits

In reply to Gagandeep Singh

The PF-to-VF message is only 16-bit wide, where the upper 8-bit is the class_id and the lower 8-bit carries the message content. For the link speed message, the lower 4-bit was previously occupied by the cookie field, leaving only 4-bit for the speed code, which allows at most 15 distinct speed values.

As the NETC IP evolves and supports more and more link speeds, 15 speed values are clearly insufficient. Since the cookie field is designed for non-blocking messages and has no meaningful use in link speed messages, remove it and expand the speed code field from 4-bit to 8-bit, allowing up to 255 speed values (ENETC_SPEED_MAX = 0xff).

Instead of enumerating every speed value greater than 5Gbps explicitly, introduce a formula-based approach:

	speed_code = (link_speed - 5000) / 1000 + ENETC_SPEED_5000

This removes the explicit enum entries for 10G, 25G, 50G and 100G, and replaces the individual switch-case branches with a generic implementation to get the speed, making it easy to support any future high speed without modifying the enum or the switch statement.

For backward compatibility with a PF running an older kernel (before 6.18.37) that still uses the legacy 4-bit speed code / 4-bit cookie message layout, add a "vf_link_legacy" devarg. When set to 1, the VF extracts the message result from the upper 4 bits of the lower byte and decodes speeds greater than 5Gbps using the legacy fixed class codes (10G/25G/50G/100G). The default (0) uses the new 8-bit layout.

	Usage: -a <pci_addr>,vf_link_legacy=1
---
 doc/guides/nics/enetc4.rst             |  11 ++
 doc/guides/rel_notes/release_26_11.rst |   3 +
 drivers/net/enetc/enetc.h              |  32 +++-
 drivers/net/enetc/enetc4_vf.c          | 203 +++++++++++++++++++++----
 4 files changed, 216 insertions(+), 33 deletions(-)
doc/guides/nics/enetc4.rst +11 -0
index e7f4348603..935cf90e6b 100644
@@ -133,6 +133,17 @@ VF-specific devargs
 
     dpdk-testpmd -a 0000:00:01.0,enetc4_vsi_delay=10 -- -i
 
+``vf_link_legacy``
+  Select the legacy 4-bit PF-to-VF link speed code layout.
+  Set to ``1`` when the host PF is running a kernel older than v6.18.37.
+  Kernels before that release encode link speed in only 4 bits; without this
+  flag the driver interprets those codes as 8-bit values and reports incorrect
+  link speeds.
+
+  Usage example::
+
+    dpdk-testpmd -a 0000:00:01.0,vf_link_legacy=1 -- -i
+
 PF/Common devargs
 ~~~~~~~~~~~~~~~~~
 
doc/guides/rel_notes/release_26_11.rst +3 -0
index 0dd08e0259..ee4f455c67 100644
@@ -63,6 +63,9 @@ New Features
   * Added KEEP_CRC Rx offload support for the ENETC4 PMD to preserve the Ethernet FCS.
   * Added TCP Segmentation Offload (TSO) support for the ENETC4 VF.
   * Added Receive Segment Coalesce (RSC / hardware LRO) support for ENETC4 PF and VF.
+  * Extended the PF-to-VF link speed code field from 4-bit to 8-bit in ENETC4.
+    Users running a PF kernel older than 6.18.37 must pass ``vf_link_legacy=1``
+    as a device argument, otherwise link speed reporting will be incorrect.
 
 Removed Items
 -------------
drivers/net/enetc/enetc.h +27 -5
index 2dc4ab2a0b..75f3705c25 100644
@@ -119,6 +119,10 @@ struct enetc_eth_hw {
 	uint32_t vsi_delay;   /* VSI-PSI message wait delay (us) */
 	uint32_t *txq_prior;  /* per-queue TX priority (TBMR priority bits) */
 	uint8_t nc_mode;      /* 1 = non-cacheable BD memory, use _nc ops */
+	/* 1 = legacy PF-to-VF link message layout (4-bit speed / 4-bit cookie),
+	 * for PF kernel versions before 6.18.37. Set via vf_link_legacy devarg.
+	 */
+	uint8_t vf_link_legacy;
 };
 
 /*
@@ -210,11 +214,29 @@ enum speed {
 	ENETC_SPEED_1000 = 0x5,
 	ENETC_SPEED_2500 = 0x6,
 	ENETC_SPEED_5000 = 0x7,
-	ENETC_SPEED_10G = 0x8,
-	ENETC_SPEED_25G = 0x9,
-	ENETC_SPEED_50G = 0xA,
-	ENETC_SPEED_100G = 0xB,
-	ENETC_SPEED_NOT_SUPPORTED = 0xF
+	/* Base speed class code used by the >5Gbps formula below */
+	/* Do not add enumeration values for any speed greater than
+	 * 5Gbps. For any speed greater than 5Gbps, its speed class
+	 * code should follow the formula below.
+	 *
+	 * SPEED = (link_speed - 5000) / 1000 + ENETC_SPEED_5000
+	 *
+	 * The unit of link_speed should be Mbps, the max SPEED
+	 * should <= ENETC_SPEED_MAX.
+	 */
+	ENETC_SPEED_MAX = 0xff,
+};
+
+/* Legacy speed class codes for backward compatibility with an older kernel PF
+ * (before 6.18.37) that encoded a 4-bit speed code and 4-bit cookie in the
+ * message's lower byte. Used only when the vf_link_legacy devarg is set.
+ */
+enum speed_legacy {
+	ENETC_SPEED_LEGACY_10G = 0x8,
+	ENETC_SPEED_LEGACY_25G = 0x9,
+	ENETC_SPEED_LEGACY_50G = 0xA,
+	ENETC_SPEED_LEGACY_100G = 0xB,
+	ENETC_SPEED_LEGACY_NOT_SUPPORTED = 0xF
 };
 
 /* PSI-VSI command header format */
drivers/net/enetc/enetc4_vf.c +175 -28

270 lines not on this page · raw message

Signature · 1 line
2.25.1
#68 lore raw

PATCH v5 5/14 net/enetc: support firmware version get for VF

In reply to Gagandeep Singh

Implement the ``.fw_version_get`` eth_dev op for the ENETC4 VF PMD to report the NETC IP revision.

The NETC IP major revision is read from the PCI revision ID register, while the IP minor revision is retrieved from the PSI over VSI-PSI messaging using the "Get IP version" command class (class ID 0xF0, command ID 0x1). The version is reported in the "<major>.<minor>" format.

The PSI firmware only implements the IP_MN command of this class, so the major revision is obtained from the PCI revision ID, matching the behaviour of the kernel PF/VF drivers.

---
 doc/guides/nics/enetc4.rst             |   1 +
 doc/guides/nics/features/enetc4.ini    |   1 +
 doc/guides/rel_notes/release_26_11.rst |   1 +
 drivers/net/enetc/enetc.h              |  19 +++-
 drivers/net/enetc/enetc4_vf.c          | 135 +++++++++++++++++++++++++
 5 files changed, 155 insertions(+), 2 deletions(-)
doc/guides/nics/enetc4.rst +1 -0
index 935cf90e6b..fa93f40b22 100644
@@ -59,6 +59,7 @@ Key functionality includes:
   Segment Coalesce (RSC), enabled when the TCP LRO Rx offload flag is
   requested. RSC requires the FCS to be stripped, so it cannot be combined
   with the KEEP_CRC Rx offload.
+- Firmware version: The NETC IP version is reported via ``rte_eth_dev_fw_version_get``.
 
 
 Prerequisites
doc/guides/nics/features/enetc4.ini +1 -0
index aae398e210..eaf474e7ba 100644
@@ -16,6 +16,7 @@ VLAN filter          = Y
 RSS hash             = Y
 Packet type parsing  = Y
 Basic stats          = Y
+FW version           = Y
 L3 checksum offload  = Y
 L4 checksum offload  = Y
 CRC offload          = Y
doc/guides/rel_notes/release_26_11.rst +1 -0
index ee4f455c67..d212cce000 100644
@@ -66,6 +66,7 @@ New Features
   * Extended the PF-to-VF link speed code field from 4-bit to 8-bit in ENETC4.
     Users running a PF kernel older than 6.18.37 must pass ``vf_link_legacy=1``
     as a device argument, otherwise link speed reporting will be incorrect.
+  * Added firmware version reporting for the ENETC4 VF.
 
 Removed Items
 -------------
drivers/net/enetc/enetc.h +17 -2
index 75f3705c25..27a617a62f 100644
@@ -169,7 +169,8 @@ enum enetc_msg_cmd_class_id {
 	ENETC_CLASS_ID_MAC_FILTER = 0x20,
 	ENETC_CLASS_ID_VLAN_FILTER = 0x21,
 	ENETC_CLASS_ID_LINK_STATUS = 0x80,
-	ENETC_CLASS_ID_LINK_SPEED = 0x81
+	ENETC_CLASS_ID_LINK_SPEED = 0x81,
+	ENETC_CLASS_ID_GET_IP_VER = 0xF0
 };
 
 /* Enum for command IDs */
@@ -183,9 +184,18 @@ enum enetc_msg_cmd_id {
 	ENETC_CMD_ID_GET_LINK_STATUS = 0,
 	ENETC_CMD_ID_REGISTER_LINK_NOTIF = 1,
 	ENETC_CMD_ID_UNREGISTER_LINK_NOTIF = 2,
-	ENETC_CMD_ID_GET_LINK_SPEED = 0
+	ENETC_CMD_ID_GET_LINK_SPEED = 0,
+	/* Get IP version command IDs (class ID 0xF0) */
+	ENETC_CMD_ID_GET_IP_MJ = 0,
+	ENETC_CMD_ID_GET_IP_MN = 1,
+	ENETC_CMD_ID_GET_IP_INT = 2,
+	ENETC_CMD_ID_GET_IP_MNT = 3,
+	ENETC_CMD_ID_GET_IP_CFG = 4
 };
 
+/* IP_VER value returned when the version is not available */
+#define ENETC_IP_VER_NOT_AVAILABLE	0xFF
+
 enum mac_addr_status {
 	ENETC_INVALID_MAC_ADDR = 0x0,
 	ENETC_DUPLICATE_MAC_ADDR = 0X1,
@@ -273,6 +283,11 @@ struct enetc_msg_cmd_get_link_speed {
 	struct enetc_msg_cmd_header header;
 };
 
+/* Get IP version command message format (class ID 0xF0) */
+struct enetc_msg_cmd_get_ip_ver {
+	struct enetc_msg_cmd_header header;
+};
+
 struct enetc_msg_cmd_set_vlan_promisc {
 	struct enetc_msg_cmd_header header;
 	uint8_t op;
drivers/net/enetc/enetc4_vf.c +135 -0

159 lines not on this page · raw message

Signature · 1 line
2.25.1
#69 lore raw

PATCH v5 6/14 net/enetc: support registers dump

In reply to Gagandeep Singh

Implement the .get_reg operation for the ENETC4 PF and VF PMDs to dump the device registers via rte_eth_dev_get_reg_info.

The VF dumps the registers reachable by a virtual station interface (VSI): the station interface and per-ring BD ring registers. Port registers are not accessible by a VF.

The PF additionally dumps the port registers, which are only accessible by the physical station interface (PSI).

---
 doc/guides/nics/enetc4.rst             |  1 +
 doc/guides/nics/features/enetc4.ini    |  1 +
 doc/guides/rel_notes/release_26_11.rst |  1 +
 drivers/net/enetc/enetc.h              | 13 +++++
 drivers/net/enetc/enetc4_ethdev.c      | 70 ++++++++++++++++++++++++++
 drivers/net/enetc/enetc4_vf.c          | 62 +++++++++++++++++++++++
 6 files changed, 148 insertions(+)
doc/guides/nics/enetc4.rst +1 -0
index fa93f40b22..16389aee5b 100644
@@ -60,6 +60,7 @@ Key functionality includes:
   requested. RSC requires the FCS to be stripped, so it cannot be combined
   with the KEEP_CRC Rx offload.
 - Firmware version: The NETC IP version is reported via ``rte_eth_dev_fw_version_get``.
+- Registers dump: The station interface, port (PF only) and BD ring registers are dumped via ``rte_eth_dev_get_reg_info``.
 
 
 Prerequisites
doc/guides/nics/features/enetc4.ini +1 -0
index eaf474e7ba..6540a43909 100644
@@ -17,6 +17,7 @@ RSS hash             = Y
 Packet type parsing  = Y
 Basic stats          = Y
 FW version           = Y
+Registers dump       = Y
 L3 checksum offload  = Y
 L4 checksum offload  = Y
 CRC offload          = Y
doc/guides/rel_notes/release_26_11.rst +1 -0
index d212cce000..6fece98f28 100644
@@ -67,6 +67,7 @@ New Features
     Users running a PF kernel older than 6.18.37 must pass ``vf_link_legacy=1``
     as a device argument, otherwise link speed reporting will be incorrect.
   * Added firmware version reporting for the ENETC4 VF.
+  * Added register dump support for ENETC4 PF and VF.
 
 Removed Items
 -------------
drivers/net/enetc/enetc.h +13 -0
index 27a617a62f..b70664eede 100644
@@ -396,6 +396,19 @@ enetc_bd_unused(struct enetc_bdr *bdr)
 	return bdr->bd_count + bdr->next_to_clean - bdr->next_to_use - 1;
 }
 
+/* Per-ring Tx BDR registers dumped by .get_reg (shared by PF and VF) */
+static const uint32_t enetc4_txbdr_regs[] = {
+	ENETC_TBMR, ENETC_TBSR, ENETC_TBBAR0, ENETC_TBBAR1,
+	ENETC_TBCIR, ENETC_TBLENR,
+};
+
+/* Per-ring Rx BDR registers dumped by .get_reg (shared by PF and VF) */
+static const uint32_t enetc4_rxbdr_regs[] = {
+	ENETC_RBMR, ENETC_RBSR, ENETC_RBBSR, ENETC_RBCIR,
+	ENETC_RBBAR0, ENETC_RBBAR1, ENETC_RBPIR, ENETC_RBLENR,
+};
+
+
 /* CBDR prototypes */
 int enetc4_setup_cbdr(struct rte_eth_dev *dev, struct enetc_hw *hw,
 			int bd_count, struct netc_cbdr *cbdr);
drivers/net/enetc/enetc4_ethdev.c +70 -0

82 lines not on this page · raw message

drivers/net/enetc/enetc4_vf.c +62 -0

80 lines not on this page · raw message

Signature · 1 line
2.25.1
#70 lore raw

PATCH v5 7/14 net/enetc: support ethtool ring parameters

In reply to Gagandeep Singh

The ethtool ring parameter query relies on the queue info ethdev ops (.rxq_info_get/.txq_info_get) together with the descriptor limits reported in dev_info. The PF already registered these ops, but the VF ops tables did not, so ring parameter queries failed on the VF.

Make enetc4_rxq_info_get() and enetc4_txq_info_get() non-static and register them in both VF ops tables so ring parameters are reported for both the PF and VF.

---
 doc/guides/rel_notes/release_26_11.rst | 1 +
 drivers/net/enetc/enetc.h              | 4 ++++
 drivers/net/enetc/enetc4_ethdev.c      | 4 ++--
 drivers/net/enetc/enetc4_vf.c          | 4 ++++
 4 files changed, 11 insertions(+), 2 deletions(-)
doc/guides/rel_notes/release_26_11.rst +1 -0
index 6fece98f28..ec223a93ba 100644
@@ -68,6 +68,7 @@ New Features
     as a device argument, otherwise link speed reporting will be incorrect.
   * Added firmware version reporting for the ENETC4 VF.
   * Added register dump support for ENETC4 PF and VF.
+  * Added ring parameters support for the ENETC4 VF (rxq_info_get / txq_info_get).
 
 Removed Items
 -------------
drivers/net/enetc/enetc.h +4 -0
index b70664eede..6ff438eff6 100644
@@ -338,6 +338,10 @@ int enetc4_tx_queue_stop(struct rte_eth_dev *dev, uint16_t qidx);
 void enetc4_tx_queue_release(struct rte_eth_dev *dev, uint16_t qid);
 const uint32_t *enetc4_supported_ptypes_get(struct rte_eth_dev *dev __rte_unused,
 			size_t *no_of_elements);
+void enetc4_rxq_info_get(struct rte_eth_dev *dev, uint16_t queue_id,
+			 struct rte_eth_rxq_info *qinfo);
+void enetc4_txq_info_get(struct rte_eth_dev *dev, uint16_t queue_id,
+			 struct rte_eth_txq_info *qinfo);
 
 /*
  * enetc4_vf function prototype
drivers/net/enetc/enetc4_ethdev.c +2 -2
index bccd418e32..0295ed332b 100644
@@ -1121,7 +1121,7 @@ enetc4_tx_queue_stop(struct rte_eth_dev *dev, uint16_t qidx)
 	return 0;
 }
 
-static void
+void
 enetc4_rxq_info_get(struct rte_eth_dev *dev, uint16_t queue_id,
 			struct rte_eth_rxq_info *qinfo)
 {
@@ -1135,7 +1135,7 @@ enetc4_rxq_info_get(struct rte_eth_dev *dev, uint16_t queue_id,
 	qinfo->conf.rx_drop_en = 0;
 }
 
-static void
+void
 enetc4_txq_info_get(struct rte_eth_dev *dev, uint16_t queue_id,
 			struct rte_eth_txq_info *qinfo)
 {
drivers/net/enetc/enetc4_vf.c +4 -0
index bf7829ee00..406559094f 100644
@@ -1535,10 +1535,12 @@ static const struct eth_dev_ops enetc4_vf_ops_no_vsi_m = {
 	.rx_queue_start       = enetc4_rx_queue_start,
 	.rx_queue_stop        = enetc4_rx_queue_stop,
 	.rx_queue_release     = enetc4_rx_queue_release,
+	.rxq_info_get         = enetc4_rxq_info_get,
 	.tx_queue_setup       = enetc4_tx_queue_setup,
 	.tx_queue_start       = enetc4_tx_queue_start,
 	.tx_queue_stop        = enetc4_tx_queue_stop,
 	.tx_queue_release     = enetc4_tx_queue_release,
+	.txq_info_get         = enetc4_txq_info_get,
 	.dev_supported_ptypes_get = enetc4_supported_ptypes_get,
 };
 
@@ -1565,10 +1567,12 @@ static const struct eth_dev_ops enetc4_vf_ops = {
 	.rx_queue_start       = enetc4_rx_queue_start,
 	.rx_queue_stop        = enetc4_rx_queue_stop,
 	.rx_queue_release     = enetc4_rx_queue_release,
+	.rxq_info_get         = enetc4_rxq_info_get,
 	.tx_queue_setup       = enetc4_tx_queue_setup,
 	.tx_queue_start       = enetc4_tx_queue_start,
 	.tx_queue_stop        = enetc4_tx_queue_stop,
 	.tx_queue_release     = enetc4_tx_queue_release,
+	.txq_info_get         = enetc4_txq_info_get,
 	.dev_supported_ptypes_get = enetc4_supported_ptypes_get,
 };
 
Signature · 1 line
2.25.1
#71 lore raw

PATCH v5 8/14 net/enetc: refresh link speed on VF link-up interrupt

In reply to Gagandeep Singh

The interrupt-driven link-status path (enetc4_process_psi_msg) only updated link_status when a PSI-to-VSI notification arrived; it never re-queried the link speed from the PF. As a result, after a link-down followed by a link-up the cached link_speed showed the speed from the previous session rather than the freshly negotiated one.

1. Introducing enetc4_decode_link_speed() - a shared helper that maps a PF-to-VF speed status code to the corresponding RTE_ETH_SPEED_NUM_* / RTE_ETH_LINK_*_DUPLEX values, handling both the current and the legacy (vf_link_legacy) 4-bit message layout.

2. Calling enetc4_vf_get_link_speed() inside enetc4_process_psi_msg() on ENETC_LINK_UP so the negotiated speed is fetched from the PF and decoded immediately, before rte_eth_linkstatus_set() is called and the LSC callback is fired.

---
 doc/guides/rel_notes/release_26_11.rst |   1 +
 drivers/net/enetc/enetc4_vf.c          | 257 +++++++++++++------------
 2 files changed, 138 insertions(+), 120 deletions(-)
doc/guides/rel_notes/release_26_11.rst +1 -0
index ec223a93ba..1765adc1bc 100644
@@ -69,6 +69,7 @@ New Features
   * Added firmware version reporting for the ENETC4 VF.
   * Added register dump support for ENETC4 PF and VF.
   * Added ring parameters support for the ENETC4 VF (rxq_info_get / txq_info_get).
+  * Refreshed VF link speed on the link-up interrupt in the ENETC4 VF driver.
 
 Removed Items
 -------------
drivers/net/enetc/enetc4_vf.c +137 -120

278 lines not on this page · raw message

Signature · 1 line
2.25.1
#72 lore raw

PATCH v5 9/14 net/enetc: support stats reset for VF

In reply to Gagandeep Singh

The NETC SI-level hardware counters (SIROCT0, SIRFRM0, SITOCT0, SITFRM0, SITDFCR) are read-only for a VF and cannot be directly zeroed. No VSI-PSI command class exists for stats reset, and using FLR/soft-reset to clear counters is not reliable due to a known hardware erratum on some NETC platforms.

Implement stats_reset for the enetc4 VF PMD using a software snapshot/delta approach: on stats_reset, the current HW counter values are captured as a baseline in a new per-device enetc4_vf_stats_saved struct. stats_get then reports the delta (current_hw_value - saved_baseline), so counters appear to start from zero after each reset call. Per-ring software Rx error accumulators (ierrors) are zeroed directly on reset.

Register the stats_reset callback in both VF ops tables (enetc4_vf_ops and enetc4_vf_ops_no_vsi_m) so the feature is available regardless of whether the VSI messaging path is enabled.

---
 doc/guides/rel_notes/release_26_11.rst |  1 +
 drivers/net/enetc/enetc.h              | 17 +++++++
 drivers/net/enetc/enetc4_vf.c          | 61 +++++++++++++++++++++++---
 3 files changed, 74 insertions(+), 5 deletions(-)
doc/guides/rel_notes/release_26_11.rst +1 -0
index 1765adc1bc..a42577c681 100644
@@ -70,6 +70,7 @@ New Features
   * Added register dump support for ENETC4 PF and VF.
   * Added ring parameters support for the ENETC4 VF (rxq_info_get / txq_info_get).
   * Refreshed VF link speed on the link-up interrupt in the ENETC4 VF driver.
+  * Added stats reset for the ENETC4 VF using a software snapshot/delta approach.
 
 Removed Items
 -------------
drivers/net/enetc/enetc.h +17 -0
index 6ff438eff6..3cddc4873f 100644
@@ -104,6 +104,21 @@ struct enetc_bdr {
 	uint8_t rsc_enable;
 };
 
+/*
+ * Saved SI counter baseline for VF stats reset. Since the SI-level
+ * hardware counters (SIROCT0, SIRFRM0, SITOCT0, SITFRM0, SITDFCR)
+ * are read-only for a VF and cannot be directly zeroed, stats_reset
+ * captures the current counter values as a baseline. stats_get then
+ * reports the delta: current_hw_value - baseline.
+ */
+struct enetc4_vf_stats_saved {
+	uint64_t ipackets;
+	uint64_t opackets;
+	uint64_t ibytes;
+	uint64_t obytes;
+	uint64_t oerrors;
+};
+
 struct enetc_eth_hw {
 	struct rte_eth_dev *ndev;
 	struct enetc_hw hw;
@@ -123,6 +138,8 @@ struct enetc_eth_hw {
 	 * for PF kernel versions before 6.18.37. Set via vf_link_legacy devarg.
 	 */
 	uint8_t vf_link_legacy;
+	/* Baseline snapshot for VF stats reset (software delta approach). */
+	struct enetc4_vf_stats_saved vf_stats_saved;
 };
 
 /*
drivers/net/enetc/enetc4_vf.c +56 -5

83 lines not on this page · raw message

Signature · 1 line
2.25.1
#73 lore raw

PATCH v5 10/14 net/enetc4: add per-queue Rx interrupt support for VF

In reply to Gagandeep Singh

Add MSI-X per-queue Rx interrupt support to the ENETC4 VF PMD on the cacheable (default) Rx path. This allows applications such as l3fwd-power to block in epoll_wait when no traffic is present, reducing CPU utilization to near zero.

MSI-X vector 0 is reserved for the PSI-to-VSI mailbox. Rx queue i is mapped to MSI-X vector i + 1 via ENETC_SIMSIRRV. Per-ring coalescing is enabled with ICPT=1 so the first arriving packet fires the interrupt immediately. The SIRXIDR W1C detect bit is cleared before re-arming ENETC_RBIER to prevent spurious interrupts after traffic stops.

The interrupt infrastructure (rte_intr_efd_enable + rte_intr_vec_list_alloc) is set up before rte_intr_enable() so that vfio-pci can wire each MSI-X vector to its eventfd when programming the MSI-X table.

enetc4_dev_configure() is updated to trigger interrupt setup when intr_conf.rxq is set (not only when intr_conf.lsc is set), as applications like l3fwd-power set intr_conf.rxq without setting lsc.

---
 doc/guides/nics/enetc4.rst             | 65 ++++++++++++++++++++
 doc/guides/nics/features/enetc4.ini    |  1 +
 doc/guides/rel_notes/release_26_11.rst |  1 +
 drivers/net/enetc/base/enetc4_hw.h     |  2 +
 drivers/net/enetc/enetc.h              |  1 +
 drivers/net/enetc/enetc4_ethdev.c      |  9 +--
 drivers/net/enetc/enetc4_vf.c          | 82 +++++++++++++++++++++++++-
 7 files changed, 156 insertions(+), 5 deletions(-)
doc/guides/nics/enetc4.rst +65 -0
index 16389aee5b..2b73916682 100644
@@ -59,6 +59,10 @@ Key functionality includes:
   Segment Coalesce (RSC), enabled when the TCP LRO Rx offload flag is
   requested. RSC requires the FCS to be stripped, so it cannot be combined
   with the KEEP_CRC Rx offload.
+- Per-queue Rx interrupts on VFs (cacheable Rx path only), enabling
+  interrupt-driven receive with ``vfio-pci``. Applications set
+  ``intr_conf.rxq = 1`` in ``rte_eth_conf`` to activate this feature.
+  See `Rx Interrupt Mode (VF)`_ for setup details.
 - Firmware version: The NETC IP version is reported via ``rte_eth_dev_fw_version_get``.
 - Registers dump: The station interface, port (PF only) and BD ring registers are dumped via ``rte_eth_dev_get_reg_info``.
 
@@ -167,3 +171,64 @@ PF/Common devargs
   Usage example::
 
     dpdk-testpmd -a 0000:00:00.0,nc=1 -- -i
+
+
+Rx Interrupt Mode (VF)
+----------------------
+
+The ENETC4 VF PMD supports per-queue MSI-X Rx interrupts on the cacheable
+(default) Rx path. This allows applications to block in ``epoll_wait``
+instead of busy-polling, reducing CPU utilization when traffic is absent.
+
+**MSI-X vector assignment**
+
+ENETC4 VF MSI-X vector 0 is reserved for the PSI-to-VSI mailbox interrupt
+(link status notifications). Rx queue ``i`` is mapped to vector ``i + 1``.
+The driver allocates all required eventfds before calling
+``rte_intr_enable()`` so that ``vfio-pci`` can wire each MSI-X vector to
+its eventfd when it programs the MSI-X table.
+
+**Kernel and driver requirements**
+
+- ``vfio-pci`` kernel module with no-IOMMU mode enabled (no SMMU required).
+- The non-cacheable memory mode (``nc=1`` devarg) does **not** support
+  Rx interrupts and returns ``-ENOTSUP`` from ``rx_queue_intr_enable``.
+
+**Host setup**
+
+.. code-block:: console
+
+   # Enable vfio-pci no-IOMMU mode (if SMMU is not available)
+   modprobe vfio enable_unsafe_noiommu_mode=1
+   modprobe vfio-pci
+
+   # Bind the VF to vfio-pci
+   echo vfio-pci > /sys/bus/pci/devices/<vf_pci_addr>/driver_override
+   echo <vf_pci_addr> > /sys/bus/pci/drivers_probe
+
+**Running l3fwd-power with a single queue and core**
+
+The ``l3fwd-power`` sample application demonstrates interrupt-driven Rx.
+It sets ``intr_conf.rxq = 1`` in ``rte_eth_conf``, which triggers the VF
+interrupt setup in the driver. The ``--vfio-intr=msix`` EAL flag instructs
+DPDK to use MSI-X eventfds for interrupt signalling.
+
+.. code-block:: console
+
+   ./dpdk-l3fwd-power -l 0-1 -n 1 --vfio-intr=msix \
+       -a <vf_pci_addr> -- \
+       -p 0x1 --config="(0,0,1)" --no-numa --interrupt-only
+
+Where:
+
+- ``-l 0-1`` assigns the main thread to core 0 and the forwarding lcore to
+  core 1.
+- ``-a <vf_pci_addr>`` specifies the VF PCI address (e.g. ``0000:01:00.1``).
+- ``--config="(0,0,1)"`` maps port 0, queue 0 to lcore 1.
+- ``--interrupt-only`` enables pure interrupt mode (no busy-poll fallback).
+
+With no incoming traffic the forwarding lcore sleeps in ``epoll_wait``;
+CPU utilization drops to near zero. On the first arriving packet the MSI-X
+interrupt fires, the lcore wakes, drains the ring, disables the interrupt,
+processes the burst, then re-enables and re-arms the interrupt before
+returning to sleep.
doc/guides/nics/features/enetc4.ini +1 -0
index 6540a43909..005c64a3ca 100644
@@ -5,6 +5,7 @@
 ;
 [Features]
 Link status event    = Y
+Rx interrupt         = Y
 Speed capabilities   = Y
 Link status          = Y
 LRO                  = Y
doc/guides/rel_notes/release_26_11.rst +1 -0
index a42577c681..c182495118 100644
@@ -71,6 +71,7 @@ New Features
   * Added ring parameters support for the ENETC4 VF (rxq_info_get / txq_info_get).
   * Refreshed VF link speed on the link-up interrupt in the ENETC4 VF driver.
   * Added stats reset for the ENETC4 VF using a software snapshot/delta approach.
+  * Added per-queue MSI-X Rx interrupt support for the ENETC4 VF.
 
 Removed Items
 -------------
drivers/net/enetc/base/enetc4_hw.h +2 -0
index 8ad8f169d2..9543e982a2 100644
@@ -250,6 +250,8 @@ struct enetc_rx_bd_ext {
 #define ENETC4_VSIIDR            0xA08
 #define ENETC4_VSIIER_MRIE       BIT(9)
 #define ENETC4_SI_INT_IDX        0
+/* MSI-X vector base for per-Rx-queue interrupts; vector 0 is the mailbox. */
+#define ENETC4_VF_RX_VEC_BASE    1
 
 /* VSI Registers */
 #define ENETC4_VSIMSGSR  0x204   /* RO */
drivers/net/enetc/enetc.h +1 -0
index 3cddc4873f..b86193da90 100644
@@ -134,6 +134,7 @@ struct enetc_eth_hw {
 	uint32_t vsi_delay;   /* VSI-PSI message wait delay (us) */
 	uint32_t *txq_prior;  /* per-queue TX priority (TBMR priority bits) */
 	uint8_t nc_mode;      /* 1 = non-cacheable BD memory, use _nc ops */
+	uint8_t rxq_intr_en;  /* 1 = per-queue Rx MSI-X interrupts enabled */
 	/* 1 = legacy PF-to-VF link message layout (4-bit speed / 4-bit cookie),
 	 * for PF kernel versions before 6.18.37. Set via vf_link_legacy devarg.
 	 */
drivers/net/enetc/enetc4_ethdev.c +5 -4
index 0295ed332b..b0c20e3b15 100644
@@ -835,7 +835,8 @@ enetc4_dev_close(struct rte_eth_dev *dev)
 		return 0;
 
 	if (hw->device_id == ENETC4_DEV_ID_VF) {
-		if (dev->data->dev_conf.intr_conf.lsc != 0)
+		if (dev->data->dev_conf.intr_conf.lsc != 0 ||
+		    dev->data->dev_conf.intr_conf.rxq != 0)
 			enetc4_vf_dev_intr(dev, false);
 		ret = enetc4_vf_dev_stop(dev);
 	} else {
@@ -957,12 +958,12 @@ enetc4_dev_configure(struct rte_eth_dev *dev)
 	if (hw->device_id != ENETC4_DEV_ID_VF)
 		enetc4_port_wr(enetc_hw, ENETC4_PARCSCR, checksum);
 
-	/* Enable interrupts */
 	if (hw->device_id == ENETC4_DEV_ID_VF) {
-		if (dev->data->dev_conf.intr_conf.lsc != 0) {
+		if (dev->data->dev_conf.intr_conf.lsc != 0 ||
+		    dev->data->dev_conf.intr_conf.rxq != 0) {
 			ret = enetc4_vf_dev_intr(dev, true);
 			if (ret)
-				ENETC_PMD_WARN("Failed to setup link interrupts");
+				ENETC_PMD_WARN("Failed to setup VF interrupts: %d", ret);
 		}
 	}
 
drivers/net/enetc/enetc4_vf.c +81 -1

118 lines not on this page · raw message

Signature · 1 line
2.25.1
#74 lore raw

PATCH v5 11/14 net/enetc4: add SI-based port VLAN insertion and removal

In reply to Gagandeep Singh

Implement hardware VLAN tag insertion on Tx and removal on Rx via the per-SI VLAN isolation (pvid) mechanism on ENETC4.

On a PF, the driver writes directly to PSIaVLANR(0) (VID + enable bit) and PSIaCFGR0(0) (SIVIE for Tx insertion, VTE for Rx removal, SIVC_CVLAN to allow C-VLAN 0x8100 TPID).

On a privileged VF, the request is forwarded to the kernel PF via the VSI-PSI mailbox using a new command class 0x24 (SI VLAN isolation, cmd ID 0x1). The kernel PF handler programs the same registers on behalf of the VF's station interface. The class 0x24 reply is added to the pass-through list in enetc4_msg_vsi_send() so it is handled correctly alongside the existing command classes

---
 doc/guides/nics/enetc4.rst             |  4 ++
 doc/guides/nics/features/enetc4.ini    |  1 +
 doc/guides/rel_notes/release_26_11.rst |  1 +
 drivers/net/enetc/base/enetc4_hw.h     | 14 +++++
 drivers/net/enetc/enetc.h              | 23 +++++++
 drivers/net/enetc/enetc4_ethdev.c      | 39 ++++++++++++
 drivers/net/enetc/enetc4_vf.c          | 83 ++++++++++++++++++++++++++
 7 files changed, 165 insertions(+)
doc/guides/nics/enetc4.rst +4 -0
index 2b73916682..262e2fe703 100644
@@ -65,6 +65,10 @@ Key functionality includes:
   See `Rx Interrupt Mode (VF)`_ for setup details.
 - Firmware version: The NETC IP version is reported via ``rte_eth_dev_fw_version_get``.
 - Registers dump: The station interface, port (PF only) and BD ring registers are dumped via ``rte_eth_dev_get_reg_info``.
+- SI-based port VLAN (pvid): Hardware VLAN tag insertion on Tx and removal on Rx, configured
+  via ``rte_eth_dev_set_vlan_pvid``. On a PF the registers are written directly; on a privileged
+  VF the request is forwarded to the kernel PF through the VSI-PSI mailbox (class 0x24).
+  Use the testpmd command ``tx_vlan set pvid <port_id> <vlan_id> on|off`` to enable or disable.
 
 
 Prerequisites
doc/guides/nics/features/enetc4.ini +1 -0
index 005c64a3ca..01b0dc5b80 100644
@@ -14,6 +14,7 @@ Promiscuous mode     = Y
 Allmulticast mode    = Y
 Unicast MAC filter   = Y
 VLAN filter          = Y
+VLAN offload         = Y
 RSS hash             = Y
 Packet type parsing  = Y
 Basic stats          = Y
doc/guides/rel_notes/release_26_11.rst +1 -0
index c182495118..190d77ecee 100644
@@ -72,6 +72,7 @@ New Features
   * Refreshed VF link speed on the link-up interrupt in the ENETC4 VF driver.
   * Added stats reset for the ENETC4 VF using a software snapshot/delta approach.
   * Added per-queue MSI-X Rx interrupt support for the ENETC4 VF.
+  * Added SI-based port VLAN insertion (Tx) and removal (Rx) for ENETC4 PF and VF.
 
 Removed Items
 -------------
drivers/net/enetc/base/enetc4_hw.h +14 -0
index 9543e982a2..a9552f21f4 100644
@@ -277,6 +277,20 @@ struct enetc_rx_bd_ext {
 #define ENETC4_SICTR0		0x18
 #define ENETC4_SICTR1		0x1c
 
+/* PSI SI VLAN register: per-SI VLAN tag for insertion/removal */
+#define ENETC4_PSIVLANR(a)		((a) * 0x80 + 0x2008)
+#define ENETC4_PSIVLANR_E		BIT(31)  /* enable SI VLAN processing */
+#define ENETC4_PSIVLANR_VTEA		BIT(30)  /* 0=strip tag, 1=zero VID */
+#define ENETC4_PSIVLANR_PCP(v)		(((uint32_t)(v) & 0x7) << 13)
+#define ENETC4_PSIVLANR_DEI		BIT(12)
+#define ENETC4_PSIVLANR_VID(v)		((uint32_t)(v) & 0xfff)
+
+/* PSI SI configuration register 0 */
+#define ENETC4_PSICFGR0(a)		((a) * 0x80 + 0x2010)
+#define ENETC4_PSICFGR0_SIVC_CVLAN	BIT(24)  /* allow C-VLAN 0x8100 */
+#define ENETC4_PSICFGR0_SIVIE		BIT(14)  /* SI VLAN insertion enable */
+#define ENETC4_PSICFGR0_VTE		BIT(12)  /* SI VLAN removal enable */
+
 /* general register accessors */
 #define enetc4_rd_reg(reg)	rte_read32((void *)(reg))
 #define enetc4_wr_reg(reg, val)  rte_write32((val), (void *)(reg))
drivers/net/enetc/enetc.h +23 -0
index b86193da90..6cabef000e 100644
@@ -186,6 +186,8 @@ struct enetc_eth_adapter {
 enum enetc_msg_cmd_class_id {
 	ENETC_CLASS_ID_MAC_FILTER = 0x20,
 	ENETC_CLASS_ID_VLAN_FILTER = 0x21,
+	/* Configure SI VLAN isolation (insert / remove) */
+	ENETC_CLASS_ID_SI_VLAN_ISO = 0x24,
 	ENETC_CLASS_ID_LINK_STATUS = 0x80,
 	ENETC_CLASS_ID_LINK_SPEED = 0x81,
 	ENETC_CLASS_ID_GET_IP_VER = 0xF0
@@ -211,6 +213,11 @@ enum enetc_msg_cmd_id {
 	ENETC_CMD_ID_GET_IP_CFG = 4
 };
 
+/* Command IDs for class ID 0x24 (SI VLAN isolation) */
+enum enetc_msg_si_vlan_cmd_id {
+	ENETC_CMD_ID_SET_SI_VLAN_ISO = 1,
+};
+
 /* IP_VER value returned when the version is not available */
 #define ENETC_IP_VER_NOT_AVAILABLE	0xFF
 
@@ -322,6 +329,22 @@ struct enetc_msg_vlan_exact_filter {
 	uint8_t reserved2;
 };
 
+/* VSI-PSI SI VLAN isolation message (class 0x24, cmd 0x1) */
+struct enetc_msg_si_vlan_iso {
+	struct enetc_msg_cmd_header header;
+	uint8_t ctrl;          /* E[7], VTEA[6], TPID[1:0] */
+	uint8_t pcp_dei_vid_hi; /* PCP[7:5], DEI[4], VID[11:8] */
+	uint8_t vid_lo;        /* VID[7:0] */
+	uint8_t reserved_0;
+	uint8_t flags;         /* SVIE[2], VTE[1] */
+	uint8_t reserved_1[3];
+};
+
+#define ENETC_SI_VLAN_ISO_E	BIT(7)  /* ctrl: enable SI VLAN */
+#define ENETC_SI_VLAN_ISO_VTEA	BIT(6)  /* ctrl: 0=strip, 1=zero VID */
+#define ENETC_SI_VLAN_ISO_SVIE	BIT(2)  /* flags: Tx insertion enable */
+#define ENETC_SI_VLAN_ISO_VTE	BIT(1)  /* flags: Rx removal enable */
+
 struct enetc_psi_reply_msg {
 	uint8_t class_id;
 	uint8_t status;
drivers/net/enetc/enetc4_ethdev.c +39 -0
index b0c20e3b15..b4e793e63c 100644
@@ -868,6 +868,44 @@ enetc4_dev_close(struct rte_eth_dev *dev)
 	return ret;
 }
 
+/* Configure SI-based VLAN insertion (Tx) and removal (Rx) for the PF. */
+static int
+enetc4_vlan_pvid_set(struct rte_eth_dev *dev, uint16_t vlan_id, int on)
+{
+	struct enetc_eth_hw *hw =
+		ENETC_DEV_PRIVATE_TO_HW(dev->data->dev_private);
+	struct enetc_hw *enetc_hw = &hw->hw;
+	uint32_t psivlanr, psicfgr0;
+
+	PMD_INIT_FUNC_TRACE();
+
+	psicfgr0 = enetc4_port_rd(enetc_hw, ENETC4_PSICFGR0(0));
+
+	if (on) {
+		/* Build the VLAN register: enable bit + VID (PCP/DEI left 0) */
+		psivlanr = (uint32_t)ENETC4_PSIVLANR_E |
+			   ENETC4_PSIVLANR_VID(vlan_id);
+		enetc4_port_wr(enetc_hw, ENETC4_PSIVLANR(0), psivlanr);
+
+		/* Allow C-VLAN TPID, enable Tx insertion and Rx removal */
+		psicfgr0 |= ENETC4_PSICFGR0_SIVC_CVLAN |
+			    ENETC4_PSICFGR0_SIVIE |
+			    ENETC4_PSICFGR0_VTE;
+		enetc4_port_wr(enetc_hw, ENETC4_PSICFGR0(0), psicfgr0);
+	} else {
+		/* Clear Tx insertion, Rx removal and C-VLAN allow bits */
+		psicfgr0 &= ~(ENETC4_PSICFGR0_SIVC_CVLAN |
+			      ENETC4_PSICFGR0_SIVIE |
+			      ENETC4_PSICFGR0_VTE);
+		enetc4_port_wr(enetc_hw, ENETC4_PSICFGR0(0), psicfgr0);
+
+		/* Clear the VLAN register (disable SI VLAN processing) */
+		enetc4_port_wr(enetc_hw, ENETC4_PSIVLANR(0), 0);
+	}
+
+	return 0;
+}
+
 static int
 enetc4_promiscuous_enable(struct rte_eth_dev *dev)
 {
@@ -1263,6 +1301,7 @@ static const struct eth_dev_ops enetc4_ops = {
 	.get_reg              = enetc4_get_regs,
 	.promiscuous_enable   = enetc4_promiscuous_enable,
 	.promiscuous_disable  = enetc4_promiscuous_disable,
+	.vlan_pvid_set        = enetc4_vlan_pvid_set,
 	.rx_queue_setup       = enetc4_rx_queue_setup,
 	.rx_queue_start       = enetc4_rx_queue_start,
 	.rx_queue_stop        = enetc4_rx_queue_stop,
drivers/net/enetc/enetc4_vf.c +83 -0

101 lines not on this page · raw message

Signature · 1 line
2.25.1
#75 lore raw

PATCH v5 12/14 net/enetc4: update VF link status to bitmask encoding

In reply to Gagandeep Singh

The PF-to-VF link status notification code was previously a two-value enum (UP=0x0, DOWN=0x1). Change this to a bitmask so future bits can carry additional state alongside the link up/down indication:

ENETC_LINK_DOWN BIT(0) -- set when link is down

Link up is now encoded as the DOWN bit being clear, which keeps the wire value for link-down identical (0x1) and ensures backward compatibility with older kernel PFs.

Changes:
- enetc.h: replace enum link_status with a #define bitmask; drop ENETC_LINK_UP (no longer a named constant).
- enetc4_vf.c enetc4_process_psi_msg(): replace switch/case on ENETC_LINK_UP/DOWN with bitmask decode.
- enetc4_vf.c enetc4_vf_link_update(): same bitmask decode.

---
 doc/guides/rel_notes/release_26_11.rst |  1 +
 drivers/net/enetc/enetc.h              |  8 ++++----
 drivers/net/enetc/enetc4_vf.c          | 27 +++++++-------------------
 3 files changed, 12 insertions(+), 24 deletions(-)
doc/guides/rel_notes/release_26_11.rst +1 -0
index 190d77ecee..47090068d0 100644
@@ -73,6 +73,7 @@ New Features
   * Added stats reset for the ENETC4 VF using a software snapshot/delta approach.
   * Added per-queue MSI-X Rx interrupt support for the ENETC4 VF.
   * Added SI-based port VLAN insertion (Tx) and removal (Rx) for ENETC4 PF and VF.
+  * Updated ENETC4 VF link status reporting to use bitmask encoding.
 
 Removed Items
 -------------
drivers/net/enetc/enetc.h +4 -4
index 6cabef000e..d4d39737ec 100644
@@ -235,10 +235,10 @@ enum vlan_status {
 	ENETC_VLAN_NO_RESOURCE = 0x3
 };
 
-enum link_status {
-	ENETC_LINK_UP = 0x0,
-	ENETC_LINK_DOWN = 0x1
-};
+/* Link status bitmask in PF-to-VF mailbox notification.
+ * Link up is encoded as the DOWN bit being clear.
+ */
+#define ENETC_LINK_DOWN  (1u << 0)
 
 enum speed {
 	ENETC_SPEED_UNKNOWN = 0x0,
drivers/net/enetc/enetc4_vf.c +7 -20
index 9b03d91ca4..3bdd032dba 100644
@@ -510,8 +510,10 @@ enetc4_process_psi_msg(struct rte_eth_dev *eth_dev, struct enetc_hw *enetc_hw)
 	enetc4_msg_get_psi_msg(enetc_hw, msg);
 
 	if (msg->class_id == ENETC_CLASS_ID_LINK_STATUS) {
-		switch (msg->status) {
-		case ENETC_LINK_UP:
+		if (msg->status & ENETC_LINK_DOWN) {
+			ENETC_PMD_DEBUG("Link is down");
+			link.link_status = RTE_ETH_LINK_DOWN;
+		} else {
 			ENETC_PMD_DEBUG("Link is up");
 			link.link_status = RTE_ETH_LINK_UP;
 			/* Re-query speed from PF so the cached value reflects
@@ -528,14 +530,6 @@ enetc4_process_psi_msg(struct rte_eth_dev *eth_dev, struct enetc_hw *enetc_hw)
 			} else {
 				ENETC_PMD_WARN("Failed to alloc msg for speed query");
 			}
-			break;
-		case ENETC_LINK_DOWN:
-			ENETC_PMD_DEBUG("Link is down");
-			link.link_status = RTE_ETH_LINK_DOWN;
-			break;
-		default:
-			ENETC_PMD_ERR("Unknown link status 0x%x", msg->status);
-			break;
 		}
 		ret = rte_eth_linkstatus_set(eth_dev, &link);
 		if (!ret)
@@ -1208,17 +1202,10 @@ enetc4_vf_link_update(struct rte_eth_dev *dev, int wait_to_complete __rte_unused
 	}
 
 	if (reply_msg->class_id == ENETC_CLASS_ID_LINK_STATUS) {
-		switch (reply_msg->status) {
-		case ENETC_LINK_UP:
-			link.link_status = RTE_ETH_LINK_UP;
-			break;
-		case ENETC_LINK_DOWN:
+		if (reply_msg->status & ENETC_LINK_DOWN)
 			link.link_status = RTE_ETH_LINK_DOWN;
-			break;
-		default:
-			ENETC_PMD_ERR("Unknown link status");
-			break;
-		}
+		else
+			link.link_status = RTE_ETH_LINK_UP;
 	} else {
 		ENETC_PMD_ERR("Wrong reply message");
 		return -1;
Signature · 1 line
2.25.1
#76 lore raw

PATCH v5 13/14 net/enetc4: enable Tx PAUSE via VF Rx congestion mode

In reply to Gagandeep Singh

When the PF negotiates TX PAUSE on the port it signals this to the VF via BIT(1) of the PF-to-VF link status mailbox message. The VF PMD must respond by setting RBMR_CM (BIT(4)) on all active RX rings so the MAC emits PAUSE frames on ingress pressure.

Add ENETC_RBMR_CM register definition, ENETC_LINK_TX_PAUSE bitmask, and tx_pause_active state flag. Add enetc4_vf_set_congestion_mode() to update all active RX rings and persist the state for rings started later. Hook it into both the interrupt and poll link-update paths, and apply the saved state in rx_queue_setup() and rx_queue_start().

RX PAUSE (honoring received PAUSE frames) is handled at the MAC level by the PF and requires no VF PMD changes.

---
 doc/guides/nics/features/enetc4.ini    |  1 +
 doc/guides/rel_notes/release_26_11.rst |  1 +
 drivers/net/enetc/base/enetc_hw.h      |  1 +
 drivers/net/enetc/enetc.h              |  9 +++-
 drivers/net/enetc/enetc4_ethdev.c      | 13 +++++-
 drivers/net/enetc/enetc4_vf.c          | 59 ++++++++++++++++++++++++--
 6 files changed, 78 insertions(+), 6 deletions(-)
doc/guides/nics/features/enetc4.ini +1 -0
index 01b0dc5b80..1f599dace7 100644
@@ -14,6 +14,7 @@ Promiscuous mode     = Y
 Allmulticast mode    = Y
 Unicast MAC filter   = Y
 VLAN filter          = Y
+Flow control         = Y
 VLAN offload         = Y
 RSS hash             = Y
 Packet type parsing  = Y
doc/guides/rel_notes/release_26_11.rst +1 -0
index 47090068d0..555ac65ae8 100644
@@ -74,6 +74,7 @@ New Features
   * Added per-queue MSI-X Rx interrupt support for the ENETC4 VF.
   * Added SI-based port VLAN insertion (Tx) and removal (Rx) for ENETC4 PF and VF.
   * Updated ENETC4 VF link status reporting to use bitmask encoding.
+  * Added TX PAUSE support for the ENETC4 VF via RX congestion mode.
 
 Removed Items
 -------------
drivers/net/enetc/base/enetc_hw.h +1 -0
index 6e96562850..33d075fe59 100644
@@ -51,6 +51,7 @@ enum enetc_bdr_type {TX, RX};
 							+ (off))
 /* RX BDR reg offsets */
 #define ENETC_RBMR		0x0 /* RX BDR mode register*/
+#define ENETC_RBMR_CM		BIT(4)  /* congestion mode: assert congestion to emit TX PAUSE */
 #define ENETC_RBMR_EN		BIT(31)
 
 #define ENETC_BMR_RESET		0x0 /* BDR reset*/
drivers/net/enetc/enetc.h +8 -1
index d4d39737ec..e47d208538 100644
@@ -139,6 +139,10 @@ struct enetc_eth_hw {
 	 * for PF kernel versions before 6.18.37. Set via vf_link_legacy devarg.
 	 */
 	uint8_t vf_link_legacy;
+	/* 1 = TX PAUSE negotiated on port; VF RX rings must have RBMR_CM set.
+	 * Updated from the PF-to-VF link status mailbox message (BIT(1)).
+	 */
+	uint8_t tx_pause_active;
 	/* Baseline snapshot for VF stats reset (software delta approach). */
 	struct enetc4_vf_stats_saved vf_stats_saved;
 };
@@ -237,8 +241,11 @@ enum vlan_status {
 
 /* Link status bitmask in PF-to-VF mailbox notification.
  * Link up is encoded as the DOWN bit being clear.
+ * TX_PAUSE is set when the port has negotiated TX PAUSE; VF must enable
+ * congestion mode (ENETC_RBMR_CM) on its RX rings accordingly.
  */
-#define ENETC_LINK_DOWN  (1u << 0)
+#define ENETC_LINK_DOWN      (1u << 0)
+#define ENETC_LINK_TX_PAUSE  (1u << 1)
 
 enum speed {
 	ENETC_SPEED_UNKNOWN = 0x0,
drivers/net/enetc/enetc4_ethdev.c +11 -2
index b4e793e63c..9f75bc07c9 100644
@@ -708,8 +708,12 @@ enetc4_rx_queue_setup(struct rte_eth_dev *dev,
 	}
 
 	if (!rx_conf->rx_deferred_start) {
-		/* enable ring */
+		/* Enable ring; apply congestion mode if TX PAUSE is already active. */
 		rx_enable |= ENETC_RBMR_EN;
+		if (adapter->hw.tx_pause_active)
+			rx_enable |= ENETC_RBMR_CM;
+		else
+			rx_enable &= ~(uint32_t)ENETC_RBMR_CM;
 		enetc4_rxbdr_wr(&adapter->hw.hw, rx_ring->index, ENETC_RBMR,
 			       rx_enable);
 		dev->data->rx_queue_state[rx_ring->index] =
@@ -1085,7 +1089,12 @@ enetc4_rx_queue_start(struct rte_eth_dev *dev, uint16_t qidx)
 	if (dev->data->rx_queue_state[qidx] == RTE_ETH_QUEUE_STATE_STOPPED) {
 		rx_data = enetc4_rxbdr_rd(&priv->hw.hw, rx_ring->index,
 					 ENETC_RBMR);
-		rx_data = rx_data | ENETC_RBMR_EN;
+		rx_data |= ENETC_RBMR_EN;
+		/* Restore congestion mode if TX PAUSE is active. */
+		if (priv->hw.tx_pause_active)
+			rx_data |= ENETC_RBMR_CM;
+		else
+			rx_data &= ~(uint32_t)ENETC_RBMR_CM;
 		enetc4_rxbdr_wr(&priv->hw.hw, rx_ring->index, ENETC_RBMR,
 			       rx_data);
 		dev->data->rx_queue_state[qidx] = RTE_ETH_QUEUE_STATE_STARTED;
drivers/net/enetc/enetc4_vf.c +56 -3

87 lines not on this page · raw message

Signature · 1 line
2.25.1
#77 lore raw

PATCH v5 14/14 net/enetc4: add WRR Tx scheduler devarg for VF rings

In reply to Gagandeep Singh

Add enetc4_txq_wrr devarg to configure per-ring WRR weights in the NETC LEAF-level Tx scheduler (TBaMR register, bits [6:4]).

The NETC Tx scheduler has three levels:
- ROOT (port/TC): strict priority + CBS (PF/port space)
- MID (SI/VSI): WBFS shaping (PF space)
- LEAF (Tx BDR): strict priority + frame-based WRR (VF/SI space)

TBaMR is in the VF own SI space, so no Linux PF involvement is needed for PRIO or WRR configuration.

Changes:
- enetc_hw.h: add ENETC_TBMR_WRR_MASK, ENETC_TBMR_WRR(n) macros for TBaMR bits [6:4], and ENETC_TBMR_PRIO_MASK for bits [2:0]
- enetc.h: add txq_wrr pointer to enetc_eth_hw struct
- enetc4_ethdev.c: add parse_txq_wrr() and wire ENETC4_TXQ_WRR devarg through enetc4_get_devargs() and enetc4_dev_configure(); apply WRR bits in enetc4_tx_queue_setup() and enetc4_tx_queue_start()

Usage:

  # strict priority: ring 0 highest
  -a 0002:00:12.0,enetc4_txq_prior="3|2|1"

# WRR 2:4:1 on same-priority rings
-a 0002:00:12.0,enetc4_txq_prior="1|1|1",enetc4_txq_wrr="2|4|1"

---
 doc/guides/nics/enetc4.rst             | 12 ++++
 doc/guides/rel_notes/release_26_11.rst |  1 +
 drivers/net/enetc/base/enetc_hw.h      |  5 ++
 drivers/net/enetc/enetc.h              |  1 +
 drivers/net/enetc/enetc4_ethdev.c      | 84 +++++++++++++++++++++++---
 5 files changed, 95 insertions(+), 8 deletions(-)
doc/guides/nics/enetc4.rst +12 -0
index 262e2fe703..7399a416d3 100644
@@ -166,6 +166,18 @@ PF/Common devargs
 
     dpdk-testpmd -a 0000:00:00.0,enetc4_txq_prior=1|2|3 -- -i
 
+``enetc4_txq_wrr``
+  Set per-queue WRR weight for the LEAF-level Tx scheduler (TBaMR bits [6:4]).
+  The value is a ``|``-separated list of WRR weights, one per Tx queue.
+  Meaningful only when the corresponding queues share the same strict-priority
+  level via ``enetc4_txq_prior``; queues with different priorities are
+  scheduled strictly regardless of their WRR weight.
+  Values beyond the maximum supported Tx queue count are discarded.
+
+  Usage example (WRR 2:4:1 on three equal-priority rings)::
+
+    dpdk-testpmd -a 0000:00:00.0,enetc4_txq_prior="1|1|1",enetc4_txq_wrr="2|4|1" -- -i
+
 ``nc``
   Select non-cacheable Rx/Tx ops (BD rings mapped as non-cacheable memory).
   Set to ``1`` to use non-cacheable descriptor ring operations.
doc/guides/rel_notes/release_26_11.rst +1 -0
index 555ac65ae8..b80c8ebda6 100644
@@ -75,6 +75,7 @@ New Features
   * Added SI-based port VLAN insertion (Tx) and removal (Rx) for ENETC4 PF and VF.
   * Updated ENETC4 VF link status reporting to use bitmask encoding.
   * Added TX PAUSE support for the ENETC4 VF via RX congestion mode.
+  * Added WRR Tx scheduler devarg (``enetc4_txq_wrr``) for ENETC4 VF ring weights.
 
 Removed Items
 -------------
drivers/net/enetc/base/enetc_hw.h +5 -0
index 33d075fe59..5a71f01db9 100644
@@ -86,6 +86,11 @@ enum enetc_bdr_type {TX, RX};
 
 #define ENETC_RTBLENR_LEN(n)		((n) & ~0x7)
 #define ENETC_TBMR_EN			BIT(31)
+/* TBaMR[WRR] bits [6:4]: weight for same-priority ring arbitration (0=1x .. 7=8x). */
+#define ENETC_TBMR_WRR_MASK		GENMASK(6, 4)
+#define ENETC_TBMR_WRR(n)		((((n) - 1) & 0x7) << 4)
+/* TBaMR[PRIO] bits [2:0]: strict priority (0=lowest, 7=highest). */
+#define ENETC_TBMR_PRIO_MASK		GENMASK(2, 0)
 
 /* Port regs, offset: 1_0000h */
 #define ENETC_PORT_BASE			0x10000
drivers/net/enetc/enetc.h +1 -0
index e47d208538..c1a345e379 100644
@@ -133,6 +133,7 @@ struct enetc_eth_hw {
 	uint32_t vsi_timeout; /* VSI-PSI message wait timeout (iterations) */
 	uint32_t vsi_delay;   /* VSI-PSI message wait delay (us) */
 	uint32_t *txq_prior;  /* per-queue TX priority (TBMR priority bits) */
+	uint32_t *txq_wrr;    /* per-queue TX WRR weight pre-shifted for TBMR[WRR] */
 	uint8_t nc_mode;      /* 1 = non-cacheable BD memory, use _nc ops */
 	uint8_t rxq_intr_en;  /* 1 = per-queue Rx MSI-X interrupts enabled */
 	/* 1 = legacy PF-to-VF link message layout (4-bit speed / 4-bit cookie),
drivers/net/enetc/enetc4_ethdev.c +76 -8

149 lines not on this page · raw message

Signature · 1 line
2.25.1
#78 lore raw

Re: [PATCH v5 00/14] net/enetc: add new features for ENETC4 on i.MX95

In reply to Gagandeep Singh
Quoted 52 lines · On Mon, 10 Aug 2026 16:18:01 +0530 Gagandeep Singh <[email protected]> wrote:

V4-changes:
- fix doc build issue: WARNING: undefined label: pmd_build_and_test

v3-changes:
- fix doc build issue.
- fix compilation issue on fedore:43-gcc-minsize

V2-changes:
- compilation fixes.

V1-changes:
This series adds new PMD features to the ENETC4 driver targeting the NXP i.MX95 NETC IP.

The series covers:

- KEEP_CRC Rx offload: preserve the Ethernet FCS in the receive buffer.
- TSO: TCP Segmentation Offload for the VF Tx path.
- RSC/LRO: hardware Receive Segment Coalesce for PF and VF Rx paths.
- Link speed code: extend the PF-to-VF mailbox field from 4-bit to 8-bit to support speeds beyond 10G.
- Firmware version: report the NETC IP version via fw_version_get.
- Register dump: dump SI, port (PF) and BD ring registers.
- Ring parameters: implement rxq_info_get / txq_info_get for the VF.
- Link-up interrupt: refresh the cached link speed on each VF link-up interrupt so that link_update returns the current speed immediately.
- Stats reset: software snapshot/delta approach for VF counter reset.
- Per-queue Rx interrupt: MSI-X per-queue Rx interrupts for the VF, enabling interrupt-driven receive with l3fwd-power.
- SI VLAN: hardware port VLAN insertion/removal for PF and VF.
- VF link status bitmask: switch VF link status to bitmask encoding to align with the PF and newer kernel driver conventions.
- TX PAUSE: VF sets Rx congestion mode when the PF signals TX PAUSE negotiated on the wire; adds Flow control = Y to enetc4.ini.
- WRR Tx scheduler: per-ring WRR weights via enetc4_txq_wrr devarg.

Gagandeep Singh (14):
net/enetc: add keep-CRC Rx offload for ENETC4 net/enetc: add TSO support for ENETC4 VF net/enetc: add RSC (hardware LRO) support for ENETC4 net/enetc: extend PF-VF link speed field to 8 bits net/enetc: support firmware version get for VF net/enetc: support registers dump
net/enetc: support ethtool ring parameters net/enetc: refresh link speed on VF link-up interrupt net/enetc: support stats reset for VF net/enetc4: add per-queue Rx interrupt support for VF net/enetc4: add SI-based port VLAN insertion and removal net/enetc4: update VF link status to bitmask encoding net/enetc4: enable Tx PAUSE via VF Rx congestion mode net/enetc4: add WRR Tx scheduler devarg for VF rings

Quoted 11 lines
 doc/guides/nics/enetc4.rst             | 100 +++
 doc/guides/nics/features/enetc4.ini    |   8 +
 doc/guides/rel_notes/release_26_11.rst |  21 +
 drivers/net/enetc/base/enetc4_hw.h     | 129 +++-
 drivers/net/enetc/base/enetc_hw.h      |   6 +
 drivers/net/enetc/enetc.h              | 134 ++++-
 drivers/net/enetc/enetc4_ethdev.c      | 413 +++++++++++--
 drivers/net/enetc/enetc4_vf.c          | 801 ++++++++++++++++++++++---
 drivers/net/enetc/enetc_rxtx.c         | 531 +++++++++++++++-
 9 files changed, 1998 insertions(+), 145 deletions(-)

Better but still has AI review issues:

ENETC4 v5 series review - 14 patches

No Reviewed-by; two errors remain.

Build status is now correct. All 14 commits build clean individually on top of c1a46b9 with gcc 13.3 and -Dwerror=true:

[0] d657b18 01/14 add keep-CRC Rx offload for ENETC4
[0] 410e8f0 02/14 add TSO support for ENETC4 VF
[0] 1dc5e61 03/14 add RSC (hardware LRO) support for ENETC4
[0] 3dc3726 04/14 extend PF-VF link speed field to 8 bits
[0] e1ba634 05/14 support firmware version get for VF
[0] f3772c4 06/14 support registers dump
[0] 4c51974 07/14 support ethtool ring parameters
[0] 663e4ac 08/14 refresh link speed on VF link-up interrupt
[0] d9c0dfa 09/14 support stats reset for VF
[0] 3b7ef0c 10/14 add per-queue Rx interrupt support for VF
[0] 131a052 11/14 add SI-based port VLAN insertion and removal
[0] ea47dc2 12/14 update VF link status to bitmask encoding
[0] ffaa8a6 13/14 enable Tx PAUSE via VF Rx congestion mode
[0] 57ac69c 14/14 add WRR Tx scheduler devarg for VF rings

check-git-log.sh: 14/14 valid patches. No trailing whitespace.

Confirmed fixed from v4: prev_seg declaration moved to patch 01; the duplicate offload arrays and duplicate rx_enable removed at the point of introduction; SCATTER and MULTI_SEGS restored to the PF capability lists; both LSO validation paths now free the mbuf before start++; the rte_cpu_to_le_16() on the uint8_t flags field dropped; Tx ring doubling validated post-multiply; mailbox-dependent ops removed from the no-VSI table; link speed decode bounded to defined RTE_ETH_SPEED_NUM_* values; duplicate rte_kvargs.h include removed; RSC now explicitly rejects nc=1 rather than silently overriding the burst selection; vf_link_legacy and enetc4_txq_wrr documented, and the release note calls out the 6.18.37 PF requirement.

This round I read patches 05-14 in full, which I had deferred.

Patch 14

Error: free() on memory allocated with rte_zmalloc().

parse_txq_prior() was converted from calloc() to rte_zmalloc(), and enetc4_dev_close() was updated to rte_free(). enetc4_dev_uninit() was not:

static int
enetc4_dev_uninit(struct rte_eth_dev eth_dev)
{
...
if (hw->txq_prior) {
free(hw->txq_prior); / rte_zmalloc'd */
hw->txq_prior = NULL;
}

    return enetc4_dev_close(eth_dev);

}

uninit runs before close, so on any port using enetc4_txq_prior the pointer is still non-NULL here and libc free() is handed a pointer from the DPDK heap. txq_wrr is not freed on this path at all. Both allocations are already released correctly in enetc4_dev_close(), so the simplest fix is to delete the block from enetc4_dev_uninit().

Patch 10

Error: eventfd and vector-list leak on interrupt teardown.

enetc4_vf_dev_intr(dev, true) calls rte_intr_efd_enable() and rte_intr_vec_list_alloc(). The disable path clears rxq_intr_en, calls rte_intr_disable() and unregisters the callback, but never calls rte_intr_efd_disable() or rte_intr_vec_list_free(). The eventfds and the vector list survive dev_close, and a subsequent configure/close cycle allocates a new set each time.

The intr_enable_fail: label has the same gap: if rte_intr_enable() fails after efd_enable() succeeded, both resources are dropped.

disable:
enetc_vf_enable_mr_int(enetc_hw, false);
hw->rxq_intr_en = 0;

rte_intr_vec_list_free(intr_handle);

    rte_intr_efd_disable(intr_handle);
    ret = rte_intr_disable(intr_handle);

Patch 03

Warning: Rx ring doubling still bypasses MAX_BD_COUNT.

The Tx side now validates after the multiply, but enetc4_alloc_rxbdr() does not:

ring_desc = rxr->rsc_enable ? (uint32_t)nb_desc * 2 : (uint32_t)nb_desc;

size = ring_desc * sizeof(struct enetc_swbd);

The only bound is nb_rx_desc > MAX_BD_COUNT in enetc4_rx_queue_setup(), checked before the doubling, so an RSC ring can reach 128000 entries. ENETC_RTBLENR_LEN(n) is ((n) & ~0x7) with no upper clamp. Mirror the check that enetc4_alloc_txbdr() already has.

Patch 08

Warning: VSI-PSI transaction issued from the interrupt handler.

enetc4_process_psi_msg() runs from enetc4_dev_interrupt_handler(), and now issues a fresh mailbox round trip:

    rte_free(msg);
    msg = rte_zmalloc(NULL, sizeof(*msg), RTE_CACHE_LINE_SIZE);
    if (msg) {
            if (!enetc4_vf_get_link_speed(eth_dev, msg) && ...

There are eleven enetc4_msg_vsi_send() call sites and no lock anywhere in the file. Until this patch every one of them ran on the control thread, so they were serialized by convention. This is the first that runs on the interrupt thread, so it can interleave with a concurrent mac_addr_set, vlan_pvid_set, mtu_set or link_update: both writers touch VSIMSGSNDAR/VSIMSGSR and one consumes the other's reply.

A mutex around the send/poll sequence in enetc4_msg_vsi_send() would cover all callers at once. Note it would need to be a sleeping lock, not rte_spinlock_t, since the poll loop waits up to vsi_timeout.

Info: the free-and-reallocate of msg is unnecessary churn; memset of the existing buffer would do, and would remove the NULL branch.

Patch 13

Warning: unsynchronized access to tx_pause_active and RBMR.

hw->tx_pause_active is written by enetc4_vf_set_congestion_mode() on the interrupt thread and read by enetc4_rx_queue_setup() and enetc4_rx_queue_start() on the control thread as a plain uint8_t. Use rte_atomic_store_explicit()/rte_atomic_load_explicit() with rte_memory_order_release/acquire; relaxed is not enough here because the flag publishes the RBMR writes that precede it.

The RBMR read-modify-write is the larger half of the same problem:

    rbmr = enetc4_rxbdr_rd(enetc_hw, i, ENETC_RBMR);
    if (enable)
            rbmr |= ENETC_RBMR_CM;
    ...
    enetc4_rxbdr_wr(enetc_hw, i, ENETC_RBMR, rbmr);

enetc4_rx_queue_start() and _stop() perform the same read-modify-write on ENETC_RBMR_EN from the control thread. A link-status interrupt arriving mid-sequence can lose either update, leaving a ring enabled without congestion mode or disabled with it.

Patch 06

Warning: signed shift overflow in the register-dump version field.

regs->version = hw->device_id << 16 | hw->revision_id;

device_id is uint16_t, so it promotes to int before the shift. Both ENETC4_DEV_ID (0xe101) and ENETC4_DEV_ID_VF (0xef00) have bit 15 set, so the shift result is not representable in int -- undefined behaviour, and UBSan will flag it. The same line appears in both enetc4_get_regs() and enetc4_vf_get_regs().

regs->version = (uint32_t)hw->device_id << 16 | hw->revision_id;

Info: enetc4_txbdr_regs[] and enetc4_rxbdr_regs[] are static const arrays defined in enetc.h, so every translation unit that includes the header gets its own copy. Moving them to one .c file with an extern declaration, or making them macros, avoids the duplication.

Patch 05

Info: the fw_size == 0 early return reports the length of "0.0" rather than of the real version string, since ip_mj and ip_mn are still zero at that point. Callers using the query-then-allocate idiom get a buffer that is too small, though the second call returns the correct size so it does self-correct.

Series-wide

Info: four new consecutive-blank-line pairs -- enetc.h:464, enetc4_ethdev.c:36 and :164, enetc_rxtx.c:1144.

Info: the release note entry uses "TX PAUSE" and "RX congestion mode"; the commit subjects were corrected to Tx/Rx in this revision but the note was not.

Info: parse_txq_prior() returns -1 for strdup failure but -ENOMEM for the rte_zmalloc failure; parse_txq_wrr() returns -1 for both. Worth making consistent.

#79 lore raw

Re: [PATCH v5 00/14] net/enetc: add new features for ENETC4 on i.MX95

In reply to Gagandeep Singh
Quoted 52 lines · On Mon, 10 Aug 2026 16:18:01 +0530 Gagandeep Singh <[email protected]> wrote:

V4-changes:
- fix doc build issue: WARNING: undefined label: pmd_build_and_test

v3-changes:
- fix doc build issue.
- fix compilation issue on fedore:43-gcc-minsize

V2-changes:
- compilation fixes.

V1-changes:
This series adds new PMD features to the ENETC4 driver targeting the NXP i.MX95 NETC IP.

The series covers:

- KEEP_CRC Rx offload: preserve the Ethernet FCS in the receive buffer.
- TSO: TCP Segmentation Offload for the VF Tx path.
- RSC/LRO: hardware Receive Segment Coalesce for PF and VF Rx paths.
- Link speed code: extend the PF-to-VF mailbox field from 4-bit to 8-bit to support speeds beyond 10G.
- Firmware version: report the NETC IP version via fw_version_get.
- Register dump: dump SI, port (PF) and BD ring registers.
- Ring parameters: implement rxq_info_get / txq_info_get for the VF.
- Link-up interrupt: refresh the cached link speed on each VF link-up interrupt so that link_update returns the current speed immediately.
- Stats reset: software snapshot/delta approach for VF counter reset.
- Per-queue Rx interrupt: MSI-X per-queue Rx interrupts for the VF, enabling interrupt-driven receive with l3fwd-power.
- SI VLAN: hardware port VLAN insertion/removal for PF and VF.
- VF link status bitmask: switch VF link status to bitmask encoding to align with the PF and newer kernel driver conventions.
- TX PAUSE: VF sets Rx congestion mode when the PF signals TX PAUSE negotiated on the wire; adds Flow control = Y to enetc4.ini.
- WRR Tx scheduler: per-ring WRR weights via enetc4_txq_wrr devarg.

Gagandeep Singh (14):
net/enetc: add keep-CRC Rx offload for ENETC4 net/enetc: add TSO support for ENETC4 VF net/enetc: add RSC (hardware LRO) support for ENETC4 net/enetc: extend PF-VF link speed field to 8 bits net/enetc: support firmware version get for VF net/enetc: support registers dump
net/enetc: support ethtool ring parameters net/enetc: refresh link speed on VF link-up interrupt net/enetc: support stats reset for VF net/enetc4: add per-queue Rx interrupt support for VF net/enetc4: add SI-based port VLAN insertion and removal net/enetc4: update VF link status to bitmask encoding net/enetc4: enable Tx PAUSE via VF Rx congestion mode net/enetc4: add WRR Tx scheduler devarg for VF rings

Quoted 11 lines
 doc/guides/nics/enetc4.rst             | 100 +++
 doc/guides/nics/features/enetc4.ini    |   8 +
 doc/guides/rel_notes/release_26_11.rst |  21 +
 drivers/net/enetc/base/enetc4_hw.h     | 129 +++-
 drivers/net/enetc/base/enetc_hw.h      |   6 +
 drivers/net/enetc/enetc.h              | 134 ++++-
 drivers/net/enetc/enetc4_ethdev.c      | 413 +++++++++++--
 drivers/net/enetc/enetc4_vf.c          | 801 ++++++++++++++++++++++---
 drivers/net/enetc/enetc_rxtx.c         | 531 +++++++++++++++-
 9 files changed, 1998 insertions(+), 145 deletions(-)

More AI review feedback.
ENETC4 v5 series review - 14 patches

No Reviewed-by; two errors remain.

Build status is now correct. All 14 commits build clean individually on top of c1a46b9 with gcc 13.3 and -Dwerror=true:

[0] d657b18 01/14 add keep-CRC Rx offload for ENETC4
[0] 410e8f0 02/14 add TSO support for ENETC4 VF
[0] 1dc5e61 03/14 add RSC (hardware LRO) support for ENETC4
[0] 3dc3726 04/14 extend PF-VF link speed field to 8 bits
[0] e1ba634 05/14 support firmware version get for VF
[0] f3772c4 06/14 support registers dump
[0] 4c51974 07/14 support ethtool ring parameters
[0] 663e4ac 08/14 refresh link speed on VF link-up interrupt
[0] d9c0dfa 09/14 support stats reset for VF
[0] 3b7ef0c 10/14 add per-queue Rx interrupt support for VF
[0] 131a052 11/14 add SI-based port VLAN insertion and removal
[0] ea47dc2 12/14 update VF link status to bitmask encoding
[0] ffaa8a6 13/14 enable Tx PAUSE via VF Rx congestion mode
[0] 57ac69c 14/14 add WRR Tx scheduler devarg for VF rings

check-git-log.sh: 14/14 valid patches. No trailing whitespace.

Confirmed fixed from v4: prev_seg declaration moved to patch 01; the duplicate offload arrays and duplicate rx_enable removed at the point of introduction; SCATTER and MULTI_SEGS restored to the PF capability lists; both LSO validation paths now free the mbuf before start++; the rte_cpu_to_le_16() on the uint8_t flags field dropped; Tx ring doubling validated post-multiply; mailbox-dependent ops removed from the no-VSI table; link speed decode bounded to defined RTE_ETH_SPEED_NUM_* values; duplicate rte_kvargs.h include removed; RSC now explicitly rejects nc=1 rather than silently overriding the burst selection; vf_link_legacy and enetc4_txq_wrr documented, and the release note calls out the 6.18.37 PF requirement.

This round I read patches 05-14 in full, which I had deferred.

Patch 14

Error: free() on memory allocated with rte_zmalloc().

parse_txq_prior() was converted from calloc() to rte_zmalloc(), and enetc4_dev_close() was updated to rte_free(). enetc4_dev_uninit() was not:

  static int
  enetc4_dev_uninit(struct rte_eth_dev *eth_dev)
  {
        ...
        if (hw->txq_prior) {
                free(hw->txq_prior);        /* rte_zmalloc'd */
                hw->txq_prior = NULL;
        }
        return enetc4_dev_close(eth_dev);

}

uninit runs before close, so on any port using enetc4_txq_prior the pointer is still non-NULL here and libc free() is handed a pointer from the DPDK heap. txq_wrr is not freed on this path at all. Both allocations are already released correctly in enetc4_dev_close(), so the simplest fix is to delete the block from enetc4_dev_uninit().

Patch 10

Error: eventfd and vector-list leak on interrupt teardown.

enetc4_vf_dev_intr(dev, true) calls rte_intr_efd_enable() and rte_intr_vec_list_alloc(). The disable path clears rxq_intr_en, calls rte_intr_disable() and unregisters the callback, but never calls rte_intr_efd_disable() or rte_intr_vec_list_free(). The eventfds and the vector list survive dev_close, and a subsequent configure/close cycle allocates a new set each time.

The intr_enable_fail: label has the same gap: if rte_intr_enable() fails after efd_enable() succeeded, both resources are dropped.

  disable:
        enetc_vf_enable_mr_int(enetc_hw, false);
        hw->rxq_intr_en = 0;
  +     rte_intr_vec_list_free(intr_handle);
  +     rte_intr_efd_disable(intr_handle);
        ret = rte_intr_disable(intr_handle);

Patch 03

Warning: Rx ring doubling still bypasses MAX_BD_COUNT.

The Tx side now validates after the multiply, but enetc4_alloc_rxbdr() does not:

  ring_desc = rxr->rsc_enable ? (uint32_t)nb_desc * 2 : (uint32_t)nb_desc;

  size = ring_desc * sizeof(struct enetc_swbd);

The only bound is nb_rx_desc > MAX_BD_COUNT in enetc4_rx_queue_setup(), checked before the doubling, so an RSC ring can reach 128000 entries. ENETC_RTBLENR_LEN(n) is ((n) & ~0x7) with no upper clamp. Mirror the check that enetc4_alloc_txbdr() already has.

Patch 08

Warning: VSI-PSI transaction issued from the interrupt handler.

enetc4_process_psi_msg() runs from enetc4_dev_interrupt_handler(), and now issues a fresh mailbox round trip:

        rte_free(msg);
        msg = rte_zmalloc(NULL, sizeof(*msg), RTE_CACHE_LINE_SIZE);
        if (msg) {
                if (!enetc4_vf_get_link_speed(eth_dev, msg) && ...

There are eleven enetc4_msg_vsi_send() call sites and no lock anywhere in the file. Until this patch every one of them ran on the control thread, so they were serialized by convention. This is the first that runs on the interrupt thread, so it can interleave with a concurrent mac_addr_set, vlan_pvid_set, mtu_set or link_update: both writers touch VSIMSGSNDAR/VSIMSGSR and one consumes the other's reply.

A mutex around the send/poll sequence in enetc4_msg_vsi_send() would cover all callers at once. Note it would need to be a sleeping lock, not rte_spinlock_t, since the poll loop waits up to vsi_timeout.

Info: the free-and-reallocate of msg is unnecessary churn; memset of the existing buffer would do, and would remove the NULL branch.

Patch 13

Warning: unsynchronized access to tx_pause_active and RBMR.

hw->tx_pause_active is written by enetc4_vf_set_congestion_mode() on the interrupt thread and read by enetc4_rx_queue_setup() and enetc4_rx_queue_start() on the control thread as a plain uint8_t. Use rte_atomic_store_explicit()/rte_atomic_load_explicit() with rte_memory_order_release/acquire; relaxed is not enough here because the flag publishes the RBMR writes that precede it.

The RBMR read-modify-write is the larger half of the same problem:

        rbmr = enetc4_rxbdr_rd(enetc_hw, i, ENETC_RBMR);
        if (enable)
                rbmr |= ENETC_RBMR_CM;
        ...
        enetc4_rxbdr_wr(enetc_hw, i, ENETC_RBMR, rbmr);

enetc4_rx_queue_start() and _stop() perform the same read-modify-write on ENETC_RBMR_EN from the control thread. A link-status interrupt arriving mid-sequence can lose either update, leaving a ring enabled without congestion mode or disabled with it.

Patch 06

Warning: signed shift overflow in the register-dump version field.

  regs->version = hw->device_id << 16 | hw->revision_id;

device_id is uint16_t, so it promotes to int before the shift. Both ENETC4_DEV_ID (0xe101) and ENETC4_DEV_ID_VF (0xef00) have bit 15 set, so the shift result is not representable in int -- undefined behaviour, and UBSan will flag it. The same line appears in both enetc4_get_regs() and enetc4_vf_get_regs().

  regs->version = (uint32_t)hw->device_id << 16 | hw->revision_id;

Info: enetc4_txbdr_regs[] and enetc4_rxbdr_regs[] are static const arrays defined in enetc.h, so every translation unit that includes the header gets its own copy. Moving them to one .c file with an extern declaration, or making them macros, avoids the duplication.

Patch 05

Info: the fw_size == 0 early return reports the length of "0.0" rather than of the real version string, since ip_mj and ip_mn are still zero at that point. Callers using the query-then-allocate idiom get a buffer that is too small, though the second call returns the correct size so it does self-correct.

Series-wide

Info: four new consecutive-blank-line pairs -- enetc.h:464, enetc4_ethdev.c:36 and :164, enetc_rxtx.c:1144.

Info: the release note entry uses "TX PAUSE" and "RX congestion mode"; the commit subjects were corrected to Tx/Rx in this revision but the note was not.

Info: parse_txq_prior() returns -1 for strdup failure but -ENOMEM for the rte_zmalloc failure; parse_txq_wrr() returns -1 for both. Worth making consistent.

#80 lore raw

v6 cover net/enetc: add new features for ENETC4 on i.MX95

In reply to Gagandeep Singh

V6-changes:
- fixed free() on memory allocated with rte_zmalloc().
- fixed eventfd and vector-list leak on interrupt teardown
- fixed Rx ring doubling still bypasses
- fixed VSI-PSI transaction issued from the interrupt handler
- fixed the free-and-reallocate of msg is unnecessary churn
- fixed unsynchronized access to tx_pause_active and RBMR
- fixed signed shift overflow in the register-dump version field
- fixed the fw_size == 0 early return reports the length of "0.0"
- unwanted blank lines removed.
- parse_txq_prior() returns updated.

V5-changes:
- Patch 1 Build fixes which includes:
'prev_seg' undeclared fixed. redefinition of 'dev_rx_offloads_sup' fixed.
Error: duplicate rx_enable declaration fixed.
PF loses Scattered Rx and Multi-segment Tx
- mbuf leak in enetc_xmit_pkts_lso() fixed.
- fixed conversion on ENETC4_TXBD_FLAGS_F issue.
- fixed link speed decode has no upper bound.
- fixed mailbox ops added to the no-VSI ops table.
- new devargs documented.

V4-changes:
- fix doc build issue: WARNING: undefined label: pmd_build_and_test

v3-changes:
- fix doc build issue.
- fix compilation issue on fedore:43-gcc-minsize

V2-changes:
- compilation fixes.

V1-changes:
This series adds new PMD features to the ENETC4 driver targeting the NXP i.MX95 NETC IP.

The series covers:

- KEEP_CRC Rx offload: preserve the Ethernet FCS in the receive buffer.
- TSO: TCP Segmentation Offload for the VF Tx path.
- RSC/LRO: hardware Receive Segment Coalesce for PF and VF Rx paths.
- Link speed code: extend the PF-to-VF mailbox field from 4-bit to 8-bit to support speeds beyond 10G.
- Firmware version: report the NETC IP version via fw_version_get.
- Register dump: dump SI, port (PF) and BD ring registers.
- Ring parameters: implement rxq_info_get / txq_info_get for the VF.
- Link-up interrupt: refresh the cached link speed on each VF link-up interrupt so that link_update returns the current speed immediately.
- Stats reset: software snapshot/delta approach for VF counter reset.
- Per-queue Rx interrupt: MSI-X per-queue Rx interrupts for the VF, enabling interrupt-driven receive with l3fwd-power.
- SI VLAN: hardware port VLAN insertion/removal for PF and VF.
- VF link status bitmask: switch VF link status to bitmask encoding to align with the PF and newer kernel driver conventions.
- TX PAUSE: VF sets Rx congestion mode when the PF signals TX PAUSE negotiated on the wire; adds Flow control = Y to enetc4.ini.
- WRR Tx scheduler: per-ring WRR weights via enetc4_txq_wrr devarg.

Gagandeep Singh (13):
net/enetc: add keep-CRC Rx offload for ENETC4 net/enetc: add TSO support for ENETC4 VF net/enetc: add RSC (hardware LRO) support for ENETC4 net/enetc: extend PF-VF link speed field to 8 bits net/enetc: support firmware version get for VF net/enetc: support registers dump
net/enetc: support ethtool ring parameters net/enetc: refresh link speed on VF link-up interrupt net/enetc: support stats reset for VF net/enetc4: add per-queue Rx interrupt support for VF net/enetc4: add SI-based port VLAN insertion and removal net/enetc4: update VF link status to bitmask encoding net/enetc4: enable Tx PAUSE via VF Rx congestion mode

 doc/guides/nics/enetc4.rst             |  88 +++
 doc/guides/nics/features/enetc4.ini    |   8 +
 doc/guides/rel_notes/release_26_11.rst |  20 +
 drivers/net/enetc/base/enetc4_hw.h     | 128 +++-
 drivers/net/enetc/base/enetc_hw.h      |   1 +
 drivers/net/enetc/enetc.h              | 135 ++++-
 drivers/net/enetc/enetc4_ethdev.c      | 340 ++++++++++-
 drivers/net/enetc/enetc4_vf.c          | 807 ++++++++++++++++++++++---
 drivers/net/enetc/enetc_rxtx.c         | 530 +++++++++++++++-
 9 files changed, 1919 insertions(+), 138 deletions(-)
Signature · 1 line
2.25.1
#81 lore raw

PATCH v6 1/13 net/enetc: add keep-CRC Rx offload for ENETC4

The legacy ENETC (LS1028A) driver already supports the RTE_ETH_RX_OFFLOAD_KEEP_CRC offload, but ENETC4 (i.MX95 NETC) did not.

Add KEEP_CRC support for ENETC4 (both PF and VF):

- Advertise RTE_ETH_RX_OFFLOAD_KEEP_CRC in the supported Rx offloads for the ENETC4 PF and VF. The VF reuses the PF Rx queue setup, so the HW configuration and datapath handling apply to both.
- Configure the per-ring RBaMR[CRC] bit in the Rx queue setup so that HW preserves the Ethernet FCS in the receive buffer when the offload is requested (0 = FCS removed, 1 = FCS preserved).
- Follow the DPDK convention used by the legacy ENETC and ixgbe drivers:
set crc_len to RTE_ETHER_CRC_LEN when KEEP_CRC is enabled and have the datapath subtract crc_len from pkt_len/data_len. ENETC and ENETC4 share the same datapath (enetc_rxtx.c), so the semantics stay consistent.
- Handle the scatter-gather boundary case where the 4-byte FCS straddles the last two segments: drop the trailing segment, decrement nb_segs and trim the carry-over from its predecessor.

---
 doc/guides/nics/features/enetc4.ini    |  1 +
 doc/guides/rel_notes/release_26_11.rst |  6 ++++
 drivers/net/enetc/base/enetc4_hw.h     |  3 ++
 drivers/net/enetc/enetc4_ethdev.c      | 45 ++++++++++++++++----------
 drivers/net/enetc/enetc4_vf.c          |  1 +
 drivers/net/enetc/enetc_rxtx.c         | 39 +++++++++++++++++++---
 6 files changed, 74 insertions(+), 21 deletions(-)
doc/guides/nics/features/enetc4.ini +1 -0
index 698140e30b..91b18d979e 100644
@@ -16,6 +16,7 @@ Packet type parsing  = Y
 Basic stats          = Y
 L3 checksum offload  = Y
 L4 checksum offload  = Y
+CRC offload          = Y
 Queue start/stop     = Y
 Scattered Rx         = Y
 Linux                = Y
doc/guides/rel_notes/release_26_11.rst +6 -0
index c8cc86295d..3678dd6894 100644
@@ -56,6 +56,12 @@ New Features
      =======================================================
 
 
+* **Updated NXP ENETC4 PMD.**
+
+  Updated the NXP ENETC4 poll mode driver for i.MX95:
+
+  * Added KEEP_CRC Rx offload support for the ENETC4 PMD to preserve the Ethernet FCS.
+
 Removed Items
 -------------
 
drivers/net/enetc/base/enetc4_hw.h +3 -0
index 9685e7e1e5..c81ac00ec6 100644
@@ -68,6 +68,9 @@ struct enetc_msg_swbd {
 #define PM_CMD_CFG_TX_EN		BIT(0)
 #define PM_CMD_CFG_RX_EN		BIT(1)
 
+/* RBaMR[CRC]: 0 = FCS removed, 1 = FCS preserved (KEEP_CRC) */
+#define ENETC4_RBMR_CRC			BIT(8)
+
 /* i.MX95 supports jumbo frame, but it is recommended to set the max frame
  * size to 2000 bytes.
  */
drivers/net/enetc/enetc4_ethdev.c +28 -17

85 lines not on this page · raw message

drivers/net/enetc/enetc4_vf.c +1 -0
index ef5f1e6d66..83a1e4931f 100644
@@ -52,6 +52,7 @@ static uint64_t dev_rx_offloads_sup =
 	RTE_ETH_RX_OFFLOAD_UDP_CKSUM |
 	RTE_ETH_RX_OFFLOAD_TCP_CKSUM |
 	RTE_ETH_RX_OFFLOAD_VLAN_FILTER |
+	RTE_ETH_RX_OFFLOAD_KEEP_CRC |
 	RTE_ETH_RX_OFFLOAD_SCATTER;
 
 /* Supported Tx offloads */
drivers/net/enetc/enetc_rxtx.c +35 -4
index 8678bafece..d5855e69a3 100644
@@ -530,6 +530,28 @@ enetc_clean_rx_ring(struct enetc_bdr *rx_ring,
 	return rx_frm_cnt;
 }
 
+/*
+ * Trim the Ethernet FCS from a received cluster when HW CRC strip is
+ * disabled. pkt_len is reduced by crc_len. If the FCS straddles the last
+ * two segments (last seg holds fewer bytes than crc_len), drop the trailing
+ * segment and trim the carry-over from its predecessor. prev_seg is the
+ * segment preceding last_seg in the chain (the caller already tracks it).
+ */
+static inline void
+enetc_rx_crc_trim(struct rte_mbuf *first_seg, struct rte_mbuf *prev_seg,
+		  struct rte_mbuf *last_seg, uint16_t crc_len)
+{
+	first_seg->pkt_len -= crc_len;
+	if (likely(last_seg->data_len > crc_len)) {
+		last_seg->data_len -= crc_len;
+	} else if (prev_seg != NULL) {
+		first_seg->nb_segs--;
+		prev_seg->data_len -= crc_len - last_seg->data_len;
+		prev_seg->next = NULL;
+		rte_pktmbuf_free_seg(last_seg);
+	}
+}
+
 static int
 enetc_clean_rx_ring_nc(struct enetc_bdr *rx_ring,
 		    struct rte_mbuf **rx_pkts,
@@ -539,7 +561,7 @@ enetc_clean_rx_ring_nc(struct enetc_bdr *rx_ring,
 	int cleaned_cnt, i;
 	struct enetc_swbd *rx_swbd;
 	union enetc_rx_bd *rxbd, rxbd_temp;
-	struct rte_mbuf *first_seg, *cur_seg;
+	struct rte_mbuf *first_seg = NULL, *cur_seg = NULL, *prev_seg = NULL;
 	uint32_t bd_status;
 	uint8_t *data;
 	uint32_t j;
@@ -572,6 +594,7 @@ enetc_clean_rx_ring_nc(struct enetc_bdr *rx_ring,
 		if (!first_seg) {
 			first_seg = seg;
 			cur_seg = seg;
+			prev_seg = NULL;
 			first_seg->pkt_len = data_len;
 			enetc_dev_rx_parse(first_seg, rxbd_temp.r.parse_summary);
 			first_seg->hash.rss = rxbd_temp.r.rss_hash;
@@ -579,6 +602,7 @@ enetc_clean_rx_ring_nc(struct enetc_bdr *rx_ring,
 			first_seg->pkt_len += data_len;
 			first_seg->nb_segs++;
 			cur_seg->next = seg;
+			prev_seg = cur_seg;
 			cur_seg = seg;
 		}
 
@@ -590,7 +614,9 @@ enetc_clean_rx_ring_nc(struct enetc_bdr *rx_ring,
 
 		if (bd_status & ENETC_RXBD_LSTATUS_F) {
 			seg->next = NULL;
-			first_seg->pkt_len -= rx_ring->crc_len;
+			if (rx_ring->crc_len)
+				enetc_rx_crc_trim(first_seg, prev_seg, seg,
+						  rx_ring->crc_len);
 			rx_pkts[rx_frm_cnt] = first_seg;
 			rx_frm_cnt++;
 			first_seg = NULL;
@@ -760,7 +786,7 @@ enetc_clean_rx_ring_cacheable(struct enetc_bdr *rx_ring,
 	int cleaned_cnt, i;
 	struct enetc_swbd *rx_swbd;
 	union enetc_rx_bd *rxbd;
-	struct rte_mbuf *first_seg, *cur_seg;
+	struct rte_mbuf *first_seg = NULL, *cur_seg = NULL, *prev_seg = NULL;
 	uint32_t bd_status;
 	uint8_t *data;
 	uint32_t j;
@@ -815,6 +841,7 @@ enetc_clean_rx_ring_cacheable(struct enetc_bdr *rx_ring,
 		if (!first_seg) {
 			first_seg = seg;
 			cur_seg = seg;
+			prev_seg = NULL;
 			first_seg->pkt_len = data_len;
 			enetc_dev_rx_parse(first_seg,
 					   rxbd->r.parse_summary);
@@ -823,6 +850,7 @@ enetc_clean_rx_ring_cacheable(struct enetc_bdr *rx_ring,
 			first_seg->pkt_len += data_len;
 			first_seg->nb_segs++;
 			cur_seg->next = seg;
+			prev_seg = cur_seg;
 			cur_seg = seg;
 		}
 
@@ -838,7 +866,10 @@ enetc_clean_rx_ring_cacheable(struct enetc_bdr *rx_ring,
 
 		if (bd_status & ENETC_RXBD_LSTATUS_F) {
 			seg->next = NULL;
-			first_seg->pkt_len -= rx_ring->crc_len;
+			if (rx_ring->crc_len)
+				enetc_rx_crc_trim(first_seg, prev_seg, seg,
+						  rx_ring->crc_len);
+
 			rx_pkts[rx_frm_cnt] = first_seg;
 			rx_frm_cnt++;
 			first_seg = NULL;
Signature · 1 line
2.25.1
#82 lore raw

PATCH v6 2/13 net/enetc: add TSO support for ENETC4 VF

In reply to Gagandeep Singh

Add TCP and UDP segmentation offload (TSO) for the ENETC4 virtual function. The offload is advertised through the VF Tx capabilities and is enabled on a per-queue basis when an application requests the TSO offload flags during Tx queue setup.

A dedicated Tx burst, enetc_xmit_pkts_lso(), builds the large-send descriptor chain: a standard header BD, a 16B extension BD carrying the segment size and frame length extension, and one BD per payload buffer with the final-frame flag on the last BD. To make room for the extra extension BD, an LSO-enabled Tx ring is allocated with twice the number of descriptors. The existing non-TSO Tx paths are left unchanged.

---
 doc/guides/nics/enetc4.rst             |   2 +
 doc/guides/nics/features/enetc4.ini    |   1 +
 doc/guides/rel_notes/release_26_11.rst |   1 +
 drivers/net/enetc/base/enetc4_hw.h     |  34 +++-
 drivers/net/enetc/enetc.h              |   3 +
 drivers/net/enetc/enetc4_ethdev.c      |  49 ++++-
 drivers/net/enetc/enetc4_vf.c          |   2 +
 drivers/net/enetc/enetc_rxtx.c         | 257 +++++++++++++++++++++++++
 8 files changed, 344 insertions(+), 5 deletions(-)
doc/guides/nics/enetc4.rst +2 -0
index f0dd039f6e..4d27e4048e 100644
@@ -53,6 +53,8 @@ Key functionality includes:
 - Receive processing: Upon packet reception, the BD Ring status bit is set,
   facilitating packet processing.
 - Transmission: Packet transmission precedes reception, ensuring efficient data transfer.
+- TCP and UDP segmentation offload (TSO) on VFs, enabled per Tx queue
+  when the TSO offload flag is requested.
 
 
 Prerequisites
doc/guides/nics/features/enetc4.ini +1 -0
index 91b18d979e..8ec1e8d00f 100644
@@ -7,6 +7,7 @@
 Link status event    = Y
 Speed capabilities   = Y
 Link status          = Y
+TSO                  = Y
 Promiscuous mode     = Y
 Allmulticast mode    = Y
 Unicast MAC filter   = Y
doc/guides/rel_notes/release_26_11.rst +1 -0
index 3678dd6894..6a348ab4e0 100644
@@ -61,6 +61,7 @@ New Features
   Updated the NXP ENETC4 poll mode driver for i.MX95:
 
   * Added KEEP_CRC Rx offload support for the ENETC4 PMD to preserve the Ethernet FCS.
+  * Added TCP Segmentation Offload (TSO) support for the ENETC4 VF.
 
 Removed Items
 -------------
drivers/net/enetc/base/enetc4_hw.h +33 -1
index c81ac00ec6..6bc462a93e 100644
@@ -1,5 +1,5 @@
 /* SPDX-License-Identifier: BSD-3-Clause
- * Copyright 2024 NXP
+ * Copyright 2024-2026 NXP
  *
  * This header file defines the register offsets and bit fields
  * of ENETC4 PF and VFs.
@@ -24,7 +24,12 @@ struct enetc_msg_swbd {
 
 /* enetc4 txbd flags */
 #define ENETC4_TXBD_FLAGS_L4CS		BIT(0)
+/* Request LSO (Large Send Offload) segmentation for this frame */
+#define ENETC4_TXBD_FLAGS_LSO		BIT(1)
+/* L4 checksum insertion (also used for checksum update on LSO) */
 #define ENETC4_TXBD_FLAGS_L_TX_CKSUM	BIT(3)
+/* Extended descriptor: the next 16B ring entry is an extension BD */
+#define ENETC4_TXBD_FLAGS_EXT		BIT(6)
 #define ENETC4_TXBD_FLAGS_F		BIT(7)
 /* L4 type */
 #define ENETC4_TXBD_L4T_UDP		BIT(0)
@@ -34,6 +39,33 @@ struct enetc_msg_swbd {
 /* IPv4 checksum */
 #define ENETC4_TXBD_IPCS		1
 
+/*
+ * Extension Transmit Buffer Descriptor (16B). When the standard BD has the
+ * extended flag set, this occupies the next ring entry and carries the extra
+ * fields required by LSO.
+ */
+struct enetc_tx_bd_ext {
+	uint32_t timestamp;	/* PTP timestamp, unused for LSO */
+	uint32_t vlan;		/* VLAN insert, unused for LSO */
+	uint32_t lso;		/* LSO_MAX_SEG_SIZE and FRM_LEN_EXT */
+	uint32_t flags;		/* extension flags */
+};
+
+/* LSO_MAX_SEG_SIZE occupies bits 13-0 of the LSO word */
+#define ENETC4_TXBD_EXT_LSO_SEG_MASK	0x3fff
+#define ENETC4_TXBD_EXT_LSO_SEG(mss) \
+		((uint32_t)((mss) & ENETC4_TXBD_EXT_LSO_SEG_MASK))
+/* FRM_LEN_EXT occupies bits 19-16 of the LSO word (top 4 bits of data len) */
+#define ENETC4_TXBD_EXT_FRM_LEN_EXT(x) \
+		(((uint32_t)((x) & 0xf)) << 16)
+/* Final flag in the extension flags word (bit 127 -> local bit 31) */
+#define ENETC4_TXBD_EXT_FLAGS_F		BIT(31)
+
+/* NETC does not create LSO frames larger than this many bytes */
+#define ENETC4_LSO_MAX_FRAME		9600
+/* Maximum LSO data unit (payload to be segmented) supported by HW: 256KB */
+#define ENETC4_LSO_MAX_DATA_UNIT	(256 * 1024)
+
 /***************************ENETC port registers**************************/
 #define ENETC4_PMR		0x10
 #define ENETC4_PMR_EN		(BIT(16) | BIT(17) | BIT(18))
drivers/net/enetc/enetc.h +3 -0
index d3a8b8e34a..6cd031f269 100644
@@ -99,6 +99,7 @@ struct enetc_bdr {
 	uint64_t ierrors;
 	uint8_t rx_deferred_start;
 	uint8_t tx_deferred_start;
+	uint8_t lso_enable;
 };
 
 struct enetc_eth_hw {
@@ -312,6 +313,8 @@ uint16_t enetc_xmit_pkts(void *txq, struct rte_mbuf **tx_pkts,
 		uint16_t nb_pkts);
 uint16_t enetc_xmit_pkts_nc(void *txq, struct rte_mbuf **tx_pkts,
 		uint16_t nb_pkts);
+uint16_t enetc_xmit_pkts_lso(void *txq, struct rte_mbuf **tx_pkts,
+		uint16_t nb_pkts);
 uint16_t enetc_recv_pkts(void *rxq, struct rte_mbuf **rx_pkts,
 		uint16_t nb_pkts);
 uint16_t enetc_recv_pkts_nc(void *rxq, struct rte_mbuf **rx_pkts,
drivers/net/enetc/enetc4_ethdev.c +45 -4

86 lines not on this page · raw message

drivers/net/enetc/enetc4_vf.c +2 -0
index 83a1e4931f..3083a56335 100644
@@ -60,6 +60,8 @@ static uint64_t dev_tx_offloads_sup =
 	RTE_ETH_TX_OFFLOAD_IPV4_CKSUM |
 	RTE_ETH_TX_OFFLOAD_UDP_CKSUM |
 	RTE_ETH_TX_OFFLOAD_TCP_CKSUM |
+	RTE_ETH_TX_OFFLOAD_TCP_TSO |
+	RTE_ETH_TX_OFFLOAD_UDP_TSO |
 	RTE_ETH_TX_OFFLOAD_MULTI_SEGS;
 
 static void
drivers/net/enetc/enetc_rxtx.c +257 -0

263 lines not on this page · raw message

Signature · 1 line
2.25.1
#83 lore raw

PATCH v6 3/13 net/enetc: add RSC (hardware LRO) support for ENETC4

In reply to Gagandeep Singh

Add Receive Segment Coalesce (RSC) support, exposed as the DPDK RTE_ETH_RX_OFFLOAD_TCP_LRO Rx offload, for the ENETC4 PF and VF on i.MX95. RSC lets the HW coalesce multiple in-order TCP segments of a flow into a single receive frame, reducing per-packet overhead.

RSC is a port-level offload driven by a dedicated Rx burst (enetc_recv_pkts_rsc). When TCP LRO is requested the ring is switched to 32B extended receive descriptors (RBaMR[BDS] = 1), the FCS is stripped (RBaMR[CRC] = 0, so RSC is incompatible with KEEP_CRC), interrupt coalescing is enabled (RBaICR0[ICEN] with a non-zero RBaICR1[ICTT] hold timer that doubles as the RSC flush window), and RBaRSCR[EN] is set with the coalesced-frame size clamped to the HW maximum.

Because a 32B descriptor spans two 16B ring slots, the ring length register (RBaLENR) and the consumer-index register are programmed in HW-descriptor units (slot count / 2), while the internal SW indices continue to track 16B slots. Coalesced clusters are delivered with the RTE_MBUF_F_RX_LRO flag set when RSC_FRAMES > 1.

---
 doc/guides/nics/enetc4.rst             |   4 +
 doc/guides/nics/features/enetc4.ini    |   1 +
 doc/guides/rel_notes/release_26_11.rst |   1 +
 drivers/net/enetc/base/enetc4_hw.h     |  75 ++++++++
 drivers/net/enetc/enetc.h              |   5 +
 drivers/net/enetc/enetc4_ethdev.c      | 112 +++++++++++-
 drivers/net/enetc/enetc4_vf.c          |   1 +
 drivers/net/enetc/enetc_rxtx.c         | 234 +++++++++++++++++++++++++
 8 files changed, 427 insertions(+), 6 deletions(-)
doc/guides/nics/enetc4.rst +4 -0
index 4d27e4048e..e7f4348603 100644
@@ -55,6 +55,10 @@ Key functionality includes:
 - Transmission: Packet transmission precedes reception, ensuring efficient data transfer.
 - TCP and UDP segmentation offload (TSO) on VFs, enabled per Tx queue
   when the TSO offload flag is requested.
+- Large receive offload (LRO) on the receive path via hardware Receive
+  Segment Coalesce (RSC), enabled when the TCP LRO Rx offload flag is
+  requested. RSC requires the FCS to be stripped, so it cannot be combined
+  with the KEEP_CRC Rx offload.
 
 
 Prerequisites
doc/guides/nics/features/enetc4.ini +1 -0
index 8ec1e8d00f..aae398e210 100644
@@ -7,6 +7,7 @@
 Link status event    = Y
 Speed capabilities   = Y
 Link status          = Y
+LRO                  = Y
 TSO                  = Y
 Promiscuous mode     = Y
 Allmulticast mode    = Y
doc/guides/rel_notes/release_26_11.rst +1 -0
index 6a348ab4e0..0dd08e0259 100644
@@ -62,6 +62,7 @@ New Features
 
   * Added KEEP_CRC Rx offload support for the ENETC4 PMD to preserve the Ethernet FCS.
   * Added TCP Segmentation Offload (TSO) support for the ENETC4 VF.
+  * Added Receive Segment Coalesce (RSC / hardware LRO) support for ENETC4 PF and VF.
 
 Removed Items
 -------------
drivers/net/enetc/base/enetc4_hw.h +75 -0

81 lines not on this page · raw message

drivers/net/enetc/enetc.h +5 -0
index 6cd031f269..145ebbbb00 100644
@@ -100,6 +100,8 @@ struct enetc_bdr {
 	uint8_t rx_deferred_start;
 	uint8_t tx_deferred_start;
 	uint8_t lso_enable;
+	void *rbidr;
+	uint8_t rsc_enable;
 };
 
 struct enetc_eth_hw {
@@ -319,12 +321,15 @@ uint16_t enetc_recv_pkts(void *rxq, struct rte_mbuf **rx_pkts,
 		uint16_t nb_pkts);
 uint16_t enetc_recv_pkts_nc(void *rxq, struct rte_mbuf **rx_pkts,
 		uint16_t nb_pkts);
+uint16_t enetc_recv_pkts_rsc(void *rxq, struct rte_mbuf **rx_pkts,
+		uint16_t nb_pkts);
 uint16_t enetc_xmit_pkts_cacheable(void *txq, struct rte_mbuf **tx_pkts,
 		uint16_t nb_pkts);
 uint16_t enetc_recv_pkts_cacheable(void *rxq, struct rte_mbuf **rx_pkts,
 		uint16_t nb_pkts);
 
 int enetc_refill_rx_ring(struct enetc_bdr *rx_ring, const int buff_cnt);
+int enetc_refill_rx_ring_rsc(struct enetc_bdr *rx_ring, const int buff_cnt);
 
 /*
  * Cache-maintenance constants for cacheable BD ring mode.
drivers/net/enetc/enetc4_ethdev.c +106 -6

173 lines not on this page · raw message

drivers/net/enetc/enetc4_vf.c +1 -0
index 3083a56335..be79a18a39 100644
@@ -53,6 +53,7 @@ static uint64_t dev_rx_offloads_sup =
 	RTE_ETH_RX_OFFLOAD_TCP_CKSUM |
 	RTE_ETH_RX_OFFLOAD_VLAN_FILTER |
 	RTE_ETH_RX_OFFLOAD_KEEP_CRC |
+	RTE_ETH_RX_OFFLOAD_TCP_LRO |
 	RTE_ETH_RX_OFFLOAD_SCATTER;
 
 /* Supported Tx offloads */
drivers/net/enetc/enetc_rxtx.c +234 -0

240 lines not on this page · raw message

Signature · 1 line
2.25.1
#84 lore raw

PATCH v6 4/13 net/enetc: extend PF-VF link speed field to 8 bits

In reply to Gagandeep Singh

The PF-to-VF message is only 16-bit wide, where the upper 8-bit is the class_id and the lower 8-bit carries the message content. For the link speed message, the lower 4-bit was previously occupied by the cookie field, leaving only 4-bit for the speed code, which allows at most 15 distinct speed values.

As the NETC IP evolves and supports more and more link speeds, 15 speed values are clearly insufficient. Since the cookie field is designed for non-blocking messages and has no meaningful use in link speed messages, remove it and expand the speed code field from 4-bit to 8-bit, allowing up to 255 speed values (ENETC_SPEED_MAX = 0xff).

Instead of enumerating every speed value greater than 5Gbps explicitly, introduce a formula-based approach:

	speed_code = (link_speed - 5000) / 1000 + ENETC_SPEED_5000

This removes the explicit enum entries for 10G, 25G, 50G and 100G, and replaces the individual switch-case branches with a generic implementation to get the speed, making it easy to support any future high speed without modifying the enum or the switch statement.

For backward compatibility with a PF running an older kernel (before 6.18.37) that still uses the legacy 4-bit speed code / 4-bit cookie message layout, add a "vf_link_legacy" devarg. When set to 1, the VF extracts the message result from the upper 4 bits of the lower byte and decodes speeds greater than 5Gbps using the legacy fixed class codes (10G/25G/50G/100G). The default (0) uses the new 8-bit layout.

	Usage: -a <pci_addr>,vf_link_legacy=1
---
 doc/guides/nics/enetc4.rst             |  11 ++
 doc/guides/rel_notes/release_26_11.rst |   3 +
 drivers/net/enetc/enetc.h              |  32 +++-
 drivers/net/enetc/enetc4_vf.c          | 202 +++++++++++++++++++++----
 4 files changed, 215 insertions(+), 33 deletions(-)
doc/guides/nics/enetc4.rst +11 -0
index e7f4348603..935cf90e6b 100644
@@ -133,6 +133,17 @@ VF-specific devargs
 
     dpdk-testpmd -a 0000:00:01.0,enetc4_vsi_delay=10 -- -i
 
+``vf_link_legacy``
+  Select the legacy 4-bit PF-to-VF link speed code layout.
+  Set to ``1`` when the host PF is running a kernel older than v6.18.37.
+  Kernels before that release encode link speed in only 4 bits; without this
+  flag the driver interprets those codes as 8-bit values and reports incorrect
+  link speeds.
+
+  Usage example::
+
+    dpdk-testpmd -a 0000:00:01.0,vf_link_legacy=1 -- -i
+
 PF/Common devargs
 ~~~~~~~~~~~~~~~~~
 
doc/guides/rel_notes/release_26_11.rst +3 -0
index 0dd08e0259..ee4f455c67 100644
@@ -63,6 +63,9 @@ New Features
   * Added KEEP_CRC Rx offload support for the ENETC4 PMD to preserve the Ethernet FCS.
   * Added TCP Segmentation Offload (TSO) support for the ENETC4 VF.
   * Added Receive Segment Coalesce (RSC / hardware LRO) support for ENETC4 PF and VF.
+  * Extended the PF-to-VF link speed code field from 4-bit to 8-bit in ENETC4.
+    Users running a PF kernel older than 6.18.37 must pass ``vf_link_legacy=1``
+    as a device argument, otherwise link speed reporting will be incorrect.
 
 Removed Items
 -------------
drivers/net/enetc/enetc.h +27 -5
index 145ebbbb00..d6ae54a132 100644
@@ -119,6 +119,10 @@ struct enetc_eth_hw {
 	uint32_t vsi_delay;   /* VSI-PSI message wait delay (us) */
 	uint32_t *txq_prior;  /* per-queue TX priority (TBMR priority bits) */
 	uint8_t nc_mode;      /* 1 = non-cacheable BD memory, use _nc ops */
+	/* 1 = legacy PF-to-VF link message layout (4-bit speed / 4-bit cookie),
+	 * for PF kernel versions before 6.18.37. Set via vf_link_legacy devarg.
+	 */
+	uint8_t vf_link_legacy;
 };
 
 /*
@@ -210,11 +214,29 @@ enum speed {
 	ENETC_SPEED_1000 = 0x5,
 	ENETC_SPEED_2500 = 0x6,
 	ENETC_SPEED_5000 = 0x7,
-	ENETC_SPEED_10G = 0x8,
-	ENETC_SPEED_25G = 0x9,
-	ENETC_SPEED_50G = 0xA,
-	ENETC_SPEED_100G = 0xB,
-	ENETC_SPEED_NOT_SUPPORTED = 0xF
+	/* Base speed class code used by the >5Gbps formula below */
+	/* Do not add enumeration values for any speed greater than
+	 * 5Gbps. For any speed greater than 5Gbps, its speed class
+	 * code should follow the formula below.
+	 *
+	 * SPEED = (link_speed - 5000) / 1000 + ENETC_SPEED_5000
+	 *
+	 * The unit of link_speed should be Mbps, the max SPEED
+	 * should <= ENETC_SPEED_MAX.
+	 */
+	ENETC_SPEED_MAX = 0xff,
+};
+
+/* Legacy speed class codes for backward compatibility with an older kernel PF
+ * (before 6.18.37) that encoded a 4-bit speed code and 4-bit cookie in the
+ * message's lower byte. Used only when the vf_link_legacy devarg is set.
+ */
+enum speed_legacy {
+	ENETC_SPEED_LEGACY_10G = 0x8,
+	ENETC_SPEED_LEGACY_25G = 0x9,
+	ENETC_SPEED_LEGACY_50G = 0xA,
+	ENETC_SPEED_LEGACY_100G = 0xB,
+	ENETC_SPEED_LEGACY_NOT_SUPPORTED = 0xF
 };
 
 /* PSI-VSI command header format */
drivers/net/enetc/enetc4_vf.c +174 -28

269 lines not on this page · raw message

Signature · 1 line
2.25.1
#85 lore raw

PATCH v6 5/13 net/enetc: support firmware version get for VF

In reply to Gagandeep Singh

Implement the ``.fw_version_get`` eth_dev op for the ENETC4 VF PMD to report the NETC IP revision.

The NETC IP major revision is read from the PCI revision ID register, while the IP minor revision is retrieved from the PSI over VSI-PSI messaging using the "Get IP version" command class (class ID 0xF0, command ID 0x1). The version is reported in the "<major>.<minor>" format.

The PSI firmware only implements the IP_MN command of this class, so the major revision is obtained from the PCI revision ID, matching the behaviour of the kernel PF/VF drivers.

---
 doc/guides/nics/enetc4.rst             |   1 +
 doc/guides/nics/features/enetc4.ini    |   1 +
 doc/guides/rel_notes/release_26_11.rst |   1 +
 drivers/net/enetc/enetc.h              |  19 +++-
 drivers/net/enetc/enetc4_vf.c          | 139 +++++++++++++++++++++++++
 5 files changed, 159 insertions(+), 2 deletions(-)
doc/guides/nics/enetc4.rst +1 -0
index 935cf90e6b..fa93f40b22 100644
@@ -59,6 +59,7 @@ Key functionality includes:
   Segment Coalesce (RSC), enabled when the TCP LRO Rx offload flag is
   requested. RSC requires the FCS to be stripped, so it cannot be combined
   with the KEEP_CRC Rx offload.
+- Firmware version: The NETC IP version is reported via ``rte_eth_dev_fw_version_get``.
 
 
 Prerequisites
doc/guides/nics/features/enetc4.ini +1 -0
index aae398e210..eaf474e7ba 100644
@@ -16,6 +16,7 @@ VLAN filter          = Y
 RSS hash             = Y
 Packet type parsing  = Y
 Basic stats          = Y
+FW version           = Y
 L3 checksum offload  = Y
 L4 checksum offload  = Y
 CRC offload          = Y
doc/guides/rel_notes/release_26_11.rst +1 -0
index ee4f455c67..d212cce000 100644
@@ -66,6 +66,7 @@ New Features
   * Extended the PF-to-VF link speed code field from 4-bit to 8-bit in ENETC4.
     Users running a PF kernel older than 6.18.37 must pass ``vf_link_legacy=1``
     as a device argument, otherwise link speed reporting will be incorrect.
+  * Added firmware version reporting for the ENETC4 VF.
 
 Removed Items
 -------------
drivers/net/enetc/enetc.h +17 -2
index d6ae54a132..c4a55626f8 100644
@@ -169,7 +169,8 @@ enum enetc_msg_cmd_class_id {
 	ENETC_CLASS_ID_MAC_FILTER = 0x20,
 	ENETC_CLASS_ID_VLAN_FILTER = 0x21,
 	ENETC_CLASS_ID_LINK_STATUS = 0x80,
-	ENETC_CLASS_ID_LINK_SPEED = 0x81
+	ENETC_CLASS_ID_LINK_SPEED = 0x81,
+	ENETC_CLASS_ID_GET_IP_VER = 0xF0
 };
 
 /* Enum for command IDs */
@@ -183,9 +184,18 @@ enum enetc_msg_cmd_id {
 	ENETC_CMD_ID_GET_LINK_STATUS = 0,
 	ENETC_CMD_ID_REGISTER_LINK_NOTIF = 1,
 	ENETC_CMD_ID_UNREGISTER_LINK_NOTIF = 2,
-	ENETC_CMD_ID_GET_LINK_SPEED = 0
+	ENETC_CMD_ID_GET_LINK_SPEED = 0,
+	/* Get IP version command IDs (class ID 0xF0) */
+	ENETC_CMD_ID_GET_IP_MJ = 0,
+	ENETC_CMD_ID_GET_IP_MN = 1,
+	ENETC_CMD_ID_GET_IP_INT = 2,
+	ENETC_CMD_ID_GET_IP_MNT = 3,
+	ENETC_CMD_ID_GET_IP_CFG = 4
 };
 
+/* IP_VER value returned when the version is not available */
+#define ENETC_IP_VER_NOT_AVAILABLE	0xFF
+
 enum mac_addr_status {
 	ENETC_INVALID_MAC_ADDR = 0x0,
 	ENETC_DUPLICATE_MAC_ADDR = 0X1,
@@ -273,6 +283,11 @@ struct enetc_msg_cmd_get_link_speed {
 	struct enetc_msg_cmd_header header;
 };
 
+/* Get IP version command message format (class ID 0xF0) */
+struct enetc_msg_cmd_get_ip_ver {
+	struct enetc_msg_cmd_header header;
+};
+
 struct enetc_msg_cmd_set_vlan_promisc {
 	struct enetc_msg_cmd_header header;
 	uint8_t op;
drivers/net/enetc/enetc4_vf.c +139 -0

163 lines not on this page · raw message

Signature · 1 line
2.25.1
#86 lore raw

PATCH v6 6/13 net/enetc: support registers dump

In reply to Gagandeep Singh

Implement the .get_reg operation for the ENETC4 PF and VF PMDs to dump the device registers via rte_eth_dev_get_reg_info.

The VF dumps the registers reachable by a virtual station interface (VSI): the station interface and per-ring BD ring registers. Port registers are not accessible by a VF.

The PF additionally dumps the port registers, which are only accessible by the physical station interface (PSI).

---
 doc/guides/nics/enetc4.rst             |  1 +
 doc/guides/nics/features/enetc4.ini    |  1 +
 doc/guides/rel_notes/release_26_11.rst |  1 +
 drivers/net/enetc/enetc.h              | 12 +++++
 drivers/net/enetc/enetc4_ethdev.c      | 70 ++++++++++++++++++++++++++
 drivers/net/enetc/enetc4_vf.c          | 62 +++++++++++++++++++++++
 6 files changed, 147 insertions(+)
doc/guides/nics/enetc4.rst +1 -0
index fa93f40b22..16389aee5b 100644
@@ -60,6 +60,7 @@ Key functionality includes:
   requested. RSC requires the FCS to be stripped, so it cannot be combined
   with the KEEP_CRC Rx offload.
 - Firmware version: The NETC IP version is reported via ``rte_eth_dev_fw_version_get``.
+- Registers dump: The station interface, port (PF only) and BD ring registers are dumped via ``rte_eth_dev_get_reg_info``.
 
 
 Prerequisites
doc/guides/nics/features/enetc4.ini +1 -0
index eaf474e7ba..6540a43909 100644
@@ -17,6 +17,7 @@ RSS hash             = Y
 Packet type parsing  = Y
 Basic stats          = Y
 FW version           = Y
+Registers dump       = Y
 L3 checksum offload  = Y
 L4 checksum offload  = Y
 CRC offload          = Y
doc/guides/rel_notes/release_26_11.rst +1 -0
index d212cce000..6fece98f28 100644
@@ -67,6 +67,7 @@ New Features
     Users running a PF kernel older than 6.18.37 must pass ``vf_link_legacy=1``
     as a device argument, otherwise link speed reporting will be incorrect.
   * Added firmware version reporting for the ENETC4 VF.
+  * Added register dump support for ENETC4 PF and VF.
 
 Removed Items
 -------------
drivers/net/enetc/enetc.h +12 -0
index c4a55626f8..f0d64cfb29 100644
@@ -395,6 +395,18 @@ enetc_bd_unused(struct enetc_bdr *bdr)
 	return bdr->bd_count + bdr->next_to_clean - bdr->next_to_use - 1;
 }
 
+/* Per-ring Tx BDR registers dumped by .get_reg (shared by PF and VF) */
+static const uint32_t enetc4_txbdr_regs[] = {
+	ENETC_TBMR, ENETC_TBSR, ENETC_TBBAR0, ENETC_TBBAR1,
+	ENETC_TBCIR, ENETC_TBLENR,
+};
+
+/* Per-ring Rx BDR registers dumped by .get_reg (shared by PF and VF) */
+static const uint32_t enetc4_rxbdr_regs[] = {
+	ENETC_RBMR, ENETC_RBSR, ENETC_RBBSR, ENETC_RBCIR,
+	ENETC_RBBAR0, ENETC_RBBAR1, ENETC_RBPIR, ENETC_RBLENR,
+};
+
 /* CBDR prototypes */
 int enetc4_setup_cbdr(struct rte_eth_dev *dev, struct enetc_hw *hw,
 			int bd_count, struct netc_cbdr *cbdr);
drivers/net/enetc/enetc4_ethdev.c +70 -0

82 lines not on this page · raw message

drivers/net/enetc/enetc4_vf.c +62 -0

80 lines not on this page · raw message

Signature · 1 line
2.25.1
#87 lore raw

PATCH v6 7/13 net/enetc: support ethtool ring parameters

In reply to Gagandeep Singh

The ethtool ring parameter query relies on the queue info ethdev ops (.rxq_info_get/.txq_info_get) together with the descriptor limits reported in dev_info. The PF already registered these ops, but the VF ops tables did not, so ring parameter queries failed on the VF.

Make enetc4_rxq_info_get() and enetc4_txq_info_get() non-static and register them in both VF ops tables so ring parameters are reported for both the PF and VF.

---
 doc/guides/rel_notes/release_26_11.rst | 1 +
 drivers/net/enetc/enetc.h              | 4 ++++
 drivers/net/enetc/enetc4_ethdev.c      | 4 ++--
 drivers/net/enetc/enetc4_vf.c          | 4 ++++
 4 files changed, 11 insertions(+), 2 deletions(-)
doc/guides/rel_notes/release_26_11.rst +1 -0
index 6fece98f28..ec223a93ba 100644
@@ -68,6 +68,7 @@ New Features
     as a device argument, otherwise link speed reporting will be incorrect.
   * Added firmware version reporting for the ENETC4 VF.
   * Added register dump support for ENETC4 PF and VF.
+  * Added ring parameters support for the ENETC4 VF (rxq_info_get / txq_info_get).
 
 Removed Items
 -------------
drivers/net/enetc/enetc.h +4 -0
index f0d64cfb29..4b563851b8 100644
@@ -338,6 +338,10 @@ int enetc4_tx_queue_stop(struct rte_eth_dev *dev, uint16_t qidx);
 void enetc4_tx_queue_release(struct rte_eth_dev *dev, uint16_t qid);
 const uint32_t *enetc4_supported_ptypes_get(struct rte_eth_dev *dev __rte_unused,
 			size_t *no_of_elements);
+void enetc4_rxq_info_get(struct rte_eth_dev *dev, uint16_t queue_id,
+			 struct rte_eth_rxq_info *qinfo);
+void enetc4_txq_info_get(struct rte_eth_dev *dev, uint16_t queue_id,
+			 struct rte_eth_txq_info *qinfo);
 
 /*
  * enetc4_vf function prototype
drivers/net/enetc/enetc4_ethdev.c +2 -2
index 7a296a8d07..ad6ef84214 100644
@@ -1127,7 +1127,7 @@ enetc4_tx_queue_stop(struct rte_eth_dev *dev, uint16_t qidx)
 	return 0;
 }
 
-static void
+void
 enetc4_rxq_info_get(struct rte_eth_dev *dev, uint16_t queue_id,
 			struct rte_eth_rxq_info *qinfo)
 {
@@ -1141,7 +1141,7 @@ enetc4_rxq_info_get(struct rte_eth_dev *dev, uint16_t queue_id,
 	qinfo->conf.rx_drop_en = 0;
 }
 
-static void
+void
 enetc4_txq_info_get(struct rte_eth_dev *dev, uint16_t queue_id,
 			struct rte_eth_txq_info *qinfo)
 {
drivers/net/enetc/enetc4_vf.c +4 -0
index ec9a2e2bf8..3da84941a2 100644
@@ -1539,10 +1539,12 @@ static const struct eth_dev_ops enetc4_vf_ops_no_vsi_m = {
 	.rx_queue_start       = enetc4_rx_queue_start,
 	.rx_queue_stop        = enetc4_rx_queue_stop,
 	.rx_queue_release     = enetc4_rx_queue_release,
+	.rxq_info_get         = enetc4_rxq_info_get,
 	.tx_queue_setup       = enetc4_tx_queue_setup,
 	.tx_queue_start       = enetc4_tx_queue_start,
 	.tx_queue_stop        = enetc4_tx_queue_stop,
 	.tx_queue_release     = enetc4_tx_queue_release,
+	.txq_info_get         = enetc4_txq_info_get,
 	.dev_supported_ptypes_get = enetc4_supported_ptypes_get,
 };
 
@@ -1569,10 +1571,12 @@ static const struct eth_dev_ops enetc4_vf_ops = {
 	.rx_queue_start       = enetc4_rx_queue_start,
 	.rx_queue_stop        = enetc4_rx_queue_stop,
 	.rx_queue_release     = enetc4_rx_queue_release,
+	.rxq_info_get         = enetc4_rxq_info_get,
 	.tx_queue_setup       = enetc4_tx_queue_setup,
 	.tx_queue_start       = enetc4_tx_queue_start,
 	.tx_queue_stop        = enetc4_tx_queue_stop,
 	.tx_queue_release     = enetc4_tx_queue_release,
+	.txq_info_get         = enetc4_txq_info_get,
 	.dev_supported_ptypes_get = enetc4_supported_ptypes_get,
 };
 
Signature · 1 line
2.25.1
#88 lore raw

PATCH v6 8/13 net/enetc: refresh link speed on VF link-up interrupt

In reply to Gagandeep Singh

The interrupt-driven link-status path (enetc4_process_psi_msg) only updated link_status when a PSI-to-VSI notification arrived; it never re-queried the link speed from the PF. As a result, after a link-down followed by a link-up the cached link_speed showed the speed from the previous session rather than the freshly negotiated one.

1. Introducing enetc4_decode_link_speed() - a shared helper that maps a PF-to-VF speed status code to the corresponding RTE_ETH_SPEED_NUM_* / RTE_ETH_LINK_*_DUPLEX values, handling both the current and the legacy (vf_link_legacy) 4-bit message layout.

2. Calling enetc4_vf_get_link_speed() inside enetc4_process_psi_msg() on ENETC_LINK_UP so the negotiated speed is fetched from the PF and decoded immediately, before rte_eth_linkstatus_set() is called and the LSC callback is fired.

---
 doc/guides/rel_notes/release_26_11.rst |   1 +
 drivers/net/enetc/enetc.h              |   2 +
 drivers/net/enetc/enetc4_ethdev.c      |   1 +
 drivers/net/enetc/enetc4_vf.c          | 257 +++++++++++++------------
 4 files changed, 141 insertions(+), 120 deletions(-)
doc/guides/rel_notes/release_26_11.rst +1 -0
index ec223a93ba..1765adc1bc 100644
@@ -69,6 +69,7 @@ New Features
   * Added firmware version reporting for the ENETC4 VF.
   * Added register dump support for ENETC4 PF and VF.
   * Added ring parameters support for the ENETC4 VF (rxq_info_get / txq_info_get).
+  * Refreshed VF link speed on the link-up interrupt in the ENETC4 VF driver.
 
 Removed Items
 -------------
drivers/net/enetc/enetc.h +2 -0
index 4b563851b8..185fd8c4ee 100644
@@ -5,6 +5,7 @@
 #ifndef _ENETC_H_
 #define _ENETC_H_
 
+#include <pthread.h>
 #include <rte_time.h>
 #include <ethdev_pci.h>
 
@@ -123,6 +124,7 @@ struct enetc_eth_hw {
 	 * for PF kernel versions before 6.18.37. Set via vf_link_legacy devarg.
 	 */
 	uint8_t vf_link_legacy;
+	pthread_mutex_t vsi_lock; /* serializes all VSI-PSI mailbox transactions */
 };
 
 /*
drivers/net/enetc/enetc4_ethdev.c +1 -0
index ad6ef84214..3d86072593 100644
@@ -844,6 +844,7 @@ enetc4_dev_close(struct rte_eth_dev *dev)
 		if (dev->data->dev_conf.intr_conf.lsc != 0)
 			enetc4_vf_dev_intr(dev, false);
 		ret = enetc4_vf_dev_stop(dev);
+		pthread_mutex_destroy(&hw->vsi_lock);
 	} else {
 		ret = enetc4_dev_stop(dev);
 	}
drivers/net/enetc/enetc4_vf.c +137 -120

307 lines not on this page · raw message

Signature · 1 line
2.25.1
#89 lore raw

PATCH v6 9/13 net/enetc: support stats reset for VF

In reply to Gagandeep Singh

The NETC SI-level hardware counters (SIROCT0, SIRFRM0, SITOCT0, SITFRM0, SITDFCR) are read-only for a VF and cannot be directly zeroed. No VSI-PSI command class exists for stats reset, and using FLR/soft-reset to clear counters is not reliable due to a known hardware erratum on some NETC platforms.

Implement stats_reset for the enetc4 VF PMD using a software snapshot/delta approach: on stats_reset, the current HW counter values are captured as a baseline in a new per-device enetc4_vf_stats_saved struct. stats_get then reports the delta (current_hw_value - saved_baseline), so counters appear to start from zero after each reset call. Per-ring software Rx error accumulators (ierrors) are zeroed directly on reset.

Register the stats_reset callback in both VF ops tables (enetc4_vf_ops and enetc4_vf_ops_no_vsi_m) so the feature is available regardless of whether the VSI messaging path is enabled.

---
 doc/guides/rel_notes/release_26_11.rst |  1 +
 drivers/net/enetc/enetc.h              | 17 +++++++
 drivers/net/enetc/enetc4_vf.c          | 61 +++++++++++++++++++++++---
 3 files changed, 74 insertions(+), 5 deletions(-)
doc/guides/rel_notes/release_26_11.rst +1 -0
index 1765adc1bc..a42577c681 100644
@@ -70,6 +70,7 @@ New Features
   * Added register dump support for ENETC4 PF and VF.
   * Added ring parameters support for the ENETC4 VF (rxq_info_get / txq_info_get).
   * Refreshed VF link speed on the link-up interrupt in the ENETC4 VF driver.
+  * Added stats reset for the ENETC4 VF using a software snapshot/delta approach.
 
 Removed Items
 -------------
drivers/net/enetc/enetc.h +17 -0
index 185fd8c4ee..96e18028a6 100644
@@ -105,6 +105,21 @@ struct enetc_bdr {
 	uint8_t rsc_enable;
 };
 
+/*
+ * Saved SI counter baseline for VF stats reset. Since the SI-level
+ * hardware counters (SIROCT0, SIRFRM0, SITOCT0, SITFRM0, SITDFCR)
+ * are read-only for a VF and cannot be directly zeroed, stats_reset
+ * captures the current counter values as a baseline. stats_get then
+ * reports the delta: current_hw_value - baseline.
+ */
+struct enetc4_vf_stats_saved {
+	uint64_t ipackets;
+	uint64_t opackets;
+	uint64_t ibytes;
+	uint64_t obytes;
+	uint64_t oerrors;
+};
+
 struct enetc_eth_hw {
 	struct rte_eth_dev *ndev;
 	struct enetc_hw hw;
@@ -125,6 +140,8 @@ struct enetc_eth_hw {
 	 */
 	uint8_t vf_link_legacy;
 	pthread_mutex_t vsi_lock; /* serializes all VSI-PSI mailbox transactions */
+	/* Baseline snapshot for VF stats reset (software delta approach). */
+	struct enetc4_vf_stats_saved vf_stats_saved;
 };
 
 /*
drivers/net/enetc/enetc4_vf.c +56 -5

83 lines not on this page · raw message

Signature · 1 line
2.25.1
#90 lore raw

PATCH v6 10/13 net/enetc4: add per-queue Rx interrupt support for VF

In reply to Gagandeep Singh

Add MSI-X per-queue Rx interrupt support to the ENETC4 VF PMD on the cacheable (default) Rx path. This allows applications such as l3fwd-power to block in epoll_wait when no traffic is present, reducing CPU utilization to near zero.

MSI-X vector 0 is reserved for the PSI-to-VSI mailbox. Rx queue i is mapped to MSI-X vector i + 1 via ENETC_SIMSIRRV. Per-ring coalescing is enabled with ICPT=1 so the first arriving packet fires the interrupt immediately. The SIRXIDR W1C detect bit is cleared before re-arming ENETC_RBIER to prevent spurious interrupts after traffic stops.

The interrupt infrastructure (rte_intr_efd_enable + rte_intr_vec_list_alloc) is set up before rte_intr_enable() so that vfio-pci can wire each MSI-X vector to its eventfd when programming the MSI-X table.

enetc4_dev_configure() is updated to trigger interrupt setup when intr_conf.rxq is set (not only when intr_conf.lsc is set), as applications like l3fwd-power set intr_conf.rxq without setting lsc.

---
 doc/guides/nics/enetc4.rst             | 65 ++++++++++++++++++++
 doc/guides/nics/features/enetc4.ini    |  1 +
 doc/guides/rel_notes/release_26_11.rst |  1 +
 drivers/net/enetc/base/enetc4_hw.h     |  2 +
 drivers/net/enetc/enetc.h              |  1 +
 drivers/net/enetc/enetc4_ethdev.c      |  9 +--
 drivers/net/enetc/enetc4_vf.c          | 84 +++++++++++++++++++++++++-
 7 files changed, 158 insertions(+), 5 deletions(-)
doc/guides/nics/enetc4.rst +65 -0
index 16389aee5b..2b73916682 100644
@@ -59,6 +59,10 @@ Key functionality includes:
   Segment Coalesce (RSC), enabled when the TCP LRO Rx offload flag is
   requested. RSC requires the FCS to be stripped, so it cannot be combined
   with the KEEP_CRC Rx offload.
+- Per-queue Rx interrupts on VFs (cacheable Rx path only), enabling
+  interrupt-driven receive with ``vfio-pci``. Applications set
+  ``intr_conf.rxq = 1`` in ``rte_eth_conf`` to activate this feature.
+  See `Rx Interrupt Mode (VF)`_ for setup details.
 - Firmware version: The NETC IP version is reported via ``rte_eth_dev_fw_version_get``.
 - Registers dump: The station interface, port (PF only) and BD ring registers are dumped via ``rte_eth_dev_get_reg_info``.
 
@@ -167,3 +171,64 @@ PF/Common devargs
   Usage example::
 
     dpdk-testpmd -a 0000:00:00.0,nc=1 -- -i
+
+
+Rx Interrupt Mode (VF)
+----------------------
+
+The ENETC4 VF PMD supports per-queue MSI-X Rx interrupts on the cacheable
+(default) Rx path. This allows applications to block in ``epoll_wait``
+instead of busy-polling, reducing CPU utilization when traffic is absent.
+
+**MSI-X vector assignment**
+
+ENETC4 VF MSI-X vector 0 is reserved for the PSI-to-VSI mailbox interrupt
+(link status notifications). Rx queue ``i`` is mapped to vector ``i + 1``.
+The driver allocates all required eventfds before calling
+``rte_intr_enable()`` so that ``vfio-pci`` can wire each MSI-X vector to
+its eventfd when it programs the MSI-X table.
+
+**Kernel and driver requirements**
+
+- ``vfio-pci`` kernel module with no-IOMMU mode enabled (no SMMU required).
+- The non-cacheable memory mode (``nc=1`` devarg) does **not** support
+  Rx interrupts and returns ``-ENOTSUP`` from ``rx_queue_intr_enable``.
+
+**Host setup**
+
+.. code-block:: console
+
+   # Enable vfio-pci no-IOMMU mode (if SMMU is not available)
+   modprobe vfio enable_unsafe_noiommu_mode=1
+   modprobe vfio-pci
+
+   # Bind the VF to vfio-pci
+   echo vfio-pci > /sys/bus/pci/devices/<vf_pci_addr>/driver_override
+   echo <vf_pci_addr> > /sys/bus/pci/drivers_probe
+
+**Running l3fwd-power with a single queue and core**
+
+The ``l3fwd-power`` sample application demonstrates interrupt-driven Rx.
+It sets ``intr_conf.rxq = 1`` in ``rte_eth_conf``, which triggers the VF
+interrupt setup in the driver. The ``--vfio-intr=msix`` EAL flag instructs
+DPDK to use MSI-X eventfds for interrupt signalling.
+
+.. code-block:: console
+
+   ./dpdk-l3fwd-power -l 0-1 -n 1 --vfio-intr=msix \
+       -a <vf_pci_addr> -- \
+       -p 0x1 --config="(0,0,1)" --no-numa --interrupt-only
+
+Where:
+
+- ``-l 0-1`` assigns the main thread to core 0 and the forwarding lcore to
+  core 1.
+- ``-a <vf_pci_addr>`` specifies the VF PCI address (e.g. ``0000:01:00.1``).
+- ``--config="(0,0,1)"`` maps port 0, queue 0 to lcore 1.
+- ``--interrupt-only`` enables pure interrupt mode (no busy-poll fallback).
+
+With no incoming traffic the forwarding lcore sleeps in ``epoll_wait``;
+CPU utilization drops to near zero. On the first arriving packet the MSI-X
+interrupt fires, the lcore wakes, drains the ring, disables the interrupt,
+processes the burst, then re-enables and re-arms the interrupt before
+returning to sleep.
doc/guides/nics/features/enetc4.ini +1 -0
index 6540a43909..005c64a3ca 100644
@@ -5,6 +5,7 @@
 ;
 [Features]
 Link status event    = Y
+Rx interrupt         = Y
 Speed capabilities   = Y
 Link status          = Y
 LRO                  = Y
doc/guides/rel_notes/release_26_11.rst +1 -0
index a42577c681..c182495118 100644
@@ -71,6 +71,7 @@ New Features
   * Added ring parameters support for the ENETC4 VF (rxq_info_get / txq_info_get).
   * Refreshed VF link speed on the link-up interrupt in the ENETC4 VF driver.
   * Added stats reset for the ENETC4 VF using a software snapshot/delta approach.
+  * Added per-queue MSI-X Rx interrupt support for the ENETC4 VF.
 
 Removed Items
 -------------
drivers/net/enetc/base/enetc4_hw.h +2 -0
index d42c04df4b..dff6b8ddf2 100644
@@ -249,6 +249,8 @@ struct enetc_rx_bd_ext {
 #define ENETC4_VSIIDR            0xA08
 #define ENETC4_VSIIER_MRIE       BIT(9)
 #define ENETC4_SI_INT_IDX        0
+/* MSI-X vector base for per-Rx-queue interrupts; vector 0 is the mailbox. */
+#define ENETC4_VF_RX_VEC_BASE    1
 
 /* VSI Registers */
 #define ENETC4_VSIMSGSR  0x204   /* RO */
drivers/net/enetc/enetc.h +1 -0
index 96e18028a6..9ef493888c 100644
@@ -135,6 +135,7 @@ struct enetc_eth_hw {
 	uint32_t vsi_delay;   /* VSI-PSI message wait delay (us) */
 	uint32_t *txq_prior;  /* per-queue TX priority (TBMR priority bits) */
 	uint8_t nc_mode;      /* 1 = non-cacheable BD memory, use _nc ops */
+	uint8_t rxq_intr_en;  /* 1 = per-queue Rx MSI-X interrupts enabled */
 	/* 1 = legacy PF-to-VF link message layout (4-bit speed / 4-bit cookie),
 	 * for PF kernel versions before 6.18.37. Set via vf_link_legacy devarg.
 	 */
drivers/net/enetc/enetc4_ethdev.c +5 -4
index 3d86072593..53d201d62b 100644
@@ -841,7 +841,8 @@ enetc4_dev_close(struct rte_eth_dev *dev)
 		return 0;
 
 	if (hw->device_id == ENETC4_DEV_ID_VF) {
-		if (dev->data->dev_conf.intr_conf.lsc != 0)
+		if (dev->data->dev_conf.intr_conf.lsc != 0 ||
+		    dev->data->dev_conf.intr_conf.rxq != 0)
 			enetc4_vf_dev_intr(dev, false);
 		ret = enetc4_vf_dev_stop(dev);
 		pthread_mutex_destroy(&hw->vsi_lock);
@@ -964,12 +965,12 @@ enetc4_dev_configure(struct rte_eth_dev *dev)
 	if (hw->device_id != ENETC4_DEV_ID_VF)
 		enetc4_port_wr(enetc_hw, ENETC4_PARCSCR, checksum);
 
-	/* Enable interrupts */
 	if (hw->device_id == ENETC4_DEV_ID_VF) {
-		if (dev->data->dev_conf.intr_conf.lsc != 0) {
+		if (dev->data->dev_conf.intr_conf.lsc != 0 ||
+		    dev->data->dev_conf.intr_conf.rxq != 0) {
 			ret = enetc4_vf_dev_intr(dev, true);
 			if (ret)
-				ENETC_PMD_WARN("Failed to setup link interrupts");
+				ENETC_PMD_WARN("Failed to setup VF interrupts: %d", ret);
 		}
 	}
 
drivers/net/enetc/enetc4_vf.c +83 -1

124 lines not on this page · raw message

Signature · 1 line
2.25.1
#91 lore raw

PATCH v6 11/13 net/enetc4: add SI-based port VLAN insertion and removal

In reply to Gagandeep Singh

Implement hardware VLAN tag insertion on Tx and removal on Rx via the per-SI VLAN isolation (pvid) mechanism on ENETC4.

On a PF, the driver writes directly to PSIaVLANR(0) (VID + enable bit) and PSIaCFGR0(0) (SIVIE for Tx insertion, VTE for Rx removal, SIVC_CVLAN to allow C-VLAN 0x8100 TPID).

On a privileged VF, the request is forwarded to the kernel PF via the VSI-PSI mailbox using a new command class 0x24 (SI VLAN isolation, cmd ID 0x1). The kernel PF handler programs the same registers on behalf of the VF's station interface. The class 0x24 reply is added to the pass-through list in enetc4_msg_vsi_send() so it is handled correctly alongside the existing command classes

---
 doc/guides/nics/enetc4.rst             |  4 ++
 doc/guides/nics/features/enetc4.ini    |  1 +
 doc/guides/rel_notes/release_26_11.rst |  1 +
 drivers/net/enetc/base/enetc4_hw.h     | 14 +++++
 drivers/net/enetc/enetc.h              | 23 +++++++
 drivers/net/enetc/enetc4_ethdev.c      | 39 ++++++++++++
 drivers/net/enetc/enetc4_vf.c          | 83 ++++++++++++++++++++++++++
 7 files changed, 165 insertions(+)
doc/guides/nics/enetc4.rst +4 -0
index 2b73916682..262e2fe703 100644
@@ -65,6 +65,10 @@ Key functionality includes:
   See `Rx Interrupt Mode (VF)`_ for setup details.
 - Firmware version: The NETC IP version is reported via ``rte_eth_dev_fw_version_get``.
 - Registers dump: The station interface, port (PF only) and BD ring registers are dumped via ``rte_eth_dev_get_reg_info``.
+- SI-based port VLAN (pvid): Hardware VLAN tag insertion on Tx and removal on Rx, configured
+  via ``rte_eth_dev_set_vlan_pvid``. On a PF the registers are written directly; on a privileged
+  VF the request is forwarded to the kernel PF through the VSI-PSI mailbox (class 0x24).
+  Use the testpmd command ``tx_vlan set pvid <port_id> <vlan_id> on|off`` to enable or disable.
 
 
 Prerequisites
doc/guides/nics/features/enetc4.ini +1 -0
index 005c64a3ca..01b0dc5b80 100644
@@ -14,6 +14,7 @@ Promiscuous mode     = Y
 Allmulticast mode    = Y
 Unicast MAC filter   = Y
 VLAN filter          = Y
+VLAN offload         = Y
 RSS hash             = Y
 Packet type parsing  = Y
 Basic stats          = Y
doc/guides/rel_notes/release_26_11.rst +1 -0
index c182495118..190d77ecee 100644
@@ -72,6 +72,7 @@ New Features
   * Refreshed VF link speed on the link-up interrupt in the ENETC4 VF driver.
   * Added stats reset for the ENETC4 VF using a software snapshot/delta approach.
   * Added per-queue MSI-X Rx interrupt support for the ENETC4 VF.
+  * Added SI-based port VLAN insertion (Tx) and removal (Rx) for ENETC4 PF and VF.
 
 Removed Items
 -------------
drivers/net/enetc/base/enetc4_hw.h +14 -0
index dff6b8ddf2..cddfa6e0ae 100644
@@ -276,6 +276,20 @@ struct enetc_rx_bd_ext {
 #define ENETC4_SICTR0		0x18
 #define ENETC4_SICTR1		0x1c
 
+/* PSI SI VLAN register: per-SI VLAN tag for insertion/removal */
+#define ENETC4_PSIVLANR(a)		((a) * 0x80 + 0x2008)
+#define ENETC4_PSIVLANR_E		BIT(31)  /* enable SI VLAN processing */
+#define ENETC4_PSIVLANR_VTEA		BIT(30)  /* 0=strip tag, 1=zero VID */
+#define ENETC4_PSIVLANR_PCP(v)		(((uint32_t)(v) & 0x7) << 13)
+#define ENETC4_PSIVLANR_DEI		BIT(12)
+#define ENETC4_PSIVLANR_VID(v)		((uint32_t)(v) & 0xfff)
+
+/* PSI SI configuration register 0 */
+#define ENETC4_PSICFGR0(a)		((a) * 0x80 + 0x2010)
+#define ENETC4_PSICFGR0_SIVC_CVLAN	BIT(24)  /* allow C-VLAN 0x8100 */
+#define ENETC4_PSICFGR0_SIVIE		BIT(14)  /* SI VLAN insertion enable */
+#define ENETC4_PSICFGR0_VTE		BIT(12)  /* SI VLAN removal enable */
+
 /* general register accessors */
 #define enetc4_rd_reg(reg)	rte_read32((void *)(reg))
 #define enetc4_wr_reg(reg, val)  rte_write32((val), (void *)(reg))
drivers/net/enetc/enetc.h +23 -0
index 9ef493888c..8189dc3ea8 100644
@@ -188,6 +188,8 @@ struct enetc_eth_adapter {
 enum enetc_msg_cmd_class_id {
 	ENETC_CLASS_ID_MAC_FILTER = 0x20,
 	ENETC_CLASS_ID_VLAN_FILTER = 0x21,
+	/* Configure SI VLAN isolation (insert / remove) */
+	ENETC_CLASS_ID_SI_VLAN_ISO = 0x24,
 	ENETC_CLASS_ID_LINK_STATUS = 0x80,
 	ENETC_CLASS_ID_LINK_SPEED = 0x81,
 	ENETC_CLASS_ID_GET_IP_VER = 0xF0
@@ -213,6 +215,11 @@ enum enetc_msg_cmd_id {
 	ENETC_CMD_ID_GET_IP_CFG = 4
 };
 
+/* Command IDs for class ID 0x24 (SI VLAN isolation) */
+enum enetc_msg_si_vlan_cmd_id {
+	ENETC_CMD_ID_SET_SI_VLAN_ISO = 1,
+};
+
 /* IP_VER value returned when the version is not available */
 #define ENETC_IP_VER_NOT_AVAILABLE	0xFF
 
@@ -324,6 +331,22 @@ struct enetc_msg_vlan_exact_filter {
 	uint8_t reserved2;
 };
 
+/* VSI-PSI SI VLAN isolation message (class 0x24, cmd 0x1) */
+struct enetc_msg_si_vlan_iso {
+	struct enetc_msg_cmd_header header;
+	uint8_t ctrl;          /* E[7], VTEA[6], TPID[1:0] */
+	uint8_t pcp_dei_vid_hi; /* PCP[7:5], DEI[4], VID[11:8] */
+	uint8_t vid_lo;        /* VID[7:0] */
+	uint8_t reserved_0;
+	uint8_t flags;         /* SVIE[2], VTE[1] */
+	uint8_t reserved_1[3];
+};
+
+#define ENETC_SI_VLAN_ISO_E	BIT(7)  /* ctrl: enable SI VLAN */
+#define ENETC_SI_VLAN_ISO_VTEA	BIT(6)  /* ctrl: 0=strip, 1=zero VID */
+#define ENETC_SI_VLAN_ISO_SVIE	BIT(2)  /* flags: Tx insertion enable */
+#define ENETC_SI_VLAN_ISO_VTE	BIT(1)  /* flags: Rx removal enable */
+
 struct enetc_psi_reply_msg {
 	uint8_t class_id;
 	uint8_t status;
drivers/net/enetc/enetc4_ethdev.c +39 -0
index 53d201d62b..59632cc790 100644
@@ -875,6 +875,44 @@ enetc4_dev_close(struct rte_eth_dev *dev)
 	return ret;
 }
 
+/* Configure SI-based VLAN insertion (Tx) and removal (Rx) for the PF. */
+static int
+enetc4_vlan_pvid_set(struct rte_eth_dev *dev, uint16_t vlan_id, int on)
+{
+	struct enetc_eth_hw *hw =
+		ENETC_DEV_PRIVATE_TO_HW(dev->data->dev_private);
+	struct enetc_hw *enetc_hw = &hw->hw;
+	uint32_t psivlanr, psicfgr0;
+
+	PMD_INIT_FUNC_TRACE();
+
+	psicfgr0 = enetc4_port_rd(enetc_hw, ENETC4_PSICFGR0(0));
+
+	if (on) {
+		/* Build the VLAN register: enable bit + VID (PCP/DEI left 0) */
+		psivlanr = (uint32_t)ENETC4_PSIVLANR_E |
+			   ENETC4_PSIVLANR_VID(vlan_id);
+		enetc4_port_wr(enetc_hw, ENETC4_PSIVLANR(0), psivlanr);
+
+		/* Allow C-VLAN TPID, enable Tx insertion and Rx removal */
+		psicfgr0 |= ENETC4_PSICFGR0_SIVC_CVLAN |
+			    ENETC4_PSICFGR0_SIVIE |
+			    ENETC4_PSICFGR0_VTE;
+		enetc4_port_wr(enetc_hw, ENETC4_PSICFGR0(0), psicfgr0);
+	} else {
+		/* Clear Tx insertion, Rx removal and C-VLAN allow bits */
+		psicfgr0 &= ~(ENETC4_PSICFGR0_SIVC_CVLAN |
+			      ENETC4_PSICFGR0_SIVIE |
+			      ENETC4_PSICFGR0_VTE);
+		enetc4_port_wr(enetc_hw, ENETC4_PSICFGR0(0), psicfgr0);
+
+		/* Clear the VLAN register (disable SI VLAN processing) */
+		enetc4_port_wr(enetc_hw, ENETC4_PSIVLANR(0), 0);
+	}
+
+	return 0;
+}
+
 static int
 enetc4_promiscuous_enable(struct rte_eth_dev *dev)
 {
@@ -1270,6 +1308,7 @@ static const struct eth_dev_ops enetc4_ops = {
 	.get_reg              = enetc4_get_regs,
 	.promiscuous_enable   = enetc4_promiscuous_enable,
 	.promiscuous_disable  = enetc4_promiscuous_disable,
+	.vlan_pvid_set        = enetc4_vlan_pvid_set,
 	.rx_queue_setup       = enetc4_rx_queue_setup,
 	.rx_queue_start       = enetc4_rx_queue_start,
 	.rx_queue_stop        = enetc4_rx_queue_stop,
drivers/net/enetc/enetc4_vf.c +83 -0

101 lines not on this page · raw message

Signature · 1 line
2.25.1
#92 lore raw

PATCH v6 12/13 net/enetc4: update VF link status to bitmask encoding

In reply to Gagandeep Singh

The PF-to-VF link status notification code was previously a two-value enum (UP=0x0, DOWN=0x1). Change this to a bitmask so future bits can carry additional state alongside the link up/down indication:

ENETC_LINK_DOWN BIT(0) -- set when link is down

Link up is now encoded as the DOWN bit being clear, which keeps the wire value for link-down identical (0x1) and ensures backward compatibility with older kernel PFs.

Changes:
- enetc.h: replace enum link_status with a #define bitmask; drop ENETC_LINK_UP (no longer a named constant).
- enetc4_vf.c enetc4_process_psi_msg(): replace switch/case on ENETC_LINK_UP/DOWN with bitmask decode.
- enetc4_vf.c enetc4_vf_link_update(): same bitmask decode.

---
 doc/guides/rel_notes/release_26_11.rst |  1 +
 drivers/net/enetc/enetc.h              |  8 ++++----
 drivers/net/enetc/enetc4_vf.c          | 27 +++++++-------------------
 3 files changed, 12 insertions(+), 24 deletions(-)
doc/guides/rel_notes/release_26_11.rst +1 -0
index 190d77ecee..47090068d0 100644
@@ -73,6 +73,7 @@ New Features
   * Added stats reset for the ENETC4 VF using a software snapshot/delta approach.
   * Added per-queue MSI-X Rx interrupt support for the ENETC4 VF.
   * Added SI-based port VLAN insertion (Tx) and removal (Rx) for ENETC4 PF and VF.
+  * Updated ENETC4 VF link status reporting to use bitmask encoding.
 
 Removed Items
 -------------
drivers/net/enetc/enetc.h +4 -4
index 8189dc3ea8..4ad6af777b 100644
@@ -237,10 +237,10 @@ enum vlan_status {
 	ENETC_VLAN_NO_RESOURCE = 0x3
 };
 
-enum link_status {
-	ENETC_LINK_UP = 0x0,
-	ENETC_LINK_DOWN = 0x1
-};
+/* Link status bitmask in PF-to-VF mailbox notification.
+ * Link up is encoded as the DOWN bit being clear.
+ */
+#define ENETC_LINK_DOWN  (1u << 0)
 
 enum speed {
 	ENETC_SPEED_UNKNOWN = 0x0,
drivers/net/enetc/enetc4_vf.c +7 -20
index eab4f3ed65..af196900cb 100644
@@ -510,8 +510,10 @@ enetc4_process_psi_msg(struct rte_eth_dev *eth_dev, struct enetc_hw *enetc_hw)
 	enetc4_msg_get_psi_msg(enetc_hw, msg);
 
 	if (msg->class_id == ENETC_CLASS_ID_LINK_STATUS) {
-		switch (msg->status) {
-		case ENETC_LINK_UP:
+		if (msg->status & ENETC_LINK_DOWN) {
+			ENETC_PMD_DEBUG("Link is down");
+			link.link_status = RTE_ETH_LINK_DOWN;
+		} else {
 			ENETC_PMD_DEBUG("Link is up");
 			link.link_status = RTE_ETH_LINK_UP;
 			/* Re-query speed from PF so the cached value reflects
@@ -523,14 +525,6 @@ enetc4_process_psi_msg(struct rte_eth_dev *eth_dev, struct enetc_hw *enetc_hw)
 				enetc4_decode_link_speed(msg->status,
 							hw->vf_link_legacy,
 							&link);
-			break;
-		case ENETC_LINK_DOWN:
-			ENETC_PMD_DEBUG("Link is down");
-			link.link_status = RTE_ETH_LINK_DOWN;
-			break;
-		default:
-			ENETC_PMD_ERR("Unknown link status 0x%x", msg->status);
-			break;
 		}
 		ret = rte_eth_linkstatus_set(eth_dev, &link);
 		if (!ret)
@@ -1211,17 +1205,10 @@ enetc4_vf_link_update(struct rte_eth_dev *dev, int wait_to_complete __rte_unused
 	}
 
 	if (reply_msg->class_id == ENETC_CLASS_ID_LINK_STATUS) {
-		switch (reply_msg->status) {
-		case ENETC_LINK_UP:
-			link.link_status = RTE_ETH_LINK_UP;
-			break;
-		case ENETC_LINK_DOWN:
+		if (reply_msg->status & ENETC_LINK_DOWN)
 			link.link_status = RTE_ETH_LINK_DOWN;
-			break;
-		default:
-			ENETC_PMD_ERR("Unknown link status");
-			break;
-		}
+		else
+			link.link_status = RTE_ETH_LINK_UP;
 	} else {
 		ENETC_PMD_ERR("Wrong reply message");
 		return -1;
Signature · 1 line
2.25.1
#93 lore raw

PATCH v6 13/13 net/enetc4: enable Tx PAUSE via VF Rx congestion mode

In reply to Gagandeep Singh

When the PF negotiates TX PAUSE on the port it signals this to the VF via BIT(1) of the PF-to-VF link status mailbox message. The VF PMD must respond by setting RBMR_CM (BIT(4)) on all active RX rings so the MAC emits PAUSE frames on ingress pressure.

Add ENETC_RBMR_CM register definition, ENETC_LINK_TX_PAUSE bitmask, and tx_pause_active state flag. Add enetc4_vf_set_congestion_mode() to update all active RX rings and persist the state for rings started later. Hook it into both the interrupt and poll link-update paths, and apply the saved state in rx_queue_setup() and rx_queue_start().

RX PAUSE (honoring received PAUSE frames) is handled at the MAC level by the PF and requires no VF PMD changes.

---
 doc/guides/nics/features/enetc4.ini    |  1 +
 doc/guides/rel_notes/release_26_11.rst |  1 +
 drivers/net/enetc/base/enetc_hw.h      |  1 +
 drivers/net/enetc/enetc.h              | 11 ++++-
 drivers/net/enetc/enetc4_ethdev.c      | 15 ++++++-
 drivers/net/enetc/enetc4_vf.c          | 60 ++++++++++++++++++++++++--
 6 files changed, 83 insertions(+), 6 deletions(-)
doc/guides/nics/features/enetc4.ini +1 -0
index 01b0dc5b80..1f599dace7 100644
@@ -14,6 +14,7 @@ Promiscuous mode     = Y
 Allmulticast mode    = Y
 Unicast MAC filter   = Y
 VLAN filter          = Y
+Flow control         = Y
 VLAN offload         = Y
 RSS hash             = Y
 Packet type parsing  = Y
doc/guides/rel_notes/release_26_11.rst +1 -0
index 47090068d0..f287390db7 100644
@@ -74,6 +74,7 @@ New Features
   * Added per-queue MSI-X Rx interrupt support for the ENETC4 VF.
   * Added SI-based port VLAN insertion (Tx) and removal (Rx) for ENETC4 PF and VF.
   * Updated ENETC4 VF link status reporting to use bitmask encoding.
+  * Added Tx PAUSE support for the ENETC4 VF via Rx congestion mode.
 
 Removed Items
 -------------
drivers/net/enetc/base/enetc_hw.h +1 -0
index 6e96562850..33d075fe59 100644
@@ -51,6 +51,7 @@ enum enetc_bdr_type {TX, RX};
 							+ (off))
 /* RX BDR reg offsets */
 #define ENETC_RBMR		0x0 /* RX BDR mode register*/
+#define ENETC_RBMR_CM		BIT(4)  /* congestion mode: assert congestion to emit TX PAUSE */
 #define ENETC_RBMR_EN		BIT(31)
 
 #define ENETC_BMR_RESET		0x0 /* BDR reset*/
drivers/net/enetc/enetc.h +10 -1
index 4ad6af777b..7f67b2a0b3 100644
@@ -6,6 +6,7 @@
 #define _ENETC_H_
 
 #include <pthread.h>
+#include <rte_stdatomic.h>
 #include <rte_time.h>
 #include <ethdev_pci.h>
 
@@ -141,6 +142,11 @@ struct enetc_eth_hw {
 	 */
 	uint8_t vf_link_legacy;
 	pthread_mutex_t vsi_lock; /* serializes all VSI-PSI mailbox transactions */
+	/* 1 = TX PAUSE negotiated on port; VF RX rings must have RBMR_CM set.
+	 * Updated from the PF-to-VF link status mailbox message (BIT(1)).
+	 * Written on the interrupt thread, read on the control thread.
+	 */
+	RTE_ATOMIC(uint8_t)tx_pause_active;
 	/* Baseline snapshot for VF stats reset (software delta approach). */
 	struct enetc4_vf_stats_saved vf_stats_saved;
 };
@@ -239,8 +245,11 @@ enum vlan_status {
 
 /* Link status bitmask in PF-to-VF mailbox notification.
  * Link up is encoded as the DOWN bit being clear.
+ * TX_PAUSE is set when the port has negotiated TX PAUSE; VF must enable
+ * congestion mode (ENETC_RBMR_CM) on its RX rings accordingly.
  */
-#define ENETC_LINK_DOWN  (1u << 0)
+#define ENETC_LINK_DOWN      (1u << 0)
+#define ENETC_LINK_TX_PAUSE  (1u << 1)
 
 enum speed {
 	ENETC_SPEED_UNKNOWN = 0x0,
drivers/net/enetc/enetc4_ethdev.c +13 -2
index 59632cc790..df22ad0c7b 100644
@@ -714,8 +714,13 @@ enetc4_rx_queue_setup(struct rte_eth_dev *dev,
 	}
 
 	if (!rx_conf->rx_deferred_start) {
-		/* enable ring */
+		/* Enable ring; apply congestion mode if TX PAUSE is already active. */
 		rx_enable |= ENETC_RBMR_EN;
+		if (rte_atomic_load_explicit(&adapter->hw.tx_pause_active,
+					     rte_memory_order_acquire))
+			rx_enable |= ENETC_RBMR_CM;
+		else
+			rx_enable &= ~(uint32_t)ENETC_RBMR_CM;
 		enetc4_rxbdr_wr(&adapter->hw.hw, rx_ring->index, ENETC_RBMR,
 			       rx_enable);
 		dev->data->rx_queue_state[rx_ring->index] =
@@ -1092,7 +1097,13 @@ enetc4_rx_queue_start(struct rte_eth_dev *dev, uint16_t qidx)
 	if (dev->data->rx_queue_state[qidx] == RTE_ETH_QUEUE_STATE_STOPPED) {
 		rx_data = enetc4_rxbdr_rd(&priv->hw.hw, rx_ring->index,
 					 ENETC_RBMR);
-		rx_data = rx_data | ENETC_RBMR_EN;
+		rx_data |= ENETC_RBMR_EN;
+		/* Restore congestion mode if TX PAUSE is active. */
+		if (rte_atomic_load_explicit(&priv->hw.tx_pause_active,
+					     rte_memory_order_acquire))
+			rx_data |= ENETC_RBMR_CM;
+		else
+			rx_data &= ~(uint32_t)ENETC_RBMR_CM;
 		enetc4_rxbdr_wr(&priv->hw.hw, rx_ring->index, ENETC_RBMR,
 			       rx_data);
 		dev->data->rx_queue_state[qidx] = RTE_ETH_QUEUE_STATE_STARTED;
drivers/net/enetc/enetc4_vf.c +57 -3

88 lines not on this page · raw message

Signature · 1 line
2.25.1