Message ID | 20220423152300.16201-2-dsahern@kernel.org (mailing list archive) |
---|---|
State | Accepted |
Commit | ba6519cbcb28ec8e78c5948fff580cdf5ce2df29 |
Delegated to: | David Ahern |
Headers | show |
Series | Address more libbpf deprecations | expand |
Context | Check | Description |
---|---|---|
netdev/tree_selection | success | Not a local patch |
Hi David, This patch revert c04e45d0 lib/bpf: fix verbose flag when using libbpf, Should we set prog->log_level directly before it loaded, like bpf_program__set_log_level() does? Thanks Hangbin On Sat, Apr 23, 2022 at 09:22:58AM -0600, David Ahern wrote: > bpf_object__load_xattr is deprecated as of v0.8+; remove it > in favor of bpf_object__load. > > Signed-off-by: David Ahern <dsahern@kernel.org> > --- > lib/bpf_libbpf.c | 7 +------ > 1 file changed, 1 insertion(+), 6 deletions(-) > > diff --git a/lib/bpf_libbpf.c b/lib/bpf_libbpf.c > index f4f98caa1e58..f723f6310c28 100644 > --- a/lib/bpf_libbpf.c > +++ b/lib/bpf_libbpf.c > @@ -248,7 +248,6 @@ static int handle_legacy_maps(struct bpf_object *obj) > > static int load_bpf_object(struct bpf_cfg_in *cfg) > { > - struct bpf_object_load_attr attr = {}; > struct bpf_program *p, *prog = NULL; > struct bpf_object *obj; > char root_path[PATH_MAX]; > @@ -305,11 +304,7 @@ static int load_bpf_object(struct bpf_cfg_in *cfg) > if (ret) > goto unload_obj; > > - attr.obj = obj; > - if (cfg->verbose) > - attr.log_level = 2; > - > - ret = bpf_object__load_xattr(&attr); > + ret = bpf_object__load(obj); > if (ret) > goto unload_obj; > > -- > 2.24.3 (Apple Git-128) >
On 4/23/22 7:56 PM, Hangbin Liu wrote: > Hi David, > > This patch revert c04e45d0 lib/bpf: fix verbose flag when using libbpf, > Should we set prog->log_level directly before it loaded, like > bpf_program__set_log_level() does? > that API is new - Dec 2021 so it will not be present across relevant libbpf versions. Detecting what exists in a libbpf version and adding compat wrappers needs to be added. That's an undertaking I do not have time for at the moment. If you or someone else does it would be appreciated.
On Sun, Apr 24, 2022 at 10:10:44AM -0600, David Ahern wrote: > On 4/23/22 7:56 PM, Hangbin Liu wrote: > > Hi David, > > > > This patch revert c04e45d0 lib/bpf: fix verbose flag when using libbpf, > > Should we set prog->log_level directly before it loaded, like > > bpf_program__set_log_level() does? > > > > that API is new - Dec 2021 so it will not be present across relevant > libbpf versions. Detecting what exists in a libbpf version and adding > compat wrappers needs to be added. That's an undertaking I do not have > time for at the moment. If you or someone else does it would be appreciated. > Ah, yes, I forgot we can't set prog log_level directly. Looks we need to add a new flag similar with HAVE_LIBBPF_SECTION_NAME... It's really a pain to add more flags for libbfp... Hi Paul, will you do that? Thanks Hangbin
diff --git a/lib/bpf_libbpf.c b/lib/bpf_libbpf.c index f4f98caa1e58..f723f6310c28 100644 --- a/lib/bpf_libbpf.c +++ b/lib/bpf_libbpf.c @@ -248,7 +248,6 @@ static int handle_legacy_maps(struct bpf_object *obj) static int load_bpf_object(struct bpf_cfg_in *cfg) { - struct bpf_object_load_attr attr = {}; struct bpf_program *p, *prog = NULL; struct bpf_object *obj; char root_path[PATH_MAX]; @@ -305,11 +304,7 @@ static int load_bpf_object(struct bpf_cfg_in *cfg) if (ret) goto unload_obj; - attr.obj = obj; - if (cfg->verbose) - attr.log_level = 2; - - ret = bpf_object__load_xattr(&attr); + ret = bpf_object__load(obj); if (ret) goto unload_obj;
bpf_object__load_xattr is deprecated as of v0.8+; remove it in favor of bpf_object__load. Signed-off-by: David Ahern <dsahern@kernel.org> --- lib/bpf_libbpf.c | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-)