Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Merge branch 'support-tcp_rto_min_us-and-tcp_delack_max_us-for-set-getsockopt'

Jason Xing says:

====================
support TCP_RTO_MIN_US and TCP_DELACK_MAX_US for set/getsockopt

Add set/getsockopt supports for TCP_RTO_MIN_US and TCP_DELACK_MAX_US.
====================

Link: https://patch.msgid.link/20250317120314.41404-1-kerneljasonxing@gmail.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>

+30 -6
+2 -2
Documentation/networking/ip-sysctl.rst
··· 1229 1229 tcp_rto_min_us - INTEGER 1230 1230 Minimal TCP retransmission timeout (in microseconds). Note that the 1231 1231 rto_min route option has the highest precedence for configuring this 1232 - setting, followed by the TCP_BPF_RTO_MIN socket option, followed by 1233 - this tcp_rto_min_us sysctl. 1232 + setting, followed by the TCP_BPF_RTO_MIN and TCP_RTO_MIN_US socket 1233 + options, followed by this tcp_rto_min_us sysctl. 1234 1234 1235 1235 The recommended practice is to use a value less or equal to 200000 1236 1236 microseconds.
+1 -1
include/net/tcp.h
··· 844 844 static inline u32 tcp_rto_min(const struct sock *sk) 845 845 { 846 846 const struct dst_entry *dst = __sk_dst_get(sk); 847 - u32 rto_min = inet_csk(sk)->icsk_rto_min; 847 + u32 rto_min = READ_ONCE(inet_csk(sk)->icsk_rto_min); 848 848 849 849 if (dst && dst_metric_locked(dst, RTAX_RTO_MIN)) 850 850 rto_min = dst_metric_rtt(dst, RTAX_RTO_MIN);
+2
include/uapi/linux/tcp.h
··· 140 140 141 141 #define TCP_IS_MPTCP 43 /* Is MPTCP being used? */ 142 142 #define TCP_RTO_MAX_MS 44 /* max rto time in ms */ 143 + #define TCP_RTO_MIN_US 45 /* min rto time in us */ 144 + #define TCP_DELACK_MAX_US 46 /* max delayed ack time in us */ 143 145 144 146 #define TCP_REPAIR_ON 1 145 147 #define TCP_REPAIR_OFF 0
+24 -2
net/ipv4/tcp.c
··· 3352 3352 icsk->icsk_probes_out = 0; 3353 3353 icsk->icsk_probes_tstamp = 0; 3354 3354 icsk->icsk_rto = TCP_TIMEOUT_INIT; 3355 - icsk->icsk_rto_min = TCP_RTO_MIN; 3356 - icsk->icsk_delack_max = TCP_DELACK_MAX; 3355 + WRITE_ONCE(icsk->icsk_rto_min, TCP_RTO_MIN); 3356 + WRITE_ONCE(icsk->icsk_delack_max, TCP_DELACK_MAX); 3357 3357 tp->snd_ssthresh = TCP_INFINITE_SSTHRESH; 3358 3358 tcp_snd_cwnd_set(tp, TCP_INIT_CWND); 3359 3359 tp->snd_cwnd_cnt = 0; ··· 3833 3833 return -EINVAL; 3834 3834 WRITE_ONCE(inet_csk(sk)->icsk_rto_max, msecs_to_jiffies(val)); 3835 3835 return 0; 3836 + case TCP_RTO_MIN_US: { 3837 + int rto_min = usecs_to_jiffies(val); 3838 + 3839 + if (rto_min > TCP_RTO_MIN || rto_min < TCP_TIMEOUT_MIN) 3840 + return -EINVAL; 3841 + WRITE_ONCE(inet_csk(sk)->icsk_rto_min, rto_min); 3842 + return 0; 3843 + } 3844 + case TCP_DELACK_MAX_US: { 3845 + int delack_max = usecs_to_jiffies(val); 3846 + 3847 + if (delack_max > TCP_DELACK_MAX || delack_max < TCP_TIMEOUT_MIN) 3848 + return -EINVAL; 3849 + WRITE_ONCE(inet_csk(sk)->icsk_delack_max, delack_max); 3850 + return 0; 3851 + } 3836 3852 } 3837 3853 3838 3854 sockopt_lock_sock(sk); ··· 4687 4671 break; 4688 4672 case TCP_RTO_MAX_MS: 4689 4673 val = jiffies_to_msecs(tcp_rto_max(sk)); 4674 + break; 4675 + case TCP_RTO_MIN_US: 4676 + val = jiffies_to_usecs(READ_ONCE(inet_csk(sk)->icsk_rto_min)); 4677 + break; 4678 + case TCP_DELACK_MAX_US: 4679 + val = jiffies_to_usecs(READ_ONCE(inet_csk(sk)->icsk_delack_max)); 4690 4680 break; 4691 4681 default: 4692 4682 return -ENOPROTOOPT;
+1 -1
net/ipv4/tcp_output.c
··· 4179 4179 { 4180 4180 u32 delack_from_rto_min = max(tcp_rto_min(sk), 2) - 1; 4181 4181 4182 - return min(inet_csk(sk)->icsk_delack_max, delack_from_rto_min); 4182 + return min(READ_ONCE(inet_csk(sk)->icsk_delack_max), delack_from_rto_min); 4183 4183 } 4184 4184 4185 4185 /* Send out a delayed ack, the caller does the policy checking