diff options
author | Mohammed Hawari <mohammed@hawari.fr> | 2024-08-29 14:01:06 +0200 |
---|---|---|
committer | Damjan Marion <dmarion@0xa5.net> | 2024-09-12 10:11:30 +0000 |
commit | 3b5a013103f0eff44afbdc4937407a82931edd00 (patch) | |
tree | dcace32773735e02fb26835f277d85b06b0f5313 /src/vlib/main.c | |
parent | 47968438dc42931952d39300fcc7b5e36239857b (diff) |
vlib: introduce lazy next node initialization
This change allow a node registration A to name a next node B that does not
exist yet at registration time. When node B is effectively created,
vlib_node_main_lazy_next_update need to be called so that the vlib graph
is updated accordingly. To enable this behavior, node A needs to bear
the new VLIB_NODE_FLAG_ALLOW_LAZY_NEXT_NODES.
Change-Id: I561d3a0de19a0b7bd1045760a2ba8e27d27caa9a
Type: improvement
Signed-off-by: Mohammed Hawari <mohammed@hawari.fr>
Diffstat (limited to 'src/vlib/main.c')
-rw-r--r-- | src/vlib/main.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/src/vlib/main.c b/src/vlib/main.c index 8f87df997e5..bf840324b64 100644 --- a/src/vlib/main.c +++ b/src/vlib/main.c @@ -569,6 +569,9 @@ vlib_node_sync_stats (vlib_main_t * vm, vlib_node_t * n) uword i; for (i = 0; i < rt->n_next_nodes; i++) { + if (n->flags & VLIB_NODE_FLAG_ALLOW_LAZY_NEXT_NODES && + n->next_nodes[i] == VLIB_INVALID_NODE_INDEX) + continue; nf = vlib_node_runtime_get_next_frame (vm, rt, i); vec_elt (n->n_vectors_by_next_node, i) += nf->vectors_since_last_overflow; |