Message ID | 20191210011438.4182911-4-andriin@fb.com |
---|---|
State | Changes Requested |
Delegated to: | BPF Maintainers |
Headers | show |
Series | Add code-generated BPF object skeleton support | expand |
On Mon, 9 Dec 2019 17:14:26 -0800, Andrii Nakryiko wrote: > Few libbpf APIs are not public but currently exposed through libbpf.h to be > used by bpftool. Move them to libbpf_internal.h, where intent of being > non-stable and non-public is much more obvious. > > Signed-off-by: Andrii Nakryiko <andriin@fb.com> > --- > tools/bpf/bpftool/net.c | 1 + > tools/lib/bpf/libbpf.h | 17 ----------------- > tools/lib/bpf/libbpf_internal.h | 17 +++++++++++++++++ > 3 files changed, 18 insertions(+), 17 deletions(-) > > diff --git a/tools/bpf/bpftool/net.c b/tools/bpf/bpftool/net.c > index 4f52d3151616..d93bee298e54 100644 > --- a/tools/bpf/bpftool/net.c > +++ b/tools/bpf/bpftool/net.c > @@ -18,6 +18,7 @@ > > #include <bpf.h> > #include <nlattr.h> > +#include "libbpf_internal.h" > #include "main.h" > #include "netlink_dumper.h" I thought this idea was unpopular when proposed?
On Mon, Dec 9, 2019 at 5:33 PM Jakub Kicinski <jakub.kicinski@netronome.com> wrote: > > On Mon, 9 Dec 2019 17:14:26 -0800, Andrii Nakryiko wrote: > > Few libbpf APIs are not public but currently exposed through libbpf.h to be > > used by bpftool. Move them to libbpf_internal.h, where intent of being > > non-stable and non-public is much more obvious. > > > > Signed-off-by: Andrii Nakryiko <andriin@fb.com> > > --- > > tools/bpf/bpftool/net.c | 1 + > > tools/lib/bpf/libbpf.h | 17 ----------------- > > tools/lib/bpf/libbpf_internal.h | 17 +++++++++++++++++ > > 3 files changed, 18 insertions(+), 17 deletions(-) > > > > diff --git a/tools/bpf/bpftool/net.c b/tools/bpf/bpftool/net.c > > index 4f52d3151616..d93bee298e54 100644 > > --- a/tools/bpf/bpftool/net.c > > +++ b/tools/bpf/bpftool/net.c > > @@ -18,6 +18,7 @@ > > > > #include <bpf.h> > > #include <nlattr.h> > > +#include "libbpf_internal.h" > > #include "main.h" > > #include "netlink_dumper.h" > > I thought this idea was unpopular when proposed? There was a recent discussion about the need for unstable APIs to be exposed to bpftool and we concluded that libbpf_internal.h is the most appropriate place to do this.
On Tue, 10 Dec 2019 09:04:58 -0800, Andrii Nakryiko wrote: > > I thought this idea was unpopular when proposed? > > There was a recent discussion about the need for unstable APIs to be > exposed to bpftool and we concluded that libbpf_internal.h is the most > appropriate place to do this. Mm. Do you happen to have lore link? Can't find now. My recollection is that only you and Alexei thought it was a good/workable idea.
On Tue, Dec 10, 2019 at 10:17 AM Jakub Kicinski <jakub.kicinski@netronome.com> wrote: > > On Tue, 10 Dec 2019 09:04:58 -0800, Andrii Nakryiko wrote: > > > I thought this idea was unpopular when proposed? > > > > There was a recent discussion about the need for unstable APIs to be > > exposed to bpftool and we concluded that libbpf_internal.h is the most > > appropriate place to do this. > > Mm. Do you happen to have lore link? Can't find now. > https://lkml.org/lkml/2019/11/27/1264 > My recollection is that only you and Alexei thought it was > a good/workable idea. Daniel and others didn't seem to mind either.
diff --git a/tools/bpf/bpftool/net.c b/tools/bpf/bpftool/net.c index 4f52d3151616..d93bee298e54 100644 --- a/tools/bpf/bpftool/net.c +++ b/tools/bpf/bpftool/net.c @@ -18,6 +18,7 @@ #include <bpf.h> #include <nlattr.h> +#include "libbpf_internal.h" #include "main.h" #include "netlink_dumper.h" diff --git a/tools/lib/bpf/libbpf.h b/tools/lib/bpf/libbpf.h index 804f445c9957..2698fbcb0c79 100644 --- a/tools/lib/bpf/libbpf.h +++ b/tools/lib/bpf/libbpf.h @@ -126,11 +126,6 @@ bpf_object__open_buffer(const void *obj_buf, size_t obj_buf_sz, LIBBPF_API struct bpf_object * bpf_object__open_xattr(struct bpf_object_open_attr *attr); -int bpf_object__section_size(const struct bpf_object *obj, const char *name, - __u32 *size); -int bpf_object__variable_offset(const struct bpf_object *obj, const char *name, - __u32 *off); - enum libbpf_pin_type { LIBBPF_PIN_NONE, /* PIN_BY_NAME: pin maps by name (in /sys/fs/bpf by default) */ @@ -514,18 +509,6 @@ bpf_perf_event_read_simple(void *mmap_mem, size_t mmap_size, size_t page_size, void **copy_mem, size_t *copy_size, bpf_perf_event_print_t fn, void *private_data); -struct nlattr; -typedef int (*libbpf_dump_nlmsg_t)(void *cookie, void *msg, struct nlattr **tb); -int libbpf_netlink_open(unsigned int *nl_pid); -int libbpf_nl_get_link(int sock, unsigned int nl_pid, - libbpf_dump_nlmsg_t dump_link_nlmsg, void *cookie); -int libbpf_nl_get_class(int sock, unsigned int nl_pid, int ifindex, - libbpf_dump_nlmsg_t dump_class_nlmsg, void *cookie); -int libbpf_nl_get_qdisc(int sock, unsigned int nl_pid, int ifindex, - libbpf_dump_nlmsg_t dump_qdisc_nlmsg, void *cookie); -int libbpf_nl_get_filter(int sock, unsigned int nl_pid, int ifindex, int handle, - libbpf_dump_nlmsg_t dump_filter_nlmsg, void *cookie); - struct bpf_prog_linfo; struct bpf_prog_info; diff --git a/tools/lib/bpf/libbpf_internal.h b/tools/lib/bpf/libbpf_internal.h index 97ac17a64a58..7ee0c8691835 100644 --- a/tools/lib/bpf/libbpf_internal.h +++ b/tools/lib/bpf/libbpf_internal.h @@ -98,6 +98,23 @@ static inline bool libbpf_validate_opts(const char *opts, int libbpf__load_raw_btf(const char *raw_types, size_t types_len, const char *str_sec, size_t str_len); +int bpf_object__section_size(const struct bpf_object *obj, const char *name, + __u32 *size); +int bpf_object__variable_offset(const struct bpf_object *obj, const char *name, + __u32 *off); + +struct nlattr; +typedef int (*libbpf_dump_nlmsg_t)(void *cookie, void *msg, struct nlattr **tb); +int libbpf_netlink_open(unsigned int *nl_pid); +int libbpf_nl_get_link(int sock, unsigned int nl_pid, + libbpf_dump_nlmsg_t dump_link_nlmsg, void *cookie); +int libbpf_nl_get_class(int sock, unsigned int nl_pid, int ifindex, + libbpf_dump_nlmsg_t dump_class_nlmsg, void *cookie); +int libbpf_nl_get_qdisc(int sock, unsigned int nl_pid, int ifindex, + libbpf_dump_nlmsg_t dump_qdisc_nlmsg, void *cookie); +int libbpf_nl_get_filter(int sock, unsigned int nl_pid, int ifindex, int handle, + libbpf_dump_nlmsg_t dump_filter_nlmsg, void *cookie); + struct btf_ext_info { /* * info points to the individual info section (e.g. func_info and
Few libbpf APIs are not public but currently exposed through libbpf.h to be used by bpftool. Move them to libbpf_internal.h, where intent of being non-stable and non-public is much more obvious. Signed-off-by: Andrii Nakryiko <andriin@fb.com> --- tools/bpf/bpftool/net.c | 1 + tools/lib/bpf/libbpf.h | 17 ----------------- tools/lib/bpf/libbpf_internal.h | 17 +++++++++++++++++ 3 files changed, 18 insertions(+), 17 deletions(-)