aboutsummaryrefslogtreecommitdiffstats
path: root/src/vnet/dpo
diff options
context:
space:
mode:
authorNeale Ranns <neale@graphiant.com>2021-08-10 12:35:57 +0000
committerOle Tr�an <otroan@employees.org>2021-08-10 14:45:51 +0000
commit31a4aa7b354dcef292c0ddaf8fbae915938a5d23 (patch)
tree93b278b520728f0821837297e1b80f0806418546 /src/vnet/dpo
parent625a1f1824e4b21e8343e1dc50c4f5400080d0ed (diff)
ip: Use the IP4 lookup functions
Type: refactor as opposed to wrtiing out the mtrie steps one by one each time. Signed-off-by: Neale Ranns <neale@graphiant.com> Change-Id: I1248861350f9189f9a67ac6e68940813af279e03
Diffstat (limited to 'src/vnet/dpo')
-rw-r--r--src/vnet/dpo/lookup_dpo.c51
1 files changed, 3 insertions, 48 deletions
diff --git a/src/vnet/dpo/lookup_dpo.c b/src/vnet/dpo/lookup_dpo.c
index 3f34cefe0c4..9ce94eebe5c 100644
--- a/src/vnet/dpo/lookup_dpo.c
+++ b/src/vnet/dpo/lookup_dpo.c
@@ -268,50 +268,6 @@ lookup_dpo_unlock (dpo_id_t *dpo)
}
}
-always_inline void
-ip4_src_fib_lookup_one (u32 src_fib_index0,
- const ip4_address_t * addr0,
- u32 * src_adj_index0)
-{
- ip4_fib_mtrie_leaf_t leaf0;
- ip4_fib_mtrie_t * mtrie0;
-
- mtrie0 = &ip4_fib_get (src_fib_index0)->mtrie;
-
- leaf0 = ip4_fib_mtrie_lookup_step_one (mtrie0, addr0);
- leaf0 = ip4_fib_mtrie_lookup_step (mtrie0, leaf0, addr0, 2);
- leaf0 = ip4_fib_mtrie_lookup_step (mtrie0, leaf0, addr0, 3);
-
- src_adj_index0[0] = ip4_fib_mtrie_leaf_get_adj_index (leaf0);
-}
-
-always_inline void
-ip4_src_fib_lookup_two (u32 src_fib_index0,
- u32 src_fib_index1,
- const ip4_address_t * addr0,
- const ip4_address_t * addr1,
- u32 * src_adj_index0,
- u32 * src_adj_index1)
-{
- ip4_fib_mtrie_leaf_t leaf0, leaf1;
- ip4_fib_mtrie_t * mtrie0, * mtrie1;
-
- mtrie0 = &ip4_fib_get (src_fib_index0)->mtrie;
- mtrie1 = &ip4_fib_get (src_fib_index1)->mtrie;
-
- leaf0 = ip4_fib_mtrie_lookup_step_one (mtrie0, addr0);
- leaf1 = ip4_fib_mtrie_lookup_step_one (mtrie1, addr1);
-
- leaf0 = ip4_fib_mtrie_lookup_step (mtrie0, leaf0, addr0, 2);
- leaf1 = ip4_fib_mtrie_lookup_step (mtrie1, leaf1, addr1, 2);
-
- leaf0 = ip4_fib_mtrie_lookup_step (mtrie0, leaf0, addr0, 3);
- leaf1 = ip4_fib_mtrie_lookup_step (mtrie1, leaf1, addr1, 3);
-
- src_adj_index0[0] = ip4_fib_mtrie_leaf_get_adj_index (leaf0);
- src_adj_index1[0] = ip4_fib_mtrie_leaf_get_adj_index (leaf1);
-}
-
/**
* @brief Lookup trace data
*/
@@ -435,9 +391,8 @@ lookup_dpo_ip4_inline (vlib_main_t * vm,
}
/* do lookup */
- ip4_src_fib_lookup_two (fib_index0, fib_index1,
- input_addr0, input_addr1,
- &lbi0, &lbi1);
+ ip4_fib_forwarding_lookup_x2 (fib_index0, fib_index1, input_addr0,
+ input_addr1, &lbi0, &lbi1);
lb0 = load_balance_get(lbi0);
lb1 = load_balance_get(lbi1);
@@ -573,7 +528,7 @@ lookup_dpo_ip4_inline (vlib_main_t * vm,
}
/* do lookup */
- ip4_src_fib_lookup_one (fib_index0, input_addr, &lbi0);
+ lbi0 = ip4_fib_forwarding_lookup (fib_index0, input_addr);
lb0 = load_balance_get(lbi0);
vnet_buffer(b0)->sw_if_index[VLIB_TX] = fib_index0;