Messages in this thread Patch in this message |  | | Date | Tue, 03 Sep 2002 16:42:43 +0900 (JST) | Subject | Re: TCP Segmentation Offloading (TSO) | From | Hirokazu Takahashi <> |
| |
Hello!
kuznet> > [1] Kudos to kuznet> kuznet> Hmm... wait awhile with celebrating, the implementation in tcp is still kuznet> at level of a toy. Well, and it happens to crash, the patch is enclosed.
I guess it may also depend on bad implementations of csum_partial(). It's wrong that some architecture assume every data in a skbuff are aligned on a 2byte boundary so that it would access a byte next to the the last byte where no pages might be there.
And we should know sendfile systemcall also pass pages with any offsets and any byte while csum_partial() may be called from everywhere in the kernel including device drivers.
It's time to fix csum_partial().
P.S. Using "bswap" is little bit tricky.
Regards, Hirokazu Takahashi VP Engineering Dept. VA Linux Systems Japan
--- linux/arch/i386/lib/checksum.S.BUG Sun Sep 1 17:00:59 2030 +++ linux/arch/i386/lib/checksum.S Mon Sep 2 13:09:09 2030 @@ -126,8 +126,8 @@ csum_partial: movl 16(%esp),%ecx # Function arg: int len movl 12(%esp),%esi # Function arg: const unsigned char *buf - testl $2, %esi - jnz 30f + testl $3, %esi + jnz 25f 10: movl %ecx, %edx movl %ecx, %ebx @@ -145,6 +145,20 @@ csum_partial: lea 2(%esi), %esi adcl $0, %eax jmp 10b +25: + testl $1, %esi + jz 30f + # buf is odd + dec %ecx + jl 90f + bswap %eax + movzbl (%esi), %ebx + shll $8, %ebx + addl %ebx, %eax + adcl $0, %eax + inc %esi + testl $2, %esi + jz 10b 30: subl $2, %ecx ja 20b @@ -211,6 +225,10 @@ csum_partial: addl %ebx,%eax adcl $0,%eax 80: + testl $1, 12(%esp) + jz 90f + bswap %eax +90: popl %ebx popl %esi ret - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
|  |