Re: [PATCH v19 00/13] net/sxe: added Linkdata sxe ethernet driver

Stephen Hemminger
2026-03-18T03:04:47Z

On Sat, 14 Mar 2026 16:51:52 +0800
liujie5@linkdatatechnology.com wrote:

> From: Jie Liu <liujie5@linkdatatechnology.com>
>
> This patch set implements core functionality for the SXE PMD,
> including basic driver framework, data path setup, and advanced
> offload features (VLAN, RSS, DCB, PTP etc.).
>
> V19:
> - Addressed AI comments
>
> v18:
> - Addressed AI comments
>
> Jie Liu (13):
> net/sxe: add base driver directory and doc
> net/sxe: add ethdev probe and remove
> net/sxe: add tx rx setup and data path
> net/sxe: add link and mac layer operations
> net/sxe: support vlan filter
> net/sxe: add filter function
> net/sxe: support rss offload
> net/sxe: add dcb function
> net/sxe: support ptp
> net/sxe: add xstats function
> net/sxe: add custom cmd led ctrl
> net/sxe: add simd function
> net/sxe: add virtual function
>
> MAINTAINERS | 6 +
> doc/guides/nics/features/sxe.ini | 51 +
> doc/guides/nics/features/sxe_vf.ini | 37 +
> doc/guides/nics/index.rst | 1 +
> doc/guides/nics/sxe.rst | 71 +
> doc/guides/rel_notes/release_26_03.rst | 6 +
> drivers/net/meson.build | 1 +
> drivers/net/sxe/base/sxe_common.c | 45 +
> drivers/net/sxe/base/sxe_common.h | 13 +
> drivers/net/sxe/base/sxe_compat_platform.h | 73 +
> drivers/net/sxe/base/sxe_compat_version.h | 34 +
> drivers/net/sxe/base/sxe_errno.h | 61 +
> drivers/net/sxe/base/sxe_hw.c | 3271 ++++++++++++++++++++
> drivers/net/sxe/base/sxe_hw.h | 1010 ++++++
> drivers/net/sxe/base/sxe_logs.h | 105 +
> drivers/net/sxe/base/sxe_offload_common.c | 54 +
> drivers/net/sxe/base/sxe_offload_common.h | 14 +
> drivers/net/sxe/base/sxe_queue_common.c | 450 +++
> drivers/net/sxe/base/sxe_queue_common.h | 240 ++
> drivers/net/sxe/base/sxe_rx_common.c | 358 +++
> drivers/net/sxe/base/sxe_rx_common.h | 17 +
> drivers/net/sxe/base/sxe_tx_common.c | 40 +
> drivers/net/sxe/base/sxe_tx_common.h | 12 +
> drivers/net/sxe/base/sxe_types.h | 40 +
> drivers/net/sxe/base/sxevf_hw.c | 819 +++++
> drivers/net/sxe/base/sxevf_hw.h | 318 ++
> drivers/net/sxe/base/sxevf_regs.h | 119 +
> drivers/net/sxe/include/drv_msg.h | 18 +
> drivers/net/sxe/include/sxe/sxe_cli.h | 218 ++
> drivers/net/sxe/include/sxe/sxe_hdc.h | 43 +
> drivers/net/sxe/include/sxe/sxe_ioctl.h | 21 +
> drivers/net/sxe/include/sxe/sxe_msg.h | 135 +
> drivers/net/sxe/include/sxe/sxe_regs.h | 1270 ++++++++
> drivers/net/sxe/include/sxe_type.h | 795 +++++
> drivers/net/sxe/include/sxe_version.h | 29 +
> drivers/net/sxe/meson.build | 65 +
> drivers/net/sxe/pf/rte_pmd_sxe.h | 19 +
> drivers/net/sxe/pf/sxe.h | 93 +
> drivers/net/sxe/pf/sxe_dcb.c | 945 ++++++
> drivers/net/sxe/pf/sxe_dcb.h | 99 +
> drivers/net/sxe/pf/sxe_ethdev.c | 928 ++++++
> drivers/net/sxe/pf/sxe_ethdev.h | 28 +
> drivers/net/sxe/pf/sxe_filter.c | 923 ++++++
> drivers/net/sxe/pf/sxe_filter.h | 109 +
> drivers/net/sxe/pf/sxe_flow_ctrl.c | 98 +
> drivers/net/sxe/pf/sxe_flow_ctrl.h | 16 +
> drivers/net/sxe/pf/sxe_irq.c | 516 +++
> drivers/net/sxe/pf/sxe_irq.h | 48 +
> drivers/net/sxe/pf/sxe_main.c | 196 ++
> drivers/net/sxe/pf/sxe_offload.c | 336 ++
> drivers/net/sxe/pf/sxe_offload.h | 51 +
> drivers/net/sxe/pf/sxe_phy.c | 953 ++++++
> drivers/net/sxe/pf/sxe_phy.h | 117 +
> drivers/net/sxe/pf/sxe_pmd_hdc.c | 661 ++++
> drivers/net/sxe/pf/sxe_pmd_hdc.h | 42 +
> drivers/net/sxe/pf/sxe_ptp.c | 209 ++
> drivers/net/sxe/pf/sxe_ptp.h | 26 +
> drivers/net/sxe/pf/sxe_queue.c | 774 +++++
> drivers/net/sxe/pf/sxe_queue.h | 132 +
> drivers/net/sxe/pf/sxe_rx.c | 1459 +++++++++
> drivers/net/sxe/pf/sxe_rx.h | 188 ++
> drivers/net/sxe/pf/sxe_stats.c | 586 ++++
> drivers/net/sxe/pf/sxe_stats.h | 69 +
> drivers/net/sxe/pf/sxe_tx.c | 1051 +++++++
> drivers/net/sxe/pf/sxe_tx.h | 50 +
> drivers/net/sxe/pf/sxe_vec_common.h | 321 ++
> drivers/net/sxe/pf/sxe_vec_neon.c | 600 ++++
> drivers/net/sxe/pf/sxe_vec_sse.c | 622 ++++
> drivers/net/sxe/pf/sxe_vf.c | 1199 +++++++
> drivers/net/sxe/pf/sxe_vf.h | 200 ++
> drivers/net/sxe/sxe_drv_type.h | 15 +
> drivers/net/sxe/sxe_testpmd.c | 196 ++
> drivers/net/sxe/vf/sxevf.h | 42 +
> drivers/net/sxe/vf/sxevf_ethdev.c | 752 +++++
> drivers/net/sxe/vf/sxevf_ethdev.h | 16 +
> drivers/net/sxe/vf/sxevf_filter.c | 493 +++
> drivers/net/sxe/vf/sxevf_filter.h | 70 +
> drivers/net/sxe/vf/sxevf_irq.c | 432 +++
> drivers/net/sxe/vf/sxevf_irq.h | 34 +
> drivers/net/sxe/vf/sxevf_main.c | 82 +
> drivers/net/sxe/vf/sxevf_msg.c | 624 ++++
> drivers/net/sxe/vf/sxevf_msg.h | 201 ++
> drivers/net/sxe/vf/sxevf_offload.c | 30 +
> drivers/net/sxe/vf/sxevf_offload.h | 16 +
> drivers/net/sxe/vf/sxevf_queue.c | 208 ++
> drivers/net/sxe/vf/sxevf_queue.h | 69 +
> drivers/net/sxe/vf/sxevf_rx.c | 162 +
> drivers/net/sxe/vf/sxevf_rx.h | 18 +
> drivers/net/sxe/vf/sxevf_stats.c | 162 +
> drivers/net/sxe/vf/sxevf_stats.h | 31 +
> drivers/net/sxe/vf/sxevf_tx.c | 46 +
> drivers/net/sxe/vf/sxevf_tx.h | 14 +
> 92 files changed, 27237 insertions(+)
> create mode 100644 doc/guides/nics/features/sxe.ini
> create mode 100644 doc/guides/nics/features/sxe_vf.ini
> create mode 100644 doc/guides/nics/sxe.rst
> create mode 100644 drivers/net/sxe/base/sxe_common.c
> create mode 100644 drivers/net/sxe/base/sxe_common.h
> create mode 100644 drivers/net/sxe/base/sxe_compat_platform.h
> create mode 100644 drivers/net/sxe/base/sxe_compat_version.h
> create mode 100644 drivers/net/sxe/base/sxe_errno.h
> create mode 100644 drivers/net/sxe/base/sxe_hw.c
> create mode 100644 drivers/net/sxe/base/sxe_hw.h
> create mode 100644 drivers/net/sxe/base/sxe_logs.h
> create mode 100644 drivers/net/sxe/base/sxe_offload_common.c
> create mode 100644 drivers/net/sxe/base/sxe_offload_common.h
> create mode 100644 drivers/net/sxe/base/sxe_queue_common.c
> create mode 100644 drivers/net/sxe/base/sxe_queue_common.h
> create mode 100644 drivers/net/sxe/base/sxe_rx_common.c
> create mode 100644 drivers/net/sxe/base/sxe_rx_common.h
> create mode 100644 drivers/net/sxe/base/sxe_tx_common.c
> create mode 100644 drivers/net/sxe/base/sxe_tx_common.h
> create mode 100644 drivers/net/sxe/base/sxe_types.h
> create mode 100644 drivers/net/sxe/base/sxevf_hw.c
> create mode 100644 drivers/net/sxe/base/sxevf_hw.h
> create mode 100644 drivers/net/sxe/base/sxevf_regs.h
> create mode 100644 drivers/net/sxe/include/drv_msg.h
> create mode 100644 drivers/net/sxe/include/sxe/sxe_cli.h
> create mode 100644 drivers/net/sxe/include/sxe/sxe_hdc.h
> create mode 100644 drivers/net/sxe/include/sxe/sxe_ioctl.h
> create mode 100644 drivers/net/sxe/include/sxe/sxe_msg.h
> create mode 100644 drivers/net/sxe/include/sxe/sxe_regs.h
> create mode 100644 drivers/net/sxe/include/sxe_type.h
> create mode 100644 drivers/net/sxe/include/sxe_version.h
> create mode 100644 drivers/net/sxe/meson.build
> create mode 100644 drivers/net/sxe/pf/rte_pmd_sxe.h
> create mode 100644 drivers/net/sxe/pf/sxe.h
> create mode 100644 drivers/net/sxe/pf/sxe_dcb.c
> create mode 100644 drivers/net/sxe/pf/sxe_dcb.h
> create mode 100644 drivers/net/sxe/pf/sxe_ethdev.c
> create mode 100644 drivers/net/sxe/pf/sxe_ethdev.h
> create mode 100644 drivers/net/sxe/pf/sxe_filter.c
> create mode 100644 drivers/net/sxe/pf/sxe_filter.h
> create mode 100644 drivers/net/sxe/pf/sxe_flow_ctrl.c
> create mode 100644 drivers/net/sxe/pf/sxe_flow_ctrl.h
> create mode 100644 drivers/net/sxe/pf/sxe_irq.c
> create mode 100644 drivers/net/sxe/pf/sxe_irq.h
> create mode 100644 drivers/net/sxe/pf/sxe_main.c
> create mode 100644 drivers/net/sxe/pf/sxe_offload.c
> create mode 100644 drivers/net/sxe/pf/sxe_offload.h
> create mode 100644 drivers/net/sxe/pf/sxe_phy.c
> create mode 100644 drivers/net/sxe/pf/sxe_phy.h
> create mode 100644 drivers/net/sxe/pf/sxe_pmd_hdc.c
> create mode 100644 drivers/net/sxe/pf/sxe_pmd_hdc.h
> create mode 100644 drivers/net/sxe/pf/sxe_ptp.c
> create mode 100644 drivers/net/sxe/pf/sxe_ptp.h
> create mode 100644 drivers/net/sxe/pf/sxe_queue.c
> create mode 100644 drivers/net/sxe/pf/sxe_queue.h
> create mode 100644 drivers/net/sxe/pf/sxe_rx.c
> create mode 100644 drivers/net/sxe/pf/sxe_rx.h
> create mode 100644 drivers/net/sxe/pf/sxe_stats.c
> create mode 100644 drivers/net/sxe/pf/sxe_stats.h
> create mode 100644 drivers/net/sxe/pf/sxe_tx.c
> create mode 100644 drivers/net/sxe/pf/sxe_tx.h
> create mode 100644 drivers/net/sxe/pf/sxe_vec_common.h
> create mode 100644 drivers/net/sxe/pf/sxe_vec_neon.c
> create mode 100644 drivers/net/sxe/pf/sxe_vec_sse.c
> create mode 100644 drivers/net/sxe/pf/sxe_vf.c
> create mode 100644 drivers/net/sxe/pf/sxe_vf.h
> create mode 100644 drivers/net/sxe/sxe_drv_type.h
> create mode 100644 drivers/net/sxe/sxe_testpmd.c
> create mode 100644 drivers/net/sxe/vf/sxevf.h
> create mode 100644 drivers/net/sxe/vf/sxevf_ethdev.c
> create mode 100644 drivers/net/sxe/vf/sxevf_ethdev.h
> create mode 100644 drivers/net/sxe/vf/sxevf_filter.c
> create mode 100644 drivers/net/sxe/vf/sxevf_filter.h
> create mode 100644 drivers/net/sxe/vf/sxevf_irq.c
> create mode 100644 drivers/net/sxe/vf/sxevf_irq.h
> create mode 100644 drivers/net/sxe/vf/sxevf_main.c
> create mode 100644 drivers/net/sxe/vf/sxevf_msg.c
> create mode 100644 drivers/net/sxe/vf/sxevf_msg.h
> create mode 100644 drivers/net/sxe/vf/sxevf_offload.c
> create mode 100644 drivers/net/sxe/vf/sxevf_offload.h
> create mode 100644 drivers/net/sxe/vf/sxevf_queue.c
> create mode 100644 drivers/net/sxe/vf/sxevf_queue.h
> create mode 100644 drivers/net/sxe/vf/sxevf_rx.c
> create mode 100644 drivers/net/sxe/vf/sxevf_rx.h
> create mode 100644 drivers/net/sxe/vf/sxevf_stats.c
> create mode 100644 drivers/net/sxe/vf/sxevf_stats.h
> create mode 100644 drivers/net/sxe/vf/sxevf_tx.c
> create mode 100644 drivers/net/sxe/vf/sxevf_tx.h

