From 1240de9e51201eaf7057f63b9ce5db15380cbbbe Mon Sep 17 00:00:00 2001 From: Haishuang Yan Date: Sun, 11 Oct 2026 18:20:22 +0800 Subject: [PATCH 1/2] bareudp: Enable BIG TCP packets Commit f3d0f753f066 ("vxlan: Enable BIG TCP packets") and commit 03ebe91b0f61 ("geneve: Enable BIG TCP packets") allowed BIG TCP on vxlan and geneve, after the preceding patches of that series made the common UDP tunnel transmit path handle GSO packets larger than 64KB. bareudp transmits through the same helpers, udp_tunnel_handle_offloads() followed by udp_tunnel_xmit_skb() or udp_tunnel6_xmit_skb(), and does not fill in any length field itself. Bump tso_max_size up to GSO_MAX_SIZE so that the admin can use BIG TCP with bareudp too. The default gso_max_size and gso_ipv4_max_size stay at 64KB, so nothing changes unless they are raised explicitly. iperf3 TCP over bareudp (ethertype ipv4, IPv4 outer) between two netns connected by veth, MTU 1600 on veth, 3 runs of 20 seconds each. This was measured in a QEMU TCG guest, so only the relative numbers are meaningful: gso_max_size/gso_ipv4_max_size 65536: 4380.6, 4404.2, 4354.5 Mbit/s, average 4379.8 Mbit/s gso_max_size/gso_ipv4_max_size 196608: 5509.4, 5454.7, 5497.4 Mbit/s, average 5487.2 Mbit/s (+25%) With 196608, about 90k to 100k packets larger than 64KB were transmitted on the bareudp device per run, none with 65536. Without this patch, setting gso_max_size to 196608 is rejected. Acked-by: Alice Mikityanska Signed-off-by: Haishuang Yan Reviewed-by: Simon Horman Link: https://patch.msgid.link/20261011102023.1603595-2-yanhaishuang@cmss.chinamobile.com Signed-off-by: Jakub Kicinski --- drivers/net/bareudp.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/net/bareudp.c b/drivers/net/bareudp.c index b9fe54151e1a..48bcb619ef41 100644 --- a/drivers/net/bareudp.c +++ b/drivers/net/bareudp.c @@ -590,6 +590,7 @@ static void bareudp_setup(struct net_device *dev) dev->max_mtu = IP_MAX_MTU - BAREUDP_BASE_HLEN; dev->type = ARPHRD_NONE; netif_keep_dst(dev); + netif_set_tso_max_size(dev, GSO_MAX_SIZE); dev->priv_flags |= IFF_NO_QUEUE; dev->lltx = true; dev->flags = IFF_POINTOPOINT | IFF_NOARP | IFF_MULTICAST; From 3e3f209961b03835a8f3d3e52ed9ca976997c142 Mon Sep 17 00:00:00 2001 From: Haishuang Yan Date: Sun, 11 Oct 2026 18:20:23 +0800 Subject: [PATCH 2/2] selftests: net: big_tcp_tunnels: Cover bareudp Now that bareudp allows BIG TCP too, run the same checks over bareudp as for vxlan and geneve. bareudp only works in external mode, so attach the tunnel metadata to all packets sent through the device with a tc tunnel_key action on egress. The device uses ethertype ipv4 with multiproto, so that both IPv4 and IPv6 traffic can go through it. Its MTU does not account for the encapsulation, so lower it to leave room for the IPv6 and UDP headers, otherwise the encapsulated packets would be fragmented. Signed-off-by: Haishuang Yan Reviewed-by: Simon Horman Link: https://patch.msgid.link/20261011102023.1603595-3-yanhaishuang@cmss.chinamobile.com Signed-off-by: Jakub Kicinski --- .../testing/selftests/net/big_tcp_tunnels.sh | 55 ++++++++++++++++--- 1 file changed, 46 insertions(+), 9 deletions(-) diff --git a/tools/testing/selftests/net/big_tcp_tunnels.sh b/tools/testing/selftests/net/big_tcp_tunnels.sh index fb43fed824e3..9c1482b842bf 100755 --- a/tools/testing/selftests/net/big_tcp_tunnels.sh +++ b/tools/testing/selftests/net/big_tcp_tunnels.sh @@ -1,7 +1,7 @@ #!/usr/bin/env bash # SPDX-License-Identifier: GPL-2.0 # -# Testing for IPv4 and IPv6 BIG TCP over VXLAN and GENEVE tunnels. +# Testing for IPv4 and IPv6 BIG TCP over VXLAN, GENEVE and bareudp tunnels. source "$(dirname "$0")/lib.sh" @@ -53,6 +53,24 @@ setup() { DEFAULT_TCP_MIN_TSO_SEGS=$(ip netns exec "$CLIENT_NS" sysctl -n net.ipv4.tcp_min_tso_segs) } +# Create a bareudp device. bareudp only works in external mode: attach the +# tunnel metadata to all packets sent through the device. Its MTU does not +# account for the encapsulation either, so leave room for IPv6 and UDP +# headers. +# $1: netns, $2: device, $3: local underlay address, $4: remote one +setup_bareudp() { + ip -netns "$1" link add "$2" type bareudp \ + dstport 6635 ethertype ipv4 multiproto && + ip -netns "$1" link set "$2" mtu 1452 && + tc -netns "$1" qdisc add dev "$2" clsact && + tc -netns "$1" filter add dev "$2" egress matchall \ + action tunnel_key set src_ip "$3" dst_ip "$4" id 0 ttl 64 && + return 0 + + echo "Failed to set up bareudp device $2" >&2 + return 1 +} + setup_tunnel() { if [ "$2" = 4 ]; then SERVER_IP="$SERVER_IP4" @@ -64,26 +82,40 @@ setup_tunnel() { echo "Setting up ${1^^} over IPv6, veth tx csum offload $3" fi - if [ "$1" = vxlan ]; then + case "$1" in + vxlan) ip -netns "$CLIENT_NS" link add tun0 type vxlan \ id 5001 remote "$SERVER_IP" local "$CLIENT_IP" dev link0 dstport 4789 - else + ;; + geneve) ip -netns "$CLIENT_NS" link add tun0 type geneve \ id 5001 remote "$SERVER_IP" - fi + ;; + bareudp) + setup_bareudp "$CLIENT_NS" tun0 "$CLIENT_IP" "$SERVER_IP" || + return 1 + ;; + esac ip -netns "$CLIENT_NS" link set tun0 up ip -netns "$CLIENT_NS" addr replace "$CLIENT_IP4_TUN/24" dev tun0 ip -netns "$CLIENT_NS" addr replace "$CLIENT_IP6_TUN/112" dev tun0 nodad ip -netns "$CLIENT_NS" link set tun0 \ gso_max_size 196608 gso_ipv4_max_size 196608 \ gro_max_size 196608 gro_ipv4_max_size 196608 - if [ "$1" = vxlan ]; then + case "$1" in + vxlan) ip -netns "$SERVER_NS" link add tun1 type vxlan \ id 5001 remote "$CLIENT_IP" local "$SERVER_IP" dev link1 dstport 4789 - else + ;; + geneve) ip -netns "$SERVER_NS" link add tun1 type geneve \ id 5001 remote "$CLIENT_IP" - fi + ;; + bareudp) + setup_bareudp "$SERVER_NS" tun1 "$SERVER_IP" "$CLIENT_IP" || + return 1 + ;; + esac ip -netns "$SERVER_NS" link set tun1 up ip -netns "$SERVER_NS" addr replace "$SERVER_IP4_TUN/24" dev tun1 ip -netns "$SERVER_NS" addr replace "$SERVER_IP6_TUN/112" dev tun1 nodad @@ -112,7 +144,7 @@ do_test() { local packets_threshold="$PACKETS_THRESHOLD" # When tx csum offload is off, software GSO is performed before passing the - # packet to veth. Check BIG TCP packets inside the VXLAN tunnel to verify + # packet to veth. Check BIG TCP packets inside the tunnel to verify # the software checksum path: if the checksum code is broken, these packets # will be dropped. if [ "$3" = on ]; then @@ -193,6 +225,11 @@ if ! iptables --version &> /dev/null; then exit "$ksft_skip" fi +if ! tc -V &> /dev/null; then + echo "SKIP: Could not run test without tc tool" + exit "$ksft_skip" +fi + if ! ethtool --version &> /dev/null; then echo "SKIP: Could not run test without ethtool tool" exit "$ksft_skip" @@ -206,7 +243,7 @@ fi WORKDIR=$(mktemp -d) trap cleanup EXIT setup -for tunnel in vxlan geneve; do +for tunnel in vxlan geneve bareudp; do for tun_family in 4 6; do for traffic_family in 4 6; do for csum_offload in on off; do