DPDK patches and discussions
 help / color / mirror / Atom feed
From: Bruce Richardson <bruce.richardson@intel.com>
To: dev@dpdk.org
Cc: Bruce Richardson <bruce.richardson@intel.com>
Subject: [RFC PATCH 3/3] telemetry: use standard logging
Date: Mon, 29 Aug 2022 16:19:01 +0100	[thread overview]
Message-ID: <20220829151901.376754-4-bruce.richardson@intel.com> (raw)
In-Reply-To: <20220829151901.376754-1-bruce.richardson@intel.com>

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>
---
 lib/eal/freebsd/eal.c              |  6 +-----
 lib/eal/linux/eal.c                |  6 +-----
 lib/telemetry/telemetry.c          | 12 +++++-------
 lib/telemetry/telemetry_internal.h |  3 +--
 4 files changed, 8 insertions(+), 19 deletions(-)

diff --git a/lib/eal/freebsd/eal.c b/lib/eal/freebsd/eal.c
index 26fbc91b26..154ed65da6 100644
--- a/lib/eal/freebsd/eal.c
+++ b/lib/eal/freebsd/eal.c
@@ -871,13 +871,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;
 	}
 
diff --git a/lib/eal/linux/eal.c b/lib/eal/linux/eal.c
index 37d29643a5..8d968f6e5c 100644
--- a/lib/eal/linux/eal.c
+++ b/lib/eal/linux/eal.c
@@ -1312,13 +1312,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;
 	}
 
diff --git a/lib/telemetry/telemetry.c b/lib/telemetry/telemetry.c
index c6fd03a5ab..83d73ac517 100644
--- a/lib/telemetry/telemetry.c
+++ b/lib/telemetry/telemetry.c
@@ -51,11 +51,10 @@ 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;
+extern int logtype;
 
 #define TMTY_LOG(l, ...) \
