MFIB: changes to improve route add/delete performance
Change-Id: I063d85200d12b09545ae1c373c7fc69112ae3b34
Signed-off-by: Neale Ranns <nranns@cisco.com>
diff --git a/src/vnet/mfib/ip6_mfib.c b/src/vnet/mfib/ip6_mfib.c
index 8f3dae8..991b91c 100644
--- a/src/vnet/mfib/ip6_mfib.c
+++ b/src/vnet/mfib/ip6_mfib.c
@@ -431,7 +431,7 @@
{
ip6_mfib_node_t *i6mn = clib_mem_alloc(sizeof(*i6mn));
- memset(i6mn, 0, sizeof(*i6mn));
+ memset(i6mn->i6mn_nodes, 0, sizeof(i6mn->i6mn_nodes));
IP6_MFIB_MK_KEY_MASK(grp, src, len, &i6mn->i6mn_key);
i6mn->i6mn_entry = mfib_entry_index;
diff --git a/src/vnet/mfib/mfib_entry.c b/src/vnet/mfib/mfib_entry.c
index 117ddc2..1aa8e08 100644
--- a/src/vnet/mfib/mfib_entry.c
+++ b/src/vnet/mfib/mfib_entry.c
@@ -406,14 +406,21 @@
mfib_entry_t *mfib_entry;
pool_get(mfib_entry_pool, mfib_entry);
- memset(mfib_entry, 0, sizeof(*mfib_entry));
fib_node_init(&mfib_entry->mfe_node,
FIB_NODE_TYPE_MFIB_ENTRY);
+ /*
+ * Some of the members require non-default initialisation
+ * so we also init those that don't and thus save on the call to memset.
+ */
+ mfib_entry->mfe_flags = 0;
mfib_entry->mfe_fib_index = fib_index;
mfib_entry->mfe_prefix = *prefix;
mfib_entry->mfe_parent = FIB_NODE_INDEX_INVALID;
+ mfib_entry->mfe_sibling = FIB_NODE_INDEX_INVALID;
+ mfib_entry->mfe_srcs = NULL;
+ mfib_entry->mfe_itfs = NULL;
dpo_reset(&mfib_entry->mfe_rep);