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

@ -2256,8 +2256,7 @@ static void xs_tcp_set_socket_timeouts(struct rpc_xprt *xprt,
/* TCP Keepalive options */
kernel_setsockopt(sock, SOL_SOCKET, SO_KEEPALIVE,
(char *)&opt_on, sizeof(opt_on));
kernel_setsockopt(sock, SOL_TCP, TCP_KEEPIDLE,
(char *)&keepidle, sizeof(keepidle));
tcp_sock_set_keepidle(sock->sk, keepidle);
kernel_setsockopt(sock, SOL_TCP, TCP_KEEPINTVL,
(char *)&keepidle, sizeof(keepidle));
kernel_setsockopt(sock, SOL_TCP, TCP_KEEPCNT,