aboutsummaryrefslogtreecommitdiffstats
path: root/src/vnet/fib
diff options
context:
space:
mode:
authorNeale Ranns <neale@graphiant.com>2021-08-06 12:24:14 +0000
committerOle Tr�an <otroan@employees.org>2021-08-11 08:48:42 +0000
commit6bb2db0ea860812d9c366935312e7849deca9c93 (patch)
treef70bdd3e4ce59419aa6583f3ee879dbaa029f56d /src/vnet/fib
parenta8c720e301f3576506b2b284fe925b055398b638 (diff)
ip: Rename the ip4 mtrie function to be 16_8_8 specific
Type: improvement the existing mtrie functions use the existing 16_8_8 mtrie. Rename them to make that explicit. Then we can add the 8_8_8_8 types and functions alongside. Signed-off-by: Neale Ranns <neale@graphiant.com> Change-Id: If5ce7a282d5d3742dc65bcd0523220235d9c510d
Diffstat (limited to 'src/vnet/fib')
-rw-r--r--src/vnet/fib/ip4_fib.c12
-rw-r--r--src/vnet/fib/ip4_fib.h76
2 files changed, 44 insertions, 44 deletions
diff --git a/src/vnet/fib/ip4_fib.c b/src/vnet/fib/ip4_fib.c
index a3010149a4d..e8ab653e53a 100644
--- a/src/vnet/fib/ip4_fib.c
+++ b/src/vnet/fib/ip4_fib.c
@@ -129,7 +129,7 @@ ip4_create_fib_with_table_id (u32 table_id,
fib_table_lock(fib_table->ft_index, FIB_PROTOCOL_IP4, src);
- ip4_mtrie_init(&v4_fib->mtrie);
+ ip4_mtrie_16_init(&v4_fib->mtrie);
/*
* add the special entries into the new FIB
@@ -195,7 +195,7 @@ ip4_fib_table_destroy (u32 fib_index)
}
vec_free(fib_table->ft_src_route_counts);
- ip4_mtrie_free(&v4_fib->mtrie);
+ ip4_mtrie_16_free(&v4_fib->mtrie);
pool_put(ip4_main.v4_fibs, v4_fib);
pool_put(ip4_main.fibs, fib_table);
@@ -377,7 +377,7 @@ ip4_fib_table_fwding_dpo_update (ip4_fib_t *fib,
u32 len,
const dpo_id_t *dpo)
{
- ip4_fib_mtrie_route_add(&fib->mtrie, addr, len, dpo->dpoi_index);
+ ip4_mtrie_16_route_add(&fib->mtrie, addr, len, dpo->dpoi_index);
}
void
@@ -398,7 +398,7 @@ ip4_fib_table_fwding_dpo_remove (ip4_fib_t *fib,
cover_prefix = fib_entry_get_prefix(cover_index);
cover_dpo = fib_entry_contribute_ip_forwarding(cover_index);
- ip4_fib_mtrie_route_del(&fib->mtrie,
+ ip4_mtrie_16_route_del(&fib->mtrie,
addr, len, dpo->dpoi_index,
cover_prefix->fp_len,
cover_dpo->dpoi_index);
@@ -632,7 +632,7 @@ ip4_show_fib (vlib_main_t * vm,
uword mtrie_size, hash_size;
- mtrie_size = ip4_fib_mtrie_memory_usage(&fib->mtrie);
+ mtrie_size = ip4_mtrie_16_memory_usage(&fib->mtrie);
hash_size = 0;
for (i = 0; i < ARRAY_LEN (fib->fib_entry_by_dst_address); i++)
@@ -679,7 +679,7 @@ ip4_show_fib (vlib_main_t * vm,
/* Show summary? */
if (mtrie)
{
- vlib_cli_output (vm, "%U", format_ip4_fib_mtrie, &fib->mtrie, verbose);
+ vlib_cli_output (vm, "%U", format_ip4_mtrie_16, &fib->mtrie, verbose);
continue;
}
if (! verbose)
diff --git a/src/vnet/fib/ip4_fib.h b/src/vnet/fib/ip4_fib.h
index dc41eb8163f..1f0c168eff3 100644
--- a/src/vnet/fib/ip4_fib.h
+++ b/src/vnet/fib/ip4_fib.h
@@ -45,7 +45,7 @@ typedef struct ip4_fib_t_
* Mtrie for fast lookups. Hash is used to maintain overlapping prefixes.
* First member so it's in the first cacheline.
*/
- ip4_fib_mtrie_t mtrie;
+ ip4_mtrie_16_t mtrie;
/* Hash table for each prefix length mapping. */
uword *fib_entry_by_dst_address[33];
@@ -160,16 +160,16 @@ always_inline index_t
ip4_fib_forwarding_lookup (u32 fib_index,
const ip4_address_t * addr)
{
- ip4_fib_mtrie_leaf_t leaf;
- ip4_fib_mtrie_t * mtrie;
+ ip4_mtrie_leaf_t leaf;
+ ip4_mtrie_16_t * mtrie;
mtrie = &ip4_fib_get(fib_index)->mtrie;
- leaf = ip4_fib_mtrie_lookup_step_one (mtrie, addr);
- leaf = ip4_fib_mtrie_lookup_step (mtrie, leaf, addr, 2);
- leaf = ip4_fib_mtrie_lookup_step (mtrie, leaf, addr, 3);
+ leaf = ip4_mtrie_16_lookup_step_one (mtrie, addr);
+ leaf = ip4_mtrie_16_lookup_step (mtrie, leaf, addr, 2);
+ leaf = ip4_mtrie_16_lookup_step (mtrie, leaf, addr, 3);
- return (ip4_fib_mtrie_leaf_get_adj_index(leaf));
+ return (ip4_mtrie_leaf_get_adj_index(leaf));
}
static_always_inline void
@@ -180,21 +180,21 @@ ip4_fib_forwarding_lookup_x2 (u32 fib_index0,
index_t *lb0,
index_t *lb1)
{
- ip4_fib_mtrie_leaf_t leaf[2];
- ip4_fib_mtrie_t * mtrie[2];
+ ip4_mtrie_leaf_t leaf[2];
+ ip4_mtrie_16_t * mtrie[2];
mtrie[0] = &ip4_fib_get(fib_index0)->mtrie;
mtrie[1] = &ip4_fib_get(fib_index1)->mtrie;
- leaf[0] = ip4_fib_mtrie_lookup_step_one (mtrie[0], addr0);
- leaf[1] = ip4_fib_mtrie_lookup_step_one (mtrie[1], addr1);
- leaf[0] = ip4_fib_mtrie_lookup_step (mtrie[0], leaf[0], addr0, 2);
- leaf[1] = ip4_fib_mtrie_lookup_step (mtrie[1], leaf[1], addr1, 2);
- leaf[0] = ip4_fib_mtrie_lookup_step (mtrie[0], leaf[0], addr0, 3);
- leaf[1] = ip4_fib_mtrie_lookup_step (mtrie[1], leaf[1], addr1, 3);
+ leaf[0] = ip4_mtrie_16_lookup_step_one (mtrie[0], addr0);
+ leaf[1] = ip4_mtrie_16_lookup_step_one (mtrie[1], addr1);
+ leaf[0] = ip4_mtrie_16_lookup_step (mtrie[0], leaf[0], addr0, 2);
+ leaf[1] = ip4_mtrie_16_lookup_step (mtrie[1], leaf[1], addr1, 2);
+ leaf[0] = ip4_mtrie_16_lookup_step (mtrie[0], leaf[0], addr0, 3);
+ leaf[1] = ip4_mtrie_16_lookup_step (mtrie[1], leaf[1], addr1, 3);
- *lb0 = ip4_fib_mtrie_leaf_get_adj_index(leaf[0]);
- *lb1 = ip4_fib_mtrie_leaf_get_adj_index(leaf[1]);
+ *lb0 = ip4_mtrie_leaf_get_adj_index(leaf[0]);
+ *lb1 = ip4_mtrie_leaf_get_adj_index(leaf[1]);
}
static_always_inline void
@@ -211,33 +211,33 @@ ip4_fib_forwarding_lookup_x4 (u32 fib_index0,
index_t *lb2,
index_t *lb3)
{
- ip4_fib_mtrie_leaf_t leaf[4];
- ip4_fib_mtrie_t * mtrie[4];
+ ip4_mtrie_leaf_t leaf[4];
+ ip4_mtrie_16_t * mtrie[4];
mtrie[0] = &ip4_fib_get(fib_index0)->mtrie;
mtrie[1] = &ip4_fib_get(fib_index1)->mtrie;
mtrie[2] = &ip4_fib_get(fib_index2)->mtrie;
mtrie[3] = &ip4_fib_get(fib_index3)->mtrie;
- leaf[0] = ip4_fib_mtrie_lookup_step_one (mtrie[0], addr0);
- leaf[1] = ip4_fib_mtrie_lookup_step_one (mtrie[1], addr1);
- leaf[2] = ip4_fib_mtrie_lookup_step_one (mtrie[2], addr2);
- leaf[3] = ip4_fib_mtrie_lookup_step_one (mtrie[3], addr3);
-
- leaf[0] = ip4_fib_mtrie_lookup_step (mtrie[0], leaf[0], addr0, 2);
- leaf[1] = ip4_fib_mtrie_lookup_step (mtrie[1], leaf[1], addr1, 2);
- leaf[2] = ip4_fib_mtrie_lookup_step (mtrie[2], leaf[2], addr2, 2);
- leaf[3] = ip4_fib_mtrie_lookup_step (mtrie[3], leaf[3], addr3, 2);
-
- leaf[0] = ip4_fib_mtrie_lookup_step (mtrie[0], leaf[0], addr0, 3);
- leaf[1] = ip4_fib_mtrie_lookup_step (mtrie[1], leaf[1], addr1, 3);
- leaf[2] = ip4_fib_mtrie_lookup_step (mtrie[2], leaf[2], addr2, 3);
- leaf[3] = ip4_fib_mtrie_lookup_step (mtrie[3], leaf[3], addr3, 3);
-
- *lb0 = ip4_fib_mtrie_leaf_get_adj_index(leaf[0]);
- *lb1 = ip4_fib_mtrie_leaf_get_adj_index(leaf[1]);
- *lb2 = ip4_fib_mtrie_leaf_get_adj_index(leaf[2]);
- *lb3 = ip4_fib_mtrie_leaf_get_adj_index(leaf[3]);
+ leaf[0] = ip4_mtrie_16_lookup_step_one (mtrie[0], addr0);
+ leaf[1] = ip4_mtrie_16_lookup_step_one (mtrie[1], addr1);
+ leaf[2] = ip4_mtrie_16_lookup_step_one (mtrie[2], addr2);
+ leaf[3] = ip4_mtrie_16_lookup_step_one (mtrie[3], addr3);
+
+ leaf[0] = ip4_mtrie_16_lookup_step (mtrie[0], leaf[0], addr0, 2);
+ leaf[1] = ip4_mtrie_16_lookup_step (mtrie[1], leaf[1], addr1, 2);
+ leaf[2] = ip4_mtrie_16_lookup_step (mtrie[2], leaf[2], addr2, 2);
+ leaf[3] = ip4_mtrie_16_lookup_step (mtrie[3], leaf[3], addr3, 2);
+
+ leaf[0] = ip4_mtrie_16_lookup_step (mtrie[0], leaf[0], addr0, 3);
+ leaf[1] = ip4_mtrie_16_lookup_step (mtrie[1], leaf[1], addr1, 3);
+ leaf[2] = ip4_mtrie_16_lookup_step (mtrie[2], leaf[2], addr2, 3);
+ leaf[3] = ip4_mtrie_16_lookup_step (mtrie[3], leaf[3], addr3, 3);
+
+ *lb0 = ip4_mtrie_leaf_get_adj_index(leaf[0]);
+ *lb1 = ip4_mtrie_leaf_get_adj_index(leaf[1]);
+ *lb2 = ip4_mtrie_leaf_get_adj_index(leaf[2]);
+ *lb3 = ip4_mtrie_leaf_get_adj_index(leaf[3]);
}
#endif