lwip-devel
[Top][All Lists]
Advanced

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

[lwip-devel] [bug #26134] Insert a dummy u16_t field to prevent alignmen


From: Simon Goldschmidt
Subject: [lwip-devel] [bug #26134] Insert a dummy u16_t field to prevent alignment exceptions
Date: Wed, 15 Apr 2009 20:44:01 +0000
User-agent: Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.4; de; rv:1.9.0.8) Gecko/2009032608 Firefox/3.0.8

Update of bug #26134 (project lwip):

                  Status:                    None => Invalid                
             Assigned to:                    None => goldsimon              
             Open/Closed:                    Open => Closed                 

    _______________________________________________________

Follow-up Comment #6:

> The crux of the issue is certain architectures word accesses has 
> to be aligned to 4 byte boundary. In the arp header source ip 
> address will be starting at non-aligned (4byte) location.

That is the case with most architectures and the reason 'packed structs' have
been introduced to C. (Forgive me if you already know this): with packed
structs, the compiler basically accesses memory byte-by-byte and reconstructs
the u32_t in a register. This is slow but there is no workaround for this as
the structure layout is defined by the network protocol (we cannot just change
it in the lwIP code).

lwIP ports can control structure packing either through defines
(PACK_STRUCT_BEGIN / PACK_STRUCT_FIELD / PACK_STRUCT_STRUCT / PACK_STRUCT_END)
or through include files (PACK_STRUCT_USE_INCLUDES). Both ways can be found as
example either in the win32 or unix port. There are *some* compilers that
don't support structure packing, but these are so rare that we cannot afford
to support them (and these are really, really rare so I doubt that is the case
for you).

I'll close this as invalid. Please don't hesitate to reply to the lwip_devel
list on further questions. 

    _______________________________________________________

Reply to this item at:

  <http://savannah.nongnu.org/bugs/?26134>

_______________________________________________
  Nachricht geschickt von/durch Savannah
  http://savannah.nongnu.org/





reply via email to

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