From 6af551606d254c59abcae08092e610477e811ee6 Mon Sep 17 00:00:00 2001 From: EunBong Song Date: Tue, 21 Mar 2017 09:37:55 +0900 Subject: [PATCH] net: add config menus for LwIP memory options This patch is the first patch for adding LwIP configuration. And adds for config menu for LwIP memory options. Change-Id: Ief52429e422e41aebb546e4c56322f4a45fe8244 Signed-off-by: EunBong Song --- .../configs/sidk_s5jt200/sidk_tash_wlan/defconfig | 24 ++++- os/include/net/lwip/lwipopts.h | 88 +++++++++++------ os/net/Kconfig | 4 + os/net/lwip/Kconfig | 108 +++++++++++++++++++++ 4 files changed, 188 insertions(+), 36 deletions(-) create mode 100644 os/net/lwip/Kconfig diff --git a/build/configs/sidk_s5jt200/sidk_tash_wlan/defconfig b/build/configs/sidk_s5jt200/sidk_tash_wlan/defconfig index 9d2d013..91738e4 100755 --- a/build/configs/sidk_s5jt200/sidk_tash_wlan/defconfig +++ b/build/configs/sidk_s5jt200/sidk_tash_wlan/defconfig @@ -625,10 +625,25 @@ CONFIG_NET=y CONFIG_NET_LWIP=y # -# LwIP DHCP options +# LwIP options # -CONFIG_NET_LWIP_DHCPC=y -CONFIG_NET_LWIP_DHCPS=y + +# +# LwIP memory options +# +CONFIG_NET_LWIP_MEM_ALIGNMENT=4 +CONFIG_NET_LWIP_MEM_SIZE=153600 +CONFIG_NET_LWIP_MEMP_OVERFLOW_CHECK=1 +CONFIG_NET_LWIP_MEMP_SANITY_CHECK=y +CONFIG_NET_LWIP_MEMP_NUM_PBUF=50 +CONFIG_NET_LWIP_MEMP_NUM_RAW_PCB=4 +CONFIG_NET_LWIP_MEMP_NUM_UDP_PCB=8 +CONFIG_NET_LWIP_MEMP_NUM_TCP_PCB=8 +CONFIG_NET_LWIP_MEMP_NUM_TCP_PCB_LISTEN=8 +CONFIG_NET_LWIP_MEMP_NUM_TCP_SEG=80 +CONFIG_NET_LWIP_MEMP_NUM_REASSDATA=5 +CONFIG_NET_LWIP_MEMP_NUM_FRAG_PBUF=15 +CONFIG_NET_LWIP_MEMP_NUM_ARP_QUEUE=30 CONFIG_NET_SECURITY_TLS=y # CONFIG_TLS_WITH_SSS is not set CONFIG_NET_NOINTS=y @@ -726,7 +741,6 @@ CONFIG_MTD_PARTITION=y CONFIG_MTD_PARTITION_NAMES=y CONFIG_MTD_PROGMEM=y CONFIG_MTD_CONFIG=y -# CONFIG_MTD_BYTE_WRITE is not set # # MTD Configurations @@ -921,7 +935,6 @@ CONFIG_EXAMPLES_IPERF=y # CONFIG_EXAMPLES_TLS_SELFTEST is not set # CONFIG_EXAMPLES_TLS_SERVER is not set # CONFIG_EXAMPLES_WAKAAMA_CLIENT is not set -# CONFIG_EXAMPLES_WEBCLIENT is not set # CONFIG_EXAMPLES_WORKQUEUE is not set # CONFIG_EXAMPLES_ARTIK_DEMO is not set CONFIG_EXAMPLES_SLSIWIFI=y @@ -952,6 +965,7 @@ CONFIG_SLSI_WIFI_DEFAULT_WLAN_COUNTRY_CODE="00" CONFIG_SLSI_WIFI_DEFAULT_WLAN_TX_POWER=30 CONFIG_SCSC_WLAN=y CONFIG_SCSC_CORE=y +# CONFIG_NETUTILS_MQTT is not set # # Platform-specific Support diff --git a/os/include/net/lwip/lwipopts.h b/os/include/net/lwip/lwipopts.h index dda325c..6c970b9 100644 --- a/os/include/net/lwip/lwipopts.h +++ b/os/include/net/lwip/lwipopts.h @@ -134,50 +134,76 @@ #define MEMP_NUM_TCPIP_INPKT 16 /* ---------- Memory options ---------- */ +#if !defined(CONFIG_NET_LWIP_MEM_ALIGNMENT) +#error "CONFIG_NET_LWIP_MEM_ALIGNMENT is undefined" +#else +#define MEM_ALIGNMENT CONFIG_NET_LWIP_MEM_ALIGNMENT +#endif + +#if !defined(CONFIG_NET_LWIP_MEM_SIZE) +#error "CONFIG_NET_LWIP_MEM_SIZE is undefined" +#else +#define MEM_SIZE CONFIG_NET_LWIP_MEM_SIZE +#endif + +#ifdef CONFIG_NET_LWIP_MEMP_OVERFLOW_CHECK +#define MEMP_OVERFLOW_CHECK CONFIG_NET_LWIP_MEMP_OVERFLOW_CHECK +#else +#define MEMP_OVERFLOW_CHECK 0 +#endif + +#ifdef CONFIG_NET_LWIP_MEMP_SANITY_CHECK +#define MEMP_SANITY_CHECK 1 +#else +#define MEMP_SANITY_CHECK 0 +#endif + +#define MEMP_MEM_MALLOC 1 + +#ifdef CONFIG_NET_LWIP_MEMP_NUM_PBUF +#define MEMP_NUM_PBUF CONFIG_NET_LWIP_MEMP_NUM_PBUF +#endif + +#ifdef CONFIG_NET_LWIP_MEMP_NUM_RAW_PCB +#define MEMP_NUM_RAW_PCB CONFIG_NET_LWIP_MEMP_NUM_RAW_PCB +#endif + +#ifdef CONFIG_NET_LWIP_MEMP_NUM_UDP_PCB +#define MEMP_NUM_UDP_PCB CONFIG_NET_LWIP_MEMP_NUM_UDP_PCB +#endif -/* MEM_ALIGNMENT: should be set to the alignment of the CPU for which - lwIP is compiled. 4 byte alignment -> define MEM_ALIGNMENT to 4, 2 - byte alignment -> define MEM_ALIGNMENT to 2. */ -#define MEM_ALIGNMENT 4 -/* MEM_SIZE: the size of the heap memory. If the application will send -a lot of data that needs to be copied, this should be set high. */ -#define MEM_SIZE (150*1024) +#ifdef CONFIG_NET_LWIP_MEMP_NUM_TCP_PCB +#define MEMP_NUM_TCP_PCB CONFIG_NET_LWIP_MEMP_NUM_TCP_PCB +#endif + +#ifdef CONFIG_NET_LWIP_MEMP_NUM_TCP_PCB_LISTEN +#define MEMP_NUM_TCP_PCB_LISTEN CONFIG_NET_LWIP_MEMP_NUM_TCP_PCB_LISTEN +#endif -/* MEMP_NUM_PBUF: the number of memp struct pbufs. If the application - sends a lot of data out of ROM (or other static memory), this - should be set high. */ -#define MEMP_NUM_PBUF 50 +#ifdef CONFIG_NET_LWIP_MEMP_NUM_TCP_SEG +#define MEMP_NUM_TCP_SEG CONFIG_NET_LWIP_MEMP_NUM_TCP_SEG +#endif -/* MEMP_NUM_UDP_PCB: the number of UDP protocol control blocks. One - per active UDP "connection". */ -#define MEMP_NUM_UDP_PCB 8 +#ifdef CONFIG_NET_LWIP_MEMP_NUM_REASSDATA +#define MEMP_NUM_REASSDATA CONFIG_NET_LWIP_MEMP_NUM_REASSDATA +#endif -/* MEMP_NUM_TCP_PCB: the number of simulatenously active TCP - connections. */ -#define MEMP_NUM_TCP_PCB 8 +#ifdef CONFIG_NET_LWIP_MEMP_NUM_FRAG_PBUF +#define MEMP_NUM_FRAG_PBUF CONFIG_NET_LWIP_MEMP_NUM_FRAG_PBUF +#endif -/* MEMP_NUM_TCP_PCB_LISTEN: the number of listening TCP - connections. */ -#define MEMP_NUM_TCP_PCB_LISTEN 8 +#ifdef CONFIG_NET_LWIP_MEMP_NUM_ARP_QUEUE +#define MEMP_NUM_ARP_QUEUE CONFIG_NET_LWIP_MEMP_NUM_ARP_QUEUE +#endif +/* ---------- Memory options ---------- */ -/* MEMP_NUM_TCP_SEG: the number of simultaneously queued TCP - segments. */ -#define MEMP_NUM_TCP_SEG (2 * TCP_SND_QUEUELEN) /* ---------- Pbuf options ---------- */ /* PBUF_POOL_SIZE: the number of buffers in the pbuf pool. */ #define PBUF_POOL_SIZE 50 -/* -* MEMP_MEM_MALLOC==1: Use mem_malloc/mem_free instead of the lwip pool allocator. -* Especially useful with MEM_LIBC_MALLOC but handle with care regarding execution -* speed and usage from interrupts! -*/ -#define MEMP_MEM_MALLOC 1 -#define MEMP_OVERFLOW_CHECK 1 -#define MEMP_SANITY_CHECK 1 /* ------------------------------------ diff --git a/os/net/Kconfig b/os/net/Kconfig index 4756cde..bf62019 100644 --- a/os/net/Kconfig +++ b/os/net/Kconfig @@ -29,6 +29,10 @@ config NET_LWIP endchoice +if NET_LWIP +source net/lwip/Kconfig +endif #NET_LWIP + config NET_SECURITY_TLS bool "TLS Support" default n diff --git a/os/net/lwip/Kconfig b/os/net/lwip/Kconfig new file mode 100644 index 0000000..43df315 --- /dev/null +++ b/os/net/lwip/Kconfig @@ -0,0 +1,108 @@ +# +# For a description of the syntax of this configuration file, +# see kconfig-language at https://www.kernel.org/doc/Documentation/kbuild/kconfig-language.txt +# + +menu "LwIP options" + +menu "LwIP memory options" + +config NET_LWIP_MEM_ALIGNMENT + int "Memory alignment size" + default 4 + ---help--- + should be set to the alignment of the CPU + +config NET_LWIP_MEM_SIZE + int "Size of LwIP memory pool" + default 1600 + ---help--- + the size of the heap memory. If the application will send + a lot of data that needs to be copied, this should be set high. + +config NET_LWIP_MEMP_OVERFLOW_CHECK + int "Memory pool overflow protection" + default 0 + ---help--- + memp overflow protection reserves a configurable amount of bytes + before and after each memp element in every pool and fills + it with a prominent default value. + if 0, no checking + if 1, checks each element when it is freed + if 2, checks each element in every pool every time memp_malloc() + or memp_free() is called (useful but slow!) + +config NET_LWIP_MEMP_SANITY_CHECK + bool "Memory pool sanity check" + default n + ---help--- + run a sanity check after each memp_free() to make sure that + there are no cycles in the linked lists. + +config NET_LWIP_MEMP_NUM_PBUF + int "Number of Pbufs" + default 16 + ---help--- + The number of memp struct pbufs (used for PBUF_ROM and PBUF_REF). + If the application sends a lot of data out of ROM (or other static memory), + this should be set high. + +config NET_LWIP_MEMP_NUM_RAW_PCB + int "Number of raw connection PCBs" + default 4 + depends on NET_LWIP_RAW + ---help--- + Number of raw connection PCBs + +config NET_LWIP_MEMP_NUM_UDP_PCB + int "Number of udp connection PCBs" + default 4 + depends on NET_LWIP_UDP + ---help--- + Number of udp connection PCBs + +config NET_LWIP_MEMP_NUM_TCP_PCB + int "Number of tcp connection PCBs" + default 5 + depends on NET_LWIP_TCP + ---help--- + Number of tcp connection PCBs + +config NET_LWIP_MEMP_NUM_TCP_PCB_LISTEN + int "Number of listening tcp connections" + default 5 + depends on NET_LWIP_TCP + ---help--- + Number of simultaneously queued TCP segments + +config NET_LWIP_MEMP_NUM_TCP_SEG + int "Number of simultaneously queued TCP segments" + default 16 + depends on NET_LWIP_TCP + ---help--- + Number of simultaneously queued TCP segments + +config NET_LWIP_MEMP_NUM_REASSDATA + int "Number of IP reassemble packets" + default 5 + ---help--- + Number of IP fragments simultaneously sent + for reassembly (whole packets, not fragments!) + +config NET_LWIP_MEMP_NUM_FRAG_PBUF + int "Number of IP fragments packets" + default 15 + ---help--- + Number of IP fragments simultaneously sent + (fragments, not whole packets!). + +config NET_LWIP_MEMP_NUM_ARP_QUEUE + int "Maximum number of waiting arp request packet" + default 30 + ---help--- + Number of simultaneously queued outgoing packets (pbufs) + that are waiting for an ARP request (to resolve their + destination address) to finish. + +endmenu #LwIP memory options +endmenu #LwIP options \ No newline at end of file -- 2.7.4