From 6dc3a2108ad040ba225c0c46e5c4e0f41455e6d2 Mon Sep 17 00:00:00 2001 From: Joel Cunningham Date: Fri, 11 Nov 2016 15:59:03 -0600 Subject: [PATCH] WND_SCALE: duplicate define check & doc cleanup This commit cleans up a duplicate #if check for LWIP_WND_SCALE in init.c which was already under #if LWIP_WND_SCALE This commit also improves documentation for TCP_WND in the window scaling case to communicate TCP_WND is always the calculated (scaled) window value, not the value reported in the TCP header Our developers were confused by having to set both the window and scaling factor and only after studying the usage of TCP_WND throughout the code, was it determined to be the calculated (scaled) window --- src/core/init.c | 2 +- src/include/lwip/opt.h | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/core/init.c b/src/core/init.c index 0eb1e44c..570d54aa 100644 --- a/src/core/init.c +++ b/src/core/init.c @@ -141,7 +141,7 @@ PACK_STRUCT_END #if (LWIP_TCP && (TCP_WND > 0xffffffff)) #error "If you want to use TCP, TCP_WND must fit in an u32_t, so, you have to reduce it in your lwipopts.h" #endif -#if (LWIP_TCP && LWIP_WND_SCALE && (TCP_RCV_SCALE > 14)) +#if (LWIP_TCP && (TCP_RCV_SCALE > 14)) #error "The maximum valid window scale value is 14!" #endif #if (LWIP_TCP && (TCP_WND > (0xFFFFU << TCP_RCV_SCALE))) diff --git a/src/include/lwip/opt.h b/src/include/lwip/opt.h index 0db03b50..61305016 100644 --- a/src/include/lwip/opt.h +++ b/src/include/lwip/opt.h @@ -1128,7 +1128,10 @@ /** * TCP_WND: The size of a TCP window. This must be at least - * (2 * TCP_MSS) for things to work well + * (2 * TCP_MSS) for things to work well. + * ATTENTION: when using TCP_RCV_SCALE, TCP_WND is the total size + * with scaling applied. Maximum window value in the TCP header + * will be TCP_WND >> TCP_RCV_SCALE */ #if !defined TCP_WND || defined __DOXYGEN__ #define TCP_WND (4 * TCP_MSS)