Skip to content

Commit 1560af5

Browse files
committed
selftests: drv-net: rss_api: factor out checking min queue count
Multiple tests check min queue count, create a helper. Link: https://patch.msgid.link/[email protected] Signed-off-by: Jakub Kicinski <[email protected]>
1 parent c0ae035 commit 1560af5

File tree

1 file changed

+9
-8
lines changed

1 file changed

+9
-8
lines changed

tools/testing/selftests/drivers/net/hw/rss_api.py

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,13 @@
1313
from lib.py import NetDrvEnv
1414

1515

16+
def _require_2qs(cfg):
17+
qcnt = len(glob.glob(f"/sys/class/net/{cfg.ifname}/queues/rx-*"))
18+
if qcnt < 2:
19+
raise KsftSkipEx(f"Local has only {qcnt} queues")
20+
return qcnt
21+
22+
1623
def _ethtool_create(cfg, act, opts):
1724
output = ethtool(f"{act} {cfg.ifname} {opts}").stdout
1825
# Output will be something like: "New RSS context is 1" or
@@ -57,10 +64,7 @@ def test_rxfh_indir_ntf(cfg):
5764
Check that Netlink notifications are generated when RSS indirection
5865
table was modified.
5966
"""
60-
61-
qcnt = len(glob.glob(f"/sys/class/net/{cfg.ifname}/queues/rx-*"))
62-
if qcnt < 2:
63-
raise KsftSkipEx(f"Local has only {qcnt} queues")
67+
_require_2qs(cfg)
6468

6569
ethnl = EthtoolFamily()
6670
ethnl.ntf_subscribe("monitor")
@@ -88,10 +92,7 @@ def test_rxfh_indir_ctx_ntf(cfg):
8892
Check that Netlink notifications are generated when RSS indirection
8993
table was modified on an additional RSS context.
9094
"""
91-
92-
qcnt = len(glob.glob(f"/sys/class/net/{cfg.ifname}/queues/rx-*"))
93-
if qcnt < 2:
94-
raise KsftSkipEx(f"Local has only {qcnt} queues")
95+
_require_2qs(cfg)
9596

9697
ctx_id = _ethtool_create(cfg, "-X", "context new")
9798
defer(ethtool, f"-X {cfg.ifname} context {ctx_id} delete")

0 commit comments

Comments
 (0)