Detailed Description

Calculating RTO

To calculate retransmission timeout (RTO), Round Trip Time (RTT) needs to be taken into account. SRTT (smoothed round-trip time) and RTTVAR (round-trip time variation) are hence calculated as follows:

RTTVAR <- (1 - beta) * RTTVAR + beta * |SRTT - R'|
SRTT <- (1 - alpha) * SRTT + alpha * R'

where alpha ( 1 / CONFIG_GNRC_TCP_RTO_A_DIV ) and beta ( 1 / CONFIG_GNRC_TCP_RTO_B_DIV) are constants, and R' is the instantaneous RTT value.

RTO is then calculated as :

RTO <- SRTT + max (G, K*RTTVAR)

where K is a constant, and G is clock granularity in seconds ( CONFIG_GNRC_TCP_RTO_GRANULARITY_MS). For more information refer to https://tools.ietf.org/html/rfc6298

#define CONFIG_GNRC_TCP_CONNECTION_TIMEOUT_DURATION_MS   (120U * MS_PER_SEC)
 Timeout duration in milliseconds for user calls. More...
 
#define CONFIG_GNRC_TCP_MSL_MS   (30U * MS_PER_SEC)
 Maximum segment lifetime (MSL) in milliseconds. More...
 
#define CONFIG_GNRC_TCP_MSS   (1220U)
 Maximum Segment Size (MSS). More...
 
#define CONFIG_GNRC_TCP_MSS_MULTIPLICATOR   (1U)
 MSS Multiplicator = Number of MSS sized packets stored in receive buffer.
 
#define CONFIG_GNRC_TCP_DEFAULT_WINDOW   (CONFIG_GNRC_TCP_MSS * CONFIG_GNRC_TCP_MSS_MULTIPLICATOR)
 Default receive window size.
 
#define CONFIG_GNRC_TCP_RCV_BUFFERS   (1U)
 Number of preallocated receive buffers. More...
 
#define GNRC_TCP_RCV_BUF_SIZE   (CONFIG_GNRC_TCP_DEFAULT_WINDOW)
 Default receive buffer size.
 
#define CONFIG_GNRC_TCP_RTO_LOWER_BOUND_MS   (1U * MS_PER_SEC)
 Lower bound for RTO in milliseconds. More...
 
#define CONFIG_GNRC_TCP_RTO_UPPER_BOUND_MS   (60U * MS_PER_SEC)
 Upper bound for RTO in milliseconds. More...
 
#define CONFIG_GNRC_TCP_RTO_GRANULARITY_MS   (10U)
 Clock granularity for TCP in milliseconds. More...
 
#define CONFIG_GNRC_TCP_RTO_A_DIV   (8U)
 Alpha value for RTO calculation, default is 1/8.
 
#define CONFIG_GNRC_TCP_RTO_B_DIV   (4U)
 Beta value for RTO calculation, default is 1/4.
 
#define CONFIG_GNRC_TCP_RTO_K   (4U)
 K value for RTO calculation, default is 4.
 
#define CONFIG_GNRC_TCP_PROBE_LOWER_BOUND_MS   (1U * MS_PER_SEC)
 Lower bound for the duration between probes in milliseconds. More...
 
#define CONFIG_GNRC_TCP_PROBE_UPPER_BOUND_MS   (60U * MS_PER_SEC)
 Upper bound for the duration between probes in milliseconds. More...
 
#define CONFIG_GNRC_TCP_MSG_QUEUE_SIZE_EXP   (2U)
 Message queue size for TCP API internal messaging. More...
 
#define CONFIG_GNRC_TCP_EVENTLOOP_MSG_QUEUE_SIZE_EXP   (3U)
 Message queue size for the TCP eventloop. More...
 
#define CONFIG_GNRC_TCP_EXPERIMENTAL_DYN_MSL_EN   0
 Enable experimental feature "dynamic msl". More...
 
#define CONFIG_GNRC_TCP_EXPERIMENTAL_DYN_MSL_RTO_MUL   (4U)
 Set RTO multiplication factor if experimental feature "dynamic msl" is enabled. More...
 

Macro Definition Documentation

◆ CONFIG_GNRC_TCP_CONNECTION_TIMEOUT_DURATION_MS

#define CONFIG_GNRC_TCP_CONNECTION_TIMEOUT_DURATION_MS   (120U * MS_PER_SEC)

Timeout duration in milliseconds for user calls.

Default is 2 minutes.

Definition at line 58 of file config.h.

◆ CONFIG_GNRC_TCP_EVENTLOOP_MSG_QUEUE_SIZE_EXP

#define CONFIG_GNRC_TCP_EVENTLOOP_MSG_QUEUE_SIZE_EXP   (3U)

Message queue size for the TCP eventloop.

Note
The number of elements in a message queue must be a power of two. This value defines the exponent of 2^n.

Definition at line 185 of file config.h.

◆ CONFIG_GNRC_TCP_EXPERIMENTAL_DYN_MSL_EN

#define CONFIG_GNRC_TCP_EXPERIMENTAL_DYN_MSL_EN   0

Enable experimental feature "dynamic msl".

Disabled by default.

Warning
This feature is experimental!
This feature is experimental because it deviates from the TCP RFC.
Note
This features calculates the MSL based by multiplying the latest retransmission timeout value with CONFIG_GNRC_TCP_EXPERIMENTAL_DYN_MSL_RTO_MUL. This leads to much faster return times on gnrc_tcp_close.

Definition at line 197 of file config.h.

◆ CONFIG_GNRC_TCP_EXPERIMENTAL_DYN_MSL_RTO_MUL

#define CONFIG_GNRC_TCP_EXPERIMENTAL_DYN_MSL_RTO_MUL   (4U)

Set RTO multiplication factor if experimental feature "dynamic msl" is enabled.

Warning
This feature is experimental!
This feature is experimental because it deviates from the TCP RFC.

Definition at line 205 of file config.h.

◆ CONFIG_GNRC_TCP_MSG_QUEUE_SIZE_EXP

#define CONFIG_GNRC_TCP_MSG_QUEUE_SIZE_EXP   (2U)

Message queue size for TCP API internal messaging.

Note
The number of elements in a message queue must be a power of two. This value defines the exponent of 2^n.

Definition at line 176 of file config.h.

◆ CONFIG_GNRC_TCP_MSL_MS

#define CONFIG_GNRC_TCP_MSL_MS   (30U * MS_PER_SEC)

Maximum segment lifetime (MSL) in milliseconds.

Default is 30 seconds.

Definition at line 65 of file config.h.

◆ CONFIG_GNRC_TCP_MSS

#define CONFIG_GNRC_TCP_MSS   (1220U)

Maximum Segment Size (MSS).

If IPv6 is used. Get MSS = 1280 - IPv6 Hdr - TCP Hdr = 1220

Definition at line 73 of file config.h.

◆ CONFIG_GNRC_TCP_PROBE_LOWER_BOUND_MS

#define CONFIG_GNRC_TCP_PROBE_LOWER_BOUND_MS   (1U * MS_PER_SEC)

Lower bound for the duration between probes in milliseconds.

Default is 1 seconds

Definition at line 160 of file config.h.

◆ CONFIG_GNRC_TCP_PROBE_UPPER_BOUND_MS

#define CONFIG_GNRC_TCP_PROBE_UPPER_BOUND_MS   (60U * MS_PER_SEC)

Upper bound for the duration between probes in milliseconds.

Default is 60 seconds

Definition at line 167 of file config.h.

◆ CONFIG_GNRC_TCP_RCV_BUFFERS

#define CONFIG_GNRC_TCP_RCV_BUFFERS   (1U)

Number of preallocated receive buffers.

This value determines how many parallel TCP connections can be active at the same time.

Definition at line 100 of file config.h.

◆ CONFIG_GNRC_TCP_RTO_GRANULARITY_MS

#define CONFIG_GNRC_TCP_RTO_GRANULARITY_MS   (10U)

Clock granularity for TCP in milliseconds.

Default is 10 milliseconds (see RFC 6298)

Definition at line 132 of file config.h.

◆ CONFIG_GNRC_TCP_RTO_LOWER_BOUND_MS

#define CONFIG_GNRC_TCP_RTO_LOWER_BOUND_MS   (1U * MS_PER_SEC)

Lower bound for RTO in milliseconds.

Default is 1 sec (see RFC 6298)

Note
Retransmission Timeout (RTO) determines how long TCP waits for acknowledgment (ACK) of transmitted segment. If the acknowledgment isn't received within this time it is considered lost.

Definition at line 118 of file config.h.

◆ CONFIG_GNRC_TCP_RTO_UPPER_BOUND_MS

#define CONFIG_GNRC_TCP_RTO_UPPER_BOUND_MS   (60U * MS_PER_SEC)

Upper bound for RTO in milliseconds.

Default is 60 sec (see RFC 6298)

Definition at line 125 of file config.h.