This driver is large and requires more detail human review so it won't
make 25.03 release.

Some more automated review feedback (some of this is false positives like complaining
about u8, etc).

Review of [PATCH v19 01/13] through [PATCH v19 13/13] net/sxe driver series
=============================================================================

Reviewed-by: Stephen Hemminger <stephen@networkplumber.org>

Patch 02/13: net/sxe: add ethdev probe and remove
--------------------------------------------------

Error: Blocking calls (mdelay) under spinlock in HDC command path.

In sxe_pmd_hdc.c, sxe_hdc_cmd_process() acquires g_hdc_lock (an
rte_spinlock_t) then calls sxe_hdc_packet_trans(), which calls
sxe_poll_fw_ack() containing mdelay(10) in a loop up to 1000
iterations (SXE_HDC_WAIT_TIME). That is up to 10 seconds of
blocking while holding a spinlock. Spinlocks are busy-wait locks;
blocking under them wastes CPU on any other thread trying to
acquire the lock and causes massive latency spikes.

Replace g_hdc_lock with a pthread_mutex_t, which is a sleeping
lock and appropriate for operations that block for milliseconds.

Error: Global HDC state re-initialized on every probe.

sxe_hdc_channel_init() is called from sxe_probe() and
re-initializes the global g_hdc_lock spinlock and resets the
global sxe_trace_id counter. If two SXE PCI devices are probed,
the second probe reinitializes the lock while the first device
may be using it. This is a race condition.

