diff options
author | Florin Coras <fcoras@cisco.com> | 2020-03-18 21:26:41 +0000 |
---|---|---|
committer | Dave Barach <openvpp@barachs.net> | 2020-04-02 19:17:11 +0000 |
commit | 0765d97abef74727c040d2eaf9112865d59f1593 (patch) | |
tree | e3639e34a0fccf8b40a6114676f704d9bac205e2 /src/vnet/tcp/tcp_output.c | |
parent | 48d32b43c534c9f52d37b047dbcbc30a8882b52a (diff) |
tcp: explicit use of timer wheel in timer apis
Type: refactor
Signed-off-by: Florin Coras <fcoras@cisco.com>
Change-Id: I06120d43c15b2fa3f437ef235bf5f83ec2beb45e
Diffstat (limited to 'src/vnet/tcp/tcp_output.c')
-rw-r--r-- | src/vnet/tcp/tcp_output.c | 44 |
1 files changed, 21 insertions, 23 deletions
diff --git a/src/vnet/tcp/tcp_output.c b/src/vnet/tcp/tcp_output.c index aeeffa726c3..a68d5269abd 100644 --- a/src/vnet/tcp/tcp_output.c +++ b/src/vnet/tcp/tcp_output.c @@ -808,12 +808,12 @@ tcp_send_syn (tcp_connection_t * tc) * Setup retransmit and establish timers before requesting buffer * such that we can return if we've ran out. */ - tcp_timer_update (tc, TCP_TIMER_RETRANSMIT_SYN, + tcp_timer_update (&wrk->timer_wheel, tc, TCP_TIMER_RETRANSMIT_SYN, tc->rto * TCP_TO_TIMER_TICK); if (PREDICT_FALSE (!vlib_buffer_alloc (vm, &bi, 1))) { - tcp_timer_update (tc, TCP_TIMER_RETRANSMIT_SYN, 1); + tcp_timer_update (&wrk->timer_wheel, tc, TCP_TIMER_RETRANSMIT_SYN, 1); return; } @@ -839,11 +839,11 @@ tcp_send_synack (tcp_connection_t * tc) vlib_buffer_t *b; u32 bi; - tcp_retransmit_timer_force_update (tc); + tcp_retransmit_timer_force_update (&wrk->timer_wheel, tc); if (PREDICT_FALSE (!vlib_buffer_alloc (vm, &bi, 1))) { - tcp_timer_update (tc, TCP_TIMER_RETRANSMIT, 1); + tcp_timer_update (&wrk->timer_wheel, tc, TCP_TIMER_RETRANSMIT, 1); return; } @@ -874,7 +874,7 @@ tcp_send_fin (tcp_connection_t * tc) if (PREDICT_FALSE (!vlib_buffer_alloc (vm, &bi, 1))) { /* Out of buffers so program fin retransmit ASAP */ - tcp_timer_update (tc, TCP_TIMER_RETRANSMIT, 1); + tcp_timer_update (&wrk->timer_wheel, tc, TCP_TIMER_RETRANSMIT, 1); if (fin_snt) tc->snd_nxt += 1; else @@ -887,7 +887,7 @@ tcp_send_fin (tcp_connection_t * tc) if ((tc->flags & TCP_CONN_SNDACK) && !tc->pending_dupacks) tc->flags &= ~TCP_CONN_SNDACK; - tcp_retransmit_timer_force_update (tc); + tcp_retransmit_timer_force_update (&wrk->timer_wheel, tc); b = vlib_get_buffer (vm, bi); tcp_init_buffer (vm, b); tcp_make_fin (tc, b); @@ -1001,7 +1001,8 @@ tcp_session_push_header (transport_connection_t * tconn, vlib_buffer_t * b) } if (PREDICT_FALSE (!tcp_timer_is_active (tc, TCP_TIMER_RETRANSMIT))) { - tcp_retransmit_timer_set (tc); + tcp_worker_ctx_t *wrk = tcp_get_worker (tc->c_thread_index); + tcp_retransmit_timer_set (&wrk->timer_wheel, tc); tc->rto_boff = 0; } tcp_trajectory_add_start (b, 3); @@ -1252,7 +1253,7 @@ tcp_prepare_retransmit_segment (tcp_worker_ctx_t * wrk, tc->bytes_retrans += n_bytes; tc->segs_retrans += 1; - tcp_workerp_stats_inc (wrk, rxt_segs, 1); + tcp_worker_stats_inc (wrk, rxt_segs, 1); TCP_EVT (TCP_EVT_CC_RTX, tc, offset, n_bytes); return n_bytes; @@ -1304,7 +1305,7 @@ tcp_timer_retransmit_handler (tcp_connection_t * tc) vlib_buffer_t *b = 0; u32 bi, n_bytes; - tcp_workerp_stats_inc (wrk, tr_events, 1); + tcp_worker_stats_inc (wrk, tr_events, 1); /* Should be handled by a different handler */ if (PREDICT_FALSE (tc->state == TCP_STATE_SYN_SENT)) @@ -1357,7 +1358,7 @@ tcp_timer_retransmit_handler (tcp_connection_t * tc) session_transport_closed_notify (&tc->connection); tcp_connection_timers_reset (tc); tcp_program_cleanup (wrk, tc); - tcp_workerp_stats_inc (wrk, tr_abort, 1); + tcp_worker_stats_inc (wrk, tr_abort, 1); return; } @@ -1373,7 +1374,7 @@ tcp_timer_retransmit_handler (tcp_connection_t * tc) n_bytes = tcp_prepare_retransmit_segment (wrk, tc, 0, n_bytes, &b); if (!n_bytes) { - tcp_timer_update (tc, TCP_TIMER_RETRANSMIT, 1); + tcp_timer_update (&wrk->timer_wheel, tc, TCP_TIMER_RETRANSMIT, 1); return; } @@ -1381,7 +1382,7 @@ tcp_timer_retransmit_handler (tcp_connection_t * tc) tcp_enqueue_to_output (wrk, b, bi, tc->c_is_ip4); tc->rto = clib_min (tc->rto << 1, TCP_RTO_MAX); - tcp_retransmit_timer_force_update (tc); + tcp_retransmit_timer_force_update (&wrk->timer_wheel, tc); tc->rto_boff += 1; if (tc->rto_boff == 1) @@ -1409,13 +1410,13 @@ tcp_timer_retransmit_handler (tcp_connection_t * tc) tcp_connection_set_state (tc, TCP_STATE_CLOSED); tcp_connection_timers_reset (tc); tcp_program_cleanup (wrk, tc); - tcp_workerp_stats_inc (wrk, tr_abort, 1); + tcp_worker_stats_inc (wrk, tr_abort, 1); return; } if (PREDICT_FALSE (!vlib_buffer_alloc (vm, &bi, 1))) { - tcp_timer_update (tc, TCP_TIMER_RETRANSMIT, 1); + tcp_timer_update (&wrk->timer_wheel, tc, TCP_TIMER_RETRANSMIT, 1); return; } @@ -1423,7 +1424,7 @@ tcp_timer_retransmit_handler (tcp_connection_t * tc) if (tc->rto_boff > TCP_RTO_SYN_RETRIES) tc->rto = clib_min (tc->rto << 1, TCP_RTO_MAX); - tcp_retransmit_timer_force_update (tc); + tcp_retransmit_timer_force_update (&wrk->timer_wheel, tc); b = vlib_get_buffer (vm, bi); tcp_init_buffer (vm, b); @@ -1478,7 +1479,7 @@ tcp_timer_retransmit_syn_handler (tcp_connection_t * tc) if (PREDICT_FALSE (!vlib_buffer_alloc (vm, &bi, 1))) { - tcp_timer_update (tc, TCP_TIMER_RETRANSMIT_SYN, 1); + tcp_timer_update (&wrk->timer_wheel, tc, TCP_TIMER_RETRANSMIT_SYN, 1); return; } @@ -1498,7 +1499,7 @@ tcp_timer_retransmit_syn_handler (tcp_connection_t * tc) tcp_push_ip_hdr (wrk, tc, b); tcp_enqueue_to_ip_lookup (wrk, b, bi, tc->c_is_ip4, tc->c_fib_index); - tcp_timer_update (tc, TCP_TIMER_RETRANSMIT_SYN, + tcp_timer_update (&wrk->timer_wheel, tc, TCP_TIMER_RETRANSMIT_SYN, tc->rto * TCP_TO_TIMER_TICK); } @@ -1529,7 +1530,7 @@ tcp_timer_persist_handler (tcp_connection_t * tc) * next time */ if (!available_bytes) { - tcp_persist_timer_set (tc); + tcp_persist_timer_set (&wrk->timer_wheel, tc); return; } @@ -1545,7 +1546,7 @@ tcp_timer_persist_handler (tcp_connection_t * tc) */ if (PREDICT_FALSE (!vlib_buffer_alloc (vm, &bi, 1))) { - tcp_persist_timer_set (tc); + tcp_persist_timer_set (&wrk->timer_wheel, tc); return; } @@ -1576,7 +1577,7 @@ tcp_timer_persist_handler (tcp_connection_t * tc) tcp_enqueue_to_output (wrk, b, bi, tc->c_is_ip4); /* Just sent new data, enable retransmit */ - tcp_retransmit_timer_update (tc); + tcp_retransmit_timer_update (&wrk->timer_wheel, tc); return; @@ -2171,9 +2172,6 @@ tcp_output_handle_packet (tcp_connection_t * tc0, vlib_buffer_t * b0, } } - if (!TCP_ALWAYS_ACK) - tcp_timer_reset (tc0, TCP_TIMER_DELACK); - tc0->segs_out += 1; } |