Commit 6bdef102 authored by Eric Dumazet's avatar Eric Dumazet Committed by David S. Miller

net: support 64bit values for setsockopt(SO_MAX_PACING_RATE)

64bit kernels now support 64bit pacing rates.

This commit changes setsockopt() to accept 64bit
values provided by applications.

Old applications providing 32bit value are still supported,
but limited to the old 34Gbit limitation.
Signed-off-by: default avatarEric Dumazet <edumazet@google.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 255c1c72
...@@ -1108,15 +1108,23 @@ int sock_setsockopt(struct socket *sock, int level, int optname, ...@@ -1108,15 +1108,23 @@ int sock_setsockopt(struct socket *sock, int level, int optname,
#endif #endif
case SO_MAX_PACING_RATE: case SO_MAX_PACING_RATE:
if (val != ~0U) {
unsigned long ulval = (val == ~0U) ? ~0UL : val;
if (sizeof(ulval) != sizeof(val) &&
optlen >= sizeof(ulval) &&
get_user(ulval, (unsigned long __user *)optval)) {
ret = -EFAULT;
break;
}
if (ulval != ~0UL)
cmpxchg(&sk->sk_pacing_status, cmpxchg(&sk->sk_pacing_status,
SK_PACING_NONE, SK_PACING_NONE,
SK_PACING_NEEDED); SK_PACING_NEEDED);
sk->sk_max_pacing_rate = (val == ~0U) ? ~0UL : val; sk->sk_max_pacing_rate = ulval;
sk->sk_pacing_rate = min(sk->sk_pacing_rate, sk->sk_pacing_rate = min(sk->sk_pacing_rate, ulval);
sk->sk_max_pacing_rate);
break; break;
}
case SO_INCOMING_CPU: case SO_INCOMING_CPU:
sk->sk_incoming_cpu = val; sk->sk_incoming_cpu = val;
break; break;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment