Debian Codegraph @

tools/testing/selftests/net/packetdrill/tcp_timestamping_partial.pkt

raw
1 // SPDX-License-Identifier: GPL-2.0
2 // Test tx timestamping for partial writes (IPv4).
3 `./defaults.sh
4 `
5
6 // Create a socket and set it to non-blocking.
7 0 socket(..., SOCK_STREAM, IPPROTO_TCP) = 3
8 +0 fcntl(3, F_GETFL) = 0x2 (flags O_RDWR)
9 +0 fcntl(3, F_SETFL, O_RDWR|O_NONBLOCK) = 0
10
11 // Establish connection and verify that there was no error.
12 +0 connect(3, ..., ...) = -1 EINPROGRESS (Operation now in progress)
13 +0 > S 0:0(0) <mss 1460,sackOK,TS val 100 ecr 0,nop,wscale 8>
14 +.01 < S. 0:0(0) ack 1 win 2000 <mss 1000,sackOK,TS val 700 ecr 100,nop,wscale 7>
15 +0 > . 1:1(0) ack 1 <nop,nop,TS val 200 ecr 700>
16 +0 getsockopt(3, SOL_SOCKET, SO_ERROR, [0], [4]) = 0
17
18 +0 setsockopt(3, SOL_SOCKET, SO_SNDBUF, [1000], 4) = 0
19 +0 setsockopt(3, SOL_SOCKET, SO_TIMESTAMPING,
20 [SOF_TIMESTAMPING_TX_SCHED | SOF_TIMESTAMPING_TX_SOFTWARE |
21 SOF_TIMESTAMPING_TX_ACK | SOF_TIMESTAMPING_SOFTWARE |
22 SOF_TIMESTAMPING_OPT_ID], 4) = 0
23
24 // We have a partial write.
25 +0 write(3, ..., 10000) = 2964
26 +0 > . 1:989(988) ack 1 <nop,nop,TS val 110 ecr 700>
27 +0 > P. 989:1977(988) ack 1 <nop,nop,TS val 110 ecr 700>
28 +.01 < . 1:1(0) ack 1977 win 92 <nop,nop,TS val 800 ecr 200>
29 +0 > P. 1977:2965(988) ack 1 <nop,nop,TS val 114 ecr 800>
30 +.01 < . 1:1(0) ack 2965 win 92 <nop,nop,TS val 800 ecr 200>
31
32 // Make sure that internal TCP timestamps are not overwritten and we have sane
33 // RTT measurement.
34 +0 %{
35 assert 5000 <= tcpi_rtt <= 20000, 'srtt=%d us' % tcpi_rtt
36 }%
37
38 // SCM_TSTAMP_SCHED for the first chunk should be received almost immediately
39 // after the first ack at t=20ms.
40 +0 recvmsg(3, {msg_name(...)=...,
41 msg_iov(1)=[{...,0}],
42 msg_flags=MSG_ERRQUEUE|MSG_TRUNC,
43 msg_control=[
44 {cmsg_level=SOL_SOCKET,
45 cmsg_type=SCM_TIMESTAMPING,
46 cmsg_data={scm_sec=0,scm_nsec=20000000}},
47 {cmsg_level=CMSG_LEVEL_IP,
48 cmsg_type=CMSG_TYPE_RECVERR,
49 cmsg_data={ee_errno=ENOMSG,
50 ee_origin=SO_EE_ORIGIN_TIMESTAMPING,
51 ee_type=0,
52 ee_code=0,
53 ee_info=SCM_TSTAMP_SCHED,
54 ee_data=2963}}
55 ]}, MSG_ERRQUEUE) = 0
56 // SCM_TSTAMP_SND for the first chunk should be received almost immediately
57 // after the first ack at t=20ms.
58 +0 recvmsg(3, {msg_name(...)=...,
59 msg_iov(1)=[{...,0}],
60 msg_flags=MSG_ERRQUEUE|MSG_TRUNC,
61 msg_control=[
62 {cmsg_level=SOL_SOCKET,
63 cmsg_type=SCM_TIMESTAMPING,
64 cmsg_data={scm_sec=0,scm_nsec=20000000}},
65 {cmsg_level=CMSG_LEVEL_IP,
66 cmsg_type=CMSG_TYPE_RECVERR,
67 cmsg_data={ee_errno=ENOMSG,
68 ee_origin=SO_EE_ORIGIN_TIMESTAMPING,
69 ee_type=0,
70 ee_code=0,
71 ee_info=SCM_TSTAMP_SND,
72 ee_data=2963}}
73 ]}, MSG_ERRQUEUE) = 0
74 // SCM_TSTAMP_ACK for the first chunk should be received after the last ack at
75 // t=30ms.
76 +0 recvmsg(3, {msg_name(...)=...,
77 msg_iov(1)=[{...,0}],
78 msg_flags=MSG_ERRQUEUE|MSG_TRUNC,
79 msg_control=[
80 {cmsg_level=SOL_SOCKET,
81 cmsg_type=SCM_TIMESTAMPING,
82 cmsg_data={scm_sec=0,scm_nsec=30000000}},
83 {cmsg_level=CMSG_LEVEL_IP,
84 cmsg_type=CMSG_TYPE_RECVERR,
85 cmsg_data={ee_errno=ENOMSG,
86 ee_origin=SO_EE_ORIGIN_TIMESTAMPING,
87 ee_type=0,
88 ee_code=0,
89 ee_info=SCM_TSTAMP_ACK,
90 ee_data=2963}}
91 ]}, MSG_ERRQUEUE) = 0