netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Joe Perches <joe@perches.com>
To: David Miller <davem@davemloft.net>
Cc: acme@ghostprotocols.net, netdev@vger.kernel.org
Subject: Re: [PATCH] - trivial - Improve appletalk checksum calculation
Date: Mon, 22 Oct 2007 18:36:28 -0700	[thread overview]
Message-ID: <1193103388.5132.38.camel@localhost> (raw)
In-Reply-To: <20071022.173545.74561992.davem@davemloft.net>

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.




  reply	other threads:[~2007-10-23  1:54 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-10-22 19:36 [PATCH] - trivial - Improve appletalk checksum calculation Joe Perches
2007-10-23  0:35 ` David Miller
2007-10-23  1:36   ` Joe Perches [this message]
2007-10-23  1:43     ` David Miller
2007-10-23  1:53       ` Joe Perches
2007-10-23  3:51         ` Herbert Xu
2007-10-28 20:18           ` Urs Thuermann
2007-10-28 21:01             ` Joe Perches
2007-10-29  2:40               ` Joe Perches
2007-10-23  3:30 ` Stephen Hemminger
2007-10-23  3:39   ` Joe Perches

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=1193103388.5132.38.camel@localhost \
    --to=joe@perches.com \
    --cc=acme@ghostprotocols.net \
    --cc=davem@davemloft.net \
    --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).