mirror of
https://github.com/torvalds/linux.git
synced 2026-05-23 14:42:08 +02:00
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/20250716000331.1378807-3-kuba@kernel.org Signed-off-by: Jakub Kicinski <kuba@kernel.org>
This commit is contained in:
parent
c0ae03588b
commit
1560af51e1
|
|
@ -13,6 +13,13 @@ from lib.py import EthtoolFamily
|
|||
from lib.py import NetDrvEnv
|
||||
|
||||
|
||||
def _require_2qs(cfg):
|
||||
qcnt = len(glob.glob(f"/sys/class/net/{cfg.ifname}/queues/rx-*"))
|
||||
if qcnt < 2:
|
||||
raise KsftSkipEx(f"Local has only {qcnt} queues")
|
||||
return qcnt
|
||||
|
||||
|
||||
def _ethtool_create(cfg, act, opts):
|
||||
output = ethtool(f"{act} {cfg.ifname} {opts}").stdout
|
||||
# Output will be something like: "New RSS context is 1" or
|
||||
|
|
@ -57,10 +64,7 @@ def test_rxfh_indir_ntf(cfg):
|
|||
Check that Netlink notifications are generated when RSS indirection
|
||||
table was modified.
|
||||
"""
|
||||
|
||||
qcnt = len(glob.glob(f"/sys/class/net/{cfg.ifname}/queues/rx-*"))
|
||||
if qcnt < 2:
|
||||
raise KsftSkipEx(f"Local has only {qcnt} queues")
|
||||
_require_2qs(cfg)
|
||||
|
||||
ethnl = EthtoolFamily()
|
||||
ethnl.ntf_subscribe("monitor")
|
||||
|
|
@ -88,10 +92,7 @@ def test_rxfh_indir_ctx_ntf(cfg):
|
|||
Check that Netlink notifications are generated when RSS indirection
|
||||
table was modified on an additional RSS context.
|
||||
"""
|
||||
|
||||
qcnt = len(glob.glob(f"/sys/class/net/{cfg.ifname}/queues/rx-*"))
|
||||
if qcnt < 2:
|
||||
raise KsftSkipEx(f"Local has only {qcnt} queues")
|
||||
_require_2qs(cfg)
|
||||
|
||||
ctx_id = _ethtool_create(cfg, "-X", "context new")
|
||||
defer(ethtool, f"-X {cfg.ifname} context {ctx_id} delete")
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user