Commit a0aab7d7 authored by Jakub Kicinski's avatar Jakub Kicinski

selftests: drv-net: rss_ctx: fix cleanup in the basic test

The basic test may fail without resetting the RSS indir table.
Use the .exec() method to run cleanup early since we re-test
with traffic that returning to default state works.
While at it reformat the doc a tiny bit.
Reviewed-by: default avatarWillem de Bruijn <willemb@google.com>
Link: https://patch.msgid.link/20240708213627.226025-2-kuba@kernel.orgSigned-off-by: default avatarJakub Kicinski <kuba@kernel.org>
parent d6947113
...@@ -64,9 +64,8 @@ def _get_rx_cnts(cfg, prev=None): ...@@ -64,9 +64,8 @@ def _get_rx_cnts(cfg, prev=None):
def test_rss_key_indir(cfg): def test_rss_key_indir(cfg):
""" """Test basics like updating the main RSS key and indirection table."""
Test basics like updating the main RSS key and indirection table.
"""
if len(_get_rx_cnts(cfg)) < 2: if len(_get_rx_cnts(cfg)) < 2:
KsftSkipEx("Device has only one queue (or doesn't support queue stats)") KsftSkipEx("Device has only one queue (or doesn't support queue stats)")
...@@ -89,6 +88,7 @@ def test_rss_key_indir(cfg): ...@@ -89,6 +88,7 @@ def test_rss_key_indir(cfg):
# Set the indirection table # Set the indirection table
ethtool(f"-X {cfg.ifname} equal 2") ethtool(f"-X {cfg.ifname} equal 2")
reset_indir = defer(ethtool, f"-X {cfg.ifname} default")
data = get_rss(cfg) data = get_rss(cfg)
ksft_eq(0, min(data['rss-indirection-table'])) ksft_eq(0, min(data['rss-indirection-table']))
ksft_eq(1, max(data['rss-indirection-table'])) ksft_eq(1, max(data['rss-indirection-table']))
...@@ -104,7 +104,7 @@ def test_rss_key_indir(cfg): ...@@ -104,7 +104,7 @@ def test_rss_key_indir(cfg):
ksft_eq(sum(cnts[2:]), 0, "traffic on unused queues: " + str(cnts)) ksft_eq(sum(cnts[2:]), 0, "traffic on unused queues: " + str(cnts))
# Restore, and check traffic gets spread again # Restore, and check traffic gets spread again
ethtool(f"-X {cfg.ifname} default") reset_indir.exec()
cnts = _get_rx_cnts(cfg) cnts = _get_rx_cnts(cfg)
GenerateTraffic(cfg).wait_pkts_and_stop(20000) GenerateTraffic(cfg).wait_pkts_and_stop(20000)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment