summaryrefslogtreecommitdiffstats
path: root/vlib
diff options
context:
space:
mode:
authorJohn Lo <loj@cisco.com>2016-04-12 18:20:39 -0400
committerGerrit Code Review <gerrit@fd.io>2016-04-14 23:06:54 +0000
commitd1f5d047988655a001655357f1ce35152161bedf (patch)
treed2a3f442190a352e8ed8cbfab7fefbf58e994133 /vlib
parente10e372e5a7a1be385e77a8062a2573eb58b29d8 (diff)
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 <loj@cisco.com>
Diffstat (limited to 'vlib')
-rw-r--r--vlib/vlib/node.c9
1 files changed, 4 insertions, 5 deletions
diff --git a/vlib/vlib/node.c b/vlib/vlib/node.c
index 40ef7c71a51..573b3a79567 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);