From: ThisSeanZhang <thisseanzhang@gmail.com>
To: bpf@vger.kernel.org
Cc: ThisSeanZhang <thisseanzhang@gmail.com>,
Alexei Starovoitov <ast@kernel.org>,
Daniel Borkmann <daniel@iogearbox.net>,
Andrii Nakryiko <andrii@kernel.org>,
Eduard Zingerman <eddyz87@gmail.com>,
netdev@vger.kernel.org, Nick Hudson <nhudson@akamai.com>,
Felix Fietkau <nbd@openwrt.org>, Qingfang Deng <dqfext@gmail.com>
Subject: [RFC bpf-next 0/3] bpf: Add PPPoE encap/decap support to bpf_skb_adjust_room
Date: Sat, 26 Sep 2026 17:07:54 -0400 [thread overview]
Message-ID: <20260926210757.2152159-1-thisseanzhang@gmail.com> (raw)
Hello,
This series adds PPPoE session encapsulation and decapsulation support to
bpf_skb_adjust_room(), allowing TC BPF programs to update packet data and
skb metadata consistently.
A TC program can currently insert bytes with bpf_skb_adjust_room() and
fill them with a PPPoE header, but it cannot decapsulate a PPPoE packet or
update skb->protocol and related header metadata consistently. This prevents
packets modified by a TC BPF program from using the PPPoE GSO/GRO path
correctly. The new flags let the helper insert or remove the fixed-size
header and update the skb metadata, while the BPF program fills in the
header bytes and the ethertype on encapsulation and restores the
ethertype on decapsulation.
This series builds on the PPPoE GRO/GSO support merged by commit
55a5d8fca836 ("net: pppoe: implement GRO/GSO support"). That support is
available to packets whose skb metadata identifies them as ETH_P_PPP_SES;
the flags added here make that metadata transition possible from a TC BPF
program.
Examples:
bpf_skb_adjust_room(skb, PPPOE_SES_HLEN, BPF_ADJ_ROOM_MAC,
BPF_F_ADJ_ROOM_ENCAP_PPPOE);
bpf_skb_adjust_room(skb, -PPPOE_SES_HLEN, BPF_ADJ_ROOM_MAC,
BPF_F_ADJ_ROOM_DECAP_PPPOE);
Encapsulation changes skb->protocol to ETH_P_PPP_SES. Decapsulation accepts
only packets whose skb->protocol is ETH_P_PPP_SES, reads the PPP protocol
field, and restores ETH_P_IP or ETH_P_IPV6. Both flags require
BPF_ADJ_ROOM_MAC and a fixed eight-byte adjustment.
The selftest covers IPv4 and IPv6 round trips, protocol transitions, and
invalid flag, size, mode, protocol, and truncated-packet cases. The kernel
and the BPF selftests build cleanly with this series. The selftest also
passes in a QEMU/KVM boot of the resulting kernel (11/11 subtests).
Questions for reviewers:
- Is extending bpf_skb_adjust_room() with dedicated PPPoE flags the
preferred interface?
- Should the helper validate more of the PPPoE header (version, type,
code, session ID, length)?
- Should the helper update the Ethernet ethertype during encapsulation
and decapsulation, or should that remain the BPF program's
responsibility?
ThisSeanZhang (3):
bpf: Add PPPoE encap support to bpf_skb_adjust_room
bpf: Add PPPoE decap support to bpf_skb_adjust_room
selftests/bpf: Add a test for the PPPoE encap/decap adjust_room flags
include/uapi/linux/bpf.h | 21 ++
net/core/filter.c | 85 +++++-
tools/include/uapi/linux/bpf.h | 21 ++
.../selftests/bpf/prog_tests/tc_pppoe.c | 249 ++++++++++++++++++
tools/testing/selftests/bpf/progs/tc_pppoe.c | 159 +++++++++++
5 files changed, 532 insertions(+), 3 deletions(-)
create mode 100644 tools/testing/selftests/bpf/prog_tests/tc_pppoe.c
create mode 100644 tools/testing/selftests/bpf/progs/tc_pppoe.c
--
2.47.3
next reply other threads:[~2026-09-26 21:08 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-26 21:07 ThisSeanZhang [this message]
2026-09-26 21:07 ` [RFC bpf-next 1/3] bpf: Add PPPoE encap support to bpf_skb_adjust_room ThisSeanZhang
2026-09-26 21:07 ` [RFC bpf-next 2/3] bpf: Add PPPoE decap " ThisSeanZhang
2026-09-26 21:07 ` [RFC bpf-next 3/3] selftests/bpf: Add a test for the PPPoE encap/decap adjust_room flags ThisSeanZhang
2026-09-27 4:41 ` [RFC bpf-next 0/3] bpf: Add PPPoE encap/decap support to bpf_skb_adjust_room Alexei Starovoitov
2026-09-27 6:13 ` Sean zhang
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=20260926210757.2152159-1-thisseanzhang@gmail.com \
--to=thisseanzhang@gmail.com \
--cc=andrii@kernel.org \
--cc=ast@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=daniel@iogearbox.net \
--cc=dqfext@gmail.com \
--cc=eddyz87@gmail.com \
--cc=nbd@openwrt.org \
--cc=netdev@vger.kernel.org \
--cc=nhudson@akamai.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