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>
#include <nat/nat44-ed/nat44_ed_affinity.h>
#include <nat/nat44-ed/nat44_ed_inlines.h>
#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,
snat_main_t snat_main;
static_always_inline void nat_validate_interface_counters (snat_main_t *sm,
nat_init_simple_counter (sm->total_sessions, "total-sessions",
"/nat44-ed/total-sessions");
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, \
#define _(x) \
nat_init_simple_counter (sm->counters.fastpath.in2out.x, #x, \
c.sessions = 63 * 1024;
sm->max_translations_per_thread = c.sessions;
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
sm->translation_buckets = nat_calc_bihash_buckets (c.sessions);
// ED only feature
return 1;
sm->max_translations_per_thread = nat44_get_max_session_limit ();
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);
sm->translation_buckets =
nat_calc_bihash_buckets (sm->max_translations_per_thread);
/* counters */
vlib_simple_counter_main_t total_sessions;
/* 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
#define _(x) vlib_simple_counter_main_t x;
struct
* Create a new entry and add name to directory hash.
* Returns ~0 if name exists.
* Called from main heap.
* Create a new entry and add name to directory hash.
* Returns ~0 if name exists.
* Called from main heap.
+ * The name is either C-string or nul-terminated vector
*/
u32
stat_segment_new_entry (u8 *name, stat_directory_type_t t)
*/
u32
stat_segment_new_entry (u8 *name, stat_directory_type_t t)
memset (&e, 0, sizeof (e));
e.type = t;
memset (&e, 0, sizeof (e));
e.type = t;
- memcpy (e.name, name, vec_len (name));
+ strcpy_s (e.name, sizeof (e.name), (char *) name);
oldheap = vlib_stats_push_heap (NULL);
vlib_stat_segment_lock ();
oldheap = vlib_stats_push_heap (NULL);
vlib_stat_segment_lock ();