]> git.puffer.fish Git - mirror/frr.git/commitdiff
bgpd: Make bgp_keepalives.c not use MTYPE_TMP 13053/head
authorDonald Sharp <sharpd@nvidia.com>
Mon, 5 Dec 2022 17:17:00 +0000 (12:17 -0500)
committerMergify <37929162+mergify[bot]@users.noreply.github.com>
Mon, 20 Mar 2023 08:33:37 +0000 (08:33 +0000)
Signed-off-by: Donald Sharp <sharpd@nvidia.com>
(cherry picked from commit 19a713be1db59d757d3d08b72636e4efe0a3e0c0)

bgpd/bgp_keepalives.c

index 604d6c95097d8379c4360d9a30949f18f9bd1822..aeb91712b60a0e1e7411d30d49f520caa39c49b5 100644 (file)
 #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);