diff options
-rw-r--r-- | src/vnet/adj/adj.c | 7 | ||||
-rw-r--r-- | src/vnet/adj/adj.h | 6 | ||||
-rw-r--r-- | src/vnet/feature/feature.c | 33 | ||||
-rw-r--r-- | src/vnet/feature/feature.h | 6 |
4 files changed, 42 insertions, 10 deletions
diff --git a/src/vnet/adj/adj.c b/src/vnet/adj/adj.c index 0966d97cc6d..a603925e905 100644 --- a/src/vnet/adj/adj.c +++ b/src/vnet/adj/adj.c @@ -405,10 +405,11 @@ adj_feature_update_walk_cb (adj_index_t ai, return (ADJ_WALK_RC_CONTINUE); } -void +static void adj_feature_update (u32 sw_if_index, u8 arc_index, - u8 is_enable) + u8 is_enable, + void *data) { /* * Walk all the adjacencies on the interface to update the cached @@ -590,6 +591,8 @@ adj_module_init (vlib_main_t * vm) adj_midchain_module_init(); adj_mcast_module_init(); + vnet_feature_register(adj_feature_update, NULL); + return (NULL); } diff --git a/src/vnet/adj/adj.h b/src/vnet/adj/adj.h index 9d1577fe911..58e5ebf5d98 100644 --- a/src/vnet/adj/adj.h +++ b/src/vnet/adj/adj.h @@ -390,12 +390,6 @@ extern int adj_is_up (adj_index_t ai); extern const u8* adj_get_rewrite (adj_index_t ai); /** - * @brief Notify the adjacency subsystem that the features settings for - * an interface have changed - */ -extern void adj_feature_update (u32 sw_if_index, u8 arc_index, u8 is_enable); - -/** * @brief descend the FIB graph looking for loops * * @param ai 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 */ /* |