tools/testing/selftests/rdma/rxe_rping_between_netns.sh
Source file repositories/reference/linux-study-clean/tools/testing/selftests/rdma/rxe_rping_between_netns.sh
File Facts
- System
- Linux kernel
- Corpus path
tools/testing/selftests/rdma/rxe_rping_between_netns.sh- Extension
.sh- Size
- 2329 bytes
- Lines
- 93
- 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
# Configuration
NS="test1"
VETH_A="veth-a"
VETH_B="veth-b"
IP_A="1.1.1.1"
IP_B="1.1.1.2"
PORT=4791
source "$(dirname "$0")/../kselftest/ktap_helpers.sh"
exec > /dev/null
# --- Cleanup Routine ---
cleanup() {
echo "Cleaning up resources..."
rdma link del rxe1 2>/dev/null
ip netns exec "$NS" rdma link del rxe0 2>/dev/null
ip link delete "$VETH_B" 2>/dev/null
ip netns del "$NS" 2>/dev/null
modprobe -r rdma_rxe 2>/dev/null
}
trap cleanup EXIT
# --- Prerequisite Checks ---
if [[ $EUID -ne 0 ]]; then
echo "This script must be run as root"
exit 1
fi
if ! modinfo rdma_rxe >/dev/null 2>&1; then
echo "SKIP: Kernel module 'rdma_rxe' not found." >&2
exit $KSFT_SKIP
fi
modprobe rdma_rxe || { echo "Failed to load rdma_rxe"; exit 1; }
# --- Setup Network Topology ---
echo "Setting up network namespace and veth pair..."
ip netns add "$NS"
ip link add "$VETH_A" type veth peer name "$VETH_B"
ip link set "$VETH_A" netns "$NS"
# Configure Namespace side (test1)
ip netns exec "$NS" ip addr add "$IP_A/24" dev "$VETH_A"
ip netns exec "$NS" ip link set "$VETH_A" up
ip netns exec "$NS" ip link set lo up
# Configure Host side
ip addr add "$IP_B/24" dev "$VETH_B"
ip link set "$VETH_B" up
# --- RXE Link Creation ---
echo "Creating RDMA links..."
ip netns exec "$NS" rdma link add rxe0 type rxe netdev "$VETH_A"
rdma link add rxe1 type rxe netdev "$VETH_B"
# Verify UDP 4791 is listening
check_port() {
local target=$1 # "host" or "ns"
if [ "$target" == "ns" ]; then
ip netns exec "$NS" ss -Huln sport == :$PORT | grep -q ":$PORT"
else
ss -Huln sport == :$PORT | grep -q ":$PORT"
fi
}
check_port "ns" || { echo "Error: RXE port not listening in namespace"; exit 1; }
check_port "host" || { echo "Error: RXE port not listening on host"; exit 1; }
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.