From: Lorenz Bauer <lmb@cloudflare.com>
To: ast@kernel.org, yhs@fb.com, daniel@iogearbox.net,
jakub@cloudflare.com, john.fastabend@gmail.com, kafai@fb.com
Cc: bpf@vger.kernel.org, kernel-team@cloudflare.com,
Lorenz Bauer <lmb@cloudflare.com>
Subject: [PATCH bpf-next v5 0/3] Sockmap iterator
Date: Wed, 9 Sep 2020 17:27:09 +0100 [thread overview]
Message-ID: <20200909162712.221874-1-lmb@cloudflare.com> (raw)
I've decided to drop the changes that extend BTF pointers from this series.
They are a lot more work than I anticipated, and I don't want to hold
this up more.
The context for a sockmap / sockhash iterator contains the key, and a BTF
pointer to a socket. Iterating a sockmap will yield a NULL socket if the
slot in the array is empty. Iterating a hashmap will never yield a NULL
socket.
I'll add support to call map_update_elem from bpf_iter in a follow up to
this series.
Changes in v5:
- Drop pointer to struct sock shenanigans
Changes in v4:
- Alias struct sock* to PTR_TO_SOCK_COMMON instead of PTR_TO_SOCKET (Martin)
Changes in v3:
- Use PTR_TO_BTF_ID in iterator context (Yonghong, Martin)
- Use rcu_dereference instead of rcu_dereference_raw (Jakub)
- Fix various test nits (Jakub, Andrii)
Changes in v2:
- Remove unnecessary sk_fullsock checks (Jakub)
- Nits for test output (Jakub)
- Increase number of sockets in tests to 64 (Jakub)
- Handle ENOENT in tests (Jakub)
- Actually test SOCKHASH iteration (myself)
- Fix SOCKHASH iterator initialization (myself)
Lorenz Bauer (3):
net: sockmap: Remove unnecessary sk_fullsock checks
net: Allow iterating sockmap and sockhash
selftests: bpf: Test iterating a sockmap
net/core/sock_map.c | 284 +++++++++++++++++-
.../selftests/bpf/prog_tests/sockmap_basic.c | 89 ++++++
tools/testing/selftests/bpf/progs/bpf_iter.h | 9 +
.../selftests/bpf/progs/bpf_iter_sockmap.c | 43 +++
.../selftests/bpf/progs/bpf_iter_sockmap.h | 3 +
5 files changed, 424 insertions(+), 4 deletions(-)
create mode 100644 tools/testing/selftests/bpf/progs/bpf_iter_sockmap.c
create mode 100644 tools/testing/selftests/bpf/progs/bpf_iter_sockmap.h
--
2.25.1
next reply other threads:[~2020-09-09 16:28 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-09-09 16:27 Lorenz Bauer [this message]
2020-09-09 16:27 ` [PATCH bpf-next v5 1/3] net: sockmap: Remove unnecessary sk_fullsock checks Lorenz Bauer
2020-09-09 16:27 ` [PATCH bpf-next v5 2/3] net: Allow iterating sockmap and sockhash Lorenz Bauer
2020-09-10 17:40 ` Yonghong Song
2020-09-09 16:27 ` [PATCH bpf-next v5 3/3] selftests: bpf: Test iterating a sockmap Lorenz Bauer
2020-09-10 18:11 ` Yonghong Song
2020-09-10 19:36 ` Alexei Starovoitov
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20200909162712.221874-1-lmb@cloudflare.com \
--to=lmb@cloudflare.com \
--cc=ast@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=daniel@iogearbox.net \
--cc=jakub@cloudflare.com \
--cc=john.fastabend@gmail.com \
--cc=kafai@fb.com \
--cc=kernel-team@cloudflare.com \
--cc=yhs@fb.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox