perfmon: fix perfmon start type argument

When trying to start perfmon with a bundle that has a unique type while
specifying that type as argument, the command fails
(e.g. perfmon start bundle branch-mispred type node).
This error occurs because the returned value of
unformat_perfmon_active_type is actually a perfmon_bundle_type_t, but
it was treated as a perfmon_bundle_type_flag_t by a test in the CLI
function.

However, this test is useless and thus can just be removed.

Type: fix
Signed-off-by: Maxime Peim <mpeim@cisco.com>
Change-Id: I5d8b9815871621e8ee7b935586f4cedbc0e7a53d
This commit is contained in:
Maxime Peim
2023-03-16 16:10:00 +00:00
committed by Damjan Marion
parent cada0c5075
commit 2eb8d1ae0c

View File

@ -68,7 +68,7 @@ unformat_perfmon_active_type (unformat_input_t *input, va_list *args)
}
vec_free (str);
return bundle_type ? 1 : 0;
return 1;
}
uword
@ -560,11 +560,9 @@ perfmon_start_command_fn (vlib_main_t *vm, unformat_input_t *input,
if (!bundle_type)
return clib_error_return (0, "please specify a valid type");
}
else /* otherwise just use the default */
/* otherwise just use the default */
else if (!bundle_type)
{
if (bundle_type && !(b->type_flags & bundle_type))
return clib_error_return (0, "please specify a valid type");
bundle_type =
(perfmon_bundle_type_t) count_trailing_zeros (b->type_flags);
}