From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) by dpdk.org (Postfix) with ESMTP id C3F7A234 for ; Wed, 15 Mar 2017 20:03:40 +0100 (CET) Received: from orsmga003.jf.intel.com ([10.7.209.27]) by fmsmga105.fm.intel.com with ESMTP; 15 Mar 2017 12:03:39 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.36,170,1486454400"; d="scan'208";a="944702498" Received: from irsmsx110.ger.corp.intel.com ([163.33.3.25]) by orsmga003.jf.intel.com with ESMTP; 15 Mar 2017 12:03:38 -0700 Received: from irsmsx108.ger.corp.intel.com ([169.254.11.173]) by irsmsx110.ger.corp.intel.com ([169.254.15.101]) with mapi id 14.03.0248.002; Wed, 15 Mar 2017 19:03:37 +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/9RoZ5Kztp6GWOIxg Date: Wed, 15 Mar 2017 19:03:37 +0000 Message-ID: <3EB4FA525960D640B5BDFFD6A3D89126527609A4@IRSMSX108.ger.corp.intel.com> References: <1487969657-172541-2-git-send-email-jasvinder.singh@intel.com> <4909384.YypA4ZyVZF@xps13> <6450918.dWRLMxV3EZ@xps13> In-Reply-To: <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:03:41 -0000 ... > > > > > 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 ca= lculate > CRC, but not as a hash function. >=20 > 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. >=20 > I think you must separate hash functions and hash table management. >=20 The fact that CRC32 instruction is opportunistically used to compute a hash= 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 ins= truction should be placed in librte_hash. The purpose of the hash functions in librte_hash is to compute a digest/sig= nature for a given array of bytes (the key) as fast as possible. Any hash f= unction that produces a hash signature with good uniform distribution in a = small amount of cycles belongs here, including those opportunistically usin= g specialized CPU instructions such as CRC32 (or XOR, AESNI, etc). The code proposed in this patch is used to compute packet fields for variou= s protocols that have a CRC field, such as FCS of Ethernet frames, etc. acc= ording to the relevant standard (IEEE 802, others). It is an utility to be = used for implementing protocol-level functionality for various protocols fr= om the network stack, similar to e.g. IP or UDP checksum. If we were to add= an IP or UDCP checksum calculator, would you put it in librte_hash? The code from this patch is never going to be used to compute a fast signat= ure/digest. Typically this CRC is computed over the entire frame/packet rat= her than just selected fields from the packet representing the application-= specific flow key. Also note that the signature produced by CRC32 hash func= tion from librte_hash is actually not the correct Cyclic Redundancy Check o= f that array of bytes (or, for math guys, of the associated polynomial), it= is just a partial/intermediate value. Therefore, I suggest placing this code into: librte_ether (given that it ca= n be used to compute Ethernet FCS), or librte_net, or librte_crc. Definitel= y not in librte_hash. Regards, Cristian