diff options
author | Donald Sharp <sharpd@nvidia.com> | 2023-04-19 14:13:18 +0200 |
---|---|---|
committer | Donald Sharp <sharpd@nvidia.com> | 2023-06-26 20:59:21 +0200 |
commit | 161972c9fe108ffe3de851a537d9b34efeb09e31 (patch) | |
tree | 6de17e2202d18969ee4aae4c85ecaccdc89c4f89 /bgpd/rfapi | |
parent | Merge pull request #13804 from LabNConsulting/aceelindem/ospf6d-config-callbacks (diff) | |
download | frr-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 'bgpd/rfapi')
-rw-r--r-- | bgpd/rfapi/vnc_zebra.c | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/bgpd/rfapi/vnc_zebra.c b/bgpd/rfapi/vnc_zebra.c index 4c55c2f63..9c971272e 100644 --- a/bgpd/rfapi/vnc_zebra.c +++ b/bgpd/rfapi/vnc_zebra.c @@ -560,9 +560,9 @@ static void vnc_zebra_add_del_prefix(struct bgp *bgp, return; } - if (!vrf_bitmap_check( - zclient_vnc->redist[family2afi(p->family)][ZEBRA_ROUTE_VNC], - VRF_DEFAULT)) + if (!vrf_bitmap_check(&zclient_vnc->redist[family2afi(p->family)] + [ZEBRA_ROUTE_VNC], + VRF_DEFAULT)) return; if (!bgp->rfapi_cfg) { @@ -622,7 +622,7 @@ static void vnc_zebra_add_del_nve(struct bgp *bgp, struct rfapi_descriptor *rfd, if (zclient_vnc->sock < 0) return; - if (!vrf_bitmap_check(zclient_vnc->redist[afi][ZEBRA_ROUTE_VNC], + if (!vrf_bitmap_check(&zclient_vnc->redist[afi][ZEBRA_ROUTE_VNC], VRF_DEFAULT)) return; @@ -819,12 +819,12 @@ int vnc_redistribute_set(struct bgp *bgp, afi_t afi, int type) // bgp->redist[afi][type] = 1; /* Return if already redistribute flag is set. */ - if (vrf_bitmap_check(zclient_vnc->redist[afi][type], VRF_DEFAULT)) + if (vrf_bitmap_check(&zclient_vnc->redist[afi][type], VRF_DEFAULT)) return CMD_WARNING_CONFIG_FAILED; - vrf_bitmap_set(zclient_vnc->redist[afi][type], VRF_DEFAULT); + vrf_bitmap_set(&zclient_vnc->redist[afi][type], VRF_DEFAULT); - // vrf_bitmap_set(zclient_vnc->redist[afi][type], VRF_DEFAULT); + // vrf_bitmap_set(&zclient_vnc->redist[afi][type], VRF_DEFAULT); /* Return if zebra connection is not established. */ if (zclient_vnc->sock < 0) @@ -855,9 +855,9 @@ int vnc_redistribute_unset(struct bgp *bgp, afi_t afi, int type) bgp->rfapi_cfg->redist[afi][type] = 0; /* Return if zebra connection is disabled. */ - if (!vrf_bitmap_check(zclient_vnc->redist[afi][type], VRF_DEFAULT)) + if (!vrf_bitmap_check(&zclient_vnc->redist[afi][type], VRF_DEFAULT)) return CMD_WARNING_CONFIG_FAILED; - vrf_bitmap_unset(zclient_vnc->redist[afi][type], VRF_DEFAULT); + vrf_bitmap_unset(&zclient_vnc->redist[afi][type], VRF_DEFAULT); if (bgp->rfapi_cfg->redist[AFI_IP][type] == 0 && bgp->rfapi_cfg->redist[AFI_IP6][type] == 0 |