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 2 of 3

lore
Share & tools
lore
#94 lore raw

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

In reply to Gagandeep Singh

V7-changes:
- added missing 14th patch.

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 (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     | 128 +++-
 drivers/net/enetc/base/enetc_hw.h      |   6 +
 drivers/net/enetc/enetc.h              | 136 ++++-
 drivers/net/enetc/enetc4_ethdev.c      | 428 +++++++++++--
 drivers/net/enetc/enetc4_vf.c          | 807 ++++++++++++++++++++++---
 drivers/net/enetc/enetc_rxtx.c         | 530 +++++++++++++++-
 9 files changed, 2011 insertions(+), 153 deletions(-)
Signature · 1 line
2.25.1
#95 lore raw

PATCH v7 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     |  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
#96 lore raw

PATCH v7 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     |  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
#97 lore raw

PATCH v7 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     |  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
#98 lore raw

PATCH v7 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          | 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
#99 lore raw

PATCH v7 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          | 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
#100 lore raw

PATCH v7 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              | 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
#101 lore raw

PATCH v7 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 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
#102 lore raw

PATCH v7 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/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
#103 lore raw

PATCH v7 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 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
#104 lore raw

PATCH v7 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          | 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
#105 lore raw

PATCH v7 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 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
#106 lore raw

PATCH v7 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 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
#107 lore raw

PATCH v7 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              | 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
#108 lore raw

PATCH v7 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      | 88 +++++++++++++++++++++-----
 5 files changed, 92 insertions(+), 15 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 f287390db7..2be5357af3 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 7f67b2a0b3..f6a69b3cf7 100644
@@ -135,6 +135,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 +73 -15

155 lines not on this page · raw message

Signature · 1 line
2.25.1
#109 lore raw

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

In reply to Gagandeep Singh
Quoted 79 lines · On Tue, 11 Aug 2026 13:17:31 +0530 Gagandeep Singh <[email protected]> wrote:

V7-changes:
- added missing 14th patch.

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 (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     | 128 +++-
 drivers/net/enetc/base/enetc_hw.h      |   6 +
 drivers/net/enetc/enetc.h              | 136 ++++-
 drivers/net/enetc/enetc4_ethdev.c      | 428 +++++++++++--
 drivers/net/enetc/enetc4_vf.c          | 807 ++++++++++++++++++++++---
 drivers/net/enetc/enetc_rxtx.c         | 530 +++++++++++++++-
 9 files changed, 2011 insertions(+), 153 deletions(-)

Still lots of issues found by AI review

ENETC4 v7 series review - 14 patches

No Reviewed-by; one error and two warnings remain.

All 14 commits build clean individually on top of c1a46b9 with gcc 13.3 and -Dwerror=true. check-git-log.sh: 14/14 valid. No trailing whitespace. Consecutive-blank-line counts are back to the upstream values in all four touched files.

Confirmed fixed from v5: the free()/rte_free() mismatch is gone -- enetc4_dev_uninit() no longer touches txq_prior at all and both arrays are released in enetc4_dev_close(); rte_intr_vec_list_free() and rte_intr_efd_disable() added at the intr_enable_fail: label so both the teardown and the error path are covered; enetc4_alloc_rxbdr() now validates ring_desc against MAX_BD_COUNT the same way the Tx side does; tx_pause_active is RTE_ATOMIC with acquire/release accessors; the register-dump version field is cast before the shift in both enetc4_get_regs() and enetc4_vf_get_regs(); fw_version_get() computes the fw_size == 0 length from the real values; release note reads "Tx PAUSE ... Rx congestion mode"; parse_txq_prior() and parse_txq_wrr() both return -ENOMEM consistently.

Patch 08

Error: pthread mutex in shared memory without PTHREAD_PROCESS_SHARED.

The new vsi_lock lives in struct enetc_eth_hw, which sits in eth_dev->data->dev_private. ethdev allocates that with rte_zmalloc_socket(), so it is hugepage memory visible to secondary processes:

drivers/net/enetc/enetc.h:145
pthread_mutex_t vsi_lock; /* serializes all VSI-PSI mailbox ... */

drivers/net/enetc/enetc4_vf.c:1985
pthread_mutex_init(&hw->vsi_lock, NULL);

Two problems follow. A mutex initialized with NULL attributes is undefined behaviour if it is ever locked from a second process. And enetc4_vf_dev_init() has no primary-process guard -- enetc4_dev_close() is the only place in the driver that checks rte_eal_process_type() -- so a secondary attaching to the same VF re-runs pthread_mutex_init() on a mutex the primary may be holding.

pthread_mutexattr_t attr;

pthread_mutexattr_init(&attr); pthread_mutexattr_setpshared(&attr, PTHREAD_PROCESS_SHARED); pthread_mutex_init(&hw->vsi_lock, &attr); pthread_mutexattr_destroy(&attr);

rte_spinlock_t would sidestep the initialization problem but is the wrong primitive here, since the poll loop under the lock waits up to vsi_timeout iterations.

Warning: the reply status is still read outside the lock.

enetc4_msg_vsi_send() now holds vsi_lock across the write, the MB poll and the completion-status check, which closes most of the window. But every caller re-reads ENETC4_VSIMSGSR after the function has returned and dropped the lock:

err = enetc4_msg_vsi_send(hw, msg);
if (err) {
ENETC_PMD_ERR("VSI message send error");
goto end;
}

enetc4_msg_vsi_reply_msg(enetc_hw, reply_msg); /* lock released */

Six call sites go through enetc4_msg_vsi_reply_msg() (lines 727, 973, 1019, 1404, 1504, 1637) and enetc4_vf_get_ip_minor_revision() reads the register directly at line 1081. A second thread -- in particular the interrupt thread doing the patch 08 speed re-query -- can take the lock and start a new transaction between the unlock and that read, so the caller parses someone else's reply.

enetc4_msg_vsi_send() already has the value in its local vsimsgsr. Returning it through an out-parameter, and having callers parse from that instead of re-reading the register, removes the window entirely.

Patch 13

Warning: RBMR read-modify-write still races between threads.

The atomic on tx_pause_active covers the flag but not the register. enetc4_vf_set_congestion_mode() runs on the interrupt thread:

rbmr = enetc4_rxbdr_rd(enetc_hw, i, ENETC_RBMR);
if (enable)
rbmr |= ENETC_RBMR_CM;
else
rbmr &= ~(uint32_t)ENETC_RBMR_CM;
enetc4_rxbdr_wr(enetc_hw, i, ENETC_RBMR, rbmr);

enetc4_rx_queue_start() and enetc4_rx_queue_stop() perform the same unguarded read-modify-write on ENETC_RBMR_EN from the control thread. A link-status interrupt landing mid-sequence still loses one of the two updates, leaving a ring enabled without congestion mode or stopped with it set. Serializing the RBMR accesses -- vsi_lock would do, or a dedicated per-device lock -- is what is missing.

Info: the release store on tx_pause_active is placed before the RBMR writes it is described as publishing, so the ordering does not do what the comment implies. Nothing else is published through this flag, so rte_memory_order_relaxed on both sides would be correct and clearer.

Patch 06

Info: enetc4_txbdr_regs[] and enetc4_rxbdr_regs[] are still static const arrays defined in enetc.h, so every translation unit including the header gets a private copy. Moving them into one .c file with an extern declaration avoids the duplication.

#110 lore raw

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

In reply to Gagandeep Singh

V8-changes:
- Fixed Warning RBMR RMW races between threads by adding lock
- Fixed static const arrays in enetc.h
- Proper pthread_mutexattr_t intialization added as suggested by AI
- VSIMSGSR stale re-read race is eliminated

V7-changes:
- added missing 14th patch.

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 (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     | 128 +++-
 drivers/net/enetc/base/enetc_hw.h      |   6 +
 drivers/net/enetc/enetc.h              | 132 +++-
 drivers/net/enetc/enetc4_ethdev.c      | 454 +++++++++++--
 drivers/net/enetc/enetc4_vf.c          | 860 +++++++++++++++++++++----
 drivers/net/enetc/enetc_rxtx.c         | 530 ++++++++++++++-
 9 files changed, 2062 insertions(+), 177 deletions(-)
Signature · 1 line
2.25.1
#111 lore raw

PATCH v8 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     |  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
#112 lore raw

PATCH v8 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     |  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
#113 lore raw

PATCH v8 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     |  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
#114 lore raw

PATCH v8 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          | 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
#115 lore raw

PATCH v8 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          | 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
#116 lore raw

PATCH v8 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              |  4 ++
 drivers/net/enetc/enetc4_ethdev.c      | 81 ++++++++++++++++++++++++++
 drivers/net/enetc/enetc4_vf.c          | 62 ++++++++++++++++++++
 6 files changed, 150 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 +4 -0
index c4a55626f8..bdcee9deb6 100644
@@ -395,6 +395,10 @@ enetc_bd_unused(struct enetc_bdr *bdr)
 	return bdr->bd_count + bdr->next_to_clean - bdr->next_to_use - 1;
 }
 
+/* Per-ring BDR registers dumped by .get_reg (shared by PF and VF) */
+extern const uint32_t enetc4_txbdr_regs[6];
+extern const uint32_t enetc4_rxbdr_regs[8];
+
 /* 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 +81 -0

99 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
#117 lore raw

PATCH v8 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 bdcee9deb6..fb286537a6 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 101a099003..9a8dc88ece 100644
@@ -1138,7 +1138,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)
 {
@@ -1152,7 +1152,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
#118 lore raw

PATCH v8 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/enetc.h              |   2 +
 drivers/net/enetc/enetc4_ethdev.c      |   1 +
 drivers/net/enetc/enetc4_vf.c          | 318 +++++++++++++------------
 4 files changed, 173 insertions(+), 149 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 fb286537a6..85826c5ab2 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 9a8dc88ece..3b2ef69bb8 100644
@@ -855,6 +855,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 +169 -149

515 lines not on this page · raw message

Signature · 1 line
2.25.1
#119 lore raw

PATCH v8 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 85826c5ab2..895d11a30d 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
#120 lore raw

PATCH v8 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          | 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 895d11a30d..07c2038b68 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 3b2ef69bb8..b0667ac28e 100644
@@ -852,7 +852,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);
@@ -975,12 +976,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
#121 lore raw

PATCH v8 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 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 07c2038b68..8e679e6aa2 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 b0667ac28e..8ac5854802 100644
@@ -886,6 +886,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)
 {
@@ -1281,6 +1319,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
#122 lore raw

PATCH v8 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 8e679e6aa2..9bf7cd43c6 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 66090e4f98..c75ac95ec1 100644
@@ -507,8 +507,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
@@ -520,14 +522,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)
@@ -1209,17 +1203,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
#123 lore raw

PATCH v8 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              | 17 ++++++-
 drivers/net/enetc/enetc4_ethdev.c      | 30 ++++++++++++-
 drivers/net/enetc/enetc4_vf.c          | 62 ++++++++++++++++++++++++--
 6 files changed, 105 insertions(+), 7 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 +15 -2
index 9bf7cd43c6..63ad30251a 100644
@@ -6,6 +6,7 @@
 #define _ENETC_H_
 
 #include <pthread.h>
+#include <rte_stdatomic.h>
 #include <rte_time.h>
 #include <ethdev_pci.h>
 
@@ -140,7 +141,16 @@ 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 */
+	/* serializes all VSI-PSI mailbox transactions and RBMR read-modify-write
+	 * sequences so that set_congestion_mode() and rx_queue_start/stop()
+	 * cannot race on the same RBMR register.
+	 */
+	pthread_mutex_t vsi_lock;
+	/* 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)).
+	 * Always accessed under vsi_lock, so relaxed ordering suffices.
+	 */
+	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 +249,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 +28 -2
index 8ac5854802..10ec2e110d 100644
@@ -725,10 +725,22 @@ 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;
+		/* vsi_lock serializes RBMR RMW with enetc4_vf_set_congestion_mode().
+		 * Only VF has that interrupt-driven path; PF skips the lock.
+		 */
+		if (adapter->hw.device_id == ENETC4_DEV_ID_VF)
+			pthread_mutex_lock(&adapter->hw.vsi_lock);
+		if (rte_atomic_load_explicit(&adapter->hw.tx_pause_active,
+					     rte_memory_order_relaxed))
+			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);
+		if (adapter->hw.device_id == ENETC4_DEV_ID_VF)
+			pthread_mutex_unlock(&adapter->hw.vsi_lock);
 		dev->data->rx_queue_state[rx_ring->index] =
 			       RTE_ETH_QUEUE_STATE_STARTED;
 	} else {
@@ -1101,11 +1113,21 @@ enetc4_rx_queue_start(struct rte_eth_dev *dev, uint16_t qidx)
 	PMD_INIT_FUNC_TRACE();
 	rx_ring = dev->data->rx_queues[qidx];
 	if (dev->data->rx_queue_state[qidx] == RTE_ETH_QUEUE_STATE_STOPPED) {
+		if (priv->hw.device_id == ENETC4_DEV_ID_VF)
+			pthread_mutex_lock(&priv->hw.vsi_lock);
 		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_relaxed))
+			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);
+		if (priv->hw.device_id == ENETC4_DEV_ID_VF)
+			pthread_mutex_unlock(&priv->hw.vsi_lock);
 		dev->data->rx_queue_state[qidx] = RTE_ETH_QUEUE_STATE_STARTED;
 	}
 
@@ -1123,11 +1145,15 @@ enetc4_rx_queue_stop(struct rte_eth_dev *dev, uint16_t qidx)
 	PMD_INIT_FUNC_TRACE();
 	rx_ring = dev->data->rx_queues[qidx];
 	if (dev->data->rx_queue_state[qidx] == RTE_ETH_QUEUE_STATE_STARTED) {
+		if (priv->hw.device_id == ENETC4_DEV_ID_VF)
+			pthread_mutex_lock(&priv->hw.vsi_lock);
 		rx_data = enetc4_rxbdr_rd(&priv->hw.hw, rx_ring->index,
 					 ENETC_RBMR);
 		rx_data = rx_data & (~ENETC_RBMR_EN);
 		enetc4_rxbdr_wr(&priv->hw.hw, rx_ring->index, ENETC_RBMR,
 			       rx_data);
+		if (priv->hw.device_id == ENETC4_DEV_ID_VF)
+			pthread_mutex_unlock(&priv->hw.vsi_lock);
 		dev->data->rx_queue_state[qidx] = RTE_ETH_QUEUE_STATE_STOPPED;
 	}
 
