diff options
| author | Tao Chen <[email protected]> | 2025-07-10 03:20:32 +0000 |
|---|---|---|
| committer | Andrii Nakryiko <[email protected]> | 2025-07-11 17:51:55 +0000 |
| commit | b725441f02c2b31c04a95d0e9ca5420fa029a767 (patch) | |
| tree | 2f2dc3a2f6835dbcc09fad06ab975f60304a0607 /net/core/dev.c | |
| parent | selftests/bpf: Range analysis test case for JSET (diff) | |
| download | kernel-b725441f02c2b31c04a95d0e9ca5420fa029a767.tar.gz kernel-b725441f02c2b31c04a95d0e9ca5420fa029a767.zip | |
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 <[email protected]>
Signed-off-by: Andrii Nakryiko <[email protected]>
Acked-by: Daniel Borkmann <[email protected]>
Acked-by: Jiri Olsa <[email protected]>
Link: https://lore.kernel.org/bpf/[email protected]
Diffstat (limited to 'net/core/dev.c')
| -rw-r--r-- | net/core/dev.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/net/core/dev.c b/net/core/dev.c index be97c440ecd5..7969fddc94e3 100644 --- a/net/core/dev.c +++ b/net/core/dev.c @@ -10364,7 +10364,8 @@ int bpf_xdp_link_attach(const union bpf_attr *attr, struct bpf_prog *prog) goto unlock; } - bpf_link_init(&link->link, BPF_LINK_TYPE_XDP, &bpf_xdp_link_lops, prog); + bpf_link_init(&link->link, BPF_LINK_TYPE_XDP, &bpf_xdp_link_lops, prog, + attr->link_create.attach_type); link->dev = dev; link->flags = attr->link_create.flags; |
