[dpdk-dev] [PATCH 1/3 v2] librte_hash: Fix unsupported instruction `crc32' in i686 platform

Yerden Zhumabekov e_zhumabekov at sts.kz
Tue Mar 10 04:55:16 CET 2015



08.03.2015 0:39, Thomas Monjalon пишет:
> 2015-03-06 01:39, Qiu, Michael:
>> On 3/6/2015 1:11 AM, Thomas Monjalon wrote:
>>> 2015-03-06 00:55, Michael Qiu:
>>>> ... skipped ...
>>>>  
>>>> +#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.

That would be a bad surprise if one tries to launch that pre-built
binary on SSE4.2-capable arch :) It's fine though, if binary portability
is out of scope here.

-- 
Sincerely,

Yerden Zhumabekov
State Technical Service
Astana, KZ



More information about the dev mailing list