40 #ifndef included_ip_lookup_h 41 #define included_ip_lookup_h 93 #define IP4_LOOKUP_NEXT_NODES { \ 94 [IP_LOOKUP_NEXT_MISS] = "ip4-miss", \ 95 [IP_LOOKUP_NEXT_DROP] = "ip4-drop", \ 96 [IP_LOOKUP_NEXT_PUNT] = "ip4-punt", \ 97 [IP_LOOKUP_NEXT_LOCAL] = "ip4-local", \ 98 [IP_LOOKUP_NEXT_ARP] = "ip4-arp", \ 99 [IP_LOOKUP_NEXT_REWRITE] = "ip4-rewrite-transit", \ 100 [IP_LOOKUP_NEXT_CLASSIFY] = "ip4-classify", \ 101 [IP_LOOKUP_NEXT_MAP] = "ip4-map", \ 102 [IP_LOOKUP_NEXT_MAP_T] = "ip4-map-t", \ 103 [IP_LOOKUP_NEXT_SIXRD] = "ip4-sixrd", \ 104 [IP_LOOKUP_NEXT_HOP_BY_HOP] = "ip4-hop-by-hop", \ 105 [IP_LOOKUP_NEXT_ADD_HOP_BY_HOP] = "ip4-add-hop-by-hop", \ 106 [IP_LOOKUP_NEXT_POP_HOP_BY_HOP] = "ip4-pop-hop-by-hop", \ 107 [IP_LOOKUP_NEXT_INDIRECT] = "ip4-indirect", \ 110 #define IP6_LOOKUP_NEXT_NODES { \ 111 [IP_LOOKUP_NEXT_MISS] = "ip6-miss", \ 112 [IP_LOOKUP_NEXT_DROP] = "ip6-drop", \ 113 [IP_LOOKUP_NEXT_PUNT] = "ip6-punt", \ 114 [IP_LOOKUP_NEXT_LOCAL] = "ip6-local", \ 115 [IP_LOOKUP_NEXT_ARP] = "ip6-discover-neighbor", \ 116 [IP_LOOKUP_NEXT_REWRITE] = "ip6-rewrite", \ 117 [IP_LOOKUP_NEXT_CLASSIFY] = "ip6-classify", \ 118 [IP_LOOKUP_NEXT_MAP] = "ip6-map", \ 119 [IP_LOOKUP_NEXT_MAP_T] = "ip6-map-t", \ 120 [IP_LOOKUP_NEXT_SIXRD] = "ip6-sixrd", \ 121 [IP_LOOKUP_NEXT_HOP_BY_HOP] = "ip6-hop-by-hop", \ 122 [IP_LOOKUP_NEXT_ADD_HOP_BY_HOP] = "ip6-add-hop-by-hop", \ 123 [IP_LOOKUP_NEXT_POP_HOP_BY_HOP] = "ip6-pop-hop-by-hop", \ 124 [IP_LOOKUP_NEXT_INDIRECT] = "ip6-indirect", \ 128 #define IP_FLOW_HASH_SRC_ADDR (1<<0) 129 #define IP_FLOW_HASH_DST_ADDR (1<<1) 130 #define IP_FLOW_HASH_PROTO (1<<2) 131 #define IP_FLOW_HASH_SRC_PORT (1<<3) 132 #define IP_FLOW_HASH_DST_PORT (1<<4) 133 #define IP_FLOW_HASH_REVERSE_SRC_DST (1<<5) 136 #define IP_FLOW_HASH_DEFAULT (0x1F) 138 #define foreach_flow_hash_bit \ 139 _(src, IP_FLOW_HASH_SRC_ADDR) \ 140 _(dst, IP_FLOW_HASH_DST_ADDR) \ 141 _(sport, IP_FLOW_HASH_SRC_PORT) \ 142 _(dport, IP_FLOW_HASH_DST_PORT) \ 143 _(proto, IP_FLOW_HASH_PROTO) \ 144 _(reverse, IP_FLOW_HASH_REVERSE_SRC_DST) 185 ip46_address_t next_hop;
205 uword signature = 0xfeedfaceULL;
228 if (memcmp (&a1->rewrite_header, &a2->rewrite_header,
269 } normalized_next_hops, unnormalized_next_hops;
290 u8 rewrite_string[64 - 1*
sizeof(
u32) - 1*
sizeof(
u8)];
383 #define IP_LOOKUP_MISS_ADJ_INDEX 0 435 #define ip_prefetch_adjacency(lm,adj_index,type) \ 437 ip_adjacency_t * _adj = (lm)->adjacency_heap + (adj_index); \ 438 CLIB_PREFETCH (_adj, sizeof (_adj[0]), type); \ 463 u32 * adj_index_result);
492 u32 old_mp_adj_index,
493 u32 next_hop_adj_index,
495 u32 * new_mp_adj_index);
520 u32 if_address_index;
527 if_address_index = (if_address_index == ~0 ?
534 #define foreach_ip_interface_address(lm,a,sw_if_index,loop,body) \ 536 vnet_main_t *_vnm = vnet_get_main(); \ 537 u32 _sw_if_index = sw_if_index; \ 538 vnet_sw_interface_t *_swif; \ 539 _swif = vnet_get_sw_interface (_vnm, _sw_if_index); \ 544 if (loop && _swif->flags & VNET_SW_INTERFACE_FLAG_UNNUMBERED) \ 545 _sw_if_index = _swif->unnumbered_sw_if_index; \ 547 (vec_len((lm)->if_address_pool_index_by_sw_if_index) \ 549 ? vec_elt ((lm)->if_address_pool_index_by_sw_if_index, \ 550 (_sw_if_index)) : (u32)~0; \ 551 ip_interface_address_t * _a; \ 554 _a = pool_elt_at_index ((lm)->if_address_pool, _ia); \ 555 _ia = _a->next_this_sw_interface; \ uword * multipath_adjacency_by_next_hops
uword * adjacency_by_id_vector
format_function_t * format_fib_result
#define CLIB_CACHE_LINE_ALIGN_MARK(mark)
sll srl srl sll sra u16x4 i
u32 * config_index_by_sw_if_index
ip_add_del_adjacency_callback_t * add_del_adjacency_callbacks
ip_adjacency_t * adjacency_heap
u16 saved_lookup_next_index
ip_multicast_rewrite_t * rewrite_heap
clib_error_t * ip_interface_address_add_del(ip_lookup_main_t *lm, u32 sw_if_index, void *address, u32 address_length, u32 is_del, u32 *result_index)
static void(BVT(clib_bihash)*h, BVT(clib_bihash_value)*v)
ip_interface_address_t * if_address_pool
#define STRUCT_MARK_PTR(v, f)
ip_lookup_next_t lookup_next_index
static int ip_adjacency_is_multipath(ip_lookup_main_t *lm, u32 adj_index)
ip_config_main_t rx_config_mains[VNET_N_CAST]
void ip_update_adjacency(ip_lookup_main_t *lm, u32 adj_index, ip_adjacency_t *copy_adj)
#define vec_add1(V, E)
Add 1 element to end of vector (unspecified alignment).
#define STRUCT_MARK(mark)
#define STRUCT_OFFSET_OF(t, f)
static int vnet_ip_adjacency_share_compare(ip_adjacency_t *a1, ip_adjacency_t *a2)
always_inline void * mhash_key_to_mem(mhash_t *h, uword key)
void(* ip_add_del_adjacency_callback_t)(struct ip_lookup_main_t *lm, u32 adj_index, ip_adjacency_t *adj, u32 is_del)
u32 neighbor_probe_adj_index
mhash_t address_to_if_address_index
always_inline void * ip_interface_address_get_address(ip_lookup_main_t *lm, ip_interface_address_t *a)
u32 next_adj_with_signature
u32 * adjacency_remap_table
uword * adj_index_by_signature
#define vec_elt_at_index(v, i)
Get vector value at index i checking that i is in bounds.
#define VLIB_BUFFER_PRE_DATA_SIZE
static uword vnet_ip_adjacency_signature(ip_adjacency_t *adj)
struct ip_lookup_main_t ip_lookup_main_t
#define pool_elt_at_index(p, i)
u32 * classify_table_index_by_sw_if_index
u8 local_next_by_ip_protocol[256]
always_inline ip_interface_address_t * ip_interface_address_for_packet(ip_lookup_main_t *lm, vlib_buffer_t *b, u32 sw_if_index)
u32 ip_multipath_adjacency_add_del_next_hop(ip_lookup_main_t *lm, u32 is_del, u32 old_mp_adj_index, u32 next_hop_adj_index, u32 next_hop_weight, u32 *new_mp_adj_index)
ip_adjacency_t * ip_add_adjacency(ip_lookup_main_t *lm, ip_adjacency_t *adj, u32 n_adj, u32 *adj_index_result)
vlib_combined_counter_main_t adjacency_counters
u8 builtin_protocol_by_ip_protocol[256]
u32 * if_address_pool_index_by_sw_if_index
static void ip_register_add_del_adjacency_callback(ip_lookup_main_t *lm, ip_add_del_adjacency_callback_t cb)
ip_multipath_next_hop_t * next_hop_hash_lookup_key
i32 ** adjacency_id_vector
uword hash_memory(void *p, word n_bytes, uword state)
always_inline ip_adjacency_t * ip_get_adjacency(ip_lookup_main_t *lm, u32 adj_index)
#define vec_elt(v, i)
Get vector value at index i.
ip_config_main_t tx_config_main
#define vnet_declare_rewrite(total_bytes)
always_inline ip_interface_address_t * ip_get_interface_address(ip_lookup_main_t *lm, void *addr_fib)
#define vec_len(v)
Number of elements in vector (rvalue-only, NULL tolerant)
void ip_multipath_adjacency_free(ip_lookup_main_t *lm, ip_multipath_adjacency_t *a)
ip_multipath_next_hop_t * next_hop_heap
ip_multipath_adjacency_t * multipath_adjacencies
always_inline void ip_call_add_del_adjacency_callbacks(ip_lookup_main_t *lm, u32 adj_index, u32 is_del)
ip_multipath_next_hop_t * next_hop_hash_lookup_key_normalized
void ip_lookup_init(ip_lookup_main_t *lm, u32 ip_lookup_node_index)
vlib buffer structure definition and a few select access methods.
vnet_config_main_t config_main
always_inline uword * mhash_get(mhash_t *h, void *key)
void ip_del_adjacency(ip_lookup_main_t *lm, u32 adj_index)
f64 multipath_next_hop_error_tolerance
ip_multicast_rewrite_string_t * rewrite_strings
u32 next_this_sw_interface
format_function_t * format_address_and_length
u32 prev_this_sw_interface
u16 lookup_next_index_as_int