@@ -7,8 +7,6 @@ source net_helper.sh
7
7
8
8
readonly PEER_NS=" ns-peer-$( mktemp -u XXXXXX) "
9
9
10
- BPF_FILE=" xdp_dummy.bpf.o"
11
-
12
10
# set global exit status, but never reset nonzero one.
13
11
check_err ()
14
12
{
@@ -38,25 +36,27 @@ cfg_veth() {
38
36
ip -netns " ${PEER_NS} " addr add dev veth1 192.168.1.1/24
39
37
ip -netns " ${PEER_NS} " addr add dev veth1 2001:db8::1/64 nodad
40
38
ip -netns " ${PEER_NS} " link set dev veth1 up
41
- ip -n " ${PEER_NS} " link set veth1 xdp object ${BPF_FILE} section xdp
39
+ ip netns exec " ${PEER_NS} " ethtool -K veth1 gro on
42
40
}
43
41
44
42
run_one () {
45
43
# use 'rx' as separator between sender args and receiver args
46
44
local -r all=" $@ "
47
45
local -r tx_args=${all% rx* }
48
46
local -r rx_args=${all#* rx}
47
+ local ret=0
49
48
50
49
cfg_veth
51
50
52
- ip netns exec " ${PEER_NS} " ./udpgso_bench_rx -C 1000 -R 10 ${rx_args} && \
53
- echo " ok" || \
54
- echo " failed" &
51
+ ip netns exec " ${PEER_NS} " ./udpgso_bench_rx -C 1000 -R 10 ${rx_args} &
52
+ local PID1=$!
55
53
56
54
wait_local_port_listen ${PEER_NS} 8000 udp
57
55
./udpgso_bench_tx ${tx_args}
58
- ret=$?
59
- wait $( jobs -p)
56
+ check_err $?
57
+ wait ${PID1}
58
+ check_err $?
59
+ [ " $ret " -eq 0 ] && echo " ok" || echo " failed"
60
60
return $ret
61
61
}
62
62
@@ -73,6 +73,7 @@ run_one_nat() {
73
73
local -r all=" $@ "
74
74
local -r tx_args=${all% rx* }
75
75
local -r rx_args=${all#* rx}
76
+ local ret=0
76
77
77
78
if [[ ${tx_args} = * -4* ]]; then
78
79
ipt_cmd=iptables
@@ -93,16 +94,17 @@ run_one_nat() {
93
94
# ... so that GRO will match the UDP_GRO enabled socket, but packets
94
95
# will land on the 'plain' one
95
96
ip netns exec " ${PEER_NS} " ./udpgso_bench_rx -G ${family} -b ${addr1} -n 0 &
96
- pid=$!
97
- ip netns exec " ${PEER_NS} " ./udpgso_bench_rx -C 1000 -R 10 ${family} -b ${addr2%/* } ${rx_args} && \
98
- echo " ok" || \
99
- echo " failed" &
97
+ local PID1=$!
98
+ ip netns exec " ${PEER_NS} " ./udpgso_bench_rx -C 1000 -R 10 ${family} -b ${addr2%/* } ${rx_args} &
99
+ local PID2=$!
100
100
101
101
wait_local_port_listen " ${PEER_NS} " 8000 udp
102
102
./udpgso_bench_tx ${tx_args}
103
- ret=$?
104
- kill -INT $pid
105
- wait $( jobs -p)
103
+ check_err $?
104
+ kill -INT ${PID1}
105
+ wait ${PID2}
106
+ check_err $?
107
+ [ " $ret " -eq 0 ] && echo " ok" || echo " failed"
106
108
return $ret
107
109
}
108
110
@@ -111,20 +113,26 @@ run_one_2sock() {
111
113
local -r all=" $@ "
112
114
local -r tx_args=${all% rx* }
113
115
local -r rx_args=${all#* rx}
116
+ local ret=0
114
117
115
118
cfg_veth
116
119
117
120
ip netns exec " ${PEER_NS} " ./udpgso_bench_rx -C 1000 -R 10 ${rx_args} -p 12345 &
118
- ip netns exec " ${PEER_NS} " ./udpgso_bench_rx -C 2000 -R 10 ${rx_args} && \
119
- echo " ok " || \
120
- echo " failed " &
121
+ local PID1= $!
122
+ ip netns exec " ${PEER_NS} " ./udpgso_bench_rx -C 2000 -R 10 ${rx_args} &
123
+ local PID2= $!
121
124
122
125
wait_local_port_listen " ${PEER_NS} " 12345 udp
123
126
./udpgso_bench_tx ${tx_args} -p 12345
127
+ check_err $?
124
128
wait_local_port_listen " ${PEER_NS} " 8000 udp
125
129
./udpgso_bench_tx ${tx_args}
126
- ret=$?
127
- wait $( jobs -p)
130
+ check_err $?
131
+ wait ${PID1}
132
+ check_err $?
133
+ wait ${PID2}
134
+ check_err $?
135
+ [ " $ret " -eq 0 ] && echo " ok" || echo " failed"
128
136
return $ret
129
137
}
130
138
@@ -196,11 +204,6 @@ run_all() {
196
204
return $ret
197
205
}
198
206
199
- if [ ! -f ${BPF_FILE} ]; then
200
- echo " Missing ${BPF_FILE} . Run 'make' first"
201
- exit -1
202
- fi
203
-
204
207
if [[ $# -eq 0 ]]; then
205
208
run_all
206
209
elif [[ $1 == " __subprocess" ]]; then
0 commit comments