Skip to content

Commit e3450b7

Browse files
qmonnetborkmann
authored andcommitted
tools: bpftool: For "feature probe" define "full_mode" bool as global
The "full_mode" variable used for switching between full or partial feature probing (i.e. with or without probing helpers that will log warnings in kernel logs) was piped from the main do_probe() function down to probe_helpers_for_progtype(), where it is needed. Define it as a global variable: the calls will be more readable, and if other similar flags were to be used in the future, we could use global variables as well instead of extending again the list of arguments with new flags. Signed-off-by: Quentin Monnet <quentin@isovalent.com> Signed-off-by: Daniel Borkmann <daniel@iogearbox.net> Acked-by: John Fastabend <john.fastabend@gmail.com> Link: https://lore.kernel.org/bpf/20200429144506.8999-2-quentin@isovalent.com
1 parent fd9c40c commit e3450b7

File tree

1 file changed

+7
-8
lines changed

1 file changed

+7
-8
lines changed

tools/bpf/bpftool/feature.c

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,8 @@ static const char * const helper_name[] = {
3535

3636
#undef BPF_HELPER_MAKE_ENTRY
3737

38+
static bool full_mode;
39+
3840
/* Miscellaneous utility functions */
3941

4042
static bool check_procfs(void)
@@ -540,8 +542,7 @@ probe_helper_for_progtype(enum bpf_prog_type prog_type, bool supported_type,
540542

541543
static void
542544
probe_helpers_for_progtype(enum bpf_prog_type prog_type, bool supported_type,
543-
const char *define_prefix, bool full_mode,
544-
__u32 ifindex)
545+
const char *define_prefix, __u32 ifindex)
545546
{
546547
const char *ptype_name = prog_type_name[prog_type];
547548
char feat_name[128];
@@ -678,8 +679,7 @@ static void section_map_types(const char *define_prefix, __u32 ifindex)
678679
}
679680

680681
static void
681-
section_helpers(bool *supported_types, const char *define_prefix,
682-
bool full_mode, __u32 ifindex)
682+
section_helpers(bool *supported_types, const char *define_prefix, __u32 ifindex)
683683
{
684684
unsigned int i;
685685

@@ -704,8 +704,8 @@ section_helpers(bool *supported_types, const char *define_prefix,
704704
define_prefix, define_prefix, define_prefix,
705705
define_prefix);
706706
for (i = BPF_PROG_TYPE_UNSPEC + 1; i < ARRAY_SIZE(prog_type_name); i++)
707-
probe_helpers_for_progtype(i, supported_types[i],
708-
define_prefix, full_mode, ifindex);
707+
probe_helpers_for_progtype(i, supported_types[i], define_prefix,
708+
ifindex);
709709

710710
print_end_section();
711711
}
@@ -725,7 +725,6 @@ static int do_probe(int argc, char **argv)
725725
enum probe_component target = COMPONENT_UNSPEC;
726726
const char *define_prefix = NULL;
727727
bool supported_types[128] = {};
728-
bool full_mode = false;
729728
__u32 ifindex = 0;
730729
char *ifname;
731730

@@ -803,7 +802,7 @@ static int do_probe(int argc, char **argv)
803802
goto exit_close_json;
804803
section_program_types(supported_types, define_prefix, ifindex);
805804
section_map_types(define_prefix, ifindex);
806-
section_helpers(supported_types, define_prefix, full_mode, ifindex);
805+
section_helpers(supported_types, define_prefix, ifindex);
807806
section_misc(define_prefix, ifindex);
808807

809808
exit_close_json:

0 commit comments

Comments
 (0)