drivers/net/enetc/enetc4_vf.c +59 -3

90 lines not on this page · raw message

Signature · 1 line
2.25.1
#124 lore raw

PATCH v8 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      | 88 +++++++++++++++++++++-----
 5 files changed, 92 insertions(+), 15 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 f287390db7..2be5357af3 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 63ad30251a..de0aa4d532 100644
@@ -135,6 +135,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 +73 -15

155 lines not on this page · raw message

Signature · 1 line
2.25.1
#125 lore raw

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

In reply to Gagandeep Singh
Quoted 85 lines · On Wed, 12 Aug 2026 17:03:03 +0530 Gagandeep Singh <[email protected]> wrote:

V8-changes:
- Fixed Warning RBMR RMW races between threads by adding lock
- Fixed static const arrays in enetc.h
- Proper pthread_mutexattr_t intialization added as suggested by AI
- VSIMSGSR stale re-read race is eliminated

V7-changes:
- added missing 14th patch.

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 (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     | 128 +++-
 drivers/net/enetc/base/enetc_hw.h      |   6 +
 drivers/net/enetc/enetc.h              | 132 +++-
 drivers/net/enetc/enetc4_ethdev.c      | 454 +++++++++++--
 drivers/net/enetc/enetc4_vf.c          | 860 +++++++++++++++++++++----
 drivers/net/enetc/enetc_rxtx.c         | 530 ++++++++++++++-
 9 files changed, 2062 insertions(+), 177 deletions(-)

AI review still discovered some things.
ENETC4 v8 series review - 14 patches

No Reviewed-by; two errors remain.

Fixed from v7: vsi_lock now uses PTHREAD_PROCESS_SHARED; enetc4_msg_vsi_send() returns the latched VSIMSGSR via out-parameter and all call sites parse from it instead of re-reading after the unlock; RBMR read-modify-write serialized under vsi_lock in set_congestion_mode(), rx_queue_setup(), rx_queue_start() and rx_queue_stop() (VF only, PF correctly skips); tx_pause_active dropped to relaxed with the comment updated; the BDR register arrays moved out of the header into enetc4_ethdev.c with extern declarations.

I checked for lock-ordering problems from the new RBMR locking. set_congestion_mode() releases vsi_lock before the subsequent get_link_speed() reacquires it, so no recursive acquisition.

Errors

Patch 11 - VF vlan_pvid_set fails on every successful command. The reply check compares reply_msg->class_id against ENETC_MSG_CLASS_ID_CMD_SUCCESS (0x1), but class_id carries the command class from VSIMSGSR[15:8], which for this command is ENETC_CLASS_ID_SI_VLAN_ISO (0x24). Never equal, so the function returns -EINVAL even when the PSI accepted the command. enetc4_msg_vsi_send() already validated the class; every other mailbox op matches the class first and then switches on status.

Patch 09 - VF stats_reset baseline underflows on counter wrap. SIROCT0/SIRFRM0/SITOCT0/SITFRM0 are 64-bit counters on 8-byte stride, but enetc4_rd() is rte_read32(), so only the low word is read. The new delta stores that in a uint64_t baseline and subtracts, so once the low word wraps the result is ~1.8e19 instead of a small wrapped value. At 10G a 32-bit octet counter wraps in about three seconds. Either read the full 64-bit counter, or mask the delta to 32 bits. SITDFCR is a genuine 32-bit register and only needs the mask.

Warnings

Patch 13 - "Flow control = Y" added to enetc4.ini with no implementing ops. features.rst requires flow_ctrl_get/flow_ctrl_set; none of the three ops tables provide them, so rte_eth_dev_flow_ctrl_set() returns -ENOTSUP. The congestion mode this patch adds is driven by PF link state and is not reachable through the flow-control API. The other new entries (Rx interrupt, LRO, TSO, FW version, Registers dump, CRC offload) all check out.

Patch 08 - no primary-process guard in enetc4_vf_dev_init(). rte_eth_dev_pci_generic_probe() calls dev_init in secondaries too, and the secondary attaches to the primary's dev_private. A secondary re-runs pthread_mutex_init() on a mutex the primary may hold, which is undefined behaviour; PROCESS_SHARED makes cross-process locking valid but not double initialization. The same path re-runs dev_hw_init() and the devarg parsing, overwriting the primary's txq_prior/txq_wrr pointers. An early return for RTE_PROC_SECONDARY in both the VF and PF dev_init covers it.

Info

Patch 12 - the pre-existing reply_msg leak on the "Wrong reply message" path sits in the if/else this patch rewrites; cheap to fold in.

Patch 10 - "ret = 0;" in the efd_enable failure branch is a dead store, overwritten by the following rte_intr_enable(). rte_intr_callback_unregister() can return -EAGAIN; the return value is discarded on teardown.

Series-wide - six functions declare int vsimsgsr_* mid-body after a block of top-of-function declarations, and enetc4_vf_dev_init() declares pthread_mutexattr_t attr after several statements. C99 mixing is allowed, but each of these functions is otherwise declarations-first.

#126 lore raw

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

In reply to Gagandeep Singh

V9-Changes:
- Mid-body variable declaration moved to top of the function.
- ret=0 dead code is removed.
- Added check on return value of rte_intr_callback_unregister()
- The pre-existing reply_msg leak fixed.
- Added primary-process guard in enetc4_vf_dev_init
- Removed Flow control from enetc4.ini
- Fixed VF stats_reset baseline underflows on counter wrap
- Fixed VF vlan_pvid_set fails on every successful command

V8-changes:
- Fixed Warning RBMR RMW races between threads by adding lock
- Fixed static const arrays in enetc.h
- Proper pthread_mutexattr_t initialization added as suggested by AI
- VSIMSGSR stale re-read race is eliminated

V7-changes:
- added missing 14th patch.

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 (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    |   7 +
 doc/guides/rel_notes/release_26_11.rst |  21 +
 drivers/net/enetc/base/enetc4_hw.h     | 137 +++-
 drivers/net/enetc/base/enetc_hw.h      |   6 +
 drivers/net/enetc/enetc.h              | 132 +++-
 drivers/net/enetc/enetc4_ethdev.c      | 459 +++++++++++--
 drivers/net/enetc/enetc4_vf.c          | 870 +++++++++++++++++++++----
 drivers/net/enetc/enetc_rxtx.c         | 530 ++++++++++++++-
 9 files changed, 2084 insertions(+), 178 deletions(-)
Signature · 1 line
2.25.1
#127 lore raw

PATCH 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     |  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
#128 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.

---
 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
#129 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     |  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
#130 lore raw

PATCH 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          | 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
#131 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          | 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
#132 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              |  4 ++
 drivers/net/enetc/enetc4_ethdev.c      | 81 ++++++++++++++++++++++++++
 drivers/net/enetc/enetc4_vf.c          | 62 ++++++++++++++++++++
 6 files changed, 150 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 +4 -0
index c4a55626f8..bdcee9deb6 100644
@@ -395,6 +395,10 @@ enetc_bd_unused(struct enetc_bdr *bdr)
 	return bdr->bd_count + bdr->next_to_clean - bdr->next_to_use - 1;
 }
 
+/* Per-ring BDR registers dumped by .get_reg (shared by PF and VF) */
+extern const uint32_t enetc4_txbdr_regs[6];
+extern const uint32_t enetc4_rxbdr_regs[8];
+
 /* 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 +81 -0

99 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
#133 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 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 bdcee9deb6..fb286537a6 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 101a099003..9a8dc88ece 100644
@@ -1138,7 +1138,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)
 {
@@ -1152,7 +1152,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
#134 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.

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      |   6 +
 drivers/net/enetc/enetc4_vf.c          | 323 +++++++++++++------------
 4 files changed, 183 insertions(+), 149 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 fb286537a6..85826c5ab2 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 +6 -0
index 9a8dc88ece..f3e62fd5e7 100644
@@ -855,6 +855,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);
 	}
@@ -1339,6 +1340,11 @@ enetc4_dev_init(struct rte_eth_dev *eth_dev)
 	struct enetc_hw *enetc_hw = &hw->hw;
 
 	PMD_INIT_FUNC_TRACE();
+
+	if (rte_eal_process_type() != RTE_PROC_PRIMARY) {
+		eth_dev->dev_ops = &enetc4_ops;
+		return 0;
+	}
 	eth_dev->dev_ops = &enetc4_ops;
 	enetc4_dev_hw_init(eth_dev);
 
drivers/net/enetc/enetc4_vf.c +174 -149

550 lines not on this page · raw message

Signature · 1 line
2.25.1
#135 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/base/enetc4_hw.h     |  9 ++++
 drivers/net/enetc/enetc.h              | 17 +++++++
 drivers/net/enetc/enetc4_vf.c          | 61 +++++++++++++++++++++++---
 4 files changed, 83 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/base/enetc4_hw.h +9 -0
index d42c04df4b..67d20a0854 100644
@@ -8,6 +8,7 @@
 #ifndef _ENETC4_HW_H_
 #define _ENETC4_HW_H_
 #include <rte_io.h>
+#include "enetc_hw.h"
 
 #define BIT(x)		((uint64_t)1 << ((x)))
 
@@ -279,6 +280,14 @@ struct enetc_rx_bd_ext {
 #define enetc4_wr_reg(reg, val)  rte_write32((val), (void *)(reg))
 
 #define enetc4_rd(hw, off)	 enetc4_rd_reg((size_t)(hw)->reg + (off))
+static inline uint64_t
+enetc4_rd64(struct enetc_hw *hw, uint32_t off)
+{
+	size_t base = (size_t)hw->reg + off;
+
+	return (uint64_t)enetc4_rd_reg(base + 4) << 32 |
+		enetc4_rd_reg(base);
+}
 #define enetc4_wr(hw, off, val)  enetc4_wr_reg((size_t)(hw)->reg + (off), val)
 /* port register accessors - PF only */
 #define enetc4_port_rd(hw, off)  enetc4_rd_reg((size_t)(hw)->port + (off))
drivers/net/enetc/enetc.h +17 -0
index 85826c5ab2..895d11a30d 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
#136 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.

---
 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          | 87 +++++++++++++++++++++++++-
 7 files changed, 160 insertions(+), 6 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 67d20a0854..1292ce4a52 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 895d11a30d..07c2038b68 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 f3e62fd5e7..4d2dff5997 100644
@@ -852,7 +852,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);
@@ -975,12 +976,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 +85 -2

128 lines not on this page · raw message

Signature · 1 line
2.25.1
#137 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

---
 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 1292ce4a52..3b18fb71dd 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 07c2038b68..8e679e6aa2 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 4d2dff5997..2539f2446e 100644
@@ -886,6 +886,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)
 {
@@ -1281,6 +1319,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
#138 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          | 29 ++++++++------------------
 3 files changed, 14 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 8e679e6aa2..9bf7cd43c6 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 +9 -20
index 1fcacc84a0..56bc6a694f 100644
@@ -507,8 +507,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
@@ -520,14 +522,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)
@@ -1209,19 +1203,13 @@ 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");
+		rte_free(reply_msg);
 		return -1;
 	}
 
@@ -1237,6 +1225,7 @@ enetc4_vf_link_update(struct rte_eth_dev *dev, int wait_to_complete __rte_unused
 					 hw->vf_link_legacy, &link);
 	} else {
 		ENETC_PMD_ERR("Wrong reply message");
+		rte_free(reply_msg);
 		return -1;
 	}
 
Signature · 1 line
2.25.1
#139 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/rel_notes/release_26_11.rst |  1 +
 drivers/net/enetc/base/enetc_hw.h      |  1 +
 drivers/net/enetc/enetc.h              | 17 ++++++-
 drivers/net/enetc/enetc4_ethdev.c      | 30 ++++++++++++-
 drivers/net/enetc/enetc4_vf.c          | 62 ++++++++++++++++++++++++--
 5 files changed, 104 insertions(+), 7 deletions(-)
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 +15 -2
index 9bf7cd43c6..63ad30251a 100644
@@ -6,6 +6,7 @@
 #define _ENETC_H_
 
 #include <pthread.h>
+#include <rte_stdatomic.h>
 #include <rte_time.h>
 #include <ethdev_pci.h>
 
@@ -140,7 +141,16 @@ 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 */
+	/* serializes all VSI-PSI mailbox transactions and RBMR read-modify-write
+	 * sequences so that set_congestion_mode() and rx_queue_start/stop()
+	 * cannot race on the same RBMR register.
+	 */
+	pthread_mutex_t vsi_lock;
+	/* 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)).
+	 * Always accessed under vsi_lock, so relaxed ordering suffices.
+	 */
+	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 +249,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 +28 -2
index 2539f2446e..db1ec6a6ea 100644
@@ -725,10 +725,22 @@ 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;
+		/* vsi_lock serializes RBMR RMW with enetc4_vf_set_congestion_mode().
+		 * Only VF has that interrupt-driven path; PF skips the lock.
+		 */
+		if (adapter->hw.device_id == ENETC4_DEV_ID_VF)
+			pthread_mutex_lock(&adapter->hw.vsi_lock);
+		if (rte_atomic_load_explicit(&adapter->hw.tx_pause_active,
+					     rte_memory_order_relaxed))
+			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);
+		if (adapter->hw.device_id == ENETC4_DEV_ID_VF)
+			pthread_mutex_unlock(&adapter->hw.vsi_lock);
 		dev->data->rx_queue_state[rx_ring->index] =
 			       RTE_ETH_QUEUE_STATE_STARTED;
 	} else {
@@ -1101,11 +1113,21 @@ enetc4_rx_queue_start(struct rte_eth_dev *dev, uint16_t qidx)
 	PMD_INIT_FUNC_TRACE();
 	rx_ring = dev->data->rx_queues[qidx];
 	if (dev->data->rx_queue_state[qidx] == RTE_ETH_QUEUE_STATE_STOPPED) {
+		if (priv->hw.device_id == ENETC4_DEV_ID_VF)
+			pthread_mutex_lock(&priv->hw.vsi_lock);
 		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_relaxed))
