Yes, ETH_PAD_SIZE is indeed a alignment fix.
Since the ethernet header is 14 bytes, the entire IP packet becomes unaligned. By adding a 2byte pad at the beginning of the ethernet packet, everything becomes nicely aligned. This alignment boosts performance on all 32bit processors, and is actually a requirement on processors which do not allow unaligned memory accesses. The only disadvantage is that it "wastes" 2 bytes.

Timmy Brolin

Christiaan Simons wrote:

Hi Frédéric,

Where is the best file to redefine ETH_PAD_SIZE ? I suppose that
lwipopts.h is the good location, but in ETH_PAD_SIZE is defined in
etharp.h, but before any include.

Yes, lwipopts.h is ok.

Isn't it better to move the
#define ETH_PAD_SIZE, after all #include in etharp.h? Or to add
#include "lwip/opt.h" before ?

Yes, at least after "lwip/opt.h" so your lwipopts define overrules the
etharp.h one.
I don't know what the purpose of this define is, maybe it is some alignment
fix or workaround.

Bye,

Christiaan Simons

Hardware Designer
Axon Digital Design

http://www.axon.tv



_______________________________________________
lwip-users mailing list
[email protected]
http://lists.nongnu.org/mailman/listinfo/lwip-users





_______________________________________________
lwip-users mailing list
[email protected]
http://lists.nongnu.org/mailman/listinfo/lwip-users

Reply via email to