tcp: make syn-rcvd timeout configurable
Type: improvement
Signed-off-by: Florin Coras <fcoras@cisco.com>
Change-Id: Ic89570315a5c3c00e0e89c5535929313916869eb
diff --git a/src/vnet/tcp/tcp.c b/src/vnet/tcp/tcp.c
index efc72a2..28d7ed9 100644
--- a/src/vnet/tcp/tcp.c
+++ b/src/vnet/tcp/tcp.c
@@ -1642,6 +1642,9 @@
/* This value is seconds */
tcp_cfg.cleanup_time = 0.1; /* 100ms */
+
+ /* Time constants defined as tcp tick (1us) multiples */
+ tcp_cfg.syn_rcvd_time = TCP_ESTABLISH_TIME;
}
static clib_error_t *
diff --git a/src/vnet/tcp/tcp.h b/src/vnet/tcp/tcp.h
index 2362a8b..3d67800 100644
--- a/src/vnet/tcp/tcp.h
+++ b/src/vnet/tcp/tcp.h
@@ -197,6 +197,9 @@
/** Time to wait (sec) before cleaning up the connection */
f32 cleanup_time;
+ /** Time to wait (tcp ticks) for syn-rcvd connection to establish */
+ u32 syn_rcvd_time;
+
/** Number of preallocated connections */
u32 preallocated_connections;
diff --git a/src/vnet/tcp/tcp_cli.c b/src/vnet/tcp/tcp_cli.c
index b04c0bd..e264883 100644
--- a/src/vnet/tcp/tcp_cli.c
+++ b/src/vnet/tcp/tcp_cli.c
@@ -1009,6 +1009,8 @@
tcp_cfg.alloc_err_timeout = tmp_time / TCP_TIMER_TICK;
else if (unformat (input, "cleanup-time %u", &tmp_time))
tcp_cfg.cleanup_time = tmp_time / 1000.0;
+ else if (unformat (input, "syn-rcvd-time %u", &tmp_time))
+ tcp_cfg.syn_rcvd_time = tmp_time * THZ;
else
return clib_error_return (0, "unknown input `%U'",
format_unformat_error, input);
diff --git a/src/vnet/tcp/tcp_output.c b/src/vnet/tcp/tcp_output.c
index 78148cd..373bb2a 100644
--- a/src/vnet/tcp/tcp_output.c
+++ b/src/vnet/tcp/tcp_output.c
@@ -1391,7 +1391,7 @@
tc->rtt_ts = 0;
/* Passive open establish timeout */
- if (tc->rto > TCP_ESTABLISH_TIME >> 1)
+ if (tc->rto > tcp_cfg.syn_rcvd_time >> 1)
{
tcp_connection_set_state (tc, TCP_STATE_CLOSED);
tcp_connection_timers_reset (tc);