From mboxrd@z Thu Jan 1 00:00:00 1970 From: Tony Lu Subject: Re: [PATCH] fm10k: fix the compilation on big endian platforms Date: Tue, 4 Aug 2015 08:50:05 +0800 Message-ID: <000101d0ce4f$8abc5140$a034f3c0$@com> References: <1438583517-19035-1-git-send-email-chaozhu@linux.vnet.ibm.com> <1533915.C0IUmFEqd8@xps13> <55BF5161.3000904@linux.vnet.ibm.com> <16563190.8TBxXSHCrU@xps13> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Cc: dev@dpdk.org To: 'Thomas Monjalon' , 'Chao Zhu' Return-path: Received: from emea01-am1-obe.outbound.protection.outlook.com (mail-am1on0053.outbound.protection.outlook.com [157.56.112.53]) by dpdk.org (Postfix) with ESMTP id 41372C394 for ; Tue, 4 Aug 2015 02:50:19 +0200 (CEST) In-Reply-To: <16563190.8TBxXSHCrU@xps13> Content-Language: zh-cn List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" >-----Original Message----- >From: Thomas Monjalon [mailto:thomas.monjalon@6wind.com] >Sent: Monday, August 03, 2015 7:39 PM >To: Chao Zhu >Cc: dev@dpdk.org; Zhigang Lu >Subject: Re: [dpdk-dev] [PATCH] fm10k: fix the compilation on big endian >platforms > >2015-08-03 19:32, Chao Zhu: >> 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. > >The tile arch force intrinsics: > http://dpdk.org/browse/dpdk/tree/config/defconfig_tile-tilegx-linuxapp-gcc >#n39 > http://dpdk.org/browse/dpdk/tree/lib/librte_eal/common/include/arch/tile >/rte_byteorder.h#n36 >I don't know wether it was for the same reason. Not really, the reason Tile arch force intrinsics is to reuse some generic functions in lib/librte_eal/common/include/generic/, such as rte_atomic16_cmpset() rte_atomic16_inc() rte_spinlock_lock() .... Thanks -Zhigang