[dpdk-dev,1/3] eal: fix keep alive header for C++

Message ID 1454691969-25734-2-git-send-email-thomas.monjalon@6wind.com (mailing list archive)
State Superseded, archived
Delegated to: Thomas Monjalon
Headers

Commit Message

Thomas Monjalon Feb. 5, 2016, 5:06 p.m. UTC
  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;
                                         ^

Fixes: 75583b0d1efd ("eal: add keep alive monitoring")

Signed-off-by: Thomas Monjalon <thomas.monjalon@6wind.com>
---
 lib/librte_eal/common/include/rte_keepalive.h | 15 +++++++++------
 1 file changed, 9 insertions(+), 6 deletions(-)
  

Comments

Remy Horton Feb. 15, 2016, 11:16 a.m. UTC | #1
On 05/02/2016 17:06, Thomas Monjalon wrote:
> 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;
>                                           ^
>
> Fixes: 75583b0d1efd ("eal: add keep alive monitoring")
>
> Signed-off-by: Thomas Monjalon <thomas.monjalon@6wind.com>

Acked-by: Remy Horton <remy.horton@intel.com>
  

Patch

diff --git a/lib/librte_eal/common/include/rte_keepalive.h b/lib/librte_eal/common/include/rte_keepalive.h
index 02472c0..3418c60 100644
--- a/lib/librte_eal/common/include/rte_keepalive.h
+++ b/lib/librte_eal/common/include/rte_keepalive.h
@@ -60,18 +60,21 @@  typedef void (*rte_keepalive_failure_callback_t)(
 	const int id_core);
 
 
+enum rte_keepalive_state {
+	ALIVE = 1,
+	MISSING = 0,
+	DEAD = 2,
+	GONE = 3
+};
+
 /**
  * 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];
+	enum rte_keepalive_state __rte_cache_aligned
+		state_flags[RTE_KEEPALIVE_MAXCORES];
 
 	/** Last-seen-alive timestamps */
 	uint64_t last_alive[RTE_KEEPALIVE_MAXCORES];