netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Arnaldo Carvalho de Melo <acme@conectiva.com.br>
To: Joe Perches <joe@perches.com>
Cc: netdev@oss.sgi.com
Subject: Re: [IPX]: Fix checksum computation.
Date: Fri, 31 Oct 2003 19:31:59 -0200	[thread overview]
Message-ID: <20031031213159.GO3705@conectiva.com.br> (raw)
In-Reply-To: <1067635446.11564.92.camel@localhost.localdomain>

Em Fri, Oct 31, 2003 at 01:24:06PM -0800, Joe Perches escreveu:
> On Thu, 2003-10-30 at 19:43, Linux Kernel Mailing List wrote:
> > ChangeSet 1.1399, 2003/10/30 19:43:04-08:00, davem@nuts.ninka.net
> > 	[IPX]: Fix checksum computation.
> > diff -Nru a/net/appletalk/ddp.c b/net/appletalk/ddp.c
> > --- a/net/appletalk/ddp.c	Fri Oct 31 12:06:06 2003
> > +++ b/net/appletalk/ddp.c	Fri Oct 31 12:06:06 2003
> > @@ -937,9 +937,13 @@
> >  {
> >  	/* This ought to be unwrapped neatly. I'll trust gcc for now */
> >  	while (len--) {
> > -		sum += *data++;
> > +		sum += *data;
> >  		sum <<= 1;
> > -		sum = ((sum >> 16) + sum) & 0xFFFF;
> > +		if (sum & 0x10000) {
> > +			sum++;
> > +			sum &= 0xffff;
> > +		}
> > +		data++;
> >  	}
> >  	return sum;
> >  }
> 
> This change didn't appear on this list for comment,
> it just appeared in the source.
> 
> Why is this a "fix"?  Performance?
> It seems more like someone's idea of code neatening.
> 
> If this is done, why not if (unlikely())

No, the reverse is true, with the patch it is the same as in 2.4, when Stephen
did the conversion to handle paged skbs it did what you called "neatening"
(i.e.  without the patch above), now, if you care, go try to use this with
recent gcc, and get back with your results.

Mine were: reversing this patch makes the checksum calculations sometimes
wrong, preventing Appletalk from working.

Mind boggling? Yes, did it fixed a problem? Yes.

- Arnaldo

  parent reply	other threads:[~2003-10-31 21:31 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <200310312006.h9VK62Hh005910@hera.kernel.org>
2003-10-31 21:24 ` [IPX]: Fix checksum computation Joe Perches
2003-10-31 21:23   ` David S. Miller
2003-10-31 21:34     ` Arnaldo Carvalho de Melo
2003-10-31 21:50     ` Joe Perches
2003-10-31 21:53       ` David S. Miller
2003-10-31 22:21         ` Stephen Hemminger
2003-10-31 22:46           ` Arnaldo Carvalho de Melo
2003-11-01  0:25           ` David S. Miller
2003-10-31 21:56       ` Arnaldo Carvalho de Melo
2003-10-31 23:29     ` Mark Huth
2003-11-01  0:31       ` Joe Perches
2003-11-01  0:31         ` David S. Miller
2003-10-31 21:31   ` Arnaldo Carvalho de Melo [this message]
2003-11-01  0:38     ` Stephen Hemminger
2003-11-01  1:13       ` Arnaldo Carvalho de Melo
2003-11-01  1:19         ` Arnaldo Carvalho de Melo

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=20031031213159.GO3705@conectiva.com.br \
    --to=acme@conectiva.com.br \
    --cc=joe@perches.com \
    --cc=netdev@oss.sgi.com \
    /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).