summaryrefslogtreecommitdiffstats
path: root/zebra/zapi_msg.c
diff options
context:
space:
mode:
authorDonald Sharp <sharpd@nvidia.com>2023-04-19 14:13:18 +0200
committerDonald Sharp <sharpd@nvidia.com>2023-06-26 20:59:21 +0200
commit161972c9fe108ffe3de851a537d9b34efeb09e31 (patch)
tree6de17e2202d18969ee4aae4c85ecaccdc89c4f89 /zebra/zapi_msg.c
parentMerge pull request #13804 from LabNConsulting/aceelindem/ospf6d-config-callbacks (diff)
downloadfrr-161972c9fe108ffe3de851a537d9b34efeb09e31.tar.xz
frr-161972c9fe108ffe3de851a537d9b34efeb09e31.zip
*: 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/zapi_msg.c')
-rw-r--r--zebra/zapi_msg.c21
1 files changed, 11 insertions, 10 deletions
diff --git a/zebra/zapi_msg.c b/zebra/zapi_msg.c
index b91e2ec74..5ac875405 100644
--- a/zebra/zapi_msg.c
+++ b/zebra/zapi_msg.c
@@ -995,7 +995,7 @@ void zsend_nhrp_neighbor_notify(int cmd, struct interface *ifp,
family2addrsize(sockunion_family(&ip)));
for (ALL_LIST_ELEMENTS(zrouter.client_list, node, nnode, client)) {
- if (!vrf_bitmap_check(client->nhrp_neighinfo[afi],
+ if (!vrf_bitmap_check(&client->nhrp_neighinfo[afi],
ifp->vrf->vrf_id))
continue;
@@ -1016,7 +1016,7 @@ int zsend_router_id_update(struct zserv *client, afi_t afi, struct prefix *p,
struct stream *s;
/* Check this client need interface information. */
- if (!vrf_bitmap_check(client->ridinfo[afi], vrf_id))
+ if (!vrf_bitmap_check(&client->ridinfo[afi], vrf_id))
return 0;
s = stream_new(ZEBRA_MAX_PACKET_SIZ);
@@ -2281,7 +2281,7 @@ static void zread_router_id_add(ZAPI_HANDLER_ARGS)
}
/* Router-id information is needed. */
- vrf_bitmap_set(client->ridinfo[afi], zvrf_id(zvrf));
+ vrf_bitmap_set(&client->ridinfo[afi], zvrf_id(zvrf));
router_id_get(afi, &p, zvrf);
@@ -2317,7 +2317,7 @@ static void zread_router_id_delete(ZAPI_HANDLER_ARGS)
goto stream_failure;
}
- vrf_bitmap_unset(client->ridinfo[afi], zvrf_id(zvrf));
+ vrf_bitmap_unset(&client->ridinfo[afi], zvrf_id(zvrf));
stream_failure:
return;
@@ -2407,10 +2407,11 @@ static void zread_vrf_unregister(ZAPI_HANDLER_ARGS)
for (afi = AFI_IP; afi < AFI_MAX; afi++) {
for (i = 0; i < ZEBRA_ROUTE_MAX; i++)
- vrf_bitmap_unset(client->redist[afi][i], zvrf_id(zvrf));
- vrf_bitmap_unset(client->redist_default[afi], zvrf_id(zvrf));
- vrf_bitmap_unset(client->ridinfo[afi], zvrf_id(zvrf));
- vrf_bitmap_unset(client->nhrp_neighinfo[afi], zvrf_id(zvrf));
+ vrf_bitmap_unset(&client->redist[afi][i],
+ zvrf_id(zvrf));
+ vrf_bitmap_unset(&client->redist_default[afi], zvrf_id(zvrf));
+ vrf_bitmap_unset(&client->ridinfo[afi], zvrf_id(zvrf));
+ vrf_bitmap_unset(&client->nhrp_neighinfo[afi], zvrf_id(zvrf));
}
}
@@ -3563,7 +3564,7 @@ static inline void zebra_neigh_register(ZAPI_HANDLER_ARGS)
afi);
goto stream_failure;
}
- vrf_bitmap_set(client->nhrp_neighinfo[afi], zvrf_id(zvrf));
+ vrf_bitmap_set(&client->nhrp_neighinfo[afi], zvrf_id(zvrf));
stream_failure:
return;
}
@@ -3579,7 +3580,7 @@ static inline void zebra_neigh_unregister(ZAPI_HANDLER_ARGS)
afi);
goto stream_failure;
}
- vrf_bitmap_unset(client->nhrp_neighinfo[afi], zvrf_id(zvrf));
+ vrf_bitmap_unset(&client->nhrp_neighinfo[afi], zvrf_id(zvrf));
stream_failure:
return;
}