mirror of
https://github.com/torvalds/linux.git
synced 2026-05-25 07:33:19 +02:00
selftests: drv-net: add shaper test for duplicate leaves
Add test exercising duplicate leaves. Signed-off-by: Jakub Kicinski <kuba@kernel.org> Link: https://patch.msgid.link/20260510192904.3987113-5-kuba@kernel.org Signed-off-by: Paolo Abeni <pabeni@redhat.com>
This commit is contained in:
parent
a9a2fa1da6
commit
6e8ae9d805
|
|
@ -1,7 +1,10 @@
|
|||
#!/usr/bin/env python3
|
||||
# SPDX-License-Identifier: GPL-2.0
|
||||
|
||||
from lib.py import ksft_run, ksft_exit, ksft_eq, ksft_true, KsftSkipEx
|
||||
import errno
|
||||
|
||||
from lib.py import ksft_run, ksft_exit
|
||||
from lib.py import ksft_eq, ksft_raises, ksft_true, KsftSkipEx
|
||||
from lib.py import EthtoolFamily, NetshaperFamily
|
||||
from lib.py import NetDrvEnv
|
||||
from lib.py import NlError
|
||||
|
|
@ -438,6 +441,21 @@ def queue_update(cfg, nl_shaper) -> None:
|
|||
nl_shaper.delete({'ifindex': cfg.ifindex,
|
||||
'handle': {'scope': 'queue', 'id': i}})
|
||||
|
||||
def dup_leaves(cfg, nl_shaper) -> None:
|
||||
""" Ensure that the kernel rejects duplicate leaves. """
|
||||
if not cfg.groups:
|
||||
raise KsftSkipEx("device does not support node scope")
|
||||
|
||||
with ksft_raises(NlError) as cm:
|
||||
nl_shaper.group({
|
||||
'ifindex': cfg.ifindex,
|
||||
'leaves':[{'handle': {'scope': 'queue', 'id': 0}},
|
||||
{'handle': {'scope': 'queue', 'id': 0}}],
|
||||
'handle': {'scope':'node'},
|
||||
'metric': 'bps',
|
||||
'bw-max': 10000})
|
||||
ksft_eq(cm.exception.error, errno.EINVAL)
|
||||
|
||||
def main() -> None:
|
||||
with NetDrvEnv(__file__, queue_count=4) as cfg:
|
||||
cfg.queues = False
|
||||
|
|
@ -453,7 +471,9 @@ def main() -> None:
|
|||
basic_groups,
|
||||
qgroups,
|
||||
delegation,
|
||||
queue_update], args=(cfg, NetshaperFamily()))
|
||||
dup_leaves,
|
||||
queue_update],
|
||||
args=(cfg, NetshaperFamily()))
|
||||
ksft_exit()
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user