xref: /linux/tools/testing/selftests/net/packetdrill/tcp_sack_sack-shift-sacked-2-6-8-3-9-nofack.pkt (revision 0ad9617c78acbc71373fb341a6f75d4012b01d69)
1*88395c07SSoham Chakradeo// SPDX-License-Identifier: GPL-2.0
2*88395c07SSoham Chakradeo// Test shifting of newly-SACKed ranges onto the previous already-SACKed skb.
3*88395c07SSoham Chakradeo// This variant tests non-FACK SACK with SACKs coming in the order
4*88395c07SSoham Chakradeo// 2 6 8 3 9, to test what happens when we get a new SACKed range
5*88395c07SSoham Chakradeo// (for packet 3) that is on the right of an existing SACKed range
6*88395c07SSoham Chakradeo// (for packet 2).
7*88395c07SSoham Chakradeo
8*88395c07SSoham Chakradeo`./defaults.sh`
9*88395c07SSoham Chakradeo
10*88395c07SSoham Chakradeo// Establish a connection and send 10 MSS.
11*88395c07SSoham Chakradeo    0 socket(..., SOCK_STREAM, IPPROTO_TCP) = 3
12*88395c07SSoham Chakradeo   +0 setsockopt(3, SOL_SOCKET, SO_REUSEADDR, [1], 4) = 0
13*88395c07SSoham Chakradeo   +0 bind(3, ..., ...) = 0
14*88395c07SSoham Chakradeo   +0 listen(3, 1) = 0
15*88395c07SSoham Chakradeo
16*88395c07SSoham Chakradeo   +0 < S 0:0(0) win 32792 <mss 1000,sackOK,nop,nop,nop,wscale 7>
17*88395c07SSoham Chakradeo   +0 > S. 0:0(0) ack 1 <mss 1460,nop,nop,sackOK,nop,wscale 8>
18*88395c07SSoham Chakradeo  +.1 < . 1:1(0) ack 1 win 1024
19*88395c07SSoham Chakradeo   +0 accept(3, ..., ...) = 4
20*88395c07SSoham Chakradeo
21*88395c07SSoham Chakradeo   +0 write(4, ..., 10000) = 10000
22*88395c07SSoham Chakradeo   +0 > P. 1:10001(10000) ack 1
23*88395c07SSoham Chakradeo
24*88395c07SSoham Chakradeo  +.1 < . 1:1(0) ack 1 win 257 <sack 2001:3001,nop,nop>
25*88395c07SSoham Chakradeo+.001 < . 1:1(0) ack 1 win 257 <sack 2001:3001 6001:7001,nop,nop>
26*88395c07SSoham Chakradeo+.001 < . 1:1(0) ack 1 win 257 <sack 2001:3001 6001:7001 8001:9001,nop,nop>
27*88395c07SSoham Chakradeo
28*88395c07SSoham Chakradeo// 3 SACKed packets, so we enter Fast Recovery.
29*88395c07SSoham Chakradeo   +0 > . 1:1001(1000) ack 1
30*88395c07SSoham Chakradeo   +0 %{ assert tcpi_ca_state == TCP_CA_Recovery, tcpi_ca_state }%
31*88395c07SSoham Chakradeo   +0 %{ assert tcpi_lost == 6, tcpi_lost }%
32*88395c07SSoham Chakradeo
33*88395c07SSoham Chakradeo// SACK for 3001:4001.
34*88395c07SSoham Chakradeo// This SACK for an adjacent range causes the sender to
35*88395c07SSoham Chakradeo// shift the newly-SACKed range onto the previous skb.
36*88395c07SSoham Chakradeo+.007 < . 1:1(0) ack 1 win 257 <sack 2001:4001 6001:7001 8001:9001,nop,nop>
37*88395c07SSoham Chakradeo   +0 > . 1001:2001(1000) ack 1
38*88395c07SSoham Chakradeo   +0 %{ assert tcpi_lost == 5, tcpi_lost }%
39*88395c07SSoham Chakradeo   +0 %{ assert tcpi_reordering == 6, tcpi_reordering }%   // 8001:9001 -> 3001:4001 is 6
40*88395c07SSoham Chakradeo
41*88395c07SSoham Chakradeo// SACK for 9001:10001.
42*88395c07SSoham Chakradeo +.01 < . 1:1(0) ack 1 win 257 <sack 2001:4001 6001:7001 8001:10001,nop,nop>
43*88395c07SSoham Chakradeo   +0 %{ assert tcpi_lost == 5, tcpi_lost }%
44*88395c07SSoham Chakradeo
45*88395c07SSoham Chakradeo// ACK for 1:1001 as packets from t=0.303 arrive.
46*88395c07SSoham Chakradeo+.083 < . 1:1(0) ack 1001 win 257 <sack 2001:4001 6001:7001 8001:10001,nop,nop>
47*88395c07SSoham Chakradeo   +0 %{ assert tcpi_lost == 4,tcpi_lost }%
48*88395c07SSoham Chakradeo
49*88395c07SSoham Chakradeo// ACK for 1:4001 as packets from t=0.310 arrive.
50*88395c07SSoham Chakradeo+.017 < . 1:1(0) ack 4001 win 257 <sack 6001:7001 8001:10001,nop,nop>
51*88395c07SSoham Chakradeo   +0 %{ assert tcpi_lost == 3,tcpi_lost }%
52*88395c07SSoham Chakradeo
53*88395c07SSoham Chakradeo// ACK for 1:7001 as packets from t=0.320 arrive.
54*88395c07SSoham Chakradeo +.01 < . 1:1(0) ack 7001 win 257 <sack 8001:10001,nop,nop>
55*88395c07SSoham Chakradeo
56*88395c07SSoham Chakradeo// ACK for all data as packets from t=0.403 arrive.
57*88395c07SSoham Chakradeo  +.1 < . 1:1(0) ack 10001 win 257
58*88395c07SSoham Chakradeo   +0 %{
59*88395c07SSoham Chakradeoassert tcpi_ca_state == TCP_CA_Open, tcpi_ca_state
60*88395c07SSoham Chakradeoassert tcpi_unacked == 0, tcpi_unacked
61*88395c07SSoham Chakradeoassert tcpi_sacked == 0, tcpi_sacked
62*88395c07SSoham Chakradeoassert tcpi_lost == 0, tcpi_lost
63*88395c07SSoham Chakradeoassert tcpi_retrans == 0, tcpi_retrans
64*88395c07SSoham Chakradeo}%
65