Move the HDC channel initialization to a one-time constructor
(RTE_INIT) or use rte_thread_once / an initialization flag.

Error: Non-atomic store to atomic variable.

In sxe_common.c, sxe_trace_id_gen() writes sxe_trace_id with a
plain assignment (sxe_trace_id = 0) despite sxe_trace_id being
declared RTE_ATOMIC(uint64_t) and read elsewhere via
rte_atomic_fetch_add_explicit(). This is a data race. Use
rte_atomic_store_explicit(&sxe_trace_id, 0,
rte_memory_order_relaxed).

Warning: sxe_compat_version.h defines SXE_GET_FRAME_SIZE using
dev->data->mtu + SXE_ETH_OVERHEAD, where SXE_ETH_OVERHEAD is
RTE_ETHER_HDR_LEN + RTE_ETHER_CRC_LEN (18 bytes). The feature
set claims VLAN and QinQ support. The scatter decision in
sxe_rx_queue_attr_configure (patch 03) correctly adds
2*SXE_VLAN_TAG_SIZE separately, but the SXE_GET_FRAME_SIZE macro
does not include VLAN overhead. This inconsistency means callers
of SXE_GET_FRAME_SIZE that don't add VLAN overhead themselves
will underestimate frame size. Consider making the overhead
device-specific or using SXE_ETH_DEAD_LOAD consistently.

