88f4450ab2
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_HAS_JANSSON when Jansson dependency is found. 2. In rte_metrics_telemetry.c, leverage RTE_HAS_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 <jizh@microsoft.com> Acked-by: Bruce Richardson <bruce.richardson@intel.com> Acked-by: Dmitry Kozlyuk <dmitry.kozliuk@gmail.com>
64 lines
1.3 KiB
C
64 lines
1.3 KiB
C
/* 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_metrics.h"
|
|
|
|
#ifndef _RTE_METRICS_TELEMETRY_H_
|
|
#define _RTE_METRICS_TELEMETRY_H_
|
|
|
|
|
|
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);
|
|
|
|
#endif
|