Commit 2cfbcc5d authored by Daniel Zahka's avatar Daniel Zahka Committed by Jakub Kicinski
Browse files

selftests: drv-net: tso: fix vxlan tunnel flags to get correct gso_type



When vxlan is used with ipv6 as the outer network header, the correct
ip link parameters for acheiving the SKB_GSO_UDP_TUNNEL gso type is
"udp6zerocsumtx udp6zerocsumrx". Otherwise the gso type will be
SKB_GSO_UDP_TUNNEL_CSUM.

This bug was the reason for the second of the three possible
invocations of run_one_stream() invocations, so that can be deleted as
well. We only need to test with the feature off and on.

Fixes: 0d0f4174 ("selftests: drv-net: add a simple TSO test")
Signed-off-by: default avatarDaniel Zahka <daniel.zahka@gmail.com>
Link: https://patch.msgid.link/20250723184740.4075410-3-daniel.zahka@gmail.com


Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
parent 266b835e
Loading
Loading
Loading
Loading
+13 −24
Original line number Diff line number Diff line
@@ -102,7 +102,7 @@ def build_tunnel(cfg, outer_ipver, tun_info):
    remote_addr = cfg.remote_addr_v[outer_ipver]

    tun_type = tun_info[0]
    tun_arg  = tun_info[2]
    tun_arg  = tun_info[1]
    ip(f"link add {tun_type}-ksft type {tun_type} {tun_arg} local {local_addr} remote {remote_addr} dev {cfg.ifname}")
    defer(ip, f"link del {tun_type}-ksft")
    ip(f"link set dev {tun_type}-ksft up")
@@ -151,29 +151,17 @@ def test_builder(name, cfg, outer_ipver, feature, tun=None, inner_ipver=None):
            remote_v4 = cfg.remote_addr_v["4"]
            remote_v6 = cfg.remote_addr_v["6"]

        tun_partial = tun and tun[1]
        # Tunnel which can silently fall back to gso-partial
        has_gso_partial = tun and 'tx-gso-partial' in cfg.hw_features

        # For TSO4 via partial we need mangleid
        if ipver == "4" and feature in cfg.partial_features:
            ksft_pr("Testing with mangleid enabled")
            if 'tx-tcp-mangleid-segmentation' not in cfg.hw_features:
                ethtool(f"-K {cfg.ifname} tx-tcp-mangleid-segmentation on")
                defer(ethtool, f"-K {cfg.ifname} tx-tcp-mangleid-segmentation off")

        # First test without the feature enabled.
        ethtool(f"-K {cfg.ifname} {feature} off")
        if has_gso_partial:
            ethtool(f"-K {cfg.ifname} tx-gso-partial off")
        run_one_stream(cfg, ipver, remote_v4, remote_v6, should_lso=False)

        # Now test with the feature enabled.
        # For compatible tunnels only - just GSO partial, not specific feature.
        if has_gso_partial:
        ethtool(f"-K {cfg.ifname} tx-gso-partial off")
        ethtool(f"-K {cfg.ifname} tx-tcp-mangleid-segmentation off")
        if feature in cfg.partial_features:
            ethtool(f"-K {cfg.ifname} tx-gso-partial on")
            run_one_stream(cfg, ipver, remote_v4, remote_v6,
                           should_lso=tun_partial)
            if ipver == "4":
                ksft_pr("Testing with mangleid enabled")
                ethtool(f"-K {cfg.ifname} tx-tcp-mangleid-segmentation on")

        # Full feature enabled.
        ethtool(f"-K {cfg.ifname} {feature} on")
@@ -239,13 +227,14 @@ def main() -> None:
        query_nic_features(cfg)

        test_info = (
            # name,       v4/v6  ethtool_feature              tun:(type,    partial, args)
            # name,       v4/v6  ethtool_feature              tun:(type,     args)
            ("",            "4", "tx-tcp-segmentation",           None),
            ("",            "6", "tx-tcp6-segmentation",          None),
            ("vxlan",        "", "tx-udp_tnl-segmentation",       ("vxlan",  True,  "id 100 dstport 4789 noudpcsum")),
            ("vxlan_csum",   "", "tx-udp_tnl-csum-segmentation",  ("vxlan",  False, "id 100 dstport 4789 udpcsum")),
            ("gre",         "4", "tx-gre-segmentation",           ("gre",    False,  "")),
            ("gre",         "6", "tx-gre-segmentation",           ("ip6gre", False,  "")),
            ("vxlan",       "4", "tx-udp_tnl-segmentation",       ("vxlan",  "id 100 dstport 4789 noudpcsum")),
            ("vxlan",       "6", "tx-udp_tnl-segmentation",       ("vxlan",  "id 100 dstport 4789 udp6zerocsumtx udp6zerocsumrx")),
            ("vxlan_csum",   "", "tx-udp_tnl-csum-segmentation",  ("vxlan",  "id 100 dstport 4789 udpcsum")),
            ("gre",         "4", "tx-gre-segmentation",           ("gre",    "")),
            ("gre",         "6", "tx-gre-segmentation",           ("ip6gre", "")),
        )

        cases = []