diff options
author | David S. Miller <davem@davemloft.net> | 2019-02-06 19:56:20 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2019-02-06 19:56:20 -0500 |
commit | e90b1fd83c94d536375d8b9f4916afd15f4db0ed (patch) | |
tree | ba50688cc9a6712575aa861ff37b1db53dc472b8 /tools/lib/bpf/btf.h | |
parent | 907bea9cb8e9b7c4cb6a8042c164f3c24f141006 (diff) | |
parent | dd9cef43c222df7c0d76d34451808e789952379d (diff) |
Merge git://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf-next
Daniel Borkmann says:
====================
pull-request: bpf-next 2019-02-07
The following pull-request contains BPF updates for your *net-next* tree.
The main changes are:
1) Add a riscv64 JIT for BPF, from Björn.
2) Implement BTF deduplication algorithm for libbpf which takes BTF type
information containing duplicate per-compilation unit information and
reduces it to an equivalent set of BTF types with no duplication and
without loss of information, from Andrii.
3) Offloaded and native BPF XDP programs can coexist today, enable also
offloaded and generic ones as well, from Jakub.
4) Expose various BTF related helper functions in libbpf as API which
are in particular helpful for JITed programs, from Yonghong.
5) Fix the recently added JMP32 code emission in s390x JIT, from Heiko.
6) Fix BPF kselftests' tcp_{server,client}.py to be able to run inside
a network namespace, also add a fix for libbpf to get libbpf_print()
working, from Stanislav.
7) Fixes for bpftool documentation, from Prashant.
8) Type cleanup in BPF kselftests' test_maps.c to silence a gcc8 warning,
from Breno.
====================
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'tools/lib/bpf/btf.h')
-rw-r--r-- | tools/lib/bpf/btf.h | 43 |
1 files changed, 27 insertions, 16 deletions
diff --git a/tools/lib/bpf/btf.h b/tools/lib/bpf/btf.h index b0610dcdae6b..b393da90cc85 100644 --- a/tools/lib/bpf/btf.h +++ b/tools/lib/bpf/btf.h | |||
@@ -55,33 +55,44 @@ struct btf_ext_header { | |||
55 | __u32 line_info_len; | 55 | __u32 line_info_len; |
56 | }; | 56 | }; |
57 | 57 | ||
58 | typedef int (*btf_print_fn_t)(const char *, ...) | ||
59 | __attribute__((format(printf, 1, 2))); | ||
60 | |||
61 | LIBBPF_API void btf__free(struct btf *btf); | 58 | LIBBPF_API void btf__free(struct btf *btf); |
62 | LIBBPF_API struct btf *btf__new(__u8 *data, __u32 size, btf_print_fn_t err_log); | 59 | LIBBPF_API struct btf *btf__new(__u8 *data, __u32 size); |
63 | LIBBPF_API __s32 btf__find_by_name(const struct btf *btf, | 60 | LIBBPF_API __s32 btf__find_by_name(const struct btf *btf, |
64 | const char *type_name); | 61 | const char *type_name); |
62 | LIBBPF_API __u32 btf__get_nr_types(const struct btf *btf); | ||
65 | LIBBPF_API const struct btf_type *btf__type_by_id(const struct btf *btf, | 63 | LIBBPF_API const struct btf_type *btf__type_by_id(const struct btf *btf, |
66 | __u32 id); | 64 | __u32 id); |
67 | LIBBPF_API __s64 btf__resolve_size(const struct btf *btf, __u32 type_id); | 65 | LIBBPF_API __s64 btf__resolve_size(const struct btf *btf, __u32 type_id); |
68 | LIBBPF_API int btf__resolve_type(const struct btf *btf, __u32 type_id); | 66 | LIBBPF_API int btf__resolve_type(const struct btf *btf, __u32 type_id); |
69 | LIBBPF_API int btf__fd(const struct btf *btf); | 67 | LIBBPF_API int btf__fd(const struct btf *btf); |
68 | LIBBPF_API void btf__get_strings(const struct btf *btf, const char **strings, | ||
69 | __u32 *str_len); | ||
70 | LIBBPF_API const char *btf__name_by_offset(const struct btf *btf, __u32 offset); | 70 | LIBBPF_API const char *btf__name_by_offset(const struct btf *btf, __u32 offset); |
71 | LIBBPF_API int btf__get_from_id(__u32 id, struct btf **btf); | 71 | LIBBPF_API int btf__get_from_id(__u32 id, struct btf **btf); |
72 | LIBBPF_API int btf__get_map_kv_tids(const struct btf *btf, const char *map_name, | ||
73 | __u32 expected_key_size, | ||
74 | __u32 expected_value_size, | ||
75 | __u32 *key_type_id, __u32 *value_type_id); | ||
76 | |||
77 | LIBBPF_API struct btf_ext *btf_ext__new(__u8 *data, __u32 size); | ||
78 | LIBBPF_API void btf_ext__free(struct btf_ext *btf_ext); | ||
79 | LIBBPF_API int btf_ext__reloc_func_info(const struct btf *btf, | ||
80 | const struct btf_ext *btf_ext, | ||
81 | const char *sec_name, __u32 insns_cnt, | ||
82 | void **func_info, __u32 *cnt); | ||
83 | LIBBPF_API int btf_ext__reloc_line_info(const struct btf *btf, | ||
84 | const struct btf_ext *btf_ext, | ||
85 | const char *sec_name, __u32 insns_cnt, | ||
86 | void **line_info, __u32 *cnt); | ||
87 | LIBBPF_API __u32 btf_ext__func_info_rec_size(const struct btf_ext *btf_ext); | ||
88 | LIBBPF_API __u32 btf_ext__line_info_rec_size(const struct btf_ext *btf_ext); | ||
89 | |||
90 | struct btf_dedup_opts { | ||
91 | bool dont_resolve_fwds; | ||
92 | }; | ||
72 | 93 | ||
73 | struct btf_ext *btf_ext__new(__u8 *data, __u32 size, btf_print_fn_t err_log); | 94 | LIBBPF_API int btf__dedup(struct btf *btf, struct btf_ext *btf_ext, |
74 | void btf_ext__free(struct btf_ext *btf_ext); | 95 | const struct btf_dedup_opts *opts); |
75 | int btf_ext__reloc_func_info(const struct btf *btf, | ||
76 | const struct btf_ext *btf_ext, | ||
77 | const char *sec_name, __u32 insns_cnt, | ||
78 | void **func_info, __u32 *func_info_len); | ||
79 | int btf_ext__reloc_line_info(const struct btf *btf, | ||
80 | const struct btf_ext *btf_ext, | ||
81 | const char *sec_name, __u32 insns_cnt, | ||
82 | void **line_info, __u32 *cnt); | ||
83 | __u32 btf_ext__func_info_rec_size(const struct btf_ext *btf_ext); | ||
84 | __u32 btf_ext__line_info_rec_size(const struct btf_ext *btf_ext); | ||
85 | 96 | ||
86 | #ifdef __cplusplus | 97 | #ifdef __cplusplus |
87 | } /* extern "C" */ | 98 | } /* extern "C" */ |