NXP ENETC driver related changes
cover NXP ENETC driver related changes
ENETC driver related changes series
Gagandeep Singh (8):
net/enetc: fix TX BD structure
net/enetc: fix TX BDs flag overwrite issue
net/enetc: fix queue initialization
net/enetc: support ESP packet type in packet parsing net/enetc: update random MAC generation code
net/enetc: add option to disable VSI messaging net/enetc: add devargs to control VSI-PSI timeout and delay net/enetc4: add cacheable BD ring support with SW cache maintenance
Vanshika Shukla (2):
net/enetc: support scatter-gather
net/enetc: set user configurable priority to TX rings
drivers/net/enetc/base/enetc_hw.h | 13 +- drivers/net/enetc/enetc.h | 28 +- drivers/net/enetc/enetc4_ethdev.c | 123 +++++++-- drivers/net/enetc/enetc4_vf.c | 159 ++++++++++-- drivers/net/enetc/enetc_ethdev.c | 26 +- drivers/net/enetc/enetc_rxtx.c | 411 ++++++++++++++++++++++++++---- 6 files changed, 649 insertions(+), 111 deletions(-)
Signature · 1 line
2.25.1
PATCH 1/10 net/enetc: fix TX BD structure
The flags field in struct enetc_tx_bd was declared as uint16_t but ENETC4 TX BDs only use an 8-bit flags byte. Fix the type to uint8_t to match the hardware descriptor layout.
--- drivers/net/enetc/base/enetc_hw.h | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-)
drivers/net/enetc/base/enetc_hw.h +3 -4
@@ -1,5 +1,5 @@/* SPDX-License-Identifier: BSD-3-Clause -* Copyright 2018-2024 NXP +* Copyright 2018-2026 NXP */ #ifndef _ENETC_HW_H_
@@ -198,8 +198,7 @@ enum enetc_bdr_type {TX, RX};#define ENETC_TX_ADDR (txq, addr) ((void *)((txq)->enetc_txbdr + (addr))) -#define ENETC_TXBD_FLAGS_IE BIT(13) -#define ENETC_TXBD_FLAGS_F BIT(15) +#define ENETC_TXBD_FLAGS_F BIT(7)/* ENETC Parsed values (Little Endian) */ #define ENETC_PARSE_ERROR 0x8000
@@ -262,7 +261,7 @@ struct enetc_tx_bd { uint8_t l3t:1; uint8_t resv:5; uint8_t l4t:3; -uint16_t flags; +uint8_t flags; };/* default layout */ uint32_t txstart;uint32_t lstatus;
Signature · 1 line
2.25.1
PATCH 2/10 net/enetc: fix TX BDs flag overwrite issue
In reply to Gagandeep SinghZero the flags field before setting offload bits and set the frame-last flag (F) after all descriptor fields are written. This prevents stale flag bits from a previous packet corrupting the current descriptor.
--- drivers/net/enetc/enetc_rxtx.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/net/enetc/enetc_rxtx.c +3 -2
@@ -1,5 +1,5 @@/* SPDX-License-Identifier: BSD-3-Clause -* Copyright 2018-2024 NXP +* Copyright 2018-2026 NXP */ #include <stdbool.h>
@@ -172,7 +172,7 @@ enetc_xmit_pkts_nc(void *tx_queue,dcbf (data + j); txbd =ENETC_TXBD (*tx_ring, i); - txbd->flags =rte_cpu_to_le_16 (ENETC4_TXBD_FLAGS_F ); + txbd->flags =0 ;if (tx_ring->q_swbd[i].buffer_addr->ol_flags &ENETC4_TX_CKSUM_OFFLOAD_MASK )enetc4_tx_offload_checksum (tx_ring->q_swbd[i].buffer_addr, txbd);
@@ -182,6 +182,7 @@ enetc_xmit_pkts_nc(void *tx_queue, txbd->addr = (uint64_t )(uintptr_t )rte_cpu_to_le_64 ((size_t )tx_swbd->buffer_addr->buf_iova + tx_swbd->buffer_addr->data_off); + txbd->flags |=rte_cpu_to_le_16 (ENETC4_TXBD_FLAGS_F ); i++; start++;if (unlikely (i == tx_ring->bd_count))
Signature · 1 line
2.25.1
PATCH 3/10 net/enetc: fix queue initialization
In reply to Gagandeep SinghHardware can misbehave if the user tries to reset the consumer and producer indexes without resetting the ring.
This patch adds the ring reset step before resetting the indexes.
--- drivers/net/enetc/enetc4_ethdev.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-)
drivers/net/enetc/enetc4_ethdev.c +11 -1
@@ -1,5 +1,5 @@/* SPDX-License-Identifier: BSD-3-Clause -* Copyright 2024 NXP +* Copyright 2024-2026 NXP */ #include <stdbool.h>
@@ -279,6 +279,7 @@ enetc4_tx_queue_setup(struct rte_eth_dev *dev, const struct rte_eth_txconf *tx_conf) {int err; +uint32_t tx_data;struct enetc_bdr *tx_ring;struct rte_eth_dev_data *data = dev->data; struct enetc_eth_adapter *priv =
@@ -301,6 +302,10 @@ enetc4_tx_queue_setup(struct rte_eth_dev *dev, goto fail; tx_ring->ndev = dev; +/* reset queue */ + tx_data =enetc4_txbdr_rd (&priv->hw.hw, tx_ring->index,ENETC_TBMR ); + tx_data &= ~ENETC_TBMR_EN ; +enetc4_txbdr_wr (&priv->hw.hw, tx_ring->index,ENETC_TBMR , tx_data);enetc4_setup_txbdr (&priv->hw.hw, tx_ring); data->tx_queues[queue_idx] = tx_ring; tx_ring->tx_deferred_start = tx_conf->tx_deferred_start;
@@ -427,6 +432,7 @@ enetc4_rx_queue_setup(struct rte_eth_dev *dev, struct rte_mempool *mb_pool) {int err =0 ; +uint32_t rx_enable;struct enetc_bdr *rx_ring;struct rte_eth_dev_data *data = dev->data; struct enetc_eth_adapter *adapter =
@@ -450,6 +456,10 @@ enetc4_rx_queue_setup(struct rte_eth_dev *dev, goto fail; rx_ring->ndev = dev; +/* reset queue */ + rx_enable =enetc4_rxbdr_rd (&adapter->hw.hw, rx_ring->index,ENETC_RBMR ); + rx_enable &= ~ENETC_RBMR_EN ; +enetc4_rxbdr_wr (&adapter->hw.hw, rx_ring->index,ENETC_RBMR , rx_enable);enetc4_setup_rxbdr (&adapter->hw.hw, rx_ring, mb_pool); data->rx_queues[rx_queue_id] = rx_ring; rx_ring->rx_deferred_start = rx_conf->rx_deferred_start;
Signature · 1 line
2.25.1
PATCH 4/10 net/enetc: support ESP packet type in packet parsing
In reply to Gagandeep SinghAdd ESP (Encapsulating Security Payload) packet type definitions and handling to the RX packet parsing path. Also update the supported ptypes array to advertise ESP tunnel type support.
--- drivers/net/enetc/base/enetc_hw.h | 4 ++++ drivers/net/enetc/enetc_ethdev.c | 4 +++- drivers/net/enetc/enetc_rxtx.c | 10 ++++++++++ 3 files changed, 17 insertions(+), 1 deletion(-)
drivers/net/enetc/base/enetc_hw.h +4 -0
@@ -226,6 +226,10 @@ enum enetc_bdr_type {TX, RX}; (0x0003 | ENETC_PKT_TYPE_IPV4)#define ENETC_PKT_TYPE_IPV6_ICMP \ (0x0003 | ENETC_PKT_TYPE_IPV6) +#define ENETC_PKT_TYPE_IPV4_ESP \ + (0x0005 | ENETC_PKT_TYPE_IPV4) +#define ENETC_PKT_TYPE_IPV6_ESP \ + (0x0005 | ENETC_PKT_TYPE_IPV6)/* PCI device info */ struct enetc_hw {
drivers/net/enetc/enetc_ethdev.c +3 -1
@@ -1,5 +1,5 @@/* SPDX-License-Identifier: BSD-3-Clause -* Copyright 2018-2024 NXP +* Copyright 2018-2026 NXP */ #include <stdbool.h>
@@ -95,6 +95,8 @@ enetc_supported_ptypes_get(struct rte_eth_dev *dev __rte_unused,RTE_PTYPE_L4_UDP ,RTE_PTYPE_L4_SCTP ,RTE_PTYPE_L4_ICMP , +RTE_PTYPE_TUNNEL_ESP , +RTE_PTYPE_UNKNOWN , }; *no_of_elements =RTE_DIM (ptypes);
drivers/net/enetc/enetc_rxtx.c +10 -0
@@ -370,6 +370,16 @@ enetc_dev_rx_parse(struct rte_mbuf *m, uint16_t parse_results)RTE_PTYPE_L3_IPV6 |RTE_PTYPE_L4_UDP ;return ; +case ENETC_PKT_TYPE_IPV4_ESP : + m->packet_type =RTE_PTYPE_L2_ETHER | +RTE_PTYPE_L3_IPV4 | +RTE_PTYPE_TUNNEL_ESP ; +return ; +case ENETC_PKT_TYPE_IPV6_ESP : + m->packet_type =RTE_PTYPE_L2_ETHER | +RTE_PTYPE_L3_IPV6 | +RTE_PTYPE_TUNNEL_ESP ; +return ;case ENETC_PKT_TYPE_IPV4_SCTP : m->packet_type =RTE_PTYPE_L2_ETHER | RTE_PTYPE_L3_IPV4 |
Signature · 1 line
2.25.1
PATCH 5/10 net/enetc: update random MAC generation code
In reply to Gagandeep SinghUse rte_eth_random_addr() instead of manual rte_rand() based MAC generation. Also handle VF path by writing to ENETC_SIPMAR0/1 instead of ENETC_PSIPMAR0/1 when running as a VF.
--- drivers/net/enetc/enetc_ethdev.c | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-)
drivers/net/enetc/enetc_ethdev.c +10 -12
@@ -196,20 +196,18 @@ enetc_hardware_init(struct enetc_eth_hw *hw) }if ((high_mac | low_mac) ==0 ) { -char *first_byte; -ENETC_PMD_NOTICE ("MAC is not available for this SI, " "set random MAC" ); - mac = (uint32_t *)hw->mac.addr; - *mac = (uint32_t )rte_rand (); - first_byte = (char *)mac; - *first_byte &=0xfe ;/* clear multicast bit */ - *first_byte |=0x02 ;/* set local assignment bit (IEEE802) */ - -enetc_port_wr (enetc_hw,ENETC_PSIPMAR0 (0 ), *mac); - mac++; - *mac = (uint16_t )rte_rand (); -enetc_port_wr (enetc_hw,ENETC_PSIPMAR1 (0 ), *mac); +rte_eth_random_addr (hw->mac.addr); + high_mac = *(uint32_t *)hw->mac.addr; + low_mac = *(uint16_t *)(hw->mac.addr +4 ); +if (hw->device_id ==ENETC_DEV_ID_VF ) { +enetc_wr (enetc_hw,ENETC_SIPMAR0 , high_mac); +enetc_wr (enetc_hw,ENETC_SIPMAR1 , low_mac); + }else { +enetc_port_wr (enetc_hw,ENETC_PSIPMAR0 (0 ), high_mac); +enetc_port_wr (enetc_hw,ENETC_PSIPMAR1 (0 ), low_mac); + }enetc_print_ethaddr ("New address: " , (const struct rte_ether_addr *)hw->mac.addr); }
Signature · 1 line
2.25.1
PATCH 6/10 net/enetc: support scatter-gather
In reply to Gagandeep SinghFrom: Vanshika Shukla <[email protected]>
Add scatter-gather support for ENETC4 PMD:
- Add ENETC_RXBD_LSTATUS_R/F bits for RX BD status
- Add ENETC4_MAX_SEGS (63) for max segments per TX packet
- Update enetc4_vf_dev_infos_get to fill nb_seg_max, offloads, max queues and packet length
- Extend enetc_xmit_pkts_nc to handle multi-segment mbufs
- Extend enetc_clean_rx_ring_nc to chain scatter-gather segments using LSTATUS_R/F bits
--- drivers/net/enetc/base/enetc_hw.h | 2 + drivers/net/enetc/enetc.h | 4 +- drivers/net/enetc/enetc4_vf.c | 46 ++++++++--- drivers/net/enetc/enetc_rxtx.c | 124 +++++++++++++++++++----------- 4 files changed, 119 insertions(+), 57 deletions(-)
drivers/net/enetc/base/enetc_hw.h +2 -0
@@ -230,6 +230,8 @@ enum enetc_bdr_type {TX, RX}; (0x0005 | ENETC_PKT_TYPE_IPV4)#define ENETC_PKT_TYPE_IPV6_ESP \ (0x0005 | ENETC_PKT_TYPE_IPV6) +#define ENETC_RXBD_LSTATUS_R BIT(30) +#define ENETC_RXBD_LSTATUS_F BIT(31)/* PCI device info */ struct enetc_hw {
drivers/net/enetc/enetc.h +3 -1
@@ -1,5 +1,5 @@/* SPDX-License-Identifier: BSD-3-Clause -* Copyright 2018-2019,2024 NXP +* Copyright 2018-2019,2024-2026 NXP */ #ifndef _ENETC_H_
@@ -28,6 +28,8 @@#define MIN_BD_COUNT 32/* BD ALIGN */ #define BD_ALIGN 8 +/* Max segments per ENETC4 TX packet (scatter-gather) */ +#define ENETC4_MAX_SEGS 63/* minimum frame size supported */ #define ENETC_MAC_MINFRM_SIZE 68
drivers/net/enetc/enetc4_vf.c +37 -9
71 lines not on this page · raw message
drivers/net/enetc/enetc_rxtx.c +77 -47
176 lines not on this page · raw message
Signature · 1 line
2.25.1
PATCH 7/10 net/enetc: add option to disable VSI messaging
In reply to Gagandeep SinghAdd devarg 'enetc4_vsi_disable' to allow disabling features dependent on VSI-PSI messaging. This is useful for testing DPDK with a PF driver that does not support VSI-PSI messages.
When the devarg is present, a reduced ops table (enetc4_vf_ops_no_vsi_m) is used that replaces link_update with a no-op stub and omits MAC/VLAN filter ops that require VSI msgs.
--- drivers/net/enetc/enetc4_vf.c | 61 +++++++++++++++++++++++++++++++++-- 1 file changed, 58 insertions(+), 3 deletions(-)
drivers/net/enetc/enetc4_vf.c +58 -3
@@ -3,11 +3,14 @@*/ #include <stdbool.h> +#include <rte_kvargs.h> #include <rte_random.h> #include <dpaax_iova_table.h> #include "enetc_logs.h" #include "enetc.h" +#define ENETC4_VSI_DISABLE "enetc4_vsi_disable" +#define ENETC_CRC_TABLE_SIZE 256#define ENETC_POLY 0x1021#define ENETC_CRC_INIT 0xffff
@@ -687,6 +690,13 @@ enetc4_vf_get_link_speed(struct rte_eth_dev *dev, struct enetc_psi_reply_msg *rereturn err; } +static int +enetc4_vf_link_update_dummy(struct rte_eth_dev *dev __rte_unused, + int wait_to_complete __rte_unused) +{ +return 0 ; +} +static int enetc4_vf_link_update(struct rte_eth_dev *dev, int wait_to_complete __rte_unused) {
@@ -1148,6 +1158,27 @@ static const struct rte_pci_id pci_vf_id_enetc4_map[] = { };/* Features supported by this driver */ +/* ops table used when VSI messaging is disabled */ +static const struct eth_dev_ops enetc4_vf_ops_no_vsi_m = { + .dev_configure = enetc4_dev_configure, + .dev_start = enetc4_vf_dev_start, + .dev_stop = enetc4_vf_dev_stop, + .dev_close = enetc4_dev_close, + .stats_get = enetc4_vf_stats_get, + .dev_infos_get = enetc4_vf_dev_infos_get, + .mtu_set = enetc4_vf_mtu_set, + .link_update = enetc4_vf_link_update_dummy, + .rx_queue_setup = enetc4_rx_queue_setup, + .rx_queue_start = enetc4_rx_queue_start, + .rx_queue_stop = enetc4_rx_queue_stop, + .rx_queue_release = enetc4_rx_queue_release, + .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, + .dev_supported_ptypes_get = enetc4_supported_ptypes_get, +}; +static const struct eth_dev_ops enetc4_vf_ops = { .dev_configure = enetc4_dev_configure, .dev_start = enetc4_vf_dev_start,
@@ -1283,7 +1314,28 @@ enetc4_vf_dev_init(struct rte_eth_dev *eth_dev)struct enetc_hw *enetc_hw = &hw->hw;PMD_INIT_FUNC_TRACE (); - eth_dev->dev_ops = &enetc4_vf_ops; + +/* check if VSI messaging should be disabled via devarg */ +if (eth_dev->device->devargs) { +struct rte_kvargs *kvlist; + + kvlist =rte_kvargs_parse (eth_dev->device->devargs->args, +NULL ); +if (kvlist) { +if (rte_kvargs_count (kvlist,ENETC4_VSI_DISABLE ) !=0 ) { +ENETC_PMD_NOTICE ("VSI messaging disabled by devarg" ); + eth_dev->dev_ops = &enetc4_vf_ops_no_vsi_m; + }else { + eth_dev->dev_ops = &enetc4_vf_ops; + } +rte_kvargs_free (kvlist); + }else { + eth_dev->dev_ops = &enetc4_vf_ops; + } + }else { + eth_dev->dev_ops = &enetc4_vf_ops; + } +enetc4_dev_hw_init (eth_dev); si_cap =enetc_rd (enetc_hw,ENETC_SICAPR0 );
@@ -1304,8 +1356,9 @@ enetc4_vf_dev_init(struct rte_eth_dev *eth_dev)ENETC_PMD_DEBUG ("port_id %d vendorID=0x%x deviceID=0x%x" , eth_dev->data->port_id, pci_dev->id.vendor_id, pci_dev->id.device_id); -/* update link */ -enetc4_vf_link_update (eth_dev,0 ); +/* update link if VSI messaging is enabled */ +if (eth_dev->dev_ops == &enetc4_vf_ops) +enetc4_vf_link_update (eth_dev,0 );return 0 ; }
@@ -1389,4 +1442,6 @@ static struct rte_pci_driver rte_enetc4_vf_pmd = {RTE_PMD_REGISTER_PCI (net_enetc4_vf, rte_enetc4_vf_pmd);RTE_PMD_REGISTER_PCI_TABLE (net_enetc4_vf, pci_vf_id_enetc4_map);RTE_PMD_REGISTER_KMOD_DEP (net_enetc4_vf,"* igb_uio | uio_pci_generic" ); +RTE_PMD_REGISTER_PARAM_STRING (net_enetc4_vf, +ENETC4_VSI_DISABLE "=<any>" );RTE_LOG_REGISTER_DEFAULT (enetc4_vf_logtype_pmd,NOTICE );
Signature · 1 line
2.25.1
PATCH 8/10 net/enetc: add devargs to control VSI-PSI timeout and delay
In reply to Gagandeep SinghAdd two new devargs for ENETC4 VF:
- enetc4_vsi_timeout: VSI-PSI message wait timeout (iteration count)
- enetc4_vsi_delay: VSI-PSI message wait delay in microseconds
Store the values in struct enetc_eth_hw and use them in enetc4_msg_vsi_send() instead of the hardcoded defaults. Fall back to ENETC4_DEF_VSI_WAIT_TIMEOUT_UPDATE / ENETC4_DEF_VSI_WAIT_DELAY_UPDATE when not set.
--- drivers/net/enetc/enetc.h | 2 ++ drivers/net/enetc/enetc4_vf.c | 54 ++++++++++++++++++++++++----------- 2 files changed, 39 insertions(+), 17 deletions(-)
drivers/net/enetc/enetc.h +2 -0
@@ -109,6 +109,8 @@ struct enetc_eth_hw {uint32_t num_rss;uint32_t max_rx_queues;uint32_t max_tx_queues; +uint32_t vsi_timeout;/* VSI-PSI message wait timeout (iterations) */ +uint32_t vsi_delay;/* VSI-PSI message wait delay (us) */ };/*
drivers/net/enetc/enetc4_vf.c +37 -17
161 lines not on this page · raw message
Signature · 1 line
2.25.1
PATCH 9/10 net/enetc: set user configurable priority to TX rings
In reply to Gagandeep SinghFrom: Vanshika Shukla <[email protected]>
Add devarg 'enetc4_txq_prior' to allow per-queue TX ring priority configuration. The value is a '|'-separated list of TBMR priority bits, one per TX queue (e.g. 'enetc4_txq_prior=1|2|3').
Store the parsed priorities in hw->txq_prior and apply them in enetc4_tx_queue_setup() when enabling the ring.
--- drivers/net/enetc/enetc.h | 1 + drivers/net/enetc/enetc4_ethdev.c | 71 ++++++++++++++++++++++++++++++- 2 files changed, 71 insertions(+), 1 deletion(-)
drivers/net/enetc/enetc.h +1 -0
@@ -111,6 +111,7 @@ struct enetc_eth_hw {uint32_t max_tx_queues;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) */ };/*
drivers/net/enetc/enetc4_ethdev.c +70 -1
101 lines not on this page · raw message
Signature · 1 line
2.25.1
PATCH 10/10 net/enetc4: add cacheable BD ring support with SW cache maintenance
In reply to Gagandeep SinghOn non-cache-coherent platforms such as i.MX95, the BD ring memory may be mapped as cacheable (normal memory) while the ENETC hardware DMA engine writes and reads descriptors without CPU cache snooping. SW must therefore perform explicit cache maintenance to keep CPU caches and DDR coherent.
TX path (enetc_xmit_pkts_cacheable):
- Flush each segment's payload cache lines to PoC (dcbf) before the BD is handed to HW, so HW DMA reads the correct data.
- After all BDs for a burst are written, flush the BD cache lines (dcbf, one per 64-byte group of 4 BDs) so HW can read the updated descriptors.
RX refill (enetc_refill_rx_ring):
- After writing each full 4-BD cache-line group, dcbf that group so HW sees the buffer addresses and cleared lstatus fields.
- Flush any partial trailing group before updating the ring tail.
RX receive (enetc_recv_pkts_cacheable via enetc_clean_rx_ring_cacheable):
- Before reading BD status, dccivac the current BD cache line so stale CPU-cached BD data is discarded and fresh HW-written content is fetched from DDR.
- After a BD is consumed, dccivac each payload cache line so the CPU reads the DMA'd packet data, not stale cached bytes.
--- drivers/net/enetc/enetc.h | 21 +++ drivers/net/enetc/enetc4_ethdev.c | 40 +++-- drivers/net/enetc/enetc_rxtx.c | 274 ++++++++++++++++++++++++++++++ 3 files changed, 320 insertions(+), 15 deletions(-)
drivers/net/enetc/enetc.h +21 -0
@@ -96,6 +96,7 @@ struct enetc_bdr {uint64_t ierrors;uint8_t rx_deferred_start;uint8_t tx_deferred_start; +uint64_t bd_base_p; };struct enetc_eth_hw {
@@ -312,8 +313,28 @@ 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_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); + +/* +* Cache-maintenance constants for cacheable BD ring mode. +* +* BD = 16 bytes, cache line = 64 bytes => 4 BDs per cache line. +* Every dcbf in enetc_refill_rx_ring() flushes a full 64-byte cache line. +* To ensure each dcbf covers only fully-written BDs the caller +* must pass a count rounded DOWN to a multiple of ENETC_BD_PER_CL so that +* the last partial group is left in cache to be completed and flushed in +* the next call. +*/ +#define ENETC_BD_PER_CL (RTE_CACHE_LINE_SIZE / sizeof(union enetc_rx_bd)) +#define ENETC_BD_PER_CL_MASK (ENETC_BD_PER_CL - 1) +/* Round n DOWN to the nearest multiple of ENETC_BD_PER_CL. */ +#define ENETC_BD_ALIGN_DOWN (n) ((n) & ~(unsigned int)ENETC_BD_PER_CL_MASK) +void enetc4_dev_hw_init (struct rte_eth_dev *eth_dev);void enetc_print_ethaddr (const char *name,const struct rte_ether_addr *eth_addr);
drivers/net/enetc/enetc4_ethdev.c +25 -15
@@ -281,12 +281,14 @@ enetc4_alloc_txbdr(struct enetc_bdr *txr, uint16_t nb_desc)int size; size = nb_desc *sizeof (struct enetc_swbd ); - txr->q_swbd =rte_malloc (NULL , size,ENETC_BD_RING_ALIGN ); +/* Zero q_swbd so buffer_addr is NULL for all uninitialized slots. */ + txr->q_swbd =rte_zmalloc (NULL , size,ENETC_BD_RING_ALIGN );if (txr->q_swbd ==NULL )return -ENOMEM ; - size = nb_desc *sizeof (struct enetc_bdr ); - txr->bd_base =rte_malloc (NULL , size,ENETC_BD_RING_ALIGN ); +/* Allocate the TX BD ring: each BD is struct enetc_tx_bd (16 bytes). */ + size = nb_desc *sizeof (struct enetc_tx_bd ); + txr->bd_base =rte_zmalloc (NULL , size,ENETC_BD_RING_ALIGN );if (txr->bd_base ==NULL ) {rte_free (txr->q_swbd); txr->q_swbd =NULL ;
@@ -441,12 +443,14 @@ enetc4_alloc_rxbdr(struct enetc_bdr *rxr, uint16_t nb_desc)int size; size = nb_desc *sizeof (struct enetc_swbd ); - rxr->q_swbd =rte_malloc (NULL , size,ENETC_BD_RING_ALIGN ); +/* Zero q_swbd so buffer_addr is NULL for all uninitialized slots. */ + rxr->q_swbd =rte_zmalloc (NULL , size,ENETC_BD_RING_ALIGN );if (rxr->q_swbd ==NULL )return -ENOMEM ; - size = nb_desc *sizeof (struct enetc_bdr ); - rxr->bd_base =rte_malloc (NULL , size,ENETC_BD_RING_ALIGN ); +/* Allocate the RX BD ring: each BD is union enetc_rx_bd (16 bytes). */ + size = nb_desc *sizeof (union enetc_rx_bd ); + rxr->bd_base =rte_zmalloc (NULL , size,ENETC_BD_RING_ALIGN );if (rxr->bd_base ==NULL ) {rte_free (rxr->q_swbd); rxr->q_swbd =NULL ;
@@ -481,7 +485,7 @@ enetc4_setup_rxbdr(struct enetc_hw *hw, struct enetc_bdr *rx_ring, rx_ring->mb_pool = mb_pool; rx_ring->rcir = (void *)((size_t )hw->reg +ENETC_BDR (RX , idx,ENETC_RBCIR )); -enetc_refill_rx_ring (rx_ring, (enetc_bd_unused (rx_ring))); +enetc_refill_rx_ring (rx_ring,ENETC_BD_ALIGN_DOWN (enetc_bd_unused (rx_ring))); buf_size = (uint16_t )(rte_pktmbuf_data_room_size (rx_ring->mb_pool) -RTE_PKTMBUF_HEADROOM );enetc4_rxbdr_wr (hw, idx,ENETC_RBBSR , buf_size);
@@ -743,12 +747,17 @@ enetc4_dev_configure(struct rte_eth_dev *dev)PMD_INIT_FUNC_TRACE (); - max_len = dev->data->dev_conf.rxmode.mtu +RTE_ETHER_HDR_LEN + -RTE_ETHER_CRC_LEN ; -enetc4_port_wr (enetc_hw,ENETC4_PM_MAXFRM (0 ),ENETC_SET_MAXFRM (max_len)); +/* Port-level register writes are PF-only; skip for VF devices */ +if (hw->device_id !=ENETC4_DEV_ID_VF ) { + max_len = dev->data->dev_conf.rxmode.mtu +RTE_ETHER_HDR_LEN + +RTE_ETHER_CRC_LEN ; +enetc4_port_wr (enetc_hw,ENETC4_PM_MAXFRM (0 ), +ENETC_SET_MAXFRM (max_len)); - val =ENETC4_MAC_MAXFRM_SIZE |SDU_TYPE_MPDU ; -enetc4_port_wr (enetc_hw,ENETC4_PTCTMSDUR (0 ), val |SDU_TYPE_MPDU ); + val =ENETC4_MAC_MAXFRM_SIZE |SDU_TYPE_MPDU ; +enetc4_port_wr (enetc_hw,ENETC4_PTCTMSDUR (0 ), + val |SDU_TYPE_MPDU ); + }/* Rx offloads which are enabled by default */ if (dev_rx_offloads_sup & ~rx_offloads) {
@@ -770,7 +779,8 @@ enetc4_dev_configure(struct rte_eth_dev *dev)if (rx_offloads & (RTE_ETH_RX_OFFLOAD_UDP_CKSUM |RTE_ETH_RX_OFFLOAD_TCP_CKSUM )) checksum &= ~L4_CKSUM ; -enetc4_port_wr (enetc_hw,ENETC4_PARCSCR , checksum); +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 ) {
@@ -1033,8 +1043,8 @@ enetc4_dev_hw_init(struct rte_eth_dev *eth_dev)ENETC_DEV_PRIVATE_TO_HW (eth_dev->data->dev_private);struct rte_pci_device *pci_dev =RTE_CLASS_TO_BUS_DEVICE (eth_dev, *pci_dev); - eth_dev->rx_pkt_burst = &enetc_recv_pkts_nc; - eth_dev->tx_pkt_burst = &enetc_xmit_pkts_nc; + eth_dev->rx_pkt_burst = &enetc_recv_pkts_cacheable; + eth_dev->tx_pkt_burst = &enetc_xmit_pkts_cacheable;/* Retrieving and storing the HW base address of device */ hw->hw.reg = (void *)pci_dev->mem_resource[0 ].addr;
drivers/net/enetc/enetc_rxtx.c +274 -0
313 lines not on this page · raw message
Signature · 1 line
2.25.1
Quoted 16 lines · On Sat, 20 Jun 2026 00:14:17 +0530 Gagandeep Singh <[email protected]> wrote:
ENETC driver related changes series
Gagandeep Singh (8):
net/enetc: fix TX BD structure
net/enetc: fix TX BDs flag overwrite issue
net/enetc: fix queue initialization
net/enetc: support ESP packet type in packet parsing net/enetc: update random MAC generation code
net/enetc: add option to disable VSI messaging net/enetc: add devargs to control VSI-PSI timeout and delay net/enetc4: add cacheable BD ring support with SW cache maintenanceVanshika Shukla (2):
net/enetc: support scatter-gather
net/enetc: set user configurable priority to TX rings
Quoted 8 lines
drivers/net/enetc/base/enetc_hw.h | 13 +- drivers/net/enetc/enetc.h | 28 +- drivers/net/enetc/enetc4_ethdev.c | 123 +++++++-- drivers/net/enetc/enetc4_vf.c | 159 ++++++++++-- drivers/net/enetc/enetc_ethdev.c | 26 +- drivers/net/enetc/enetc_rxtx.c | 411 ++++++++++++++++++++++++++---- 6 files changed, 649 insertions(+), 111 deletions(-)
The AI review shows some thing that need to be addressed before merging.
[PATCH 04/10] net/enetc: support ESP packet type
Info: enetc_supported_ptypes_get() adds RTE_PTYPE_TUNNEL_ESP and a trailing RTE_PTYPE_UNKNOWN. *no_of_elements is RTE_DIM(ptypes), so the 0 entry is counted (not used as a sentinel). It is filtered out by the mask test in rte_eth_dev_get_supported_ptypes(), so harmless, but the RTE_PTYPE_UNKNOWN line is unnecessary and should be dropped.
[PATCH 06/10] net/enetc: support scatter-gather
Warning: scatter Rx reassembly state (first_seg/cur_seg) is held in local variables and reset on every call. rx_frm_cnt only advances on the F bit, so work_limit won't cut a frame, but the "!(bd_status & LSTATUS_R)" break can exit mid-frame if HW has written the leading segments of a multi-segment frame but not yet the segment carrying F. On the next call first_seg is NULL again, next_to_clean has already advanced past the consumed leading segments, and those mbufs are leaked while the tail segments are mis-assembled as a new frame. Persist the partial chain across bursts in the ring (e.g. rx_ring->pkt_first_seg / pkt_last_seg) instead of locals. (Same pattern is reproduced in enetc_clean_rx_ring_cacheable in patch 10.)
Warning: enetc4 now advertises RTE_ETH_RX_OFFLOAD_SCATTER and RTE_ETH_TX_OFFLOAD_MULTI_SEGS (VF) but doc/guides/nics/features/ enetc4.ini is not updated (Scattered Rx / Multi segment rows).
Info: the VF dev_info now advertises L3/L4 RX checksum offload, but enetc_dev_rx_parse() unconditionally sets RTE_MBUF_F_RX_IP_CKSUM_GOOD | RTE_MBUF_F_RX_L4_CKSUM_GOOD and never reports *_BAD. With the offload now advertised, an application relying on it will never see a bad-checksum indication.
Info: dccivac(data + (data_len - 1)) / dcbf(data + (seg_len - 1)) underflow to data-1 when the segment length is 0 (uint16_t promotes to int). The preceding loop already covers the final cache line, so the extra op is redundant as well as unsafe for len==0.
[PATCH 07/10] net/enetc: add option to disable VSI messaging
Warning: new devarg "enetc4_vsi_disable" is registered but not documented in doc/guides/nics/enetc.rst.
[PATCH 08/10] net/enetc: add devargs to control VSI-PSI timeout/delay
Warning: new devargs "enetc4_vsi_timeout" / "enetc4_vsi_delay" are not documented in doc/guides/nics/enetc.rst.
[PATCH 09/10] net/enetc: set user configurable priority to TX rings
Error: hw->txq_prior is allocated in parse_txq_prior() with rte_zmalloc() but never freed. It leaks on dev_close / re-probe. Free it in the close/uninit path (and note it is re-allocated every time the handler runs, so a repeated key would leak the prior allocation too).
Warning: txq_prior is control-path, CPU-only data; rte_zmalloc() consumes hugepage memory unnecessarily. Use calloc()/malloc().
Warning: the parsed value is OR'd straight into TBMR:
tx_en |= priv->hw.txq_prior[tx_ring->index];
with no mask. ENETC_TBMR_EN is BIT(31) and there is no TBMR priority mask defined. A user value with high bits set can corrupt unrelated TBMR control bits. Mask the input to the valid TBMR priority field.
Info: strdup(value) return is not checked; on failure strtok(input_str, "|") is called with a NULL first argument, which resumes from strtok's stale internal state rather than erroring.
Warning: new devarg "enetc4_txq_prior" not documented in doc/guides/nics/enetc.rst.
[PATCH 10/10] net/enetc4: add cacheable BD ring support with SW cache
Warning: enetc4_dev_hw_init() switches rx_pkt_burst/tx_pkt_burst to the cache-maintenance variants unconditionally for every enetc4 device (PF and VF). The commit message scopes this to non-cache-coherent parts (i.MX95), but the code applies it everywhere, adding dcbf/dccivac cost on cache-coherent platforms that previously used the _nc fast path. Gate it on a devarg or coherency/platform check.
Warning: the RX payload invalidation uses dccivac (dc civac = clean+invalidate). The comment justifies clean-then-invalidate for the BD ring (refill dcbf leaves BD lines clean), but payload buffers are not cleaned before being handed to HW. If a payload cache line is dirty (stale CPU data from a prior use of the mbuf), the clean phase writes it back over the HW-DMA'd data in DDR before invalidating -> silent RX corruption on a non-coherent part. Please confirm payload lines can never be dirty here, or use invalidate-only.
Info: struct enetc_bdr gains "uint64_t bd_base_p" but it is never referenced anywhere. Remove the dead field.
Info: the 64-bit BD fast copy
__uint128_t *dst128 = (__uint128_t *)&rxbd_temp; *dst128 = *(const __uint128_t *)rxbd;
takes the address of an 8-byte-aligned stack union (rxbd_temp) as __uint128_t*. That is an under-aligned 128-bit access (UB); aarch64 tolerates it via ldp/stp but it is fragile. Force 16-byte alignment on rxbd_temp or copy as two u64.
General (series-wide)
Warning: no release notes. The series adds user-visible features (scatter-gather, cacheable BD ring support, four new devargs) with no entry in doc/guides/rel_notes/. New driver capabilities and devargs need release-note coverage.
Hi
Quoted 139 lines
-----Original Message-----
From: Stephen Hemminger <[email protected]>
Sent: Saturday, June 20, 2026 3:14 AM
To: Gagandeep Singh <[email protected]>
Cc: [email protected]; Hemant Agrawal <[email protected]>
Subject: Re: [PATCH 00/10] NXP ENETC driver related changesQuoted 16 lines · On Sat, 20 Jun 2026 00:14:17 +0530 Gagandeep Singh <[email protected]> wrote:
ENETC driver related changes series
Gagandeep Singh (8):
net/enetc: fix TX BD structure
net/enetc: fix TX BDs flag overwrite issue
net/enetc: fix queue initialization
net/enetc: support ESP packet type in packet parsing net/enetc: update random MAC generation code
net/enetc: add option to disable VSI messaging net/enetc: add devargs to control VSI-PSI timeout and delay net/enetc4: add cacheable BD ring support with SW cache maintenanceVanshika Shukla (2):
net/enetc: support scatter-gather
net/enetc: set user configurable priority to TX ringsQuoted 8 lines
drivers/net/enetc/base/enetc_hw.h | 13 +- drivers/net/enetc/enetc.h | 28 +- drivers/net/enetc/enetc4_ethdev.c | 123 +++++++-- drivers/net/enetc/enetc4_vf.c | 159 ++++++++++-- drivers/net/enetc/enetc_ethdev.c | 26 +- drivers/net/enetc/enetc_rxtx.c | 411 ++++++++++++++++++++++++++---- 6 files changed, 649 insertions(+), 111 deletions(-)The AI review shows some thing that need to be addressed before merging.
[PATCH 04/10] net/enetc: support ESP packet type
Info:
enetc_supported_ptypes_get()addsRTE_PTYPE_TUNNEL_ESPand a trailingRTE_PTYPE_UNKNOWN.*no_of_elementsisRTE_DIM(ptypes), so the
0 entry is counted (not used as a sentinel). It is filtered out by the mask test inrte_eth_dev_get_supported_ptypes(), so harmless, but theRTE_PTYPE_UNKNOWNline is unnecessary and should be dropped.[PATCH 06/10] net/enetc: support scatter-gather
Warning: scatter Rx reassembly state (first_seg/cur_seg) is held in local variables and reset on every call.
rx_frm_cntonly advances on the F bit, sowork_limitwon't cut a frame, but the "!(bd_status &LSTATUS_R)" break can exit mid-frame if HW has written the leading segments of a multi-segment frame but not yet the segment carrying F. On the next callfirst_segis NULL again,next_to_cleanhas already advanced past the consumed leading segments, and those mbufs are leaked while the tail segments are mis-assembled as a new frame. Persist the partial chain across bursts in the ring (e.g.rx_ring->pkt_first_seg/pkt_last_seg) instead of locals. (Same pattern is reproduced inenetc_clean_rx_ring_cacheablein patch 10.)Warning: enetc4 now advertises
RTE_ETH_RX_OFFLOAD_SCATTERandRTE_ETH_TX_OFFLOAD_MULTI_SEGS(VF) but doc/guides/nics/features/ enetc4.ini is not updated (Scattered Rx / Multi segment rows).Info: the VF
dev_infonow advertises L3/L4 RX checksum offload, butenetc_dev_rx_parse()unconditionally setsRTE_MBUF_F_RX_IP_CKSUM_GOOD|RTE_MBUF_F_RX_L4_CKSUM_GOODand never reports*_BAD. With the offload now advertised, an application relying on it will never see a bad-checksum indication.Info:
dccivac(data + (data_len - 1))/dcbf(data + (seg_len - 1))underflow to data-1 when the segment length is 0 (uint16_tpromotes to int). The preceding loop already covers the final cache line, so the extra op is redundant as well as unsafe for len==0.[PATCH 07/10] net/enetc: add option to disable VSI messaging
Warning: new devarg "
enetc4_vsi_disable" is registered but not documented indoc/guides/nics/enetc.rst.[PATCH 08/10] net/enetc: add devargs to control VSI-PSI timeout/delay
Warning: new devargs "
enetc4_vsi_timeout" / "enetc4_vsi_delay" are not documented indoc/guides/nics/enetc.rst.[PATCH 09/10] net/enetc: set user configurable priority to TX rings
Error:
hw->txq_prioris allocated inparse_txq_prior()withrte_zmalloc()but never freed. It leaks ondev_close/ re-probe. Free it in the close/uninit path (and note it is re-allocated every time the handler runs, so a repeated key would leak the prior allocation too).Warning:
txq_prioris control-path, CPU-only data;rte_zmalloc()consumes hugepage memory unnecessarily. Use calloc()/malloc().Warning: the parsed value is OR'd straight into TBMR:
tx_en |= priv->hw.txq_prior[tx_ring->index];with no mask.
ENETC_TBMR_ENis BIT(31) and there is no TBMR priority mask defined. A user value with high bits set can corrupt unrelated TBMR control bits. Mask the input to the valid TBMR priority field.Info: strdup(value) return is not checked; on failure
strtok(input_str, "|")is called with a NULL first argument, which resumes from strtok's stale internal state rather than erroring.Warning: new devarg "
enetc4_txq_prior" not documented indoc/guides/nics/enetc.rst.[PATCH 10/10] net/enetc4: add cacheable BD ring support with SW cache
Warning:
enetc4_dev_hw_init()switches rx_pkt_burst/tx_pkt_burst to the cache- maintenance variants unconditionally for every enetc4 device (PF and VF). The commit message scopes this to non-cache-coherent parts (i.MX95), but the code applies it everywhere, adding dcbf/dccivac cost on cache-coherent platforms that previously used the_ncfast path. Gate it on a devarg or coherency/platform check.Warning: the RX payload invalidation uses dccivac (dc civac = clean+invalidate). The comment justifies clean-then-invalidate for the BD ring (refill dcbf leaves BD lines clean), but payload buffers are not cleaned before being handed to HW. If a payload cache line is dirty (stale CPU data from a prior use of the mbuf), the clean phase writes it back over the HW-DMA'd data in DDR before invalidating -> silent RX corruption on a non-coherent part. Please confirm payload lines can never be dirty here, or use invalidate-only.
Info: struct
enetc_bdrgains "uint64_tbd_base_p" but it is never referenced anywhere. Remove the dead field.Info: the 64-bit BD fast copy
__uint128_t *dst128 = (__uint128_t *)&rxbd_temp; *dst128 = *(const __uint128_t *)rxbd;takes the address of an 8-byte-aligned stack union (
rxbd_temp) as __uint128_t*. That is an under-aligned 128-bit access (UB); aarch64 tolerates it via ldp/stp but it is fragile. Force 16-byte alignment onrxbd_tempor copy as two u64.
Quoted 6 lines
General (series-wide)
Warning: no release notes. The series adds user-visible features (scatter-gather, cacheable BD ring support, four new devargs) with no entry in doc/guides/rel_notes/. New driver capabilities and devargs need release-note coverage.
I have sent the V2 series which includes most of the fixes. I have mentioned all the fixes in the cover-letter.
Thanks,
Gagan
v2 cover ENETC driver related changes series
In reply to Gagandeep SinghV2 changes:
- Fixed an un-used variable compilation issue reported on fedora:43-gcc-minsize
- Fixed various AI reported issues:
- Release notes updated for all new devargs
- enect4.ini features doc updated for scattered RX.
- removed Not required RTE_PTYPE_UNKNOWN.
- Fixed mid-frame mbuf leak in SG case.
- Enabled SG for enetc4 PF also.
- move to calloc from rte_zmalloc in parse_txq_prior().
- added vaidation checks on strdup, strtoul.
- added NC devargs to use cacheable ops conditionally.
- removed dead code like bd_base_p etc.
- Fixed rte_cpu_to_le_16() conversion on flags and combined all flags related patches in one patch.
- Fixed memory leak issue due to TXQ priority patch.
- There were some false positives, I have ignored them:
Race condition on flags field:
clean_tx_ring only touches HW-completed BDs (next_to_clean→hwci), never newly-submitted BDs; doorbell hasn't fired yet.
Missing dcbf in clean_tx_ring:
DPDK is single-threaded per queue; TX path always overwrites flags completely before dcbf.
TX dcbf granularity with wrap:
Safe (AI admits it).
RX refill flush at wrap:
In-loop dcbf at i & mask == 0 already flushes aligned groups; trailing flush only needed for partial groups.
RX reading before invalidate:
dccivac precedes the read for every group in the loop
Gagandeep Singh (7):
net/enetc: fix TX BD structure
net/enetc: fix queue initialization
net/enetc: support ESP packet type in packet parsing net/enetc: update random MAC generation code
net/enetc: add option to disable VSI messaging net/enetc: add devargs to control VSI-PSI timeout and delay net/enetc4: add cacheable BD ring support with SW cache maintenance
Vanshika Shukla (2):
net/enetc: support scatter-gather
net/enetc: set user configurable priority to TX rings
doc/guides/nics/features/enetc4.ini | 1 + doc/guides/rel_notes/release_26_07.rst | 10 + drivers/net/enetc/base/enetc_hw.h | 13 +- drivers/net/enetc/enetc.h | 31 +- drivers/net/enetc/enetc4_ethdev.c | 172 ++++++++-- drivers/net/enetc/enetc4_vf.c | 204 ++++++++++-- drivers/net/enetc/enetc_ethdev.c | 25 +- drivers/net/enetc/enetc_rxtx.c | 430 ++++++++++++++++++++++--- 8 files changed, 768 insertions(+), 118 deletions(-)
Signature · 1 line
2.25.1
PATCH v2 1/9 net/enetc: fix TX BD structure
The flags field in struct enetc_tx_bd was declared as uint16_t but ENETC4 TX BDs only use an 8-bit flags byte. Fix the type to uint8_t to match the hardware descriptor layout.
--- drivers/net/enetc/base/enetc_hw.h | 7 +++---- drivers/net/enetc/enetc_rxtx.c | 17 +++++++++-------- 2 files changed, 12 insertions(+), 12 deletions(-)
drivers/net/enetc/base/enetc_hw.h +3 -4
@@ -1,5 +1,5 @@/* SPDX-License-Identifier: BSD-3-Clause -* Copyright 2018-2024 NXP +* Copyright 2018-2026 NXP */ #ifndef _ENETC_HW_H_
@@ -198,8 +198,7 @@ enum enetc_bdr_type {TX, RX};#define ENETC_TX_ADDR (txq, addr) ((void *)((txq)->enetc_txbdr + (addr))) -#define ENETC_TXBD_FLAGS_IE BIT(13) -#define ENETC_TXBD_FLAGS_F BIT(15) +#define ENETC_TXBD_FLAGS_F BIT(7)/* ENETC Parsed values (Little Endian) */ #define ENETC_PARSE_ERROR 0x8000
@@ -262,7 +261,7 @@ struct enetc_tx_bd { uint8_t l3t:1; uint8_t resv:5; uint8_t l4t:3; -uint16_t flags; +uint8_t flags; };/* default layout */ uint32_t txstart;uint32_t lstatus;
drivers/net/enetc/enetc_rxtx.c +9 -8
@@ -1,5 +1,5 @@/* SPDX-License-Identifier: BSD-3-Clause -* Copyright 2018-2024 NXP +* Copyright 2018-2026 NXP */ #include <stdbool.h>
@@ -101,7 +101,7 @@ enetc_xmit_pkts(void *tx_queue, tx_swbd = &tx_ring->q_swbd[i]; txbd->frm_len = tx_pkts[start]->pkt_len; txbd->buf_len = txbd->frm_len; - txbd->flags =rte_cpu_to_le_16 (ENETC_TXBD_FLAGS_F ); + txbd->flags =ENETC_TXBD_FLAGS_F ; txbd->addr = (uint64_t )(uintptr_t )rte_cpu_to_le_64 ((size_t )tx_swbd->buffer_addr->buf_iova + tx_swbd->buffer_addr->data_off);
@@ -133,13 +133,13 @@ enetc4_tx_offload_checksum(struct rte_mbuf *mbuf, struct enetc_tx_bd *txbd) txbd->ipcs =ENETC4_TXBD_IPCS ; txbd->l3_start = mbuf->l2_len; txbd->l3_hdr_size = mbuf->l3_len /4 ; - txbd->flags |=rte_cpu_to_le_16 (ENETC4_TXBD_FLAGS_L_TX_CKSUM ); + txbd->flags |=ENETC4_TXBD_FLAGS_L_TX_CKSUM ;if ((mbuf->ol_flags &RTE_MBUF_F_TX_UDP_CKSUM ) ==RTE_MBUF_F_TX_UDP_CKSUM ) { - txbd->l4t =rte_cpu_to_le_16 (ENETC4_TXBD_L4T_UDP ); - txbd->flags |=rte_cpu_to_le_16 (ENETC4_TXBD_FLAGS_L4CS ); + txbd->l4t =ENETC4_TXBD_L4T_UDP ; + txbd->flags |=ENETC4_TXBD_FLAGS_L4CS ; }else if ((mbuf->ol_flags &RTE_MBUF_F_TX_TCP_CKSUM ) ==RTE_MBUF_F_TX_TCP_CKSUM ) { - txbd->l4t =rte_cpu_to_le_16 (ENETC4_TXBD_L4T_TCP ); - txbd->flags |=rte_cpu_to_le_16 (ENETC4_TXBD_FLAGS_L4CS ); + txbd->l4t =ENETC4_TXBD_L4T_TCP ; + txbd->flags |=ENETC4_TXBD_FLAGS_L4CS ; } } }
@@ -172,7 +172,7 @@ enetc_xmit_pkts_nc(void *tx_queue,dcbf (data + j); txbd =ENETC_TXBD (*tx_ring, i); - txbd->flags =rte_cpu_to_le_16 (ENETC4_TXBD_FLAGS_F ); + txbd->flags =0 ;if (tx_ring->q_swbd[i].buffer_addr->ol_flags &ENETC4_TX_CKSUM_OFFLOAD_MASK )enetc4_tx_offload_checksum (tx_ring->q_swbd[i].buffer_addr, txbd);
@@ -182,6 +182,7 @@ enetc_xmit_pkts_nc(void *tx_queue, txbd->addr = (uint64_t )(uintptr_t )rte_cpu_to_le_64 ((size_t )tx_swbd->buffer_addr->buf_iova + tx_swbd->buffer_addr->data_off); + txbd->flags |=ENETC4_TXBD_FLAGS_F ; i++; start++;if (unlikely (i == tx_ring->bd_count))
Signature · 1 line
2.25.1
PATCH v2 2/9 net/enetc: fix queue initialization
In reply to Gagandeep SinghHardware can misbehave if the user tries to reset the consumer and producer indexes without resetting the ring.
This patch adds the ring reset step before resetting the indexes.
--- drivers/net/enetc/enetc4_ethdev.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-)
drivers/net/enetc/enetc4_ethdev.c +11 -1
@@ -1,5 +1,5 @@/* SPDX-License-Identifier: BSD-3-Clause -* Copyright 2024 NXP +* Copyright 2024-2026 NXP */ #include <stdbool.h>
@@ -279,6 +279,7 @@ enetc4_tx_queue_setup(struct rte_eth_dev *dev, const struct rte_eth_txconf *tx_conf) {int err; +uint32_t tx_data;struct enetc_bdr *tx_ring;struct rte_eth_dev_data *data = dev->data; struct enetc_eth_adapter *priv =
@@ -301,6 +302,10 @@ enetc4_tx_queue_setup(struct rte_eth_dev *dev, goto fail; tx_ring->ndev = dev; +/* reset queue */ + tx_data =enetc4_txbdr_rd (&priv->hw.hw, tx_ring->index,ENETC_TBMR ); + tx_data &= ~ENETC_TBMR_EN ; +enetc4_txbdr_wr (&priv->hw.hw, tx_ring->index,ENETC_TBMR , tx_data);enetc4_setup_txbdr (&priv->hw.hw, tx_ring); data->tx_queues[queue_idx] = tx_ring; tx_ring->tx_deferred_start = tx_conf->tx_deferred_start;
@@ -427,6 +432,7 @@ enetc4_rx_queue_setup(struct rte_eth_dev *dev, struct rte_mempool *mb_pool) {int err =0 ; +uint32_t rx_enable;struct enetc_bdr *rx_ring;struct rte_eth_dev_data *data = dev->data; struct enetc_eth_adapter *adapter =
@@ -450,6 +456,10 @@ enetc4_rx_queue_setup(struct rte_eth_dev *dev, goto fail; rx_ring->ndev = dev; +/* reset queue */ + rx_enable =enetc4_rxbdr_rd (&adapter->hw.hw, rx_ring->index,ENETC_RBMR ); + rx_enable &= ~ENETC_RBMR_EN ; +enetc4_rxbdr_wr (&adapter->hw.hw, rx_ring->index,ENETC_RBMR , rx_enable);enetc4_setup_rxbdr (&adapter->hw.hw, rx_ring, mb_pool); data->rx_queues[rx_queue_id] = rx_ring; rx_ring->rx_deferred_start = rx_conf->rx_deferred_start;
Signature · 1 line
2.25.1
PATCH v2 3/9 net/enetc: support ESP packet type in packet parsing
In reply to Gagandeep SinghAdd ESP (Encapsulating Security Payload) packet type definitions and handling to the RX packet parsing path. Also update the supported ptypes array to advertise ESP tunnel type support.
--- doc/guides/rel_notes/release_26_07.rst | 3 +++ drivers/net/enetc/base/enetc_hw.h | 4 ++++ drivers/net/enetc/enetc_ethdev.c | 3 ++- drivers/net/enetc/enetc_rxtx.c | 10 ++++++++++ 4 files changed, 19 insertions(+), 1 deletion(-)
doc/guides/rel_notes/release_26_07.rst +3 -0
@@ -187,6 +187,9 @@ New Features ``RTE_ETH_EVENT_RECOVERY_FAILED``) to notify upper layers of the reset lifecycle. +* **Updated NXP ENETC ethernet driver.** + + * Added support for ESP packet type in packet parsing Removed Items -------------
drivers/net/enetc/base/enetc_hw.h +4 -0
@@ -226,6 +226,10 @@ enum enetc_bdr_type {TX, RX}; (0x0003 | ENETC_PKT_TYPE_IPV4)#define ENETC_PKT_TYPE_IPV6_ICMP \ (0x0003 | ENETC_PKT_TYPE_IPV6) +#define ENETC_PKT_TYPE_IPV4_ESP \ + (0x0005 | ENETC_PKT_TYPE_IPV4) +#define ENETC_PKT_TYPE_IPV6_ESP \ + (0x0005 | ENETC_PKT_TYPE_IPV6)/* PCI device info */ struct enetc_hw {
drivers/net/enetc/enetc_ethdev.c +2 -1
@@ -1,5 +1,5 @@/* SPDX-License-Identifier: BSD-3-Clause -* Copyright 2018-2024 NXP +* Copyright 2018-2026 NXP */ #include <stdbool.h>
@@ -95,6 +95,7 @@ enetc_supported_ptypes_get(struct rte_eth_dev *dev __rte_unused,RTE_PTYPE_L4_UDP ,RTE_PTYPE_L4_SCTP ,RTE_PTYPE_L4_ICMP , + RTE_PTYPE_TUNNEL_ESP }; *no_of_elements =RTE_DIM (ptypes);
drivers/net/enetc/enetc_rxtx.c +10 -0
@@ -370,6 +370,16 @@ enetc_dev_rx_parse(struct rte_mbuf *m, uint16_t parse_results)RTE_PTYPE_L3_IPV6 |RTE_PTYPE_L4_UDP ;return ; +case ENETC_PKT_TYPE_IPV4_ESP : + m->packet_type =RTE_PTYPE_L2_ETHER | +RTE_PTYPE_L3_IPV4 | +RTE_PTYPE_TUNNEL_ESP ; +return ; +case ENETC_PKT_TYPE_IPV6_ESP : + m->packet_type =RTE_PTYPE_L2_ETHER | +RTE_PTYPE_L3_IPV6 | +RTE_PTYPE_TUNNEL_ESP ; +return ;case ENETC_PKT_TYPE_IPV4_SCTP : m->packet_type =RTE_PTYPE_L2_ETHER | RTE_PTYPE_L3_IPV4 |
Signature · 1 line
2.25.1
PATCH v2 4/9 net/enetc: update random MAC generation code
In reply to Gagandeep SinghUse rte_eth_random_addr() instead of manual rte_rand() based MAC generation. Also handle VF path by writing to ENETC_SIPMAR0/1 instead of ENETC_PSIPMAR0/1 when running as a VF.
--- drivers/net/enetc/enetc_ethdev.c | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-)
drivers/net/enetc/enetc_ethdev.c +10 -12
@@ -195,20 +195,18 @@ enetc_hardware_init(struct enetc_eth_hw *hw) }if ((high_mac | low_mac) ==0 ) { -char *first_byte; -ENETC_PMD_NOTICE ("MAC is not available for this SI, " "set random MAC" ); - mac = (uint32_t *)hw->mac.addr; - *mac = (uint32_t )rte_rand (); - first_byte = (char *)mac; - *first_byte &=0xfe ;/* clear multicast bit */ - *first_byte |=0x02 ;/* set local assignment bit (IEEE802) */ - -enetc_port_wr (enetc_hw,ENETC_PSIPMAR0 (0 ), *mac); - mac++; - *mac = (uint16_t )rte_rand (); -enetc_port_wr (enetc_hw,ENETC_PSIPMAR1 (0 ), *mac); +rte_eth_random_addr (hw->mac.addr); + high_mac = *(uint32_t *)hw->mac.addr; + low_mac = *(uint16_t *)(hw->mac.addr +4 ); +if (hw->device_id ==ENETC_DEV_ID_VF ) { +enetc_wr (enetc_hw,ENETC_SIPMAR0 , high_mac); +enetc_wr (enetc_hw,ENETC_SIPMAR1 , low_mac); + }else { +enetc_port_wr (enetc_hw,ENETC_PSIPMAR0 (0 ), high_mac); +enetc_port_wr (enetc_hw,ENETC_PSIPMAR1 (0 ), low_mac); + }enetc_print_ethaddr ("New address: " , (const struct rte_ether_addr *)hw->mac.addr); }
Signature · 1 line
2.25.1
PATCH v2 5/9 net/enetc: support scatter-gather
In reply to Gagandeep SinghFrom: Vanshika Shukla <[email protected]>
Add scatter-gather support for ENETC4 PMD:
- Add ENETC_RXBD_LSTATUS_R/F bits for RX BD status
- Add ENETC4_MAX_SEGS (63) for max segments per TX packet
- Update enetc4_vf_dev_infos_get to fill nb_seg_max, offloads, max queues and packet length
- Extend enetc_xmit_pkts_nc to handle multi-segment mbufs
- Extend enetc_clean_rx_ring_nc to chain scatter-gather segments using LSTATUS_R/F bits
--- doc/guides/nics/features/enetc4.ini | 1 + doc/guides/rel_notes/release_26_07.rst | 3 +- drivers/net/enetc/base/enetc_hw.h | 2 + drivers/net/enetc/enetc.h | 7 +- drivers/net/enetc/enetc4_ethdev.c | 10 +- drivers/net/enetc/enetc4_vf.c | 46 +++++++-- drivers/net/enetc/enetc_rxtx.c | 129 ++++++++++++++++--------- 7 files changed, 139 insertions(+), 59 deletions(-)
doc/guides/nics/features/enetc4.ini +1 -0
@@ -17,6 +17,7 @@ Basic stats = Y L3 checksum offload = Y L4 checksum offload = Y Queue start/stop = Y +Scattered Rx = Y Linux = Y ARMv8 = Y Usage doc = Y
doc/guides/rel_notes/release_26_07.rst +2 -1
@@ -189,7 +189,8 @@ New Features * **Updated NXP ENETC ethernet driver.** - * Added support for ESP packet type in packet parsing + * Added support for ESP packet type in packet parsing. + * Added scatter-gather support for ENETC4 PFs and VFs. Removed Items -------------
drivers/net/enetc/base/enetc_hw.h +2 -0
@@ -230,6 +230,8 @@ enum enetc_bdr_type {TX, RX}; (0x0005 | ENETC_PKT_TYPE_IPV4)#define ENETC_PKT_TYPE_IPV6_ESP \ (0x0005 | ENETC_PKT_TYPE_IPV6) +#define ENETC_RXBD_LSTATUS_R BIT(30) +#define ENETC_RXBD_LSTATUS_F BIT(31)/* PCI device info */ struct enetc_hw {
drivers/net/enetc/enetc.h +6 -1
@@ -1,5 +1,5 @@/* SPDX-License-Identifier: BSD-3-Clause -* Copyright 2018-2019,2024 NXP +* Copyright 2018-2019,2024-2026 NXP */ #ifndef _ENETC_H_
@@ -28,6 +28,8 @@#define MIN_BD_COUNT 32/* BD ALIGN */ #define BD_ALIGN 8 +/* Max segments per ENETC4 TX packet (scatter-gather) */ +#define ENETC4_MAX_SEGS 63/* minimum frame size supported */ #define ENETC_MAC_MINFRM_SIZE 68
@@ -90,6 +92,9 @@ struct enetc_bdr {int next_to_alloc;/* Rx */ };struct rte_mempool *mb_pool;/* mbuf pool to populate RX ring. */ +/* Partial scatter-gather chain persisted across burst calls. */ +struct rte_mbuf *pkt_first_seg;/* first segment of in-progress frame */ +struct rte_mbuf *pkt_last_seg;/* last segment linked so far */ struct rte_eth_dev *ndev;uint64_t ierrors;uint8_t rx_deferred_start;
drivers/net/enetc/enetc4_ethdev.c +8 -2
@@ -14,13 +14,15 @@static uint64_t dev_rx_offloads_sup =RTE_ETH_RX_OFFLOAD_IPV4_CKSUM |RTE_ETH_RX_OFFLOAD_UDP_CKSUM | -RTE_ETH_RX_OFFLOAD_TCP_CKSUM ; +RTE_ETH_RX_OFFLOAD_TCP_CKSUM | +RTE_ETH_RX_OFFLOAD_SCATTER ;/* Supported Tx offloads */ static uint64_t dev_tx_offloads_sup =RTE_ETH_TX_OFFLOAD_IPV4_CKSUM |RTE_ETH_TX_OFFLOAD_UDP_CKSUM | -RTE_ETH_TX_OFFLOAD_TCP_CKSUM ; +RTE_ETH_TX_OFFLOAD_TCP_CKSUM | +RTE_ETH_TX_OFFLOAD_MULTI_SEGS ;static int enetc4_dev_start (struct rte_eth_dev *dev)
@@ -199,11 +201,15 @@ enetc4_dev_infos_get(struct rte_eth_dev *dev, .nb_max = MAX_BD_COUNT, .nb_min = MIN_BD_COUNT, .nb_align = BD_ALIGN, + .nb_seg_max = ENETC4_MAX_SEGS, + .nb_mtu_seg_max = ENETC4_MAX_SEGS, }; dev_info->tx_desc_lim = (struct rte_eth_desc_lim ) { .nb_max =MAX_BD_COUNT , .nb_min =MIN_BD_COUNT , .nb_align =BD_ALIGN , + .nb_seg_max =ENETC4_MAX_SEGS , + .nb_mtu_seg_max =ENETC4_MAX_SEGS , }; dev_info->max_rx_queues = hw->max_rx_queues; dev_info->max_tx_queues = hw->max_tx_queues;
drivers/net/enetc/enetc4_vf.c +37 -9
71 lines not on this page · raw message
drivers/net/enetc/enetc_rxtx.c +83 -46
184 lines not on this page · raw message
Signature · 1 line
2.25.1
PATCH v2 6/9 net/enetc: add option to disable VSI messaging
In reply to Gagandeep SinghAdd devarg 'enetc4_vsi_disable' to allow disabling features dependent on VSI-PSI messaging. This is useful for testing DPDK with a PF driver that does not support VSI-PSI messages.
When the devarg is present, a reduced ops table (enetc4_vf_ops_no_vsi_m) is used that replaces link_update with a no-op stub and omits MAC/VLAN filter ops that require VSI msgs.
--- doc/guides/rel_notes/release_26_07.rst | 2 + drivers/net/enetc/enetc4_vf.c | 61 ++++++++++++++++++++++++-- 2 files changed, 60 insertions(+), 3 deletions(-)
doc/guides/rel_notes/release_26_07.rst +2 -0
@@ -191,6 +191,8 @@ New Features * Added support for ESP packet type in packet parsing. * Added scatter-gather support for ENETC4 PFs and VFs. + * Added devargs option ``enetc4_vsi_disable`` to disable VSI-PSI + messaging. Removed Items -------------
drivers/net/enetc/enetc4_vf.c +58 -3
100 lines not on this page · raw message
Signature · 1 line
2.25.1
PATCH v2 7/9 net/enetc: add devargs to control VSI-PSI timeout and delay
In reply to Gagandeep SinghAdd two new devargs for ENETC4 VF:
- enetc4_vsi_timeout: VSI-PSI message wait timeout (iteration count)
- enetc4_vsi_delay: VSI-PSI message wait delay in microseconds
Store the values in struct enetc_eth_hw and use them in enetc4_msg_vsi_send() instead of the hardcoded defaults. Fall back to ENETC4_DEF_VSI_WAIT_TIMEOUT_UPDATE / ENETC4_DEF_VSI_WAIT_DELAY_UPDATE when not set.
--- doc/guides/rel_notes/release_26_07.rst | 2 + drivers/net/enetc/enetc.h | 2 + drivers/net/enetc/enetc4_vf.c | 66 +++++++++++++++++++------- 3 files changed, 53 insertions(+), 17 deletions(-)
doc/guides/rel_notes/release_26_07.rst +2 -0
@@ -193,6 +193,8 @@ New Features * Added scatter-gather support for ENETC4 PFs and VFs. * Added devargs option ``enetc4_vsi_disable`` to disable VSI-PSI messaging. + * Added devargs options ``enetc4_vsi_timeout`` and ``enetc4_vsi_delay`` + for VSI-PSI messaging timeout and delay. Removed Items -------------
drivers/net/enetc/enetc.h +2 -0
@@ -112,6 +112,8 @@ struct enetc_eth_hw {uint32_t num_rss;uint32_t max_rx_queues;uint32_t max_tx_queues; +uint32_t vsi_timeout;/* VSI-PSI message wait timeout (iterations) */ +uint32_t vsi_delay;/* VSI-PSI message wait delay (us) */ };/*
drivers/net/enetc/enetc4_vf.c +49 -17
173 lines not on this page · raw message
Signature · 1 line
2.25.1
PATCH v2 8/9 net/enetc: set user configurable priority to TX rings
In reply to Gagandeep SinghFrom: Vanshika Shukla <[email protected]>
Add devarg 'enetc4_txq_prior' to allow per-queue TX ring priority configuration. The value is a '|'-separated list of TBMR priority bits, one per TX queue (e.g. 'enetc4_txq_prior=1|2|3'). The configuration accepts values only up to the maximum supported TX queues. Any additional values beyond this supported range are discarded.
Store the parsed priorities in hw->txq_prior and apply them in enetc4_tx_queue_setup() when enabling the ring.
--- doc/guides/rel_notes/release_26_07.rst | 1 + drivers/net/enetc/enetc.h | 1 + drivers/net/enetc/enetc4_ethdev.c | 81 +++++++++++++++++++++++++- 3 files changed, 82 insertions(+), 1 deletion(-)
doc/guides/rel_notes/release_26_07.rst +1 -0
@@ -195,6 +195,7 @@ New Features messaging. * Added devargs options ``enetc4_vsi_timeout`` and ``enetc4_vsi_delay`` for VSI-PSI messaging timeout and delay. + * Added devargs option ``enetc4_txq_prior`` to set TX queues priorities. Removed Items -------------
drivers/net/enetc/enetc.h +1 -0
@@ -114,6 +114,7 @@ struct enetc_eth_hw {uint32_t max_tx_queues;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) */ };/*
drivers/net/enetc/enetc4_ethdev.c +80 -1
119 lines not on this page · raw message
Signature · 1 line
2.25.1
PATCH v2 9/9 net/enetc4: add cacheable BD ring support with SW cache maintenance
In reply to Gagandeep SinghOn non-cache-coherent platforms such as i.MX95, the BD ring memory may be mapped as cacheable (normal memory) while the ENETC hardware DMA engine writes and reads descriptors without CPU cache snooping. SW must therefore perform explicit cache maintenance to keep CPU caches and DDR coherent.
TX path (enetc_xmit_pkts_cacheable):
- Flush each segment's payload cache lines to PoC (dcbf) before the BD is handed to HW, so HW DMA reads the correct data.
- After all BDs for a burst are written, flush the BD cache lines (dcbf, one per 64-byte group of 4 BDs) so HW can read the updated descriptors.
RX refill (enetc_refill_rx_ring):
- After writing each full 4-BD cache-line group, dcbf that group so HW sees the buffer addresses and cleared lstatus fields.
- Flush any partial trailing group before updating the ring tail.
RX receive (enetc_recv_pkts_cacheable via enetc_clean_rx_ring_cacheable):
- Before reading BD status, dccivac the current BD cache line so stale CPU-cached BD data is discarded and fresh HW-written content is fetched from DDR.
- After a BD is consumed, dccivac each payload cache line so the CPU reads the DMA'd packet data, not stale cached bytes.
Add a new devarg 'nc=1' that allows selecting the non-cacheable RX/TX ops.
When nc=1 is specified:
eth_dev->rx_pkt_burst = &enetc_recv_pkts_nc; eth_dev->tx_pkt_burst = &enetc_xmit_pkts_nc;
The default (nc not set or nc=0) keeps the cacheable path with SW cache maintenance (dccivac/dcbf):
eth_dev->rx_pkt_burst = &enetc_recv_pkts_cacheable; eth_dev->tx_pkt_burst = &enetc_xmit_pkts_cacheable;
Usage:
--allow 0000:00:01.0,nc=1
--- doc/guides/rel_notes/release_26_07.rst | 1 + drivers/net/enetc/enetc.h | 21 ++ drivers/net/enetc/enetc4_ethdev.c | 71 +++++-- drivers/net/enetc/enetc4_vf.c | 35 +++- drivers/net/enetc/enetc_rxtx.c | 278 ++++++++++++++++++++++++- 5 files changed, 388 insertions(+), 18 deletions(-)
doc/guides/rel_notes/release_26_07.rst +1 -0
@@ -196,6 +196,7 @@ New Features * Added devargs options ``enetc4_vsi_timeout`` and ``enetc4_vsi_delay`` for VSI-PSI messaging timeout and delay. * Added devargs option ``enetc4_txq_prior`` to set TX queues priorities. + * Added devargs option ``nc`` to select non-cacheable RX/TX ops. Removed Items -------------
drivers/net/enetc/enetc.h +21 -0
@@ -115,6 +115,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) */ +uint8_t nc_mode;/* 1 = non-cacheable BD memory, use _nc ops */ };/*
@@ -315,8 +316,28 @@ 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_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); + +/* +* Cache-maintenance constants for cacheable BD ring mode. +* +* BD = 16 bytes, cache line = 64 bytes => 4 BDs per cache line. +* Every dcbf in enetc_refill_rx_ring() flushes a full 64-byte cache line. +* To ensure each dcbf covers only fully-written BDs the caller +* must pass a count rounded DOWN to a multiple of ENETC_BD_PER_CL so that +* the last partial group is left in cache to be completed and flushed in +* the next call. +*/ +#define ENETC_BD_PER_CL (RTE_CACHE_LINE_SIZE / sizeof(union enetc_rx_bd)) +#define ENETC_BD_PER_CL_MASK (ENETC_BD_PER_CL - 1) +/* Round n DOWN to the nearest multiple of ENETC_BD_PER_CL. */ +#define ENETC_BD_ALIGN_DOWN (n) ((n) & ~(unsigned int)ENETC_BD_PER_CL_MASK) +void enetc4_dev_hw_init (struct rte_eth_dev *eth_dev);void enetc_print_ethaddr (const char *name,const struct rte_ether_addr *eth_addr);
drivers/net/enetc/enetc4_ethdev.c +55 -16
143 lines not on this page · raw message
drivers/net/enetc/enetc4_vf.c +34 -1
@@ -12,6 +12,30 @@#define ENETC4_VSI_DISABLE "enetc4_vsi_disable"#define ENETC4_VSI_TIMEOUT "enetc4_vsi_timeout"#define ENETC4_VSI_DELAY "enetc4_vsi_delay" +#define ENETC4_NC_MEMORY "nc" + +static void +enetc4_vf_get_devarg_nc (struct rte_eth_dev *dev) +{ +struct enetc_eth_hw *hw = +ENETC_DEV_PRIVATE_TO_HW (dev->data->dev_private); +struct rte_devargs *devargs = dev->device->devargs; +struct rte_kvargs *kvlist; +const char *val; + +if (!devargs) +return ; + + kvlist =rte_kvargs_parse (devargs->args,NULL ); +if (!kvlist) +return ; + + val =rte_kvargs_get (kvlist,ENETC4_NC_MEMORY ); +if (val &&atoi (val) ==1 ) + hw->nc_mode =1 ; + +rte_kvargs_free (kvlist); +}#define ENETC_CRC_TABLE_SIZE 256#define ENETC_POLY 0x1021
@@ -1368,6 +1392,14 @@ enetc4_vf_dev_init(struct rte_eth_dev *eth_dev)enetc4_dev_hw_init (eth_dev); + hw->nc_mode =0 ; +enetc4_vf_get_devarg_nc (eth_dev); +if (hw->nc_mode) { + eth_dev->rx_pkt_burst = &enetc_recv_pkts_nc; + eth_dev->tx_pkt_burst = &enetc_xmit_pkts_nc; +ENETC_PMD_LOG (INFO ,"nc=1: using non-cacheable BD ops (_nc)" ); + } + si_cap =enetc_rd (enetc_hw,ENETC_SICAPR0 ); hw->max_tx_queues = si_cap &ENETC_SICAPR0_BDR_MASK ; hw->max_rx_queues = (si_cap >>16 ) &ENETC_SICAPR0_BDR_MASK ;
@@ -1475,5 +1507,6 @@ RTE_PMD_REGISTER_KMOD_DEP(net_enetc4_vf, "* igb_uio | uio_pci_generic");RTE_PMD_REGISTER_PARAM_STRING (net_enetc4_vf,ENETC4_VSI_DISABLE "=<any> " ENETC4_VSI_TIMEOUT "=<uint> " -ENETC4_VSI_DELAY "=<uint>" ); +ENETC4_VSI_DELAY "=<uint> " +ENETC4_NC_MEMORY "=<int>" );RTE_LOG_REGISTER_DEFAULT (enetc4_vf_logtype_pmd,NOTICE );
drivers/net/enetc/enetc_rxtx.c +277 -1
323 lines not on this page · raw message
Signature · 1 line
2.25.1
Re: [PATCH v2 0/9] ENETC driver related changes series
In reply to Gagandeep SinghQuoted 43 lines · On Mon, 22 Jun 2026 17:05:08 +0530 Gagandeep Singh <[email protected]> wrote:
V2 changes:
- Fixed an un-used variable compilation issue reported on fedora:43-gcc-minsize
- Fixed various AI reported issues:
- Release notes updated for all new devargs
- enect4.ini features doc updated for scattered RX.
- removed Not requiredRTE_PTYPE_UNKNOWN.
- Fixed mid-frame mbuf leak in SG case.
- Enabled SG for enetc4 PF also.
- move to calloc fromrte_zmallocinparse_txq_prior().
- added vaidation checks on strdup, strtoul.
- added NC devargs to use cacheable ops conditionally.
- removed dead code likebd_base_petc.
- Fixedrte_cpu_to_le_16()conversion on flags and combined all flags related patches in one patch.
- Fixed memory leak issue due to TXQ priority patch.
- There were some false positives, I have ignored them:
Race condition on flags field:
clean_tx_ringonly touches HW-completed BDs (next_to_clean→hwci), never newly-submitted BDs; doorbell hasn't fired yet.
Missing dcbf inclean_tx_ring:
DPDK is single-threaded per queue; TX path always overwrites flags completely before dcbf.
TX dcbf granularity with wrap:
Safe (AI admits it).
RX refill flush at wrap:
In-loop dcbf at i & mask == 0 already flushes aligned groups; trailing flush only needed for partial groups.
RX reading before invalidate:
dccivac precedes the read for every group in the loopGagandeep Singh (7):
net/enetc: fix TX BD structure
net/enetc: fix queue initialization
net/enetc: support ESP packet type in packet parsing net/enetc: update random MAC generation code
net/enetc: add option to disable VSI messaging net/enetc: add devargs to control VSI-PSI timeout and delay net/enetc4: add cacheable BD ring support with SW cache maintenanceVanshika Shukla (2):
net/enetc: support scatter-gather
net/enetc: set user configurable priority to TX rings
Quoted 10 lines
doc/guides/nics/features/enetc4.ini | 1 + doc/guides/rel_notes/release_26_07.rst | 10 + drivers/net/enetc/base/enetc_hw.h | 13 +- drivers/net/enetc/enetc.h | 31 +- drivers/net/enetc/enetc4_ethdev.c | 172 ++++++++-- drivers/net/enetc/enetc4_vf.c | 204 ++++++++++-- drivers/net/enetc/enetc_ethdev.c | 25 +- drivers/net/enetc/enetc_rxtx.c | 430 ++++++++++++++++++++++--- 8 files changed, 768 insertions(+), 118 deletions(-)
Better but still had some AI feedback if I asked it for more complete review. Agree that putting new devargs in doc is needed.
Error
=====
[PATCH v2 7/9] net/enetc: add devargs to control VSI-PSI timeout and delay
drivers/net/enetc/enetc4_vf.c, enetc4_vf_dev_init()
kvlist is leaked on the two invalid-value error paths. It is allocated by rte_kvargs_parse() (line 1347) and only freed at line 1385, but both
return -1; /* invalid VSI Timeout, line 1367 */
return -1; /* invalid VSI Delay, line 1380 */
return before that free. A malformed enetc4_vsi_timeout= or enetc4_vsi_delay= leaks the kvargs structure on every probe.
Free before returning, e.g.:
if (errno != 0 || hw->vsi_timeout == 0) {
ENETC_PMD_ERR("Invalid VSI Timeout value = %u",
hw->vsi_timeout);
rte_kvargs_free(kvlist);
return -1;
}(same for the delay path), or restructure with a goto.
Warning
=======
Series (patches 6-9)
The new runtime devargs - enetc4_vsi_disable, enetc4_vsi_timeout, enetc4_vsi_delay, enetc4_txq_prior, and nc - are registered via RTE_PMD_REGISTER_PARAM_STRING and noted in the release notes, but doc/guides/nics/enetc4.rst has no Runtime Configuration section describing them. Convention is to document devargs in the NIC guide so users can find the syntax (e.g. the nc=1 / 'a|b|c' priority list formats are non-obvious).
Info
====
[PATCH v2 5/9] and [PATCH v2 9/9] - RX multi-segment reassembly
In enetc_clean_rx_ring_nc() and enetc_clean_rx_ring_cacheable(), on the frame-last BD:
first_seg->pkt_len -= rx_ring->crc_len;
reduces pkt_len but leaves the final segment's data_len unchanged, so pkt_len != sum(data_len) when crc_len is non-zero. The old single-segment path kept them equal (pkt_len = data_len = buf_len
- crc_len).
This is currently unreachable: enetc4 does not advertise RTE_ETH_RX_OFFLOAD_KEEP_CRC, so crc_len is always 0 and the subtraction is a no-op. Flagging only so the asymmetry is on record if KEEP_CRC is ever added - at that point the last segment's data_len would need the same adjustment (and the CRC may straddle the last two segments).
RE: [PATCH v2 0/9] ENETC driver related changes series
Hi,
Quoted 88 lines
-----Original Message-----
From: Stephen Hemminger <[email protected]>
Sent: Monday, June 22, 2026 8:36 PM
To: Gagandeep Singh <[email protected]>
Cc: [email protected]; Hemant Agrawal <[email protected]>
Subject: Re: [PATCH v2 0/9] ENETC driver related changes seriesQuoted 2 lines · On Mon, 22 Jun 2026 17:05:08 +0530 Gagandeep Singh <[email protected]> wrote:
V2 changes:
- Fixed an un-used variable compilation issue reported on fedora:43-gcc-minsize
Quoted 8 lines
- Fixed various AI reported issues:
- Release notes updated for all new devargs
- enect4.ini features doc updated for scattered RX.
- removed Not requiredRTE_PTYPE_UNKNOWN.
- Fixed mid-frame mbuf leak in SG case.
- Enabled SG for enetc4 PF also.
- move to calloc fromrte_zmallocinparse_txq_prior().
- added vaidation checks on strdup, strtoul.Quoted 8 lines
- added NC devargs to use cacheable ops conditionally.
- removed dead code likebd_base_petc.
- Fixedrte_cpu_to_le_16()conversion on flags and combined all flags related patches in one patch.
- Fixed memory leak issue due to TXQ priority patch.
- There were some false positives, I have ignored them:
Race condition on flags field:
clean_tx_ringonly touches HW-completed BDs(next_to_clean→hwci),
Quoted 25 lines
never newly-submitted BDs; doorbell hasn't fired yet.
Missing dcbf inclean_tx_ring:
DPDK is single-threaded per queue; TX path always overwrites flags completely before dcbf.
TX dcbf granularity with wrap:
Safe (AI admits it).
RX refill flush at wrap:
In-loop dcbf at i & mask == 0 already flushes aligned groups; trailing flush only needed for partial groups.
RX reading before invalidate:
dccivac precedes the read for every group in the loopGagandeep Singh (7):
net/enetc: fix TX BD structure
net/enetc: fix queue initialization
net/enetc: support ESP packet type in packet parsing net/enetc: update random MAC generation code
net/enetc: add option to disable VSI messaging net/enetc: add devargs to control VSI-PSI timeout and delay net/enetc4: add cacheable BD ring support with SW cache maintenanceVanshika Shukla (2):
net/enetc: support scatter-gather
net/enetc: set user configurable priority to TX ringsQuoted 10 lines
doc/guides/nics/features/enetc4.ini | 1 + doc/guides/rel_notes/release_26_07.rst | 10 + drivers/net/enetc/base/enetc_hw.h | 13 +- drivers/net/enetc/enetc.h | 31 +- drivers/net/enetc/enetc4_ethdev.c | 172 ++++++++-- drivers/net/enetc/enetc4_vf.c | 204 ++++++++++-- drivers/net/enetc/enetc_ethdev.c | 25 +- drivers/net/enetc/enetc_rxtx.c | 430 ++++++++++++++++++++++--- 8 files changed, 768 insertions(+), 118 deletions(-)Better but still had some AI feedback if I asked it for more complete review. Agree that putting new devargs in doc is needed.
Error
=====[PATCH v2 7/9] net/enetc: add devargs to control VSI-PSI timeout and delay
drivers/net/enetc/enetc4_vf.c,enetc4_vf_dev_init()kvlist is leaked on the two invalid-value error paths. It is allocated by
rte_kvargs_parse()(line 1347) and only freed at line 1385, but bothreturn -1; /* invalid VSI Timeout, line 1367 */
return -1; /* invalid VSI Delay, line 1380 */return before that free. A malformed enetc4_vsi_timeout= or enetc4_vsi_delay= leaks the kvargs structure on every probe.
Free before returning, e.g.:
Quoted 10 lines
if (errno != 0 || hw->vsi_timeout == 0) { ENETC_PMD_ERR("Invalid VSI Timeout value = %u", hw->vsi_timeout); rte_kvargs_free(kvlist); return -1; }(same for the delay path), or restructure with a goto.
Fixed in v3.
Quoted 5 lines
Warning
=======Series (patches 6-9)
Quoted 8 lines
The new runtime devargs -
enetc4_vsi_disable,enetc4_vsi_timeout,enetc4_vsi_delay,enetc4_txq_prior, and nc - are registered viaRTE_PMD_REGISTER_PARAM_STRINGand noted in the release notes, butdoc/guides/nics/enetc4.rsthas no Runtime Configuration section describing them. Convention is to document devargs in the NIC guide so users can find the syntax (e.g. the nc=1 / 'a|b|c' priority list formats are non-obvious).
Documentation is done in v3
Quoted 15 lines
Info
====[PATCH v2 5/9] and [PATCH v2 9/9] - RX multi-segment reassembly
In
enetc_clean_rx_ring_nc()andenetc_clean_rx_ring_cacheable(), on the frame-last BD:first_seg->pkt_len -= rx_ring->crc_len;reduces
pkt_lenbut leaves the final segment'sdata_lenunchanged, sopkt_len!=sum(data_len)whencrc_lenis non-zero. The old single-segment path kept them equal (pkt_len=data_len=buf_len
-crc_len).
Quoted 6 lines
This is currently unreachable: enetc4 does not advertise
RTE_ETH_RX_OFFLOAD_KEEP_CRC, socrc_lenis always 0 and the subtraction is a no-op. Flagging only so the asymmetry is on record ifKEEP_CRCis ever added - at that point the last segment'sdata_lenwould need the same adjustment (and the CRC may straddle the last two segments).
I have noted it down, will submit the changes as a separate patch when We will support KEEP_CRC in enetc4.
v3 cover ENETC driver related changes series
In reply to Gagandeep SinghV3 changes:
- Added documentation for all devargs in enetc4.rst.
- Fixed kvlist memory leak issue.
V2 changes:
- Fixed an un-used variable compilation issue reported on fedora:43-gcc-minsize
- Fixed various AI reported issues:
- Release notes updated for all new devargs
- enect4.ini features doc updated for scattered RX.
- removed Not required RTE_PTYPE_UNKNOWN.
- Fixed mid-frame mbuf leak in SG case.
- Enabled SG for enetc4 PF also.
- move to calloc from rte_zmalloc in parse_txq_prior().
- added vaidation checks on strdup, strtoul.
- added NC devargs to use cacheable ops conditionally.
- removed dead code like bd_base_p etc.
- Fixed rte_cpu_to_le_16() conversion on flags and combined all flags related patches in one patch.
- Fixed memory leak issue due to TXQ priority patch.
- There were some false positives, I have ignored them:
Race condition on flags field:
clean_tx_ring only touches HW-completed BDs (next_to_clean→hwci), never newly-submitted BDs; doorbell hasn't fired yet.
Missing dcbf in clean_tx_ring:
DPDK is single-threaded per queue; TX path always overwrites flags completely before dcbf.
TX dcbf granularity with wrap:
Safe (AI admits it).
RX refill flush at wrap:
In-loop dcbf at i & mask == 0 already flushes aligned groups; trailing flush only needed for partial groups.
RX reading before invalidate:
dccivac precedes the read for every group in the loop
Gagandeep Singh (7):
net/enetc: fix TX BD structure
net/enetc: fix queue initialization
net/enetc: support ESP packet type in packet parsing net/enetc: update random MAC generation code
net/enetc: add option to disable VSI messaging net/enetc: add devargs to control VSI-PSI timeout and delay net/enetc4: add cacheable BD ring support with SW cache maintenance
Vanshika Shukla (2):
net/enetc: support scatter-gather
net/enetc: set user configurable priority to TX rings
doc/guides/nics/enetc4.rst | 62 +++- doc/guides/nics/features/enetc4.ini | 1 + doc/guides/rel_notes/release_26_07.rst | 10 + drivers/net/enetc/base/enetc_hw.h | 13 +- drivers/net/enetc/enetc.h | 31 +- drivers/net/enetc/enetc4_ethdev.c | 172 ++++++++-- drivers/net/enetc/enetc4_vf.c | 206 ++++++++++-- drivers/net/enetc/enetc_ethdev.c | 25 +- drivers/net/enetc/enetc_rxtx.c | 430 ++++++++++++++++++++++--- 9 files changed, 831 insertions(+), 119 deletions(-)
Signature · 1 line
2.25.1
PATCH v3 1/9 net/enetc: fix TX BD structure
The flags field in struct enetc_tx_bd was declared as uint16_t but ENETC4 TX BDs only use an 8-bit flags byte. Fix the type to uint8_t to match the hardware descriptor layout.
--- drivers/net/enetc/base/enetc_hw.h | 7 +++---- drivers/net/enetc/enetc_rxtx.c | 17 +++++++++-------- 2 files changed, 12 insertions(+), 12 deletions(-)
drivers/net/enetc/base/enetc_hw.h +3 -4
@@ -1,5 +1,5 @@/* SPDX-License-Identifier: BSD-3-Clause -* Copyright 2018-2024 NXP +* Copyright 2018-2026 NXP */ #ifndef _ENETC_HW_H_
@@ -198,8 +198,7 @@ enum enetc_bdr_type {TX, RX};#define ENETC_TX_ADDR (txq, addr) ((void *)((txq)->enetc_txbdr + (addr))) -#define ENETC_TXBD_FLAGS_IE BIT(13) -#define ENETC_TXBD_FLAGS_F BIT(15) +#define ENETC_TXBD_FLAGS_F BIT(7)/* ENETC Parsed values (Little Endian) */ #define ENETC_PARSE_ERROR 0x8000
@@ -262,7 +261,7 @@ struct enetc_tx_bd { uint8_t l3t:1; uint8_t resv:5; uint8_t l4t:3; -uint16_t flags; +uint8_t flags; };/* default layout */ uint32_t txstart;uint32_t lstatus;
drivers/net/enetc/enetc_rxtx.c +9 -8
@@ -1,5 +1,5 @@/* SPDX-License-Identifier: BSD-3-Clause -* Copyright 2018-2024 NXP +* Copyright 2018-2026 NXP */ #include <stdbool.h>
@@ -101,7 +101,7 @@ enetc_xmit_pkts(void *tx_queue, tx_swbd = &tx_ring->q_swbd[i]; txbd->frm_len = tx_pkts[start]->pkt_len; txbd->buf_len = txbd->frm_len; - txbd->flags =rte_cpu_to_le_16 (ENETC_TXBD_FLAGS_F ); + txbd->flags =ENETC_TXBD_FLAGS_F ; txbd->addr = (uint64_t )(uintptr_t )rte_cpu_to_le_64 ((size_t )tx_swbd->buffer_addr->buf_iova + tx_swbd->buffer_addr->data_off);
@@ -133,13 +133,13 @@ enetc4_tx_offload_checksum(struct rte_mbuf *mbuf, struct enetc_tx_bd *txbd) txbd->ipcs =ENETC4_TXBD_IPCS ; txbd->l3_start = mbuf->l2_len; txbd->l3_hdr_size = mbuf->l3_len /4 ; - txbd->flags |=rte_cpu_to_le_16 (ENETC4_TXBD_FLAGS_L_TX_CKSUM ); + txbd->flags |=ENETC4_TXBD_FLAGS_L_TX_CKSUM ;if ((mbuf->ol_flags &RTE_MBUF_F_TX_UDP_CKSUM ) ==RTE_MBUF_F_TX_UDP_CKSUM ) { - txbd->l4t =rte_cpu_to_le_16 (ENETC4_TXBD_L4T_UDP ); - txbd->flags |=rte_cpu_to_le_16 (ENETC4_TXBD_FLAGS_L4CS ); + txbd->l4t =ENETC4_TXBD_L4T_UDP ; + txbd->flags |=ENETC4_TXBD_FLAGS_L4CS ; }else if ((mbuf->ol_flags &RTE_MBUF_F_TX_TCP_CKSUM ) ==RTE_MBUF_F_TX_TCP_CKSUM ) { - txbd->l4t =rte_cpu_to_le_16 (ENETC4_TXBD_L4T_TCP ); - txbd->flags |=rte_cpu_to_le_16 (ENETC4_TXBD_FLAGS_L4CS ); + txbd->l4t =ENETC4_TXBD_L4T_TCP ; + txbd->flags |=ENETC4_TXBD_FLAGS_L4CS ; } } }
@@ -172,7 +172,7 @@ enetc_xmit_pkts_nc(void *tx_queue,dcbf (data + j); txbd =ENETC_TXBD (*tx_ring, i); - txbd->flags =rte_cpu_to_le_16 (ENETC4_TXBD_FLAGS_F ); + txbd->flags =0 ;if (tx_ring->q_swbd[i].buffer_addr->ol_flags &ENETC4_TX_CKSUM_OFFLOAD_MASK )enetc4_tx_offload_checksum (tx_ring->q_swbd[i].buffer_addr, txbd);
@@ -182,6 +182,7 @@ enetc_xmit_pkts_nc(void *tx_queue, txbd->addr = (uint64_t )(uintptr_t )rte_cpu_to_le_64 ((size_t )tx_swbd->buffer_addr->buf_iova + tx_swbd->buffer_addr->data_off); + txbd->flags |=ENETC4_TXBD_FLAGS_F ; i++; start++;if (unlikely (i == tx_ring->bd_count))
Signature · 1 line
2.25.1
PATCH v3 2/9 net/enetc: fix queue initialization
In reply to Gagandeep SinghHardware can misbehave if the user tries to reset the consumer and producer indexes without resetting the ring.
This patch adds the ring reset step before resetting the indexes.
--- drivers/net/enetc/enetc4_ethdev.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-)
drivers/net/enetc/enetc4_ethdev.c +11 -1
@@ -1,5 +1,5 @@/* SPDX-License-Identifier: BSD-3-Clause -* Copyright 2024 NXP +* Copyright 2024-2026 NXP */ #include <stdbool.h>
@@ -279,6 +279,7 @@ enetc4_tx_queue_setup(struct rte_eth_dev *dev, const struct rte_eth_txconf *tx_conf) {int err; +uint32_t tx_data;struct enetc_bdr *tx_ring;struct rte_eth_dev_data *data = dev->data; struct enetc_eth_adapter *priv =
@@ -301,6 +302,10 @@ enetc4_tx_queue_setup(struct rte_eth_dev *dev, goto fail; tx_ring->ndev = dev; +/* reset queue */ + tx_data =enetc4_txbdr_rd (&priv->hw.hw, tx_ring->index,ENETC_TBMR ); + tx_data &= ~ENETC_TBMR_EN ; +enetc4_txbdr_wr (&priv->hw.hw, tx_ring->index,ENETC_TBMR , tx_data);enetc4_setup_txbdr (&priv->hw.hw, tx_ring); data->tx_queues[queue_idx] = tx_ring; tx_ring->tx_deferred_start = tx_conf->tx_deferred_start;
@@ -427,6 +432,7 @@ enetc4_rx_queue_setup(struct rte_eth_dev *dev, struct rte_mempool *mb_pool) {int err =0 ; +uint32_t rx_enable;struct enetc_bdr *rx_ring;struct rte_eth_dev_data *data = dev->data; struct enetc_eth_adapter *adapter =
@@ -450,6 +456,10 @@ enetc4_rx_queue_setup(struct rte_eth_dev *dev, goto fail; rx_ring->ndev = dev; +/* reset queue */ + rx_enable =enetc4_rxbdr_rd (&adapter->hw.hw, rx_ring->index,ENETC_RBMR ); + rx_enable &= ~ENETC_RBMR_EN ; +enetc4_rxbdr_wr (&adapter->hw.hw, rx_ring->index,ENETC_RBMR , rx_enable);enetc4_setup_rxbdr (&adapter->hw.hw, rx_ring, mb_pool); data->rx_queues[rx_queue_id] = rx_ring; rx_ring->rx_deferred_start = rx_conf->rx_deferred_start;
Signature · 1 line
2.25.1
PATCH v3 3/9 net/enetc: support ESP packet type in packet parsing
In reply to Gagandeep SinghAdd ESP (Encapsulating Security Payload) packet type definitions and handling to the RX packet parsing path. Also update the supported ptypes array to advertise ESP tunnel type support.
--- doc/guides/rel_notes/release_26_07.rst | 3 +++ drivers/net/enetc/base/enetc_hw.h | 4 ++++ drivers/net/enetc/enetc_ethdev.c | 3 ++- drivers/net/enetc/enetc_rxtx.c | 10 ++++++++++ 4 files changed, 19 insertions(+), 1 deletion(-)
doc/guides/rel_notes/release_26_07.rst +3 -0
@@ -187,6 +187,9 @@ New Features ``RTE_ETH_EVENT_RECOVERY_FAILED``) to notify upper layers of the reset lifecycle. +* **Updated NXP ENETC ethernet driver.** + + * Added support for ESP packet type in packet parsing Removed Items -------------
drivers/net/enetc/base/enetc_hw.h +4 -0
@@ -226,6 +226,10 @@ enum enetc_bdr_type {TX, RX}; (0x0003 | ENETC_PKT_TYPE_IPV4)#define ENETC_PKT_TYPE_IPV6_ICMP \ (0x0003 | ENETC_PKT_TYPE_IPV6) +#define ENETC_PKT_TYPE_IPV4_ESP \ + (0x0005 | ENETC_PKT_TYPE_IPV4) +#define ENETC_PKT_TYPE_IPV6_ESP \ + (0x0005 | ENETC_PKT_TYPE_IPV6)/* PCI device info */ struct enetc_hw {
drivers/net/enetc/enetc_ethdev.c +2 -1
@@ -1,5 +1,5 @@/* SPDX-License-Identifier: BSD-3-Clause -* Copyright 2018-2024 NXP +* Copyright 2018-2026 NXP */ #include <stdbool.h>
@@ -95,6 +95,7 @@ enetc_supported_ptypes_get(struct rte_eth_dev *dev __rte_unused,RTE_PTYPE_L4_UDP ,RTE_PTYPE_L4_SCTP ,RTE_PTYPE_L4_ICMP , + RTE_PTYPE_TUNNEL_ESP }; *no_of_elements =RTE_DIM (ptypes);
drivers/net/enetc/enetc_rxtx.c +10 -0
@@ -370,6 +370,16 @@ enetc_dev_rx_parse(struct rte_mbuf *m, uint16_t parse_results)RTE_PTYPE_L3_IPV6 |RTE_PTYPE_L4_UDP ;return ; +case ENETC_PKT_TYPE_IPV4_ESP : + m->packet_type =RTE_PTYPE_L2_ETHER | +RTE_PTYPE_L3_IPV4 | +RTE_PTYPE_TUNNEL_ESP ; +return ; +case ENETC_PKT_TYPE_IPV6_ESP : + m->packet_type =RTE_PTYPE_L2_ETHER | +RTE_PTYPE_L3_IPV6 | +RTE_PTYPE_TUNNEL_ESP ; +return ;case ENETC_PKT_TYPE_IPV4_SCTP : m->packet_type =RTE_PTYPE_L2_ETHER | RTE_PTYPE_L3_IPV4 |
Signature · 1 line
2.25.1
PATCH v3 4/9 net/enetc: update random MAC generation code
In reply to Gagandeep SinghUse rte_eth_random_addr() instead of manual rte_rand() based MAC generation. Also handle VF path by writing to ENETC_SIPMAR0/1 instead of ENETC_PSIPMAR0/1 when running as a VF.
--- drivers/net/enetc/enetc_ethdev.c | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-)
drivers/net/enetc/enetc_ethdev.c +10 -12
@@ -195,20 +195,18 @@ enetc_hardware_init(struct enetc_eth_hw *hw) }if ((high_mac | low_mac) ==0 ) { -char *first_byte; -ENETC_PMD_NOTICE ("MAC is not available for this SI, " "set random MAC" ); - mac = (uint32_t *)hw->mac.addr; - *mac = (uint32_t )rte_rand (); - first_byte = (char *)mac; - *first_byte &=0xfe ;/* clear multicast bit */ - *first_byte |=0x02 ;/* set local assignment bit (IEEE802) */ - -enetc_port_wr (enetc_hw,ENETC_PSIPMAR0 (0 ), *mac); - mac++; - *mac = (uint16_t )rte_rand (); -enetc_port_wr (enetc_hw,ENETC_PSIPMAR1 (0 ), *mac); +rte_eth_random_addr (hw->mac.addr); + high_mac = *(uint32_t *)hw->mac.addr; + low_mac = *(uint16_t *)(hw->mac.addr +4 ); +if (hw->device_id ==ENETC_DEV_ID_VF ) { +enetc_wr (enetc_hw,ENETC_SIPMAR0 , high_mac); +enetc_wr (enetc_hw,ENETC_SIPMAR1 , low_mac); + }else { +enetc_port_wr (enetc_hw,ENETC_PSIPMAR0 (0 ), high_mac); +enetc_port_wr (enetc_hw,ENETC_PSIPMAR1 (0 ), low_mac); + }enetc_print_ethaddr ("New address: " , (const struct rte_ether_addr *)hw->mac.addr); }
Signature · 1 line
2.25.1
PATCH v3 5/9 net/enetc: support scatter-gather
In reply to Gagandeep SinghFrom: Vanshika Shukla <[email protected]>
Add scatter-gather support for ENETC4 PMD:
- Add ENETC_RXBD_LSTATUS_R/F bits for RX BD status
- Add ENETC4_MAX_SEGS (63) for max segments per TX packet
- Update enetc4_vf_dev_infos_get to fill nb_seg_max, offloads, max queues and packet length
- Extend enetc_xmit_pkts_nc to handle multi-segment mbufs
- Extend enetc_clean_rx_ring_nc to chain scatter-gather segments using LSTATUS_R/F bits
--- doc/guides/nics/features/enetc4.ini | 1 + doc/guides/rel_notes/release_26_07.rst | 3 +- drivers/net/enetc/base/enetc_hw.h | 2 + drivers/net/enetc/enetc.h | 7 +- drivers/net/enetc/enetc4_ethdev.c | 10 +- drivers/net/enetc/enetc4_vf.c | 46 +++++++-- drivers/net/enetc/enetc_rxtx.c | 129 ++++++++++++++++--------- 7 files changed, 139 insertions(+), 59 deletions(-)
doc/guides/nics/features/enetc4.ini +1 -0
@@ -17,6 +17,7 @@ Basic stats = Y L3 checksum offload = Y L4 checksum offload = Y Queue start/stop = Y +Scattered Rx = Y Linux = Y ARMv8 = Y Usage doc = Y
doc/guides/rel_notes/release_26_07.rst +2 -1
@@ -189,7 +189,8 @@ New Features * **Updated NXP ENETC ethernet driver.** - * Added support for ESP packet type in packet parsing + * Added support for ESP packet type in packet parsing. + * Added scatter-gather support for ENETC4 PFs and VFs. Removed Items -------------
drivers/net/enetc/base/enetc_hw.h +2 -0
@@ -230,6 +230,8 @@ enum enetc_bdr_type {TX, RX}; (0x0005 | ENETC_PKT_TYPE_IPV4)#define ENETC_PKT_TYPE_IPV6_ESP \ (0x0005 | ENETC_PKT_TYPE_IPV6) +#define ENETC_RXBD_LSTATUS_R BIT(30) +#define ENETC_RXBD_LSTATUS_F BIT(31)/* PCI device info */ struct enetc_hw {
drivers/net/enetc/enetc.h +6 -1
@@ -1,5 +1,5 @@/* SPDX-License-Identifier: BSD-3-Clause -* Copyright 2018-2019,2024 NXP +* Copyright 2018-2019,2024-2026 NXP */ #ifndef _ENETC_H_
@@ -28,6 +28,8 @@#define MIN_BD_COUNT 32/* BD ALIGN */ #define BD_ALIGN 8 +/* Max segments per ENETC4 TX packet (scatter-gather) */ +#define ENETC4_MAX_SEGS 63/* minimum frame size supported */ #define ENETC_MAC_MINFRM_SIZE 68
@@ -90,6 +92,9 @@ struct enetc_bdr {int next_to_alloc;/* Rx */ };struct rte_mempool *mb_pool;/* mbuf pool to populate RX ring. */ +/* Partial scatter-gather chain persisted across burst calls. */ +struct rte_mbuf *pkt_first_seg;/* first segment of in-progress frame */ +struct rte_mbuf *pkt_last_seg;/* last segment linked so far */ struct rte_eth_dev *ndev;uint64_t ierrors;uint8_t rx_deferred_start;
drivers/net/enetc/enetc4_ethdev.c +8 -2
@@ -14,13 +14,15 @@static uint64_t dev_rx_offloads_sup =RTE_ETH_RX_OFFLOAD_IPV4_CKSUM |RTE_ETH_RX_OFFLOAD_UDP_CKSUM | -RTE_ETH_RX_OFFLOAD_TCP_CKSUM ; +RTE_ETH_RX_OFFLOAD_TCP_CKSUM | +RTE_ETH_RX_OFFLOAD_SCATTER ;/* Supported Tx offloads */ static uint64_t dev_tx_offloads_sup =RTE_ETH_TX_OFFLOAD_IPV4_CKSUM |RTE_ETH_TX_OFFLOAD_UDP_CKSUM | -RTE_ETH_TX_OFFLOAD_TCP_CKSUM ; +RTE_ETH_TX_OFFLOAD_TCP_CKSUM | +RTE_ETH_TX_OFFLOAD_MULTI_SEGS ;static int enetc4_dev_start (struct rte_eth_dev *dev)
@@ -199,11 +201,15 @@ enetc4_dev_infos_get(struct rte_eth_dev *dev, .nb_max = MAX_BD_COUNT, .nb_min = MIN_BD_COUNT, .nb_align = BD_ALIGN, + .nb_seg_max = ENETC4_MAX_SEGS, + .nb_mtu_seg_max = ENETC4_MAX_SEGS, }; dev_info->tx_desc_lim = (struct rte_eth_desc_lim ) { .nb_max =MAX_BD_COUNT , .nb_min =MIN_BD_COUNT , .nb_align =BD_ALIGN , + .nb_seg_max =ENETC4_MAX_SEGS , + .nb_mtu_seg_max =ENETC4_MAX_SEGS , }; dev_info->max_rx_queues = hw->max_rx_queues; dev_info->max_tx_queues = hw->max_tx_queues;
drivers/net/enetc/enetc4_vf.c +37 -9
71 lines not on this page · raw message
drivers/net/enetc/enetc_rxtx.c +83 -46
184 lines not on this page · raw message
Signature · 1 line
2.25.1
PATCH v3 6/9 net/enetc: add option to disable VSI messaging
In reply to Gagandeep SinghAdd devarg 'enetc4_vsi_disable' to allow disabling features dependent on VSI-PSI messaging. This is useful for testing DPDK with a PF driver that does not support VSI-PSI messages.
When the devarg is present, a reduced ops table (enetc4_vf_ops_no_vsi_m) is used that replaces link_update with a no-op stub and omits MAC/VLAN filter ops that require VSI msgs.
--- doc/guides/nics/enetc4.rst | 22 +++++++++- doc/guides/rel_notes/release_26_07.rst | 2 + drivers/net/enetc/enetc4_vf.c | 61 ++++++++++++++++++++++++-- 3 files changed, 81 insertions(+), 4 deletions(-)
doc/guides/nics/enetc4.rst +21 -1
@@ -1,5 +1,5 @@ .. SPDX-License-Identifier: BSD-3-Clause - Copyright 2024-2025 NXP + Copyright 2024-2026 NXP ENETC4 Poll Mode Driver =======================
@@ -90,3 +90,23 @@ Driver compilation and testing Follow instructions available in the document :ref:`compiling and testing a PMD for a NIC <pmd_build_and_test>` to launch **testpmd**. + + +Driver Arguments (devargs) +-------------------------- + +The ENETC4 PMD supports the following device arguments (devargs) +that can be passed via ``-a`` (allow-list) option in DPDK applications. + +VF-specific devargs +~~~~~~~~~~~~~~~~~~~ + +``enetc4_vsi_disable`` + Disable VSI-PSI messaging for the VF. + When present, features that require VSI-PSI communication + (link update, MAC filter, VLAN filter) are replaced with no-op stubs. + Useful when the PF driver does not support VSI-PSI messages. + + Usage example:: + + dpdk-testpmd -a 0000:00:01.0,enetc4_vsi_disable -- -i
doc/guides/rel_notes/release_26_07.rst +2 -0
@@ -191,6 +191,8 @@ New Features * Added support for ESP packet type in packet parsing. * Added scatter-gather support for ENETC4 PFs and VFs. + * Added devargs option ``enetc4_vsi_disable`` to disable VSI-PSI + messaging. Removed Items -------------
drivers/net/enetc/enetc4_vf.c +58 -3
100 lines not on this page · raw message
Signature · 1 line
2.25.1
PATCH v3 7/9 net/enetc: add devargs to control VSI-PSI timeout and delay
In reply to Gagandeep SinghAdd two new devargs for ENETC4 VF:
- enetc4_vsi_timeout: VSI-PSI message wait timeout (iteration count)
- enetc4_vsi_delay: VSI-PSI message wait delay in microseconds
Store the values in struct enetc_eth_hw and use them in enetc4_msg_vsi_send() instead of the hardcoded defaults. Fall back to ENETC4_DEF_VSI_WAIT_TIMEOUT_UPDATE / ENETC4_DEF_VSI_WAIT_DELAY_UPDATE when not set.
--- doc/guides/nics/enetc4.rst | 18 +++++++ doc/guides/rel_notes/release_26_07.rst | 2 + drivers/net/enetc/enetc.h | 2 + drivers/net/enetc/enetc4_vf.c | 68 +++++++++++++++++++------- 4 files changed, 73 insertions(+), 17 deletions(-)
doc/guides/nics/enetc4.rst +18 -0
@@ -110,3 +110,21 @@ VF-specific devargs Usage example:: dpdk-testpmd -a 0000:00:01.0,enetc4_vsi_disable -- -i + +``enetc4_vsi_timeout`` + Set the VSI-PSI message wait timeout as an iteration count. + Controls how many polling iterations the driver waits for a VSI-PSI + response before timing out. + Defaults to ``ENETC4_DEF_VSI_WAIT_TIMEOUT_UPDATE`` when not set. + + Usage example:: + + dpdk-testpmd -a 0000:00:01.0,enetc4_vsi_timeout=200 -- -i + +``enetc4_vsi_delay`` + Set the VSI-PSI message wait delay in microseconds between polling iterations. + Defaults to ``ENETC4_DEF_VSI_WAIT_DELAY_UPDATE`` when not set. + + Usage example:: + + dpdk-testpmd -a 0000:00:01.0,enetc4_vsi_delay=10 -- -i
doc/guides/rel_notes/release_26_07.rst +2 -0
@@ -193,6 +193,8 @@ New Features * Added scatter-gather support for ENETC4 PFs and VFs. * Added devargs option ``enetc4_vsi_disable`` to disable VSI-PSI messaging. + * Added devargs options ``enetc4_vsi_timeout`` and ``enetc4_vsi_delay`` + for VSI-PSI messaging timeout and delay. Removed Items -------------
drivers/net/enetc/enetc.h +2 -0
@@ -112,6 +112,8 @@ struct enetc_eth_hw {uint32_t num_rss;uint32_t max_rx_queues;uint32_t max_tx_queues; +uint32_t vsi_timeout;/* VSI-PSI message wait timeout (iterations) */ +uint32_t vsi_delay;/* VSI-PSI message wait delay (us) */ };/*
drivers/net/enetc/enetc4_vf.c +51 -17
175 lines not on this page · raw message
Signature · 1 line
2.25.1
PATCH v3 8/9 net/enetc: set user configurable priority to TX rings
In reply to Gagandeep SinghFrom: Vanshika Shukla <[email protected]>
Add devarg 'enetc4_txq_prior' to allow per-queue TX ring priority configuration. The value is a '|'-separated list of TBMR priority bits, one per TX queue (e.g. 'enetc4_txq_prior=1|2|3'). The configuration accepts values only up to the maximum supported TX queues. Any additional values beyond this supported range are discarded.
Store the parsed priorities in hw->txq_prior and apply them in enetc4_tx_queue_setup() when enabling the ring.
--- doc/guides/nics/enetc4.rst | 12 ++++ doc/guides/rel_notes/release_26_07.rst | 1 + drivers/net/enetc/enetc.h | 1 + drivers/net/enetc/enetc4_ethdev.c | 81 +++++++++++++++++++++++++- 4 files changed, 94 insertions(+), 1 deletion(-)
doc/guides/nics/enetc4.rst +12 -0
@@ -128,3 +128,15 @@ VF-specific devargs Usage example:: dpdk-testpmd -a 0000:00:01.0,enetc4_vsi_delay=10 -- -i + +PF/Common devargs +~~~~~~~~~~~~~~~~~ + +``enetc4_txq_prior`` + Set per-queue TX ring priority (TBMR bits). + The value is a ``|``-separated list of priority values, one per TX queue. + Values beyond the maximum supported TX queue count are discarded. + + Usage example:: + + dpdk-testpmd -a 0000:00:00.0,enetc4_txq_prior=1|2|3 -- -i
doc/guides/rel_notes/release_26_07.rst +1 -0
@@ -195,6 +195,7 @@ New Features messaging. * Added devargs options ``enetc4_vsi_timeout`` and ``enetc4_vsi_delay`` for VSI-PSI messaging timeout and delay. + * Added devargs option ``enetc4_txq_prior`` to set TX queues priorities. Removed Items -------------
drivers/net/enetc/enetc.h +1 -0
@@ -114,6 +114,7 @@ struct enetc_eth_hw {uint32_t max_tx_queues;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) */ };/*
drivers/net/enetc/enetc4_ethdev.c +80 -1
119 lines not on this page · raw message
Signature · 1 line
2.25.1
PATCH v3 9/9 net/enetc4: add cacheable BD ring support with SW cache maintenance
In reply to Gagandeep SinghOn non-cache-coherent platforms such as i.MX95, the BD ring memory may be mapped as cacheable (normal memory) while the ENETC hardware DMA engine writes and reads descriptors without CPU cache snooping. SW must therefore perform explicit cache maintenance to keep CPU caches and DDR coherent.
TX path (enetc_xmit_pkts_cacheable):
- Flush each segment's payload cache lines to PoC (dcbf) before the BD is handed to HW, so HW DMA reads the correct data.
- After all BDs for a burst are written, flush the BD cache lines (dcbf, one per 64-byte group of 4 BDs) so HW can read the updated descriptors.
RX refill (enetc_refill_rx_ring):
- After writing each full 4-BD cache-line group, dcbf that group so HW sees the buffer addresses and cleared lstatus fields.
- Flush any partial trailing group before updating the ring tail.
RX receive (enetc_recv_pkts_cacheable via enetc_clean_rx_ring_cacheable):
- Before reading BD status, dccivac the current BD cache line so stale CPU-cached BD data is discarded and fresh HW-written content is fetched from DDR.
- After a BD is consumed, dccivac each payload cache line so the CPU reads the DMA'd packet data, not stale cached bytes.
Add a new devarg 'nc=1' that allows selecting the non-cacheable RX/TX ops.
When nc=1 is specified:
eth_dev->rx_pkt_burst = &enetc_recv_pkts_nc; eth_dev->tx_pkt_burst = &enetc_xmit_pkts_nc;
The default (nc not set or nc=0) keeps the cacheable path with SW cache maintenance (dccivac/dcbf):
eth_dev->rx_pkt_burst = &enetc_recv_pkts_cacheable; eth_dev->tx_pkt_burst = &enetc_xmit_pkts_cacheable;
Usage:
--allow 0000:00:01.0,nc=1
--- doc/guides/nics/enetc4.rst | 10 + doc/guides/rel_notes/release_26_07.rst | 1 + drivers/net/enetc/enetc.h | 21 ++ drivers/net/enetc/enetc4_ethdev.c | 71 +++++-- drivers/net/enetc/enetc4_vf.c | 35 +++- drivers/net/enetc/enetc_rxtx.c | 278 ++++++++++++++++++++++++- 6 files changed, 398 insertions(+), 18 deletions(-)
doc/guides/nics/enetc4.rst +10 -0
@@ -140,3 +140,13 @@ PF/Common devargs Usage example:: dpdk-testpmd -a 0000:00:00.0,enetc4_txq_prior=1|2|3 -- -i + +``nc`` + Select non-cacheable RX/TX ops (BD rings mapped as non-cacheable memory). + Set to ``1`` to use non-cacheable descriptor ring operations. + By default, cacheable BD rings with software cache maintenance are used. + Applies to both PF and VF. + + Usage example:: + + dpdk-testpmd -a 0000:00:00.0,nc=1 -- -i
doc/guides/rel_notes/release_26_07.rst +1 -0
@@ -196,6 +196,7 @@ New Features * Added devargs options ``enetc4_vsi_timeout`` and ``enetc4_vsi_delay`` for VSI-PSI messaging timeout and delay. * Added devargs option ``enetc4_txq_prior`` to set TX queues priorities. + * Added devargs option ``nc`` to select non-cacheable RX/TX ops. Removed Items -------------
drivers/net/enetc/enetc.h +21 -0
@@ -115,6 +115,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) */ +uint8_t nc_mode;/* 1 = non-cacheable BD memory, use _nc ops */ };/*
@@ -315,8 +316,28 @@ 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_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); + +/* +* Cache-maintenance constants for cacheable BD ring mode. +* +* BD = 16 bytes, cache line = 64 bytes => 4 BDs per cache line. +* Every dcbf in enetc_refill_rx_ring() flushes a full 64-byte cache line. +* To ensure each dcbf covers only fully-written BDs the caller +* must pass a count rounded DOWN to a multiple of ENETC_BD_PER_CL so that +* the last partial group is left in cache to be completed and flushed in +* the next call. +*/ +#define ENETC_BD_PER_CL (RTE_CACHE_LINE_SIZE / sizeof(union enetc_rx_bd)) +#define ENETC_BD_PER_CL_MASK (ENETC_BD_PER_CL - 1) +/* Round n DOWN to the nearest multiple of ENETC_BD_PER_CL. */ +#define ENETC_BD_ALIGN_DOWN (n) ((n) & ~(unsigned int)ENETC_BD_PER_CL_MASK) +void enetc4_dev_hw_init (struct rte_eth_dev *eth_dev);void enetc_print_ethaddr (const char *name,const struct rte_ether_addr *eth_addr);
drivers/net/enetc/enetc4_ethdev.c +55 -16
143 lines not on this page · raw message
drivers/net/enetc/enetc4_vf.c +34 -1
@@ -12,6 +12,30 @@#define ENETC4_VSI_DISABLE "enetc4_vsi_disable"#define ENETC4_VSI_TIMEOUT "enetc4_vsi_timeout"#define ENETC4_VSI_DELAY "enetc4_vsi_delay" +#define ENETC4_NC_MEMORY "nc" + +static void +enetc4_vf_get_devarg_nc (struct rte_eth_dev *dev) +{ +struct enetc_eth_hw *hw = +ENETC_DEV_PRIVATE_TO_HW (dev->data->dev_private); +struct rte_devargs *devargs = dev->device->devargs; +struct rte_kvargs *kvlist; +const char *val; + +if (!devargs) +return ; + + kvlist =rte_kvargs_parse (devargs->args,NULL ); +if (!kvlist) +return ; + + val =rte_kvargs_get (kvlist,ENETC4_NC_MEMORY ); +if (val &&atoi (val) ==1 ) + hw->nc_mode =1 ; + +rte_kvargs_free (kvlist); +}#define ENETC_CRC_TABLE_SIZE 256#define ENETC_POLY 0x1021
@@ -1370,6 +1394,14 @@ enetc4_vf_dev_init(struct rte_eth_dev *eth_dev)enetc4_dev_hw_init (eth_dev); + hw->nc_mode =0 ; +enetc4_vf_get_devarg_nc (eth_dev); +if (hw->nc_mode) { + eth_dev->rx_pkt_burst = &enetc_recv_pkts_nc; + eth_dev->tx_pkt_burst = &enetc_xmit_pkts_nc; +ENETC_PMD_LOG (INFO ,"nc=1: using non-cacheable BD ops (_nc)" ); + } + si_cap =enetc_rd (enetc_hw,ENETC_SICAPR0 ); hw->max_tx_queues = si_cap &ENETC_SICAPR0_BDR_MASK ; hw->max_rx_queues = (si_cap >>16 ) &ENETC_SICAPR0_BDR_MASK ;
@@ -1477,5 +1509,6 @@ RTE_PMD_REGISTER_KMOD_DEP(net_enetc4_vf, "* igb_uio | uio_pci_generic");RTE_PMD_REGISTER_PARAM_STRING (net_enetc4_vf,ENETC4_VSI_DISABLE "=<any> " ENETC4_VSI_TIMEOUT "=<uint> " -ENETC4_VSI_DELAY "=<uint>" ); +ENETC4_VSI_DELAY "=<uint> " +ENETC4_NC_MEMORY "=<int>" );RTE_LOG_REGISTER_DEFAULT (enetc4_vf_logtype_pmd,NOTICE );
drivers/net/enetc/enetc_rxtx.c +277 -1
323 lines not on this page · raw message
Signature · 1 line
2.25.1
Re: [PATCH v3 0/9] ENETC driver related changes series
In reply to Gagandeep SinghQuoted 47 lines · On Tue, 23 Jun 2026 11:29:55 +0530 Gagandeep Singh <[email protected]> wrote:
V3 changes:
- Added documentation for all devargs inenetc4.rst.
- Fixed kvlist memory leak issue.V2 changes:
- Fixed an un-used variable compilation issue reported on fedora:43-gcc-minsize
- Fixed various AI reported issues:
- Release notes updated for all new devargs
- enect4.ini features doc updated for scattered RX.
- removed Not requiredRTE_PTYPE_UNKNOWN.
- Fixed mid-frame mbuf leak in SG case.
- Enabled SG for enetc4 PF also.
- move to calloc fromrte_zmallocinparse_txq_prior().
- added vaidation checks on strdup, strtoul.
- added NC devargs to use cacheable ops conditionally.
- removed dead code likebd_base_petc.
- Fixedrte_cpu_to_le_16()conversion on flags and combined all flags related patches in one patch.
- Fixed memory leak issue due to TXQ priority patch.
- There were some false positives, I have ignored them:
Race condition on flags field:
clean_tx_ringonly touches HW-completed BDs (next_to_clean→hwci), never newly-submitted BDs; doorbell hasn't fired yet.
Missing dcbf inclean_tx_ring:
DPDK is single-threaded per queue; TX path always overwrites flags completely before dcbf.
TX dcbf granularity with wrap:
Safe (AI admits it).
RX refill flush at wrap:
In-loop dcbf at i & mask == 0 already flushes aligned groups; trailing flush only needed for partial groups.
RX reading before invalidate:
dccivac precedes the read for every group in the loopGagandeep Singh (7):
net/enetc: fix TX BD structure
net/enetc: fix queue initialization
net/enetc: support ESP packet type in packet parsing net/enetc: update random MAC generation code
net/enetc: add option to disable VSI messaging net/enetc: add devargs to control VSI-PSI timeout and delay net/enetc4: add cacheable BD ring support with SW cache maintenanceVanshika Shukla (2):
net/enetc: support scatter-gather
net/enetc: set user configurable priority to TX rings
Quoted 11 lines
doc/guides/nics/enetc4.rst | 62 +++- doc/guides/nics/features/enetc4.ini | 1 + doc/guides/rel_notes/release_26_07.rst | 10 + drivers/net/enetc/base/enetc_hw.h | 13 +- drivers/net/enetc/enetc.h | 31 +- drivers/net/enetc/enetc4_ethdev.c | 172 ++++++++-- drivers/net/enetc/enetc4_vf.c | 206 ++++++++++-- drivers/net/enetc/enetc_ethdev.c | 25 +- drivers/net/enetc/enetc_rxtx.c | 430 ++++++++++++++++++++++--- 9 files changed, 831 insertions(+), 119 deletions(-)
Did followup AI review and it had some more things that need fixing:
Error
=====
[PATCH v2 7/9] net/enetc: add devargs to control VSI-PSI timeout and delay
drivers/net/enetc/enetc4_vf.c, enetc4_vf_dev_init()
kvlist is leaked on the two invalid-value error paths. It is allocated by rte_kvargs_parse() (line 1347) and only freed at line 1385, but both
return -1; /* invalid VSI Timeout, line 1367 */
return -1; /* invalid VSI Delay, line 1380 */
return before that free. A malformed enetc4_vsi_timeout= or enetc4_vsi_delay= leaks the kvargs structure on every probe.
Free before returning, e.g.:
if (errno != 0 || hw->vsi_timeout == 0) {
ENETC_PMD_ERR("Invalid VSI Timeout value = %u",
hw->vsi_timeout);
rte_kvargs_free(kvlist);
return -1;
}(same for the delay path), or restructure with a goto.
Warning
=======
Series (patches 6-9)
The new runtime devargs - enetc4_vsi_disable, enetc4_vsi_timeout, enetc4_vsi_delay, enetc4_txq_prior, and nc - are registered via RTE_PMD_REGISTER_PARAM_STRING and noted in the release notes, but doc/guides/nics/enetc4.rst has no Runtime Configuration section describing them. Convention is to document devargs in the NIC guide so users can find the syntax (e.g. the nc=1 / 'a|b|c' priority list formats are non-obvious).
Info
====
[PATCH v2 5/9] and [PATCH v2 9/9] - RX multi-segment reassembly
In enetc_clean_rx_ring_nc() and enetc_clean_rx_ring_cacheable(), on the frame-last BD:
first_seg->pkt_len -= rx_ring->crc_len;
reduces pkt_len but leaves the final segment's data_len unchanged, so pkt_len != sum(data_len) when crc_len is non-zero. The old single-segment path kept them equal (pkt_len = data_len = buf_len
- crc_len).
This is currently unreachable: enetc4 does not advertise RTE_ETH_RX_OFFLOAD_KEEP_CRC, so crc_len is always 0 and the subtraction is a no-op. Flagging only so the asymmetry is on record if KEEP_CRC is ever added - at that point the last segment's data_len would need the same adjustment (and the CRC may straddle the last two segments).
RE: [PATCH v3 0/9] ENETC driver related changes series
Hi,
Quoted 130 lines
-----Original Message-----
From: Stephen Hemminger <[email protected]>
Sent: Tuesday, June 23, 2026 9:17 PM
To: Gagandeep Singh <[email protected]>
Cc: [email protected]; Hemant Agrawal <[email protected]>
Subject: Re: [PATCH v3 0/9] ENETC driver related changes seriesQuoted 6 lines · On Tue, 23 Jun 2026 11:29:55 +0530 Gagandeep Singh <[email protected]> wrote:
V3 changes:
- Added documentation for all devargs inenetc4.rst.
- Fixed kvlist memory leak issue.V2 changes:
- Fixed an un-used variable compilation issue reported on fedora:43-gcc-minsize
Quoted 8 lines
- Fixed various AI reported issues:
- Release notes updated for all new devargs
- enect4.ini features doc updated for scattered RX.
- removed Not requiredRTE_PTYPE_UNKNOWN.
- Fixed mid-frame mbuf leak in SG case.
- Enabled SG for enetc4 PF also.
- move to calloc fromrte_zmallocinparse_txq_prior().
- added vaidation checks on strdup, strtoul.Quoted 8 lines
- added NC devargs to use cacheable ops conditionally.
- removed dead code likebd_base_petc.
- Fixedrte_cpu_to_le_16()conversion on flags and combined all flags related patches in one patch.
- Fixed memory leak issue due to TXQ priority patch.
- There were some false positives, I have ignored them:
Race condition on flags field:
clean_tx_ringonly touches HW-completed BDs(next_to_clean→hwci),
Quoted 25 lines
never newly-submitted BDs; doorbell hasn't fired yet.
Missing dcbf inclean_tx_ring:
DPDK is single-threaded per queue; TX path always overwrites flags completely before dcbf.
TX dcbf granularity with wrap:
Safe (AI admits it).
RX refill flush at wrap:
In-loop dcbf at i & mask == 0 already flushes aligned groups; trailing flush only needed for partial groups.
RX reading before invalidate:
dccivac precedes the read for every group in the loopGagandeep Singh (7):
net/enetc: fix TX BD structure
net/enetc: fix queue initialization
net/enetc: support ESP packet type in packet parsing net/enetc: update random MAC generation code
net/enetc: add option to disable VSI messaging net/enetc: add devargs to control VSI-PSI timeout and delay net/enetc4: add cacheable BD ring support with SW cache maintenanceVanshika Shukla (2):
net/enetc: support scatter-gather
net/enetc: set user configurable priority to TX ringsQuoted 11 lines
doc/guides/nics/enetc4.rst | 62 +++- doc/guides/nics/features/enetc4.ini | 1 + doc/guides/rel_notes/release_26_07.rst | 10 + drivers/net/enetc/base/enetc_hw.h | 13 +- drivers/net/enetc/enetc.h | 31 +- drivers/net/enetc/enetc4_ethdev.c | 172 ++++++++-- drivers/net/enetc/enetc4_vf.c | 206 ++++++++++-- drivers/net/enetc/enetc_ethdev.c | 25 +- drivers/net/enetc/enetc_rxtx.c | 430 ++++++++++++++++++++++--- 9 files changed, 831 insertions(+), 119 deletions(-)Did followup AI review and it had some more things that need fixing:
Error
=====[PATCH v2 7/9] net/enetc: add devargs to control VSI-PSI timeout and delay
drivers/net/enetc/enetc4_vf.c,enetc4_vf_dev_init()kvlist is leaked on the two invalid-value error paths. It is allocated by
rte_kvargs_parse()(line 1347) and only freed at line 1385, but bothreturn -1; /* invalid VSI Timeout, line 1367 */
return -1; /* invalid VSI Delay, line 1380 */return before that free. A malformed enetc4_vsi_timeout= or enetc4_vsi_delay= leaks the kvargs structure on every probe.
Free before returning, e.g.:
if (errno != 0 || hw->vsi_timeout == 0) { ENETC_PMD_ERR("Invalid VSI Timeout value = %u", hw->vsi_timeout); rte_kvargs_free(kvlist); return -1; }(same for the delay path), or restructure with a goto.
Warning
=======Series (patches 6-9)
The new runtime devargs -
enetc4_vsi_disable,enetc4_vsi_timeout,enetc4_vsi_delay,enetc4_txq_prior, and nc - are registered viaRTE_PMD_REGISTER_PARAM_STRINGand noted in the release notes, butdoc/guides/nics/enetc4.rsthas no Runtime Configuration section describing them. Convention is to document devargs in the NIC guide so users can find the syntax (e.g. the nc=1 / 'a|b|c' priority list formats are non-obvious).Info
====[PATCH v2 5/9] and [PATCH v2 9/9] - RX multi-segment reassembly
In
enetc_clean_rx_ring_nc()andenetc_clean_rx_ring_cacheable(), on the frame-last BD:first_seg->pkt_len -= rx_ring->crc_len;reduces
pkt_lenbut leaves the final segment'sdata_lenunchanged, sopkt_len!=sum(data_len)whencrc_lenis non-zero. The old single-segment path kept them equal (pkt_len=data_len=buf_len
-crc_len).
Quoted 6 lines
This is currently unreachable: enetc4 does not advertise
RTE_ETH_RX_OFFLOAD_KEEP_CRC, socrc_lenis always 0 and the subtraction is a no-op. Flagging only so the asymmetry is on record ifKEEP_CRCis ever added - at that point the last segment'sdata_lenwould need the same adjustment (and the CRC may straddle the last two segments).
It seems that AI reviewed the V2 series instead of the V3 series. I have manually verified that the first two issues are fixed in the V3 series. For the last issue, I will submit a separate patch as a new feature, introducing KEEP_CRC for the enetc4 driver. Additionally, AI has acknowledged that there will be no functional issue as of now, since crc_len will be only 0.
Re: [PATCH v3 0/9] ENETC driver related changes series
Quoted 1 line · On Tue, 23 Jun 2026 17:21:59 +0000 Gagandeep Singh <[email protected]> wrote:
It seems that AI reviewed the V2 series instead of the V3 series. I have manually verified that the first two issues are fixed in the V3 series. For the last issue, I will submit a separate patch as a new feature, introducing
KEEP_CRCfor the enetc4 driver. Additionally, AI has acknowledged that there will be no functional issue as of now, sincecrc_lenwill be only 0.
It was my bad, was looking earlier in that chat.
Looks clean will apply
For V3:
v3 re-review. I diffed every patch against v2; the only substantive code change is in 7/9, and the rest of the delta is documentation.
Both v2 blockers are resolved:
The kvlist leak in enetc4_vf_dev_init() (was Error) is fixed — rte_kvargs_free(kvlist) now precedes both the invalid-timeout and invalid-delay return -1 paths.
The missing devargs documentation (was Warning) is now in doc/guides/nics/enetc4.rst: a new "Driver Arguments (devargs)" section split into VF-specific (enetc4_vsi_disable, enetc4_vsi_timeout, enetc4_vsi_delay) and PF/Common (enetc4_txq_prior, nc) subsections, each with a usage example. Section underlines are the correct length (19/19 and 17/17), so it builds clean under -W; defaults and applicability match the code.
No new issues introduced — patches 1–6 and 8 are byte-identical to v2 apart from the doc hunks, and patch 9's only delta is the nc doc plus line-number offsets shifted by patch 7's two added lines.
For the record, the one item carried over from v2 is unchanged and remains non-blocking: in the RX reassembly paths, first_seg->pkt_len -= crc_len at frame-last doesn't adjust the final segment's data_len, so pkt_len != sum(data_len) if crc_len != 0. This stays latent because enetc4 doesn't advertise RTE_ETH_RX_OFFLOAD_KEEP_CRC (crc_len is always 0). Worth a guard only if KEEP_CRC is ever added; not a reason to hold the series.
No open errors, no open warnings.
Re: [PATCH v3 0/9] ENETC driver related changes series
In reply to Gagandeep SinghQuoted 47 lines · On Tue, 23 Jun 2026 11:29:55 +0530 Gagandeep Singh <[email protected]> wrote:
V3 changes:
- Added documentation for all devargs inenetc4.rst.
- Fixed kvlist memory leak issue.V2 changes:
- Fixed an un-used variable compilation issue reported on fedora:43-gcc-minsize
- Fixed various AI reported issues:
- Release notes updated for all new devargs
- enect4.ini features doc updated for scattered RX.
- removed Not requiredRTE_PTYPE_UNKNOWN.
- Fixed mid-frame mbuf leak in SG case.
- Enabled SG for enetc4 PF also.
- move to calloc fromrte_zmallocinparse_txq_prior().
- added vaidation checks on strdup, strtoul.
- added NC devargs to use cacheable ops conditionally.
- removed dead code likebd_base_petc.
- Fixedrte_cpu_to_le_16()conversion on flags and combined all flags related patches in one patch.
- Fixed memory leak issue due to TXQ priority patch.
- There were some false positives, I have ignored them:
Race condition on flags field:
clean_tx_ringonly touches HW-completed BDs (next_to_clean→hwci), never newly-submitted BDs; doorbell hasn't fired yet.
Missing dcbf inclean_tx_ring:
DPDK is single-threaded per queue; TX path always overwrites flags completely before dcbf.
TX dcbf granularity with wrap:
Safe (AI admits it).
RX refill flush at wrap:
In-loop dcbf at i & mask == 0 already flushes aligned groups; trailing flush only needed for partial groups.
RX reading before invalidate:
dccivac precedes the read for every group in the loopGagandeep Singh (7):
net/enetc: fix TX BD structure
net/enetc: fix queue initialization
net/enetc: support ESP packet type in packet parsing net/enetc: update random MAC generation code
net/enetc: add option to disable VSI messaging net/enetc: add devargs to control VSI-PSI timeout and delay net/enetc4: add cacheable BD ring support with SW cache maintenanceVanshika Shukla (2):
net/enetc: support scatter-gather
net/enetc: set user configurable priority to TX rings
Quoted 11 lines
doc/guides/nics/enetc4.rst | 62 +++- doc/guides/nics/features/enetc4.ini | 1 + doc/guides/rel_notes/release_26_07.rst | 10 + drivers/net/enetc/base/enetc_hw.h | 13 +- drivers/net/enetc/enetc.h | 31 +- drivers/net/enetc/enetc4_ethdev.c | 172 ++++++++-- drivers/net/enetc/enetc4_vf.c | 206 ++++++++++-- drivers/net/enetc/enetc_ethdev.c | 25 +- drivers/net/enetc/enetc_rxtx.c | 430 ++++++++++++++++++++++--- 9 files changed, 831 insertions(+), 119 deletions(-)
I had merged this to net-next, but now removed it after running ./devtools/test-meson-builds.sh This script runs a number of builds with different configs, and these driver changes fail in one case.
DPDK 26.07.0-rc1
User defined options
buildtype : minsize
default_library : static
enable_deprecated_libs: *
enable_stdatomic : false
examples : l3fwd
werror : true
Found ninja-1.13.2 at /usr/bin/ninja
ninja: Entering directory `./build-gcc-static'
[2191/3862] Compiling C object drivers/libtmp_rte_net_enetc.a.p/net_enetc_enetc_rxtx.c.o
FAILED: [code=1] drivers/libtmp_rte_net_enetc.a.p/net_enetc_enetc_rxtx.c.o/usr/bin/ccache gcc -Idrivers/libtmp_rte_net_enetc.a.p -Idrivers -I../drivers -Idrivers/net/enetc -I../drivers/net/enetc -I../drivers/net/enetc/base -Ilib/ethdev -I../lib/ethdev -Ilib/eal/common -I../lib/eal/common -I. -I.. -Iconfig -I../config -Ilib/eal/include -I../lib/eal/include -Ilib/eal/linux/include -I../lib/eal/linux/include -Ilib/eal/x86/include -I../lib/eal/x86/include -I../kernel/linux -Ilib/eal -I../lib/eal -Ilib/kvargs -I../lib/kvargs -Ilib/log -I../lib/log -Ilib/metrics -I../lib/metrics -Ilib/telemetry -I../lib/telemetry -Ilib/argparse -I../lib/argparse -Ilib/net -I../lib/net -Ilib/mbuf -I../lib/mbuf -Ilib/mempool -I../lib/mempool -Ilib/ring -I../lib/ring -Ilib/meter -I../lib/meter -Idrivers/bus/pci -I../drivers/bus/pci -I../drivers/bus/pci/linux -Ilib/pci -I../lib/pci -Idrivers/bus/vdev -I../drivers/bus/vdev -Idrivers/common/dpaax -I../drivers/common/dpaax -I../drivers/common/dpaax/caamflib -I/usr/include/x86_64-linux-gnu -fdiagnostics-color=always -D_FILE_OFFSET_BITS=64 -Wall -Winvalid-pch -Wextra -Werror -std=c11 -Os -g -include rte_config.h -Wvla -Wcast-qual -Wdeprecated -Wformat -Wformat-nonliteral -Wformat-security -Wmissing-declarations -Wmissing-prototypes -Wnested-externs -Wold-style-definition -Wpointer-arith -Wshadow -Wsign-compare -Wstrict-prototypes -Wundef -Wwrite-strings -Wno-packed-not-aligned -Wno-missing-field-initializers -fzero-init-padding-bits=all -D_GNU_SOURCE -fPIC -march=native -mrtm -DALLOW_EXPERIMENTAL_API -DALLOW_INTERNAL_API -Wno-format-truncation -Wno-address-of-packed-member -DRTE_COMPONENT_CLASS=pmd_net -DRTE_COMPONENT_NAME=enetc -DRTE_LOG_DEFAULT_LOGTYPE=pmd.net.enetc -MD -MQ drivers/libtmp_rte_net_enetc.a.p/net_enetc_enetc_rxtx.c.o -MF drivers/libtmp_rte_net_enetc.a.p/net_enetc_enetc_rxtx.c.o.d -o drivers/libtmp_rte_net_enetc.a.p/net_enetc_enetc_rxtx.c.o -c ../drivers/net/enetc/enetc_rxtx.c ../drivers/net/enetc/enetc_rxtx.c: In function ‘enetc_xmit_pkts_nc’:../drivers/net/enetc/enetc_rxtx.c:213:20: error: ‘txbd’ may be used uninitialized [-Werror=maybe-uninitialized]
213 | if (likely(txbd))
| ^../drivers/net/enetc/enetc_rxtx.c:162:29: note: ‘txbd’ was declared here
162 | struct enetc_tx_bd *txbd;
| ^~~~../drivers/net/enetc/enetc_rxtx.c: In function ‘enetc_xmit_pkts_cacheable’:../drivers/net/enetc/enetc_rxtx.c:715:20: error: ‘txbd’ may be used uninitialized [-Werror=maybe-uninitialized]
715 | if (likely(txbd))
| ^../drivers/net/enetc/enetc_rxtx.c:644:29: note: ‘txbd’ was declared here
644 | struct enetc_tx_bd *txbd;
| ^~~~
cc1: all warnings being treated as errors
[2224/3862] Generating drivers/rte_common_cnxk.sym_chk with a custom command (wrapped by meson to capture output)
ninja: build stopped: subcommand failed.
Re: [PATCH v3 0/9] ENETC driver related changes series
In reply to Gagandeep SinghQuoted 47 lines · On Tue, 23 Jun 2026 11:29:55 +0530 Gagandeep Singh <[email protected]> wrote:
V3 changes:
- Added documentation for all devargs inenetc4.rst.
- Fixed kvlist memory leak issue.V2 changes:
- Fixed an un-used variable compilation issue reported on fedora:43-gcc-minsize
- Fixed various AI reported issues:
- Release notes updated for all new devargs
- enect4.ini features doc updated for scattered RX.
- removed Not requiredRTE_PTYPE_UNKNOWN.
- Fixed mid-frame mbuf leak in SG case.
- Enabled SG for enetc4 PF also.
- move to calloc fromrte_zmallocinparse_txq_prior().
- added vaidation checks on strdup, strtoul.
- added NC devargs to use cacheable ops conditionally.
- removed dead code likebd_base_petc.
- Fixedrte_cpu_to_le_16()conversion on flags and combined all flags related patches in one patch.
- Fixed memory leak issue due to TXQ priority patch.
- There were some false positives, I have ignored them:
Race condition on flags field:
clean_tx_ringonly touches HW-completed BDs (next_to_clean→hwci), never newly-submitted BDs; doorbell hasn't fired yet.
Missing dcbf inclean_tx_ring:
DPDK is single-threaded per queue; TX path always overwrites flags completely before dcbf.
TX dcbf granularity with wrap:
Safe (AI admits it).
RX refill flush at wrap:
In-loop dcbf at i & mask == 0 already flushes aligned groups; trailing flush only needed for partial groups.
RX reading before invalidate:
dccivac precedes the read for every group in the loopGagandeep Singh (7):
net/enetc: fix TX BD structure
net/enetc: fix queue initialization
net/enetc: support ESP packet type in packet parsing net/enetc: update random MAC generation code
net/enetc: add option to disable VSI messaging net/enetc: add devargs to control VSI-PSI timeout and delay net/enetc4: add cacheable BD ring support with SW cache maintenanceVanshika Shukla (2):
net/enetc: support scatter-gather
net/enetc: set user configurable priority to TX rings
Quoted 11 lines
doc/guides/nics/enetc4.rst | 62 +++- doc/guides/nics/features/enetc4.ini | 1 + doc/guides/rel_notes/release_26_07.rst | 10 + drivers/net/enetc/base/enetc_hw.h | 13 +- drivers/net/enetc/enetc.h | 31 +- drivers/net/enetc/enetc4_ethdev.c | 172 ++++++++-- drivers/net/enetc/enetc4_vf.c | 206 ++++++++++-- drivers/net/enetc/enetc_ethdev.c | 25 +- drivers/net/enetc/enetc_rxtx.c | 430 ++++++++++++++++++++++--- 9 files changed, 831 insertions(+), 119 deletions(-)
LOL AI apologized for missing this in review.
You're right, and I missed it — twice. I explicitly considered that txbd guard in my v2 review and talked myself out of flagging it as "over-defensive," but the runtime argument (the inner loop always executes because tx_pkts[start] is non-NULL) is invisible to the compiler. Under -Werror=maybe-uninitialized at -Os that's a hard build break, and per-commit buildability is non-negotiable. That's a real review failure on my part. Let me reproduce it, pin down which patch introduces it, and confirm the fix.
drivers/net/enetc/enetc_rxtx.c
enetc_xmit_pkts_nc() and enetc_xmit_pkts_cacheable() both fail to build with -Werror=maybe-uninitialized (-Os, gcc):
error: 'txbd' may be used uninitialized
txbd is declared without an initializer and assigned only inside the inner per-segment loop; the compiler cannot prove that loop runs before txbd is read after it. Initialize at declaration:
- struct enetc_tx_bd *txbd;
+ struct enetc_tx_bd *txbd = NULL; The _nc fix belongs in patch 5 (so that commit builds independently); the _cacheable fix belongs in patch 9.
RE: [PATCH v3 0/9] ENETC driver related changes series
Hi,
Quoted 92 lines
-----Original Message-----
From: Stephen Hemminger <[email protected]>
Sent: Monday, June 29, 2026 4:10 AM
To: Gagandeep Singh <[email protected]>
Cc: [email protected]; Hemant Agrawal <[email protected]>
Subject: Re: [PATCH v3 0/9] ENETC driver related changes seriesQuoted 6 lines · On Tue, 23 Jun 2026 11:29:55 +0530 Gagandeep Singh <[email protected]> wrote:
V3 changes:
- Added documentation for all devargs inenetc4.rst.
- Fixed kvlist memory leak issue.V2 changes:
- Fixed an un-used variable compilation issue reported on fedora:43-gcc-minsize
Quoted 8 lines
- Fixed various AI reported issues:
- Release notes updated for all new devargs
- enect4.ini features doc updated for scattered RX.
- removed Not requiredRTE_PTYPE_UNKNOWN.
- Fixed mid-frame mbuf leak in SG case.
- Enabled SG for enetc4 PF also.
- move to calloc fromrte_zmallocinparse_txq_prior().
- added vaidation checks on strdup, strtoul.Quoted 8 lines
- added NC devargs to use cacheable ops conditionally.
- removed dead code likebd_base_petc.
- Fixedrte_cpu_to_le_16()conversion on flags and combined all flags related patches in one patch.
- Fixed memory leak issue due to TXQ priority patch.
- There were some false positives, I have ignored them:
Race condition on flags field:
clean_tx_ringonly touches HW-completed BDs(next_to_clean→hwci),
Quoted 25 lines
never newly-submitted BDs; doorbell hasn't fired yet.
Missing dcbf inclean_tx_ring:
DPDK is single-threaded per queue; TX path always overwrites flags completely before dcbf.
TX dcbf granularity with wrap:
Safe (AI admits it).
RX refill flush at wrap:
In-loop dcbf at i & mask == 0 already flushes aligned groups; trailing flush only needed for partial groups.
RX reading before invalidate:
dccivac precedes the read for every group in the loopGagandeep Singh (7):
net/enetc: fix TX BD structure
net/enetc: fix queue initialization
net/enetc: support ESP packet type in packet parsing net/enetc: update random MAC generation code
net/enetc: add option to disable VSI messaging net/enetc: add devargs to control VSI-PSI timeout and delay net/enetc4: add cacheable BD ring support with SW cache maintenanceVanshika Shukla (2):
net/enetc: support scatter-gather
net/enetc: set user configurable priority to TX ringsQuoted 11 lines
doc/guides/nics/enetc4.rst | 62 +++- doc/guides/nics/features/enetc4.ini | 1 + doc/guides/rel_notes/release_26_07.rst | 10 + drivers/net/enetc/base/enetc_hw.h | 13 +- drivers/net/enetc/enetc.h | 31 +- drivers/net/enetc/enetc4_ethdev.c | 172 ++++++++-- drivers/net/enetc/enetc4_vf.c | 206 ++++++++++-- drivers/net/enetc/enetc_ethdev.c | 25 +- drivers/net/enetc/enetc_rxtx.c | 430 ++++++++++++++++++++++--- 9 files changed, 831 insertions(+), 119 deletions(-)LOL AI apologized for missing this in review.
You're right, and I missed it — twice. I explicitly considered that txbd guard in my v2 review and talked myself out of flagging it as "over-defensive," but the runtime argument (the inner loop always executes because tx_pkts[start] is non-NULL) is invisible to the compiler. Under -Werror=maybe-uninitialized at -Os that's a hard build break, and per-commit buildability is non-negotiable. That's a real review failure on my part. Let me reproduce it, pin down which patch introduces it, and confirm the fix.
drivers/net/enetc/enetc_rxtx.c
enetc_xmit_pkts_nc()andenetc_xmit_pkts_cacheable()both fail to build with -Werror=maybe-uninitialized (-Os, gcc):error: 'txbd' may be used uninitialized
txbd is declared without an initializer and assigned only inside the inner per-segment loop; the compiler cannot prove that loop runs before txbd is read after it. Initialize at declaration:
Quoted 6 lines
- struct enetc_tx_bd *txbd; + struct enetc_tx_bd *txbd = NULL;The
_ncfix belongs in patch 5 (so that commit builds independently); the_cacheablefix belongs in patch 9.
Thanks for reporting, I have submitted the V4 with fix.
v4 cover ENETC driver related changes series
In reply to Gagandeep SinghV4 changes:
- Fixed a compilation issue: "txbd may be used uninitialized"
V3 changes:
- Added documentation for all devargs in enetc4.rst.
- Fixed kvlist memory leak issue.
V2 changes:
- Fixed an un-used variable compilation issue reported on fedora:43-gcc-minsize
- Fixed various AI reported issues:
- Release notes updated for all new devargs
- enect4.ini features doc updated for scattered RX.
- removed Not required RTE_PTYPE_UNKNOWN.
- Fixed mid-frame mbuf leak in SG case.
- Enabled SG for enetc4 PF also.
- move to calloc from rte_zmalloc in parse_txq_prior().
- added vaidation checks on strdup, strtoul.
- added NC devargs to use cacheable ops conditionally.
- removed dead code like bd_base_p etc.
- Fixed rte_cpu_to_le_16() conversion on flags and combined all flags related patches in one patch.
- Fixed memory leak issue due to TXQ priority patch.
- There were some false positives, I have ignored them:
Race condition on flags field:
clean_tx_ring only touches HW-completed BDs (next_to_clean→hwci), never newly-submitted BDs; doorbell hasn't fired yet.
Missing dcbf in clean_tx_ring:
DPDK is single-threaded per queue; TX path always overwrites flags completely before dcbf.
TX dcbf granularity with wrap:
Safe (AI admits it).
RX refill flush at wrap:
In-loop dcbf at i & mask == 0 already flushes aligned groups; trailing flush only needed for partial groups.
RX reading before invalidate:
dccivac precedes the read for every group in the loop
Gagandeep Singh (7):
net/enetc: fix TX BD structure
net/enetc: fix queue initialization
net/enetc: support ESP packet type in packet parsing net/enetc: update random MAC generation code
net/enetc: add option to disable VSI messaging net/enetc: add devargs to control VSI-PSI timeout and delay net/enetc4: add cacheable BD ring support with SW cache maintenance
Vanshika Shukla (2):
net/enetc: support scatter-gather
net/enetc: set user configurable priority to TX rings
doc/guides/nics/enetc4.rst | 62 +++- doc/guides/nics/features/enetc4.ini | 1 + doc/guides/rel_notes/release_26_07.rst | 10 + drivers/net/enetc/base/enetc_hw.h | 13 +- drivers/net/enetc/enetc.h | 31 +- drivers/net/enetc/enetc4_ethdev.c | 172 ++++++++-- drivers/net/enetc/enetc4_vf.c | 206 ++++++++++-- drivers/net/enetc/enetc_ethdev.c | 25 +- drivers/net/enetc/enetc_rxtx.c | 430 ++++++++++++++++++++++--- 9 files changed, 831 insertions(+), 119 deletions(-)
Signature · 1 line
2.25.1
PATCH v4 1/9 net/enetc: fix TX BD structure
The flags field in struct enetc_tx_bd was declared as uint16_t but ENETC4 TX BDs only use an 8-bit flags byte. Fix the type to uint8_t to match the hardware descriptor layout.
--- drivers/net/enetc/base/enetc_hw.h | 7 +++---- drivers/net/enetc/enetc_rxtx.c | 17 +++++++++-------- 2 files changed, 12 insertions(+), 12 deletions(-)
drivers/net/enetc/base/enetc_hw.h +3 -4
@@ -1,5 +1,5 @@/* SPDX-License-Identifier: BSD-3-Clause -* Copyright 2018-2024 NXP +* Copyright 2018-2026 NXP */ #ifndef _ENETC_HW_H_
@@ -198,8 +198,7 @@ enum enetc_bdr_type {TX, RX};#define ENETC_TX_ADDR (txq, addr) ((void *)((txq)->enetc_txbdr + (addr))) -#define ENETC_TXBD_FLAGS_IE BIT(13) -#define ENETC_TXBD_FLAGS_F BIT(15) +#define ENETC_TXBD_FLAGS_F BIT(7)/* ENETC Parsed values (Little Endian) */ #define ENETC_PARSE_ERROR 0x8000
@@ -262,7 +261,7 @@ struct enetc_tx_bd { uint8_t l3t:1; uint8_t resv:5; uint8_t l4t:3; -uint16_t flags; +uint8_t flags; };/* default layout */ uint32_t txstart;uint32_t lstatus;
drivers/net/enetc/enetc_rxtx.c +9 -8
@@ -1,5 +1,5 @@/* SPDX-License-Identifier: BSD-3-Clause -* Copyright 2018-2024 NXP +* Copyright 2018-2026 NXP */ #include <stdbool.h>
@@ -101,7 +101,7 @@ enetc_xmit_pkts(void *tx_queue, tx_swbd = &tx_ring->q_swbd[i]; txbd->frm_len = tx_pkts[start]->pkt_len; txbd->buf_len = txbd->frm_len; - txbd->flags =rte_cpu_to_le_16 (ENETC_TXBD_FLAGS_F ); + txbd->flags =ENETC_TXBD_FLAGS_F ; txbd->addr = (uint64_t )(uintptr_t )rte_cpu_to_le_64 ((size_t )tx_swbd->buffer_addr->buf_iova + tx_swbd->buffer_addr->data_off);
@@ -133,13 +133,13 @@ enetc4_tx_offload_checksum(struct rte_mbuf *mbuf, struct enetc_tx_bd *txbd) txbd->ipcs =ENETC4_TXBD_IPCS ; txbd->l3_start = mbuf->l2_len; txbd->l3_hdr_size = mbuf->l3_len /4 ; - txbd->flags |=rte_cpu_to_le_16 (ENETC4_TXBD_FLAGS_L_TX_CKSUM ); + txbd->flags |=ENETC4_TXBD_FLAGS_L_TX_CKSUM ;if ((mbuf->ol_flags &RTE_MBUF_F_TX_UDP_CKSUM ) ==RTE_MBUF_F_TX_UDP_CKSUM ) { - txbd->l4t =rte_cpu_to_le_16 (ENETC4_TXBD_L4T_UDP ); - txbd->flags |=rte_cpu_to_le_16 (ENETC4_TXBD_FLAGS_L4CS ); + txbd->l4t =ENETC4_TXBD_L4T_UDP ; + txbd->flags |=ENETC4_TXBD_FLAGS_L4CS ; }else if ((mbuf->ol_flags &RTE_MBUF_F_TX_TCP_CKSUM ) ==RTE_MBUF_F_TX_TCP_CKSUM ) { - txbd->l4t =rte_cpu_to_le_16 (ENETC4_TXBD_L4T_TCP ); - txbd->flags |=rte_cpu_to_le_16 (ENETC4_TXBD_FLAGS_L4CS ); + txbd->l4t =ENETC4_TXBD_L4T_TCP ; + txbd->flags |=ENETC4_TXBD_FLAGS_L4CS ; } } }
@@ -172,7 +172,7 @@ enetc_xmit_pkts_nc(void *tx_queue,dcbf (data + j); txbd =ENETC_TXBD (*tx_ring, i); - txbd->flags =rte_cpu_to_le_16 (ENETC4_TXBD_FLAGS_F ); + txbd->flags =0 ;if (tx_ring->q_swbd[i].buffer_addr->ol_flags &ENETC4_TX_CKSUM_OFFLOAD_MASK )enetc4_tx_offload_checksum (tx_ring->q_swbd[i].buffer_addr, txbd);
@@ -182,6 +182,7 @@ enetc_xmit_pkts_nc(void *tx_queue, txbd->addr = (uint64_t )(uintptr_t )rte_cpu_to_le_64 ((size_t )tx_swbd->buffer_addr->buf_iova + tx_swbd->buffer_addr->data_off); + txbd->flags |=ENETC4_TXBD_FLAGS_F ; i++; start++;if (unlikely (i == tx_ring->bd_count))
Signature · 1 line
2.25.1
PATCH v4 2/9 net/enetc: fix queue initialization
In reply to Gagandeep SinghHardware can misbehave if the user tries to reset the consumer and producer indexes without resetting the ring.
This patch adds the ring reset step before resetting the indexes.
--- drivers/net/enetc/enetc4_ethdev.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-)
drivers/net/enetc/enetc4_ethdev.c +11 -1
@@ -1,5 +1,5 @@/* SPDX-License-Identifier: BSD-3-Clause -* Copyright 2024 NXP +* Copyright 2024-2026 NXP */ #include <stdbool.h>
@@ -279,6 +279,7 @@ enetc4_tx_queue_setup(struct rte_eth_dev *dev, const struct rte_eth_txconf *tx_conf) {int err; +uint32_t tx_data;struct enetc_bdr *tx_ring;struct rte_eth_dev_data *data = dev->data; struct enetc_eth_adapter *priv =
@@ -301,6 +302,10 @@ enetc4_tx_queue_setup(struct rte_eth_dev *dev, goto fail; tx_ring->ndev = dev; +/* reset queue */ + tx_data =enetc4_txbdr_rd (&priv->hw.hw, tx_ring->index,ENETC_TBMR ); + tx_data &= ~ENETC_TBMR_EN ; +enetc4_txbdr_wr (&priv->hw.hw, tx_ring->index,ENETC_TBMR , tx_data);enetc4_setup_txbdr (&priv->hw.hw, tx_ring); data->tx_queues[queue_idx] = tx_ring; tx_ring->tx_deferred_start = tx_conf->tx_deferred_start;
@@ -427,6 +432,7 @@ enetc4_rx_queue_setup(struct rte_eth_dev *dev, struct rte_mempool *mb_pool) {int err =0 ; +uint32_t rx_enable;struct enetc_bdr *rx_ring;struct rte_eth_dev_data *data = dev->data; struct enetc_eth_adapter *adapter =
@@ -450,6 +456,10 @@ enetc4_rx_queue_setup(struct rte_eth_dev *dev, goto fail; rx_ring->ndev = dev; +/* reset queue */ + rx_enable =enetc4_rxbdr_rd (&adapter->hw.hw, rx_ring->index,ENETC_RBMR ); + rx_enable &= ~ENETC_RBMR_EN ; +enetc4_rxbdr_wr (&adapter->hw.hw, rx_ring->index,ENETC_RBMR , rx_enable);enetc4_setup_rxbdr (&adapter->hw.hw, rx_ring, mb_pool); data->rx_queues[rx_queue_id] = rx_ring; rx_ring->rx_deferred_start = rx_conf->rx_deferred_start;
Signature · 1 line
2.25.1
PATCH v4 3/9 net/enetc: support ESP packet type in packet parsing
In reply to Gagandeep SinghAdd ESP (Encapsulating Security Payload) packet type definitions and handling to the RX packet parsing path. Also update the supported ptypes array to advertise ESP tunnel type support.
--- doc/guides/rel_notes/release_26_07.rst | 3 +++ drivers/net/enetc/base/enetc_hw.h | 4 ++++ drivers/net/enetc/enetc_ethdev.c | 3 ++- drivers/net/enetc/enetc_rxtx.c | 10 ++++++++++ 4 files changed, 19 insertions(+), 1 deletion(-)
doc/guides/rel_notes/release_26_07.rst +3 -0
@@ -187,6 +187,9 @@ New Features ``RTE_ETH_EVENT_RECOVERY_FAILED``) to notify upper layers of the reset lifecycle. +* **Updated NXP ENETC ethernet driver.** + + * Added support for ESP packet type in packet parsing Removed Items -------------
drivers/net/enetc/base/enetc_hw.h +4 -0
@@ -226,6 +226,10 @@ enum enetc_bdr_type {TX, RX}; (0x0003 | ENETC_PKT_TYPE_IPV4)#define ENETC_PKT_TYPE_IPV6_ICMP \ (0x0003 | ENETC_PKT_TYPE_IPV6) +#define ENETC_PKT_TYPE_IPV4_ESP \ + (0x0005 | ENETC_PKT_TYPE_IPV4) +#define ENETC_PKT_TYPE_IPV6_ESP \ + (0x0005 | ENETC_PKT_TYPE_IPV6)/* PCI device info */ struct enetc_hw {
drivers/net/enetc/enetc_ethdev.c +2 -1
@@ -1,5 +1,5 @@/* SPDX-License-Identifier: BSD-3-Clause -* Copyright 2018-2024 NXP +* Copyright 2018-2026 NXP */ #include <stdbool.h>
@@ -95,6 +95,7 @@ enetc_supported_ptypes_get(struct rte_eth_dev *dev __rte_unused,RTE_PTYPE_L4_UDP ,RTE_PTYPE_L4_SCTP ,RTE_PTYPE_L4_ICMP , + RTE_PTYPE_TUNNEL_ESP }; *no_of_elements =RTE_DIM (ptypes);
drivers/net/enetc/enetc_rxtx.c +10 -0
@@ -370,6 +370,16 @@ enetc_dev_rx_parse(struct rte_mbuf *m, uint16_t parse_results)RTE_PTYPE_L3_IPV6 |RTE_PTYPE_L4_UDP ;return ; +case ENETC_PKT_TYPE_IPV4_ESP : + m->packet_type =RTE_PTYPE_L2_ETHER | +RTE_PTYPE_L3_IPV4 | +RTE_PTYPE_TUNNEL_ESP ; +return ; +case ENETC_PKT_TYPE_IPV6_ESP : + m->packet_type =RTE_PTYPE_L2_ETHER | +RTE_PTYPE_L3_IPV6 | +RTE_PTYPE_TUNNEL_ESP ; +return ;case ENETC_PKT_TYPE_IPV4_SCTP : m->packet_type =RTE_PTYPE_L2_ETHER | RTE_PTYPE_L3_IPV4 |
Signature · 1 line
2.25.1
PATCH v4 4/9 net/enetc: update random MAC generation code
In reply to Gagandeep SinghUse rte_eth_random_addr() instead of manual rte_rand() based MAC generation. Also handle VF path by writing to ENETC_SIPMAR0/1 instead of ENETC_PSIPMAR0/1 when running as a VF.
--- drivers/net/enetc/enetc_ethdev.c | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-)
drivers/net/enetc/enetc_ethdev.c +10 -12
@@ -195,20 +195,18 @@ enetc_hardware_init(struct enetc_eth_hw *hw) }if ((high_mac | low_mac) ==0 ) { -char *first_byte; -ENETC_PMD_NOTICE ("MAC is not available for this SI, " "set random MAC" ); - mac = (uint32_t *)hw->mac.addr; - *mac = (uint32_t )rte_rand (); - first_byte = (char *)mac; - *first_byte &=0xfe ;/* clear multicast bit */ - *first_byte |=0x02 ;/* set local assignment bit (IEEE802) */ - -enetc_port_wr (enetc_hw,ENETC_PSIPMAR0 (0 ), *mac); - mac++; - *mac = (uint16_t )rte_rand (); -enetc_port_wr (enetc_hw,ENETC_PSIPMAR1 (0 ), *mac); +rte_eth_random_addr (hw->mac.addr); + high_mac = *(uint32_t *)hw->mac.addr; + low_mac = *(uint16_t *)(hw->mac.addr +4 ); +if (hw->device_id ==ENETC_DEV_ID_VF ) { +enetc_wr (enetc_hw,ENETC_SIPMAR0 , high_mac); +enetc_wr (enetc_hw,ENETC_SIPMAR1 , low_mac); + }else { +enetc_port_wr (enetc_hw,ENETC_PSIPMAR0 (0 ), high_mac); +enetc_port_wr (enetc_hw,ENETC_PSIPMAR1 (0 ), low_mac); + }enetc_print_ethaddr ("New address: " , (const struct rte_ether_addr *)hw->mac.addr); }
Signature · 1 line
2.25.1
PATCH v4 5/9 net/enetc: support scatter-gather
In reply to Gagandeep SinghFrom: Vanshika Shukla <[email protected]>
Add scatter-gather support for ENETC4 PMD:
- Add ENETC_RXBD_LSTATUS_R/F bits for RX BD status
- Add ENETC4_MAX_SEGS (63) for max segments per TX packet
- Update enetc4_vf_dev_infos_get to fill nb_seg_max, offloads, max queues and packet length
- Extend enetc_xmit_pkts_nc to handle multi-segment mbufs
- Extend enetc_clean_rx_ring_nc to chain scatter-gather segments using LSTATUS_R/F bits
--- doc/guides/nics/features/enetc4.ini | 1 + doc/guides/rel_notes/release_26_07.rst | 3 +- drivers/net/enetc/base/enetc_hw.h | 2 + drivers/net/enetc/enetc.h | 7 +- drivers/net/enetc/enetc4_ethdev.c | 10 +- drivers/net/enetc/enetc4_vf.c | 46 +++++++-- drivers/net/enetc/enetc_rxtx.c | 132 ++++++++++++++++--------- 7 files changed, 141 insertions(+), 60 deletions(-)
doc/guides/nics/features/enetc4.ini +1 -0
@@ -17,6 +17,7 @@ Basic stats = Y L3 checksum offload = Y L4 checksum offload = Y Queue start/stop = Y +Scattered Rx = Y Linux = Y ARMv8 = Y Usage doc = Y
doc/guides/rel_notes/release_26_07.rst +2 -1
@@ -189,7 +189,8 @@ New Features * **Updated NXP ENETC ethernet driver.** - * Added support for ESP packet type in packet parsing + * Added support for ESP packet type in packet parsing. + * Added scatter-gather support for ENETC4 PFs and VFs. Removed Items -------------
drivers/net/enetc/base/enetc_hw.h +2 -0
@@ -230,6 +230,8 @@ enum enetc_bdr_type {TX, RX}; (0x0005 | ENETC_PKT_TYPE_IPV4)#define ENETC_PKT_TYPE_IPV6_ESP \ (0x0005 | ENETC_PKT_TYPE_IPV6) +#define ENETC_RXBD_LSTATUS_R BIT(30) +#define ENETC_RXBD_LSTATUS_F BIT(31)/* PCI device info */ struct enetc_hw {
drivers/net/enetc/enetc.h +6 -1
@@ -1,5 +1,5 @@/* SPDX-License-Identifier: BSD-3-Clause -* Copyright 2018-2019,2024 NXP +* Copyright 2018-2019,2024-2026 NXP */ #ifndef _ENETC_H_
@@ -28,6 +28,8 @@#define MIN_BD_COUNT 32/* BD ALIGN */ #define BD_ALIGN 8 +/* Max segments per ENETC4 TX packet (scatter-gather) */ +#define ENETC4_MAX_SEGS 63/* minimum frame size supported */ #define ENETC_MAC_MINFRM_SIZE 68
@@ -90,6 +92,9 @@ struct enetc_bdr {int next_to_alloc;/* Rx */ };struct rte_mempool *mb_pool;/* mbuf pool to populate RX ring. */ +/* Partial scatter-gather chain persisted across burst calls. */ +struct rte_mbuf *pkt_first_seg;/* first segment of in-progress frame */ +struct rte_mbuf *pkt_last_seg;/* last segment linked so far */ struct rte_eth_dev *ndev;uint64_t ierrors;uint8_t rx_deferred_start;
drivers/net/enetc/enetc4_ethdev.c +8 -2
@@ -14,13 +14,15 @@static uint64_t dev_rx_offloads_sup =RTE_ETH_RX_OFFLOAD_IPV4_CKSUM |RTE_ETH_RX_OFFLOAD_UDP_CKSUM | -RTE_ETH_RX_OFFLOAD_TCP_CKSUM ; +RTE_ETH_RX_OFFLOAD_TCP_CKSUM | +RTE_ETH_RX_OFFLOAD_SCATTER ;/* Supported Tx offloads */ static uint64_t dev_tx_offloads_sup =RTE_ETH_TX_OFFLOAD_IPV4_CKSUM |RTE_ETH_TX_OFFLOAD_UDP_CKSUM | -RTE_ETH_TX_OFFLOAD_TCP_CKSUM ; +RTE_ETH_TX_OFFLOAD_TCP_CKSUM | +RTE_ETH_TX_OFFLOAD_MULTI_SEGS ;static int enetc4_dev_start (struct rte_eth_dev *dev)
@@ -199,11 +201,15 @@ enetc4_dev_infos_get(struct rte_eth_dev *dev, .nb_max = MAX_BD_COUNT, .nb_min = MIN_BD_COUNT, .nb_align = BD_ALIGN, + .nb_seg_max = ENETC4_MAX_SEGS, + .nb_mtu_seg_max = ENETC4_MAX_SEGS, }; dev_info->tx_desc_lim = (struct rte_eth_desc_lim ) { .nb_max =MAX_BD_COUNT , .nb_min =MIN_BD_COUNT , .nb_align =BD_ALIGN , + .nb_seg_max =ENETC4_MAX_SEGS , + .nb_mtu_seg_max =ENETC4_MAX_SEGS , }; dev_info->max_rx_queues = hw->max_rx_queues; dev_info->max_tx_queues = hw->max_tx_queues;
drivers/net/enetc/enetc4_vf.c +37 -9
71 lines not on this page · raw message
drivers/net/enetc/enetc_rxtx.c +85 -47
186 lines not on this page · raw message
Signature · 1 line
2.25.1
PATCH v4 6/9 net/enetc: add option to disable VSI messaging
In reply to Gagandeep SinghAdd devarg 'enetc4_vsi_disable' to allow disabling features dependent on VSI-PSI messaging. This is useful for testing DPDK with a PF driver that does not support VSI-PSI messages.
When the devarg is present, a reduced ops table (enetc4_vf_ops_no_vsi_m) is used that replaces link_update with a no-op stub and omits MAC/VLAN filter ops that require VSI msgs.
--- doc/guides/nics/enetc4.rst | 22 +++++++++- doc/guides/rel_notes/release_26_07.rst | 2 + drivers/net/enetc/enetc4_vf.c | 61 ++++++++++++++++++++++++-- 3 files changed, 81 insertions(+), 4 deletions(-)
doc/guides/nics/enetc4.rst +21 -1
@@ -1,5 +1,5 @@ .. SPDX-License-Identifier: BSD-3-Clause - Copyright 2024-2025 NXP + Copyright 2024-2026 NXP ENETC4 Poll Mode Driver =======================
@@ -90,3 +90,23 @@ Driver compilation and testing Follow instructions available in the document :ref:`compiling and testing a PMD for a NIC <pmd_build_and_test>` to launch **testpmd**. + + +Driver Arguments (devargs) +-------------------------- + +The ENETC4 PMD supports the following device arguments (devargs) +that can be passed via ``-a`` (allow-list) option in DPDK applications. + +VF-specific devargs +~~~~~~~~~~~~~~~~~~~ + +``enetc4_vsi_disable`` + Disable VSI-PSI messaging for the VF. + When present, features that require VSI-PSI communication + (link update, MAC filter, VLAN filter) are replaced with no-op stubs. + Useful when the PF driver does not support VSI-PSI messages. + + Usage example:: + + dpdk-testpmd -a 0000:00:01.0,enetc4_vsi_disable -- -i
doc/guides/rel_notes/release_26_07.rst +2 -0
@@ -191,6 +191,8 @@ New Features * Added support for ESP packet type in packet parsing. * Added scatter-gather support for ENETC4 PFs and VFs. + * Added devargs option ``enetc4_vsi_disable`` to disable VSI-PSI + messaging. Removed Items -------------
drivers/net/enetc/enetc4_vf.c +58 -3
100 lines not on this page · raw message
Signature · 1 line
2.25.1
PATCH v4 7/9 net/enetc: add devargs to control VSI-PSI timeout and delay
In reply to Gagandeep SinghAdd two new devargs for ENETC4 VF:
- enetc4_vsi_timeout: VSI-PSI message wait timeout (iteration count)
- enetc4_vsi_delay: VSI-PSI message wait delay in microseconds
Store the values in struct enetc_eth_hw and use them in enetc4_msg_vsi_send() instead of the hardcoded defaults. Fall back to ENETC4_DEF_VSI_WAIT_TIMEOUT_UPDATE / ENETC4_DEF_VSI_WAIT_DELAY_UPDATE when not set.
--- doc/guides/nics/enetc4.rst | 18 +++++++ doc/guides/rel_notes/release_26_07.rst | 2 + drivers/net/enetc/enetc.h | 2 + drivers/net/enetc/enetc4_vf.c | 68 +++++++++++++++++++------- 4 files changed, 73 insertions(+), 17 deletions(-)
doc/guides/nics/enetc4.rst +18 -0
@@ -110,3 +110,21 @@ VF-specific devargs Usage example:: dpdk-testpmd -a 0000:00:01.0,enetc4_vsi_disable -- -i + +``enetc4_vsi_timeout`` + Set the VSI-PSI message wait timeout as an iteration count. + Controls how many polling iterations the driver waits for a VSI-PSI + response before timing out. + Defaults to ``ENETC4_DEF_VSI_WAIT_TIMEOUT_UPDATE`` when not set. + + Usage example:: + + dpdk-testpmd -a 0000:00:01.0,enetc4_vsi_timeout=200 -- -i + +``enetc4_vsi_delay`` + Set the VSI-PSI message wait delay in microseconds between polling iterations. + Defaults to ``ENETC4_DEF_VSI_WAIT_DELAY_UPDATE`` when not set. + + Usage example:: + + dpdk-testpmd -a 0000:00:01.0,enetc4_vsi_delay=10 -- -i
doc/guides/rel_notes/release_26_07.rst +2 -0
@@ -193,6 +193,8 @@ New Features * Added scatter-gather support for ENETC4 PFs and VFs. * Added devargs option ``enetc4_vsi_disable`` to disable VSI-PSI messaging. + * Added devargs options ``enetc4_vsi_timeout`` and ``enetc4_vsi_delay`` + for VSI-PSI messaging timeout and delay. Removed Items -------------
drivers/net/enetc/enetc.h +2 -0
@@ -112,6 +112,8 @@ struct enetc_eth_hw {uint32_t num_rss;uint32_t max_rx_queues;uint32_t max_tx_queues; +uint32_t vsi_timeout;/* VSI-PSI message wait timeout (iterations) */ +uint32_t vsi_delay;/* VSI-PSI message wait delay (us) */ };/*
drivers/net/enetc/enetc4_vf.c +51 -17
175 lines not on this page · raw message
Signature · 1 line
2.25.1
PATCH v4 8/9 net/enetc: set user configurable priority to TX rings
In reply to Gagandeep SinghFrom: Vanshika Shukla <[email protected]>
Add devarg 'enetc4_txq_prior' to allow per-queue TX ring priority configuration. The value is a '|'-separated list of TBMR priority bits, one per TX queue (e.g. 'enetc4_txq_prior=1|2|3'). The configuration accepts values only up to the maximum supported TX queues. Any additional values beyond this supported range are discarded.
Store the parsed priorities in hw->txq_prior and apply them in enetc4_tx_queue_setup() when enabling the ring.
--- doc/guides/nics/enetc4.rst | 12 ++++ doc/guides/rel_notes/release_26_07.rst | 1 + drivers/net/enetc/enetc.h | 1 + drivers/net/enetc/enetc4_ethdev.c | 81 +++++++++++++++++++++++++- 4 files changed, 94 insertions(+), 1 deletion(-)
doc/guides/nics/enetc4.rst +12 -0
@@ -128,3 +128,15 @@ VF-specific devargs Usage example:: dpdk-testpmd -a 0000:00:01.0,enetc4_vsi_delay=10 -- -i + +PF/Common devargs +~~~~~~~~~~~~~~~~~ + +``enetc4_txq_prior`` + Set per-queue TX ring priority (TBMR bits). + The value is a ``|``-separated list of priority values, one per TX queue. + Values beyond the maximum supported TX queue count are discarded. + + Usage example:: + + dpdk-testpmd -a 0000:00:00.0,enetc4_txq_prior=1|2|3 -- -i
doc/guides/rel_notes/release_26_07.rst +1 -0
@@ -195,6 +195,7 @@ New Features messaging. * Added devargs options ``enetc4_vsi_timeout`` and ``enetc4_vsi_delay`` for VSI-PSI messaging timeout and delay. + * Added devargs option ``enetc4_txq_prior`` to set TX queues priorities. Removed Items -------------
drivers/net/enetc/enetc.h +1 -0
@@ -114,6 +114,7 @@ struct enetc_eth_hw {uint32_t max_tx_queues;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) */ };/*
drivers/net/enetc/enetc4_ethdev.c +80 -1
119 lines not on this page · raw message
Signature · 1 line
2.25.1
PATCH v4 9/9 net/enetc4: add cacheable BD ring support with SW cache maintenance
In reply to Gagandeep SinghOn non-cache-coherent platforms such as i.MX95, the BD ring memory may be mapped as cacheable (normal memory) while the ENETC hardware DMA engine writes and reads descriptors without CPU cache snooping. SW must therefore perform explicit cache maintenance to keep CPU caches and DDR coherent.
TX path (enetc_xmit_pkts_cacheable):
- Flush each segment's payload cache lines to PoC (dcbf) before the BD is handed to HW, so HW DMA reads the correct data.
- After all BDs for a burst are written, flush the BD cache lines (dcbf, one per 64-byte group of 4 BDs) so HW can read the updated descriptors.
RX refill (enetc_refill_rx_ring):
- After writing each full 4-BD cache-line group, dcbf that group so HW sees the buffer addresses and cleared lstatus fields.
- Flush any partial trailing group before updating the ring tail.
RX receive (enetc_recv_pkts_cacheable via enetc_clean_rx_ring_cacheable):
- Before reading BD status, dccivac the current BD cache line so stale CPU-cached BD data is discarded and fresh HW-written content is fetched from DDR.
- After a BD is consumed, dccivac each payload cache line so the CPU reads the DMA'd packet data, not stale cached bytes.
Add a new devarg 'nc=1' that allows selecting the non-cacheable RX/TX ops.
When nc=1 is specified:
eth_dev->rx_pkt_burst = &enetc_recv_pkts_nc; eth_dev->tx_pkt_burst = &enetc_xmit_pkts_nc;
The default (nc not set or nc=0) keeps the cacheable path with SW cache maintenance (dccivac/dcbf):
eth_dev->rx_pkt_burst = &enetc_recv_pkts_cacheable; eth_dev->tx_pkt_burst = &enetc_xmit_pkts_cacheable;
Usage:
--allow 0000:00:01.0,nc=1
--- doc/guides/nics/enetc4.rst | 10 + doc/guides/rel_notes/release_26_07.rst | 1 + drivers/net/enetc/enetc.h | 21 ++ drivers/net/enetc/enetc4_ethdev.c | 71 +++++-- drivers/net/enetc/enetc4_vf.c | 35 +++- drivers/net/enetc/enetc_rxtx.c | 275 +++++++++++++++++++++++++ 6 files changed, 396 insertions(+), 17 deletions(-)
doc/guides/nics/enetc4.rst +10 -0
@@ -140,3 +140,13 @@ PF/Common devargs Usage example:: dpdk-testpmd -a 0000:00:00.0,enetc4_txq_prior=1|2|3 -- -i + +``nc`` + Select non-cacheable RX/TX ops (BD rings mapped as non-cacheable memory). + Set to ``1`` to use non-cacheable descriptor ring operations. + By default, cacheable BD rings with software cache maintenance are used. + Applies to both PF and VF. + + Usage example:: + + dpdk-testpmd -a 0000:00:00.0,nc=1 -- -i
doc/guides/rel_notes/release_26_07.rst +1 -0
@@ -196,6 +196,7 @@ New Features * Added devargs options ``enetc4_vsi_timeout`` and ``enetc4_vsi_delay`` for VSI-PSI messaging timeout and delay. * Added devargs option ``enetc4_txq_prior`` to set TX queues priorities. + * Added devargs option ``nc`` to select non-cacheable RX/TX ops. Removed Items -------------
drivers/net/enetc/enetc.h +21 -0
@@ -115,6 +115,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) */ +uint8_t nc_mode;/* 1 = non-cacheable BD memory, use _nc ops */ };/*
@@ -315,8 +316,28 @@ 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_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); + +/* +* Cache-maintenance constants for cacheable BD ring mode. +* +* BD = 16 bytes, cache line = 64 bytes => 4 BDs per cache line. +* Every dcbf in enetc_refill_rx_ring() flushes a full 64-byte cache line. +* To ensure each dcbf covers only fully-written BDs the caller +* must pass a count rounded DOWN to a multiple of ENETC_BD_PER_CL so that +* the last partial group is left in cache to be completed and flushed in +* the next call. +*/ +#define ENETC_BD_PER_CL (RTE_CACHE_LINE_SIZE / sizeof(union enetc_rx_bd)) +#define ENETC_BD_PER_CL_MASK (ENETC_BD_PER_CL - 1) +/* Round n DOWN to the nearest multiple of ENETC_BD_PER_CL. */ +#define ENETC_BD_ALIGN_DOWN (n) ((n) & ~(unsigned int)ENETC_BD_PER_CL_MASK) +void enetc4_dev_hw_init (struct rte_eth_dev *eth_dev);void enetc_print_ethaddr (const char *name,const struct rte_ether_addr *eth_addr);
drivers/net/enetc/enetc4_ethdev.c +55 -16
143 lines not on this page · raw message
drivers/net/enetc/enetc4_vf.c +34 -1
@@ -12,6 +12,30 @@#define ENETC4_VSI_DISABLE "enetc4_vsi_disable"#define ENETC4_VSI_TIMEOUT "enetc4_vsi_timeout"#define ENETC4_VSI_DELAY "enetc4_vsi_delay" +#define ENETC4_NC_MEMORY "nc" + +static void +enetc4_vf_get_devarg_nc (struct rte_eth_dev *dev) +{ +struct enetc_eth_hw *hw = +ENETC_DEV_PRIVATE_TO_HW (dev->data->dev_private); +struct rte_devargs *devargs = dev->device->devargs; +struct rte_kvargs *kvlist; +const char *val; + +if (!devargs) +return ; + + kvlist =rte_kvargs_parse (devargs->args,NULL ); +if (!kvlist) +return ; + + val =rte_kvargs_get (kvlist,ENETC4_NC_MEMORY ); +if (val &&atoi (val) ==1 ) + hw->nc_mode =1 ; + +rte_kvargs_free (kvlist); +}#define ENETC_CRC_TABLE_SIZE 256#define ENETC_POLY 0x1021
@@ -1370,6 +1394,14 @@ enetc4_vf_dev_init(struct rte_eth_dev *eth_dev)enetc4_dev_hw_init (eth_dev); + hw->nc_mode =0 ; +enetc4_vf_get_devarg_nc (eth_dev); +if (hw->nc_mode) { + eth_dev->rx_pkt_burst = &enetc_recv_pkts_nc; + eth_dev->tx_pkt_burst = &enetc_xmit_pkts_nc; +ENETC_PMD_LOG (INFO ,"nc=1: using non-cacheable BD ops (_nc)" ); + } + si_cap =enetc_rd (enetc_hw,ENETC_SICAPR0 ); hw->max_tx_queues = si_cap &ENETC_SICAPR0_BDR_MASK ; hw->max_rx_queues = (si_cap >>16 ) &ENETC_SICAPR0_BDR_MASK ;
@@ -1477,5 +1509,6 @@ RTE_PMD_REGISTER_KMOD_DEP(net_enetc4_vf, "* igb_uio | uio_pci_generic");RTE_PMD_REGISTER_PARAM_STRING (net_enetc4_vf,ENETC4_VSI_DISABLE "=<any> " ENETC4_VSI_TIMEOUT "=<uint> " -ENETC4_VSI_DELAY "=<uint>" ); +ENETC4_VSI_DELAY "=<uint> " +ENETC4_NC_MEMORY "=<int>" );RTE_LOG_REGISTER_DEFAULT (enetc4_vf_logtype_pmd,NOTICE );
drivers/net/enetc/enetc_rxtx.c +275 -0
314 lines not on this page · raw message
Signature · 1 line
2.25.1
Stephen Hemminger
AppliedRe: [PATCH v4 0/9] ENETC driver related changes series
In reply to Gagandeep SinghQuoted 50 lines · On Mon, 29 Jun 2026 10:48:10 +0530 Gagandeep Singh <[email protected]> wrote:
V4 changes:
- Fixed a compilation issue: "txbd may be used uninitialized"V3 changes:
- Added documentation for all devargs inenetc4.rst.
- Fixed kvlist memory leak issue.V2 changes:
- Fixed an un-used variable compilation issue reported on fedora:43-gcc-minsize
- Fixed various AI reported issues:
- Release notes updated for all new devargs
- enect4.ini features doc updated for scattered RX.
- removed Not requiredRTE_PTYPE_UNKNOWN.
- Fixed mid-frame mbuf leak in SG case.
- Enabled SG for enetc4 PF also.
- move to calloc fromrte_zmallocinparse_txq_prior().
- added vaidation checks on strdup, strtoul.
- added NC devargs to use cacheable ops conditionally.
- removed dead code likebd_base_petc.
- Fixedrte_cpu_to_le_16()conversion on flags and combined all flags related patches in one patch.
- Fixed memory leak issue due to TXQ priority patch.
- There were some false positives, I have ignored them:
Race condition on flags field:
clean_tx_ringonly touches HW-completed BDs (next_to_clean→hwci), never newly-submitted BDs; doorbell hasn't fired yet.
Missing dcbf inclean_tx_ring:
DPDK is single-threaded per queue; TX path always overwrites flags completely before dcbf.
TX dcbf granularity with wrap:
Safe (AI admits it).
RX refill flush at wrap:
In-loop dcbf at i & mask == 0 already flushes aligned groups; trailing flush only needed for partial groups.
RX reading before invalidate:
dccivac precedes the read for every group in the loopGagandeep Singh (7):
net/enetc: fix TX BD structure
net/enetc: fix queue initialization
net/enetc: support ESP packet type in packet parsing net/enetc: update random MAC generation code
net/enetc: add option to disable VSI messaging net/enetc: add devargs to control VSI-PSI timeout and delay net/enetc4: add cacheable BD ring support with SW cache maintenanceVanshika Shukla (2):
net/enetc: support scatter-gather
net/enetc: set user configurable priority to TX rings
Quoted 11 lines
doc/guides/nics/enetc4.rst | 62 +++- doc/guides/nics/features/enetc4.ini | 1 + doc/guides/rel_notes/release_26_07.rst | 10 + drivers/net/enetc/base/enetc_hw.h | 13 +- drivers/net/enetc/enetc.h | 31 +- drivers/net/enetc/enetc4_ethdev.c | 172 ++++++++-- drivers/net/enetc/enetc4_vf.c | 206 ++++++++++-- drivers/net/enetc/enetc_ethdev.c | 25 +- drivers/net/enetc/enetc_rxtx.c | 430 ++++++++++++++++++++++--- 9 files changed, 831 insertions(+), 119 deletions(-)
Applied to net-next with minor rewording of git commit message to conform with check-git-log requirements.
v4 cover ENETC driver related changes series
In reply to Gagandeep SinghV4 changes:
- Fixed a compilation issue: "txbd may be used uninitialized"
V3 changes:
- Added documentation for all devargs in enetc4.rst.
- Fixed kvlist memory leak issue.
V2 changes:
- Fixed an un-used variable compilation issue reported on fedora:43-gcc-minsize
- Fixed various AI reported issues:
- Release notes updated for all new devargs
- enect4.ini features doc updated for scattered RX.
- removed Not required RTE_PTYPE_UNKNOWN.
- Fixed mid-frame mbuf leak in SG case.
- Enabled SG for enetc4 PF also.
- move to calloc from rte_zmalloc in parse_txq_prior().
- added vaidation checks on strdup, strtoul.
- added NC devargs to use cacheable ops conditionally.
- removed dead code like bd_base_p etc.
- Fixed rte_cpu_to_le_16() conversion on flags and combined all flags related patches in one patch.
- Fixed memory leak issue due to TXQ priority patch.
- There were some false positives, I have ignored them:
Race condition on flags field:
clean_tx_ring only touches HW-completed BDs (next_to_clean→hwci), never newly-submitted BDs; doorbell hasn't fired yet.
Missing dcbf in clean_tx_ring:
DPDK is single-threaded per queue; TX path always overwrites flags completely before dcbf.
TX dcbf granularity with wrap:
Safe (AI admits it).
RX refill flush at wrap:
In-loop dcbf at i & mask == 0 already flushes aligned groups; trailing flush only needed for partial groups.
RX reading before invalidate:
dccivac precedes the read for every group in the loop
Gagandeep Singh (7):
net/enetc: fix TX BD structure
net/enetc: fix queue initialization
net/enetc: support ESP packet type in packet parsing net/enetc: update random MAC generation code
net/enetc: add option to disable VSI messaging net/enetc: add devargs to control VSI-PSI timeout and delay net/enetc4: add cacheable BD ring support with SW cache maintenance
Vanshika Shukla (2):
net/enetc: support scatter-gather
net/enetc: set user configurable priority to TX rings
doc/guides/nics/enetc4.rst | 62 +++- doc/guides/nics/features/enetc4.ini | 1 + doc/guides/rel_notes/release_26_07.rst | 10 + drivers/net/enetc/base/enetc_hw.h | 13 +- drivers/net/enetc/enetc.h | 31 +- drivers/net/enetc/enetc4_ethdev.c | 172 ++++++++-- drivers/net/enetc/enetc4_vf.c | 206 ++++++++++-- drivers/net/enetc/enetc_ethdev.c | 25 +- drivers/net/enetc/enetc_rxtx.c | 430 ++++++++++++++++++++++--- 9 files changed, 831 insertions(+), 119 deletions(-)
Signature · 1 line
2.25.1
PATCH v4 1/9 net/enetc: fix TX BD structure
The flags field in struct enetc_tx_bd was declared as uint16_t but ENETC4 TX BDs only use an 8-bit flags byte. Fix the type to uint8_t to match the hardware descriptor layout.
--- drivers/net/enetc/base/enetc_hw.h | 7 +++---- drivers/net/enetc/enetc_rxtx.c | 17 +++++++++-------- 2 files changed, 12 insertions(+), 12 deletions(-)
drivers/net/enetc/base/enetc_hw.h +3 -4
@@ -1,5 +1,5 @@/* SPDX-License-Identifier: BSD-3-Clause -* Copyright 2018-2024 NXP +* Copyright 2018-2026 NXP */ #ifndef _ENETC_HW_H_
@@ -198,8 +198,7 @@ enum enetc_bdr_type {TX, RX};#define ENETC_TX_ADDR (txq, addr) ((void *)((txq)->enetc_txbdr + (addr))) -#define ENETC_TXBD_FLAGS_IE BIT(13) -#define ENETC_TXBD_FLAGS_F BIT(15) +#define ENETC_TXBD_FLAGS_F BIT(7)/* ENETC Parsed values (Little Endian) */ #define ENETC_PARSE_ERROR 0x8000
@@ -262,7 +261,7 @@ struct enetc_tx_bd { uint8_t l3t:1; uint8_t resv:5; uint8_t l4t:3; -uint16_t flags; +uint8_t flags; };/* default layout */ uint32_t txstart;uint32_t lstatus;
drivers/net/enetc/enetc_rxtx.c +9 -8
@@ -1,5 +1,5 @@/* SPDX-License-Identifier: BSD-3-Clause -* Copyright 2018-2024 NXP +* Copyright 2018-2026 NXP */ #include <stdbool.h>
@@ -101,7 +101,7 @@ enetc_xmit_pkts(void *tx_queue, tx_swbd = &tx_ring->q_swbd[i]; txbd->frm_len = tx_pkts[start]->pkt_len; txbd->buf_len = txbd->frm_len; - txbd->flags =rte_cpu_to_le_16 (ENETC_TXBD_FLAGS_F ); + txbd->flags =ENETC_TXBD_FLAGS_F ; txbd->addr = (uint64_t )(uintptr_t )rte_cpu_to_le_64 ((size_t )tx_swbd->buffer_addr->buf_iova + tx_swbd->buffer_addr->data_off);
@@ -133,13 +133,13 @@ enetc4_tx_offload_checksum(struct rte_mbuf *mbuf, struct enetc_tx_bd *txbd) txbd->ipcs =ENETC4_TXBD_IPCS ; txbd->l3_start = mbuf->l2_len; txbd->l3_hdr_size = mbuf->l3_len /4 ; - txbd->flags |=rte_cpu_to_le_16 (ENETC4_TXBD_FLAGS_L_TX_CKSUM ); + txbd->flags |=ENETC4_TXBD_FLAGS_L_TX_CKSUM ;if ((mbuf->ol_flags &RTE_MBUF_F_TX_UDP_CKSUM ) ==RTE_MBUF_F_TX_UDP_CKSUM ) { - txbd->l4t =rte_cpu_to_le_16 (ENETC4_TXBD_L4T_UDP ); - txbd->flags |=rte_cpu_to_le_16 (ENETC4_TXBD_FLAGS_L4CS ); + txbd->l4t =ENETC4_TXBD_L4T_UDP ; + txbd->flags |=ENETC4_TXBD_FLAGS_L4CS ; }else if ((mbuf->ol_flags &RTE_MBUF_F_TX_TCP_CKSUM ) ==RTE_MBUF_F_TX_TCP_CKSUM ) { - txbd->l4t =rte_cpu_to_le_16 (ENETC4_TXBD_L4T_TCP ); - txbd->flags |=rte_cpu_to_le_16 (ENETC4_TXBD_FLAGS_L4CS ); + txbd->l4t =ENETC4_TXBD_L4T_TCP ; + txbd->flags |=ENETC4_TXBD_FLAGS_L4CS ; } } }
@@ -172,7 +172,7 @@ enetc_xmit_pkts_nc(void *tx_queue,dcbf (data + j); txbd =ENETC_TXBD (*tx_ring, i); - txbd->flags =rte_cpu_to_le_16 (ENETC4_TXBD_FLAGS_F ); + txbd->flags =0 ;if (tx_ring->q_swbd[i].buffer_addr->ol_flags &ENETC4_TX_CKSUM_OFFLOAD_MASK )enetc4_tx_offload_checksum (tx_ring->q_swbd[i].buffer_addr, txbd);
@@ -182,6 +182,7 @@ enetc_xmit_pkts_nc(void *tx_queue, txbd->addr = (uint64_t )(uintptr_t )rte_cpu_to_le_64 ((size_t )tx_swbd->buffer_addr->buf_iova + tx_swbd->buffer_addr->data_off); + txbd->flags |=ENETC4_TXBD_FLAGS_F ; i++; start++;if (unlikely (i == tx_ring->bd_count))
Signature · 1 line
2.25.1
PATCH v4 2/9 net/enetc: fix queue initialization
In reply to Gagandeep SinghHardware can misbehave if the user tries to reset the consumer and producer indexes without resetting the ring.
This patch adds the ring reset step before resetting the indexes.
--- drivers/net/enetc/enetc4_ethdev.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-)
drivers/net/enetc/enetc4_ethdev.c +11 -1
@@ -1,5 +1,5 @@/* SPDX-License-Identifier: BSD-3-Clause -* Copyright 2024 NXP +* Copyright 2024-2026 NXP */ #include <stdbool.h>
@@ -279,6 +279,7 @@ enetc4_tx_queue_setup(struct rte_eth_dev *dev, const struct rte_eth_txconf *tx_conf) {int err; +uint32_t tx_data;struct enetc_bdr *tx_ring;struct rte_eth_dev_data *data = dev->data; struct enetc_eth_adapter *priv =
@@ -301,6 +302,10 @@ enetc4_tx_queue_setup(struct rte_eth_dev *dev, goto fail; tx_ring->ndev = dev; +/* reset queue */ + tx_data =enetc4_txbdr_rd (&priv->hw.hw, tx_ring->index,ENETC_TBMR ); + tx_data &= ~ENETC_TBMR_EN ; +enetc4_txbdr_wr (&priv->hw.hw, tx_ring->index,ENETC_TBMR , tx_data);enetc4_setup_txbdr (&priv->hw.hw, tx_ring); data->tx_queues[queue_idx] = tx_ring; tx_ring->tx_deferred_start = tx_conf->tx_deferred_start;
@@ -427,6 +432,7 @@ enetc4_rx_queue_setup(struct rte_eth_dev *dev, struct rte_mempool *mb_pool) {int err =0 ; +uint32_t rx_enable;struct enetc_bdr *rx_ring;struct rte_eth_dev_data *data = dev->data; struct enetc_eth_adapter *adapter =
@@ -450,6 +456,10 @@ enetc4_rx_queue_setup(struct rte_eth_dev *dev, goto fail; rx_ring->ndev = dev; +/* reset queue */ + rx_enable =enetc4_rxbdr_rd (&adapter->hw.hw, rx_ring->index,ENETC_RBMR ); + rx_enable &= ~ENETC_RBMR_EN ; +enetc4_rxbdr_wr (&adapter->hw.hw, rx_ring->index,ENETC_RBMR , rx_enable);enetc4_setup_rxbdr (&adapter->hw.hw, rx_ring, mb_pool); data->rx_queues[rx_queue_id] = rx_ring; rx_ring->rx_deferred_start = rx_conf->rx_deferred_start;
Signature · 1 line
2.25.1
PATCH v4 3/9 net/enetc: support ESP packet type in packet parsing
In reply to Gagandeep SinghAdd ESP (Encapsulating Security Payload) packet type definitions and handling to the RX packet parsing path. Also update the supported ptypes array to advertise ESP tunnel type support.
--- doc/guides/rel_notes/release_26_07.rst | 3 +++ drivers/net/enetc/base/enetc_hw.h | 4 ++++ drivers/net/enetc/enetc_ethdev.c | 3 ++- drivers/net/enetc/enetc_rxtx.c | 10 ++++++++++ 4 files changed, 19 insertions(+), 1 deletion(-)
doc/guides/rel_notes/release_26_07.rst +3 -0
@@ -187,6 +187,9 @@ New Features ``RTE_ETH_EVENT_RECOVERY_FAILED``) to notify upper layers of the reset lifecycle. +* **Updated NXP ENETC ethernet driver.** + + * Added support for ESP packet type in packet parsing Removed Items -------------
drivers/net/enetc/base/enetc_hw.h +4 -0
@@ -226,6 +226,10 @@ enum enetc_bdr_type {TX, RX}; (0x0003 | ENETC_PKT_TYPE_IPV4)#define ENETC_PKT_TYPE_IPV6_ICMP \ (0x0003 | ENETC_PKT_TYPE_IPV6) +#define ENETC_PKT_TYPE_IPV4_ESP \ + (0x0005 | ENETC_PKT_TYPE_IPV4) +#define ENETC_PKT_TYPE_IPV6_ESP \ + (0x0005 | ENETC_PKT_TYPE_IPV6)/* PCI device info */ struct enetc_hw {
drivers/net/enetc/enetc_ethdev.c +2 -1
@@ -1,5 +1,5 @@/* SPDX-License-Identifier: BSD-3-Clause -* Copyright 2018-2024 NXP +* Copyright 2018-2026 NXP */ #include <stdbool.h>
@@ -95,6 +95,7 @@ enetc_supported_ptypes_get(struct rte_eth_dev *dev __rte_unused,RTE_PTYPE_L4_UDP ,RTE_PTYPE_L4_SCTP ,RTE_PTYPE_L4_ICMP , + RTE_PTYPE_TUNNEL_ESP }; *no_of_elements =RTE_DIM (ptypes);
drivers/net/enetc/enetc_rxtx.c +10 -0
@@ -370,6 +370,16 @@ enetc_dev_rx_parse(struct rte_mbuf *m, uint16_t parse_results)RTE_PTYPE_L3_IPV6 |RTE_PTYPE_L4_UDP ;return ; +case ENETC_PKT_TYPE_IPV4_ESP : + m->packet_type =RTE_PTYPE_L2_ETHER | +RTE_PTYPE_L3_IPV4 | +RTE_PTYPE_TUNNEL_ESP ; +return ; +case ENETC_PKT_TYPE_IPV6_ESP : + m->packet_type =RTE_PTYPE_L2_ETHER | +RTE_PTYPE_L3_IPV6 | +RTE_PTYPE_TUNNEL_ESP ; +return ;case ENETC_PKT_TYPE_IPV4_SCTP : m->packet_type =RTE_PTYPE_L2_ETHER | RTE_PTYPE_L3_IPV4 |
Signature · 1 line
2.25.1
PATCH v4 4/9 net/enetc: update random MAC generation code
In reply to Gagandeep SinghUse rte_eth_random_addr() instead of manual rte_rand() based MAC generation. Also handle VF path by writing to ENETC_SIPMAR0/1 instead of ENETC_PSIPMAR0/1 when running as a VF.
--- drivers/net/enetc/enetc_ethdev.c | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-)
drivers/net/enetc/enetc_ethdev.c +10 -12
@@ -195,20 +195,18 @@ enetc_hardware_init(struct enetc_eth_hw *hw) }if ((high_mac | low_mac) ==0 ) { -char *first_byte; -ENETC_PMD_NOTICE ("MAC is not available for this SI, " "set random MAC" ); - mac = (uint32_t *)hw->mac.addr; - *mac = (uint32_t )rte_rand (); - first_byte = (char *)mac; - *first_byte &=0xfe ;/* clear multicast bit */ - *first_byte |=0x02 ;/* set local assignment bit (IEEE802) */ - -enetc_port_wr (enetc_hw,ENETC_PSIPMAR0 (0 ), *mac); - mac++; - *mac = (uint16_t )rte_rand (); -enetc_port_wr (enetc_hw,ENETC_PSIPMAR1 (0 ), *mac); +rte_eth_random_addr (hw->mac.addr); + high_mac = *(uint32_t *)hw->mac.addr; + low_mac = *(uint16_t *)(hw->mac.addr +4 ); +if (hw->device_id ==ENETC_DEV_ID_VF ) { +enetc_wr (enetc_hw,ENETC_SIPMAR0 , high_mac); +enetc_wr (enetc_hw,ENETC_SIPMAR1 , low_mac); + }else { +enetc_port_wr (enetc_hw,ENETC_PSIPMAR0 (0 ), high_mac); +enetc_port_wr (enetc_hw,ENETC_PSIPMAR1 (0 ), low_mac); + }enetc_print_ethaddr ("New address: " , (const struct rte_ether_addr *)hw->mac.addr); }
Signature · 1 line
2.25.1
PATCH v4 5/9 net/enetc: support scatter-gather
In reply to Gagandeep SinghFrom: Vanshika Shukla <[email protected]>
Add scatter-gather support for ENETC4 PMD:
- Add ENETC_RXBD_LSTATUS_R/F bits for RX BD status
- Add ENETC4_MAX_SEGS (63) for max segments per TX packet
- Update enetc4_vf_dev_infos_get to fill nb_seg_max, offloads, max queues and packet length
- Extend enetc_xmit_pkts_nc to handle multi-segment mbufs
- Extend enetc_clean_rx_ring_nc to chain scatter-gather segments using LSTATUS_R/F bits
--- doc/guides/nics/features/enetc4.ini | 1 + doc/guides/rel_notes/release_26_07.rst | 3 +- drivers/net/enetc/base/enetc_hw.h | 2 + drivers/net/enetc/enetc.h | 7 +- drivers/net/enetc/enetc4_ethdev.c | 10 +- drivers/net/enetc/enetc4_vf.c | 46 +++++++-- drivers/net/enetc/enetc_rxtx.c | 132 ++++++++++++++++--------- 7 files changed, 141 insertions(+), 60 deletions(-)
doc/guides/nics/features/enetc4.ini +1 -0
@@ -17,6 +17,7 @@ Basic stats = Y L3 checksum offload = Y L4 checksum offload = Y Queue start/stop = Y +Scattered Rx = Y Linux = Y ARMv8 = Y Usage doc = Y
doc/guides/rel_notes/release_26_07.rst +2 -1
@@ -189,7 +189,8 @@ New Features * **Updated NXP ENETC ethernet driver.** - * Added support for ESP packet type in packet parsing + * Added support for ESP packet type in packet parsing. + * Added scatter-gather support for ENETC4 PFs and VFs. Removed Items -------------
drivers/net/enetc/base/enetc_hw.h +2 -0
@@ -230,6 +230,8 @@ enum enetc_bdr_type {TX, RX}; (0x0005 | ENETC_PKT_TYPE_IPV4)#define ENETC_PKT_TYPE_IPV6_ESP \ (0x0005 | ENETC_PKT_TYPE_IPV6) +#define ENETC_RXBD_LSTATUS_R BIT(30) +#define ENETC_RXBD_LSTATUS_F BIT(31)/* PCI device info */ struct enetc_hw {
drivers/net/enetc/enetc.h +6 -1
@@ -1,5 +1,5 @@/* SPDX-License-Identifier: BSD-3-Clause -* Copyright 2018-2019,2024 NXP +* Copyright 2018-2019,2024-2026 NXP */ #ifndef _ENETC_H_
@@ -28,6 +28,8 @@#define MIN_BD_COUNT 32/* BD ALIGN */ #define BD_ALIGN 8 +/* Max segments per ENETC4 TX packet (scatter-gather) */ +#define ENETC4_MAX_SEGS 63/* minimum frame size supported */ #define ENETC_MAC_MINFRM_SIZE 68
@@ -90,6 +92,9 @@ struct enetc_bdr {int next_to_alloc;/* Rx */ };struct rte_mempool *mb_pool;/* mbuf pool to populate RX ring. */ +/* Partial scatter-gather chain persisted across burst calls. */ +struct rte_mbuf *pkt_first_seg;/* first segment of in-progress frame */ +struct rte_mbuf *pkt_last_seg;/* last segment linked so far */ struct rte_eth_dev *ndev;uint64_t ierrors;uint8_t rx_deferred_start;
drivers/net/enetc/enetc4_ethdev.c +8 -2
@@ -14,13 +14,15 @@static uint64_t dev_rx_offloads_sup =RTE_ETH_RX_OFFLOAD_IPV4_CKSUM |RTE_ETH_RX_OFFLOAD_UDP_CKSUM | -RTE_ETH_RX_OFFLOAD_TCP_CKSUM ; +RTE_ETH_RX_OFFLOAD_TCP_CKSUM | +RTE_ETH_RX_OFFLOAD_SCATTER ;/* Supported Tx offloads */ static uint64_t dev_tx_offloads_sup =RTE_ETH_TX_OFFLOAD_IPV4_CKSUM |RTE_ETH_TX_OFFLOAD_UDP_CKSUM | -RTE_ETH_TX_OFFLOAD_TCP_CKSUM ; +RTE_ETH_TX_OFFLOAD_TCP_CKSUM | +RTE_ETH_TX_OFFLOAD_MULTI_SEGS ;static int enetc4_dev_start (struct rte_eth_dev *dev)
@@ -199,11 +201,15 @@ enetc4_dev_infos_get(struct rte_eth_dev *dev, .nb_max = MAX_BD_COUNT, .nb_min = MIN_BD_COUNT, .nb_align = BD_ALIGN, + .nb_seg_max = ENETC4_MAX_SEGS, + .nb_mtu_seg_max = ENETC4_MAX_SEGS, }; dev_info->tx_desc_lim = (struct rte_eth_desc_lim ) { .nb_max =MAX_BD_COUNT , .nb_min =MIN_BD_COUNT , .nb_align =BD_ALIGN , + .nb_seg_max =ENETC4_MAX_SEGS , + .nb_mtu_seg_max =ENETC4_MAX_SEGS , }; dev_info->max_rx_queues = hw->max_rx_queues; dev_info->max_tx_queues = hw->max_tx_queues;
drivers/net/enetc/enetc4_vf.c +37 -9
71 lines not on this page · raw message
drivers/net/enetc/enetc_rxtx.c +85 -47
186 lines not on this page · raw message
Signature · 1 line
2.25.1
PATCH v4 6/9 net/enetc: add option to disable VSI messaging
In reply to Gagandeep SinghAdd devarg 'enetc4_vsi_disable' to allow disabling features dependent on VSI-PSI messaging. This is useful for testing DPDK with a PF driver that does not support VSI-PSI messages.
When the devarg is present, a reduced ops table (enetc4_vf_ops_no_vsi_m) is used that replaces link_update with a no-op stub and omits MAC/VLAN filter ops that require VSI msgs.
--- doc/guides/nics/enetc4.rst | 22 +++++++++- doc/guides/rel_notes/release_26_07.rst | 2 + drivers/net/enetc/enetc4_vf.c | 61 ++++++++++++++++++++++++-- 3 files changed, 81 insertions(+), 4 deletions(-)
doc/guides/nics/enetc4.rst +21 -1
@@ -1,5 +1,5 @@ .. SPDX-License-Identifier: BSD-3-Clause - Copyright 2024-2025 NXP + Copyright 2024-2026 NXP ENETC4 Poll Mode Driver =======================
@@ -90,3 +90,23 @@ Driver compilation and testing Follow instructions available in the document :ref:`compiling and testing a PMD for a NIC <pmd_build_and_test>` to launch **testpmd**. + + +Driver Arguments (devargs) +-------------------------- + +The ENETC4 PMD supports the following device arguments (devargs) +that can be passed via ``-a`` (allow-list) option in DPDK applications. + +VF-specific devargs +~~~~~~~~~~~~~~~~~~~ + +``enetc4_vsi_disable`` + Disable VSI-PSI messaging for the VF. + When present, features that require VSI-PSI communication + (link update, MAC filter, VLAN filter) are replaced with no-op stubs. + Useful when the PF driver does not support VSI-PSI messages. + + Usage example:: + + dpdk-testpmd -a 0000:00:01.0,enetc4_vsi_disable -- -i
doc/guides/rel_notes/release_26_07.rst +2 -0
@@ -191,6 +191,8 @@ New Features * Added support for ESP packet type in packet parsing. * Added scatter-gather support for ENETC4 PFs and VFs. + * Added devargs option ``enetc4_vsi_disable`` to disable VSI-PSI + messaging. Removed Items -------------
drivers/net/enetc/enetc4_vf.c +58 -3
100 lines not on this page · raw message
Signature · 1 line
2.25.1
PATCH v4 7/9 net/enetc: add devargs to control VSI-PSI timeout and delay
In reply to Gagandeep SinghAdd two new devargs for ENETC4 VF:
- enetc4_vsi_timeout: VSI-PSI message wait timeout (iteration count)
- enetc4_vsi_delay: VSI-PSI message wait delay in microseconds
Store the values in struct enetc_eth_hw and use them in enetc4_msg_vsi_send() instead of the hardcoded defaults. Fall back to ENETC4_DEF_VSI_WAIT_TIMEOUT_UPDATE / ENETC4_DEF_VSI_WAIT_DELAY_UPDATE when not set.
--- doc/guides/nics/enetc4.rst | 18 +++++++ doc/guides/rel_notes/release_26_07.rst | 2 + drivers/net/enetc/enetc.h | 2 + drivers/net/enetc/enetc4_vf.c | 68 +++++++++++++++++++------- 4 files changed, 73 insertions(+), 17 deletions(-)
doc/guides/nics/enetc4.rst +18 -0
@@ -110,3 +110,21 @@ VF-specific devargs Usage example:: dpdk-testpmd -a 0000:00:01.0,enetc4_vsi_disable -- -i + +``enetc4_vsi_timeout`` + Set the VSI-PSI message wait timeout as an iteration count. + Controls how many polling iterations the driver waits for a VSI-PSI + response before timing out. + Defaults to ``ENETC4_DEF_VSI_WAIT_TIMEOUT_UPDATE`` when not set. + + Usage example:: + + dpdk-testpmd -a 0000:00:01.0,enetc4_vsi_timeout=200 -- -i + +``enetc4_vsi_delay`` + Set the VSI-PSI message wait delay in microseconds between polling iterations. + Defaults to ``ENETC4_DEF_VSI_WAIT_DELAY_UPDATE`` when not set. + + Usage example:: + + dpdk-testpmd -a 0000:00:01.0,enetc4_vsi_delay=10 -- -i
doc/guides/rel_notes/release_26_07.rst +2 -0
@@ -193,6 +193,8 @@ New Features * Added scatter-gather support for ENETC4 PFs and VFs. * Added devargs option ``enetc4_vsi_disable`` to disable VSI-PSI messaging. + * Added devargs options ``enetc4_vsi_timeout`` and ``enetc4_vsi_delay`` + for VSI-PSI messaging timeout and delay. Removed Items -------------
drivers/net/enetc/enetc.h +2 -0
@@ -112,6 +112,8 @@ struct enetc_eth_hw {uint32_t num_rss;uint32_t max_rx_queues;uint32_t max_tx_queues; +uint32_t vsi_timeout;/* VSI-PSI message wait timeout (iterations) */ +uint32_t vsi_delay;/* VSI-PSI message wait delay (us) */ };/*
drivers/net/enetc/enetc4_vf.c +51 -17
175 lines not on this page · raw message
Signature · 1 line
2.25.1
PATCH v4 8/9 net/enetc: set user configurable priority to TX rings
In reply to Gagandeep SinghFrom: Vanshika Shukla <[email protected]>
Add devarg 'enetc4_txq_prior' to allow per-queue TX ring priority configuration. The value is a '|'-separated list of TBMR priority bits, one per TX queue (e.g. 'enetc4_txq_prior=1|2|3'). The configuration accepts values only up to the maximum supported TX queues. Any additional values beyond this supported range are discarded.
Store the parsed priorities in hw->txq_prior and apply them in enetc4_tx_queue_setup() when enabling the ring.
--- doc/guides/nics/enetc4.rst | 12 ++++ doc/guides/rel_notes/release_26_07.rst | 1 + drivers/net/enetc/enetc.h | 1 + drivers/net/enetc/enetc4_ethdev.c | 81 +++++++++++++++++++++++++- 4 files changed, 94 insertions(+), 1 deletion(-)
doc/guides/nics/enetc4.rst +12 -0
@@ -128,3 +128,15 @@ VF-specific devargs Usage example:: dpdk-testpmd -a 0000:00:01.0,enetc4_vsi_delay=10 -- -i + +PF/Common devargs +~~~~~~~~~~~~~~~~~ + +``enetc4_txq_prior`` + Set per-queue TX ring priority (TBMR bits). + The value is a ``|``-separated list of priority values, one per TX queue. + Values beyond the maximum supported TX queue count are discarded. + + Usage example:: + + dpdk-testpmd -a 0000:00:00.0,enetc4_txq_prior=1|2|3 -- -i
doc/guides/rel_notes/release_26_07.rst +1 -0
@@ -195,6 +195,7 @@ New Features messaging. * Added devargs options ``enetc4_vsi_timeout`` and ``enetc4_vsi_delay`` for VSI-PSI messaging timeout and delay. + * Added devargs option ``enetc4_txq_prior`` to set TX queues priorities. Removed Items -------------
drivers/net/enetc/enetc.h +1 -0
@@ -114,6 +114,7 @@ struct enetc_eth_hw {uint32_t max_tx_queues;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) */ };/*
drivers/net/enetc/enetc4_ethdev.c +80 -1
119 lines not on this page · raw message
Signature · 1 line
2.25.1
PATCH v4 9/9 net/enetc4: add cacheable BD ring support with SW cache maintenance
In reply to Gagandeep SinghOn non-cache-coherent platforms such as i.MX95, the BD ring memory may be mapped as cacheable (normal memory) while the ENETC hardware DMA engine writes and reads descriptors without CPU cache snooping. SW must therefore perform explicit cache maintenance to keep CPU caches and DDR coherent.
TX path (enetc_xmit_pkts_cacheable):
- Flush each segment's payload cache lines to PoC (dcbf) before the BD is handed to HW, so HW DMA reads the correct data.
- After all BDs for a burst are written, flush the BD cache lines (dcbf, one per 64-byte group of 4 BDs) so HW can read the updated descriptors.
RX refill (enetc_refill_rx_ring):
- After writing each full 4-BD cache-line group, dcbf that group so HW sees the buffer addresses and cleared lstatus fields.
- Flush any partial trailing group before updating the ring tail.
RX receive (enetc_recv_pkts_cacheable via enetc_clean_rx_ring_cacheable):
- Before reading BD status, dccivac the current BD cache line so stale CPU-cached BD data is discarded and fresh HW-written content is fetched from DDR.
- After a BD is consumed, dccivac each payload cache line so the CPU reads the DMA'd packet data, not stale cached bytes.
Add a new devarg 'nc=1' that allows selecting the non-cacheable RX/TX ops.
When nc=1 is specified:
eth_dev->rx_pkt_burst = &enetc_recv_pkts_nc; eth_dev->tx_pkt_burst = &enetc_xmit_pkts_nc;
The default (nc not set or nc=0) keeps the cacheable path with SW cache maintenance (dccivac/dcbf):
eth_dev->rx_pkt_burst = &enetc_recv_pkts_cacheable; eth_dev->tx_pkt_burst = &enetc_xmit_pkts_cacheable;
Usage:
--allow 0000:00:01.0,nc=1
--- doc/guides/nics/enetc4.rst | 10 + doc/guides/rel_notes/release_26_07.rst | 1 + drivers/net/enetc/enetc.h | 21 ++ drivers/net/enetc/enetc4_ethdev.c | 71 +++++-- drivers/net/enetc/enetc4_vf.c | 35 +++- drivers/net/enetc/enetc_rxtx.c | 275 +++++++++++++++++++++++++ 6 files changed, 396 insertions(+), 17 deletions(-)
doc/guides/nics/enetc4.rst +10 -0
@@ -140,3 +140,13 @@ PF/Common devargs Usage example:: dpdk-testpmd -a 0000:00:00.0,enetc4_txq_prior=1|2|3 -- -i + +``nc`` + Select non-cacheable RX/TX ops (BD rings mapped as non-cacheable memory). + Set to ``1`` to use non-cacheable descriptor ring operations. + By default, cacheable BD rings with software cache maintenance are used. + Applies to both PF and VF. + + Usage example:: + + dpdk-testpmd -a 0000:00:00.0,nc=1 -- -i
doc/guides/rel_notes/release_26_07.rst +1 -0
@@ -196,6 +196,7 @@ New Features * Added devargs options ``enetc4_vsi_timeout`` and ``enetc4_vsi_delay`` for VSI-PSI messaging timeout and delay. * Added devargs option ``enetc4_txq_prior`` to set TX queues priorities. + * Added devargs option ``nc`` to select non-cacheable RX/TX ops. Removed Items -------------
drivers/net/enetc/enetc.h +21 -0
@@ -115,6 +115,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) */ +uint8_t nc_mode;/* 1 = non-cacheable BD memory, use _nc ops */ };/*
@@ -315,8 +316,28 @@ 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_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); + +/* +* Cache-maintenance constants for cacheable BD ring mode. +* +* BD = 16 bytes, cache line = 64 bytes => 4 BDs per cache line. +* Every dcbf in enetc_refill_rx_ring() flushes a full 64-byte cache line. +* To ensure each dcbf covers only fully-written BDs the caller +* must pass a count rounded DOWN to a multiple of ENETC_BD_PER_CL so that +* the last partial group is left in cache to be completed and flushed in +* the next call. +*/ +#define ENETC_BD_PER_CL (RTE_CACHE_LINE_SIZE / sizeof(union enetc_rx_bd)) +#define ENETC_BD_PER_CL_MASK (ENETC_BD_PER_CL - 1) +/* Round n DOWN to the nearest multiple of ENETC_BD_PER_CL. */ +#define ENETC_BD_ALIGN_DOWN (n) ((n) & ~(unsigned int)ENETC_BD_PER_CL_MASK) +void enetc4_dev_hw_init (struct rte_eth_dev *eth_dev);void enetc_print_ethaddr (const char *name,const struct rte_ether_addr *eth_addr);
drivers/net/enetc/enetc4_ethdev.c +55 -16
143 lines not on this page · raw message
drivers/net/enetc/enetc4_vf.c +34 -1
@@ -12,6 +12,30 @@#define ENETC4_VSI_DISABLE "enetc4_vsi_disable"#define ENETC4_VSI_TIMEOUT "enetc4_vsi_timeout"#define ENETC4_VSI_DELAY "enetc4_vsi_delay" +#define ENETC4_NC_MEMORY "nc" + +static void +enetc4_vf_get_devarg_nc (struct rte_eth_dev *dev) +{ +struct enetc_eth_hw *hw = +ENETC_DEV_PRIVATE_TO_HW (dev->data->dev_private); +struct rte_devargs *devargs = dev->device->devargs; +struct rte_kvargs *kvlist; +const char *val; + +if (!devargs) +return ; + + kvlist =rte_kvargs_parse (devargs->args,NULL ); +if (!kvlist) +return ; + + val =rte_kvargs_get (kvlist,ENETC4_NC_MEMORY ); +if (val &&atoi (val) ==1 ) + hw->nc_mode =1 ; + +rte_kvargs_free (kvlist); +}#define ENETC_CRC_TABLE_SIZE 256#define ENETC_POLY 0x1021
@@ -1370,6 +1394,14 @@ enetc4_vf_dev_init(struct rte_eth_dev *eth_dev)enetc4_dev_hw_init (eth_dev); + hw->nc_mode =0 ; +enetc4_vf_get_devarg_nc (eth_dev); +if (hw->nc_mode) { + eth_dev->rx_pkt_burst = &enetc_recv_pkts_nc; + eth_dev->tx_pkt_burst = &enetc_xmit_pkts_nc; +ENETC_PMD_LOG (INFO ,"nc=1: using non-cacheable BD ops (_nc)" ); + } + si_cap =enetc_rd (enetc_hw,ENETC_SICAPR0 ); hw->max_tx_queues = si_cap &ENETC_SICAPR0_BDR_MASK ; hw->max_rx_queues = (si_cap >>16 ) &ENETC_SICAPR0_BDR_MASK ;
@@ -1477,5 +1509,6 @@ RTE_PMD_REGISTER_KMOD_DEP(net_enetc4_vf, "* igb_uio | uio_pci_generic");RTE_PMD_REGISTER_PARAM_STRING (net_enetc4_vf,ENETC4_VSI_DISABLE "=<any> " ENETC4_VSI_TIMEOUT "=<uint> " -ENETC4_VSI_DELAY "=<uint>" ); +ENETC4_VSI_DELAY "=<uint> " +ENETC4_NC_MEMORY "=<int>" );RTE_LOG_REGISTER_DEFAULT (enetc4_vf_logtype_pmd,NOTICE );
drivers/net/enetc/enetc_rxtx.c +275 -0
314 lines not on this page · raw message
Signature · 1 line
2.25.1