TCPv4 checksum errors

Paul Mackerras paulus at cs.anu.edu.au
Thu Dec 24 14:57:53 EST 1998


Geert Uytterhoeven <Geert.Uytterhoeven at cs.kuleuven.ac.be> wrote:

> In the mean time I got this from a `new' PPC hacker. I haven't tried it yet
> (still have to manually calculate checksums for my bad packets, too, sigh).

> diff -ur linux/include/asm-ppc/checksum.h linux/include/asm-ppc/checksum.h
> --- linux/include/asm-ppc/checksum.h Thu Apr 23 02:35:41 1998
> +++ linux/include/asm-ppc/checksum.h    Tue Dec 22 16:19:49 1998
> @@ -83,13 +83,13 @@
>                            unsigned int sum)
>  {
>      __asm__("
> -   add %0,%0,%1
> -   add %0,%0,%2
> -   add %0,%0,%0
> -   addi %0,%0,0
> +   addc %0,%0,%1
> +   adde %0,%0,%2
> +   adde %0,%0,%3
> +   addze %0,%0
>     "
>     : "=r" (sum)
> -   : "r" (daddr), "r"(saddr), "r"((ntohs(len)<<16)+proto*256), "0"(sum));
> +   : "r" (daddr), "r"(saddr), "r"((proto<<16)+len), "0"(sum));
>      return sum;
>  }

Aargh, I checked arch/ppc/lib/checksum.S thoroughly but I missed this
one!  Of course it needs to be addc/adde/adde/addze.  Kudos to Petr
Vandrovec (good spotting, as Linus would say).

Paul.

[[ This message was sent via the linuxppc-dev mailing list. Replies are ]]
[[ not forced back to the list, so be sure to  Cc linuxppc-dev  if your ]]
[[ reply is of general interest. To unsubscribe from linuxppc-dev, send ]]
[[ the message 'unsubscribe' to linuxppc-dev-request at lists.linuxppc.org ]]




More information about the Linuxppc-dev mailing list