+			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);
+		if (priv->hw.device_id == ENETC4_DEV_ID_VF)
+			pthread_mutex_unlock(&priv->hw.vsi_lock);
 		dev->data->rx_queue_state[qidx] = RTE_ETH_QUEUE_STATE_STARTED;
 	}
 
@@ -1123,11 +1145,15 @@ enetc4_rx_queue_stop(struct rte_eth_dev *dev, uint16_t qidx)
 	PMD_INIT_FUNC_TRACE();
 	rx_ring = dev->data->rx_queues[qidx];
 	if (dev->data->rx_queue_state[qidx] == RTE_ETH_QUEUE_STATE_STARTED) {
+		if (priv->hw.device_id == ENETC4_DEV_ID_VF)
+			pthread_mutex_lock(&priv->hw.vsi_lock);
 		rx_data = enetc4_rxbdr_rd(&priv->hw.hw, rx_ring->index,
 					 ENETC_RBMR);
 		rx_data = rx_data & (~ENETC_RBMR_EN);
 		enetc4_rxbdr_wr(&priv->hw.hw, rx_ring->index, ENETC_RBMR,
 			       rx_data);
+		if (priv->hw.device_id == ENETC4_DEV_ID_VF)
+			pthread_mutex_unlock(&priv->hw.vsi_lock);
 		dev->data->rx_queue_state[qidx] = RTE_ETH_QUEUE_STATE_STOPPED;
 	}
 
drivers/net/enetc/enetc4_vf.c +59 -3

90 lines not on this page · raw message

Signature · 1 line
2.25.1
#140 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/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      | 88 +++++++++++++++++++++-----
 5 files changed, 92 insertions(+), 15 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 f287390db7..2be5357af3 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 63ad30251a..de0aa4d532 100644
@@ -135,6 +135,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 +73 -15

155 lines not on this page · raw message

Signature · 1 line
2.25.1
#141 lore raw

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

In reply to Gagandeep Singh
Quoted 95 lines · On Thu, 13 Aug 2026 17:43:44 +0530 Gagandeep Singh <[email protected]> wrote:

V9-Changes:
- Mid-body variable declaration moved to top of the function.
- ret=0 dead code is removed.
- Added check on return value of rte_intr_callback_unregister()
- The pre-existing reply_msg leak fixed.
- Added primary-process guard in enetc4_vf_dev_init
- Removed Flow control from enetc4.ini
- Fixed VF stats_reset baseline underflows on counter wrap
- Fixed VF vlan_pvid_set fails on every successful command

V8-changes:
- Fixed Warning RBMR RMW races between threads by adding lock
- Fixed static const arrays in enetc.h
- Proper pthread_mutexattr_t initialization added as suggested by AI
- VSIMSGSR stale re-read race is eliminated

