diff options
author | Akhmat Karakotov <hmukos@yandex-team.ru> | 2022-01-31 16:31:24 +0300 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2022-01-31 15:05:25 +0000 |
commit | e7b9bfd18476cd3de9a3819235f9221e59abc80a (patch) | |
tree | def56040256174c45370e14ecc715e1de8e71351 | |
parent | 2127324a7d4a205ceb0452512a3b8c0999b4e86e (diff) |
bpf: Add SO_TXREHASH setsockopt
Add bpf socket option to override rehash behaviour from userspace or from bpf.
Signed-off-by: Akhmat Karakotov <hmukos@yandex-team.ru>
Reviewed-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r-- | net/core/filter.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/net/core/filter.c b/net/core/filter.c index a06931c27eeb..9615ae1ab530 100644 --- a/net/core/filter.c +++ b/net/core/filter.c @@ -5091,6 +5091,13 @@ static int _bpf_setsockopt(struct sock *sk, int level, int optname, case SO_REUSEPORT: sk->sk_reuseport = valbool; break; + case SO_TXREHASH: + if (val < -1 || val > 1) { + ret = -EINVAL; + break; + } + sk->sk_txrehash = (u8)val; + break; default: ret = -EINVAL; } @@ -5269,6 +5276,9 @@ static int _bpf_getsockopt(struct sock *sk, int level, int optname, case SO_REUSEPORT: *((int *)optval) = sk->sk_reuseport; break; + case SO_TXREHASH: + *((int *)optval) = sk->sk_txrehash; + break; default: goto err_clear; } |