1*6f669205SSoham Chakradeo// SPDX-License-Identifier: GPL-2.0 2*6f669205SSoham Chakradeo// Test for blocking write. 3*6f669205SSoham Chakradeo--tolerance_usecs=10000 4*6f669205SSoham Chakradeo 5*6f669205SSoham Chakradeo`./defaults.sh 6*6f669205SSoham Chakradeo./set_sysctls.py /proc/sys/net/ipv4/tcp_min_tso_segs=10 7*6f669205SSoham Chakradeo` 8*6f669205SSoham Chakradeo 9*6f669205SSoham Chakradeo// Establish a connection. 10*6f669205SSoham Chakradeo 0 socket(..., SOCK_STREAM, IPPROTO_TCP) = 3 11*6f669205SSoham Chakradeo +0 setsockopt(3, SOL_SOCKET, SO_REUSEADDR, [1], 4) = 0 12*6f669205SSoham Chakradeo +0 bind(3, ..., ...) = 0 13*6f669205SSoham Chakradeo +0 listen(3, 1) = 0 14*6f669205SSoham Chakradeo 15*6f669205SSoham Chakradeo +.1 < S 0:0(0) win 50000 <mss 1000,nop,wscale 0> 16*6f669205SSoham Chakradeo +0 > S. 0:0(0) ack 1 <mss 1460,nop,wscale 8> 17*6f669205SSoham Chakradeo +.1 < . 1:1(0) ack 1 win 50000 18*6f669205SSoham Chakradeo +0 accept(3, ..., ...) = 4 19*6f669205SSoham Chakradeo 20*6f669205SSoham Chakradeo// Kernel doubles our value -> sk->sk_sndbuf is set to 42000 21*6f669205SSoham Chakradeo +0 setsockopt(4, SOL_SOCKET, SO_SNDBUF, [21000], 4) = 0 22*6f669205SSoham Chakradeo +0 getsockopt(4, SOL_SOCKET, SO_SNDBUF, [42000], [4]) = 0 23*6f669205SSoham Chakradeo 24*6f669205SSoham Chakradeo// A write of 60000 does not block. 25*6f669205SSoham Chakradeo +0...0.300 write(4, ..., 61000) = 61000 // this write() blocks 26*6f669205SSoham Chakradeo 27*6f669205SSoham Chakradeo +.1 < . 1:1(0) ack 10001 win 50000 28*6f669205SSoham Chakradeo 29*6f669205SSoham Chakradeo +.1 < . 1:1(0) ack 30001 win 50000 30*6f669205SSoham Chakradeo 31*6f669205SSoham Chakradeo// This ACK should wakeup the write(). An ACK of 35001 does not. 32*6f669205SSoham Chakradeo +.1 < . 1:1(0) ack 36001 win 50000 33*6f669205SSoham Chakradeo 34*6f669205SSoham Chakradeo// Reset to sysctls defaults. 35*6f669205SSoham Chakradeo`/tmp/sysctl_restore_${PPID}.sh` 36