diff options
author | John Lo <loj@cisco.com> | 2016-04-12 18:20:39 -0400 |
---|---|---|
committer | Gerrit Code Review <gerrit@fd.io> | 2016-04-14 23:06:54 +0000 |
commit | d1f5d047988655a001655357f1ce35152161bedf (patch) | |
tree | d2a3f442190a352e8ed8cbfab7fefbf58e994133 /vnet/vnet/ip/ip6_forward.c | |
parent | e10e372e5a7a1be385e77a8062a2573eb58b29d8 (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 'vnet/vnet/ip/ip6_forward.c')
-rw-r--r-- | vnet/vnet/ip/ip6_forward.c | 30 |
1 files changed, 3 insertions, 27 deletions
diff --git a/vnet/vnet/ip/ip6_forward.c b/vnet/vnet/ip/ip6_forward.c index a79bae6905a..4a161e7271c 100644 --- a/vnet/vnet/ip/ip6_forward.c +++ b/vnet/vnet/ip/ip6_forward.c @@ -1768,6 +1768,7 @@ void ip6_register_protocol (u32 protocol, u32 node_index) typedef enum { IP6_DISCOVER_NEIGHBOR_NEXT_DROP, + IP6_DISCOVER_NEIGHBOR_NEXT_REPLY_TX, IP6_DISCOVER_NEIGHBOR_N_NEXT, } ip6_discover_neighbor_next_t; @@ -1933,11 +1934,7 @@ ip6_discover_neighbor (vlib_main_t * vm, sizeof (ethernet_header_t)); vlib_buffer_advance (b0, -adj0->rewrite_header.data_bytes); - /* $$$$ hack in case next0 == 0 */ - b0->error = node->errors[IP6_DISCOVER_NEIGHBOR_ERROR_DROP]; - next0 = - vec_elt (im->discover_neighbor_next_index_by_hw_if_index, - hw_if0->hw_if_index); + next0 = IP6_DISCOVER_NEIGHBOR_NEXT_REPLY_TX; vlib_set_next_frame_buffer (vm, node, next0, bi0); } @@ -1969,32 +1966,11 @@ VLIB_REGISTER_NODE (ip6_discover_neighbor_node) = { .n_next_nodes = IP6_DISCOVER_NEIGHBOR_N_NEXT, .next_nodes = { [IP6_DISCOVER_NEIGHBOR_NEXT_DROP] = "error-drop", + [IP6_DISCOVER_NEIGHBOR_NEXT_REPLY_TX] = "interface-output", }, }; clib_error_t * -ip6_discover_neighbor_hw_interface_link_up_down (vnet_main_t * vnm, - u32 hw_if_index, - u32 flags) -{ - vlib_main_t * vm = vnm->vlib_main; - ip6_main_t * im = &ip6_main; - vnet_hw_interface_t * hw_if; - - hw_if = vnet_get_hw_interface (vnm, hw_if_index); - - vec_validate_init_empty - (im->discover_neighbor_next_index_by_hw_if_index, hw_if_index, 0); - im->discover_neighbor_next_index_by_hw_if_index[hw_if_index] - = vlib_node_add_next (vm, ip6_discover_neighbor_node.index, - hw_if->output_node_index); - return 0; -} - -VNET_HW_INTERFACE_LINK_UP_DOWN_FUNCTION -(ip6_discover_neighbor_hw_interface_link_up_down); - -clib_error_t * ip6_probe_neighbor (vlib_main_t * vm, ip6_address_t * dst, u32 sw_if_index) { vnet_main_t * vnm = vnet_get_main(); |