}
static void
-tcp_counters_init (void)
+tcp_counters_init (tcp_main_t *tm)
{
vlib_stats_collector_reg_t r = {};
u32 idx;
+ if (tm->counters_init)
+ return;
+
r.entry_index = idx = vlib_stats_add_counter_vector ("/sys/tcp");
r.collect_fn = tcp_stats_collector_fn;
vlib_stats_validate (idx, 0, TCP_STAT_no_buffer);
#undef _
vlib_stats_register_collector_fn (&r);
+
+ tm->counters_init = 1;
}
static clib_error_t *
tm->bytes_per_buffer = vlib_buffer_get_default_data_size (vm);
tm->cc_last_type = TCP_CC_LAST;
- tcp_counters_init ();
+ tcp_counters_init (tm);
return error;
}
/** Flag that indicates if stack is on or off */
u8 is_enabled;
+ /** Set if counters on stats segment initialized */
+ u8 counters_init;
+
/** Flag that indicates if v4 punting is enabled */
u8 punt_unknown4;