From 336c0946fa3c7fdbbaeecfea4056eb57c0917c2c Mon Sep 17 00:00:00 2001 From: Paul Guyot Date: Thu, 2 Nov 2023 07:47:16 +0100 Subject: [PATCH] Add missing configuration for DEFAULT_ACCEPTMBOX_SIZE (fix #12509) Signed-off-by: Paul Guyot --- components/esp_wifi/src/wifi_init.c | 1 + components/lwip/Kconfig | 14 ++++++++++++++ components/lwip/port/include/lwipopts.h | 2 +- tools/ldgen/samples/sdkconfig | 1 + 4 files changed, 17 insertions(+), 1 deletion(-) diff --git a/components/esp_wifi/src/wifi_init.c b/components/esp_wifi/src/wifi_init.c index 73b11acf9a..71614fcd8b 100644 --- a/components/esp_wifi/src/wifi_init.c +++ b/components/esp_wifi/src/wifi_init.c @@ -190,6 +190,7 @@ static void esp_wifi_config_info(void) #endif #ifdef CONFIG_ESP_NETIF_TCPIP_LWIP + ESP_LOGI(TAG, "accept mbox: %d", CONFIG_LWIP_ACCEPTMBOX_SIZE); ESP_LOGI(TAG, "tcpip mbox: %d", CONFIG_LWIP_TCPIP_RECVMBOX_SIZE); ESP_LOGI(TAG, "udp mbox: %d", CONFIG_LWIP_UDP_RECVMBOX_SIZE); ESP_LOGI(TAG, "tcp mbox: %d", CONFIG_LWIP_TCP_RECVMBOX_SIZE); diff --git a/components/lwip/Kconfig b/components/lwip/Kconfig index 6204816fd4..e4a9e4c730 100644 --- a/components/lwip/Kconfig +++ b/components/lwip/Kconfig @@ -665,6 +665,20 @@ menu "LWIP" mail box is full, the LWIP drops the packets. So generally we need to make sure the TCP receive mail box is big enough to avoid packet drop between LWIP core and application. + config LWIP_ACCEPTMBOX_SIZE + int "Default TCP accept mail box size" + default 6 + range 1 64 if !LWIP_WND_SCALE + range 1 255 if LWIP_WND_SCALE + help + Set TCP accept mail box size. Generally bigger value means supporting larger backlogs + but more memory. The recommended value is 6, but applications can set it to a lower value + if listening servers are meant to have a smaller backlog. + + TCP accept mail box is a per socket mail box, when the application listens for connections + with a given listening TCP socket. If the mailbox is full, LWIP will send a RST packet and + the client will fail to connect. + config LWIP_TCP_QUEUE_OOSEQ bool "Queue incoming out-of-order segments" default y diff --git a/components/lwip/port/include/lwipopts.h b/components/lwip/port/include/lwipopts.h index 55ce6558f8..9ca5d87614 100644 --- a/components/lwip/port/include/lwipopts.h +++ b/components/lwip/port/include/lwipopts.h @@ -849,7 +849,7 @@ static inline uint32_t timeout_from_offered(uint32_t lease, uint32_t min) * The queue size value itself is platform-dependent, but is passed to * sys_mbox_new() when the acceptmbox is created. */ -#define DEFAULT_ACCEPTMBOX_SIZE 6 +#define DEFAULT_ACCEPTMBOX_SIZE CONFIG_LWIP_ACCEPTMBOX_SIZE /** * DEFAULT_THREAD_STACKSIZE: The stack size used by any other lwIP thread. diff --git a/tools/ldgen/samples/sdkconfig b/tools/ldgen/samples/sdkconfig index a43ae9db5d..a07b7101f2 100644 --- a/tools/ldgen/samples/sdkconfig +++ b/tools/ldgen/samples/sdkconfig @@ -362,6 +362,7 @@ CONFIG_LWIP_TCP_MSL=60000 CONFIG_LWIP_TCP_SND_BUF_DEFAULT=5744 CONFIG_LWIP_TCP_WND_DEFAULT=5744 CONFIG_LWIP_TCP_RECVMBOX_SIZE=6 +CONFIG_LWIP_ACCEPTMBOX_SIZE=6 CONFIG_LWIP_TCP_QUEUE_OOSEQ=y CONFIG_LWIP_TCP_OVERSIZE_MSS=y CONFIG_LWIP_TCP_OVERSIZE_QUARTER_MSS=