diff options
author | Donald Sharp <sharpd@nvidia.com> | 2022-12-05 18:17:00 +0100 |
---|---|---|
committer | Donald Sharp <sharpd@nvidia.com> | 2022-12-05 18:17:00 +0100 |
commit | 19a713be1db59d757d3d08b72636e4efe0a3e0c0 (patch) | |
tree | 8ee1c55133943ca98933cf40ae4265442d46cfbd | |
parent | ospf6d: Stop using MTYPE_TMP in some cases (diff) | |
download | frr-19a713be1db59d757d3d08b72636e4efe0a3e0c0.tar.xz frr-19a713be1db59d757d3d08b72636e4efe0a3e0c0.zip |
bgpd: Make bgp_keepalives.c not use MTYPE_TMP
Signed-off-by: Donald Sharp <sharpd@nvidia.com>
-rw-r--r-- | bgpd/bgp_keepalives.c | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/bgpd/bgp_keepalives.c b/bgpd/bgp_keepalives.c index b39a7daa1..0e83157ec 100644 --- a/bgpd/bgp_keepalives.c +++ b/bgpd/bgp_keepalives.c @@ -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); |