Article View: linux.kernel.netdev
Article #11819Re: [net PATCH] net: Segment CHECKSUM_UNNECESSARY GSO skbs other than fraglist
From: netdev-bot+sashiko
Date: Thu, 05 Nov 2026 17:11
Date: Thu, 05 Nov 2026 17:11
136 lines
13020 bytes
13020 bytes
Thank you for your contribution! Sashiko AI review found 1 potential
issue(s) to consider.
Critical: 0 · High: 0 · Medium: 1 · Low: 0
If you believe none of the issues are legitimate, please reply to each
issue of Medium severity or higher and explain why the AI is wrong.
If any of them are legitimate and you plan to respin, please let patchwork
know by including "pw-bot: cr" as a separate line at the end of your reply
(one such reply per series is enough).
- [Medium] In validate_xmit_skb() (net/core/dev.c), a non-fraglist
CHECKSUM_UNNECESSARY GSO skb is relabelled CHECKSUM_NONE before…
--
net: Segment CHECKSUM_UNNECESSARY GSO skbs other than fraglist
This commit changes validate_xmit_skb() to relabel any non-fraglist
CHECKSUM_UNNECESSARY GSO skb, such as a hardware LRO aggregate sent out
through tc mirred, as CHECKSUM_NONE. The stated intent is that
netif_needs_gso() then segments these skbs in software. Without the
change, drivers that only set up TSO for CHECKSUM_PARTIAL send one
oversized frame with a bad checksum.
> diff --git a/net/core/dev.c b/net/core/dev.c
> index f32353b0467cd..28b4a652d037f 100644
> --- a/net/core/dev.c
> +++ b/net/core/dev.c
> @@ -4207,6 +4207,17 @@ static struct sk_buff *validate_xmit_skb(struct sk_buff *skb, struct net_device
> if (unlikely(!skb))
> goto out_null;
>
> + /* Only fraglist GSO, whose segments already carry valid checksums,
> + * can be handed to a device as CHECKSUM_UNNECESSARY. Any other GSO
> + * skb has no csum_start for the device to segment from. NONE means
> + * the same on transmit, and has netif_needs_gso() segment it in
> + * software.
> + */
> + if (unlikely(skb->ip_summed == CHECKSUM_UNNECESSARY &&
> + skb_is_gso(skb) &&
> + !(skb_shinfo(skb)->gso_type & SKB_GSO_FRAGLIST)))
> + skb->ip_summed = CHECKSUM_NONE;
> +
> features = netif_skb_features(skb);
[Severity: Medium]
On a TSO-capable egress device, does this path actually reach software
segmentation?
ip_summed is already CHECKSUM_NONE when netif_skb_features() runs, so
the driver's ndo_features_check() sees a non-PARTIAL skb.
i40e_features_check(), ice_features_check() and fbnic_features_check()
all return early in that case and leave NETIF_F_GSO_MASK set:
drivers/net/ethernet/intel/i40e/i40e_main.c:i40e_features_check() {
if (skb->ip_summed != CHECKSUM_PARTIAL)
return features;
...
}
harmonize_features() also skips its can_checksum_protocol() test for
CHECKSUM_NONE.
netif_needs_gso() then returns true, and __skb_gso_segment() runs with
NETIF_F_TSO/TSO6 still in features. tcp4_gso_segment() (and
tcp6_gso_segment()) turns the skb back into CHECKSUM_PARTIAL:
net/ipv4/tcp_offload.c:tcp4_gso_segment() {
if (unlikely(skb->ip_summed != CHECKSUM_PARTIAL)) {
...
th->check = 0;
skb->ip_summed = CHECKSUM_PARTIAL;
__tcp_v4_send_check(skb, iph->saddr, iph->daddr);
}
return tcp_gso_segment(skb, features);
}
Since the device can do TSO, tcp_gso_segment() then returns NULL:
net/ipv4/tcp_offload.c:tcp_gso_segment() {
...
if (skb_gso_ok(skb, features | NETIF_F_GSO_ROBUST)) {
...
segs = NULL;
goto out;
}
...
}
validate_xmit_skb() treats NULL as "not segmented" and passes the
original skb to the driver as a CHECKSUM_PARTIAL TSO request.
If so, the new comment ("has netif_needs_gso() segment it in software")
and the commit message ("The netif_needs_gso function then segments it
in software") don't match what happens on most real NICs. fbnic
advertises NETIF_F_TSO/TSO6. Did the MSS-sized frames in the QEMU test
come from the emulated device's TSO rather than from software GSO?
A further concern is that the driver's TSO validation never sees the
skb in the form that is finally offloaded. i40e and ice drop GSO when
gso_size < 64 ("We cannot support GSO if the MSS is going to be less
than 64 bytes"). fbnic checks L2/L3 header length, alignment and
csum_offset limits. All of these checks are skipped for these skbs.
mlx5 LRO sets gso_size to an average over the aggregated segments:
drivers/net/ethernet/mellanox/mlx5/core/en_rx.c:mlx5e_build_rx_skb() {
...
skb_shinfo(skb)->gso_size = DIV_ROUND_UP(cqe_bcnt - hdrlen, lro_num_seg);
...
}
Could a remote peer that sends small segments produce an aggregate that
gets redirected to i40e or ice as a TSO request with an MSS below 64?
DODGY CHECKSUM_NONE GSO skbs already take this bypass. This patch sends
every LRO-style CHECKSUM_UNNECESSARY TCP GSO skb through it as well.
Would one of these options give the documented behaviour?
- Clear NETIF_F_GSO_MASK from features for the converted skbs after
netif_skb_features().
- Before netif_skb_features(), turn the skbs into proper
CHECKSUM_PARTIAL skbs (cow the header, set csum_start and
csum_offset, write the pseudo-header checksum). Then
ndo_features_check() validates what is actually offloaded.
> skb = validate_xmit_vlan(skb, features);
> if (unlikely(!skb))
--
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/179372577673.49909.11253315483074546903.stgit%40ahduyck-xeon-server.home.arpa
Technical Details
Message-ID:
<179389871649.994134.5339648334633501825@kernel.org>Path:
mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-357520-linux-kernel-netdev=dewy.ruReferences:
<179372577673.49909.11253315483074546903.stgit@ahduyck-xeon-server.home.arpa>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-357520-linux-kernel-netdev=dewy.ru From: netdev-bot+sashiko@kernel.org Newsgroups: linux.kernel.netdev Subject: Re: [net PATCH] net: Segment CHECKSUM_UNNECESSARY GSO skbs other than fraglist Date: Thu, 05 Nov 2026 17:11:56 +0000 Organization: Usenet Network Message-ID: <179389871649.994134.5339648334633501825@kernel.org> References: <179372577673.49909.11253315483074546903.stgit@ahduyck-xeon-server.home.arpa> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit Injection-Info: usenet.network; logging-data="3688956"; mail-complaints-to="abuse@usenet.network" Cancel-Lock: sha1:1hCiZfjA+qDdt/npynjlVoiAIlA= sha256:PwD7T9zpCxTzCH07T2o6XcHCZBiJTIm6284qRT/PVMw= sha1:Ut2pZvOnVBhKeTQgVMb9OZQ+wUQ= sha256:5AHAnvuE3LsNnd9Ef5eq9OkeTdNXpd/Cf9BesCjRXZA= 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 EE20411303A; Thu, 5 Nov 2026 20:21:25 +0300 (MSK) X-Virus-Scanned: Debian amavisd-new at usenet.network X-Spam-Flag: NO X-Spam-Score: -3.4 X-Spam-Status: No, score=-3.4 tagged_above=-9999 required=6.31 tests=[DCC_REPUT_70_89=0.1, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, MAILING_LIST_MULTI=-1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001] autolearn=ham autolearn_force=no X-Authentication-Results: mail.dewy.ru (amavisd-new); dkim=pass (2048-bit key) header.d=kernel.org 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 hZXRbxfYsyGw; Thu, 5 Nov 2026 20:21:22 +0300 (MSK) X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.105.105.114; helo=tor.lore.kernel.org; envelope-from=netdev+bounces-357520-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN> X-Authentication-Results: OpenDMARC; dmarc=pass (p=quarantine dis=none) header.from=kernel.org X-Received: from tor.lore.kernel.org (tor.lore.kernel.org [172.105.105.114]) by mail.dewy.ru (Postfix) with ESMTPS id C239F113037; Thu, 5 Nov 2026 20:21:10 +0300 (MSK) X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92]) by tor.lore.kernel.org (Postfix) with ESMTP id 8B4E029C3E; Thu, 5 Nov 2026 17:11:59 +0000 (UTC) X-Authentication-Results: smtp.subspace.kernel.org; arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1 X-ARC-Seal: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=pass; t=1793898719; b=U7828PLDuirNTmthY4gAjiegfVpuXdTAn9RmsC+0/KRK4wGlKg8Zc8qleYIybSs1++SD O3/ACzdLfxdv5ZkvBZMjS9RvHCf2IjdBSjpyj9bcmhQnBqaDl8B0H+U0ZBBhw1mZyv3uU TndtmiWdn5Zo8JDNrX60qTkSWGPCVkWdTdAcpXPArB4rHDKHuHW0OscZtYSt44vY870iz 4kYToS7NkMj6pZLLI44ciHq6auNz1GfK8a49pmkS6Qa2HeDkjgCYih+oNb68w8cEP1fcu Qx1FwTBDyP2EhOnTqaAdFEFcInme6YO1opp3CcigJRR5nJ8gCN+KnovuV0QYvsnIkQw== X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1793898719; h=X-Original-To:Received:Received:DKIM-Signature:Subject:From:To:Cc: Date:Message-ID:In-Reply-To:References:X-sashiko-severity: Content-Type:Content-Transfer-Encoding:X-Mailing-List:List-Id: List-Post:List-Help:List-Subscribe:List-Unsubscribe:List-Owner: Precedence:MIME-Version; bh=13d2ij5dViFrjhoQvQxDCRQxF9jfntf8UhmPYjNCyEQ=; b=CfnqTHV+odOVbCMi82nKYXZEdv/ZqJqdjJWfHklENLo6hUqFmgv5YxfapEVFssVYRdLn ZlXbJjPdLZQrIxIw3iUjn9RRZLcxBFBX+ibay0tlGWPRfw7clhiYLD1gt+gY8lJ+hAmid E+HB4MzXHN8xTcNfNWRuWGrj3MtAcGrMycAXol/pSsjmxlkvgP2F3trokmkMRT4JN1vUH 5r/gBvIPScPoVyYEgriuhzXhPVUmxR6m3rG9WCSj7xX/jhKCEaLSjHrEs2DKRCLmKabc6 5qIzr0y6hKdeW5BCDAh6Kwjzzhas7+gx/dJgHuhoV5iBD44tKSCbmhQpOw8QSnnwd1w== X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=dyEP7z3k; arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1 X-Received: from localhost.localdomain (localhost [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 014C4606A32D; Thu, 5 Nov 2026 17:11:59 +0000 (UTC) X-Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key, unprotected) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=dyEP7z3k X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1793898718; b=OOgyN6J2Q55SOE1LihrzNtN6ab4grpP0vraCa8v2DO7vxGLGZ0+e3UhfLQhycUEyU5+B Ak4PWp1SCGuBZXdprMrVxhU2ExMdmlddiZVdMB8UqhqwLte+MpHBUokhqt8fV3Sy+MqQM BReopd1BYeGyte/sveMtNZip1XObzwuYuAmvI+niP4cKfxatj25E1PR13R0ySkg3LI4DD r5SmR39kwOMglG+kXHqJCFgRFr69r6FMtvnKvlOLXO9QHEUPKmjxBorT5KZ11vsCDt7sO MtZwxf/YLGTwiBIDWBGv0uVi9rD1GIT6kFGaNC7ZFGi/cEJXyhD9xIT+TtRFZgUpFQQ== X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1793898718; h=Received:DKIM-Signature:Subject:From:To:Cc:Date:Message-ID: In-Reply-To:References:X-sashiko-severity:Content-Type: Content-Transfer-Encoding:MIME-Version; bh=13d2ij5dViFrjhoQvQxDCRQxF9jfntf8UhmPYjNCyEQ=; b=C5/K/pqyejMQ49BWUyaVOcv/s4tfoXdfigdSPrWRJ7P8AD/gwXWSKzt6WBoDEkW9b+zi 9SyE8BB85BlrhAc+WJfE0L/QK7KqOT1f0+jvtbgE4WJjOqfeSxOZjoNeiNNxkMl4SpEoQ Dfgj99S0SWdS7e1ysAcFCpZh3w1bVgDJtcwsnccpm2Ca9oMImtY2cQwU2o0dTj3IpMoMq g1ddRRfzt32ZrzKZ5gJXV40LI8a7qx+qlA+x0mwpDi62sOpShHs2pu4EVC8+fiuddowNE 87pYikQjf83URLPTKvovLjo8vuZv4MAz1FXkefKENyW3xUC99Kplu9ae3TzbpJCS0Rw== X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=dyEP7z3k; arc=none smtp.remote-ip=100.103.45.18 X-Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id CF279606A31B for <netdev@vger.kernel.org>; Thu, 5 Nov 2026 17:11:57 +0000 (UTC) X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id F23C31F00919; Thu, 5 Nov 2026 17:11:56 +0000 (UTC) X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1793898717; bh=13d2ij5dViFrjhoQvQxDCRQxF9jfntf8UhmPYjNCyEQ=; h=Subject:From:To:Cc:Date:In-Reply-To:References; b=dyEP7z3kpfZ7VfFti4+PhQ2B4wvDjV1BEc7pf8W+MhVLCGo7Ev9LCqOWkUrFUtcB6 x/UbGzplKz6+guqhENf/WWHjduqbIFixV+Xro3rgFJMwDDAoqXw3Ig7T/reSo8ziiV KWi5Qo9j/XOqRLnqVBEhnv8UHhduEc17ZooutLAnWibH9ntBx1aLCTDB+adu1BGA4x 5sfDFuojDFn+sXwxLsz/EQ8clA9pMut1exgHgEehCLn0F9KGdAYDnvQoF52DeihLiS EZbWAkvNvUDKU/7x+2/7jHsd9qNiJZE3d64j7qrfXVD9bHObqPjcD3ExN0vFKj/6sF uO5wC/uo40Awg== X-Cc: netdev@vger.kernel.org, andrew+netdev@lunn.ch, davem@davemloft.net, edumazet@google.com, horms@kernel.org, kernel-team@meta.com, kuba@kernel.org, pabeni@redhat.com, tactii@gmail.com X-In-Reply-To: <179372577673.49909.11253315483074546903.stgit@ahduyck-xeon-server.home.arpa> X-sashiko-severity: Medium X-Mailing-List: netdev@vger.kernel.org X-List-Post: <mailto:netdev@vger.kernel.org> X-List-Help: <mailto:netdev+help@vger.kernel.org> X-List-Subscribe: <mailto:netdev+subscribe@vger.kernel.org> X-List-Unsubscribe: <mailto:netdev+unsubscribe@vger.kernel.org> X-List-Owner: <mailto:netdev+owner@vger.kernel.org> X-Precedence: list