aboutsummaryrefslogtreecommitdiffstats
path: root/tools/include/uapi/linux/bpf.h
diff options
context:
space:
mode:
authorYonghong Song <yhs@fb.com>2018-11-19 15:29:11 -0800
committerAlexei Starovoitov <ast@kernel.org>2018-11-20 10:54:39 -0800
commit838e96904ff3fc6c30e5ebbc611474669856e3c0 (patch)
tree6c29177207be1dea47bc54f4ac9e31a5e71d9bd3 /tools/include/uapi/linux/bpf.h
parenttools/bpf: Add tests for BTF_KIND_FUNC_PROTO and BTF_KIND_FUNC (diff)
downloadlinux-dev-838e96904ff3fc6c30e5ebbc611474669856e3c0.tar.xz
linux-dev-838e96904ff3fc6c30e5ebbc611474669856e3c0.zip
bpf: Introduce bpf_func_info
This patch added interface to load a program with the following additional information: . prog_btf_fd . func_info, func_info_rec_size and func_info_cnt where func_info will provide function range and type_id corresponding to each function. The func_info_rec_size is introduced in the UAPI to specify struct bpf_func_info size passed from user space. This intends to make bpf_func_info structure growable in the future. If the kernel gets a different bpf_func_info size from userspace, it will try to handle user request with part of bpf_func_info it can understand. In this patch, kernel can understand struct bpf_func_info { __u32 insn_offset; __u32 type_id; }; If user passed a bpf func_info record size of 16 bytes, the kernel can still handle part of records with the above definition. If verifier agrees with function range provided by the user, the bpf_prog ksym for each function will use the func name provided in the type_id, which is supposed to provide better encoding as it is not limited by 16 bytes program name limitation and this is better for bpf program which contains multiple subprograms. The bpf_prog_info interface is also extended to return btf_id, func_info, func_info_rec_size and func_info_cnt to userspace, so userspace can print out the function prototype for each xlated function. The insn_offset in the returned func_info corresponds to the insn offset for xlated functions. With other jit related fields in bpf_prog_info, userspace can also print out function prototypes for each jited function. Signed-off-by: Yonghong Song <yhs@fb.com> Signed-off-by: Martin KaFai Lau <kafai@fb.com> Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Diffstat (limited to '')
0 files changed, 0 insertions, 0 deletions