aboutsummaryrefslogtreecommitdiffstats
path: root/src/vnet/bier/bier_types.c
diff options
context:
space:
mode:
authorNeale Ranns <nranns@cisco.com>2017-12-05 13:24:04 -0800
committerFlorin Coras <florin.coras@gmail.com>2017-12-09 20:55:08 +0000
commit9128637ee8f7b0d903551f165a1447d427e8dd19 (patch)
tree244014dd1064643946d64066e352ee1627bf622c /src/vnet/bier/bier_types.c
parentcef87f1a5eb4d69cf11ce1cd3c5506edcfba74c4 (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/bier/bier_types.c')
-rw-r--r--src/vnet/bier/bier_types.c43
1 files changed, 43 insertions, 0 deletions
diff --git a/src/vnet/bier/bier_types.c b/src/vnet/bier/bier_types.c
index 680182de597..5c812a4557d 100644
--- a/src/vnet/bier/bier_types.c
+++ b/src/vnet/bier/bier_types.c
@@ -160,6 +160,35 @@ bier_hdr_proto_to_dpo (bier_hdr_proto_id_t bproto)
return (DPO_PROTO_NUM);
}
+bier_bift_id_t
+bier_bift_id_encode (bier_table_set_id_t set,
+ bier_table_sub_domain_id_t sd,
+ bier_hdr_len_id_t bsl)
+{
+ bier_bift_id_t id;
+
+ id = bsl;
+ id = id << 8;
+ id |= sd;
+ id = id << 8;
+ id |= set;
+
+ return (id);
+}
+
+void
+bier_bift_id_decode (bier_bift_id_t id,
+ bier_table_set_id_t *set,
+ bier_table_sub_domain_id_t *sd,
+ bier_hdr_len_id_t *bsl)
+{
+ *set = id & 0xff;
+ id = id >> 8;
+ *sd = id & 0xff;
+ id = id >> 8;
+ *bsl = id;
+}
+
u8 *
format_bier_table_id (u8 *s, va_list *ap)
{
@@ -188,3 +217,17 @@ format_bier_hdr (u8 *s, va_list *ap)
format_bier_hdr_proto, bier_hdr_get_proto_id(&copy),
bier_hdr_get_src_id(&copy)));
}
+
+ u8*
+ format_bier_bift_id(u8 *s, va_list *ap)
+ {
+ bier_bift_id_t id = va_arg(*ap, bier_bift_id_t);
+ bier_table_sub_domain_id_t sd;
+ bier_table_set_id_t set;
+ bier_hdr_len_id_t bsl;
+
+ bier_bift_id_decode(id, &set, &sd, &bsl);
+
+ return (format(s, "0x%x -> set:%d sd:%d hdr-len:%U",
+ id, set, sd, format_bier_hdr_len_id, bsl));
+ }