Skip to content

Commit

Permalink
tcp: Make retransmission timeout (RTO) configurable
Browse files Browse the repository at this point in the history
  • Loading branch information
ESP-YJM authored and yarrick committed May 9, 2022
1 parent 876517e commit 239918c
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/core/tcp.c
Expand Up @@ -1901,8 +1901,10 @@ 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;
/* Set initial TCP's retransmission timeout to 3000 ms by default.
This value could be configured in lwipopts */
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;
Expand Down
9 changes: 9 additions & 0 deletions src/include/lwip/opt.h
Expand Up @@ -1337,6 +1337,15 @@
#define TCP_CALCULATE_EFF_SEND_MSS 1
#endif

/**
* LWIP_TCP_RTO_TIME: Initial TCP retransmission timeout (ms).
* This defaults to 3 seconds as traditionally defined in the TCP protocol.
* For improving timely recovery on faster networks, this value could
* be lowered down to 1 second (RFC 6298)
*/
#if !defined LWIP_TCP_RTO_TIME || defined __DOXYGEN__
#define LWIP_TCP_RTO_TIME 3000
#endif

/**
* TCP_SND_BUF: TCP sender buffer space (bytes).
Expand Down

0 comments on commit 239918c

Please sign in to comment.