1 /* SPDX-License-Identifier: BSD-3-Clause
2 * Copyright(c) 2020 Intel Corporation
5 #ifndef _RTE_TELEMETRY_INTERNAL_H_
6 #define _RTE_TELEMETRY_INTERNAL_H_
8 #include <rte_compat.h>
10 #include "rte_telemetry.h"
16 * RTE Telemetry Legacy and internal definitions
22 * Value representing if data is required for the command
24 enum rte_telemetry_legacy_data_req {
30 * This telemetry callback is used when registering a legacy telemetry command.
31 * It handles getting and formatting stats to be returned to telemetry when
32 * requested. Stats up to buf_len in length are put in the buffer.
35 * The cmd that was requested by the client.
37 * Contains data required by the callback function.
39 * A buffer to hold the formatted response.
41 * Length of the buffer.
44 * Length of buffer used on success.
46 * Negative integer on error.
48 typedef int (*telemetry_legacy_cb)(const char *cmd, const char *params,
49 char *buffer, int buf_len);
53 * Counter for the number of registered legacy callbacks
55 extern int num_legacy_callbacks;
59 * Used for handling data received over the legacy telemetry socket.
65 legacy_client_handler(void *sock_id);
70 * Used when registering a command and callback function with
71 * telemetry legacy support.
76 * -EINVAL for invalid parameters failure.
78 * -ENOENT if max callbacks limit has been reached.
82 rte_telemetry_legacy_register(const char *cmd,
83 enum rte_telemetry_legacy_data_req data_req,
84 telemetry_legacy_cb fn);
88 * Log function type, to allow passing as parameter if necessary
90 typedef int (*rte_log_fn)(uint32_t level, uint32_t logtype, const char *format, ...);
94 * Initialize Telemetry.
97 * The runtime directory of DPDK.
99 * The CPU set to be used for setting the thread affinity.
101 * Function pointer to the rte_log function for logging use
102 * @param registered_logtype
103 * The registered log type to use for logging
112 rte_telemetry_init(const char *runtime_dir, const char *rte_version, rte_cpuset_t *cpuset,
113 rte_log_fn log_fn, uint32_t registered_logtype);