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

lore
Share & tools
lore
#185 lore raw

PATCH v12 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 919400b170..790fa910d5 100644
@@ -1165,7 +1165,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)
 {
@@ -1173,19 +1173,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
#186 lore raw

PATCH v12 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/nics/enetc4.rst             |  10 +
 doc/guides/rel_notes/release_26_11.rst |   1 +
 drivers/net/enetc/enetc.h              |   2 +
 drivers/net/enetc/enetc4_ethdev.c      |  26 ++
 drivers/net/enetc/enetc4_vf.c          | 350 ++++++++++++++-----------
 5 files changed, 240 insertions(+), 149 deletions(-)
doc/guides/nics/enetc4.rst +10 -0
index 9e32c525f5..ff694dd040 100644
@@ -64,6 +64,16 @@ Key functionality includes:
 - 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``.
 
+.. note::
+
+   The LRO (RSC) and TSO (LSO) offloads use a doubled 32B buffer descriptor
+   ring layout that the primary process selects only during queue setup. A
+   secondary process cannot observe that per-queue choice and always uses the
+   base descriptor stride, so running the Rx/Tx datapath from a secondary
+   process is not supported when LRO or TSO is enabled. The ``nc=1``
+   non-cacheable ring mode is stored in shared memory and is honoured by the
+   secondary.
+
 
 Prerequisites
 -------------
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 +26 -0
index 790fa910d5..bc0c58e97a 100644
@@ -882,6 +882,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);
 	}
@@ -1368,7 +1369,32 @@ 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 pointers must also be set here or
+		 * rte_eth_rx_burst()/rte_eth_tx_burst() would dereference NULL.
+		 * hw->nc_mode lives in the shared dev_private and has already
+		 * been set by the primary, so honour it to match the base BD
+		 * ring layout. The RSC (LRO) and LSO (TSO) bursts use doubled
+		 * 32B descriptor rings that the primary selects only at queue
+		 * setup; the secondary cannot observe that choice, so it always
+		 * uses the base (nc or cacheable) burst. Running the Rx/Tx
+		 * datapath from a secondary is therefore not supported when LRO
+		 * or TSO is enabled (see the ENETC4 NIC guide).
+		 */
+		if (hw->nc_mode) {
+			eth_dev->rx_pkt_burst = &enetc_recv_pkts_nc;
+			eth_dev->tx_pkt_burst = &enetc_xmit_pkts_nc;
+		} else {
+			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 +201 -149

577 lines not on this page · raw message

Signature · 1 line
2.25.1
#187 lore raw

PATCH v12 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
#188 lore raw

PATCH v12 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 ff694dd040..dff12919fc 100644
@@ -61,6 +61,10 @@ 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.
+- 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``.
 
@@ -179,3 +183,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 edbdb48eb2..4ef2b9b9ba 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 bc0c58e97a..5280804423 100644
@@ -879,7 +879,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);
@@ -1002,12 +1003,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
#189 lore raw

PATCH v12 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 dff12919fc..6c71108de6 100644
@@ -67,6 +67,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.
 
 .. note::
 
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
#190 lore raw

PATCH v12 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 d2999b4547..fbb74c39bc 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
#191 lore raw

PATCH v12 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 c3a5d683be..ad6f5f4337 100644
@@ -752,10 +752,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 {
@@ -1134,11 +1146,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;
 	}
 
@@ -1156,11 +1178,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
#192 lore raw

PATCH v12 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             | 14 +++-
 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, 102 insertions(+), 21 deletions(-)
doc/guides/nics/enetc4.rst +13 -1
index 6c71108de6..64094c00a6 100644
@@ -176,7 +176,19 @@ PF/Common devargs
 
   Usage example::
 
-    dpdk-testpmd -a 0000:00:00.0,enetc4_txq_prior=1|2|3 -- -i
+    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).
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 a93aa20b49..6eb1e5d760 100644
@@ -2208,5 +2208,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
#193 lore raw

Re: [PATCH v12 15/15] net/enetc4: add WRR Tx scheduler devarg for VF rings

Review parse_txq_prior(const char *key __rte_unused, const char *value, void *opaque) · line 81

Quoted 12 lines · On Fri, 21 Aug 2026 11:26:43 +0530 Gagandeep Singh <[email protected]> wrote:
(quoted diff) +7 -1
@@ -71,7 +72,46 @@ parse_txq_prior(const char *key __rte_unused, const char *value, void *opaque)
 
 	str = strtok(input_str, "|");
 	while (str != NULL && i < hw->max_tx_queues) {
-		hw->txq_prior[i++] = (uint32_t)atoi(str);
+		hw->txq_prior[i++] = atoi(str) & ENETC_TBMR_PRIO_MASK;
+		str = strtok(NULL, "|");
+	}
+
+	free(input_str);
+	return 0;
+}

The arg parsing in this driver has lots of usage of functions that are on the naughty list like: atoi, atof, and strtok.

Suggest reworking this to use strtok_r and strtoul and strtod.

Not a fan of so many nerd knobs either. These kind of queue configurations really need to be under ethdev but that is more work.

Something like this?