V7-changes:
- added missing 14th patch.

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 (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    |   7 +
 doc/guides/rel_notes/release_26_11.rst |  21 +
 drivers/net/enetc/base/enetc4_hw.h     | 137 +++-
 drivers/net/enetc/base/enetc_hw.h      |   6 +
 drivers/net/enetc/enetc.h              | 132 +++-
 drivers/net/enetc/enetc4_ethdev.c      | 459 +++++++++++--
 drivers/net/enetc/enetc4_vf.c          | 870 +++++++++++++++++++++----
 drivers/net/enetc/enetc_rxtx.c         | 530 ++++++++++++++-
 9 files changed, 2084 insertions(+), 178 deletions(-)

Still some AI review feedback items that need addressing. I say addressing because AI can and does spot things that are not a real problem.

ENETC4 v9 series review - 14 patches

No Reviewed-by. The two v8 errors are fixed, but this revision introduces a regression in patch 14 that silently disables the existing enetc4_txq_prior devarg, and the patch 11 reply check looks inverted rather than fixed. Applied cleanly onto c1a46b9; source review only, no builds.

Fixed from v8

enetc4_rd64() now reads the 64-bit SI counters as a high/low pair and oerrors is masked to 32 bits before the subtraction, so the stats_reset delta no longer underflows on counter wrap. "Flow control = Y" is gone from enetc4.ini. The ring-doubling paths validate the doubled count against MAX_BD_COUNT. enetc4_vf_link_update() frees reply_msg on both "Wrong reply message" paths. Interrupt teardown frees the vector list and disables the efds. txq_prior moved to rte_zmalloc/rte_free consistently, with the old allocation released before re-parsing.

Errors

Patch 14 - enetc4_txq_prior and enetc4_txq_wrr have no effect at queue setup.

In enetc4_tx_queue_setup() the hunk changed the target variable but not the register write:

  uint32_t tx_en = ENETC_TBMR_EN;

  if (priv->hw.txq_prior)
          tx_data |= priv->hw.txq_prior[tx_ring->index];
  if (priv->hw.txq_wrr)
          tx_data |= priv->hw.txq_wrr[tx_ring->index];
  /* enable ring */
  enetc4_txbdr_wr(&priv->hw.hw, tx_ring->index, ENETC_TBMR, tx_en);

tx_data is never read again, so both the priority and the WRR weight are dropped and only ENETC_TBMR_EN reaches TBaMR. This is a regression: v8 had "tx_en |= priv->hw.txq_prior[...]", which worked. The scheduler bits now only get programmed through enetc4_tx_queue_start(), which non-deferred queues never go through. Either OR into tx_en, or drop tx_en and write tx_data | ENETC_TBMR_EN.

Patch 11 - the vlan_pvid_set reply check is inverted, not fixed.

  if (reply_msg->class_id != ENETC_CLASS_ID_SI_VLAN_ISO) {
          ENETC_PMD_ERR("SI VLAN isolation command failed: ...");
          err = -EINVAL;
  }

For the configuration command classes the driver already handles, class_id equal to the command class is the failure indication and ENETC_MSG_CLASS_ID_CMD_SUCCESS (0x1) is success. Both MAC and VLAN filter follow that shape:

  if (class_id == ENETC_CLASS_ID_MAC_FILTER) {
          switch (status) { ... default: err = -EINVAL; }
  }

that is, every status under 0x20 is an error. If 0x20 were also returned on success, set_mac_addr could never succeed.

SI VLAN isolation (0x24) is a set-type command in the same 0x2x family, so success should arrive as 0x1 and 0x24 should carry a class-specific error status. As written the function still returns -EINVAL on every successful command, the same symptom as v8 with a different comparand. The shape to match is:

  if (reply_msg->class_id == ENETC_CLASS_ID_SI_VLAN_ISO) {
          /* class-specific failure: inspect reply_msg->status */
          err = -EINVAL;
  }

The classes where class_id == command class *is* the success reply are the query classes - LINK_STATUS (0x80), LINK_SPEED (0x81), GET_IP_VER (0xF0) - which return data in the status byte. If the PSI really does return 0x24 on success for this command, please say so in the commit message, since it contradicts the convention every other setter in the file uses.

Warnings

Patch 11 - "VLAN offload = Y" added to enetc4.ini for a pvid change.

doc/guides/nics/features.rst lists vlan_pvid_set under "Other dev ops not represented by a Feature"; pvid has no matrix entry. The VLAN offload entry requires vlan_offload_set plus RTE_ETH_RX_OFFLOAD_VLAN_STRIP / RTE_ETH_TX_OFFLOAD_VLAN_INSERT in rx_offload_capa / tx_offload_capa. The PF ops table has no vlan_offload_set at all and neither offload flag is in dev_rx_offloads_sup / dev_tx_offloads_sup. Drop the line.

Patches 02 and 03 - the burst function is selected on enable but never restored.

enetc4_rx_queue_setup() sets dev->rx_pkt_burst = &enetc_recv_pkts_rsc when LRO is requested and enetc4_tx_queue_setup() sets dev->tx_pkt_burst = &enetc_xmit_pkts_lso when TSO is requested; neither has an else branch. The defaults are assigned once at probe in enetc4_dev_hw_init(). After a dev_stop plus rte_eth_dev_configure() without those offloads the pointers keep their previous values, and enetc_clean_rx_ring_rsc() then walks a 16B-descriptor ring as if it were 32B (i += 2, bd_count not doubled, extension slot read from the neighbouring descriptor). The RSC assignment also happens before enetc4_alloc_rxbdr(), so it survives a failed setup.

Info

Patch 09 - enetc4_rd64() reads high and low with no re-read of the low word, so a carry between the two accesses yields a value 2^32 too large. The window is tiny but the error is not; the usual form is read-high / read-low / read-high-again and retry if the high word moved. Related: the operands of | have unspecified evaluation order, so which half is fetched first is up to the compiler.

Patch 10 - enetc4_vf_rx_queue_intr_enable() writes RBICR1 = 0 and RBICR0 = ICEN | ICPT(1), overwriting the coalescing timer that patch 03 programs for RSC (ENETC4_RSC_DEF_ICTT). An application enabling both LRO and intr_conf.rxq gets per-frame flushes and no coalescing, with no diagnostic.

Patch 14 - ENETC_TBMR_WRR_MASK and ENETC_TBMR_PRIO_MASK use GENMASK, which is defined in ntmp.h, not in base/enetc_hw.h where the macros live. It works only because enetc.h pulls in both and the expansion is deferred to the use site; enetc_rxtx.c includes base/enetc_hw.h directly and would break if it ever used them.

Patch 14 - devargs are now parsed in both enetc4_dev_init() (priorities, nc) and enetc4_dev_configure() (priorities, wrr, nc). The duplicate parse is harmless since parse_txq_prior() frees the previous array, but hw->nc_mode is reset and re-parsed in configure after the burst functions were already chosen in init, so an nc change there cannot take effect.

Patch 01 - enetc_rx_crc_trim() decrements first_seg->pkt_len unconditionally; if a single-segment cluster ever arrived with data_len <= crc_len and prev_seg == NULL, pkt_len would wrap. Not reachable for valid Ethernet frames, but a data_len > crc_len guard on the pkt_len adjustment would make it total.

#142 lore raw

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

Hi,

NXP Confidential

Quoted 194 lines

-----Original Message-----
From: Stephen Hemminger <[email protected]>
Sent: Saturday, August 15, 2026 8:47 PM
To: Gagandeep Singh <[email protected]>
Cc: [email protected]; Hemant Agrawal <[email protected]>
Subject: Re: [PATCH v9-1 00/14] net/enetc: add new features for ENETC4 on i.MX95

Quoted 95 lines · On Thu, 13 Aug 2026 17:43:44 +0530 Gagandeep Singh <[email protected]> wrote:

V9-Changes:
- Mid-body variable declaration moved to top of the function.
- ret=0 dead code is removed.
- Added check on return value of rte_intr_callback_unregister()
- The pre-existing reply_msg leak fixed.
- Added primary-process guard in enetc4_vf_dev_init
- Removed Flow control from enetc4.ini
- Fixed VF stats_reset baseline underflows on counter wrap
- Fixed VF vlan_pvid_set fails on every successful command

V8-changes:
- Fixed Warning RBMR RMW races between threads by adding lock
- Fixed static const arrays in enetc.h
- Proper pthread_mutexattr_t initialization added as suggested by AI
- VSIMSGSR stale re-read race is eliminated

V7-changes:
- added missing 14th patch.

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 (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    |   7 +
 doc/guides/rel_notes/release_26_11.rst |  21 +
 drivers/net/enetc/base/enetc4_hw.h     | 137 +++-
 drivers/net/enetc/base/enetc_hw.h      |   6 +
 drivers/net/enetc/enetc.h              | 132 +++-
 drivers/net/enetc/enetc4_ethdev.c      | 459 +++++++++++--
 drivers/net/enetc/enetc4_vf.c          | 870 +++++++++++++++++++++----
 drivers/net/enetc/enetc_rxtx.c         | 530 ++++++++++++++-
 9 files changed, 2084 insertions(+), 178 deletions(-)

Still some AI review feedback items that need addressing.
I say addressing because AI can and does spot things that are not a real problem.

ENETC4 v9 series review - 14 patches

No Reviewed-by. The two v8 errors are fixed, but this revision introduces a regression in patch 14 that silently disables the existing enetc4_txq_prior devarg, and the patch 11 reply check looks inverted rather than fixed. Applied cleanly onto c1a46b9; source review only, no builds.

Fixed from v8

enetc4_rd64() now reads the 64-bit SI counters as a high/low pair and oerrors is masked to 32 bits before the subtraction, so the stats_reset delta no longer underflows on counter wrap. "Flow control = Y" is gone from enetc4.ini. The ring-doubling paths validate the doubled count against MAX_BD_COUNT. enetc4_vf_link_update() frees reply_msg on both "Wrong reply message" paths. Interrupt teardown frees the vector list and disables the efds. txq_prior moved to rte_zmalloc/rte_free consistently, with the old allocation released before re- parsing.

Errors

Patch 14 - enetc4_txq_prior and enetc4_txq_wrr have no effect at queue setup.

In enetc4_tx_queue_setup() the hunk changed the target variable but not the register write:

  uint32_t tx_en = ENETC_TBMR_EN;

  if (priv->hw.txq_prior)
          tx_data |= priv->hw.txq_prior[tx_ring->index];
  if (priv->hw.txq_wrr)
          tx_data |= priv->hw.txq_wrr[tx_ring->index];
  /* enable ring */
  enetc4_txbdr_wr(&priv->hw.hw, tx_ring->index, ENETC_TBMR, tx_en);

tx_data is never read again, so both the priority and the WRR weight are dropped and only ENETC_TBMR_EN reaches TBaMR. This is a regression: v8 had "tx_en |= priv->hw.txq_prior[...]", which worked. The scheduler bits now only get programmed through enetc4_tx_queue_start(), which non-deferred queues never go through. Either OR into tx_en, or drop tx_en and write tx_data | ENETC_TBMR_EN.

Patch 11 - the vlan_pvid_set reply check is inverted, not fixed.

  if (reply_msg->class_id != ENETC_CLASS_ID_SI_VLAN_ISO) {
          ENETC_PMD_ERR("SI VLAN isolation command failed: ...");
          err = -EINVAL;
  }

For the configuration command classes the driver already handles, class_id equal to the command class is the failure indication and ENETC_MSG_CLASS_ID_CMD_SUCCESS (0x1) is success. Both MAC and VLAN filter follow that shape:

  if (class_id == ENETC_CLASS_ID_MAC_FILTER) {
          switch (status) { ... default: err = -EINVAL; }
  }

that is, every status under 0x20 is an error. If 0x20 were also returned on success, set_mac_addr could never succeed.

SI VLAN isolation (0x24) is a set-type command in the same 0x2x family, so success should arrive as 0x1 and 0x24 should carry a class-specific error status. As written the function still returns -EINVAL on every successful command, the same symptom as v8 with a different comparand.
The shape to match is:

  if (reply_msg->class_id == ENETC_CLASS_ID_SI_VLAN_ISO) {
          /* class-specific failure: inspect reply_msg->status */
          err = -EINVAL;
  }
Quoted 5 lines

The classes where class_id == command class *is* the success reply are the query classes - LINK_STATUS (0x80), LINK_SPEED (0x81), GET_IP_VER (0xF0) - which return data in the status byte. If the PSI really does return 0x24 on success for this command, please say so in the commit message, since it contradicts the convention every other setter in the file uses.

I checked the kernel PF reply. The PSI reports command completion in the reply class_id: a
successful command returns ENETC_MSG_CLASS_ID_CMD_SUCCESS (0x1),
while any other class_id (e.g. CMD_NOT_SUPPORT 0x3) indicates a
failure. The command class value (0x24) is only used in the outgoing VF-to-PSI header and is never echoed back in the reply, So treating class_id != CMD_SUCCESS as failure.

Quoted 45 lines

Warnings

Patch 11 - "VLAN offload = Y" added to enetc4.ini for a pvid change.

doc/guides/nics/features.rst lists vlan_pvid_set under "Other dev ops not represented by a Feature"; pvid has no matrix entry. The VLAN offload entry requires vlan_offload_set plus RTE_ETH_RX_OFFLOAD_VLAN_STRIP / RTE_ETH_TX_OFFLOAD_VLAN_INSERT in rx_offload_capa / tx_offload_capa. The PF ops table has no vlan_offload_set at all and neither offload flag is in dev_rx_offloads_sup / dev_tx_offloads_sup. Drop the line.

Patches 02 and 03 - the burst function is selected on enable but never restored.

enetc4_rx_queue_setup() sets dev->rx_pkt_burst = &enetc_recv_pkts_rsc when LRO is requested and enetc4_tx_queue_setup() sets
dev->tx_pkt_burst = &enetc_xmit_pkts_lso when TSO is requested; neither has an else branch. The defaults are assigned once at probe in enetc4_dev_hw_init(). After a dev_stop plus rte_eth_dev_configure() without those offloads the pointers keep their previous values, and enetc_clean_rx_ring_rsc() then walks a 16B-descriptor ring as if it were 32B (i += 2, bd_count not doubled, extension slot read from the neighbouring descriptor). The RSC assignment also happens before enetc4_alloc_rxbdr(), so it survives a failed setup.

Info

Patch 09 - enetc4_rd64() reads high and low with no re-read of the low word, so a carry between the two accesses yields a value 2^32 too large. The window is tiny but the error is not; the usual form is read-high / read-low / read-high-again and retry if the high word moved. Related: the operands of | have unspecified evaluation order, so which half is fetched first is up to the compiler.

Patch 10 - enetc4_vf_rx_queue_intr_enable() writes RBICR1 = 0 and RBICR0 = ICEN | ICPT(1), overwriting the coalescing timer that patch 03 programs for RSC (ENETC4_RSC_DEF_ICTT). An application enabling both LRO and intr_conf.rxq gets per-frame flushes and no coalescing, with no diagnostic.

Patch 14 - ENETC_TBMR_WRR_MASK and ENETC_TBMR_PRIO_MASK use
GENMASK, which is defined in ntmp.h, not in base/enetc_hw.h where the macros live. It works only because enetc.h pulls in both and the expansion is deferred to the use site; enetc_rxtx.c includes base/enetc_hw.h directly and would break if it ever used them.

Quoted 5 lines

Patch 14 - devargs are now parsed in both enetc4_dev_init() (priorities, nc) and enetc4_dev_configure() (priorities, wrr, nc). The duplicate parse is harmless since parse_txq_prior() frees the previous array, but hw->nc_mode is reset and re- parsed in configure after the burst functions were already chosen in init, so an nc change there cannot take effect.

FALSE POSITIVE, no change. The claim that an nc change in dev_configure() "cannot take effect" does not hold:

nc_mode is derived from the device's devargs string, which is immutable after probe — re-parsing in configure always produces the exact value dev_init() computed. There is no possible "nc change" between the two calls.
The burst functions set in dev_init() (lines 1501-1503) are only a tentative default. The authoritative selection happens later in enetc4_tx_queue_setup() (lines 497-498) and enetc4_rx_queue_setup() (lines 728-730), which read hw->nc_mode and run after dev_configure(). So the configure-time value is fully honored at queue setup. The duplicate parse is redundant but harmless (as the comment itself concedes), and parse_txq_prior/wrr free the previous array each time, so no leak.

Quoted 5 lines

Patch 01 - enetc_rx_crc_trim() decrements first_seg->pkt_len unconditionally; if a single-segment cluster ever arrived with data_len <= crc_len and prev_seg == NULL, pkt_len would wrap. Not reachable for valid Ethernet frames, but a data_len > crc_len guard on the pkt_len adjustment would make it total.

Its False positive, - crc_len is always RTE_ETHER_CRC_LEN = 4
ENETC hardware enforces the Ethernet minimum frame size (64 bytes including FCS) Any frame delivered to the driver has data_len >= 64, so last_seg->data_len > 4 is always true

I have sent V10 series with the fixes.

#143 lore raw

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

In reply to Gagandeep Singh

V10-Changes:
- Fixed enetc4_txq_prior and enetc4_txq_wrr have no effect at queue setup issue.
- Updated ENETC_CLASS_ID_SI_VLAN_ISO reply check.
- Updated enetc4.ini for VLAN offload.
- Added else part for burst functions selection for RSC and TSO.
- Updated enetc4_rd64()
- Fixed RBICR0 issue.
- Removed GENMASK.

V9-Changes:
- Mid-body variable declaration moved to top of the function.
- ret=0 dead code is removed.
- Added check on return value of rte_intr_callback_unregister()
- The pre-existing reply_msg leak fixed.
- Added primary-process guard in enetc4_vf_dev_init
- Removed Flow control from enetc4.ini
- Fixed VF stats_reset baseline underflows on counter wrap
- Fixed VF vlan_pvid_set fails on every successful command

V8-changes:
- Fixed Warning RBMR RMW races between threads by adding lock
- Fixed static const arrays in enetc.h
- Proper pthread_mutexattr_t initialization added as suggested by AI
- VSIMSGSR stale re-read race is eliminated

V7-changes:
- added missing 14th patch.

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 (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    |   6 +
 doc/guides/rel_notes/release_26_11.rst |  21 +
 drivers/net/enetc/base/enetc4_hw.h     | 139 +++-
 drivers/net/enetc/base/enetc_hw.h      |   6 +
 drivers/net/enetc/enetc.h              | 132 +++-
 drivers/net/enetc/enetc4_ethdev.c      | 478 +++++++++++--
 drivers/net/enetc/enetc4_vf.c          | 886 +++++++++++++++++++++----
 drivers/net/enetc/enetc_rxtx.c         | 530 ++++++++++++++-
 9 files changed, 2117 insertions(+), 181 deletions(-)
Signature · 1 line
2.25.1
#144 lore raw

PATCH v10 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     |  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
#145 lore raw

PATCH v10 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     |  34 +++-
 drivers/net/enetc/enetc.h              |   3 +
 drivers/net/enetc/enetc4_ethdev.c      |  54 +++++-
 drivers/net/enetc/enetc4_vf.c          |   2 +
 drivers/net/enetc/enetc_rxtx.c         | 257 +++++++++++++++++++++++++
 8 files changed, 349 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 +50 -4

91 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
#146 lore raw

PATCH v10 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     |  75 ++++++++
 drivers/net/enetc/enetc.h              |   5 +
 drivers/net/enetc/enetc4_ethdev.c      | 119 ++++++++++++-
 drivers/net/enetc/enetc4_vf.c          |   1 +
 drivers/net/enetc/enetc_rxtx.c         | 234 +++++++++++++++++++++++++
 8 files changed, 434 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 +113 -6

184 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
#147 lore raw

PATCH v10 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          | 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
#148 lore raw

PATCH v10 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          | 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
#149 lore raw

PATCH v10 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              |  4 ++
 drivers/net/enetc/enetc4_ethdev.c      | 81 ++++++++++++++++++++++++++
 drivers/net/enetc/enetc4_vf.c          | 62 ++++++++++++++++++++
 6 files changed, 150 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 +4 -0
index c4a55626f8..bdcee9deb6 100644
@@ -395,6 +395,10 @@ enetc_bd_unused(struct enetc_bdr *bdr)
 	return bdr->bd_count + bdr->next_to_clean - bdr->next_to_use - 1;
 }
 
+/* Per-ring BDR registers dumped by .get_reg (shared by PF and VF) */
+extern const uint32_t enetc4_txbdr_regs[6];
+extern const uint32_t enetc4_rxbdr_regs[8];
+
 /* 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 +81 -0

99 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
#150 lore raw

PATCH v10 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 bdcee9deb6..fb286537a6 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 5922d8bf56..5d1c0ad828 100644
@@ -1150,7 +1150,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)
 {
@@ -1164,7 +1164,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
#151 lore raw

PATCH v10 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/enetc.h              |   2 +
 drivers/net/enetc/enetc4_ethdev.c      |   6 +
 drivers/net/enetc/enetc4_vf.c          | 323 +++++++++++++------------
 4 files changed, 183 insertions(+), 149 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 fb286537a6..85826c5ab2 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 +6 -0
index 5d1c0ad828..5f0b530c2f 100644
@@ -867,6 +867,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);
 	}
@@ -1351,6 +1352,11 @@ enetc4_dev_init(struct rte_eth_dev *eth_dev)
 	struct enetc_hw *enetc_hw = &hw->hw;
 
 	PMD_INIT_FUNC_TRACE();
+
+	if (rte_eal_process_type() != RTE_PROC_PRIMARY) {
+		eth_dev->dev_ops = &enetc4_ops;
+		return 0;
+	}
 	eth_dev->dev_ops = &enetc4_ops;
 	enetc4_dev_hw_init(eth_dev);
 
drivers/net/enetc/enetc4_vf.c +174 -149

550 lines not on this page · raw message

Signature · 1 line
2.25.1
#152 lore raw

PATCH v10 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/base/enetc4_hw.h     | 11 +++++
 drivers/net/enetc/enetc.h              | 17 +++++++
 drivers/net/enetc/enetc4_vf.c          | 61 +++++++++++++++++++++++---
 4 files changed, 85 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/base/enetc4_hw.h +11 -0
index d42c04df4b..01b267edb6 100644
@@ -8,6 +8,7 @@
 #ifndef _ENETC4_HW_H_
 #define _ENETC4_HW_H_
 #include <rte_io.h>
+#include "enetc_hw.h"
 
 #define BIT(x)		((uint64_t)1 << ((x)))
 
@@ -279,6 +280,16 @@ struct enetc_rx_bd_ext {
 #define enetc4_wr_reg(reg, val)  rte_write32((val), (void *)(reg))
 
 #define enetc4_rd(hw, off)	 enetc4_rd_reg((size_t)(hw)->reg + (off))
+static inline uint64_t
+enetc4_rd64(struct enetc_hw *hw, uint32_t off)
+{
+	size_t base = (size_t)hw->reg + off;
+	uint32_t lo, hi;
+
+	lo = enetc4_rd_reg(base);
+	hi = enetc4_rd_reg(base + 4);
+	return (uint64_t)hi << 32 | lo;
+}
 #define enetc4_wr(hw, off, val)  enetc4_wr_reg((size_t)(hw)->reg + (off), val)
 /* port register accessors - PF only */
 #define enetc4_port_rd(hw, off)  enetc4_rd_reg((size_t)(hw)->port + (off))
drivers/net/enetc/enetc.h +17 -0
index 85826c5ab2..895d11a30d 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
#153 lore raw

PATCH v10 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          | 95 +++++++++++++++++++++++++-
 7 files changed, 168 insertions(+), 6 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 01b267edb6..8c522b69cd 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 895d11a30d..07c2038b68 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 5f0b530c2f..1857f21f56 100644
@@ -864,7 +864,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);
@@ -987,12 +988,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 +93 -2

136 lines not on this page · raw message

Signature · 1 line
2.25.1
#154 lore raw

PATCH v10 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/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          | 91 ++++++++++++++++++++++++++
 6 files changed, 172 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/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 8c522b69cd..15cea5a83d 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 07c2038b68..8e679e6aa2 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 1857f21f56..f77b595f58 100644
@@ -898,6 +898,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)
 {
@@ -1293,6 +1331,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 +91 -0

109 lines not on this page · raw message

Signature · 1 line
2.25.1
#155 lore raw

PATCH v10 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          | 29 ++++++++------------------
 3 files changed, 14 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 8e679e6aa2..9bf7cd43c6 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 +9 -20
index b66fde64f1..435964ea4e 100644
@@ -507,8 +507,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
@@ -520,14 +522,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)
@@ -1209,19 +1203,13 @@ 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");
+		rte_free(reply_msg);
 		return -1;
 	}
 
@@ -1237,6 +1225,7 @@ enetc4_vf_link_update(struct rte_eth_dev *dev, int wait_to_complete __rte_unused
 					 hw->vf_link_legacy, &link);
 	} else {
 		ENETC_PMD_ERR("Wrong reply message");
+		rte_free(reply_msg);
 		return -1;
 	}
 
Signature · 1 line
2.25.1
#156 lore raw

PATCH v10 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/rel_notes/release_26_11.rst |  1 +
 drivers/net/enetc/base/enetc_hw.h      |  1 +
 drivers/net/enetc/enetc.h              | 17 ++++++-
 drivers/net/enetc/enetc4_ethdev.c      | 30 ++++++++++++-
 drivers/net/enetc/enetc4_vf.c          | 62 ++++++++++++++++++++++++--
 5 files changed, 104 insertions(+), 7 deletions(-)
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 +15 -2
index 9bf7cd43c6..63ad30251a 100644
@@ -6,6 +6,7 @@
 #define _ENETC_H_
 
 #include <pthread.h>
+#include <rte_stdatomic.h>
 #include <rte_time.h>
 #include <ethdev_pci.h>
 
@@ -140,7 +141,16 @@ 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 */
+	/* serializes all VSI-PSI mailbox transactions and RBMR read-modify-write
+	 * sequences so that set_congestion_mode() and rx_queue_start/stop()
+	 * cannot race on the same RBMR register.
+	 */
+	pthread_mutex_t vsi_lock;
+	/* 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)).
+	 * Always accessed under vsi_lock, so relaxed ordering suffices.
+	 */
+	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 +249,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 +28 -2
index f77b595f58..3a2bc22b8b 100644
@@ -737,10 +737,22 @@ 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;
+		/* vsi_lock serializes RBMR RMW with enetc4_vf_set_congestion_mode().
+		 * Only VF has that interrupt-driven path; PF skips the lock.
+		 */
+		if (adapter->hw.device_id == ENETC4_DEV_ID_VF)
+			pthread_mutex_lock(&adapter->hw.vsi_lock);
+		if (rte_atomic_load_explicit(&adapter->hw.tx_pause_active,
+					     rte_memory_order_relaxed))
+			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);
+		if (adapter->hw.device_id == ENETC4_DEV_ID_VF)
+			pthread_mutex_unlock(&adapter->hw.vsi_lock);
 		dev->data->rx_queue_state[rx_ring->index] =
 			       RTE_ETH_QUEUE_STATE_STARTED;
 	} else {
@@ -1113,11 +1125,21 @@ enetc4_rx_queue_start(struct rte_eth_dev *dev, uint16_t qidx)
 	PMD_INIT_FUNC_TRACE();
 	rx_ring = dev->data->rx_queues[qidx];
 	if (dev->data->rx_queue_state[qidx] == RTE_ETH_QUEUE_STATE_STOPPED) {
+		if (priv->hw.device_id == ENETC4_DEV_ID_VF)
+			pthread_mutex_lock(&priv->hw.vsi_lock);
 		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_relaxed))
+			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);
+		if (priv->hw.device_id == ENETC4_DEV_ID_VF)
+			pthread_mutex_unlock(&priv->hw.vsi_lock);
 		dev->data->rx_queue_state[qidx] = RTE_ETH_QUEUE_STATE_STARTED;
 	}
 
@@ -1135,11 +1157,15 @@ enetc4_rx_queue_stop(struct rte_eth_dev *dev, uint16_t qidx)
 	PMD_INIT_FUNC_TRACE();
 	rx_ring = dev->data->rx_queues[qidx];
 	if (dev->data->rx_queue_state[qidx] == RTE_ETH_QUEUE_STATE_STARTED) {
+		if (priv->hw.device_id == ENETC4_DEV_ID_VF)
+			pthread_mutex_lock(&priv->hw.vsi_lock);
 		rx_data = enetc4_rxbdr_rd(&priv->hw.hw, rx_ring->index,
 					 ENETC_RBMR);
 		rx_data = rx_data & (~ENETC_RBMR_EN);
 		enetc4_rxbdr_wr(&priv->hw.hw, rx_ring->index, ENETC_RBMR,
 			       rx_data);
+		if (priv->hw.device_id == ENETC4_DEV_ID_VF)
+			pthread_mutex_unlock(&priv->hw.vsi_lock);
 		dev->data->rx_queue_state[qidx] = RTE_ETH_QUEUE_STATE_STOPPED;
 	}
 
drivers/net/enetc/enetc4_vf.c +59 -3

90 lines not on this page · raw message

Signature · 1 line
2.25.1
#157 lore raw

PATCH v10 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      | 95 +++++++++++++++++++++-----
 5 files changed, 96 insertions(+), 18 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 f287390db7..2be5357af3 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..3065c16e5c 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		0x70
+#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		0x7
 
 /* Port regs, offset: 1_0000h */
 #define ENETC_PORT_BASE			0x10000
drivers/net/enetc/enetc.h +1 -0
index 63ad30251a..de0aa4d532 100644
@@ -135,6 +135,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 +77 -18

166 lines not on this page · raw message

Signature · 1 line
2.25.1
#158 lore raw

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

In reply to Gagandeep Singh
Quoted 105 lines · On Mon, 17 Aug 2026 12:04:40 +0530 Gagandeep Singh <[email protected]> wrote:

V10-Changes:
- Fixed enetc4_txq_prior and enetc4_txq_wrr have no effect at queue setup issue.
- Updated ENETC_CLASS_ID_SI_VLAN_ISO reply check.
- Updated enetc4.ini for VLAN offload.
- Added else part for burst functions selection for RSC and TSO.
- Updated enetc4_rd64()
- Fixed RBICR0 issue.
- Removed GENMASK.

V9-Changes:
- Mid-body variable declaration moved to top of the function.
- ret=0 dead code is removed.
- Added check on return value of rte_intr_callback_unregister()
- The pre-existing reply_msg leak fixed.
- Added primary-process guard in enetc4_vf_dev_init
- Removed Flow control from enetc4.ini
- Fixed VF stats_reset baseline underflows on counter wrap
- Fixed VF vlan_pvid_set fails on every successful command

V8-changes:
- Fixed Warning RBMR RMW races between threads by adding lock
- Fixed static const arrays in enetc.h
- Proper pthread_mutexattr_t initialization added as suggested by AI
- VSIMSGSR stale re-read race is eliminated

