aboutsummaryrefslogtreecommitdiffstats
path: root/net/ipv4/inet_connection_sock.c
diff options
context:
space:
mode:
authorAkhmat Karakotov <hmukos@yandex-team.ru>2022-01-31 16:31:22 +0300
committerDavid S. Miller <davem@davemloft.net>2022-01-31 15:05:25 +0000
commit26859240e4ee701e0379f08634957adaff67e43a (patch)
tree8f5b6f3e487f59496ec6a089b3e57d3beac1aab2 /net/ipv4/inet_connection_sock.c
parenttxhash: Make rethinking txhash behavior configurable via sysctl (diff)
downloadlinux-dev-26859240e4ee701e0379f08634957adaff67e43a.tar.xz
linux-dev-26859240e4ee701e0379f08634957adaff67e43a.zip
txhash: Add socket option to control TX hash rethink behavior
Add the SO_TXREHASH socket option to control hash rethink behavior per socket. When default mode is set, sockets disable rehash at initialization and use sysctl option when entering listen state. setsockopt() overrides default behavior. Signed-off-by: Akhmat Karakotov <hmukos@yandex-team.ru> Reviewed-by: Eric Dumazet <edumazet@google.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv4/inet_connection_sock.c')
-rw-r--r--net/ipv4/inet_connection_sock.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/net/ipv4/inet_connection_sock.c b/net/ipv4/inet_connection_sock.c
index fc2a985f6064..b81fb13fc5f4 100644
--- a/net/ipv4/inet_connection_sock.c
+++ b/net/ipv4/inet_connection_sock.c
@@ -1046,6 +1046,9 @@ int inet_csk_listen_start(struct sock *sk)
sk->sk_ack_backlog = 0;
inet_csk_delack_init(sk);
+ if (sk->sk_txrehash == SOCK_TXREHASH_DEFAULT)
+ sk->sk_txrehash = READ_ONCE(sock_net(sk)->core.sysctl_txrehash);
+
/* There is race window here: we announce ourselves listening,
* but this transition is still not validated by get_port().
* It is OK, because this socket enters to hash table only