Netdev List
 help / color / mirror / Atom feed
* [PATCH bpf-next v4 07/13] tools/bpf: add new fields for program load in lib/bpf
@ 2018-11-08 20:37 Yonghong Song
  2018-11-08 20:37 ` [PATCH bpf-next v4 08/13] tools/bpf: extends test_btf to test load/retrieve func_type info Yonghong Song
  2018-11-08 20:37 ` [PATCH bpf-next v4 09/13] tools/bpf: add support to read .BTF.ext sections Yonghong Song
  0 siblings, 2 replies; 3+ messages in thread
From: Yonghong Song @ 2018-11-08 20:37 UTC (permalink / raw)
  To: ast, daniel, netdev; +Cc: kernel-team

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.

Acked-by: Martin KaFai Lau <kafai@fb.com>
Signed-off-by: Yonghong Song <yhs@fb.com>
---
 tools/lib/bpf/bpf.c | 4 ++++
 tools/lib/bpf/bpf.h | 4 ++++
 2 files changed, 8 insertions(+)

diff --git a/tools/lib/bpf/bpf.c b/tools/lib/bpf/bpf.c
index 03f9bcc4ef50..06fc5e91ac51 100644
--- a/tools/lib/bpf/bpf.c
+++ b/tools/lib/bpf/bpf.c
@@ -196,6 +196,10 @@ int bpf_load_program_xattr(const struct bpf_load_program_attr *load_attr,
 	attr.log_level = 0;
 	attr.kern_version = load_attr->kern_version;
 	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,
 	       min(name_len, BPF_OBJ_NAME_LEN - 1));
 
diff --git a/tools/lib/bpf/bpf.h b/tools/lib/bpf/bpf.h
index 26a51538213c..8bdfd806253a 100644
--- a/tools/lib/bpf/bpf.h
+++ b/tools/lib/bpf/bpf.h
@@ -74,6 +74,10 @@ struct bpf_load_program_attr {
 	const char *license;
 	__u32 kern_version;
 	__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 */
-- 
2.17.1

^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2018-11-09  6:14 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-11-08 20:37 [PATCH bpf-next v4 07/13] tools/bpf: add new fields for program load in lib/bpf Yonghong Song
2018-11-08 20:37 ` [PATCH bpf-next v4 08/13] tools/bpf: extends test_btf to test load/retrieve func_type info Yonghong Song
2018-11-08 20:37 ` [PATCH bpf-next v4 09/13] tools/bpf: add support to read .BTF.ext sections Yonghong Song

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox