tools/testing/selftests/drivers/net/mlxsw/spectrum/devlink_lib_spectrum.sh
Source file repositories/reference/linux-study-clean/tools/testing/selftests/drivers/net/mlxsw/spectrum/devlink_lib_spectrum.sh
File Facts
- System
- Linux kernel
- Corpus path
tools/testing/selftests/drivers/net/mlxsw/spectrum/devlink_lib_spectrum.sh- Extension
.sh- Size
- 2877 bytes
- Lines
- 118
- Domain
- Support Tooling And Documentation
- Bucket
- tools
- Inferred role
- Support Tooling And Documentation: tools
- Status
- atlas-only
Why This File Exists
Repository support layer: documentation, build tooling, samples, user-space helper tools, generated initramfs support, licenses, and validation utilities.
- Repository support layer: documentation, build tooling, samples, user-space helper tools, generated initramfs support, licenses, and validation utilities.
Dependency Surface
- No C-style include directives detected by the generator.
Detected Declarations
- No top-level syscall, struct, function, initcall, or export declaration detected by the generator.
Annotated Snippet
#!/bin/bash
# SPDX-License-Identifier: GPL-2.0
source "../../../../net/forwarding/devlink_lib.sh"
source ../mlxsw_lib.sh
mlxsw_only_on_spectrum 1 || exit 1
# Needed for returning to default
declare -A KVD_DEFAULTS
KVD_CHILDREN="linear hash_single hash_double"
KVDL_CHILDREN="singles chunks large_chunks"
devlink_sp_resource_minimize()
{
local size
local i
for i in $KVD_CHILDREN; do
size=$(devlink_resource_get kvd "$i" | jq '.["size_min"]')
devlink_resource_size_set "$size" kvd "$i"
done
for i in $KVDL_CHILDREN; do
size=$(devlink_resource_get kvd linear "$i" | \
jq '.["size_min"]')
devlink_resource_size_set "$size" kvd linear "$i"
done
}
devlink_sp_size_kvd_to_default()
{
local need_reload=0
local i
for i in $KVD_CHILDREN; do
local size=$(echo "${KVD_DEFAULTS[kvd_$i]}" | jq '.["size"]')
current_size=$(devlink_resource_size_get kvd "$i")
if [ "$size" -ne "$current_size" ]; then
devlink_resource_size_set "$size" kvd "$i"
need_reload=1
fi
done
for i in $KVDL_CHILDREN; do
local size=$(echo "${KVD_DEFAULTS[kvd_linear_$i]}" | \
jq '.["size"]')
current_size=$(devlink_resource_size_get kvd linear "$i")
if [ "$size" -ne "$current_size" ]; then
devlink_resource_size_set "$size" kvd linear "$i"
need_reload=1
fi
done
if [ "$need_reload" -ne "0" ]; then
devlink_reload
fi
}
devlink_sp_read_kvd_defaults()
{
local key
local i
KVD_DEFAULTS[kvd]=$(devlink_resource_get "kvd")
for i in $KVD_CHILDREN; do
key=kvd_$i
Annotation
- Atlas domain: Support Tooling And Documentation / tools.
- Implementation status: atlas-only.
Implementation Notes
- This generated page is the file-by-file coverage layer; curated subsystem chapters should link here when they synthesize a multi-file control flow.
- Core OS pages should be promoted from atlas-only to deep-reviewed when they explain data structures, invariants, locking, lifecycle, and C implementation snippets.
- Driver-family pages are intentionally pattern-oriented unless they are part of the selected PCIe/NVMe representative device path.