From 8e1ada3a615f47d318586add8a4358ea50a10695 Mon Sep 17 00:00:00 2001 From: Florin Coras Date: Wed, 5 Jan 2022 09:48:36 -0800 Subject: tcp: handle start tx event in cubic If app was idle update start time of current congestion avoidance phase unless tcp connection was not idle. Type: improvement Signed-off-by: Florin Coras Change-Id: Idf6a03a9ef96c409462de9f9cb19df609f730afe --- src/vnet/tcp/tcp_cubic.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/src/vnet/tcp/tcp_cubic.c b/src/vnet/tcp/tcp_cubic.c index 3160e528e6d..85c311bb631 100644 --- a/src/vnet/tcp/tcp_cubic.c +++ b/src/vnet/tcp/tcp_cubic.c @@ -232,6 +232,23 @@ cubic_unformat_config (unformat_input_t * input) return 1; } +void +cubic_event (tcp_connection_t *tc, tcp_cc_event_t evt) +{ + cubic_data_t *cd; + f64 now; + + if (evt != TCP_CC_EVT_START_TX) + return; + + /* App was idle so update t_start to avoid artificially + * inflating cwnd if nothing recently sent and acked */ + cd = (cubic_data_t *) tcp_cc_data (tc); + now = cubic_time (tc->c_thread_index); + if (now > tc->mrtt_us + 1) + cd->t_start = now; +} + const static tcp_cc_algorithm_t tcp_cubic = { .name = "cubic", .unformat_cfg = cubic_unformat_config, @@ -240,6 +257,7 @@ const static tcp_cc_algorithm_t tcp_cubic = { .recovered = cubic_recovered, .rcv_ack = cubic_rcv_ack, .rcv_cong_ack = newreno_rcv_cong_ack, + .event = cubic_event, .init = cubic_conn_init, }; -- cgit 1.2.3-korg