[1/1] net/mlx4: fix build on PPC64

Message ID 20190813112843.27072-2-christian.ehrhardt@canonical.com
State New
Delegated to: Raslan Darawsheh
Headers show
Series
  • PPC64 buid error in 19.08
Related show

Checks

Context Check Description
ci/mellanox-Performance-Testing success Performance Testing PASS
ci/intel-Performance-Testing success Performance Testing PASS
ci/iol-Compile-Testing success Compile Testing PASS
ci/Intel-compilation success Compilation OK
ci/checkpatch warning coding style issues

Commit Message

Christian Ehrhardt Aug. 13, 2019, 11:28 a.m.
The AltiVec header file breaks boolean type:

error: incompatible types when initializing type
'__vector _bool int' {aka '_vector(4) __bool int'} using type 'int'

If __APPLE_ALTIVEC__ is defined, then bool type is redefined
and conflicts with stdbool.h.

There is no good solution to fix it for the whole project without
breaking something else, so a workaround is inserted in mlx5 PMD.
This workaround is not compatible with C++ but there is no C++ in DPDK.

Related to:
https://git.dpdk.org/dpdk/commit/?id=725f5dd0bfb50192a2d2341d4cc69084c2c4e03d

Change-Id: Iceb058c07086def4176c5ab199ca4dd5018d0340
Signed-off-by: Christian Ehrhardt <christian.ehrhardt@canonical.com>
---
 drivers/net/mlx4/mlx4_utils.h | 10 ++++++++++
 1 file changed, 10 insertions(+)

Comments

David Christensen Aug. 13, 2019, 11:49 p.m. | #1
On 8/13/19 4:28 AM, Christian Ehrhardt wrote:
> The AltiVec header file breaks boolean type:
> 
> error: incompatible types when initializing type
> '__vector _bool int' {aka '_vector(4) __bool int'} using type 'int'
> 
> If __APPLE_ALTIVEC__ is defined, then bool type is redefined
> and conflicts with stdbool.h.
> 
> There is no good solution to fix it for the whole project without
> breaking something else, so a workaround is inserted in mlx5 PMD.
> This workaround is not compatible with C++ but there is no C++ in DPDK.
> 
> Related to:
> https://git.dpdk.org/dpdk/commit/?id=725f5dd0bfb50192a2d2341d4cc69084c2c4e03d
> 
> Change-Id: Iceb058c07086def4176c5ab199ca4dd5018d0340
> Signed-off-by: Christian Ehrhardt <christian.ehrhardt@canonical.com>

Tested-by: David Christensen <drc@linux.vnet.ibm.com>

Patch

diff --git a/drivers/net/mlx4/mlx4_utils.h b/drivers/net/mlx4/mlx4_utils.h
index a49190252..74b9d2ecd 100644
--- a/drivers/net/mlx4/mlx4_utils.h
+++ b/drivers/net/mlx4/mlx4_utils.h
@@ -15,6 +15,16 @@ 
 
 #include "mlx4.h"
 
+/*
+ * Compilation workaround for PPC64 when AltiVec is fully enabled, e.g. std=c11.
+ * Otherwise there would be a type conflict between stdbool and altivec.
+ */
+#if defined(__PPC64__) && !defined(__APPLE_ALTIVEC__)
+#undef bool
+/* redefine as in stdbool.h */
+#define bool _Bool
+#endif
+
 extern int mlx4_logtype;
 
 #ifndef NDEBUG