1*1e42f73fSWillem de Bruijn// SPDX-License-Identifier: GPL-2.0 2*1e42f73fSWillem de Bruijn// Fastopen server zerocopy test: 3*1e42f73fSWillem de Bruijn// 4*1e42f73fSWillem de Bruijn// send data with MSG_FASTOPEN | MSG_ZEROCOPY and verify that the 5*1e42f73fSWillem de Bruijn// kernel returns the notification ID. 6*1e42f73fSWillem de Bruijn 7*1e42f73fSWillem de Bruijn`./defaults.sh 8*1e42f73fSWillem de Bruijn ./set_sysctls.py /proc/sys/net/ipv4/tcp_fastopen=0x207` 9*1e42f73fSWillem de Bruijn 10*1e42f73fSWillem de Bruijn// Set up a TFO server listening socket. 11*1e42f73fSWillem de Bruijn 0 socket(..., SOCK_STREAM, IPPROTO_TCP) = 3 12*1e42f73fSWillem de Bruijn +.1 setsockopt(3, SOL_SOCKET, SO_REUSEADDR, [1], 4) = 0 13*1e42f73fSWillem de Bruijn +0 bind(3, ..., ...) = 0 14*1e42f73fSWillem de Bruijn +0 listen(3, 1) = 0 15*1e42f73fSWillem de Bruijn +0 setsockopt(3, SOL_TCP, TCP_FASTOPEN, [2], 4) = 0 16*1e42f73fSWillem de Bruijn +0 setsockopt(3, SOL_SOCKET, SO_ZEROCOPY, [1], 4) = 0 17*1e42f73fSWillem de Bruijn 18*1e42f73fSWillem de Bruijn// Client sends a SYN with data. 19*1e42f73fSWillem de Bruijn +.1 < S 0:1000(1000) win 32792 <mss 1460,sackOK,nop,nop> 20*1e42f73fSWillem de Bruijn +0 > S. 0:0(0) ack 1001 <mss 1460,nop,nop,sackOK> 21*1e42f73fSWillem de Bruijn 22*1e42f73fSWillem de Bruijn// Server accepts and replies with data. 23*1e42f73fSWillem de Bruijn+.005 accept(3, ..., ...) = 4 24*1e42f73fSWillem de Bruijn +0 read(4, ..., 1024) = 1000 25*1e42f73fSWillem de Bruijn +0 sendto(4, ..., 1000, MSG_ZEROCOPY, ..., ...) = 1000 26*1e42f73fSWillem de Bruijn +0 > P. 1:1001(1000) ack 1001 27*1e42f73fSWillem de Bruijn +.05 < . 1001:1001(0) ack 1001 win 32792 28*1e42f73fSWillem de Bruijn 29*1e42f73fSWillem de Bruijn// Read from error queue: now has first zerocopy notification 30*1e42f73fSWillem de Bruijn +0.1 recvmsg(4, {msg_name(...)=..., 31*1e42f73fSWillem de Bruijn msg_iov(1)=[{...,0}], 32*1e42f73fSWillem de Bruijn msg_flags=MSG_ERRQUEUE, 33*1e42f73fSWillem de Bruijn msg_control=[ 34*1e42f73fSWillem de Bruijn {cmsg_level=CMSG_LEVEL_IP, 35*1e42f73fSWillem de Bruijn cmsg_type=CMSG_TYPE_RECVERR, 36*1e42f73fSWillem de Bruijn cmsg_data={ee_errno=0, 37*1e42f73fSWillem de Bruijn ee_origin=SO_EE_ORIGIN_ZEROCOPY, 38*1e42f73fSWillem de Bruijn ee_type=0, 39*1e42f73fSWillem de Bruijn ee_code=SO_EE_CODE_ZEROCOPY_COPIED, 40*1e42f73fSWillem de Bruijn ee_info=0, 41*1e42f73fSWillem de Bruijn ee_data=0}} 42*1e42f73fSWillem de Bruijn ]}, MSG_ERRQUEUE) = 0 43*1e42f73fSWillem de Bruijn 44*1e42f73fSWillem de Bruijn`/tmp/sysctl_restore_${PPID}.sh` 45