summaryrefslogtreecommitdiffstats
path: root/tools/lib/bpf/bpf.h
diff options
context:
space:
mode:
authorWang Nan <wangnan0@huawei.com>2015-07-01 02:14:06 +0000
committerArnaldo Carvalho de Melo <acme@redhat.com>2015-08-07 10:16:58 -0300
commit7bf98369a73a9a84c56b3f2b247ea8f0eaf8668b (patch)
treee230f8c6c9757148d4e5a73b28a19c29561705db /tools/lib/bpf/bpf.h
parent8a47a6c522c0593a977069b0b1e5a0725ca0e32e (diff)
downloadlinux-7bf98369a73a9a84c56b3f2b247ea8f0eaf8668b.tar.bz2
bpf tools: Introduce bpf_load_program() to bpf.c
bpf_load_program() can be used to load bpf program into kernel. To make loading faster, first try to load without logbuf. Try again with logbuf if the first try failed. Signed-off-by: Wang Nan <wangnan0@huawei.com> Acked-by: Alexei Starovoitov <ast@plumgrid.com> Cc: Brendan Gregg <brendan.d.gregg@gmail.com> Cc: Daniel Borkmann <daniel@iogearbox.net> Cc: David Ahern <dsahern@gmail.com> Cc: He Kuang <hekuang@huawei.com> Cc: Jiri Olsa <jolsa@kernel.org> Cc: Kaixu Xia <xiakaixu@huawei.com> Cc: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com> Cc: Namhyung Kim <namhyung@kernel.org> Cc: Peter Zijlstra <a.p.zijlstra@chello.nl> Cc: Zefan Li <lizefan@huawei.com> Cc: pi3orama@163.com Link: http://lkml.kernel.org/r/1435716878-189507-19-git-send-email-wangnan0@huawei.com Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools/lib/bpf/bpf.h')
-rw-r--r--tools/lib/bpf/bpf.h7
1 files changed, 7 insertions, 0 deletions
diff --git a/tools/lib/bpf/bpf.h b/tools/lib/bpf/bpf.h
index 28f79426834d..854b7361b784 100644
--- a/tools/lib/bpf/bpf.h
+++ b/tools/lib/bpf/bpf.h
@@ -13,4 +13,11 @@
int bpf_create_map(enum bpf_map_type map_type, int key_size, int value_size,
int max_entries);
+/* Recommend log buffer size */
+#define BPF_LOG_BUF_SIZE 65536
+int bpf_load_program(enum bpf_prog_type type, struct bpf_insn *insns,
+ size_t insns_cnt, char *license,
+ u32 kern_version, char *log_buf,
+ size_t log_buf_sz);
+
#endif