From c966dd04da252ebc1ab5e1b947a584611ad85a79 Mon Sep 17 00:00:00 2001 From: Zhang Jun Hao Date: Tue, 31 Jul 2018 11:06:25 +0800 Subject: [PATCH] feat(lwip): make tcp fast timer to 125ms and make rto to 250ms --- components/lwip/lwip/src/core/tcp.c | 5 +++++ components/lwip/lwip/src/include/lwip/priv/tcp_priv.h | 4 ++++ components/lwip/port/esp8266/include/lwipopts.h | 1 + 3 files changed, 10 insertions(+) diff --git a/components/lwip/lwip/src/core/tcp.c b/components/lwip/lwip/src/core/tcp.c index b5144d2f..1ba69ace 100644 --- a/components/lwip/lwip/src/core/tcp.c +++ b/components/lwip/lwip/src/core/tcp.c @@ -108,8 +108,13 @@ static u16_t tcp_port = TCP_LOCAL_PORT_RANGE_START; /* Incremented every coarse grained timer shot (typically every 500 ms). */ u32_t tcp_ticks; +#if TCP_HIGH_SPEED_RETRANSMISSION +static const u8_t tcp_backoff[13] = + { 0, 0, 0, 0, 0, 0, 1, 2, 3, 4, 5, 6, 7}; +#else static const u8_t tcp_backoff[13] = { 1, 2, 3, 4, 5, 6, 7, 7, 7, 7, 7, 7, 7}; +#endif /* Times per slowtmr hits */ static const u8_t tcp_persist_backoff[7] = { 3, 6, 12, 24, 48, 96, 120 }; diff --git a/components/lwip/lwip/src/include/lwip/priv/tcp_priv.h b/components/lwip/lwip/src/include/lwip/priv/tcp_priv.h index 73e8967e..b2c98f9e 100644 --- a/components/lwip/lwip/src/include/lwip/priv/tcp_priv.h +++ b/components/lwip/lwip/src/include/lwip/priv/tcp_priv.h @@ -114,7 +114,11 @@ err_t tcp_process_refused_data(struct tcp_pcb *pcb); #define TCP_SEQ_BETWEEN(a,b,c) (TCP_SEQ_GEQ(a,b) && TCP_SEQ_LEQ(a,c)) #ifndef TCP_TMR_INTERVAL +#if TCP_HIGH_SPEED_RETRANSMISSION +#define TCP_TMR_INTERVAL 125 /* The TCP timer interval in milliseconds. */ +#else #define TCP_TMR_INTERVAL 250 /* The TCP timer interval in milliseconds. */ +#endif #endif /* TCP_TMR_INTERVAL */ #ifndef TCP_FAST_INTERVAL diff --git a/components/lwip/port/esp8266/include/lwipopts.h b/components/lwip/port/esp8266/include/lwipopts.h index 97da94dc..aaa9c1f3 100644 --- a/components/lwip/port/esp8266/include/lwipopts.h +++ b/components/lwip/port/esp8266/include/lwipopts.h @@ -62,6 +62,7 @@ //#define SOCKETS_TCP_TRACE +#define TCP_HIGH_SPEED_RETRANSMISSION CONFIG_TCP_HIGH_SPEED_RETRANSMISSION /* ------------------------------------