1// SPDX-License-Identifier: GPL-2.0 2// Test after "tcp: tcp_tx_timestamp() must look at the rtx queue" 3 4// This test is about receiving the SCM_TSTAMP_ACK, 5// we do not care about its SCM_TIMESTAMPING precision. 6--tolerance_usecs=1000000 7 8`./defaults.sh 9sysctl -q net.ipv4.tcp_min_tso_segs=70 10` 11 12// Create a socket and set it to non-blocking. 13 0 socket(..., SOCK_STREAM, IPPROTO_TCP) = 3 14 +0 fcntl(3, F_GETFL) = 0x2 (flags O_RDWR) 15 +0 fcntl(3, F_SETFL, O_RDWR|O_NONBLOCK) = 0 16 17// Establish connection and verify that there was no error. 18 +0 connect(3, ..., ...) = -1 EINPROGRESS (Operation now in progress) 19 +0 > S 0:0(0) <mss 1460,sackOK,TS val 100 ecr 0,nop,wscale 8> 20+.010 < S. 0:0(0) ack 1 win 65535 <mss 1000,sackOK,TS val 700 ecr 100,nop,wscale 7> 21 +0 > . 1:1(0) ack 1 <nop,nop,TS val 200 ecr 700> 22 +0 getsockopt(3, SOL_SOCKET, SO_ERROR, [0], [4]) = 0 23 +0 setsockopt(3, SOL_SOCKET, SO_SNDBUF, [30000], 4) = 0 24 25 +0 write(3, ..., 9880) = 9880 26 +0 > P. 1:9881(9880) ack 1 <nop,nop,TS val 200 ecr 700> 27+.010 < . 1:1(0) ack 9881 win 10000 <nop,nop,TS val 701 ecr 200> 28 29 +0 write(3, ..., 19760) = 19760 30 +0 > P. 9881:29641(19760) ack 1 <nop,nop,TS val 201 ecr 701> 31+.010 < . 1:1(0) ack 29641 win 10000 <nop,nop,TS val 702 ecr 201> 32 33 +0 write(3, ..., 39520) = 39520 34 +0 > P. 29641:69161(39520) ack 1 <nop,nop,TS val 202 ecr 702> 35+.010 < . 1:1(0) ack 69161 win 10000 <nop,nop,TS val 703 ecr 202> 36 37// One more write to increase cwnd 38 +0 write(3, ..., 79040) = 79040 39 +0 > P. 69161:108681(39520) ack 1 <nop,nop,TS val 203 ecr 703> 40 +0 > P. 108681:148201(39520) ack 1 <nop,nop,TS val 203 ecr 703> 41+.010 < . 1:1(0) ack 148201 win 1000 <nop,nop,TS val 704 ecr 203> 42 43 +0 setsockopt(3, SOL_SOCKET, SO_TIMESTAMPING, 44 [SOF_TIMESTAMPING_TX_ACK | SOF_TIMESTAMPING_SOFTWARE | 45 SOF_TIMESTAMPING_OPT_ID], 4) = 0 46 47// We have one write filling one skb 48// last byte can not be stored because of our small SO_SNDBUF 49 +0 write(3, ..., 65209) = 65208 50 +0 > P. 148201:213409(65208) ack 1 <nop,nop,TS val 204 ecr 704> 51+.010 < . 1:1(0) ack 213409 win 1000 <nop,nop,TS val 705 ecr 204> 52 53// SCM_TSTAMP_ACK should be received after the last ack at 54// t=60ms. 55 +0 recvmsg(3, {msg_name(...)=..., 56 msg_iov(1)=[{...,0}], 57 msg_flags=MSG_ERRQUEUE|MSG_TRUNC, 58 msg_control=[ 59 {cmsg_level=SOL_SOCKET, 60 cmsg_type=SCM_TIMESTAMPING, 61 cmsg_data={scm_sec=0,scm_nsec=60000000}}, 62 {cmsg_level=CMSG_LEVEL_IP, 63 cmsg_type=CMSG_TYPE_RECVERR, 64 cmsg_data={ee_errno=ENOMSG, 65 ee_origin=SO_EE_ORIGIN_TIMESTAMPING, 66 ee_type=0, 67 ee_code=0, 68 ee_info=SCM_TSTAMP_ACK, 69 ee_data=65207}} 70 ]}, MSG_ERRQUEUE) = 0 71