diff options
Diffstat (limited to 'src/vnet')
-rw-r--r-- | src/vnet/feature/feature.h | 16 | ||||
-rw-r--r-- | src/vnet/interface.h | 41 |
2 files changed, 57 insertions, 0 deletions
diff --git a/src/vnet/feature/feature.h b/src/vnet/feature/feature.h index eb6c95ca2c2..70a456ee7c1 100644 --- a/src/vnet/feature/feature.h +++ b/src/vnet/feature/feature.h @@ -109,6 +109,14 @@ static void __vnet_add_feature_arc_registration_##x (void) \ vnet_feat_arc_##x.next = fm->next_arc; \ fm->next_arc = & vnet_feat_arc_##x; \ } \ +static void __vnet_rm_feature_arc_registration_##x (void) \ + __attribute__((__destructor__)) ; \ +static void __vnet_rm_feature_arc_registration_##x (void) \ +{ \ + vnet_feature_main_t * fm = &feature_main; \ + vnet_feature_arc_registration_t *r = &vnet_feat_arc_##x; \ + VLIB_REMOVE_FROM_LINKED_LIST (fm->next_arc, r, next); \ +} \ __VA_ARGS__ vnet_feature_arc_registration_t vnet_feat_arc_##x #define VNET_FEATURE_INIT(x,...) \ @@ -121,6 +129,14 @@ static void __vnet_add_feature_registration_##x (void) \ vnet_feat_##x.next = fm->next_feature; \ fm->next_feature = & vnet_feat_##x; \ } \ +static void __vnet_rm_feature_registration_##x (void) \ + __attribute__((__destructor__)) ; \ +static void __vnet_rm_feature_registration_##x (void) \ +{ \ + vnet_feature_main_t * fm = &feature_main; \ + vnet_feature_registration_t *r = &vnet_feat_##x; \ + VLIB_REMOVE_FROM_LINKED_LIST (fm->next_feature, r, next); \ +} \ __VA_ARGS__ vnet_feature_registration_t vnet_feat_##x void diff --git a/src/vnet/interface.h b/src/vnet/interface.h index 00a7353d701..6a140d2059c 100644 --- a/src/vnet/interface.h +++ b/src/vnet/interface.h @@ -101,6 +101,31 @@ static void __vnet_interface_function_init_##tag##_##f (void) \ init_function.next_interface_function = vnm->tag##_functions[p]; \ vnm->tag##_functions[p] = &init_function; \ init_function.fp = (void *) &f; \ +} \ +static void __vnet_interface_function_deinit_##tag##_##f (void) \ + __attribute__((__destructor__)) ; \ + \ +static void __vnet_interface_function_deinit_##tag##_##f (void) \ +{ \ + vnet_main_t * vnm = vnet_get_main(); \ + _vnet_interface_function_list_elt_t *next; \ + if (vnm->tag##_functions[p]->fp == (void *) &f) \ + { \ + vnm->tag##_functions[p] = \ + vnm->tag##_functions[p]->next_interface_function; \ + return; \ + } \ + next = vnm->tag##_functions[p]; \ + while (next->next_interface_function) \ + { \ + if (next->next_interface_function->fp == (void *) &f) \ + { \ + next->next_interface_function = \ + next->next_interface_function->next_interface_function; \ + return; \ + } \ + next = next->next_interface_function; \ + } \ } #define _VNET_INTERFACE_FUNCTION_DECL(f,tag) \ @@ -200,6 +225,14 @@ static void __vnet_add_device_class_registration_##x (void) \ x.next_class_registration = vnm->device_class_registrations; \ vnm->device_class_registrations = &x; \ } \ +static void __vnet_rm_device_class_registration_##x (void) \ + __attribute__((__destructor__)) ; \ +static void __vnet_rm_device_class_registration_##x (void) \ +{ \ + vnet_main_t * vnm = vnet_get_main(); \ + VLIB_REMOVE_FROM_LINKED_LIST (vnm->device_class_registrations, \ + &x, next_class_registration); \ +} \ __VA_ARGS__ vnet_device_class_t x #define VLIB_DEVICE_TX_FUNCTION_CLONE_TEMPLATE(arch, fn, tgt) \ @@ -368,6 +401,14 @@ static void __vnet_add_hw_interface_class_registration_##x (void) \ x.next_class_registration = vnm->hw_interface_class_registrations; \ vnm->hw_interface_class_registrations = &x; \ } \ +static void __vnet_rm_hw_interface_class_registration_##x (void) \ + __attribute__((__destructor__)) ; \ +static void __vnet_rm_hw_interface_class_registration_##x (void) \ +{ \ + vnet_main_t * vnm = vnet_get_main(); \ + VLIB_REMOVE_FROM_LINKED_LIST (vnm->hw_interface_class_registrations,\ + &x, next_class_registration); \ +} \ __VA_ARGS__ vnet_hw_interface_class_t x /* Hardware-interface. This corresponds to a physical wire |