diff --git a/components/lwip/Kconfig b/components/lwip/Kconfig index 0006c006..3f442249 100644 --- a/components/lwip/Kconfig +++ b/components/lwip/Kconfig @@ -479,6 +479,13 @@ config LWIP_TCP_TIMESTAMPS really used locally. Therefore, it is only enabled when a TS option is received in the initial SYN packet from a remote host. +config LWIP_TCP_RTO_TIME + int "Default TCP RTO TIME" + default 1000 + help + Set default TCP RTO time for a reasonable initial RTO. + Advise to set initial RTO to 1 second + endmenu # TCP menu "UDP" diff --git a/components/lwip/lwip/src/core/tcp.c b/components/lwip/lwip/src/core/tcp.c index fba9d99e..3af362d7 100644 --- a/components/lwip/lwip/src/core/tcp.c +++ b/components/lwip/lwip/src/core/tcp.c @@ -1630,8 +1630,9 @@ tcp_alloc(u8_t prio) /* As initial send MSS, we use TCP_MSS but limit it to 536. The send MSS is updated when an MSS option is received. */ pcb->mss = INITIAL_MSS; - pcb->rto = 3000 / TCP_SLOW_INTERVAL; - pcb->sv = 3000 / TCP_SLOW_INTERVAL; + /* make TCP's retransmission time to be configurable */ + pcb->rto = LWIP_TCP_RTO_TIME / TCP_SLOW_INTERVAL; + pcb->sv = LWIP_TCP_RTO_TIME / TCP_SLOW_INTERVAL; pcb->rtime = -1; pcb->cwnd = 1; pcb->tmr = tcp_ticks; diff --git a/components/lwip/lwip/src/include/lwip/opt.h b/components/lwip/lwip/src/include/lwip/opt.h index 8f8b0777..634ae70b 100644 --- a/components/lwip/lwip/src/include/lwip/opt.h +++ b/components/lwip/lwip/src/include/lwip/opt.h @@ -1350,6 +1350,11 @@ #define LWIP_WND_SCALE 0 #define TCP_RCV_SCALE 0 #endif + +#if !defined LWIP_TCP_RTO_TIME || defined __DOXYGEN__ +#define LWIP_TCP_RTO_TIME 3000 +#endif + /** * @} */ diff --git a/components/lwip/port/esp8266/include/lwipopts.h b/components/lwip/port/esp8266/include/lwipopts.h index 970ac342..60eaf9e7 100644 --- a/components/lwip/port/esp8266/include/lwipopts.h +++ b/components/lwip/port/esp8266/include/lwipopts.h @@ -1097,6 +1097,12 @@ size_t memp_malloc_get_size(size_t type); */ #define LWIP_WND_SCALE 0 #define TCP_RCV_SCALE 0 + +/** + * LWIP_TCP_RTO_TIME: make TCP RTO time configurable. + * Default is 1 second. + */ +#define LWIP_TCP_RTO_TIME CONFIG_LWIP_TCP_RTO_TIME /** * @} */