Skip to content

RFC bpf: Introduce bpf_netpoll

Mahe Tardy bpf 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 RFC Latest4 patches 7 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/4bpf: Add netpoll kfuncs for sending UDP packetsdrivers/net/Kconfig include/linux/bpf_netpoll.h kernel/bpf/verifier.c +2 more+262 -04 replies
2/4selftests/bpf: Add netpoll kfunc sanity testtools/testing/selftests/bpf/config tools/testing/selftests/bpf/prog_tests/netpoll.c tools/testing/selftests/bpf/progs/netpoll_common.h +1 more+275 -00 replies
3/4selftests/bpf: Add netpoll kfunc IPv6 variant testtools/testing/selftests/bpf/prog_tests/netpoll.c tools/testing/selftests/bpf/progs/netpoll_sanity.c+59 -170 replies
4/4selftests/bpf: Add netpoll setup basic teststools/testing/selftests/bpf/prog_tests/netpoll.c tools/testing/selftests/bpf/progs/netpoll_basic.c+70 -00 replies

Reviews trailers per patch

1 of 4 patches has a Reviewed-by or Acked-by.

PatchMahe Tardy
1/4R-b
2/4
3/4
4/4

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v1 thread

Cover letter [RFC PATCH bpf-next 0/4] bpf: Introduce bpf_netpoll

This patch series introduces bpf_netpoll, a set of BPF kfuncs that allow BPF programs to send UDP packets via the netpoll infrastructure. This provides a mechanism for BPF programs (e.g., LSM hooks) to emit telemetry over UDP without depending on the regular networking stack.

For reference, this was discussed at LSF/MM/BPF 2025[^1] in Montreal, and again at Plumbers 2025 in Tokyo. Liam Wisehart mentioned this work during his presentation of BpfJailer[^2].

The main use case is to be able to completely dispense with agents/daemons for BPF programs after startup. In the case of Isovalent's Tetragon, the idea would be to be able to emit security alerts or export data from BPF even when the agent is down. For meta, according to Liam presentation[^2], this could replace logging via ringbuffers which created cross-binary versioning issues.

The implementation follows the established kfunc lifecycle pattern (create/acquire/release with refcounting, kptr map storage, dtor registration), for example used by the network bpf_crypto kfuncs.

Further patches would extend the bpf_netpoll_send kfunc to more program types. Note that network program types should not encounter recursion issues as netpoll bypasses the network stack and sends directly to the driver.

[^1]: https://lwn.net/Articles/1022034/
[^2]: https://lpc.events/event/19/contributions/2159/

Mahe Tardy (2):
selftests/bpf: Add netpoll kfunc IPv6 variant test selftests/bpf: Add netpoll setup basic tests

Song Liu (2):
bpf: Add netpoll kfuncs for sending UDP packets
selftests/bpf: Add netpoll kfunc sanity test

 drivers/net/Kconfig                           |  11 +
 include/linux/bpf_netpoll.h                   |  38 ++++
 kernel/bpf/verifier.c                         |   3 +
 net/core/Makefile                             |   1 +
 net/core/bpf_netpoll.c                        | 209 ++++++++++++++++++
 tools/testing/selftests/bpf/config            |   1 +
 .../selftests/bpf/prog_tests/netpoll.c        | 140 ++++++++++++
 .../selftests/bpf/progs/netpoll_basic.c       |  47 ++++
 .../selftests/bpf/progs/netpoll_common.h      |  64 ++++++
 .../selftests/bpf/progs/netpoll_sanity.c      | 135 +++++++++++
 10 files changed, 649 insertions(+)
 create mode 100644 include/linux/bpf_netpoll.h
 create mode 100644 net/core/bpf_netpoll.c
 create mode 100644 tools/testing/selftests/bpf/prog_tests/netpoll.c
 create mode 100644 tools/testing/selftests/bpf/progs/netpoll_basic.c
 create mode 100644 tools/testing/selftests/bpf/progs/netpoll_common.h
 create mode 100644 tools/testing/selftests/bpf/progs/netpoll_sanity.c
Signature · 1 line
2.34.1