Linux 4.19.133
[linux/fpc-iii.git] / tools / testing / selftests / net / udpgso_bench.sh
blob99e537ab5ad9a3418b0350d7e193e71205608b04
1 #!/bin/bash
2 # SPDX-License-Identifier: GPL-2.0
4 # Run a series of udpgso benchmarks
6 wake_children() {
7 local -r jobs="$(jobs -p)"
9 if [[ "${jobs}" != "" ]]; then
10 kill -1 ${jobs} 2>/dev/null
13 trap wake_children EXIT
15 run_one() {
16 local -r args=$@
18 ./udpgso_bench_rx &
19 ./udpgso_bench_rx -t &
21 ./udpgso_bench_tx ${args}
24 run_in_netns() {
25 local -r args=$@
27 ./in_netns.sh $0 __subprocess ${args}
30 run_udp() {
31 local -r args=$@
33 echo "udp"
34 run_in_netns ${args}
36 echo "udp gso"
37 run_in_netns ${args} -S
40 run_tcp() {
41 local -r args=$@
43 echo "tcp"
44 run_in_netns ${args} -t
46 echo "tcp zerocopy"
47 run_in_netns ${args} -t -z
50 run_all() {
51 local -r core_args="-l 4"
52 local -r ipv4_args="${core_args} -4 -D 127.0.0.1"
53 local -r ipv6_args="${core_args} -6 -D ::1"
55 echo "ipv4"
56 run_tcp "${ipv4_args}"
57 run_udp "${ipv4_args}"
59 echo "ipv6"
60 run_tcp "${ipv4_args}"
61 run_udp "${ipv6_args}"
64 if [[ $# -eq 0 ]]; then
65 run_all
66 elif [[ $1 == "__subprocess" ]]; then
67 shift
68 run_one $@
69 else
70 run_in_netns $@