From: Sergey Vlasov <vsu@altlinux.ru>
To: Ivo van Doorn <ivdoorn@gmail.com>
Cc: netdev@vger.kernel.org
Subject: Re: CRC16 in rt2x00
Date: Sat, 27 May 2006 17:55:16 +0400 [thread overview]
Message-ID: <20060527175516.600f450c.vsu@altlinux.ru> (raw)
In-Reply-To: <200605271327.18879.IvDoorn@gmail.com>
[-- Attachment #1: Type: text/plain, Size: 2298 bytes --]
On Sat, 27 May 2006 13:27:15 +0200 Ivo van Doorn wrote:
> I have a small question about the CRC16 usage in rt2x00
> and what the netdev preferred method is for this.
>
> At the moment the rt2x00 drivers in wireless-dev use
> its own CRC16 table and calculation inside the driver.
> There already is a CRC16 library in the kernel
> which uses the 0x8005 table, while rt2x00 uses the
> 0x1021 polynomial table.
>
> Is keeping this version of CRC16 inside rt2x00 the most
> sensible thing to do? Or should it be moved to the lib
> folder of the kernel so other drivers could make use of it as well?
> (So far I have not found a driver which makes use
> of the same CRC16 table)
However, fs/udf/crc.c has exactly the same CRC table as rt2x00:
static uint16_t crc_table[256] = {
0x0000U, 0x1021U, 0x2042U, 0x3063U, 0x4084U, 0x50a5U, 0x60c6U, 0x70e7U,
...
0x6e17U, 0x7e36U, 0x4e55U, 0x5e74U, 0x2e93U, 0x3eb2U, 0x0ed1U, 0x1ef0U
};
/*
* udf_crc
*
* PURPOSE
* Calculate a 16-bit CRC checksum using ITU-T V.41 polynomial.
*
* DESCRIPTION
* The OSTA-UDF(tm) 1.50 standard states that using CRCs is mandatory.
* The polynomial used is: x^16 + x^12 + x^15 + 1
*
* PRE-CONDITIONS
* data Pointer to the data block.
* size Size of the data block.
*
* POST-CONDITIONS
* <return> CRC of the data block.
*
* HISTORY
* July 21, 1997 - Andrew E. Mileski
* Adapted from OSTA-UDF(tm) 1.50 standard.
*/
This is a bit-reversed form of CRC-CCITT supported by lib/crc-ccitt.c.
Unfortunately, this does not help much, because converting one form to
the other is too expensive (you would need to reverse bits in all data
bytes, and then reverse bits in the 16-bit result).
BTW, there is more CRC code duplication in drivers/bluetooth/hci_bcsp.c
(bcsp_crc_update() seems to give the same result as crc_ccitt_byte()).
In drivers/media/dvb/frontends/nxt200x.c, nxt200x_crc() seems to give
the same result as rt2x00crc_byte() (but without using a table).
drivers/net/wan/cycx_drv.c:checksum() is also some mutated version of
CRC-CCITT (adding two additional zero bytes at the end of data makes it
return the same result as rt2x00crc()).
[-- Attachment #2: Type: application/pgp-signature, Size: 190 bytes --]
next prev parent reply other threads:[~2006-05-27 13:55 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-05-27 11:27 CRC16 in rt2x00 Ivo van Doorn
2006-05-27 13:55 ` Sergey Vlasov [this message]
2006-05-27 14:24 ` Ivo van Doorn
2006-05-27 16:30 ` Sergey Vlasov
2006-05-27 20:46 ` Ivo van Doorn
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20060527175516.600f450c.vsu@altlinux.ru \
--to=vsu@altlinux.ru \
--cc=ivdoorn@gmail.com \
--cc=netdev@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).