Subject: Re: [PATCH] - trivial - Improve appletalk checksum calculation

From: Joe Perches <[email-masked]>
Date: Mon, 22 Oct 2007 18:36:28 -0700

On Mon, 2007-10-22 at 17:35 -0700, David Miller wrote:
> Your code is rotating bit 15 down by one bit and bits 0-14 up by one
> bit.

Yes, a 16 bit rotate left.

There was a discussion a few years ago:
http://oss.sgi.com/archives/netdev/2003-10/msg00734.html

>>From the spec:

Implementers of DDP should treat generating the checksum as an optional
feature. The 16-bit DDP checksum is computed as follows:

CkSum := 0 ;
FOR each datagram byte starting with the byte immediately following this
Checksum field
REPEAT the following algorithm:
          CkSum := CkSum + byte; (unsigned addition)
          Rotate CkSum left one bit, rotating the
              most significant bit in least significant bit;
IF, at the end, CkSum = 0 THEN
          CkSum := $FFFF (all ones).

Reception of a datagram with CkSum equal to 0 implies that a checksum is
not performed.