V7-changes:
- added missing 14th patch.

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 (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    |   6 +
 doc/guides/rel_notes/release_26_11.rst |  21 +
 drivers/net/enetc/base/enetc4_hw.h     | 139 +++-
 drivers/net/enetc/base/enetc_hw.h      |   6 +
 drivers/net/enetc/enetc.h              | 132 +++-
 drivers/net/enetc/enetc4_ethdev.c      | 478 +++++++++++--
 drivers/net/enetc/enetc4_vf.c          | 886 +++++++++++++++++++++----
 drivers/net/enetc/enetc_rxtx.c         | 530 ++++++++++++++-
 9 files changed, 2117 insertions(+), 181 deletions(-)

Looks better but AI still sees some things.

ENETC4 v10 series review - 14 patches

No Reviewed-by. Both v9 errors are fixed and nothing in this revision looks like a regression, but there is one new problem introduced by the secondary-process guards and a handful of documentation/API mismatches that should be sorted before this goes in. Applied cleanly onto c1a46b9; source review only, no builds.

On the v9 replies

The nc_mode item is a false positive as you say, dropped. Both enetc4_tx_queue_setup() and enetc4_rx_queue_setup() now have an else branch that reads hw->nc_mode, and queue setup always runs after dev_configure(), so the configure-time value is what reaches the burst selection. Worth noting the argument only became true in this
revision: those else branches are the fix for the other v9 warning. Before that, the dev_init() assignment really was the last word.

The enetc_rx_crc_trim() item is also a false positive, dropped. The unguarded arm is prev_seg == NULL, which only happens on a single-segment cluster where data_len is the whole frame, and minimum frame size enforcement puts that well above 4. One thing to keep in mind if that ever changes: the Rx clean paths count rxbd.r.error into ierrors but still hand the mbuf to the application, so a runt that was flagged rather than dropped would take exactly that path.

On vlan_pvid_set, your explanation is more specific than what the review inferred from the MAC and VLAN filter shape, and the code is right if the kernel PF behaves as you describe. One leftover though:
enetc4_msg_vsi_send() still carries

case ENETC_CLASS_ID_SI_VLAN_ISO:

          break;

in the non-success whitelist. Every class_id that is not on that list already makes send() return an error before vlan_pvid_set() reaches its own reply check, so 0x24 is now the only value that can ever make the new check fire. If 0x24 is genuinely never echoed back, that case is dead and should go. If it can come back as a class-specific error, then the comment above the check is wrong. Either way the two should not say different things.

Fixed from v9

enetc4_tx_queue_setup() writes tx_data now, with the scheduler bits cleared before EN, txq_prior and txq_wrr are OR'd in, so both devargs reach TBaMR at setup. The vlan_pvid_set reply check tests against CMD_SUCCESS. "VLAN offload = Y" is gone from enetc4.ini. Both queue setup paths restore the nc/cacheable burst function in an else branch.

Also addressed without comment: ENETC_TBMR_WRR_MASK and ENETC_TBMR_PRIO_MASK are literal hex now, so the GENMASK-from-ntmp.h dependency is gone, and enetc4_vf_rx_queue_intr_enable() guards the RBICR1 = 0 write with if (!rx_ring->rsc_enable), preserving the RSC coalesce timer.

The mailbox is serialized by hw->vsi_lock, correctly initialized with PTHREAD_PROCESS_SHARED (dev_private is hugepage memory, so that is the right attribute), unlocked on every return path in enetc4_msg_vsi_send(), and destroyed under a primary-process guard in dev_close. No deadlock: enetc4_process_psi_msg() runs from the interrupt callback outside the lock. VF stats_reset uses enetc4_rd64() for the 64-bit SI counters and does the SITDFCR delta in uint32_t, so the wrap underflow is gone.

Errors

Patch 08 - the secondary-process guards leave the burst function pointers NULL.

Both enetc4_dev_init() and enetc4_vf_dev_init() now start with

  if (rte_eal_process_type() != RTE_PROC_PRIMARY) {
          eth_dev->dev_ops = &enetc4_ops;
          return 0;
  }

The burst functions are selected in enetc4_rx_queue_setup() and enetc4_tx_queue_setup(), which a secondary process never calls, so eth_dev->rx_pkt_burst and tx_pkt_burst stay NULL there. eth_dev_fp_ops_setup() copies them into rte_eth_fp_ops verbatim, so rte_eth_rx_burst() in the secondary calls through a NULL pointer.

Before the guard, dev_init() ran enetc4_dev_hw_init() in the secondary and the pointers were at least set, so this is a step backwards for multi-process. Either set the burst functions in the secondary branch the way most PMDs do, or, if secondary process operation is not intended to be supported at all, return -ENOTSUP so the probe fails cleanly instead of succeeding into a crash.

In the PF path the dev_ops assignment is also duplicated immediately after the guard.

Warnings

Patch 07 - rxq_info_get and txq_info_get report the doubled ring size.

With RSC or LSO enabled, bd_count is 2 * nb_desc, and qinfo->nb_desc = rxq->bd_count hands that value back to the application. An application that reads nb_desc and feeds it into a later rx_queue_setup() doubles the ring on every pass until MAX_BD_COUNT rejects it. Report the count the application asked for, not the internal slot count.

Patches 05, 06 and 10 - the features matrix is the PF's, but the new entries are VF-only.

There is no doc/guides/nics/features/enetc4_vf.ini, so everything in enetc4.ini describes net_enetc4. "Rx interrupt = Y" requires rx_queue_intr_enable and rx_queue_intr_disable, and "FW version = Y" requires fw_version_get; neither is in enetc4_ops, both are VF-only. A separate enetc4_vf.ini would fix this cleanly and would also let you untangle the pre-existing entries in that file that are already VF-only.

Patch 03 - "LRO = Y" without dev->data->lro.

features.rst lists "[implements] rte_eth_dev_data: lro" for that entry and the driver never sets it. The same applies to dev->data->scattered_rx, which stays 0 even though RSC delivers multi-segment clusters, so enetc4_rxq_info_get() then reports scattered_rx = 0. Nothing checks that the application enabled RTE_ETH_RX_OFFLOAD_SCATTER before RSC starts building chains, and with max_lro_pkt_size defaulting to the port frame size the chains are guaranteed once the coalesced frame exceeds one mbuf.

Patch 08 - link-up handling now blocks the EAL interrupt thread.

enetc4_process_psi_msg() calls enetc4_vf_get_link_speed(), a full mailbox round trip, from inside the interrupt callback with device interrupts masked. With the defaults that is up to 100 * 2000 us = 200 ms, during which no other EAL interrupt callback on the process runs. Consider deferring the speed refresh to an alarm or to the next link_update() call.

Patch 13 - link_update() now rewrites RBMR on every Rx ring.

enetc4_vf_link_update() calls enetc4_vf_set_congestion_mode() on both the up and down paths, which does a read-modify-write of RBMR for every Rx ring under vsi_lock. Applications poll rte_eth_link_get_nowait() frequently (testpmd does), so this turns a status query into a per-ring register write storm against running rings. Only touch RBMR when the pause state actually changed.

Patch 14 - enetc4_txq_wrr is not registered for the VF.

The commit subject and the release note both say the devarg is for VF rings, and doc/guides/nics/enetc4.rst files it under "PF/Common devargs", but RTE_PMD_REGISTER_PARAM_STRING(net_enetc4_vf, ...) lists only vsi_disable, vsi_timeout, vsi_delay, nc and vf_link_legacy. enetc4_txq_prior has the same gap. It happens to work because enetc4_get_devargs() parses with a NULL valid-key list, but the registration should match.

Info

Patch 09 - enetc4_rd64() still reads low then high with no re-read, so a carry between the two accesses yields a value 2^32 too large. Unchanged from v9.

Patch 03 - the rsc_size == 0 fallback in enetc4_rx_queue_setup() is dead code. rte_eth_dev_configure() fills rxmode.max_lro_pkt_size with mtu + overhead when the application leaves it zero, so the field is never zero by the time the PMD reads it.

Patches 02 and 04 - ENETC4_TXBD_EXT_FLAGS_F and ENETC_SPEED_MAX are defined but never used.

Patch 06 - enetc4_txbdr_regs and enetc4_rxbdr_regs are declared extern with an explicit dimension in enetc.h while the definitions in enetc4_ethdev.c use []. RTE_DIM() at the use sites in enetc4_vf.c depends on those staying in sync with no diagnostic if they drift.

Patch 13 - the deferred-start branch of enetc4_rx_queue_setup() writes RBMR outside vsi_lock and without applying tx_pause_active, so it can lose a concurrent congestion-mode update. Harmless in practice since rx_queue_start() reapplies it, but the locking is inconsistent with the non-deferred branch three lines above.

Patch 11 - enetc4_vlan_pvid_set() and enetc4_vf_vlan_pvid_set() mask vlan_id to 12 bits without range checking it, so a caller passing something above 4095 silently gets a different VLAN.

Pre-existing, noticed while reading patch 14: enetc4_dev_configure() resets the Tx rings with

  enetc4_rxbdr_wr(enetc_hw, i, ENETC_TBMR, ENETC_BMR_RESET);

ENETC_TBMR and ENETC_RBMR are both offset 0, so this writes the Rx ring's mode register a second time and the Tx rings are never reset. Not introduced here, but the loop is immediately above the new devarg parsing this patch adds.

#159 lore raw

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

In reply to Gagandeep Singh

V11-Changes:
- Added enetc4_vf.ini for VF only features.
- Fixed the secondary-process guards leave the burst function pointers NULL
- Fixed rxq_info_get and txq_info_get report the doubled ring size
- Move the VFs only features to enetc4_vf.ini
- Setting the dev->data->lro
- Added a comment to use devargs to change delay and timeout to process PSI message to avoid any interrupts stall.
- Fixed link_update() now rewrites RBMR on every Rx ring.
- Regestering - enetc4_txq_wr in VF
- Updated enetc4_rd64 with re-read to confirm the correctness.
- Removed the dead code and un-used macros.
- Added Vlan check for maximum allowed value.
- fixed pre-existing ring write function for TX path.

V10-Changes:
- Fixed enetc4_txq_prior and enetc4_txq_wrr have no effect at queue setup issue.
- Updated ENETC_CLASS_ID_SI_VLAN_ISO reply check.
- Updated enetc4.ini for VLAN offload.
- Added else part for burst functions selection for RSC and TSO.
- Updated enetc4_rd64()
- Fixed RBICR0 issue.
- Removed GENMASK.

V9-Changes:
- Mid-body variable declaration moved to top of the function.
- ret=0 dead code is removed.
- Added check on return value of rte_intr_callback_unregister()
- The pre-existing reply_msg leak fixed.
- Added primary-process guard in enetc4_vf_dev_init
- Removed Flow control from enetc4.ini
- Fixed VF stats_reset baseline underflows on counter wrap
- Fixed VF vlan_pvid_set fails on every successful command

V8-changes:
- Fixed Warning RBMR RMW races between threads by adding lock
- Fixed static const arrays in enetc.h
- Proper pthread_mutexattr_t initialization added as suggested by AI
- VSIMSGSR stale re-read race is eliminated

V7-changes:
- added missing 14th patch.

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 (15):
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: add VF supported features file 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

 MAINTAINERS                            |   1 +
 doc/guides/nics/enetc4.rst             | 100 +++
 doc/guides/nics/features/enetc4.ini    |   4 +
 doc/guides/nics/features/enetc4_vf.ini |  29 +
 doc/guides/rel_notes/release_26_11.rst |  21 +
 drivers/net/enetc/base/enetc4_hw.h     | 148 +++-
 drivers/net/enetc/base/enetc_hw.h      |   6 +
 drivers/net/enetc/enetc.h              | 133 +++-
 drivers/net/enetc/enetc4_ethdev.c      | 517 ++++++++++++--
 drivers/net/enetc/enetc4_vf.c          | 919 ++++++++++++++++++++++---
 drivers/net/enetc/enetc_rxtx.c         | 530 +++++++++++++-
 11 files changed, 2223 insertions(+), 185 deletions(-)
 create mode 100644 doc/guides/nics/features/enetc4_vf.ini
Signature · 1 line
2.25.1
#160 lore raw

PATCH v11 1/15 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
#161 lore raw

PATCH v11 2/15 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     |  32 ++-
 drivers/net/enetc/enetc.h              |   3 +
 drivers/net/enetc/enetc4_ethdev.c      |  54 +++++-
 drivers/net/enetc/enetc4_vf.c          |   2 +
 drivers/net/enetc/enetc_rxtx.c         | 257 +++++++++++++++++++++++++
 8 files changed, 347 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 +31 -1
index c81ac00ec6..d7e36163f6 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,31 @@ 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)
+
+/* 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 +50 -4

91 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
#162 lore raw

PATCH v11 3/15 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      | 126 ++++++++++++-
 drivers/net/enetc/enetc4_vf.c          |   1 +
 drivers/net/enetc/enetc_rxtx.c         | 234 +++++++++++++++++++++++++
 8 files changed, 441 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 +120 -6

191 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
#163 lore raw

PATCH v11 4/15 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.

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              |  30 +++-
 drivers/net/enetc/enetc4_vf.c          | 202 +++++++++++++++++++++----
 4 files changed, 213 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 +25 -5
index 145ebbbb00..39a07df59d 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,27 @@ 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
+	/* 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 resulting SPEED
+	 * must fit in the 8-bit speed code field (0x0 to 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
#164 lore raw

PATCH v11 5/15 net/enetc: add VF supported features file

In reply to Gagandeep Singh

The upcoming VF-specific feature work needs its own supported-features documentation, separate from the PF (enetc4). Add a dedicated enetc4_vf.ini for the net_enetc4_vf PMD so that VF-only features can be tracked independently, and reference it in MAINTAINERS.

---
 MAINTAINERS                            |  1 +
 doc/guides/nics/features/enetc4_vf.ini | 26 ++++++++++++++++++++++++++
 2 files changed, 27 insertions(+)
 create mode 100644 doc/guides/nics/features/enetc4_vf.ini
MAINTAINERS +1 -0
index e99a65d197..8f64a7b3ed 100644
@@ -995,6 +995,7 @@ F: doc/guides/nics/enetc.rst
 F: doc/guides/nics/enetc4.rst
 F: doc/guides/nics/features/enetc.ini
 F: doc/guides/nics/features/enetc4.ini
+F: doc/guides/nics/features/enetc4_vf.ini
 
 NXP enetfec - EXPERIMENTAL
 M: Apeksha Gupta <[email protected]>
doc/guides/nics/features/enetc4_vf.ini new file +26 -0
new file mode 100644
index 0000000000..c4a3568e71
@@ -0,0 +1,26 @@
+;
+; Supported features of the 'enetc4_vf' network poll mode driver.
+;
+; Refer to default.ini for the full list of available PMD features.
+;
+[Features]
+Link status event    = Y
+Speed capabilities   = Y
+Link status          = Y
+LRO                  = Y
+TSO                  = Y
+Promiscuous mode     = Y
+Allmulticast mode    = Y
+Unicast MAC filter   = Y
+VLAN filter          = Y
+RSS hash             = Y
+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
+ARMv8                = Y
+Usage doc            = Y
Signature · 1 line
2.25.1
#165 lore raw

PATCH v11 6/15 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_vf.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_vf.ini +1 -0
index c4a3568e71..939cceacf2 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 39a07df59d..46804a05ba 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,
@@ -271,6 +281,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
#166 lore raw

PATCH v11 7/15 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/nics/features/enetc4_vf.ini |  1 +
 doc/guides/rel_notes/release_26_11.rst |  1 +
 drivers/net/enetc/enetc.h              |  4 ++
 drivers/net/enetc/enetc4_ethdev.c      | 88 ++++++++++++++++++++++++++
 drivers/net/enetc/enetc4_vf.c          | 62 ++++++++++++++++++
 7 files changed, 158 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 aae398e210..a427c68344 100644
@@ -16,6 +16,7 @@ VLAN filter          = Y
 RSS hash             = Y
 Packet type parsing  = Y
 Basic stats          = Y
+Registers dump       = Y
 L3 checksum offload  = Y
 L4 checksum offload  = Y
 CRC offload          = Y
doc/guides/nics/features/enetc4_vf.ini +1 -0
index 939cceacf2..55eaed6633 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 +4 -0
index 46804a05ba..02b935ad8e 100644
@@ -393,6 +393,10 @@ enetc_bd_unused(struct enetc_bdr *bdr)
 	return bdr->bd_count + bdr->next_to_clean - bdr->next_to_use - 1;
 }
 
+/* Per-ring BDR registers dumped by .get_reg (shared by PF and VF) */
+extern const uint32_t enetc4_txbdr_regs[6];
+extern const uint32_t enetc4_rxbdr_regs[8];
+
 /* 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 +88 -0

106 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
#167 lore raw

PATCH v11 8/15 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      | 10 ++++++----
 drivers/net/enetc/enetc4_vf.c          |  4 ++++
 4 files changed, 15 insertions(+), 4 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 02b935ad8e..eec0edc963 100644
@@ -336,6 +336,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 +6 -4
index 6064a4d905..f31eed849e 100644
@@ -1164,7 +1164,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)
 {
@@ -1172,19 +1172,21 @@ enetc4_rxq_info_get(struct rte_eth_dev *dev, uint16_t queue_id,
 
 	qinfo->mp = rxq->mb_pool;
 	qinfo->scattered_rx = dev->data->scattered_rx;
-	qinfo->nb_desc = rxq->bd_count;
+	/* RSC rings use 2 slots per descriptor; report the requested count. */
+	qinfo->nb_desc = rxq->rsc_enable ? rxq->bd_count / 2 : rxq->bd_count;
 	qinfo->conf.rx_free_thresh = 0;
 	qinfo->conf.rx_deferred_start = rxq->rx_deferred_start;
 	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)
 {
 	struct enetc_bdr *txq = dev->data->tx_queues[queue_id];
 
-	qinfo->nb_desc = txq->bd_count;
+	/* LSO rings use 2 slots per descriptor; report the requested count. */
+	qinfo->nb_desc = txq->lso_enable ? txq->bd_count / 2 : txq->bd_count;
 	qinfo->conf.tx_thresh.pthresh = 0;
 	qinfo->conf.tx_thresh.hthresh = 0;
 	qinfo->conf.tx_thresh.wthresh = 0;
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
#168 lore raw

PATCH v11 9/15 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      |  17 ++
 drivers/net/enetc/enetc4_vf.c          | 341 ++++++++++++++-----------
 4 files changed, 212 insertions(+), 149 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 eec0edc963..62a8690f10 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 +17 -0
index f31eed849e..eca756f90d 100644
@@ -881,6 +881,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);
 	}
@@ -1367,7 +1368,23 @@ enetc4_dev_init(struct rte_eth_dev *eth_dev)
 	struct enetc_hw *enetc_hw = &hw->hw;
 
 	PMD_INIT_FUNC_TRACE();
+
 	eth_dev->dev_ops = &enetc4_ops;
+
+	if (rte_eal_process_type() != RTE_PROC_PRIMARY) {
+		/*
+		 * Secondary process: dev_ops is set above, but the fast-path
+		 * burst function pointers must also be set here or
+		 * rte_eth_rx_burst()/rte_eth_tx_burst() would dereference NULL.
+		 * Use the cacheable defaults; the primary refines them
+		 * (nc/lso/rsc) during queue setup, which the secondary does not
+		 * run. This matches the pre-guard behaviour where
+		 * enetc4_dev_hw_init() set these defaults in both processes.
+		 */
+		eth_dev->rx_pkt_burst = &enetc_recv_pkts_cacheable;
+		eth_dev->tx_pkt_burst = &enetc_xmit_pkts_cacheable;
+		return 0;
+	}
 	enetc4_dev_hw_init(eth_dev);
 
 	si_cap = enetc_rd(enetc_hw, ENETC_SICAPR0);
drivers/net/enetc/enetc4_vf.c +192 -149

568 lines not on this page · raw message

Signature · 1 line
2.25.1
#169 lore raw

PATCH v11 10/15 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/base/enetc4_hw.h     | 22 ++++++++++
 drivers/net/enetc/enetc.h              | 17 +++++++
 drivers/net/enetc/enetc4_vf.c          | 61 +++++++++++++++++++++++---
 4 files changed, 96 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/base/enetc4_hw.h +22 -0
index 70af9118a3..060dc03991 100644
@@ -8,6 +8,7 @@
 #ifndef _ENETC4_HW_H_
 #define _ENETC4_HW_H_
 #include <rte_io.h>
+#include "enetc_hw.h"
 
 #define BIT(x)		((uint64_t)1 << ((x)))
 
@@ -277,6 +278,27 @@ struct enetc_rx_bd_ext {
 #define enetc4_wr_reg(reg, val)  rte_write32((val), (void *)(reg))
 
 #define enetc4_rd(hw, off)	 enetc4_rd_reg((size_t)(hw)->reg + (off))
+static inline uint64_t
+enetc4_rd64(struct enetc_hw *hw, uint32_t off)
+{
+	size_t base = (size_t)hw->reg + off;
+	uint32_t lo, hi, hi_check;
+
+	/*
+	 * A 64-bit statistics counter is read as two 32-bit accesses, so
+	 * the low word can carry into the high word between the two reads
+	 * and produce a value that is off by 2^32. Read the high word,
+	 * then the low word, then re-read the high word; if the high word
+	 * changed a carry happened during the sequence, so retry.
+	 */
+	do {
+		hi = enetc4_rd_reg(base + 4);
+		lo = enetc4_rd_reg(base);
+		hi_check = enetc4_rd_reg(base + 4);
+	} while (hi != hi_check);
+
+	return (uint64_t)hi << 32 | lo;
+}
 #define enetc4_wr(hw, off, val)  enetc4_wr_reg((size_t)(hw)->reg + (off), val)
 /* port register accessors - PF only */
 #define enetc4_port_rd(hw, off)  enetc4_rd_reg((size_t)(hw)->port + (off))
drivers/net/enetc/enetc.h +17 -0
index 62a8690f10..ae7fecbed2 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
#170 lore raw

PATCH v11 11/15 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_vf.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          | 95 +++++++++++++++++++++++++-
 7 files changed, 168 insertions(+), 6 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_vf.ini +1 -0
index 55eaed6633..c6014fd5a9 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 060dc03991..d4cdb01bcf 100644
@@ -248,6 +248,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 ae7fecbed2..dc5f66c0b7 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 eca756f90d..2be8c73403 100644
@@ -878,7 +878,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);
@@ -1001,12 +1002,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 +93 -2

