LISP: make statistics thread safe
Change-Id: I056dc6246f79d887d69ad459a6b8b3092a099baa
Signed-off-by: Filip Tehlar <ftehlar@cisco.com>
diff --git a/src/vnet/lisp-cp/one_api.c b/src/vnet/lisp-cp/one_api.c
index 2892409..23549af 100644
--- a/src/vnet/lisp-cp/one_api.c
+++ b/src/vnet/lisp-cp/one_api.c
@@ -108,6 +108,7 @@
_(SHOW_ONE_STATS_ENABLE_DISABLE, show_one_stats_enable_disable) \
_(ONE_STATS_ENABLE_DISABLE, one_stats_enable_disable) \
_(ONE_STATS_DUMP, one_stats_dump) \
+_(ONE_STATS_FLUSH, one_stats_flush) \
static locator_t *
@@ -1347,6 +1348,16 @@
}
static void
+vl_api_one_stats_flush_t_handler (vl_api_one_stats_flush_t * mp)
+{
+ vl_api_one_stats_flush_reply_t *rmp;
+ u8 rv;
+
+ rv = vnet_lisp_flush_stats ();
+ REPLY_MACRO (VL_API_ONE_STATS_FLUSH_REPLY);
+}
+
+static void
vl_api_one_stats_dump_t_handler (vl_api_one_stats_dump_t * mp)
{
vl_api_one_stats_details_t *rmp;
@@ -1369,8 +1380,8 @@
ip_address_copy_addr (rmp->rloc, &stat->rmt_rloc);
ip_address_copy_addr (rmp->lloc, &stat->loc_rloc);
- rmp->pkt_count = clib_host_to_net_u32 (stat->stats.pkt_count);
- rmp->bytes = clib_host_to_net_u32 (stat->stats.bytes);
+ rmp->pkt_count = clib_host_to_net_u32 (stat->counters.packets);
+ rmp->bytes = clib_host_to_net_u32 (stat->counters.bytes);
}));
/* *INDENT-ON* */
}