From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 9E518A034F; Tue, 28 Apr 2020 09:58:49 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 7157B1D540; Tue, 28 Apr 2020 09:58:49 +0200 (CEST) Received: from mellanox.co.il (mail-il-dmz.mellanox.com [193.47.165.129]) by dpdk.org (Postfix) with ESMTP id C30471D509 for ; Tue, 28 Apr 2020 09:58:47 +0200 (CEST) Received: from Internal Mail-Server by MTLPINE2 (envelope-from orika@mellanox.com) with ESMTPS (AES256-SHA encrypted); 28 Apr 2020 10:58:45 +0300 Received: from pegasus04.mtr.labs.mlnx. (pegasus04.mtr.labs.mlnx [10.210.16.126]) by labmailer.mlnx (8.13.8/8.13.8) with ESMTP id 03S7wfDR027491; Tue, 28 Apr 2020 10:58:44 +0300 From: Ori Kam To: thomas@monjalon.net, Matan Azrad , Shahaf Shuler , Viacheslav Ovsiienko , David Christensen Cc: dev@dpdk.org, orika@mellanox.com, ferruh.yigit@intel.com Date: Tue, 28 Apr 2020 07:58:25 +0000 Message-Id: <1588060706-27316-1-git-send-email-orika@mellanox.com> X-Mailer: git-send-email 1.8.3.1 Subject: [dpdk-dev] [PATCH] eal/ppc: fix redefine bool type X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" The AltiVec header file breaks boolean type. [1] [2] Currently the workaround was located only in mlx5 device. Adding the trace module caused this issue to appear again, due to order of includes, it keeps overriding the local fix. This patch solves this issue by resetting the bool type, immediately after it is being changed. [1] https://mails.dpdk.org/archives/dev/2018-August/110281.html [2] In file included from dpdk/ppc_64-power8-linux-gcc/include/rte_mempool_trace_fp.h:18:0, from dpdk/ppc_64-power8-linux-gcc/include/rte_mempool.h:54, from dpdk/drivers/common/mlx5/mlx5_common_mr.c:7: dpdk/ppc_64-power8-linux-gcc/include/rte_trace_point.h: In function '__rte_trace_point_fp_is_enabled': dpdk/ppc_64-power8-linux-gcc/include/rte_trace_point.h:226:2: error: incompatible types when returning type 'int' but '__vector __bool int' was expected return false; ^ In file included from dpdk/ppc_64-power8-linux-gcc/include/rte_trace_point.h:281:0, from dpdk/ppc_64-power8-linux-gcc/include/rte_mempool_trace_fp.h:18, from dpdk/ppc_64-power8-linux-gcc/include/rte_mempool.h:54, from dpdk/drivers/common/mlx5/mlx5_common_mr.c:7: dpdk/ppc_64-power8-linux-gcc/include/rte_mempool_trace_fp.h: In function 'rte_mempool_trace_ops_dequeue_bulk': dpdk/ppc_64-power8-linux-gcc/include/rte_trace_point_provider.h:104:6: error: wrong type argument to unary exclamation mark if (!__rte_trace_point_fp_is_enabled()) \ ^ dpdk/ppc_64-power8-linux-gcc/include/rte_trace_point.h:49:2: note: in expansion of macro '__rte_trace_point_emit_header_fp' __rte_trace_point_emit_header_##_mode(&__##_tp); \ ^ dpdk/ppc_64-power8-linux-gcc/include/rte_trace_point.h:99:2: note: in expansion of macro '__RTE_TRACE_POINT' __RTE_TRACE_POINT(fp, tp, args, __VA_ARGS__) ^ dpdk/ppc_64-power8-linux-gcc/include/rte_mempool_trace_fp.h:20:1: note: in expansion of macro 'RTE_TRACE_POINT_FP' RTE_TRACE_POINT_FP( ^ dpdk/ppc_64-power8-linux-gcc/include/rte_mempool_trace_fp.h: In function 'rte_mempool_trace_ops_dequeue_contig_blocks': dpdk/ppc_64-power8-linux-gcc/include/rte_trace_point_provider.h:104:6: error: wrong type argument to unary exclamation mark if (!__rte_trace_point_fp_is_enabled()) \ ^ dpdk/ppc_64-power8-linux-gcc/include/rte_trace_point.h:49:2: note: in expansion of macro '__rte_trace_point_emit_header_fp' __rte_trace_point_emit_header_##_mode(&__##_tp); \ ^ dpdk/ppc_64-power8-linux-gcc/include/rte_trace_point.h:99:2: note: in expansion of macro '__RTE_TRACE_POINT' __RTE_TRACE_POINT(fp, tp, args, __VA_ARGS__) ^ dpdk/ppc_64-power8-linux-gcc/include/rte_mempool_trace_fp.h:29:1: note: in expansion of macro 'RTE_TRACE_POINT_FP' RTE_TRACE_POINT_FP( ^ dpdk/ppc_64-power8-linux-gcc/include/rte_mempool_trace_fp.h: In function 'rte_mempool_trace_ops_enqueue_bulk': dpdk/ppc_64-power8-linux-gcc/include/rte_trace_point_provider.h:104:6: error: wrong type argument to unary exclamation mark if (!__rte_trace_point_fp_is_enabled()) \ Fixes: 725f5dd0bfb5 ("net/mlx5: fix build on PPC64") Signed-off-by: Ori Kam --- drivers/common/mlx5/mlx5_common.h | 10 ---------- drivers/net/mlx5/mlx5_utils.h | 10 ---------- lib/librte_eal/ppc/include/meson.build | 1 + lib/librte_eal/ppc/include/rte_altivec.h | 22 ++++++++++++++++++++++ lib/librte_eal/ppc/include/rte_memcpy.h | 3 +-- 5 files changed, 24 insertions(+), 22 deletions(-) create mode 100644 lib/librte_eal/ppc/include/rte_altivec.h diff --git a/drivers/common/mlx5/mlx5_common.h b/drivers/common/mlx5/mlx5_common.h index 16de1b3..c2d688a 100644 --- a/drivers/common/mlx5/mlx5_common.h +++ b/drivers/common/mlx5/mlx5_common.h @@ -17,16 +17,6 @@ #include "mlx5_prm.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 - /* Bit-field manipulation. */ #define BITFIELD_DECLARE(bf, type, size) \ type bf[(((size_t)(size) / (sizeof(type) * CHAR_BIT)) + \ diff --git a/drivers/net/mlx5/mlx5_utils.h b/drivers/net/mlx5/mlx5_utils.h index d81ace3..0e016f8 100644 --- a/drivers/net/mlx5/mlx5_utils.h +++ b/drivers/net/mlx5/mlx5_utils.h @@ -21,16 +21,6 @@ #include "mlx5_defs.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 - /* Convert a bit number to the corresponding 64-bit mask */ #define MLX5_BITSHIFT(v) (UINT64_C(1) << (v)) diff --git a/lib/librte_eal/ppc/include/meson.build b/lib/librte_eal/ppc/include/meson.build index 3a91c98..3ee38f6 100644 --- a/lib/librte_eal/ppc/include/meson.build +++ b/lib/librte_eal/ppc/include/meson.build @@ -4,6 +4,7 @@ includes += include_directories('.') arch_headers = files( + 'rte_altivec.h', 'rte_atomic.h', 'rte_byteorder.h', 'rte_cpuflags.h', diff --git a/lib/librte_eal/ppc/include/rte_altivec.h b/lib/librte_eal/ppc/include/rte_altivec.h new file mode 100644 index 0000000..1551a94 --- /dev/null +++ b/lib/librte_eal/ppc/include/rte_altivec.h @@ -0,0 +1,22 @@ +/* + * SPDX-License-Identifier: BSD-3-Clause + * Copyright (C) Mellanox 2020. + */ + +#ifndef _RTE_ALTIVEC_H_ +#define _RTE_ALTIVEC_H_ + +/* To include altivec.h, GCC version must be >= 4.8 */ +#include + +/* + * 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 + +#endif /* _RTE_ALTIVEC_H_ */ diff --git a/lib/librte_eal/ppc/include/rte_memcpy.h b/lib/librte_eal/ppc/include/rte_memcpy.h index 25311ba..d234e21 100644 --- a/lib/librte_eal/ppc/include/rte_memcpy.h +++ b/lib/librte_eal/ppc/include/rte_memcpy.h @@ -8,13 +8,12 @@ #include #include -/*To include altivec.h, GCC version must >= 4.8 */ -#include #ifdef __cplusplus extern "C" { #endif +#include "rte_altivec.h" #include "generic/rte_memcpy.h" static inline void -- 1.8.3.1