[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20210723093938.49354-1-zeil@yandex-team.ru>
Date: Fri, 23 Jul 2021 12:39:38 +0300
From: Dmitry Yakunin <zeil@...dex-team.ru>
To: kafai@...com, edumazet@...gle.com, netdev@...r.kernel.org,
bpf@...r.kernel.org
Cc: dmtrmonakhov@...dex-team.ru
Subject: [PATCH] tcp: use rto_min value from socket in retransmits timeout
Commit ca584ba07086 ("tcp: bpf: Add TCP_BPF_RTO_MIN for bpf_setsockopt")
adds ability to set rto_min value on socket less then default TCP_RTO_MIN.
But retransmits_timed_out() function still uses TCP_RTO_MIN and
tcp_retries{1,2} sysctls don't work properly for tuned socket values.
Fixes: ca584ba07086 ("tcp: bpf: Add TCP_BPF_RTO_MIN for bpf_setsockopt")
Signed-off-by: Dmitry Yakunin <zeil@...dex-team.ru>
Acked-by: Dmitry Monakhov <dmtrmonakhov@...dex-team.ru>
---
net/ipv4/tcp_timer.c | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/net/ipv4/tcp_timer.c b/net/ipv4/tcp_timer.c
index 20cf4a9..66c4b97 100644
--- a/net/ipv4/tcp_timer.c
+++ b/net/ipv4/tcp_timer.c
@@ -199,12 +199,13 @@ static unsigned int tcp_model_timeout(struct sock *sk,
* @boundary: max number of retransmissions
* @timeout: A custom timeout value.
* If set to 0 the default timeout is calculated and used.
- * Using TCP_RTO_MIN and the number of unsuccessful retransmits.
+ * Using icsk_rto_min value from socket or RTAX_RTO_MIN from route
+ * and the number of unsuccessful retransmits.
*
* The default "timeout" value this function can calculate and use
* is equivalent to the timeout of a TCP Connection
* after "boundary" unsuccessful, exponentially backed-off
- * retransmissions with an initial RTO of TCP_RTO_MIN.
+ * retransmissions with an initial RTO of icsk_rto_min or RTAX_RTO_MIN.
*/
static bool retransmits_timed_out(struct sock *sk,
unsigned int boundary,
@@ -217,7 +218,7 @@ static bool retransmits_timed_out(struct sock *sk,
start_ts = tcp_sk(sk)->retrans_stamp;
if (likely(timeout == 0)) {
- unsigned int rto_base = TCP_RTO_MIN;
+ unsigned int rto_base = tcp_rto_min(sk);
if ((1 << sk->sk_state) & (TCPF_SYN_SENT | TCPF_SYN_RECV))
rto_base = tcp_timeout_init(sk);
--
2.7.4
Powered by blists - more mailing lists