Patch 03/13: net/sxe: add tx rx setup and data path
----------------------------------------------------

Error: mtu_set does not re-select the Rx burst function.

In sxe_mtu_set() (sxe_ethdev.c), when the device is started and
scatter is not enabled, the function rejects the MTU change with
-EINVAL and tells the user to "stop port first." However, even
if the port is stopped and restarted, the mtu_set callback itself
stores the new MTU in adapter->mtu but never updates
dev->data->scattered_rx or re-selects the Rx burst function.
The Rx function selection only happens in sxe_rx_configure()
during dev_start, but it reads dev->data->mtu, not adapter->mtu.
If adapter->mtu and dev->data->mtu diverge, the scatter decision
at restart will use the wrong value.

The adapter->mtu field appears to shadow dev->data->mtu without
a clear purpose. The ethdev layer already writes dev->data->mtu
before calling the mtu_set callback. Either remove adapter->mtu
and use dev->data->mtu everywhere, or ensure they stay in sync.

Warning: dev_infos_get reports max_mtu using SXE_ETH_OVERHEAD
(18 bytes) but the device supports VLAN/QinQ, so the true maximum
frame overhead is larger. This means max_mtu is slightly
overestimated — the ethdev layer would allow an MTU that, with
VLAN tags, exceeds max_rx_pktlen. This is a minor inconsistency
with the scatter Rx decision which does account for VLAN tags.

