rte_telemetry.h(3)
β¨ NAME β¨
rte_telemetry.h β bestie, it's the RTE Telemetry header π
π¦ SYNOPSIS π¦
#include <stdint.h>
#include <rte_compat.h>
#include <rte_common.h>
π Macros π
#define RTE_TEL_MAX_STRING_LEN 128
#define RTE_TEL_MAX_SINGLE_STRING_LEN 8192
#define RTE_TEL_MAX_DICT_ENTRIES 256
#define RTE_TEL_MAX_ARRAY_ENTRIES 512
πΈ Typedefs πΈ
typedef int(* telemetry_cb) (const char *cmd, const char *params, struct
rte_tel_data *info)
typedef int(* telemetry_arg_cb) (const char *cmd, const char *params,
void *arg, struct rte_tel_data *info)
π Enumerations π
enum rte_tel_value_type { }
π«Ά Functions π«Ά
int rte_tel_data_start_array (struct rte_tel_data *d, enum
rte_tel_value_type type)
int rte_tel_data_start_dict (struct rte_tel_data *d)
int rte_tel_data_string (struct rte_tel_data *d, const char *str)
int rte_tel_data_add_array_string (struct rte_tel_data *d, const char
*str)
int rte_tel_data_add_array_int (struct rte_tel_data *d, int64_t x)
int rte_tel_data_add_array_uint (struct rte_tel_data *d, uint64_t x)
int rte_tel_data_add_array_container (struct rte_tel_data *d, struct
rte_tel_data *val, int keep)
__rte_experimental int rte_tel_data_add_array_uint_hex (struct
rte_tel_data *d, uint64_t val, uint8_t display_bitwidth)
int rte_tel_data_add_dict_string (struct rte_tel_data *d, const char
*name, const char *val)
int rte_tel_data_add_dict_int (struct rte_tel_data *d, const char *name,
int64_t val)
int rte_tel_data_add_dict_uint (struct rte_tel_data *d, const char
*name, uint64_t val)
int rte_tel_data_add_dict_container (struct rte_tel_data *d, const char
*name, struct rte_tel_data *val, int keep)
__rte_experimental int rte_tel_data_add_dict_uint_hex (struct
rte_tel_data *d, const char *name, uint64_t val, uint8_t
display_bitwidth)
int rte_telemetry_register_cmd (const char *cmd, telemetry_cb fn, const
char *help)
__rte_experimental int rte_telemetry_register_cmd_arg (const char *cmd,
telemetry_arg_cb fn, void *arg, const char *help)
struct rte_tel_data * rte_tel_data_alloc (void) __rte_malloc
__rte_dealloc(rte_tel_data_free
π Detailed Description π
RTE Telemetry. β¨
So like, the telemetry library is the whole method for getting statistics out of DPDK β you send a request message over a socket, and DPDK sends back a JSON-encoded response stuffed full of telemetry data. It's giving very much "ask and you shall receive" energy π¦
Definition in file rte_telemetry.h.
π Macro Definition Documentation π
π #define RTE_TEL_MAX_STRING_LEN 128
The max length for a string used in an object, periodt.
Definition at line 17 of file rte_telemetry.h.
π #define RTE_TEL_MAX_SINGLE_STRING_LEN 8192
The maximum length of a string. Iconic capacity honestly π
Definition at line 19 of file rte_telemetry.h.
π #define RTE_TEL_MAX_DICT_ENTRIES 256
The maximum number of dictionary entries. No cap, but also, a cap.
Definition at line 21 of file rte_telemetry.h.
π #define RTE_TEL_MAX_ARRAY_ENTRIES 512
The maximum number of array entries. She's got room for 512 little guys and not one more π
Definition at line 23 of file rte_telemetry.h.
π§ Typedef Documentation π§
β typedef int(* telemetry_cb) (const char *cmd, const char *params, struct rte_tel_data *info)
Okay so this telemetry callback is what you use when you're registering a telemetry command. Its whole job is getting and formatting the information that gets returned to telemetry when somebody requests it. Main character duties fr fr π
Parameters
cmdβ the cmd that was requested by the client.paramsβ contains data required by the callback function.infoβ the information to be returned to the caller.
Returns
- The length of buffer used on success.
- A negative integer on error. (Not the vibe, but okay π)
Definition at line 301 of file rte_telemetry.h.
β typedef int(* telemetry_arg_cb) (const char *cmd, const char *params, void *arg, struct rte_tel_data *info)
This telemetry callback is the one you use when you register a telemetry command with rte_telemetry_register_cmd_arg().
Same energy as above: it handles getting and formatting information that gets returned to telemetry when it's requested π«Ά
Parameters
cmdβ the cmd that was requested by the client.paramsβ contains data required by the callback function.argβ the opaque value that was passed torte_telemetry_register_cmd_arg().infoβ the information to be returned to the caller.
Returns
- The length of buffer used on success.
- A negative integer on error.
Definition at line 325 of file rte_telemetry.h.
π Enumeration Type Documentation π
π enum rte_tel_value_type
These are the types of data that can be managed in arrays or dicts. Heads up bestie, there's a lil difference in how you declare them: for arrays, this has to be specified at creation time, but for dicts it gets specified implicitly every single time an element is added, by calling a type-specific function. Lowkey important, highkey useful β¨
Enumerator
RTE_TEL_INT_VALβ a string valueRTE_TEL_UINT_VALβ a signed 64-bit int valueRTE_TEL_CONTAINERβ an unsigned 64-bit int value
Definition at line 44 of file rte_telemetry.h.
okay that's the header stuff, the structs and the rest are coming right up, don't go anywhere π
β¨ FUNCTION DOCUMENTATION β¨
Okay bestie, this is the part where we meet all the little functions you'll actually be calling. They're all about building up telemetry data β arrays, dicts, strings, numbers β so your callback can hand something pretty back to the telemetry library. Let's gooo π
π rte_tel_data_start_array
int rte_tel_data_start_array(struct rte_tel_data * d, enum rte_tel_value_type type)
Starts up an array of whatever type you pick, for your callback to hand back. It's giving "setting the stage" β¨
Parameters
dβ the data structure the callback was handedtypeβ the type of the array of data
Returns
0 on success, negative errno on error π«Ά
π rte_tel_data_start_dict
int rte_tel_data_start_dict(struct rte_tel_data * d)
Starts a dict of values for returning from a callback. A dict is literally just key-value pairs: the keys (aka names) are strings, and the values can be any of the types telemetry supports. And heads up β name strings may only contain alphanumeric characters plus '_' or '/'. No cap. π«
Parameters
dβ the data structure the callback was handed
Returns
0 on success, negative errno on error πΈ
π rte_tel_data_string
int rte_tel_data_string(struct rte_tel_data * d, const char * str)
Sets a string for returning from a callback. Simple, iconic. π
Parameters
dβ the data structure the callback was handedstrβ the string to be returned in the data structure
Returns
0 on success, negative errno on error, and E2BIG on string truncation (aka your string got chopped π)
π rte_tel_data_add_array_string
int rte_tel_data_add_array_string(struct rte_tel_data * d, const char * str)
Adds a string to an array. And listen β the array must have been started by rte_tel_data_start_array() with RTE_TEL_STRING_VAL as the type parameter, or it's not gonna work bestie. π¦
Parameters
dβ the data structure the callback was handedstrβ the string to be returned in the array
Returns
0 on success, negative errno on error, E2BIG on string truncation π
π rte_tel_data_add_array_int
int rte_tel_data_add_array_int(struct rte_tel_data * d, int64_t x)
Adds an int to an array. The array must have been started by rte_tel_data_start_array() with RTE_TEL_INT_VAL as the type parameter. Match the type, babe. β¨
Parameters
dβ the data structure the callback was handedxβ the number to be returned in the array
Returns
0 on success, negative errno on error π₯
π rte_tel_data_add_array_uint
int rte_tel_data_add_array_uint(struct rte_tel_data * d, uint64_t x)
Adds an unsigned value to an array. The array must have been started by rte_tel_data_start_array() with RTE_TEL_UINT_VAL as the type parameter. Unsigneds only, we don't do negativity here π
Parameters
dβ the data structure the callback was handedxβ the number to be returned in the array
Returns
0 on success, negative errno on error π
π rte_tel_data_add_array_container
int rte_tel_data_add_array_container(struct rte_tel_data * d,
struct rte_tel_data * val,
int keep)
Adds a container to an array. A container is just an existing telemetry data array, okay? The array you're adding the container to must have been started by rte_tel_data_start_array() with RTE_TEL_CONTAINER as the type parameter. And the container type itself must be an array of type uint64_t/int/string. Nested cuteness, we love to see it π
Parameters
dβ the data structure the callback was handedvalβ the pointer to the container to be stored in the arraykeepβ flag saying whether the container memory should not be automatically freed by the telemetry library once it's done with the data.1= keep,0= free. Choose wisely bestie π
Returns
0 on success, negative errno on error π
π rte_tel_data_add_array_uint_hex
__rte_experimental int rte_tel_data_add_array_uint_hex(struct rte_tel_data * d,
uint64_t val,
uint8_t display_bitwidth)
β οΈ This one's marked __rte_experimental β experimental vibes, use with care.
Converts an unsigned integer into hexadecimal encoded strings and adds that string to an array. The array must have been started by rte_tel_data_start_array() with RTE_TEL_STRING_VAL as the type parameter. Yes, it's a number going into a string-typed array. That's the whole point. π
Parameters
dβ the data structure the callback was handedvalβ the number to be returned in the array as a hexadecimal encoded stringdisplay_bitwidthβ the display bit width of theval. Ifdisplay_bitwidthis zero, the value is stored in the array as a no-padding-zero hexadecimal encoded string; otherwise the value is stored as padding zero to the specified hexadecimal width. Your width, your rules π
Returns
0 on success, negative errno on error π
π rte_tel_data_add_dict_string
int rte_tel_data_add_dict_string(struct rte_tel_data * d,
const char * name,
const char * val)
Adds a string value to a dict. The dict must have been started by rte_tel_data_start_dict(). π
Parameters
dβ the data structure the callback was handednameβ the name the value is to be stored under in the dict. Must contain only alphanumeric characters or the symbols'_'or'/'valβ the string to be stored in the dict
Returns
0 on success, negative errno on error, E2BIG on string truncation of either the name or the value. Double the truncation risk, double the drama π
π rte_tel_data_add_dict_int
int rte_tel_data_add_dict_int(struct rte_tel_data * d,
const char * name,
int64_t val)
Adds an int value to a dict. The dict must have been started by rte_tel_data_start_dict(). π§
Parameters
dβ the data structure the callback was handednameβ the name the value is to be stored under in the dict. Must contain only alphanumeric characters or the symbols'_'or'/'valβ the number to be stored in the dict
Returns
0 on success, negative errno on error, E2BIG on string truncation of the name πΈ
π rte_tel_data_add_dict_uint
int rte_tel_data_add_dict_uint(struct rte_tel_data * d,
const char * name,
uint64_t val)
Adds an unsigned value to a dict. The dict must have been started by rte_tel_data_start_dict(). β¨
Parameters
dβ the data structure the callback was handednameβ the name the value is to be stored under in the dict. Must contain only alphanumeric characters or the symbols'_'or'/'valβ the number to be stored in the dict
Returns
0 on success, negative errno on error, E2BIG on string truncation of the name π«Ά
π rte_tel_data_add_dict_container
int rte_tel_data_add_dict_container(struct rte_tel_data * d,
const char * name,
struct rte_tel_data * val,
int keep)
Adds a container to a dict. A container is an existing telemetry data array, remember? The dict you're adding the container to must have been started by rte_tel_data_start_dict(), and the container must be an array of type uint64_t/int/string. π
Parameters
dβ the data structure the callback was handednameβ the name the value is to be stored under in the dict. Must contain only alphanumeric characters or the symbols'_'or'/'valβ the pointer to the container to be stored in the dictkeepβ flag saying whether the container memory should not be automatically freed by the telemetry library once it's done with the data.1= keep,0= free π₯
Returns
0 on success, negative errno on error π
π rte_tel_data_add_dict_uint_hex
__rte_experimental int rte_tel_data_add_dict_uint_hex(struct rte_tel_data * d,
const char * name,
uint64_t val,
uint8_t display_bitwidth)
β οΈ Also __rte_experimental, so experimental bestie energy.
Converts an unsigned integer into hexadecimal encoded strings and adds that string to a dictionary. The dict must have been started by rte_tel_data_start_dict(). π₯
Parameters
dβ the data structure the callback was handednameβ the name of the value is to be stored in the dict. Must contain only alphanumeric characters or the symbols'_'or'/'valβ the number to be stored in the dict as a hexadecimal encoded stringdisplay_bitwidthβ the display bit width of theval. Ifdisplay_bitwidthis zero, the value is stored in the array as a no-padding-zero hexadecimal encoded string; otherwise the value is stored as padding zero to the specified hexadecimal width π
Returns
0 on success, negative errno on error π
π rte_telemetry_register_cmd
int rte_telemetry_register_cmd(const char * cmd, telemetry_cb fn, const char * help)
This is the one you use when registering a command and its callback function with telemetry. Main character move, honestly π
Parameters
cmdβ the command to register with telemetryfnβ callback function to be called when the command is requestedhelpβ help text for the command
Returns
0on success-EINVALfor invalid parameters failure-ENOMEMfor mem allocation failure π
π rte_telemetry_register_cmd_arg
__rte_experimental int rte_telemetry_register_cmd_arg(const char * cmd,
telemetry_arg_cb fn,
void * arg,
const char * help)
β οΈ __rte_experimental β yes, this one too.
Also used when registering a command and callback function with telemetry β but this flavor lets you smuggle an opaque value in there. Very sneaky, very slay β¨
Parameters
cmdβ the command to register with telemetryfnβ callback function to be called when the command is requestedargβ an opaque value that will be passed to the callback functionhelpβ help text for the command
Returns
0on success-EINVALfor invalid parameters failure-ENOMEMfor mem allocation failure π
π rte_tel_data_alloc
struct rte_tel_data * rte_tel_data_alloc(void )
Gets you a pointer to a container with memory allocated. The container is meant to be used embedded within an existing telemetry dict/array β it's a little nestling, not a standalone thing π¦
Returns
Pointer to a container π
π AUTHOR
Generated automatically by Doxygen for DPDK from the source code. Not a human, but honestly? Ate. π
Aaaand that's a wrap bestie!! π This was DPDK manual page for rte_telemetry.h(3), Version 25.11.3. Go forth and build the prettiest telemetry dicts the world has ever seen. Periodt. πΈπβ¨
π¦ where this page comes from
- ubuntu resolute: dpdk-doc 25.11.3-0ubuntu0.26.04.1 Β· BSD-3-Clause
- ubuntu stonking: dpdk-doc 25.11.3-1 Β· BSD-3-Clause
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms