eal: fix keep alive header for C++
When built in a C++ application, the keepalive include fails: rte_keepalive.h:142:41: error: ‘ALIVE’ was not declared in this scope keepcfg->state_flags[rte_lcore_id()] = ALIVE; ^ C++ requires to use a scope operator to access an enum inside a struct. There was also a namespace issue for the values (no RTE prefix). The solution is to move the struct and related code out of the header file. Fixes: 75583b0d1efd ("eal: add keep alive monitoring") Signed-off-by: Thomas Monjalon <thomas.monjalon@6wind.com> Acked-by: Remy Horton <remy.horton@intel.com>
This commit is contained in:
parent
2f29ce885a
commit
1a8dbad49a
@ -64,35 +64,7 @@ typedef void (*rte_keepalive_failure_callback_t)(
|
||||
* Keepalive state structure.
|
||||
* @internal
|
||||
*/
|
||||
struct rte_keepalive {
|
||||
/** Core Liveness. */
|
||||
enum {
|
||||
ALIVE = 1,
|
||||
MISSING = 0,
|
||||
DEAD = 2,
|
||||
GONE = 3
|
||||
} __rte_cache_aligned state_flags[RTE_KEEPALIVE_MAXCORES];
|
||||
|
||||
/** Last-seen-alive timestamps */
|
||||
uint64_t last_alive[RTE_KEEPALIVE_MAXCORES];
|
||||
|
||||
/**
|
||||
* Cores to check.
|
||||
* Indexed by core id, non-zero if the core should be checked.
|
||||
*/
|
||||
uint8_t active_cores[RTE_KEEPALIVE_MAXCORES];
|
||||
|
||||
/** Dead core handler. */
|
||||
rte_keepalive_failure_callback_t callback;
|
||||
|
||||
/**
|
||||
* Dead core handler app data.
|
||||
* Pointer is passed to dead core handler.
|
||||
*/
|
||||
void *callback_data;
|
||||
uint64_t tsc_initial;
|
||||
uint64_t tsc_mhz;
|
||||
};
|
||||
struct rte_keepalive;
|
||||
|
||||
|
||||
/**
|
||||
@ -136,11 +108,8 @@ void rte_keepalive_register_core(struct rte_keepalive *keepcfg,
|
||||
* This function needs to be called from within the main process loop of
|
||||
* the LCore to be checked.
|
||||
*/
|
||||
static inline void
|
||||
rte_keepalive_mark_alive(struct rte_keepalive *keepcfg)
|
||||
{
|
||||
keepcfg->state_flags[rte_lcore_id()] = ALIVE;
|
||||
}
|
||||
void
|
||||
rte_keepalive_mark_alive(struct rte_keepalive *keepcfg);
|
||||
|
||||
|
||||
#endif /* _KEEPALIVE_H_ */
|
||||
|
@ -39,6 +39,37 @@
|
||||
#include <rte_keepalive.h>
|
||||
#include <rte_malloc.h>
|
||||
|
||||
struct rte_keepalive {
|
||||
/** Core Liveness. */
|
||||
enum rte_keepalive_state {
|
||||
ALIVE = 1,
|
||||
MISSING = 0,
|
||||
DEAD = 2,
|
||||
GONE = 3
|
||||
} __rte_cache_aligned state_flags[RTE_KEEPALIVE_MAXCORES];
|
||||
|
||||
/** Last-seen-alive timestamps */
|
||||
uint64_t last_alive[RTE_KEEPALIVE_MAXCORES];
|
||||
|
||||
/**
|
||||
* Cores to check.
|
||||
* Indexed by core id, non-zero if the core should be checked.
|
||||
*/
|
||||
uint8_t active_cores[RTE_KEEPALIVE_MAXCORES];
|
||||
|
||||
/** Dead core handler. */
|
||||
rte_keepalive_failure_callback_t callback;
|
||||
|
||||
/**
|
||||
* Dead core handler app data.
|
||||
* Pointer is passed to dead core handler.
|
||||
*/
|
||||
void *callback_data;
|
||||
uint64_t tsc_initial;
|
||||
uint64_t tsc_mhz;
|
||||
};
|
||||
|
||||
|
||||
static void
|
||||
print_trace(const char *msg, struct rte_keepalive *keepcfg, int idx_core)
|
||||
{
|
||||
@ -111,3 +142,10 @@ rte_keepalive_register_core(struct rte_keepalive *keepcfg, const int id_core)
|
||||
if (id_core < RTE_KEEPALIVE_MAXCORES)
|
||||
keepcfg->active_cores[id_core] = 1;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
rte_keepalive_mark_alive(struct rte_keepalive *keepcfg)
|
||||
{
|
||||
keepcfg->state_flags[rte_lcore_id()] = ALIVE;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user