From 0bfe5d8c792abcdbcf27bfcc7b7b353fba04aee2 Mon Sep 17 00:00:00 2001 From: Neale Ranns Date: Thu, 25 Aug 2016 15:29:12 +0100 Subject: A Protocol Independent Hierarchical FIB (VPP-352) Main Enhancements: - Protocol Independent FIB API - Hierarchical FIB entries. Dynamic recursive route resolution. - Extranet Support. - Integration of IP and MPLS forwarding. - Separation of FIB and Adjacency databases. - Data-Plane Object forwarding model. Change-Id: I52dc815c0d0aa8b493e3cf6b978568f3cc82296c Signed-off-by: Neale Ranns --- vnet/vnet/lisp-gpe/lisp_gpe.h | 232 +++++++++++++++++++++++++----------------- 1 file changed, 140 insertions(+), 92 deletions(-) (limited to 'vnet/vnet/lisp-gpe/lisp_gpe.h') diff --git a/vnet/vnet/lisp-gpe/lisp_gpe.h b/vnet/vnet/lisp-gpe/lisp_gpe.h index 4a8bdfe7..66009cc1 100644 --- a/vnet/vnet/lisp-gpe/lisp_gpe.h +++ b/vnet/vnet/lisp-gpe/lisp_gpe.h @@ -30,6 +30,7 @@ #include #include #include +#include /** IP4-UDP-LISP encap header */ /* *INDENT-OFF* */ @@ -49,37 +50,6 @@ typedef CLIB_PACKED (struct { }) ip6_udp_lisp_gpe_header_t; /* *INDENT-ON* */ -/** LISP-GPE tunnel key */ -typedef struct -{ - union - { - struct - { - dp_address_t rmt; - dp_address_t lcl; - u32 vni; - }; - u8 as_u8[40]; - }; -} lisp_gpe_tunnel_key_t; - -typedef struct lisp_gpe_sub_tunnel -{ - /** Rewrite string. $$$$ embed vnet_rewrite header */ - u8 *rewrite; - u32 parent_index; - u32 locator_pair_index; - u8 weight; - u8 is_ip4; -} lisp_gpe_sub_tunnel_t; - -typedef struct nomalized_sub_tunnel -{ - u32 sub_tunnel_index; - u8 weight; -} normalized_sub_tunnel_weights_t; - /** LISP-GPE tunnel structure */ typedef struct { @@ -87,17 +57,7 @@ typedef struct locator_pair_t *locator_pairs; /** locator-pairs with best priority become sub-tunnels */ - lisp_gpe_sub_tunnel_t *sub_tunnels; - - /** sub-tunnels load balancing vector: contains list of sub-tunnel - * indexes replicated according to weight */ - u32 *sub_tunnels_lbv; - - /** number of entries in load balancing vector */ - u32 sub_tunnels_lbv_count; - - /** normalized sub tunnel weights */ - normalized_sub_tunnel_weights_t *norm_sub_tunnel_weights; + u32 *sub_tunnels; /** decap next index */ u32 decap_next_index; @@ -109,10 +69,16 @@ typedef struct u32 encap_fib_index; /* tunnel partner lookup here */ u32 decap_fib_index; /* inner IP lookup here */ + /** index of the source address lookup FIB */ + u32 src_fib_index; + /** vnet intfc hw/sw_if_index */ u32 hw_if_index; u32 sw_if_index; + /** L2 path-list */ + fib_node_index_t l2_path_list; + /** action for 'negative' tunnels */ u8 action; @@ -124,6 +90,112 @@ typedef struct u32 vni; } lisp_gpe_tunnel_t; +/** + * @brief A path on which to forward lisp traffic + */ +typedef struct lisp_fwd_path_t_ +{ + /** + * The adjacency constructed for the locator pair + */ + index_t lisp_adj; + + /** + * Priority. Only the paths with the best priority will be installed in FIB + */ + u8 priority; + + /** + * [UE]CMP weigt for the path + */ + u8 weight; + +} lisp_fwd_path_t; + +/** + * @brief A Forwarding entry can be 'normal' or 'negative' + * Negative implies we deliberately want to add a FIB entry for an EID + * that results in 'spcial' behaviour determined by an 'action'. + * @normal' means send it down some tunnels. + */ +typedef enum lisp_fwd_entry_type_t_ +{ + LISP_FWD_ENTRY_TYPE_NORMAL, + LISP_FWD_ENTRY_TYPE_NEGATIVE, +} lisp_fwd_entry_type_t; + +typedef enum +{ + NO_ACTION, + FORWARD_NATIVE, + SEND_MAP_REQUEST, + DROP +} negative_fwd_actions_e; + +/** + * LISP-GPE fwd entry key + */ +typedef struct lisp_gpe_fwd_entry_key_t_ +{ + dp_address_t rmt; + dp_address_t lcl; + u32 vni; +} lisp_gpe_fwd_entry_key_t; + +/** + * @brief A LISP Forwarding Entry + * + * A forwarding entry is from a locai EID to a remote EID over a set of rloc pairs + */ +typedef struct lisp_fwd_entry_t_ +{ + /** + * The Entry's key: {lEID,r-EID,vni} + */ + lisp_gpe_fwd_entry_key_t *key; + + /** + * The VRF (in the case of L3) or Bridge-Domain (for L2) index + */ + union + { + u32 eid_table_id; + u32 eid_bd_index; + }; + + /** + * The forwarding entry type + */ + lisp_fwd_entry_type_t type; + + union + { + /** + * @brief When the type is 'normal' + * The RLOC pair that form the route's paths. i.e. where to send + * packets for this route. + */ + lisp_fwd_path_t *paths; + + /** + * @brief When the type is negative. The action to take. + */ + negative_fwd_actions_e action; + }; + + /** + * The FIB index for the overlay, i.e. the FIB in which the EIDs + * are present + */ + u32 eid_fib_index; + + /** + * The SRC-FIB index for created for anding source-route entries + */ + u32 src_fib_index; +} lisp_fwd_entry_t; + + #define foreach_lisp_gpe_ip_input_next \ _(DROP, "error-drop") \ _(IP4_INPUT, "ip4-input") \ @@ -147,30 +219,6 @@ typedef enum LISP_GPE_N_ERROR, } lisp_gpe_error_t; -/** IP4 source FIB. - * As a first step, reuse v4 fib. The goal of the typedef is - * to shield consumers from future updates that may result in the lisp ip4 fib - * diverging from ip4 fib - */ -typedef ip4_fib_t ip4_src_fib_t; - -/** IP6 source FIB */ -typedef struct ip6_src_fib -{ - BVT (clib_bihash) ip6_lookup_table; - - /** bitmap/vector of mask widths to search */ - uword *non_empty_dst_address_length_bitmap; - u8 *prefix_lengths_in_search_order; - ip6_address_t fib_masks[129]; - i32 dst_address_length_refcounts[129]; - - /** ip6 lookup table config parameters */ - u32 lookup_table_nbuckets; - uword lookup_table_size; -} ip6_src_fib_t; - -/** Tunnel lookup structure for L2 and L3 tunnels */ typedef struct tunnel_lookup { /** Lookup lisp-gpe interfaces by dp table (eg. vrf/bridge index) */ @@ -178,6 +226,8 @@ typedef struct tunnel_lookup /** lookup decap tunnel termination sw_if_index by vni and vice versa */ uword *sw_if_index_by_vni; + + // FIXME - Need this? uword *vni_by_sw_if_index; } tunnel_lookup_t; @@ -187,9 +237,6 @@ typedef struct lisp_gpe_main /** pool of encap tunnel instances */ lisp_gpe_tunnel_t *tunnels; - /** lookup tunnel by key */ - mhash_t lisp_gpe_tunnel_by_key; - /** Free vlib hw_if_indices */ u32 *free_tunnel_hw_if_indices; @@ -197,21 +244,8 @@ typedef struct lisp_gpe_main /* L3 data structures * ================== */ - - /** Pool of src fibs that are paired with dst fibs */ - ip4_src_fib_t *ip4_src_fibs; - ip6_src_fib_t *ip6_src_fibs; - tunnel_lookup_t l3_ifaces; - /** Lookup lgpe_ipX_lookup_next by vrf */ - uword *lgpe_ip4_lookup_next_index_by_table_id; - uword *lgpe_ip6_lookup_next_index_by_table_id; - - /** next node indexes that point ip4/6 lookup to lisp gpe ip lookup */ - u32 ip4_lookup_next_lgpe_ip4_lookup; - u32 ip6_lookup_next_lgpe_ip6_lookup; - /* L2 data structures * ================== */ @@ -220,6 +254,10 @@ typedef struct lisp_gpe_main tunnel_lookup_t l2_ifaces; + /** Load-balance for a miss in the table */ + index_t l2_lb_miss; + index_t l2_lb_cp_lkup; + /** convenience */ vlib_main_t *vlib_main; vnet_main_t *vnet_main; @@ -238,10 +276,10 @@ vnet_lisp_gpe_get_main () return &lisp_gpe_main; } -extern vlib_node_registration_t lgpe_ip4_lookup_node; -extern vlib_node_registration_t lgpe_ip6_lookup_node; + extern vlib_node_registration_t lisp_gpe_ip4_input_node; extern vlib_node_registration_t lisp_gpe_ip6_input_node; +extern vnet_hw_interface_class_t lisp_gpe_hw_class; u8 *format_lisp_gpe_header_with_length (u8 * s, va_list * args); @@ -291,7 +329,7 @@ typedef struct u8 is_negative; /** action for negative mappings */ - u8 action; + negative_fwd_actions_e action; /** local eid */ gid_address_t lcl_eid; @@ -332,13 +370,23 @@ int vnet_lisp_gpe_add_del_fwd_entry (vnet_lisp_gpe_add_del_fwd_entry_args_t * a, u32 * hw_if_indexp); -int -ip_sd_fib_add_del_route (lisp_gpe_main_t * lgm, ip_prefix_t * dst_prefix, - ip_prefix_t * src_prefix, u32 table_id, - ip_adjacency_t * add_adj, u8 is_add); -u32 -ip_sd_fib_get_route (lisp_gpe_main_t * lgm, ip_prefix_t * dst_prefix, - ip_prefix_t * src_prefix, u32 table_id); +extern void +ip_src_fib_add_route (u32 src_fib_index, + const ip_prefix_t * src_prefix, + const lisp_fwd_path_t * paths); +extern void +ip_src_dst_fib_del_route (u32 src_fib_index, + const ip_prefix_t * src_prefix, + u32 dst_table_id, const ip_prefix_t * dst_prefix); +extern void +ip_src_fib_add_route_w_dpo (u32 src_fib_index, + const ip_prefix_t * src_prefix, + const dpo_id_t * src_dpo); +extern u32 +ip_dst_fib_add_route (u32 dst_table_id, const ip_prefix_t * dst_prefix); + +extern fib_route_path_t *lisp_gpe_mk_paths_for_sub_tunnels (lisp_gpe_tunnel_t + * t); #define foreach_lgpe_ip4_lookup_next \ _(DROP, "error-drop") \ -- cgit 1.2.3-korg