All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/3] fix C++ includes
@ 2016-02-05 17:06 Thomas Monjalon
  2016-02-05 17:06 ` [PATCH 1/3] eal: fix keep alive header for C++ Thomas Monjalon
                   ` (3 more replies)
  0 siblings, 4 replies; 16+ messages in thread
From: Thomas Monjalon @ 2016-02-05 17:06 UTC (permalink / raw)
  To: pablo.de.lara.guarch, declan.doherty, remy.horton; +Cc: dev

When trying to build a C++ application, some error appears from DPDK headers.
2 libraries are not fixed in this series:
- cmdline
- vhost which includes some not compliant Linux virtio headers

Thomas Monjalon (3):
  eal: fix keep alive header for C++
  hash: fix header for C++
  mbuf_offload: fix header for C++

 lib/librte_eal/common/include/rte_keepalive.h | 15 +++++++++------
 lib/librte_hash/rte_jhash.h                   |  2 +-
 lib/librte_mbuf_offload/rte_mbuf_offload.h    |  5 ++++-
 3 files changed, 14 insertions(+), 8 deletions(-)

-- 
2.7.0

^ permalink raw reply	[flat|nested] 16+ messages in thread

* [PATCH 1/3] eal: fix keep alive header for C++
  2016-02-05 17:06 [PATCH 0/3] fix C++ includes Thomas Monjalon
@ 2016-02-05 17:06 ` Thomas Monjalon
  2016-02-15 11:16   ` Remy Horton
  2016-02-05 17:06 ` [PATCH 2/3] hash: fix " Thomas Monjalon
                   ` (2 subsequent siblings)
  3 siblings, 1 reply; 16+ messages in thread
From: Thomas Monjalon @ 2016-02-05 17:06 UTC (permalink / raw)
  To: pablo.de.lara.guarch, declan.doherty, remy.horton; +Cc: dev

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(-)

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];
-- 
2.7.0

^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [PATCH 2/3] hash: fix header for C++
  2016-02-05 17:06 [PATCH 0/3] fix C++ includes Thomas Monjalon
  2016-02-05 17:06 ` [PATCH 1/3] eal: fix keep alive header for C++ Thomas Monjalon
@ 2016-02-05 17:06 ` Thomas Monjalon
  2016-02-08 13:42   ` De Lara Guarch, Pablo
  2016-02-05 17:06 ` [PATCH 3/3] mbuf_offload: " Thomas Monjalon
  2016-02-16  7:14 ` [PATCH v2 0/3] fix C++ includes Thomas Monjalon
  3 siblings, 1 reply; 16+ messages in thread
From: Thomas Monjalon @ 2016-02-05 17:06 UTC (permalink / raw)
  To: pablo.de.lara.guarch, declan.doherty, remy.horton; +Cc: dev

When built in a C++ application, the jhash include fails:

rte_jhash.h:123:22: error:
invalid conversion from ‘const void*’ to ‘const uint32_t*’ [-fpermissive]
  const uint32_t *k = key;
                      ^

Fixes: 8718219a8737 ("hash: add new jhash functions")

Signed-off-by: Thomas Monjalon <thomas.monjalon@6wind.com>
---
 lib/librte_hash/rte_jhash.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/librte_hash/rte_jhash.h b/lib/librte_hash/rte_jhash.h
index 457f225..207478c 100644
--- a/lib/librte_hash/rte_jhash.h
+++ b/lib/librte_hash/rte_jhash.h
@@ -120,7 +120,7 @@ __rte_jhash_2hashes(const void *key, uint32_t length, uint32_t *pc,
 	 * If check_align is not set, first case will be used
 	 */
 #if defined(RTE_ARCH_X86_64) || defined(RTE_ARCH_I686) || defined(RTE_ARCH_X86_X32)
-	const uint32_t *k = key;
+	const uint32_t *k = (const uint32_t *)key;
 	const uint32_t s = 0;
 #else
 	const uint32_t *k = (uint32_t *)((uintptr_t)key & (uintptr_t)~3);
-- 
2.7.0

^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [PATCH 3/3] mbuf_offload: fix header for C++
  2016-02-05 17:06 [PATCH 0/3] fix C++ includes Thomas Monjalon
  2016-02-05 17:06 ` [PATCH 1/3] eal: fix keep alive header for C++ Thomas Monjalon
  2016-02-05 17:06 ` [PATCH 2/3] hash: fix " Thomas Monjalon
@ 2016-02-05 17:06 ` Thomas Monjalon
  2016-02-05 21:33   ` Thomas Monjalon
  2016-02-16  7:14 ` [PATCH v2 0/3] fix C++ includes Thomas Monjalon
  3 siblings, 1 reply; 16+ messages in thread
