From: "Alexei Starovoitov" <alexei.starovoitov@gmail.com>
To: "Nikolay Aleksandrov" <razor@blackwall.org>, <bpf@vger.kernel.org>
Cc: "Eric Dumazet" <edumazet@kernel.org>,
"Jakub Kicinski" <kuba@kernel.org>,
"Paolo Abeni" <pabeni@redhat.com>, <netdev@vger.kernel.org>,
"Daniel Borkmann" <daniel@iogearbox.net>,
"Stanislav Fomichev" <sdf.kernel@gmail.com>
Subject: Re: [PATCH RFC bpf-next 0/4] bpf: add bpf_sk_assign support on netkit egress
Date: Tue, 24 Nov 2026 21:02:25 +0000 [thread overview]
Message-ID: <DN3QTN97ANJV.14Z27ER78AES8@gmail.com> (raw)
In-Reply-To: <20261124151244.1423343-1-razor@blackwall.org>
On Tue, Nov 24, 2026 at 07:12 AM Nikolay Aleksandrov <razor@blackwall.org> wrote:
> This series builds on Daniel's work [2] to steer netkit traffic to a
> transparent proxy in the receiving namespace. The receive backlog can
> outlive the transmit path's RCU read-side section, so the skb takes its
> own socket reference even for SOCK_RCU_FREE listeners.
can we do the assign at tcx ingress of the receiving netkit device ?
That works today. After NETKIT_PASS the skb goes through
sch_handle_ingress() of that device. It runs after the backlog, so
the listener stays borrowed under RCU.
tc_netkit_pkt_type already runs such a pair: tc1 in netkit, tc7 at
tcx ingress of the peer.
netkit scrubs skb->mark before the prog runs. So the netkit prog can
pass its verdict to the tcx prog in the mark.
assign_proxy_sock() from patch 4 needs no change for that, I think:
SEC("tcx/ingress")
int assign_proxy(struct __sk_buff *skb)
{
int ret = assign_proxy_sock(skb);
return ret && ret != SKIP_PACKET ? TCX_DROP : TCX_PASS;
}
bpf_program__attach_tcx(skel->progs.assign_proxy,
if_nametoindex(HOST_DEV), NULL);
The two ways:
netkit prog tcx ingress prog
(this series) on nk_host (today)
------------------ ---------------------- -----------------------
kernel changes patches 1 and 3 none
listener, UDP sk refcount inc and put no refcount
per skb
other netkit skbs netkit_run() sets and one more prog, only
clears sk_assign_skb after NETKIT_PASS
who sees the skb backlog, generic XDP, same as today
with assigned sk tcx ingress, the rest
as today
With a UDP proxy every datagram does an atomic inc and dec on one
socket, from all cpus.
commit 7ae215d23c12 ("bpf: Don't refcount LISTEN sockets in sk_assign()")
removed that for tc ingress.
Then there is no need for sock_pfree_ref, sk_assign_skb,
BPF_RI_F_NETKIT_SK_ASSIGN and the second set of rules in the helper doc.
pw-bot: cr
prev parent reply other threads:[~2026-11-24 21:02 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-24 15:12 [PATCH RFC bpf-next 0/4] bpf: add bpf_sk_assign support on netkit egress Nikolay Aleksandrov
2026-11-24 15:12 ` [PATCH RFC bpf-next 1/4] net: track references owned by prefetched socket assignments Nikolay Aleksandrov
2026-11-24 15:12 ` [PATCH RFC bpf-next 2/4] bpf: preserve owned socket assignments on ingress redirects Nikolay Aleksandrov
2026-11-24 15:12 ` [PATCH RFC bpf-next 3/4] bpf: support bpf_sk_assign in netkit tx path Nikolay Aleksandrov
2026-11-24 15:59 ` sashiko-bot
2026-11-24 16:04 ` Nikolay Aleksandrov
2026-11-24 15:12 ` [PATCH RFC bpf-next 4/4] selftests/bpf: test netkit socket assignment to a transparent proxy Nikolay Aleksandrov
2026-11-24 21:02 ` Alexei Starovoitov [this message]
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=DN3QTN97ANJV.14Z27ER78AES8@gmail.com \
--to=alexei.starovoitov@gmail.com \
--cc=bpf@vger.kernel.org \
--cc=daniel@iogearbox.net \
--cc=edumazet@kernel.org \
--cc=kuba@kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=razor@blackwall.org \
--cc=sdf.kernel@gmail.com \
/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