* [PATCH bpf-next 2/2] bpftool: Probe for bounded loop support
@ 2021-12-17 12:12 Paul Chaignon
0 siblings, 0 replies; only message in thread
From: Paul Chaignon @ 2021-12-17 12:12 UTC (permalink / raw)
To: Alexei Starovoitov, Daniel Borkmann, Andrii Nakryiko; +Cc: bpf, Quentin Monnet
This patch probes for bounded loop support and displays the results as
part of the miscellaneous section, as shown below.
$ bpftool feature probe | grep loops
Bounded loop support is available
$ bpftool feature probe macro | grep LOOPS
#define HAVE_BOUNDED_LOOPS
$ bpftool feature probe -j | jq .misc
{
"have_large_insn_limit": true,
"have_bounded_loops": true
}
Reviewed-by: Quentin Monnet <quentin@isovalent.com>
Signed-off-by: Paul Chaignon <paul@isovalent.com>
---
tools/bpf/bpftool/feature.c | 13 +++++++++++++
1 file changed, 13 insertions(+)
diff --git a/tools/bpf/bpftool/feature.c b/tools/bpf/bpftool/feature.c
index 5397077d0d9e..7aee920162e5 100644
--- a/tools/bpf/bpftool/feature.c
+++ b/tools/bpf/bpftool/feature.c
@@ -654,6 +654,18 @@ probe_large_insn_limit(const char *define_prefix, __u32 ifindex)
res, define_prefix);
}
+static void
+probe_bounded_loops(const char *define_prefix, __u32 ifindex)
+{
+ bool res;
+
+ res = bpf_probe_bounded_loops(ifindex);
+ print_bool_feature("have_bounded_loops",
+ "Bounded loop support",
+ "BOUNDED_LOOPS",
+ res, define_prefix);
+}
+
static void
section_system_config(enum probe_component target, const char *define_prefix)
{
@@ -768,6 +780,7 @@ static void section_misc(const char *define_prefix, __u32 ifindex)
"/*** eBPF misc features ***/",
define_prefix);
probe_large_insn_limit(define_prefix, ifindex);
+ probe_bounded_loops(define_prefix, ifindex);
print_end_section();
}
--
2.25.1
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2021-12-17 12:12 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-12-17 12:12 [PATCH bpf-next 2/2] bpftool: Probe for bounded loop support Paul Chaignon
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).