aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorFlorin Coras <fcoras@cisco.com>2017-08-14 08:10:42 -0700
committerDave Barach <openvpp@barachs.net>2017-08-14 21:26:32 +0000
commit82d3ec8b513455fb1a4a9fd045065beddb87bad7 (patch)
treeaf8ac1abb6684730a4c9941c4f35cdcc27f692be /src
parent28ab9cc13bb0b6adf68277f12cfcd33b69f40b00 (diff)
TCP: Update time_now once per burst
Change-Id: I58089d7a9867ede9d8a36b2aea62edef04cb5b81 Signed-off-by: Florin Coras <fcoras@cisco.com>
Diffstat (limited to 'src')
-rw-r--r--src/vnet/tcp/tcp.c2
-rw-r--r--src/vnet/tcp/tcp.h12
-rw-r--r--src/vnet/tcp/tcp_input.c2
-rw-r--r--src/vnet/tcp/tcp_output.c2
4 files changed, 15 insertions, 3 deletions
diff --git a/src/vnet/tcp/tcp.c b/src/vnet/tcp/tcp.c
index 4652618b22c..10ecf2f31f1 100644
--- a/src/vnet/tcp/tcp.c
+++ b/src/vnet/tcp/tcp.c
@@ -1299,6 +1299,8 @@ tcp_main_enable (vlib_main_t * vm)
tm->bytes_per_buffer = vlib_buffer_free_list_buffer_size
(vm, VLIB_BUFFER_DEFAULT_FREE_LIST_INDEX);
+
+ vec_validate (tm->time_now, num_threads - 1);
return error;
}
diff --git a/src/vnet/tcp/tcp.h b/src/vnet/tcp/tcp.h
index a17262fa7b4..52610dddaea 100644
--- a/src/vnet/tcp/tcp.h
+++ b/src/vnet/tcp/tcp.h
@@ -367,6 +367,7 @@ typedef struct _tcp_main
u8 log2_tstamp_clocks_per_tick;
f64 tstamp_ticks_per_clock;
+ u32 *time_now;
/** per-worker tx buffer free lists */
u32 **tx_buffers;
@@ -619,12 +620,21 @@ void tcp_update_sack_list (tcp_connection_t * tc, u32 start, u32 end);
always_inline u32
tcp_time_now (void)
{
- return clib_cpu_time_now () * tcp_main.tstamp_ticks_per_clock;
+ return tcp_main.time_now[vlib_get_thread_index ()];
+}
+
+always_inline u32
+tcp_set_time_now (u32 thread_index)
+{
+ tcp_main.time_now[thread_index] = clib_cpu_time_now ()
+ * tcp_main.tstamp_ticks_per_clock;
+ return tcp_main.time_now[thread_index];
}
always_inline void
tcp_update_time (f64 now, u32 thread_index)
{
+ tcp_set_time_now (thread_index);
tw_timer_expire_timers_16t_2w_512sl (&tcp_main.timer_wheels[thread_index],
now);
tcp_flush_frames_to_output (thread_index);
diff --git a/src/vnet/tcp/tcp_input.c b/src/vnet/tcp/tcp_input.c
index a3b48d83659..2d36c85e0c9 100644
--- a/src/vnet/tcp/tcp_input.c
+++ b/src/vnet/tcp/tcp_input.c
@@ -2801,8 +2801,8 @@ tcp46_input_inline (vlib_main_t * vm, vlib_node_runtime_t * node,
from = vlib_frame_vector_args (from_frame);
n_left_from = from_frame->n_vectors;
-
next_index = node->cached_next_index;
+ tcp_set_time_now (my_thread_index);
while (n_left_from > 0)
{
diff --git a/src/vnet/tcp/tcp_output.c b/src/vnet/tcp/tcp_output.c
index 4c1add21c27..5a395b9f25e 100644
--- a/src/vnet/tcp/tcp_output.c
+++ b/src/vnet/tcp/tcp_output.c
@@ -1621,8 +1621,8 @@ tcp46_output_inline (vlib_main_t * vm,
from = vlib_frame_vector_args (from_frame);
n_left_from = from_frame->n_vectors;
-
next_index = node->cached_next_index;
+ tcp_set_time_now (my_thread_index);
while (n_left_from > 0)
{