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

Source file repositories/reference/linux-study-clean/tools/testing/selftests/net/packetdrill/tcp_timestamping_server.pkt

File Facts

System
Linux kernel
Corpus path
tools/testing/selftests/net/packetdrill/tcp_timestamping_server.pkt
Extension
.pkt
Size
5027 bytes
Lines
146
Domain
Support Tooling And Documentation
Bucket
tools
Inferred role
Support Tooling And Documentation: tools
Status
atlas-only

Why This File Exists

Repository support layer: documentation, build tooling, samples, user-space helper tools, generated initramfs support, licenses, and validation utilities.

Dependency Surface

Detected Declarations

Annotated Snippet

// SPDX-License-Identifier: GPL-2.0
// Test tx timestamping for server-side (IPv4).
`./defaults.sh
`

// Initialize connection
    0	socket(..., SOCK_STREAM, IPPROTO_TCP) = 3
   +0	setsockopt(3, SOL_SOCKET, SO_REUSEADDR, [1], 4) = 0
   +0	bind(3, ..., ...) = 0
   +0	listen(3, 1) = 0

   +0	< S 0:0(0) win 32792 <mss 1000,sackOK,nop,nop,nop,wscale 10>
   +0	> S. 0:0(0) ack 1 <mss 1460,nop,nop,sackOK,nop,wscale 8>
 +.01	< . 1:1(0) ack 1 win 514

   +0	accept(3, ..., ...) = 4
   +0	setsockopt(4, SOL_SOCKET, SO_TIMESTAMPING,
		   [SOF_TIMESTAMPING_TX_SCHED | SOF_TIMESTAMPING_TX_SOFTWARE |
		    SOF_TIMESTAMPING_TX_ACK | SOF_TIMESTAMPING_SOFTWARE |
		    SOF_TIMESTAMPING_OPT_ID], 4) = 0

// Write two 2KB chunks.
// setsockopt(..., [SOF_TIMESTAMPING_SOFTWARE | SOF_TIMESTAMPING_OPT_ID], ...)
// is called after when SYN is acked. So, we expect the last byte of the first
// and the second chunks to have timestamp keys of 1999 (i.e., 2000 - 1) and
// 3999 (i.e., 4000 - 1) respectively.
   +0	write(4, ..., 2000) = 2000
   +0	write(4, ..., 2000) = 2000
   +0	> P. 1:2001(2000) ack 1
   +0	> P. 2001:4001(2000) ack 1
 +.01	< .  1:1(0) ack 2001 win 514
 +.01	< .  1:1(0) ack 4001 win 514

// Make sure that internal TCP timestamps are not overwritten and we have sane
// RTT measurement.
   +0	%{
assert 5000 <= tcpi_rtt <= 20000, 'srtt=%d us' % tcpi_rtt
}%

// SCM_TSTAMP_SCHED for the first chunk should be received almost immediately
// after write at t=10ms.
   +0	recvmsg(4, {msg_name(...)=...,
		    msg_iov(1)=[{...,0}],
                    msg_flags=MSG_ERRQUEUE|MSG_TRUNC,
                    msg_control=[
			{cmsg_level=SOL_SOCKET,
			 cmsg_type=SCM_TIMESTAMPING,
			 cmsg_data={scm_sec=0,scm_nsec=10000000}},
			{cmsg_level=CMSG_LEVEL_IP,
			 cmsg_type=CMSG_TYPE_RECVERR,
			 cmsg_data={ee_errno=ENOMSG,
				    ee_origin=SO_EE_ORIGIN_TIMESTAMPING,
				    ee_type=0,
				    ee_code=0,
				    ee_info=SCM_TSTAMP_SCHED,
				    ee_data=1999}}
		    ]}, MSG_ERRQUEUE) = 0
// SCM_TSTAMP_SND for the first chunk should be received almost immediately
// after write at t=10ms.
   +0	recvmsg(4, {msg_name(...)=...,
		    msg_iov(1)=[{...,0}],
                    msg_flags=MSG_ERRQUEUE|MSG_TRUNC,
                    msg_control=[
			{cmsg_level=SOL_SOCKET,
			 cmsg_type=SCM_TIMESTAMPING,
			 cmsg_data={scm_sec=0,scm_nsec=10000000}},
			{cmsg_level=CMSG_LEVEL_IP,
			 cmsg_type=CMSG_TYPE_RECVERR,
			 cmsg_data={ee_errno=ENOMSG,
				    ee_origin=SO_EE_ORIGIN_TIMESTAMPING,

Annotation

Implementation Notes