summaryrefslogtreecommitdiffstats
path: root/src/plugins/cdp/cdp_node.c
diff options
context:
space:
mode:
authorDave Barach <dave@barachs.net>2019-05-29 10:19:56 -0400
committerFlorin Coras <florin.coras@gmail.com>2019-05-29 16:27:36 +0000
commitef8711b3b2aa3c25baea5bce5d0f1626aa74fc7d (patch)
tree99449ef4923e5e52daef8e8513d0c0a16018acbf /src/plugins/cdp/cdp_node.c
parent257573d86bae518736f76ee59066d4200cd55bd2 (diff)
Start the cdp period process on demand
Change-Id: I219b270f905dad5939ab38e933712845c314286d Signed-off-by: Dave Barach <dave@barachs.net>
Diffstat (limited to 'src/plugins/cdp/cdp_node.c')
-rw-r--r--src/plugins/cdp/cdp_node.c24
1 files changed, 9 insertions, 15 deletions
diff --git a/src/plugins/cdp/cdp_node.c b/src/plugins/cdp/cdp_node.c
index 740bb4105e8..f9ee251c022 100644
--- a/src/plugins/cdp/cdp_node.c
+++ b/src/plugins/cdp/cdp_node.c
@@ -129,9 +129,6 @@ cdp_process (vlib_main_t * vm, vlib_node_runtime_t * rt, vlib_frame_t * f)
f64 poll_time_remaining;
uword event_type, *event_data = 0;
- /* So we can send events to the cdp process */
- cm->cdp_process_node_index = cdp_process_node.index;
-
/* Start w/ cdp disabled */
poll_time_remaining = 86400.0;
@@ -200,20 +197,17 @@ cdp_process (vlib_main_t * vm, vlib_node_runtime_t * rt, vlib_frame_t * f)
return 0;
}
-/*
- * cdp periodic node declaration
- */
-/* *INDENT-OFF* */
-VLIB_REGISTER_NODE (cdp_process_node) = {
- .function = cdp_process,
- .type = VLIB_NODE_TYPE_PROCESS,
- .name = "cdp-process",
-};
-/* *INDENT-ON* */
-
void
-vnet_cdp_node_reference (void)
+vnet_cdp_create_periodic_process (cdp_main_t * cmp)
{
+ /* Already created the process node? */
+ if (cmp->cdp_process_node_index > 0)
+ return;
+
+ /* No, create it now and make a note of the node index */
+ cmp->cdp_process_node_index = vlib_process_create
+ (cmp->vlib_main, "cdp-process",
+ cdp_process, 16 /* log2_n_stack_bytes */ );
}
/*