aboutsummaryrefslogtreecommitdiffstats
path: root/net/core/sock.c
diff options
context:
space:
mode:
Diffstat (limited to 'net/core/sock.c')
-rw-r--r--net/core/sock.c26
1 files changed, 26 insertions, 0 deletions
diff --git a/net/core/sock.c b/net/core/sock.c
index d6d024cfaaaf..ab06b719f5b1 100644
--- a/net/core/sock.c
+++ b/net/core/sock.c
@@ -139,6 +139,8 @@
139#include <net/tcp.h> 139#include <net/tcp.h>
140#endif 140#endif
141 141
142#include <net/ll_poll.h>
143
142static DEFINE_MUTEX(proto_list_mutex); 144static DEFINE_MUTEX(proto_list_mutex);
143static LIST_HEAD(proto_list); 145static LIST_HEAD(proto_list);
144 146
@@ -898,6 +900,19 @@ set_rcvbuf:
898 sock_valbool_flag(sk, SOCK_SELECT_ERR_QUEUE, valbool); 900 sock_valbool_flag(sk, SOCK_SELECT_ERR_QUEUE, valbool);
899 break; 901 break;
900 902
903#ifdef CONFIG_NET_LL_RX_POLL
904 case SO_LL:
905 /* allow unprivileged users to decrease the value */
906 if ((val > sk->sk_ll_usec) && !capable(CAP_NET_ADMIN))
907 ret = -EPERM;
908 else {
909 if (val < 0)
910 ret = -EINVAL;
911 else
912 sk->sk_ll_usec = val;
913 }
914 break;
915#endif
901 default: 916 default:
902 ret = -ENOPROTOOPT; 917 ret = -ENOPROTOOPT;
903 break; 918 break;
@@ -1155,6 +1170,12 @@ int sock_getsockopt(struct socket *sock, int level, int optname,
1155 v.val = sock_flag(sk, SOCK_SELECT_ERR_QUEUE); 1170 v.val = sock_flag(sk, SOCK_SELECT_ERR_QUEUE);
1156 break; 1171 break;
1157 1172
1173#ifdef CONFIG_NET_LL_RX_POLL
1174 case SO_LL:
1175 v.val = sk->sk_ll_usec;
1176 break;
1177#endif
1178
1158 default: 1179 default:
1159 return -ENOPROTOOPT; 1180 return -ENOPROTOOPT;
1160 } 1181 }
@@ -2271,6 +2292,11 @@ void sock_init_data(struct socket *sock, struct sock *sk)
2271 2292
2272 sk->sk_stamp = ktime_set(-1L, 0); 2293 sk->sk_stamp = ktime_set(-1L, 0);
2273 2294
2295#ifdef CONFIG_NET_LL_RX_POLL
2296 sk->sk_napi_id = 0;
2297 sk->sk_ll_usec = sysctl_net_ll_read;
2298#endif
2299
2274 /* 2300 /*
2275 * Before updating sk_refcnt, we must commit prior changes to memory 2301 * Before updating sk_refcnt, we must commit prior changes to memory
2276 * (Documentation/RCU/rculist_nulls.txt for details) 2302 * (Documentation/RCU/rculist_nulls.txt for details)