[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CANn89iKsq6fghsyfoeOjN8f7bpREq48tGAQSXz54Q2tp_J9DTQ@mail.gmail.com>
Date: Thu, 2 Dec 2021 09:24:10 -0800
From: Eric Dumazet <edumazet@...gle.com>
To: Akhmat Karakotov <hmukos@...dex-team.ru>
Cc: eric.dumazet@...il.com, mitradir@...dex-team.ru,
netdev@...r.kernel.org, tom@...bertland.com, zeil@...dex-team.ru
Subject: Re: [RFC PATCH v2 net-next 4/4] tcp: change SYN ACK retransmit
behaviour to account for rehash
On Thu, Dec 2, 2021 at 8:41 AM Akhmat Karakotov <hmukos@...dex-team.ru> wrote:
>
> Disabling rehash behavior did not affect SYN ACK retransmits because hash
> was forcefully changed bypassing the sk_rethink_hash function. This patch
> adds a condition which checks for rehash mode before resetting hash.
>
> Signed-off-by: Akhmat Karakotov <hmukos@...dex-team.ru>
> ---
> net/ipv4/tcp_output.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/net/ipv4/tcp_output.c b/net/ipv4/tcp_output.c
> index 6d72f3ea48c4..7d54bbe00cde 100644
> --- a/net/ipv4/tcp_output.c
> +++ b/net/ipv4/tcp_output.c
> @@ -4108,7 +4108,8 @@ int tcp_rtx_synack(const struct sock *sk, struct request_sock *req)
> struct flowi fl;
> int res;
>
> - tcp_rsk(req)->txhash = net_tx_rndhash();
> + if (sk->sk_txrehash == SOCK_TXREHASH_ENABLED)
Since you add a new sk->sk_txrehash, you probably want to add
READ_ONCE()/WRITE_ONCE() over the reads/writes,
because at this point the listener socket lock is not held.
/* Paired with WRITE_ONCE() in sock_setsockopt() */
if (READ_ONCE(sk->sk_txrehash) == SOCK_TXREHASH_ENABLED)
sock_setsockopt() would need a similar comment
/* Paired with READ_ONCE() in tcp_rtx_synack() */
WRITE_ONCE(sk->sk_txrehash, val);
> + tcp_rsk(req)->txhash = net_tx_rndhash();
> res = af_ops->send_synack(sk, NULL, &fl, req, NULL, TCP_SYNACK_NORMAL,
> NULL);
> if (!res) {
> --
> 2.17.1
>
Powered by blists - more mailing lists