aboutsummaryrefslogtreecommitdiffstats
path: root/src/vnet/interface.c
diff options
context:
space:
mode:
authorMohsin Kazmi <sykazmi@cisco.com>2018-07-23 14:45:57 +0200
committerDamjan Marion <dmarion@me.com>2018-08-11 15:01:42 +0000
commitdd8e7d0e512425ec05de652a3c71028561e0f40a (patch)
tree849eaaabe4c2a07a0bd9cf8173e6cfbac31ffdf5 /src/vnet/interface.c
parent7f1f7e7865f07f98b5ab6d4ab483cd9a51e4ce4e (diff)
Multiversioning: Device (tx) function constructor
Change-Id: I39f87ca161c891fb22462a23188982fef7c3243f Signed-off-by: Mohsin Kazmi <sykazmi@cisco.com>
Diffstat (limited to 'src/vnet/interface.c')
-rw-r--r--src/vnet/interface.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/src/vnet/interface.c b/src/vnet/interface.c
index ca4dc493aac..1e69ccbf6ea 100644
--- a/src/vnet/interface.c
+++ b/src/vnet/interface.c
@@ -1359,6 +1359,27 @@ vnet_interface_init (vlib_main_t * vm)
{
c->index = vec_len (im->device_classes);
hash_set_mem (im->device_class_by_name, c->name, c->index);
+
+ if (c->tx_fn_registrations)
+ {
+ vlib_node_fn_registration_t *fnr = c->tx_fn_registrations;
+ int priority = -1;
+
+ /* to avoid confusion, please remove ".tx_function" statiement
+ from VNET_DEVICE_CLASS() if using function candidates */
+ ASSERT (c->tx_function == 0);
+
+ while (fnr)
+ {
+ if (fnr->priority > priority)
+ {
+ priority = fnr->priority;
+ c->tx_function = fnr->function;
+ }
+ fnr = fnr->next_registration;
+ }
+ }
+
vec_add1 (im->device_classes, c[0]);
c = c->next_class_registration;
}