From: netdev-bot+sashiko@kernel.org
To: julius@bairaktaris.de
Cc: netdev@vger.kernel.org, davem@davemloft.net, edumazet@kernel.org,
kuba@kernel.org, pabeni@redhat.com, horms@kernel.org,
dsahern@kernel.org, idosch@nvidia.com, willemb@google.com,
ncardwell@google.com, kuniyu@google.com,
steffen.klassert@secunet.com, nbd@nbd.name,
jiayuan.chen@linux.dev, mfleming@cloudflare.com,
almasrymina@google.com, bigeasy@linutronix.de,
richardbgobert@gmail.com, ecree.xilinx@gmail.com,
bsdhenrymartin@gmail.com
Subject: Re: [PATCH net v6 2/5] net: gso: segment fraglist packets with a software tunnel checksum
Date: Wed, 25 Nov 2026 15:15:12 +0000 [thread overview]
Message-ID: <179561971293.3135.1414270038839047097@kernel.org> (raw)
In-Reply-To: <c512956bc8cc74688721e3d5a52016ee85966484.1795295554.git.julius@bairaktaris.de>
Thank you for your contribution! Sashiko AI review found 2 potential
issue(s) to consider.
Critical: 0 · High: 0 · Medium: 1 · Low: 1
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] skb_gso_tnl_csum_sw() (include/net/gso.h:87-97) is meant to
predict whether the tunnel segmenter will compute the outer checksum…
- [Low] For UDP, the fix sends affected fraglist aggregates into
__udp_gso_segment()'s DODGY / changed-geometry fallback, and that…
--
net: gso: segment fraglist packets with a software tunnel checksum
This commit stops skb_segment_list() from segmenting fraglist GSO packets
when a GRE or UDP tunnel segmenter will compute the outer checksum with
gso_make_checksum(). skb_segment_list() sets no SKB_GSO_CB() checksum state,
and gso_make_checksum() reads that state. The patch adds
skb_gso_tnl_csum_sw(), which sets skb->encap_hdr_csum only in those cases,
and skb_gso_list_csum_ok(), which sends such packets to skb_segment() in the
TCP and UDP GSO handlers.
> diff --git a/include/net/gso.h b/include/net/gso.h
> index 119fc4c170e16..1cf2bf3a2b4aa 100644
> --- a/include/net/gso.h
> +++ b/include/net/gso.h
> @@ -84,6 +84,30 @@ static inline __sum16 gso_make_checksum(struct sk_buff *skb, __wsum res)
> return csum_fold(csum_partial(csum_start, plen, partial));
> }
>
> +/* Whether a GRE or UDP tunnel segmenter computes the outer checksum of a
> + * segment with gso_make_checksum(): when it does not offload it, and for each
> + * segment that is CHECKSUM_PARTIAL, as it then sets skb->encapsulation. Every
> + * segment of skb_segment_list() has the ip_summed of the head.
> + */
> +static inline bool skb_gso_tnl_csum_sw(const struct sk_buff *skb,
> + bool need_csum, bool offload_csum)
> +{
> + return need_csum &&
> + (!offload_csum || skb->ip_summed == CHECKSUM_PARTIAL);
> +}
[Severity: Medium]
Does this predicate match what __skb_udp_tunnel_segment() does when
SKB_GSO_TUNNEL_REMCSUM is set?
With remcsum, the segment loop clears CHECKSUM_PARTIAL before it checks
encapsulation:
net/ipv4/udp_offload.c:__skb_udp_tunnel_segment() {
...
if (remcsum)
skb->ip_summed = CHECKSUM_NONE;
/* Set up inner headers if we are offloading inner checksum */
if (skb->ip_summed == CHECKSUM_PARTIAL) {
skb_reset_inner_headers(skb);
skb->encapsulation = 1;
}
...
if (skb->encapsulation || !offload_csum) {
uh->check = gso_make_checksum(skb, ~uh->check);
...
}
So with remcsum and offload_csum true, skb->encapsulation is never set and
gso_make_checksum() is never called. The helper is called without remcsum
and still returns true for a CHECKSUM_PARTIAL head. Its comment also says
"for each segment that is CHECKSUM_PARTIAL, as it then sets
skb->encapsulation", which does not hold here.
vxlan_build_skb() sets SKB_GSO_TUNNEL_REMCSUM only when the skb is
CHECKSUM_PARTIAL, so a CHECKSUM_PARTIAL head is the usual case for remcsum.
Take this setup:
- VXLAN with REMCSUM_TX and UDP checksums on
- an egress device that offloads the outer checksum
- CHECKSUM_PARTIAL fraglist GRO aggregates
Here encap_hdr_csum now gets set and skb_gso_list_csum_ok() returns false.
Before this patch, skb_segment_list() segmented these packets correctly. Now
tcp4_gso_segment() and tcp6_gso_segment() fall back to skb_segment(), and
__udp_gso_segment() linearizes the whole aggregate.
Is this a performance regression for a configuration that already worked?
Could remcsum be passed to skb_gso_tnl_csum_sw(), so that remcsum with
offload_csum counts as offloaded, and the comment updated to match?
[ ... ]
> diff --git a/net/ipv4/udp_offload.c b/net/ipv4/udp_offload.c
> index 7dc85eb333aa3..fb2f63774cf6c 100644
> --- a/net/ipv4/udp_offload.c
> +++ b/net/ipv4/udp_offload.c
[ ... ]
> @@ -521,6 +521,7 @@ struct sk_buff *__udp_gso_segment(struct sk_buff *gso_skb,
> */
> if ((skb_pagelen(gso_skb) - sizeof(*uh) == skb_shinfo(gso_skb)->gso_size) &&
> !(skb_shinfo(gso_skb)->gso_type & SKB_GSO_DODGY) &&
> + skb_gso_list_csum_ok(gso_skb) &&
> ip_hdr(skb_shinfo(gso_skb)->frag_list)->version == (is_ipv6 ? 6 : 4))
> return __udp_gso_segment_list(gso_skb, features, is_ipv6);
>
[Severity: Low]
For UDP, this sends the affected aggregates into the DODGY / changed
geometry fallback just below, which linearizes the whole aggregate:
ret = __skb_linearize(gso_skb);
if (ret)
return ERR_PTR(ret);
__skb_linearize() goes through __pskb_pull_tail() -> pskb_expand_head()
with GFP_ATOMIC. A GRO aggregate can have up to 64 frag_list members. That
means one high-order atomic allocation of around 64KB per aggregate on the
xmit path. If the allocation fails, the aggregate is dropped with -ENOMEM.
With skb_gso_tnl_csum_sw(), this fallback becomes the normal path for UDP
fraglist traffic in a checksummed VXLAN, GENEVE or GRE tunnel in two cases:
- the egress device does not offload the outer checksum
- the aggregate is CHECKSUM_PARTIAL, even when the device does offload it
These packets used to leave with wrong outer checksums, so nothing that
worked before gets slower here. The commit message only says the patch
will "segment a fraglist packet with skb_segment() when it is set". It does
not mention the linearization in the UDP case.
Could the commit message mention the UDP linearization and its cost?
Alternatively, would it be cheaper to keep the skb_segment_list() fast path
and set up SKB_GSO_CB() checksum state on each segment it builds? That would
mean gso_reset_checksum() for CHECKSUM_PARTIAL segments and a payload
skb_checksum() for the rest.
TCP does not seem to be affected, since tcp_gso_segment() -> skb_segment()
walks frag_list without linearizing.
--
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/cover.1795295554.git.julius%40bairaktaris.de
next prev parent reply other threads:[~2026-11-25 15:15 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-21 21:14 [PATCH net v6 0/5] ipmr: forward GSO multicast packets Julius Bairaktaris
2026-11-21 21:14 ` [PATCH net v6 1/5] net: gro: set the inner transport header of encapsulated fraglist packets Julius Bairaktaris
2026-11-21 21:14 ` [PATCH net v6 2/5] net: gso: segment fraglist packets with a software tunnel checksum Julius Bairaktaris
2026-11-25 15:15 ` netdev-bot+sashiko [this message]
2026-11-21 21:14 ` [PATCH net v6 3/5] net: gso: count the inner UDP header of encapsulated UDP GSO packets Julius Bairaktaris
2026-11-21 21:14 ` [PATCH net v6 4/5] ipmr: set up GSO state for tunnel vifs Julius Bairaktaris
2026-11-25 15:15 ` netdev-bot+sashiko
2026-11-21 21:14 ` [PATCH net v6 5/5] ipmr: do not drop GSO packets that fit the MTU after segmentation Julius Bairaktaris
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=179561971293.3135.1414270038839047097@kernel.org \
--to=netdev-bot+sashiko@kernel.org \
--cc=almasrymina@google.com \
--cc=bigeasy@linutronix.de \
--cc=bsdhenrymartin@gmail.com \
--cc=davem@davemloft.net \
--cc=dsahern@kernel.org \
--cc=ecree.xilinx@gmail.com \
--cc=edumazet@kernel.org \
--cc=horms@kernel.org \
--cc=idosch@nvidia.com \
--cc=jiayuan.chen@linux.dev \
--cc=julius@bairaktaris.de \
--cc=kuba@kernel.org \
--cc=kuniyu@google.com \
--cc=mfleming@cloudflare.com \
--cc=nbd@nbd.name \
--cc=ncardwell@google.com \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=richardbgobert@gmail.com \
--cc=steffen.klassert@secunet.com \
--cc=willemb@google.com \
/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