From mboxrd@z Thu Jan 1 00:00:00 1970 From: Thomas Monjalon Subject: Re: [PATCH 1/3 v2] librte_hash: Fix unsupported instruction `crc32' in i686 platform Date: Sat, 07 Mar 2015 19:39:10 +0100 Message-ID: <9442704.dXlXz1iyK3@xps13> References: <1425561339-13300-2-git-send-email-michael.qiu@intel.com> <9902699.YtPW44peIi@xps13> <533710CFB86FA344BFBF2D6802E60286CEF549@SHSMSX101.ccr.corp.intel.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7Bit Cc: dev-VfR2kkLFssw@public.gmane.org To: "Qiu, Michael" Return-path: In-Reply-To: <533710CFB86FA344BFBF2D6802E60286CEF549-0J0gbvR4kThpB2pF5aRoyrfspsVTdybXVpNB7YpNyf8@public.gmane.org> List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces-VfR2kkLFssw@public.gmane.org Sender: "dev" 2015-03-06 01:39, Qiu, Michael: > On 3/6/2015 1:11 AM, Thomas Monjalon wrote: > > 2015-03-06 00:55, Michael Qiu: > >> CC rte_hash.o > >> Error: unsupported instruction `crc32' > >> > >> The root cause is that i686 platform does not support 'crc32q' > >> Need make it only available in x86_64 platform > >> > >> Signed-off-by: Michael Qiu > >> --- > >> v2 --> v1: > >> Make crc32 instruction only works in X86 platform > >> lib/librte_hash/rte_hash_crc.h | 12 ++++++++++++ > >> 1 file changed, 12 insertions(+) > >> > >> diff --git a/lib/librte_hash/rte_hash_crc.h b/lib/librte_hash/rte_hash_crc.h > >> index d28bb2a..c0a789e 100644 > >> --- a/lib/librte_hash/rte_hash_crc.h > >> +++ b/lib/librte_hash/rte_hash_crc.h > >> @@ -364,6 +364,7 @@ crc32c_2words(uint64_t data, uint32_t init_val) > >> return crc; > >> } > >> > >> +#if defined RTE_ARCH_I686 || defined RTE_ARCH_X86_64 > >> static inline uint32_t > >> crc32c_sse42_u32(uint32_t data, uint32_t init_val) > >> { > >> @@ -373,7 +374,9 @@ crc32c_sse42_u32(uint32_t data, uint32_t init_val) > >> : [data] "rm" (data)); > >> return init_val; > >> } > >> +#endif > > > > Wouldn't it be more elegant to define a stub which returns 0 in #else > > in order to remove #ifdef below? > > Not sure, matter of taste. > > It may be not a good idea, see rte_hash_crc_8byte(), if no crc32 > support, it will use crc32c_2words(), if we define a stub which returns > 0 in #else, then we need always check the return value whether it is > none-zero otherwise need fallback. I don't think so. The stub won't never been called because they are protected by the cpuflag condition.