From: Thomas Monjalon @ 2016-02-05 17:06 UTC (permalink / raw)
  To: pablo.de.lara.guarch, declan.doherty, remy.horton; +Cc: dev

When built in a C++ application, the include fails for 2 reasons:

rte_mbuf_offload.h:128:24: error:
invalid conversion from ‘void*’ to ‘rte_pktmbuf_offload_pool_private*’ [-fpermissive]
    rte_mempool_get_priv(mpool);
                        ^

rte_mbuf_offload.h:304:1: error: expected declaration before ‘}’ token

Fixes: 78c8709b5ddb ("mbuf_offload: introduce library to attach offloads to mbuf")

Signed-off-by: Thomas Monjalon <thomas.monjalon@6wind.com>
---
 lib/librte_mbuf_offload/rte_mbuf_offload.h | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/lib/librte_mbuf_offload/rte_mbuf_offload.h b/lib/librte_mbuf_offload/rte_mbuf_offload.h
index 4345f06..a0e990d 100644
--- a/lib/librte_mbuf_offload/rte_mbuf_offload.h
+++ b/lib/librte_mbuf_offload/rte_mbuf_offload.h
@@ -59,6 +59,9 @@
 #include <rte_mbuf.h>
 #include <rte_crypto.h>
 
+#ifdef __cplusplus
+extern "C" {
+#endif
 
 /** packet mbuf offload operation types */
 enum rte_mbuf_ol_op_type {
@@ -125,7 +128,7 @@ static inline uint16_t
 __rte_pktmbuf_offload_priv_size(struct rte_mempool *mpool)
 {
 	struct rte_pktmbuf_offload_pool_private *priv =
-			rte_mempool_get_priv(mpool);
+		(rte_pktmbuf_offload_pool_private *)rte_mempool_get_priv(mpool);
 
 	return priv->offload_priv_size;
 }
-- 
2.7.0

^ permalink raw reply related	[flat|nested] 16+ messages in thread

* Re: [PATCH 3/3] mbuf_offload: fix header for C++
  2016-02-05 17:06 ` [PATCH 3/3] mbuf_offload: " Thomas Monjalon
@ 2016-02-05 21:33   ` Thomas Monjalon
  0 siblings, 0 replies; 16+ messages in thread
From: Thomas Monjalon @ 2016-02-05 21:33 UTC (permalink / raw)
  To: declan.doherty; +Cc: dev

2016-02-05 18:06, Thomas Monjalon:
> When built in a C++ application, the include fails for 2 reasons:
> 
> rte_mbuf_offload.h:128:24: error:
> invalid conversion from ‘void*’ to ‘rte_pktmbuf_offload_pool_private*’ [-fpermissive]
>     rte_mempool_get_priv(mpool);
>                         ^
[...]
>  	struct rte_pktmbuf_offload_pool_private *priv =
> -			rte_mempool_get_priv(mpool);
> +		(rte_pktmbuf_offload_pool_private *)rte_mempool_get_priv(mpool);

self-nack: a struct keyword is missing

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH 2/3] hash: fix header for C++
  2016-02-05 17:06 ` [PATCH 2/3] hash: fix " Thomas Monjalon
@ 2016-02-08 13:42   ` De Lara Guarch, Pablo
  0 siblings, 0 replies; 16+ messages in thread
From: De Lara Guarch, Pablo @ 2016-02-08 13:42 UTC (permalink / raw)
  To: Thomas Monjalon, Doherty, Declan, Horton, Remy; +Cc: dev



> -----Original Message-----
> From: Thomas Monjalon [mailto:thomas.monjalon@6wind.com]
> Sent: Friday, February 05, 2016 5:06 PM
> To: De Lara Guarch, Pablo; Doherty, Declan; Horton, Remy
> Cc: dev@dpdk.org
> Subject: [PATCH 2/3] hash: fix header for C++
> 
> When built in a C++ application, the jhash include fails:
> 
> rte_jhash.h:123:22: error:
> invalid conversion from ‘const void*’ to ‘const uint32_t*’ [-fpermissive]
>   const uint32_t *k = key;
>                       ^
> 
> Fixes: 8718219a8737 ("hash: add new jhash functions")
> 
> Signed-off-by: Thomas Monjalon <thomas.monjalon@6wind.com>

Acked-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH 1/3] eal: fix keep alive header for C++
  2016-02-05 17:06 ` [PATCH 1/3] eal: fix keep alive header for C++ Thomas Monjalon
@ 2016-02-15 11:16   ` Remy Horton
  0 siblings, 0 replies; 16+ messages in thread
From: Remy Horton @ 2016-02-15 11:16 UTC (permalink / raw)
  To: Thomas Monjalon, pablo.de.lara.guarch, declan.doherty; +Cc: dev


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>

^ permalink raw reply	[flat|nested] 16+ messages in thread

* [PATCH v2 0/3] fix C++ includes
  2016-02-05 17:06 [PATCH 0/3] fix C++ includes Thomas Monjalon
                   ` (2 preceding siblings ...)
  2016-02-05 17:06 ` [PATCH 3/3] mbuf_offload: " Thomas Monjalon
@ 2016-02-16  7:14 ` Thomas Monjalon
  2016-02-16  7:14   ` [PATCH v2 1/3] eal: fix keep alive header for C++ Thomas Monjalon
                     ` (4 more replies)
  3 siblings, 5 replies; 16+ messages in thread
From: Thomas Monjalon @ 2016-02-16  7:14 UTC (permalink / raw)
  To: pablo.de.lara.guarch, declan.doherty, remy.horton; +Cc: dev

When trying to build a C++ application, some errors appear from DPDK headers.
2 libraries are not fixed in this series:
- cmdline
- vhost which includes some not compliant Linux virtio headers

v2:
- move keep-alive struct out of header
- fix syntax in mbuf_offload cast

Thomas Monjalon (3):
  eal: fix keep alive header for C++
  hash: fix header for C++
  mbuf_offload: fix header for C++

 lib/librte_eal/common/include/rte_keepalive.h | 37 +++-----------------------
 lib/librte_eal/common/rte_keepalive.c         | 38 +++++++++++++++++++++++++++
 lib/librte_hash/rte_jhash.h                   |  2 +-
 lib/librte_mbuf_offload/rte_mbuf_offload.h    |  5 +++-
 4 files changed, 46 insertions(+), 36 deletions(-)

-- 
2.7.0

^ permalink raw reply	[flat|nested] 16+ messages in thread

* [PATCH v2 1/3] eal: fix keep alive header for C++
  2016-02-16  7:14 ` [PATCH v2 0/3] fix C++ includes Thomas Monjalon
@ 2016-02-16  7:14   ` Thomas Monjalon
  2016-02-16 10:16     ` Remy Horton
  2016-02-16  7:14   ` [PATCH v2 2/3] hash: fix " Thomas Monjalon
                     ` (3 subsequent siblings)
  4 siblings, 1 reply; 16+ messages in thread
From: Thomas Monjalon @ 2016-02-16  7:14 UTC (permalink / raw)
  To: pablo.de.lara.guarch, declan.doherty, remy.horton; +Cc: dev

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>
---
 lib/librte_eal/common/include/rte_keepalive.h | 37 +++-----------------------
 lib/librte_eal/common/rte_keepalive.c         | 38 +++++++++++++++++++++++++++
 2 files changed, 41 insertions(+), 34 deletions(-)

v2:
- move keep-alive struct out of header
- uninline mark_alive function

diff --git a/lib/librte_eal/common/include/rte_keepalive.h b/lib/librte_eal/common/include/rte_keepalive.h
index 02472c0..f4cec04 100644
--- a/lib/librte_eal/common/include/rte_keepalive.h
+++ b/lib/librte_eal/common/include/rte_keepalive.h
@@ -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_ */
diff --git a/lib/librte_eal/common/rte_keepalive.c b/lib/librte_eal/common/rte_keepalive.c
index 736fd0f..bd1f16b 100644
--- a/lib/librte_eal/common/rte_keepalive.c
+++ b/lib/librte_eal/common/rte_keepalive.c
@@ -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;
+}
-- 
2.7.0

^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [PATCH v2 2/3] hash: fix header for C++
  2016-02-16  7:14 ` [PATCH v2 0/3] fix C++ includes Thomas Monjalon
  2016-02-16  7:14   ` [PATCH v2 1/3] eal: fix keep alive header for C++ Thomas Monjalon
