summaryrefslogtreecommitdiff
path: root/tools/testing/selftests/drivers/net/hw/toeplitz.py
diff options
context:
space:
mode:
authorJakub Kicinski <kuba@kernel.org>2025-11-24 18:51:44 -0800
committerJakub Kicinski <kuba@kernel.org>2025-11-24 18:51:44 -0800
commitd350d2835033bfa6833ff03bb2a7dc99a237d1c2 (patch)
tree03a9861c34a7e6f6e2a9e196c6dcf54080f4ec0c /tools/testing/selftests/drivers/net/hw/toeplitz.py
parentef0b78b5b6cb139af1273fc5f2720201556b2650 (diff)
parent5aadc155849eb85d799604939fd9e9024b7392a3 (diff)
Merge branch 'selftests-hw-net-toeplitz-read-config-from-the-nic-directly'
Jakub Kicinski says: ==================== selftests: hw-net: toeplitz: read config from the NIC directly First patch here tries to auto-disable building the iouring sample. Our CI will still run the iouring test(s), of course, but it looks like the liburing updates aren't very quick in distroes and having to hack around it when developing unrelated tests is a bit annoying. Remaining 4 patches iron out running the Toeplitz hash test against real NICs. I tested mlx5, bnxt and fbnic, they all pass now. I switched to using YNL directly in the C code, can't see a reason to get the info in Python and pass it to C via argv. The old code likely did this because it predates YNL. ==================== Link: https://patch.msgid.link/20251121040259.3647749-1-kuba@kernel.org Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Diffstat (limited to 'tools/testing/selftests/drivers/net/hw/toeplitz.py')
-rwxr-xr-xtools/testing/selftests/drivers/net/hw/toeplitz.py28
1 files changed, 15 insertions, 13 deletions
diff --git a/tools/testing/selftests/drivers/net/hw/toeplitz.py b/tools/testing/selftests/drivers/net/hw/toeplitz.py
index 9019a8c1ff62..d2db5ee9e358 100755
--- a/tools/testing/selftests/drivers/net/hw/toeplitz.py
+++ b/tools/testing/selftests/drivers/net/hw/toeplitz.py
@@ -17,6 +17,9 @@ from lib.py import cmd, bkg, rand_port, defer
from lib.py import ksft_in
from lib.py import ksft_variants, KsftNamedVariant, KsftSkipEx, KsftFailEx
+# "define" for the ID of the Toeplitz hash function
+ETH_RSS_HASH_TOP = 1
+
def _check_rps_and_rfs_not_configured(cfg):
"""Verify that RPS is not already configured."""
@@ -34,16 +37,6 @@ def _check_rps_and_rfs_not_configured(cfg):
raise KsftSkipEx(f"RFS already configured {rfs_file}: {val}")
-def _get_rss_key(cfg):
- """
- Read the RSS key from the device.
- Return a string in the traditional %02x:%02x:%02x:.. format.
- """
-
- rss = cfg.ethnl.rss_get({"header": {"dev-index": cfg.ifindex}})
- return ':'.join(f'{b:02x}' for b in rss["hkey"])
-
-
def _get_cpu_for_irq(irq):
with open(f"/proc/irq/{irq}/smp_affinity_list", "r",
encoding="utf-8") as fp:
@@ -153,8 +146,18 @@ def test(cfg, proto_flag, ipver, grp):
# Check that rxhash is enabled
ksft_in("receive-hashing: on", cmd(f"ethtool -k {cfg.ifname}").stdout)
+ rss = cfg.ethnl.rss_get({"header": {"dev-index": cfg.ifindex}})
+ # Make sure NIC is configured to use Toeplitz hash, and no key xfrm.
+ if rss.get('hfunc') != ETH_RSS_HASH_TOP or rss.get('input-xfrm'):
+ cfg.ethnl.rss_set({"header": {"dev-index": cfg.ifindex},
+ "hfunc": ETH_RSS_HASH_TOP,
+ "input-xfrm": {}})
+ defer(cfg.ethnl.rss_set, {"header": {"dev-index": cfg.ifindex},
+ "hfunc": rss.get('hfunc'),
+ "input-xfrm": rss.get('input-xfrm', {})
+ })
+
port = rand_port(socket.SOCK_DGRAM)
- key = _get_rss_key(cfg)
toeplitz_path = cfg.test_dir / "toeplitz"
rx_cmd = [
@@ -163,8 +166,7 @@ def test(cfg, proto_flag, ipver, grp):
proto_flag,
"-d", str(port),
"-i", cfg.ifname,
- "-k", key,
- "-T", "1000",
+ "-T", "4000",
"-s",
"-v"
]