1 /* SPDX-License-Identifier: BSD-3-Clause
2 * Copyright(c) 2016 Intel Corporation
5 #define RTE_KEEPALIVE_SHM_NAME "/dpdk_keepalive_shm_name"
7 #define RTE_KEEPALIVE_SHM_ALIVE 1
8 #define RTE_KEEPALIVE_SHM_DEAD 2
15 #include <semaphore.h>
16 #include <rte_keepalive.h>
19 * Keepalive SHM structure.
21 * The shared memory allocated by the primary is this size, and contains the
22 * information as contained within this struct. A secondary may open the SHM,
23 * and read the contents.
25 struct rte_keepalive_shm {
26 /** IPC semaphore. Posted when a core dies */
30 * Relayed status of each core.
32 enum rte_keepalive_state core_state[RTE_KEEPALIVE_MAXCORES];
35 * Last-seen-alive timestamps for the cores
37 uint64_t core_last_seen_times[RTE_KEEPALIVE_MAXCORES];
41 * Create shared host memory keepalive object.
43 * Pointer to SHM keepalive structure, or NULL on failure.
45 struct rte_keepalive_shm *rte_keepalive_shm_create(void);
48 * Relays state for given core
50 * Pointer to SHM keepalive structure.
56 * Last seen timestamp for core
58 void rte_keepalive_relayed_state(struct rte_keepalive_shm *shm,
59 const int id_core, const enum rte_keepalive_state core_state,
62 /** Shutdown cleanup of shared host memory keepalive object.
64 * Pointer to SHM keepalive structure. May be NULL.
66 * If *shm is NULL, this function will only attempt to remove the
67 * shared host memory handle and not unmap the underlying memory.
69 void rte_keepalive_shm_cleanup(struct rte_keepalive_shm *ka_shm);