summaryrefslogtreecommitdiff
path: root/zebra/zebra_mpls.c
diff options
context:
space:
mode:
authorDonald Sharp <sharpd@nvidia.com>2021-04-26 09:34:41 -0400
committerDonald Sharp <sharpd@nvidia.com>2021-05-05 10:08:06 -0400
commit4a73887e0f6d5ab5ebb2018ed6f8a3cc49c0ee51 (patch)
tree2cfe46441a3da5b89986482f655a0091e9605274 /zebra/zebra_mpls.c
parentda55bcbcb384a023e6283b8b36c672d09a643485 (diff)
zebra: Reduce per vrf memory usage from hash table creation
When creating a large number of vrf's we are creating a fairly large number of hash tables per vrf. Reduce memory usage on startup as well as let us identify the table these things come from. Signed-off-by: Donald Sharp <sharpd@nvidia.com>
Diffstat (limited to 'zebra/zebra_mpls.c')
-rw-r--r--zebra/zebra_mpls.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/zebra/zebra_mpls.c b/zebra/zebra_mpls.c
index a923782bfe..5dcfe85f3d 100644
--- a/zebra/zebra_mpls.c
+++ b/zebra/zebra_mpls.c
@@ -3952,11 +3952,19 @@ void zebra_mpls_close_tables(struct zebra_vrf *zvrf)
*/
void zebra_mpls_init_tables(struct zebra_vrf *zvrf)
{
+ char buffer[80];
+
if (!zvrf)
return;
+
+ snprintf(buffer, sizeof(buffer), "ZEBRA SLSP table: %s",
+ zvrf->vrf->name);
zvrf->slsp_table =
- hash_create(label_hash, label_cmp, "ZEBRA SLSP table");
- zvrf->lsp_table = hash_create(label_hash, label_cmp, "ZEBRA LSP table");
+ hash_create_size(8, label_hash, label_cmp, buffer);
+
+ snprintf(buffer, sizeof(buffer), "ZEBRA LSP table: %s",
+ zvrf->vrf->name);
+ zvrf->lsp_table = hash_create_size(8, label_hash, label_cmp, buffer);
zvrf->fec_table[AFI_IP] = route_table_init();
zvrf->fec_table[AFI_IP6] = route_table_init();
zvrf->mpls_flags = 0;