mirror of
https://github.com/apache/nuttx.git
synced 2026-05-31 23:40:19 +08:00
net/tcp: add kconfig to support retransmission at a fixed time
Build Documentation / build-html (push) Has been cancelled
Build Documentation / build-html (push) Has been cancelled
the maximum retransmission interval allowed for car projects cannot exceed 6 seconds, and allows for fixed retransmission intervals. according to the previous algorithm, the retransmission interval may be 0.5 * 2 ^ 4 = 8 seconds, which does not meet the requirements. Signed-off-by: zhanghongyu <zhanghongyu@xiaomi.com>
This commit is contained in:
+15
-1
@@ -105,7 +105,21 @@ config NET_TCP_RTO
|
|||||||
int "RTO of TCP/IP connections"
|
int "RTO of TCP/IP connections"
|
||||||
default 3
|
default 3
|
||||||
---help---
|
---help---
|
||||||
RTO of TCP/IP connections (all tasks)
|
Default retransmission timeout (RTO) of TCP/IP connections (all tasks).
|
||||||
|
In units of half seconds. When the same data packet is retransmitted
|
||||||
|
multiple times due to timeout, the RTO will be doubled. but the maximum
|
||||||
|
RTO is NET_TCP_RTO * 16. When this packet is ACKed, the RTO will be
|
||||||
|
reset to this value. This algorithm helps to reduce network congestion
|
||||||
|
to some extent.
|
||||||
|
|
||||||
|
config NET_TCP_FIXED_RTO
|
||||||
|
bool "Use fixed RTO"
|
||||||
|
default n
|
||||||
|
---help---
|
||||||
|
Use fixed RTO for TCP/IP connections (all tasks), i.e. do not use
|
||||||
|
the RTO exponentially increasing algorithm. This is useful for projects
|
||||||
|
that require a fixed RTO value or have restrictions on the maximum
|
||||||
|
retransmission time.
|
||||||
|
|
||||||
config NET_TCP_MAXRTX
|
config NET_TCP_MAXRTX
|
||||||
int "Maximum retransmitted number of TCP/IP data packet"
|
int "Maximum retransmitted number of TCP/IP data packet"
|
||||||
|
|||||||
@@ -1082,6 +1082,7 @@ found:
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifndef CONFIG_NET_TCP_FIXED_RTO
|
||||||
/* Do RTT estimation, unless we have done retransmissions. */
|
/* Do RTT estimation, unless we have done retransmissions. */
|
||||||
|
|
||||||
if (conn->nrtx == 0)
|
if (conn->nrtx == 0)
|
||||||
@@ -1102,6 +1103,7 @@ found:
|
|||||||
conn->sv += m;
|
conn->sv += m;
|
||||||
conn->rto = (conn->sa >> 3) + conn->sv;
|
conn->rto = (conn->sa >> 3) + conn->sv;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
/* Set the acknowledged flag. */
|
/* Set the acknowledged flag. */
|
||||||
|
|
||||||
|
|||||||
@@ -579,7 +579,9 @@ void tcp_timer(FAR struct net_driver_s *dev, FAR struct tcp_conn_s *conn)
|
|||||||
|
|
||||||
/* Exponential backoff. */
|
/* Exponential backoff. */
|
||||||
|
|
||||||
|
#ifndef CONFIG_NET_TCP_FIXED_RTO
|
||||||
conn->rto = TCP_RTO << (conn->nrtx > 4 ? 4: conn->nrtx);
|
conn->rto = TCP_RTO << (conn->nrtx > 4 ? 4: conn->nrtx);
|
||||||
|
#endif
|
||||||
tcp_update_retrantimer(conn, conn->rto);
|
tcp_update_retrantimer(conn, conn->rto);
|
||||||
conn->nrtx++;
|
conn->nrtx++;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user