From 3c96819a2c9399440a8c579b360bbd65d971c349 Mon Sep 17 00:00:00 2001 From: goldsimon Date: Fri, 26 Mar 2010 16:54:15 +0000 Subject: [PATCH] Make LWIP_NETIF_TX_SINGLE_PBUF work for TCP, too --- CHANGELOG | 3 +++ src/core/init.c | 4 ++-- src/core/tcp_out.c | 9 +++++++++ 3 files changed, 14 insertions(+), 2 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index 420b8c05..ee35db38 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -169,6 +169,9 @@ HISTORY ++ Bugfixes: + 2010-03-26: Simon Goldschmidt + * tcp_out.c: Make LWIP_NETIF_TX_SINGLE_PBUF work for TCP, too + 2010-03-26: Simon Goldschmidt * various files: Fixed compiling with different options disabled (TCP/UDP), triggered by bug #29345; don't allocate acceptmbox if LWIP_TCP is disabled diff --git a/src/core/init.c b/src/core/init.c index b22b3a83..3ddd49a8 100644 --- a/src/core/init.c +++ b/src/core/init.c @@ -181,8 +181,8 @@ #if LWIP_TCPIP_CORE_LOCKING_INPUT && !LWIP_TCPIP_CORE_LOCKING #error "When using LWIP_TCPIP_CORE_LOCKING_INPUT, LWIP_TCPIP_CORE_LOCKING must be enabled, too" #endif -#if LWIP_TCP && LWIP_NETIF_TX_SINGLE_PBUF && (TCP_OVERSIZE < TCP_MSS) - #error "LWIP_NETIF_TX_SINGLE_PBUF needs TCP_OVERSIZE == TCP_MSS to create single-pbuf TCP packets" +#if LWIP_TCP && LWIP_NETIF_TX_SINGLE_PBUF && !TCP_OVERSIZE + #error "LWIP_NETIF_TX_SINGLE_PBUF needs TCP_OVERSIZE enabled to create single-pbuf TCP packets" #endif diff --git a/src/core/tcp_out.c b/src/core/tcp_out.c index e8e7db7b..a2bce4d2 100644 --- a/src/core/tcp_out.c +++ b/src/core/tcp_out.c @@ -221,6 +221,14 @@ tcp_pbuf_prealloc(pbuf_layer layer, u16_t length, u16_t max_length, struct pbuf *p; u16_t alloc = length; +#if LWIP_NETIF_TX_SINGLE_PBUF + LWIP_UNUSED_ARG(max_length); + LWIP_UNUSED_ARG(pcb); + LWIP_UNUSED_ARG(apiflags); + LWIP_UNUSED_ARG(first_seg); + /* always create MSS-sized pbufs */ + alloc = TCP_MSS; +#else /* LWIP_NETIF_TX_SINGLE_PBUF */ if (length < max_length) { /* Should we allocate an oversized pbuf, or just the minimum * length required? If tcp_write is going to be called again @@ -241,6 +249,7 @@ tcp_pbuf_prealloc(pbuf_layer layer, u16_t length, u16_t max_length, alloc = LWIP_MIN(max_length, LWIP_MEM_ALIGN_SIZE(length + TCP_OVERSIZE)); } } +#endif /* LWIP_NETIF_TX_SINGLE_PBUF */ p = pbuf_alloc(layer, alloc, PBUF_RAM); if (p == NULL) { return NULL;