BPF List
 help / color / mirror / Atom feed
* [PATCH bpf-next v5 0/3] Sockmap iterator
@ 2020-09-09 16:27 Lorenz Bauer
  2020-09-09 16:27 ` [PATCH bpf-next v5 1/3] net: sockmap: Remove unnecessary sk_fullsock checks Lorenz Bauer
                   ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: Lorenz Bauer @ 2020-09-09 16:27 UTC (permalink / raw)
  To: ast, yhs, daniel, jakub, john.fastabend, kafai
  Cc: bpf, kernel-team, Lorenz Bauer

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


^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2020-09-10 19:37 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-09-09 16:27 [PATCH bpf-next v5 0/3] Sockmap iterator Lorenz Bauer
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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox