---
name: "rte_keepalive.h"
section: "3"
platform: "linux"
package: "dpdk-doc"
version: "24.11.4-0+deb13u1"
release: "Debian 13 (Trixie)"
platforms: ["linux"]
url: "https://new.carta.tech/rte_keepalive.h"
---

# rte\_keepalive.h(3)

## NAME

rte\_keepalive.h

## SYNOPSIS

`#include <rte_config.h>`\
 `#include <rte_memory.h>`\

### 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

### #define RTE\_KEEPALIVE\_MAXCORES RTE\_MAX\_LCORE

Number of cores to track.

**Note**

Must be larger than the highest core id.

Definition at line **24** of file **rte\_keepalive.h**.

## Typedef Documentation

### 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**

*data* Data pointer passed to **rte\_keepalive\_create()** \
 *id\_core* ID of the core that has failed

Definition at line **45** of file **rte\_keepalive.h**.

### 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**

*data* Data pointer passed to **rte\_keepalive\_register\_relay\_callback()** \
 *id\_core* ID of the core for which state is being reported \
 *core\_state* The current state of the core \
 *last\_seen* Timestamp of when core was last seen alive

Definition at line **60** of file **rte\_keepalive.h**.

## Function Documentation

### struct rte\_keepalive \* rte\_keepalive\_create (rte\_keepalive\_failure\_callback\_t callback, void \* data)

Initialise keepalive sub-system.

**Parameters**

*callback* Function called upon detection of a dead core. \
 *data* Data pointer to be passed to function callback.

**Returns**

Keepalive structure success, NULL on failure.

### void rte\_keepalive\_dispatch\_pings (void \* ptr\_timer, void \* ptr\_data)

Checks & handles keepalive state of monitored cores.

**Parameters**

*\*ptr\_timer* Triggering timer (unused) \
 *\*ptr\_data* Data pointer (keepalive structure)

### void rte\_keepalive\_register\_core (struct rte\_keepalive \* keepcfg, const int id\_core)

Registers a core for keepalive checks.

**Parameters**

*\*keepcfg* Keepalive structure pointer \
 *id\_core* ID number of core to register.

### void rte\_keepalive\_mark\_alive (struct rte\_keepalive \* keepcfg)

Per-core keepalive check.

**Parameters**

*\*keepcfg* Keepalive structure pointer

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

### void rte\_keepalive\_mark\_sleep (struct rte\_keepalive \* keepcfg)

Per-core sleep-time indication.

**Parameters**

*\*keepcfg* Keepalive 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.

### 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**

*\*keepcfg* Keepalive structure pointer \
 *callback* Function called upon detection of a dead core. \
 *data* Data pointer to be passed to function callback.

## Author

Generated automatically by Doxygen for DPDK from the source code.
