diff options
author | Mohsin Kazmi <sykazmi@cisco.com> | 2018-07-23 14:45:57 +0200 |
---|---|---|
committer | Damjan Marion <dmarion@me.com> | 2018-08-11 15:01:42 +0000 |
commit | dd8e7d0e512425ec05de652a3c71028561e0f40a (patch) | |
tree | 849eaaabe4c2a07a0bd9cf8173e6cfbac31ffdf5 /src/vnet/interface.h | |
parent | 7f1f7e7865f07f98b5ab6d4ab483cd9a51e4ce4e (diff) |
Multiversioning: Device (tx) function constructor
Change-Id: I39f87ca161c891fb22462a23188982fef7c3243f
Signed-off-by: Mohsin Kazmi <sykazmi@cisco.com>
Diffstat (limited to 'src/vnet/interface.h')
-rw-r--r-- | src/vnet/interface.h | 21 |
1 files changed, 21 insertions, 0 deletions
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)) \ |