bpf: Add attach_type field to bpf_link
authorTao Chen <chen.dylane@linux.dev>
Thu, 10 Jul 2025 03:20:32 +0000 (11:20 +0800)
committerAndrii Nakryiko <andrii@kernel.org>
Fri, 11 Jul 2025 17:51:55 +0000 (10:51 -0700)
commitb725441f02c2b31c04a95d0e9ca5420fa029a767
tree2f2dc3a2f6835dbcc09fad06ab975f60304a0607
parentd81526a6ebff4ac2358b71d40271c8f95212fac1
bpf: Add attach_type field to bpf_link

Attach_type will be set when a link is created by user. It is better to
record attach_type in bpf_link generically and have it available
universally for all link types. So add the attach_type field in bpf_link
and move the sleepable field to avoid unnecessary gap padding.

Signed-off-by: Tao Chen <chen.dylane@linux.dev>
Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
Acked-by: Daniel Borkmann <daniel@iogearbox.net>
Acked-by: Jiri Olsa <jolsa@kernel.org>
Link: https://lore.kernel.org/bpf/20250710032038.888700-2-chen.dylane@linux.dev
14 files changed:
drivers/net/netkit.c
include/linux/bpf.h
kernel/bpf/bpf_iter.c
kernel/bpf/bpf_struct_ops.c
kernel/bpf/cgroup.c
kernel/bpf/net_namespace.c
kernel/bpf/syscall.c
kernel/bpf/tcx.c
kernel/bpf/trampoline.c
kernel/trace/bpf_trace.c
net/bpf/bpf_dummy_struct_ops.c
net/core/dev.c
net/core/sock_map.c
net/netfilter/nf_bpf_link.c