From: Willem de Bruijn <willemdebruijn.kernel@gmail.com>
To: Jakub Kicinski <kuba@kernel.org>, davem@davemloft.net
Cc: netdev@vger.kernel.org, edumazet@google.com, pabeni@redhat.com,
andrew+netdev@lunn.ch, horms@kernel.org, willemb@google.com,
shuah@kernel.org, petrm@nvidia.com,
Jakub Kicinski <kuba@kernel.org>
Subject: Re: [PATCH net-next 3/3] selftests: drv-net: add a simple TSO test
Date: Thu, 13 Feb 2025 11:01:33 -0500 [thread overview]
Message-ID: <67ae175d7a7fc_24be45294be@willemb.c.googlers.com.notmuch> (raw)
In-Reply-To: <20250213003454.1333711-4-kuba@kernel.org>
Jakub Kicinski wrote:
> Add a simple test for TSO. Send a few MB of data and check device
> stats to verify that the device was performing segmentation.
> Do the same thing over a few tunnel types.
>
> Injecting GSO packets directly would give us more ability to test
> corner cases, but perhaps starting simple is good enough?
>
> # ./ksft-net-drv/drivers/net/hw/tso.py
> # Detected qstat for LSO wire-packets
> KTAP version 1
> 1..14
> ok 1 tso.ipv4 # SKIP Test requires IPv4 connectivity
> ok 2 tso.vxlan4_ipv4 # SKIP Test requires IPv4 connectivity
> ok 3 tso.vxlan6_ipv4 # SKIP Test requires IPv4 connectivity
> ok 4 tso.vxlan_csum4_ipv4 # SKIP Test requires IPv4 connectivity
> ok 5 tso.vxlan_csum6_ipv4 # SKIP Test requires IPv4 connectivity
> ok 6 tso.gre4_ipv4 # SKIP Test requires IPv4 connectivity
> ok 7 tso.gre6_ipv4 # SKIP Test requires IPv4 connectivity
> ok 8 tso.ipv6
> ok 9 tso.vxlan4_ipv6
> ok 10 tso.vxlan6_ipv6
> ok 11 tso.vxlan_csum4_ipv6
> ok 12 tso.vxlan_csum6_ipv6
> ok 13 tso.gre4_ipv6
> ok 14 tso.gre6_ipv6
> # Totals: pass:7 fail:0 xfail:0 xpass:0 skip:7 error:0
>
> Note that the test currently depends on the driver reporting
> the LSO count via qstat, which appears to be relatively rare
> (virtio, cisco/enic, sfc/efc; but virtio needs host support).
>
> Signed-off-by: Jakub Kicinski <kuba@kernel.org>
> +def test_builder(name, cfg, ipv4, feature, tun=None, inner_ipv4=None):
> + """Construct specific tests from the common template."""
> + def f(cfg):
> + if ipv4:
> + cfg.require_v4()
> + else:
> + cfg.require_v6()
> +
> + if not cfg.have_stat_super_count and \
> + not cfg.have_stat_wire_count:
> + raise KsftSkipEx(f"Device does not support LSO queue stats")
> +
> + if tun:
> + remote_v4, remote_v6 = build_tunnel(cfg, ipv4, tun)
> + else:
> + remote_v4 = cfg.remote_v4
> + remote_v6 = cfg.remote_v6
> +
> + has_gso_partial = tun and 'tx-gso-partial' in cfg.features
> +
> + # 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, ipv4, remote_v4, remote_v6, should_lso=False)
> +
> + # Now test with the feature enabled.
> + if has_gso_partial:
> + ethtool(f"-K {cfg.ifname} tx-gso-partial on")
Is the special handling of GSO partial needed?
This test is not trying to test that feature.
> +def main() -> None:
> + with NetDrvEpEnv(__file__, nsim_test=False) as cfg:
> + cfg.ethnl = EthtoolFamily()
> + cfg.netnl = NetdevFamily()
> +
> + query_nic_features(cfg)
> +
> + tun_info = (
> + # name, ethtool_feature tun:(type, args 4/6 only)
> + ("", "tx-tcp6-segmentation", None),
tx-tcp6-segmentation implies v6 only? The catch-all is tcp-segmentation-offload.
> + ("vxlan", "tx-udp_tnl-segmentation", ("vxlan", "id 100 dstport 4789 noudpcsum")),
> + ("vxlan_csum", "tx-udp_tnl-csum-segmentation", ("vxlan", "id 100 dstport 4789 udpcsum")),
> + ("gre", "tx-udp_tnl-segmentation", ("ipgre", "", True)),
> + ("gre", "tx-udp_tnl-segmentation", ("ip6gre", "", False)),
> + )
> +
> + cases = []
> + for outer_ipv4 in [True, False]:
> + for info in tun_info:
> + # Skip if it's tunnel which only works for a specific IP version
> + if info[2] and len(info[2]) > 2 and outer_ipv4 != info[2][2]:
> + continue
> +
> + cases.append(test_builder(info[0], cfg, outer_ipv4, info[1],
> + tun=info[2], inner_ipv4=True))
> + if info[2]:
> + cases.append(test_builder(info[0], cfg, outer_ipv4, info[1],
> + tun=info[2], inner_ipv4=False))
> +
> + ksft_run(cases=cases, args=(cfg, ))
> + ksft_exit()
> +
> +
> +if __name__ == "__main__":
> + main()
> --
> 2.48.1
>
next prev parent reply other threads:[~2025-02-13 16:01 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-02-13 0:34 [PATCH net-next 0/3] selftests: drv-net: add a simple TSO test Jakub Kicinski
2025-02-13 0:34 ` [PATCH net-next 1/3] selftests: drv-net: resolve remote interface name Jakub Kicinski
2025-02-13 14:31 ` Petr Machata
2025-02-13 15:55 ` Jakub Kicinski
2025-02-13 16:23 ` Petr Machata
2025-02-13 0:34 ` [PATCH net-next 2/3] selftests: drv-net: get detailed interface info Jakub Kicinski
2025-02-13 14:39 ` Petr Machata
2025-02-13 0:34 ` [PATCH net-next 3/3] selftests: drv-net: add a simple TSO test Jakub Kicinski
2025-02-13 2:49 ` Stanislav Fomichev
2025-02-13 4:18 ` Jakub Kicinski
2025-02-13 16:02 ` Willem de Bruijn
2025-02-13 17:01 ` Jakub Kicinski
2025-02-13 16:01 ` Willem de Bruijn [this message]
2025-02-13 17:07 ` Jakub Kicinski
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=67ae175d7a7fc_24be45294be@willemb.c.googlers.com.notmuch \
--to=willemdebruijn.kernel@gmail.com \
--cc=andrew+netdev@lunn.ch \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=horms@kernel.org \
--cc=kuba@kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=petrm@nvidia.com \
--cc=shuah@kernel.org \
--cc=willemb@google.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox