tools/testing/selftests/drivers/net/mlxsw/rif_mac_profile_scale.sh
Source file repositories/reference/linux-study-clean/tools/testing/selftests/drivers/net/mlxsw/rif_mac_profile_scale.sh
File Facts
- System
- Linux kernel
- Corpus path
tools/testing/selftests/drivers/net/mlxsw/rif_mac_profile_scale.sh- Extension
.sh- Size
- 1679 bytes
- Lines
- 73
- 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
# Test for RIF MAC profiles resource. The test adds VLAN netdevices according to
# the maximum number of RIF MAC profiles, sets each of them with a random
# MAC address, and checks that eventually the number of occupied RIF MAC
# profiles equals the maximum number of RIF MAC profiles.
RIF_MAC_PROFILE_NUM_NETIFS=2
rif_mac_profiles_create()
{
local count=$1; shift
local should_fail=$1; shift
local batch_file="$(mktemp)"
for ((i = 1; i <= count; i++)); do
vlan=$(( i*10 ))
m=$(( i*11 ))
cat >> $batch_file <<-EOF
link add link $h1 name $h1.$vlan \
address 00:$m:$m:$m:$m:$m type vlan id $vlan
address add 192.0.$m.1/24 dev $h1.$vlan
EOF
done
ip -b $batch_file &> /dev/null
check_err_fail $should_fail $? "RIF creation"
rm -f $batch_file
}
rif_mac_profile_test()
{
local count=$1; shift
local should_fail=$1; shift
rif_mac_profiles_create $count $should_fail
occ=$(devlink -j resource show $DEVLINK_DEV \
| jq '.[][][] | select(.name=="rif_mac_profiles") |.["occ"]')
[[ $occ -eq $count ]]
check_err_fail $should_fail $? "Attempt to use $count profiles (actual result $occ)"
}
rif_mac_profile_setup_prepare()
{
h1=${NETIFS[p1]}
h2=${NETIFS[p2]}
# Disable IPv6 on the two interfaces to avoid IPv6 link-local addresses
# being generated and RIFs being created.
sysctl_set net.ipv6.conf.$h1.disable_ipv6 1
sysctl_set net.ipv6.conf.$h2.disable_ipv6 1
ip link set $h1 up
ip link set $h2 up
}
rif_mac_profile_cleanup()
{
pre_cleanup
ip link set $h2 down
ip link set $h1 down
sysctl_restore net.ipv6.conf.$h2.disable_ipv6
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.