40 #include <sys/types.h> 44 typedef struct _vlib_node_march_variant
46 struct _vlib_node_march_variant *next_variant;
50 #define VLIB_VARIANT_REGISTER() \ 51 static vlib_node_march_variant_t \ 52 CLIB_MARCH_VARIANT##variant; \ 54 static void __clib_constructor \ 55 CLIB_MARCH_VARIANT##_register (void) \ 57 extern vlib_node_march_variant_t *variants; \ 58 vlib_node_march_variant_t *v; \ 59 v = & CLIB_MARCH_VARIANT##variant; \ 60 v->name = CLIB_MARCH_VARIANT_STR; \ 61 v->next_variant = variants; \ 67 #ifndef CLIB_MARCH_VARIANT 74 u8 **variant = va_arg (*args,
u8 **);
77 if (!
unformat (input,
"%v", variant))
82 if (!strncmp (v->name, (
char *) *variant,
vec_len (*variant)))
102 if (!p_reg || fnr->priority > p_reg->priority)
106 if (!strncmp (fnr->name, (
char *) variant,
vec_len (variant) - 1))
109 fnr = fnr->next_registration;
116 ASSERT (p_reg != 0 && v_reg != 0);
119 tmp = p_reg->priority;
120 p_reg->priority = v_reg->priority;
121 v_reg->priority = tmp;
144 nr = nr->next_registration;
155 if (!
unformat (&sub_input,
"variant %U",
158 "please specify a valid node variant");
165 nr = nr->next_registration;
177 "node variants: unknown graph node '%s'",
189 if (!
unformat (&sub_input,
"variant %U",
192 "please specify a valid node variant");
#define vec_add1(V, E)
Add 1 element to end of vector (unspecified alignment).
#define hash_set_mem(h, key, value)
#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)
static_always_inline void vlib_update_nr_variant_default(vlib_node_registration_t *nr, u8 *variant)
vlib_node_registration_t * node_registrations
#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)