diff options
author | saravanank <saravanank@vmware.com> | 2019-05-03 14:47:07 +0200 |
---|---|---|
committer | saravanank <saravanank@vmware.com> | 2019-05-15 06:37:35 +0200 |
commit | 23255dfd2a2406b49d6fc13d65eec938d7703841 (patch) | |
tree | 207db89692f1f1adcc08becb87eb68eec34a45ec /pimd | |
parent | pimd: Implementation of show ip pim bsr command (diff) | |
download | frr-23255dfd2a2406b49d6fc13d65eec938d7703841.tar.xz frr-23255dfd2a2406b49d6fc13d65eec938d7703841.zip |
pimd: BSM related memory definition to static and function reordering
Signed-off-by: Saravanan K <saravanank@vmware.com>
Diffstat (limited to 'pimd')
-rw-r--r-- | pimd/pim_bsm.c | 68 | ||||
-rw-r--r-- | pimd/pim_memory.c | 4 | ||||
-rw-r--r-- | pimd/pim_memory.h | 4 |
3 files changed, 35 insertions, 41 deletions
diff --git a/pimd/pim_bsm.c b/pimd/pim_bsm.c index 7af9d3e1c..e3948eb33 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 0562dba70..2bbab67e4 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 9495db43b..e5ca57a15 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 */ |