diff options
author | Florin Coras <fcoras@cisco.com> | 2024-06-10 13:12:40 -0700 |
---|---|---|
committer | Dave Barach <vpp@barachs.net> | 2024-06-14 23:27:49 +0000 |
commit | 1c30d2d8bc80240b7435d313e2eeb010715eea5e (patch) | |
tree | 36a004b12ae7c51ae45f57b8288ecb3b7b4284da /src/vnet/tcp | |
parent | bee28afbb29992c4f332dcb319fbc3eacdc6e52b (diff) |
tcp: make syn-rcvd timeout configurable
Type: improvement
Signed-off-by: Florin Coras <fcoras@cisco.com>
Change-Id: Ic89570315a5c3c00e0e89c5535929313916869eb
Diffstat (limited to 'src/vnet/tcp')
-rw-r--r-- | src/vnet/tcp/tcp.c | 3 | ||||
-rw-r--r-- | src/vnet/tcp/tcp.h | 3 | ||||
-rw-r--r-- | src/vnet/tcp/tcp_cli.c | 2 | ||||
-rw-r--r-- | src/vnet/tcp/tcp_output.c | 2 |
4 files changed, 9 insertions, 1 deletions
diff --git a/src/vnet/tcp/tcp.c b/src/vnet/tcp/tcp.c index efc72a227e8..28d7ed9fac1 100644 --- a/src/vnet/tcp/tcp.c +++ b/src/vnet/tcp/tcp.c @@ -1642,6 +1642,9 @@ tcp_configuration_init (void) /* 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 2362a8bb857..3d678006f70 100644 --- a/src/vnet/tcp/tcp.h +++ b/src/vnet/tcp/tcp.h @@ -197,6 +197,9 @@ typedef struct tcp_configuration_ /** 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 b04c0bdc0cf..e26488342d2 100644 --- a/src/vnet/tcp/tcp_cli.c +++ b/src/vnet/tcp/tcp_cli.c @@ -1009,6 +1009,8 @@ tcp_config_fn (vlib_main_t * vm, unformat_input_t * input) 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 78148cd5695..373bb2a9e0f 100644 --- a/src/vnet/tcp/tcp_output.c +++ b/src/vnet/tcp/tcp_output.c @@ -1391,7 +1391,7 @@ tcp_timer_retransmit_handler (tcp_connection_t * tc) 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); |