From adb5bd5344cd7b422c0c08e6434ad8642b897502 Mon Sep 17 00:00:00 2001 From: Florin Coras Date: Fri, 22 Jun 2018 15:29:38 -0700 Subject: tw: add light weight timer update function Because it avoids pool putting/getting the timer, this function is somewhat faster than stopping and restarting a timer. Change-Id: Id99ed9d356b0b1f7e12facfe8da193e1cd30b3ec Signed-off-by: Florin Coras --- src/vnet/tcp/tcp.h | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) (limited to 'src/vnet/tcp/tcp.h') diff --git a/src/vnet/tcp/tcp.h b/src/vnet/tcp/tcp.h index ba57e3a1fef..1fd03c9e7ba 100644 --- a/src/vnet/tcp/tcp.h +++ b/src/vnet/tcp/tcp.h @@ -721,13 +721,14 @@ tcp_timer_update (tcp_connection_t * tc, u8 timer_id, u32 interval) { ASSERT (tc->c_thread_index == vlib_get_thread_index ()); if (tc->timers[timer_id] != TCP_TIMER_HANDLE_INVALID) - tw_timer_stop_16t_2w_512sl (&tcp_main. - wrk_ctx[tc->c_thread_index].timer_wheel, - tc->timers[timer_id]); - tc->timers[timer_id] = - tw_timer_start_16t_2w_512sl (&tcp_main. - wrk_ctx[tc->c_thread_index].timer_wheel, - tc->c_c_index, timer_id, interval); + tw_timer_update_16t_2w_512sl (&tcp_main. + wrk_ctx[tc->c_thread_index].timer_wheel, + tc->timers[timer_id], interval); + else + tc->timers[timer_id] = + tw_timer_start_16t_2w_512sl (&tcp_main. + wrk_ctx[tc->c_thread_index].timer_wheel, + tc->c_c_index, timer_id, interval); } always_inline void -- cgit 1.2.3-korg