Netdev List
 help / color / mirror / Atom feed
From: "Alexei Starovoitov" <alexei.starovoitov@gmail.com>
To: "ThisSeanZhang" <thisseanzhang@gmail.com>, <bpf@vger.kernel.org>
Cc: "Daniel Borkmann" <daniel@iogearbox.net>,
	"Andrii Nakryiko" <andrii@kernel.org>,
	"Eduard Zingerman" <eddyz87@gmail.com>,
	"Kumar Kartikeya Dwivedi" <memxor@gmail.com>,
	"Martin KaFai Lau" <martin.lau@linux.dev>,
	<netdev@vger.kernel.org>, "Nick Hudson" <nhudson@akamai.com>,
	"Felix Fietkau" <nbd@nbd.name>
Subject: Re: [RFC bpf-next v3 2/3] bpf: Add PPPoE encap/decap kfuncs
Date: Fri, 13 Nov 2026 04:33:57 +0000	[thread overview]
Message-ID: <DMTSWTHS6PIL.36XSJNJDKSKDA@gmail.com> (raw)
In-Reply-To: <20261111032141.525444-3-thisseanzhang@gmail.com>

On Tue, Nov 10, 2026 at 07:21 PM ThisSeanZhang <thisseanzhang@gmail.com> wrote:
> Previously, a TC program could add or remove the header bytes
> manually, but the skb would keep a stale skb->protocol: forwarded GSO
> packets larger than the PPPoE MTU could not reach the PPPoE
> segmentation path registered for ETH_P_PPP_SES and could be dropped.
> bpf_skb_adjust_room() cannot be used for the decapsulation direction
> either, because it only accepts ETH_P_IP or ETH_P_IPV6 in
> skb->protocol.

Sorry, it is still a no go.
It works today without new kfuncs.

Encap: bpf_redirect() to the ppp device. It has no TSO, so
validate_xmit_skb() segments the GSO skb as plain IP.
pppoe_xmit() adds the header to every segment.

Decap: XDP removes the 8 bytes with bpf_xdp_adjust_head() before the skb
exists. The skb is plain IP and GRO handles it like any IP packet.

A prog that adds the header itself can update skb->protocol too.
__skb_vlan_pop() takes it from the packet. Not tested:

	bpf_skb_adjust_room(skb, 8, BPF_ADJ_ROOM_MAC, 0);
	/* write the PPPoE header and h_proto = ETH_P_PPP_SES */
	bpf_skb_vlan_push(skb, bpf_htons(ETH_P_8021Q), 0);
	bpf_skb_vlan_push(skb, bpf_htons(ETH_P_8021Q), 0);
	bpf_skb_vlan_pop(skb);
	bpf_skb_vlan_pop(skb);
	/* skb->protocol == ETH_P_PPP_SES */

I think you said earlier that it cannot. Prove me wrong.

pw-bot: cr

  reply	other threads:[~2026-11-13  4:33 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-11  3:21 [RFC bpf-next v3 0/3] bpf: Add PPPoE encap/decap kfuncs ThisSeanZhang
2026-11-11  3:21 ` [RFC bpf-next v3 1/3] bpf: Add KF_CHANGES_PKT kfunc flag ThisSeanZhang
2026-11-11  3:21 ` [RFC bpf-next v3 2/3] bpf: Add PPPoE encap/decap kfuncs ThisSeanZhang
2026-11-13  4:33   ` Alexei Starovoitov [this message]
2026-11-11  3:21 ` [RFC bpf-next v3 3/3] selftests/bpf: Add a test for the " ThisSeanZhang

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=DMTSWTHS6PIL.36XSJNJDKSKDA@gmail.com \
    --to=alexei.starovoitov@gmail.com \
    --cc=andrii@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=daniel@iogearbox.net \
    --cc=eddyz87@gmail.com \
    --cc=martin.lau@linux.dev \
    --cc=memxor@gmail.com \
    --cc=nbd@nbd.name \
    --cc=netdev@vger.kernel.org \
    --cc=nhudson@akamai.com \
    --cc=thisseanzhang@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