From 305b63209ecb3e7c3c6c0bf20f60d41135e7da8f Mon Sep 17 00:00:00 2001 From: Liu Zhi Fu Date: Fri, 28 Oct 2016 12:03:51 +0800 Subject: [PATCH 1/3] lwip: support max 16 sockets Since the customers need more sockets in their application, support max 16 sockets, in other words, the total socket number of UDP/TCP/RAW sockets should not exceed 16. --- components/lwip/include/lwip/port/lwipopts.h | 32 +++++++++++++++++--- 1 file changed, 28 insertions(+), 4 deletions(-) diff --git a/components/lwip/include/lwip/port/lwipopts.h b/components/lwip/include/lwip/port/lwipopts.h index 75f349280..e72279067 100755 --- a/components/lwip/include/lwip/port/lwipopts.h +++ b/components/lwip/include/lwip/port/lwipopts.h @@ -99,13 +99,37 @@ extern unsigned long os_random(void); * MEMP_NUM_TCP_PCB: the number of simulatenously active TCP connections. * (requires the LWIP_TCP option) */ -#define MEMP_NUM_TCP_PCB 5 /** * MEMP_NUM_NETCONN: the number of struct netconns. * (only needed if you use the sequential API, like api_lib.c) */ -#define MEMP_NUM_NETCONN 10 +#define MEMP_NUM_NETCONN CONFIG_LWIP_MAX_SOCKETS + +/** + * MEMP_NUM_RAW_PCB: Number of raw connection PCBs + * (requires the LWIP_RAW option) + */ +#define MEMP_NUM_RAW_PCB 16 + +/** + * MEMP_NUM_TCP_PCB: the number of simulatenously active TCP connections. + * (requires the LWIP_TCP option) + */ +#define MEMP_NUM_TCP_PCB 16 + +/** + * MEMP_NUM_TCP_PCB_LISTEN: the number of listening TCP connections. + * (requires the LWIP_TCP option) + */ +#define MEMP_NUM_TCP_PCB_LISTEN 16 + +/** + * MEMP_NUM_UDP_PCB: the number of UDP protocol control blocks. One + * per active UDP "connection". + * (requires the LWIP_UDP option) + */ +#define MEMP_NUM_UDP_PCB 16 /* -------------------------------- @@ -542,9 +566,9 @@ extern unsigned char misc_prof_get_tcp_snd_buf(void); * DHCP_DEBUG: Enable debugging in dhcp.c. */ #define DHCP_DEBUG LWIP_DBG_OFF -#define LWIP_DEBUG 0 +#define LWIP_DEBUG LWIP_DBG_OFF #define TCP_DEBUG LWIP_DBG_OFF -#define ESP_THREAD_SAFE_DEBUG LWIP_DBG_OFF +#define ESP_THREAD_SAFE_DEBUG LWIP_DBG_OFF #define CHECKSUM_CHECK_UDP 0 #define CHECKSUM_CHECK_IP 0 From 38ff616e4a46650869fff52441c327dfa129932c Mon Sep 17 00:00:00 2001 From: Liu Zhi Fu Date: Fri, 28 Oct 2016 12:29:26 +0800 Subject: [PATCH 2/3] lwip: add prompt when configure max sockets number in menuconfig --- components/lwip/Kconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/lwip/Kconfig b/components/lwip/Kconfig index 715d7dd46..a957c1fdb 100644 --- a/components/lwip/Kconfig +++ b/components/lwip/Kconfig @@ -1,7 +1,7 @@ menu "LWIP" config LWIP_MAX_SOCKETS - int "Max number of open sockets" + int "Max number of open sockets, the valid value is from 1 to 16" range 1 16 default 4 help From 9e7bc900c51dd31545222dca993e18c2964cb060 Mon Sep 17 00:00:00 2001 From: Liu Zhi Fu Date: Fri, 28 Oct 2016 13:35:06 +0800 Subject: [PATCH 3/3] lwip: rework comments according to review --- components/lwip/Kconfig | 5 +++-- components/lwip/include/lwip/port/lwipopts.h | 4 ---- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/components/lwip/Kconfig b/components/lwip/Kconfig index a957c1fdb..15c94c66b 100644 --- a/components/lwip/Kconfig +++ b/components/lwip/Kconfig @@ -1,13 +1,14 @@ menu "LWIP" config LWIP_MAX_SOCKETS - int "Max number of open sockets, the valid value is from 1 to 16" + int "Max number of open sockets" range 1 16 default 4 help Sockets take up a certain amount of memory, and allowing fewer sockets to be open at the same time conserves memory. Specify - the maximum amount of sockets here. + the maximum amount of sockets here. The valid value is from 1 + to 16. config LWIP_THREAD_LOCAL_STORAGE_INDEX int "Index for thread-local-storage pointer for lwip" diff --git a/components/lwip/include/lwip/port/lwipopts.h b/components/lwip/include/lwip/port/lwipopts.h index e72279067..35c2800ed 100755 --- a/components/lwip/include/lwip/port/lwipopts.h +++ b/components/lwip/include/lwip/port/lwipopts.h @@ -95,10 +95,6 @@ extern unsigned long os_random(void); ---------- Internal Memory Pool Sizes ---------- ------------------------------------------------ */ -/** - * MEMP_NUM_TCP_PCB: the number of simulatenously active TCP connections. - * (requires the LWIP_TCP option) - */ /** * MEMP_NUM_NETCONN: the number of struct netconns.