From 107e7d4b5375295e94e01653e3cf064ea6647064 Mon Sep 17 00:00:00 2001 From: Neale Ranns Date: Tue, 11 Apr 2017 09:55:19 -0700 Subject: [PATCH] Remove usued, redundant and deprecated code from lookup.h Change-Id: Ic16bc10d0b2877b2afdf052615f9334f31b9519f Signed-off-by: Neale Ranns --- src/plugins/ioam/encap/ip6_ioam_trace.c | 4 +-- src/plugins/ioam/lib-vxlan-gpe/vxlan_gpe_ioam.c | 3 +- .../ioam/lib-vxlan-gpe/vxlan_gpe_ioam_trace.c | 10 +++--- src/vnet/adj/adj.c | 3 -- src/vnet/ethernet/arp.c | 14 +++------ src/vnet/fib/fib_path.c | 19 ------------ src/vnet/ip/ip4_forward.c | 19 ++++++------ src/vnet/ip/ip4_source_check.c | 2 +- src/vnet/ip/ip6_forward.c | 29 +++++++++-------- src/vnet/ip/ip6_hop_by_hop.c | 8 ++--- src/vnet/ip/ip6_neighbor.c | 6 ++-- src/vnet/ip/lookup.c | 35 ++------------------- src/vnet/ip/lookup.h | 29 ----------------- src/vnet/mpls/mpls.c | 4 +-- src/vnet/sr/sr_localsid.c | 8 ++--- src/vnet/sr/sr_policy_rewrite.c | 23 ++++++-------- src/vnet/sr/sr_steering.c | 36 +++++++++++----------- 17 files changed, 78 insertions(+), 174 deletions(-) diff --git a/src/plugins/ioam/encap/ip6_ioam_trace.c b/src/plugins/ioam/encap/ip6_ioam_trace.c index 299ee88f9c8..3ec3ea82113 100644 --- a/src/plugins/ioam/encap/ip6_ioam_trace.c +++ b/src/plugins/ioam/encap/ip6_ioam_trace.c @@ -254,13 +254,11 @@ int ip6_hbh_ioam_trace_data_list_handler (vlib_buffer_t * b, ip6_header_t * ip, ip6_hop_by_hop_option_t * opt) { - ip6_main_t *im = &ip6_main; - ip_lookup_main_t *lm = &im->lookup_main; ip6_hop_by_hop_ioam_main_t *hm = &ip6_hop_by_hop_ioam_main; u8 elt_index = 0; ioam_trace_option_t *trace = (ioam_trace_option_t *) opt; u32 adj_index = vnet_buffer (b)->ip.adj_index[VLIB_TX]; - ip_adjacency_t *adj = ip_get_adjacency (lm, adj_index); + ip_adjacency_t *adj = adj_get (adj_index); time_u64_t time_u64; u32 *elt; int rv = 0; diff --git a/src/plugins/ioam/lib-vxlan-gpe/vxlan_gpe_ioam.c b/src/plugins/ioam/lib-vxlan-gpe/vxlan_gpe_ioam.c index 6c04d9af210..88d7d205273 100644 --- a/src/plugins/ioam/lib-vxlan-gpe/vxlan_gpe_ioam.c +++ b/src/plugins/ioam/lib-vxlan-gpe/vxlan_gpe_ioam.c @@ -265,8 +265,7 @@ vxlan_gpe_enable_disable_ioam_for_dest (vlib_main_t * vm, continue; } - adj0 = - ip_get_adjacency (&(ip4_main.lookup_main), adj_index0); + adj0 = adj_get (adj_index0); sw_if_index0 = adj0->rewrite_header.sw_if_index; if (~0 == sw_if_index0) diff --git a/src/plugins/ioam/lib-vxlan-gpe/vxlan_gpe_ioam_trace.c b/src/plugins/ioam/lib-vxlan-gpe/vxlan_gpe_ioam_trace.c index 48edb4b0204..f3d03b674cc 100644 --- a/src/plugins/ioam/lib-vxlan-gpe/vxlan_gpe_ioam_trace.c +++ b/src/plugins/ioam/lib-vxlan-gpe/vxlan_gpe_ioam_trace.c @@ -302,11 +302,10 @@ vxlan_gpe_ioam_trace_data_list_handler (vlib_buffer_t * b, { u16 tx_if = 0; u32 adj_index = vnet_buffer (b)->ip.adj_index[VLIB_TX]; - ip4_main_t *im4 = &ip4_main; - ip_lookup_main_t *lm = &im4->lookup_main; + if (use_adj) { - ip_adjacency_t *adj = ip_get_adjacency (lm, adj_index); + ip_adjacency_t *adj = adj_get (adj_index); tx_if = adj->rewrite_header.sw_if_index & 0xFFFF; } @@ -330,11 +329,10 @@ vxlan_gpe_ioam_trace_data_list_handler (vlib_buffer_t * b, { u16 tx_if = 0; u32 adj_index = vnet_buffer (b)->ip.adj_index[VLIB_TX]; - ip6_main_t *im6 = &ip6_main; - ip_lookup_main_t *lm = &im6->lookup_main; + if (use_adj) { - ip_adjacency_t *adj = ip_get_adjacency (lm, adj_index); + ip_adjacency_t *adj = adj_get (adj_index); tx_if = adj->rewrite_header.sw_if_index & 0xFFFF; } diff --git a/src/vnet/adj/adj.c b/src/vnet/adj/adj.c index 36dfe500eb3..bf44383fd5f 100644 --- a/src/vnet/adj/adj.c +++ b/src/vnet/adj/adj.c @@ -71,9 +71,6 @@ adj_alloc (fib_protocol_t proto) memset(&adj->sub_type.midchain.next_dpo, 0, sizeof(adj->sub_type.midchain.next_dpo)); - ip4_main.lookup_main.adjacency_heap = adj_pool; - ip6_main.lookup_main.adjacency_heap = adj_pool; - return (adj); } diff --git a/src/vnet/ethernet/arp.c b/src/vnet/ethernet/arp.c index dd509193386..3e292e4df93 100644 --- a/src/vnet/ethernet/arp.c +++ b/src/vnet/ethernet/arp.c @@ -1915,18 +1915,15 @@ vnet_proxy_arp_add_del (ip4_address_t * lo_addr, int vnet_proxy_arp_fib_reset (u32 fib_id) { - ip4_main_t *im = &ip4_main; ethernet_arp_main_t *am = ðernet_arp_main; ethernet_proxy_arp_t *pa; u32 *entries_to_delete = 0; u32 fib_index; - uword *p; int i; - p = hash_get (im->fib_index_by_table_id, fib_id); - if (!p) + fib_index = fib_table_find (FIB_PROTOCOL_IP4, fib_id); + if (~0 == fib_index) return VNET_API_ERROR_NO_SUCH_ENTRY; - fib_index = p[0]; vec_foreach (pa, am->proxy_arps) { @@ -1985,11 +1982,10 @@ ip_arp_add_del_command_fn (vlib_main_t * vm, else if (unformat (input, "fib-id %d", &fib_id)) { - ip4_main_t *im = &ip4_main; - uword *p = hash_get (im->fib_index_by_table_id, fib_id); - if (!p) + fib_index = fib_table_find (FIB_PROTOCOL_IP4, fib_id); + + if (~0 == fib_index) return clib_error_return (0, "fib ID %d doesn't exist\n", fib_id); - fib_index = p[0]; } else if (unformat (input, "proxy %U - %U", diff --git a/src/vnet/fib/fib_path.c b/src/vnet/fib/fib_path.c index f81f41706c5..6c1bd6bd65d 100644 --- a/src/vnet/fib/fib_path.c +++ b/src/vnet/fib/fib_path.c @@ -240,25 +240,6 @@ typedef struct fib_path_t_ { } fp_nh; /** * The FIB table index in which to find the next-hop. - * This needs to be fixed. We should lookup the adjacencies in - * a separate table of adjacencies, rather than from the FIB. - * Two reasons I can think of: - * - consider: - * int ip addr Gig0 10.0.0.1/24 - * ip route 10.0.0.2/32 via Gig1 192.168.1.2 - * ip route 1.1.1.1/32 via Gig0 10.0.0.2 - * this is perfectly valid. - * Packets addressed to 10.0.0.2 should be sent via Gig1. - * Packets address to 1.1.1.1 should be sent via Gig0. - * when we perform the adj resolution from the FIB for the path - * "via Gig0 10.0.0.2" the lookup will result in the route via Gig1 - * and so we will pick up the adj via Gig1 - which was not what the - * operator wanted. - * - we can only return link-type IPv4 and so not the link-type MPLS. - * more on this in a later commit. - * - * The table ID should only belong to a recursive path and indicate - * which FIB should be used to resolve the next-hop. */ fib_node_index_t fp_tbl_id; } recursive; diff --git a/src/vnet/ip/ip4_forward.c b/src/vnet/ip/ip4_forward.c index 9fdf9b3cee1..e42b36374e4 100644 --- a/src/vnet/ip/ip4_forward.c +++ b/src/vnet/ip/ip4_forward.c @@ -2036,7 +2036,7 @@ ip4_arp_inline (vlib_main_t * vm, p0 = vlib_get_buffer (vm, pi0); adj_index0 = vnet_buffer (p0)->ip.adj_index[VLIB_TX]; - adj0 = ip_get_adjacency (lm, adj_index0); + adj0 = adj_get (adj_index0); ip0 = vlib_buffer_get_current (p0); a0 = hash_seeds[0]; @@ -2276,7 +2276,7 @@ ip4_probe_neighbor (vlib_main_t * vm, ip4_address_t * dst, u32 sw_if_index) sw_if_index); } - adj = ip_get_adjacency (&im->lookup_main, ia->neighbor_probe_adj_index); + adj = adj_get (ia->neighbor_probe_adj_index); h = vlib_packet_template_get_packet (vm, @@ -2465,8 +2465,8 @@ ip4_rewrite_inline (vlib_main_t * vm, } /* Rewrite packet header and updates lengths. */ - adj0 = ip_get_adjacency (lm, adj_index0); - adj1 = ip_get_adjacency (lm, adj_index1); + adj0 = adj_get (adj_index0); + adj1 = adj_get (adj_index1); /* Worth pipelining. No guarantee that adj0,1 are hot... */ rw_len0 = adj0[0].rewrite_header.data_bytes; @@ -2571,7 +2571,7 @@ ip4_rewrite_inline (vlib_main_t * vm, adj_index0 = vnet_buffer (p0)->ip.adj_index[VLIB_TX]; - adj0 = ip_get_adjacency (lm, adj_index0); + adj0 = adj_get (adj_index0); ip0 = vlib_buffer_get_current (p0); @@ -3003,14 +3003,15 @@ VLIB_CLI_COMMAND (lookup_test_command, static) = int vnet_set_ip4_flow_hash (u32 table_id, u32 flow_hash_config) { - ip4_main_t *im4 = &ip4_main; ip4_fib_t *fib; - uword *p = hash_get (im4->fib_index_by_table_id, table_id); + u32 fib_index; + + fib_index = fib_table_find (FIB_PROTOCOL_IP4, table_id); - if (p == 0) + if (~0 == fib_index) return VNET_API_ERROR_NO_SUCH_FIB; - fib = ip4_fib_get (p[0]); + fib = ip4_fib_get (fib_index); fib->flow_hash_config = flow_hash_config; return 0; diff --git a/src/vnet/ip/ip4_source_check.c b/src/vnet/ip/ip4_source_check.c index 6831066e550..63b7594d4e4 100644 --- a/src/vnet/ip/ip4_source_check.c +++ b/src/vnet/ip/ip4_source_check.c @@ -492,7 +492,7 @@ ip_source_check_accept (vlib_main_t * vm, if (~0 != table_id) { - fib_index = fib_table_id_find_fib_index (pfx.fp_proto, table_id); + fib_index = fib_table_find (pfx.fp_proto, table_id); if (~0 == fib_index) { error = clib_error_return (0, "Nonexistent table id %d", table_id); diff --git a/src/vnet/ip/ip6_forward.c b/src/vnet/ip/ip6_forward.c index a369f79fbb8..90a88b1cc0c 100644 --- a/src/vnet/ip/ip6_forward.c +++ b/src/vnet/ip/ip6_forward.c @@ -1611,7 +1611,7 @@ ip6_discover_neighbor_inline (vlib_main_t * vm, ip0 = vlib_buffer_get_current (p0); - adj0 = ip_get_adjacency (lm, adj_index0); + adj0 = adj_get (adj_index0); if (!is_glean) { @@ -1862,7 +1862,7 @@ ip6_probe_neighbor (vlib_main_t * vm, ip6_address_t * dst, u32 sw_if_index) vnet_buffer (b)->sw_if_index[VLIB_TX] = sw_if_index; /* Add encapsulation string for software interface (e.g. ethernet header). */ - adj = ip_get_adjacency (&im->lookup_main, ia->neighbor_probe_adj_index); + adj = adj_get (ia->neighbor_probe_adj_index); vnet_rewrite_one_header (adj[0], h, sizeof (ethernet_header_t)); vlib_buffer_advance (b, -adj->rewrite_header.data_bytes); @@ -2007,8 +2007,8 @@ ip6_rewrite_inline (vlib_main_t * vm, { p1->flags &= ~VNET_BUFFER_LOCALLY_ORIGINATED; } - adj0 = ip_get_adjacency (lm, adj_index0); - adj1 = ip_get_adjacency (lm, adj_index1); + adj0 = adj_get (adj_index0); + adj1 = adj_get (adj_index1); rw_len0 = adj0[0].rewrite_header.data_bytes; rw_len1 = adj1[0].rewrite_header.data_bytes; @@ -2108,7 +2108,7 @@ ip6_rewrite_inline (vlib_main_t * vm, adj_index0 = vnet_buffer (p0)->ip.adj_index[VLIB_TX]; - adj0 = ip_get_adjacency (lm, adj_index0); + adj0 = adj_get (adj_index0); ip0 = vlib_buffer_get_current (p0); @@ -2531,8 +2531,6 @@ ip6_hop_by_hop (vlib_main_t * vm, ip6_hop_by_hop_main_t *hm = &ip6_hop_by_hop_main; u32 n_left_from, *from, *to_next; ip_lookup_next_t next_index; - ip6_main_t *im = &ip6_main; - ip_lookup_main_t *lm = &im->lookup_main; from = vlib_frame_vector_args (frame); n_left_from = frame->n_vectors; @@ -2581,9 +2579,9 @@ ip6_hop_by_hop (vlib_main_t * vm, /* Default use the next_index from the adjacency. A HBH option rarely redirects to a different node */ u32 adj_index0 = vnet_buffer (b0)->ip.adj_index[VLIB_TX]; - ip_adjacency_t *adj0 = ip_get_adjacency (lm, adj_index0); + ip_adjacency_t *adj0 = adj_get (adj_index0); u32 adj_index1 = vnet_buffer (b1)->ip.adj_index[VLIB_TX]; - ip_adjacency_t *adj1 = ip_get_adjacency (lm, adj_index1); + ip_adjacency_t *adj1 = adj_get (adj_index1); /* Default use the next_index from the adjacency. A HBH option rarely redirects to a different node */ next0 = adj0->lookup_next_index; @@ -2704,7 +2702,7 @@ ip6_hop_by_hop (vlib_main_t * vm, * A HBH option rarely redirects to a different node */ u32 adj_index0 = vnet_buffer (b0)->ip.adj_index[VLIB_TX]; - ip_adjacency_t *adj0 = ip_get_adjacency (lm, adj_index0); + ip_adjacency_t *adj0 = adj_get (adj_index0); next0 = adj0->lookup_next_index; ip0 = vlib_buffer_get_current (b0); @@ -3114,14 +3112,15 @@ VLIB_CLI_COMMAND (test_link_command, static) = int vnet_set_ip6_flow_hash (u32 table_id, u32 flow_hash_config) { - ip6_main_t *im6 = &ip6_main; ip6_fib_t *fib; - uword *p = hash_get (im6->fib_index_by_table_id, table_id); + u32 fib_index; + + fib_index = fib_table_find (FIB_PROTOCOL_IP6, table_id); - if (p == 0) - return -1; + if (~0 == fib_index) + return VNET_API_ERROR_NO_SUCH_FIB; - fib = ip6_fib_get (p[0]); + fib = ip6_fib_get (fib_index); fib->flow_hash_config = flow_hash_config; return 1; diff --git a/src/vnet/ip/ip6_hop_by_hop.c b/src/vnet/ip/ip6_hop_by_hop.c index df2a932e00d..14fbb392e19 100644 --- a/src/vnet/ip/ip6_hop_by_hop.c +++ b/src/vnet/ip/ip6_hop_by_hop.c @@ -581,8 +581,6 @@ static uword ip6_pop_hop_by_hop_node_fn (vlib_main_t * vm, vlib_node_runtime_t * node, vlib_frame_t * frame) { - ip6_main_t *im = &ip6_main; - ip_lookup_main_t *lm = &im->lookup_main; u32 n_left_from, *from, *to_next; ip_lookup_next_t next_index; u32 processed = 0; @@ -640,8 +638,8 @@ ip6_pop_hop_by_hop_node_fn (vlib_main_t * vm, ip1 = vlib_buffer_get_current (b1); adj_index0 = vnet_buffer (b0)->ip.adj_index[VLIB_TX]; adj_index1 = vnet_buffer (b1)->ip.adj_index[VLIB_TX]; - adj0 = ip_get_adjacency (lm, adj_index0); - adj1 = ip_get_adjacency (lm, adj_index1); + adj0 = adj_get (adj_index0); + adj1 = adj_get (adj_index1); next0 = adj0->lookup_next_index; next1 = adj1->lookup_next_index; @@ -729,7 +727,7 @@ ip6_pop_hop_by_hop_node_fn (vlib_main_t * vm, ip0 = vlib_buffer_get_current (b0); adj_index0 = vnet_buffer (b0)->ip.adj_index[VLIB_TX]; - adj0 = ip_get_adjacency (lm, adj_index0); + adj0 = adj_get (adj_index0); /* Default use the next_index from the adjacency. */ next0 = adj0->lookup_next_index; diff --git a/src/vnet/ip/ip6_neighbor.c b/src/vnet/ip/ip6_neighbor.c index 58b997aa0db..42edb79a545 100644 --- a/src/vnet/ip/ip6_neighbor.c +++ b/src/vnet/ip/ip6_neighbor.c @@ -1001,8 +1001,7 @@ icmp6_neighbor_solicitation_or_advertisement (vlib_main_t * vm, if (ADJ_INDEX_INVALID != src_adj_index0) { - ip_adjacency_t *adj0 = - ip_get_adjacency (&im->lookup_main, src_adj_index0); + ip_adjacency_t *adj0 = adj_get (src_adj_index0); /* Allow all realistic-looking rewrite adjacencies to pass */ ni0 = adj0->lookup_next_index; @@ -1322,8 +1321,7 @@ icmp6_router_solicitation (vlib_main_t * vm, if (ADJ_INDEX_INVALID != src_adj_index0) { - ip_adjacency_t *adj0 = ip_get_adjacency (&im->lookup_main, - src_adj_index0); + ip_adjacency_t *adj0 = adj_get (src_adj_index0); error0 = (adj0->rewrite_header.sw_if_index != sw_if_index0 ? diff --git a/src/vnet/ip/lookup.c b/src/vnet/ip/lookup.c index 597de06b5e3..2321c072620 100755 --- a/src/vnet/ip/lookup.c +++ b/src/vnet/ip/lookup.c @@ -191,9 +191,6 @@ VNET_SW_INTERFACE_ADD_DEL_FUNCTION (ip_sw_interface_add_del); void ip_lookup_init (ip_lookup_main_t * lm, u32 is_ip6) { - /* Preallocate three "special" adjacencies */ - lm->adjacency_heap = adj_pool; - if (!lm->fib_result_n_bytes) lm->fib_result_n_bytes = sizeof (uword); @@ -353,32 +350,6 @@ const ip46_address_t zero_addr = { 0, 0}, }; -u32 -fib_table_id_find_fib_index (fib_protocol_t proto, u32 table_id) -{ - ip4_main_t *im4 = &ip4_main; - ip6_main_t *im6 = &ip6_main; - uword *p; - - switch (proto) - { - case FIB_PROTOCOL_IP4: - p = hash_get (im4->fib_index_by_table_id, table_id); - break; - case FIB_PROTOCOL_IP6: - p = hash_get (im6->fib_index_by_table_id, table_id); - break; - default: - p = NULL; - break; - } - if (NULL != p) - { - return (p[0]); - } - return (~0); -} - clib_error_t * vnet_ip_route_cmd (vlib_main_t * vm, unformat_input_t * main_input, vlib_cli_command_t * cmd) @@ -602,7 +573,7 @@ vnet_ip_route_cmd (vlib_main_t * vm, } else { - fib_index = fib_table_id_find_fib_index (prefixs[0].fp_proto, table_id); + fib_index = fib_table_find (prefixs[0].fp_proto, table_id); if (~0 == fib_index) { @@ -651,8 +622,8 @@ vnet_ip_route_cmd (vlib_main_t * vm, /* * the CLI parsing stored table Ids, swap to FIB indicies */ - fi = fib_table_id_find_fib_index (prefixs[i].fp_proto, - rpaths[i].frp_fib_index); + fi = fib_table_find (prefixs[i].fp_proto, + rpaths[i].frp_fib_index); if (~0 == fi) { diff --git a/src/vnet/ip/lookup.h b/src/vnet/ip/lookup.h index 662a1cc0066..941a6df965e 100644 --- a/src/vnet/ip/lookup.h +++ b/src/vnet/ip/lookup.h @@ -121,12 +121,6 @@ struct ip_lookup_main_t; typedef struct ip_lookup_main_t { - /* Adjacency heap. */ - ip_adjacency_t *adjacency_heap; - - /** load-balance packet/byte counters indexed by LB index. */ - vlib_combined_counter_main_t load_balance_counters; - /** Pool of addresses that are assigned to interfaces. */ ip_interface_address_t *if_address_pool; @@ -149,17 +143,12 @@ typedef struct ip_lookup_main_t sizeof (uword). First word is always adjacency index. */ u32 fib_result_n_bytes, fib_result_n_words; - format_function_t *format_fib_result; - /** 1 for ip6; 0 for ip4. */ u32 is_ip6; /** Either format_ip4_address_and_length or format_ip6_address_and_length. */ format_function_t *format_address_and_length; - /** Special adjacency format functions */ - format_function_t **special_adjacency_format_functions; - /** Table mapping ip protocol to ip[46]-local node next index. */ u8 local_next_by_ip_protocol[256]; @@ -167,22 +156,6 @@ typedef struct ip_lookup_main_t u8 builtin_protocol_by_ip_protocol[256]; } ip_lookup_main_t; -always_inline ip_adjacency_t * -ip_get_adjacency (ip_lookup_main_t * lm, u32 adj_index) -{ - ip_adjacency_t *adj; - - adj = vec_elt_at_index (lm->adjacency_heap, adj_index); - - return adj; -} - -#define ip_prefetch_adjacency(lm,adj_index,type) \ -do { \ - ip_adjacency_t * _adj = (lm)->adjacency_heap + (adj_index); \ - CLIB_PREFETCH (_adj, sizeof (_adj[0]), type); \ -} while (0) - clib_error_t *ip_interface_address_add_del (ip_lookup_main_t * lm, u32 sw_if_index, void *address, @@ -198,8 +171,6 @@ ip_get_interface_address (ip_lookup_main_t * lm, void *addr_fib) return p ? pool_elt_at_index (lm->if_address_pool, p[0]) : 0; } -u32 fib_table_id_find_fib_index (fib_protocol_t proto, u32 table_id); - always_inline void * ip_interface_address_get_address (ip_lookup_main_t * lm, ip_interface_address_t * a) diff --git a/src/vnet/mpls/mpls.c b/src/vnet/mpls/mpls.c index 451b15cf03c..a67f47a2cb4 100644 --- a/src/vnet/mpls/mpls.c +++ b/src/vnet/mpls/mpls.c @@ -447,8 +447,8 @@ vnet_mpls_local_label (vlib_main_t * vm, */ if (FIB_NODE_INDEX_INVALID == rpath.frp_sw_if_index) { - fi = fib_table_id_find_fib_index(dpo_proto_to_fib(pfx.fp_payload_proto), - rpaths[0].frp_fib_index); + fi = fib_table_find(dpo_proto_to_fib(pfx.fp_payload_proto), + rpaths[0].frp_fib_index); if (~0 == fi) { diff --git a/src/vnet/sr/sr_localsid.c b/src/vnet/sr/sr_localsid.c index 6d72a506088..32fc5f823ef 100755 --- a/src/vnet/sr/sr_localsid.c +++ b/src/vnet/sr/sr_localsid.c @@ -93,9 +93,9 @@ sr_cli_localsid (char is_del, ip6_address_t * localsid_addr, } }; - fib_table_entry_delete (fib_table_id_find_fib_index - (FIB_PROTOCOL_IP6, fib_table), &pfx, - FIB_SOURCE_SR); + fib_table_entry_delete (fib_table_find (FIB_PROTOCOL_IP6, + fib_table), + &pfx, FIB_SOURCE_SR); /* In case it is a Xconnect iface remove the (OIF, NHOP) adj */ if (ls->behavior == SR_BEHAVIOR_X || ls->behavior == SR_BEHAVIOR_DX6 @@ -135,7 +135,7 @@ sr_cli_localsid (char is_del, ip6_address_t * localsid_addr, pfx.fp_addr.as_u64[1] = localsid_addr->as_u64[1]; /* Lookup the FIB index associated to the table id provided */ - u32 fib_index = fib_table_id_find_fib_index (FIB_PROTOCOL_IP6, fib_table); + u32 fib_index = fib_table_find (FIB_PROTOCOL_IP6, fib_table); if (fib_index == ~0) return -3; diff --git a/src/vnet/sr/sr_policy_rewrite.c b/src/vnet/sr/sr_policy_rewrite.c index 61cf4437125..c4024070f00 100755 --- a/src/vnet/sr/sr_policy_rewrite.c +++ b/src/vnet/sr/sr_policy_rewrite.c @@ -376,10 +376,9 @@ update_lb (ip6_sr_policy_t * sr_policy) load_balance_create (0, DPO_PROTO_IP6, fhc)); /* Update FIB entry's to point to the LB DPO in the main FIB and hidden one */ - fib_table_entry_special_dpo_update (fib_table_id_find_fib_index - (FIB_PROTOCOL_IP6, - sr_policy->fib_table), &pfx, - FIB_SOURCE_SR, + fib_table_entry_special_dpo_update (fib_table_find (FIB_PROTOCOL_IP6, + sr_policy->fib_table), + &pfx, FIB_SOURCE_SR, FIB_ENTRY_FLAG_EXCLUSIVE, &sr_policy->bsid_dpo); @@ -470,10 +469,9 @@ update_replicate (ip6_sr_policy_t * sr_policy) .ip6 = sr_policy->bsid, } }; - fib_table_entry_special_dpo_update (fib_table_id_find_fib_index - (FIB_PROTOCOL_IP6, - sr_policy->fib_table), &pfx, - FIB_SOURCE_SR, + fib_table_entry_special_dpo_update (fib_table_find (FIB_PROTOCOL_IP6, + sr_policy->fib_table), + &pfx, FIB_SOURCE_SR, FIB_ENTRY_FLAG_EXCLUSIVE, &sr_policy->bsid_dpo); @@ -568,9 +566,8 @@ sr_policy_add (ip6_address_t * bsid, ip6_address_t * segments, }; /* Lookup the FIB index associated to the table selected */ - u32 fib_index = fib_table_id_find_fib_index (FIB_PROTOCOL_IP6, - (fib_table != - (u32) ~ 0 ? fib_table : 0)); + u32 fib_index = fib_table_find (FIB_PROTOCOL_IP6, + (fib_table != (u32) ~ 0 ? fib_table : 0)); if (fib_index == ~0) return -13; @@ -653,8 +650,8 @@ sr_policy_del (ip6_address_t * bsid, u32 index) , }; - fib_table_entry_special_remove (fib_table_id_find_fib_index - (FIB_PROTOCOL_IP6, sr_policy->fib_table), + fib_table_entry_special_remove (fib_table_find (FIB_PROTOCOL_IP6, + sr_policy->fib_table), &pfx, FIB_SOURCE_SR); fib_table_entry_special_remove (sm->fib_table_ip6, &pfx, FIB_SOURCE_SR); diff --git a/src/vnet/sr/sr_steering.c b/src/vnet/sr/sr_steering.c index 5156b20474c..04646198de1 100755 --- a/src/vnet/sr/sr_steering.c +++ b/src/vnet/sr/sr_steering.c @@ -115,10 +115,10 @@ sr_steering_policy (int is_del, ip6_address_t * bsid, u32 sr_policy_index, pfx.fp_len = steer_pl->classify.l3.mask_width; pfx.fp_addr.ip6 = steer_pl->classify.l3.prefix.ip6; - fib_table_entry_delete (fib_table_id_find_fib_index + fib_table_entry_delete (fib_table_find (FIB_PROTOCOL_IP6, - steer_pl->classify.l3.fib_table), &pfx, - FIB_SOURCE_SR); + steer_pl->classify.l3.fib_table), + &pfx, FIB_SOURCE_SR); } else if (steer_pl->classify.traffic_type == SR_STEER_IPV4) { @@ -127,7 +127,7 @@ sr_steering_policy (int is_del, ip6_address_t * bsid, u32 sr_policy_index, pfx.fp_len = steer_pl->classify.l3.mask_width; pfx.fp_addr.ip4 = steer_pl->classify.l3.prefix.ip4; - fib_table_entry_delete (fib_table_id_find_fib_index + fib_table_entry_delete (fib_table_find (FIB_PROTOCOL_IP4, steer_pl->classify.l3.fib_table), &pfx, FIB_SOURCE_SR); @@ -194,10 +194,10 @@ sr_steering_policy (int is_del, ip6_address_t * bsid, u32 sr_policy_index, pfx.fp_len = steer_pl->classify.l3.mask_width; pfx.fp_addr.ip6 = steer_pl->classify.l3.prefix.ip6; - fib_table_entry_delete (fib_table_id_find_fib_index + fib_table_entry_delete (fib_table_find (FIB_PROTOCOL_IP6, - steer_pl->classify.l3.fib_table), &pfx, - FIB_SOURCE_SR); + steer_pl->classify.l3.fib_table), + &pfx, FIB_SOURCE_SR); /* Create a new one */ goto update_fib; @@ -209,10 +209,10 @@ sr_steering_policy (int is_del, ip6_address_t * bsid, u32 sr_policy_index, pfx.fp_len = steer_pl->classify.l3.mask_width; pfx.fp_addr.ip4 = steer_pl->classify.l3.prefix.ip4; - fib_table_entry_delete (fib_table_id_find_fib_index + fib_table_entry_delete (fib_table_find (FIB_PROTOCOL_IP4, - steer_pl->classify.l3.fib_table), &pfx, - FIB_SOURCE_SR); + steer_pl->classify.l3.fib_table), + &pfx, FIB_SOURCE_SR); /* Create a new one */ goto update_fib; @@ -304,10 +304,10 @@ update_fib: pfx.fp_len = steer_pl->classify.l3.mask_width; pfx.fp_addr.ip6 = steer_pl->classify.l3.prefix.ip6; - fib_table_entry_path_add (fib_table_id_find_fib_index (FIB_PROTOCOL_IP6, - (table_id != - (u32) ~ 0 ? - table_id : 0)), + fib_table_entry_path_add (fib_table_find (FIB_PROTOCOL_IP6, + (table_id != + (u32) ~ 0 ? + table_id : 0)), &pfx, FIB_SOURCE_SR, FIB_ENTRY_FLAG_LOOSE_URPF_EXEMPT, FIB_PROTOCOL_IP6, @@ -321,10 +321,10 @@ update_fib: pfx.fp_len = steer_pl->classify.l3.mask_width; pfx.fp_addr.ip4 = steer_pl->classify.l3.prefix.ip4; - fib_table_entry_path_add (fib_table_id_find_fib_index (FIB_PROTOCOL_IP4, - (table_id != - (u32) ~ 0 ? - table_id : 0)), + fib_table_entry_path_add (fib_table_find (FIB_PROTOCOL_IP4, + (table_id != + (u32) ~ 0 ? + table_id : 0)), &pfx, FIB_SOURCE_SR, FIB_ENTRY_FLAG_LOOSE_URPF_EXEMPT, FIB_PROTOCOL_IP6, -- 2.16.6