tools/testing/selftests/net/vlan_hw_filter.sh
Source file repositories/reference/linux-study-clean/tools/testing/selftests/net/vlan_hw_filter.sh
File Facts
- System
- Linux kernel
- Corpus path
tools/testing/selftests/net/vlan_hw_filter.sh- Extension
.sh- Size
- 3245 bytes
- Lines
- 104
- 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
function fail
Annotated Snippet
#!/bin/sh
# SPDX-License-Identifier: GPL-2.0
readonly NETNS="ns-$(mktemp -u XXXXXX)"
ALL_TESTS="
test_vlan_filter_check
test_vlan0_del_crash_01
test_vlan0_del_crash_02
test_vlan0_del_crash_03
test_vid0_memleak
"
ret=0
setup() {
ip netns add ${NETNS}
}
cleanup() {
ip netns del $NETNS 2>/dev/null
}
trap cleanup EXIT
fail() {
echo "ERROR: ${1:-unexpected return code} (ret: $_)" >&2
ret=1
}
tests_run()
{
local current_test
for current_test in ${TESTS:-$ALL_TESTS}; do
$current_test
done
}
test_vlan_filter_check() {
setup
ip netns exec ${NETNS} ip link add bond0 type bond mode 0
ip netns exec ${NETNS} ip link add bond_slave_1 type veth peer veth2
ip netns exec ${NETNS} ip link set bond_slave_1 master bond0
ip netns exec ${NETNS} ethtool -K bond0 rx-vlan-filter off
ip netns exec ${NETNS} ip link add link bond_slave_1 name bond_slave_1.0 type vlan id 0
ip netns exec ${NETNS} ip link add link bond0 name bond0.0 type vlan id 0
ip netns exec ${NETNS} ip link set bond_slave_1 nomaster
ip netns exec ${NETNS} ip link del veth2 || fail "Please check vlan HW filter function"
cleanup
}
#enable vlan_filter feature of real_dev with vlan0 during running time
test_vlan0_del_crash_01() {
setup
ip netns exec ${NETNS} ip link add bond0 type bond mode 0
ip netns exec ${NETNS} ip link add link bond0 name vlan0 type vlan id 0 protocol 802.1q
ip netns exec ${NETNS} ethtool -K bond0 rx-vlan-filter off
ip netns exec ${NETNS} ip link set dev bond0 up
ip netns exec ${NETNS} ethtool -K bond0 rx-vlan-filter on
ip netns exec ${NETNS} ip link set dev bond0 down
ip netns exec ${NETNS} ip link set dev bond0 up
ip netns exec ${NETNS} ip link del vlan0 || fail "Please check vlan HW filter function"
cleanup
}
#enable vlan_filter feature and add vlan0 for real_dev during running time
test_vlan0_del_crash_02() {
setup
ip netns exec ${NETNS} ip link add bond0 type bond mode 0
ip netns exec ${NETNS} ethtool -K bond0 rx-vlan-filter off
Annotation
- Detected declarations: `function fail`.
- 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.