lkml.org 
[lkml]   [2004]   [Mar]   [31]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [PATCH] lib/libcrc32c
From
Date
On Tue, 30 Mar 2004, Bartlomiej Zolnierkiewicz told this:

> On Tuesday 30 of March 2004 21:11, Clay Haapala wrote:
>> On Tue, 30 Mar 2004, Bartlomiej Zolnierkiewicz outgrape:
>> > +
>> > +static u32 crc32c_table[256] = {
>> >
>> > Tables are build time generated in case of CRC32
>> > (lib/gen_crc32table.c) so you can trade some performance for
>> > smaller size of the table.
>> >
>> > [ However I don't know how useful is this. ]
>>
>> As the table was statically in code in sctp and in the iSCSI driver
>> where it originally came from, I left it that way. Why would the
>> table be of a different size?
>
> See lib/crc32defs.h and lib/gen_crc32table.c.
>
> lib/crc32defs.h:
>
> /* How many bits at a time to use. Requires a table of
> 4<<CRC_xx_BITS bytes. */ /* For less performance-sensitive, use 4 */
> #ifndef CRC_LE_BITS # define CRC_LE_BITS 8 #endif #ifndef
> CRC_BE_BITS # define CRC_BE_BITS 8 #endif
>
> lib/gen_crc32table.c:
>
> #define LE_TABLE_SIZE (1 << CRC_LE_BITS)
> #define BE_TABLE_SIZE (1 << CRC_BE_BITS)
>
> static u_int32_t crc32table_le[LE_TABLE_SIZE];
> static u_int32_t crc32table_be[BE_TABLE_SIZE];
>
>
This is a legitimate question.

The immediate user of this crc32c is the iscsi-sfnet driver, and my
mind-set for that is always towards gigabit-ethernet wire-rate, so
that bias may prevent me from making the right choice here.

Regarding performance vs. size, we have the BITS == 8 table for "high"
performance and bigger size, and BITS == 1 bit-wise computation, for the
least size, albeit slower performance. Is that good enough?

The last time I wrote CRC lookup code for nibble-sized tables, it was
for an 8051 microcontroller. :-)
--
Clay Haapala (chaapala@cisco.com) Cisco Systems SRBU +1 763-398-1056
6450 Wedgwood Rd, Suite 130 Maple Grove MN 55311 PGP: C89240AD
Dyslexia meets Concealed Carry laws:
"Microsoft bans gnus on these premises"
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2005-03-22 14:02    [W:0.185 / U:0.656 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site