Article View: linux.kernel.netdev
Article #602[PATCH net-next v5 1/6] net: core: use the packet's L3 protocol for the GSO size limit
From: Wang Zhan
Date: Thu, 08 Oct 2026 10:06
Date: Thu, 08 Oct 2026 10:06
67 lines
11144 bytes
11144 bytes
gso_features_check() compares the frame length against
netif_get_gso_max_size(), which picks the IPv4 or the IPv6 limit from
skb->protocol. A tag which is already inside the frame replaces that field
with the VLAN ethertype, as skb_vlan_push() does, and an IPv6 packet is
then measured against the IPv4 limit and segmented although the device
could send it as one TSO frame.
The lookup moves from netdevice.h into dev.c: vlan_get_protocol() reads the
L3 protocol from behind an in-frame tag, while if_vlan.h includes
netdevice.h, so an inline in that header cannot call it. dev.c is the only
file which calls the lookup, so it becomes a static helper there.
Reviewed-by: Willem de Bruijn <willemb@google.com>
Assisted-by: LLM
Signed-off-by: Wang Zhan <wang.zhan@smartx.com>
---
v4: https://lore.kernel.org/20260930111526.2183107-2-wang.zhan@smartx.com/
v3: https://lore.kernel.org/20260928044102.1004310-2-wang.zhan@smartx.com/
---
include/linux/netdevice.h | 9 ---------
net/core/dev.c | 9 +++++++++
2 files changed, 9 insertions(+), 9 deletions(-)
diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
index 8cae9b00211eee..4819acbc06ead9 100644
--- a/include/linux/netdevice.h
+++ b/include/linux/netdevice.h
@@ -5564,15 +5564,6 @@ netif_get_gro_max_size(const struct net_device *dev, const struct sk_buff *skb)
READ_ONCE(dev->gro_ipv4_max_size);
}
-static inline unsigned int
-netif_get_gso_max_size(const struct net_device *dev, const struct sk_buff *skb)
-{
- /* pairs with WRITE_ONCE() in netif_set_gso(_ipv4)_max_size() */
- return skb->protocol == htons(ETH_P_IPV6) ?
- READ_ONCE(dev->gso_max_size) :
- READ_ONCE(dev->gso_ipv4_max_size);
-}
-
static inline bool netif_is_macsec(const struct net_device *dev)
{
return dev->priv_flags & IFF_MACSEC;
diff --git a/net/core/dev.c b/net/core/dev.c
index f587645e930a15..0aedea7c9ffb79 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -3888,6 +3888,15 @@ static bool skb_has_ipv6_extension_hdr(const struct sk_buff *skb)
return false;
}
+static unsigned int
+netif_get_gso_max_size(const struct net_device *dev, const struct sk_buff *skb)
+{
+ /* pairs with WRITE_ONCE() in netif_set_gso(_ipv4)_max_size() */
+ return vlan_get_protocol(skb) == htons(ETH_P_IPV6) ?
+ READ_ONCE(dev->gso_max_size) :
+ READ_ONCE(dev->gso_ipv4_max_size);
+}
+
static netdev_features_t gso_features_check(const struct sk_buff *skb,
struct net_device *dev,
netdev_features_t features)
--
2.47.3
Technical Details
Message-ID:
<20261008100651.2534957-2-wang.zhan@smartx.com>Path:
mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-342881-linux-kernel-netdev=dewy.ruReferences:
<20261008100651.2534957-1-wang.zhan@smartx.com>Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-342881-linux-kernel-netdev=dewy.ru
From: wang.zhan@smartx.com (Wang Zhan)
Newsgroups: linux.kernel.netdev
Subject: [PATCH net-next v5 1/6] net: core: use the packet's L3 protocol for the GSO size limit
Date: Thu, 8 Oct 2026 18:06:46 +0800
Organization: Usenet Network
Message-ID: <20261008100651.2534957-2-wang.zhan@smartx.com>
References: <20261008100651.2534957-1-wang.zhan@smartx.com>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
Injection-Info: usenet.network;
logging-data="851787"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:xm850VmDQ6ac/p7Ap/PqJFCgfXM= sha256:dW4L0a36pTdIVyLTlb8nINPER4RAQHMUcJjKySfcxOk=
sha1:pkm/sZmy7wo77JHfCK7AaRo2puU= sha256:mH+kIN3nyCl8G42cWVKJuxu1o20+5O9yVrZH6DkhfbI=
List-ID: <netdev.vger.kernel.org>
X-Mailpost-Empty-Hdrs: X-Spam-Level
X-Received: from localhost (localhost [127.0.0.1])
by mail.dewy.ru (Postfix) with ESMTP id 2462510F391; Thu, 8 Oct 2026 13:10:15 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -2.951
X-Spam-Status: No, score=-2.951 tagged_above=-9999 required=6.31
tests=[DCC_REPUT_70_89=0.1, DKIM_SIGNED=0.1, DKIM_VALID=-0.1,
HEADER_FROM_DIFFERENT_DOMAINS=0.249, MAILING_LIST_MULTI=-1,
RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_PASS=-0.001]
autolearn=ham autolearn_force=no
X-Authentication-Results: mail.dewy.ru (amavisd-new); dkim=pass (2048-bit key)
header.d=smartx-com.20251104.gappssmtp.com
X-Received: from mail.dewy.ru ([127.0.0.1])
by localhost (mail.dewy.ru [127.0.0.1]) (amavisd-new, port 10024)
with ESMTP id h0P2CQds41t3;
Thu, 8 Oct 2026 13:10:11 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.234.253.10; helo=sea.lore.kernel.org; envelope-from=netdev+bounces-342881-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN>
X-Authentication-Results: OpenDMARC; dmarc=fail (p=none dis=none) header.from=smartx.com
X-Received: from sea.lore.kernel.org (sea.lore.kernel.org [172.234.253.10])
by mail.dewy.ru (Postfix) with ESMTPS id 0848710F33D; Thu, 8 Oct 2026 13:10:08 +0300 (MSK)
X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.90.174.1])
by sea.lore.kernel.org (Postfix) with ESMTP id 190942AE8D; Thu, 8 Oct 2026 10:07:17 +0000 (UTC)
X-Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id C1515492E31;
Thu, 8 Oct 2026 10:07:15 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (2048-bit key) header.d=smartx-com.20251104.gappssmtp.com header.i=@smartx-com.20251104.gappssmtp.com header.b="V/rk97gc"
X-Received: from mail-dl1-f46.google.com (mail-dl1-f46.google.com [74.125.82.46])
(using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits))
(No client certificate requested)
by smtp.subspace.kernel.org (Postfix) with ESMTPS id AC6E11C3F0C
for <netdev@vger.kernel.org>; Thu, 8 Oct 2026 10:07:10 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=74.125.82.46
X-ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
t=1791454035; cv=none; b=B3qUjh0G+DBkmanCY+LbBh6mDmAc+zQBoaUYy1ULLUN56XnS2xFW6cLgbJ84O3OuQx4A568bcWuNi1TDvqUBs5pDS+2JxEvTEk3aVtmEGSty0P6M/NRGcD/ps8e3YZVGMdIUXG+OvMW3GdpbhVFfNyOCU7Vir4Ta5cynYa3dS4Y=
X-ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org;
s=arc-20240116; t=1791454035; c=relaxed/simple;
bh=FKpBR7hQo39BL/dR/mgDOn30cx+5yCGTaAVu5tEL3Ug=;
h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References:
MIME-Version; b=rsIDGGOBJ2UBt5g9WEztnbDAgKFN4HEDE2O6fqSGuErU3wQ8s5N1MwlyuudRa9z+qRWRbZLFVle9Fi1PzoSwzK9STdpSn5m3tUHpkP+cnbSX3ASU6M4RTXRPFG3s25i4iIJkPhWr0WEjn8kcPeP5KFBkZf9MP0Wy2KKNC8LpXf0=
X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=fail (p=none dis=none) header.from=smartx.com; spf=none smtp.mailfrom=smartx.com; dkim=pass (2048-bit key) header.d=smartx-com.20251104.gappssmtp.com header.i=@smartx-com.20251104.gappssmtp.com header.b=V/rk97gc; arc=none smtp.client-ip=74.125.82.46
X-Authentication-Results: smtp.subspace.kernel.org; dmarc=fail (p=none dis=none) header.from=smartx.com
X-Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=smartx.com
X-Received: by mail-dl1-f46.google.com with SMTP id a92af1059eb24-15354aa70e8so1090755c88.1
for <netdev@vger.kernel.org>; Thu, 08 Oct 2026 03:07:10 -0700 (PDT)
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=smartx-com.20251104.gappssmtp.com; s=20251104; t=1791454030; x=1792058830; darn=vger.kernel.org;
h=content-transfer-encoding:mime-version:references:in-reply-to
:message-id:date:subject:cc:to:from:from:to:cc:subject:date
:message-id:reply-to:content-type;
bh=YXTxP7wPqB8O5jCM9UZCzUB+8OpldS6fGVM+L+IgMUE=;
b=V/rk97gcH8+cqJEgJiE56YT0PLqzWFpkSvDrLhN+G1Y/FGnjGl3xdqSbLeisJhhBTm
6yLmMno7GpPe8/XttHuNp6iEmutD0xgLWZTdu5zoNqlHl78K6wEHLT0SzP/T19189SHB
+pM0T0wA1mvvMARUxTqEtZBRQLZLWx1hzkqbh/u5iNWJIA7r9UzPnVaYZn+JCL7av3nd
rB/QqClLpiMyvySbXsFRGofPpRljzHBlzRDinjbKXv4UQSFge+RMHe+IsxFhh6ThGOei
778p1c4BxaxaTuSQBqtKoUsuta2z67vfZWFvvyZTg7kV2Sr6jBMHMGPVt3664EjnTrEK
XKaQ==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20260707; t=1791454030; x=1792058830;
h=content-transfer-encoding:mime-version:references:in-reply-to
:message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from
:to:cc:subject:date:message-id:reply-to:content-type;
bh=YXTxP7wPqB8O5jCM9UZCzUB+8OpldS6fGVM+L+IgMUE=;
b=BaXm54WVA/6VXYPB/d1SypciHb9H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6djOnUE=
X-Received: by 2002:a05:701b:2802:b0:15b:722b:4bfc with SMTP id a92af1059eb24-162088094a4mr5144719c88.31.1791454029089;
Thu, 08 Oct 2026 03:07:09 -0700 (PDT)
X-Received: from localhost.localdomain ([23.148.204.128])
by smtp.gmail.com with ESMTPSA id a92af1059eb24-161684ba3fdsm14200933c88.12.2026.10.08.03.07.04
(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
Thu, 08 Oct 2026 03:07:08 -0700 (PDT)
X-Cc: davem@davemloft.net,
edumazet@google.com,
kuba@kernel.org,
pabeni@redhat.com,
horms@kernel.org,
keyong.sun@smartx.com,
Willem de Bruijn <willemdebruijn.kernel@gmail.com>,
Jason Wang <jasowangio@gmail.com>,
Andrew Lunn <andrew+netdev@lunn.ch>,
Aaron Conole <aconole@redhat.com>,
Eelco Chaudron <echaudro@redhat.com>,
Ilya Maximets <i.maximets@ovn.org>,
dev@openvswitch.org,
Daniel Borkmann <daniel@iogearbox.net>,
Neal Cardwell <ncardwell@google.com>,
Kuniyuki Iwashima <kuniyu@google.com>,
Alice Mikityanska <alice@isovalent.com>,
David Laight <david.laight.linux@gmail.com>,
Wang Zhan <wang.zhan@smartx.com>,
Willem de Bruijn <willemb@google.com>
X-Mailer: git-send-email 2.47.3
X-In-Reply-To: <20261008100651.2534957-1-wang.zhan@smartx.com>
X-Precedence: bulk
X-Mailing-List: netdev@vger.kernel.org
X-List-Subscribe: <mailto:netdev+subscribe@vger.kernel.org>
X-List-Unsubscribe: <mailto:netdev+unsubscribe@vger.kernel.org>