eal: fix telemetry logtype registration
PATCH 1/1 eal: fix telemetry logtype registration
rte_log_register_type_and_pick_level() returns an int. Casting to a uin32_t will make us miss the -1 passed in case of failure.
--- lib/librte_eal/freebsd/eal.c | 4 +++- lib/librte_eal/linux/eal.c | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-)
lib/librte_eal/freebsd/eal.c +3 -1
@@ -941,8 +941,10 @@ rte_eal_init(int argc, char **argv)return -1 ; }if (!internal_conf->no_telemetry) { -uint32_t tlog =rte_log_register_type_and_pick_level ( +int tlog =rte_log_register_type_and_pick_level ("lib.telemetry" ,RTE_LOG_WARNING ); +if (tlog <0 ) + tlog =RTE_LOGTYPE_EAL ;if (rte_telemetry_init (rte_eal_get_runtime_dir (),rte_version (), &internal_conf->ctrl_cpuset, rte_log, tlog) !=0 )
lib/librte_eal/linux/eal.c +3 -1
@@ -1314,8 +1314,10 @@ rte_eal_init(int argc, char **argv)return -1 ; }if (!internal_conf->no_telemetry) { -uint32_t tlog =rte_log_register_type_and_pick_level ( +int tlog =rte_log_register_type_and_pick_level ("lib.telemetry" ,RTE_LOG_WARNING ); +if (tlog <0 ) + tlog =RTE_LOGTYPE_EAL ;if (rte_telemetry_init (rte_eal_get_runtime_dir (),rte_version (), &internal_conf->ctrl_cpuset, rte_log, tlog) !=0 )
Signature · 1 line
2.23.0
Quoted 7 lines · David Marchand
rte_log_register_type_and_pick_level()returns an int. Casting to auin32_twill make us miss the -1 passed in case of failure.Fixes 37b881a96194 ("telemetry: use log function from pointer")Signed-off-by David Marchand <[email protected]>---
06/04/2021 12:18, Bruce Richardson:
Quoted 9 lines · David Marchand
Quoted 7 lines
rte_log_register_type_and_pick_level()returns an int. Casting to auin32_twill make us miss the -1 passed in case of failure.Fixes 37b881a96194 ("telemetry: use log function from pointer")Signed-off-by David Marchand <[email protected]>---
Acked-by Bruce Richardson <[email protected]>
Good catch, I missed it when doing the patch "log: choose EAL log type on registration failure"
https://patches.dpdk.org/project/dpdk/patch/[email protected]/
About the title, I would not say it fixes the registration. It is more about catching registration failure with a fallback.
David Marchand
AppliedQuoted 11 lines · Bruce Richardson
Quoted 7 lines · David Marchand
rte_log_register_type_and_pick_level()returns an int. Casting to auin32_twill make us miss the -1 passed in case of failure.Fixes 37b881a96194 ("telemetry: use log function from pointer")Signed-off-by David Marchand <[email protected]>---
Acked-by Bruce Richardson <[email protected]>
Applied, thanks.
Signature · 1 line
David Marchand