lkml.org 
[lkml]   [1996]   [Nov]   [25]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: TCP/IP Checksumming
From
Date

"Richard B. Johnson" <root@analogic.com> writes:

>This is intended to be a definitive statement about the TCP/IP
>checksumming.

I appreciate the work you have done, but you have made a large
mistake. Read on.

[...]

>My attempts to bring this to the attention of some developers was met
>with responses that are more emotional than factual.

I hope you are not including my response(s) in that group.

>This will operate under MS-DOS if you remove your memory manager.
>This code does not enter protected mode so you can readily use
>MS-DOS facilities to record results and modify code. The 32-bit
>instructions work in real mode just as they do in protected mode
>as long as you don't attempt to use memory offsets greater than 64k.

No, they don't. Did you read the comment on the code I sent you,
which said to run it from a 32-bit segment? I at least do you the
courtesy of reading what you have to say. Using 32-bit instructions
in 16-bit DOS requires one or more prefixes to specify they are using
32-bit addressing and/or operands. These prefixes require one extra
cycle each and prevent the instruction from running in the V-pipe
which means no parallelism is obtained. No parallelism gives a factor
of two performance hit for this code. The extra cycles for the
prefixes give even more performance hit. Take away those performance
hits and you will see the 10:1 ratio.

>Yes, there still IS a reason for DOS. It's a good test bench.

For some things, yes, but not for 32-bit code. Any chance you could
redo this in a 32-bit segment? Also, go ahead and use the code I sent
you.

Also, try this one (in 16-bit mode) to see how bad lodsw/loop really
are. This is how SIMPLE_NOLODSW should have been written, and is a fair
comparison with SIMPLE_CHKSUM since it uses the same size operands
and addresses:

SPUD_CHKSUM PROC NEAR
MOV ECX, (PACKET_LEN SHR 1) ; Get packet length
MOV ESI, OFFSET IP_PACKET ; Point to packet
XOR EDX, EDX ; Clear CY, zero
;
SPUD: MOV AX, [SI]
LEA SI,[SI+2]
ADC DX,AX ; Sum words only with previous CY
DEC CX
JNZ SPUD
ADC DX,0 ; Possible last CY
MOV EAX,EDX ; Return in EAX to be fair
RET
SPUD_CHKSUM ENDP

Tom.

\
 
 \ /
  Last update: 2005-03-22 13:37    [W:0.066 / U:8.400 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site