summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorsaravanank <saravanank@vmware.com>2019-05-03 05:47:07 -0700
committersaravanank <saravanank@vmware.com>2019-05-14 21:37:35 -0700
commit23255dfd2a2406b49d6fc13d65eec938d7703841 (patch)
tree207db89692f1f1adcc08becb87eb68eec34a45ec
parent256392ebfd7c9c34127dd8512a86999f914bbc40 (diff)
pimd: BSM related memory definition to static and function reordering
Signed-off-by: Saravanan K <saravanank@vmware.com>
-rw-r--r--pimd/pim_bsm.c68
-rw-r--r--pimd/pim_memory.c4
-rw-r--r--pimd/pim_memory.h4
3 files changed, 35 insertions, 41 deletions
diff --git a/pimd/pim_bsm.c b/pimd/pim_bsm.c
index 7af9d3e1c8..e3948eb338 100644
--- a/pimd/pim_bsm.c
+++ b/pimd/pim_bsm.c
@@ -32,8 +32,12 @@
/* Functions forward declaration */
static void pim_bs_timer_start(struct bsm_scope *scope, int bs_timeout);
-static int pim_on_bs_timer(struct thread *t);
-static void pim_bs_timer_stop(struct bsm_scope *scope);
+
+/* Memory Types */
+DEFINE_MTYPE_STATIC(PIMD, PIM_BSGRP_NODE, "PIM BSR advertised grp info")
+DEFINE_MTYPE_STATIC(PIMD, PIM_BSRP_NODE, "PIM BSR advertised RP info")
+DEFINE_MTYPE_STATIC(PIMD, PIM_BSM_INFO, "PIM BSM Info")
+DEFINE_MTYPE_STATIC(PIMD, PIM_BSM_PKT_VAR_MEM, "PIM BSM Packet")
/* pim_bsm_write_config - Write the interface pim bsm configuration.*/
void pim_bsm_write_config(struct vty *vty, struct interface *ifp)
@@ -54,7 +58,6 @@ static void pim_free_bsgrp_data(struct bsgrp_node *bsgrp_node)
list_delete(&bsgrp_node->bsrp_list);
if (bsgrp_node->partial_bsrp_list)
list_delete(&bsgrp_node->partial_bsrp_list);
-
XFREE(MTYPE_PIM_BSGRP_NODE, bsgrp_node);
}
@@ -65,6 +68,35 @@ static void pim_bsm_node_free(struct bsm_info *bsm)
XFREE(MTYPE_PIM_BSM_INFO, bsm);
}
+static int pim_on_bs_timer(struct thread *t)
+{
+ return 0;
+}
+
+static void pim_bs_timer_stop(struct bsm_scope *scope)
+{
+ if (PIM_DEBUG_BSM)
+ zlog_debug("%s : BS timer being stopped of sz: %d",
+ __PRETTY_FUNCTION__, scope->sz_id);
+ THREAD_OFF(scope->bs_timer);
+}
+
+static void pim_bs_timer_start(struct bsm_scope *scope, int bs_timeout)
+{
+ if (!scope) {
+ if (PIM_DEBUG_BSM)
+ zlog_debug("%s : Invalid scope(NULL).",
+ __PRETTY_FUNCTION__);
+ return;
+ }
+ THREAD_OFF(scope->bs_timer);
+ if (PIM_DEBUG_BSM)
+ zlog_debug("%s : starting bs timer for scope %d with timeout %d secs",
+ __PRETTY_FUNCTION__, scope->sz_id, bs_timeout);
+ thread_add_timer(router->master, pim_on_bs_timer, scope, bs_timeout,
+ &scope->bs_timer);
+}
+
void pim_bsm_proc_init(struct pim_instance *pim)
{
memset(&pim->global_scope, 0, sizeof(struct bsm_scope));
@@ -101,36 +133,6 @@ void pim_bsm_proc_free(struct pim_instance *pim)
route_table_finish(pim->global_scope.bsrp_table);
}
-static int pim_on_bs_timer(struct thread *t)
-{
- return 0;
-}
-
-static void pim_bs_timer_stop(struct bsm_scope *scope)
-{
- if (PIM_DEBUG_BSM)
- zlog_debug("%s : BS timer being stopped of sz: %d",
- __PRETTY_FUNCTION__, scope->sz_id);
- THREAD_OFF(scope->bs_timer);
-}
-
-static void pim_bs_timer_start(struct bsm_scope *scope, int bs_timeout)
-{
- if (!scope) {
- if (PIM_DEBUG_BSM)
- zlog_debug("%s : Invalid scope(NULL).",
- __PRETTY_FUNCTION__);
- }
-
- THREAD_OFF(scope->bs_timer);
-
- if (PIM_DEBUG_BSM)
- zlog_debug("%s : starting bs timer for scope %d with timeout %d secs",
- __PRETTY_FUNCTION__, scope->sz_id, bs_timeout);
- thread_add_timer(router->master, pim_on_bs_timer, scope, bs_timeout,
- &scope->bs_timer);
-}
-
struct bsgrp_node *pim_bsm_get_bsgrp_node(struct bsm_scope *scope,
struct prefix *grp)
{
diff --git a/pimd/pim_memory.c b/pimd/pim_memory.c
index 0562dba70a..2bbab67e45 100644
--- a/pimd/pim_memory.c
+++ b/pimd/pim_memory.c
@@ -53,7 +53,3 @@ DEFINE_MTYPE(PIMD, PIM_NEXTHOP_CACHE, "PIM nexthop cache state")
DEFINE_MTYPE(PIMD, PIM_SSM_INFO, "PIM SSM configuration")
DEFINE_MTYPE(PIMD, PIM_SPT_PLIST_NAME, "PIM SPT Prefix List Name")
DEFINE_MTYPE(PIMD, PIM_VXLAN_SG, "PIM VxLAN mroute cache")
-DEFINE_MTYPE(PIMD, PIM_BSGRP_NODE, "PIM BSR advertised grp info")
-DEFINE_MTYPE(PIMD, PIM_BSRP_NODE, "PIM BSR advertised RP info")
-DEFINE_MTYPE(PIMD, PIM_BSM_INFO, "PIM BSM Info")
-DEFINE_MTYPE(PIMD, PIM_BSM_PKT_VAR_MEM, "PIM BSM Packet")
diff --git a/pimd/pim_memory.h b/pimd/pim_memory.h
index 9495db43be..e5ca57a15d 100644
--- a/pimd/pim_memory.h
+++ b/pimd/pim_memory.h
@@ -52,9 +52,5 @@ DECLARE_MTYPE(PIM_NEXTHOP_CACHE)
DECLARE_MTYPE(PIM_SSM_INFO)
DECLARE_MTYPE(PIM_SPT_PLIST_NAME);
DECLARE_MTYPE(PIM_VXLAN_SG)
-DECLARE_MTYPE(PIM_BSRP_NODE)
-DECLARE_MTYPE(PIM_BSGRP_NODE)
-DECLARE_MTYPE(PIM_BSM_INFO)
-DECLARE_MTYPE(PIM_BSM_PKT_VAR_MEM)
#endif /* _QUAGGA_PIM_MEMORY_H */