pimd: BSM related memory definition to static and function reordering

Signed-off-by: Saravanan K <saravanank@vmware.com>
This commit is contained in:
saravanank 2019-05-03 05:47:07 -07:00
parent 256392ebfd
commit 23255dfd2a
3 changed files with 35 additions and 41 deletions

View file

@ -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)
{

View file

@ -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")

View file

@ -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 */