36 areg->feature_arc_index = arc_index;
37 if (areg->arc_index_ptr)
38 *areg->arc_index_ptr = arc_index;
43 while ((s = areg->start_nodes[i]))
47 areg->n_start_nodes =
i;
71 arc_index = areg->feature_arc_index;
88 arc_index = areg->feature_arc_index;
136 return reg->feature_arc_index;
145 if (arc_index == (
u8) ~ 0)
175 return reg->feature_index;
180 u32 sw_if_index,
int enable_disable,
181 void *feature_config,
182 u32 n_feature_config_bytes)
187 int is_first_or_last;
190 if (arc_index == (
u8) ~ 0)
191 return VNET_API_ERROR_INVALID_VALUE;
193 if (feature_index == ~0)
194 return VNET_API_ERROR_INVALID_VALUE_2;
203 if (!enable_disable && feature_count < 1)
210 n_feature_config_bytes);
214 enable_disable = (enable_disable > 0);
215 feature_count += enable_disable ? 1 : -1;
216 is_first_or_last = (feature_count == enable_disable);
217 ASSERT (feature_count >= 0);
231 (feature_count > 0));
239 u32 sw_if_index,
int enable_disable,
240 void *feature_config,
u32 n_feature_config_bytes)
247 if (arc_index == (
u8) ~ 0)
248 return VNET_API_ERROR_INVALID_VALUE;
253 sw_if_index, enable_disable,
255 n_feature_config_bytes);
303 .path =
"show features",
304 .short_help =
"show features",
317 u32 node_index, current_config_index;
335 feature_arc = areg->feature_arc_index;
341 if (
NULL == cm[feature_arc].config_index_by_sw_if_index ||
342 vec_len (cm[feature_arc].config_index_by_sw_if_index) <=
349 current_config_index =
350 vec_elt (cm[feature_arc].config_index_by_sw_if_index, sw_if_index);
352 if (current_config_index == ~0)
358 ASSERT (current_config_index
384 u8 *feature_name = 0;
385 u32 sw_if_index = ~0;
398 else if (
unformat (line_input,
"arc %v", &arc_name))
400 else if (
unformat (line_input,
"disable"))
409 if (sw_if_index == ~0)
421 (
const char *) feature_name);
427 if (reg->enable_disable_cb)
428 error = reg->enable_disable_cb (sw_if_index, enable);
431 (
const char *) feature_name, sw_if_index,
451 .path =
"set interface feature",
452 .short_help =
"set interface feature <intfc> <feature_name> arc <arc_name>",
vnet_config_main_t config_main
#define vec_validate(V, I)
Make sure vector is long enough for given index (no header, unspecified alignment) ...
sll srl srl sll sra u16x4 i
vnet_config_feature_t * features
u8 vnet_get_feature_arc_index(const char *s)
static vlib_main_t * vlib_get_main(void)
char *** feature_nodes
Save partial order results for show command.
vnet_feature_registration_t * next_feature
feature path configuration lists
u32 vnet_config_del_feature(vlib_main_t *vm, vnet_config_main_t *cm, u32 config_string_heap_index, u32 feature_index, void *feature_config, u32 n_feature_config_bytes)
u32 * config_index_by_sw_if_index
#define vec_add1(V, E)
Add 1 element to end of vector (unspecified alignment).
static uword * clib_bitmap_set(uword *ai, uword i, uword value)
Sets the ith bit of a bitmap to new_value Removes trailing zeros from the bitmap. ...
#define hash_set_mem(h, key, value)
unformat_function_t unformat_vnet_sw_interface
format_function_t format_vnet_sw_if_index_name
vnet_main_t * vnet_get_main(void)
#define VLIB_INIT_FUNCTION(x)
vnet_feature_registration_t * vnet_get_feature_reg(const char *arc_name, const char *node_name)
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 clib_error_t * vnet_feature_init(vlib_main_t *vm)
static uword pointer_to_uword(const void *p)
#define hash_create_string(elts, value_bytes)
#define pool_elt_at_index(p, i)
Returns pointer to element at given index.
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 clib_error_t * set_interface_features_command_fn(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
void vlib_cli_output(vlib_main_t *vm, char *fmt,...)
uword ** next_feature_by_name
#define uword_to_pointer(u, type)
u32 * config_pool_index_by_user_index
void vnet_interface_features_show(vlib_main_t *vm, u32 sw_if_index)
Display the set of driver features configured on a specific interface Called by "show interface" hand...
#define vec_free(V)
Free vector's memory (no header).
uword ** arc_index_by_name
i16 ** feature_count_by_sw_if_index
feature reference counts by interface
#define VLIB_CLI_COMMAND(x,...)
vnet_feature_registration_t ** next_feature_by_arc
u32 vnet_config_add_feature(vlib_main_t *vm, vnet_config_main_t *cm, u32 config_string_heap_index, u32 feature_index, void *feature_config, u32 n_feature_config_bytes)
#define vec_elt(v, i)
Get vector value at index i.
#define vec_len(v)
Number of elements in vector (rvalue-only, NULL tolerant)
struct _vnet_feature_arc_registration vnet_feature_arc_registration_t
feature registration object
#define hash_get_mem(h, key)
vnet_feature_arc_registration_t * next_arc
feature arc configuration list
uword ** sw_if_index_has_features
bitmap of interfaces which have driver rx features configured
vnet_config_t * config_pool
static vlib_node_t * vlib_get_node(vlib_main_t *vm, u32 i)
Get vlib node by index.
static clib_error_t * show_features_command_fn(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
Display the set of available driver features.
#define clib_error_return(e, args...)
vnet_feature_config_main_t * feature_config_mains
feature config main objects
#define vec_validate_init_empty(V, I, INIT)
Make sure vector is long enough for given index and initialize empty space (no header, unspecified alignment)
vnet_feature_main_t feature_main
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)
struct _vnet_feature_registration vnet_feature_registration_t
feature registration object