Skip to content

Commit e874be2

Browse files
wdebruijkuba-moo
authored andcommitted
selftests/net: packetdrill: import tcp/slow_start
Same import process as previous tests. Also add CONFIG_NET_SCH_FQ to config, as one test uses that. Same test process as previous tests. Both with and without debug mode. Recording the steps once: make mrproper vng --build \ --config tools/testing/selftests/net/packetdrill/config \ --config kernel/configs/debug.config vng -v --run . --user root --cpus 4 -- \ make -C tools/testing/selftests TARGETS=net/packetdrill run_tests Link: https://github.com/linux-netdev/nipa/wiki/How-to-run-netdev-selftests-CI-style#how-to-build Signed-off-by: Willem de Bruijn <[email protected]> Acked-by: Matthieu Baerts (NGI0) <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Jakub Kicinski <[email protected]>
1 parent 1e42f73 commit e874be2

11 files changed

+427
-0
lines changed

tools/testing/selftests/net/packetdrill/config

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ CONFIG_HZ_1000=y
33
CONFIG_HZ=1000
44
CONFIG_NET_NS=y
55
CONFIG_NET_SCH_FIFO=y
6+
CONFIG_NET_SCH_FQ=y
67
CONFIG_PROC_SYSCTL=y
78
CONFIG_SYN_COOKIES=y
89
CONFIG_TCP_CONG_CUBIC=y
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
// SPDX-License-Identifier: GPL-2.0
2+
// Test of slow start when not application-limited, so that
3+
// the cwnd continues to grow.
4+
// In this variant, the receiver ACKs every packet.
5+
6+
// Set up config. To keep things simple, disable the
7+
// mechanism that defers sending in order to send bigger TSO packets.
8+
`./defaults.sh
9+
sysctl -q net.ipv4.tcp_tso_win_divisor=100`
10+
11+
0 socket(..., SOCK_STREAM, IPPROTO_TCP) = 3
12+
+0 setsockopt(3, SOL_SOCKET, SO_REUSEADDR, [1], 4) = 0
13+
+0 bind(3, ..., ...) = 0
14+
+0 listen(3, 1) = 0
15+
16+
+.1 < S 0:0(0) win 32792 <mss 1000,sackOK,nop,nop,nop,wscale 7>
17+
+0 > S. 0:0(0) ack 1 <mss 1460,nop,nop,sackOK,nop,wscale 8>
18+
+.1 < . 1:1(0) ack 1 win 257
19+
+0 accept(3, ..., ...) = 4
20+
+0 setsockopt(4, SOL_SOCKET, SO_SNDBUF, [200000], 4) = 0
21+
22+
+0 write(4, ..., 30000) = 30000
23+
+0 > P. 1:10001(10000) ack 1
24+
+0 %{ assert tcpi_snd_cwnd == 10, tcpi_snd_cwnd }%
25+
26+
+.105 < . 1:1(0) ack 1001 win 257
27+
+0 > P. 10001:12001(2000) ack 1
28+
29+
+0 < . 1:1(0) ack 2001 win 257
30+
+0 > P. 12001:14001(2000) ack 1
31+
32+
+.005 < . 1:1(0) ack 3001 win 257
33+
+0 > P. 14001:16001(2000) ack 1
34+
35+
+0 < . 1:1(0) ack 4001 win 257
36+
+0 > P. 16001:18001(2000) ack 1
37+
38+
+.005 < . 1:1(0) ack 5001 win 257
39+
+0 > P. 18001:20001(2000) ack 1
40+
41+
+0 < . 1:1(0) ack 6001 win 257
42+
+0 > P. 20001:22001(2000) ack 1
43+
44+
+.005 < . 1:1(0) ack 7001 win 257
45+
+0 > P. 22001:24001(2000) ack 1
46+
47+
+0 < . 1:1(0) ack 8001 win 257
48+
+0 > P. 24001:26001(2000) ack 1
49+
50+
+.005 < . 1:1(0) ack 9001 win 257
51+
+0 > P. 26001:28001(2000) ack 1
52+
53+
+0 < . 1:1(0) ack 10001 win 257
54+
+0 > P. 28001:30001(2000) ack 1
55+
56+
+0 %{ assert tcpi_snd_cwnd == 20, tcpi_snd_cwnd }%
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
// SPDX-License-Identifier: GPL-2.0
2+
// Test of slow start when an outstanding flight of packets is
3+
// less than the current cwnd, and not big enough to bump up cwnd.
4+
//
5+
// In this variant, the receiver ACKs every other packet,
6+
// approximating standard delayed ACKs.
7+
8+
// Set up config.
9+
`./defaults.sh`
10+
11+
0 socket(..., SOCK_STREAM, IPPROTO_TCP) = 3
12+
+0 setsockopt(3, SOL_SOCKET, SO_REUSEADDR, [1], 4) = 0
13+
+0 bind(3, ..., ...) = 0
14+
+0 listen(3, 1) = 0
15+
16+
+0 < S 0:0(0) win 32792 <mss 1000,sackOK,nop,nop,nop,wscale 7>
17+
+0 > S. 0:0(0) ack 1 <mss 1460,nop,nop,sackOK,nop,wscale 8>
18+
+0 < . 1:1(0) ack 1 win 257
19+
+0 accept(3, ..., ...) = 4
20+
21+
// Only send 5 packets.
22+
+0 write(4, ..., 5000) = 5000
23+
+0 > P. 1:5001(5000) ack 1
24+
+0 %{ assert tcpi_snd_cwnd == 10, tcpi_snd_cwnd }%
25+
26+
+0 < . 1:1(0) ack 2001 win 257
27+
+0 %{ assert tcpi_snd_cwnd == 10, 'cwnd=%d' % tcpi_snd_cwnd }%
28+
29+
+0 < . 1:1(0) ack 4001 win 257
30+
+0 %{ assert tcpi_snd_cwnd == 10, 'cwnd=%d' % tcpi_snd_cwnd }%
31+
32+
+0 < . 1:1(0) ack 5001 win 257
33+
+0 %{ assert tcpi_snd_cwnd == 10, 'cwnd=%d' % tcpi_snd_cwnd }%
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
// SPDX-License-Identifier: GPL-2.0
2+
// Test of slow start when an outstanding flight of packets is
3+
// less than the current cwnd, but still big enough that in slow
4+
// start we want to increase our cwnd a little.
5+
//
6+
// In this variant, the receiver ACKs every other packet,
7+
// approximating standard delayed ACKs.
8+
9+
// Set up config.
10+
`./defaults.sh`
11+
12+
0 socket(..., SOCK_STREAM, IPPROTO_TCP) = 3
13+
+0 setsockopt(3, SOL_SOCKET, SO_REUSEADDR, [1], 4) = 0
14+
+0 bind(3, ..., ...) = 0
15+
+0 listen(3, 1) = 0
16+
17+
+0 < S 0:0(0) win 32792 <mss 1000,sackOK,nop,nop,nop,wscale 7>
18+
+0 > S. 0:0(0) ack 1 <mss 1460,nop,nop,sackOK,nop,wscale 8>
19+
+0 < . 1:1(0) ack 1 win 257
20+
+0 accept(3, ..., ...) = 4
21+
22+
// Only send 6 packets.
23+
+0 write(4, ..., 6000) = 6000
24+
+0 > P. 1:6001(6000) ack 1
25+
+0 %{ assert tcpi_snd_cwnd == 10, tcpi_snd_cwnd }%
26+
27+
+0 < . 1:1(0) ack 2001 win 257
28+
+0 %{ assert tcpi_snd_cwnd == 12, 'cwnd=%d' % tcpi_snd_cwnd }%
29+
30+
+0 < . 1:1(0) ack 4001 win 257
31+
+0 %{ assert tcpi_snd_cwnd == 12, 'cwnd=%d' % tcpi_snd_cwnd }%
32+
33+
+0 < . 1:1(0) ack 6001 win 257
34+
+0 %{ assert tcpi_snd_cwnd == 12, 'cwnd=%d' % tcpi_snd_cwnd }%
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
// SPDX-License-Identifier: GPL-2.0
2+
// Test of slow start when not application-limited, so that
3+
// the cwnd continues to grow.
4+
// In this variant, the receiver ACKs every other packet,
5+
// approximating standard delayed ACKs.
6+
7+
// Set up config. To keep things simple, disable the
8+
// mechanism that defers sending in order to send bigger TSO packets.
9+
`./defaults.sh
10+
sysctl -q net.ipv4.tcp_tso_win_divisor=100`
11+
12+
0 socket(..., SOCK_STREAM, IPPROTO_TCP) = 3
13+
+0 setsockopt(3, SOL_SOCKET, SO_REUSEADDR, [1], 4) = 0
14+
+0 bind(3, ..., ...) = 0
15+
+0 listen(3, 1) = 0
16+
17+
+.1 < S 0:0(0) win 32792 <mss 1000,sackOK,nop,nop,nop,wscale 7>
18+
+0 > S. 0:0(0) ack 1 <mss 1460,nop,nop,sackOK,nop,wscale 8>
19+
+.1 < . 1:1(0) ack 1 win 257
20+
+0 accept(3, ..., ...) = 4
21+
+0 setsockopt(4, SOL_SOCKET, SO_SNDBUF, [200000], 4) = 0
22+
23+
+0 write(4, ..., 30000) = 30000
24+
+0 > P. 1:10001(10000) ack 1
25+
+0 %{ assert tcpi_snd_cwnd == 10, tcpi_snd_cwnd }%
26+
27+
+.105 < . 1:1(0) ack 2001 win 257
28+
+0 > P. 10001:14001(4000) ack 1
29+
30+
+.005 < . 1:1(0) ack 4001 win 257
31+
+0 > P. 14001:18001(4000) ack 1
32+
33+
+.005 < . 1:1(0) ack 6001 win 257
34+
+0 > P. 18001:22001(4000) ack 1
35+
36+
+.005 < . 1:1(0) ack 8001 win 257
37+
+0 > P. 22001:26001(4000) ack 1
38+
39+
+.005 < . 1:1(0) ack 10001 win 257
40+
+0 > P. 26001:30001(4000) ack 1
41+
42+
+0 %{ assert tcpi_snd_cwnd == 20, tcpi_snd_cwnd }%
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
// SPDX-License-Identifier: GPL-2.0
2+
// Test of slow start when not application-limited, so that
3+
// the cwnd continues to grow.
4+
// In this variant, the receiver sends one ACK per 4 packets.
5+
6+
// Set up config. To keep things simple, disable the
7+
// mechanism that defers sending in order to send bigger TSO packets.
8+
`./defaults.sh
9+
sysctl -q net.ipv4.tcp_tso_win_divisor=100`
10+
11+
0 socket(..., SOCK_STREAM, IPPROTO_TCP) = 3
12+
+0 setsockopt(3, SOL_SOCKET, SO_REUSEADDR, [1], 4) = 0
13+
+0 bind(3, ..., ...) = 0
14+
+0 listen(3, 1) = 0
15+
16+
+.1 < S 0:0(0) win 32792 <mss 1000,sackOK,nop,nop,nop,wscale 7>
17+
+0 > S. 0:0(0) ack 1 <mss 1460,nop,nop,sackOK,nop,wscale 8>
18+
+.1 < . 1:1(0) ack 1 win 257
19+
+0 accept(3, ..., ...) = 4
20+
+0 setsockopt(4, SOL_SOCKET, SO_SNDBUF, [200000], 4) = 0
21+
22+
+0 write(4, ..., 30000) = 30000
23+
+0 > P. 1:10001(10000) ack 1
24+
+0 %{ assert tcpi_snd_cwnd == 10, tcpi_snd_cwnd }%
25+
26+
+.11 < . 1:1(0) ack 4001 win 257
27+
+0 > P. 10001:18001(8000) ack 1
28+
29+
+.01 < . 1:1(0) ack 8001 win 257
30+
+0 > P. 18001:26001(8000) ack 1
31+
32+
+.005 < . 1:1(0) ack 10001 win 257
33+
+0 > P. 26001:30001(4000) ack 1
34+
35+
+0 %{ assert tcpi_snd_cwnd == 20, tcpi_snd_cwnd }%
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
// SPDX-License-Identifier: GPL-2.0
2+
// Test of slow start after idle
3+
// This test expects tso size to be at least initial cwnd * mss
4+
5+
`./defaults.sh
6+
./set_sysctls.py /proc/sys/net/ipv4/tcp_slow_start_after_idle=1 \
7+
/proc/sys/net/ipv4/tcp_min_tso_segs=10`
8+
9+
0 socket(..., SOCK_STREAM, IPPROTO_TCP) = 3
10+
+0 setsockopt(3, SOL_SOCKET, SO_REUSEADDR, [1], 4) = 0
11+
+0 bind(3, ..., ...) = 0
12+
+0 listen(3, 1) = 0
13+
14+
+0 < S 0:0(0) win 65535 <mss 1000,sackOK,nop,nop,nop,wscale 7>
15+
+0 > S. 0:0(0) ack 1 <mss 1460,nop,nop,sackOK,nop,wscale 8>
16+
+.1 < . 1:1(0) ack 1 win 511
17+
+0 accept(3, ..., ...) = 4
18+
+0 setsockopt(4, SOL_SOCKET, SO_SNDBUF, [200000], 4) = 0
19+
20+
+0 write(4, ..., 26000) = 26000
21+
+0 > P. 1:5001(5000) ack 1
22+
+0 > P. 5001:10001(5000) ack 1
23+
+0 %{ assert tcpi_snd_cwnd == 10, tcpi_snd_cwnd }%
24+
25+
+.1 < . 1:1(0) ack 10001 win 511
26+
+0 %{ assert tcpi_snd_cwnd == 20, tcpi_snd_cwnd }%
27+
+0 > P. 10001:20001(10000) ack 1
28+
+0 > P. 20001:26001(6000) ack 1
29+
30+
+.1 < . 1:1(0) ack 26001 win 511
31+
+0 %{ assert tcpi_snd_cwnd == 36, tcpi_snd_cwnd }%
32+
33+
+2 write(4, ..., 20000) = 20000
34+
// If slow start after idle works properly, we should send 5 MSS here (cwnd/2)
35+
+0 > P. 26001:31001(5000) ack 1
36+
+0 %{ assert tcpi_snd_cwnd == 10, tcpi_snd_cwnd }%
37+
38+
// Reset sysctls
39+
`/tmp/sysctl_restore_${PPID}.sh`
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
// SPDX-License-Identifier: GPL-2.0
2+
// Test of slow start after window update
3+
// This test expects tso size to be at least initial cwnd * mss
4+
5+
`./defaults.sh
6+
./set_sysctls.py /proc/sys/net/ipv4/tcp_slow_start_after_idle=1 \
7+
/proc/sys/net/ipv4/tcp_min_tso_segs=10`
8+
9+
0 socket(..., SOCK_STREAM, IPPROTO_TCP) = 3
10+
+0 setsockopt(3, SOL_SOCKET, SO_REUSEADDR, [1], 4) = 0
11+
+0 bind(3, ..., ...) = 0
12+
+0 listen(3, 1) = 0
13+
14+
+0 < S 0:0(0) win 65535 <mss 1000,sackOK,nop,nop,nop,wscale 7>
15+
+0 > S. 0:0(0) ack 1 <mss 1460,nop,nop,sackOK,nop,wscale 8>
16+
+.1 < . 1:1(0) ack 1 win 511
17+
+0 accept(3, ..., ...) = 4
18+
+0 setsockopt(4, SOL_SOCKET, SO_SNDBUF, [200000], 4) = 0
19+
20+
+0 write(4, ..., 26000) = 26000
21+
+0 > P. 1:5001(5000) ack 1
22+
+0 > P. 5001:10001(5000) ack 1
23+
+0 %{ assert tcpi_snd_cwnd == 10, tcpi_snd_cwnd }%
24+
25+
+.1 < . 1:1(0) ack 10001 win 511
26+
+0 %{ assert tcpi_snd_cwnd == 20, tcpi_snd_cwnd }%
27+
+0 > P. 10001:20001(10000) ack 1
28+
+0 > P. 20001:26001(6000) ack 1
29+
30+
+.1 < . 1:1(0) ack 26001 win 0
31+
+0 %{ assert tcpi_snd_cwnd == 36, tcpi_snd_cwnd }%
32+
33+
+0 write(4, ..., 20000) = 20000
34+
// 1st win0 probe
35+
+.3~+.310 > . 26000:26000(0) ack 1
36+
+0 %{ assert tcpi_snd_cwnd == 36, tcpi_snd_cwnd }%
37+
38+
// 2nd win0 probe
39+
+.6~+.620 > . 26000:26000(0) ack 1
40+
+0 %{ assert tcpi_snd_cwnd == 36, tcpi_snd_cwnd }%
41+
42+
// 3rd win0 probe
43+
+1.2~+1.240 > . 26000:26000(0) ack 1
44+
+0 %{ assert tcpi_snd_cwnd == 36, tcpi_snd_cwnd }%
45+
46+
+.9 < . 1:1(0) ack 26001 win 511
47+
+0 > P. 26001:31001(5000) ack 1
48+
49+
// Reset sysctls
50+
`/tmp/sysctl_restore_${PPID}.sh`
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
// SPDX-License-Identifier: GPL-2.0
2+
// Test of slow start when application-limited: in this case,
3+
// with IW10, if we don't fully use our cwnd but instead
4+
// send just 9 packets, then cwnd should grow to twice that
5+
// value, or 18 packets.
6+
7+
// Set up config.
8+
`./defaults.sh`
9+
10+
0 socket(..., SOCK_STREAM, IPPROTO_TCP) = 3
11+
+0 setsockopt(3, SOL_SOCKET, SO_REUSEADDR, [1], 4) = 0
12+
+0 bind(3, ..., ...) = 0
13+
+0 listen(3, 1) = 0
14+
15+
+.1 < S 0:0(0) win 32792 <mss 1000,sackOK,nop,nop,nop,wscale 7>
16+
+0 > S. 0:0(0) ack 1 <mss 1460,nop,nop,sackOK,nop,wscale 8>
17+
+.1 < . 1:1(0) ack 1 win 257
18+
+0 accept(3, ..., ...) = 4
19+
+0 setsockopt(4, SOL_SOCKET, SO_SNDBUF, [200000], 4) = 0
20+
21+
+0 write(4, ..., 9000) = 9000
22+
+0 > P. 1:9001(9000) ack 1
23+
+0 %{ assert tcpi_snd_cwnd == 10, tcpi_snd_cwnd }%
24+
25+
+.105 < . 1:1(0) ack 2001 win 257
26+
+0 %{ assert tcpi_snd_cwnd == 12, tcpi_snd_cwnd }%
27+
28+
+.005 < . 1:1(0) ack 4001 win 257
29+
+0 %{ assert tcpi_snd_cwnd == 14, tcpi_snd_cwnd }%
30+
31+
+.005 < . 1:1(0) ack 6001 win 257
32+
+0 %{ assert tcpi_snd_cwnd == 16, tcpi_snd_cwnd }%
33+
34+
+.005 < . 1:1(0) ack 8001 win 257
35+
+0 %{ assert tcpi_snd_cwnd == 18, tcpi_snd_cwnd }%
36+
37+
+.005 < . 1:1(0) ack 9001 win 257
38+
+0 %{ assert tcpi_snd_cwnd == 18, tcpi_snd_cwnd }%
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
// SPDX-License-Identifier: GPL-2.0
2+
// Test of slow start when application-limited: in this case,
3+
// with IW10, if we send exactly 10 packets then cwnd should grow to 20.
4+
5+
// Set up config.
6+
`./defaults.sh`
7+
8+
0 socket(..., SOCK_STREAM, IPPROTO_TCP) = 3
9+
+0 setsockopt(3, SOL_SOCKET, SO_REUSEADDR, [1], 4) = 0
10+
+0 bind(3, ..., ...) = 0
11+
+0 listen(3, 1) = 0
12+
13+
+.1 < S 0:0(0) win 32792 <mss 1000,sackOK,nop,nop,nop,wscale 7>
14+
+0 > S. 0:0(0) ack 1 <mss 1460,nop,nop,sackOK,nop,wscale 8>
15+
+.1 < . 1:1(0) ack 1 win 257
16+
+0 accept(3, ..., ...) = 4
17+
+0 setsockopt(4, SOL_SOCKET, SO_SNDBUF, [200000], 4) = 0
18+
19+
+0 write(4, ..., 10000) = 10000
20+
+0 > P. 1:10001(10000) ack 1
21+
+0 %{ assert tcpi_snd_cwnd == 10, tcpi_snd_cwnd }%
22+
23+
+.105 < . 1:1(0) ack 2001 win 257
24+
+0 %{ assert tcpi_snd_cwnd == 12, tcpi_snd_cwnd }%
25+
26+
+.005 < . 1:1(0) ack 4001 win 257
27+
+0 %{ assert tcpi_snd_cwnd == 14, tcpi_snd_cwnd }%
28+
29+
+.005 < . 1:1(0) ack 6001 win 257
30+
+0 %{ assert tcpi_snd_cwnd == 16, tcpi_snd_cwnd }%
31+
32+
+.005 < . 1:1(0) ack 8001 win 257
33+
+0 %{ assert tcpi_snd_cwnd == 18, tcpi_snd_cwnd }%
34+
35+
+.005 < . 1:1(0) ack 10001 win 257
36+
+0 %{ assert tcpi_snd_cwnd == 20, tcpi_snd_cwnd }%

0 commit comments

Comments
 (0)