This series adds XDP support to the e1000e driver, with multi-buffer frames, XDP_TX, XDP_REDIRECT and .ndo_xdp_xmit. As suggested in the v4 review, the Rx path is reworked first: the three Rx routines, and the clean_rx and alloc_rx_buf function pointers, are replaced by a single routine using the libeth helpers, and XDP is built on top of it: - patch 1 processes Tx completions from NAPI also in MSI-X mode (82574), as page_pool buffers can't be returned from hard interrupt context; - patch 2 disables NAPI in e1000e_down(), as a page_pool tied to a NAPI instance can only be destroyed while the NAPI is disabled; - patch 3 removes the packet split Rx routine; - patch 4 replaces the two remaining Rx routines with a single one: buffers are allocated from a libeth page_pool and assembled into an xdp_buff, which can span multiple descriptors, then converted into an skb; - patch 5 adds XDP support, including XDP_TX and XDP_REDIRECT, for both single and multi-buffer frames; - patch 6 adds .ndo_xdp_xmit, so that the device can be a redirect target, with or without a program attached. The hardware only supports power of two Rx buffer sizes, so it is always programmed for 2 KB buffers, and frames bigger than that span multiple descriptors. With the standard MTU, long packet reception is disabled and frames never exceed a VLAN tagged frame, so the buffers are allocated just big enough for it, two per 4 KB page. The device has a single Tx queue, shared with the regular transmit path, so XDP_TX and .ndo_xdp_xmit place the frames on it with the Tx queue lock held. The libeth_xdp Tx helpers assume dedicated XDP queues, e.g. a frame can be split across bulk flushes, so like ice the Tx side is handled by the driver. Attaching or removing a program resets the device, as the Rx buffers are reallocated with the XDP headroom. Programs without frags support are rejected when the MTU allows jumbo frames, and the MTU can't be raised above 1500 while one is attached. User visible changes: the copybreak module parameter and the rx_header_split ethtool statistic are removed, as the copy and the header split Rx paths they refer to are gone. Tested in QEMU, with three emulated 82574L devices connected to the same hub, one of them moved into a network namespace as the remote end: - drivers/net/xdp.py selftest: 21 of 27 tests pass, the other 6 are the qstats ones, as e1000e doesn't report queue stats; same result with MSI-X and with legacy interrupts; - UDP frames reflected with XDP_TX, with a redirect to the same device and with a redirect to another e1000e without a program attached: 250 single buffer frames of 18 to 1472 bytes and 450 multi-buffer frames of up to 8972 bytes in each mode, none lost or corrupted; - 60 seconds of bidirectional TCP traffic (8.95 GB) while about 180k frames were reflected onto the same Tx rings with XDP_TX and redirect, with 17 reconfigurations in the meantime (ring sizes, MTU, program, link down and up): no corrupted frame, and the device works normally afterwards; - no page_pool left with in-flight pages after the interfaces go down; - the same on a kernel with KASAN, lockdep, DMA API debugging, kmemleak and a strict IOMMU, without any warning or leak report. The other driver selftests give the same results with and without this series. ping.py's native XDP tests fail, as they ping right after attaching the program, while the link is still down after the device reset; without this series one of them is skipped, the other fails. Tested on an Intel 82574L (PCIe x1), connected at 1 Gbps through a switch to a Realtek RTL8111, which generates the traffic with pktgen. The RTL8111 can't send more than about 0.53 Mpps of 64 byte frames, below the 82574L line rate, and the 82574L handles all of them in every mode, so this is the load of the CPU handling its interrupts at that rate, with generic XDP before the series and native XDP after it: before after no program 53% 51% XDP_DROP 19% 4.5% XDP_PASS 58% 54% XDP_TX 28% 8.5% XDP_REDIRECT 28% 11% XDP_REDIRECT sends the frames back on the same device, as there is no other e1000e. TCP throughput is 941 Mbit/s in both directions, with and without the series, and with and without a program attached. The XDP_TX and redirect tests done in QEMU pass also on hardware, with MSI-X, MSI and legacy interrupts, and with the link at 100 Mbps. The device keeps working after 12 reconfigurations under 0.15 Mpps of XDP_TX and redirect traffic, without leaving page_pool pages in flight. v4: https://lore.kernel.org/all/2026…@meta.com/ v5: - rework the Rx path to use libeth with a single Rx routine, and add multi-buffer support (Maciej) - take the Tx queue lock for XDP_TX, as the ring is shared with the regular transmit path (Aleksandr) - don't put the program reference on ndo_bpf failure, it's done by the core (Aleksandr), the interface is now reset with down/up which can't fail - .ndo_xdp_xmit still stops at the first frame which doesn't fit: the caller frees the remaining ones and reports them as dropped with the xdp_devmap_xmit tracepoint, so they are not lost silently (Aleksandr) - clean the Tx ring from NAPI also in MSI-X mode, freeing XDP buffers from the hard interrupt handler was not allowed - fix the cover letter, this series is not about AF_XDP (Maciej) v4: bugfixes v3: removed a leftover file. v2: added a missing 'select PAGE_POOL' which triggered a build failure with some configurations. Matteo Croce (6): e1000e: clean the Tx ring from NAPI in MSI-X mode e1000e: disable NAPI when bringing the interface down e1000e: remove packet split Rx e1000e: use libeth for Rx buffer management e1000e: add XDP support e1000e: add .ndo_xdp_xmit support .../device_drivers/ethernet/intel/e1000e.rst | 15 - drivers/net/ethernet/intel/Kconfig | 1 + drivers/net/ethernet/intel/e1000e/e1000.h | 66 +- drivers/net/ethernet/intel/e1000e/ethtool.c | 1 - drivers/net/ethernet/intel/e1000e/netdev.c | 1853 +++++++---------- drivers/net/ethernet/intel/e1000e/param.c | 6 - 6 files changed, 792 insertions(+), 1150 deletions(-) base-commit: d5cf954cebe4f175dfd834e1dc471a3aa203ec7d
-- 2.56.1