drivers/net/enetc/enetc4_ethdev.c +175 -81
index bb579a0b90..3e13542302 100644
@@ -2,7 +2,9 @@
  * Copyright 2024-2026 NXP
  */
 
+#include <errno.h>
 #include <stdbool.h>
+#include <stdlib.h>
 #include <rte_kvargs.h>
 #include <rte_random.h>
 #include <dpaax_iova_table.h>
@@ -49,85 +51,172 @@ static uint64_t dev_tx_offloads_sup =
 
 #define ENETC4_NC_MEMORY	"nc"
 
+/* Tx ring WRR weight range; ENETC_TBMR_WRR() encodes it as (weight - 1). */
+#define ENETC4_TXQ_WRR_MIN	1
+#define ENETC4_TXQ_WRR_MAX	8
+
+static const char * const enetc4_valid_args[] = {
+	ENETC4_TXQ_PRIORITIES,
+	ENETC4_TXQ_WRR,
+	ENETC4_NC_MEMORY,
+	NULL,
+};
+
+/*
+ * Parse one unsigned decimal value, rejecting empty strings, signs, trailing
+ * garbage and values outside [min, max]. atoi() reports none of these: it
+ * returns 0 for any non-numeric string and is undefined on overflow.
+ */
 static int
-parse_txq_prior(const char *key __rte_unused, const char *value, void *opaque)
+enetc4_parse_uint(const char *str, uint32_t min, uint32_t max, uint32_t *val)
 {
-	struct rte_eth_dev *dev = (struct rte_eth_dev *)opaque;
-	struct enetc_eth_hw *hw =
-				ENETC_DEV_PRIVATE_TO_HW(dev->data->dev_private);
-	char *input_str;
-	char *str;
-	uint32_t i = 0;
+	unsigned long res;
+	char *endptr;
+
+	if (str == NULL || *str == '\0')
+		return -EINVAL;
+
+	/* strtoul() silently wraps a leading '-', so reject signs up front. */
+	if (*str == '-' || *str == '+')
+		return -EINVAL;
+
+	errno = 0;
+	res = strtoul(str, &endptr, 10);
+	if (errno != 0 || endptr == str || *endptr != '\0')
+		return -EINVAL;
+
+	if (res < min || res > max)
+		return -ERANGE;
+
+	*val = (uint32_t)res;
+	return 0;
+}
+
+/*
+ * Parse a "v0|v1|..." list into vals[], validating every field against
+ * [min, max]. Returns the number of values parsed, or a negative errno.
+ */
+static int
+enetc4_parse_uint_list(const char *key, const char *value, uint32_t min,
+		       uint32_t max, uint32_t *vals, uint32_t max_vals)
+{
+	char *input_str, *str, *saveptr;
+	uint32_t n = 0;
+	int ret;
+
+	if (value == NULL) {
+		ENETC_PMD_ERR("%s: missing value", key);
+		return -EINVAL;
+	}
 
 	input_str = strdup(value);
-	if (!input_str)
+	if (input_str == NULL)
 		return -ENOMEM;
 
-	rte_free(hw->txq_prior);
-	hw->txq_prior = rte_zmalloc(NULL, hw->max_tx_queues * sizeof(uint32_t), 0);
-	if (!hw->txq_prior) {
-		free(input_str);
-		return -ENOMEM;
+	for (str = strtok_r(input_str, "|", &saveptr); str != NULL;
+	     str = strtok_r(NULL, "|", &saveptr)) {
+		if (n == max_vals) {
+			ENETC_PMD_ERR("%s: too many values, at most %u supported",
+				      key, max_vals);
+			ret = -EINVAL;
+			goto out;
+		}
+
+		ret = enetc4_parse_uint(str, min, max, &vals[n]);
+		if (ret != 0) {
+			ENETC_PMD_ERR("%s: invalid value '%s' at index %u, expected %u..%u",
+				      key, str, n, min, max);
+			goto out;
+		}
+		n++;
 	}
 
-	str = strtok(input_str, "|");
-	while (str != NULL && i < hw->max_tx_queues) {
-		hw->txq_prior[i++] = atoi(str) & ENETC_TBMR_PRIO_MASK;
-		str = strtok(NULL, "|");
+	if (n == 0) {
+		ENETC_PMD_ERR("%s: empty value list", key);
+		ret = -EINVAL;
+		goto out;
 	}
 
+	ret = n;
+out:
 	free(input_str);
+	return ret;
+}
+
+/* Parse enetc4_txq_prior="p0|p1|..." devarg; priority 0..7 per ring. */
+static int
+parse_txq_prior(const char *key, const char *value, void *opaque)
+{
+	struct rte_eth_dev *dev = opaque;
+	struct enetc_eth_hw *hw =
+				ENETC_DEV_PRIVATE_TO_HW(dev->data->dev_private);
+	uint32_t *prior;
+	int ret;
+
+	prior = rte_zmalloc(NULL, hw->max_tx_queues * sizeof(uint32_t), 0);
+	if (prior == NULL)
+		return -ENOMEM;
+
+	ret = enetc4_parse_uint_list(key, value, 0, ENETC_TBMR_PRIO_MASK,
+				     prior, hw->max_tx_queues);
+	if (ret < 0) {
+		rte_free(prior);
+		return ret;
+	}
+
+	/* Only swap in the new table once the whole list is known good. */
+	rte_free(hw->txq_prior);
+	hw->txq_prior = prior;
+
 	return 0;
 }
 
 /* Parse enetc4_txq_wrr="w0|w1|..." devarg; weight 1..8 per ring. */
-static int parse_txq_wrr(const char *key __rte_unused, const char *value,
-			  void *opaque)
+static int
+parse_txq_wrr(const char *key, const char *value, void *opaque)
 {
-	struct rte_eth_dev *dev = (struct rte_eth_dev *)opaque;
+	struct rte_eth_dev *dev = opaque;
 	struct enetc_eth_hw *hw =
 			ENETC_DEV_PRIVATE_TO_HW(dev->data->dev_private);
-	char *input_str;
-	char *str;
-	uint32_t i = 0;
-	int w;
+	uint32_t *wrr;
+	int n, i;
 
-	input_str = strdup(value);
-	if (!input_str)
+	wrr = rte_zmalloc(NULL, hw->max_tx_queues * sizeof(uint32_t), 0);
+	if (wrr == NULL)
 		return -ENOMEM;
 
-	rte_free(hw->txq_wrr);
-	hw->txq_wrr = rte_zmalloc(NULL,
-			hw->max_tx_queues * sizeof(uint32_t), 0);
-	if (!hw->txq_wrr) {
-		free(input_str);
-		return -ENOMEM;
+	n = enetc4_parse_uint_list(key, value, ENETC4_TXQ_WRR_MIN,
+				   ENETC4_TXQ_WRR_MAX, wrr, hw->max_tx_queues);
+	if (n < 0) {
+		rte_free(wrr);
+		return n;
 	}
 
-	str = strtok(input_str, "|");
-	while (str != NULL && i < hw->max_tx_queues) {
-		w = atoi(str);
-		if (w < 1)
-			w = 1;
-		if (w > 8)
-			w = 8;
-		hw->txq_wrr[i++] = ENETC_TBMR_WRR(w);
-		str = strtok(NULL, "|");
-	}
+	for (i = 0; i < n; i++)
+		wrr[i] = ENETC_TBMR_WRR(wrr[i]);
+
+	/* Only swap in the new table once the whole list is known good. */
+	rte_free(hw->txq_wrr);
+	hw->txq_wrr = wrr;
 
-	free(input_str);
 	return 0;
 }
 
 static int
-parse_nc(const char *key __rte_unused, const char *value, void *extra_args)
+parse_nc(const char *key, const char *value, void *extra_args)
 {
 	struct rte_eth_dev *dev = extra_args;
 	struct enetc_eth_hw *hw =
 		ENETC_DEV_PRIVATE_TO_HW(dev->data->dev_private);
+	uint32_t val;
+
+	if (enetc4_parse_uint(value, 0, 1, &val) != 0) {
+		ENETC_PMD_ERR("%s: invalid value '%s', expected 0 or 1",
+			      key, value ? value : "(null)");
+		return -EINVAL;
+	}
 
-	if (value && atoi(value) == 1)
-		hw->nc_mode = 1;
+	hw->nc_mode = val;
 
 	return 0;
 }
@@ -135,45 +224,41 @@ parse_nc(const char *key __rte_unused, const char *value, void *extra_args)
 static int
 enetc4_get_devargs(struct rte_eth_dev *dev, const char *key)
 {
+	static const struct {
+		const char *key;
+		arg_handler_t handler;
+	} handlers[] = {
+		{ ENETC4_TXQ_PRIORITIES, parse_txq_prior },
+		{ ENETC4_TXQ_WRR,	 parse_txq_wrr	 },
+		{ ENETC4_NC_MEMORY,	 parse_nc	 },
+	};
 	struct rte_devargs *devargs = dev->device->devargs;
 	struct rte_kvargs *kvlist;
+	unsigned int i;
+	int ret = 0;
 
-	if (!devargs)
+	if (devargs == NULL)
 		return 0;
 
-	kvlist = rte_kvargs_parse(devargs->args, NULL);
-	if (!kvlist)
-		return 0;
-
-	if (!rte_kvargs_count(kvlist, key)) {
-		rte_kvargs_free(kvlist);
-		return 0;
+	/* Passing the key list makes a mistyped devarg an error, not a no-op. */
+	kvlist = rte_kvargs_parse(devargs->args, enetc4_valid_args);
+	if (kvlist == NULL) {
+		ENETC_PMD_ERR("Invalid device arguments '%s'", devargs->args);
+		return -EINVAL;
 	}
 
-	if (!strcmp(key, ENETC4_TXQ_PRIORITIES)) {
-		if (rte_kvargs_process(kvlist, key,
-				       parse_txq_prior, (void *)dev) < 0) {
-			rte_kvargs_free(kvlist);
-			return 0;
-		}
-	}
-	if (!strcmp(key, ENETC4_TXQ_WRR)) {
-		if (rte_kvargs_process(kvlist, key,
-				       parse_txq_wrr, (void *)dev) < 0) {
-			rte_kvargs_free(kvlist);
-			return 0;
-		}
-	}
-	if (!strcmp(key, ENETC4_NC_MEMORY)) {
-		if (rte_kvargs_process(kvlist, key,
-				       parse_nc, (void *)dev) < 0) {
-			rte_kvargs_free(kvlist);
-			return 0;
-		}
-	}
+	if (rte_kvargs_count(kvlist, key) == 0)
+		goto out;
 
+	for (i = 0; i < RTE_DIM(handlers); i++) {
+		if (strcmp(key, handlers[i].key) != 0)
+			continue;
+		ret = rte_kvargs_process(kvlist, key, handlers[i].handler, dev);
+		break;
+	}
+out:
 	rte_kvargs_free(kvlist);
-	return 0;
+	return ret;
 }
 
 static int
@@ -1129,9 +1214,13 @@ enetc4_dev_configure(struct rte_eth_dev *dev)
 		enetc4_txbdr_wr(enetc_hw, i, ENETC_TBMR, ENETC_BMR_RESET);
 
 	hw->nc_mode = 0;
-	enetc4_get_devargs(dev, ENETC4_TXQ_PRIORITIES);
-	enetc4_get_devargs(dev, ENETC4_TXQ_WRR);
-	enetc4_get_devargs(dev, ENETC4_NC_MEMORY);
+	ret = enetc4_get_devargs(dev, ENETC4_TXQ_PRIORITIES);
+	if (ret == 0)
+		ret = enetc4_get_devargs(dev, ENETC4_TXQ_WRR);
+	if (ret == 0)
+		ret = enetc4_get_devargs(dev, ENETC4_NC_MEMORY);
+	if (ret != 0)
+		return ret;
 
 	if (dev->data->nb_rx_queues <= 1)
 		return 0;
@@ -1538,8 +1627,13 @@ enetc4_dev_init(struct rte_eth_dev *eth_dev)
 	hw->max_rx_queues = (si_cap >> 16) & ENETC_SICAPR0_BDR_MASK;
 
 	hw->nc_mode = 0;
-	enetc4_get_devargs(eth_dev, ENETC4_TXQ_PRIORITIES);
-	enetc4_get_devargs(eth_dev, ENETC4_NC_MEMORY);
+	error = enetc4_get_devargs(eth_dev, ENETC4_TXQ_PRIORITIES);
+	if (error == 0)
+		error = enetc4_get_devargs(eth_dev, ENETC4_NC_MEMORY);
+	if (error != 0) {
+		ENETC_PMD_ERR("Invalid device arguments");
+		return error;
+	}
 	if (hw->nc_mode) {
 		eth_dev->rx_pkt_burst = &enetc_recv_pkts_nc;
 		eth_dev->tx_pkt_burst = &enetc_xmit_pkts_nc;
#194 lore raw

Re: [PATCH v12 15/15] net/enetc4: add WRR Tx scheduler devarg for VF rings

In reply to Gagandeep Singh
Quoted 23 lines · On Fri, 21 Aug 2026 11:26:43 +0530 Gagandeep Singh <[email protected]> wrote:

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"
Quoted 6 lines

# 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"

---

This is in next-net now as is, but you should fix the arg parsing code not to use unsafe string handling functions.

strtok() is not thread safe, use strtok_r() or other non-destructive parsing. atoi() and atof() except garbage and don't do out of range testing and take negative values; use strtoul() here instead. Probably should have a DPDK string function for this like rte_str_to_u32() etc; might get to doing that.

Newer version of checkpatch (in python) flags this as:

### [PATCH] net/enetc4: add WRR Tx scheduler devarg for VF rings

ERROR: [FORBIDDEN_TOKEN] Using strtok(), prefer strtok_r() (non-reentrant static state) # drivers/net/enetc/enetc4_ethdev.c:76:
+ str = strtok(NULL, "|");

ERROR: [FORBIDDEN_TOKEN] Using strtok(), prefer strtok_r() (non-reentrant static state) # drivers/net/enetc/enetc4_ethdev.c:107:
+ str = strtok(input_str, "|");

WARNING: [FORBIDDEN_TOKEN] Using atoi()/atol()/atof(), prefer strtol()/strtoul() with errno and endptr checks # drivers/net/enetc/enetc4_ethdev.c:75:
+ hw->txq_prior[i++] = atoi(str) & ENETC_TBMR_PRIO_MASK;

WARNING: [FORBIDDEN_TOKEN] Using atoi()/atol()/atof(), prefer strtol()/strtoul() with errno and endptr checks # drivers/net/enetc/enetc4_ethdev.c:109:
+ w = atoi(str);

total: 2 errors, 2 warnings, 0 checks, 102 lines checked

#195 lore raw

RE: [PATCH v12 15/15] net/enetc4: add WRR Tx scheduler devarg for VF rings

Hi,

NXP Public

Quoted 66 lines

-----Original Message-----
From: Stephen Hemminger <[email protected]>
Sent: Thursday, September 3, 2026 11:50 PM
To: Gagandeep Singh <[email protected]>
Cc: [email protected]; Hemant Agrawal <[email protected]>
Subject: Re: [PATCH v12 15/15] net/enetc4: add WRR Tx scheduler devarg for VF rings

Quoted 8 lines · On Fri, 21 Aug 2026 11:26:43 +0530 Gagandeep Singh <[email protected]> wrote:

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)

Quoted 5 lines

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

Quoted 10 lines

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"
Quoted 6 lines

# 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"

---

This is in next-net now as is, but you should fix the arg parsing code not to use unsafe string handling functions.

strtok() is not thread safe, use strtok_r() or other non-destructive parsing. atoi() and atof() except garbage and don't do out of range testing and take negative values; use strtoul() here instead. Probably should have a DPDK string function for this like rte_str_to_u32() etc; might get to doing that.

Newer version of checkpatch (in python) flags this as:

### [PATCH] net/enetc4: add WRR Tx scheduler devarg for VF rings

ERROR: [FORBIDDEN_TOKEN] Using strtok(), prefer strtok_r() (non-reentrant static state) # drivers/net/enetc/enetc4_ethdev.c:76:
+ str = strtok(NULL, "|");

ERROR: [FORBIDDEN_TOKEN] Using strtok(), prefer strtok_r() (non-reentrant static state) # drivers/net/enetc/enetc4_ethdev.c:107:
+ str = strtok(input_str, "|");

WARNING: [FORBIDDEN_TOKEN] Using atoi()/atol()/atof(), prefer strtol()/strtoul() with errno and endptr checks # drivers/net/enetc/enetc4_ethdev.c:75:
+ hw->txq_prior[i++] = atoi(str) & ENETC_TBMR_PRIO_MASK;

Quoted 5 lines

WARNING: [FORBIDDEN_TOKEN] Using atoi()/atol()/atof(), prefer strtol()/strtoul() with errno and endptr checks # drivers/net/enetc/enetc4_ethdev.c:109:
+ w = atoi(str);

total: 2 errors, 2 warnings, 0 checks, 102 lines checked

Could you please share the latest checkpatch.pl script? I tried the one from kernel v7.3-rc2, but I'm not able to reproduce or see these errors. Is there any specific command or setup required to reproduce these issues?

Also, would you like me to send v13 after fixing this, or would it be sufficient to send only the updated patch:
"net/enetc4: add WRR Tx scheduler devarg for VF rings"?

#196 lore raw

Re: [PATCH v12 15/15] net/enetc4: add WRR Tx scheduler devarg for VF rings

Quoted 4 lines · On Mon, 7 Sep 2026 09:36:11 +0000 Gagandeep Singh <[email protected]> wrote:

Could you please share the latest checkpatch.pl script? I tried the one from kernel v7.3-rc2, but I'm not able to reproduce or see these errors. Is there any specific command or setup required to reproduce these issues?

Also, would you like me to send v13 after fixing this, or would it be sufficient to send only the updated patch:
"net/enetc4: add WRR Tx scheduler devarg for VF rings"?

I use the replacement python version which since it can be in DPDK doesn't get as limited or confused by kernel only things.

Sent revised version https://patchwork.dpdk.org/project/dpdk/patch/[email protected]/

#197 lore raw

RE: [PATCH v12 15/15] net/enetc4: add WRR Tx scheduler devarg for VF rings

NXP Public

Quoted 22 lines

-----Original Message-----
From: Stephen Hemminger <[email protected]>
Sent: Monday, September 7, 2026 10:30 PM
To: Gagandeep Singh <[email protected]>
Cc: [email protected]; Hemant Agrawal <[email protected]>
Subject: Re: [PATCH v12 15/15] net/enetc4: add WRR Tx scheduler devarg for VF rings

Quoted 1 line · On Mon, 7 Sep 2026 09:36:11 +0000 Gagandeep Singh <[email protected]> wrote:

Could you please share the latest checkpatch.pl script? I tried the one from

kernel v7.3-rc2, but I'm not able to reproduce or see these errors. Is there any specific command or setup required to reproduce these issues?

Quoted 2 lines

Also, would you like me to send v13 after fixing this, or would it be sufficient to

send only the updated patch:

Quoted 1 line

"net/enetc4: add WRR Tx scheduler devarg for VF rings"?

I use the replacement python version which since it can be in DPDK doesn't get as limited or confused by kernel only things.

Quoted 9 lines

Sent revised version
https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fpatchwork
.dpdk.org%2Fproject%2Fdpdk%2Fpatch%2F20260907165808.320840-1- stephen%40networkplumber.org%2F&data=05%7C02%7CG.Singh%40nxp.com%7 Cc65cf836d3164f70fe7508df0d016c8a%7C686ea1d3bc2b4c6fa92cd99c5c30163 5%7C0%7C0%7C639243971907498721%7CUnknown%7CTWFpbGZsb3d8eyJFbX B0eU1hcGkiOnRydWUsIlYiOiIwLjAuMDAwMCIsIlAiOiJXaW4zMiIsIkFOIjoiTWFpbC IsIldUIjoyfQ%3D%3D%7C0%7C%7C%7C&sdata=REHE0nUTBV53MiaB4ALlJLFYLL ohn1ysiDyL3YhdZt4%3D&reserved=0

Ok, I have sent the V13 series after the fixes reported by this script.

#198 lore raw

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

In reply to Gagandeep Singh
Quoted 136 lines · On Fri, 21 Aug 2026 11:26:28 +0530 Gagandeep Singh <[email protected]> wrote:

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

Quoted 14 lines
 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

Much better, really close. I apologize for the AI review being so long winded, but what is complaining about now looks valid.

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.

#199 lore raw

RE: [PATCH v12 00/15] et/enetc: add new features for ENETC4 on i.MX95

Hi,

NXP Confidential

Quoted 265 lines

-----Original Message-----
From: Stephen Hemminger <[email protected]>
Sent: Friday, August 21, 2026 9:19 PM
To: Gagandeep Singh <[email protected]>
Cc: [email protected]; Hemant Agrawal <[email protected]>
Subject: Re: [PATCH v12 00/15] et/enetc: add new features for ENETC4 on i.MX95

Quoted 148 lines · On Fri, 21 Aug 2026 11:26:28 +0530 Gagandeep Singh <[email protected]> wrote:

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
Quoted 2 lines

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

Much better, really close. I apologize for the AI review being so long winded, but what is complaining about now looks valid.

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

Quoted 7 lines

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.

AI comments are on V11 series, can you please check? I have fixed the V11 issues in V12.

#200 lore raw

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

Quoted 4 lines · On Mon, 24 Aug 2026 07:52:57 +0000 Gagandeep Singh <[email protected]> wrote:

Hi,

NXP Confidential

Please fix your mail response system. This a public list so any response like is violating that statement.

#201 lore raw

RE: [PATCH v12 00/15] et/enetc: add new features for ENETC4 on i.MX95

Hi

NXP Public

Quoted 10 lines

-----Original Message-----
From: Stephen Hemminger <[email protected]>
Sent: Monday, August 24, 2026 10:11 PM
To: Gagandeep Singh <[email protected]>
Cc: [email protected]; Hemant Agrawal <[email protected]>
Subject: Re: [PATCH v12 00/15] et/enetc: add new features for ENETC4 on i.MX95

On Mon, 24 Aug 2026 07:52:57 +0000
Gagandeep Singh <[email protected]> wrote:

Quoted 7 lines
Quoted 4 lines

Hi,

NXP Confidential

Please fix your mail response system. This a public list so any response like is violating that statement.

Thanks for pointing that out, the defaults are confidential. I'll take care of that in future emails.

#202 lore raw

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

In reply to Gagandeep Singh
Quoted 5 lines · On Fri, 21 Aug 2026 11:26:28 +0530 Gagandeep Singh <[email protected]> wrote:

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.

Quoted 8 lines

- 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.

Applied to next-net

#203 lore raw

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

In reply to Gagandeep Singh
Quoted 5 lines · On Fri, 21 Aug 2026 11:26:28 +0530 Gagandeep Singh <[email protected]> wrote:

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.

Quoted 8 lines

- 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.

Applied to net-next

#204 lore raw

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

In reply to Gagandeep Singh

V13-changes:
- Fixed checkpatch issues reported by new script.

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      | 559 +++++++++++++--
 drivers/net/enetc/enetc4_vf.c          | 928 ++++++++++++++++++++++---
 drivers/net/enetc/enetc_rxtx.c         | 530 +++++++++++++-
 11 files changed, 2284 insertions(+), 188 deletions(-)
 create mode 100644 doc/guides/nics/features/enetc4_vf.ini
Signature · 1 line
2.25.1
#205 lore raw

PATCH v13 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
#206 lore raw

PATCH v13 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
#207 lore raw

PATCH v13 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
#208 lore raw

PATCH v13 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
#209 lore raw

PATCH v13 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
#210 lore raw

PATCH v13 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
#211 lore raw

PATCH v13 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
#212 lore raw

PATCH v13 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 919400b170..790fa910d5 100644
@@ -1165,7 +1165,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)
 {
@@ -1173,19 +1173,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
#213 lore raw

PATCH v13 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/nics/enetc4.rst             |  10 +
 doc/guides/rel_notes/release_26_11.rst |   1 +
 drivers/net/enetc/enetc.h              |   2 +
 drivers/net/enetc/enetc4_ethdev.c      |  26 ++
 drivers/net/enetc/enetc4_vf.c          | 350 ++++++++++++++-----------
 5 files changed, 240 insertions(+), 149 deletions(-)
doc/guides/nics/enetc4.rst +10 -0
index 9e32c525f5..ff694dd040 100644
@@ -64,6 +64,16 @@ Key functionality includes:
 - 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``.
 
+.. note::
+
+   The LRO (RSC) and TSO (LSO) offloads use a doubled 32B buffer descriptor
+   ring layout that the primary process selects only during queue setup. A
+   secondary process cannot observe that per-queue choice and always uses the
+   base descriptor stride, so running the Rx/Tx datapath from a secondary
+   process is not supported when LRO or TSO is enabled. The ``nc=1``
+   non-cacheable ring mode is stored in shared memory and is honoured by the
+   secondary.
+
 
 Prerequisites
 -------------
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 +26 -0
index 790fa910d5..bc0c58e97a 100644
@@ -882,6 +882,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);
 	}
@@ -1368,7 +1369,32 @@ 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 pointers must also be set here or
+		 * rte_eth_rx_burst()/rte_eth_tx_burst() would dereference NULL.
+		 * hw->nc_mode lives in the shared dev_private and has already
+		 * been set by the primary, so honour it to match the base BD
+		 * ring layout. The RSC (LRO) and LSO (TSO) bursts use doubled
+		 * 32B descriptor rings that the primary selects only at queue
+		 * setup; the secondary cannot observe that choice, so it always
+		 * uses the base (nc or cacheable) burst. Running the Rx/Tx
+		 * datapath from a secondary is therefore not supported when LRO
+		 * or TSO is enabled (see the ENETC4 NIC guide).
+		 */
+		if (hw->nc_mode) {
+			eth_dev->rx_pkt_burst = &enetc_recv_pkts_nc;
+			eth_dev->tx_pkt_burst = &enetc_xmit_pkts_nc;
+		} else {
+			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 +201 -149

577 lines not on this page · raw message

Signature · 1 line
2.25.1
#214 lore raw

PATCH v13 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
#215 lore raw

PATCH v13 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 ff694dd040..dff12919fc 100644
@@ -61,6 +61,10 @@ 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.
+- 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``.
 
@@ -179,3 +183,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 edbdb48eb2..4ef2b9b9ba 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 bc0c58e97a..5280804423 100644
@@ -879,7 +879,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);
@@ -1002,12 +1003,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
#216 lore raw

PATCH v13 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 dff12919fc..6c71108de6 100644
@@ -67,6 +67,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.
 
 .. note::
 
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
#217 lore raw

PATCH v13 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 d2999b4547..fbb74c39bc 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
#218 lore raw

PATCH v13 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 c3a5d683be..ad6f5f4337 100644
@@ -752,10 +752,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 {
@@ -1134,11 +1146,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;
 	}
 
@@ -1156,11 +1178,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
#219 lore raw

PATCH v13 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             |  14 ++-
 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      | 129 ++++++++++++++++++++-----
 drivers/net/enetc/enetc4_vf.c          |   2 +
 6 files changed, 132 insertions(+), 23 deletions(-)
doc/guides/nics/enetc4.rst +13 -1
index 6c71108de6..64094c00a6 100644
@@ -176,7 +176,19 @@ PF/Common devargs
 
   Usage example::
 
-    dpdk-testpmd -a 0000:00:00.0,enetc4_txq_prior=1|2|3 -- -i
+    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).
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 +107 -22

200 lines not on this page · raw message

drivers/net/enetc/enetc4_vf.c +2 -0
index a93aa20b49..6eb1e5d760 100644
@@ -2208,5 +2208,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
#220 lore raw

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

In reply to Gagandeep Singh
Quoted 122 lines · On Tue, 8 Sep 2026 11:17:21 +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 13 lines
 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      | 559 +++++++++++++--
 drivers/net/enetc/enetc4_vf.c          | 928 ++++++++++++++++++++++---
 drivers/net/enetc/enetc_rxtx.c         | 530 +++++++++++++-
 11 files changed, 2284 insertions(+), 188 deletions(-)
 create mode 100644 doc/guides/nics/features/enetc4_vf.ini

Before merging did a recheck AI review. It was mostly good (will save you the long winded version). But it did mention:

Two findings

Warning — calloc() reverted to rte_zmalloc().
Patch 15 changes the allocation that upstream
commit 662e61c3 ("net/enetc: set configurable priority to Tx rings") deliberately made calloc():

- hw->txq_prior = calloc(hw->max_tx_queues, sizeof(uint32_t));
+ hw->txq_prior = rte_zmalloc(NULL, hw->max_tx_queues * sizeof(uint32_t), 0);

and the new txq_wrr array follows suit.

These are small control-path arrays read only in tx_queue_setup() and tx_queue_start() — no hugepage memory, NUMA locality, or secondary-process access is needed. This was changed to calloc() at review request in the original series; please keep it. (The free()→rte_free() pairing is consistent within the patch, so there's no mismatch — just the wrong allocator.)

Warning — the new validation errors are swallowed. The parsers now return -EINVAL, but nothing acts on it:

+ if (!strcmp(key, ENETC4_TXQ_WRR)) {
+ if (rte_kvargs_process(kvlist, key,
+ parse_txq_wrr, (void *)dev) < 0) {
+ rte_kvargs_free(kvlist);
+ return 0;

and enetc4_dev_configure() discards the return of enetc4_get_devargs() entirely.

So enetc4_txq_wrr="2|99|1" logs an error, applies weight 2 to ring 0, leaves the rest at the zero default, and configures successfully. Entries parsed before the bad token stay live. Either free and NULL the array on the error path so nothing is applied, or propagate the failure out of dev_configure().

#221 lore raw

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

In reply to Gagandeep Singh

V14-changes:
- revert rte_zmalloc to calloc as suggested by AI.
- fixed validation issues.

V13-changes:
- Fixed checkpatch issues reported by new script.

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      | 560 +++++++++++++--
 drivers/net/enetc/enetc4_vf.c          | 928 ++++++++++++++++++++++---
 drivers/net/enetc/enetc_rxtx.c         | 530 +++++++++++++-
 11 files changed, 2286 insertions(+), 187 deletions(-)
 create mode 100644 doc/guides/nics/features/enetc4_vf.ini
Signature · 1 line
2.25.1
#222 lore raw

PATCH v14 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
#223 lore raw

PATCH v14 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
#224 lore raw

PATCH v14 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
#225 lore raw

PATCH v14 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
#226 lore raw

PATCH v14 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
#227 lore raw

PATCH v14 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
#228 lore raw

PATCH v14 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
#229 lore raw

PATCH v14 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 919400b170..790fa910d5 100644
@@ -1165,7 +1165,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)
 {
@@ -1173,19 +1173,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
#230 lore raw

PATCH v14 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/nics/enetc4.rst             |  10 +
 doc/guides/rel_notes/release_26_11.rst |   1 +
 drivers/net/enetc/enetc.h              |   2 +
 drivers/net/enetc/enetc4_ethdev.c      |  26 ++
 drivers/net/enetc/enetc4_vf.c          | 350 ++++++++++++++-----------
 5 files changed, 240 insertions(+), 149 deletions(-)
doc/guides/nics/enetc4.rst +10 -0
index 9e32c525f5..ff694dd040 100644
@@ -64,6 +64,16 @@ Key functionality includes:
 - 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``.
 
+.. note::
+
+   The LRO (RSC) and TSO (LSO) offloads use a doubled 32B buffer descriptor
+   ring layout that the primary process selects only during queue setup. A
+   secondary process cannot observe that per-queue choice and always uses the
+   base descriptor stride, so running the Rx/Tx datapath from a secondary
+   process is not supported when LRO or TSO is enabled. The ``nc=1``
+   non-cacheable ring mode is stored in shared memory and is honoured by the
+   secondary.
+
 
 Prerequisites
 -------------
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 +26 -0
index 790fa910d5..bc0c58e97a 100644
@@ -882,6 +882,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);
 	}
@@ -1368,7 +1369,32 @@ 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 pointers must also be set here or
+		 * rte_eth_rx_burst()/rte_eth_tx_burst() would dereference NULL.
+		 * hw->nc_mode lives in the shared dev_private and has already
+		 * been set by the primary, so honour it to match the base BD
+		 * ring layout. The RSC (LRO) and LSO (TSO) bursts use doubled
+		 * 32B descriptor rings that the primary selects only at queue
+		 * setup; the secondary cannot observe that choice, so it always
+		 * uses the base (nc or cacheable) burst. Running the Rx/Tx
+		 * datapath from a secondary is therefore not supported when LRO
+		 * or TSO is enabled (see the ENETC4 NIC guide).
+		 */
+		if (hw->nc_mode) {
+			eth_dev->rx_pkt_burst = &enetc_recv_pkts_nc;
+			eth_dev->tx_pkt_burst = &enetc_xmit_pkts_nc;
+		} else {
+			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 +201 -149

577 lines not on this page · raw message

Signature · 1 line
2.25.1
#231 lore raw

PATCH v14 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
#232 lore raw

PATCH v14 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 ff694dd040..dff12919fc 100644
@@ -61,6 +61,10 @@ 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.
+- 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``.
 
@@ -179,3 +183,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 edbdb48eb2..4ef2b9b9ba 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 bc0c58e97a..5280804423 100644
@@ -879,7 +879,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);
@@ -1002,12 +1003,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
#233 lore raw

PATCH v14 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 dff12919fc..6c71108de6 100644
@@ -67,6 +67,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.
 
 .. note::
 
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
#234 lore raw

PATCH v14 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 d2999b4547..fbb74c39bc 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
#235 lore raw

PATCH v14 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 c3a5d683be..ad6f5f4337 100644
@@ -752,10 +752,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 {
@@ -1134,11 +1146,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;
 	}
 
@@ -1156,11 +1178,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
#236 lore raw

PATCH v14 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             |  14 ++-
 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      | 130 +++++++++++++++++++++----
 drivers/net/enetc/enetc4_vf.c          |   2 +
 6 files changed, 134 insertions(+), 22 deletions(-)
doc/guides/nics/enetc4.rst +13 -1
index 6c71108de6..64094c00a6 100644
@@ -176,7 +176,19 @@ PF/Common devargs
 
   Usage example::
 
-    dpdk-testpmd -a 0000:00:00.0,enetc4_txq_prior=1|2|3 -- -i
+    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).
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 +109 -21

202 lines not on this page · raw message

drivers/net/enetc/enetc4_vf.c +2 -0
index a93aa20b49..6eb1e5d760 100644
@@ -2208,5 +2208,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
#237 lore raw

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

In reply to Gagandeep Singh
Quoted 143 lines · On Wed, 9 Sep 2026 11:13:55 +0530 Gagandeep Singh <[email protected]> wrote:

V14-changes:
- revert rte_zmalloc to calloc as suggested by AI.
- fixed validation issues.

V13-changes:
- Fixed checkpatch issues reported by new script.

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

Quoted 14 lines
 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      | 560 +++++++++++++--
 drivers/net/enetc/enetc4_vf.c          | 928 ++++++++++++++++++++++---
 drivers/net/enetc/enetc_rxtx.c         | 530 +++++++++++++-
 11 files changed, 2286 insertions(+), 187 deletions(-)
 create mode 100644 doc/guides/nics/features/enetc4_vf.ini

Applied to net-next