aboutsummaryrefslogtreecommitdiffstats
path: root/src/vnet/interface.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/vnet/interface.h')
-rw-r--r--src/vnet/interface.h41
1 files changed, 41 insertions, 0 deletions
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