Commit e7b9bfd1 authored by Akhmat Karakotov's avatar Akhmat Karakotov Committed by David S. Miller

bpf: Add SO_TXREHASH setsockopt

Add bpf socket option to override rehash behaviour from userspace or from bpf.
Signed-off-by: default avatarAkhmat Karakotov <hmukos@yandex-team.ru>
Reviewed-by: default avatarEric Dumazet <edumazet@google.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 2127324a
...@@ -5091,6 +5091,13 @@ static int _bpf_setsockopt(struct sock *sk, int level, int optname, ...@@ -5091,6 +5091,13 @@ static int _bpf_setsockopt(struct sock *sk, int level, int optname,
case SO_REUSEPORT: case SO_REUSEPORT:
sk->sk_reuseport = valbool; sk->sk_reuseport = valbool;
break; break;
case SO_TXREHASH:
if (val < -1 || val > 1) {
ret = -EINVAL;
break;
}
sk->sk_txrehash = (u8)val;
break;
default: default:
ret = -EINVAL; ret = -EINVAL;
} }
...@@ -5269,6 +5276,9 @@ static int _bpf_getsockopt(struct sock *sk, int level, int optname, ...@@ -5269,6 +5276,9 @@ static int _bpf_getsockopt(struct sock *sk, int level, int optname,
case SO_REUSEPORT: case SO_REUSEPORT:
*((int *)optval) = sk->sk_reuseport; *((int *)optval) = sk->sk_reuseport;
break; break;
case SO_TXREHASH:
*((int *)optval) = sk->sk_txrehash;
break;
default: default:
goto err_clear; goto err_clear;
} }
......
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