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 B0C16A0566; Mon, 8 Mar 2021 19:05:48 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 4ABB422A46F; Mon, 8 Mar 2021 19:05:48 +0100 (CET) Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by mails.dpdk.org (Postfix) with ESMTP id C556A22A461 for ; Mon, 8 Mar 2021 19:05:45 +0100 (CET) Received: from linuxonhyperv3.guj3yctzbm1etfxqx2vob5hsef.xx.internal.cloudapp.net (linux.microsoft.com [13.77.154.182]) by linux.microsoft.com (Postfix) with ESMTPSA id C6E64208AAA7; Mon, 8 Mar 2021 10:05:44 -0800 (PST) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com C6E64208AAA7 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1615226744; bh=BT4dRbAeupFQwVq1elsVvUi+qb+sXc35weCT5w2CII0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=URe3p8kt02ylvPfTSIzCOtmIYJi8tInERd38Gew/pcIHGgvNFemaXk85rjBZ6s5Nc J3uziqURC3TLbWnsYB+FJcI86/uamm0t5yQdRMLAMNK2pXydishCdjBgbDeWqLsgJO mvVNSc+EK2HmJrQZewsycIWE5cTVMegcRGq8R2ZA= From: Jie Zhou To: dev@dpdk.org Cc: dmitry.kozliuk@gmail.com, bruce.richardson@intel.com Date: Mon, 8 Mar 2021 10:05:39 -0800 Message-Id: <1615226739-27419-1-git-send-email-jizh@linux.microsoft.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1614192383-20597-1-git-send-email-jizh@linux.microsoft.com> References: <1614192383-20597-1-git-send-email-jizh@linux.microsoft.com> Subject: [dpdk-dev] [PATCH v4] rte_metrics: unconditionally exports rte_metrics_tel_xxx functions 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 Sender: "dev" From: Jie Zhou This patch allows the same set of rte_metrics_tel_* functions to be exported no matter JANSSON is available or not, by doing following: 1. Leverage dpdk_conf to set configuration flag RTE_HAVE_JANSSON when Jansson dependency is found. 2. In rte_metrics_telemetry.c, leverage RTE_HAVE_JANSSON to handle the case when JANSSON is not available by adding stubs for all the instances. 3. In meson.build, per dpdk\doc\guides\rel_notes\release_20_05.rst, it is claimed that "Telemetry library is no longer dependent on the external Jansson library, which allows Telemetry be enabled by default.", thus make the deps and includes of Telemetry as not conditional anymore. Signed-off-by: Jie Zhou Acked-by: Bruce Richardson Acked-by: Dmitry Kozlyuk --- V2 changes: Address comments from Dmitry Kozlyuk and Bruce Richardson : - Set dpdk.conf RTE_HAS_JANSSON in metrics meson.build. - Reduce #ifdef RTE_HAS_JANSSON blocks. V3 changes: Address comment from Bruce Richardson : - Remove redundant includes line on librte_telemetry. V4 changes: Carry forward Acked-by from previous versions. Address comments from Dmitry Kozlyuk : - Move change log below "---" so that it's not included in commit. --- lib/librte_metrics/meson.build | 11 ++-- lib/librte_metrics/rte_metrics_telemetry.c | 60 +++++++++++++++++++++- lib/librte_metrics/rte_metrics_telemetry.h | 2 +- 3 files changed, 64 insertions(+), 9 deletions(-) diff --git a/lib/librte_metrics/meson.build b/lib/librte_metrics/meson.build index 28a8cc115..d5be6a214 100644 --- a/lib/librte_metrics/meson.build +++ b/lib/librte_metrics/meson.build @@ -1,14 +1,13 @@ # SPDX-License-Identifier: BSD-3-Clause # Copyright(c) 2017 Intel Corporation -sources = files('rte_metrics.c') -headers = files('rte_metrics.h') +sources = files('rte_metrics.c', 'rte_metrics_telemetry.c') +headers = files('rte_metrics.h', 'rte_metrics_telemetry.h') jansson = dependency('jansson', required: false, method: 'pkg-config') if jansson.found() + dpdk_conf.set('RTE_HAS_JANSSON', 1) ext_deps += jansson - sources += files('rte_metrics_telemetry.c') - headers += files('rte_metrics_telemetry.h') - deps += ['ethdev', 'telemetry'] - includes += include_directories('../librte_telemetry') endif + +deps += ['ethdev', 'telemetry'] diff --git a/lib/librte_metrics/rte_metrics_telemetry.c b/lib/librte_metrics/rte_metrics_telemetry.c index b8ee56ef0..305ee271f 100644 --- a/lib/librte_metrics/rte_metrics_telemetry.c +++ b/lib/librte_metrics/rte_metrics_telemetry.c @@ -2,8 +2,6 @@ * Copyright(c) 2020 Intel Corporation */ -#include - #include #include #ifdef RTE_LIB_TELEMETRY @@ -13,6 +11,7 @@ #include "rte_metrics.h" #include "rte_metrics_telemetry.h" +#ifdef RTE_HAS_JANSSON struct telemetry_metrics_data tel_met_data; int metrics_log_level; @@ -541,3 +540,60 @@ RTE_INIT(metrics_ctor) handle_ports_stats_values_by_name); #endif } +#else +int32_t +rte_metrics_tel_reg_all_ethdev(int *metrics_register_done, int *reg_index_list) +{ + RTE_SET_USED(metrics_register_done); + RTE_SET_USED(reg_index_list); + + return -ENOTSUP; +} + +int32_t +rte_metrics_tel_encode_json_format(struct telemetry_encode_param *ep, + char **json_buffer) +{ + RTE_SET_USED(ep); + RTE_SET_USED(json_buffer); + + return -ENOTSUP; +} + +int32_t +rte_metrics_tel_get_ports_stats_json(struct telemetry_encode_param *ep, + int *reg_index, char **json_buffer) +{ + RTE_SET_USED(ep); + RTE_SET_USED(reg_index); + RTE_SET_USED(json_buffer); + + return -ENOTSUP; +} + +int32_t +rte_metrics_tel_get_port_stats_ids(struct telemetry_encode_param *ep) +{ + RTE_SET_USED(ep); + + return -ENOTSUP; +} + +int32_t +rte_metrics_tel_extract_data(struct telemetry_encode_param *ep, json_t *data) +{ + RTE_SET_USED(ep); + RTE_SET_USED(data); + + return -ENOTSUP; +} + +int32_t +rte_metrics_tel_get_global_stats(struct telemetry_encode_param *ep) +{ + RTE_SET_USED(ep); + + return -ENOTSUP; +} + +#endif diff --git a/lib/librte_metrics/rte_metrics_telemetry.h b/lib/librte_metrics/rte_metrics_telemetry.h index 5dbb32ca0..2b6eb1ccc 100644 --- a/lib/librte_metrics/rte_metrics_telemetry.h +++ b/lib/librte_metrics/rte_metrics_telemetry.h @@ -2,7 +2,7 @@ * Copyright(c) 2020 Intel Corporation */ -#ifdef RTE_LIB_TELEMETRY +#ifdef RTE_HAS_JANSSON #include #else #define json_t void * -- 2.30.0.vfs.0.2