summaryrefslogtreecommitdiffstats
path: root/zebra
diff options
context:
space:
mode:
authorDonald Sharp <sharpd@nvidia.com>2021-04-26 15:34:41 +0200
committerDonald Sharp <sharpd@nvidia.com>2021-05-05 16:08:06 +0200
commit4a73887e0f6d5ab5ebb2018ed6f8a3cc49c0ee51 (patch)
tree2cfe46441a3da5b89986482f655a0091e9605274 /zebra
parentzebra: Reduce size of vni hash tables to a more reasonable start size (diff)
downloadfrr-4a73887e0f6d5ab5ebb2018ed6f8a3cc49c0ee51.tar.xz
frr-4a73887e0f6d5ab5ebb2018ed6f8a3cc49c0ee51.zip
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')
-rw-r--r--zebra/zebra_mpls.c12
-rw-r--r--zebra/zebra_vxlan.c17
2 files changed, 22 insertions, 7 deletions
diff --git a/zebra/zebra_mpls.c b/zebra/zebra_mpls.c
index a923782bf..5dcfe85f3 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;
diff --git a/zebra/zebra_vxlan.c b/zebra/zebra_vxlan.c
index 3ac7ee8f4..c816ba5a2 100644
--- a/zebra/zebra_vxlan.c
+++ b/zebra/zebra_vxlan.c
@@ -5752,13 +5752,20 @@ stream_failure:
*/
void zebra_vxlan_init_tables(struct zebra_vrf *zvrf)
{
+ char buffer[80];
+
if (!zvrf)
return;
- zvrf->evpn_table =
- hash_create(zebra_evpn_hash_keymake, zebra_evpn_hash_cmp,
- "Zebra VRF EVPN Table");
- zvrf->vxlan_sg_table = hash_create(zebra_vxlan_sg_hash_key_make,
- zebra_vxlan_sg_hash_eq, "Zebra VxLAN SG Table");
+
+ snprintf(buffer, sizeof(buffer), "Zebra VRF EVPN Table: %s",
+ zvrf->vrf->name);
+ zvrf->evpn_table = hash_create_size(8, zebra_evpn_hash_keymake,
+ zebra_evpn_hash_cmp, buffer);
+
+ snprintf(buffer, sizeof(buffer), "Zebra VxLAN SG Table: %s",
+ zvrf->vrf->name);
+ zvrf->vxlan_sg_table = hash_create_size(8, zebra_vxlan_sg_hash_key_make,
+ zebra_vxlan_sg_hash_eq, buffer);
}
/* Cleanup EVPN info, but don't free the table. */