diff options
author | John Lo <loj@cisco.com> | 2018-01-23 19:21:34 -0500 |
---|---|---|
committer | Dave Barach <openvpp@barachs.net> | 2018-01-24 13:56:45 +0000 |
commit | e5453d0fa29f39a7f78a7e22815566a7f4c9e5ef (patch) | |
tree | 805b3d5ad2ca314a99d9460b202c483b4ae5550a /src/vnet/vxlan/vxlan.c | |
parent | d95c39e87bf9d21b2a9d4c49fdf7ebca2a5eab3d (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>
Diffstat (limited to 'src/vnet/vxlan/vxlan.c')
-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 edd8733741b..b0a186e2c05 100644 --- a/src/vnet/vxlan/vxlan.c +++ b/src/vnet/vxlan/vxlan.c @@ -79,14 +79,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) { @@ -101,7 +93,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, }; @@ -423,17 +414,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; @@ -441,16 +437,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); @@ -542,9 +536,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 |