@ 2016-02-16  7:14   ` Thomas Monjalon
  2016-02-16  7:14   ` [PATCH v2 3/3] mbuf_offload: " Thomas Monjalon
                     ` (2 subsequent siblings)
  4 siblings, 0 replies; 16+ messages in thread
From: Thomas Monjalon @ 2016-02-16  7:14 UTC (permalink / raw)
  To: pablo.de.lara.guarch, declan.doherty, remy.horton; +Cc: dev

When built in a C++ application, the jhash include fails:

rte_jhash.h:123:22: error:
invalid conversion from ‘const void*’ to ‘const uint32_t*’ [-fpermissive]
  const uint32_t *k = key;
                      ^
The cast must be explicit for C++.

Fixes: 8718219a8737 ("hash: add new jhash functions")

Signed-off-by: Thomas Monjalon <thomas.monjalon@6wind.com>
Acked-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
---
 lib/librte_hash/rte_jhash.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/librte_hash/rte_jhash.h b/lib/librte_hash/rte_jhash.h
index 457f225..207478c 100644
--- a/lib/librte_hash/rte_jhash.h
+++ b/lib/librte_hash/rte_jhash.h
@@ -120,7 +120,7 @@ __rte_jhash_2hashes(const void *key, uint32_t length, uint32_t *pc,
 	 * If check_align is not set, first case will be used
 	 */
 #if defined(RTE_ARCH_X86_64) || defined(RTE_ARCH_I686) || defined(RTE_ARCH_X86_X32)
-	const uint32_t *k = key;
+	const uint32_t *k = (const uint32_t *)key;
 	const uint32_t s = 0;
 #else
 	const uint32_t *k = (uint32_t *)((uintptr_t)key & (uintptr_t)~3);
-- 
2.7.0

^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [PATCH v2 3/3] mbuf_offload: fix header for C++
  2016-02-16  7:14 ` [PATCH v2 0/3] fix C++ includes Thomas Monjalon
  2016-02-16  7:14   ` [PATCH v2 1/3] eal: fix keep alive header for C++ Thomas Monjalon
  2016-02-16  7:14   ` [PATCH v2 2/3] hash: fix " Thomas Monjalon
@ 2016-02-16  7:14   ` Thomas Monjalon
  2016-02-16 16:21   ` [PATCH v2 0/3] fix C++ includes Ferruh Yigit
  2016-02-21 10:49   ` Thomas Monjalon
  4 siblings, 0 replies; 16+ messages in thread
From: Thomas Monjalon @ 2016-02-16  7:14 UTC (permalink / raw)
  To: pablo.de.lara.guarch, declan.doherty, remy.horton; +Cc: dev

When built in a C++ application, the include fails for 2 reasons:

rte_mbuf_offload.h:128:24: error:
invalid conversion from ‘void*’ to ‘rte_pktmbuf_offload_pool_private*’ [-fpermissive]
    rte_mempool_get_priv(mpool);
                        ^
The cast must be explicit for C++.

rte_mbuf_offload.h:304:1: error: expected declaration before ‘}’ token

There was a closing brace for __cplusplus but not an opening one.

Fixes: 78c8709b5ddb ("mbuf_offload: introduce library to attach offloads to mbuf")

Signed-off-by: Thomas Monjalon <thomas.monjalon@6wind.com>
---
 lib/librte_mbuf_offload/rte_mbuf_offload.h | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

v2:
- add struct keyword

diff --git a/lib/librte_mbuf_offload/rte_mbuf_offload.h b/lib/librte_mbuf_offload/rte_mbuf_offload.h
index 4345f06..77993b6 100644
--- a/lib/librte_mbuf_offload/rte_mbuf_offload.h
+++ b/lib/librte_mbuf_offload/rte_mbuf_offload.h
@@ -59,6 +59,9 @@
 #include <rte_mbuf.h>
 #include <rte_crypto.h>
 
+#ifdef __cplusplus
+extern "C" {
+#endif
 
 /** packet mbuf offload operation types */
 enum rte_mbuf_ol_op_type {
@@ -125,7 +128,7 @@ static inline uint16_t
 __rte_pktmbuf_offload_priv_size(struct rte_mempool *mpool)
 {
 	struct rte_pktmbuf_offload_pool_private *priv =
-			rte_mempool_get_priv(mpool);
+		(struct rte_pktmbuf_offload_pool_private *)rte_mempool_get_priv(mpool);
 
 	return priv->offload_priv_size;
 }
-- 
2.7.0

^ permalink raw reply related	[flat|nested] 16+ messages in thread

* Re: [PATCH v2 1/3] eal: fix keep alive header for C++
  2016-02-16  7:14   ` [PATCH v2 1/3] eal: fix keep alive header for C++ Thomas Monjalon
@ 2016-02-16 10:16     ` Remy Horton
  0 siblings, 0 replies; 16+ messages in thread
From: Remy Horton @ 2016-02-16 10:16 UTC (permalink / raw)
  To: Thomas Monjalon, pablo.de.lara.guarch, declan.doherty; +Cc: dev


Suspect this will introduce an extra indirection and call/return into 
the generated code, but can't think of any alternative that doesn't 
potentially break source compatibility..


On 16/02/2016 07:14, 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;
>                                           ^
> 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>

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH v2 0/3] fix C++ includes
  2016-02-16  7:14 ` [PATCH v2 0/3] fix C++ includes Thomas Monjalon
                     ` (2 preceding siblings ...)
  2016-02-16  7:14   ` [PATCH v2 3/3] mbuf_offload: " Thomas Monjalon
@ 2016-02-16 16:21   ` Ferruh Yigit
  2016-02-16 16:26     ` Thomas Monjalon
  2016-02-21 10:49   ` Thomas Monjalon
  4 siblings, 1 reply; 16+ messages in thread
From: Ferruh Yigit @ 2016-02-16 16:21 UTC (permalink / raw)
  To: Thomas Monjalon; +Cc: dev

On Tue, Feb 16, 2016 at 08:14:22AM +0100, Thomas Monjalon wrote:
> When trying to build a C++ application, some errors appear from DPDK headers.
> 2 libraries are not fixed in this series:
> - cmdline
> - vhost which includes some not compliant Linux virtio headers
> 
Hi Thomas,

Out of curiosity, how can we detect C++ compilation problems, do we have a C++ sample application?
Or how can we compile any existing application with c++, I tried "EXTRA_CFLAGS="-x c++" or "CC=g++" but both failed to compile.

Thanks,
ferruh

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH v2 0/3] fix C++ includes
  2016-02-16 16:21   ` [PATCH v2 0/3] fix C++ includes Ferruh Yigit
@ 2016-02-16 16:26     ` Thomas Monjalon
  2016-02-16 18:33       ` Marc
  0 siblings, 1 reply; 16+ messages in thread
From: Thomas Monjalon @ 2016-02-16 16:26 UTC (permalink / raw)
  To: Ferruh Yigit; +Cc: dev

2016-02-16 16:21, Ferruh Yigit:
> On Tue, Feb 16, 2016 at 08:14:22AM +0100, Thomas Monjalon wrote:
> > When trying to build a C++ application, some errors appear from DPDK headers.
> > 2 libraries are not fixed in this series:
> > - cmdline
> > - vhost which includes some not compliant Linux virtio headers
> 
> Out of curiosity, how can we detect C++ compilation problems, do we have a C++ sample application?
> Or how can we compile any existing application with c++, I tried "EXTRA_CFLAGS="-x c++" or "CC=g++" but both failed to compile.

I will submit a test.
At the moment, I use CC=g++ with this file:

#ifdef RTE_LIBRTE_EAL
#include <rte_alarm.h>
#include <rte_atomic.h>
#include <rte_branch_prediction.h>
#include <rte_byteorder.h>
#include <rte_common.h>
#include <rte_cpuflags.h>
#include <rte_cycles.h>
#include <rte_debug.h>
#include <rte_devargs.h>
#include <rte_dev.h>
#include <rte_dev_info.h>
#include <rte_eal.h>
#include <rte_eal_memconfig.h>
#include <rte_errno.h>
#include <rte_hexdump.h>
#include <rte_interrupts.h>
#include <rte_keepalive.h>
#include <rte_launch.h>
#include <rte_lcore.h>
#include <rte_log.h>
#include <rte_malloc.h>
#include <rte_malloc_heap.h>
#include <rte_memcpy.h>
#include <rte_memory.h>
#include <rte_memzone.h>
#include <rte_pci.h>
#include <rte_pci_dev_feature_defs.h>
#include <rte_pci_dev_features.h>
#include <rte_pci_dev_ids.h>
#include <rte_per_lcore.h>
#include <rte_prefetch.h>
#include <rte_random.h>
#ifdef RTE_ARCH_X86
#include <rte_rtm.h>
#endif
#include <rte_rwlock.h>
#include <rte_spinlock.h>
#include <rte_string_fns.h>
#include <rte_tailq.h>
#include <rte_time.h>
#include <rte_timer.h>
#include <rte_vect.h>
#include <rte_version.h>
#endif
#ifdef RTE_LIBRTE_CMDLINE
/* TODO: C++ support
#include <cmdline.h>
#include <cmdline_cirbuf.h>
#include <cmdline_parse_etheraddr.h>
*/
#include <cmdline_parse.h>
#include <cmdline_parse_ipaddr.h>
#include <cmdline_parse_num.h>
#include <cmdline_parse_portlist.h>
#include <cmdline_parse_string.h>
#include <cmdline_rdline.h>
#include <cmdline_socket.h>
#include <cmdline_vt100.h>
#endif
#ifdef RTE_LIBRTE_ACL
#include <rte_acl.h>
#endif
#ifdef RTE_LIBRTE_SCHED
#include <rte_approx.h>
#include <rte_bitmap.h>
#include <rte_red.h>
#include <rte_sched_common.h>
#include <rte_sched.h>
#endif
#ifdef RTE_LIBRTE_NET
#include <rte_arp.h>
#include <rte_icmp.h>
#include <rte_ip.h>
#include <rte_sctp.h>
#include <rte_tcp.h>
#include <rte_udp.h>
#endif
#ifdef RTE_LIBRTE_CFGFILE
#include <rte_cfgfile.h>
#endif
#include <rte_compat.h>
#include <rte_config.h>
#ifdef RTE_LIBRTE_CRYPTODEV
#include <rte_crypto.h>
#include <rte_cryptodev.h>
#include <rte_cryptodev_pmd.h>
#endif
#ifdef RTE_LIBRTE_DISTRIBUTOR
#include <rte_distributor.h>
#endif
#ifdef RTE_LIBRTE_PMD_AF_PACKET
#include <rte_eth_af_packet.h>
#endif
#ifdef RTE_LIBRTE_PMD_BOND
#include <rte_eth_bond.h>
#include <rte_eth_bond_8023ad.h>
#endif
#ifdef RTE_LIBRTE_ETHER
#include <rte_eth_ctrl.h>
#include <rte_ethdev.h>
#include <rte_ether.h>
#endif
#ifdef RTE_LIBRTE_PMD_NULL
#include <rte_eth_null.h>
#endif
#ifdef RTE_LIBRTE_PMD_RING
#include <rte_eth_ring.h>
#endif
#ifdef RTE_LIBRTE_HASH
#include <rte_fbk_hash.h>
#include <rte_hash_crc.h>
#include <rte_hash.h>
#include <rte_jhash.h>
#include <rte_thash.h>
#endif
#ifdef RTE_LIBRTE_IP_FRAG
#include <rte_ip_frag.h>
#endif
#ifdef RTE_LIBRTE_JOBSTATS
#include <rte_jobstats.h>
#endif
#ifdef RTE_LIBRTE_KNI
#include <rte_kni.h>
#endif
#ifdef RTE_LIBRTE_KVARGS
#include <rte_kvargs.h>
#endif
#ifdef RTE_LIBRTE_LPM
#include <rte_lpm.h>
#include <rte_lpm6.h>
#endif
#ifdef RTE_LIBRTE_MBUF
#include <rte_mbuf.h>
#endif
#ifdef RTE_LIBRTE_MBUF_OFFLOAD
#include <rte_mbuf_offload.h>
#endif
#ifdef RTE_LIBRTE_MEMPOOL
#include <rte_mempool.h>
#endif
#ifdef RTE_LIBRTE_METER
#include <rte_meter.h>
#endif
#ifdef RTE_LIBRTE_PIPELINE
#include <rte_pipeline.h>
#endif
#ifdef RTE_LIBRTE_PORT
#include <rte_port.h>
#include <rte_port_ethdev.h>
#include <rte_port_frag.h>
#include <rte_port_ras.h>
#include <rte_port_ring.h>
#include <rte_port_sched.h>
#include <rte_port_source_sink.h>
#endif
#ifdef RTE_LIBRTE_POWER
#include <rte_power.h>
#endif
#ifdef RTE_LIBRTE_REORDER
#include <rte_reorder.h>
#endif
#ifdef RTE_LIBRTE_RING
#include <rte_ring.h>
#endif
#ifdef RTE_LIBRTE_TABLE
#include <rte_lru.h>
#include <rte_table.h>
#include <rte_table_acl.h>
#include <rte_table_array.h>
#include <rte_table_hash.h>
#include <rte_table_lpm.h>
#include <rte_table_lpm_ipv6.h>
#include <rte_table_stub.h>
#endif
#ifdef RTE_LIBRTE_VHOST
/* TODO: fix vhost header for C++
#include <rte_virtio_net.h>
*/
#endif

int
main(int argc, char **argv)
{
        RTE_LOG(NOTICE, USER1, "function %s\n", __func__);
        return 0;
}

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH v2 0/3] fix C++ includes
  2016-02-16 16:26     ` Thomas Monjalon
@ 2016-02-16 18:33       ` Marc
  0 siblings, 0 replies; 16+ messages in thread
From: Marc @ 2016-02-16 18:33 UTC (permalink / raw)
  To: Thomas Monjalon; +Cc: dev

On 16 February 2016 at 17:26, Thomas Monjalon <thomas.monjalon@6wind.com>
wrote:

