From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 71C8E27EFE9 for ; Thu, 30 Apr 2026 10:01:37 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.129.124 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1777543298; cv=none; b=H1lFdZcqKZv93DiqQoRhKF5y40d+dPI1beNc5sECUb6kC+mVM3OYN86ftGqkbwI4rRtwc2BHUiBh56LSFE5tbt3BXOOup68quUbZnw6sehco73mdKAni2qHIllRgwtPMQ4MH4HSpvpqqGzvonFHXiAIr/aZMZ806+StQ0Bqx9aA= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1777543298; c=relaxed/simple; bh=XuzriXIH4ZVyXTd2Jo14EGNEA6R0lhMFbzpoWHiIR+M=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=YgAnevuBzl9ZliL2ahbne9qzYpqhX2p1LAnt4JMVHgtLrcZ9PFqy7B3z8ThO31vuxWm8KJ/TO6+iEnpxSRVuzYwTxQHBCJTi4+PwOZCNcIQNlJKczaMCALEzxXBpu6qCHsulhLXqKVIv7oPkyo/rAg/XvPVFpLOy3JTX66mqfns= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=Dv1q5N6J; dkim=pass (2048-bit key) header.d=redhat.com header.i=@redhat.com header.b=fOJR05Zf; arc=none smtp.client-ip=170.10.129.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="Dv1q5N6J"; dkim=pass (2048-bit key) header.d=redhat.com header.i=@redhat.com header.b="fOJR05Zf" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1777543296; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=N07/Ak0OajH65jWxaz0uv/NFa2E5T7TXDwVpUO3pEZk=; b=Dv1q5N6JQPHOiWOnsx4STJ0dvte6fPx4tfMO938of3x1IQX1aLfQZLM4aSH1AFkf2C9kt3 QTfWHHBqU017gvJbi6360UgW9ElcNw+dFuHVYJLVa7NxxbM4ko3L8k028Zy6FmCn0pdHOs k8ioOVSg7YFOGX5XAGLiXmFYac5Fe48= Received: from mail-wr1-f72.google.com (mail-wr1-f72.google.com [209.85.221.72]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-479-DZQGQeWYNyyr-ah2Ci4P7g-1; Thu, 30 Apr 2026 06:01:35 -0400 X-MC-Unique: DZQGQeWYNyyr-ah2Ci4P7g-1 X-Mimecast-MFC-AGG-ID: DZQGQeWYNyyr-ah2Ci4P7g_1777543294 Received: by mail-wr1-f72.google.com with SMTP id ffacd0b85a97d-4411a36715dso484019f8f.2 for ; Thu, 30 Apr 2026 03:01:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=google; t=1777543294; x=1778148094; darn=vger.kernel.org; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=N07/Ak0OajH65jWxaz0uv/NFa2E5T7TXDwVpUO3pEZk=; b=fOJR05ZfmpY4TJB+K5ICwSKh+iO3aC6iM4RIkKzvJdbu47IJX/2lFvHHwDY695ALLO 8t1SaGkibrG2CK6IHZVjzxvAmeQINAzKFfGQKcMtwxkbC6tCecmi5TcZJm0f+hWfSpdI Wr6ONyFpnRtUbAYucqx+J1VEV8Xl+rkfbpR0QxudjUwEgHM9mX8DaZb4sJNnj8hWm9zF QrpVwzFJoq4FeeTMzk2ub6Xa1g0VN/0j9GmMeMMJNtbnCiHBsU1b5LhwBHcZo4mogp8N MC+YxwkKcXFJ4aEqR4PDU60CrbWCO+IfDO/SGwJXfb9EMkP/vLuHNukMTVccygez8tG+ tapw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1777543294; x=1778148094; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:date:message-id :x-gm-gg:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=N07/Ak0OajH65jWxaz0uv/NFa2E5T7TXDwVpUO3pEZk=; b=JHFehbReibcq9uE+ILb1+3jnLr3PfD4+8qT0lVMonX/zUhz60CIaiQV2Wu+sjK3YAk nMayJglyXdSc28gQRiI73sCKMsgyE07D+cRCuVpE875q722ehAo8SINCy6rlPtbHrvz4 4L6EjBzM6+K1+k4ye7xLYP/Gb9OgaH4HiEls2scQL9AEEEtNnLJyMjjgfkI2nbqLXi49 D6C56UxKTzBlSO0PcP89KdQwnmxkFukBuoGCdVlrZDVW0L0sL0uQ7/Ll2ygc16ieaQD/ elM62+8mmEwBYyMNtWSK6pO5FXEd0Y9ywb7wugXLj1jbkLN+yM++793qnIHGAe77+Chz FcUw== X-Forwarded-Encrypted: i=1; AFNElJ9qy29dSfhJe9nG7fhE2WiagfyeeKmIhr8Sy1bv8G/1NnqXUYdr4Drgdnhy99n7CUBM5R6XB8d8o5ojgdA=@vger.kernel.org X-Gm-Message-State: AOJu0YydZnLPdVAVNll56HVZj9Fx742N1R96GbfDDp/0VcTaYF5w3CTh LlJnYwvvQ6VJPFR8z8Cu6vyOMh6ek35lCF7vHPRUdLCBZWCSHdY14BniM3M/SEvbyHl0OpH4uFD dZmwxPg3NJOj8c/tRgCwaZhJYfdRn6GUURljUuInQPtb6l6HH2GMPvd9Mlgb+65FT1g== X-Gm-Gg: AeBDiev8iDH7Q9oswEVllbwTwzTUuWfP7o3xdvu8cTO8RIIF2f/tvmAh/sb2WlH1oi7 K0gkLLNWrTwFkdaqzGGS9H0NnsfMz2V1sI/Pyo/eufmiSxinpNrY43JI29kUtU+vonj0xkLownH NCegI/QjuB5aRDa0UH15NOlVt6E/xtzSbBRoJuU6BeMX4xou46eL9FrQQ7HY9Xs0XoP7F4UUZyn bRhRIe9s+7HDKgNpxzbidT0f68LFo6ZYDFS1lEq4ZYHMXVFmZEKML/NMg3Dh265XLcTBw/TRSY4 XNqcD65QCRtc6ZTDMKklO/91FI6ia+8QoExj0BqA41FhQtrv8B2zNUWvbinz9Dh+M5d6/g3YiRG xl83fDLi7gsX+s3QNrhu758UaS0atDWCTLVdk8fBAkLVM/p7Vcy47Vjgs5LhKssm6RQ== X-Received: by 2002:a05:600c:4fc5:b0:488:9e43:9690 with SMTP id 5b1f17b1804b1-48a83e7206emr39045345e9.10.1777543293590; Thu, 30 Apr 2026 03:01:33 -0700 (PDT) X-Received: by 2002:a05:600c:4fc5:b0:488:9e43:9690 with SMTP id 5b1f17b1804b1-48a83e7206emr39044565e9.10.1777543292809; Thu, 30 Apr 2026 03:01:32 -0700 (PDT) Received: from [192.168.88.32] ([150.228.93.27]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-48a81ed6b65sm89540355e9.3.2026.04.30.03.01.31 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 30 Apr 2026 03:01:32 -0700 (PDT) Message-ID: <5fb1048c-1b3d-4136-9f10-0525ef063e58@redhat.com> Date: Thu, 30 Apr 2026 12:01:30 +0200 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH net-next v7 1/2] net: pppoe: implement GRO/GSO support To: Qingfang Deng , Andrew Lunn , "David S. Miller" , Eric Dumazet , Jakub Kicinski , David Ahern , Simon Horman , Kees Cook , Guillaume Nault , Eric Woudstra , Felix Fietkau , netdev@vger.kernel.org, linux-kernel@vger.kernel.org Cc: linux-ppp@vger.kernel.org, Pablo Neira Ayuso References: <20260428064717.74794-1-qingfang.deng@linux.dev> Content-Language: en-US From: Paolo Abeni In-Reply-To: <20260428064717.74794-1-qingfang.deng@linux.dev> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit On 4/28/26 8:47 AM, Qingfang Deng wrote: > diff --git a/drivers/net/ppp/pppoe.c b/drivers/net/ppp/pppoe.c > index bdd61c504a1c..363204e0c49a 100644 > --- a/drivers/net/ppp/pppoe.c > +++ b/drivers/net/ppp/pppoe.c > @@ -77,6 +77,7 @@ > #include > #include > #include > +#include > > #include > > @@ -409,7 +410,7 @@ static int pppoe_rcv(struct sk_buff *skb, struct net_device *dev, > if (ppp_skb_is_compressed_proto(skb)) > goto drop; > > - if (pskb_trim_rcsum(skb, len)) > + if (!skb_is_gso(skb) && pskb_trim_rcsum(skb, len)) > goto drop; > > ph = pppoe_hdr(skb); > @@ -1103,6 +1104,164 @@ static struct pernet_operations pppoe_net_ops = { > .size = sizeof(struct pppoe_net), > }; > > +static u16 > +compare_pppoe_header(const struct pppoe_hdr *phdr, > + const struct pppoe_hdr *phdr2) > +{ > + __be16 proto = *(const __be16 *)(phdr + 1); > + __be16 proto2 = *(const __be16 *)(phdr2 + 1); > + > + return (__force u16)((phdr->sid ^ phdr2->sid) | (proto ^ proto2)); > +} > + > +static __be16 pppoe_hdr_proto(const struct pppoe_hdr *phdr) > +{ > + __be16 proto = *(const __be16 *)(phdr + 1); > + > + switch (proto) { > + case cpu_to_be16(PPP_IP): > + return cpu_to_be16(ETH_P_IP); > +#if IS_ENABLED(CONFIG_IPV6) > + case cpu_to_be16(PPP_IPV6): > + return cpu_to_be16(ETH_P_IPV6); > +#endif > + default: > + return 0; > + } > +} > + > +static struct sk_buff *pppoe_gro_receive(struct list_head *head, > + struct sk_buff *skb) > +{ > + const struct packet_offload *ptype; > + unsigned int hlen, off_pppoe; > + const struct pppoe_hdr *phdr; > + struct sk_buff *pp = NULL; > + struct sk_buff *p; > + int flush = 1; > + __be16 type; > + > + off_pppoe = skb_gro_offset(skb); > + hlen = off_pppoe + PPPOE_SES_HLEN; > + phdr = skb_gro_header(skb, hlen, off_pppoe); > + if (unlikely(!phdr)) > + goto out; > + > + /* filter for session packets (type:1, ver:1, code:0) */ > + if (*(const __be16 *)phdr != cpu_to_be16(0x1100)) > + goto out; > + > + /* ignore packets with padding or invalid length */ > + if (skb_gro_len(skb) != be16_to_cpu(phdr->length) + sizeof(*phdr)) > + goto out; > + > + type = pppoe_hdr_proto(phdr); > + ptype = gro_find_receive_by_type(type); > + if (!ptype) > + goto out; > + > + flush = 0; > + > + list_for_each_entry(p, head, list) { > + const struct pppoe_hdr *phdr2; > + > + if (!NAPI_GRO_CB(p)->same_flow) > + continue; > + > + phdr2 = (const struct pppoe_hdr *)(p->data + off_pppoe); > + if (compare_pppoe_header(phdr, phdr2)) > + NAPI_GRO_CB(p)->same_flow = 0; > + } > + > + skb_gro_pull(skb, PPPOE_SES_HLEN); > + skb_gro_postpull_rcsum(skb, phdr, PPPOE_SES_HLEN); > + > + pp = indirect_call_gro_receive_inet(ptype->callbacks.gro_receive, > + ipv6_gro_receive, inet_gro_receive, > + head, skb); > + > +out: > + skb_gro_flush_final(skb, pp, flush); > + > + return pp; > +} > + > +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); > + phdr->length = cpu_to_be16(len); Whoops, I wrongly replied to v6, but comments still apply here: https://lore.kernel.org/netdev/9d7f1bbc-155d-4c18-bcf7-732ebe4cbf67@redhat.com/T/#m6c92ba4367355abf1bdb001f102c4847853ac4f3 /P