Merge branch 'feature/lwip_expose_more_config' into 'master'

lwip: Expose more config in IDF menuconfig

See merge request !909
This commit is contained in:
Ivan Grokhotkov 2017-06-27 12:53:42 +08:00
commit 3f8f618df5
6 changed files with 133 additions and 8 deletions

View File

@ -345,6 +345,19 @@ static esp_err_t esp_system_event_debug(system_event_t *event)
MAC2STR(ap_probereqrecved->mac));
break;
}
case SYSTEM_EVENT_AP_STA_GOT_IP6: {
ip6_addr_t *addr = &event->event_info.got_ip6.ip6_info.ip;
ESP_LOGD(TAG, "SYSTEM_EVENT_AP_STA_GOT_IP6 address %04x:%04x:%04x:%04x:%04x:%04x:%04x:%04x",
IP6_ADDR_BLOCK1(addr),
IP6_ADDR_BLOCK2(addr),
IP6_ADDR_BLOCK3(addr),
IP6_ADDR_BLOCK4(addr),
IP6_ADDR_BLOCK5(addr),
IP6_ADDR_BLOCK6(addr),
IP6_ADDR_BLOCK7(addr),
IP6_ADDR_BLOCK8(addr));
break;
}
case SYSTEM_EVENT_ETH_START: {
ESP_LOGD(TAG, "SYSTEM_EVENT_ETH_START");
break;
@ -367,7 +380,7 @@ static esp_err_t esp_system_event_debug(system_event_t *event)
}
default: {
ESP_LOGW(TAG, "no such kind of event!");
ESP_LOGW(TAG, "unexpected system event %d!", event->event_id);
break;
}
}

View File

@ -68,6 +68,8 @@ config LWIP_IP_REASSEMBLY
help
Enabling this option allows reassemblying incoming fragmented IP packets.
menu "TCP"
config TCP_MAXRTX
int "Maximum number of retransmissions of data segments"
default 12
@ -82,6 +84,79 @@ config TCP_SYNMAXRTX
help
Set maximum number of retransmissions of SYN segments.
config TCP_MSS
int "Maximum Segment Size (MSS)"
default 1436
range 1220 1436
help
Set maximum segment size for TCP transmission.
Can be set lower to save RAM, the default value 1436 will give best throughput.
config TCP_SND_BUF_DEFAULT
int "Default send buffer size"
default 5744 # 4 * default MSS
range 2440 65535
help
Set default send buffer size for new TCP sockets.
Per-socket send buffer size can be changed at runtime
with lwip_setsockopt(s, TCP_SNDBUF, ...).
This value must be at least 2x the MSS size, and the default
is 4x the default MSS size.
Setting a smaller default SNDBUF size can save some RAM, but
will decrease performance.
config TCP_WND_DEFAULT
int "Default receive window size"
default 5744 # 4 * default MSS
range 2440 65535
help
Set default TCP receive window size for new TCP sockets.
Per-socket receive window size can be changed at runtime
with lwip_setsockopt(s, TCP_WINDOW, ...).
Setting a smaller default receive window size can save some RAM,
but will significantly decrease performance.
config TCP_QUEUE_OOSEQ
bool "Queue incoming out-of-order segments"
default y
help
Queue incoming out-of-order segments for later use.
Disable this option to save some RAM during TCP sessions, at the expense
of increased retransmissions if segments arrive out of order.
choice TCP_OVERSIZE
prompt "Pre-allocate transmit PBUF size"
default TCP_OVERSIZE_MSS
help
Allows enabling "oversize" allocation of TCP transmission pbufs ahead of time,
which can reduce the length of pbuf chains used for transmission.
This will not make a difference to sockets where Nagle's algorithm
is disabled.
Default value of MSS is fine for most applications, 25% MSS may save
some RAM when only transmitting small amounts of data. Disabled will
have worst performance and fragmentation characteristics, but uses
least RAM overall.
config TCP_OVERSIZE_MSS
bool "MSS"
config TCP_OVERSIZE_QUARTER_MSS
bool "25% MSS"
config TCP_OVERSIZE_DISABLE
bool "Disabled"
endchoice
endmenu # TCP
config LWIP_DHCP_DOES_ARP_CHECK
bool "Enable an ARP check on the offered address"
default y
@ -139,4 +214,16 @@ config PPP_DEBUG_ON
help
Enable PPP debug log output
menu "ICMP"
config LWIP_MULTICAST_PING
bool "Respond to multicast pings"
default n
config LWIP_BROADCAST_PING
bool "Respond to broadcast pings"
default n
endmenu # ICMP
endmenu

