xref: /linux/tools/testing/selftests/net/packetdrill/tcp_sack_sack-shift-sacked-7-5-6-8-9-fack.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 the case where we mark packets 0-4 lost, then
4*88395c07SSoham Chakradeo// get a SACK for 5, and then a SACK for 6.
5*88395c07SSoham Chakradeo
6*88395c07SSoham Chakradeo`./defaults.sh`
7*88395c07SSoham Chakradeo
8*88395c07SSoham Chakradeo// Establish a connection and send 10 MSS.
9*88395c07SSoham Chakradeo    0 socket(..., SOCK_STREAM, IPPROTO_TCP) = 3
10*88395c07SSoham Chakradeo   +0 setsockopt(3, SOL_SOCKET, SO_REUSEADDR, [1], 4) = 0
11*88395c07SSoham Chakradeo   +0 bind(3, ..., ...) = 0
12*88395c07SSoham Chakradeo   +0 listen(3, 1) = 0
13*88395c07SSoham Chakradeo
14*88395c07SSoham Chakradeo   +0 < S 0:0(0) win 32792 <mss 1000,sackOK,nop,nop,nop,wscale 7>
15*88395c07SSoham Chakradeo   +0 > S. 0:0(0) ack 1 <mss 1460,nop,nop,sackOK,nop,wscale 8>
16*88395c07SSoham Chakradeo  +.1 < . 1:1(0) ack 1 win 1024
17*88395c07SSoham Chakradeo   +0 accept(3, ..., ...) = 4
18*88395c07SSoham Chakradeo
19*88395c07SSoham Chakradeo   +0 write(4, ..., 10000) = 10000
20*88395c07SSoham Chakradeo   +0 > P. 1:10001(10000) ack 1
21*88395c07SSoham Chakradeo
22*88395c07SSoham Chakradeo// SACK for 7001:8001. Using RACK we delay a fast retransmit.
23*88395c07SSoham Chakradeo  +.1 < . 1:1(0) ack 1 win 257 <sack 7001:8001,nop,nop>
24*88395c07SSoham Chakradeo+.027 > . 1:1001(1000) ack 1
25*88395c07SSoham Chakradeo   +0 %{
26*88395c07SSoham Chakradeoassert tcpi_ca_state == TCP_CA_Recovery, tcpi_ca_state
27*88395c07SSoham Chakradeoassert tcpi_lost == 7,tcpi_lost         # RACK thinks 1:7001 are lost
28*88395c07SSoham Chakradeoassert tcpi_reordering == 3, tcpi_reordering
29*88395c07SSoham Chakradeo}%
30*88395c07SSoham Chakradeo
31*88395c07SSoham Chakradeo// SACK for 5001:6001.
32*88395c07SSoham Chakradeo   +0 < . 1:1(0) ack 1 win 257 <sack 5001:6001 7001:8001,nop,nop>
33*88395c07SSoham Chakradeo   +0 > . 1001:2001(1000) ack 1
34*88395c07SSoham Chakradeo   +0 %{
35*88395c07SSoham Chakradeoassert tcpi_lost == 6, tcpi_lost
36*88395c07SSoham Chakradeoassert tcpi_reordering == 3, tcpi_reordering  # 7001:8001 -> 5001:6001 is 3
37*88395c07SSoham Chakradeo}%
38*88395c07SSoham Chakradeo
39*88395c07SSoham Chakradeo// SACK for 6001:7001.
40*88395c07SSoham Chakradeo// This SACK for an adjacent range causes the sender to
41*88395c07SSoham Chakradeo// shift the newly-SACKed range onto the previous skb.
42*88395c07SSoham Chakradeo   +0 < . 1:1(0) ack 1 win 257 <sack 5001:8001,nop,nop>
43*88395c07SSoham Chakradeo   +0 > . 2001:3001(1000) ack 1
44*88395c07SSoham Chakradeo   +0 %{ assert tcpi_lost == 5, tcpi_lost }%
45*88395c07SSoham Chakradeo
46*88395c07SSoham Chakradeo// SACK for 8001:9001.
47*88395c07SSoham Chakradeo   +0 < . 1:1(0) ack 1 win 257 <sack 5001:9001,nop,nop>
48*88395c07SSoham Chakradeo   +0 > . 3001:4001(1000) ack 1
49*88395c07SSoham Chakradeo
50*88395c07SSoham Chakradeo// SACK for 9001:10001.
51*88395c07SSoham Chakradeo   +0 < . 1:1(0) ack 1 win 257 <sack 5001:10001,nop,nop>
52*88395c07SSoham Chakradeo   +0 > . 4001:5001(1000) ack 1
53*88395c07SSoham Chakradeo
54*88395c07SSoham Chakradeo// To simplify clean-up, say we get an ACK for all data.
55*88395c07SSoham Chakradeo  +.1 < . 1:1(0) ack 10001 win 257
56*88395c07SSoham Chakradeo   +0 %{
57*88395c07SSoham Chakradeoassert tcpi_ca_state == TCP_CA_Open, tcpi_ca_state
58*88395c07SSoham Chakradeoassert tcpi_unacked == 0, tcpi_unacked
59*88395c07SSoham Chakradeoassert tcpi_sacked == 0, tcpi_sacked
60*88395c07SSoham Chakradeoassert tcpi_lost == 0, tcpi_lost
61*88395c07SSoham Chakradeoassert tcpi_retrans == 0, tcpi_retrans
62*88395c07SSoham Chakradeo}%
63