DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH] librte_hash: Fix crc32 error when complie i686 in x86_64
@ 2015-03-23  8:43 Michael Qiu
  2015-03-23 10:58 ` Thomas Monjalon
  0 siblings, 1 reply; 2+ messages in thread
From: Michael Qiu @ 2015-03-23  8:43 UTC (permalink / raw)
  To: dev

When compile target i686 in platform x86_64, the stud fuction will
be called, and return zero.

This patch fix this issue.

Signed-off-by: Michael Qiu <michael.qiu@intel.com>
---
 lib/librte_hash/rte_hash_crc.h | 35 ++++++-----------------------------
 1 file changed, 6 insertions(+), 29 deletions(-)

diff --git a/lib/librte_hash/rte_hash_crc.h b/lib/librte_hash/rte_hash_crc.h
index 3dcd362..1cd626c 100644
--- a/lib/librte_hash/rte_hash_crc.h
+++ b/lib/librte_hash/rte_hash_crc.h
@@ -366,7 +366,6 @@ crc32c_2words(uint64_t data, uint32_t init_val)
 }
 
 #if defined(RTE_ARCH_I686) || defined(RTE_ARCH_X86_64)
-
 static inline uint32_t
 crc32c_sse42_u32(uint32_t data, uint32_t init_val)
 {
@@ -390,27 +389,9 @@ crc32c_sse42_u64_mimic(uint64_t data, uint64_t init_val)
 	init_val = crc32c_sse42_u32(d.u32[1], init_val);
 	return init_val;
 }
-
-#else
-
-static inline uint32_t
-crc32c_sse42_u32(__rte_unused uint32_t data,
-                 __rte_unused uint32_t init_val)
-{
-	return 0;
-}
-
-static inline uint32_t
-crc32c_sse42_u64_mimic(__rte_unused uint32_t data,
-                       __rte_unused uint32_t init_val)
-{
-	return 0;
-}
-
 #endif
 
 #ifdef RTE_ARCH_X86_64
-
 static inline uint32_t
 crc32c_sse42_u64(uint64_t data, uint64_t init_val)
 {
@@ -420,16 +401,6 @@ crc32c_sse42_u64(uint64_t data, uint64_t init_val)
 			: [data] "rm" (data));
 	return init_val;
 }
-
-#else
-
-static inline uint32_t
-crc32c_sse42_u64(__rte_unused uint64_t data,
-                 __rte_unused uint64_t init_val)
-{
-	return 0;
-}
-
 #endif
 
 #define CRC32_SW            (1U << 0)
@@ -489,8 +460,10 @@ rte_hash_crc_init_alg(void)
 static inline uint32_t
 rte_hash_crc_4byte(uint32_t data, uint32_t init_val)
 {
+#if defined RTE_ARCH_I686 || defined RTE_ARCH_X86_64
 	if (likely(crc32_alg & CRC32_SSE42))
 		return crc32c_sse42_u32(data, init_val);
+#endif
 
 	return crc32c_1word(data, init_val);
 }
@@ -510,11 +483,15 @@ rte_hash_crc_4byte(uint32_t data, uint32_t init_val)
 static inline uint32_t
 rte_hash_crc_8byte(uint64_t data, uint32_t init_val)
 {
+#ifdef RTE_ARCH_X86_64
 	if (likely(crc32_alg == CRC32_SSE42_x64))
 		return crc32c_sse42_u64(data, init_val);
+#endif
 
+#if defined RTE_ARCH_I686 || defined RTE_ARCH_X86_64
 	if (likely(crc32_alg & CRC32_SSE42))
 		return crc32c_sse42_u64_mimic(data, init_val);
+#endif
 
 	return crc32c_2words(data, init_val);
 }
-- 
1.9.3

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [dpdk-dev] [PATCH] librte_hash: Fix crc32 error when complie i686 in x86_64
  2015-03-23  8:43 [dpdk-dev] [PATCH] librte_hash: Fix crc32 error when complie i686 in x86_64 Michael Qiu
@ 2015-03-23 10:58 ` Thomas Monjalon
  0 siblings, 0 replies; 2+ messages in thread
From: Thomas Monjalon @ 2015-03-23 10:58 UTC (permalink / raw)
  To: Michael Qiu; +Cc: dev

2015-03-23 16:43, Michael Qiu:
> When compile target i686 in platform x86_64, the stud fuction will
> be called, and return zero.
> 
> This patch fix this issue.
> 
> Signed-off-by: Michael Qiu <michael.qiu@intel.com>

Acked-by: Thomas Monjalon <thomas.monjalon@6wind.com>

Applied, thanks

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2015-03-23 10:59 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-03-23  8:43 [dpdk-dev] [PATCH] librte_hash: Fix crc32 error when complie i686 in x86_64 Michael Qiu
2015-03-23 10:58 ` Thomas Monjalon

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).