From: Paolo Abeni <pabeni@redhat.com>
To: Alice Mikityanska <alice.kernel@fastmail.im>,
Daniel Borkmann <daniel@iogearbox.net>,
"David S. Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@google.com>,
Jakub Kicinski <kuba@kernel.org>, Xin Long <lucien.xin@gmail.com>,
Willem de Bruijn <willemdebruijn.kernel@gmail.com>,
Willem de Bruijn <willemb@google.com>,
David Ahern <dsahern@kernel.org>,
Nikolay Aleksandrov <razor@blackwall.org>
Cc: Shuah Khan <shuah@kernel.org>,
Stanislav Fomichev <stfomichev@gmail.com>,
Andrew Lunn <andrew+netdev@lunn.ch>,
Simon Horman <horms@kernel.org>, Florian Westphal <fw@strlen.de>,
netdev@vger.kernel.org, Alice Mikityanska <alice@isovalent.com>
Subject: Re: [PATCH net-next v7 04/11] net: Enable BIG TCP with partial GSO
Date: Sun, 14 Jun 2026 13:19:47 +0200 [thread overview]
Message-ID: <554ff2bd-e4d7-4e64-8ec4-86dc7da85992@redhat.com> (raw)
In-Reply-To: <20260611192955.604661-5-alice.kernel@fastmail.im>
On 6/11/26 9:29 PM, Alice Mikityanska wrote:
> From: Alice Mikityanska <alice@isovalent.com>
>
> skb_segment is called for partial GSO, when netif_needs_gso returns true
> in validate_xmit_skb. Partial GSO is needed, for example, when
> segmentation of tunneled traffic is offloaded to a NIC that only
> supports inner checksum offload.
>
> Currently, skb_segment clamps the segment length to 65534 bytes, because
> gso_size == 65535 is a special value GSO_BY_FRAGS, and we don't want
> to accidentally assign mss = 65535, as it would fall into the
> GSO_BY_FRAGS check further in the function.
>
> This implementation, however, artificially blocks len > 65534, which is
> possible since the introduction of BIG TCP. To allow bigger lengths and
> avoid resegmentation of BIG TCP packets, store the gso_by_frags flag in
> the beginning and don't use a special value of mss for this purpose
> after mss was modified.
>
> Signed-off-by: Alice Mikityanska <alice@isovalent.com>
> Reviewed-by: Willem de Bruijn <willemb@google.com>
> ---
> drivers/net/netdevsim/psp.c | 2 +-
> net/core/skbuff.c | 10 +++++-----
> 2 files changed, 6 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/net/netdevsim/psp.c b/drivers/net/netdevsim/psp.c
> index d3e36c74be62..6b3532b5e360 100644
> --- a/drivers/net/netdevsim/psp.c
> +++ b/drivers/net/netdevsim/psp.c
> @@ -92,7 +92,7 @@ nsim_do_psp(struct sk_buff *skb, struct netdevsim *ns,
> * provide a valid checksum here, so the skb isn't dropped.
> */
> uh = udp_hdr(skb);
> - udplen = ntohs(uh->len) ?: skb->len - skb_transport_offset(skb);
> + udplen = udp_get_len(skb, uh, skb_transport_offset(skb));
> csum = skb_checksum(skb, skb_transport_offset(skb),
> udplen, 0);
>
> diff --git a/net/core/skbuff.c b/net/core/skbuff.c
> index c64693fcb2d1..5dcee79df8cf 100644
> --- a/net/core/skbuff.c
> +++ b/net/core/skbuff.c
> @@ -4773,6 +4773,7 @@ struct sk_buff *skb_segment(struct sk_buff *head_skb,
> struct sk_buff *tail = NULL;
> struct sk_buff *list_skb = skb_shinfo(head_skb)->frag_list;
> unsigned int mss = skb_shinfo(head_skb)->gso_size;
> + bool gso_by_frags = mss == GSO_BY_FRAGS;
> unsigned int doffset = head_skb->data - skb_mac_header(head_skb);
> unsigned int offset = doffset;
> unsigned int tnl_hlen = skb_tnl_header_len(head_skb);
> @@ -4788,7 +4789,7 @@ struct sk_buff *skb_segment(struct sk_buff *head_skb,
> int nfrags, pos;
>
> if ((skb_shinfo(head_skb)->gso_type & SKB_GSO_DODGY) &&
> - mss != GSO_BY_FRAGS && mss != skb_headlen(head_skb)) {
> + !gso_by_frags && mss != skb_headlen(head_skb)) {
> struct sk_buff *check_skb;
>
> for (check_skb = list_skb; check_skb; check_skb = check_skb->next) {
> @@ -4816,7 +4817,7 @@ struct sk_buff *skb_segment(struct sk_buff *head_skb,
> sg = !!(features & NETIF_F_SG);
> csum = !!can_checksum_protocol(features, proto);
>
> - if (sg && csum && (mss != GSO_BY_FRAGS)) {
> + if (sg && csum && !gso_by_frags) {
> if (!(features & NETIF_F_GSO_PARTIAL)) {
> struct sk_buff *iter;
> unsigned int frag_len;
> @@ -4850,9 +4851,8 @@ struct sk_buff *skb_segment(struct sk_buff *head_skb,
> /* GSO partial only requires that we trim off any excess that
> * doesn't fit into an MSS sized block, so take care of that
> * now.
> - * Cap len to not accidentally hit GSO_BY_FRAGS.
> */
> - partial_segs = min(len, GSO_BY_FRAGS - 1) / mss;
> + partial_segs = len / mss;
Sashiko/gemini says the above can lead to hit BUG_ON() later.
I *think* it's not a false positive, as it looks like skb_segment()
assumes an skb can hold `mss` bytes without resorting to frag_list
usage, and mss > MAX_SKB_FRAGS * PAGE_SIZE breaks such assumption.
I think handling correctly this case will requires some non trivial
surgery to skb_segment: both `while (pos < offset + len) {` loops must
be updated to feed data from `frags` as needed instead of
BUG_ON()/net_warn_ratelimited(skb_shinfo(nskb)->nr_frags >= MAX_SKB_FRAGS);
/P
next prev parent reply other threads:[~2026-06-14 11:19 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-06-11 19:29 [PATCH net-next v7 00/11] BIG TCP for UDP tunnels Alice Mikityanska
2026-06-11 19:29 ` [PATCH net-next v7 01/11] net/sched: act_csum: don't mangle UDP tunnel GSO packets Alice Mikityanska
2026-06-11 19:29 ` [PATCH net-next v7 02/11] geneve: Fix off-by-one comparing with GRO_LEGACY_MAX_SIZE Alice Mikityanska
2026-06-14 13:25 ` Paolo Abeni
2026-06-11 19:29 ` [PATCH net-next v7 03/11] net: Use helpers to get/set UDP len tree-wide Alice Mikityanska
2026-06-12 17:04 ` Jason A. Donenfeld
2026-06-11 19:29 ` [PATCH net-next v7 04/11] net: Enable BIG TCP with partial GSO Alice Mikityanska
2026-06-14 11:19 ` Paolo Abeni [this message]
2026-06-11 19:29 ` [PATCH net-next v7 05/11] udp: Support BIG TCP GSO packets where they can occur Alice Mikityanska
2026-06-11 19:29 ` [PATCH net-next v7 06/11] udp: Support gro_ipv4_max_size > 65536 Alice Mikityanska
2026-06-14 11:30 ` Paolo Abeni
2026-06-11 19:29 ` [PATCH net-next v7 07/11] udp: Validate UDP length in udp_gro_receive Alice Mikityanska
2026-06-11 19:29 ` [PATCH net-next v7 08/11] udp: Set length in UDP header to 0 for big GSO packets Alice Mikityanska
2026-06-14 13:19 ` Paolo Abeni
2026-06-11 19:29 ` [PATCH net-next v7 09/11] vxlan: Enable BIG TCP packets Alice Mikityanska
2026-06-11 19:29 ` [PATCH net-next v7 10/11] geneve: " Alice Mikityanska
2026-06-11 19:29 ` [PATCH net-next v7 11/11] selftests: net: Add a test for BIG TCP in UDP tunnels Alice Mikityanska
2026-06-14 13:23 ` Paolo Abeni
2026-06-14 13:50 ` [PATCH net-next v7 00/11] BIG TCP for " patchwork-bot+netdevbpf
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=554ff2bd-e4d7-4e64-8ec4-86dc7da85992@redhat.com \
--to=pabeni@redhat.com \
--cc=alice.kernel@fastmail.im \
--cc=alice@isovalent.com \
--cc=andrew+netdev@lunn.ch \
--cc=daniel@iogearbox.net \
--cc=davem@davemloft.net \
--cc=dsahern@kernel.org \
--cc=edumazet@google.com \
--cc=fw@strlen.de \
--cc=horms@kernel.org \
--cc=kuba@kernel.org \
--cc=lucien.xin@gmail.com \
--cc=netdev@vger.kernel.org \
--cc=razor@blackwall.org \
--cc=shuah@kernel.org \
--cc=stfomichev@gmail.com \
--cc=willemb@google.com \
--cc=willemdebruijn.kernel@gmail.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.