rte_telemetry.h(3)
rte_telemetry.h(3) β Library Functions Manual π¦
okay so bestie, welcome to the manual page for rte_telemetry.h, aka the header that's lowkey carrying DPDK telemetry. It's giving library functions manual energy, and we're gonna go through it together, no cap. β¨
π NAME π
rte_telemetry.h β that's the name. Short, iconic, and to the point. π
β¨ SYNOPSIS β¨
okay so before you do anything, you gotta bring in these headers. They're non-negotiable, bestie:
#include <stdint.h>
#include <rte_compat.h>
#include <rte_common.h>
π Macros π
These are the macro constants, and they're literally the limits you need to know:
#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 π«Ά
Two callback typedefs, and they're both kind of a big deal:
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 π
There's exactly one enum in the synopsis, and she's empty in the braces on this page:
enum rte_tel_value_type { }
π₯ Functions π₯
Here's the whole function lineup, copied exactly so you can trust it. No edits, no vibes-based renaming, periodt:
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.
The telemetry library provides a method to retrieve statistics from DPDK by sending a request message over a socket. DPDK will send a JSON encoded response containing telemetry data.
Definition in file rte_telemetry.h.
π Macro Definition Documentation π
#define RTE_TEL_MAX_STRING_LEN 128 π
Maximum length for string used in object.
Definition at line 17 of file rte_telemetry.h.
#define RTE_TEL_MAX_SINGLE_STRING_LEN 8192 β¨
Maximum length of string.
Definition at line 19 of file rte_telemetry.h.
#define RTE_TEL_MAX_DICT_ENTRIES 256 π
Maximum number of dictionary entries.
Definition at line 21 of file rte_telemetry.h.
#define RTE_TEL_MAX_ARRAY_ENTRIES 512 π¦
Maximum number of array entries.
Definition at line 23 of file rte_telemetry.h.
π«Ά Typedef Documentation π«Ά
telemetry_cb β the callback bestie π
typedef int(* telemetry_cb) (const char *cmd, const char *params, struct
rte_tel_data *info)
This telemetry callback is used when registering a telemetry command. It handles getting and formatting information to be returned to telemetry when requested.
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 β¨
- Length of buffer used on success.
- Negative integer on error.
Definition at line 301 of file rte_telemetry.h.
telemetry_arg_cb β the callback bestie with an arg π«Ά
typedef int(* telemetry_arg_cb) (const char *cmd, const char *params,
void *arg, struct rte_tel_data *info)
This telemetry callback is used when registering a telemetry command with rte_telemetry_register_cmd_arg().
It handles getting and formatting information to be returned to telemetry when 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 β¨
- Length of buffer used on success.
- Negative integer on error.
Definition at line 325 of file rte_telemetry.h.
π Enumeration Type Documentation π
enum rte_tel_value_type β the data-type vibe check π
The types of data that can be managed in arrays or dicts. For arrays, this must be specified at creation time, while for dicts this is specified implicitly each time an element is added via calling a type-specific function.
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
ngl bestie, those three one-liners are exactly what the original page says, even if the vibes feel a little chaotic. Keeping it 100% as written. π
Definition at line 44 of file rte_telemetry.h.
π₯ FUNCTION DOCUMENTATION π₯
Okay bestie, this is the part where the actual β¨doing thingsβ¨ happens β all the functions you'd call from inside your telemetry callback. Buckle up π
rte_tel_data_start_array
int rte_tel_data_start_array (struct rte_tel_data * d, enum rte_tel_value_type type)
Start an array of the specified type, so you can hand it back out of a callback π
Parameters
dβ the data structure that got passed to your callbacktypeβ 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)
Start a dictionary of values for returning from a callback π
Dictionaries are made of key-value pairs, where the keys (aka names) are strings and the values can be any of the types telemetry supports. Name strings may only contain alphanumeric characters as well as '_' or '/' β that's the vibe check for names, no cap.
Parameters
dβ the data structure that got passed to your callback
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)
Set a string for returning from a callback β¨
Parameters
dβ the data structure that got passed to your callbackstrβ the string to be returned in the data structure
Returns
0 on success, negative errno on error, and E2BIG on string truncation (iykyk, your string was too long π).
rte_tel_data_add_array_string
int rte_tel_data_add_array_string (struct rte_tel_data * d, const char * str)
Add a string to an array. Heads up: the array must have been started by rte_tel_data_start_array() with RTE_TEL_STRING_VAL as the type parameter β otherwise it's not giving β
Parameters
dβ the data structure that got passed to your callbackstrβ 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)
Add 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.
Parameters
dβ the data structure that got passed to your callbackxβ 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)
Add 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 π
Parameters
dβ the data structure that got passed to your callbackxβ 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)
Add a container to an array. A container is just an existing telemetry data array, like nesting dolls πͺ The array the container is being added to must have been started by rte_tel_data_start_array() with RTE_TEL_CONTAINER as the type parameter. The container type must be an array of type uint64_t/int/string.
Parameters
dβ the data structure that got passed to your callbackvalβ the pointer to the container to be stored in the arraykeepβ flag to indicate that the container memory should not be automatically freed by the telemetry library once it has finished with the data.1= keep,0= free.
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)
Convert an unsigned integer to hexadecimal encoded strings and add this 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 π₯
Parameters
dβ the data structure that got passed to your callback.valβ the number to be returned in the array as a hexadecimal encoded strings.display_bitwidthβ the display bit width of the'val'. If'display_bitwidth'is zero, the value is stored in the array as no-padding zero hexadecimal encoded string; otherwise the value is stored as padding zero to specified hexadecimal width.
Returns
0 on success, negative errno on error.
β οΈ marked __rte_experimental β it's giving "still cooking", so treat it accordingly π
rte_tel_data_add_dict_string
int rte_tel_data_add_dict_string (struct rte_tel_data * d, const char * name, const char * val)
Add a string value to a dictionary. The dict must have been started by rte_tel_data_start_dict().
Parameters
dβ the data structure that got passed to your callbacknameβ 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 name or value π
rte_tel_data_add_dict_int
int rte_tel_data_add_dict_int (struct rte_tel_data * d, const char * name, int64_t val)
Add an int value to a dictionary. The dict must have been started by rte_tel_data_start_dict().
Parameters
dβ the data structure that got passed to your callbacknameβ 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 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)
Add an unsigned value to a dictionary. The dict must have been started by rte_tel_data_start_dict() πΈ
Parameters
dβ the data structure that got passed to your callbacknameβ 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 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)
Add a container to a dictionary. A container is an existing telemetry data array β nesting time πͺ The dict the container is being added to must have been started by rte_tel_data_start_dict(). The container must be an array of type uint64_t/int/string.
Parameters
dβ the data structure that got passed to your callbacknameβ 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 to indicate that the container memory should not be automatically freed by the telemetry library once it has finished 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)
Convert an unsigned integer to hexadecimal encoded strings and add this string to an dictionary. The dict must have been started by rte_tel_data_start_dict() π
Parameters
dβ the data structure that got passed to your callback.nameβ 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 strings.display_bitwidthβ the display bit width of the'val'. If'display_bitwidth'is zero, the value is stored in the array as no-padding zero hexadecimal encoded string; otherwise the value is stored as padding zero to specified hexadecimal width.
Returns
0 on success, negative errno on error.
β οΈ also __rte_experimental, bestie. Same energy as above π
rte_telemetry_register_cmd
int rte_telemetry_register_cmd (const char * cmd, telemetry_cb fn, const char * help)
Used when registering a command and callback function with telemetry β this is literally how you make your own command exist π
Parameters
cmdβ the command to register with telemetry.fnβ callback function to be called when the command is requested.helpβ help text for the command.
Returns
0 on success.
-EINVAL for invalid parameters failure.
-ENOMEM for 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)
Used when registering a command and callback function with telemetry β the version that also lets you smuggle an arg through π«Ά
Parameters
cmdβ the command to register with telemetry.fnβ callback function to be called when the command is requested.argβ an opaque value that will be passed to the callback function.helpβ help text for the command.
Returns
0 on success.
-EINVAL for invalid parameters failure.
-ENOMEM for mem allocation failure.
β οΈ yep, __rte_experimental again. You know the drill π
rte_tel_data_alloc
struct rte_tel_data * rte_tel_data_alloc (void )
Get a pointer to a container with memory allocated. The container is meant to be used embedded within an existing telemetry dict/array β¨
Returns
Pointer to a container.
π AUTHOR π
Generated automatically by Doxygen for DPDK from the source code. Not me writing it by hand, the robot did it, and honestly? It ate π€β¨
That's the whole page, bestie β you made it to the end π This was rte_telemetry.h, man page section 3, from DPDK Version 26.03.0, and the footer date is the same as always (you know how these generated pages are β it's stamped with that version). Go forth and register some commands ππ
π¦ where this page comes from
- nixos 26.05: dpdk 26.03
- nixpkgs unstable: dpdk 26.03
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms