Skip to content

RFC Add bpf_link support for sk_msg prog

Yonghong Song bpf oe-kbuild-all 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 RFC Latest5 patches 17 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/5bpf: Add link support for sk_msg proginclude/linux/bpf.h include/uapi/linux/bpf.h kernel/bpf/syscall.c +3 more+181 -46 replies
2/5libbpf: Refactor bpf_program_attach_fd()tools/lib/bpf/libbpf.c+13 -52 replies
3/5libbpf: Add link support for BPF_PROG_TYPE_SK_MSGtools/lib/bpf/libbpf.c tools/lib/bpf/libbpf.h tools/lib/bpf/libbpf.map+12 -02 replies
4/5bpftool: Add link dump support for BPF_LINK_TYPE_SK_MSGtools/bpf/bpftool/link.c+8 -02 replies
5/5selftests/bpf: Add some tests with new bpf_program__attach_sk_msg() APItools/testing/selftests/bpf/prog_tests/sockmap_basic.c tools/testing/selftests/bpf/prog_tests/sockmap_listen.c+65 -00 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [RFC PATCH bpf-next 0/5] Add bpf_link support for sk_msg prog

One of our internal services started to use sk_msg program and currently it used existing prog attach/detach2 as demonstrated in selftests. But attach/detach of all other bpf programs are based on bpf_link. Consistent attach/detach APIs for all programs will make things easy to undersand and less error prone. So this patch added bpf_link support for BPF_PROG_TYPE_SK_MSG.

I marked the patch as RFC as not all functionality are covered by tests yet, e.g. update_prog(). Maybe somebody can suggest an existing test which I can look into.
Or maybe some other tests need to be added as well.

Yonghong Song (5):
bpf: Add link support for sk_msg prog
libbpf: Refactor bpf_program_attach_fd()
libbpf: Add link support for BPF_PROG_TYPE_SK_MSG
bpftool: Add link dump support for BPF_LINK_TYPE_SK_MSG selftests/bpf: Add some tests with new bpf_program__attach_sk_msg()
API

 include/linux/bpf.h                           |  13 ++
 include/uapi/linux/bpf.h                      |   5 +
 kernel/bpf/syscall.c                          |   3 +
 net/core/skmsg.c                              | 153 ++++++++++++++++++
 net/core/sock_map.c                           |   6 +-
 tools/bpf/bpftool/link.c                      |   8 +
 tools/include/uapi/linux/bpf.h                |   5 +
 tools/lib/bpf/libbpf.c                        |  26 ++-
 tools/lib/bpf/libbpf.h                        |   3 +
 tools/lib/bpf/libbpf.map                      |   1 +
 .../selftests/bpf/prog_tests/sockmap_basic.c  |  27 ++++
 .../selftests/bpf/prog_tests/sockmap_listen.c |  38 +++++
 12 files changed, 279 insertions(+), 9 deletions(-)
Signature · 1 line
2.43.0