> 2016-02-16 16:21, Ferruh Yigit:
> > On Tue, Feb 16, 2016 at 08:14:22AM +0100, Thomas Monjalon wrote:
> > > When trying to build a C++ application, some errors appear from DPDK
> headers.
> > > 2 libraries are not fixed in this series:
> > > - cmdline
> > > - vhost which includes some not compliant Linux virtio headers
> >
> > Out of curiosity, how can we detect C++ compilation problems, do we have
> a C++ sample application?
> > Or how can we compile any existing application with c++, I tried
> "EXTRA_CFLAGS="-x c++" or "CC=g++" but both failed to compile.
>
> I will submit a test.
> At the moment, I use CC=g++ with this file:
>
> #ifdef RTE_LIBRTE_EAL
> #include <rte_alarm.h>
> #include <rte_atomic.h>
> #include <rte_branch_prediction.h>
> #include <rte_byteorder.h>
> #include <rte_common.h>
> #include <rte_cpuflags.h>
> #include <rte_cycles.h>
> #include <rte_debug.h>
> #include <rte_devargs.h>
> #include <rte_dev.h>
> #include <rte_dev_info.h>
> #include <rte_eal.h>
> #include <rte_eal_memconfig.h>
> #include <rte_errno.h>
> #include <rte_hexdump.h>
> #include <rte_interrupts.h>
> #include <rte_keepalive.h>
> #include <rte_launch.h>
> #include <rte_lcore.h>
> #include <rte_log.h>
> #include <rte_malloc.h>
> #include <rte_malloc_heap.h>
> #include <rte_memcpy.h>
> #include <rte_memory.h>
> #include <rte_memzone.h>
> #include <rte_pci.h>
> #include <rte_pci_dev_feature_defs.h>
> #include <rte_pci_dev_features.h>
> #include <rte_pci_dev_ids.h>
> #include <rte_per_lcore.h>
> #include <rte_prefetch.h>
> #include <rte_random.h>
> #ifdef RTE_ARCH_X86
> #include <rte_rtm.h>
> #endif
> #include <rte_rwlock.h>
> #include <rte_spinlock.h>
> #include <rte_string_fns.h>
> #include <rte_tailq.h>
> #include <rte_time.h>
> #include <rte_timer.h>
> #include <rte_vect.h>
> #include <rte_version.h>
> #endif
> #ifdef RTE_LIBRTE_CMDLINE
> /* TODO: C++ support
> #include <cmdline.h>
> #include <cmdline_cirbuf.h>
> #include <cmdline_parse_etheraddr.h>
> */
> #include <cmdline_parse.h>
> #include <cmdline_parse_ipaddr.h>
> #include <cmdline_parse_num.h>
> #include <cmdline_parse_portlist.h>
> #include <cmdline_parse_string.h>
> #include <cmdline_rdline.h>
> #include <cmdline_socket.h>
> #include <cmdline_vt100.h>
> #endif
> #ifdef RTE_LIBRTE_ACL
> #include <rte_acl.h>
> #endif
> #ifdef RTE_LIBRTE_SCHED
> #include <rte_approx.h>
> #include <rte_bitmap.h>
> #include <rte_red.h>
> #include <rte_sched_common.h>
> #include <rte_sched.h>
> #endif
> #ifdef RTE_LIBRTE_NET
> #include <rte_arp.h>
> #include <rte_icmp.h>
> #include <rte_ip.h>
> #include <rte_sctp.h>
> #include <rte_tcp.h>
> #include <rte_udp.h>
> #endif
> #ifdef RTE_LIBRTE_CFGFILE
> #include <rte_cfgfile.h>
> #endif
> #include <rte_compat.h>
> #include <rte_config.h>
> #ifdef RTE_LIBRTE_CRYPTODEV
> #include <rte_crypto.h>
> #include <rte_cryptodev.h>
> #include <rte_cryptodev_pmd.h>
> #endif
> #ifdef RTE_LIBRTE_DISTRIBUTOR
> #include <rte_distributor.h>
> #endif
> #ifdef RTE_LIBRTE_PMD_AF_PACKET
> #include <rte_eth_af_packet.h>
> #endif
> #ifdef RTE_LIBRTE_PMD_BOND
> #include <rte_eth_bond.h>
> #include <rte_eth_bond_8023ad.h>
> #endif
> #ifdef RTE_LIBRTE_ETHER
> #include <rte_eth_ctrl.h>
> #include <rte_ethdev.h>
> #include <rte_ether.h>
> #endif
> #ifdef RTE_LIBRTE_PMD_NULL
> #include <rte_eth_null.h>
> #endif
> #ifdef RTE_LIBRTE_PMD_RING
> #include <rte_eth_ring.h>
> #endif
> #ifdef RTE_LIBRTE_HASH
> #include <rte_fbk_hash.h>
> #include <rte_hash_crc.h>
> #include <rte_hash.h>
> #include <rte_jhash.h>
> #include <rte_thash.h>
> #endif
> #ifdef RTE_LIBRTE_IP_FRAG
> #include <rte_ip_frag.h>
> #endif
> #ifdef RTE_LIBRTE_JOBSTATS
> #include <rte_jobstats.h>
> #endif
> #ifdef RTE_LIBRTE_KNI
> #include <rte_kni.h>
> #endif
> #ifdef RTE_LIBRTE_KVARGS
> #include <rte_kvargs.h>
> #endif
> #ifdef RTE_LIBRTE_LPM
> #include <rte_lpm.h>
> #include <rte_lpm6.h>
> #endif
> #ifdef RTE_LIBRTE_MBUF
> #include <rte_mbuf.h>
> #endif
> #ifdef RTE_LIBRTE_MBUF_OFFLOAD
> #include <rte_mbuf_offload.h>
> #endif
> #ifdef RTE_LIBRTE_MEMPOOL
> #include <rte_mempool.h>
> #endif
> #ifdef RTE_LIBRTE_METER
> #include <rte_meter.h>
> #endif
> #ifdef RTE_LIBRTE_PIPELINE
> #include <rte_pipeline.h>
> #endif
> #ifdef RTE_LIBRTE_PORT
> #include <rte_port.h>
> #include <rte_port_ethdev.h>
> #include <rte_port_frag.h>
> #include <rte_port_ras.h>
> #include <rte_port_ring.h>
> #include <rte_port_sched.h>
> #include <rte_port_source_sink.h>
> #endif
> #ifdef RTE_LIBRTE_POWER
> #include <rte_power.h>
> #endif
> #ifdef RTE_LIBRTE_REORDER
> #include <rte_reorder.h>
> #endif
> #ifdef RTE_LIBRTE_RING
> #include <rte_ring.h>
> #endif
> #ifdef RTE_LIBRTE_TABLE
> #include <rte_lru.h>
> #include <rte_table.h>
> #include <rte_table_acl.h>
> #include <rte_table_array.h>
> #include <rte_table_hash.h>
> #include <rte_table_lpm.h>
> #include <rte_table_lpm_ipv6.h>
> #include <rte_table_stub.h>
> #endif
> #ifdef RTE_LIBRTE_VHOST
> /* TODO: fix vhost header for C++
> #include <rte_virtio_net.h>
> */
> #endif
>
> int
> main(int argc, char **argv)
> {
>         RTE_LOG(NOTICE, USER1, "function %s\n", __func__);
>         return 0;
> }
>
>
I don't know what you have in mind for the test, but with this file you can
only detect things like using reserved keywords of C++ in DPDK headers and
things like that. It will not detect linking issues (fundamentally missing
extern "C" in function declarations), which happen from time to time,
specially with new headers.

