pimd: Setup hash names appropriately

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
This commit is contained in:
Donald Sharp 2017-07-25 09:45:03 -04:00
parent 7c59195031
commit 9fb302f41d
7 changed files with 38 additions and 11 deletions

View File

@ -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;

View File

@ -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;

View File

@ -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__);

View File

@ -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;

View File

@ -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;
}

View File

@ -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) {

View File

@ -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;