[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20211104010648.h3bhz6cugnhcyfg6@kafai-mbp>
Date: Wed, 3 Nov 2021 18:06:48 -0700
From: Martin KaFai Lau <kafai@...com>
To: Akhmat Karakotov <hmukos@...dex-team.ru>
CC: <brakmo@...com>, <eric.dumazet@...il.com>,
<mitradir@...dex-team.ru>, <ncardwell@...gle.com>,
<netdev@...r.kernel.org>, <ycheng@...gle.com>,
<zeil@...dex-team.ru>
Subject: Re: [PATCH v3] tcp: Use BPF timeout setting for SYN ACK RTO
On Wed, Nov 03, 2021 at 11:46:07PM +0300, Akhmat Karakotov wrote:
> When setting RTO through BPF program, some SYN ACK packets were unaffected
> and continued to use TCP_TIMEOUT_INIT constant. This patch adds timeout
> option to struct request_sock. Option is initialized with TCP_TIMEOUT_INIT
> and is reassigned through BPF using tcp_timeout_init call. SYN ACK
> retransmits now use newly added timeout option.
>
> Signed-off-by: Akhmat Karakotov <hmukos@...dex-team.ru>
> ---
> include/net/request_sock.h | 2 ++
> include/net/tcp.h | 2 +-
> net/ipv4/inet_connection_sock.c | 4 +++-
> net/ipv4/tcp_input.c | 8 +++++---
> net/ipv4/tcp_minisocks.c | 12 +++++++++---
> 5 files changed, 20 insertions(+), 8 deletions(-)
>
> diff --git a/include/net/request_sock.h b/include/net/request_sock.h
> index 29e41ff3ec93..144c39db9898 100644
> --- a/include/net/request_sock.h
> +++ b/include/net/request_sock.h
> @@ -70,6 +70,7 @@ struct request_sock {
> struct saved_syn *saved_syn;
> u32 secid;
> u32 peer_secid;
> + u32 timeout;
> };
>
> static inline struct request_sock *inet_reqsk(const struct sock *sk)
> @@ -104,6 +105,7 @@ reqsk_alloc(const struct request_sock_ops *ops, struct sock *sk_listener,
> sk_node_init(&req_to_sk(req)->sk_node);
> sk_tx_queue_clear(req_to_sk(req));
> req->saved_syn = NULL;
> + req->timeout = 0;
> req->num_timeout = 0;
> req->num_retrans = 0;
> req->sk = NULL;
> diff --git a/include/net/tcp.h b/include/net/tcp.h
> index 3166dc15d7d6..e328d6735e38 100644
> --- a/include/net/tcp.h
> +++ b/include/net/tcp.h
> @@ -2323,7 +2323,7 @@ static inline u32 tcp_timeout_init(struct sock *sk)
>
> if (timeout <= 0)
> timeout = TCP_TIMEOUT_INIT;
> - return timeout;
> + return min_t(int, timeout, TCP_RTO_MAX);
Acked-by: Martin KaFai Lau <kafai@...com>
Powered by blists - more mailing lists