[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20191028055247.bh5bctgxfvmr3zjh@kafai-mbp.dhcp.thefacebook.com>
Date: Mon, 28 Oct 2019 05:52:56 +0000
From: Martin Lau <kafai@...com>
To: Jakub Sitnicki <jakub@...udflare.com>
CC: "bpf@...r.kernel.org" <bpf@...r.kernel.org>,
John Fastabend <john.fastabend@...il.com>,
"netdev@...r.kernel.org" <netdev@...r.kernel.org>,
"kernel-team@...udflare.com" <kernel-team@...udflare.com>
Subject: Re: [RFC bpf-next 0/5] Extend SOCKMAP to store listening sockets
On Tue, Oct 22, 2019 at 01:37:25PM +0200, Jakub Sitnicki wrote:
> This patch set is a follow up on a suggestion from LPC '19 discussions to
> make SOCKMAP (or a new map type derived from it) a generic type for storing
> established as well as listening sockets.
>
> We found ourselves in need of a map type that keeps references to listening
> sockets when working on making the socket lookup programmable, aka BPF
> inet_lookup [1]. Initially we repurposed REUSEPORT_SOCKARRAY but found it
> problematic to extend due to being tightly coupled with reuseport
> logic (see slides [2]).
> So we've turned our attention to SOCKMAP instead.
>
> As it turns out the changes needed to make SOCKMAP suitable for storing
> listening sockets are self-contained and have use outside of programming
> the socket lookup. Hence this patch set.
>
> With these patches SOCKMAP can be used in SK_REUSEPORT BPF programs as a
> drop-in replacement for REUSEPORT_SOCKARRAY for TCP. This can hopefully
> lead to code consolidation between the two map types in the future.
What is the plan for UDP support in sockmap?
>
> Having said that, the main intention here is to lay groundwork for using
> SOCKMAP in the next iteration of programmable socket lookup patches.
What may be the minimal to get only lookup work for UDP sockmap?
.close() and .unhash()?
>
> I'm looking for feedback if there's anything fundamentally wrong with
> extending SOCKMAP map type like this that I might have missed.
>
> Thanks,
> Jakub
>
> [1] https://lore.kernel.org/bpf/20190828072250.29828-1-jakub@cloudflare.com/
> [2] https://urldefense.proofpoint.com/v2/url?u=https-3A__linuxplumbersconf.org_event_4_contributions_487_attachments_238_417_Programmable-5Fsocket-5Flookup-5FLPC-5F19.pdf&d=DwIDAg&c=5VD0RTtNlTh3ycd41b3MUw&r=VQnoQ7LvghIj0gVEaiQSUw&m=Y-Ap1QuRBsqsu8gATb1wH3rPT89No2mam2qINt1BGDI&s=_sfXVfJhB2eR7znE7-WBk660dQXIBxuDLRi7jvXVpsg&e=
>
>
> Jakub Sitnicki (5):
> bpf, sockmap: Let BPF helpers use lookup operation on SOCKMAP
> bpf, sockmap: Allow inserting listening TCP sockets into SOCKMAP
> bpf, sockmap: Don't let child socket inherit psock or its ops on copy
> bpf: Allow selecting reuseport socket from a SOCKMAP
> selftests/bpf: Extend SK_REUSEPORT tests to cover SOCKMAP
>
> kernel/bpf/verifier.c | 6 +-
> net/core/sock_map.c | 11 +-
> net/ipv4/tcp_bpf.c | 30 ++++
> tools/testing/selftests/bpf/Makefile | 7 +-
> .../selftests/bpf/test_select_reuseport.c | 141 ++++++++++++++----
> .../selftests/bpf/test_select_reuseport.sh | 14 ++
> 6 files changed, 173 insertions(+), 36 deletions(-)
> create mode 100755 tools/testing/selftests/bpf/test_select_reuseport.sh
>
> --
> 2.20.1
>
Powered by blists - more mailing lists