From d1f5d047988655a001655357f1ce35152161bedf Mon Sep 17 00:00:00 2001 From: John Lo Date: Tue, 12 Apr 2016 18:20:39 -0400 Subject: Change ARP and IP6-ND nodes to use interface-output node for output The current mechanism for setting up arp-input and ip6-discover-neighbor output nodes for interfaces using their interface link up/down callback function is inefficient and has potential timing issue, as observed for bonded interface. Now both nodes will setup output interface sw_if_index in the the sw_if_index[VLIB_TX] field of current packet buffer and then use the interface-ouput node to tx the packet. One side effect is that vlib_node_add_next_with_slot() needs to be modified to allow the same output node-id to be put at the specified slot, even if another slot contain that same node-id already exist. This requirement is caused by BVI support where all loopback interfaces set up as BVIs will have the same output node-id being l2-input while, for output-interface node, the output slot must match the hw_if_index of the interface. Change-Id: I18bd1d4fe9bea047018796f7b8a4d4c20ee31d6e Signed-off-by: John Lo --- vlib/vlib/node.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) (limited to 'vlib') diff --git a/vlib/vlib/node.c b/vlib/vlib/node.c index 40ef7c71..573b3a79 100644 --- a/vlib/vlib/node.c +++ b/vlib/vlib/node.c @@ -177,10 +177,9 @@ vlib_node_add_next_with_slot (vlib_main_t * vm, if ((p = hash_get (node->next_slot_by_node, next_node_index))) { - /* Next already exists: slot must match. */ - if (slot != ~0) - ASSERT (slot == p[0]); - return p[0]; + /* Next already exists: use it if slot not specified or the same. */ + if ((slot == ~0) || (slot == p[0])) + return p[0]; } if (slot == ~0) @@ -190,7 +189,7 @@ vlib_node_add_next_with_slot (vlib_main_t * vm, vec_validate (node->n_vectors_by_next_node, slot); node->next_nodes[slot] = next_node_index; - hash_set (node->next_slot_by_node, next_node_index, slot); + if (!p) hash_set (node->next_slot_by_node, next_node_index, slot); vlib_node_runtime_update (vm, node_index, slot); -- cgit 1.2.3-korg