The fraglist branches of tcp4_gro_complete() and tcp6_gro_complete() return before tcp_gro_complete(), and those of udp4_gro_complete() and udp6_gro_complete() before udp_gro_complete_segment(). Only the latter two set skb->inner_transport_header when skb->encapsulation is set: commit d51c5907e980 ("net, gro: Set inner transport header offset in tcp/udp GRO hook") added it to the regular branches only. The TCP fraglist branch completes the inner flow of every tunnel that GRO handles (UDP tunnel sockets, FOU/GUE, GRE, IPIP, SIT, ip6ip6, ip4ip6): tcp4_check_fraglist_gro() and tcp6_check_fraglist_gro() do not look at the encapsulation. The UDP one completes the inner flow of a UDP tunnel socket, whose udp_gro_complete() clears encap_mark, and of FOU/GUE, which clear it on receive; behind GRE, IPIP and SIT encap_mark stays set and the aggregate completes through udp_gro_complete_segment(). Such an aggregate keeps an inner transport header from earlier processing. skb_gso_transport_seglen() computes the segment length from it, so the MTU checks of ip_forward(), ip6_forward(), ip_finish_output_gso() and ip6_finish_output_gso() compare a wrong length with the MTU; qdisc_pkt_len_segs_init() drops the aggregate with SKB_DROP_REASON_SKB_BAD_GSO when the offset lies in front of skb->data; and __skb_udp_tunnel_segment() sets the inner transport header of the packet it segments from it. Set the inner transport header in the fraglist branches as well. The transport header points at the inner TCP or UDP header there, as in the regular branches. With rx-gro-list on a virtio-net port of a router with VXLAN sockets, 1000 VXLAN packets per case (outer IPv4, 1400 bytes; inner UDP or TCP over IPv4 or IPv6; outer UDP checksum zero or set) forwarded unicast over a 1400-byte route reached the receiver 35 to 195 times per case on net (2 runs of 12 cases), and 1000 times with this change (5 runs, one with KASAN). Fixes: 9fd1ff5d2ac7 ("udp: Support UDP fraglist GRO/GSO.") Fixes: 8d95dc474f85 ("net: add code for TCP fraglist GRO") Signed-off-by: Julius Bairaktaris --- Changes since ipmr v6 1/5: - Name the IPv6 users of the segment length in the commit message. - Rebase onto net. - v6: https://lore.kernel.org/netdev/7b97180d58a027672614af854d79e5639f17d180.1795295554.git.julius@bairaktaris.de/ net/ipv4/tcp_offload.c | 3 +++ net/ipv4/udp_offload.c | 3 +++ net/ipv6/tcpv6_offload.c | 3 +++ net/ipv6/udp_offload.c | 3 +++ 4 files changed, 12 insertions(+) diff --git a/net/ipv4/tcp_offload.c b/net/ipv4/tcp_offload.c index 7691be01da4d..527313547091 100644 --- a/net/ipv4/tcp_offload.c +++ b/net/ipv4/tcp_offload.c @@ -469,6 +469,9 @@ INDIRECT_CALLABLE_SCOPE int tcp4_gro_complete(struct sk_buff *skb, int thoff) skb_shinfo(skb)->gso_type |= SKB_GSO_FRAGLIST | SKB_GSO_TCPV4; skb_shinfo(skb)->gso_segs = NAPI_GRO_CB(skb)->count; + if (skb->encapsulation) + skb->inner_transport_header = skb->transport_header; + __skb_incr_checksum_unnecessary(skb); return 0; diff --git a/net/ipv4/udp_offload.c b/net/ipv4/udp_offload.c index 243bd75302d8..8c77f6f95fb1 100644 --- a/net/ipv4/udp_offload.c +++ b/net/ipv4/udp_offload.c @@ -972,6 +972,9 @@ INDIRECT_CALLABLE_SCOPE int udp4_gro_complete(struct sk_buff *skb, int nhoff) skb_shinfo(skb)->gso_type |= (SKB_GSO_FRAGLIST|SKB_GSO_UDP_L4); skb_shinfo(skb)->gso_segs = NAPI_GRO_CB(skb)->count; + if (skb->encapsulation) + skb->inner_transport_header = skb->transport_header; + __skb_incr_checksum_unnecessary(skb); return 0; diff --git a/net/ipv6/tcpv6_offload.c b/net/ipv6/tcpv6_offload.c index 71feb92aeac2..d1c0b1889d8b 100644 --- a/net/ipv6/tcpv6_offload.c +++ b/net/ipv6/tcpv6_offload.c @@ -89,6 +89,9 @@ static __always_inline int tcp6_gro_complete(struct sk_buff *skb, int thoff) skb_shinfo(skb)->gso_type |= SKB_GSO_FRAGLIST | SKB_GSO_TCPV6; skb_shinfo(skb)->gso_segs = NAPI_GRO_CB(skb)->count; + if (skb->encapsulation) + skb->inner_transport_header = skb->transport_header; + __skb_incr_checksum_unnecessary(skb); return 0; diff --git a/net/ipv6/udp_offload.c b/net/ipv6/udp_offload.c index 7370bcb80332..79346fc17df5 100644 --- a/net/ipv6/udp_offload.c +++ b/net/ipv6/udp_offload.c @@ -176,6 +176,9 @@ int udp6_gro_complete(struct sk_buff *skb, int nhoff) skb_shinfo(skb)->gso_type |= (SKB_GSO_FRAGLIST|SKB_GSO_UDP_L4); skb_shinfo(skb)->gso_segs = NAPI_GRO_CB(skb)->count; + if (skb->encapsulation) + skb->inner_transport_header = skb->transport_header; + __skb_incr_checksum_unnecessary(skb); return 0; -- 2.53.0