From 9fb302f41d836328ad56588036eaf43fe84e2ddf Mon Sep 17 00:00:00 2001 From: Donald Sharp Date: Tue, 25 Jul 2017 09:45:03 -0400 Subject: [PATCH] pimd: Setup hash names appropriately Signed-off-by: Donald Sharp --- pimd/pim_iface.c | 6 +++++- pimd/pim_igmp.c | 7 +++++-- pimd/pim_instance.c | 6 ++++-- pimd/pim_msdp.c | 7 +++++-- pimd/pim_nht.c | 7 ++++++- pimd/pim_oil.c | 9 +++++++-- pimd/pim_upstream.c | 7 ++++++- 7 files changed, 38 insertions(+), 11 deletions(-) diff --git a/pimd/pim_iface.c b/pimd/pim_iface.c index 3cf8f678ca..7f623c429c 100644 --- a/pimd/pim_iface.c +++ b/pimd/pim_iface.c @@ -100,6 +100,7 @@ static void *if_list_clean(struct pim_interface *pim_ifp) struct pim_interface *pim_if_new(struct interface *ifp, int igmp, int pim) { struct pim_interface *pim_ifp; + char hash_name[64]; zassert(ifp); zassert(!ifp->info); @@ -182,8 +183,11 @@ struct pim_interface *pim_if_new(struct interface *ifp, int igmp, int pim) pim_ifp->pim_ifchannel_list->cmp = (int (*)(void *, void *))pim_ifchannel_compare; + snprintf(hash_name, 64, "Pim Interface %s hash", + ifp->name); pim_ifp->pim_ifchannel_hash = - hash_create(pim_ifchannel_hash_key, pim_ifchannel_equal, NULL); + hash_create(pim_ifchannel_hash_key, pim_ifchannel_equal, + hash_name); ifp->info = pim_ifp; diff --git a/pimd/pim_igmp.c b/pimd/pim_igmp.c index c693f30ac2..ea8eff4d59 100644 --- a/pimd/pim_igmp.c +++ b/pimd/pim_igmp.c @@ -812,6 +812,7 @@ static struct igmp_sock *igmp_sock_new(int fd, struct in_addr ifaddr, { struct pim_interface *pim_ifp; struct igmp_sock *igmp; + char hash_name[64]; pim_ifp = ifp->info; @@ -836,8 +837,10 @@ static struct igmp_sock *igmp_sock_new(int fd, struct in_addr ifaddr, } igmp->igmp_group_list->del = (void (*)(void *))igmp_group_free; - igmp->igmp_group_hash = - hash_create(igmp_group_hash_key, igmp_group_hash_equal, NULL); + snprintf(hash_name, 64, "IGMP %s hash", ifp->name); + igmp->igmp_group_hash = hash_create(igmp_group_hash_key, + igmp_group_hash_equal, + hash_name); igmp->fd = fd; igmp->interface = ifp; diff --git a/pimd/pim_instance.c b/pimd/pim_instance.c index 883720942e..fc25f352b9 100644 --- a/pimd/pim_instance.c +++ b/pimd/pim_instance.c @@ -66,6 +66,7 @@ static void pim_instance_terminate(struct pim_instance *pim) static struct pim_instance *pim_instance_init(struct vrf *vrf) { struct pim_instance *pim; + char hash_name[64]; pim = XCALLOC(MTYPE_PIM_PIM_INSTANCE, sizeof(struct pim_instance)); if (!pim) @@ -81,8 +82,9 @@ static struct pim_instance *pim_instance_init(struct vrf *vrf) pim_msdp_init(pim, master); - pim->rpf_hash = - hash_create_size(256, pim_rpf_hash_key, pim_rpf_equal, NULL); + snprintf(hash_name, 64, "PIM %s RPF Hash", vrf->name); + pim->rpf_hash = hash_create_size(256, pim_rpf_hash_key, + pim_rpf_equal, hash_name); if (PIM_DEBUG_ZEBRA) zlog_debug("%s: NHT rpf hash init ", __PRETTY_FUNCTION__); diff --git a/pimd/pim_msdp.c b/pimd/pim_msdp.c index 57f54102a9..c0f74945fd 100644 --- a/pimd/pim_msdp.c +++ b/pimd/pim_msdp.c @@ -1591,15 +1591,18 @@ static void pim_msdp_enable(struct pim_instance *pim) void pim_msdp_init(struct pim_instance *pim, struct thread_master *master) { pim->msdp.master = master; + char hash_name[64]; + snprintf(hash_name, 64, "PIM %s MSDP Peer Hash", pim->vrf->name); pim->msdp.peer_hash = hash_create(pim_msdp_peer_hash_key_make, - pim_msdp_peer_hash_eq, NULL); + pim_msdp_peer_hash_eq, hash_name); pim->msdp.peer_list = list_new(); pim->msdp.peer_list->del = (void (*)(void *))pim_msdp_peer_free; pim->msdp.peer_list->cmp = (int (*)(void *, void *))pim_msdp_peer_comp; + snprintf(hash_name, 64, "PIM %s MSDP SA Hash", pim->vrf->name); pim->msdp.sa_hash = hash_create(pim_msdp_sa_hash_key_make, - pim_msdp_sa_hash_eq, NULL); + pim_msdp_sa_hash_eq, hash_name); pim->msdp.sa_list = list_new(); pim->msdp.sa_list->del = (void (*)(void *))pim_msdp_sa_free; pim->msdp.sa_list->cmp = (int (*)(void *, void *))pim_msdp_sa_comp; diff --git a/pimd/pim_nht.c b/pimd/pim_nht.c index 01342eb58f..e91d251060 100644 --- a/pimd/pim_nht.c +++ b/pimd/pim_nht.c @@ -113,6 +113,8 @@ static struct pim_nexthop_cache *pim_nexthop_cache_add(struct pim_instance *pim, struct pim_rpf *rpf_addr) { struct pim_nexthop_cache *pnc; + char hash_name[64]; + char buf1[64]; pnc = XCALLOC(MTYPE_PIM_NEXTHOP_CACHE, sizeof(struct pim_nexthop_cache)); @@ -130,9 +132,12 @@ static struct pim_nexthop_cache *pim_nexthop_cache_add(struct pim_instance *pim, pnc->rp_list = list_new(); pnc->rp_list->cmp = pim_rp_list_cmp; + snprintf(hash_name, 64, "PNC %s(%s) Upstream Hash", + prefix2str(&pnc->rpf.rpf_addr, buf1, 64), + pim->vrf->name); pnc->upstream_hash = hash_create_size(8192, pim_upstream_hash_key, pim_upstream_equal, - "PNC Upstream Hash"); + hash_name); return pnc; } diff --git a/pimd/pim_oil.c b/pimd/pim_oil.c index 582fb42f39..b3bd94dc2a 100644 --- a/pimd/pim_oil.c +++ b/pimd/pim_oil.c @@ -101,8 +101,13 @@ static unsigned int pim_oil_hash_key(void *arg) void pim_oil_init(struct pim_instance *pim) { - pim->channel_oil_hash = - hash_create_size(8192, pim_oil_hash_key, pim_oil_equal, NULL); + char hash_name[64]; + + snprintf(hash_name, 64, "PIM %s Oil Hash", pim->vrf->name); + pim->channel_oil_hash = hash_create_size(8192, + pim_oil_hash_key, + pim_oil_equal, + hash_name); pim->channel_oil_list = list_new(); if (!pim->channel_oil_list) { diff --git a/pimd/pim_upstream.c b/pimd/pim_upstream.c index c7262d64ba..96aaff09b0 100644 --- a/pimd/pim_upstream.c +++ b/pimd/pim_upstream.c @@ -1752,11 +1752,16 @@ void pim_upstream_remove_lhr_star_pimreg(struct pim_instance *pim, void pim_upstream_init(struct pim_instance *pim) { + char hash_name[64]; + pim->upstream_sg_wheel = wheel_init(master, 31000, 100, pim_upstream_hash_key, pim_upstream_sg_running); + + snprintf(hash_name, 64, "PIM %s Upstream Hash", + pim->vrf->name); pim->upstream_hash = hash_create_size(8192, pim_upstream_hash_key, - pim_upstream_equal, NULL); + pim_upstream_equal, hash_name); pim->upstream_list = list_new(); pim->upstream_list->del = (void (*)(void *))pim_upstream_free; -- 2.39.5