| 1 |
// SPDX-License-Identifier: GPL-2.0 |
| 2 |
// Test shifting of newly-SACKed ranges onto the previous already-SACKed skb. |
| 3 |
// This variant tests non-FACK SACK with SACKs coming in the order |
| 4 |
// 2 6 8 3 9, to test what happens when we get a new SACKed range |
| 5 |
// (for packet 3) that is on the right of an existing SACKed range |
| 6 |
// (for packet 2). |
| 7 |
|
| 8 |
`./defaults.sh` |
| 9 |
|
| 10 |
// Establish a connection and send 10 MSS. |
| 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 |
+.1 < . 1:1(0) ack 1 win 1024 |
| 19 |
+0 accept(3, ..., ...) = 4 |
| 20 |
|
| 21 |
+0 write(4, ..., 10000) = 10000 |
| 22 |
+0 > P. 1:10001(10000) ack 1 |
| 23 |
|
| 24 |
+.1 < . 1:1(0) ack 1 win 257 <sack 2001:3001,nop,nop> |
| 25 |
+.001 < . 1:1(0) ack 1 win 257 <sack 2001:3001 6001:7001,nop,nop> |
| 26 |
+.001 < . 1:1(0) ack 1 win 257 <sack 2001:3001 6001:7001 8001:9001,nop,nop> |
| 27 |
|
| 28 |
// 3 SACKed packets, so we enter Fast Recovery. |
| 29 |
+0 > . 1:1001(1000) ack 1 |
| 30 |
+0 %{ assert tcpi_ca_state == TCP_CA_Recovery, tcpi_ca_state }% |
| 31 |
+0 %{ assert tcpi_lost == 6, tcpi_lost }% |
| 32 |
|
| 33 |
// SACK for 3001:4001. |
| 34 |
// This SACK for an adjacent range causes the sender to |
| 35 |
// shift the newly-SACKed range onto the previous skb. |
| 36 |
+.007 < . 1:1(0) ack 1 win 257 <sack 2001:4001 6001:7001 8001:9001,nop,nop> |
| 37 |
+0 > . 1001:2001(1000) ack 1 |
| 38 |
+0 %{ assert tcpi_lost == 5, tcpi_lost }% |
| 39 |
+0 %{ assert tcpi_reordering == 6, tcpi_reordering }% // 8001:9001 -> 3001:4001 is 6 |
| 40 |
|
| 41 |
// SACK for 9001:10001. |
| 42 |
+.01 < . 1:1(0) ack 1 win 257 <sack 2001:4001 6001:7001 8001:10001,nop,nop> |
| 43 |
+0 %{ assert tcpi_lost == 5, tcpi_lost }% |
| 44 |
|
| 45 |
// ACK for 1:1001 as packets from t=0.303 arrive. |
| 46 |
+.083 < . 1:1(0) ack 1001 win 257 <sack 2001:4001 6001:7001 8001:10001,nop,nop> |
| 47 |
+0 %{ assert tcpi_lost == 4,tcpi_lost }% |
| 48 |
|
| 49 |
// ACK for 1:4001 as packets from t=0.310 arrive. |
| 50 |
+.017 < . 1:1(0) ack 4001 win 257 <sack 6001:7001 8001:10001,nop,nop> |
| 51 |
+0 %{ assert tcpi_lost == 3,tcpi_lost }% |
| 52 |
|
| 53 |
// ACK for 1:7001 as packets from t=0.320 arrive. |
| 54 |
+.01 < . 1:1(0) ack 7001 win 257 <sack 8001:10001,nop,nop> |
| 55 |
|
| 56 |
// ACK for all data as packets from t=0.403 arrive. |
| 57 |
+.1 < . 1:1(0) ack 10001 win 257 |
| 58 |
+0 %{ |
| 59 |
assert tcpi_ca_state == TCP_CA_Open, tcpi_ca_state |
| 60 |
assert tcpi_unacked == 0, tcpi_unacked |
| 61 |
assert tcpi_sacked == 0, tcpi_sacked |
| 62 |
assert tcpi_lost == 0, tcpi_lost |
| 63 |
assert tcpi_retrans == 0, tcpi_retrans |
| 64 |
}% |