summaryrefslogtreecommitdiff
path: root/ospf6d/ospf6_zebra.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 /ospf6d/ospf6_zebra.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 'ospf6d/ospf6_zebra.c')
-rw-r--r--ospf6d/ospf6_zebra.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/ospf6d/ospf6_zebra.c b/ospf6d/ospf6_zebra.c
index 0f631c4d01..8bd0d8f0b5 100644
--- a/ospf6d/ospf6_zebra.c
+++ b/ospf6d/ospf6_zebra.c
@@ -97,9 +97,9 @@ static int ospf6_router_id_update_zebra(ZAPI_CALLBACK_ARGS)
/* redistribute function */
void ospf6_zebra_redistribute(int type, vrf_id_t vrf_id)
{
- if (vrf_bitmap_check(zclient->redist[AFI_IP6][type], vrf_id))
+ if (vrf_bitmap_check(&zclient->redist[AFI_IP6][type], vrf_id))
return;
- vrf_bitmap_set(zclient->redist[AFI_IP6][type], vrf_id);
+ vrf_bitmap_set(&zclient->redist[AFI_IP6][type], vrf_id);
if (zclient->sock > 0)
zebra_redistribute_send(ZEBRA_REDISTRIBUTE_ADD, zclient,
@@ -108,9 +108,9 @@ void ospf6_zebra_redistribute(int type, vrf_id_t vrf_id)
void ospf6_zebra_no_redistribute(int type, vrf_id_t vrf_id)
{
- if (!vrf_bitmap_check(zclient->redist[AFI_IP6][type], vrf_id))
+ if (!vrf_bitmap_check(&zclient->redist[AFI_IP6][type], vrf_id))
return;
- vrf_bitmap_unset(zclient->redist[AFI_IP6][type], vrf_id);
+ vrf_bitmap_unset(&zclient->redist[AFI_IP6][type], vrf_id);
if (zclient->sock > 0)
zebra_redistribute_send(ZEBRA_REDISTRIBUTE_DELETE, zclient,
AFI_IP6, type, 0, vrf_id);
@@ -333,10 +333,10 @@ DEFUN(show_zebra,
json_object_int_add(json_zebra, "fail", zclient->fail);
json_object_int_add(
json_zebra, "redistributeDefault",
- vrf_bitmap_check(zclient->default_information[AFI_IP6],
+ vrf_bitmap_check(&zclient->default_information[AFI_IP6],
VRF_DEFAULT));
for (i = 0; i < ZEBRA_ROUTE_MAX; i++) {
- if (vrf_bitmap_check(zclient->redist[AFI_IP6][i],
+ if (vrf_bitmap_check(&zclient->redist[AFI_IP6][i],
VRF_DEFAULT))
json_object_array_add(
json_array,
@@ -351,11 +351,11 @@ DEFUN(show_zebra,
vty_out(vty, "Zebra Information\n");
vty_out(vty, " fail: %d\n", zclient->fail);
vty_out(vty, " redistribute default: %d\n",
- vrf_bitmap_check(zclient->default_information[AFI_IP6],
+ vrf_bitmap_check(&zclient->default_information[AFI_IP6],
VRF_DEFAULT));
vty_out(vty, " redistribute:");
for (i = 0; i < ZEBRA_ROUTE_MAX; i++) {
- if (vrf_bitmap_check(zclient->redist[AFI_IP6][i],
+ if (vrf_bitmap_check(&zclient->redist[AFI_IP6][i],
VRF_DEFAULT))
vty_out(vty, " %s", zebra_route_string(i));
}