diff options
author | 2025-02-07 15:28:30 +0000 | |
---|---|---|
committer | 2025-02-11 13:08:00 +0100 | |
commit | 1280c26228bd7eb14bdecd67dedbdd871f8fdda5 (patch) | |
tree | a30101f515f68abb751a449a79570c0458059f11 /net/ipv4/tcp.c | |
parent | tcp: add the ability to control max RTO (diff) | |
download | wireguard-linux-1280c26228bd7eb14bdecd67dedbdd871f8fdda5.tar.xz wireguard-linux-1280c26228bd7eb14bdecd67dedbdd871f8fdda5.zip |
tcp: add tcp_rto_max_ms sysctl
Previous patch added a TCP_RTO_MAX_MS socket option
to tune a TCP socket max RTO value.
Many setups prefer to change a per netns sysctl.
This patch adds /proc/sys/net/ipv4/tcp_rto_max_ms
Its initial value is 120000 (120 seconds).
Keep in mind that a decrease of tcp_rto_max_ms
means shorter overall timeouts, unless tcp_retries2
sysctl is increased.
Signed-off-by: Eric Dumazet <edumazet@google.com>
Reviewed-by: Jason Xing <kerneljasonxing@gmail.com>
Reviewed-by: Neal Cardwell <ncardwell@google.com>
Reviewed-by: Kuniyuki Iwashima <kuniyu@amazon.com>
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
Diffstat (limited to 'net/ipv4/tcp.c')
-rw-r--r-- | net/ipv4/tcp.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/net/ipv4/tcp.c b/net/ipv4/tcp.c index 3bb8fbbb01d9..992d5c9b2487 100644 --- a/net/ipv4/tcp.c +++ b/net/ipv4/tcp.c @@ -423,7 +423,7 @@ void tcp_init_sock(struct sock *sk) { struct inet_connection_sock *icsk = inet_csk(sk); struct tcp_sock *tp = tcp_sk(sk); - int rto_min_us; + int rto_min_us, rto_max_ms; tp->out_of_order_queue = RB_ROOT; sk->tcp_rtx_queue = RB_ROOT; @@ -433,8 +433,8 @@ void tcp_init_sock(struct sock *sk) icsk->icsk_rto = TCP_TIMEOUT_INIT; - /* Use a sysctl ? */ - icsk->icsk_rto_max = TCP_RTO_MAX; + rto_max_ms = READ_ONCE(sock_net(sk)->ipv4.sysctl_tcp_rto_max_ms); + icsk->icsk_rto_max = msecs_to_jiffies(rto_max_ms); rto_min_us = READ_ONCE(sock_net(sk)->ipv4.sysctl_tcp_rto_min_us); icsk->icsk_rto_min = usecs_to_jiffies(rto_min_us); |