X-Git-Url: https://gerrit.fd.io/r/gitweb?a=blobdiff_plain;ds=sidebyside;f=src%2Fvlib%2Fnode.c;h=2bb5bceadbcb26ca6b4b380dcb466e62fc7f698f;hb=41e831f5588fe5ebfd879f4e570e85e12770b360;hp=0e6038d01fa438676891b550a025901baa51e78e;hpb=687c9021fda009caa2b7eb17bea2eaa51d275bde;p=vpp.git diff --git a/src/vlib/node.c b/src/vlib/node.c index 0e6038d01fa..2bb5bceadbc 100644 --- a/src/vlib/node.c +++ b/src/vlib/node.c @@ -128,10 +128,6 @@ vlib_node_runtime_update (vlib_main_t * vm, u32 node_index, u32 next_index) vlib_pending_frame_t *pf; i32 i, j, n_insert; - ASSERT (vlib_get_thread_index () == 0); - - vlib_worker_thread_barrier_sync (vm); - node = vec_elt (nm->nodes, node_index); r = vlib_node_get_runtime (vm, node_index); @@ -176,8 +172,6 @@ vlib_node_runtime_update (vlib_main_t * vm, u32 node_index, u32 next_index) nf->node_runtime_index = next_node->runtime_index; vlib_worker_thread_node_runtime_update (); - - vlib_worker_thread_barrier_release (vm); } uword @@ -207,9 +201,12 @@ vlib_node_add_next_with_slot (vlib_main_t * vm, uword next_node_index, uword slot) { vlib_node_main_t *nm = &vm->node_main; - vlib_node_t *node, *next; + vlib_node_t *node, *next, *old_next; + u32 old_next_index; uword *p; + ASSERT (vlib_get_thread_index () == 0); + node = vec_elt (nm->nodes, node_index); next = vec_elt (nm->nodes, next_node_index); @@ -224,12 +221,22 @@ vlib_node_add_next_with_slot (vlib_main_t * vm, return p[0]; } + vlib_worker_thread_barrier_sync (vm); + if (slot == ~0) slot = vec_len (node->next_nodes); vec_validate_init_empty (node->next_nodes, slot, ~0); vec_validate (node->n_vectors_by_next_node, slot); + if ((old_next_index = node->next_nodes[slot]) != ~0u) + { + hash_unset (node->next_slot_by_node, old_next_index); + old_next = vlib_get_node (vm, old_next_index); + old_next->prev_node_bitmap = + clib_bitmap_andnoti (old_next->prev_node_bitmap, node_index); + } + node->next_nodes[slot] = next_node_index; hash_set (node->next_slot_by_node, next_node_index, slot); @@ -254,6 +261,7 @@ vlib_node_add_next_with_slot (vlib_main_t * vm, /* *INDENT-ON* */ } + vlib_worker_thread_barrier_release (vm); return slot; }