4 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 only,
8 * as published by the Free Software Foundation.
10 * This program is distributed in the hope that it will be useful, but
11 * WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * General Public License version 2 for more details (a copy is included
14 * in the LICENSE file that accompanied this code).
16 * You should have received a copy of the GNU General Public License
17 * version 2 along with this program; If not, see
18 * http://www.gnu.org/licenses/gpl-2.0.html
23 #ifndef __LIBCFS_LINUX_NET_H__
24 #define __LIBCFS_LINUX_NET_H__
26 #ifdef HAVE_KERNEL_SETSOCKOPT
30 static inline void tcp_sock_set_quickack(struct sock *sk, int opt)
32 struct socket *sock = sk->sk_socket;
34 kernel_setsockopt(sock, SOL_TCP, TCP_QUICKACK,
35 (char *)&opt, sizeof(opt));
38 static inline void tcp_sock_set_nodelay(struct sock *sk)
41 struct socket *sock = sk->sk_socket;
43 kernel_setsockopt(sock, SOL_TCP, TCP_NODELAY,
44 (char *)&opt, sizeof(opt));
47 static inline int tcp_sock_set_keepidle(struct sock *sk, int opt)
49 struct socket *sock = sk->sk_socket;
51 return kernel_setsockopt(sock, SOL_TCP, TCP_KEEPIDLE,
52 (char *)&opt, sizeof(opt));
55 static inline int tcp_sock_set_keepintvl(struct sock *sk, int opt)
57 struct socket *sock = sk->sk_socket;
59 return kernel_setsockopt(sock, SOL_TCP, TCP_KEEPINTVL,
60 (char *)&opt, sizeof(opt));
63 static inline int tcp_sock_set_keepcnt(struct sock *sk, int opt)
65 struct socket *sock = sk->sk_socket;
67 return kernel_setsockopt(sock, SOL_TCP, TCP_KEEPCNT,
68 (char *)&opt, sizeof(opt));
70 #endif /* HAVE_KERNEL_SETSOCKOPT */
72 #endif /* __LIBCFS_LINUX_NET_H__ */