• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1#!/bin/bash
2# SPDX-License-Identifier: GPL-2.0
3#
4# Run a series of udpgso benchmarks
5
6wake_children() {
7	local -r jobs="$(jobs -p)"
8
9	if [[ "${jobs}" != "" ]]; then
10		kill -1 ${jobs} 2>/dev/null
11	fi
12}
13trap wake_children EXIT
14
15run_one() {
16	local -r args=$@
17
18	./udpgso_bench_rx &
19	./udpgso_bench_rx -t &
20
21	./udpgso_bench_tx ${args}
22}
23
24run_in_netns() {
25	local -r args=$@
26
27	./in_netns.sh $0 __subprocess ${args}
28}
29
30run_udp() {
31	local -r args=$@
32
33	echo "udp"
34	run_in_netns ${args}
35
36	echo "udp gso"
37	run_in_netns ${args} -S
38}
39
40run_tcp() {
41	local -r args=$@
42
43	echo "tcp"
44	run_in_netns ${args} -t
45
46	echo "tcp zerocopy"
47	run_in_netns ${args} -t -z
48}
49
50run_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"
54
55	echo "ipv4"
56	run_tcp "${ipv4_args}"
57	run_udp "${ipv4_args}"
58
59	echo "ipv6"
60	run_tcp "${ipv4_args}"
61	run_udp "${ipv6_args}"
62}
63
64if [[ $# -eq 0 ]]; then
65	run_all
66elif [[ $1 == "__subprocess" ]]; then
67	shift
68	run_one $@
69else
70	run_in_netns $@
71fi
72