tools/testing/selftests/drivers/net/bonding/bond_options.sh
Source file repositories/reference/linux-study-clean/tools/testing/selftests/drivers/net/bonding/bond_options.sh
File Facts
- System
- Linux kernel
- Corpus path
tools/testing/selftests/drivers/net/bonding/bond_options.sh- Extension
.sh- Size
- 16949 bytes
- Lines
- 579
- 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 bonding options with mode 1,5,6
ALL_TESTS="
prio
arp_validate
num_grat_arp
fail_over_mac
vlan_over_bond
"
lib_dir=$(dirname "$0")
source ${lib_dir}/bond_topo_3d1c.sh
c_maddr="33:33:ff:00:00:10"
g_maddr="33:33:ff:00:02:54"
skip_prio()
{
local skip=1
# check if iproute support prio option
ip -n ${s_ns} link set eth0 type bond_slave prio 10
[[ $? -ne 0 ]] && skip=0
# check if kernel support prio option
ip -n ${s_ns} -d link show eth0 | grep -q "prio 10"
[[ $? -ne 0 ]] && skip=0
return $skip
}
skip_ns()
{
local skip=1
# check if iproute support ns_ip6_target option
ip -n ${s_ns} link add bond1 type bond ns_ip6_target ${g_ip6}
[[ $? -ne 0 ]] && skip=0
# check if kernel support ns_ip6_target option
ip -n ${s_ns} -d link show bond1 | grep -q "ns_ip6_target ${g_ip6}"
[[ $? -ne 0 ]] && skip=0
ip -n ${s_ns} link del bond1
return $skip
}
active_slave=""
active_slave_changed()
{
local old_active_slave=$1
local new_active_slave=$(cmd_jq "ip -n ${s_ns} -d -j link show bond0" \
".[].linkinfo.info_data.active_slave")
[ "$new_active_slave" != "$old_active_slave" -a "$new_active_slave" != "null" ]
}
check_active_slave()
{
local target_active_slave=$1
slowwait 5 active_slave_changed $active_slave
active_slave=$(cmd_jq "ip -n ${s_ns} -d -j link show bond0" ".[].linkinfo.info_data.active_slave")
test "$active_slave" = "$target_active_slave"
check_err $? "Current active slave is $active_slave but not $target_active_slave"
}
# Test bonding prio option
prio_test()
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.