diff options
author | Emanuele Di Pascale <lele84@gmail.com> | 2022-03-29 12:29:23 +0200 |
---|---|---|
committer | Emanuele Di Pascale <lele84@gmail.com> | 2022-04-01 18:10:35 +0200 |
commit | 7539e4b5522b015a715ba49eed4477b8cece1b86 (patch) | |
tree | 9f181557091c4125d1561f606fa40f4d0f5d2ef5 /src/plugins/vrrp/vrrp.h | |
parent | 2518dca440f1ef41500d73067fe44318b782b98d (diff) |
vrrp: add stats support and update API
Add simple counter statistics to VRRP, based on a subset of those
defined in RFC8347.
Add an update API that allows in-place modification of an existing
instance. The method returns a vrrp_index which can be used both for
retrieving statistics and to modify non-key parameters. Also add a
delete method which will take that vrrp_index as parameter.
Type: improvement
Signed-off-by: Emanuele Di Pascale <lele84@gmail.com>
Change-Id: I2cd11467b4dbd9dfdb5aa748783144b4883dba57
Diffstat (limited to 'src/plugins/vrrp/vrrp.h')
-rw-r--r-- | src/plugins/vrrp/vrrp.h | 43 |
1 files changed, 42 insertions, 1 deletions
diff --git a/src/plugins/vrrp/vrrp.h b/src/plugins/vrrp/vrrp.h index c9325921959..cf529a153a4 100644 --- a/src/plugins/vrrp/vrrp.h +++ b/src/plugins/vrrp/vrrp.h @@ -108,6 +108,7 @@ typedef struct vrrp_vr vrrp_vr_config_t config; vrrp_vr_runtime_t runtime; vrrp_vr_tracking_t tracking; + u32 stat_index; } vrrp_vr_t; /* Timers */ @@ -185,9 +186,46 @@ extern vlib_node_registration_t vrrp_periodic_node; #define VRRP_EVENT_VR_STOP 2 #define VRRP_EVENT_PERIODIC_ENABLE_DISABLE 3 +/* global error counter types */ +#define foreach_vrrp_err_counter \ + _ (CHKSUM, 0) \ + _ (VERSION, 1) \ + _ (VRID, 2) \ + _ (TTL, 3) \ + _ (ADDR_LIST, 4) \ + _ (PKT_LEN, 5) + +typedef enum vrrp_err_counter_ +{ +#define _(sym, val) VRRP_ERR_COUNTER_##sym = val, + foreach_vrrp_err_counter +#undef _ +} vrrp_err_counter_t; + +#define VRRP_ERR_COUNTER_MAX 6 + +/* per-instance stats */ +#define foreach_vrrp_stat_counter \ + _ (MASTER_TRANS, 0) \ + _ (ADV_SENT, 1) \ + _ (ADV_RCVD, 2) \ + _ (PRIO0_SENT, 3) \ + _ (PRIO0_RCVD, 4) + +typedef enum vrrp_stat_counter_ +{ +#define _(sym, val) VRRP_STAT_COUNTER_##sym = val, + foreach_vrrp_stat_counter +#undef _ +} vrrp_stat_counter_t; + +#define VRRP_STAT_COUNTER_MAX 5 + clib_error_t *vrrp_plugin_api_hookup (vlib_main_t * vm); -int vrrp_vr_add_del (u8 is_add, vrrp_vr_config_t * conf); +int vrrp_vr_add_del (u8 is_add, vrrp_vr_config_t *conf, index_t *ret_index); +int vrrp_vr_update (index_t *vrrp_index, vrrp_vr_config_t *vr_conf); +int vrrp_vr_del (index_t vrrp_index); int vrrp_vr_start_stop (u8 is_start, vrrp_vr_key_t * vr_key); extern u8 *format_vrrp_vr (u8 * s, va_list * args); extern u8 *format_vrrp_vr_key (u8 * s, va_list * args); @@ -209,6 +247,9 @@ int vrrp_vr_tracking_ifs_add_del (vrrp_vr_t * vr, u8 is_add); void vrrp_vr_event (vrrp_vr_t * vr, vrrp_vr_state_t new_state); +// stats +void vrrp_incr_err_counter (vrrp_err_counter_t err_type); +void vrrp_incr_stat_counter (vrrp_stat_counter_t stat_type, u32 stat_index); always_inline void vrrp_vr_skew_compute (vrrp_vr_t * vr) |