16 #ifndef included_features_h 17 #define included_features_h 24 typedef struct _vnet_feature_arc_registration
27 struct _vnet_feature_arc_registration *next;
40 (
u32 sw_if_index,
int enable_disable);
43 typedef struct _vnet_feature_registration
46 struct _vnet_feature_registration *next, *next_in_arc;
52 u32 *feature_index_ptr;
102 #define VNET_FEATURE_ARC_INIT(x,...) \ 103 __VA_ARGS__ vnet_feature_arc_registration_t vnet_feat_arc_##x;\ 104 static void __vnet_add_feature_arc_registration_##x (void) \ 105 __attribute__((__constructor__)) ; \ 106 static void __vnet_add_feature_arc_registration_##x (void) \ 108 vnet_feature_main_t * fm = &feature_main; \ 109 vnet_feat_arc_##x.next = fm->next_arc; \ 110 fm->next_arc = & vnet_feat_arc_##x; \ 112 static void __vnet_rm_feature_arc_registration_##x (void) \ 113 __attribute__((__destructor__)) ; \ 114 static void __vnet_rm_feature_arc_registration_##x (void) \ 116 vnet_feature_main_t * fm = &feature_main; \ 117 vnet_feature_arc_registration_t *r = &vnet_feat_arc_##x; \ 118 VLIB_REMOVE_FROM_LINKED_LIST (fm->next_arc, r, next); \ 120 __VA_ARGS__ vnet_feature_arc_registration_t vnet_feat_arc_##x 122 #define VNET_FEATURE_INIT(x,...) \ 123 __VA_ARGS__ vnet_feature_registration_t vnet_feat_##x; \ 124 static void __vnet_add_feature_registration_##x (void) \ 125 __attribute__((__constructor__)) ; \ 126 static void __vnet_add_feature_registration_##x (void) \ 128 vnet_feature_main_t * fm = &feature_main; \ 129 vnet_feat_##x.next = fm->next_feature; \ 130 fm->next_feature = & vnet_feat_##x; \ 132 static void __vnet_rm_feature_registration_##x (void) \ 133 __attribute__((__destructor__)) ; \ 134 static void __vnet_rm_feature_registration_##x (void) \ 136 vnet_feature_main_t * fm = &feature_main; \ 137 vnet_feature_registration_t *r = &vnet_feat_##x; \ 138 VLIB_REMOVE_FROM_LINKED_LIST (fm->next_feature, r, next); \ 140 __VA_ARGS__ vnet_feature_registration_t vnet_feat_##x 144 u32 sw_if_index,
int is_add);
149 const char *node_name);
154 u32 sw_if_index,
int enable_disable,
155 void *feature_config,
156 u32 n_feature_config_bytes);
160 u32 sw_if_index,
int enable_disable,
161 void *feature_config,
162 u32 n_feature_config_bytes);
169 if (arc_index == (
u8) ~ 0)
268 vnet_buffer (b0)->device_input_feat.saved_next_index = *next0;
270 vnet_buffer (b0)->device_input_feat.buffer_advance = adv;
273 vnet_buffer (b0)->feature_arc_index = feature_arc_index;
302 vnet_buffer (b0)->device_input_feat.saved_next_index = *next0;
304 vnet_buffer (b0)->device_input_feat.buffer_advance = adv;
307 vnet_buffer (b1)->device_input_feat.saved_next_index = *next1;
309 vnet_buffer (b1)->device_input_feat.buffer_advance = adv;
312 vnet_buffer (b0)->feature_arc_index = feature_arc_index;
313 vnet_buffer (b1)->feature_arc_index = feature_arc_index;
349 vnet_buffer (b0)->device_input_feat.saved_next_index = *next0;
351 vnet_buffer (b0)->device_input_feat.buffer_advance = adv;
354 vnet_buffer (b1)->device_input_feat.saved_next_index = *next1;
356 vnet_buffer (b1)->device_input_feat.buffer_advance = adv;
359 vnet_buffer (b2)->device_input_feat.saved_next_index = *next2;
361 vnet_buffer (b2)->device_input_feat.buffer_advance = adv;
364 vnet_buffer (b3)->device_input_feat.saved_next_index = *next3;
366 vnet_buffer (b3)->device_input_feat.buffer_advance = adv;
369 vnet_buffer (b0)->feature_arc_index = feature_arc_index;
370 vnet_buffer (b1)->feature_arc_index = feature_arc_index;
371 vnet_buffer (b2)->feature_arc_index = feature_arc_index;
372 vnet_buffer (b3)->feature_arc_index = feature_arc_index;
391 #define VNET_FEATURES(...) (char*[]) { __VA_ARGS__, 0} 395 char **feature_start_nodes,
396 int num_feature_start_nodes,
398 first_reg,
char ***feature_nodes);
vnet_config_main_t config_main
struct vnet_feature_config_main_t_ vnet_feature_config_main_t
u32 current_config_index
Used by feature subgraph arcs to visit enabled feature nodes.
char *** feature_nodes
Save partial order results for show command.
vnet_feature_registration_t * next_feature
feature path configuration lists
static_always_inline void vnet_feature_start_device_input_x4(u32 sw_if_index, u32 *next0, u32 *next1, u32 *next2, u32 *next3, vlib_buffer_t *b0, vlib_buffer_t *b1, vlib_buffer_t *b2, vlib_buffer_t *b3)
u32 * config_index_by_sw_if_index
static_always_inline int vnet_have_features(u8 arc, u32 sw_if_index)
void vnet_config_update_feature_count(vnet_feature_main_t *fm, u8 arc, u32 sw_if_index, int is_add)
#define static_always_inline
u8 vnet_get_feature_arc_index(const char *s)
vlib_main_t * vlib_main
convenience
static_always_inline int vnet_device_input_have_features(u32 sw_if_index)
void vnet_interface_features_show(vlib_main_t *vm, u32 sw_if_index, int verbose)
Display the set of driver features configured on a specific interface Called by "show interface" hand...
vnet_feature_main_t feature_main
const u32 device_input_next_node_advance[((VNET_DEVICE_INPUT_N_NEXT_NODES/CLIB_CACHE_LINE_BYTES)+1)*CLIB_CACHE_LINE_BYTES]
clib_error_t * vnet_feature_arc_init(vlib_main_t *vm, vnet_config_main_t *vcm, char **feature_start_nodes, int num_feature_start_nodes, vnet_feature_registration_t *first_reg, char ***feature_nodes)
Initialize a feature graph arc.
static void * vnet_get_config_data(vnet_config_main_t *cm, u32 *config_index, u32 *next_index, u32 n_data_bytes)
static_always_inline void vnet_feature_next(u32 sw_if_index, u32 *next0, vlib_buffer_t *b0)
uword ** next_feature_by_name
static_always_inline void vnet_feature_start_device_input_x2(u32 sw_if_index, u32 *next0, u32 *next1, vlib_buffer_t *b0, vlib_buffer_t *b1)
int vnet_feature_enable_disable_with_index(u8 arc_index, u32 feature_index, u32 sw_if_index, int enable_disable, void *feature_config, u32 n_feature_config_bytes)
u32 vnet_get_feature_index(u8 arc, const char *s)
static uword clib_bitmap_get(uword *ai, uword i)
Gets the ith bit value from a bitmap.
uword ** arc_index_by_name
i16 ** feature_count_by_sw_if_index
feature reference counts by interface
vnet_feature_registration_t ** next_feature_by_arc
static void vlib_buffer_advance(vlib_buffer_t *b, word l)
Advance current data pointer by the supplied (signed!) amount.
int vnet_feature_enable_disable(const char *arc_name, const char *node_name, u32 sw_if_index, int enable_disable, void *feature_config, u32 n_feature_config_bytes)
clib_error_t *( vnet_feature_enable_disable_function_t)(u32 sw_if_index, int enable_disable)
#define vec_elt(v, i)
Get vector value at index i.
u8 device_input_feature_arc_index
Feature arc index for device-input.
static_always_inline u32 vnet_get_feature_config_index(u8 arc, u32 sw_if_index)
static_always_inline void * vnet_feature_arc_start_with_data(u8 arc, u32 sw_if_index, u32 *next, vlib_buffer_t *b, u32 n_data_bytes)
static vnet_feature_config_main_t * vnet_get_feature_arc_config_main(u8 arc_index)
static_always_inline void * vnet_feature_next_with_data(u32 sw_if_index, u32 *next0, vlib_buffer_t *b0, u32 n_data_bytes)
struct _vnet_feature_arc_registration vnet_feature_arc_registration_t
feature registration object
vnet_feature_arc_registration_t * next_arc
feature arc configuration list
static_always_inline void vnet_feature_start_device_input_x1(u32 sw_if_index, u32 *next0, vlib_buffer_t *b0)
uword ** sw_if_index_has_features
bitmap of interfaces which have driver rx features configured
vnet_feature_registration_t * vnet_get_feature_reg(const char *arc_name, const char *node_name)
vnet_feature_config_main_t * feature_config_mains
feature config main objects
static_always_inline vnet_feature_config_main_t * vnet_feature_get_config_main(u16 arc)
struct _vnet_feature_registration vnet_feature_registration_t
feature registration object
static_always_inline void vnet_feature_arc_start(u8 arc, u32 sw_if_index, u32 *next0, vlib_buffer_t *b0)