tools/testing/selftests/drivers/net/netdevsim/fib_notifications.sh
Source file repositories/reference/linux-study-clean/tools/testing/selftests/drivers/net/netdevsim/fib_notifications.sh
File Facts
- System
- Linux kernel
- Corpus path
tools/testing/selftests/drivers/net/netdevsim/fib_notifications.sh- Extension
.sh- Size
- 10376 bytes
- Lines
- 431
- 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
lib_dir=$(dirname $0)/../../../net/forwarding
ALL_TESTS="
ipv4_route_addition_test
ipv4_route_deletion_test
ipv4_route_replacement_test
ipv4_route_offload_failed_test
ipv6_route_addition_test
ipv6_route_deletion_test
ipv6_route_replacement_test
ipv6_route_offload_failed_test
"
NETDEVSIM_PATH=/sys/bus/netdevsim/
DEV_ADDR=1337
DEV=netdevsim${DEV_ADDR}
DEVLINK_DEV=netdevsim/${DEV}
SYSFS_NET_DIR=/sys/bus/netdevsim/devices/$DEV/net/
DEBUGFS_DIR=/sys/kernel/debug/netdevsim/$DEV/
NUM_NETIFS=0
source $lib_dir/lib.sh
check_rt_offload_failed()
{
local outfile=$1; shift
local line
# Make sure that the first notification was emitted without
# RTM_F_OFFLOAD_FAILED flag and the second with RTM_F_OFFLOAD_FAILED
# flag
head -n 1 $outfile | grep -q "rt_offload_failed"
if [[ $? -eq 0 ]]; then
return 1
fi
head -n 2 $outfile | tail -n 1 | grep -q "rt_offload_failed"
}
check_rt_trap()
{
local outfile=$1; shift
local line
# Make sure that the first notification was emitted without RTM_F_TRAP
# flag and the second with RTM_F_TRAP flag
head -n 1 $outfile | grep -q "rt_trap"
if [[ $? -eq 0 ]]; then
return 1
fi
head -n 2 $outfile | tail -n 1 | grep -q "rt_trap"
}
route_notify_check()
{
local outfile=$1; shift
local expected_num_lines=$1; shift
local offload_failed=${1:-0}; shift
# check the monitor results
lines=`wc -l $outfile | cut "-d " -f1`
test $lines -eq $expected_num_lines
check_err $? "$expected_num_lines notifications were expected but $lines were received"
if [[ $expected_num_lines -eq 1 ]]; then
return
fi
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.