Subject: Re: [PATCH v2 net] ip6_gre: use skb_vlan_inet_prepare() instead of pskb_inet_may_pull()

From: Jakub Kicinski <[email-masked]>
Date: Tue, 6 Jan 2026 14:28:38 -0800

On Tue, 6 Jan 2026 22:33:05 +0100 Eric Dumazet wrote:
> > [hi on] edumazet@edumazet1:~/git/net-next$ vng  -r --user root --cpus
> > 4 --memory 4G
> > /usr/lib/tmpfiles.d/legacy.conf:14: Duplicate line for path
> > "/run/lock", ignoring.
> >           _      _
> >    __   _(_)_ __| |_ _ __ ___   ___       _ __   __ _
> >    \ \ / / |  __| __|  _   _ \ / _ \_____|  _ \ / _  |
> >     \ V /| | |  | |_| | | | | |  __/_____| | | | (_| |
> >      \_/ |_|_|   \__|_| |_| |_|\___|     |_| |_|\__  |
> >                                                 |___/
> >    kernel version: 6.16.12-1rodete2-amd64 x86_64
> >    (CTRL+d to exit)
> >
> > Illegal instruction        shell-history-configtool configure-interactively
> > root@virtme-ng:/usr/local/google/home/edumazet/git/net-next# cd
> > tools/testing/selftests/net/
> > root@virtme-ng:/usr/local/google/home/edumazet/git/net-next/tools/testing/selftests/net#
> > ./gre_gso.sh
> >     TEST: GREv6/v4 - copy file w/ TSO                                   [ OK ]
> >     TEST: GREv6/v4 - copy file w/ GSO                                   [ OK ]
> > 2026/01/06 21:25:27 socat[1214] W exiting on signal 15
> >     TEST: GREv6/v6 - copy file w/ TSO                                   [ OK ]
> >     TEST: GREv6/v6 - copy file w/ GSO                                   [ OK ]
> > 2026/01/06 21:25:27 socat[1229] W exiting on signal 15
> >
> > Tests passed:   4
> > Tests failed:   0
> > root@virtme-ng:/usr/local/google/home/edumazet/git/net-next/tools/testing/selftests/net#  
> 
> Ah of course my script had '-r arch/x86/boot/bzImage'

Maybe your machine / TCP tunings are super fast. I think we have some
packet loss here which slows things down, maybe we run into the timeout
of 1 sec with GSO and you don't.

I did this to the (GSO side of the) test:

diff --git a/tools/testing/selftests/net/gre_gso.sh b/tools/testing/selftests/net/gre_gso.sh
index 5100d90f92d2..b9a223b584f6 100755
--- a/tools/testing/selftests/net/gre_gso.sh
+++ b/tools/testing/selftests/net/gre_gso.sh
@@ -125,9 +125,16 @@ gre_gst_test_checks()
 
        ethtool -K veth0 tso off
 
-       cat $TMPFILE | timeout 1 socat -u STDIN TCP:$addr:$port
-       log_test $? 0 "$name - copy file w/ GSO"
-
+       $NS_EXEC nstat >>/dev/null
+       nstat >>/dev/null
+       cat $TMPFILE | \time timeout 1 socat -u STDIN TCP:$addr:$port
+       R=$?
+       echo "== Sender"
+       nstat
+       echo "== Receiver"
+       $NS_EXEC nstat
+       log_test $R 0 "$name - copy file w/ GSO"
+       
        ethtool -K veth0 tso on
 
        kill $PID

Without the fix under discussion I get:

# ./gre_gso.sh 
    TEST: GREv6/v4 - copy file w/ TSO                                   [ OK ]
0.00user 0.12system 0:00.13elapsed 92%CPU (0avgtext+0avgdata 3744maxresident)k
0inputs+0outputs (0major+406minor)pagefaults 0swaps
== Sender
#kernel
IpInReceives                    255                0.0
IpInDelivers                    255                0.0
IpOutRequests                   259                0.0
IpOutTransmits                  259                0.0
TcpActiveOpens                  1                  0.0
TcpInSegs                       255                0.0
TcpOutSegs                      1539               0.0
Ip6InReceives                   255                0.0
Ip6InDelivers                   255                0.0
Ip6InOctets                     26528              0.0
Ip6OutOctets                    2124096            0.0
Ip6InNoECTPkts                  255                0.0
Ip6OutTransmits                 259                0.0
TcpExtTCPPureAcks               252                0.0
TcpExtTCPBacklogCoalesce        1                  0.0
TcpExtTCPOrigDataSent           1536               0.0
TcpExtTCPDelivered              1537               0.0
IpExtInOctets                   13268              0.0
IpExtOutOctets                  2110628            0.0
IpExtInNoECTPkts                255                0.0
== Receiver
#kernel
IpInReceives                    7                  0.0
IpInDelivers                    7                  0.0
TcpPassiveOpens                 2                  0.0
TcpInSegs                       7                  0.0
Ip6InReceives                   1287               0.0
Ip6InDelivers                   1287               0.0
Ip6InMcastPkts                  1                  0.0
Ip6InOctets                     4328152            0.0
Ip6InMcastOctets                72                 0.0
Ip6InNoECTPkts                  2564               0.0
Icmp6InNeighborSolicits         1                  0.0
Icmp6OutNeighborAdvertisements  1                  0.0
Icmp6InType135                  1                  0.0
Icmp6OutType136                 1                  0.0
TcpExtTW                        2                  0.0
TcpExtTCPRcvCoalesce            22                 0.0
IpExtInOctets                   4194668            0.0
IpExtInNoECTPkts                2564               0.0
    TEST: GREv6/v4 - copy file w/ GSO                                   [ OK ]
2026/01/06 17:23:10 socat[787] W exiting on signal 15
    TEST: GREv6/v6 - copy file w/ TSO                                   [ OK ]
0.00user 0.12system 0:00.14elapsed 85%CPU (0avgtext+0avgdata 3668maxresident)k
0inputs+0outputs (0major+405minor)pagefaults 0swaps
== Sender
#kernel
TcpActiveOpens                  1                  0.0
TcpInSegs                       261                0.0
TcpOutSegs                      1539               0.0
Ip6InReceives                   522                0.0
Ip6InDelivers                   522                0.0
Ip6OutRequests                  263                0.0
Ip6InOctets                     51172              0.0
Ip6OutOctets                    4245868            0.0
Ip6InNoECTPkts                  522                0.0
Ip6OutTransmits                 526                0.0
TcpExtTCPPureAcks               257                0.0
TcpExtTCPLossProbes             1                  0.0
TcpExtTCPBacklogCoalesce        2                  0.0
TcpExtTCPOrigDataSent           1537               0.0
TcpExtTCPDelivered              1538               0.0
== Receiver
#kernel
IpInReceives                    7                  0.0
IpInDelivers                    7                  0.0
TcpPassiveOpens                 4                  0.0
TcpInSegs                       11                 0.0
Ip6InReceives                   2571               0.0
Ip6InDelivers                   2571               0.0
Ip6InMcastPkts                  1                  0.0
Ip6InOctets                     12875768           0.0
Ip6InMcastOctets                72                 0.0
Ip6InNoECTPkts                  7670               0.0
Icmp6InNeighborSolicits         1                  0.0
Icmp6OutNeighborAdvertisements  1                  0.0
Icmp6InType135                  1                  0.0
Icmp6OutType136                 1                  0.0
TcpExtTW                        4                  0.0
TcpExtTCPRcvCoalesce            42                 0.0
IpExtInOctets                   4194668            0.0
IpExtInNoECTPkts                2564               0.0
    TEST: GREv6/v6 - copy file w/ GSO                                   [ OK ]
2026/01/06 17:23:10 socat[808] W exiting on signal 15

Tests passed:   4
Tests failed:   0

With the change I see retransmits:

# ./gre_gso.sh 
    TEST: GREv6/v4 - copy file w/ TSO                                   [ OK ]
2026/01/06 17:25:21 socat[805] W exiting on signal 15
Command exited with non-zero status 124
0.00user 0.03system 0:01.02elapsed 3%CPU (0avgtext+0avgdata 3792maxresident)k
0inputs+0outputs (2major+408minor)pagefaults 0swaps
== Sender
#kernel
IpInReceives                    103                0.0
IpInDelivers                    103                0.0
IpOutRequests                   145                0.0
IpOutTransmits                  145                0.0
TcpActiveOpens                  1                  0.0
TcpInSegs                       103                0.0
TcpOutSegs                      123                0.0
TcpRetransSegs                  52                 0.0
Ip6InReceives                   103                0.0
Ip6InDelivers                   103                0.0
Ip6InOctets                     11176              0.0
Ip6OutOctets                    254280             0.0
Ip6InNoECTPkts                  103                0.0
Ip6OutTransmits                 145                0.0
TcpExtDelayedACKs               1                  0.0
TcpExtTCPPureAcks               88                 0.0
TcpExtTCPSackRecovery           9                  0.0
TcpExtTCPLostRetransmit         10                 0.0
TcpExtTCPLossFailures           1                  0.0
TcpExtTCPFastRetrans            33                 0.0
TcpExtTCPSlowStartRetrans       15                 0.0
TcpExtTCPTimeouts               4                  0.0
TcpExtTCPLossProbes             2                  0.0
TcpExtTCPSackRecoveryFail       3                  0.0
TcpExtTCPBacklogCoalesce        12                 0.0
TcpExtTCPSackMerged             4                  0.0
TcpExtTCPSackShiftFallback      9                  0.0
TcpExtTCPOrigDataSent           120                0.0
TcpExtTCPDelivered              119                0.0
TcpExtTcpTimeoutRehash          4                  0.0
IpExtInOctets                   5820               0.0
IpExtOutOctets                  246740             0.0
IpExtInNoECTPkts                103                0.0
== Receiver
#kernel
IpInReceives                    23                 0.0
IpInDelivers                    22                 0.0
TcpPassiveOpens                 2                  0.0
TcpInSegs                       23                 0.0
Ip6InReceives                   21                 0.0
Ip6InDelivers                   21                 0.0
Ip6InMcastPkts                  1                  0.0
Ip6InOctets                     2262688            0.0
Ip6InMcastOctets                72                 0.0
Ip6InNoECTPkts                  1295               0.0
Icmp6InNeighborSolicits         1                  0.0
Icmp6OutNeighborAdvertisements  1                  0.0
Icmp6InType135                  1                  0.0
Icmp6OutType136                 1                  0.0
TcpExtTW                        1                  0.0
TcpExtTCPRcvCoalesce            72                 0.0
TcpExtTCPOFOQueue               13                 0.0
IpExtInOctets                   2261596            0.0
IpExtInNoECTPkts                1295               0.0
    TEST: GREv6/v4 - copy file w/ GSO                                   [FAIL]
2026/01/06 17:25:21 socat[789] W exiting on signal 15
    TEST: GREv6/v6 - copy file w/ TSO                                   [ OK ]
2026/01/06 17:25:22 socat[825] W exiting on signal 15
Command exited with non-zero status 124
0.00user 0.10system 0:01.05elapsed 9%CPU (0avgtext+0avgdata 3720maxresident)k
0inputs+0outputs (0major+406minor)pagefaults 0swaps
== Sender
#kernel
TcpActiveOpens                  1                  0.0
TcpInSegs                       408                0.0
TcpOutSegs                      430                0.0
TcpRetransSegs                  73                 0.0
Ip6InReceives                   818                0.0
Ip6InDelivers                   817                0.0
Ip6OutRequests                  464                0.0
Ip6InMcastPkts                  1                  0.0
Ip6OutMcastPkts                 1                  0.0
Ip6InOctets                     81620              0.0
Ip6OutOctets                    1460624            0.0
Ip6InMcastOctets                72                 0.0
Ip6OutMcastOctets               72                 0.0
Ip6InNoECTPkts                  818                0.0
Ip6OutTransmits                 928                0.0
Icmp6OutMsgs                    1                  0.0
Icmp6OutRouterSolicits          1                  0.0
Icmp6OutType133                 1                  0.0
TcpExtDelayedACKs               1                  0.0
TcpExtTCPPureAcks               238                0.0
TcpExtTCPSackRecovery           15                 0.0
TcpExtTCPDSACKUndo              1                  0.0
TcpExtTCPLostRetransmit         10                 0.0
TcpExtTCPLossFailures           1                  0.0
TcpExtTCPFastRetrans            57                 0.0
TcpExtTCPSlowStartRetrans       12                 0.0
TcpExtTCPTimeouts               4                  0.0
TcpExtTCPLossProbes             8                  0.0
TcpExtTCPSackRecoveryFail       3                  0.0
TcpExtTCPBacklogCoalesce        161                0.0
TcpExtTCPDSACKRecv              1                  0.0
TcpExtTCPSackShiftFallback      15                 0.0
TcpExtTCPOrigDataSent           427                0.0
TcpExtTCPDelivered              427                0.0
TcpExtTcpTimeoutRehash          4                  0.0
TcpExtTCPDSACKRecvSegs          1                  0.0
== Receiver
#kernel
IpInReceives                    21                 0.0
IpInDelivers                    21                 0.0
TcpPassiveOpens                 4                  0.0
TcpInSegs                       43                 0.0
Ip6InReceives                   65                 0.0
Ip6InDelivers                   65                 0.0
Ip6InMcastPkts                  1                  0.0
Ip6InOctets                     7658680            0.0
Ip6InMcastOctets                72                 0.0
Ip6InNoECTPkts                  3889               0.0
Icmp6InNeighborSolicits         1                  0.0
Icmp6OutNeighborAdvertisements  1                  0.0
Icmp6InType135                  1                  0.0
Icmp6OutType136                 1                  0.0
TcpExtTW                        3                  0.0
TcpExtDelayedACKLost            1                  0.0
TcpExtTCPDSACKOldSent           1                  0.0
TcpExtTCPRcvCoalesce            197                0.0
TcpExtTCPOFOQueue               30                 0.0
IpExtInOctets                   2294396            0.0
IpExtInNoECTPkts                1295               0.0
    TEST: GREv6/v6 - copy file w/ GSO                                   [FAIL]
2026/01/06 17:25:22 socat[812] W exiting on signal 15

Tests passed:   2
Tests failed:   2

If I increase the timeout to 3 or 4 sec it's enough time to finish the
file transfer regardless of the loss.