mirror of
https://github.com/torvalds/linux.git
synced 2026-05-28 00:53:34 +02:00
selftests: drv-net: test the napi init state
Test that threaded state (in the persistent NAPI config) gets updated
even when NAPI with given ID is not allocated at the time.
This test is validating commit ccba9f6baa ("net: update NAPI threaded
config even for disabled NAPIs").
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Reviewed-by: Joe Damato <joe@dama.to>
Link: https://patch.msgid.link/20250815013314.2237512-1-kuba@kernel.org
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
This commit is contained in:
parent
730ff06d3f
commit
0283b8f134
|
|
@ -38,6 +38,34 @@ def _setup_deferred_cleanup(cfg) -> None:
|
|||
return combined
|
||||
|
||||
|
||||
def napi_init(cfg, nl) -> None:
|
||||
"""
|
||||
Test that threaded state (in the persistent NAPI config) gets updated
|
||||
even when NAPI with given ID is not allocated at the time.
|
||||
"""
|
||||
|
||||
qcnt = _setup_deferred_cleanup(cfg)
|
||||
|
||||
_set_threaded_state(cfg, 1)
|
||||
cmd(f"ethtool -L {cfg.ifname} combined 1")
|
||||
_set_threaded_state(cfg, 0)
|
||||
cmd(f"ethtool -L {cfg.ifname} combined {qcnt}")
|
||||
|
||||
napis = nl.napi_get({'ifindex': cfg.ifindex}, dump=True)
|
||||
for napi in napis:
|
||||
ksft_eq(napi['threaded'], 'disabled')
|
||||
ksft_eq(napi.get('pid'), None)
|
||||
|
||||
cmd(f"ethtool -L {cfg.ifname} combined 1")
|
||||
_set_threaded_state(cfg, 1)
|
||||
cmd(f"ethtool -L {cfg.ifname} combined {qcnt}")
|
||||
|
||||
napis = nl.napi_get({'ifindex': cfg.ifindex}, dump=True)
|
||||
for napi in napis:
|
||||
ksft_eq(napi['threaded'], 'enabled')
|
||||
ksft_ne(napi.get('pid'), None)
|
||||
|
||||
|
||||
def enable_dev_threaded_disable_napi_threaded(cfg, nl) -> None:
|
||||
"""
|
||||
Test that when napi threaded is enabled at device level and
|
||||
|
|
@ -103,7 +131,8 @@ def main() -> None:
|
|||
""" Ksft boiler plate main """
|
||||
|
||||
with NetDrvEnv(__file__, queue_count=2) as cfg:
|
||||
ksft_run([change_num_queues,
|
||||
ksft_run([napi_init,
|
||||
change_num_queues,
|
||||
enable_dev_threaded_disable_napi_threaded],
|
||||
args=(cfg, NetdevFamily()))
|
||||
ksft_exit()
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user