DPDK-dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Bruce Richardson <bruce.richardson@intel.com>
To: Stephen Hemminger <stephen@networkplumber.org>
Cc: <dev@dpdk.org>
Subject: Re: [PATCH] metrics: remove experimental telemetry helper API
Date: Wed, 7 Oct 2026 09:03:23 +0100	[thread overview]
Message-ID: <asX8y0Nv8APsp8ct@bricha3-mobl1.ger.corp.intel.com> (raw)
In-Reply-To: <20261006233144.644562-2-stephen@networkplumber.org>

On Tue, Oct 06, 2026 at 04:31:44PM -0700, Stephen Hemminger wrote:
> While investigating experimental functions leftover in DPDK.
> 
> The rte_metrics_tel_* functions are dead code. Nothing in the tree
> calls them from outside the metrics library itself; they were left
> exported by the telemetry library rewrite in 20.05.
> 
> Stop exporting them. Delete the header, move the types into the C file
> and make the helpers static. The file now only builds when jansson is
> present, so the stub branch goes away too.
> 
> The legacy commands ports_all_stat_values, global_stat_values and
> ports_stats_values_by_name are unchanged.
> 
> Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
> ---
>  doc/guides/rel_notes/release_26_11.rst |   9 +++
>  lib/metrics/meson.build                |   6 +-
>  lib/metrics/rte_metrics_telemetry.c    | 106 ++++++-------------------
>  lib/metrics/rte_metrics_telemetry.h    |  71 -----------------
>  4 files changed, 39 insertions(+), 153 deletions(-)
>  delete mode 100644 lib/metrics/rte_metrics_telemetry.h
> 

In the process, should we post a deprecation notice for the whole
metrics-based legacy telemetry system? It's been superceded for many years
now and it has a lot of limitations: supporting ethdev only, having
globally registered stats (so if you have two different NIC types, you get
a list of all stats names for both whatever port you query), and probably
more beside. That would allow us to remove a large enough chunk of code in
a future release.

/Bruce

