Skip to content

librte_net: add crc computation support

Jasvinder Singh dpdk-dev 11 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v11 Latest2 patches 2 repliesIn review
  2. v102 patches 2 repliesSuperseded
  3. v93 patches 7 repliesSuperseded
Earlier versions · 8
VersionPostedPatchesRepliesStatus
v82 patches4 repliesSuperseded
v72 patches0 repliesSuperseded
v62 patches2 repliesSuperseded
v52 patches5 repliesSuperseded
v42 patches1 replySuperseded
v32 patches2 repliesSuperseded
v22 patches10 repliesSuperseded
v12 patches0 repliesSuperseded

Changes in v11 from the cover letter

- fixed doxygen warning

Patches in v11 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/2librte_net: add crc compute APIsMAINTAINERS lib/Makefile lib/librte_net/Makefile +4 more+682 -10 replies
2/2test/test: add unit test for CRC computationMAINTAINERS test/test/Makefile test/test/test_crc.c+186 -01 reply

Reviews trailers per patch

All 2 patches have a Reviewed-by or Acked-by.

PatchPablo de Lara
1/2A-b
2/2A-b

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v11 thread

Cover letter [PATCH v11 0/2] librte_net: add crc computation support

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

v11 changes:
- fixed doxygen warning

v10 changes:
- added check for PCLMULQDQ instructions support to fix FreeBSD 10.4 build error (clang 3.4.0)

v9 changes:
- included header files.
- added maintainership

v8 changes:
- improve unit test case.

v7 changes:
- remove 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

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

 MAINTAINERS                        |   6 +
 lib/Makefile                       |   2 +-
 lib/librte_net/Makefile            |   2 +
 lib/librte_net/net_crc_sse.h       | 363 +++++++++++++++++++++++++++++++++++++
 lib/librte_net/rte_net_crc.c       | 207 +++++++++++++++++++++
 lib/librte_net/rte_net_crc.h       |  96 ++++++++++
 lib/librte_net/rte_net_version.map |   8 +
 test/test/Makefile                 |   2 +
 test/test/test_crc.c               | 183 +++++++++++++++++++
 9 files changed, 868 insertions(+), 1 deletion(-)
 create mode 100644 lib/librte_net/net_crc_sse.h
 create mode 100644 lib/librte_net/rte_net_crc.c
 create mode 100644 lib/librte_net/rte_net_crc.h
 create mode 100644 test/test/test_crc.c
Signature · 1 line
2.5.5