16 #ifndef included_features_h 17 #define included_features_h 24 typedef struct _vnet_feature_arc_registration
27 struct _vnet_feature_arc_registration *next;
42 (
u32 sw_if_index,
int enable_disable);
45 typedef struct _vnet_feature_registration
48 struct _vnet_feature_registration *next, *next_in_arc;
54 u32 *feature_index_ptr;
66 typedef struct _vnet_feature_constraint_registration
69 struct _vnet_feature_constraint_registration *next, *next_in_arc;
121 #ifndef CLIB_MARCH_VARIANT 122 #define VNET_FEATURE_ARC_INIT(x,...) \ 123 __VA_ARGS__ vnet_feature_arc_registration_t vnet_feat_arc_##x;\ 124 static void __vnet_add_feature_arc_registration_##x (void) \ 125 __attribute__((__constructor__)) ; \ 126 static void __vnet_add_feature_arc_registration_##x (void) \ 128 vnet_feature_main_t * fm = &feature_main; \ 129 vnet_feat_arc_##x.next = fm->next_arc; \ 130 fm->next_arc = & vnet_feat_arc_##x; \ 132 static void __vnet_rm_feature_arc_registration_##x (void) \ 133 __attribute__((__destructor__)) ; \ 134 static void __vnet_rm_feature_arc_registration_##x (void) \ 136 vnet_feature_main_t * fm = &feature_main; \ 137 vnet_feature_arc_registration_t *r = &vnet_feat_arc_##x; \ 138 VLIB_REMOVE_FROM_LINKED_LIST (fm->next_arc, r, next); \ 140 __VA_ARGS__ vnet_feature_arc_registration_t vnet_feat_arc_##x 142 #define VNET_FEATURE_INIT(x,...) \ 143 __VA_ARGS__ vnet_feature_registration_t vnet_feat_##x; \ 144 static void __vnet_add_feature_registration_##x (void) \ 145 __attribute__((__constructor__)) ; \ 146 static void __vnet_add_feature_registration_##x (void) \ 148 vnet_feature_main_t * fm = &feature_main; \ 149 vnet_feat_##x.next = fm->next_feature; \ 150 fm->next_feature = & vnet_feat_##x; \ 152 static void __vnet_rm_feature_registration_##x (void) \ 153 __attribute__((__destructor__)) ; \ 154 static void __vnet_rm_feature_registration_##x (void) \ 156 vnet_feature_main_t * fm = &feature_main; \ 157 vnet_feature_registration_t *r = &vnet_feat_##x; \ 158 VLIB_REMOVE_FROM_LINKED_LIST (fm->next_feature, r, next); \ 160 __VA_ARGS__ vnet_feature_registration_t vnet_feat_##x 162 #define VNET_FEATURE_ARC_ORDER(x,...) \ 163 __VA_ARGS__ vnet_feature_constraint_registration_t \ 164 vnet_feature_constraint_##x; \ 165 static void __vnet_add_constraint_registration_##x (void) \ 166 __attribute__((__constructor__)) ; \ 167 static void __vnet_add_constraint_registration_##x (void) \ 169 vnet_feature_main_t * fm = &feature_main; \ 170 vnet_feature_constraint_##x.next = fm->next_constraint; \ 171 fm->next_constraint = & vnet_feature_constraint_##x; \ 173 static void __vnet_rm_constraint_registration_##x (void) \ 174 __attribute__((__destructor__)) ; \ 175 static void __vnet_rm_constraint_registration_##x (void) \ 177 vnet_feature_main_t * fm = &feature_main; \ 178 vnet_feature_constraint_registration_t *r = &vnet_feature_constraint_##x; \ 179 VLIB_REMOVE_FROM_LINKED_LIST (fm->next_constraint, r, next); \ 181 __VA_ARGS__ vnet_feature_constraint_registration_t vnet_feature_constraint_##x 184 #define VNET_FEATURE_ARC_INIT(x,...) \ 185 extern vnet_feature_arc_registration_t __clib_unused vnet_feat_arc_##x; \ 186 static vnet_feature_arc_registration_t __clib_unused __clib_unused_vnet_feat_arc_##x 187 #define VNET_FEATURE_INIT(x,...) \ 188 extern vnet_feature_registration_t __clib_unused vnet_feat_##x; \ 189 static vnet_feature_registration_t __clib_unused __clib_unused_vnet_feat_##x 191 #define VNET_FEATURE_ARC_ORDER(x,...) \ 192 extern vnet_feature_constraint_registration_t \ 193 __clib_unused vnet_feature_constraint_##x; \ 194 static vnet_feature_constraint_registration_t __clib_unused \ 195 __clib_unused_vnet_feature_constraint_##x 202 u32 sw_if_index,
int is_add);
207 const char *node_name);
212 u32 sw_if_index,
int enable_disable,
213 void *feature_config,
214 u32 n_feature_config_bytes);
218 u32 sw_if_index,
int enable_disable,
219 void *feature_config,
220 u32 n_feature_config_bytes);
237 if (arc_index == (
u8) ~ 0)
364 vnet_buffer (b0)->feature_arc_index = feature_arc_index;
399 vnet_buffer (b0)->feature_arc_index = feature_arc_index;
400 vnet_buffer (b1)->feature_arc_index = feature_arc_index;
448 vnet_buffer (b0)->feature_arc_index = feature_arc_index;
449 vnet_buffer (b1)->feature_arc_index = feature_arc_index;
450 vnet_buffer (b2)->feature_arc_index = feature_arc_index;
451 vnet_buffer (b3)->feature_arc_index = feature_arc_index;
470 #define VNET_FEATURES(...) (char*[]) { __VA_ARGS__, 0} 475 char **feature_start_nodes,
476 int num_feature_start_nodes,
480 char ***in_feature_nodes);
487 u8 is_enable,
void *cb);
vnet_config_main_t config_main
struct vnet_feature_config_main_t_ vnet_feature_config_main_t
clib_error_t *() vnet_feature_enable_disable_function_t(u32 sw_if_index, int enable_disable)
u32 vnet_feature_modify_end_node(u8 arc_index, u32 sw_if_index, u32 node_index)
struct _vnet_feature_constraint_registration vnet_feature_constraint_registration_t
constraint registration object
const u32 device_input_next_node_advance[((VNET_DEVICE_INPUT_N_NEXT_NODES/CLIB_CACHE_LINE_BYTES)+1) *CLIB_CACHE_LINE_BYTES]
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)
static_always_inline u32 vnet_get_feature_count(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)
static_always_inline void vnet_feature_next_u16(u16 *next0, vlib_buffer_t *b0)
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, char *last_in_arc, vnet_feature_registration_t *first_reg, vnet_feature_constraint_registration_t *first_const_set, char ***in_feature_nodes)
Initialize a feature graph arc.
vnet_feature_constraint_registration_t * next_constraint
#define static_always_inline
u8 vnet_get_feature_arc_index(const char *s)
vl_api_interface_index_t sw_if_index
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
static_always_inline void * vnet_feature_next_with_data(u32 *next0, vlib_buffer_t *b0, u32 n_data_bytes)
void vnet_feature_register(vnet_feature_update_cb_t cb, void *data)
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_arc_start_w_cfg_index(u8 arc, u32 sw_if_index, u32 *next, vlib_buffer_t *b, u32 cfg_index)
void(* vnet_feature_update_cb_t)(u32 sw_if_index, u8 arc_index, u8 is_enable, void *cb)
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)
static_always_inline void vnet_feature_next(u32 *next0, vlib_buffer_t *b0)
u32 vnet_get_feature_index(u8 arc, const char *s)
u32 current_config_index
Used by feature subgraph arcs to visit enabled feature nodes.
static uword clib_bitmap_get(uword *ai, uword i)
Gets the ith bit value from a bitmap.
vnet_feature_constraint_registration_t ** next_constraint_by_arc
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)
#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)
VLIB buffer representation.
static vnet_feature_config_main_t * vnet_get_feature_arc_config_main(u8 arc_index)
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)