Subject: RE: iSCSI CRC: A CRC-checking example

From: "THALER,PAT (A-Roseville,ex1)" <[email-masked]>
Date: Mon, 20 Aug 2001 18:59:48 -0600

Sanjay,

I thought the bitswapping of the CRC was being done to match the way
Ethernet sends the CRC. Ethernet sends the bits of a packet most significant
byte first and least significant bit first. It puts the bits of the CRC into
the packet such that the CRC remainder in the serial stream goes from most
significant coefficient to least significant coefficient. Therefore, the
x^31 term goes into the LSB of the first byte and the x^0 term goes into the
MSB of the last byte. The order of bits within the bytes is swapped but the
order of the bytes is not swapped.

This would covert a CRC of 0x556c8951 into a bit swapped 0xaa36918a.

I agree that to get a constant value out of a CRC checker, the bits have to
be processed in their polynomial coefficient order regardless of the order
in which they are sent.

Pat

-----Original Message-----
From: Sanjay Goyal [mailto:[email-masked]]
Sent: Friday, August 17, 2001 2:35 PM
To: 'Mark Bakke'; Julian Satran; IPS
Cc: Sanjay Goyal
Subject: RE: iSCSI CRC: A CRC-checking example

Hi
 For all zeros the value after complementing the CRC result is 0x556c8951.
If it is bit-swapped it becomes  0x8a9136aa.
 
 The way you will get the constant remainder 0x1c2d19ed is that you append
 0x556c8951 and not 0xaa36918a to the all-zero data bytes. The crc-check
engine would assume as if it is processing 4 more bytes. If we bit-swap the
CRC while transmitting, don't we have to again swap it at the receive side
and then pass it through the crc-check engine.

Sanjay Goyal                                  
www.ivivity.com

---

From: "Douglas Otis" <[email-masked]>
Date: Mon, 20 Aug 2001 21:14:50 -0700

Pat,

As the lookup table is reflected, meaning that bit 0 becomes bit 31, bit 1
becomes 30 etc, the order of these bytes are actually reversed.  You wish to
keep the bits reversed within the byte as that is how they will be sent, but
the byte order out of the table lookup has the least significant byte in the
most significant location.  This reversed byte order must be accommodated,
but no accommodation is required of the bits thanks to the reflected table.
In the case of an Intel architecture, this reversed order allows direct
placement into big endian order using the little endian CPU.  Just as
shifting bits for the table was helped by the bit order of the process, so
too is the byte placement in this case.

Doug