> diff --git a/doc/guides/rel_notes/release_26_11.rst b/doc/guides/rel_notes/release_26_11.rst
> index 934efaaf93..254e9ada64 100644
> --- a/doc/guides/rel_notes/release_26_11.rst
> +++ b/doc/guides/rel_notes/release_26_11.rst
> @@ -195,6 +195,15 @@ Removed Items
>    which were based on the legacy pipeline library API.
>    The ``pipeline`` example application covers the SWX pipeline API.
>  
> +* metrics: Removed the experimental telemetry helper API
> +  and the ``rte_metrics_telemetry.h`` header:
> +  ``rte_metrics_tel_reg_all_ethdev``, ``rte_metrics_tel_encode_json_format``,
> +  ``rte_metrics_tel_get_global_stats``, ``rte_metrics_tel_get_port_stats_ids``,
> +  ``rte_metrics_tel_get_ports_stats_json`` and ``rte_metrics_tel_extract_data``.
> +  These had no users and exposed jansson types in the public header.
> +  The legacy telemetry commands ``ports_all_stat_values``,
> +  ``global_stat_values`` and ``ports_stats_values_by_name`` are unchanged.
> +
>  * net/iavf: Removed the ``auto_reconfig`` devarg.
>  
>    The restoration of the promiscuous and all-multicast settings after a VF reset
> diff --git a/lib/metrics/meson.build b/lib/metrics/meson.build
> index 6722f666d2..0e32a08dc3 100644
> --- a/lib/metrics/meson.build
> +++ b/lib/metrics/meson.build
> @@ -1,10 +1,12 @@
>  # SPDX-License-Identifier: BSD-3-Clause
>  # Copyright(c) 2017 Intel Corporation
>  
> -sources = files('rte_metrics.c', 'rte_metrics_telemetry.c')
> -headers = files('rte_metrics.h', 'rte_metrics_telemetry.h')
> +sources = files('rte_metrics.c')
> +headers = files('rte_metrics.h')
>  
> +# Legacy JSON telemetry commands are only available with jansson.
>  if dpdk_conf.has('RTE_HAS_JANSSON')
> +    sources += files('rte_metrics_telemetry.c')
>      ext_deps += jansson_dep
>  endif
>  
> diff --git a/lib/metrics/rte_metrics_telemetry.c b/lib/metrics/rte_metrics_telemetry.c
> index f9ec556595..2350ef5041 100644
> --- a/lib/metrics/rte_metrics_telemetry.c
> +++ b/lib/metrics/rte_metrics_telemetry.c
> @@ -2,19 +2,35 @@
>   * Copyright(c) 2020 Intel Corporation
>   */
>  
> +#include <jansson.h>
> +
>  #include <ethdev_driver.h>
> -#include <eal_export.h>
>  #include <rte_string_fns.h>
>  #ifdef RTE_LIB_TELEMETRY
>  #include <telemetry_internal.h>
>  #endif
>  
>  #include "rte_metrics.h"
> -#include "rte_metrics_telemetry.h"
> -
> -#ifdef RTE_HAS_JANSSON
>  
> -struct telemetry_metrics_data tel_met_data;
> +enum rte_telemetry_stats_type {
> +	PORT_STATS = 0,
> +	GLOBAL_STATS = 1
> +};
> +
> +struct telemetry_encode_param {
> +	enum rte_telemetry_stats_type type;
> +	struct port_param {
> +		int num_metric_ids;
> +		uint32_t metric_ids[RTE_METRICS_MAX_METRICS];
> +		int num_port_ids;
> +		uint32_t port_ids[RTE_MAX_ETHPORTS];
> +	} pp;
> +};
> +
> +static struct telemetry_metrics_data {
> +	int reg_index[RTE_MAX_ETHPORTS];
> +	int metrics_register_done;
> +} tel_met_data;
>  
>  int metrics_log_level;
>  #define RTE_LOGTYPE_METRICS metrics_log_level
> @@ -72,8 +88,7 @@ rte_metrics_tel_reg_port_ethdev_to_metrics(uint16_t port_id)
>  	return ret;
>  }
>  
> -RTE_EXPORT_EXPERIMENTAL_SYMBOL(rte_metrics_tel_reg_all_ethdev, 20.05)
> -int32_t
> +static int32_t
>  rte_metrics_tel_reg_all_ethdev(int *metrics_register_done, int *reg_index_list)
>  {
>  	struct driver_index {
> @@ -227,8 +242,7 @@ rte_metrics_tel_format_port(uint32_t pid, json_t *ports,
>  	return ret;
>  }
>  
> -RTE_EXPORT_EXPERIMENTAL_SYMBOL(rte_metrics_tel_encode_json_format, 20.05)
> -int32_t
> +static int32_t
>  rte_metrics_tel_encode_json_format(struct telemetry_encode_param *ep,
>  		char **json_buffer)
>  {
> @@ -281,8 +295,7 @@ rte_metrics_tel_encode_json_format(struct telemetry_encode_param *ep,
>  	return 0;
>  }
>  
> -RTE_EXPORT_EXPERIMENTAL_SYMBOL(rte_metrics_tel_get_ports_stats_json, 20.05)
> -int32_t
> +static int32_t
>  rte_metrics_tel_get_ports_stats_json(struct telemetry_encode_param *ep,
>  		int *reg_index, char **json_buffer)
>  {
> @@ -312,8 +325,7 @@ rte_metrics_tel_get_ports_stats_json(struct telemetry_encode_param *ep,
>  	return 0;
>  }
>  
> -RTE_EXPORT_EXPERIMENTAL_SYMBOL(rte_metrics_tel_get_port_stats_ids, 20.05)
> -int32_t
> +static int32_t
>  rte_metrics_tel_get_port_stats_ids(struct telemetry_encode_param *ep)
>  {
>  	int p, num_port_ids = 0;
> @@ -379,8 +391,7 @@ rte_metrics_tel_stat_names_to_ids(const char * const *stat_names,
>  	return 0;
>  }
>  
> -RTE_EXPORT_EXPERIMENTAL_SYMBOL(rte_metrics_tel_extract_data, 20.05)
> -int32_t
> +static int32_t
>  rte_metrics_tel_extract_data(struct telemetry_encode_param *ep, json_t *data)
>  {
>  	int ret;
> @@ -547,68 +558,3 @@ RTE_INIT(metrics_ctor)
>  			handle_ports_stats_values_by_name);
>  #endif
>  }
> -
> -#else /* !RTE_HAS_JANSSON */
> -
> -RTE_EXPORT_EXPERIMENTAL_SYMBOL(rte_metrics_tel_reg_all_ethdev, 20.05)
> -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;
> -}
> -
> -RTE_EXPORT_EXPERIMENTAL_SYMBOL(rte_metrics_tel_encode_json_format, 20.05)
> -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;
> -}
> -
> -RTE_EXPORT_EXPERIMENTAL_SYMBOL(rte_metrics_tel_get_ports_stats_json, 20.05)
> -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;
> -}
> -
> -RTE_EXPORT_EXPERIMENTAL_SYMBOL(rte_metrics_tel_get_port_stats_ids, 20.05)
> -int32_t
> -rte_metrics_tel_get_port_stats_ids(struct telemetry_encode_param *ep)
> -{
> -	RTE_SET_USED(ep);
> -
> -	return -ENOTSUP;
> -}
> -
> -RTE_EXPORT_EXPERIMENTAL_SYMBOL(rte_metrics_tel_extract_data, 20.05)
> -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;
> -}
> -
> -RTE_EXPORT_EXPERIMENTAL_SYMBOL(rte_metrics_tel_get_global_stats, 20.05)
> -int32_t
> -rte_metrics_tel_get_global_stats(struct telemetry_encode_param *ep)
> -{
> -	RTE_SET_USED(ep);
> -
> -	return -ENOTSUP;
> -}
> -
> -#endif /* !RTE_HAS_JANSSON */
> diff --git a/lib/metrics/rte_metrics_telemetry.h b/lib/metrics/rte_metrics_telemetry.h
> deleted file mode 100644
> index dd84f5431e..0000000000
> --- a/lib/metrics/rte_metrics_telemetry.h
> +++ /dev/null
> @@ -1,71 +0,0 @@
> -/* SPDX-License-Identifier: BSD-3-Clause
> - * Copyright(c) 2020 Intel Corporation
> - */
> -
> -#ifdef RTE_HAS_JANSSON
> -#include <jansson.h>
> -#else
> -#define json_t void *
> -#endif
> -
> -#include <rte_compat.h>
> -#include "rte_metrics.h"
> -
> -#ifndef _RTE_METRICS_TELEMETRY_H_
> -#define _RTE_METRICS_TELEMETRY_H_
> -
> -#ifdef __cplusplus
> -extern "C" {
> -#endif
> -
> -enum rte_telemetry_stats_type {
> -	PORT_STATS = 0,
> -	GLOBAL_STATS = 1
> -};
> -
> -struct telemetry_encode_param {
> -	enum rte_telemetry_stats_type type;
> -	struct port_param {
> -		int num_metric_ids;
> -		uint32_t metric_ids[RTE_METRICS_MAX_METRICS];
> -		int num_port_ids;
> -		uint32_t port_ids[RTE_MAX_ETHPORTS];
> -	} pp;
> -};
> -
> -struct telemetry_metrics_data {
> -	int reg_index[RTE_MAX_ETHPORTS];
> -	int metrics_register_done;
> -};
> -
> -__rte_experimental
> -int32_t rte_metrics_tel_reg_all_ethdev(int *metrics_register_done,
> -		int *reg_index_list);
> -
> -__rte_experimental
> -int32_t
> -rte_metrics_tel_encode_json_format(struct telemetry_encode_param *ep,
> -		char **json_buffer);
> -
> -__rte_experimental
> -int32_t
> -rte_metrics_tel_get_global_stats(struct telemetry_encode_param *ep);
> -
> -__rte_experimental
> -int32_t
> -rte_metrics_tel_get_port_stats_ids(struct telemetry_encode_param *ep);
> -
> -__rte_experimental
> -int32_t
> -rte_metrics_tel_get_ports_stats_json(struct telemetry_encode_param *ep,
> -		int *reg_index, char **json_buffer);
> -
> -__rte_experimental
> -int32_t
> -rte_metrics_tel_extract_data(struct telemetry_encode_param *ep, json_t *data);
> -
> -#ifdef __cplusplus
> -}
> -#endif
> -
> -#endif
> -- 
> 2.53.0
> 

  reply	other threads:[~2026-10-07  8:03 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-06 23:31 [PATCH] metrics: remove experimental telemetry helper API Stephen Hemminger
2026-10-07  8:03 ` Bruce Richardson [this message]
2026-10-07  8:26   ` David Marchand
2026-10-07 15:32   ` Stephen Hemminger
2026-10-08  9:17 ` 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=asX8y0Nv8APsp8ct@bricha3-mobl1.ger.corp.intel.com \
    --to=bruce.richardson@intel.com \
    --cc=dev@dpdk.org \
    --cc=stephen@networkplumber.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