[lkml]   [2002]   [Sep]   [3]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
Patch in this message
SubjectRe: TCP Segmentation Offloading (TSO)

kuznet> > [1] Kudos to
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().

Using "bswap" is little bit tricky.

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
movl %ecx, %edx
movl %ecx, %ebx
@@ -145,6 +145,20 @@ csum_partial:
lea 2(%esi), %esi
adcl $0, %eax
jmp 10b
+ 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
+ testl $1, 12(%esp)
+ jz 90f
+ bswap %eax
popl %ebx
popl %esi
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to
More majordomo info at
Please read the FAQ at
 \ /
  Last update: 2005-03-22 13:28    [W:0.114 / U:4.328 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site