summaryrefslogtreecommitdiffstats
path: root/src/vnet/feature/feature.c
diff options
context:
space:
mode:
authorNeale Ranns <nranns@cisco.com>2019-12-02 23:10:08 +0000
committerOle Trøan <otroan@employees.org>2019-12-03 19:27:53 +0000
commitc8972fe506c78530a3e4085453e86a0b85b245ef (patch)
tree08a549b4e1bc9b941fefdceb0a0e7d2efd02b4b5 /src/vnet/feature/feature.c
parenta6460e46f379315e872819af139ae2c87e8e06f3 (diff)
fib feature: Code mechanics to decouple dependency of feature on adj
Type: refactor Signed-off-by: Neale Ranns <nranns@cisco.com> Change-Id: I1d8b88fe1eefc850865297b4f025b97e6373a6bd
Diffstat (limited to 'src/vnet/feature/feature.c')
-rw-r--r--src/vnet/feature/feature.c33
1 files changed, 31 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;