DPDK  21.08.0
Macros | Typedefs | Functions
rte_keepalive.h File Reference
#include <rte_config.h>
#include <rte_memory.h>

Go to the source code of this file.

Macros

#define RTE_KEEPALIVE_MAXCORES   RTE_MAX_LCORE
 

Typedefs

typedef void(* rte_keepalive_failure_callback_t) (void *data, const int id_core)
 
typedef void(* rte_keepalive_relay_callback_t) (void *data, const int id_core, enum rte_keepalive_state core_state, uint64_t last_seen)
 

Functions

struct rte_keepalive * rte_keepalive_create (rte_keepalive_failure_callback_t callback, void *data)
 
void rte_keepalive_dispatch_pings (void *ptr_timer, void *ptr_data)
 
void rte_keepalive_register_core (struct rte_keepalive *keepcfg, const int id_core)
 
void rte_keepalive_mark_alive (struct rte_keepalive *keepcfg)
 
void rte_keepalive_mark_sleep (struct rte_keepalive *keepcfg)
 
void rte_keepalive_register_relay_callback (struct rte_keepalive *keepcfg, rte_keepalive_relay_callback_t callback, void *data)
 

Detailed Description

DPDK RTE LCore Keepalive Monitor.

Definition in file rte_keepalive.h.

Macro Definition Documentation

◆ RTE_KEEPALIVE_MAXCORES

#define RTE_KEEPALIVE_MAXCORES   RTE_MAX_LCORE

Number of cores to track.

Note
Must be larger than the highest core id.
Examples:
examples/l2fwd-keepalive/ka-agent/main.c, and examples/l2fwd-keepalive/shm.c.

Definition at line 21 of file rte_keepalive.h.

Typedef Documentation

◆ rte_keepalive_failure_callback_t

typedef void(* rte_keepalive_failure_callback_t) (void *data, const int id_core)

Keepalive failure callback.

Receives a data pointer passed to rte_keepalive_create() and the id of the failed core.

Parameters
dataData pointer passed to rte_keepalive_create()
id_coreID of the core that has failed

Definition at line 42 of file rte_keepalive.h.

◆ rte_keepalive_relay_callback_t

typedef void(* rte_keepalive_relay_callback_t) (void *data, const int id_core, enum rte_keepalive_state core_state, uint64_t last_seen)

Keepalive relay callback.

Receives a data pointer passed to rte_keepalive_register_relay_callback(), the id of the core for which state is to be forwarded, and details of the current core state.

Parameters
dataData pointer passed to rte_keepalive_register_relay_callback()
id_coreID of the core for which state is being reported
core_stateThe current state of the core
last_seenTimestamp of when core was last seen alive

Definition at line 57 of file rte_keepalive.h.

Function Documentation

◆ rte_keepalive_create()

struct rte_keepalive* rte_keepalive_create ( rte_keepalive_failure_callback_t  callback,
void *  data 
)

Initialise keepalive sub-system.

Parameters
callbackFunction called upon detection of a dead core.
dataData pointer to be passed to function callback.
Returns
Keepalive structure success, NULL on failure.
Examples:
examples/l2fwd-keepalive/main.c.

◆ rte_keepalive_dispatch_pings()

void rte_keepalive_dispatch_pings ( void *  ptr_timer,
void *  ptr_data 
)

Checks & handles keepalive state of monitored cores.

Parameters
*ptr_timerTriggering timer (unused)
*ptr_dataData pointer (keepalive structure)
Examples:
examples/l2fwd-keepalive/main.c.

◆ rte_keepalive_register_core()

void rte_keepalive_register_core ( struct rte_keepalive *  keepcfg,
const int  id_core 
)

Registers a core for keepalive checks.

Parameters
*keepcfgKeepalive structure pointer
id_coreID number of core to register.
Examples:
examples/l2fwd-keepalive/main.c.

◆ rte_keepalive_mark_alive()

void rte_keepalive_mark_alive ( struct rte_keepalive *  keepcfg)

Per-core keepalive check.

Parameters
*keepcfgKeepalive structure pointer

This function needs to be called from within the main process loop of the LCore to be checked.

Examples:
examples/l2fwd-keepalive/main.c.

◆ rte_keepalive_mark_sleep()

void rte_keepalive_mark_sleep ( struct rte_keepalive *  keepcfg)

Per-core sleep-time indication.

Parameters
*keepcfgKeepalive structure pointer

If CPU idling is enabled, this function needs to be called from within the main process loop of the LCore going to sleep, in order to avoid the LCore being mis-detected as dead.

◆ rte_keepalive_register_relay_callback()

void rte_keepalive_register_relay_callback ( struct rte_keepalive *  keepcfg,
rte_keepalive_relay_callback_t  callback,
void *  data 
)

Registers a 'live core' callback.

The complement of the 'dead core' callback. This is called when a core is known to be alive, and is intended for cases when an app needs to know 'liveness' beyond just knowing when a core has died.

Parameters
*keepcfgKeepalive structure pointer
callbackFunction called upon detection of a dead core.
dataData pointer to be passed to function callback.
Examples:
examples/l2fwd-keepalive/main.c.