136 lines not on this page · raw message

Signature · 1 line
2.25.1
#171 lore raw

PATCH v11 12/15 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/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      | 45 ++++++++++++
 drivers/net/enetc/enetc4_vf.c          | 96 ++++++++++++++++++++++++++
 6 files changed, 183 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/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 d4cdb01bcf..b3c6b02100 100644
@@ -275,6 +275,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 dc5f66c0b7..6b8299c370 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
 
@@ -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 +45 -0

57 lines not on this page · raw message

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

108 lines not on this page · raw message

Signature · 1 line
2.25.1
#172 lore raw

PATCH v11 13/15 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          | 29 ++++++++------------------
 3 files changed, 14 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 6b8299c370..b4a83827ca 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 +9 -20
index 5e85ff2139..a5c917d4f6 100644
@@ -507,8 +507,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)
 				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)
@@ -1216,19 +1210,13 @@ 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");
+		rte_free(reply_msg);
 		return -1;
 	}
 
@@ -1244,6 +1232,7 @@ enetc4_vf_link_update(struct rte_eth_dev *dev, int wait_to_complete __rte_unused
 					 hw->vf_link_legacy, &link);
 	} else {
 		ENETC_PMD_ERR("Wrong reply message");
+		rte_free(reply_msg);
 		return -1;
 	}
 
Signature · 1 line
2.25.1
#173 lore raw

PATCH v11 14/15 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/rel_notes/release_26_11.rst |  1 +
 drivers/net/enetc/base/enetc_hw.h      |  1 +
 drivers/net/enetc/enetc.h              | 17 ++++++-
 drivers/net/enetc/enetc4_ethdev.c      | 30 ++++++++++-
 drivers/net/enetc/enetc4_vf.c          | 70 ++++++++++++++++++++++++--
 5 files changed, 112 insertions(+), 7 deletions(-)
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 +15 -2
index b4a83827ca..c528d21b73 100644
@@ -6,6 +6,7 @@
 #define _ENETC_H_
 
 #include <pthread.h>
+#include <rte_stdatomic.h>
 #include <rte_time.h>
 #include <ethdev_pci.h>
 
@@ -140,7 +141,16 @@ 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 */
+	/* serializes all VSI-PSI mailbox transactions and RBMR read-modify-write
+	 * sequences so that set_congestion_mode() and rx_queue_start/stop()
+	 * cannot race on the same RBMR register.
+	 */
+	pthread_mutex_t vsi_lock;
+	/* 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)).
+	 * Always accessed under vsi_lock, so relaxed ordering suffices.
+	 */
+	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 +249,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 +28 -2
index 475e22d475..38253a511c 100644
@@ -751,10 +751,22 @@ 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;
+		/* vsi_lock serializes RBMR RMW with enetc4_vf_set_congestion_mode().
+		 * Only VF has that interrupt-driven path; PF skips the lock.
+		 */
+		if (adapter->hw.device_id == ENETC4_DEV_ID_VF)
+			pthread_mutex_lock(&adapter->hw.vsi_lock);
+		if (rte_atomic_load_explicit(&adapter->hw.tx_pause_active,
+					     rte_memory_order_relaxed))
+			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);
+		if (adapter->hw.device_id == ENETC4_DEV_ID_VF)
+			pthread_mutex_unlock(&adapter->hw.vsi_lock);
 		dev->data->rx_queue_state[rx_ring->index] =
 			       RTE_ETH_QUEUE_STATE_STARTED;
 	} else {
@@ -1133,11 +1145,21 @@ enetc4_rx_queue_start(struct rte_eth_dev *dev, uint16_t qidx)
 	PMD_INIT_FUNC_TRACE();
 	rx_ring = dev->data->rx_queues[qidx];
 	if (dev->data->rx_queue_state[qidx] == RTE_ETH_QUEUE_STATE_STOPPED) {
+		if (priv->hw.device_id == ENETC4_DEV_ID_VF)
+			pthread_mutex_lock(&priv->hw.vsi_lock);
 		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_relaxed))
+			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);
+		if (priv->hw.device_id == ENETC4_DEV_ID_VF)
+			pthread_mutex_unlock(&priv->hw.vsi_lock);
 		dev->data->rx_queue_state[qidx] = RTE_ETH_QUEUE_STATE_STARTED;
 	}
 
@@ -1155,11 +1177,15 @@ enetc4_rx_queue_stop(struct rte_eth_dev *dev, uint16_t qidx)
 	PMD_INIT_FUNC_TRACE();
 	rx_ring = dev->data->rx_queues[qidx];
 	if (dev->data->rx_queue_state[qidx] == RTE_ETH_QUEUE_STATE_STARTED) {
+		if (priv->hw.device_id == ENETC4_DEV_ID_VF)
+			pthread_mutex_lock(&priv->hw.vsi_lock);
 		rx_data = enetc4_rxbdr_rd(&priv->hw.hw, rx_ring->index,
 					 ENETC_RBMR);
 		rx_data = rx_data & (~ENETC_RBMR_EN);
 		enetc4_rxbdr_wr(&priv->hw.hw, rx_ring->index, ENETC_RBMR,
 			       rx_data);
+		if (priv->hw.device_id == ENETC4_DEV_ID_VF)
+			pthread_mutex_unlock(&priv->hw.vsi_lock);
 		dev->data->rx_queue_state[qidx] = RTE_ETH_QUEUE_STATE_STOPPED;
 	}
 
drivers/net/enetc/enetc4_vf.c +67 -3

98 lines not on this page · raw message

Signature · 1 line
2.25.1
#174 lore raw

PATCH v11 15/15 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              |  4 ++
 drivers/net/enetc/enetc4_ethdev.c      | 97 ++++++++++++++++++++------
 drivers/net/enetc/enetc4_vf.c          |  2 +
 6 files changed, 101 insertions(+), 20 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 f287390db7..2be5357af3 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..3065c16e5c 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		0x70
+#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		0x7
 
 /* Port regs, offset: 1_0000h */
 #define ENETC_PORT_BASE			0x10000
drivers/net/enetc/enetc.h +4 -0
index c528d21b73..925ba22af6 100644
@@ -53,6 +53,9 @@
 /* size for marking hugepage non-cacheable */
 #define SIZE_2MB	0x200000
 
+#define ENETC4_TXQ_PRIORITIES	"enetc4_txq_prior"
+#define ENETC4_TXQ_WRR		"enetc4_txq_wrr"
+
 #define ENETC_TXBD(BDR, i) (&(((struct enetc_tx_bd *)((BDR).bd_base))[i]))
 #define ENETC_RXBD(BDR, i) (&(((union enetc_rx_bd *)((BDR).bd_base))[i]))
 
@@ -135,6 +138,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 +77 -20

168 lines not on this page · raw message

drivers/net/enetc/enetc4_vf.c +2 -0
index 641feabae4..c03110634d 100644
@@ -2199,5 +2199,7 @@ RTE_PMD_REGISTER_PARAM_STRING(net_enetc4_vf,
 			      ENETC4_VSI_TIMEOUT "=<uint> "
 			      ENETC4_VSI_DELAY "=<uint> "
 			      ENETC4_NC_MEMORY "=<int> "
+			      ENETC4_TXQ_PRIORITIES "=<string> "
+			      ENETC4_TXQ_WRR "=<string> "
 			      ENETC_VF_LINK_LEGACY "=<0|1>");
 RTE_LOG_REGISTER_DEFAULT(enetc4_vf_logtype_pmd, NOTICE);
Signature · 1 line
2.25.1
#175 lore raw

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

In reply to Gagandeep Singh
Quoted 122 lines · On Wed, 19 Aug 2026 11:04:00 +0530 Gagandeep Singh <[email protected]> wrote:

V11-Changes:
- Added enetc4_vf.ini for VF only features.
- Fixed the secondary-process guards leave the burst function pointers NULL
- Fixed rxq_info_get and txq_info_get report the doubled ring size
- Move the VFs only features to enetc4_vf.ini
- Setting the dev->data->lro
- Added a comment to use devargs to change delay and timeout to process PSI message to avoid any interrupts stall.
- Fixed link_update() now rewrites RBMR on every Rx ring.
- Regestering - enetc4_txq_wr in VF
- Updated enetc4_rd64 with re-read to confirm the correctness.
- Removed the dead code and un-used macros.
- Added Vlan check for maximum allowed value.
- fixed pre-existing ring write function for TX path.

V10-Changes:
- Fixed enetc4_txq_prior and enetc4_txq_wrr have no effect at queue setup issue.
- Updated ENETC_CLASS_ID_SI_VLAN_ISO reply check.
- Updated enetc4.ini for VLAN offload.
- Added else part for burst functions selection for RSC and TSO.
- Updated enetc4_rd64()
- Fixed RBICR0 issue.
- Removed GENMASK.

V9-Changes:
- Mid-body variable declaration moved to top of the function.
- ret=0 dead code is removed.
- Added check on return value of rte_intr_callback_unregister()
- The pre-existing reply_msg leak fixed.
- Added primary-process guard in enetc4_vf_dev_init
- Removed Flow control from enetc4.ini
- Fixed VF stats_reset baseline underflows on counter wrap
- Fixed VF vlan_pvid_set fails on every successful command

V8-changes:
- Fixed Warning RBMR RMW races between threads by adding lock
- Fixed static const arrays in enetc.h
- Proper pthread_mutexattr_t initialization added as suggested by AI
- VSIMSGSR stale re-read race is eliminated

V7-changes:
- added missing 14th patch.

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 (15):
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: add VF supported features file 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 14 lines
 MAINTAINERS                            |   1 +
 doc/guides/nics/enetc4.rst             | 100 +++
 doc/guides/nics/features/enetc4.ini    |   4 +
 doc/guides/nics/features/enetc4_vf.ini |  29 +
 doc/guides/rel_notes/release_26_11.rst |  21 +
 drivers/net/enetc/base/enetc4_hw.h     | 148 +++-
 drivers/net/enetc/base/enetc_hw.h      |   6 +
 drivers/net/enetc/enetc.h              | 133 +++-
 drivers/net/enetc/enetc4_ethdev.c      | 517 ++++++++++++--
 drivers/net/enetc/enetc4_vf.c          | 919 ++++++++++++++++++++++---
 drivers/net/enetc/enetc_rxtx.c         | 530 +++++++++++++-
 11 files changed, 2223 insertions(+), 185 deletions(-)
 create mode 100644 doc/guides/nics/features/enetc4_vf.ini

Almost there, just a few small bits of AI review.

ENETC4 v11 series review - 15 patches

No Reviewed-by, but this is close. Everything reported against v10 is addressed and nothing new is broken; what remains is four documentation/state-hygiene warnings and no errors. Applied cleanly onto c1a46b9. Built this time: full driver build with -Dwerror=true -Denable_drivers=common/dpaax,bus/pci,bus/vdev, mempool/ring,net/enetc is clean, and all five enetc translation units compile with no diagnostics at every one of the 15 commits, so the series bisects.

Fixed from v10

The features matrix is split. enetc4_vf.ini is a new file added in patch 05 with only the entries that hold at that point; FW version, Registers dump and Rx interrupt are added by the later patches that implement them, so doc and code land together. "Rx interrupt" and "FW version" are out of enetc4.ini, and MAINTAINERS covers the new file.

rxq_info_get and txq_info_get divide by two when rsc_enable / lso_enable is set, so the application gets back the descriptor count it asked for. enetc4_rd64() reads high / low / high again and retries on a carry. enetc4_dev_configure() resets the Tx rings with enetc4_txbdr_wr() instead of enetc4_rxbdr_wr(), which also fixes the pre-existing bug where the Tx rings were never reset. enetc4_vf_set_congestion_mode() returns early when tx_pause_active already matches, so link_update() no longer rewrites RBMR on every poll. Both pvid setters range-check vlan_id. enetc4_txq_prior and enetc4_txq_wrr are in the VF param string. ENETC4_TXBD_EXT_FLAGS_F and ENETC_SPEED_MAX are gone, the rsc_size == 0 fallback is gone, and the BDR register arrays carry explicit dimensions in both the declaration and the definition so a drift becomes a compile error.

ENETC_CLASS_ID_SI_VLAN_ISO is out of the enetc4_msg_vsi_send() whitelist, which is now consistent with the reply handling in enetc4_vf_vlan_pvid_set() and with your explanation that 0x24 is never echoed back.

The 200 ms interrupt-thread stall is documented rather than changed. That is a reasonable call, and the devarg names in the new comment ("enetc4_vsi_timeout", "enetc4_vsi_delay") do match the macros, so the advice is actionable.

RSC now refuses to start unless the application asked for RTE_ETH_RX_OFFLOAD_SCATTER, and sets dev->data->lro and dev->data->scattered_rx. That closes the gap where the driver built multi-segment clusters for an application that had not opted in.

Warnings

Patch 09 - the secondary-process burst pointers still do not match what the primary is running.

The NULL dereference is gone, which was the point. But both branches hardcode enetc_recv_pkts_cacheable / enetc_xmit_pkts_cacheable, and the comment claims this "matches the pre-guard behaviour where enetc4_dev_hw_init() set these defaults in both processes". It does
not: dev_hw_init() parses the nc devarg and switches to enetc_recv_pkts_nc / enetc_xmit_pkts_nc when nc_mode is set, and the guard returns before that.

For nc the mismatch is the harmless direction. For RSC and LSO it is
not: those rings are 2 slots per descriptor, and a secondary polling one with the 16-byte-stride cacheable burst reads the extension half as a descriptor. That is silent garbage rather than a crash.

hw->nc_mode lives in dev_private, which is shared, so the secondary can at least honour it. RSC and LSO cannot be resolved at probe time, since they come from offloads chosen later by the primary. If multi-process is meant to work here, the burst selection needs to happen after the primary has configured; if it is not, saying so in enetc4.rst and rejecting LRO/TSO in that case would be clearer than handing the secondary a burst function for the wrong ring layout.

Patch 03 - the new RSC restrictions are not in enetc4.rst.

enetc4_rx_queue_setup() now returns -EINVAL for LRO in three cases:
with KEEP_CRC, with nc=1, and without RTE_ETH_RX_OFFLOAD_SCATTER. The guide documents only the first. An application that enables LRO without SCATTER now fails queue setup with no hint in the docs; both of the new conditions belong in the LRO bullet next to the FCS one.

Patch 03 - dev->data->lro and dev->data->scattered_rx are set but never cleared.

Both are assigned 1 in enetc4_rx_queue_setup() when RSC is on, and nothing assigns 0 anywhere. After dev_stop plus a reconfigure without LRO, they keep the stale value, so rxq_info_get() reports scattered_rx = 1 on a non-scattered ring and telemetry reports lro = 1 for a port that is not doing LRO. Assign from rsc_enable unconditionally rather than only in the rsc_enable branch, or clear both in dev_configure().

Patch 05 - two entries in the new enetc4_vf.ini do not hold.

"Unicast MAC filter" requires mac_addr_set, mac_addr_add and mac_addr_remove per features.rst; enetc4_vf_ops has the first two and no mac_addr_remove. "RSS hash" lists offloads:RTE_ETH_RX_OFFLOAD_RSS_HASH, which is not in the VF dev_rx_offloads_sup, though flow_type_rss_offloads is provided. Both were inherited from enetc4.ini, so they are not new claims, but a new file is the right moment to drop the ones that do not match.

Info

doc/guides/nics/enetc4.rst line 167 still has

dpdk-testpmd -a 0000:00:00.0,enetc4_txq_prior=1|2|3 -- -i

Unquoted, the shell reads the pipes as a pipeline. Pre-existing, but the enetc4_txq_wrr example added twelve lines below quotes its value, so the two now disagree on the same page.

Acked-by on the v11 series
#176 lore raw

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

In reply to Gagandeep Singh

Series-

Quoted 136 lines · Gagandeep Singh

V11-Changes:
- Added enetc4_vf.ini for VF only features.
- Fixed the secondary-process guards leave the burst function pointers NULL
- Fixed rxq_info_get and txq_info_get report the doubled ring size
- Move the VFs only features to enetc4_vf.ini
- Setting the dev->data->lro
- Added a comment to use devargs to change delay and timeout to process PSI message to avoid any interrupts stall.
- Fixed link_update() now rewrites RBMR on every Rx ring.
- Regestering - enetc4_txq_wr in VF
- Updated enetc4_rd64 with re-read to confirm the correctness.
- Removed the dead code and un-used macros.
- Added Vlan check for maximum allowed value.
- fixed pre-existing ring write function for TX path.

V10-Changes:
- Fixed enetc4_txq_prior and enetc4_txq_wrr have no effect at queue setup issue.
- Updated ENETC_CLASS_ID_SI_VLAN_ISO reply check.
- Updated enetc4.ini for VLAN offload.
- Added else part for burst functions selection for RSC and TSO.
- Updated enetc4_rd64()
- Fixed RBICR0 issue.
- Removed GENMASK.

V9-Changes:
- Mid-body variable declaration moved to top of the function.
- ret=0 dead code is removed.
- Added check on return value of rte_intr_callback_unregister()
- The pre-existing reply_msg leak fixed.
- Added primary-process guard in enetc4_vf_dev_init
- Removed Flow control from enetc4.ini
- Fixed VF stats_reset baseline underflows on counter wrap
- Fixed VF vlan_pvid_set fails on every successful command

V8-changes:
- Fixed Warning RBMR RMW races between threads by adding lock
- Fixed static const arrays in enetc.h
- Proper pthread_mutexattr_t initialization added as suggested by AI
- VSIMSGSR stale re-read race is eliminated

V7-changes:
- added missing 14th patch.

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 (15):
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: add VF supported features file 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

  MAINTAINERS                            |   1 +
  doc/guides/nics/enetc4.rst             | 100 +++
  doc/guides/nics/features/enetc4.ini    |   4 +
  doc/guides/nics/features/enetc4_vf.ini |  29 +
  doc/guides/rel_notes/release_26_11.rst |  21 +
  drivers/net/enetc/base/enetc4_hw.h     | 148 +++-
  drivers/net/enetc/base/enetc_hw.h      |   6 +
  drivers/net/enetc/enetc.h              | 133 +++-
  drivers/net/enetc/enetc4_ethdev.c      | 517 ++++++++++++--
  drivers/net/enetc/enetc4_vf.c          | 919 ++++++++++++++++++++++---
  drivers/net/enetc/enetc_rxtx.c         | 530 +++++++++++++-
  11 files changed, 2223 insertions(+), 185 deletions(-)

create mode 100644 doc/guides/nics/features/enetc4_vf.ini

#177 lore raw

v12 cover et/enetc: add new features for ENETC4 on i.MX95

In reply to Gagandeep Singh

V12-Changes:
- Fixed documentation for:
- missing double quotes for enetc4_txq_prior
- In accurate comment related to secondary process burst functions.
- Added a note related to LRO and its BD size chosen.
- Fixed secondary process burst functions selection.
- Removed "Unicast MAC filter" from vf, but comment regarding "RSS hash" is false positive as or RSS hash, the only mandatory requirement is [provides] rte_eth_dev_info: flow_type_rss_offloads , which the VF sets in enetc4_vf_dev_infos_get (dev_info->flow_type_rss_offloads = ENETC_RSS_OFFLOAD_ALL`).
- Fixed lro and scattered_rx configuration by enabling only after rsc_enable branch.

V11-Changes:
- Added enetc4_vf.ini for VF only features.
- Fixed the secondary-process guards leave the burst function pointers NULL
- Fixed rxq_info_get and txq_info_get report the doubled ring size
- Move the VFs only features to enetc4_vf.ini
- Setting the dev->data->lro
- Added a comment to use devargs to change delay and timeout to process PSI message to avoid any interrupts stall.
- Fixed link_update() now rewrites RBMR on every Rx ring.
- Regestering - enetc4_txq_wr in VF
- Updated enetc4_rd64 with re-read to confirm the correctness.
- Removed the dead code and un-used macros.
- Added Vlan check for maximum allowed value.
- fixed pre-existing ring write function for TX path.

V10-Changes:
- Fixed enetc4_txq_prior and enetc4_txq_wrr have no effect at queue setup issue.
- Updated ENETC_CLASS_ID_SI_VLAN_ISO reply check.
- Updated enetc4.ini for VLAN offload.
- Added else part for burst functions selection for RSC and TSO.
- Updated enetc4_rd64()
- Fixed RBICR0 issue.
- Removed GENMASK.

V9-Changes:
- Mid-body variable declaration moved to top of the function.
- ret=0 dead code is removed.
- Added check on return value of rte_intr_callback_unregister()
- The pre-existing reply_msg leak fixed.
- Added primary-process guard in enetc4_vf_dev_init
- Removed Flow control from enetc4.ini
- Fixed VF stats_reset baseline underflows on counter wrap
- Fixed VF vlan_pvid_set fails on every successful command

V8-changes:
- Fixed Warning RBMR RMW races between threads by adding lock
- Fixed static const arrays in enetc.h
- Proper pthread_mutexattr_t initialization added as suggested by AI
- VSIMSGSR stale re-read race is eliminated

V7-changes:
- added missing 14th patch.

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 (15):
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: add VF supported features file 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

 MAINTAINERS                            |   1 +
 doc/guides/nics/enetc4.rst             | 114 ++-
 doc/guides/nics/features/enetc4.ini    |   4 +
 doc/guides/nics/features/enetc4_vf.ini |  28 +
 doc/guides/rel_notes/release_26_11.rst |  21 +
 drivers/net/enetc/base/enetc4_hw.h     | 148 +++-
 drivers/net/enetc/base/enetc_hw.h      |   6 +
 drivers/net/enetc/enetc.h              | 133 +++-
 drivers/net/enetc/enetc4_ethdev.c      | 527 ++++++++++++--
 drivers/net/enetc/enetc4_vf.c          | 928 ++++++++++++++++++++++---
 drivers/net/enetc/enetc_rxtx.c         | 530 +++++++++++++-
 11 files changed, 2254 insertions(+), 186 deletions(-)
 create mode 100644 doc/guides/nics/features/enetc4_vf.ini
Signature · 1 line
2.25.1
#178 lore raw

PATCH v12 1/15 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
#179 lore raw

PATCH v12 2/15 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     |  32 ++-
 drivers/net/enetc/enetc.h              |   3 +
 drivers/net/enetc/enetc4_ethdev.c      |  54 +++++-
 drivers/net/enetc/enetc4_vf.c          |   2 +
 drivers/net/enetc/enetc_rxtx.c         | 257 +++++++++++++++++++++++++
 8 files changed, 347 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 +31 -1
index c81ac00ec6..d7e36163f6 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,31 @@ 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)
+
+/* 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 +50 -4

91 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
#180 lore raw

PATCH v12 3/15 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             |   6 +
 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      | 127 +++++++++++++-
 drivers/net/enetc/enetc4_vf.c          |   1 +
 drivers/net/enetc/enetc_rxtx.c         | 234 +++++++++++++++++++++++++
 8 files changed, 444 insertions(+), 6 deletions(-)
doc/guides/nics/enetc4.rst +6 -0
index 4d27e4048e..141fe0486d 100644
@@ -55,6 +55,12 @@ 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. RSC also requires the SCATTER Rx offload
+  (coalesced frames span multiple buffers) and is not supported with the
+  ``nc=1`` non-cacheable descriptor ring mode.
 
 
 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 +121 -6

192 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
#181 lore raw

PATCH v12 4/15 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.

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              |  30 +++-
 drivers/net/enetc/enetc4_vf.c          | 202 +++++++++++++++++++++----
 4 files changed, 213 insertions(+), 33 deletions(-)
doc/guides/nics/enetc4.rst +11 -0
index 141fe0486d..d2839d517f 100644
@@ -135,6 +135,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 +25 -5
index 145ebbbb00..39a07df59d 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,27 @@ 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
+	/* 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 resulting SPEED
+	 * must fit in the 8-bit speed code field (0x0 to 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
#182 lore raw

PATCH v12 5/15 net/enetc: add VF supported features file

In reply to Gagandeep Singh

The upcoming VF-specific feature work needs its own supported-features documentation, separate from the PF (enetc4). Add a dedicated enetc4_vf.ini for the net_enetc4_vf PMD so that VF-only features can be tracked independently, and reference it in MAINTAINERS.

---
 MAINTAINERS                            |  1 +
 doc/guides/nics/features/enetc4_vf.ini | 25 +++++++++++++++++++++++++
 2 files changed, 26 insertions(+)
 create mode 100644 doc/guides/nics/features/enetc4_vf.ini
MAINTAINERS +1 -0
index e99a65d197..8f64a7b3ed 100644
@@ -995,6 +995,7 @@ F: doc/guides/nics/enetc.rst
 F: doc/guides/nics/enetc4.rst
 F: doc/guides/nics/features/enetc.ini
 F: doc/guides/nics/features/enetc4.ini
+F: doc/guides/nics/features/enetc4_vf.ini
 
 NXP enetfec - EXPERIMENTAL
 M: Apeksha Gupta <[email protected]>
doc/guides/nics/features/enetc4_vf.ini new file +25 -0
new file mode 100644
index 0000000000..9107c8ede5
@@ -0,0 +1,25 @@
+;
+; Supported features of the 'enetc4_vf' network poll mode driver.
+;
+; Refer to default.ini for the full list of available PMD features.
+;
+[Features]
+Link status event    = Y
+Speed capabilities   = Y
+Link status          = Y
+LRO                  = Y
+TSO                  = Y
+Promiscuous mode     = Y
+Allmulticast mode    = Y
+VLAN filter          = Y
+RSS hash             = Y
+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
+ARMv8                = Y
+Usage doc            = Y
Signature · 1 line
2.25.1
#183 lore raw

PATCH v12 6/15 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_vf.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 d2839d517f..9ca36c6a17 100644
@@ -61,6 +61,7 @@ Key functionality includes:
   with the KEEP_CRC Rx offload. RSC also requires the SCATTER Rx offload
   (coalesced frames span multiple buffers) and is not supported with the
   ``nc=1`` non-cacheable descriptor ring mode.
+- Firmware version: The NETC IP version is reported via ``rte_eth_dev_fw_version_get``.
 
 
 Prerequisites
doc/guides/nics/features/enetc4_vf.ini +1 -0
index 9107c8ede5..45d2827e98 100644
@@ -15,6 +15,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 39a07df59d..46804a05ba 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,
@@ -271,6 +281,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
#184 lore raw

PATCH v12 7/15 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/nics/features/enetc4_vf.ini |  1 +
 doc/guides/rel_notes/release_26_11.rst |  1 +
 drivers/net/enetc/enetc.h              |  4 ++
 drivers/net/enetc/enetc4_ethdev.c      | 88 ++++++++++++++++++++++++++
 drivers/net/enetc/enetc4_vf.c          | 62 ++++++++++++++++++
 7 files changed, 158 insertions(+)
doc/guides/nics/enetc4.rst +1 -0
index 9ca36c6a17..9e32c525f5 100644
@@ -62,6 +62,7 @@ Key functionality includes:
   (coalesced frames span multiple buffers) and is not supported with the
   ``nc=1`` non-cacheable descriptor ring mode.
 - 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 aae398e210..a427c68344 100644
@@ -16,6 +16,7 @@ VLAN filter          = Y
 RSS hash             = Y
 Packet type parsing  = Y
 Basic stats          = Y
+Registers dump       = Y
 L3 checksum offload  = Y
 L4 checksum offload  = Y
 CRC offload          = Y
doc/guides/nics/features/enetc4_vf.ini +1 -0
index 45d2827e98..edbdb48eb2 100644
@@ -16,6 +16,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 +4 -0
index 46804a05ba..02b935ad8e 100644
@@ -393,6 +393,10 @@ enetc_bd_unused(struct enetc_bdr *bdr)
 	return bdr->bd_count + bdr->next_to_clean - bdr->next_to_use - 1;
 }
 
+/* Per-ring BDR registers dumped by .get_reg (shared by PF and VF) */
+extern const uint32_t enetc4_txbdr_regs[6];
+extern const uint32_t enetc4_rxbdr_regs[8];
+
 /* 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 +88 -0

106 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