bpf: Introduce bpf_netpoll
Status from this message: Nacked-by: Jakub Kicinski <[email protected]>
Get series with b4
b4 am [email protected]Versions newest first
Patches in v1
| # | Subject and files | Size | Replies | Applied |
|---|---|---|---|---|
| 1/4 | bpf: Add netpoll kfuncs for sending UDP packetsdrivers/ include/ kernel/ +2 more | +262 | 13 replies | |
| 2/4 | selftests/bpf: Add netpoll kfunc sanity testtools/ tools/ tools/ +1 more | +275 | 0 replies | |
| 3/4 | selftests/bpf: Add netpoll kfunc IPv6 variant testtools/ tools/ | +58 | 0 replies | |
| 4/4 | selftests/bpf: Add netpoll setup basic teststools/ tools/ | +70 | 0 replies |
Reviews trailers per patch
1 of 4 patches has a Reviewed-by or Acked-by.
| Patch | Mahe Tardy | Jakub Kicinski |
|---|---|---|
| 1/4 | R-b | Nacked-by |
| 2/4 | ||
| 3/4 | ||
| 4/4 |
Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.
Cover letter [PATCH v1 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, again at Plumbers 2025 in Tokyo. Liam Wisehart mentioned this work during his presentation of BpfJailer[^2]. Then it was also discussed during LSF/MM/BPF 2026.
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.
Note that network program types should not encounter recursion issues as netpoll bypasses the network stack and sends directly to the driver.
v1 updates:
- use kzalloc_obj instead of kzalloc after tree wide update (alexei)
- extend bpf_netpoll_send_udp to all program types (mahe)
- correct documentation on send return value (ci bpf bot)
- add IPv6 tests as a subtest (mahe)
- we had some discussions at LSF/MM/BPF 2026 in Zagreb, demoing how this could be used, generally agreeing we could move forward with such an API.
[^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 | 139 ++++++++++++ .../selftests/bpf/progs/netpoll_basic.c | 47 ++++ .../selftests/bpf/progs/netpoll_common.h | 64 ++++++ .../selftests/bpf/progs/netpoll_sanity.c | 135 +++++++++++ 10 files changed, 648 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
--
2.34.1