Commit 7e0d0fb5 authored by Yonghong Song's avatar Yonghong Song Committed by Alexei Starovoitov

tools/bpf: add new fields for program load in lib/bpf

The new fields are added for program load in lib/bpf so
application uses api bpf_load_program_xattr() is able
to load program with btf and func_info data.

This functionality will be used in next patch
by bpf selftest test_btf.
Signed-off-by: default avatarYonghong Song <yhs@fb.com>
Signed-off-by: default avatarMartin KaFai Lau <kafai@fb.com>
Signed-off-by: default avatarAlexei Starovoitov <ast@kernel.org>
parent cc19435c
...@@ -205,6 +205,10 @@ int bpf_load_program_xattr(const struct bpf_load_program_attr *load_attr, ...@@ -205,6 +205,10 @@ int bpf_load_program_xattr(const struct bpf_load_program_attr *load_attr,
attr.log_level = 0; attr.log_level = 0;
attr.kern_version = load_attr->kern_version; attr.kern_version = load_attr->kern_version;
attr.prog_ifindex = load_attr->prog_ifindex; attr.prog_ifindex = load_attr->prog_ifindex;
attr.prog_btf_fd = load_attr->prog_btf_fd;
attr.func_info_rec_size = load_attr->func_info_rec_size;
attr.func_info_cnt = load_attr->func_info_cnt;
attr.func_info = ptr_to_u64(load_attr->func_info);
memcpy(attr.prog_name, load_attr->name, memcpy(attr.prog_name, load_attr->name,
min(name_len, BPF_OBJ_NAME_LEN - 1)); min(name_len, BPF_OBJ_NAME_LEN - 1));
......
...@@ -74,6 +74,10 @@ struct bpf_load_program_attr { ...@@ -74,6 +74,10 @@ struct bpf_load_program_attr {
const char *license; const char *license;
__u32 kern_version; __u32 kern_version;
__u32 prog_ifindex; __u32 prog_ifindex;
__u32 prog_btf_fd;
__u32 func_info_rec_size;
const void *func_info;
__u32 func_info_cnt;
}; };
/* Flags to direct loading requirements */ /* Flags to direct loading requirements */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment