199a2dd95SBruce Richardson /* SPDX-License-Identifier: BSD-3-Clause 299a2dd95SBruce Richardson * Copyright(c) 2020 Intel Corporation 399a2dd95SBruce Richardson */ 499a2dd95SBruce Richardson 599a2dd95SBruce Richardson #ifdef RTE_HAS_JANSSON 699a2dd95SBruce Richardson #include <jansson.h> 799a2dd95SBruce Richardson #else 899a2dd95SBruce Richardson #define json_t void * 999a2dd95SBruce Richardson #endif 1099a2dd95SBruce Richardson 11*1094dd94SDavid Marchand #include <rte_compat.h> 1299a2dd95SBruce Richardson #include "rte_metrics.h" 1399a2dd95SBruce Richardson 1499a2dd95SBruce Richardson #ifndef _RTE_METRICS_TELEMETRY_H_ 1599a2dd95SBruce Richardson #define _RTE_METRICS_TELEMETRY_H_ 1699a2dd95SBruce Richardson 174e90b3a3SBrian Dooley #ifdef __cplusplus 184e90b3a3SBrian Dooley extern "C" { 194e90b3a3SBrian Dooley #endif 2099a2dd95SBruce Richardson 2199a2dd95SBruce Richardson enum rte_telemetry_stats_type { 2299a2dd95SBruce Richardson PORT_STATS = 0, 2399a2dd95SBruce Richardson GLOBAL_STATS = 1 2499a2dd95SBruce Richardson }; 2599a2dd95SBruce Richardson 2699a2dd95SBruce Richardson struct telemetry_encode_param { 2799a2dd95SBruce Richardson enum rte_telemetry_stats_type type; 2899a2dd95SBruce Richardson struct port_param { 2999a2dd95SBruce Richardson int num_metric_ids; 3099a2dd95SBruce Richardson uint32_t metric_ids[RTE_METRICS_MAX_METRICS]; 3199a2dd95SBruce Richardson int num_port_ids; 3299a2dd95SBruce Richardson uint32_t port_ids[RTE_MAX_ETHPORTS]; 3399a2dd95SBruce Richardson } pp; 3499a2dd95SBruce Richardson }; 3599a2dd95SBruce Richardson 3699a2dd95SBruce Richardson struct telemetry_metrics_data { 3799a2dd95SBruce Richardson int reg_index[RTE_MAX_ETHPORTS]; 3899a2dd95SBruce Richardson int metrics_register_done; 3999a2dd95SBruce Richardson }; 4099a2dd95SBruce Richardson 4199a2dd95SBruce Richardson __rte_experimental 4299a2dd95SBruce Richardson int32_t rte_metrics_tel_reg_all_ethdev(int *metrics_register_done, 4399a2dd95SBruce Richardson int *reg_index_list); 4499a2dd95SBruce Richardson 4599a2dd95SBruce Richardson __rte_experimental 4699a2dd95SBruce Richardson int32_t 4799a2dd95SBruce Richardson rte_metrics_tel_encode_json_format(struct telemetry_encode_param *ep, 4899a2dd95SBruce Richardson char **json_buffer); 4999a2dd95SBruce Richardson 5099a2dd95SBruce Richardson __rte_experimental 5199a2dd95SBruce Richardson int32_t 5299a2dd95SBruce Richardson rte_metrics_tel_get_global_stats(struct telemetry_encode_param *ep); 5399a2dd95SBruce Richardson 5499a2dd95SBruce Richardson __rte_experimental 5599a2dd95SBruce Richardson int32_t 5699a2dd95SBruce Richardson rte_metrics_tel_get_port_stats_ids(struct telemetry_encode_param *ep); 5799a2dd95SBruce Richardson 5899a2dd95SBruce Richardson __rte_experimental 5999a2dd95SBruce Richardson int32_t 6099a2dd95SBruce Richardson rte_metrics_tel_get_ports_stats_json(struct telemetry_encode_param *ep, 6199a2dd95SBruce Richardson int *reg_index, char **json_buffer); 6299a2dd95SBruce Richardson 6399a2dd95SBruce Richardson __rte_experimental 6499a2dd95SBruce Richardson int32_t 6599a2dd95SBruce Richardson rte_metrics_tel_extract_data(struct telemetry_encode_param *ep, json_t *data); 6699a2dd95SBruce Richardson 674e90b3a3SBrian Dooley #ifdef __cplusplus 684e90b3a3SBrian Dooley } 694e90b3a3SBrian Dooley #endif 704e90b3a3SBrian Dooley 7199a2dd95SBruce Richardson #endif 72