aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/nat/nat44-ed
diff options
context:
space:
mode:
authorOle Troan <ot@cisco.com>2021-05-18 15:05:23 +0200
committerDamjan Marion <dmarion@me.com>2021-05-21 16:49:30 +0000
commit92a8d761c412590f5112239be4c511091b2b2d5a (patch)
treed4337456b046d9a841916b9f1657829ca8ac836a /src/plugins/nat/nat44-ed
parent84b543d8b1522d70aada38f3db49aade5230fc64 (diff)
nat: add maximum configured sessions to stat segment
Add /nat44-ed/max-cfg-sessions gauge. Reflects the configured value for configured sessions (per thread). Type: improvement Signed-off-by: Ole Troan <ot@cisco.com> Change-Id: I618c8aa0daab0981399cfe9273d191fa1990ef60 Signed-off-by: Ole Troan <ot@cisco.com>
Diffstat (limited to 'src/plugins/nat/nat44-ed')
-rw-r--r--src/plugins/nat/nat44-ed/nat44_ed.c9
-rw-r--r--src/plugins/nat/nat44-ed/nat44_ed.h2
2 files changed, 11 insertions, 0 deletions
diff --git a/src/plugins/nat/nat44-ed/nat44_ed.c b/src/plugins/nat/nat44-ed/nat44_ed.c
index 58aade568b9..d42d303d95c 100644
--- a/src/plugins/nat/nat44-ed/nat44_ed.c
+++ b/src/plugins/nat/nat44-ed/nat44_ed.c
@@ -36,6 +36,8 @@
#include <nat/nat44-ed/nat44_ed_affinity.h>
#include <nat/nat44-ed/nat44_ed_inlines.h>
+#include <vpp/stats/stat_segment.h>
+
snat_main_t snat_main;
static_always_inline void nat_validate_interface_counters (snat_main_t *sm,
@@ -2025,6 +2027,8 @@ nat_init (vlib_main_t * vm)
nat_init_simple_counter (sm->total_sessions, "total-sessions",
"/nat44-ed/total-sessions");
+ sm->max_cfg_sessions_gauge = stat_segment_new_entry (
+ (u8 *) "/nat44-ed/max-cfg-sessions", STAT_DIR_TYPE_SCALAR_INDEX);
#define _(x) \
nat_init_simple_counter (sm->counters.fastpath.in2out.x, #x, \
@@ -2123,6 +2127,8 @@ nat44_plugin_enable (nat44_config_t c)
c.sessions = 63 * 1024;
sm->max_translations_per_thread = c.sessions;
+ stat_segment_set_state_counter (sm->max_cfg_sessions_gauge,
+ sm->max_translations_per_thread);
sm->translation_buckets = nat_calc_bihash_buckets (c.sessions);
// ED only feature
@@ -2788,6 +2794,9 @@ nat44_update_session_limit (u32 session_limit, u32 vrf_id)
return 1;
sm->max_translations_per_thread = nat44_get_max_session_limit ();
+ stat_segment_set_state_counter (sm->max_cfg_sessions_gauge,
+ sm->max_translations_per_thread);
+
sm->translation_buckets =
nat_calc_bihash_buckets (sm->max_translations_per_thread);
diff --git a/src/plugins/nat/nat44-ed/nat44_ed.h b/src/plugins/nat/nat44-ed/nat44_ed.h
index c9ae089210d..1668d0295d5 100644
--- a/src/plugins/nat/nat44-ed/nat44_ed.h
+++ b/src/plugins/nat/nat44-ed/nat44_ed.h
@@ -608,6 +608,8 @@ typedef struct snat_main_s
/* counters */
vlib_simple_counter_main_t total_sessions;
+ u32 max_cfg_sessions_gauge; /* Index of max configured sessions gauge in
+ stats */
#define _(x) vlib_simple_counter_main_t x;
struct