From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by dpdk.org (Postfix) with ESMTP id 8043A2B88 for ; Fri, 24 Feb 2017 21:44:20 +0100 (CET) Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by orsmga102.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 24 Feb 2017 12:44:18 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.35,201,1484035200"; d="scan'208";a="229417625" Received: from silpixa00381635.ir.intel.com (HELO silpixa00381635.ger.corp.intel.com) ([10.237.222.149]) by fmsmga004.fm.intel.com with ESMTP; 24 Feb 2017 12:44:17 -0800 From: Jasvinder Singh To: dev@dpdk.org Cc: declan.doherty@intel.com Date: Fri, 24 Feb 2017 20:54:15 +0000 Message-Id: <1487969657-172541-1-git-send-email-jasvinder.singh@intel.com> X-Mailer: git-send-email 2.5.5 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Subject: [dpdk-dev] [PATCH 0/2] librte_net: add crc computation support 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: Fri, 24 Feb 2017 20:44:20 -0000 In some applications, CRC (Cyclic Redundancy Check) needs to be computed or updated during packet processing operations. This patchset adds software implementation of some common standard CRCs (32-bit Ethernet CRC as per Ethernet/[ISO/IEC 8802-3] and 16-bit CCITT-CRC [ITU-T X.25]). Two versions of each 32-bit and 16-bit CRC calculation are proposed. The first version presents a fast and efficient CRC generation on IA processors by using the carry-less multiplication instruction – PCLMULQDQ (i.e SSE4.2 instrinsics). In this implementation, a parallelized folding approach has been used to first reduce an arbitrary length buffer to a small fixed size length buffer (16 bytes) with the help of precomputed constants. The resultant single 16-bytes chunk is further reduced by Barrett reduction method to generate final CRC value. For more details on the implementation, see reference [1]. The second version presents the fallback solution to support the CRC generation without needing any specific support from CPU (for examples- SSE4.2 intrinsics). It is based on generic Look-Up Table(LUT) algorithm that uses precomputed 256 element table as explained in reference[2]. Following APIs have been added; (i) rte_net_crc_init() (ii)rte_net_crc_calc() The first API (i) initalises the data structures required for CRC computation and this api should be used only once in the application before using second API (ii) for 16-bit and 32-bit CRC calculations. References: [1] Fast CRC Computation for Generic Polynomials Using PCLMULQDQ Instruction http://www.intel.com/content/dam/www/public/us/en/documents/white-papers/fast-crc-computation-generic-polynomials-pclmulqdq-paper.pdf [2] A PAINLESS GUIDE TO CRC ERROR DETECTION ALGORITHMS http://www.ross.net/crc/download/crc_v3.txt Jasvinder Singh (2): librte_net: add crc init and compute APIs app/test: add unit test for CRC computation app/test/Makefile | 2 + app/test/test_crc.c | 229 +++++++++++++ lib/librte_net/Makefile | 2 + lib/librte_net/rte_net_crc.c | 657 +++++++++++++++++++++++++++++++++++++ lib/librte_net/rte_net_crc.h | 101 ++++++ lib/librte_net/rte_net_version.map | 8 + 6 files changed, 999 insertions(+) create mode 100644 app/test/test_crc.c create mode 100644 lib/librte_net/rte_net_crc.c create mode 100644 lib/librte_net/rte_net_crc.h -- 2.5.5