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

2007-10-28 Thread Urs Thuermann
Herbert Xu [EMAIL PROTECTED] writes: But your code differs significantly from Stephen's version. However, if it is correct it does look like a good improvement. So please write a simple test program. It can't that bad since there are only 65536 values to test :) I think the code is simple

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

2007-10-28 Thread Joe Perches
On Sun, 2007-10-28 at 21:18 +0100, Urs Thuermann wrote: I have written a short test program to show this and tested it on i686 (gcc-4.2.2) and powerpc (gcc-3.4.5) without optimization and with -O6. Thanks for that. BTW, shouldn't unsigned long be replaced by unsigned int to avoid 64-bit

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

2007-10-28 Thread Joe Perches
On Sun, 2007-10-28 at 14:01 -0700, Joe Perches wrote: probably unsigned long should be u16. Or not. x86 u16 performs much worse than u32 (~ 50% worse) - To unsubscribe from this list: send the line unsubscribe netdev in the body of a message to [EMAIL PROTECTED] More majordomo info at

[PATCH] - trivial - Improve appletalk checksum calculation

2007-10-22 Thread Joe Perches
It's a bit after 2.6.1 now... Removes unnecessary if, uses 16 bit rotate left. Performance improves ~30% Signed-off-by: Joe Perches [EMAIL PROTECTED] diff --git a/net/appletalk/ddp.c b/net/appletalk/ddp.c index 7c0b515..1c50f4c 100644 --- a/net/appletalk/ddp.c +++ b/net/appletalk/ddp.c @@

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

2007-10-22 Thread David Miller
From: Joe Perches [EMAIL PROTECTED] 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:

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

2007-10-22 Thread Joe Perches
On Mon, 2007-10-22 at 18:43 -0700, David Miller wrote: Ok, but again did you test it? Nope. Stephen Hemminger did in 2003. - To unsubscribe from this list: send the line unsubscribe netdev in the body of a message to [EMAIL PROTECTED] More majordomo info at

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

2007-10-22 Thread Joe Perches
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

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

2007-10-22 Thread Stephen Hemminger
On Mon, 22 Oct 2007 12:36:19 -0700 Joe Perches [EMAIL PROTECTED] wrote: It's a bit after 2.6.1 now... Removes unnecessary if, uses 16 bit rotate left. Performance improves ~30% Signed-off-by: Joe Perches [EMAIL PROTECTED] diff --git a/net/appletalk/ddp.c b/net/appletalk/ddp.c index

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

2007-10-22 Thread Herbert Xu
Joe Perches [EMAIL PROTECTED] wrote: On Mon, 2007-10-22 at 18:43 -0700, David Miller wrote: Ok, but again did you test it? Nope. Stephen Hemminger did in 2003. But your code differs significantly from Stephen's version. However, if it is correct it does look like a good improvement. So

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

2007-10-22 Thread Joe Perches
On Mon, 2007-10-22 at 20:30 -0700, Stephen Hemminger wrote: Corrected fast code is: while (len--) { sum += *data++; sum = 1; sum = (((sum 0x1) 16) + sum) 0x; } At least it is correct on the standalone