summaryrefslogtreecommitdiff
path: root/zebra/redistribute.c
diff options
context:
space:
mode:
authorDonald Sharp <sharpd@nvidia.com>2023-04-19 08:13:18 -0400
committerDonald Sharp <sharpd@nvidia.com>2023-06-26 14:59:21 -0400
commit161972c9fe108ffe3de851a537d9b34efeb09e31 (patch)
tree6de17e2202d18969ee4aae4c85ecaccdc89c4f89 /zebra/redistribute.c
parentdee79c33a425d264e53e0e5d0ad51b1bc13945d0 (diff)
*: Rearrange vrf_bitmap_X api to reduce memory footprint
When running all daemons with config for most of them, FRR has sharpd@janelle:~/frr$ vtysh -c "show debug hashtable" | grep "VRF BIT HASH" | wc -l 3570 3570 hashes for bitmaps associated with the vrf. This is a very large number of hashes. Let's do two things: a) Reduce the created size of the actually created hashes to 2 instead of 32. b) Delay generation of the hash *until* a set operation happens. As that no hash directly implies a unset value if/when checked. This reduces the number of hashes to 61 in my setup for normal operation. Signed-off-by: Donald Sharp <sharpd@nvidia.com>
Diffstat (limited to 'zebra/redistribute.c')
-rw-r--r--zebra/redistribute.c18
1 files changed, 9 insertions, 9 deletions
diff --git a/zebra/redistribute.c b/zebra/redistribute.c
index 6767000f3b..47ecbc0b44 100644
--- a/zebra/redistribute.c
+++ b/zebra/redistribute.c
@@ -60,7 +60,7 @@ static void zebra_redistribute_default(struct zserv *client, vrf_id_t vrf_id)
for (afi = AFI_IP; afi <= AFI_IP6; afi++) {
- if (!vrf_bitmap_check(client->redist_default[afi], vrf_id))
+ if (!vrf_bitmap_check(&client->redist_default[afi], vrf_id))
continue;
/* Lookup table. */
@@ -151,11 +151,11 @@ static bool zebra_redistribute_check(const struct route_node *rn,
/* If default route and redistributed */
if (is_default_prefix(&rn->p) &&
- vrf_bitmap_check(client->redist_default[afi], re->vrf_id))
+ vrf_bitmap_check(&client->redist_default[afi], re->vrf_id))
return true;
/* If redistribute in enabled for zebra route all */
- if (vrf_bitmap_check(client->redist[afi][ZEBRA_ROUTE_ALL], re->vrf_id))
+ if (vrf_bitmap_check(&client->redist[afi][ZEBRA_ROUTE_ALL], re->vrf_id))
return true;
/*
@@ -171,7 +171,7 @@ static bool zebra_redistribute_check(const struct route_node *rn,
}
/* If redistribution is enabled for give route type. */
- if (vrf_bitmap_check(client->redist[afi][re->type], re->vrf_id))
+ if (vrf_bitmap_check(&client->redist[afi][re->type], re->vrf_id))
return true;
return false;
@@ -331,14 +331,14 @@ void zebra_redistribute_add(ZAPI_HANDLER_ARGS)
zvrf_id(zvrf), afi);
}
} else {
- if (!vrf_bitmap_check(client->redist[afi][type],
+ if (!vrf_bitmap_check(&client->redist[afi][type],
zvrf_id(zvrf))) {
if (IS_ZEBRA_DEBUG_EVENT)
zlog_debug(
"%s: setting vrf %s(%u) redist bitmap",
__func__, VRF_LOGNAME(zvrf->vrf),
zvrf_id(zvrf));
- vrf_bitmap_set(client->redist[afi][type],
+ vrf_bitmap_set(&client->redist[afi][type],
zvrf_id(zvrf));
zebra_redistribute(client, type, 0, zvrf_id(zvrf), afi);
}
@@ -387,7 +387,7 @@ void zebra_redistribute_delete(ZAPI_HANDLER_ARGS)
if (instance)
redist_del_instance(&client->mi_redist[afi][type], instance);
else
- vrf_bitmap_unset(client->redist[afi][type], zvrf_id(zvrf));
+ vrf_bitmap_unset(&client->redist[afi][type], zvrf_id(zvrf));
stream_failure:
return;
@@ -405,7 +405,7 @@ void zebra_redistribute_default_add(ZAPI_HANDLER_ARGS)
return;
}
- vrf_bitmap_set(client->redist_default[afi], zvrf_id(zvrf));
+ vrf_bitmap_set(&client->redist_default[afi], zvrf_id(zvrf));
zebra_redistribute_default(client, zvrf_id(zvrf));
stream_failure:
@@ -424,7 +424,7 @@ void zebra_redistribute_default_delete(ZAPI_HANDLER_ARGS)
return;
}
- vrf_bitmap_unset(client->redist_default[afi], zvrf_id(zvrf));
+ vrf_bitmap_unset(&client->redist_default[afi], zvrf_id(zvrf));
stream_failure:
return;