aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorDave Barach <dave@barachs.net>2021-02-08 07:56:22 -0500
committerFlorin Coras <florin.coras@gmail.com>2021-02-08 20:55:30 +0000
commita8f4ebd08e6d7fddf6fca4f2ef7081321c51a451 (patch)
tree4a4f92f276ead13c8e5c2ff06afcc92132a58240 /src
parentc7eaa711f3e25580687df0618e9ca80d3dc85e5f (diff)
vlib: ASSERT vm == vlib_get_main()
To catch coding mistakes: calling vlib_get_frame_to_node() from a worker thread with vm = &vlib_global_main instead of vm = vlib_mains[worker_thread_index] Type: improvement Signed-off-by: Dave Barach <dave@barachs.net> Change-Id: I5a8f01fdf9f35daeeada2d6eaa7180a60c4ca529
Diffstat (limited to 'src')
-rw-r--r--src/vlib/main.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/vlib/main.c b/src/vlib/main.c
index 77c69794d0f..761d4ee0bc5 100644
--- a/src/vlib/main.c
+++ b/src/vlib/main.c
@@ -122,6 +122,8 @@ vlib_frame_alloc_to_node (vlib_main_t * vm, u32 to_node_index,
vlib_frame_t *f;
u32 l, n, scalar_size, vector_size;
+ ASSERT (vm == vlib_get_main ());
+
to_node = vlib_get_node (vm, to_node_index);
scalar_size = to_node->scalar_size;
@@ -221,6 +223,8 @@ vlib_put_frame_to_node (vlib_main_t * vm, u32 to_node_index, vlib_frame_t * f)
if (f->n_vectors == 0)
return;
+ ASSERT (vm == vlib_get_main ());
+
vlib_validate_frame_indices (f);
to_node = vlib_get_node (vm, to_node_index);
@@ -241,6 +245,7 @@ vlib_frame_free (vlib_main_t * vm, vlib_node_runtime_t * r, vlib_frame_t * f)
vlib_node_t *node;
vlib_frame_size_t *fs;
+ ASSERT (vm == vlib_get_main ());
ASSERT (f->frame_flags & VLIB_FRAME_IS_ALLOCATED);
node = vlib_get_node (vm, r->node_index);