lwip-users
[Top][All Lists]
Advanced

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

Re: [lwip-users] ETH_PAD_SIZE


From: Timmy Brolin
Subject: Re: [lwip-users] ETH_PAD_SIZE
Date: Tue, 04 Jul 2006 17:58:47 +0200
User-agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.4) Gecko/20030624 Netscape/7.1 (ax)

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
address@hidden
http://lists.nongnu.org/mailman/listinfo/lwip-users







reply via email to

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