tools/testing/selftests/drivers/net/netdevsim/udp_tunnel_nic.sh
Source file repositories/reference/linux-study-clean/tools/testing/selftests/drivers/net/netdevsim/udp_tunnel_nic.sh
File Facts
- System
- Linux kernel
- Corpus path
tools/testing/selftests/drivers/net/netdevsim/udp_tunnel_nic.sh- Extension
.sh- Size
- 20131 bytes
- Lines
- 943
- 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-only
VNI_GEN=$RANDOM
NSIM_ID=$((RANDOM % 1024))
NSIM_DEV_SYS=/sys/bus/netdevsim/devices/netdevsim$NSIM_ID
NSIM_DEV_DFS=/sys/kernel/debug/netdevsim/netdevsim$NSIM_ID
NSIM_NETDEV=
HAS_ETHTOOL=
STATIC_ENTRIES=
EXIT_STATUS=0
num_cases=0
num_errors=0
clean_up_devs=( )
function err_cnt {
echo "ERROR:" $@
EXIT_STATUS=1
((num_errors++))
((num_cases++))
}
function pass_cnt {
((num_cases++))
}
function cleanup_tuns {
for dev in "${clean_up_devs[@]}"; do
[ -e /sys/class/net/$dev ] && ip link del dev $dev
done
clean_up_devs=( )
}
function cleanup_nsim {
if [ -e $NSIM_DEV_SYS ]; then
echo $NSIM_ID > /sys/bus/netdevsim/del_device
fi
}
function cleanup {
cleanup_tuns
cleanup_nsim
}
trap cleanup EXIT
function new_vxlan {
local dev=$1
local dstport=$2
local lower=$3
local ipver=$4
local flags=$5
local group ipfl
[ "$ipver" != '6' ] && group=239.1.1.1 || group=fff1::1
[ "$ipver" != '6' ] || ipfl="-6"
[[ ! "$flags" =~ "external" ]] && flags="$flags id $((VNI_GEN++))"
ip $ipfl link add $dev type vxlan \
group $group \
dev $lower \
dstport $dstport \
$flags
ip link set dev $dev up
clean_up_devs=("${clean_up_devs[@]}" $dev)
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.