From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id A5406A0542; Mon, 29 Aug 2022 17:19:39 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 76F4242B71; Mon, 29 Aug 2022 17:19:23 +0200 (CEST) Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by mails.dpdk.org (Postfix) with ESMTP id 4AB7A41147 for ; Mon, 29 Aug 2022 17:19:19 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1661786359; x=1693322359; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=pd/rvy9iLqs+i5jAN6qDUm/EoUbIeECqhHtJxj+tVDE=; b=gG0qERFxDtsxNiNStRN3xlM0CibNXIvLQezthZngfN647KaL0UsFDi0q VohOUd4cdBnLul+OT2kosEpJESZSEPRjCRlrvu1eR2F6GB2KDUBhZKNsT ELDtX6c8pTv6wIsHcWIXL4oVAesoEULQC40yu+IbHu9Gf4XFlRClnmHzG Np9A1JRzsGdYpcZaMsQ90p6ENYkv4xMg6SVfWvLGNYAQBqlTYGWlAyYNN 226DK+/T+2zsX4xGHbB3V1nyaZxqsnQSy/jzWvkJmFCvaaCH8CbQ+mTeH D9rjJ+VghXu1eTdwXgQ4s2NyudXlaEmnpKHQlGfkbOybLZrzkA2eK5CUz A==; X-IronPort-AV: E=McAfee;i="6500,9779,10454"; a="296196054" X-IronPort-AV: E=Sophos;i="5.93,272,1654585200"; d="scan'208";a="296196054" Received: from orsmga006.jf.intel.com ([10.7.209.51]) by orsmga103.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 29 Aug 2022 08:19:12 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.93,272,1654585200"; d="scan'208";a="588198114" Received: from silpixa00401385.ir.intel.com (HELO silpixa00401385.ger.corp.intel.com) ([10.237.222.145]) by orsmga006.jf.intel.com with ESMTP; 29 Aug 2022 08:19:12 -0700 From: Bruce Richardson To: dev@dpdk.org Cc: Bruce Richardson Subject: [RFC PATCH 3/3] telemetry: use standard logging Date: Mon, 29 Aug 2022 16:19:01 +0100 Message-Id: <20220829151901.376754-4-bruce.richardson@intel.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220829151901.376754-1-bruce.richardson@intel.com> References: <20220829151901.376754-1-bruce.richardson@intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org 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 --- 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