tools/testing/selftests/bpf/test_xsk.sh

Source file repositories/reference/linux-study-clean/tools/testing/selftests/bpf/test_xsk.sh

File Facts

System
Linux kernel
Corpus path
tools/testing/selftests/bpf/test_xsk.sh
Extension
.sh
Size
5446 bytes
Lines
247
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.

Dependency Surface

Detected Declarations

Annotated Snippet

function ctrl_c() {
        cleanup_exit ${VETH0} ${VETH1}
	exit 1
}

setup_vethPairs() {
	if [[ $verbose -eq 1 ]]; then
	        echo "setting up ${VETH0}"
	fi
	ip link add ${VETH0} numtxqueues 4 numrxqueues 4 type veth peer name ${VETH1} numtxqueues 4 numrxqueues 4
	if [ -f /proc/net/if_inet6 ]; then
		echo 1 > /proc/sys/net/ipv6/conf/${VETH0}/disable_ipv6
		echo 1 > /proc/sys/net/ipv6/conf/${VETH1}/disable_ipv6
	fi
	if [[ $verbose -eq 1 ]]; then
	        echo "setting up ${VETH1}"
	fi

	if [[ $busy_poll -eq 1 ]]; then
	        echo 2 > /sys/class/net/${VETH0}/napi_defer_hard_irqs
		echo 200000 > /sys/class/net/${VETH0}/gro_flush_timeout
		echo 2 > /sys/class/net/${VETH1}/napi_defer_hard_irqs
		echo 200000 > /sys/class/net/${VETH1}/gro_flush_timeout
	fi

	ip link set ${VETH1} mtu ${MTU}
	ip link set ${VETH0} mtu ${MTU}
	ip link set ${VETH1} up
	ip link set ${VETH0} up
}

if [[ $list -eq 1 ]]; then
        ./${XSKOBJ} -l
        exit
fi

if [[ $help -eq 1 ]]; then
	./${XSKOBJ}
        exit
fi

if [ ! -z $ETH ]; then
	VETH0=${ETH}
	VETH1=${ETH}
else
	validate_root_exec
	validate_veth_support ${VETH0}
	validate_ip_utility
	setup_vethPairs

	retval=$?
	if [ $retval -ne 0 ]; then
		test_status $retval "${TEST_NAME}"
		cleanup_exit ${VETH0} ${VETH1}
		exit $retval
	fi
fi


if [[ $verbose -eq 1 ]]; then
	ARGS+="-v "
fi

if [ -n "$MODE" ]; then
	ARGS+="-m ${MODE} "
fi

if [ -n "$TEST" ]; then
	ARGS+="-t ${TEST} "
fi

Annotation

Implementation Notes