From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wi0-f170.google.com (mail-wi0-f170.google.com [209.85.212.170]) by dpdk.org (Postfix) with ESMTP id 2D4EC255 for ; Mon, 3 Aug 2015 11:08:03 +0200 (CEST) Received: by wibud3 with SMTP id ud3so127109541wib.1 for ; Mon, 03 Aug 2015 02:08:03 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:organization :user-agent:in-reply-to:references:mime-version :content-transfer-encoding:content-type; bh=p1nijFfbfD+Lpo6u7GEy/R46cknsgSqDRI1pNRTwrec=; b=QfC0P607faWXIiGjtxZqJ8C0ynfQp0ZDQQy8Vr1nifzvhrEHFBscEvxE5WhqwY8AIY 1/rZXfclnsuszLDMB7w/5WpDOpZEq06iu7lbAM7elxTmWTKAxiNsdnKSO9EyAwLN3/AR V6Sldv9VgdAv7gUoNO+o3nCVcPdnzJvTHx0ShQi4XU9kXq76d+QbV51rEp05Qw45MP5W OMXBKeypgPLPFVcvGJhOS4Q5FnmDWGF0n/t0EqKhR9gq4IJn0gsyJoVbhWYw8H622OTp GYfcWpYqOR7QojBRumq1sbdMjiyIDenGopisL6cS7BSW+yUMmpD96e3sTlGzXHsziwLp gciA== X-Gm-Message-State: ALoCoQnj0MhvuyY/yrFvi2BG8TExv/LLu4hcFs+h7oUNJxEBfuMQMhKz8o0KSXTJkzcyk169ReKQ X-Received: by 10.194.79.225 with SMTP id m1mr31823426wjx.8.1438592883048; Mon, 03 Aug 2015 02:08:03 -0700 (PDT) Received: from xps13.localnet (136-92-190-109.dsl.ovh.fr. [109.190.92.136]) by smtp.gmail.com with ESMTPSA id pn6sm21801337wjb.36.2015.08.03.02.08.02 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 03 Aug 2015 02:08:02 -0700 (PDT) From: Thomas Monjalon To: Chao Zhu Date: Mon, 03 Aug 2015 11:06:49 +0200 Message-ID: <1533915.C0IUmFEqd8@xps13> Organization: 6WIND User-Agent: KMail/4.14.8 (Linux/4.0.4-2-ARCH; KDE/4.14.8; x86_64; ; ) In-Reply-To: <1438583517-19035-2-git-send-email-chaozhu@linux.vnet.ibm.com> References: <1438583517-19035-1-git-send-email-chaozhu@linux.vnet.ibm.com> <1438583517-19035-2-git-send-email-chaozhu@linux.vnet.ibm.com> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" 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 09:08:03 -0000 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) > -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