Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

net: fix segmentation of forwarding fraglist GRO

This patch enhances GSO segment handling by properly checking
the SKB_GSO_DODGY flag for frag_list GSO packets, addressing
low throughput issues observed when a station accesses IPv4
servers via hotspots with an IPv6-only upstream interface.

Specifically, it fixes a bug in GSO segmentation when forwarding
GRO packets containing a frag_list. The function skb_segment_list
cannot correctly process GRO skbs that have been converted by XLAT,
since XLAT only translates the header of the head skb. Consequently,
skbs in the frag_list may remain untranslated, resulting in protocol
inconsistencies and reduced throughput.

To address this, the patch explicitly sets the SKB_GSO_DODGY flag
for GSO packets in XLAT's IPv4/IPv6 protocol translation helpers
(bpf_skb_proto_4_to_6 and bpf_skb_proto_6_to_4). This marks GSO
packets as potentially modified after protocol translation. As a
result, GSO segmentation will avoid using skb_segment_list and
instead falls back to skb_segment for packets with the SKB_GSO_DODGY
flag. This ensures that only safe and fully translated frag_list
packets are processed by skb_segment_list, resolving protocol
inconsistencies and improving throughput when forwarding GRO packets
converted by XLAT.

Signed-off-by: Jibin Zhang <jibin.zhang@mediatek.com>
Fixes: 9fd1ff5d2ac7 ("udp: Support UDP fraglist GRO/GSO.")
Cc: stable@vger.kernel.org
Link: https://patch.msgid.link/20260126152114.1211-1-jibin.zhang@mediatek.com
Signed-off-by: Paolo Abeni <pabeni@redhat.com>

authored by

Jibin Zhang and committed by
Paolo Abeni
426ca15c 08582067

+8 -3
+2
net/core/filter.c
··· 3353 3353 shinfo->gso_type &= ~SKB_GSO_TCPV4; 3354 3354 shinfo->gso_type |= SKB_GSO_TCPV6; 3355 3355 } 3356 + shinfo->gso_type |= SKB_GSO_DODGY; 3356 3357 } 3357 3358 3358 3359 bpf_skb_change_protocol(skb, ETH_P_IPV6); ··· 3384 3383 shinfo->gso_type &= ~SKB_GSO_TCPV6; 3385 3384 shinfo->gso_type |= SKB_GSO_TCPV4; 3386 3385 } 3386 + shinfo->gso_type |= SKB_GSO_DODGY; 3387 3387 } 3388 3388 3389 3389 bpf_skb_change_protocol(skb, ETH_P_IP);
+2 -1
net/ipv4/tcp_offload.c
··· 107 107 if (skb_shinfo(skb)->gso_type & SKB_GSO_FRAGLIST) { 108 108 struct tcphdr *th = tcp_hdr(skb); 109 109 110 - if (skb_pagelen(skb) - th->doff * 4 == skb_shinfo(skb)->gso_size) 110 + if ((skb_pagelen(skb) - th->doff * 4 == skb_shinfo(skb)->gso_size) && 111 + !(skb_shinfo(skb)->gso_type & SKB_GSO_DODGY)) 111 112 return __tcp4_gso_segment_list(skb, features); 112 113 113 114 skb->ip_summed = CHECKSUM_NONE;
+2 -1
net/ipv4/udp_offload.c
··· 514 514 515 515 if (skb_shinfo(gso_skb)->gso_type & SKB_GSO_FRAGLIST) { 516 516 /* Detect modified geometry and pass those to skb_segment. */ 517 - if (skb_pagelen(gso_skb) - sizeof(*uh) == skb_shinfo(gso_skb)->gso_size) 517 + if ((skb_pagelen(gso_skb) - sizeof(*uh) == skb_shinfo(gso_skb)->gso_size) && 518 + !(skb_shinfo(gso_skb)->gso_type & SKB_GSO_DODGY)) 518 519 return __udp_gso_segment_list(gso_skb, features, is_ipv6); 519 520 520 521 ret = __skb_linearize(gso_skb);
+2 -1
net/ipv6/tcpv6_offload.c
··· 170 170 if (skb_shinfo(skb)->gso_type & SKB_GSO_FRAGLIST) { 171 171 struct tcphdr *th = tcp_hdr(skb); 172 172 173 - if (skb_pagelen(skb) - th->doff * 4 == skb_shinfo(skb)->gso_size) 173 + if ((skb_pagelen(skb) - th->doff * 4 == skb_shinfo(skb)->gso_size) && 174 + !(skb_shinfo(skb)->gso_type & SKB_GSO_DODGY)) 174 175 return __tcp6_gso_segment_list(skb, features); 175 176 176 177 skb->ip_summed = CHECKSUM_NONE;