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: Frédéric BERNON
Subject: RE : [lwip-users] ETH_PAD_SIZE
Date: Wed, 5 Jul 2006 09:38:01 +0200

Yes, I know that, but I look for the way to define this ETH_PAD_SIZE with a "2" 
value, but without modify lwip source code (the etharp.h file in this case). If 
I add it in lwipopts.h, I have to do an #undef and next an #define.

If in etharp.h, the code was ...

#ifndef __NETIF_ETHARP_H__
#define __NETIF_ETHARP_H__

#include "lwip/pbuf.h"
#include "lwip/ip_addr.h"
#include "lwip/netif.h"
#include "lwip/ip.h"

#ifndef ETH_PAD_SIZE
#define ETH_PAD_SIZE    0
#endif

OR

#ifndef __NETIF_ETHARP_H__
#define __NETIF_ETHARP_H__

#include "lwip/opt.h"

#ifndef ETH_PAD_SIZE
#define ETH_PAD_SIZE    0
#endif 

#include "lwip/pbuf.h"
#include "lwip/ip_addr.h"
#include "lwip/netif.h"
#include "lwip/ip.h"

It's just to avoid a problem if etharp.h is included before any other header 
file, and to avoid to do an #undef which is not in the "lwipopts.h spirit"...

But it's just something I note...

Thanks
  
====================================
Frédéric BERNON 
HYMATOM SA 
Chef de projet informatique 
Microsoft Certified Professional 
Tél. : +33 (0)4-67-87-61-10 
Fax. : +33 (0)4-67-70-85-44 
Email : address@hidden 
Web Site : http://www.hymatom.fr 
====================================


-----Message d'origine-----
De : address@hidden [mailto:address@hidden De la part de Timmy Brolin
Envoyé : mardi 4 juillet 2006 17:59
À : Mailing list for lwIP users
Objet : Re: [lwip-users] ETH_PAD_SIZE


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
>
>
>  
>



_______________________________________________
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]