summaryrefslogtreecommitdiffstats
path: root/src/vnet/mfib/ip6_mfib.c
diff options
context:
space:
mode:
authorNeale Ranns <nranns@cisco.com>2020-10-19 14:47:20 +0000
committerDamjan Marion <dmarion@me.com>2020-10-19 20:59:54 +0000
commit5a59b2bac48611a316adf128bdb0e1e2fe889656 (patch)
tree37e51dbf5d97fda9d9deee2d08e4b18a29981c5f /src/vnet/mfib/ip6_mfib.c
parent710d78074e07ffb5006ad01a0da4c1b6dc3de38b (diff)
ip: Move the IP6 fib into ip6_[m]fib.c
Type: improvement reduce the compile time by moving the bihash includes out of ip[46].h Signed-off-by: Neale Ranns <nranns@cisco.com> Change-Id: I6b9216e10aff1013071f9238b3e1ebbdd205bd80
Diffstat (limited to 'src/vnet/mfib/ip6_mfib.c')
-rw-r--r--src/vnet/mfib/ip6_mfib.c32
1 files changed, 25 insertions, 7 deletions
diff --git a/src/vnet/mfib/ip6_mfib.c b/src/vnet/mfib/ip6_mfib.c
index 6b3b8d90fbe..14c724b3bef 100644
--- a/src/vnet/mfib/ip6_mfib.c
+++ b/src/vnet/mfib/ip6_mfib.c
@@ -19,6 +19,8 @@
#include <vnet/mfib/mfib_entry.h>
#include <vnet/fib/ip6_fib.h>
+ip6_mfib_table_instance_t ip6_mfib_table;
+
/**
* Key and mask for radix
*/
@@ -333,7 +335,7 @@ ip6_mfib_table_lookup_exact_match (const ip6_mfib_t *mfib,
IP6_MFIB_MK_KEY(mfib, grp, src, len, key);
- rv = clib_bihash_search_inline_2_40_8(&ip6_main.ip6_mtable.ip6_mhash,
+ rv = clib_bihash_search_inline_2_40_8(&ip6_mfib_table.ip6_mhash,
&key, &value);
if (rv == 0)
return value.value;
@@ -356,7 +358,7 @@ ip6_mfib_table_fwd_lookup (const ip6_mfib_t *mfib,
int i, n, len;
int rv;
- table = &ip6_main.ip6_mtable;
+ table = &ip6_mfib_table;
n = vec_len (table->prefix_lengths_in_search_order);
for (i = 0; i < n; i++)
@@ -421,7 +423,7 @@ ip6_mfib_table_lookup (const ip6_mfib_t *mfib,
ip6_mfib_key_t key, value;
int i, n, rv;
- table = &ip6_main.ip6_mtable;
+ table = &ip6_mfib_table;
n = vec_len (table->prefix_lengths_in_search_order);
/*
@@ -471,7 +473,7 @@ ip6_mfib_table_entry_insert (ip6_mfib_t *mfib,
ip6_mfib_table_instance_t *table;
ip6_mfib_key_t key;
- table = &ip6_main.ip6_mtable;
+ table = &ip6_mfib_table;
IP6_MFIB_MK_KEY(mfib, grp, src, len, key);
key.value = mfib_entry_index;
@@ -497,7 +499,7 @@ ip6_mfib_table_entry_remove (ip6_mfib_t *mfib,
IP6_MFIB_MK_KEY(mfib, grp, src, len, key);
- table = &ip6_main.ip6_mtable;
+ table = &ip6_mfib_table;
clib_bihash_add_del_40_8(&table->ip6_mhash, &key, 0);
ASSERT (table->dst_address_length_refcounts[len] > 0);
@@ -523,7 +525,7 @@ format_ip6_mfib_table_memory (u8 * s, va_list * args)
{
u64 bytes_inuse;
- bytes_inuse = alloc_arena_next(&(ip6_main.ip6_mtable.ip6_mhash));
+ bytes_inuse = alloc_arena_next(&(ip6_mfib_table.ip6_mhash));
s = format(s, "%=30s %=6d %=12ld\n",
"IPv6 multicast",
@@ -634,7 +636,7 @@ ip6_mfib_table_walk (ip6_mfib_t *mfib,
};
clib_bihash_foreach_key_value_pair_40_8(
- &ip6_main.ip6_mtable.ip6_mhash,
+ &ip6_mfib_table.ip6_mhash,
ip6_mfib_walk_cb,
&ctx);
}
@@ -778,3 +780,19 @@ VLIB_CLI_COMMAND (ip6_show_fib_command, static) = {
.function = ip6_show_mfib,
};
/* *INDENT-ON* */
+
+static clib_error_t *
+ip6_mfib_init (vlib_main_t * vm)
+{
+ clib_bihash_init_40_8 (&ip6_mfib_table.ip6_mhash,
+ "ip6 mFIB table",
+ IP6_MFIB_DEFAULT_HASH_NUM_BUCKETS,
+ IP6_MFIB_DEFAULT_HASH_MEMORY_SIZE);
+
+ return (NULL);
+}
+
+VLIB_INIT_FUNCTION (ip6_mfib_init) =
+{
+ .runs_before = VLIB_INITS("ip6_lookup_init"),
+};