bgpd: Make bgp_keepalives.c not use MTYPE_TMP

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
This commit is contained in:
Donald Sharp 2022-12-05 12:17:00 -05:00
parent 4898cbaf1d
commit 19a713be1d

View File

@ -36,6 +36,10 @@
#include "bgpd/bgp_keepalives.h"
/* clang-format on */
DEFINE_MTYPE_STATIC(BGPD, BGP_PKAT, "Peer KeepAlive Timer");
DEFINE_MTYPE_STATIC(BGPD, BGP_COND, "BGP Peer pthread Conditional");
DEFINE_MTYPE_STATIC(BGPD, BGP_MUTEX, "BGP Peer pthread Mutex");
/*
* Peer KeepAlive Timer.
* Associates a peer with the time of its last keepalive.
@ -54,7 +58,7 @@ static struct hash *peerhash;
static struct pkat *pkat_new(struct peer *peer)
{
struct pkat *pkat = XMALLOC(MTYPE_TMP, sizeof(struct pkat));
struct pkat *pkat = XMALLOC(MTYPE_BGP_PKAT, sizeof(struct pkat));
pkat->peer = peer;
monotime(&pkat->last);
return pkat;
@ -62,7 +66,7 @@ static struct pkat *pkat_new(struct peer *peer)
static void pkat_del(void *pkat)
{
XFREE(MTYPE_TMP, pkat);
XFREE(MTYPE_BGP_PKAT, pkat);
}
@ -158,8 +162,8 @@ static void bgp_keepalives_finish(void *arg)
pthread_mutex_destroy(peerhash_mtx);
pthread_cond_destroy(peerhash_cond);
XFREE(MTYPE_TMP, peerhash_mtx);
XFREE(MTYPE_TMP, peerhash_cond);
XFREE(MTYPE_BGP_MUTEX, peerhash_mtx);
XFREE(MTYPE_BGP_COND, peerhash_cond);
}
/*
@ -184,8 +188,8 @@ void *bgp_keepalives_start(void *arg)
*/
rcu_read_unlock();
peerhash_mtx = XCALLOC(MTYPE_TMP, sizeof(pthread_mutex_t));
peerhash_cond = XCALLOC(MTYPE_TMP, sizeof(pthread_cond_t));
peerhash_mtx = XCALLOC(MTYPE_BGP_MUTEX, sizeof(pthread_mutex_t));
peerhash_cond = XCALLOC(MTYPE_BGP_COND, sizeof(pthread_cond_t));
/* initialize mutex */
pthread_mutex_init(peerhash_mtx, NULL);