BPF List
 help / color / mirror / Atom feed
* [PATCH v1 0/4] bpf: Introduce bpf_netpoll
@ 2026-05-11  8:53 Mahe Tardy
  2026-05-11  8:53 ` [PATCH v1 1/4] bpf: Add netpoll kfuncs for sending UDP packets Mahe Tardy
                   ` (3 more replies)
  0 siblings, 4 replies; 18+ messages in thread
From: Mahe Tardy @ 2026-05-11  8:53 UTC (permalink / raw)
  To: bpf
  Cc: andrew+netdev, andrii, ast, daniel, davem, eddyz87, edumazet,
	john.fastabend, kuba, martin.lau, pabeni, song, liamwisehart,
	Mahe Tardy

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


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

end of thread, other threads:[~2026-05-13  1:31 UTC | newest]

Thread overview: 18+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-05-11  8:53 [PATCH v1 0/4] bpf: Introduce bpf_netpoll Mahe Tardy
2026-05-11  8:53 ` [PATCH v1 1/4] bpf: Add netpoll kfuncs for sending UDP packets Mahe Tardy
2026-05-11  9:40   ` bot+bpf-ci
2026-05-11  9:51     ` Mahe Tardy
2026-05-11 12:05   ` Daniel Borkmann
2026-05-12  8:51     ` Mahe Tardy
2026-05-12  1:20   ` Jakub Kicinski
2026-05-12  1:59     ` Alexei Starovoitov
2026-05-12  2:36       ` Jakub Kicinski
2026-05-12  2:59         ` Alexei Starovoitov
2026-05-12 13:53           ` Jakub Kicinski
2026-05-12 20:25             ` Alexei Starovoitov
2026-05-12 23:32               ` Jakub Kicinski
2026-05-13  1:16                 ` Alexei Starovoitov
2026-05-13  1:31                   ` Song Liu
2026-05-11  8:53 ` [PATCH v1 2/4] selftests/bpf: Add netpoll kfunc sanity test Mahe Tardy
2026-05-11  8:53 ` [PATCH v1 3/4] selftests/bpf: Add netpoll kfunc IPv6 variant test Mahe Tardy
2026-05-11  8:53 ` [PATCH v1 4/4] selftests/bpf: Add netpoll setup basic tests Mahe Tardy

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