diff options
author | Eliezer Tamir <eliezer.tamir@linux.intel.com> | 2013-06-14 16:33:57 +0300 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2013-06-17 15:48:14 -0700 |
commit | dafcc4380deec21d160c31411f33c8813f67f517 (patch) | |
tree | 4d1984857eca0b470d229604a5634fee87da7073 /net/core/sock.c | |
parent | 89bf1b5a683df497c572c4d3bd3f9c9aa919d773 (diff) | |
download | blackbird-op-linux-dafcc4380deec21d160c31411f33c8813f67f517.tar.gz blackbird-op-linux-dafcc4380deec21d160c31411f33c8813f67f517.zip |
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/sock.c')
-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: sock_valbool_flag(sk, SOCK_SELECT_ERR_QUEUE, valbool); break; +#ifdef CONFIG_NET_LL_RX_POLL + case SO_LL: + /* allow unprivileged users to decrease the value */ + if ((val > sk->sk_ll_usec) && !capable(CAP_NET_ADMIN)) + ret = -EPERM; + else { + if (val < 0) + ret = -EINVAL; + else + sk->sk_ll_usec = val; + } + break; +#endif default: ret = -ENOPROTOOPT; break; @@ -1170,6 +1183,12 @@ int sock_getsockopt(struct socket *sock, int level, int optname, v.val = sock_flag(sk, SOCK_SELECT_ERR_QUEUE); break; +#ifdef CONFIG_NET_LL_RX_POLL + case SO_LL: + v.val = sk->sk_ll_usec; + break; +#endif + default: return -ENOPROTOOPT; } @@ -2288,6 +2307,7 @@ void sock_init_data(struct socket *sock, struct sock *sk) #ifdef CONFIG_NET_LL_RX_POLL sk->sk_napi_id = 0; + sk->sk_ll_usec = sysctl_net_ll_poll; #endif /* |