summaryrefslogtreecommitdiff
path: root/tools/lib/python/kdoc/kdoc_files.py
diff options
context:
space:
mode:
authorPetr Machata <petrm@nvidia.com>2025-12-09 16:29:01 +0100
committerJakub Kicinski <kuba@kernel.org>2025-12-11 00:53:15 -0800
commit0842e34849f65dc0aef0c7a0baae1dceb2b8bb33 (patch)
tree548d97e44b856681df64df5e9c079e60a52210f7 /tools/lib/python/kdoc/kdoc_files.py
parent6bcb7727d9e612011b70d64a34401688b986d6ab (diff)
selftests: net: lib: tc_rule_stats_get(): Don't hard-code array index
Flower is commonly used to match on packets in many bash-based selftests. A dump of a flower filter including statistics looks something like this: [ { "protocol": "all", "pref": 49152, "kind": "flower", "chain": 0 }, { ... "options": { ... "actions": [ { ... "stats": { "bytes": 0, "packets": 0, "drops": 0, "overlimits": 0, "requeues": 0, "backlog": 0, "qlen": 0 } } ] } } ] The JQ query in the helper function tc_rule_stats_get() assumes this form and looks for the second element of the array. However, a dump of a u32 filter looks like this: [ { "protocol": "all", "pref": 49151, "kind": "u32", "chain": 0 }, { "protocol": "all", "pref": 49151, "kind": "u32", "chain": 0, "options": { "fh": "800:", "ht_divisor": 1 } }, { ... "options": { ... "actions": [ { ... "stats": { "bytes": 0, "packets": 0, "drops": 0, "overlimits": 0, "requeues": 0, "backlog": 0, "qlen": 0 } } ] } }, ] There's an extra element which the JQ query ends up choosing. Instead of hard-coding a particular index, look for the entry on which a selector .options.actions yields anything. Signed-off-by: Petr Machata <petrm@nvidia.com> Reviewed-by: Ido Schimmel <idosch@nvidia.com> Link: https://patch.msgid.link/12982a44471c834511a0ee6c1e8f57e3a5307105.1765289566.git.petrm@nvidia.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Diffstat (limited to 'tools/lib/python/kdoc/kdoc_files.py')
0 files changed, 0 insertions, 0 deletions