Make LWIP_NETIF_TX_SINGLE_PBUF work for TCP, too

This commit is contained in:
goldsimon 2010-03-26 16:54:15 +00:00
parent 846a2fb933
commit 3c96819a2c
3 changed files with 14 additions and 2 deletions

View File

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

View File

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

View File

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