Skip to content

Commit aaad5ba

Browse files
committed
netns: test 4 parallel streams
In order to test ndo_start_xmit being called in parallel, explicitly add 4 separate tests, which should all run on different cores. This should help tease out bugs associated with queueing up packets from different cores in parallel. Currently, it hasn't found those types of bugs, but given future planned work, this is a useful regression to avoid. Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
1 parent 8420c79 commit aaad5ba

File tree

1 file changed

+17
-1
lines changed

1 file changed

+17
-1
lines changed

src/tests/netns.sh

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ ip0() { pretty 0 "ip $*"; ip -n $netns0 "$@"; }
4040
ip1() { pretty 1 "ip $*"; ip -n $netns1 "$@"; }
4141
ip2() { pretty 2 "ip $*"; ip -n $netns2 "$@"; }
4242
sleep() { read -t "$1" -N 1 || true; }
43-
waitiperf() { pretty "${1//*-}" "wait for iperf:5201 pid $2"; while [[ $(ss -N "$1" -tlpH 'sport = 5201') != *\"iperf3\",pid=$2,fd=* ]]; do sleep 0.1; done; }
43+
waitiperf() { pretty "${1//*-}" "wait for iperf:${3:-5201} pid $2"; while [[ $(ss -N "$1" -tlpH "sport = ${3:-5201}") != *\"iperf3\",pid=$2,fd=* ]]; do sleep 0.1; done; }
4444
waitncatudp() { pretty "${1//*-}" "wait for udp:1111 pid $2"; while [[ $(ss -N "$1" -ulpH 'sport = 1111') != *\"ncat\",pid=$2,fd=* ]]; do sleep 0.1; done; }
4545
waitiface() { pretty "${1//*-}" "wait for $2 to come up"; ip netns exec "$1" bash -c "while [[ \$(< \"/sys/class/net/$2/operstate\") != up ]]; do read -t .1 -N 0 || true; done;"; }
4646

@@ -142,6 +142,22 @@ tests() {
142142
n2 iperf3 -s -1 -B fd00::2 &
143143
waitiperf $netns2 $!
144144
n1 iperf3 -Z -t 3 -b 0 -u -c fd00::2
145+
146+
# TCP over IPv4 x 4
147+
local pids=( )
148+
n2 iperf3 -p 5201 -s -1 -B 192.168.241.2 &
149+
pids+=( $! ); waitiperf $netns2 $! 5201
150+
n2 iperf3 -p 5202 -s -1 -B 192.168.241.2 &
151+
pids+=( $! ); waitiperf $netns2 $! 5202
152+
n2 iperf3 -p 5203 -s -1 -B 192.168.241.2 &
153+
pids+=( $! ); waitiperf $netns2 $! 5203
154+
n2 iperf3 -p 5204 -s -1 -B 192.168.241.2 &
155+
pids+=( $! ); waitiperf $netns2 $! 5204
156+
n1 iperf3 -Z -t 5 -p 5201 -c 192.168.241.2 &
157+
n1 iperf3 -Z -t 5 -p 5202 -c 192.168.241.2 &
158+
n1 iperf3 -Z -t 5 -p 5203 -c 192.168.241.2 &
159+
n1 iperf3 -Z -t 5 -p 5204 -c 192.168.241.2 &
160+
wait "${pids[@]}"
145161
}
146162

147163
[[ $(ip1 link show dev wg0) =~ mtu\ ([0-9]+) ]] && orig_mtu="${BASH_REMATCH[1]}"

0 commit comments

Comments
 (0)