summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorNeale Ranns <nranns@cisco.com>2017-02-24 08:29:22 -0800
committerDamjan Marion <dmarion.lists@gmail.com>2017-02-25 19:21:48 +0000
commit5a72c1c151f843a962cc1247213c063233e8b119 (patch)
tree57dbe378f56efbf559e8a036cd445a167c1b92f6 /src
parentb5b2ef594726c4e9b0e14457b4d2019de53372e3 (diff)
MFIB: changes to improve route add/delete performance
Change-Id: I063d85200d12b09545ae1c373c7fc69112ae3b34 Signed-off-by: Neale Ranns <nranns@cisco.com>
Diffstat (limited to 'src')
-rw-r--r--src/vnet/fib/fib_path_list.c8
-rw-r--r--src/vnet/mfib/ip6_mfib.c2
-rw-r--r--src/vnet/mfib/mfib_entry.c9
3 files changed, 12 insertions, 7 deletions
diff --git a/src/vnet/fib/fib_path_list.c b/src/vnet/fib/fib_path_list.c
index ce11cf452cb..b9a391b33f5 100644
--- a/src/vnet/fib/fib_path_list.c
+++ b/src/vnet/fib/fib_path_list.c
@@ -538,7 +538,7 @@ static const fib_node_vft_t fib_path_list_vft = {
.fnv_mem_show = fib_path_list_memory_show,
};
-static fib_path_list_t *
+static inline fib_path_list_t *
fib_path_list_alloc (fib_node_index_t *path_list_index)
{
fib_path_list_t *path_list;
@@ -549,11 +549,9 @@ fib_path_list_alloc (fib_node_index_t *path_list_index)
fib_node_init(&path_list->fpl_node,
FIB_NODE_TYPE_PATH_LIST);
path_list->fpl_urpf = INDEX_INVALID;
+ path_list->fpl_paths = NULL;
- if (NULL != path_list_index)
- {
- *path_list_index = fib_path_list_get_index(path_list);
- }
+ *path_list_index = fib_path_list_get_index(path_list);
FIB_PATH_LIST_DBG(path_list, "alloc");
diff --git a/src/vnet/mfib/ip6_mfib.c b/src/vnet/mfib/ip6_mfib.c
index 8f3dae8d7b5..991b91c6498 100644
--- a/src/vnet/mfib/ip6_mfib.c
+++ b/src/vnet/mfib/ip6_mfib.c
@@ -431,7 +431,7 @@ ip6_mfib_table_entry_insert (ip6_mfib_t *mfib,
{
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 117ddc2fdfd..1aa8e0864ca 100644
--- a/src/vnet/mfib/mfib_entry.c
+++ b/src/vnet/mfib/mfib_entry.c
@@ -406,14 +406,21 @@ mfib_entry_alloc (u32 fib_index,
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);