From: "Alexei Starovoitov" <alexei.starovoitov@gmail.com>
To: "Jakub Kicinski" <kuba@kernel.org>, "Mahe Tardy" <mahe.tardy@gmail.com>
Cc: <bpf@vger.kernel.org>, <andrew+netdev@lunn.ch>,
<andrii@kernel.org>, <ast@kernel.org>, <daniel@iogearbox.net>,
<davem@davemloft.net>, <eddyz87@gmail.com>, <edumazet@google.com>,
<john.fastabend@gmail.com>, <martin.lau@linux.dev>,
<pabeni@redhat.com>, <song@kernel.org>, <liamwisehart@meta.com>
Subject: Re: [PATCH v1 1/4] bpf: Add netpoll kfuncs for sending UDP packets
Date: Mon, 11 May 2026 18:59:56 -0700 [thread overview]
Message-ID: <DIGBS3WKQN94.1YYMZM0K6CETY@gmail.com> (raw)
In-Reply-To: <20260511182019.69ebc7c6@kernel.org>
On Mon May 11, 2026 at 6:20 PM PDT, Jakub Kicinski wrote:
> On Mon, 11 May 2026 08:53:41 +0000 Mahe Tardy wrote:
>> Add 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.
>>
>> The API consists of four kfuncs:
>>
>> bpf_netpoll_create() - Allocate and set up a netpoll context
>> (sleepable, SYSCALL prog type only)
>> bpf_netpoll_acquire() - Acquire a reference to a netpoll context
>> bpf_netpoll_release() - Release a reference (cleanup via
>> queue_rcu_work since netpoll_cleanup sleeps)
>> bpf_netpoll_send_udp() - Send a UDP packet (any context, LSM prog
>> type only for now)
>>
>> The implementation follows the established kfunc lifecycle pattern
>> (create/acquire/release with refcounting, kptr map storage, dtor
>> registration). The netpoll context is wrapped in a refcounted
>> bpf_netpoll struct. Cleanup is deferred via queue_rcu_work() because
>> netpoll_cleanup() takes rtnl_lock.
>
> We have enough bug reports as is, let's not merge unusable toys.
> For any use of netpoll by BPF:
>
> Nacked-by: Jakub Kicinski <kuba@kernel.org>
unusable toys? What are you talking about?
netpoll is already called from everywhere.
bpf_netpoll_send_udp() won't add any more bugs.
I like this netpoll approach way more then creating and keeping proper socket
within bpf and all head aches of keeping it around and doing send from
good context. With netpoll all of these issues are gone.
Just bpf_netpoll_send_udp() from anywhere and it works just like it does
for dmesg.
next prev parent reply other threads:[~2026-05-12 1:59 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
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 [this message]
2026-05-12 2:36 ` Jakub Kicinski
2026-05-12 2:59 ` Alexei Starovoitov
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
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=DIGBS3WKQN94.1YYMZM0K6CETY@gmail.com \
--to=alexei.starovoitov@gmail.com \
--cc=andrew+netdev@lunn.ch \
--cc=andrii@kernel.org \
--cc=ast@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=daniel@iogearbox.net \
--cc=davem@davemloft.net \
--cc=eddyz87@gmail.com \
--cc=edumazet@google.com \
--cc=john.fastabend@gmail.com \
--cc=kuba@kernel.org \
--cc=liamwisehart@meta.com \
--cc=mahe.tardy@gmail.com \
--cc=martin.lau@linux.dev \
--cc=pabeni@redhat.com \
--cc=song@kernel.org \
/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