X-Git-Url: https://gerrit.fd.io/r/gitweb?a=blobdiff_plain;f=src%2Fvnet%2Fbier%2Fbier_fmask_db.h;h=cf78bdae4eba80495dbb6fe94923776674cefd43;hb=fc7344f;hp=6ba40f3a839b35b69b5ce90873c850c138b39f41;hpb=d792d9c01e60656cbfe1b0f1fd6a9b125f5dab0c;p=vpp.git diff --git a/src/vnet/bier/bier_fmask_db.h b/src/vnet/bier/bier_fmask_db.h index 6ba40f3a839..cf78bdae4eb 100644 --- a/src/vnet/bier/bier_fmask_db.h +++ b/src/vnet/bier/bier_fmask_db.h @@ -21,41 +21,83 @@ #include -#include +#include /** - * Foward declarations + * BIER header encapulsation types */ -struct bier_fmask_t_; - typedef enum bier_hdr_type_t_ { - BIER_HDR_IN_IP6, + /** + * BIER Header in MPLS networks + */ BIER_HDR_O_MPLS, -} bier_hdr_type_t; + /** + * BIER header in non-MPLS networks + */ + BIER_HDR_O_OTHER, +} __attribute__((packed)) bier_hdr_type_t; + +/** + * BIER next-hop type + */ +typedef enum bier_nh_type_t_ { + /** + * BIER Header in MPLS networks + */ + BIER_NH_IP, + + /** + * BIER header in non-MPLS networks + */ + BIER_NH_UDP, +} __attribute__((packed)) bier_nh_type_t; + +/** + * A key/ID for a BIER forwarding Mas (FMask). + * This is a simplified version of a fib_route_path_t. + */ typedef struct bier_fmask_id_t_ { + union { + /** + * next-hop of the peer + */ + ip46_address_t bfmi_nh; + + /** + * ID of the next-hop object, e.g. a UDP-encap + */ + u32 bfmi_id; + }; + /** + * The BIER table this fmask is in + */ + index_t bfmi_bti; + /** * Type of BIER header this fmask supports */ bier_hdr_type_t bfmi_hdr_type; /** - * next-hop of the peer + * Union discriminator */ - ip46_address_t bfmi_nh; -} bier_fmask_id_t; + bier_nh_type_t bfmi_nh_type; +} __attribute__((packed)) bier_fmask_id_t; -extern u32 +extern index_t bier_fmask_db_find_or_create_and_lock(index_t bti, - const bier_fmask_id_t *fmid, const fib_route_path_t *rpath); +extern index_t bier_fmask_db_find (index_t bti, + const fib_route_path_t *rpath); + +extern void bier_fmask_db_remove (const bier_fmask_id_t *fmid); -extern u32 -bier_fmask_db_find(index_t bti, - const bier_fmask_id_t *fmid); +/** + * Walk all the BIER fmasks + */ +typedef walk_rc_t (*bier_fmask_walk_fn_t) (index_t bfmi, void *ctx); -extern void -bier_fmask_db_remove(index_t bti, - const bier_fmask_id_t *fmid); +extern void bier_fmask_db_walk(bier_fmask_walk_fn_t fn, void *ctx); #endif