DPDK  20.05.0
Macros | Typedefs | Enumerations | Functions
rte_telemetry.h File Reference
#include <stdint.h>
#include <rte_compat.h>

Go to the source code of this file.

Macros

#define TELEMETRY_MAX_CALLBACKS   64
 
#define RTE_TEL_MAX_STRING_LEN   64
 
#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 void *(* handler) (void *sock_id)
 

Enumerations

enum  rte_tel_value_type { , RTE_TEL_INT_VAL, RTE_TEL_U64_VAL }
 

Functions

__rte_experimental int rte_tel_data_start_array (struct rte_tel_data *d, enum rte_tel_value_type type)
 
__rte_experimental int rte_tel_data_start_dict (struct rte_tel_data *d)
 
__rte_experimental int rte_tel_data_string (struct rte_tel_data *d, const char *str)
 
__rte_experimental int rte_tel_data_add_array_string (struct rte_tel_data *d, const char *str)
 
__rte_experimental int rte_tel_data_add_array_int (struct rte_tel_data *d, int x)
 
__rte_experimental int rte_tel_data_add_array_u64 (struct rte_tel_data *d, uint64_t x)
 
__rte_experimental int rte_tel_data_add_dict_string (struct rte_tel_data *d, const char *name, const char *val)
 
__rte_experimental int rte_tel_data_add_dict_int (struct rte_tel_data *d, const char *name, int val)
 
__rte_experimental int rte_tel_data_add_dict_u64 (struct rte_tel_data *d, const char *name, uint64_t val)
 
__rte_experimental int rte_telemetry_register_cmd (const char *cmd, telemetry_cb fn, const char *help)
 

Detailed Description

Warning
EXPERIMENTAL: all functions in this file may change without prior notice

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 TELEMETRY_MAX_CALLBACKS   64

Maximum number of telemetry callbacks.

Definition at line 12 of file rte_telemetry.h.

#define RTE_TEL_MAX_STRING_LEN   64

Maximum length for string used in object.

Definition at line 14 of file rte_telemetry.h.

#define RTE_TEL_MAX_SINGLE_STRING_LEN   8192

Maximum length of string.

Definition at line 16 of file rte_telemetry.h.

#define RTE_TEL_MAX_DICT_ENTRIES   256

Maximum number of dictionary entries.

Definition at line 18 of file rte_telemetry.h.

#define RTE_TEL_MAX_ARRAY_ENTRIES   512

Maximum number of array entries.

Definition at line 20 of file rte_telemetry.h.

Typedef Documentation

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
cmdThe cmd that was requested by the client.
paramsContains data required by the callback function.
infoThe information to be returned to the caller.
Returns
Length of buffer used on success.
Negative integer on error.

Definition at line 208 of file rte_telemetry.h.

typedef void*(* handler) (void *sock_id)

Used for handling data received over a telemetry socket.

Parameters
sock_idID for the socket to be used by the handler.
Returns
Void.

Definition at line 220 of file rte_telemetry.h.

Enumeration Type Documentation

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 value

RTE_TEL_U64_VAL 

a signed 32-bit int value

Definition at line 43 of file rte_telemetry.h.

Function Documentation

__rte_experimental int rte_tel_data_start_array ( struct rte_tel_data *  d,
enum rte_tel_value_type  type 
)

Start an array of the specified type for returning from a callback

Parameters
dThe data structure passed to the callback
typeThe type of the array of data
Returns
0 on success, negative errno on error
__rte_experimental int rte_tel_data_start_dict ( struct rte_tel_data *  d)

Start a dictionary of values for returning from a callback

Parameters
dThe data structure passed to the callback
Returns
0 on success, negative errno on error
Examples:
examples/l3fwd-power/main.c.
__rte_experimental int rte_tel_data_string ( struct rte_tel_data *  d,
const char *  str 
)

Set a string for returning from a callback

Parameters
dThe data structure passed to the callback
strThe string to be returned in the data structure
Returns
0 on success, negative errno on error, E2BIG on string truncation
__rte_experimental int rte_tel_data_add_array_string ( struct rte_tel_data *  d,
const char *  str 
)

Add a 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
dThe data structure passed to the callback
strThe string to be returned in the array
Returns
0 on success, negative errno on error, E2BIG on string truncation
__rte_experimental int rte_tel_data_add_array_int ( struct rte_tel_data *  d,
int  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
dThe data structure passed to the callback
xThe number to be returned in the array
Returns
0 on success, negative errno on error
__rte_experimental int rte_tel_data_add_array_u64 ( struct rte_tel_data *  d,
uint64_t  x 
)

Add a uint64_t to an array. The array must have been started by rte_tel_data_start_array() with RTE_TEL_U64_VAL as the type parameter.

Parameters
dThe data structure passed to the callback
xThe number to be returned in the array
Returns
0 on success, negative errno on error
__rte_experimental 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
dThe data structure passed to the callback
nameThe name the value is to be stored under in the dict
valThe 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_experimental int rte_tel_data_add_dict_int ( struct rte_tel_data *  d,
const char *  name,
int  val 
)

Add an int value to a dictionary. The dict must have been started by rte_tel_data_start_dict().

Parameters
dThe data structure passed to the callback
nameThe name the value is to be stored under in the dict
valThe number to be stored in the dict
Returns
0 on success, negative errno on error, E2BIG on string truncation of name.
__rte_experimental int rte_tel_data_add_dict_u64 ( struct rte_tel_data *  d,
const char *  name,
uint64_t  val 
)

Add a uint64_t value to a dictionary. The dict must have been started by rte_tel_data_start_dict().

Parameters
dThe data structure passed to the callback
nameThe name the value is to be stored under in the dict
valThe number to be stored in the dict
Returns
0 on success, negative errno on error, E2BIG on string truncation of name.
Examples:
examples/l3fwd-power/main.c.
__rte_experimental int rte_telemetry_register_cmd ( const char *  cmd,
telemetry_cb  fn,
const char *  help 
)

Used when registering a command and callback function with telemetry.

Parameters
cmdThe command to register with telemetry.
fnCallback function to be called when the command is requested.
helpHelp text for the command.
Returns
0 on success.
-EINVAL for invalid parameters failure.
-ENOENT if max callbacks limit has been reached.
Examples:
examples/l3fwd-power/main.c.