From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <jasvinder.singh@intel.com>
Received: from mga14.intel.com (mga14.intel.com [192.55.52.115])
 by dpdk.org (Postfix) with ESMTP id 46AF210FBD
 for <dev@dpdk.org>; Thu, 30 Mar 2017 13:20:33 +0200 (CEST)
DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple;
 d=intel.com; i=@intel.com; q=dns/txt; s=intel;
 t=1490872833; x=1522408833;
 h=from:to:cc:subject:date:message-id:in-reply-to:
 references:mime-version:content-transfer-encoding;
 bh=OyPwAmb4S+JLbnAmnN44G25ZR5JAr57XAH/26lnWP1s=;
 b=HOlEqwtrGJ1G0AXDZ+qU4rWWSTz1KSPG2itpC5CRBgLvZ3ZQ3tpJWlQY
 LxieQ3UCt7MXz5YrPMsNAXZ4vKQ2Pg==;
Received: from orsmga005.jf.intel.com ([10.7.209.41])
 by fmsmga103.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384;
 30 Mar 2017 04:20:31 -0700
X-ExtLoop1: 1
X-IronPort-AV: E=Sophos;i="5.36,246,1486454400"; d="scan'208";a="80940484"
Received: from silpixa00381635.ir.intel.com (HELO
 silpixa00381635.ger.corp.intel.com) ([10.237.222.149])
 by orsmga005.jf.intel.com with ESMTP; 30 Mar 2017 04:20:31 -0700
From: Jasvinder Singh <jasvinder.singh@intel.com>
To: dev@dpdk.org
Cc: olivier.matz@6wind.com, declan.doherty@intel.com,
 pablo.de.lara.guarch@intel.com
Date: Thu, 30 Mar 2017 12:30:20 +0100
Message-Id: <1490873422-13734-1-git-send-email-jasvinder.singh@intel.com>
X-Mailer: git-send-email 2.5.5
In-Reply-To: <1490807704-211859-2-git-send-email-jasvinder.singh@intel.com>
References: <1490807704-211859-2-git-send-email-jasvinder.singh@intel.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Subject: [dpdk-dev] [PATCH v8 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 <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: Thu, 30 Mar 2017 11:20:34 -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].

During intialisation, all the data structures required for CRC computation
are initialised. Also, x86 specific crc implementation (if supported by
the platform) or scalar version is enabled.

Following APIs have been added;

(i) rte_net_crc_set_alg()   
(ii)rte_net_crc_calc()

The first API (i) allows user to select the specific CRC implementation
in run-time while the second API (ii) is used for computing the 16-bit and
32-bit CRC.

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

v8 changes:
- fixed memory leaks in unit test.
 
v7 changes:
- removed the duplicate function in unit test.

v6 changes:
- fixed build error when compiling net library as a shared library
- addressed review comments on v5, (thanks Pablo) 

v5 changes:
- rebase to the master

v4 changes:
- change crc compute api parameters to make it more generic
- change the unit test to accomodate the crc compute api change

v3 changes:
- separate the x86 specific implementation into new file
- improve the unit test

v2 changes:
- fix build errors for target i686-native-linuxapp-gcc
- fix checkpatch warnings

Notes:
- Build not successful with clang version earlier than 3.7.0 due to
  missing intrinsics. Refer dpdk known issue section for more details.

Jasvinder Singh (2):
  librte_net: add crc compute APIs
  test/test: add unit test for CRC computation

 lib/Makefile                       |   2 +-
 lib/librte_net/Makefile            |   3 +
 lib/librte_net/rte_net_crc.c       | 199 ++++++++++++++++++++
 lib/librte_net/rte_net_crc.h       | 104 +++++++++++
 lib/librte_net/rte_net_crc_sse.h   | 361 +++++++++++++++++++++++++++++++++++++
 lib/librte_net/rte_net_version.map |   8 +
 test/test/Makefile                 |   2 +
 test/test/test_crc.c               | 182 +++++++++++++++++++
 8 files changed, 860 insertions(+), 1 deletion(-)
 create mode 100644 lib/librte_net/rte_net_crc.c
 create mode 100644 lib/librte_net/rte_net_crc.h
 create mode 100644 lib/librte_net/rte_net_crc_sse.h
 create mode 100644 test/test/test_crc.c

-- 
2.5.5