• Bob Pearson's avatar
    crc32: simplify unit test code · 3863ef31
    Bob Pearson authored
    Replace the unit test provided in crc32.c, which doesn't have a makefile
    and doesn't compile with current headers, with a simpler self test
    routine that also gives a measure of performance and runs at module init
    time.  The self test option can be enabled through a configuration
    The test stresses the pre and post loops and is thus not very realistic
    since actual uses will likely have addresses and lengths that are at
    least 4 byte aligned.  However, the main loop is long enough so that the
    performance is dominated by that loop.
    The expected values for crc32_le and crc32_be were generated with the
    original version of crc32.c using CRC_BITS_LE = 8 and CRC_BITS_BE = 8.
    These values were then used to check all the values of the BITS
    parameters in both the original and new versions.
    The performance results show some variability from run to run in spite
    of attempts to both warm the cache and reduce the amount of OS noise by
    limiting interrutps during the test.  To get comparable results and to
    analyse options wrt performance the best time reported over a small
    sample of runs has been taken.
    [djwong@us.ibm.com: Minor changelog tweaks]
    Signed-off-by: default avatarBob Pearson <rpearson@systemfabricworks.com>
    Signed-off-by: default avatarDarrick J. Wong <djwong@us.ibm.com>
    Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
    Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
crc32.c 38 KB