lwip-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[lwip-users] Re: [lwip] Bug in checksum routine + patch


From: Adam Dunkels
Subject: [lwip-users] Re: [lwip] Bug in checksum routine + patch
Date: Wed, 08 Jan 2003 22:38:07 -0000

Hi Paul!

I haven't tried your checksum patch, but I do believe that the checksum 
calculation should be moved out from the core code and into the architecture 
specific area. This would make it easier to reimplement the function in 
assembler for speed.

As for the problems with the checksumming in your case, I might suspect that 
is has to do with alignment problems and buffers starting on misaligned 
addresses.

On Thursday 07 February 2002 09.36, you wrote:
> So my questions are:
>
>       *- What is the expected alignment of
>               lwIP? 4, 2, or 1?

This *should* be configurable through the use of the MEM_ALIGNMENT option. 
Note that I haven't been able to test and troubleshoot this myself as I don't 
have access to any machines with alignment issues.

>       *- In what structures is the alignment
>               criticle? tcp - obviously, what else
>
> Adam, could you do a careful audit of this? its seems
> like quite a criticle problem. What about putting #pragma pack
> where necessary, or using gcc __attribute__?

The IP, UDP and TCP headers are designed in such a way that alignment issues 
are largely avoided: double word (4 byte) fields start on an even 4-byte 
boundary and word fields start on word boundaries. Many CPUs and compilers 
can take advantage of this and is able to pack the structures. 

Some compilers may not do this, however, so it might be best to just add the 
PACK-macros around all structures that depend on being packed.

The structures that depend on being packed are the ones used for packet 
headers - arp_hdr, ip_hdr, udp_hdr, tcp_hdr and icmp_hdr. 

> PS ARM Atmel port is working - i'll send a patch as soon as i've
> ironed out a few problems!!

Great!

/adam
-- 
Adam Dunkels <address@hidden>
http://www.sics.se/~adam
[This message was sent through the lwip discussion list.]




reply via email to

[Prev in Thread] Current Thread [Next in Thread]