We would need to compile a .cc/.cpp file including all these headers and
link against all the functions on those headers, similarly to what autoconf
does to test libs. I could help on that for 2.4.

Marc

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH v2 0/3] fix C++ includes
  2016-02-16  7:14 ` [PATCH v2 0/3] fix C++ includes Thomas Monjalon
                     ` (3 preceding siblings ...)
  2016-02-16 16:21   ` [PATCH v2 0/3] fix C++ includes Ferruh Yigit
@ 2016-02-21 10:49   ` Thomas Monjalon
  4 siblings, 0 replies; 16+ messages in thread
From: Thomas Monjalon @ 2016-02-21 10:49 UTC (permalink / raw)
  To: dev

2016-02-16 08:14, Thomas Monjalon:
> When trying to build a C++ application, some errors appear from DPDK headers.
> 2 libraries are not fixed in this series:
> - cmdline
> - vhost which includes some not compliant Linux virtio headers
> 
> v2:
> - move keep-alive struct out of header
> - fix syntax in mbuf_offload cast
> 
> Thomas Monjalon (3):
>   eal: fix keep alive header for C++
>   hash: fix header for C++
>   mbuf_offload: fix header for C++

Applied

^ permalink raw reply	[flat|nested] 16+ messages in thread

end of thread, other threads:[~2016-02-21 10:51 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-02-05 17:06 [PATCH 0/3] fix C++ includes Thomas Monjalon
2016-02-05 17:06 ` [PATCH 1/3] eal: fix keep alive header for C++ Thomas Monjalon
2016-02-15 11:16   ` Remy Horton
2016-02-05 17:06 ` [PATCH 2/3] hash: fix " Thomas Monjalon
2016-02-08 13:42   ` De Lara Guarch, Pablo
2016-02-05 17:06 ` [PATCH 3/3] mbuf_offload: " Thomas Monjalon
2016-02-05 21:33   ` Thomas Monjalon
2016-02-16  7:14 ` [PATCH v2 0/3] fix C++ includes Thomas Monjalon
2016-02-16  7:14   ` [PATCH v2 1/3] eal: fix keep alive header for C++ Thomas Monjalon
2016-02-16 10:16     ` Remy Horton
2016-02-16  7:14   ` [PATCH v2 2/3] hash: fix " Thomas Monjalon
2016-02-16  7:14   ` [PATCH v2 3/3] mbuf_offload: " Thomas Monjalon
2016-02-16 16:21   ` [PATCH v2 0/3] fix C++ includes Ferruh Yigit
2016-02-16 16:26     ` Thomas Monjalon
2016-02-16 18:33       ` Marc
2016-02-21 10:49   ` Thomas Monjalon

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.