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(-) -- 2.43.0