X-Git-Url: https://gerrit.fd.io/r/gitweb?a=blobdiff_plain;f=src%2Fvnet%2Ffib%2Ffib_path_list.h;h=06c1b14204baa26f1921519d9d079f782d309676;hb=097fa66b986f06281f603767d321ab13ab6c88c3;hp=f4f94a1b04ae38e79e2b42b34b23ce0316304502;hpb=c0790cfef0bd1c56f4c75dc4f959584148386258;p=vpp.git diff --git a/src/vnet/fib/fib_path_list.h b/src/vnet/fib/fib_path_list.h index f4f94a1b04a..06c1b14204b 100644 --- a/src/vnet/fib/fib_path_list.h +++ b/src/vnet/fib/fib_path_list.h @@ -19,8 +19,8 @@ #include #include -#include "fib_node.h" -#include "fib_path.h" +#include +#include /** * Enumeration of path-list flags. @@ -60,10 +60,20 @@ typedef enum fib_path_list_attribute_t_ { * looped path-list. one path looped implies the whole list is */ FIB_PATH_LIST_ATTRIBUTE_LOOPED, + /** + * a popular path-ist is one that is shared amongst many entries. + * Path list become popular as they gain more children, but they + * don't become unpopular as they lose them. + */ + FIB_PATH_LIST_ATTRIBUTE_POPULAR, + /** + * no uRPF - do not generate unicast RPF list for this path-list + */ + FIB_PATH_LIST_ATTRIBUTE_NO_URPF, /** * Marher. Add new flags before this one, and then update it. */ - FIB_PATH_LIST_ATTRIBUTE_LAST = FIB_PATH_LIST_ATTRIBUTE_LOOPED, + FIB_PATH_LIST_ATTRIBUTE_LAST = FIB_PATH_LIST_ATTRIBUTE_NO_URPF, } fib_path_list_attribute_t; typedef enum fib_path_list_flags_t_ { @@ -74,6 +84,8 @@ typedef enum fib_path_list_flags_t_ { FIB_PATH_LIST_FLAG_EXCLUSIVE = (1 << FIB_PATH_LIST_ATTRIBUTE_EXCLUSIVE), FIB_PATH_LIST_FLAG_RESOLVED = (1 << FIB_PATH_LIST_ATTRIBUTE_RESOLVED), FIB_PATH_LIST_FLAG_LOOPED = (1 << FIB_PATH_LIST_ATTRIBUTE_LOOPED), + FIB_PATH_LIST_FLAG_POPULAR = (1 << FIB_PATH_LIST_ATTRIBUTE_POPULAR), + FIB_PATH_LIST_FLAG_NO_URPF = (1 << FIB_PATH_LIST_ATTRIBUTE_NO_URPF), } fib_path_list_flags_t; #define FIB_PATH_LIST_ATTRIBUTES { \ @@ -81,8 +93,10 @@ typedef enum fib_path_list_flags_t_ { [FIB_PATH_LIST_ATTRIBUTE_RESOLVED] = "resolved", \ [FIB_PATH_LIST_ATTRIBUTE_DROP] = "drop", \ [FIB_PATH_LIST_ATTRIBUTE_EXCLUSIVE] = "exclusive", \ - [FIB_PATH_LIST_ATTRIBUTE_LOCAL] = "local", \ - [FIB_PATH_LIST_ATTRIBUTE_LOOPED] = "looped", \ + [FIB_PATH_LIST_ATTRIBUTE_LOCAL] = "local", \ + [FIB_PATH_LIST_ATTRIBUTE_LOOPED] = "looped", \ + [FIB_PATH_LIST_ATTRIBUTE_POPULAR] = "popular", \ + [FIB_PATH_LIST_ATTRIBUTE_NO_URPF] = "no-uRPF", \ } #define FOR_EACH_PATH_LIST_ATTRIBUTE(_item) \ @@ -92,7 +106,7 @@ typedef enum fib_path_list_flags_t_ { extern fib_node_index_t fib_path_list_create(fib_path_list_flags_t flags, const fib_route_path_t *paths); -extern fib_node_index_t fib_path_list_create_special(fib_protocol_t nh_proto, +extern 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); @@ -104,10 +118,28 @@ extern fib_node_index_t fib_path_list_copy_and_path_remove( fib_node_index_t pl_index, fib_path_list_flags_t flags, const fib_route_path_t *path); +extern fib_node_index_t* fib_path_list_paths_add ( + fib_node_index_t path_list_index, + const fib_route_path_t *rpaths); +extern fib_node_index_t* fib_path_list_paths_remove ( + fib_node_index_t path_list_index, + const fib_route_path_t *rpaths); + extern u32 fib_path_list_get_n_paths(fib_node_index_t pl_index); +/** + * Flags to control how the path-list returns forwarding information + */ +typedef enum fib_path_list_fwd_flags_t_ +{ + FIB_PATH_LIST_FWD_FLAG_NONE = 0, + FIB_PATH_LIST_FWD_FLAG_COLLAPSE = (1 << 0), + FIB_PATH_LIST_FWD_FLAG_STICKY = (1 << 1), +} fib_path_list_fwd_flags_t; + extern void fib_path_list_contribute_forwarding(fib_node_index_t path_list_index, fib_forward_chain_type_t type, + fib_path_list_fwd_flags_t flags, dpo_id_t *dpo); extern void fib_path_list_contribute_urpf(fib_node_index_t path_index, index_t urpf); @@ -128,25 +160,40 @@ extern int fib_path_list_recursive_loop_detect(fib_node_index_t path_list_index, fib_node_index_t **entry_indicies); extern u32 fib_path_list_get_resolving_interface(fib_node_index_t path_list_index); extern int fib_path_list_is_looped(fib_node_index_t path_list_index); -extern fib_protocol_t fib_path_list_get_proto(fib_node_index_t path_list_index); +extern int fib_path_list_is_popular(fib_node_index_t path_list_index); +extern dpo_proto_t fib_path_list_get_proto(fib_node_index_t path_list_index); extern u8 * fib_path_list_format(fib_node_index_t pl_index, u8 * s); -extern u8 * fib_path_list_adjs_format(fib_node_index_t pl_index, - u32 indent, - u8 * s); +extern u8 * format_fib_path_list(u8 * s, va_list *args); + extern index_t fib_path_list_lb_map_add_or_lock(fib_node_index_t pl_index, const fib_node_index_t *pis); +extern u32 fib_path_list_find_rpath (fib_node_index_t path_list_index, + const fib_route_path_t *rpath); + /** * A callback function type for walking a path-list's paths */ -typedef int (*fib_path_list_walk_fn_t)(fib_node_index_t pl_index, - fib_node_index_t path_index, - void *ctx); +typedef 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); extern void fib_path_list_walk(fib_node_index_t pl_index, fib_path_list_walk_fn_t func, void *ctx); +typedef 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); + +extern void fib_path_list_walk_w_ext(fib_node_index_t pl_index, + const fib_path_ext_list_t *ext_list, + fib_path_list_walk_w_ext_fn_t func, + void *ctx); + extern void fib_path_list_module_init(void); extern void fib_path_list_module_init(void);