net: lwip: Fix PBUF_POOL_BUFSIZE when PROT_TCP_LWIP is disabled
PATCH 1/1 net: lwip: Fix PBUF_POOL_BUFSIZE when PROT_TCP_LWIP is disabled
The PBUF_POOL_BUFSIZE ends up being only 592 bytes, instead of 1514, when PROT_TCP_LWIP Kconfig option is disabled. This results in a full Ethernet frame requiring three PBUFs instead of just one.
This happens because the PBUF_POOL_BUFSIZE constants depends on the value of a TCP_MSS constant, something that defaults to 536 when PROT_TCP_LWIP=n.
PBUF_POOL_BUFSIZE = LWIP_MEM_ALIGN_SIZE(TCP_MSS + 40 + PBUF_LINK_HLEN)
Ensure that a full Ethernet frame fits inside a single PBUF by moving the define of TCP_MSS outside the PROT_TCP_LWIP ifdef block.
--- lib/lwip/u-boot/lwipopts.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
lib/lwip/u-boot/lwipopts.h +1 -1
@@ -121,9 +121,9 @@#define LWIP_UDP 0#endif +#define TCP_MSS 1460#if defined(CONFIG_PROT_TCP_LWIP )#define LWIP_TCP 1 -#define TCP_MSS 1460#define TCP_WND CONFIG_LWIP_TCP_WND#define LWIP_WND_SCALE 1#define TCP_RCV_SCALE 0x7
Signature · 1 line
2.53.0
Hi Jonas,
Quoted 24 lines · Jonas Karlman
The
PBUF_POOL_BUFSIZEends up being only 592 bytes, instead of 1514, whenPROT_TCP_LWIPKconfigoption is disabled. This results in a full Ethernet frame requiring three PBUFs instead of just one.This happens because the
PBUF_POOL_BUFSIZEconstants depends on the value of aTCP_MSSconstant, something that defaults to 536 when PROT_TCP_LWIP=n.
PBUF_POOL_BUFSIZE=LWIP_MEM_ALIGN_SIZE(TCP_MSS + 40 + PBUF_LINK_HLEN)Ensure that a full Ethernet frame fits inside a single PBUF by moving the define of
TCP_MSSoutside thePROT_TCP_LWIPifdef block.Fixes 1c41a7afaa15 ("net: lwip: build lwIP")Signed-off-by Jonas Karlman <[email protected]>--- lib/lwip/u-boot/lwipopts.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)lib/lwip/u-boot/lwipopts.h +0
-0
lib/lwip/u-boot/lwipopts.h line 124
Quoted 4 lines
lib/lwip/u-boot/lwipopts.h +1
-0@@ -121,9 +121,9 @@#define LWIP_UDP 0#endif +#define TCP_MSS 1460
LGTM, but I would appreciate a comment here, Something like:
/*
* PBUF_POOL_BUFSIZE is derived from TCP_MSS even when
* CONFIG_PROT_TCP_LWIP is not defined
*/
With that:
Quoted 6 lines
lib/lwip/u-boot/lwipopts.h +0
-1#if defined(CONFIG_PROT_TCP_LWIP )#define LWIP_TCP 1 -#define TCP_MSS 1460#define TCP_WND CONFIG_LWIP_TCP_WND#define LWIP_WND_SCALE 1#define TCP_RCV_SCALE 0x7