From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from e28smtp07.in.ibm.com (e28smtp07.in.ibm.com [122.248.162.7]) by dpdk.org (Postfix) with ESMTP id A9DC3C3DC for ; Mon, 3 Aug 2015 13:32:57 +0200 (CEST) Received: from /spool/local by e28smtp07.in.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Mon, 3 Aug 2015 17:02:56 +0530 Received: from d28dlp02.in.ibm.com (9.184.220.127) by e28smtp07.in.ibm.com (192.168.1.137) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Mon, 3 Aug 2015 17:02:52 +0530 X-Helo: d28dlp02.in.ibm.com X-MailFrom: chaozhu@linux.vnet.ibm.com X-RcptTo: dev@dpdk.org Received: from d28relay03.in.ibm.com (d28relay03.in.ibm.com [9.184.220.60]) by d28dlp02.in.ibm.com (Postfix) with ESMTP id CA73B3940060 for ; Mon, 3 Aug 2015 17:02:51 +0530 (IST) Received: from d28av02.in.ibm.com (d28av02.in.ibm.com [9.184.220.64]) by d28relay03.in.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id t73BWpUC35979270 for ; Mon, 3 Aug 2015 17:02:51 +0530 Received: from d28av02.in.ibm.com (localhost [127.0.0.1]) by d28av02.in.ibm.com (8.14.4/8.14.4/NCO v10.0 AVout) with ESMTP id t73BWoHP022740 for ; Mon, 3 Aug 2015 17:02:50 +0530 Received: from [9.186.50.80] ([9.186.50.80]) by d28av02.in.ibm.com (8.14.4/8.14.4/NCO v10.0 AVin) with ESMTP id t73BWnrR022667; Mon, 3 Aug 2015 17:02:49 +0530 Message-ID: <55BF5161.3000904@linux.vnet.ibm.com> Date: Mon, 03 Aug 2015 19:32:49 +0800 From: Chao Zhu User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:31.0) Gecko/20100101 Thunderbird/31.7.0 MIME-Version: 1.0 To: Thomas Monjalon References: <1438583517-19035-1-git-send-email-chaozhu@linux.vnet.ibm.com> <1438583517-19035-2-git-send-email-chaozhu@linux.vnet.ibm.com> <1533915.C0IUmFEqd8@xps13> In-Reply-To: <1533915.C0IUmFEqd8@xps13> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit X-TM-AS-MML: disable X-Content-Scanned: Fidelis XPS MAILER x-cbid: 15080311-0025-0000-0000-00000631CC4D Cc: dev@dpdk.org Subject: Re: [dpdk-dev] [PATCH] fm10k: fix the compilation on big endian platforms X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 03 Aug 2015 11:32:58 -0000 On 2015/8/3 17:06, Thomas Monjalon wrote: > 2015-08-03 14:31, Chao Zhu: >> The rte_cpu_to_le_32 function can't be used to define const variables >> because it has different implementation on big endian platforms. If >> doing so, it will cause 'initializer element is not constant' compiling >> error. This patch fixes this problem. >> --- a/drivers/net/fm10k/base/fm10k_tlv.c >> +++ b/drivers/net/fm10k/base/fm10k_tlv.c > You cannot change a base driver file except the osdep header where > FM10K_CPU_TO_LE32 is defined. > > I don't understand why it doesn't give you a constant, given this definition: > > #define rte_bswap32(x) ((uint32_t)(__builtin_constant_p(x) ? \ > rte_constant_bswap32(x) : \ > rte_arch_bswap32(x))) > > Have you tried CONFIG_RTE_FORCE_INTRINSICS=y ? > It should trigger this definition: > > #define rte_bswap32(x) __builtin_bswap32(x) Yes. CONFIG_RTE_FORCE_INTRINSICS=y works on Power Big endian. But if I turn off this, the error happens. Seems rte_constant_bswap32 doesn't work on Power8? I'll try to check it. > >> -STATIC const __le32 test_le[2] = { FM10K_CPU_TO_LE32(0x12345678), >> - FM10K_CPU_TO_LE32(0x9abcdef0)}; >> +#if RTE_BYTE_ORDER == RTE_BIG_ENDIAN >> +STATIC const __le32 test_le[2] = {0x78563412,0xf0debc9a}; >> +#else >> +STATIC const __le32 test_le[2] = {0x12345678,0x9abcdef0}; >> +#endif