Loading...
Searching...
No Matches

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.
 
#define CONFIG_GNRC_TCP_MSL_MS   (30U * MS_PER_SEC)
 Maximum segment lifetime (MSL) in milliseconds.
 
#define CONFIG_GNRC_TCP_MSS   (1220U)
 Maximum Segment Size (MSS).
 
#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.
 
#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.
 
#define CONFIG_GNRC_TCP_RTO_UPPER_BOUND_MS   (60U * MS_PER_SEC)
 Upper bound for RTO in milliseconds.
 
#define CONFIG_GNRC_TCP_RTO_GRANULARITY_MS   (10U)
 Clock granularity for TCP in milliseconds.
 
#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.
 
#define CONFIG_GNRC_TCP_PROBE_UPPER_BOUND_MS   (60U * MS_PER_SEC)
 Upper bound for the duration between probes in milliseconds.
 
#define CONFIG_GNRC_TCP_MSG_QUEUE_SIZE_EXP   (2U)
 Message queue size for TCP API internal messaging.
 
#define CONFIG_GNRC_TCP_EVENTLOOP_MSG_QUEUE_SIZE_EXP   (3U)
 Message queue size for the TCP eventloop.
 
#define CONFIG_GNRC_TCP_EXPERIMENTAL_DYN_MSL_EN   0
 Enable experimental feature "dynamic msl".
 
#define CONFIG_GNRC_TCP_EXPERIMENTAL_DYN_MSL_RTO_MUL   (4U)
 Set RTO multiplication factor if experimental feature "dynamic msl" is enabled.
 

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 59 of file config.h.

◆ CONFIG_GNRC_TCP_DEFAULT_WINDOW

#define CONFIG_GNRC_TCP_DEFAULT_WINDOW   (CONFIG_GNRC_TCP_MSS * CONFIG_GNRC_TCP_MSS_MULTIPLICATOR)

Default receive window size.

Definition at line 91 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 186 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 198 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 206 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 177 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 66 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 74 of file config.h.

◆ CONFIG_GNRC_TCP_MSS_MULTIPLICATOR

#define CONFIG_GNRC_TCP_MSS_MULTIPLICATOR   (1U)

MSS Multiplicator = Number of MSS sized packets stored in receive buffer.

Definition at line 84 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 161 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 168 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 101 of file config.h.

◆ CONFIG_GNRC_TCP_RTO_A_DIV

#define CONFIG_GNRC_TCP_RTO_A_DIV   (8U)

Alpha value for RTO calculation, default is 1/8.

Definition at line 140 of file config.h.

◆ CONFIG_GNRC_TCP_RTO_B_DIV

#define CONFIG_GNRC_TCP_RTO_B_DIV   (4U)

Beta value for RTO calculation, default is 1/4.

Definition at line 147 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 133 of file config.h.

◆ CONFIG_GNRC_TCP_RTO_K

#define CONFIG_GNRC_TCP_RTO_K   (4U)

K value for RTO calculation, default is 4.

Definition at line 154 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 119 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 126 of file config.h.

◆ GNRC_TCP_RCV_BUF_SIZE

#define GNRC_TCP_RCV_BUF_SIZE   (CONFIG_GNRC_TCP_DEFAULT_WINDOW)

Default receive buffer size.

Definition at line 108 of file config.h.