View File

@ -69,7 +69,7 @@
#include "lwip/memp.h"
#include "lwip/pbuf.h"
#include "lwip/sys.h"
#if LWIP_TCP && TCP_QUEUE_OOSEQ
#if LWIP_TCP && (TCP_QUEUE_OOSEQ || ESP_LWIP)
#include "lwip/priv/tcp_priv.h"
#endif
#if LWIP_CHECKSUM_ON_COPY

View File

@ -69,8 +69,9 @@ typedef int sys_prot_t;
#define LWIP_PLATFORM_DIAG(x) do {printf x;} while(0)
#define LWIP_PLATFORM_ASSERT(x) do {printf(x); sys_arch_assert(__FILE__, __LINE__);} while(0)
//#define LWIP_DEBUG
#ifdef NDEBUG
#define LWIP_NOASSERT
#endif
//#define LWIP_ERROR
#endif /* __ARCH_CC_H__ */

View File

@ -184,6 +184,10 @@
----------------------------------
*/
#define LWIP_BROADCAST_PING CONFIG_LWIP_BROADCAST_PING
#define LWIP_MULTICAST_PING CONFIG_LWIP_MULTICAST_PING
/*
---------------------------------
---------- RAW options ----------
@ -280,7 +284,7 @@
* TCP_QUEUE_OOSEQ==1: TCP will queue segments that arrive out of order.
* Define to 0 if your device is low on memory.
*/
#define TCP_QUEUE_OOSEQ 1
#define TCP_QUEUE_OOSEQ CONFIG_TCP_QUEUE_OOSEQ
/*
* LWIP_EVENT_API==1: The user defines lwip_tcp_event() to receive all
@ -288,7 +292,7 @@
* LWIP_CALLBACK_API==1: The PCB callback function is called directly
* for the event. This is the default.
*/
#define TCP_MSS 1460
#define TCP_MSS CONFIG_TCP_MSS
/**
* TCP_MAXRTX: Maximum number of retransmissions of data segments.
@ -305,6 +309,24 @@
*/
#define TCP_LISTEN_BACKLOG 1
/**
* TCP_OVERSIZE: The maximum number of bytes that tcp_write may
* allocate ahead of time
*/
#ifdef CONFIG_TCP_OVERSIZE_MSS
#define TCP_OVERSIZE TCP_MSS
#endif
#ifdef CONFIG_TCP_OVERSIZE_QUARTER_MSS
#define TCP_OVERSIZE (TCP_MSS/4)
#endif
#ifdef CONFIG_TCP_OVERSIZE_DISABLE
#define TCP_OVERSIZE 0
#endif
#ifndef TCP_OVERSIZE
#error "One of CONFIG_TCP_OVERSIZE_xxx options should be set by sdkconfig"
#endif
/*
----------------------------------
---------- Pbuf options ----------
@ -669,8 +691,8 @@
#define ESP_DHCP_TIMER 1
#define ESP_LWIP_LOGI(...) ESP_LOGI("lwip", __VA_ARGS__)
#define TCP_WND_DEFAULT (4*TCP_MSS)
#define TCP_SND_BUF_DEFAULT (4*TCP_MSS)
#define TCP_WND_DEFAULT CONFIG_TCP_WND_DEFAULT
#define TCP_SND_BUF_DEFAULT CONFIG_TCP_SND_BUF_DEFAULT
#if ESP_PERF
#define DBG_PERF_PATH_SET(dir, point)

View File

@ -110,9 +110,11 @@ static void dbg_lwip_tcp_pcb_one_show(struct tcp_pcb* pcb)
seg = pcb->unacked;
DBG_LWIP_SEG_SHOW(seg);
ESP_LWIP_LOGI("ooseg semengts:");
#if TCP_QUEUE_OOSEQ
ESP_LWIP_LOGI("ooseq segments:");
seg = pcb->ooseq;
DBG_LWIP_SEG_SHOW(seg);
#endif
ESP_LWIP_LOGI("refused data=%p", pcb->refused_data);