Patch 04/13: net/sxe: add link and mac layer operations
--------------------------------------------------------

No correctness issues found.

Patch 12/13: net/sxe: add virtual function
-------------------------------------------

Error: Missing NULL check after malloc.

In sxe_vf_rss_hash_conf_get(), rss_conf.rss_key is allocated
with malloc(SXE_RSS_KEY_SIZE) but the return value is never
checked for NULL. If malloc fails, the subsequent
sxe_rss_hash_conf_get() and memcpy() will dereference a NULL
pointer.

rss_conf.rss_key = malloc(SXE_RSS_KEY_SIZE);
+if (rss_conf.rss_key == NULL)
+ return -ENOMEM;
sxe_rss_hash_conf_get(dev, &rss_conf);

Series-wide observations
------------------------

Warning: The driver defines its own integer typedefs (u8, u16,
u32, u64, s32 etc.) in sxe_types.h. DPDK convention is to use
standard C types (uint8_t, uint16_t, uint32_t, uint64_t, int32_t)
throughout. While this is a style issue and the base/ directory
has some latitude for cross-platform shared code, the pf/ and
vf/ code that is purely DPDK should prefer standard types.

Warning: Many functions use the goto-label pattern with labels
like l_end, l_out, l_ret, l_up, l_error, l_free, etc. Some
functions have goto targets that simply return 0 unconditionally
(e.g., sxe_hw_uc_addr_pool_disable), making the goto pattern
add complexity without benefit.

Warning: sxe_ethdev.c defines local constants SXE_ETH_HLEN (14),
SXE_ETH_FRAME_LEN (1514), SXE_ETH_FCS_LEN (4) that duplicate
standard RTE_ETHER_HDR_LEN, RTE_ETHER_MAX_LEN, and
RTE_ETHER_CRC_LEN. Use the rte_ constants directly.