From patchwork Mon Aug 29 15:18:59 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bruce Richardson X-Patchwork-Id: 115609 X-Patchwork-Delegate: thomas@monjalon.net Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 97ACBA0542; Mon, 29 Aug 2022 17:19:26 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 4F62F42847; Mon, 29 Aug 2022 17:19:21 +0200 (CEST) Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by mails.dpdk.org (Postfix) with ESMTP id AEE064069F for ; Mon, 29 Aug 2022 17:19:17 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1661786357; x=1693322357; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=uxIyNVy6lkiqWO1/YCZwMgbj+x0V9lYKyXY8RkRj2TM=; b=fJ7TdI7m3BTGZ+IRZqa6K40hAXByDzNyQO35VABOD0zwzyOASn2OT59J RIcXUkncHCW+VukZUGQzFNMOAGRCBJ/5jky2PUwjunBXN4i2DffKjjFJl 6jENDUgQadp9mXo6Yc9q4PBpS9AiHZjY0uiGhXxaKWPJMVfhFW52c7cN6 vvaF1AZqNNCZ8sVc0u/LEXiPRofSdQm3I6REMEJ6p9mYbFKf+aUjNZzHw Lgb0t+GfXT5wLcCS9wQT3qDw6G2NrVJk3RSNd+P9DoDvKcWWEZMKOoLuK yBDdbYmt+QtgpUgTOgsqGADiOB36vzQalAeErWMQ+h0+IFORP1bs80FhR A==; X-IronPort-AV: E=McAfee;i="6500,9779,10454"; a="296196037" X-IronPort-AV: E=Sophos;i="5.93,272,1654585200"; d="scan'208";a="296196037" 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:09 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.93,272,1654585200"; d="scan'208";a="588198078" 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:08 -0700 From: Bruce Richardson To: dev@dpdk.org Cc: Bruce Richardson Subject: [RFC PATCH 1/3] os: begin separating some OS compatibility from EAL Date: Mon, 29 Aug 2022 16:18:59 +0100 Message-Id: <20220829151901.376754-2-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 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 Some library functionality we may want ahead of EAL build depends upon some OS-specific functionality, so we create a new lib for that to be built separately. For now, just includes fnmatch function for windows. Signed-off-by: Bruce Richardson --- lib/eal/windows/meson.build | 1 - lib/meson.build | 11 ++++++----- lib/os/freebsd/fnmatch.c | 3 +++ lib/os/linux/fnmatch.c | 3 +++ lib/os/meson.build | 8 ++++++++ lib/os/os.c | 3 +++ lib/os/version.map | 7 +++++++ lib/{eal => os}/windows/fnmatch.c | 0 lib/{eal/windows/include => os/windows}/fnmatch.h | 0 9 files changed, 30 insertions(+), 6 deletions(-) create mode 100644 lib/os/freebsd/fnmatch.c create mode 100644 lib/os/linux/fnmatch.c create mode 100644 lib/os/meson.build create mode 100644 lib/os/os.c create mode 100644 lib/os/version.map rename lib/{eal => os}/windows/fnmatch.c (100%) rename lib/{eal/windows/include => os/windows}/fnmatch.h (100%) diff --git a/lib/eal/windows/meson.build b/lib/eal/windows/meson.build index 845e406ca1..e4b2427610 100644 --- a/lib/eal/windows/meson.build +++ b/lib/eal/windows/meson.build @@ -18,7 +18,6 @@ sources += files( 'eal_mp.c', 'eal_thread.c', 'eal_timer.c', - 'fnmatch.c', 'getopt.c', 'rte_thread.c', ) diff --git a/lib/meson.build b/lib/meson.build index c648f7d800..7b61b2a5d7 100644 --- a/lib/meson.build +++ b/lib/meson.build @@ -9,6 +9,7 @@ # given as a dep, no need to mention ring. This is especially true for the # core libs which are widely reused, so their deps are kept to a minimum. libraries = [ + 'os', # load os compatibility material 'kvargs', # eal depends on kvargs 'telemetry', # basic info querying 'eal', # everything depends on eal @@ -106,6 +107,7 @@ if cc.has_argument('-Wno-format-truncation') endif enabled_libs = [] # used to print summary at the end +default_deps = [] foreach l:libraries build = true @@ -124,11 +126,7 @@ foreach l:libraries # use "deps" for internal DPDK dependencies, and "ext_deps" for # external package/library requirements ext_deps = [] - deps = [] - # eal is standard dependency once built - if dpdk_conf.has('RTE_LIB_EAL') - deps += ['eal'] - endif + deps = default_deps if disabled_libs.contains(l) build = false @@ -271,4 +269,7 @@ foreach l:libraries if developer_mode message('lib/@0@: Defining dependency "@1@"'.format(l, name)) endif + if name == 'os' or name == 'eal' + default_deps = [name] + endif endforeach diff --git a/lib/os/freebsd/fnmatch.c b/lib/os/freebsd/fnmatch.c new file mode 100644 index 0000000000..ca8a050fda --- /dev/null +++ b/lib/os/freebsd/fnmatch.c @@ -0,0 +1,3 @@ +/* SPDX-License-Identifier: BSD-3-Clause + * Copyright(c) 2022 Intel Corporation + */ diff --git a/lib/os/linux/fnmatch.c b/lib/os/linux/fnmatch.c new file mode 100644 index 0000000000..ca8a050fda --- /dev/null +++ b/lib/os/linux/fnmatch.c @@ -0,0 +1,3 @@ +/* SPDX-License-Identifier: BSD-3-Clause + * Copyright(c) 2022 Intel Corporation + */ diff --git a/lib/os/meson.build b/lib/os/meson.build new file mode 100644 index 0000000000..53949ca17e --- /dev/null +++ b/lib/os/meson.build @@ -0,0 +1,8 @@ +# SPDX-License-Identifier: BSD-3-Clause +# Copyright(c) 2022 Intel Corporation + +includes += global_inc +includes += include_directories(exec_env) +sources += files( + exec_env / 'fnmatch.c', +) diff --git a/lib/os/os.c b/lib/os/os.c new file mode 100644 index 0000000000..ca8a050fda --- /dev/null +++ b/lib/os/os.c @@ -0,0 +1,3 @@ +/* SPDX-License-Identifier: BSD-3-Clause + * Copyright(c) 2022 Intel Corporation + */ diff --git a/lib/os/version.map b/lib/os/version.map new file mode 100644 index 0000000000..e1dbd6051e --- /dev/null +++ b/lib/os/version.map @@ -0,0 +1,7 @@ +DPDK_22 { + global: + + fnmatch; + + local: *; +}; diff --git a/lib/eal/windows/fnmatch.c b/lib/os/windows/fnmatch.c similarity index 100% rename from lib/eal/windows/fnmatch.c rename to lib/os/windows/fnmatch.c diff --git a/lib/eal/windows/include/fnmatch.h b/lib/os/windows/fnmatch.h similarity index 100% rename from lib/eal/windows/include/fnmatch.h rename to lib/os/windows/fnmatch.h From patchwork Mon Aug 29 15:19:00 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bruce Richardson X-Patchwork-Id: 115610 X-Patchwork-Delegate: thomas@monjalon.net Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id E4FE5A0542; Mon, 29 Aug 2022 17:19:32 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 89C6542B6E; Mon, 29 Aug 2022 17:19:22 +0200 (CEST) Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by mails.dpdk.org (Postfix) with ESMTP id 6A6C94069F for ; Mon, 29 Aug 2022 17:19:18 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1661786358; x=1693322358; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=5LZCOZOD6rtYuRCmOqsTjyrQr22C8EQOXI/38SrVazs=; b=ahrig0V/uYu2BXfVxtzbvkIC4z13Iz3AA/vZNzgUSEgb/a5hCxuHDE9/ oGbxdNaKkXKGzK5yag1iimygJDyIfKDoEaE6T6FV4N5I3rtQbCfgxRSo2 7vjejUT2oRPuaoK6KKsSc1N0ky9ZdfASP1x4e3r5iFm+eSw8uAs0xlHsR 1Qelle+hZMgkrR2AyYZjzWrHufvlTUE3VGDHdjvW1+mLgBT4bh8kgiKkS MTGJ+AvsK+pqaec/kYsPy5InE+YnzlmsFsD/RT7vgzPguJCwqj4gn+lhQ yM5ecpWJyX//jeUNJBu2hapYu0mSXkdk1Bh9H+2Bp41i8kYpXCMztVgv5 g==; X-IronPort-AV: E=McAfee;i="6500,9779,10454"; a="296196044" X-IronPort-AV: E=Sophos;i="5.93,272,1654585200"; d="scan'208";a="296196044" 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:11 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.93,272,1654585200"; d="scan'208";a="588198099" 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:10 -0700 From: Bruce Richardson To: dev@dpdk.org Cc: Bruce Richardson Subject: [RFC PATCH 2/3] log: separate logging functions out of EAL Date: Mon, 29 Aug 2022 16:19:00 +0100 Message-Id: <20220829151901.376754-3-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 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 Move the logging capability to a separate library, free from EAL. Signed-off-by: Bruce Richardson --- lib/eal/common/eal_private.h | 7 ---- lib/eal/common/meson.build | 1 - lib/eal/include/meson.build | 1 - lib/eal/linux/meson.build | 1 - lib/eal/meson.build | 2 +- lib/eal/version.map | 17 -------- lib/eal/windows/meson.build | 1 - lib/kvargs/meson.build | 3 +- lib/{eal/common => log}/eal_common_log.c | 1 - lib/{eal/common => log}/eal_log.h | 11 ++++++ .../linux/eal_log.c => log/eal_log_linux.c} | 0 .../eal_log.c => log/eal_log_windows.c} | 0 lib/log/meson.build | 8 ++++ lib/{eal/include => log}/rte_log.h | 0 lib/log/version.map | 39 +++++++++++++++++++ lib/meson.build | 1 + lib/telemetry/meson.build | 3 +- 17 files changed, 62 insertions(+), 34 deletions(-) rename lib/{eal/common => log}/eal_common_log.c (99%) rename lib/{eal/common => log}/eal_log.h (80%) rename lib/{eal/linux/eal_log.c => log/eal_log_linux.c} (100%) rename lib/{eal/windows/eal_log.c => log/eal_log_windows.c} (100%) create mode 100644 lib/log/meson.build rename lib/{eal/include => log}/rte_log.h (100%) create mode 100644 lib/log/version.map diff --git a/lib/eal/common/eal_private.h b/lib/eal/common/eal_private.h index 44d14241f0..734f1f334b 100644 --- a/lib/eal/common/eal_private.h +++ b/lib/eal/common/eal_private.h @@ -152,13 +152,6 @@ int rte_eal_tailqs_init(void); */ int rte_eal_intr_init(void); -/** - * Close the default log stream - * - * This function is private to EAL. - */ -void rte_eal_log_cleanup(void); - /** * Init alarm mechanism. This is to allow a callback be called after * specific time. diff --git a/lib/eal/common/meson.build b/lib/eal/common/meson.build index 917758cc65..22a626ba6f 100644 --- a/lib/eal/common/meson.build +++ b/lib/eal/common/meson.build @@ -18,7 +18,6 @@ sources += files( 'eal_common_interrupts.c', 'eal_common_launch.c', 'eal_common_lcore.c', - 'eal_common_log.c', 'eal_common_mcfg.c', 'eal_common_memalloc.c', 'eal_common_memory.c', diff --git a/lib/eal/include/meson.build b/lib/eal/include/meson.build index fd6e844224..7de7244065 100644 --- a/lib/eal/include/meson.build +++ b/lib/eal/include/meson.build @@ -27,7 +27,6 @@ headers += files( 'rte_keepalive.h', 'rte_launch.h', 'rte_lcore.h', - 'rte_log.h', 'rte_malloc.h', 'rte_mcslock.h', 'rte_memory.h', diff --git a/lib/eal/linux/meson.build b/lib/eal/linux/meson.build index 3cccfa36c0..1b913acc06 100644 --- a/lib/eal/linux/meson.build +++ b/lib/eal/linux/meson.build @@ -11,7 +11,6 @@ sources += files( 'eal_hugepage_info.c', 'eal_interrupts.c', 'eal_lcore.c', - 'eal_log.c', 'eal_memalloc.c', 'eal_memory.c', 'eal_thread.c', diff --git a/lib/eal/meson.build b/lib/eal/meson.build index 056beb9461..af8c4eae4a 100644 --- a/lib/eal/meson.build +++ b/lib/eal/meson.build @@ -22,7 +22,7 @@ subdir(exec_env) subdir(arch_subdir) -deps += ['kvargs'] +deps += ['log', 'kvargs'] if not is_windows deps += ['telemetry'] endif diff --git a/lib/eal/version.map b/lib/eal/version.map index 1f293e768b..44e1712155 100644 --- a/lib/eal/version.map +++ b/lib/eal/version.map @@ -133,20 +133,6 @@ DPDK_23 { rte_lcore_iterate; rte_lcore_to_cpu_id; rte_lcore_to_socket_id; - rte_log; - rte_log_can_log; - rte_log_cur_msg_loglevel; - rte_log_cur_msg_logtype; - rte_log_dump; - rte_log_get_global_level; - rte_log_get_level; - rte_log_get_stream; - rte_log_register; - rte_log_register_type_and_pick_level; - rte_log_set_global_level; - rte_log_set_level; - rte_log_set_level_pattern; - rte_log_set_level_regexp; rte_malloc; rte_malloc_dump_heaps; rte_malloc_dump_stats; @@ -218,7 +204,6 @@ DPDK_23 { rte_mp_request_async; rte_mp_request_sync; rte_mp_sendmsg; - rte_openlog_stream; rte_rand; rte_rand_max; rte_realloc; @@ -291,7 +276,6 @@ DPDK_23 { rte_vfio_noiommu_is_enabled; # WINDOWS_NO_EXPORT rte_vfio_release_device; # WINDOWS_NO_EXPORT rte_vfio_setup_device; # WINDOWS_NO_EXPORT - rte_vlog; rte_zmalloc; rte_zmalloc_socket; @@ -394,7 +378,6 @@ EXPERIMENTAL { # added in 21.05 rte_devargs_reset; rte_intr_callback_unregister_sync; - rte_log_list_types; rte_thread_key_create; rte_thread_key_delete; rte_thread_value_get; diff --git a/lib/eal/windows/meson.build b/lib/eal/windows/meson.build index e4b2427610..7756d417be 100644 --- a/lib/eal/windows/meson.build +++ b/lib/eal/windows/meson.build @@ -12,7 +12,6 @@ sources += files( 'eal_hugepages.c', 'eal_interrupts.c', 'eal_lcore.c', - 'eal_log.c', 'eal_memalloc.c', 'eal_memory.c', 'eal_mp.c', diff --git a/lib/kvargs/meson.build b/lib/kvargs/meson.build index b746516965..7eae744a8f 100644 --- a/lib/kvargs/meson.build +++ b/lib/kvargs/meson.build @@ -1,7 +1,6 @@ # SPDX-License-Identifier: BSD-3-Clause # Copyright(c) 2017 Intel Corporation -includes = [global_inc] - +deps += 'log' sources = files('rte_kvargs.c') headers = files('rte_kvargs.h') diff --git a/lib/eal/common/eal_common_log.c b/lib/log/eal_common_log.c similarity index 99% rename from lib/eal/common/eal_common_log.c rename to lib/log/eal_common_log.c index bd7b188ceb..895c4f2040 100644 --- a/lib/eal/common/eal_common_log.c +++ b/lib/log/eal_common_log.c @@ -16,7 +16,6 @@ #include #include "eal_log.h" -#include "eal_private.h" struct rte_log_dynamic_type { const char *name; diff --git a/lib/eal/common/eal_log.h b/lib/log/eal_log.h similarity index 80% rename from lib/eal/common/eal_log.h rename to lib/log/eal_log.h index c784fa6043..5baf19df59 100644 --- a/lib/eal/common/eal_log.h +++ b/lib/log/eal_log.h @@ -11,22 +11,33 @@ /* * Initialize the default log stream. */ +__rte_internal int eal_log_init(const char *id, int facility); /* * Determine where log data is written when no call to rte_openlog_stream. */ +__rte_internal void eal_log_set_default(FILE *default_log); /* * Save a log option for later. */ +__rte_internal int eal_log_save_regexp(const char *regexp, uint32_t level); +__rte_internal int eal_log_save_pattern(const char *pattern, uint32_t level); /* * Convert log level to string. */ +__rte_internal const char *eal_log_level2str(uint32_t level); +/* + * Close the default log stream + */ +__rte_internal +void rte_eal_log_cleanup(void); + #endif /* EAL_LOG_H */ diff --git a/lib/eal/linux/eal_log.c b/lib/log/eal_log_linux.c similarity index 100% rename from lib/eal/linux/eal_log.c rename to lib/log/eal_log_linux.c diff --git a/lib/eal/windows/eal_log.c b/lib/log/eal_log_windows.c similarity index 100% rename from lib/eal/windows/eal_log.c rename to lib/log/eal_log_windows.c diff --git a/lib/log/meson.build b/lib/log/meson.build new file mode 100644 index 0000000000..02899c47b1 --- /dev/null +++ b/lib/log/meson.build @@ -0,0 +1,8 @@ +# SPDX-License-Identifier: BSD-3-Clause +# Copyright(c) 2022 Intel Corporation + +sources = files( + 'eal_common_log.c', + 'eal_log_' + exec_env + '.c' +) +headers = files('rte_log.h') diff --git a/lib/eal/include/rte_log.h b/lib/log/rte_log.h similarity index 100% rename from lib/eal/include/rte_log.h rename to lib/log/rte_log.h diff --git a/lib/log/version.map b/lib/log/version.map new file mode 100644 index 0000000000..0ae3b7e55f --- /dev/null +++ b/lib/log/version.map @@ -0,0 +1,39 @@ +DPDK_22 { + global: + + rte_log; + rte_log_cur_msg_loglevel; + rte_log_cur_msg_logtype; + rte_log_can_log; + rte_log_dump; + rte_log_get_global_level; + rte_log_get_level; + rte_log_get_stream; + rte_log_register; + rte_log_register_type_and_pick_level; + rte_log_set_global_level; + rte_log_set_level; + rte_log_set_level_pattern; + rte_log_set_level_regexp; + rte_openlog_stream; + rte_vlog; + + local: *; +}; + +EXPERIMENTAL { + global: + + rte_log_list_types; # added 21.05 +}; + +INTERNAL { + global: + + eal_log_init; + eal_log_level2str; + eal_log_save_pattern; + eal_log_save_regexp; + eal_log_set_default; + rte_eal_log_cleanup; +}; diff --git a/lib/meson.build b/lib/meson.build index 7b61b2a5d7..1b8419d337 100644 --- a/lib/meson.build +++ b/lib/meson.build @@ -10,6 +10,7 @@ # core libs which are widely reused, so their deps are kept to a minimum. libraries = [ 'os', # load os compatibility material + 'log', 'kvargs', # eal depends on kvargs 'telemetry', # basic info querying 'eal', # everything depends on eal diff --git a/lib/telemetry/meson.build b/lib/telemetry/meson.build index f84c9aa3be..489d000047 100644 --- a/lib/telemetry/meson.build +++ b/lib/telemetry/meson.build @@ -1,8 +1,7 @@ # SPDX-License-Identifier: BSD-3-Clause # Copyright(c) 2018 Intel Corporation -includes = [global_inc] - +deps += 'log' sources = files('telemetry.c', 'telemetry_data.c', 'telemetry_legacy.c') headers = files('rte_telemetry.h') includes += include_directories('../metrics') From patchwork Mon Aug 29 15:19:01 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bruce Richardson X-Patchwork-Id: 115611 X-Patchwork-Delegate: thomas@monjalon.net Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org 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 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