diff options
author | Neale Ranns <nranns@cisco.com> | 2017-12-05 13:24:04 -0800 |
---|---|---|
committer | Florin Coras <florin.coras@gmail.com> | 2017-12-09 20:55:08 +0000 |
commit | 9128637ee8f7b0d903551f165a1447d427e8dd19 (patch) | |
tree | 244014dd1064643946d64066e352ee1627bf622c /src/vnet/fib/fib_path_list.c | |
parent | cef87f1a5eb4d69cf11ce1cd3c5506edcfba74c4 (diff) |
BIER in non-MPLS netowrks
as decsribed in section 2.2
ihttps://tools.ietf.org/html/draft-ietf-bier-mpls-encapsulation-10
with BIFT encoding from:
https://tools.ietf.org/html/draft-wijnandsxu-bier-non-mpls-bift-encoding-00
changes:
1 - introduce the new BIFT lookup table. BIER tables that have an associated
MPLS label are added to the MPLS-FIB. Those that don't are added to the
BIER table
2 - BIER routes that have no associated output MPLS label will add a BIFT label.
3 - The BIER FMask has a path-list as a member to resolve via any possible path.
Change-Id: I1fd4d9dbd074f0e855c16e9329b81460ebe1efce
Signed-off-by: Neale Ranns <nranns@cisco.com>
Diffstat (limited to 'src/vnet/fib/fib_path_list.c')
-rw-r--r-- | src/vnet/fib/fib_path_list.c | 57 |
1 files changed, 32 insertions, 25 deletions
diff --git a/src/vnet/fib/fib_path_list.c b/src/vnet/fib/fib_path_list.c index 597a700a448..5201b5a14e8 100644 --- a/src/vnet/fib/fib_path_list.c +++ b/src/vnet/fib/fib_path_list.c @@ -126,16 +126,21 @@ fib_path_list_get_index (fib_path_list_t *path_list) return (path_list - fib_path_list_pool); } -static u8 * +u8 * format_fib_path_list (u8 * s, va_list * args) { + fib_node_index_t *path_index, path_list_index; fib_path_list_attribute_t attr; - fib_node_index_t *path_index; fib_path_list_t *path_list; + u32 indent; - path_list = va_arg (*args, fib_path_list_t *); - - s = format (s, " index:%u", fib_path_list_get_index(path_list)); + path_list_index = va_arg (*args, fib_node_index_t); + indent = va_arg (*args, u32); + path_list = fib_path_list_get(path_list_index); + + s = format (s, "%Upath-list:[%d]", + format_white_space, indent, + fib_path_list_get_index(path_list)); s = format (s, " locks:%u", path_list->fpl_node.fn_locks); if (FIB_PATH_LIST_FLAG_NONE != path_list->fpl_flags) @@ -153,7 +158,7 @@ format_fib_path_list (u8 * s, va_list * args) vec_foreach (path_index, path_list->fpl_paths) { - s = fib_path_format(*path_index, s); + s = format(s, "%U", format_fib_path, *path_index, indent+2); s = format(s, "\n"); } @@ -164,11 +169,7 @@ u8 * fib_path_list_format (fib_node_index_t path_list_index, u8 * s) { - fib_path_list_t *path_list; - - path_list = fib_path_list_get(path_list_index); - - return (format(s, "%U", format_fib_path_list, path_list)); + return (format(s, "%U", format_fib_path_list, path_list_index, 4)); } static uword @@ -353,20 +354,7 @@ fib_path_list_mk_lb (fib_path_list_t *path_list, load_balance_path_t *nhs; fib_node_index_t *path_index; - nhs = NULL; - - if (!dpo_id_is_valid(dpo)) - { - /* - * first time create - */ - dpo_set(dpo, - DPO_LOAD_BALANCE, - fib_forw_chain_type_to_dpo_proto(fct), - load_balance_create(0, - fib_forw_chain_type_to_dpo_proto(fct), - 0 /* FIXME FLOW HASH */)); - } + nhs = NULL; /* * We gather the DPOs from resolved paths. @@ -382,6 +370,12 @@ fib_path_list_mk_lb (fib_path_list_t *path_list, * Path-list load-balances, which if used, would be shared and hence * never need a load-balance map. */ + dpo_set(dpo, + DPO_LOAD_BALANCE, + fib_forw_chain_type_to_dpo_proto(fct), + load_balance_create(vec_len(nhs), + fib_forw_chain_type_to_dpo_proto(fct), + 0 /* FIXME FLOW HASH */)); load_balance_multipath_update(dpo, nhs, LOAD_BALANCE_FLAG_NONE); FIB_PATH_LIST_DBG(path_list, "mk lb: %d", dpo->dpoi_index); @@ -1146,6 +1140,7 @@ fib_path_list_copy_and_path_remove (fib_node_index_t orig_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) { fib_path_list_t *path_list; @@ -1153,6 +1148,18 @@ fib_path_list_contribute_forwarding (fib_node_index_t path_list_index, path_list = fib_path_list_get(path_list_index); fib_path_list_mk_lb(path_list, fct, dpo); + + ASSERT(DPO_LOAD_BALANCE == dpo->dpoi_type); + + /* + * If there's only one bucket in the load-balance then we can + * squash it out. + */ + if ((1 == load_balance_n_buckets(dpo->dpoi_index)) && + (FIB_PATH_LIST_FWD_FLAG_COLLAPSE & flags)) + { + dpo_copy(dpo, load_balance_get_bucket(dpo->dpoi_index, 0)); + } } /* |