From 4e764017c182aef53e38dc2f1654b1f1904d7266 Mon Sep 17 00:00:00 2001 From: goldsimon Date: Sun, 14 Mar 2010 10:16:43 +0000 Subject: [PATCH] Fixed bug #29148 (Incorrect PBUF_POOL_BUFSIZE for ports where ETH_PAD_SIZE > 0) by moving definition of ETH_PAD_SIZE to opt.h and basing PBUF_LINK_HLEN on it. --- CHANGELOG | 5 +++++ src/include/lwip/opt.h | 12 +++++++++++- src/include/netif/etharp.h | 4 ---- 3 files changed, 16 insertions(+), 5 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index 8dd390d3..640b4f0a 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -158,6 +158,11 @@ HISTORY ++ Bugfixes: + 2010-03-14: Simon Goldschmidt + * opt.h, etharp.h: Fixed bug #29148 (Incorrect PBUF_POOL_BUFSIZE for ports + where ETH_PAD_SIZE > 0) by moving definition of ETH_PAD_SIZE to opt.h + and basing PBUF_LINK_HLEN on it. + 2010-03-08: Simon Goldschmidt * netif.c, ipv4/ip.c: task #10241 (AutoIP: don't break existing connections when assiging routable address): when checking incoming packets and diff --git a/src/include/lwip/opt.h b/src/include/lwip/opt.h index c7cf3585..6109a916 100644 --- a/src/include/lwip/opt.h +++ b/src/include/lwip/opt.h @@ -435,6 +435,16 @@ #define LWIP_ETHERNET (LWIP_ARP || PPPOE_SUPPORT) #endif +/** ETH_PAD_SIZE: number of bytes added before the ethernet header to ensure + * alignment of payload after that header. Since the header is 14 bytes long, + * without this padding e.g. addresses in the IP header will not be aligned + * on a 32-bit boundary, so setting this to 2 can speed up 32-bit-platforms. + */ +#ifndef ETH_PAD_SIZE +#define ETH_PAD_SIZE 0 +#endif + + /* -------------------------------- ---------- IP options ---------- @@ -997,7 +1007,7 @@ * Ethernet. */ #ifndef PBUF_LINK_HLEN -#define PBUF_LINK_HLEN 14 +#define PBUF_LINK_HLEN (14 + ETH_PAD_SIZE) #endif /** diff --git a/src/include/netif/etharp.h b/src/include/netif/etharp.h index 3eb0604f..324e0f22 100644 --- a/src/include/netif/etharp.h +++ b/src/include/netif/etharp.h @@ -48,10 +48,6 @@ extern "C" { #endif -#ifndef ETH_PAD_SIZE -#define ETH_PAD_SIZE 0 -#endif - #ifndef ETHARP_HWADDR_LEN #define ETHARP_HWADDR_LEN 6 #endif