BACKPORT: tcp: add tcp_sock_set_keepidle

Add a helper to directly set the TCP_KEEP_IDLE sockopt from kernel
space without going through a fake uaccess.

Change-Id: I57286ea8efb618476bac4d8d74f16e01b17e12aa
Signed-off-by: Christoph Hellwig <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
This commit is contained in:
Christoph Hellwig 2020-05-28 07:12:23 +02:00 • committed by basamaryan
commit 259e678a87
No known key found for this signature in database
GPG key ID: 210D5384FB2A5885
4 changed files with 38 additions and 21 deletions

View file

@ -56,10 +56,7 @@ int rds_tcp_keepalive(struct socket *sock)
if (ret < 0)
goto bail;
ret = kernel_setsockopt(sock, IPPROTO_TCP, TCP_KEEPIDLE,
(char *)&keepidle, sizeof(keepidle));
if (ret < 0)
goto bail;
tcp_sock_set_keepidle(sock->sk, keepidle);
/* KEEPINTVL is the interval between successive probes. We follow
* the model in xs_tcp_finish_connecting() and re-use keepidle.