]> git.karo-electronics.de Git - karo-tx-linux.git/commit
Add support for slice by 8 to existing crc32 algorithm. Also modify
authorfrank zago <fzago@systemfabricworks.com>
Wed, 3 Aug 2011 00:53:01 +0000 (10:53 +1000)
committerStephen Rothwell <sfr@canb.auug.org.au>
Wed, 10 Aug 2011 01:50:43 +0000 (11:50 +1000)
commitd4dca7b2ca6694c70ad4225113976652f5ac5cf1
tree9a5a1fca1d6d41cdcce68a75f9f497050b41c542
parent6a1516baf671e68aef48744a8a9944e4b42f8f44
Add support for slice by 8 to existing crc32 algorithm.  Also modify
gen_crc32table.c to only produce table entries that are actually used.
The parameters CRC_LE_BITS and CRC_BE_BITS determine the number of bits in
the input array that are processed during each step.  Generally the more
bits the faster the algorithm is but the more table data required.

Using an x86_64 Opteron machine running at 2100MHz the following table was
collected with a pre-warmed cache by computing the crc 1000 times on a
buffer of 4096 bytes.

BITS Size LE Cycles/byte BE Cycles/byte
----------------------------------------------
1 873 41.65 34.60
2 1097 25.43 29.61
4 1057 13.29 15.28
8 2913 7.13 8.19
32 9684 2.80 2.82
64 18178 1.53 1.53

BITS is the value of CRC_LE_BITS or CRC_BE_BITS. The old
default was 8 which actually selected the 32 bit algorithm. In
this version the value 8 is used to select the standard
8 bit algorithm and two new values: 32 and 64 are introduced
to select the slice by 4 and slice by 8 algorithms respectively.

Where Size is the size of crc32.o's text segment which includes
code and table data when both LE and BE versions are set to BITS.

The current version of crc32.c by default uses the slice by 4 algorithm
which requires about 2.8 cycles per byte.  The slice by 8 algorithm is
roughly 2X faster and enables packet processing at over 1GB/sec on a
typical 2-3GHz system.

Signed-off-by: Bob Pearson <rpearson@systemfabricworks.com>
Cc: Roland Dreier <roland@kernel.org>
Cc: Eric Dumazet <eric.dumazet@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
lib/crc32.c
lib/crc32defs.h
lib/gen_crc32table.c