diff options
| author | Dmitry Vyukov <dvyukov@google.com> | 2022-04-27 16:21:45 +0200 |
|---|---|---|
| committer | Dmitry Vyukov <dvyukov@google.com> | 2022-04-27 17:43:05 +0200 |
| commit | 8a1f1f07b4d5c51a99e439c5b13b0cd8bb742856 (patch) | |
| tree | d36af787bbc16b9e0efae1c866ed280d57a78471 /sys/linux/bpf.txt | |
| parent | d6b461d9bcc04628b6e782d80e373469bccef743 (diff) | |
sys/linux: make bpf_link_create_arg a template
Make bpf_link_create_arg a template so that it's possible to create more specialized versions.
Add a specialized version for XDP links. First, they need a special program type,
plus a special attach type and target fd is not an fd, but rather ifindex.
Diffstat (limited to 'sys/linux/bpf.txt')
| -rw-r--r-- | sys/linux/bpf.txt | 20 |
1 files changed, 15 insertions, 5 deletions
diff --git a/sys/linux/bpf.txt b/sys/linux/bpf.txt index 11c028d4b..f700967a4 100644 --- a/sys/linux/bpf.txt +++ b/sys/linux/bpf.txt @@ -7,6 +7,7 @@ include <uapi/linux/bpf.h> include <uapi/linux/btf.h> +include <uapi/linux/if_link.h> resource fd_bpf_map[fd]: BPF_PSEUDO_MAP_FD resource fd_bpf_prog[fd] @@ -69,6 +70,13 @@ bpf$LINK_GET_NEXT_ID(cmd const[BPF_LINK_GET_NEXT_ID], arg ptr[inout, bpf_link_ge bpf$LINK_DETACH(cmd const[BPF_LINK_DETACH], arg ptr[in, fd_bpf_link], size len[arg]) bpf$PROG_BIND_MAP(cmd const[BPF_PROG_BIND_MAP], arg ptr[in, bpf_prog_bind_map_arg], size len[arg]) +resource fd_bpf_prog_xdp[fd_bpf_prog] +bpf$PROG_LOAD_XDP(cmd const[BPF_PROG_LOAD], arg ptr[in, bpf_prog_xdp], size len[arg]) fd_bpf_prog_xdp +bpf$BPF_LINK_CREATE_XDP(cmd const[BPF_LINK_CREATE], arg ptr[in, bpf_link_create_xdp], size len[arg]) fd_bpf_link +type bpf_prog_xdp bpf_prog_t[const[BPF_PROG_TYPE_XDP, int32], const[BPF_XDP, int32], const[0, int32], const[0, int32]] +type bpf_link_create_xdp bpf_link_create_arg_t[fd_bpf_prog_xdp, ifindex, const[BPF_XDP, int32], flags[xdp_flags, int32]] +xdp_flags = XDP_FLAGS_UPDATE_IF_NOEXIST, XDP_FLAGS_SKB_MODE, XDP_FLAGS_DRV_MODE, XDP_FLAGS_HW_MODE, XDP_FLAGS_REPLACE + bpf_map_create_arg [ base bpf_map_create_arg_base bloom_filter bpf_map_create_arg_bf @@ -161,13 +169,15 @@ bpf_map_batch_arg { flags const[0, int64] } -bpf_link_create_arg { - prog_fd fd_bpf_prog - target_fd fd_cgroup - attach_type flags[bpf_attach_types_link_create, int32] - flags const[0, int32] +type bpf_link_create_arg_t[PROG_FD, TARGET_FD, ATTACH_TYPE, FLAGS] { + prog_fd PROG_FD + target_fd TARGET_FD + attach_type ATTACH_TYPE + flags FLAGS } +type bpf_link_create_arg bpf_link_create_arg_t[fd_bpf_prog, fd_cgroup, flags[bpf_attach_types_link_create, int32], const[0, int32]] + bpf_link_update_arg { link_fd fd_bpf_link new_prog_fd fd_bpf_prog |
