xref: /linux/tools/testing/selftests/net/packetdrill/tcp_sack_sack-shift-sacked-7-3-4-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 3, and then a SACK for 4.
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 the fast retransmit.
23*88395c07SSoham Chakradeo  +.1 < . 1:1(0) ack 1 win 257 <sack 7001:8001,nop,nop>
24*88395c07SSoham Chakradeo// RACK reordering timer
25*88395c07SSoham Chakradeo+.027 > . 1:1001(1000) ack 1
26*88395c07SSoham Chakradeo   +0 %{
27*88395c07SSoham Chakradeoassert tcpi_ca_state == TCP_CA_Recovery, tcpi_ca_state
28*88395c07SSoham Chakradeoassert tcpi_lost == 7, tcpi_lost  # RACK thinks 1:7001 are lost
29*88395c07SSoham Chakradeoassert tcpi_reordering == 3, tcpi_reordering
30*88395c07SSoham Chakradeo}%
31*88395c07SSoham Chakradeo
32*88395c07SSoham Chakradeo// SACK for 3001:4001.
33*88395c07SSoham Chakradeo+.002 < . 1:1(0) ack 1 win 257 <sack 3001:4001 7001:8001,nop,nop>
34*88395c07SSoham Chakradeo   +0 > . 1001:2001(1000) ack 1
35*88395c07SSoham Chakradeo   +0 %{
36*88395c07SSoham Chakradeoassert tcpi_lost == 6, tcpi_lost              # since 3001:4001 is no longer lost
37*88395c07SSoham Chakradeoassert tcpi_reordering == 5, tcpi_reordering  # 7001:8001 -> 3001:4001
38*88395c07SSoham Chakradeo}%
39*88395c07SSoham Chakradeo
40*88395c07SSoham Chakradeo// SACK for 4001:5001.
41*88395c07SSoham Chakradeo// This SACK for an adjacent range causes the sender to
42*88395c07SSoham Chakradeo// shift the newly-SACKed range onto the previous skb.
43*88395c07SSoham Chakradeo// It uses the RFC3517 algorithm to mark 1:3001 lost
44*88395c07SSoham Chakradeo// because >=3 higher-sequence packets are SACKed.
45*88395c07SSoham Chakradeo+.002 < . 1:1(0) ack 1 win 257 <sack 3001:5001 7001:8001,nop,nop>
46*88395c07SSoham Chakradeo   +0 > . 2001:3001(1000) ack 1
47*88395c07SSoham Chakradeo   +0 %{
48*88395c07SSoham Chakradeoassert tcpi_lost == 5,tcpi_lost         # SACK/RFC3517 thinks 1:3001 are lost
49*88395c07SSoham Chakradeo}%
50*88395c07SSoham Chakradeo
51*88395c07SSoham Chakradeo// SACK for 8001:9001.
52*88395c07SSoham Chakradeo+.002 < . 1:1(0) ack 1 win 257 <sack 3001:5001 7001:9001,nop,nop>
53*88395c07SSoham Chakradeo
54*88395c07SSoham Chakradeo// SACK for 9001:10001.
55*88395c07SSoham Chakradeo+.002 < . 1:1(0) ack 1 win 257 <sack 3001:5001 7001:10001,nop,nop>
56*88395c07SSoham Chakradeo   +0 > . 5001:6001(1000) ack 1
57*88395c07SSoham Chakradeo
58*88395c07SSoham Chakradeo// To simplify clean-up, say we get an ACK for all data.
59*88395c07SSoham Chakradeo  +.1 < . 1:1(0) ack 10001 win 257
60*88395c07SSoham Chakradeo   +0 %{
61*88395c07SSoham Chakradeoassert tcpi_ca_state == TCP_CA_Open, tcpi_ca_state
62*88395c07SSoham Chakradeoassert tcpi_unacked == 0, tcpi_unacked
63*88395c07SSoham Chakradeoassert tcpi_sacked == 0, tcpi_sacked
64*88395c07SSoham Chakradeoassert tcpi_lost == 0, tcpi_lost
65*88395c07SSoham Chakradeoassert tcpi_retrans == 0, tcpi_retrans
66*88395c07SSoham Chakradeo}%
67