X-Git-Url: https://gerrit.fd.io/r/gitweb?a=blobdiff_plain;f=src%2Fvnet%2Finterface.h;h=e9adfe84cbffc948c88056e9e604ed47de3693b1;hb=dd8e7d0e512425ec05de652a3c71028561e0f40a;hp=d869b0c70a22a13e28ae8acbfdfc7738a1c76fa2;hpb=7f1f7e7865f07f98b5ab6d4ab483cd9a51e4ce4e;p=vpp.git diff --git a/src/vnet/interface.h b/src/vnet/interface.h index d869b0c70a2..e9adfe84cbf 100644 --- a/src/vnet/interface.h +++ b/src/vnet/interface.h @@ -195,6 +195,9 @@ typedef struct _vnet_device_class /* Transmit function. */ vlib_node_function_t *tx_function; + /* Transmit function candidate registration with priority */ + vlib_node_fn_registration_t *tx_fn_registrations; + /* Error strings indexed by error code for this node. */ char **tx_function_error_strings; @@ -265,6 +268,24 @@ static void __vnet_rm_device_class_registration_##x (void) \ } \ __VA_ARGS__ vnet_device_class_t x +#define VNET_DEVICE_CLASS_TX_FN(devclass) \ +uword CLIB_MARCH_SFX (devclass##_tx_fn)(); \ +static vlib_node_fn_registration_t \ + CLIB_MARCH_SFX(devclass##_tx_fn_registration) = \ + { .function = &CLIB_MARCH_SFX (devclass##_tx_fn), }; \ + \ +static void __clib_constructor \ +CLIB_MARCH_SFX (devclass##_tx_fn_multiarch_register) (void) \ +{ \ + extern vnet_device_class_t devclass; \ + vlib_node_fn_registration_t *r; \ + r = &CLIB_MARCH_SFX (devclass##_tx_fn_registration); \ + r->priority = CLIB_MARCH_FN_PRIORITY(); \ + r->next_registration = devclass.tx_fn_registrations; \ + devclass.tx_fn_registrations = r; \ +} \ +uword CLIB_CPU_OPTIMIZED CLIB_MARCH_SFX (devclass##_tx_fn) + #define VLIB_DEVICE_TX_FUNCTION_CLONE_TEMPLATE(arch, fn, tgt) \ uword \ __attribute__ ((flatten)) \