Netdev List
 help / color / mirror / Atom feed
From: Matteo Croce <technoboy85@gmail.com>
To: Tony Nguyen <anthony.l.nguyen@intel.com>,
	Przemek Kitszel <przemyslaw.kitszel@intel.com>,
	Andrew Lunn <andrew+netdev@lunn.ch>,
	"David S. Miller" <davem@davemloft.net>,
	Eric Dumazet <edumazet@google.com>,
	Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
	Alexei Starovoitov <ast@kernel.org>,
	Daniel Borkmann <daniel@iogearbox.net>,
	Jesper Dangaard Brouer <hawk@kernel.org>,
	John Fastabend <john.fastabend@gmail.com>,
	Mohsin Bashir <mohsin.bashr@gmail.com>,
	"Nemo D'ACREMONT" <nemo.dacremont@dacremont.xyz>
Cc: netdev@vger.kernel.org, bpf@vger.kernel.org,
	intel-wired-lan@lists.osuosl.org, linux-kernel@vger.kernel.org
Subject: [PATCH net-next v5 0/6] e1000e: add XDP support
Date: Fri,  4 Dec 2026 21:43:54 +0100	[thread overview]
Message-ID: <20261204204400.87468-1-technoboy85@gmail.com> (raw)

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/20260323182823.5813-1-teknoraver@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


             reply	other threads:[~2026-12-04 20:44 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-12-04 20:43 Matteo Croce [this message]
2026-12-04 20:43 ` [PATCH net-next v5 1/6] e1000e: clean the Tx ring from NAPI in MSI-X mode Matteo Croce
2026-12-04 20:43 ` [PATCH net-next v5 2/6] e1000e: disable NAPI when bringing the interface down Matteo Croce
2026-12-04 20:43 ` [PATCH net-next v5 3/6] e1000e: remove packet split Rx Matteo Croce
2026-12-04 20:43 ` [PATCH net-next v5 4/6] e1000e: use libeth for Rx buffer management Matteo Croce
2026-12-04 20:44 ` [PATCH net-next v5 6/6] e1000e: add .ndo_xdp_xmit support Matteo Croce

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20261204204400.87468-1-technoboy85@gmail.com \
    --to=technoboy85@gmail.com \
    --cc=andrew+netdev@lunn.ch \
    --cc=anthony.l.nguyen@intel.com \
    --cc=ast@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=daniel@iogearbox.net \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=hawk@kernel.org \
    --cc=intel-wired-lan@lists.osuosl.org \
    --cc=john.fastabend@gmail.com \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mohsin.bashr@gmail.com \
    --cc=nemo.dacremont@dacremont.xyz \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=przemyslaw.kitszel@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox