Linux MIPS Architecture development
 help / color / mirror / Atom feed
* csum_ipv6_magic()
@ 2001-10-22  6:16 Machida Hiroyuki
  2001-10-22  7:55 ` csum_ipv6_magic() Alan Cox
  0 siblings, 1 reply; 8+ messages in thread
From: Machida Hiroyuki @ 2001-10-22  6:16 UTC (permalink / raw)
  To: Ralf Baechle; +Cc: linux-mips


I guess that csum_ipv6_magic() in include/asm-mips/checksum.h 
needs "addu %0, $1" at the next of "sltu $1, %0, $1".
Without this, you cannot add a carry of the last addtion.


--- checksum.h.ORG      Mon Oct 22 15:09:32 2001
+++ checksum.h  Mon Oct 22 15:09:51 2001
@@ -249,6 +249,7 @@ static __inline__ unsigned short int csu
        "addu\t%0, $1\n\t"
        "addu\t%0, %1\n\t"
        "sltu\t$1, %0, $1\n\t"
+       "addu\t%0, $1\n\t"
        ".set\tnoat\n\t"
        ".set\tnoreorder"
        : "=r" (sum), "=r" (proto)

---
Hiroyuki Machida
Sony Corp.

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: csum_ipv6_magic()
  2001-10-22  6:16 csum_ipv6_magic() Machida Hiroyuki
@ 2001-10-22  7:55 ` Alan Cox
  2001-10-22  7:55   ` csum_ipv6_magic() Alan Cox
  2001-10-22 10:56   ` csum_ipv6_magic() Machida Hiroyuki
  0 siblings, 2 replies; 8+ messages in thread
From: Alan Cox @ 2001-10-22  7:55 UTC (permalink / raw)
  To: Machida Hiroyuki; +Cc: Ralf Baechle, linux-mips

> I guess that csum_ipv6_magic() in include/asm-mips/checksum.h 
> needs "addu %0, $1" at the next of "sltu $1, %0, $1".
> Without this, you cannot add a carry of the last addtion.

Is that actually needed. The final end around carry cannot itself cause
a second carry.

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: csum_ipv6_magic()
  2001-10-22  7:55 ` csum_ipv6_magic() Alan Cox
@ 2001-10-22  7:55   ` Alan Cox
  2001-10-22 10:56   ` csum_ipv6_magic() Machida Hiroyuki
  1 sibling, 0 replies; 8+ messages in thread
From: Alan Cox @ 2001-10-22  7:55 UTC (permalink / raw)
  To: Machida Hiroyuki; +Cc: Ralf Baechle, linux-mips

> I guess that csum_ipv6_magic() in include/asm-mips/checksum.h 
> needs "addu %0, $1" at the next of "sltu $1, %0, $1".
> Without this, you cannot add a carry of the last addtion.

Is that actually needed. The final end around carry cannot itself cause
a second carry.

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: csum_ipv6_magic()
  2001-10-22  7:55 ` csum_ipv6_magic() Alan Cox
  2001-10-22  7:55   ` csum_ipv6_magic() Alan Cox
@ 2001-10-22 10:56   ` Machida Hiroyuki
  2001-10-22 11:33     ` csum_ipv6_magic() Machida Hiroyuki
  1 sibling, 1 reply; 8+ messages in thread
From: Machida Hiroyuki @ 2001-10-22 10:56 UTC (permalink / raw)
  To: alan; +Cc: ralf, linux-mips


From: Alan Cox <alan@lxorguk.ukuu.org.uk>
Subject: Re: csum_ipv6_magic()
Date: Mon, 22 Oct 2001 08:55:35 +0100 (BST)

> > I guess that csum_ipv6_magic() in include/asm-mips/checksum.h 
> > needs "addu %0, $1" at the next of "sltu $1, %0, $1".
> > Without this, you cannot add a carry of the last addtion.
> 
> Is that actually needed. The final end around carry cannot itself cause
> a second carry.

I don't know csum_ipv6_magic() in include/asm-mips/checksum.h works
fine or not. But if csum_ipv6_magic() doesn't need "addu %0, $1" at
next of the final "sltu $1, %0, $1", you can remove the final 
"sltu $1, %0, $1".

---
Hiroyuki Machida
Sony Corp.

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: csum_ipv6_magic()
  2001-10-22 10:56   ` csum_ipv6_magic() Machida Hiroyuki
@ 2001-10-22 11:33     ` Machida Hiroyuki
  2001-10-22 20:48       ` csum_ipv6_magic() Ralf Baechle
  0 siblings, 1 reply; 8+ messages in thread
From: Machida Hiroyuki @ 2001-10-22 11:33 UTC (permalink / raw)
  To: alan, ralf; +Cc: linux-mips


I found bugs in checksum.h. A sample fix is attached below.

I perfer to use generic csum_ipv6_magic() in net/checksum.h
than this fix. Please someone show me improvements for this asm
version of csum_ipv6_magic(). 

---
Hiroyuki Machida
Sony Corp.


ChangLog entry:

* (csum_ipv6_magic): Have same paramter types as net/checksum.h.
  Correct carry computation.  Add a final carry.


Index: checksum.h
===================================================================
RCS file: /cvs/linux/include/asm-mips/checksum.h,v
retrieving revision 1.12
diff -u -p -r1.12 checksum.h
--- checksum.h	2001/10/06 19:29:25	1.12
+++ checksum.h	2001/10/22 11:16:05
@@ -197,7 +197,7 @@ static inline unsigned short ip_compute_
 #define _HAVE_ARCH_IPV6_CSUM
 static __inline__ unsigned short int csum_ipv6_magic(struct in6_addr *saddr,
 						     struct in6_addr *daddr,
-						     __u32 len,
+						     unsigned short len,
 						     unsigned short proto,
 						     unsigned int sum) 
 {
@@ -211,49 +211,51 @@ static __inline__ unsigned short int csu
 	"addu\t%0, %6\t\t\t# csum\n\t"
 	"sltu\t$1, %0, %6\n\t"
 	"lw\t%1, 0(%2)\t\t\t# four words source address\n\t"
-	"addu\t%0, $1\n\t"
+	" addu\t%0, $1\n\t"
 	"addu\t%0, %1\n\t"
-	"sltu\t$1, %0, $1\n\t"
+	"sltu\t$1, %0, %1\n\t"
 
 	"lw\t%1, 4(%2)\n\t"
-	"addu\t%0, $1\n\t"
+	" addu\t%0, $1\n\t"
 	"addu\t%0, %1\n\t"
-	"sltu\t$1, %0, $1\n\t"
+	"sltu\t$1, %0, %1\n\t"
 
 	"lw\t%1, 8(%2)\n\t"
-	"addu\t%0, $1\n\t"
+	" addu\t%0, $1\n\t"
 	"addu\t%0, %1\n\t"
-	"sltu\t$1, %0, $1\n\t"
+	"sltu\t$1, %0, %1\n\t"
 
 	"lw\t%1, 12(%2)\n\t"
-	"addu\t%0, $1\n\t"
+	" addu\t%0, $1\n\t"
 	"addu\t%0, %1\n\t"
-	"sltu\t$1, %0, $1\n\t"
+	"sltu\t$1, %0, %1\n\t"
 
 	"lw\t%1, 0(%3)\n\t"
-	"addu\t%0, $1\n\t"
+	" addu\t%0, $1\n\t"
 	"addu\t%0, %1\n\t"
-	"sltu\t$1, %0, $1\n\t"
+	"sltu\t$1, %0, %1\n\t"
 
 	"lw\t%1, 4(%3)\n\t"
-	"addu\t%0, $1\n\t"
+	" addu\t%0, $1\n\t"
 	"addu\t%0, %1\n\t"
-	"sltu\t$1, %0, $1\n\t"
+	"sltu\t$1, %0, %1\n\t"
 
 	"lw\t%1, 8(%3)\n\t"
-	"addu\t%0, $1\n\t"
+	" addu\t%0, $1\n\t"
 	"addu\t%0, %1\n\t"
-	"sltu\t$1, %0, $1\n\t"
+	"sltu\t$1, %0, %1\n\t"
 
 	"lw\t%1, 12(%3)\n\t"
-	"addu\t%0, $1\n\t"
+	" addu\t%0, $1\n\t"
 	"addu\t%0, %1\n\t"
-	"sltu\t$1, %0, $1\n\t"
+	"sltu\t$1, %0, %1\n\t"
+	" addu\t%0, $1\n\t"
+
 	".set\tnoat\n\t"
 	".set\tnoreorder"
 	: "=r" (sum), "=r" (proto)
 	: "r" (saddr), "r" (daddr),
-	  "0" (htonl(len)), "1" (htonl(proto)), "r" (sum));
+	  "0" (htonl((__u32)len)), "1" (htonl(proto)), "r" (sum));
 
 	return csum_fold(sum);
 }

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: csum_ipv6_magic()
  2001-10-22 11:33     ` csum_ipv6_magic() Machida Hiroyuki
@ 2001-10-22 20:48       ` Ralf Baechle
  2001-10-23  5:07         ` csum_ipv6_magic() Machida Hiroyuki
  0 siblings, 1 reply; 8+ messages in thread
From: Ralf Baechle @ 2001-10-22 20:48 UTC (permalink / raw)
  To: Machida Hiroyuki; +Cc: alan, linux-mips

On Mon, Oct 22, 2001 at 08:33:24PM +0900, Machida Hiroyuki wrote:

> I found bugs in checksum.h. A sample fix is attached below.
> 
> I perfer to use generic csum_ipv6_magic() in net/checksum.h
> than this fix. Please someone show me improvements for this asm
> version of csum_ipv6_magic(). 

The C version should produce code that performs identically on MIPS.  As
such we have no good reason to keep the assembler version.

> * (csum_ipv6_magic): Have same paramter types as net/checksum.h.
>   Correct carry computation.  Add a final carry.

The len argument of that prototype should be __u32 because of IPv6
jumbograms.

  Ralf

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: csum_ipv6_magic()
  2001-10-22 20:48       ` csum_ipv6_magic() Ralf Baechle
@ 2001-10-23  5:07         ` Machida Hiroyuki
  2001-10-23 11:18           ` csum_ipv6_magic() Ralf Baechle
  0 siblings, 1 reply; 8+ messages in thread
From: Machida Hiroyuki @ 2001-10-23  5:07 UTC (permalink / raw)
  To: ralf; +Cc: alan, linux-mips


From: Ralf Baechle <ralf@oss.sgi.com>
Subject: Re: csum_ipv6_magic()
Date: Mon, 22 Oct 2001 22:48:28 +0200

> > * (csum_ipv6_magic): Have same paramter types as net/checksum.h.
> >   Correct carry computation.  Add a final carry.
> 
> The len argument of that prototype should be __u32 because of IPv6
> jumbograms.

I suppose csum_ipv6_magic() in include/net/checksum.h should have __u32
len. Please update include/net/checksum.h to avoid confusion.

Thanks.

---
Hiroyuki Machida
Sony Corp.

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: csum_ipv6_magic()
  2001-10-23  5:07         ` csum_ipv6_magic() Machida Hiroyuki
@ 2001-10-23 11:18           ` Ralf Baechle
  0 siblings, 0 replies; 8+ messages in thread
From: Ralf Baechle @ 2001-10-23 11:18 UTC (permalink / raw)
  To: Machida Hiroyuki; +Cc: alan, linux-mips

On Tue, Oct 23, 2001 at 02:07:22PM +0900, Machida Hiroyuki wrote:

> > > * (csum_ipv6_magic): Have same paramter types as net/checksum.h.
> > >   Correct carry computation.  Add a final carry.
> > 
> > The len argument of that prototype should be __u32 because of IPv6
> > jumbograms.
> 
> I suppose csum_ipv6_magic() in include/net/checksum.h should have __u32
> len. Please update include/net/checksum.h to avoid confusion.

Will do.

  Ralf

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2001-10-23 11:19 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2001-10-22  6:16 csum_ipv6_magic() Machida Hiroyuki
2001-10-22  7:55 ` csum_ipv6_magic() Alan Cox
2001-10-22  7:55   ` csum_ipv6_magic() Alan Cox
2001-10-22 10:56   ` csum_ipv6_magic() Machida Hiroyuki
2001-10-22 11:33     ` csum_ipv6_magic() Machida Hiroyuki
2001-10-22 20:48       ` csum_ipv6_magic() Ralf Baechle
2001-10-23  5:07         ` csum_ipv6_magic() Machida Hiroyuki
2001-10-23 11:18           ` csum_ipv6_magic() Ralf Baechle

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox