aboutsummaryrefslogtreecommitdiffstats
path: root/tools/testing/selftests/net/fin_ack_lat.sh
diff options
context:
space:
mode:
authorSeongJae Park <sjpark@amazon.de>2020-02-02 03:38:27 +0000
committerJakub Kicinski <kuba@kernel.org>2020-02-02 13:33:21 -0800
commitaf8c8a450bf4698a8a6a7c68956ea5ccafe4cc88 (patch)
tree32f2b03562a1bc6e2e0f725d7ff6ce15048be19f /tools/testing/selftests/net/fin_ack_lat.sh
parenttcp: Reduce SYN resend delay if a suspicous ACK is received (diff)
downloadlinux-dev-af8c8a450bf4698a8a6a7c68956ea5ccafe4cc88.tar.xz
linux-dev-af8c8a450bf4698a8a6a7c68956ea5ccafe4cc88.zip
selftests: net: Add FIN_ACK processing order related latency spike test
This commit adds a test for FIN_ACK process races related reconnection latency spike issues. The issue has described and solved by the previous commit ("tcp: Reduce SYN resend delay if a suspicous ACK is received"). The test program is configured with a server and a client process. The server creates and binds a socket to a port that dynamically allocated, listen on it, and start a infinite loop. Inside the loop, it accepts connection, reads 4 bytes from the socket, and closes the connection. The client is constructed as an infinite loop. Inside the loop, it creates a socket with LINGER and NODELAY option, connect to the server, send 4 bytes data, try read some data from server. After the read() returns, it measure the latency from the beginning of this loop to this point and if the latency is larger than 1 second (spike), print a message. Reviewed-by: Eric Dumazet <edumazet@google.com> Signed-off-by: SeongJae Park <sjpark@amazon.de> Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Diffstat (limited to '')
-rwxr-xr-xtools/testing/selftests/net/fin_ack_lat.sh35
1 files changed, 35 insertions, 0 deletions
diff --git a/tools/testing/selftests/net/fin_ack_lat.sh b/tools/testing/selftests/net/fin_ack_lat.sh
new file mode 100755
index 000000000000..a3ff6e0b2c7a
--- /dev/null
+++ b/tools/testing/selftests/net/fin_ack_lat.sh
@@ -0,0 +1,35 @@
+#!/bin/bash
+# SPDX-License-Identifier: GPL-2.0
+#
+# Test latency spikes caused by FIN/ACK handling race.
+
+set +x
+set -e
+
+tmpfile=$(mktemp /tmp/fin_ack_latency.XXXX.log)
+
+cleanup() {
+ kill $(pidof fin_ack_lat)
+ rm -f $tmpfile
+}
+
+trap cleanup EXIT
+
+do_test() {
+ RUNTIME=$1
+
+ ./fin_ack_lat | tee $tmpfile &
+ PID=$!
+
+ sleep $RUNTIME
+ NR_SPIKES=$(wc -l $tmpfile | awk '{print $1}')
+ if [ $NR_SPIKES -gt 0 ]
+ then
+ echo "FAIL: $NR_SPIKES spikes detected"
+ return 1
+ fi
+ return 0
+}
+
+do_test "30"
+echo "test done"