diff options
author | 2018-01-23 19:21:34 -0500 | |
---|---|---|
committer | 2018-02-02 17:34:00 +0000 | |
commit | 5e150a06a8b291edc9427e740d441ac652f6e705 (patch) | |
tree | 2a3810c32b444a00ba1eed20bb805ae731969c2d /src/vnet/vxlan | |
parent | cba3675fabe618194bf80a9de0e9c53b89a541ca (diff) |
Improve tunnel interface creation performance
Modify interface creation to allow creation of tunnel interfaces
without dedicated per tunnel output and tx nodes which are not
used for most tunnel types. Also changed interface-output node
function vnet_per_buffer_interface_output() so it does not rely
on hw_if_index as the next node index which is not flexible nor
efficient for large scale tunnel interfaces.
The improvenemts are done for VXLAN, VXLAN-GPE, GENEVE and GTPU
tunnels. GRE tunnel is still using per tunnel output nodes which
will be changed in a separate patch with other GRE enhencements.
Change-Id: I4123c01c0d2ead814417a867adb8c8a407e4df55
Signed-off-by: John Lo <loj@cisco.com>
(cherry picked from commit e5453d0fa29f39a7f78a7e22815566a7f4c9e5ef)
Diffstat (limited to 'src/vnet/vxlan')
-rw-r--r-- | src/vnet/vxlan/vxlan.c | 29 |
1 files changed, 10 insertions, 19 deletions
diff --git a/src/vnet/vxlan/vxlan.c b/src/vnet/vxlan/vxlan.c index 5926062b8c6..cec5ca15465 100644 --- a/src/vnet/vxlan/vxlan.c +++ b/src/vnet/vxlan/vxlan.c @@ -82,14 +82,6 @@ static u8 * format_vxlan_name (u8 * s, va_list * args) return format (s, "vxlan_tunnel%d", dev_instance); } -static uword dummy_interface_tx (vlib_main_t * vm, - vlib_node_runtime_t * node, - vlib_frame_t * frame) -{ - clib_warning ("you shouldn't be here, leaking buffers..."); - return frame->n_vectors; -} - static clib_error_t * vxlan_interface_admin_up_down (vnet_main_t * vnm, u32 hw_if_index, u32 flags) { @@ -104,7 +96,6 @@ VNET_DEVICE_CLASS (vxlan_device_class,static) = { .name = "VXLAN", .format_device_name = format_vxlan_name, .format_tx_trace = format_vxlan_encap_trace, - .tx_function = dummy_interface_tx, .admin_up_down_function = vxlan_interface_admin_up_down, }; @@ -426,17 +417,22 @@ int vnet_vxlan_add_del_tunnel (&im->sw_if_counters[VNET_INTERFACE_COUNTER_DROP], sw_if_index); vnet_interface_counter_unlock(im); } - else + else { hw_if_index = vnet_register_interface (vnm, vxlan_device_class.index, t - vxm->tunnels, vxlan_hw_class.index, t - vxm->tunnels); hi = vnet_get_hw_interface (vnm, hw_if_index); } - + + /* Set vxlan tunnel output node */ + u32 encap_index = !is_ip6 ? + vxlan4_encap_node.index : vxlan6_encap_node.index; + vnet_set_interface_output_node (vnm, hw_if_index, encap_index); + t->hw_if_index = hw_if_index; t->sw_if_index = sw_if_index = hi->sw_if_index; - + vec_validate_init_empty (vxm->tunnel_index_by_sw_if_index, sw_if_index, ~0); vxm->tunnel_index_by_sw_if_index[sw_if_index] = t - vxm->tunnels; @@ -444,16 +440,14 @@ int vnet_vxlan_add_del_tunnel vec_validate (l2im->configs, sw_if_index); l2im->configs[sw_if_index].feature_bitmap = L2INPUT_FEAT_DROP; l2im->configs[sw_if_index].bd_index = 0; - + vnet_sw_interface_t * si = vnet_get_sw_interface (vnm, sw_if_index); si->flags &= ~VNET_SW_INTERFACE_FLAG_HIDDEN; - vnet_sw_interface_set_flags (vnm, sw_if_index, + vnet_sw_interface_set_flags (vnm, sw_if_index, VNET_SW_INTERFACE_FLAG_ADMIN_UP); fib_node_init(&t->node, FIB_NODE_TYPE_VXLAN_TUNNEL); fib_prefix_t tun_dst_pfx; - u32 encap_index = !is_ip6 ? - vxlan4_encap_node.index : vxlan6_encap_node.index; vnet_flood_class_t flood_class = VNET_FLOOD_CLASS_TUNNEL_NORMAL; fib_prefix_from_ip46_addr(&t->dst, &tun_dst_pfx); @@ -545,9 +539,6 @@ int vnet_vxlan_add_del_tunnel flood_class = VNET_FLOOD_CLASS_TUNNEL_MASTER; } - /* Set vxlan tunnel output node */ - hi->output_node_index = encap_index; - vnet_get_sw_interface (vnet_get_main(), sw_if_index)->flood_class = flood_class; } else |