From: Andrii Nakryiko <andrii@kernel.org>
To: <bpf@vger.kernel.org>, <ast@kernel.org>, <daniel@iogearbox.net>
Cc: <andrii@kernel.org>, <kernel-team@fb.com>,
Quentin Monnet <quentin@isovalent.com>
Subject: [PATCH bpf-next 2/6] bpftool: stop supporting BPF offload-enabled feature probing
Date: Wed, 2 Feb 2022 14:59:12 -0800 [thread overview]
Message-ID: <20220202225916.3313522-3-andrii@kernel.org> (raw)
In-Reply-To: <20220202225916.3313522-1-andrii@kernel.org>
libbpf 1.0 is not going to support passing ifindex to BPF
prog/map/helper feature probing APIs. Remove the support for BPF offload
feature probing.
Cc: Quentin Monnet <quentin@isovalent.com>
Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
---
tools/bpf/bpftool/feature.c | 29 +++++++++++++++++------------
1 file changed, 17 insertions(+), 12 deletions(-)
diff --git a/tools/bpf/bpftool/feature.c b/tools/bpf/bpftool/feature.c
index e999159fa28d..9c894b1447de 100644
--- a/tools/bpf/bpftool/feature.c
+++ b/tools/bpf/bpftool/feature.c
@@ -487,17 +487,12 @@ probe_prog_type(enum bpf_prog_type prog_type, bool *supported_types,
size_t maxlen;
bool res;
- if (ifindex)
- /* Only test offload-able program types */
- switch (prog_type) {
- case BPF_PROG_TYPE_SCHED_CLS:
- case BPF_PROG_TYPE_XDP:
- break;
- default:
- return;
- }
+ if (ifindex) {
+ p_info("BPF offload feature probing is not supported");
+ return;
+ }
- res = bpf_probe_prog_type(prog_type, ifindex);
+ res = libbpf_probe_bpf_prog_type(prog_type, NULL);
#ifdef USE_LIBCAP
/* Probe may succeed even if program load fails, for unprivileged users
* check that we did not fail because of insufficient permissions
@@ -535,7 +530,12 @@ probe_map_type(enum bpf_map_type map_type, const char *define_prefix,
size_t maxlen;
bool res;
- res = bpf_probe_map_type(map_type, ifindex);
+ if (ifindex) {
+ p_info("BPF offload feature probing is not supported");
+ return;
+ }
+
+ res = libbpf_probe_bpf_map_type(map_type, NULL);
/* Probe result depends on the success of map creation, no additional
* check required for unprivileged users
@@ -567,7 +567,12 @@ probe_helper_for_progtype(enum bpf_prog_type prog_type, bool supported_type,
bool res = false;
if (supported_type) {
- res = bpf_probe_helper(id, prog_type, ifindex);
+ if (ifindex) {
+ p_info("BPF offload feature probing is not supported");
+ return;
+ }
+
+ res = libbpf_probe_bpf_helper(prog_type, id, NULL);
#ifdef USE_LIBCAP
/* Probe may succeed even if program load fails, for
* unprivileged users check that we did not fail because of
--
2.30.2
next prev parent reply other threads:[~2022-02-02 22:59 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-02-02 22:59 [PATCH bpf-next 0/6] Clean up leftover uses of deprecated APIs Andrii Nakryiko
2022-02-02 22:59 ` [PATCH bpf-next 1/6] libbpf: stop using deprecated bpf_map__is_offload_neutral() Andrii Nakryiko
2022-02-02 22:59 ` Andrii Nakryiko [this message]
2022-02-03 10:24 ` [PATCH bpf-next 2/6] bpftool: stop supporting BPF offload-enabled feature probing Quentin Monnet
2022-02-16 10:37 ` Niklas Söderlund
2022-02-16 11:47 ` Quentin Monnet
2022-02-16 15:40 ` Niklas Söderlund
2022-02-02 22:59 ` [PATCH bpf-next 3/6] bpftool: fix uninit variable compilation warning Andrii Nakryiko
2022-02-02 22:59 ` [PATCH bpf-next 4/6] selftests/bpf: remove usage of deprecated feature probing APIs Andrii Nakryiko
2022-02-02 22:59 ` [PATCH bpf-next 5/6] selftests/bpf: redo the switch to new libbpf XDP APIs Andrii Nakryiko
2022-02-02 22:59 ` [PATCH bpf-next 6/6] samples/bpf: get rid of bpf_prog_load_xattr() use Andrii Nakryiko
2022-02-03 10:25 ` [PATCH bpf-next 0/6] Clean up leftover uses of deprecated APIs Quentin Monnet
2022-02-03 15:40 ` patchwork-bot+netdevbpf
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20220202225916.3313522-3-andrii@kernel.org \
--to=andrii@kernel.org \
--cc=ast@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=daniel@iogearbox.net \
--cc=kernel-team@fb.com \
--cc=quentin@isovalent.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).