-        rte_log_ptr(RTE_LOG_ ## l, logtype, "TELEMETRY: " __VA_ARGS__)
+        rte_log(RTE_LOG_ ## l, logtype, "TELEMETRY: " __VA_ARGS__)
 
 /* list of command callbacks, with one command registered by default */
 static struct cmd_callback *callbacks;
@@ -606,14 +605,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)
@@ -624,3 +620,5 @@ rte_telemetry_init(const char *runtime_dir, const char *rte_version, rte_cpuset_
 
 	return 0;
 }
+
+RTE_LOG_REGISTER_DEFAULT(logtype, WARNING);
diff --git a/lib/telemetry/telemetry_internal.h b/lib/telemetry/telemetry_internal.h
index d085c492dc..5c75d73183 100644
--- a/lib/telemetry/telemetry_internal.h
+++ b/lib/telemetry/telemetry_internal.h
@@ -109,7 +109,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
-- 
2.34.1


  parent reply	other threads:[~2022-08-29 15:19 UTC|newest]

Thread overview: 58+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-08-29 15:18 [RFC PATCH 0/3] Split logging out of EAL Bruce Richardson
2022-08-29 15:18 ` [RFC PATCH 1/3] os: begin separating some OS compatibility from EAL Bruce Richardson
2022-08-29 18:57   ` Morten Brørup
2022-08-30  8:41     ` Bruce Richardson
2022-08-30  8:42   ` David Marchand
2022-08-30  9:59     ` Bruce Richardson
2022-08-29 15:19 ` [RFC PATCH 2/3] log: separate logging functions out of EAL Bruce Richardson
2022-08-29 15:19 ` Bruce Richardson [this message]
2023-01-13 16:19 ` [RFC PATCH v2 0/3] Split logging functionality " Bruce Richardson
2023-01-13 16:19   ` [RFC PATCH v2 1/3] eal/windows: move fnmatch function to header file Bruce Richardson
2023-01-13 16:41     ` Morten Brørup
2023-01-13 17:01       ` Bruce Richardson
2023-01-13 17:31         ` Tyler Retzlaff
2023-01-13 17:37           ` Bruce Richardson
2023-01-13 16:20   ` [RFC PATCH v2 2/3] log: separate logging functions out of EAL Bruce Richardson
2023-01-13 16:20   ` [RFC PATCH v2 3/3] telemetry: use standard logging Bruce Richardson
2023-01-13 20:36 ` [PATCH v3 0/3] Split logging functionality out of EAL Bruce Richardson
2023-01-13 20:36   ` [PATCH v3 1/3] eal/windows: move fnmatch function to header file Bruce Richardson
2023-01-13 20:36   ` [PATCH v3 2/3] log: separate logging functions out of EAL Bruce Richardson
2023-01-13 20:36   ` [PATCH v3 3/3] telemetry: use standard logging Bruce Richardson
2023-01-20 18:21 ` [PATCH v4 0/3] Split logging functionality out of EAL Bruce Richardson
2023-01-20 18:21   ` [PATCH v4 1/3] eal/windows: move fnmatch function to header file Bruce Richardson
2023-01-20 18:21   ` [PATCH v4 2/3] log: separate logging functions out of EAL Bruce Richardson
2023-01-20 18:21   ` [PATCH v4 3/3] telemetry: use standard logging Bruce Richardson
2023-01-22 14:56   ` [PATCH v4 0/3] Split logging functionality out of EAL David Marchand
2023-01-23 14:24     ` Bruce Richardson
2023-01-23 14:31       ` David Marchand
2023-01-23 14:36         ` Bruce Richardson
2023-01-23 14:42           ` David Marchand
2023-05-18 12:49 ` [PATCH v5 " Bruce Richardson
2023-05-18 12:49   ` [PATCH v5 1/3] eal/windows: move fnmatch function to header file Bruce Richardson
2023-05-18 12:49   ` [PATCH v5 2/3] log: separate logging functions out of EAL Bruce Richardson
2023-05-18 12:49   ` [PATCH v5 3/3] telemetry: use standard logging Bruce Richardson
2023-07-31 10:17 ` [PATCH v6 0/3] Split logging functionality out of EAL Bruce Richardson
2023-07-31 10:17   ` [PATCH v6 1/3] eal/windows: move fnmatch function to header file Bruce Richardson
2023-07-31 10:17   ` [PATCH v6 2/3] log: separate logging functions out of EAL Bruce Richardson
2023-07-31 10:17   ` [PATCH v6 3/3] telemetry: use standard logging Bruce Richardson
2023-07-31 15:38 ` [PATCH v7 0/3] Split logging functionality out of EAL Bruce Richardson
2023-07-31 15:39   ` [PATCH v7 1/3] eal/windows: move fnmatch function to header file Bruce Richardson
2023-08-09 11:18     ` David Marchand
2023-08-09 12:35       ` Bruce Richardson
2023-07-31 15:39   ` [PATCH v7 2/3] log: separate logging functions out of EAL Bruce Richardson
2023-07-31 16:22     ` David Marchand
2023-07-31 16:29       ` Bruce Richardson
2023-08-09 10:00         ` Bruce Richardson
2023-08-09 11:58     ` David Marchand
2023-08-09 12:24     ` David Marchand
2023-08-09 12:32       ` Bruce Richardson
2023-07-31 15:39   ` [PATCH v7 3/3] telemetry: use standard logging Bruce Richardson
2023-08-09 13:35 ` [PATCH v8 0/3] Split logging functionality out of EAL Bruce Richardson
2023-08-09 13:35   ` [PATCH v8 1/3] eal/windows: move fnmatch function to header file Bruce Richardson
2023-08-09 13:35   ` [PATCH v8 2/3] log: separate logging functions out of EAL Bruce Richardson
2023-08-09 13:35   ` [PATCH v8 3/3] telemetry: use standard logging Bruce Richardson
2023-08-11 12:46   ` [PATCH v8 0/3] Split logging functionality out of EAL David Marchand
2023-08-11 12:59     ` Bruce Richardson
2023-09-01 11:25       ` Thomas Monjalon
2023-09-01 12:26         ` Morten Brørup
2023-10-23  7:37     ` David Marchand

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220829151901.376754-4-bruce.richardson@intel.com \
    --to=bruce.richardson@intel.com \
    --cc=dev@dpdk.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).