Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

selftests/net: packetdrill: import tcp/eor, tcp/splice, tcp/ts_recent, tcp/blocking

Use the standard import and testing method, as described in the
import of tcp/ecn and tcp/close , tcp/sack , tcp/tcp_info.

Signed-off-by: Willem de Bruijn <willemb@google.com>
Signed-off-by: Soham Chakradeo <sohamch@google.com>
Link: https://patch.msgid.link/20241217185203.297935-4-sohamch.kernel@gmail.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>

authored by

Soham Chakradeo and committed by
Jakub Kicinski
6f669205 eab35989

+400
+18
tools/testing/selftests/net/packetdrill/tcp_blocking_blocking-accept.pkt
··· 1 + // SPDX-License-Identifier: GPL-2.0 2 + // Test for blocking accept. 3 + 4 + `./defaults.sh` 5 + 6 + // Establish a connection. 7 + 0 socket(..., SOCK_STREAM, IPPROTO_TCP) = 3 8 + +0 setsockopt(3, SOL_SOCKET, SO_REUSEADDR, [1], 4) = 0 9 + +0 bind(3, ..., ...) = 0 10 + +0 listen(3, 1) = 0 11 + +0...0.200 accept(3, ..., ...) = 4 12 + 13 + +.1 < S 0:0(0) win 32792 <mss 1000,nop,wscale 7> 14 + +0 > S. 0:0(0) ack 1 <mss 1460,nop,wscale 8> 15 + +.1 < . 1:1(0) ack 1 win 257 16 + 17 + +.1 write(4, ..., 2000) = 2000 18 + +0 > P. 1:2001(2000) ack 1
+13
tools/testing/selftests/net/packetdrill/tcp_blocking_blocking-connect.pkt
··· 1 + // SPDX-License-Identifier: GPL-2.0 2 + // Test for blocking connect. 3 + 4 + `./defaults.sh` 5 + 6 + // Establish a connection. 7 + 0 socket(..., SOCK_STREAM, IPPROTO_TCP) = 3 8 + 9 + +.1...0.200 connect(3, ..., ...) = 0 10 + 11 + +0 > S 0:0(0) <mss 1460,sackOK,TS val 100 ecr 0,nop,wscale 8> 12 + +.1 < S. 0:0(0) ack 1 win 5792 <mss 1460,nop,wscale 2,nop,nop,sackOK> 13 + +0 > . 1:1(0) ack 1
+29
tools/testing/selftests/net/packetdrill/tcp_blocking_blocking-read.pkt
··· 1 + // SPDX-License-Identifier: GPL-2.0 2 + // Test for blocking read. 3 + --tolerance_usecs=10000 4 + 5 + `./defaults.sh` 6 + 7 + // Establish a connection. 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,nop,wscale 7> 14 + +0 > S. 0:0(0) ack 1 <mss 1460,nop,wscale 8> 15 + +.1 < . 1:1(0) ack 1 win 257 16 + +0 accept(3, ..., ...) = 4 17 + 18 + +0...0.100 read(4, ..., 2000) = 2000 19 + +.1 < P. 1:2001(2000) ack 1 win 257 20 + +0 > . 1:1(0) ack 2001 21 + 22 + +.1...0.200 read(4, ..., 2000) = 2000 23 + +.1 < P. 2001:4001(2000) ack 1 win 257 24 + +0 > . 1:1(0) ack 4001 25 + 26 + +.1 < P. 4001:6001(2000) ack 1 win 257 27 + +0 > . 1:1(0) ack 6001 28 + +0...0.000 read(4, ..., 1000) = 1000 29 + +0...0.000 read(4, ..., 1000) = 1000
+35
tools/testing/selftests/net/packetdrill/tcp_blocking_blocking-write.pkt
··· 1 + // SPDX-License-Identifier: GPL-2.0 2 + // Test for blocking write. 3 + --tolerance_usecs=10000 4 + 5 + `./defaults.sh 6 + ./set_sysctls.py /proc/sys/net/ipv4/tcp_min_tso_segs=10 7 + ` 8 + 9 + // Establish a connection. 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 50000 <mss 1000,nop,wscale 0> 16 + +0 > S. 0:0(0) ack 1 <mss 1460,nop,wscale 8> 17 + +.1 < . 1:1(0) ack 1 win 50000 18 + +0 accept(3, ..., ...) = 4 19 + 20 + // Kernel doubles our value -> sk->sk_sndbuf is set to 42000 21 + +0 setsockopt(4, SOL_SOCKET, SO_SNDBUF, [21000], 4) = 0 22 + +0 getsockopt(4, SOL_SOCKET, SO_SNDBUF, [42000], [4]) = 0 23 + 24 + // A write of 60000 does not block. 25 + +0...0.300 write(4, ..., 61000) = 61000 // this write() blocks 26 + 27 + +.1 < . 1:1(0) ack 10001 win 50000 28 + 29 + +.1 < . 1:1(0) ack 30001 win 50000 30 + 31 + // This ACK should wakeup the write(). An ACK of 35001 does not. 32 + +.1 < . 1:1(0) ack 36001 win 50000 33 + 34 + // Reset to sysctls defaults. 35 + `/tmp/sysctl_restore_${PPID}.sh`
+38
tools/testing/selftests/net/packetdrill/tcp_eor_no-coalesce-large.pkt
··· 1 + // SPDX-License-Identifier: GPL-2.0 2 + // Test TCP does not append any data from consequent writes to the tail 3 + // skb created for the chunk. The large chunk itself should be packetized as 4 + // usual. 5 + `./defaults.sh 6 + ` 7 + 8 + // Initialize connection 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 32792 <mss 1000,sackOK,nop,nop,nop,wscale 10> 15 + +0 > S. 0:0(0) ack 1 <mss 1460,nop,nop,sackOK,nop,wscale 8> 16 + +.01 < . 1:1(0) ack 1 win 514 17 + 18 + +0 accept(3, ..., ...) = 4 19 + 20 + // Write a 10400B chunk to fill the ICW, and have a 400 byte skb sitting on 21 + // the tail. 22 + +0 write(4, ..., 10400) = 10400 23 + 24 + // Write another 10040B chunk with no coalescing options. 25 + +0 send(4, ..., 10400, MSG_EOR) = 10400 26 + 27 + // Write a 2KB chunk. This chunk should not be appended to the packets created 28 + // the previous chunk. 29 + +0 write(4, ..., 2000) = 2000 30 + 31 + +0 > P. 1:10001(10000) ack 1 32 + +.001 < . 1:1(0) ack 10001 win 514 33 + // Now we have enough room to send out the 2 x 400B packets out. 34 + +0 > P. 10001:20801(10800) ack 1 35 + +.001 < . 1:1(0) ack 20801 win 514 36 + // This 2KB packet should be sent alone. 37 + +0 > P. 20801:22801(2000) ack 1 38 + +.001 < . 1:1(0) ack 22801 win 514
+72
tools/testing/selftests/net/packetdrill/tcp_eor_no-coalesce-retrans.pkt
··· 1 + // SPDX-License-Identifier: GPL-2.0 2 + // Test TCP does not append any data from consequent writes to the tail 3 + // skb created for the chunk. Also, when packets are retransmitted, they 4 + // will not be coalesce into the same skb. 5 + `./defaults.sh 6 + ` 7 + 8 + // Initialize connection 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 32792 <mss 1000,sackOK,nop,nop,nop,wscale 10> 15 + +0 > S. 0:0(0) ack 1 <mss 1460,nop,nop,sackOK,nop,wscale 8> 16 + +.01 < . 1:1(0) ack 1 win 514 17 + 18 + +0 accept(3, ..., ...) = 4 19 + 20 + // Write a 10400B chunk to fill the ICW, and have a 400 byte skb sitting on 21 + // the tail. 22 + +0 write(4, ..., 10400) = 10400 23 + 24 + // Write 10 400B chunks with no coalescing options. 25 + +0 send(4, ..., 400, MSG_EOR) = 400 26 + +0 send(4, ..., 400, MSG_EOR) = 400 27 + +0 send(4, ..., 400, MSG_EOR) = 400 28 + +0 send(4, ..., 400, MSG_EOR) = 400 29 + +0 send(4, ..., 400, MSG_EOR) = 400 30 + +0 send(4, ..., 400, MSG_EOR) = 400 31 + +0 send(4, ..., 400, MSG_EOR) = 400 32 + +0 send(4, ..., 400, MSG_EOR) = 400 33 + +0 send(4, ..., 400, MSG_EOR) = 400 34 + +0 send(4, ..., 400, MSG_EOR) = 400 35 + // This chunk should not be appended to the skbs created for the previous chunk. 36 + +0 write(4, ..., 10000) = 10000 37 + 38 + +0 > P. 1:10001(10000) ack 1 39 + +.001 < . 1:1(0) ack 10001 win 514 40 + // Now we have enough room to send out the 2 x 400B packets out. 41 + +0 > P. 10001:10801(800) ack 1 42 + // The 9 remaining 400B chunks should be sent as individual packets. 43 + +0 > P. 10801:11201(400) ack 1 44 + +0 > P. 11201:11601(400) ack 1 45 + +0 > P. 11601:12001(400) ack 1 46 + +0 > P. 12001:12401(400) ack 1 47 + +0 > P. 12401:12801(400) ack 1 48 + +0 > P. 12801:13201(400) ack 1 49 + +0 > P. 13201:13601(400) ack 1 50 + +0 > P. 13601:14001(400) ack 1 51 + +0 > P. 14001:14401(400) ack 1 52 + // The last 10KB chunk should be sent separately. 53 + +0 > P. 14401:24401(10000) ack 1 54 + 55 + +.001 < . 1:1(0) ack 10401 win 514 56 + +.001 < . 1:1(0) ack 10801 win 514 57 + +.001 < . 1:1(0) ack 11201 win 514 58 + +.001 < . 1:1(0) ack 11601 win 514 59 + +.001 < . 1:1(0) ack 12001 win 514 <sack 13201:14401,nop,nop> 60 + // TCP should fill the hole but no coalescing should happen, and all 61 + // retransmissions should be sent out as individual packets. 62 + 63 + // Note : This is timeout based retransmit. 64 + // Do not put +0 here or flakes will come back. 65 + +.004~+.008 > P. 12001:12401(400) ack 1 66 + 67 + +.001 < . 1:1(0) ack 12401 win 514 <sack 13201:14401,nop,nop> 68 + +0 > P. 12401:12801(400) ack 1 69 + +0 > P. 12801:13201(400) ack 1 70 + +.001 < . 1:1(0) ack 12801 win 514 <sack 13201:14401,nop,nop> 71 + +.001 < . 1:1(0) ack 14401 win 514 72 + +.001 < . 1:1(0) ack 24401 win 514
+36
tools/testing/selftests/net/packetdrill/tcp_eor_no-coalesce-small.pkt
··· 1 + // SPDX-License-Identifier: GPL-2.0 2 + // Test TCP does not append any data from consequent writes to the tail 3 + // skb created for the chunk. 4 + `./defaults.sh 5 + ` 6 + 7 + // Initialize connection 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 + +0 < S 0:0(0) win 32792 <mss 1000,sackOK,nop,nop,nop,wscale 10> 14 + +0 > S. 0:0(0) ack 1 <mss 1460,nop,nop,sackOK,nop,wscale 8> 15 + +.01 < . 1:1(0) ack 1 win 514 16 + 17 + +0 accept(3, ..., ...) = 4 18 + 19 + // Write a 10400B chunk to fill the ICW, and have a 400 byte skb sitting on 20 + // the tail. 21 + +0 write(4, ..., 10400) = 10400 22 + 23 + // Write a 400B chunk with no coalescing options. 24 + +0 send(4, ..., 400, MSG_EOR) = 400 25 + 26 + // This chunk should not be appended to the skbs created for the previous chunk. 27 + +0 write(4, ..., 10000) = 10000 28 + 29 + +0 > P. 1:10001(10000) ack 1 30 + +.001 < . 1:1(0) ack 10001 win 514 31 + // Now we have enough room to send out the 2 x 400B packets out. 32 + +0 > P. 10001:10801(800) ack 1 33 + +0 > P. 10801:20801(10000) ack 1 34 + +.001 < . 1:1(0) ack 10401 win 514 35 + +.001 < . 1:1(0) ack 10801 win 514 36 + +.001 < . 1:1(0) ack 20801 win 514
+66
tools/testing/selftests/net/packetdrill/tcp_eor_no-coalesce-subsequent.pkt
··· 1 + // SPDX-License-Identifier: GPL-2.0 2 + // Test TCP does not append any data from consequent writes to the tail 3 + // skb created for the chunk even though we have 10 back-to-back small 4 + // writes. 5 + `./defaults.sh 6 + ` 7 + 8 + // Initialize connection 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 32792 <mss 1000,sackOK,nop,nop,nop,wscale 10> 15 + +0 > S. 0:0(0) ack 1 <mss 1460,nop,nop,sackOK,nop,wscale 8> 16 + +.01 < . 1:1(0) ack 1 win 514 17 + 18 + +0 accept(3, ..., ...) = 4 19 + 20 + // Write a 10400B chunk to fill the ICW, and have a 400 byte skb sitting on 21 + // the tail. 22 + +0 write(4, ..., 10400) = 10400 23 + 24 + // Write 10 400B chunks with no coalescing options. 25 + +0 send(4, ..., 400, MSG_EOR) = 400 26 + +0 send(4, ..., 400, MSG_EOR) = 400 27 + +0 send(4, ..., 400, MSG_EOR) = 400 28 + +0 send(4, ..., 400, MSG_EOR) = 400 29 + +0 send(4, ..., 400, MSG_EOR) = 400 30 + +0 send(4, ..., 400, MSG_EOR) = 400 31 + +0 send(4, ..., 400, MSG_EOR) = 400 32 + +0 send(4, ..., 400, MSG_EOR) = 400 33 + +0 send(4, ..., 400, MSG_EOR) = 400 34 + +0 send(4, ..., 400, MSG_EOR) = 400 35 + // This chunk should not be appended to the skbs created for the previous chunk. 36 + +0 write(4, ..., 10000) = 10000 37 + 38 + +0 > P. 1:10001(10000) ack 1 39 + +.001 < . 1:1(0) ack 10001 win 514 40 + // Now we have enough room to send out the 2 x 400B packets out. 41 + +0 > P. 10001:10801(800) ack 1 42 + // The 9 remaining 400B chunks should be sent as individual packets. 43 + +0 > P. 10801:11201(400) ack 1 44 + +0 > P. 11201:11601(400) ack 1 45 + +0 > P. 11601:12001(400) ack 1 46 + +0 > P. 12001:12401(400) ack 1 47 + +0 > P. 12401:12801(400) ack 1 48 + +0 > P. 12801:13201(400) ack 1 49 + +0 > P. 13201:13601(400) ack 1 50 + +0 > P. 13601:14001(400) ack 1 51 + +0 > P. 14001:14401(400) ack 1 52 + // The last 10KB chunk should be sent separately. 53 + +0 > P. 14401:24401(10000) ack 1 54 + 55 + +.001 < . 1:1(0) ack 10401 win 514 56 + +.001 < . 1:1(0) ack 10801 win 514 57 + +.001 < . 1:1(0) ack 11201 win 514 58 + +.001 < . 1:1(0) ack 11601 win 514 59 + +.001 < . 1:1(0) ack 12001 win 514 60 + +.001 < . 1:1(0) ack 12401 win 514 61 + +.001 < . 1:1(0) ack 12801 win 514 62 + +.001 < . 1:1(0) ack 13201 win 514 63 + +.001 < . 1:1(0) ack 13601 win 514 64 + +.001 < . 1:1(0) ack 14001 win 514 65 + +.001 < . 1:1(0) ack 14401 win 514 66 + +.001 < . 1:1(0) ack 24401 win 514
+20
tools/testing/selftests/net/packetdrill/tcp_splice_tcp_splice_loop_test.pkt
··· 1 + // SPDX-License-Identifier: GPL-2.0 2 + `./defaults.sh` 3 + 4 + // Initialize a server socket 5 + 0 socket(..., SOCK_STREAM, IPPROTO_TCP) = 3 6 + +0 setsockopt(3, SOL_SOCKET, SO_REUSEADDR, [1], 4) = 0 7 + +0 setsockopt(3, SOL_IP, IP_FREEBIND, [1], 4) = 0 8 + +0 bind(3, ..., ...) = 0 9 + +0 listen(3, 1) = 0 10 + 11 + // Connection should get accepted 12 + +0 < S 0:0(0) win 32972 <mss 1460,nop,wscale 7> 13 + +0 > S. 0:0(0) ack 1 <...> 14 + +0 < . 1:1(0) ack 1 win 257 15 + +0 accept(3, ..., ...) = 4 16 + 17 + +0 pipe([5, 6]) = 0 18 + +0 < U. 1:101(100) ack 1 win 257 urg 100 19 + +0 splice(4, NULL, 6, NULL, 99, 0) = 99 20 + +0 splice(4, NULL, 6, NULL, 1, 0) = 0
+23
tools/testing/selftests/net/packetdrill/tcp_ts_recent_fin_tsval.pkt
··· 1 + // SPDX-License-Identifier: GPL-2.0 2 + // Test that we send FIN packet with correct TSval 3 + --tcp_ts_tick_usecs=1000 4 + --tolerance_usecs=7000 5 + 6 + `./defaults.sh` 7 + 8 + // Create a socket. 9 + 0 socket(..., SOCK_STREAM, IPPROTO_TCP) = 3 10 + +0 setsockopt(3, SOL_SOCKET, SO_REUSEADDR, [1], 4) = 0 11 + 12 + +0 bind(3, ..., ...) = 0 13 + +0 listen(3, 1) = 0 14 + 15 + // Establish a connection. 16 + +0 < S 0:0(0) win 20000 <mss 1000,sackOK,TS val 100 ecr 0> 17 + +0 > S. 0:0(0) ack 1 <mss 1460,sackOK,TS val 100 ecr 100> 18 + +.1 < . 1:1(0) ack 1 win 20000 <nop,nop,TS val 200 ecr 100> 19 + +0 accept(3, ..., ...) = 4 20 + 21 + +1 close(4) = 0 22 + // Check that FIN TSval is updated properly, one second has passed since last sent packet. 23 + +0 > F. 1:1(0) ack 1 <nop,nop,TS val 1200 ecr 200>
+25
tools/testing/selftests/net/packetdrill/tcp_ts_recent_invalid_ack.pkt
··· 1 + // SPDX-License-Identifier: GPL-2.0 2 + // Test that we reject TS val updates on a packet with invalid ACK sequence 3 + 4 + `./defaults.sh 5 + ` 6 + 7 + // Create a socket. 8 + 0 socket(..., SOCK_STREAM, IPPROTO_TCP) = 3 9 + +0 setsockopt(3, SOL_SOCKET, SO_REUSEADDR, [1], 4) = 0 10 + 11 + +0 bind(3, ..., ...) = 0 12 + +0 listen(3, 1) = 0 13 + 14 + // Establish a connection. 15 + +.1 < S 0:0(0) win 20000 <mss 1000,sackOK,TS val 100 ecr 0> 16 + +0 > S. 0:0(0) ack 1 <mss 1460,sackOK,TS val 100 ecr 100> 17 + +.1 < . 1:1(0) ack 1 win 20000 <nop,nop,TS val 200 ecr 100> 18 + +0 accept(3, ..., ...) = 4 19 + 20 + // bad packet with high tsval (its ACK sequence is above our sndnxt) 21 + +0 < F. 1:1(0) ack 9999 win 20000 <nop,nop,TS val 200000 ecr 100> 22 + 23 + 24 + +0 < . 1:1001(1000) ack 1 win 20000 <nop,nop,TS val 201 ecr 100> 25 + +0 > . 1:1(0) ack 1001 <nop,nop,TS val 200 ecr 201>
+25
tools/testing/selftests/net/packetdrill/tcp_ts_recent_reset_tsval.pkt
··· 1 + // SPDX-License-Identifier: GPL-2.0 2 + // Test that we send RST packet with correct TSval 3 + --tcp_ts_tick_usecs=1000 4 + 5 + `./defaults.sh` 6 + 7 + // Create a socket. 8 + 0 socket(..., SOCK_STREAM, IPPROTO_TCP) = 3 9 + +0 setsockopt(3, SOL_SOCKET, SO_REUSEADDR, [1], 4) = 0 10 + 11 + +0 bind(3, ..., ...) = 0 12 + +0 listen(3, 1) = 0 13 + 14 + // Establish a connection. 15 + +0 < S 0:0(0) win 20000 <mss 1000,sackOK,TS val 100 ecr 0> 16 + +0 > S. 0:0(0) ack 1 <mss 1460,sackOK,TS val 100 ecr 100> 17 + +.1 < . 1:1(0) ack 1 win 20000 <nop,nop,TS val 200 ecr 100> 18 + +0 accept(3, ..., ...) = 4 19 + 20 + +0 < . 1:1001(1000) ack 1 win 20000 <nop,nop,TS val 201 ecr 100> 21 + +0 > . 1:1(0) ack 1001 <nop,nop,TS val 200 ecr 201> 22 + 23 + +1 close(4) = 0 24 + // Check that RST TSval is updated properly, one second has passed since last sent packet. 25 + +0 > R. 1:1(0) ack 1001 <nop,nop,TS val 1200 ecr 201>