From: Paolo Abeni <pabeni@redhat.com>
To: Qingfang Deng <dqfext@gmail.com>,
Michal Ostrowski <mostrows@earthlink.net>,
Andrew Lunn <andrew+netdev@lunn.ch>,
"David S. Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@google.com>,
Jakub Kicinski <kuba@kernel.org>,
David Ahern <dsahern@kernel.org>, Simon Horman <horms@kernel.org>,
netdev@vger.kernel.org, linux-kernel@vger.kernel.org
Cc: linux-ppp@vger.kernel.org, Felix Fietkau <nbd@nbd.name>
Subject: Re: [RFC PATCH net-next v6 1/2] net: pppoe: implement GRO/GSO support
Date: Thu, 30 Apr 2026 11:34:17 +0200 [thread overview]
Message-ID: <9d7f1bbc-155d-4c18-bcf7-732ebe4cbf67@redhat.com> (raw)
In-Reply-To: <20260326081127.61229-1-dqfext@gmail.com>
On 3/26/26 9:11 AM, Qingfang Deng wrote:
> +static int pppoe_gro_complete(struct sk_buff *skb, int nhoff)
> +{
> + struct pppoe_hdr *phdr = (struct pppoe_hdr *)(skb->data + nhoff);
> + __be16 type = pppoe_hdr_proto(phdr);
> + struct packet_offload *ptype;
> + unsigned int len;
> +
> + ptype = gro_find_complete_by_type(type);
> + if (!ptype)
> + return -ENOENT;
> +
> + len = skb->len - (nhoff + sizeof(*phdr));
> + len = min(len, 0xFFFFU);
AFAICS, when the computed len is >= 64K, and the above min() will
truncate it, later pppoe_rcv() will drop the packet.
I think you should prevent such case at GRO time, flushing the chain
when it grows too big.
> + phdr->length = cpu_to_be16(len);
> +
> + return INDIRECT_CALL_INET(ptype->callbacks.gro_complete,
> + ipv6_gro_complete, inet_gro_complete,
> + skb, nhoff + PPPOE_SES_HLEN);
> +}
> +
> +static struct sk_buff *pppoe_gso_segment(struct sk_buff *skb,
> + netdev_features_t features)
> +{
> + unsigned int pppoe_hlen = sizeof(struct pppoe_hdr) + 2;
> + struct sk_buff *segs = ERR_PTR(-EINVAL);
> + u16 mac_offset = skb->mac_header;
> + struct packet_offload *ptype;
> + u16 mac_len = skb->mac_len;
> + struct pppoe_hdr *phdr;
> + __be16 orig_type, type;
> + int len, nhoff;
> +
> + skb_reset_network_header(skb);
> + nhoff = skb_network_header(skb) - skb_mac_header(skb);
> +
> + if (unlikely(!pskb_may_pull(skb, pppoe_hlen)))
> + goto out;
> +
> + phdr = (struct pppoe_hdr *)skb_network_header(skb);
> + type = pppoe_hdr_proto(phdr);
> + ptype = gro_find_complete_by_type(type);
> + if (!ptype)
> + goto out;
> +
> + orig_type = skb->protocol;
> + __skb_pull(skb, pppoe_hlen);
> + segs = ptype->callbacks.gso_segment(skb, features);
> + if (IS_ERR_OR_NULL(segs)) {
> + skb_gso_error_unwind(skb, orig_type, pppoe_hlen, mac_offset,
> + mac_len);
> + goto out;
> + }
> +
> + skb = segs;
> + do {
> + phdr = (struct pppoe_hdr *)(skb_mac_header(skb) + nhoff);
> + len = skb->len - (nhoff + sizeof(*phdr));
> + phdr->length = cpu_to_be16(len);
> + skb->network_header = (u8 *)phdr - skb->head;
I understand is quite late for the following question, but...
The network headers points to the pppoe hdr. Should it point to the
actual IP hdr?
Why not? A comment in the code or in the commit message would be
appreciated.
/P
next prev parent reply other threads:[~2026-04-30 9:34 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-03-26 8:11 [RFC PATCH net-next v6 1/2] net: pppoe: implement GRO/GSO support Qingfang Deng
2026-03-26 8:11 ` [RFC PATCH net-next v6 2/2] selftests: net: test PPPoE packets in gro.sh Qingfang Deng
2026-03-26 16:29 ` Willem de Bruijn
2026-04-30 9:34 ` Paolo Abeni [this message]
2026-04-30 15:47 ` [RFC PATCH net-next v6 1/2] net: pppoe: implement GRO/GSO support Qingfang Deng
2026-04-30 15:57 ` Pablo Neira Ayuso
2026-04-30 16:22 ` Paolo Abeni
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=9d7f1bbc-155d-4c18-bcf7-732ebe4cbf67@redhat.com \
--to=pabeni@redhat.com \
--cc=andrew+netdev@lunn.ch \
--cc=davem@davemloft.net \
--cc=dqfext@gmail.com \
--cc=dsahern@kernel.org \
--cc=edumazet@google.com \
--cc=horms@kernel.org \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-ppp@vger.kernel.org \
--cc=mostrows@earthlink.net \
--cc=nbd@nbd.name \
--cc=netdev@vger.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