summaryrefslogtreecommitdiffstats
path: root/src/vnet/fib/fib_node.c
diff options
context:
space:
mode:
authorNeale Ranns <nranns@cisco.com>2017-11-25 10:04:32 -0800
committerDamjan Marion <dmarion.lists@gmail.com>2017-11-26 19:16:30 +0000
commit630b9741659b9a4b68c64ebbeb675761c6f26842 (patch)
treea47618e43d9b0598b1be3f8804fd5a139034c782 /src/vnet/fib/fib_node.c
parent020df9a7a55ebf9e06db3f24982efe5fdd68ebb9 (diff)
FIB: store the node type not the function pointer.
Saves memory at no appreciable performance cost. before: DBGvpp# sh fib mem FIB memory Name Size in-use /allocated totals Entry 80 7 / 150 560/12000 after: DBGvpp# sh fib mem FIB memory Name Size in-use /allocated totals Entry 72 7 / 7 504/504 Change-Id: Ic5d3920ceb57b54260dc9af2078c26484335fef1 Signed-off-by: Neale Ranns <nranns@cisco.com>
Diffstat (limited to 'src/vnet/fib/fib_node.c')
-rw-r--r--src/vnet/fib/fib_node.c7
1 files changed, 2 insertions, 5 deletions
diff --git a/src/vnet/fib/fib_node.c b/src/vnet/fib/fib_node.c
index db3e22bb3b8..54c300aec1e 100644
--- a/src/vnet/fib/fib_node.c
+++ b/src/vnet/fib/fib_node.c
@@ -183,14 +183,11 @@ void
fib_node_init (fib_node_t *node,
fib_node_type_t type)
{
-#if CLIB_DEBUG > 0
/**
- * The node's type. make sure we are dynamic/down casting correctly
+ * The node's type. used to retrieve the VFT.
*/
node->fn_type = type;
-#endif
node->fn_locks = 0;
- node->fn_vft = &fn_vfts[type];
node->fn_children = FIB_NODE_INDEX_INVALID;
}
@@ -213,7 +210,7 @@ fib_node_unlock (fib_node_t *node)
if (0 == node->fn_locks)
{
- node->fn_vft->fnv_last_lock(node);
+ fn_vfts[node->fn_type].fnv_last_lock(node);
}
}