aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/nat/nat64.c
diff options
context:
space:
mode:
authorKlement Sekera <ksekera@cisco.com>2020-07-16 07:54:10 +0000
committerOle Trøan <otroan@employees.org>2020-08-13 08:34:33 +0000
commitde118da58e80aec43f4b816a1ea957634a8bc07c (patch)
tree16de15d96990fdc6dd9eaf17be405daa2980d790 /src/plugins/nat/nat64.c
parentfbecd936bd40e590031ec6d7ff81c3f8827f9f18 (diff)
nat: remove non-error error counters
Some statistics counters were implemented as error counters. Move them to stat segment, where they belong. Type: improvement Change-Id: I5600bec1b4e0496282297374ec1e79d909cdaf8a Signed-off-by: Klement Sekera <ksekera@cisco.com>
Diffstat (limited to 'src/plugins/nat/nat64.c')
-rw-r--r--src/plugins/nat/nat64.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/src/plugins/nat/nat64.c b/src/plugins/nat/nat64.c
index 9fc3344f015..717cf6a630a 100644
--- a/src/plugins/nat/nat64.c
+++ b/src/plugins/nat/nat64.c
@@ -248,6 +248,13 @@ nat64_init (vlib_main_t * vm)
vlib_validate_simple_counter (&nm->total_sessions, 0);
vlib_zero_simple_counter (&nm->total_sessions, 0);
+#define _(x) \
+ nm->counters.in2out.x.name = #x; \
+ nm->counters.in2out.x.stat_segment_name = "/nat64/in2out/" #x; \
+ nm->counters.out2in.x.name = #x; \
+ nm->counters.out2in.x.stat_segment_name = "/nat64/out2in/" #x;
+ foreach_nat_counter;
+#undef _
return 0;
}
@@ -410,6 +417,18 @@ nat64_add_interface_address (u32 sw_if_index, int is_add)
return 0;
}
+static void
+nat64_validate_counters (nat64_main_t * nm, u32 sw_if_index)
+{
+#define _(x) \
+ vlib_validate_simple_counter (&nm->counters.in2out.x, sw_if_index); \
+ vlib_zero_simple_counter (&nm->counters.in2out.x, sw_if_index); \
+ vlib_validate_simple_counter (&nm->counters.out2in.x, sw_if_index); \
+ vlib_zero_simple_counter (&nm->counters.out2in.x, sw_if_index);
+ foreach_nat_counter;
+#undef _
+}
+
int
nat64_add_del_interface (u32 sw_if_index, u8 is_inside, u8 is_add)
{
@@ -439,6 +458,7 @@ nat64_add_del_interface (u32 sw_if_index, u8 is_inside, u8 is_add)
pool_get (nm->interfaces, interface);
interface->sw_if_index = sw_if_index;
interface->flags = 0;
+ nat64_validate_counters (nm, sw_if_index);
set_flags:
if (is_inside)
interface->flags |= NAT_INTERFACE_FLAG_IS_INSIDE;