Article View: linux.kernel.netdev
Article #18183Re: [PATCH net v2] gve: fix checksum state and gso_segs of HW-GRO packets
From: netdev-bot+sashiko
Date: Tue, 17 Nov 2026 23:32
Date: Tue, 17 Nov 2026 23:32
131 lines
12882 bytes
12882 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] gve_rx_complete_rsc()
(drivers/net/ethernet/google/gve/gve_rx_dqo.c) works out where the TCP…
--
gve: fix checksum state and gso_segs of HW-GRO packets
This patch makes gve_rx_complete_rsc() set the network and transport
headers on HW-GRO packets. For device-verified packets it also seeds
th->check with the TCP pseudo-header checksum and calls tcp_gro_complete(),
so forwarded HW-GRO skbs can be resegmented correctly. IPv4 and IPv6 are
now told apart by EtherType, and gso_segs is computed from the TCP payload
length.
> diff --git a/drivers/net/ethernet/google/gve/gve_rx_dqo.c b/drivers/net/ethernet/google/gve/gve_rx_dqo.c
> index 82ed5e48b00ab..b4dbfb1ba39b0 100644
> --- a/drivers/net/ethernet/google/gve/gve_rx_dqo.c
> +++ b/drivers/net/ethernet/google/gve/gve_rx_dqo.c
[ ... ]
> @@ -1049,10 +1061,50 @@ static int gve_rx_complete_rsc(struct sk_buff *skb,
> skb_frag_off_add(frag, hdr_len);
> skb->data_len -= hdr_len;
> skb->tail += hdr_len;
> + /* napi_gro_frags() pulls the Ethernet header later. */
> + nhoff = ETH_HLEN;
> + }
> +
> + /* The header lengths come from the packet, so make sure the headers are
> + * in the linear part before reading them and writing th->check.
> + */
> + if (unlikely(skb_headlen(skb) < nhoff + sizeof(struct iphdr)))
> + return -EINVAL;
> +
> + skb_set_network_header(skb, nhoff);
> + proto = nhoff ? ((struct ethhdr *)skb->data)->h_proto : skb->protocol;
> + switch (proto) {
> + case htons(ETH_P_IP):
> + gso_type = SKB_GSO_TCPV4;
> + thoff = nhoff + ip_hdrlen(skb);
> + break;
> + case htons(ETH_P_IPV6):
> + gso_type = SKB_GSO_TCPV6;
> + thoff = nhoff + sizeof(struct ipv6hdr);
[Severity: Medium]
Is it safe to assume the TCP header comes right after the fixed IPv6
header here?
Nothing checks ipv6_hdr(skb)->nexthdr == IPPROTO_TCP or desc->ipv6_ex_add.
The IPv4 case above also uses ip_hdrlen() without checking
ip_hdr(skb)->protocol == IPPROTO_TCP. The only sign that L4 is TCP is the
ptype.l4_type check at the top of gve_rx_complete_rsc().
The descriptor suggests the device does parse IPv6 extension headers:
gve_desc_dqo.h:
/* Set when IPv6 packet contains a destination options header or routing
* header.
*/
u8 ipv6_ex_add: 1;
gve_rx_skb_csum() only holds back CHECKSUM_UNNECESSARY when that bit is
set:
} else if (ptype.l3_type == GVE_L3_TYPE_IPV6) {
/* Checksum should be skipped if this flag is set. */
if (unlikely(desc->ipv6_ex_add))
return;
}
So an IPv6/TCP packet with a hop-by-hop header and a device-verified
checksum would still be CHECKSUM_UNNECESSARY when it gets here.
Suppose the device coalesces such a packet, or a tunnelled packet whose
ptype reports the inner L4 as TCP. Then thoff would point into the
extension or tunnel header, and tcp_hdrlen() would read doff from the
wrong bytes.
gve_rx_fixup_gro_checksum() would then write the pseudo-header seed at
that offset:
th->check = ~tcp_v6_check(len, &ipv6_hdr(skb)->saddr,
&ipv6_hdr(skb)->daddr, 0);
tcp_gro_complete() would also set csum_start, csum_offset and
CHECKSUM_PARTIAL at that offset.
Wouldn't a forwarded packet then leave through TSO/GSO with a bad
checksum? That is the same blackholing this patch sets out to fix.
The destination-options and routing cases are CHECKSUM_NONE, but they
still hit the wrong doff. That could drop a valid packet with -EINVAL or
give it a wrong gso_segs. It could also take the new early return:
payload = skb->len - thoff - tcp_hdrlen(skb);
if (payload <= rsc_seg_len)
return 0;
and deliver a multi-segment coalesced packet without gso_size.
Before this patch the RSC path never read or wrote the TCP header, so
this assumption is new. The changelog gives the VLAN guarantee ("The
device does not coalesce VLAN tagged frames"), but says nothing about
IPv6 extension headers or encapsulation.
For comparison, bnx2x_set_gro_params() documents the matching hardware
guarantee ("TPA aggregation won't have either IP options or TCP options
other than timestamp or IPv6 extension headers"). The mlx5 SHAMPO path
checks ipv6->nexthdr == IPPROTO_TCP.
Could the device guarantee be documented in the changelog and in a
comment? Alternatively, could this check ip_hdr(skb)->protocol and
ipv6_hdr(skb)->nexthdr against IPPROTO_TCP (and ihl >= 5), and skip the
GSO and checksum fixup otherwise?
--
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261116224308.986555-1-joshwash%40google.com
Technical Details
Message-ID:
<179495835918.3136.2006086240050992361@kernel.org>Path:
mbox-mo1.pugleaf.net!news-lax.pugleaf.net!srl.newsdeef.eu!newsfeed.bofh.team!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-365711-linux-kernel-netdev=dewy.ruReferences:
<20261116224308.986555-1-joshwash@google.com>Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!news-lax.pugleaf.net!srl.newsdeef.eu!newsfeed.bofh.team!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-365711-linux-kernel-netdev=dewy.ru From: netdev-bot+sashiko@kernel.org Newsgroups: linux.kernel.netdev Subject: Re: [PATCH net v2] gve: fix checksum state and gso_segs of HW-GRO packets Date: Tue, 17 Nov 2026 23:32:39 +0000 Organization: Usenet Network Message-ID: <179495835918.3136.2006086240050992361@kernel.org> References: <20261116224308.986555-1-joshwash@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit Injection-Info: usenet.network; logging-data="2454588"; mail-complaints-to="abuse@usenet.network" Cancel-Lock: sha1:wWvmW6WAWwt0IKdsHYNWexM+vYI= sha256:KA0ctVm+cYctrJzfaUlPQaAF52QBWbsNg8mofA+cAng= sha1:wrcq3tWcdgt0Kgcibp5p02WelsU= sha256:JURn0wOLYiiBkvL8dZ5Zqo30Empd5RFQNSFcfhw8wJk= 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 8C9EF1150FA; Wed, 18 Nov 2026 02:33:08 +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 p9CVQ9gA8rjZ; Wed, 18 Nov 2026 02:33:04 +0300 (MSK) X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.105.105.114; helo=tor.lore.kernel.org; envelope-from=netdev+bounces-365711-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 6986B1150F8; Wed, 18 Nov 2026 02:32:56 +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 CE8DD27D3A; Tue, 17 Nov 2026 23:32:41 +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=1794958361; b=RqiRt8fzLsJtS/FWbER8wm4z8JSRV44sHgpa52XPqWBC1LZUaFBtEfo2idBpZLbKNgmS GETUIW8cRzeRq/BwhTu2VBVK4curq5ZhH10dtEEdLjIETkygeP0RKjJZggD2xPGUXkmNz j1bSedXYAgF8gBG8rkypadAIRjdycbWbu4d1xRSCT1ZiAFrfygSuBpcsrEwGOof2MSXEn cNd48mQ0efsIRoyvy0V3iAlM5GceCD9xzNVZ/yC1TjI4i6sZ+I4qROXdhdfhP2BDrS0Wf 6ZfX5ZBtWBRENQJWhNfqKo2JRBwA822C3yy71h95Q0UXFOMoNfgiExuQuP5HxCErQbg== X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1794958361; 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=WiVbIaTi7dNlw1LohPd/8u8xB8/i9d/jmzm4Z28McPg=; b=nrFpvth8lquGIZo+usqPUVwzdnYUR6kYA16jW2b8ih7fmillKxeP5MmZcq0kkZhH0P0e aFo12qT5p8IUoDXtpv/n2v9aAb6+mvZHHrV0pcJqP6ArZ8BbBZOjtlIhBEoeoAP4YuugE X8ligDo8WHF7IeaCJOf3jHB2Fj5DNiWmD0cQXCuPLWxCUAskdsvj+5Y1+bhyPc1J+O8oM mAK+8D4kOwljvb/t8NsyQEzLhjVDVxWjqji3b4BFX19g8a8iKt6nbLvgxz65BoXmFNV6D 960hD5Txygl7rH3VyH5WT3v0dT0Iab0yyx6uJZuZdGZYlT6sOzUVAJdXTG5nOAqZ8dA== 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=X7imiGXE; 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 9485E606A33A; Tue, 17 Nov 2026 23:32:41 +0000 (UTC) X-Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=X7imiGXE 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=1794958360; b=uT39qBCXzpsvat9z/mjGANZHR6o+i59R9PbKsvMJXHRXvj8mqrUR70z6/M7IqRe+o4RI dhRVbVKn6SzClYlAXQl4pyOsfQN/VKrWZLuiSmoFTJ6hQyMHJjKVqJSl5FuGR/i/FDgOH J2RF+F1GGEeg3yb+GmbmqeHcgtcg8QQxcr7jILIYY/NbiMZWjef7jevrGqPhJFP3nSUCn K+PC9ZDvNextCa8yNCW71cwofMR64bbW3d69miCpnNXUy8Bcf6ZqVyaKxWwbRdEkPMrNk cQdZE9+GHNDUXrNamtl0XHfAh/gvJj6Ef1lnGyuWP57Kk0jwu4PHgEXZIQEaOBTZMTg== X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1794958360; 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=WiVbIaTi7dNlw1LohPd/8u8xB8/i9d/jmzm4Z28McPg=; b=Um91oQnqTSRGnj/wkj9z+G9/QuwSmQ+9f9VDMXPUIHH3G+lK17ledkfiaVzP/z8s972U ZKtW3HZXRkRF+lUvUM9cTdyXBv1DOmPncUJdUw2JZTZHzkL18d3vzliAMqr9XXUKXPWRS QNVHEAwyUinE7n4JzmD3p8Qm5emseslHy0E+1EuoodUihWLxMuwUMF8wAlLwX+o9ixx17 iV0cbw8sSoSug6L4UgeZQKWv2dgTx9YQJqm71k+wW7/Rusjl+SDZ3Kh4FnEl/2p9yjPRX 7lNlf03UqoW6pq1FNpLH96xvZaPjuv64pC4LiXPZZ/Y75sRlnlipno2hkQm3trRIWLQ== 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=X7imiGXE; 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 B4D9C606A32A; Tue, 17 Nov 2026 23:32:40 +0000 (UTC) X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9D2971F000C4; Tue, 17 Nov 2026 23:32:39 +0000 (UTC) X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1794958360; bh=WiVbIaTi7dNlw1LohPd/8u8xB8/i9d/jmzm4Z28McPg=; h=Subject:From:To:Cc:Date:In-Reply-To:References; b=X7imiGXE04bl+5J2D1ZvA2f8N3woFr8c2H2fMrDINAdSEPFAlk49xrc+PA8eKxsZ1 pkK/8K4UKFWZDBQgqwlycK7M4Zf9n6AZEQrC83ja7qu0TSlHdysxDtYu0RLQIu1dB6 lClCZey5y50Y4KcMKU2uHo7dKvFMXxQg8fomqAXPeGR9aoDH7EaC1Q504/PjhukKSW zlHw9QGvshfMeuz8+iGq0zE8i9wxHYt9cSqaad1omXEjfBDEHJBBbZxmPdRw2IWw3v yiHZKr2m1FKbL7UhytmZ4YM8RhIXDlFZaQvxxmwr9urj3ESKRY4bFE8UazXVN8MVY3 7TbIsNFuP4fMg== X-Cc: netdev@vger.kernel.org, hramamurthy@google.com, andrew+netdev@lunn.ch, davem@davemloft.net, edumazet@kernel.org, kuba@kernel.org, pabeni@redhat.com, jordanrhee@google.com, nktgrg@google.com, thostet@google.com, willemb@google.com, linux-kernel@vger.kernel.org, stable@vger.kernel.org, pkaligineedi@google.com X-In-Reply-To: <20261116224308.986555-1-joshwash@google.com> 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