40 #include <sys/types.h> 45 typedef struct _vlib_node_march_variant
47 struct _vlib_node_march_variant *next_variant;
51 #define VLIB_VARIANT_REGISTER() \ 52 static vlib_node_march_variant_t \ 53 CLIB_MARCH_VARIANT##variant; \ 55 static void __clib_constructor \ 56 CLIB_MARCH_VARIANT##_register (void) \ 58 extern vlib_node_march_variant_t *variants; \ 59 vlib_node_march_variant_t *v; \ 60 v = & CLIB_MARCH_VARIANT##variant; \ 61 v->name = CLIB_MARCH_VARIANT_STR; \ 62 v->next_variant = variants; \ 68 #ifndef CLIB_MARCH_VARIANT 75 u8 **variant = va_arg (*args,
u8 **);
78 if (!
unformat (input,
"%v", variant))
83 if (!strncmp (v->name, (
char *) *variant,
vec_len (*variant)))
103 if (!p_reg || fnr->priority > p_reg->priority)
107 if (!strncmp (fnr->name, (
char *) variant,
vec_len (variant) - 1))
110 fnr = fnr->next_registration;
117 ASSERT (p_reg != 0 && v_reg != 0);
120 tmp = p_reg->priority;
121 p_reg->priority = v_reg->priority;
122 v_reg->priority = tmp;
147 nr = nr->next_registration;
158 if (!
unformat (&sub_input,
"variant %U",
161 "please specify a valid node variant");
169 nr = nr->next_registration;
178 c = c->next_class_registration;
190 "node variants: unknown graph node '%s'",
202 if (!
unformat (&sub_input,
"variant %U",
205 "please specify a valid node variant");
vnet_main_t * vnet_get_main(void)
vnet_device_class_t * device_class_registrations
#define vec_add1(V, E)
Add 1 element to end of vector (unspecified alignment).
#define hash_set_mem(h, key, value)
struct _vnet_device_class vnet_device_class_t
#define static_always_inline
struct _vlib_node_march_variant vlib_node_march_variant_t
#define clib_error_return(e, args...)
vlib_node_march_variant_t * variants
struct _vlib_node_fn_registration vlib_node_fn_registration_t
#define hash_create_string(elts, value_bytes)
vlib_node_registration_t * node_registrations
static_always_inline void vlib_update_nr_variant_default(vlib_node_fn_registration_t *fnr, u8 *variant)
#define VLIB_EARLY_CONFIG_FUNCTION(x, n,...)
#define vec_free(V)
Free vector's memory (no header).
#define VLIB_VARIANT_REGISTER()
uword unformat_vlib_cli_sub_input(unformat_input_t *i, va_list *args)
#define vec_elt(v, i)
Get vector value at index i.
struct _vlib_node_registration vlib_node_registration_t
#define vec_len(v)
Number of elements in vector (rvalue-only, NULL tolerant)
vlib_node_main_t node_main
static clib_error_t * vlib_early_node_config(vlib_main_t *vm, unformat_input_t *input)
uword unformat_vlib_node_variant(unformat_input_t *input, va_list *args)
#define hash_get_mem(h, key)