From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM01-BN3-obe.outbound.protection.outlook.com (mail-bn3nam01on0055.outbound.protection.outlook.com [104.47.33.55]) by dpdk.org (Postfix) with ESMTP id A187A2BAA for ; Tue, 28 Feb 2017 13:15:29 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=CAVIUMNETWORKS.onmicrosoft.com; s=selector1-cavium-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=mYYdLDcxwAlYL4ECQsmZunWy7Ixfjd9UZyL4eiC0fOs=; b=LONoHcIPfXt17mwYon+EzRL5IBpVboCMQIa89Y5IZtG4r1obtnkx5WB6DQYzMCWyCktsKHMF1MnnUUvDUhxbxQBTUms36wGnaal9qwOxSaeX1770y3P5b2jLwDCBb7Ygk2ej5ywZ5BJN1R5L071FPSt+0ckUNS4ARXcraJmAEVM= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Jerin.JacobKollanukkaran@cavium.com; Received: from localhost.localdomain (171.48.16.70) by BN3PR0701MB1717.namprd07.prod.outlook.com (10.163.39.16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.933.12; Tue, 28 Feb 2017 12:15:24 +0000 Date: Tue, 28 Feb 2017 17:45:13 +0530 From: Jerin Jacob To: Jasvinder Singh Cc: dev@dpdk.org, declan.doherty@intel.com Message-ID: <20170228121512.GB30817@localhost.localdomain> References: <1487969657-172541-2-git-send-email-jasvinder.singh@intel.com> <1488283701-186162-1-git-send-email-jasvinder.singh@intel.com> <1488283701-186162-2-git-send-email-jasvinder.singh@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1488283701-186162-2-git-send-email-jasvinder.singh@intel.com> User-Agent: Mutt/1.7.1 (2016-10-04) X-Originating-IP: [171.48.16.70] X-ClientProxiedBy: PN1PR01CA0091.INDPRD01.PROD.OUTLOOK.COM (10.174.144.159) To BN3PR0701MB1717.namprd07.prod.outlook.com (10.163.39.16) X-MS-Office365-Filtering-Correlation-Id: 88b75f7a-487b-4acf-b6f2-08d45fd37ab1 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(22001); SRVR:BN3PR0701MB1717; X-Microsoft-Exchange-Diagnostics: 1; BN3PR0701MB1717; 3:goqOzShz+gxMiaDmTErSPWlGN5iE6FvBGNBcUsPqj1Dw7hP9fscm7KfHlY5EoZbw6TR510q7bTYPjJg4pDXLnOAywYyd8Qq4i0TzotaFUi/HqRXEdam+oB+VDNTsfzOhP0/mFOQ/qX2DCbF4m6Q0PdX9V5Ot9ePhWFsZCptxmuF7q+XdhROPgHK+6M5gG0thmfgim1RGiTEVe6c+guP/YGgnJZB45pV4w94F32Xa9olzuvG7EdUqawqJ2vL0Ch+DiutPrYbu4dZe+PSaURhV0w==; 25:CfuNjRGsZj2qSBNOBAo9+BfuS2eWaQY5b/vOz2waykb7yYkFlvf/xVIXxemh/aMgOURew1xt2JiOm+Cfhy/usKuX3Lc44MLfWcytojA2IpOtUBB/ohwBBQwBoceFYvQ3x7YZ3RbYUHZn5qbv9hlpxVWi+0Dn70rDOtYWvRibJdCNCTvmGejikQEpQ+DGcp0FeTUHwuBaAh1tUqNh9s8V+ohU4/s71w73iVpaYPOWPc73hF3abj+4Y1QPfCKVlzTEjG/fLSzOfgFqh/yD42xvaN6kf8Y+XoYWwoanwuLPeT61BCfDGrcuFMGHwJlvQ7XBiX3cekTpZXDxL+Wd0lMjVOfHnYFpGHrTXeWVkIEW9Qr/2g1MgFkuvObN9EH1mxLo/hW/2BesKE8G42tmD97C7RgqLOeJAyNvjvWLhFIeMnjX8xw/vqikdEiqWyKugEidFA6kZ3RszSOKD+reCyvBmg== X-Microsoft-Exchange-Diagnostics: 1; BN3PR0701MB1717; 31:DucbPxuR78NTfjemkKUTVK4wmxO4L2BfJ10IgCTN+rFhYWOwiQlb+MM9efwK2AtbwIaRXmEb/fRxN7mN2noCwMcytJjPYDXycR8KCJP19+QEeXBM8EoWAar6LmB63m1W3CxqlDnk0mzRpa4VbA4vi+P7THcQ6Xx8o7LImyh4WpdPbQvnLY4XZOjcUGzaP7JaL/gd7dw4ggWQ5xRWeqiY9NbK70UM7d+1yN9YyGQhcbZ9PrOpdT/3dPhJVTJl2icQzUXk8+QLQDvLp08sjOic/5+LuRMq+ZvkdDGi0pOqUUs=; 20:J5PNcSFPiBfhlVXokmCX1KMBDUaYigJHoLzjg9RcGHR8BGqWISxf9h60uqr2oG9FM5Vk1J7VnnXgaxorIrfg+ktMvPFzw2LDdvUG9yjsiwEWUi8SCKTszrJr0PE7W9mDs5xyga1rFitjCtY+gLUsgGZVWkr7rjL7uwUh4TNDEWEs5WWdII9Xc+GXPn5T0iU3mu4PYUVh3n+ZrKFxzeDTQhe4uTKYDAEDcoqC5vXAREsMqrncukRxAe84RnGx1ZcyENbX78D+ZM0zI3K0oayPj1loXWghWu/uOAWZ0zWuxK3UgzNQQwpy7YNU11HrNJy2VV+ulqLIEjoTi1Wj7pL7XazGhYbRNT5t38gccj9DCTgZd5+uMBksrcObEQ6eVZtJm2LDOs0gwzqFFrpyRIcy7t7lvtzMmWnbW7APow+A/ie46hxT9hn9zS+t6ni8FKs3DJAef0zIwee5w2tD5+Zb0QCepVhVPR0thWUD5U722/VEqPteRd1/OhpADMTn+QXvZ5GbzKIhNtdy28mTnYLkL9YKL9kmDms+X0EWyfV7O50ww9Zy0mPhtbWuS4qrCKvRM7ZIwx402bkxD/ZQbuXfh2vNSVT4kUKli4riFEhzqQA= X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(228905959029699); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040375)(601004)(2401047)(8121501046)(5005006)(3002001)(10201501046)(6041248)(20161123558025)(20161123564025)(20161123562025)(20161123555025)(20161123560025)(6072148); SRVR:BN3PR0701MB1717; BCL:0; PCL:0; RULEID:; SRVR:BN3PR0701MB1717; X-Microsoft-Exchange-Diagnostics: 1; BN3PR0701MB1717; 4:kDxr9XuhqotOVpes6AZJ5Hs03aXHTsQAWzW2fX31EPqNvGU9Q2tI++DNreUq1kzisYFoumKvDc/0KUrMDNBLmLVXvpoq2OEpYNcCF5lkkM2L0Wgs0xXY9F0wvoiHgcLD6qUDF2QxLbILrS5vlRUxfjNeVMQYtTOublgm/aWGY6d2jtnBCIxTihl3Bl2+ZZOmJ5FavZcVOPgpskzOUAUDM4xlM6ubTJ8J2ETwRDDCWOm2BTBVZOuSSQT6CPW9Wvd+IFm1WVlVAbDDuiISPzfV4kEUXR65Uce6fr9c4bzuf4IKFFdSSqL0Zq93zva/o9oQqeUcQi5C3p921Hj9dRw0ZBJ7bMcqZYSG8n4918qRS2IfMMZHYmhs8GsQ+EjcThlA2j0zMCx+XDUywGPKluPUiEWccDgK8xKq7XUCihQOPR+ZT4oXPrJGWIvljPai3FhwnYxNFXLEhmZEi1b9enTDItpM+Wt1tFp/rD6gpyLyFFYx//HkFdkyDBhANNfcJKYroez0JdZWyxA6MWoVhyOm8O4Na3Hm9inpgQBtgJf/EVQZD34CT4pIX3y3lDfJwtQlfC5bXUOrGa/3qU2uCHk5hW6NsUINzRz0qsRLGAoBcm8/9e14aJOPz8wSFlGQlAtRobe++3NpbqKb8zA3Xrtm6Q== X-Forefront-PRVS: 0232B30BBC X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(4630300001)(6009001)(6069001)(7916002)(39450400003)(199003)(189002)(24454002)(83506001)(23726003)(1076002)(47776003)(3846002)(66066001)(6116002)(55016002)(50466002)(25786008)(4001350100001)(9686003)(6506006)(68736007)(2906002)(229853002)(101416001)(305945005)(53936002)(6246003)(106356001)(189998001)(105586002)(97736004)(38730400002)(42186005)(110136004)(7736002)(8676002)(50986999)(5660300001)(76176999)(81156014)(81166006)(6666003)(2950100002)(92566002)(6916009)(54356999)(61506002)(42882006)(33656002)(18370500001); DIR:OUT; SFP:1101; SCL:1; SRVR:BN3PR0701MB1717; H:localhost.localdomain; FPR:; SPF:None; PTR:InfoNoRecords; A:1; MX:1; LANG:en; Received-SPF: None (protection.outlook.com: cavium.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; BN3PR0701MB1717; 23:3sETJtgb7ZtEPqAz+JsA4tYbvV8gF9hpwHfacK7?= =?us-ascii?Q?TLDM5mC5fpSQMFl4tL6arQ5If0CU/Bm/x20GNuiTUDVkZHZG2R95z4i5Wz6u?= =?us-ascii?Q?iDB2dXcGvicqImsiSmuluiagXKfqyJ3d9jFdE9Mf8E4ryAgKwlg2E/aAMeql?= =?us-ascii?Q?LR1443YLrTCHuJp5zCOBV8hjWmx761DHgzaj0iNgl8q/TrDzcehi+riGAvcb?= =?us-ascii?Q?pXzM02n998+vUQe+RHnKsNasJc5Ux4dr0SGFCK83b8BI6c3BP6OmYafSscB8?= =?us-ascii?Q?qQMWlB4QCVMZSc0q068vRI/DxhbIUncKCp16cHFIHD44RgyCOYME5zduvN2m?= =?us-ascii?Q?oUrrKDDY417s+ZTQofsU6kAfBUQD06QBU2ponKvzUcEr19E132Ke24UhTzmw?= =?us-ascii?Q?fXqyBxvt8ipK2vGhMW4kutfVBPtEqG8lNskH9qzfFDj3+jlP6S8kq7PJN0D1?= =?us-ascii?Q?5fnLVVbOlL1TApWxqlhtBa/VRkqvhH20x/lLjhtQLBnds4qTI7bTVBiXw4+B?= =?us-ascii?Q?yd/IVdHCs7t0cR+djU/C8BBWhJmq+ygtMmCNlHc6ROMr4GAPNAMjH2r8L7f9?= =?us-ascii?Q?fcTuJL/hRq4B+GwqHe9accxbwlzvFA1QrYy14Z1ZfAt1lAsIJz9CsAkFsr0F?= =?us-ascii?Q?2EPtWNodYdZqwN7iR/H6525y1h1km3Ezeaucvb7rIP3HogJmBKWsET6x0pEi?= =?us-ascii?Q?c4aQk7vXx07e9zWqv1Q2bAbDSBjVMcm70+2AxGtNJOixWSSD1hEg8BKSqvyD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RpKUX1UGZuO1uXSWcyoYbCcy3KctoRxPakRIqaR8o9weVAyttpo5829Bzd6zgskamvyr0wXVMTlMypG64K+HtWt+19eoE+TDcvX9q66cU6l5VK1yIq3iIO3AZyd8X3t+YQaxjQxdw==; 24:QkZMOEJGpRcyjZKi/5Xg7RmNE94kEp6Fvn4IwlP9kmU9tKXLw+9v3u3LrU7WFnjrYqjVT1jY5CXP56t+NCS7ACn8r1SX2P8HQ518KeryeZ8= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; BN3PR0701MB1717; 7:VxNmTNBOa+Myc/LvdSrOUMdcHHNxmkKhFBWHyUqa+NIzQtriGQNp60/sgvkuPHaynw5kgfF0QJnC7Nn6fBBY/S5Io+GqZK8aZBElzmfsi2KYbfIAOJsplwUrMp9Xyef/OAyVQSLfJaU7CkepOyyKksqMOzfS3xKlIPPE4K+ivh6AXKuyo2stofifscsc5UU4ddukEudGg0PAJMc0vC61FtLScwbHslPcdtwSx+xZ+EXch1UyyrG3Z1kMCGyPtX0MepA9ogTqV5X7kDyD+csi+QId6jJ6BUSzyDOsWUdYOPgUypJynDQfla7p4NlfbbYpukCPZj9cPTdvtptd+LAPrA== X-OriginatorOrg: caviumnetworks.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 28 Feb 2017 12:15:24.6194 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN3PR0701MB1717 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: Tue, 28 Feb 2017 12:15:30 -0000 On Tue, Feb 28, 2017 at 12:08:20PM +0000, Jasvinder Singh wrote: > APIs for initialising and computing the crc (16-bit and 32-bit CRCs) > are added. For CRCs calculation, scalar as well as x86 intrinsic(sse4.2) > versions are implemented. > > The scalar version is based on generic Look-Up Table(LUT) algorithm, > while x86 intrinsic version uses carry-less multiplication for > fast CRC computation. > > Signed-off-by: Jasvinder Singh > --- > lib/librte_net/Makefile | 2 + > lib/librte_net/rte_net_crc.c | 664 +++++++++++++++++++++++++++++++++++++ > lib/librte_net/rte_net_crc.h | 101 ++++++ > lib/librte_net/rte_net_version.map | 8 + > 4 files changed, 775 insertions(+) > create mode 100644 lib/librte_net/rte_net_crc.c > create mode 100644 lib/librte_net/rte_net_crc.h > > diff --git a/lib/librte_net/Makefile b/lib/librte_net/Makefile > index 20cf664..41be751 100644 > --- a/lib/librte_net/Makefile > +++ b/lib/librte_net/Makefile > @@ -39,11 +39,13 @@ EXPORT_MAP := rte_net_version.map > LIBABIVER := 1 > > SRCS-$(CONFIG_RTE_LIBRTE_NET) := rte_net.c > +SRCS-$(CONFIG_RTE_LIBRTE_NET) += rte_net_crc.c > > # install includes > SYMLINK-$(CONFIG_RTE_LIBRTE_NET)-include := rte_ip.h rte_tcp.h rte_udp.h > SYMLINK-$(CONFIG_RTE_LIBRTE_NET)-include += rte_sctp.h rte_icmp.h rte_arp.h > SYMLINK-$(CONFIG_RTE_LIBRTE_NET)-include += rte_ether.h rte_gre.h rte_net.h > +SYMLINK-$(CONFIG_RTE_LIBRTE_NET)-include += rte_net_crc.h > > DEPDIRS-$(CONFIG_RTE_LIBRTE_NET) += lib/librte_eal lib/librte_mbuf > > diff --git a/lib/librte_net/rte_net_crc.c b/lib/librte_net/rte_net_crc.c > new file mode 100644 > index 0000000..78a49dd > --- /dev/null > +++ b/lib/librte_net/rte_net_crc.c > @@ -0,0 +1,664 @@ > +/*- > + * BSD LICENSE > + * > + * Copyright(c) 2017 Intel Corporation. > + * All rights reserved. > + * > + * Redistribution and use in source and binary forms, with or without > + * modification, are permitted provided that the following conditions > + * are met: > + * > + * * Redistributions of source code must retain the above copyright > + * notice, this list of conditions and the following disclaimer. > + * * Redistributions in binary form must reproduce the above copyright > + * notice, this list of conditions and the following disclaimer in > + * the documentation and/or other materials provided with the > + * distribution. > + * * Neither the name of Intel Corporation nor the names of its > + * contributors may be used to endorse or promote products derived > + * from this software without specific prior written permission. > + * > + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS > + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT > + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR > + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT > + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, > + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT > + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, > + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY > + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT > + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE > + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. > + */ > + > +#include > +#include > + > +/* Macros for printing using RTE_LOG */ > +#define RTE_LOGTYPE_CRC RTE_LOGTYPE_USER1 > + > +/** CRC polynomials */ > +#define CRC32_ETH_POLYNOMIAL 0x04c11db7UL > +#define CRC16_CCITT_POLYNOMIAL 0x1021U > + > +typedef int (*rte_net_crc_handler)(struct rte_net_crc_params *); > + > +static int rte_crc16_ccitt_handler(struct rte_net_crc_params *p); > +static int rte_crc32_eth_handler(struct rte_net_crc_params *p); > +static int rte_crc_invalid_handler(struct rte_net_crc_params *p); > + > +static rte_net_crc_handler *handlers; > + > +static rte_net_crc_handler handlers_scalar[] = { > + [RTE_NET_CRC16_CCITT] = rte_crc16_ccitt_handler, > + [RTE_NET_CRC32_ETH] = rte_crc32_eth_handler, > + [RTE_NET_CRC_REQS] = rte_crc_invalid_handler, > +}; > + > +int > +rte_crc_invalid_handler(__rte_unused struct rte_net_crc_params *p) > +{ > + RTE_LOG(ERR, CRC, "CRC type not supported!\n"); > + return -1; /* Error */ > +} > + > +#if defined RTE_ARCH_X86_64 && defined RTE_MACHINE_CPUFLAG_SSE4_2 Could you please abstract the vector function and move the SSE implementation to separate file for future clean neon and altivec integration. Reference: lib/librte_lpm/rte_lpm_sse.h