Skip to content

Commit

Permalink
telemetry: use standard logging
Browse files Browse the repository at this point in the history
Now that logging is moved out of EAL, we don't need injection of the
logtype and logging function from EAL to telemetry library, simplifying
things.

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
Acked-by: Morten Brørup <mb@smartsharesystems.com>
Acked-by: Tyler Retzlaff <roretzla@linux.microsoft.com>
  • Loading branch information
bruce-richardson authored and david-marchand committed Aug 9, 2023
1 parent 09ce413 commit 68150b9
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 20 deletions.
6 changes: 1 addition & 5 deletions lib/eal/freebsd/eal.c
Original file line number Diff line number Diff line change
Expand Up @@ -898,13 +898,9 @@ rte_eal_init(int argc, char **argv)
return -1;
}
if (rte_eal_process_type() == RTE_PROC_PRIMARY && !internal_conf->no_telemetry) {
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)
&internal_conf->ctrl_cpuset) != 0)
return -1;
}

Expand Down
6 changes: 1 addition & 5 deletions lib/eal/linux/eal.c
Original file line number Diff line number Diff line change
Expand Up @@ -1314,13 +1314,9 @@ rte_eal_init(int argc, char **argv)
return -1;
}
if (rte_eal_process_type() == RTE_PROC_PRIMARY && !internal_conf->no_telemetry) {
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)
&internal_conf->ctrl_cpuset) != 0)
return -1;
}

Expand Down
11 changes: 3 additions & 8 deletions lib/telemetry/telemetry.c
Original file line number Diff line number Diff line change
Expand Up @@ -54,11 +54,9 @@ static struct socket v1_socket; /* socket for v1 telemetry */
static const char *telemetry_version; /* save rte_version */
static const char *socket_dir; /* runtime directory */
static rte_cpuset_t *thread_cpuset;
static rte_log_fn rte_log_ptr;
static uint32_t logtype;

#define TMTY_LOG(l, ...) \
rte_log_ptr(RTE_LOG_ ## l, logtype, "TELEMETRY: " __VA_ARGS__)
RTE_LOG_REGISTER_DEFAULT(logtype, WARNING);
#define TMTY_LOG(l, ...) rte_log(RTE_LOG_ ## l, logtype, "TELEMETRY: " __VA_ARGS__)

/* list of command callbacks, with one command registered by default */
static struct cmd_callback *callbacks;
Expand Down Expand Up @@ -627,14 +625,11 @@ telemetry_v2_init(void)
#endif /* !RTE_EXEC_ENV_WINDOWS */

int32_t
rte_telemetry_init(const char *runtime_dir, const char *rte_version, rte_cpuset_t *cpuset,
rte_log_fn log_fn, uint32_t registered_logtype)
rte_telemetry_init(const char *runtime_dir, const char *rte_version, rte_cpuset_t *cpuset)
{
telemetry_version = rte_version;
socket_dir = runtime_dir;
thread_cpuset = cpuset;
rte_log_ptr = log_fn;
logtype = registered_logtype;

#ifndef RTE_EXEC_ENV_WINDOWS
if (telemetry_v2_init() != 0)
Expand Down
3 changes: 1 addition & 2 deletions lib/telemetry/telemetry_internal.h
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,6 @@ typedef int (*rte_log_fn)(uint32_t level, uint32_t logtype, const char *format,
*/
__rte_internal
int
rte_telemetry_init(const char *runtime_dir, const char *rte_version, rte_cpuset_t *cpuset,
rte_log_fn log_fn, uint32_t registered_logtype);
rte_telemetry_init(const char *runtime_dir, const char *rte_version, rte_cpuset_t *cpuset);

#endif

0 comments on commit 68150b9

Please sign in to comment.