From e3817cd549a26c6794b77d6c523f444beaf475b3 Mon Sep 17 00:00:00 2001 From: goldsimon Date: Sat, 20 Nov 2010 17:34:10 +0000 Subject: [PATCH] Fixed bug #31535: TCP_SND_QUEUELEN must be at least 2 or else no-copy TCP writes will never succeed. --- CHANGELOG | 6 +++++- src/core/init.c | 3 +++ src/include/lwip/opt.h | 2 +- 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index e74c8f88..0ce03086 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -229,10 +229,14 @@ HISTORY ++ Bugfixes: + 2010-11-20: Simon Goldschmidt + * dns.c: Fixed bug #31535: TCP_SND_QUEUELEN must be at least 2 or else + no-copy TCP writes will never succeed. + 2010-11-20: Simon Goldschmidt * dns.c: Fixed bug #31701: Error return value from dns_gethostbyname() does not match documentation: return ERR_ARG instead of ERR_VAL if not - initialized or wrong argument. + initialized or wrong argument. 2010-10-20: Simon Goldschmidt * sockets.h: Fixed bug #31385: sizeof(struct sockaddr) is 30 but should be 16 diff --git a/src/core/init.c b/src/core/init.c index 949934ae..bf5c79da 100644 --- a/src/core/init.c +++ b/src/core/init.c @@ -105,6 +105,9 @@ #if (LWIP_TCP && (TCP_SND_QUEUELEN > 0xffff)) #error "If you want to use TCP, TCP_SND_QUEUELEN must fit in an u16_t, so, you have to reduce it in your lwipopts.h" #endif +#if (LWIP_TCP && (TCP_SND_QUEUELEN < 2)) + #error "TCP_SND_QUEUELEN must be at least 2 for no-copy TCP writes to work" +#endif #if (LWIP_TCP && ((TCP_MAXRTX > 12) || (TCP_SYNMAXRTX > 12))) #error "If you want to use TCP, TCP_MAXRTX and TCP_SYNMAXRTX must less or equal to 12 (due to tcp_backoff table), so, you have to reduce them in your lwipopts.h" #endif diff --git a/src/include/lwip/opt.h b/src/include/lwip/opt.h index c5e3967e..05912003 100644 --- a/src/include/lwip/opt.h +++ b/src/include/lwip/opt.h @@ -954,7 +954,7 @@ * as much as (2 * TCP_SND_BUF/TCP_MSS) for things to work. */ #ifndef TCP_SND_QUEUELEN -#define TCP_SND_QUEUELEN (4 * (TCP_SND_BUF)/(TCP_MSS)) +#define TCP_SND_QUEUELEN ((4 * (TCP_SND_BUF) + (TCP_MSS - 1))/(TCP_MSS)) #endif /**