[1/1] net/mlx4: fix build on PPC64
diff mbox series

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

Checks

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

Commit Message

Christian Ehrhardt Aug. 13, 2019, 11:28 a.m. UTC
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. UTC | #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>
Christian Ehrhardt Aug. 28, 2019, 12:30 p.m. UTC | #2
On Wed, Aug 14, 2019 at 1:49 AM David Christensen
<drc@linux.vnet.ibm.com> wrote:
>
> 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>

Thanks David, ping for considering inclusion into 19.11 ?
David Christensen Aug. 29, 2019, 5:06 p.m. UTC | #3
>>> 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>
> 
> Thanks David, ping for considering inclusion into 19.11 ?

Yes please.  I had the same patch ready to submit but you beat me to the 
punch.

Dave
Matan Azrad Sept. 1, 2019, 1:52 p.m. UTC | #4
Hi

> From: dev <dev-bounces@dpdk.org> On Behalf Of Christian Ehrhardt
> 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://eur03.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgit.dp
> dk.org%2Fdpdk%2Fcommit%2F%3Fid%3D725f5dd0bfb50192a2d2341d4cc690
> 84c2c4e03d&amp;data=02%7C01%7Cmatan%40mellanox.com%7Ccaefd20ac0
> 39441c69a508d71fe16f1b%7Ca652971c7d2e4d9ba6a4d149256f461b%7C0%7C
> 0%7C637012925402095536&amp;sdata=RP9wpAJeUdQGfEvzqlDubKsj9hHw7
> 5fEgs0JVIMTfPc%3D&amp;reserved=0
> 
> Change-Id: Iceb058c07086def4176c5ab199ca4dd5018d0340

No need the Change-Id ...

> Signed-off-by: Christian Ehrhardt <christian.ehrhardt@canonical.com>

Besides that,
Acked-by: Matan Azrad <matan@mellanox.com>

Thanks

> ---
>  drivers/net/mlx4/mlx4_utils.h | 10 ++++++++++
>  1 file changed, 10 insertions(+)
> 
> 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
> --
> 2.22.0
Raslan Darawsheh Sept. 2, 2019, 10:12 a.m. UTC | #5
Hi,

> -----Original Message-----
> From: dev <dev-bounces@dpdk.org> On Behalf Of Christian Ehrhardt
> Sent: Tuesday, August 13, 2019 2:29 PM
> To: dev <dev@dpdk.org>
> Cc: Luca Boccassi <bluca@debian.org>; Thomas Monjalon
> <thomas@monjalon.net>; Frank Heimes <frank.heimes@canonical.com>;
> Christian Ehrhardt <christian.ehrhardt@canonical.com>
> Subject: [dpdk-dev] [PATCH 1/1] net/mlx4: fix build on PPC64
> 
> 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://eur03.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgit.dp
> dk.org%2Fdpdk%2Fcommit%2F%3Fid%3D725f5dd0bfb50192a2d2341d4cc690
> 84c2c4e03d&amp;data=02%7C01%7Crasland%40mellanox.com%7C4617eec7
> ac6c4eb7bf7408d71fe17042%7Ca652971c7d2e4d9ba6a4d149256f461b%7C0%
> 7C0%7C637012925439283556&amp;sdata=6tZDB%2F7%2Bq%2Fs%2FDsZksg6Z
> sAGTZcbufps84bT6wBe6nXs%3D&amp;reserved=0
> 
> Change-Id: Iceb058c07086def4176c5ab199ca4dd5018d0340
> Signed-off-by: Christian Ehrhardt <christian.ehrhardt@canonical.com>
> ---
>  drivers/net/mlx4/mlx4_utils.h | 10 ++++++++++
>  1 file changed, 10 insertions(+)


Patch applied to next-net-mlx after small change in the commit log:
	1- removed Change ID.
	2- replaced related to link with the SHA of the commit only

Kindest regards,
Raslan Darawsheh

Patch
diff mbox series

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