From: "Qiu, Michael" <michael.qiu@intel.com>
To: "Liu, Yong" <yong.liu@intel.com>,
"thomas.monjalon@6wind.com" <thomas.monjalon@6wind.com>,
"dev@dpdk.org" <dev@dpdk.org>
Cc: "yerden.zhumabekov@sts.kz" <yerden.zhumabekov@sts.kz>
Subject: Re: [dpdk-dev] [PATCH 1/3 v3] librte_hash: Fix unsupported instruction `crc32' in i686 platform
Date: Wed, 18 Mar 2015 14:59:27 +0000 [thread overview]
Message-ID: <533710CFB86FA344BFBF2D6802E60286D14D8D@SHSMSX101.ccr.corp.intel.com> (raw)
In-Reply-To: <86228AFD5BCD8E4EBFD2B90117B5E81E10DA603B@SHSMSX103.ccr.corp.intel.com>
Hi, Yong
If the platform is i686, dpdk will use software crc function.
Thanks,
Michael
-----Original Message-----
From: Liu, Yong
Sent: Wednesday, March 18, 2015 9:21 PM
To: Qiu, Michael; thomas.monjalon@6wind.com; dev@dpdk.org
Cc: yerden.zhumabekov@sts.kz
Subject: RE: [dpdk-dev] [PATCH 1/3 v3] librte_hash: Fix unsupported instruction `crc32' in i686 platform
Michael & Thomas,
Should we use software crc function replace of hardware crc function in 'crc32c_sse42_u64' when arch is i686?
Thus application still can use CRC32_SSE42_x64 algorithm for crc calculation when build with i686 configuration.
This may helpful for simplify application code.
> -----Original Message-----
> From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Michael Qiu
> Sent: Monday, March 09, 2015 1:58 PM
> To: dev@dpdk.org
> Cc: yerden.zhumabekov@sts.kz
> Subject: [dpdk-dev] [PATCH 1/3 v3] librte_hash: Fix unsupported
> instruction `crc32' in i686 platform
>
> 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 <michael.qiu@intel.com>
> Acked-by: Yerden Zhumabekov <yerden.zhumabekov@sts.kz>
> ---
> v3 --> v2:
> Add sub function for #else which returns 0
> v2 --> v1:
> Make crc32 instruction only works in X86 platform
>
> lib/librte_hash/rte_hash_crc.h | 46
> +++++++++++++++++++++++++++++++++----
> -----
> 1 file changed, 36 insertions(+), 10 deletions(-)
>
> diff --git a/lib/librte_hash/rte_hash_crc.h
> b/lib/librte_hash/rte_hash_crc.h index d28bb2a..f1dbded 100644
> --- a/lib/librte_hash/rte_hash_crc.h
> +++ b/lib/librte_hash/rte_hash_crc.h
> @@ -47,6 +47,7 @@ extern "C" {
> #include <stdint.h>
> #include <rte_cpuflags.h>
> #include <rte_branch_prediction.h>
> +#include <rte_common.h>
>
> /* Lookup tables for software implementation of CRC32C */ static
> const uint32_t crc32c_tables[8][256] = {{ @@ -364,6 +365,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) { @@ -375,16
> +377,6 @@ crc32c_sse42_u32(uint32_t data, uint32_t init_val) }
>
> static inline uint32_t
> -crc32c_sse42_u64(uint64_t data, uint64_t init_val) -{
> - __asm__ volatile(
> - "crc32q %[data], %[init_val];"
> - : [init_val] "+r" (init_val)
> - : [data] "rm" (data));
> - return init_val;
> -}
> -
> -static inline uint32_t
> crc32c_sse42_u64_mimic(uint64_t data, uint64_t init_val) {
> union {
> @@ -397,6 +389,40 @@ 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) {
> + __asm__ volatile(
> + "crc32q %[data], %[init_val];"
> + : [init_val] "+r" (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 crc32c_2words(data, init_val);
> + return 0;
> +}
> +#endif
>
> #define CRC32_SW (1U << 0)
> #define CRC32_SSE42 (1U << 1)
> --
> 1.9.3
next prev parent reply other threads:[~2015-03-18 15:03 UTC|newest]
Thread overview: 36+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-03-05 13:15 [dpdk-dev] [PATCH 0/3] dpdk2.0-rc1 build error fix Michael Qiu
2015-03-05 13:15 ` [dpdk-dev] [PATCH 1/3] librte_hash: Fix unsupported instruction `crc32' in i686 platform Michael Qiu
2015-03-05 16:10 ` Yerden Zhumabekov
2015-03-05 16:34 ` Qiu, Michael
2015-03-05 16:55 ` [dpdk-dev] [PATCH 1/3 v2] " Michael Qiu
2015-03-05 17:02 ` Yerden Zhumabekov
2015-03-05 17:10 ` Thomas Monjalon
2015-03-06 1:39 ` Qiu, Michael
2015-03-07 18:39 ` Thomas Monjalon
2015-03-10 3:55 ` Yerden Zhumabekov
2015-03-19 2:00 ` Qiu, Michael
2015-03-19 8:10 ` Thomas Monjalon
2015-03-09 5:58 ` [dpdk-dev] [PATCH 1/3 v3] " Michael Qiu
2015-03-18 13:20 ` Liu, Yong
2015-03-18 14:59 ` Qiu, Michael [this message]
2015-03-05 13:15 ` [dpdk-dev] [PATCH 2/3] app/test: Fix size_t printf formart issue Michael Qiu
2015-03-05 13:22 ` Bruce Richardson
2015-03-05 14:00 ` [dpdk-dev] [PATCH 2/3 v2] app/test: Fix size_t printf format issue Michael Qiu
2015-03-05 17:27 ` Thomas Monjalon
2015-03-06 1:42 ` Qiu, Michael
2015-03-06 3:53 ` [dpdk-dev] [PATCH 2/3 v3] " Michael Qiu
2015-03-05 13:15 ` [dpdk-dev] [PATCH 3/3] librte_eal/common: Fix redeclaration of enumerator ‘REG_EAX’ Michael Qiu
2015-03-05 13:23 ` Bruce Richardson
2015-03-05 13:36 ` David Marchand
2015-03-05 13:54 ` Qiu, Michael
2015-03-05 13:41 ` Qiu, Michael
2015-03-05 13:23 ` Qiu, Michael
2015-03-05 13:50 ` [dpdk-dev] [PATCH 3/3 v2] =?UTF-8?q?librte=5Feal/common:=20Fix=20redeclaration=20of?= =?UTF-8?q?=20enumerator=20=E2=80=98REG=5FEAX=E2=80=99?= Michael Qiu
2015-03-05 13:54 ` [dpdk-dev] [PATCH 3/3 v2] librte_eal/common: Fix redeclaration of enumerator ‘REG_EAX’ David Marchand
2015-03-05 14:03 ` Qiu, Michael
2015-03-05 14:38 ` Thomas Monjalon
2015-03-05 16:31 ` Qiu, Michael
2015-03-05 18:24 ` Thomas Monjalon
2015-03-05 13:57 ` [dpdk-dev] [PATCH 3/3 v3] =?UTF-8?q?librte=5Feal/common:=20Fix=20redeclaration=20of?= =?UTF-8?q?=20enumerator=20=E2=80=98REG=5FEAX=E2=80=99?= Michael Qiu
2015-03-06 6:28 ` [dpdk-dev] [PATCH 3/3 v3] librte_eal/common: Fix redeclaration of enumerator ‘REG_EAX’ David Marchand
2015-03-09 17:04 ` [dpdk-dev] [PATCH 0/3] dpdk2.0-rc1 build error fix Thomas Monjalon
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=533710CFB86FA344BFBF2D6802E60286D14D8D@SHSMSX101.ccr.corp.intel.com \
--to=michael.qiu@intel.com \
--cc=dev@dpdk.org \
--cc=thomas.monjalon@6wind.com \
--cc=yerden.zhumabekov@sts.kz \
--cc=yong.liu@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).