From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga07.intel.com (mga07.intel.com [134.134.136.100]) by dpdk.org (Postfix) with ESMTP id 92FA61396 for ; Wed, 15 Mar 2017 20:09:29 +0100 (CET) Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by orsmga105.jf.intel.com with ESMTP; 15 Mar 2017 12:09:28 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.36,170,1486454400"; d="scan'208";a="236565449" Received: from irsmsx109.ger.corp.intel.com ([163.33.3.23]) by fmsmga004.fm.intel.com with ESMTP; 15 Mar 2017 12:09:27 -0700 Received: from irsmsx108.ger.corp.intel.com ([169.254.11.173]) by IRSMSX109.ger.corp.intel.com ([169.254.13.44]) with mapi id 14.03.0248.002; Wed, 15 Mar 2017 19:09:26 +0000 From: "Dumitrescu, Cristian" To: Thomas Monjalon , "De Lara Guarch, Pablo" CC: "Singh, Jasvinder" , "dev@dpdk.org" , "Doherty, Declan" Thread-Topic: [dpdk-dev] [PATCH v2 1/2] librte_net: add crc init and compute APIs Thread-Index: AQHSnbK6hplM9lSNNEq/9RoZ5Kztp6GWOIxggAAKmvA= Date: Wed, 15 Mar 2017 19:09:25 +0000 Message-ID: <3EB4FA525960D640B5BDFFD6A3D89126527609CA@IRSMSX108.ger.corp.intel.com> References: <1487969657-172541-2-git-send-email-jasvinder.singh@intel.com> <4909384.YypA4ZyVZF@xps13> <6450918.dWRLMxV3EZ@xps13> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiNDk2MjgyMTAtMGFkZS00ZDg2LThlMjgtOGQyNzNiNjc2MzM2IiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX0lDIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE2LjUuOS4zIiwiVHJ1c3RlZExhYmVsSGFzaCI6IlRcL29PWGhXN0wzd3JqZW04SEJzZXY2eUdqXC93QmxCSzlOSmx4UkJraUtJaz0ifQ== x-ctpclassification: CTP_IC x-originating-ip: [163.33.239.180] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Subject: Re: [dpdk-dev] [PATCH v2 1/2] librte_net: add crc init and compute APIs X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 15 Mar 2017 19:09:30 -0000 > -----Original Message----- > From: Dumitrescu, Cristian > Sent: Wednesday, March 15, 2017 7:04 PM > To: 'Thomas Monjalon' ; De Lara Guarch, > Pablo > Cc: Singh, Jasvinder ; dev@dpdk.org; Doherty, > Declan > Subject: RE: [dpdk-dev] [PATCH v2 1/2] librte_net: add crc init and compu= te > APIs >=20 > ... >=20 > > > > > > I think it should be in librte_hash. > > > > > > > > > > > > Please check lib/librte_hash/rte_hash_crc.h > > > > > > > > > > Is it good to include payload crc calculation in hash library as = I see all > > hash > > > > related functionality there? > > > > > > > > I think yes. Pablo? > > > > > > I think this doesn't belong in the hash library. These new functions > calculate > > CRC, but not as a hash function. > > > > Can't we say that a CRC is a hash? What is a hash? > > A function generating the same output bytes from given input bytes. > > > > I think you must separate hash functions and hash table management. > > >=20 > The fact that CRC32 instruction is opportunistically used to compute a ha= sh > digest/signature for load balancing (affinity-based) or hash tables (flow > tables, ARP cache, etc) does not mean that all the code that uses CRC32 > instruction should be placed in librte_hash. >=20 > The purpose of the hash functions in librte_hash is to compute a > digest/signature for a given array of bytes (the key) as fast as possible= . Any > hash function that produces a hash signature with good uniform distributi= on > in a small amount of cycles belongs here, including those opportunistical= ly > using specialized CPU instructions such as CRC32 (or XOR, AESNI, etc). >=20 > The code proposed in this patch is used to compute packet fields for vari= ous > protocols that have a CRC field, such as FCS of Ethernet frames, etc. > according to the relevant standard (IEEE 802, others). It is an utility t= o be used > for implementing protocol-level functionality for various protocols from = the > network stack, similar to e.g. IP or UDP checksum. If we were to add an I= P or > UDCP checksum calculator, would you put it in librte_hash? >=20 > The code from this patch is never going to be used to compute a fast > signature/digest. Typically this CRC is computed over the entire frame/pa= cket > rather than just selected fields from the packet representing the applica= tion- > specific flow key. Also note that the signature produced by CRC32 hash > function from librte_hash is actually not the correct Cyclic Redundancy C= heck > of that array of bytes (or, for math guys, of the associated polynomial),= it is > just a partial/intermediate value. >=20 > Therefore, I suggest placing this code into: librte_ether (given that it = can be > used to compute Ethernet FCS), or librte_net, or librte_crc. Definitely n= ot in > librte_hash. >=20 Sorry, my bad on librte_ether: the rte_ether.h where Ethernet frame is defi= ned is located in librte_net, not librte_ether, so librte_ether should not = be on the above list. Therefore, my suggestion is: librte_net or a new libr= ary librte_crc. > Regards, > Cristian