| 1 |
// SPDX-License-Identifier: GPL-2.0 |
| 2 |
// Test shifting of newly-SACKed ranges onto the previous already-SACKed skb. |
| 3 |
// This variant tests the case where we mark packets 0-4 lost, then |
| 4 |
// get a SACK for 5, and then a SACK for 6. |
| 5 |
|
| 6 |
`./defaults.sh` |
| 7 |
|
| 8 |
// Establish a connection and send 10 MSS. |
| 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 7> |
| 15 |
+0 > S. 0:0(0) ack 1 <mss 1460,nop,nop,sackOK,nop,wscale 8> |
| 16 |
+.1 < . 1:1(0) ack 1 win 1024 |
| 17 |
+0 accept(3, ..., ...) = 4 |
| 18 |
|
| 19 |
+0 write(4, ..., 10000) = 10000 |
| 20 |
+0 > P. 1:10001(10000) ack 1 |
| 21 |
|
| 22 |
// SACK for 7001:8001. Using RACK we delay a fast retransmit. |
| 23 |
+.1 < . 1:1(0) ack 1 win 257 <sack 7001:8001,nop,nop> |
| 24 |
+.027 > . 1:1001(1000) ack 1 |
| 25 |
+0 %{ |
| 26 |
assert tcpi_ca_state == TCP_CA_Recovery, tcpi_ca_state |
| 27 |
assert tcpi_lost == 7,tcpi_lost # RACK thinks 1:7001 are lost |
| 28 |
assert tcpi_reordering == 3, tcpi_reordering |
| 29 |
}% |
| 30 |
|
| 31 |
// SACK for 5001:6001. |
| 32 |
+0 < . 1:1(0) ack 1 win 257 <sack 5001:6001 7001:8001,nop,nop> |
| 33 |
+0 > . 1001:2001(1000) ack 1 |
| 34 |
+0 %{ |
| 35 |
assert tcpi_lost == 6, tcpi_lost |
| 36 |
assert tcpi_reordering == 3, tcpi_reordering # 7001:8001 -> 5001:6001 is 3 |
| 37 |
}% |
| 38 |
|
| 39 |
// SACK for 6001:7001. |
| 40 |
// This SACK for an adjacent range causes the sender to |
| 41 |
// shift the newly-SACKed range onto the previous skb. |
| 42 |
+0 < . 1:1(0) ack 1 win 257 <sack 5001:8001,nop,nop> |
| 43 |
+0 > . 2001:3001(1000) ack 1 |
| 44 |
+0 %{ assert tcpi_lost == 5, tcpi_lost }% |
| 45 |
|
| 46 |
// SACK for 8001:9001. |
| 47 |
+0 < . 1:1(0) ack 1 win 257 <sack 5001:9001,nop,nop> |
| 48 |
+0 > . 3001:4001(1000) ack 1 |
| 49 |
|
| 50 |
// SACK for 9001:10001. |
| 51 |
+0 < . 1:1(0) ack 1 win 257 <sack 5001:10001,nop,nop> |
| 52 |
+0 > . 4001:5001(1000) ack 1 |
| 53 |
|
| 54 |
// To simplify clean-up, say we get an ACK for all data. |
| 55 |
+.1 < . 1:1(0) ack 10001 win 257 |
| 56 |
+0 %{ |
| 57 |
assert tcpi_ca_state == TCP_CA_Open, tcpi_ca_state |
| 58 |
assert tcpi_unacked == 0, tcpi_unacked |
| 59 |
assert tcpi_sacked == 0, tcpi_sacked |
| 60 |
assert tcpi_lost == 0, tcpi_lost |
| 61 |
assert tcpi_retrans == 0, tcpi_retrans |
| 62 |
}% |