|
FD.io VPP
v21.06-3-gbb25fbf28
Vector Packet Processing
|
Go to the documentation of this file.
38 #define FIB_PATH_LIST_POPULAR 64
90 #define FIB_PATH_LIST_DBG(_pl, _fmt, _args...) \
92 vlib_log_debug(fib_path_list_logger, \
94 format_fib_path_list, \
95 fib_path_list_get_index(_pl), 0, \
133 indent = va_arg (*args,
u32);
136 s =
format (s,
"%Upath-list:[%d]",
143 s =
format (s,
" flags:");
174 uword old_path_list_hash, new_path_list_hash, path_hash;
188 hash_mix64(path_hash, old_path_list_hash, new_path_list_hash);
190 hash_mix32(path_hash, old_path_list_hash, new_path_list_hash);
194 return (new_path_list_hash);
728 path_list_index = old_path_list_index;
749 return (path_list_index);
796 return (path_list_index);
849 new_path_indices = NULL;
872 new_path_indices[ii] = *path_index;
882 path_index = &new_path_indices[ii];
903 return (new_path_indices);
957 if (0 ==
fib_path_cmp(new_path_index, *orig_path_index))
971 path_list->
fpl_paths[pi++] = new_path_index;
996 path_list_index = exist_path_list_index;
1018 return (path_list_index);
1033 match_path_indices = NULL;
1066 match_path_index = path_list->
fpl_paths[ii];
1069 match_path_indices[jj] = match_path_index;
1075 return (match_path_indices);
1178 path_list_index = exist_path_list_index;
1201 return (path_list_index);
1256 int is_looped, list_looped;
1272 copy =
vec_dup(*entry_indicies);
1276 list_looped += is_looped;
1292 return (list_looped);
1456 s =
format(s,
"children:");
1481 .path =
"show fib path-lists",
1483 .short_help =
"show fib path-lists",
static vlib_cli_command_t show_fib_path_list
(constructor) VLIB_CLI_COMMAND (show_fib_path_list)
fib_node_index_t fib_path_copy(fib_node_index_t path_index, fib_node_index_t path_list_index)
@ FIB_PATH_LIST_FLAG_DROP
index_t dpoi_index
the index of objects of that type
static void fib_path_list_mk_lb(fib_path_list_t *path_list, fib_forward_chain_type_t fct, dpo_id_t *dpo, fib_path_list_fwd_flags_t flags)
int fib_path_list_is_popular(fib_node_index_t path_list_index)
enum fib_node_back_walk_rc_t_ fib_node_back_walk_rc_t
Return code from a back walk function.
static fib_path_list_t * fib_path_list_alloc(fib_node_index_t *path_list_index)
enum dpo_proto_t_ dpo_proto_t
Data path protocol.
dpo_type_t dpoi_type
the type
#define hash_mix32(a0, b0, c0)
fib_node_t fpl_node
A path-list is a node in the FIB graph.
static load_balance_flags_t fib_path_list_fwd_flags_2_load_balance(fib_path_list_fwd_flags_t pl_flags)
#define pool_elt_at_index(p, i)
Returns pointer to element at given index.
static fib_path_list_t * fib_path_list_get(fib_node_index_t index)
static fib_path_list_t * fib_path_list_pool
u8 * fib_path_list_format(fib_node_index_t path_list_index, u8 *s)
dpo_proto_t fib_path_list_get_proto(fib_node_index_t path_list_index)
u8 * format_fib_path(u8 *s, va_list *args)
static fib_path_list_t * fib_path_list_from_fib_node(fib_node_t *node)
vlib_log_class_t vlib_log_register_class(char *class, char *subclass)
fib_path_list_flags_t fpl_flags
Flags on the path-list.
vlib_main_t vlib_node_runtime_t * node
index_t fib_path_list_get_urpf(fib_node_index_t path_list_index)
Return the the child the RPF list pre-built for this path list.
fib_node_list_t fn_children
Vector of nodes that depend upon/use/share this node.
A FIB graph nodes virtual function table.
static uword fib_path_list_db_hash_key_is_index(uword key)
index_t load_balance_create(u32 n_buckets, dpo_proto_t lb_proto, flow_hash_config_t fhc)
#define FIB_NODE_INDEX_INVALID
@ FIB_PATH_LIST_FLAG_LOCAL
static void fib_path_list_db_insert(fib_node_index_t path_list_index)
u16 load_balance_n_buckets(index_t lbi)
u32 fn_locks
Number of dependents on this node.
void fib_path_destroy(fib_node_index_t path_index)
#define pool_put(P, E)
Free an object E in pool P.
void fib_urpf_list_combine(index_t ui1, index_t ui2)
Combine to interface lists.
u32 fib_path_list_get_resolving_interface(fib_node_index_t path_list_index)
vlib_main_t * vm
X-connect all packets from the HOST to the PHY.
u8 * fib_node_children_format(fib_node_list_t list, u8 *s)
vl_api_gbp_next_hop_t nhs[8]
static void fib_path_list_last_lock_gone(fib_node_t *node)
@ FIB_PATH_LIST_FLAG_NONE
enum fib_node_type_t_ fib_node_type_t
The types of nodes in a FIB graph.
fib_node_index_t * fpl_paths
Vector of paths indicies for all configured paths.
flow_hash_config_t load_balance_get_default_flow_hash(dpo_proto_t lb_proto)
#define FIB_PATH_LIST_ATTRIBUTES
static uword * fib_path_list_db
void fib_walk_async(fib_node_type_t parent_type, fib_node_index_t parent_index, fib_walk_priority_t prio, fib_node_back_walk_ctx_t *ctx)
u32 fib_path_list_get_n_paths(fib_node_index_t path_list_index)
static fib_path_cfg_flags_t fib_path_list_flags_2_path_flags(fib_path_list_flags_t plf)
u32 fib_node_get_n_children(fib_node_type_t parent_type, fib_node_index_t parent_index)
enum fib_path_list_flags_t_ fib_path_list_flags_t
void load_balance_multipath_update(const dpo_id_t *dpo, const load_balance_path_t *raw_nhs, load_balance_flags_t flags)
int fib_path_resolve(fib_node_index_t path_index)
static clib_error_t * show_fib_path_list_command(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
#define pool_is_free_index(P, I)
Use free bitmap to query whether given index is free.
@ FIB_NODE_BW_REASON_FLAG_EVALUATE
#define hash_set(h, key, value)
void fib_path_list_unlock(fib_node_index_t path_list_index)
@ FIB_PATH_FORMAT_FLAGS_NONE
int fib_path_cmp_for_sort(void *v1, void *v2)
dpo_proto_t fib_path_get_proto(fib_node_index_t path_index)
#define FIB_PATH_LIST_KEY_FLAGS
The flags on a path-list that contribute to its key in the DB.
#define FOR_EACH_PATH_LIST_ATTRIBUTE(_item)
const dpo_id_t * load_balance_get_bucket(index_t lbi, u32 bucket)
#define vec_len(v)
Number of elements in vector (rvalue-only, NULL tolerant)
static void fib_path_list_memory_show(void)
#define vec_add1(V, E)
Add 1 element to end of vector (unspecified alignment).
adj_index_t fib_path_list_get_adj(fib_node_index_t path_list_index, fib_forward_chain_type_t type)
enum fib_forward_chain_type_t_ fib_forward_chain_type_t
FIB output chain type.
#define vec_dup(V)
Return copy of vector (no header, no alignment)
dpo_proto_t fib_forw_chain_type_to_dpo_proto(fib_forward_chain_type_t fct)
Convert from a chain type to the DPO proto it will install.
enum load_balance_flags_t_ load_balance_flags_t
u8 * format_fib_path_list(u8 *s, va_list *args)
@ FIB_PATH_LIST_FLAG_SHARED
fib_node_index_t fpl_urpf
the RPF list calculated for this path list
static fib_path_list_flags_t fib_path_list_flags_fixup(fib_path_list_flags_t flags)
@ FIB_NODE_TYPE_PATH_LIST
A list of path-extensions.
u32 index_t
A Data-Path Object is an object that represents actions that are applied to packets are they are swit...
fib_node_index_t * fib_path_list_paths_remove(fib_node_index_t path_list_index, const fib_route_path_t *rpaths)
u32 fib_node_index_t
A typedef of a node index.
#define vec_foreach_index(var, v)
Iterate over vector indices.
void fib_show_memory_usage(const char *name, u32 in_use_elts, u32 allocd_elts, size_t size_elt)
Show the memory usage for a type.
fib_node_index_t fib_path_create_special(fib_node_index_t pl_index, dpo_proto_t nh_proto, fib_path_cfg_flags_t flags, const dpo_id_t *dpo)
#define hash_create2(_elts, _user, _value_bytes, _key_sum, _key_equal, _format_pair, _format_pair_arg)
sll srl srl sll sra u16x4 i
void fib_path_list_module_init(void)
enum fib_path_list_attribute_t_ fib_path_list_attribute_t
Enumeration of path-list flags.
#define pool_get(P, E)
Allocate an object E from a pool P (unspecified alignment).
u8 * format_fib_urpf_list(u8 *s, va_list *args)
static void fib_path_list_db_remove(fib_node_index_t path_list_index)
#define vec_validate(V, I)
Make sure vector is long enough for given index (no header, unspecified alignment)
static uword fib_path_list_db_hash_key_2_index(uword key)
#define VLIB_CLI_COMMAND(x,...)
fib_path_ext_t * fib_path_ext_list_find_by_path_index(const fib_path_ext_list_t *list, fib_node_index_t path_index)
u32 fib_path_get_resolving_interface(fib_node_index_t path_index)
u32 fib_path_list_child_add(fib_node_index_t path_list_index, fib_node_type_t child_type, fib_node_index_t child_index)
int fib_path_list_is_looped(fib_node_index_t path_list_index)
void fib_path_list_contribute_forwarding(fib_node_index_t path_list_index, fib_forward_chain_type_t fct, fib_path_list_fwd_flags_t flags, dpo_id_t *dpo)
void fib_node_register_type(fib_node_type_t type, const fib_node_vft_t *vft)
fib_node_register_type
@ FIB_PATH_LIST_WALK_STOP
@ FIB_NODE_BACK_WALK_CONTINUE
void vlib_cli_output(vlib_main_t *vm, char *fmt,...)
static fib_path_list_t * fib_path_list_resolve(fib_path_list_t *path_list)
u32 fib_path_list_pool_size(void)
fib_path_list_walk_rc_t(* fib_path_list_walk_fn_t)(fib_node_index_t pl_index, fib_node_index_t path_index, void *ctx)
A callback function type for walking a path-list's paths.
fib_node_index_t fib_path_create(fib_node_index_t pl_index, const fib_route_path_t *rpath)
@ FIB_PATH_CFG_FLAG_LOCAL
@ FIB_PATH_CFG_FLAG_EXCLUSIVE
static const fib_node_vft_t fib_path_list_vft
void fib_path_list_walk_w_ext(fib_node_index_t path_list_index, const fib_path_ext_list_t *ext_list, fib_path_list_walk_w_ext_fn_t func, void *ctx)
@ FIB_PATH_LIST_FLAG_RESOLVED
static uword hash_elts(void *v)
@ DPO_LOAD_BALANCE
load-balancing over a choice of [un]equal cost paths
void fib_walk_sync(fib_node_type_t parent_type, fib_node_index_t parent_index, fib_node_back_walk_ctx_t *ctx)
Back walk all the children of a FIB node.
#define vec_free(V)
Free vector's memory (no header).
#define pool_len(p)
Number of elements in pool vector.
fib_node_index_t fib_path_list_create_special(dpo_proto_t nh_proto, fib_path_list_flags_t flags, const dpo_id_t *dpo)
static fib_node_t * fib_path_list_get_node(fib_node_index_t index)
void dpo_copy(dpo_id_t *dst, const dpo_id_t *src)
atomic copy a data-plane object.
enum fib_path_list_fwd_flags_t_ fib_path_list_fwd_flags_t
Flags to control how the path-list returns forwarding information.
fib_node_index_t fib_path_list_copy_and_path_remove(fib_node_index_t orig_path_list_index, fib_path_list_flags_t flags, const fib_route_path_t *rpaths)
#define pool_foreach_index(i, v)
void fib_urpf_list_show_mem(void)
@ FIB_PATH_LIST_FLAG_LOOPED
description fragment has unexpected format
void fib_path_list_walk(fib_node_index_t path_list_index, fib_path_list_walk_fn_t func, void *ctx)
#define vec_validate_init_empty(V, I, INIT)
Make sure vector is long enough for given index and initialize empty space (no header,...
static uword fib_path_list_db_hash_key_sum(hash_t *h, uword key)
static uword fib_path_list_db_hash_key_from_index(uword index)
static fib_node_index_t fib_path_list_db_find(fib_path_list_t *path_list)
A representation of a path as described by a route producer.
load_balance_path_t * fib_path_append_nh_for_multipath_hash(fib_node_index_t path_index, fib_forward_chain_type_t fct, load_balance_path_t *hash_key)
#define vec_foreach(var, vec)
Vector iterator.
static void fib_path_list_mk_urpf(fib_path_list_t *path_list)
[re]build the path list's uRPF list
u32 fib_path_list_find_rpath(fib_node_index_t path_list_index, const fib_route_path_t *rpath)
@ FIB_PATH_LIST_FLAG_POPULAR
int fib_path_is_resolved(fib_node_index_t path_index)
void fib_node_lock(fib_node_t *node)
static uword pool_elts(void *v)
Number of active elements in a pool.
static const char * fib_path_list_attr_names[]
int fib_path_cmp(fib_node_index_t pi1, fib_node_index_t pi2)
#define hash_mix64(a0, b0, c0)
#define FIB_PATH_LIST_POPULAR
The magic number of child entries that make a path-list popular.
void fib_path_list_child_remove(fib_node_index_t path_list_index, u32 si)
An node in the FIB graph.
#define hash_unset(h, key)
#define vec_sort_with_function(vec, f)
Sort a vector using the supplied element comparison function.
@ LOAD_BALANCE_ATTR_STICKY
u32 adj_index_t
An index for adjacencies.
void fib_path_list_lock(fib_node_index_t path_list_index)
clib_memset(h->entries, 0, sizeof(h->entries[0]) *entries)
void fib_path_list_contribute_urpf(fib_node_index_t path_list_index, index_t urpf)
Contribute (add) this path list's uRPF list.
static uword fib_path_list_db_hash_key_equal(hash_t *h, uword key1, uword key2)
void fib_path_contribute_urpf(fib_node_index_t path_index, index_t urpf)
Contribute the path's adjacency to the list passed.
adj_index_t fib_path_get_adj(fib_node_index_t path_index)
void fib_node_init(fib_node_t *node, fib_node_type_t type)
void fib_node_unlock(fib_node_t *node)
index_t fib_urpf_list_alloc_and_lock(void)
#define uword_to_pointer(u, type)
A path extension is a per-entry addition to the forwarding information when packets are sent for that...
@ FIB_PATH_LIST_FLAG_NO_URPF
Context passed between object during a back walk.
void fib_node_child_remove(fib_node_type_t parent_type, fib_node_index_t parent_index, fib_node_index_t sibling_index)
@ FIB_PATH_LIST_FWD_FLAG_STICKY
static void fib_path_list_destroy(fib_path_list_t *path_list)
The identity of a DPO is a combination of its type and its instance number/index of objects of that t...
static uword fib_path_list_hash(fib_path_list_t *path_list)
struct fib_path_list_t_ fib_path_list_t
FIB path-list A representation of the list/set of path trough which a prefix is reachable.
fib_path_list_walk_rc_t(* fib_path_list_walk_w_ext_fn_t)(fib_node_index_t pl_index, fib_node_index_t path_index, const struct fib_path_ext_t_ *ext_list, void *ctx)
int fib_path_cmp_w_route_path(fib_node_index_t path_index, const fib_route_path_t *rpath)
@ FIB_PATH_LIST_FLAG_EXCLUSIVE
static fib_node_index_t fib_path_list_get_index(fib_path_list_t *path_list)
void fib_node_deinit(fib_node_t *node)
#define FIB_PATH_LIST_DBG(_pl, _fmt, _args...)
void dpo_set(dpo_id_t *dpo, dpo_type_t type, dpo_proto_t proto, index_t index)
Set/create a DPO ID The DPO will be locked.
void fib_urpf_list_bake(index_t ui)
Convert the uRPF list from the itf set obtained during the walk to a unique list.
void fib_path_list_back_walk(fib_node_index_t path_list_index, fib_node_back_walk_ctx_t *ctx)
u32 fib_path_list_db_size(void)
fib_node_index_t * fib_path_list_paths_add(fib_node_index_t path_list_index, const fib_route_path_t *rpaths)
#define INDEX_INVALID
Invalid index - used when no index is known blazoned capitals INVALID speak volumes where ~0 does not...
fib_node_index_t fib_path_list_copy_and_path_add(fib_node_index_t orig_path_list_index, fib_path_list_flags_t flags, const fib_route_path_t *rpaths)
enum fib_path_cfg_flags_t_ fib_path_cfg_flags_t
Path config flags from the attributes.
vl_api_interface_index_t sw_if_index
fib_node_index_t fib_path_list_create(fib_path_list_flags_t flags, const fib_route_path_t *rpaths)
One path from an [EU]CMP set that the client wants to add to a load-balance object.
static fib_path_list_t * fib_path_list_db_get_from_hash_key(uword key)
static fib_node_back_walk_rc_t fib_path_list_back_walk_notify(fib_node_t *node, fib_node_back_walk_ctx_t *ctx)
int fib_path_recursive_loop_detect(fib_node_index_t path_index, fib_node_index_t **entry_indicies)
u8 * format_fib_node_bw_reason(u8 *s, va_list *args)
uword fib_path_hash(fib_node_index_t path_index)
int fib_path_list_recursive_loop_detect(fib_node_index_t path_list_index, fib_node_index_t **entry_indicies)
void fib_urpf_list_unlock(index_t ui)
u32 fib_node_child_add(fib_node_type_t parent_type, fib_node_index_t parent_index, fib_node_type_t type, fib_node_index_t index)
vl_api_fib_path_type_t type
#define vec_del1(v, i)
Delete the element at index I.
#define vec_foreach_index_backwards(var, v)
Iterate over vector indices (reverse).
@ FIB_PATH_LIST_FWD_FLAG_COLLAPSE
vlib_log_class_t fib_path_list_logger
the logger
vl_api_wireguard_peer_flags_t flags
FIB path-list A representation of the list/set of path trough which a prefix is reachable.