From eba31ecebed1a7d168da17194cab7a8955761f2b Mon Sep 17 00:00:00 2001 From: Neale Ranns Date: Sun, 17 Feb 2019 18:04:27 +0000 Subject: IPSEC: move SA counters into the stats segment 1) stats are accessed via the stat segment which is more condusive to monitoring 2) stats are accurate in the presence of multiple threads. There's no guarantee that an SA is access from only one worker. Change-Id: Id5e217ea253ddfc9480aaedb0d008dea031b1148 Signed-off-by: Neale Ranns --- src/vnet/ipsec/ipsec_sa.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'src/vnet/ipsec/ipsec_sa.c') diff --git a/src/vnet/ipsec/ipsec_sa.c b/src/vnet/ipsec/ipsec_sa.c index c4721c7afad..fc8520d5ebb 100644 --- a/src/vnet/ipsec/ipsec_sa.c +++ b/src/vnet/ipsec/ipsec_sa.c @@ -16,6 +16,16 @@ #include #include +/** + * @brief + * SA packet & bytes counters + */ +vlib_combined_counter_main_t ipsec_sa_counters = { + .name = "SA", + .stat_segment_name = "/net/ipsec/sa", +}; + + static clib_error_t * ipsec_call_add_del_callbacks (ipsec_main_t * im, ipsec_sa_t * sa, u32 sa_index, int is_add) @@ -106,8 +116,12 @@ ipsec_sa_add (u32 id, fib_node_init (&sa->node, FIB_NODE_TYPE_IPSEC_SA); sa_index = sa - im->sad; + vlib_validate_combined_counter (&ipsec_sa_counters, sa_index); + vlib_zero_combined_counter (&ipsec_sa_counters, sa_index); + sa->id = id; sa->spi = spi; + sa->stat_index = sa_index; sa->protocol = proto; sa->crypto_alg = crypto_alg; clib_memcpy (&sa->crypto_key, ck, sizeof (sa->crypto_key)); -- cgit 1.2.3-korg