mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH net-next 0/7] XDP with io_uring zero-copy RX and devmem
@ 2026-11-17 16:46 Björn Töpel
  2026-11-17 16:46 ` [PATCH net-next 1/7] bpf: Keep XDP helpers within readable data Björn Töpel
                   ` (6 more replies)
  0 siblings, 7 replies; 8+ messages in thread
From: Björn Töpel @ 2026-11-17 16:46 UTC (permalink / raw)
  To: David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
	Jonathan Corbet, Alexander Duyck, Andrew Lunn,
	Alexei Starovoitov, Daniel Borkmann, Andrii Nakryiko,
	Eduard Zingerman, Kumar Kartikeya Dwivedi,
	Jesper Dangaard Brouer, Stanislav Fomichev, Magnus Karlsson,
	Maciej Fijalkowski, Pavel Begunkov, netdev, bpf
  Cc: Björn Töpel, Simon Horman, Shuah Khan, Randy Dunlap,
	kernel-team, John Fastabend, Martin KaFai Lau, Song Liu,
	Yonghong Song, Jiri Olsa, Emil Tsalapatis, Ihor Solodrai,
	Weiming Shi, Nikolay Aleksandrov, David Wei, Bobby Eshleman,
	linux-doc, linux-kernel, linux-kselftest, io-uring, Mina Almasry

Hi!

I had a long chat on page-pool providers with Magnus and Maciej
earlier this week, and the topic of "XDP on unreadable providers" came
up. Magnus suggested building on the xdp.frags mode, to support this.

Here goes...

Devmem and io_uring zero-copy RX place packet payload in memory that the
kernel cannot read through the normal packet APIs. Header split keeps
the headers in ordinary kernel memory. Today, the core rejects XDP and
these memory providers on the same device, in either attach order.

A program that checks headers should not need to copy the payload or
turn off zero-copy receive. Keep the payload in fragments and run a
native XDP program with frags support. Frags support means that the
program accepts a packet whose data_end does not cover the whole
packet. It does not give the program permission to read provider data.

Kuba added XDP_FLAGS_FRAGS_UNREADABLE, which already records this kind
of payload. xdp_buff_add_frag() sets it for net_iov fragments, and skb
construction copies it to skb->unreadable. Drivers use this path even
without an XDP program. The series uses the same flag to stop helpers
from reading or writing provider fragments. Header access still works.

XDP_PASS keeps the payload for the normal receive path. XDP_DROP frees
it without reading it. Frame redirects and AF_XDP copies reject a
buffer while the flag is set. The driver must also reject XDP_TX:
provider payload is mapped for receive, not transmit. Tail trimming
can remove the payload without reading it; after the last fragment is
removed, the remaining header buffer has no unreadable fragments.

Only drivers that declare xdp_unreadable support accept the combination.
fbnic is the real driver in this series. Its XDP_TX path drops packets
while unreadable fragments remain. netdevsim tests the attachment
rules, but it does not test packet access to provider memory.

Generic XDP remains rejected. Its receive path first copies or
linearizes nonlinear skbs, which fails when it reaches provider data.
Even if that step were skipped, skb-to-XDP conversion does not carry
the unreadable flag, and generic transmit and redirect use skb paths
outside the native driver's XDP_TX guard. Supporting generic XDP needs
separate handling; admitting it here would not be enough.


Björn

Björn Töpel (7):
  bpf: Keep XDP helpers within readable data
  xdp: Reject frames with unreadable fragments
  net: Admit native XDP on provider queues
  eth: fbnic: Run XDP on provider queues
  netdevsim: Run native XDP next to devmem
  selftests: net: Test XDP with devmem bindings
  selftests: net: Test XDP on io_uring RX

 Documentation/networking/netmem.rst           |   8 +
 MAINTAINERS                                   |   2 +
 drivers/net/ethernet/meta/fbnic/fbnic_txrx.c  |   4 +-
 drivers/net/netdevsim/netdev.c                |   2 +
 include/linux/filter.h                        |   9 +-
 include/net/netdev_queues.h                   |   6 +
 include/net/xdp.h                             |  20 +-
 kernel/bpf/helpers.c                          |   4 +-
 net/core/dev.c                                |  28 +-
 net/core/dev.h                                |   1 +
 net/core/filter.c                             |  37 ++-
 net/core/netdev_rx_queue.c                    |   2 +-
 net/xdp/xsk.c                                 |   5 +
 .../selftests/drivers/net/hw/.gitignore       |   1 +
 .../testing/selftests/drivers/net/hw/Makefile |  10 +-
 tools/testing/selftests/drivers/net/hw/config |   5 +
 .../selftests/drivers/net/hw/iou-zcrx.c       | 242 +++++++++++++++++-
 .../selftests/drivers/net/hw/iou-zcrx.py      | 108 +++++++-
 .../selftests/drivers/net/hw/iou_zcrx.bpf.c   | 111 ++++++++
 .../selftests/drivers/net/hw/iou_zcrx.h       |  34 +++
 tools/testing/selftests/net/nl_netdev.py      |  54 +++-
 21 files changed, 646 insertions(+), 47 deletions(-)
 create mode 100644 tools/testing/selftests/drivers/net/hw/iou_zcrx.bpf.c
 create mode 100644 tools/testing/selftests/drivers/net/hw/iou_zcrx.h


base-commit: f23dcd8055612eb37c666c67fe0cfe38b3c65021
-- 
2.56.1


^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2026-11-17 16:48 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-11-17 16:46 [PATCH net-next 0/7] XDP with io_uring zero-copy RX and devmem Björn Töpel
2026-11-17 16:46 ` [PATCH net-next 1/7] bpf: Keep XDP helpers within readable data Björn Töpel
2026-11-17 16:46 ` [PATCH net-next 2/7] xdp: Reject frames with unreadable fragments Björn Töpel
2026-11-17 16:46 ` [PATCH net-next 3/7] net: Admit native XDP on provider queues Björn Töpel
2026-11-17 16:46 ` [PATCH net-next 4/7] eth: fbnic: Run " Björn Töpel
2026-11-17 16:46 ` [PATCH net-next 5/7] netdevsim: Run native XDP next to devmem Björn Töpel
2026-11-17 16:46 ` [PATCH net-next 6/7] selftests: net: Test XDP with devmem bindings Björn Töpel
2026-11-17 16:46 ` [PATCH net-next 7/7] selftests: net: Test XDP on io_uring RX Björn Töpel

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®