tools/testing/selftests/net/ecmp_rehash.sh
Source file repositories/reference/linux-study-clean/tools/testing/selftests/net/ecmp_rehash.sh
File Facts
- System
- Linux kernel
- Corpus path
tools/testing/selftests/net/ecmp_rehash.sh- Extension
.sh- Size
- 35284 bytes
- Lines
- 1110
- 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 split
Annotated Snippet
if ($i == "pkt") { print $(i-1); exit }
}'
}
# Read a TcpExt counter from /proc/net/netstat in a namespace.
# Returns 0 if the counter is not found.
get_netstat_counter()
{
local ns=$1; shift
local field=$1; shift
local val
# shellcheck disable=SC2016
val=$(ip netns exec "$ns" awk -v key="$field" '
/^TcpExt:/ {
if (!h) { split($0, n); h=1 }
else {
split($0, v)
for (i in n)
if (n[i] == key) print v[i]
}
}
' /proc/net/netstat)
echo "${val:-0}"
}
# Apply netem ECN marking: CE-mark all ECT packets instead of dropping them.
mark_ecn()
{
local ns=$1; shift
local dev=$1; shift
ip netns exec "$ns" tc qdisc add dev "$dev" root netem loss 100% ecn
}
# Block TCP (IPv6 next-header = 6) egress, allowing ICMPv6 through.
block_tcp()
{
local ns=$1; shift
local dev=$1; shift
ip netns exec "$ns" tc qdisc add dev "$dev" root handle 1: prio
ip netns exec "$ns" tc filter add dev "$dev" parent 1: \
protocol ipv6 prio 1 u32 match u8 0x06 0xff at 6 action drop
}
unblock_tcp()
{
local ns=$1; shift
local dev=$1; shift
ip netns exec "$ns" tc qdisc del dev "$dev" root 2>/dev/null
}
# Return success when a device's TX counter exceeds a baseline value.
dev_tx_packets_above()
{
local ns=$1; shift
local dev=$1; shift
local baseline=$1; shift
local cur
cur=$(link_tx_packets_get "$ns" "$dev")
[ "$cur" -gt "$baseline" ]
}
# Return success when both devices have dropped at least one TCP packet.
both_devs_attempted()
{
local ns=$1; shift
Annotation
- Detected declarations: `function split`.
- 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.