mirror of
https://github.com/torvalds/linux.git
synced 2026-09-22 04:34:03 +02:00
selftests: net: shaper: Add node scope .set rate update test
Add set_node_shaper to test updating a NODE scope shaper's rate via the .set callback. Creates a node group with bw_max=10000, updates to 20000 via .set, and verifies the change. Signed-off-by: Mohsin Bashir <hmohsin@meta.com> Link: https://patch.msgid.link/20260805030936.1092907-6-mohsin.bashr@gmail.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
This commit is contained in:
parent
ff0c37b8c1
commit
212410dc81
|
|
@ -343,6 +343,43 @@ def qgroups(cfg, nl_shaper) -> None:
|
|||
shapers = nl_shaper.get({'ifindex': cfg.ifindex}, dump=True)
|
||||
ksft_eq(len(shapers), 0)
|
||||
|
||||
def set_node_shaper(cfg, nl_shaper) -> None:
|
||||
""" Verify a node-scope shaper rate can be updated via .set. """
|
||||
_require_queues(cfg, 2)
|
||||
_require_caps(cfg, nl_shaper, 'node', ['support-bw-max', 'support-metric-bps'],
|
||||
"device does not support node scope shapers with bw_max and metric bps")
|
||||
_require_caps(cfg, nl_shaper, 'queue', ['support-nesting', 'support-weight'],
|
||||
"device does not support nested queue scope shapers with weight")
|
||||
|
||||
node_handle = nl_shaper.group({
|
||||
'ifindex': cfg.ifindex,
|
||||
'leaves':[{'handle': {'scope': 'queue', 'id': 1},
|
||||
'weight': 1}],
|
||||
'handle': {'scope':'node'},
|
||||
'metric': 'bps',
|
||||
'bw-max': 10000})
|
||||
node_id = node_handle['handle']['id']
|
||||
defer(_delete_shaper, cfg, nl_shaper, {'scope': 'queue', 'id': 1})
|
||||
|
||||
# Update the node's rate via .set
|
||||
nl_shaper.set({'ifindex': cfg.ifindex,
|
||||
'handle': {'scope': 'node', 'id': node_id},
|
||||
'metric': 'bps',
|
||||
'bw-max': 20000})
|
||||
|
||||
shaper = nl_shaper.get({'ifindex': cfg.ifindex,
|
||||
'handle': {'scope': 'node', 'id': node_id}})
|
||||
ksft_eq(shaper, {'ifindex': cfg.ifindex,
|
||||
'handle': {'scope': 'node', 'id': node_id},
|
||||
'parent': {'scope': 'netdev'},
|
||||
'metric': 'bps',
|
||||
'bw-max': 20000})
|
||||
|
||||
# Cleanup
|
||||
_delete_shaper(cfg, nl_shaper, {'scope': 'queue', 'id': 1})
|
||||
shapers = nl_shaper.get({'ifindex': cfg.ifindex}, dump=True)
|
||||
ksft_eq(len(shapers), 0)
|
||||
|
||||
def delegation(cfg, nl_shaper) -> None:
|
||||
_require_queues(cfg, 4)
|
||||
_require_caps(cfg, nl_shaper, 'node',
|
||||
|
|
@ -542,6 +579,7 @@ def main() -> None:
|
|||
basic_groups,
|
||||
basic_groups_with_rate,
|
||||
qgroups,
|
||||
set_node_shaper,
|
||||
delegation,
|
||||
dup_leaves,
|
||||
queue_update],
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user