diff options
author | Kuniyuki Iwashima <kuniyu@amazon.co.jp> | 2021-06-12 14:32:17 +0200 |
---|---|---|
committer | Daniel Borkmann <daniel@iogearbox.net> | 2021-06-15 18:01:05 +0200 |
commit | 1cd62c21572c1df6e7090ea4cabf4cf509616dbb (patch) | |
tree | a170e49c2fcd683a4d964fcccaf7221328376723 /include/net/sock_reuseport.h | |
parent | tcp: Keep TCP_CLOSE sockets in the reuseport group. (diff) | |
download | linux-1cd62c21572c1df6e7090ea4cabf4cf509616dbb.tar.xz linux-1cd62c21572c1df6e7090ea4cabf4cf509616dbb.zip |
tcp: Add reuseport_migrate_sock() to select a new listener.
reuseport_migrate_sock() does the same check done in
reuseport_listen_stop_sock(). If the reuseport group is capable of
migration, reuseport_migrate_sock() selects a new listener by the child
socket hash and increments the listener's sk_refcnt beforehand. Thus, if we
fail in the migration, we have to decrement it later.
We will support migration by eBPF in the later commits.
Signed-off-by: Kuniyuki Iwashima <kuniyu@amazon.co.jp>
Signed-off-by: Martin KaFai Lau <kafai@fb.com>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Reviewed-by: Eric Dumazet <edumazet@google.com>
Link: https://lore.kernel.org/bpf/20210612123224.12525-5-kuniyu@amazon.co.jp
Diffstat (limited to 'include/net/sock_reuseport.h')
-rw-r--r-- | include/net/sock_reuseport.h | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/include/net/sock_reuseport.h b/include/net/sock_reuseport.h index 1333d0cddfbc..473b0b0fa4ab 100644 --- a/include/net/sock_reuseport.h +++ b/include/net/sock_reuseport.h @@ -37,6 +37,9 @@ extern struct sock *reuseport_select_sock(struct sock *sk, u32 hash, struct sk_buff *skb, int hdr_len); +struct sock *reuseport_migrate_sock(struct sock *sk, + struct sock *migrating_sk, + struct sk_buff *skb); extern int reuseport_attach_prog(struct sock *sk, struct bpf_prog *prog); extern int reuseport_detach_prog(struct sock *sk); |