summaryrefslogtreecommitdiff
path: root/lib/table.h
diff options
context:
space:
mode:
authorDonald Sharp <sharpd@cumulusnetworks.com>2019-04-30 20:23:52 -0400
committerDonald Sharp <sharpd@cumulusnetworks.com>2019-05-02 16:21:38 -0400
commit66355cf9eb378868a2357bb807700c607537309d (patch)
treea3e9558fdbe42484e4e8cc4786b23274ababcd1b /lib/table.h
parent62b4b3b68dc1991e31514167a180cf752d24dc5c (diff)
lib: Convert table code to use new hash type
This converts the new table code to use the new hash type provided by David. The following test is 1 million routes installed and how much memory we are using: Old mem usage: Memory statistics for zebra: System allocator statistics: Total heap allocated: 574 MiB Holding block headers: 0 bytes Used small blocks: 0 bytes Used ordinary blocks: 536 MiB Free small blocks: 33 MiB Free ordinary blocks: 4600 KiB Ordinary blocks: 0 Small blocks: 0 Holding blocks: 0 New Memory usage: Memory statistics for zebra: System allocator statistics: Total heap allocated: 542 MiB Holding block headers: 0 bytes Used small blocks: 0 bytes Used ordinary blocks: 506 MiB Free small blocks: 3374 KiB Free ordinary blocks: 33 MiB Ordinary blocks: 0 Small blocks: 0 Holding blocks: 0 Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
Diffstat (limited to 'lib/table.h')
-rw-r--r--lib/table.h6
1 files changed, 5 insertions, 1 deletions
diff --git a/lib/table.h b/lib/table.h
index ce578e795c..3e3fb658ae 100644
--- a/lib/table.h
+++ b/lib/table.h
@@ -25,6 +25,7 @@
#include "memory.h"
#include "hash.h"
#include "prefix.h"
+#include "typesafe.h"
#ifdef __cplusplus
extern "C" {
@@ -59,10 +60,12 @@ struct route_table_delegate_t_ {
route_table_destroy_node_func_t destroy_node;
};
+PREDECL_HASH(rn_hash_node)
+
/* Routing table top structure. */
struct route_table {
struct route_node *top;
- struct hash *hash;
+ struct rn_hash_node_head hash;
/*
* Delegate that performs certain functions for this table.
@@ -129,6 +132,7 @@ struct route_table {
/* Lock of this radix */ \
unsigned int table_rdonly(lock); \
\
+ struct rn_hash_node_item nodehash; \
/* Each node of route. */ \
void *info; \