diff options
author | Eliezer Tamir <eliezer.tamir@linux.intel.com> | 2013-06-14 09:33:57 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2013-06-17 18:48:14 -0400 |
commit | dafcc4380deec21d160c31411f33c8813f67f517 (patch) | |
tree | 4d1984857eca0b470d229604a5634fee87da7073 /net/core | |
parent | 89bf1b5a683df497c572c4d3bd3f9c9aa919d773 (diff) |
net: add socket option for low latency polling
adds a socket option for low latency polling.
This allows overriding the global sysctl value with a per-socket one.
Unexport sysctl_net_ll_poll since for now it's not needed in modules.
Signed-off-by: Eliezer Tamir <eliezer.tamir@linux.intel.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/core')
-rw-r--r-- | net/core/sock.c | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/net/core/sock.c b/net/core/sock.c index 788c0da5eed1..1e744b12fda3 100644 --- a/net/core/sock.c +++ b/net/core/sock.c | |||
@@ -913,6 +913,19 @@ set_rcvbuf: | |||
913 | sock_valbool_flag(sk, SOCK_SELECT_ERR_QUEUE, valbool); | 913 | sock_valbool_flag(sk, SOCK_SELECT_ERR_QUEUE, valbool); |
914 | break; | 914 | break; |
915 | 915 | ||
916 | #ifdef CONFIG_NET_LL_RX_POLL | ||
917 | case SO_LL: | ||
918 | /* allow unprivileged users to decrease the value */ | ||
919 | if ((val > sk->sk_ll_usec) && !capable(CAP_NET_ADMIN)) | ||
920 | ret = -EPERM; | ||
921 | else { | ||
922 | if (val < 0) | ||
923 | ret = -EINVAL; | ||
924 | else | ||
925 | sk->sk_ll_usec = val; | ||
926 | } | ||
927 | break; | ||
928 | #endif | ||
916 | default: | 929 | default: |
917 | ret = -ENOPROTOOPT; | 930 | ret = -ENOPROTOOPT; |
918 | break; | 931 | break; |
@@ -1170,6 +1183,12 @@ int sock_getsockopt(struct socket *sock, int level, int optname, | |||
1170 | v.val = sock_flag(sk, SOCK_SELECT_ERR_QUEUE); | 1183 | v.val = sock_flag(sk, SOCK_SELECT_ERR_QUEUE); |
1171 | break; | 1184 | break; |
1172 | 1185 | ||
1186 | #ifdef CONFIG_NET_LL_RX_POLL | ||
1187 | case SO_LL: | ||
1188 | v.val = sk->sk_ll_usec; | ||
1189 | break; | ||
1190 | #endif | ||
1191 | |||
1173 | default: | 1192 | default: |
1174 | return -ENOPROTOOPT; | 1193 | return -ENOPROTOOPT; |
1175 | } | 1194 | } |
@@ -2288,6 +2307,7 @@ void sock_init_data(struct socket *sock, struct sock *sk) | |||
2288 | 2307 | ||
2289 | #ifdef CONFIG_NET_LL_RX_POLL | 2308 | #ifdef CONFIG_NET_LL_RX_POLL |
2290 | sk->sk_napi_id = 0; | 2309 | sk->sk_napi_id = 0; |
2310 | sk->sk_ll_usec = sysctl_net_ll_poll; | ||
2291 | #endif | 2311 | #endif |
2292 | 2312 | ||
2293 | /* | 2313 | /* |