aboutsummaryrefslogtreecommitdiffstats
path: root/src/vnet
diff options
context:
space:
mode:
authorFlorin Coras <fcoras@cisco.com>2018-06-22 15:29:38 -0700
committerDave Barach <openvpp@barachs.net>2018-06-25 20:43:44 +0000
commitadb5bd5344cd7b422c0c08e6434ad8642b897502 (patch)
tree93f2ed26f808ff73882436ea4702eb0eedc2f765 /src/vnet
parentc474feea962bcde3b5eece0ff2be8d3fd8019093 (diff)
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 <fcoras@cisco.com>
Diffstat (limited to 'src/vnet')
-rw-r--r--src/vnet/tcp/tcp.h15
1 files changed, 8 insertions, 7 deletions
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