diff options
Diffstat (limited to 'src/vnet/feature')
-rw-r--r-- | src/vnet/feature/feature.c | 33 | ||||
-rw-r--r-- | src/vnet/feature/feature.h | 6 |
2 files changed, 37 insertions, 2 deletions
diff --git a/src/vnet/feature/feature.c b/src/vnet/feature/feature.c index 6bef26257a9..24960d933ae 100644 --- a/src/vnet/feature/feature.c +++ b/src/vnet/feature/feature.c @@ -14,10 +14,39 @@ */ #include <vnet/feature/feature.h> -#include <vnet/adj/adj.h> + vnet_feature_main_t feature_main; +typedef struct vnet_feature_upd_registration_t_ +{ + vnet_feature_update_cb_t cb; + void *data; +} vnet_feature_upd_registration_t; + +static vnet_feature_upd_registration_t *regs; + +void +vnet_feature_register (vnet_feature_update_cb_t cb, void *data) +{ + vnet_feature_upd_registration_t *reg; + + vec_add2 (regs, reg, 1); + + reg->cb = cb; + reg->data = data; +} + +static void +vent_feature_reg_invoke (u32 sw_if_index, u8 arc_index, u8 is_enable) +{ + vnet_feature_upd_registration_t *reg; + + vec_foreach (reg, regs) + reg->cb (sw_if_index, arc_index, is_enable, reg->data); +} + + static clib_error_t * vnet_feature_init (vlib_main_t * vm) { @@ -265,7 +294,7 @@ vnet_feature_enable_disable_with_index (u8 arc_index, u32 feature_index, fm->sw_if_index_has_features[arc_index] = clib_bitmap_set (fm->sw_if_index_has_features[arc_index], sw_if_index, (feature_count > 0)); - adj_feature_update (sw_if_index, arc_index, (feature_count > 0)); + vent_feature_reg_invoke (sw_if_index, arc_index, (feature_count > 0)); fm->feature_count_by_sw_if_index[arc_index][sw_if_index] = feature_count; return 0; diff --git a/src/vnet/feature/feature.h b/src/vnet/feature/feature.h index ef5f4c6ad7d..cbea6590942 100644 --- a/src/vnet/feature/feature.h +++ b/src/vnet/feature/feature.h @@ -454,6 +454,12 @@ clib_error_t *vnet_feature_arc_init void vnet_interface_features_show (vlib_main_t * vm, u32 sw_if_index, int verbose); +typedef void (*vnet_feature_update_cb_t) (u32 sw_if_index, + u8 arc_index, + u8 is_enable, void *cb); + +extern void vnet_feature_register (vnet_feature_update_cb_t cb, void *data); + #endif /* included_feature_h */ /* |