From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <thomas.monjalon@6wind.com>
Received: from mail-wi0-f171.google.com (mail-wi0-f171.google.com
 [209.85.212.171]) by dpdk.org (Postfix) with ESMTP id 932065A76
 for <dev@dpdk.org>; Sat,  7 Mar 2015 19:39:47 +0100 (CET)
Received: by wiwl15 with SMTP id l15so10760319wiw.4
 for <dev@dpdk.org>; Sat, 07 Mar 2015 10:39:47 -0800 (PST)
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20130820;
 h=x-gm-message-state:from:to:cc:subject:date:message-id:organization
 :user-agent:in-reply-to:references:mime-version
 :content-transfer-encoding:content-type;
 bh=uRE9HhRxdOCJwUrFS7lNYpOARKIBdzRCeOzQeNEf7A4=;
 b=LqYUd177+t5cRuGWfJsgvp2Xqcs3c1ISdsf3ak6DsJ6udYcH7JjsbJ0+6nCd155b0C
 lsCzEfL5RgKxp6WjO/FxCu5E5yCSQC39aLJNop/XF4ABZmJALGbKbLRQ7ns3LzYkPv0E
 KLfqkUdx2wFmtiwiW+kREaxZb1KnlS5JAvPqNwQo+65WeANcyi8xrqY2KcamYawJhhg+
 jxCAFoZ+sQJMLNpjZpO/tn9yEfWIqCUg85DG7jgm8+chAL1Q84ukFo99VSZnOU2IYTgl
 bjEdrYFcwMl3s0QUNFx9yMqkvym5tAyb1WfhTmG8HWO2baPVLPMJu2TuVUNn1jbk7bSW
 73Hg==
X-Gm-Message-State: ALoCoQmytjhfoovXs5bec/dvpl01YpFKIdno2YE0LOAVuk7lFtj/ZSgdOc1nhvTXjFXX3bkMn/Tm
X-Received: by 10.180.218.71 with SMTP id pe7mr72698266wic.70.1425753587385;
 Sat, 07 Mar 2015 10:39:47 -0800 (PST)
Received: from xps13.localnet (ABayonne-157-1-175-143.w109-222.abo.wanadoo.fr.
 [109.222.38.143])
 by mx.google.com with ESMTPSA id v8sm4827399wib.0.2015.03.07.10.39.44
 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);
 Sat, 07 Mar 2015 10:39:46 -0800 (PST)
From: Thomas Monjalon <thomas.monjalon@6wind.com>
To: "Qiu, Michael" <michael.qiu@intel.com>
Date: Sat, 07 Mar 2015 19:39:10 +0100
Message-ID: <9442704.dXlXz1iyK3@xps13>
Organization: 6WIND
User-Agent: KMail/4.14.4 (Linux/3.18.4-1-ARCH; KDE/4.14.4; x86_64; ; )
In-Reply-To: <533710CFB86FA344BFBF2D6802E60286CEF549@SHSMSX101.ccr.corp.intel.com>
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-Transfer-Encoding: 7Bit
Content-Type: text/plain; charset="us-ascii"
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 <dev.dpdk.org>
List-Unsubscribe: <http://dpdk.org/ml/options/dev>,
 <mailto:dev-request@dpdk.org?subject=unsubscribe>
List-Archive: <http://dpdk.org/ml/archives/dev/>
List-Post: <mailto:dev@dpdk.org>
List-Help: <mailto:dev-request@dpdk.org?subject=help>
List-Subscribe: <http://dpdk.org/ml/listinfo/dev>,
 <mailto:dev-request@dpdk.org?subject=subscribe>
X-List-Received-Date: Sat, 07 Mar 2015 18:39:47 -0000

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 <michael.qiu@intel.com>
> >> ---
> >> 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.