|
FD.io VPP
v21.10.1-2-g0a485f517
Vector Packet Processing
|
Go to the documentation of this file.
67 if (areg->arc_index_ptr)
73 while ((s = areg->start_nodes[
i]))
77 areg->n_start_nodes =
i;
100 clib_warning (
"Unknown feature arc '%s'", freg->arc_name);
124 clib_warning (
"Unknown feature arc '%s'", creg->arc_name);
146 char **features_in_order, *last_feature;
152 (
vm, vcm, areg->start_nodes, areg->n_start_nodes,
165 if (areg->last_in_arc &&
vec_len (features_in_order) > 0)
167 last_feature = features_in_order[
vec_len (features_in_order) - 1];
168 if (strncmp (areg->last_in_arc, last_feature,
169 strlen (areg->last_in_arc)))
171 (
"WARNING: %s arc: last node is %s, but expected %s!",
172 areg->arc_name, last_feature, areg->last_in_arc);
183 freg = freg->next_in_arc;
208 return reg->feature_arc_index;
247 return reg->feature_index;
253 void *feature_config,
254 u32 n_feature_config_bytes)
262 return VNET_API_ERROR_INVALID_VALUE;
264 if (feature_index == ~0)
265 return VNET_API_ERROR_INVALID_VALUE_2;
274 if (!enable_disable && feature_count < 1)
281 n_feature_config_bytes);
289 enable_disable = (enable_disable > 0);
290 feature_count += enable_disable ? 1 : -1;
291 ASSERT (feature_count >= 0);
295 (feature_count > 0));
305 void *feature_config,
u32 n_feature_config_bytes)
313 return VNET_API_ERROR_INVALID_VALUE;
320 n_feature_config_bytes);
341 return VNET_API_ERROR_INVALID_VALUE;
346 if (feature_index == (
u32) ~ 0)
347 return VNET_API_ERROR_INVALID_VALUE_2;
355 return VNET_API_ERROR_INVALID_SW_IF_INDEX;
370 if (
f->feature_index == feature_index)
388 return VNET_API_ERROR_INVALID_VALUE;
390 if (end_node_index == ~0)
391 return VNET_API_ERROR_INVALID_VALUE_2;
412 return (
int) reg1->feature_index - reg2->feature_index;
447 freg = freg->next_in_arc;
480 .path =
"show features",
481 .short_help =
"show features [verbose]",
512 feature_arc = areg->feature_arc_index;
524 current_config_index =
545 [current_config_index]);
561 u8 *feature_name = 0;
575 else if (
unformat (line_input,
"disable"))
583 if (!feature_name || !arc_name)
606 (
const char *) arc_name);
613 (
const char *) feature_name);
618 "Feature (%s) not registered to arc (%s)... See 'show features verbose' for valid feature/arc combinations. ",
619 feature_name, arc_name);
622 if (reg->enable_disable_cb)
647 .path =
"set interface feature",
648 .short_help =
"set interface feature <intfc> <feature_name> arc <arc_name> "
667 for (far =
fm->
next_arc; far != 0; far = far->next)
vnet_feature_main_t feature_main
#define vec_reset_length(v)
Reset vector length to zero NULL-pointer tolerant.
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)
uword ** sw_if_index_has_features
bitmap of interfaces which have driver rx features configured
static vlib_cli_command_t show_features_command
(constructor) VLIB_CLI_COMMAND (show_features_command)
vnet_config_main_t config_main
static_always_inline int vnet_have_features(u8 arc, u32 sw_if_index)
void vnet_feature_register(vnet_feature_update_cb_t cb, void *data)
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)
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.
static uword pointer_to_uword(const void *p)
#define pool_elt_at_index(p, i)
Returns pointer to element at given index.
vnet_feature_registration_t * vnet_get_feature_reg(const char *arc_name, const char *node_name)
#define hash_create_string(elts, value_bytes)
#define clib_error_return(e, args...)
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)
@ VNET_ITF_FUNC_PRIORITY_HIGH
#define hash_set_mem(h, key, value)
u32 * config_index_by_sw_if_index
vlib_main_t * vm
X-connect all packets from the HOST to the PHY.
struct _vnet_feature_registration vnet_feature_registration_t
feature registration object
#define clib_error_report(e)
vlib_combined_counter_main_t * ccm
struct vnet_feature_upd_registration_t_ vnet_feature_upd_registration_t
void vnet_config_del(vnet_config_main_t *cm, u32 config_id)
vnet_feature_registration_t * next_feature
feature path configuration lists
char *** feature_nodes
Save partial order results for show command.
vnet_config_feature_t * features
vnet_feature_constraint_registration_t * next_constraint
#define vec_elt(v, i)
Get vector value at index i.
static vnet_feature_upd_registration_t * regs
#define vec_len(v)
Number of elements in vector (rvalue-only, NULL tolerant)
VNET_SW_INTERFACE_ADD_DEL_FUNCTION_PRIO(vnet_feature_add_del_sw_interface, VNET_ITF_FUNC_PRIORITY_HIGH)
#define vec_add2(V, P, N)
Add N elements to end of vector V, return pointer to new elements in P.
#define vec_add1(V, E)
Add 1 element to end of vector (unspecified alignment).
#define vec_elt_at_index(v, i)
Get vector value at index i checking that i is in bounds.
vnet_main_t * vnet_get_main(void)
static int feature_cmp(void *a1, void *a2)
uword ** next_feature_by_name
static vlib_node_t * vlib_get_node(vlib_main_t *vm, u32 i)
Get vlib node by index.
u32 * config_pool_index_by_user_index
vnet_feature_config_main_t * cm
static void vnet_feature_reg_invoke(u32 sw_if_index, u8 arc_index, u8 is_enable)
#define vec_validate(V, I)
Make sure vector is long enough for given index (no header, unspecified alignment)
u32 vnet_config_modify_end_node(vlib_main_t *vm, vnet_config_main_t *cm, u32 config_string_heap_index, u32 end_node_index)
u32 vnet_get_feature_index(u8 arc, const char *s)
#define VLIB_CLI_COMMAND(x,...)
static clib_error_t * vnet_feature_init(vlib_main_t *vm)
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.
void vlib_cli_output(vlib_main_t *vm, char *fmt,...)
static clib_error_t * vnet_feature_add_del_sw_interface(vnet_main_t *vnm, u32 sw_if_index, u32 is_add)
#define hash_get_mem(h, key)
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...
#define vec_free(V)
Free vector's memory (no header).
static clib_error_t * set_interface_features_command_fn(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
u32 vnet_feature_modify_end_node(u8 arc_index, u32 sw_if_index, u32 end_node_index)
int vnet_feature_is_enabled(const char *arc_name, const char *feature_node_name, u32 sw_if_index)
vnet_feature_update_cb_t cb
void(* vnet_feature_update_cb_t)(u32 sw_if_index, u8 arc_index, u8 is_enable, void *cb)
format_function_t format_vnet_sw_if_index_name
unformat_function_t unformat_vnet_sw_interface
#define heap_elt_at_index(v, index)
#define vec_validate_init_empty(V, I, INIT)
Make sure vector is long enough for given index and initialize empty space (no header,...
i16 ** feature_count_by_sw_if_index
feature reference counts by interface
#define VLIB_INIT_FUNCTION(x)
vnet_feature_constraint_registration_t ** next_constraint_by_arc
vnet_feature_arc_registration_t * next_arc
feature arc configuration list
u32 * end_node_indices_by_user_index
#define vec_foreach(var, vec)
Vector iterator.
vnet_feature_registration_t ** next_feature_by_arc
#define vec_sort_with_function(vec, f)
Sort a vector using the supplied element comparison function.
uword ** arc_index_by_name
struct _vnet_feature_constraint_registration vnet_feature_constraint_registration_t
constraint registration object
static vlib_main_t * vlib_get_main(void)
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)
clib_error_t *() vlib_init_function_t(struct vlib_main_t *vm)
#define uword_to_pointer(u, type)
static vlib_cli_command_t set_interface_feature_command
(constructor) VLIB_CLI_COMMAND (set_interface_feature_command)
#define clib_warning(format, args...)
vnet_feature_config_main_t * feature_config_mains
feature config main objects
u8 vnet_get_feature_arc_index(const char *s)
vl_api_interface_index_t sw_if_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.
struct _vnet_feature_arc_registration vnet_feature_arc_registration_t
feature registration object
vnet_config_t * config_pool