~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/tools/testing/selftests/net/udpgro_bench.sh

Version: ~ [ linux-6.11.5 ] ~ [ linux-6.10.14 ] ~ [ linux-6.9.12 ] ~ [ linux-6.8.12 ] ~ [ linux-6.7.12 ] ~ [ linux-6.6.58 ] ~ [ linux-6.5.13 ] ~ [ linux-6.4.16 ] ~ [ linux-6.3.13 ] ~ [ linux-6.2.16 ] ~ [ linux-6.1.114 ] ~ [ linux-6.0.19 ] ~ [ linux-5.19.17 ] ~ [ linux-5.18.19 ] ~ [ linux-5.17.15 ] ~ [ linux-5.16.20 ] ~ [ linux-5.15.169 ] ~ [ linux-5.14.21 ] ~ [ linux-5.13.19 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.228 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.284 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.322 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.336 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.337 ] ~ [ linux-4.4.302 ] ~ [ linux-3.10.108 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.9 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

  1 #!/bin/bash
  2 # SPDX-License-Identifier: GPL-2.0
  3 #
  4 # Run a series of udpgro benchmarks
  5 
  6 source net_helper.sh
  7 
  8 readonly PEER_NS="ns-peer-$(mktemp -u XXXXXX)"
  9 
 10 BPF_FILE="xdp_dummy.bpf.o"
 11 
 12 cleanup() {
 13         local -r jobs="$(jobs -p)"
 14         local -r ns="$(ip netns list|grep $PEER_NS)"
 15 
 16         [ -n "${jobs}" ] && kill -INT ${jobs} 2>/dev/null
 17         [ -n "$ns" ] && ip netns del $ns 2>/dev/null
 18 }
 19 trap cleanup EXIT
 20 
 21 run_one() {
 22         # use 'rx' as separator between sender args and receiver args
 23         local -r all="$@"
 24         local -r tx_args=${all%rx*}
 25         local rx_args=${all#*rx}
 26 
 27         [[ "${tx_args}" == *"-4"* ]] && rx_args="${rx_args} -4"
 28 
 29         ip netns add "${PEER_NS}"
 30         ip -netns "${PEER_NS}" link set lo up
 31         ip link add type veth
 32         ip link set dev veth0 up
 33         ip addr add dev veth0 192.168.1.2/24
 34         ip addr add dev veth0 2001:db8::2/64 nodad
 35 
 36         ip link set dev veth1 netns "${PEER_NS}"
 37         ip -netns "${PEER_NS}" addr add dev veth1 192.168.1.1/24
 38         ip -netns "${PEER_NS}" addr add dev veth1 2001:db8::1/64 nodad
 39         ip -netns "${PEER_NS}" link set dev veth1 up
 40 
 41         ip -n "${PEER_NS}" link set veth1 xdp object ${BPF_FILE} section xdp
 42         ip netns exec "${PEER_NS}" ./udpgso_bench_rx ${rx_args} -r &
 43         ip netns exec "${PEER_NS}" ./udpgso_bench_rx -t ${rx_args} -r &
 44 
 45         wait_local_port_listen "${PEER_NS}" 8000 udp
 46         ./udpgso_bench_tx ${tx_args}
 47 }
 48 
 49 run_in_netns() {
 50         local -r args=$@
 51 
 52         ./in_netns.sh $0 __subprocess ${args}
 53 }
 54 
 55 run_udp() {
 56         local -r args=$@
 57 
 58         echo "udp gso - over veth touching data"
 59         run_in_netns ${args} -S 0 rx
 60 
 61         echo "udp gso and gro - over veth touching data"
 62         run_in_netns ${args} -S 0 rx -G
 63 }
 64 
 65 run_tcp() {
 66         local -r args=$@
 67 
 68         echo "tcp - over veth touching data"
 69         run_in_netns ${args} -t rx
 70 }
 71 
 72 run_all() {
 73         local -r core_args="-l 4"
 74         local -r ipv4_args="${core_args} -4 -D 192.168.1.1"
 75         local -r ipv6_args="${core_args} -6 -D 2001:db8::1"
 76 
 77         echo "ipv4"
 78         run_tcp "${ipv4_args}"
 79         run_udp "${ipv4_args}"
 80 
 81         echo "ipv6"
 82         run_tcp "${ipv4_args}"
 83         run_udp "${ipv6_args}"
 84 }
 85 
 86 if [ ! -f ${BPF_FILE} ]; then
 87         echo "Missing ${BPF_FILE}. Run 'make' first"
 88         exit -1
 89 fi
 90 
 91 if [[ $# -eq 0 ]]; then
 92         run_all
 93 elif [[ $1 == "__subprocess" ]]; then
 94         shift
 95         run_one $@
 96 else
 97         run_in_netns $@
 98 fi

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

sflogo.php