From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by dpdk.org (Postfix) with ESMTP id 3721F5A4B for ; Fri, 6 Mar 2015 02:40:38 +0100 (CET) Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by orsmga102.jf.intel.com with ESMTP; 05 Mar 2015 17:39:06 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.11,350,1422950400"; d="scan'208";a="687709188" Received: from pgsmsx104.gar.corp.intel.com ([10.221.44.91]) by fmsmga002.fm.intel.com with ESMTP; 05 Mar 2015 17:40:35 -0800 Received: from shsmsx104.ccr.corp.intel.com (10.239.4.70) by PGSMSX104.gar.corp.intel.com (10.221.44.91) with Microsoft SMTP Server (TLS) id 14.3.195.1; Fri, 6 Mar 2015 09:39:53 +0800 Received: from shsmsx101.ccr.corp.intel.com ([169.254.1.192]) by SHSMSX104.ccr.corp.intel.com ([169.254.5.161]) with mapi id 14.03.0195.001; Fri, 6 Mar 2015 09:39:52 +0800 From: "Qiu, Michael" To: Thomas Monjalon Thread-Topic: [dpdk-dev] [PATCH 1/3 v2] librte_hash: Fix unsupported instruction `crc32' in i686 platform Thread-Index: AQHQV2U5FnYjrJBY6UetCuCVTidWCg== Date: Fri, 6 Mar 2015 01:39:52 +0000 Message-ID: <533710CFB86FA344BFBF2D6802E60286CEF549@SHSMSX101.ccr.corp.intel.com> References: <1425561339-13300-2-git-send-email-michael.qiu@intel.com> <1425574530-16019-1-git-send-email-michael.qiu@intel.com> <9902699.YtPW44peIi@xps13> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.239.127.40] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Cc: "dev@dpdk.org" Subject: Re: [dpdk-dev] [PATCH 1/3 v2] librte_hash: Fix unsupported instruction `crc32' in i686 platform 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: Fri, 06 Mar 2015 01:40:39 -0000 On 3/6/2015 1:11 AM, Thomas Monjalon wrote:=0A= > 2015-03-06 00:55, Michael Qiu:=0A= >> CC rte_hash.o=0A= >> Error: unsupported instruction `crc32'=0A= >>=0A= >> The root cause is that i686 platform does not support 'crc32q'=0A= >> Need make it only available in x86_64 platform=0A= >>=0A= >> Signed-off-by: Michael Qiu =0A= >> ---=0A= >> v2 --> v1:=0A= >> Make crc32 instruction only works in X86 platform=0A= >> lib/librte_hash/rte_hash_crc.h | 12 ++++++++++++=0A= >> 1 file changed, 12 insertions(+)=0A= >>=0A= >> diff --git a/lib/librte_hash/rte_hash_crc.h b/lib/librte_hash/rte_hash_c= rc.h=0A= >> index d28bb2a..c0a789e 100644=0A= >> --- a/lib/librte_hash/rte_hash_crc.h=0A= >> +++ b/lib/librte_hash/rte_hash_crc.h=0A= >> @@ -364,6 +364,7 @@ crc32c_2words(uint64_t data, uint32_t init_val)=0A= >> return crc;=0A= >> }=0A= >> =0A= >> +#if defined RTE_ARCH_I686 || defined RTE_ARCH_X86_64=0A= >> static inline uint32_t=0A= >> crc32c_sse42_u32(uint32_t data, uint32_t init_val)=0A= >> {=0A= >> @@ -373,7 +374,9 @@ crc32c_sse42_u32(uint32_t data, uint32_t init_val)= =0A= >> : [data] "rm" (data));=0A= >> return init_val;=0A= >> }=0A= >> +#endif=0A= > Wouldn't it be more elegant to define a stub which returns 0 in #else=0A= > in order to remove #ifdef below?=0A= > Not sure, matter of taste.=0A= =0A= It may be not a good idea, see rte_hash_crc_8byte(), if no crc32=0A= support, it will use crc32c_2words(), if we define a stub which returns=0A= 0 in #else, then we need always check the return value whether it is=0A= none-zero otherwise need fallback.=0A= =0A= Thanks,=0A= Michael=0A= > [...]=0A= >> @@ -455,8 +461,10 @@ rte_hash_crc_init_alg(void)=0A= >> static inline uint32_t=0A= >> rte_hash_crc_4byte(uint32_t data, uint32_t init_val)=0A= >> {=0A= >> +#if defined RTE_ARCH_I686 || defined RTE_ARCH_X86_64=0A= >> if (likely(crc32_alg & CRC32_SSE42))=0A= >> return crc32c_sse42_u32(data, init_val);=0A= >> +#endif=0A= >> =0A= >> return crc32c_1word(data, init_val);=0A= >> }=0A= >> @@ -476,11 +484,15 @@ rte_hash_crc_4byte(uint32_t data, uint32_t init_va= l)=0A= >> static inline uint32_t=0A= >> rte_hash_crc_8byte(uint64_t data, uint32_t init_val)=0A= >> {=0A= >> +#ifdef RTE_ARCH_X86_64=0A= >> if (likely(crc32_alg =3D=3D CRC32_SSE42_x64))=0A= >> return crc32c_sse42_u64(data, init_val);=0A= >> +#endif=0A= >> =0A= >> +#if defined RTE_ARCH_I686 || defined RTE_ARCH_X86_64=0A= >> if (likely(crc32_alg & CRC32_SSE42))=0A= >> return crc32c_sse42_u64_mimic(data, init_val);=0A= >> +#endif=0A= >> =0A= >> return crc32c_2words(data, init_val);=0A= >> }=0A= >>=0A= >=0A= >=0A= =0A=