diff options
author | Hongjun Ni <hongjun.ni@intel.com> | 2016-05-30 19:45:51 +0800 |
---|---|---|
committer | Hongjun Ni <hongjun.ni@intel.com> | 2016-05-30 03:31:13 +0000 |
commit | 0e06e2b1420bca9b2bddd43e9642e56c81768fc2 (patch) | |
tree | 8969cb6ac5aa1ce50b3f546621ef8b633ff865b3 /vnet | |
parent | 4b46c84901b6ea393a5118d7835d77aa6b3cef58 (diff) |
Add Dump API for VxLAN-GPE tunnel
Change-Id: I4913fe6c4b1280939147887896aea9b79a9f7f10
Signed-off-by: Hongjun Ni <hongjun.ni@intel.com>
Diffstat (limited to 'vnet')
-rw-r--r-- | vnet/vnet/vxlan-gpe/vxlan_gpe.c | 37 | ||||
-rw-r--r-- | vnet/vnet/vxlan-gpe/vxlan_gpe.h | 4 |
2 files changed, 10 insertions, 31 deletions
diff --git a/vnet/vnet/vxlan-gpe/vxlan_gpe.c b/vnet/vnet/vxlan-gpe/vxlan_gpe.c index bf1623af372..e6565f4379b 100644 --- a/vnet/vnet/vxlan-gpe/vxlan_gpe.c +++ b/vnet/vnet/vxlan-gpe/vxlan_gpe.c @@ -56,30 +56,10 @@ u8 * format_vxlan_gpe_tunnel (u8 * s, va_list * args) static u8 * format_vxlan_gpe_name (u8 * s, va_list * args) { - vxlan_gpe_main_t * gm = &vxlan_gpe_main; - u32 i = va_arg (*args, u32); - u32 show_dev_instance = ~0; - - if (i < vec_len (gm->dev_inst_by_real)) - show_dev_instance = gm->dev_inst_by_real[i]; - - if (show_dev_instance != ~0) - i = show_dev_instance; - - return format (s, "vxlan_gpe_tunnel%d", i); + u32 dev_instance = va_arg (*args, u32); + return format (s, "vxlan_gpe_tunnel%d", dev_instance); } -static int vxlan_gpe_name_renumber (vnet_hw_interface_t * hi, - u32 new_dev_instance) -{ - vxlan_gpe_main_t * gm = &vxlan_gpe_main; - - vec_validate_init_empty (gm->dev_inst_by_real, hi->dev_instance, ~0); - - gm->dev_inst_by_real [hi->dev_instance] = new_dev_instance; - - return 0; -} static uword dummy_interface_tx (vlib_main_t * vm, vlib_node_runtime_t * node, @@ -88,6 +68,12 @@ static uword dummy_interface_tx (vlib_main_t * vm, clib_warning ("you shouldn't be here, leaking buffers..."); return frame->n_vectors; } +VNET_DEVICE_CLASS (vxlan_gpe_device_class,static) = { + .name = "VXLAN_GPE", + .format_device_name = format_vxlan_gpe_name, + .format_tx_trace = format_vxlan_gpe_encap_trace, + .tx_function = dummy_interface_tx, +}; static uword dummy_set_rewrite (vnet_main_t * vnm, u32 sw_if_index, @@ -99,13 +85,6 @@ static uword dummy_set_rewrite (vnet_main_t * vnm, return 0; } -VNET_DEVICE_CLASS (vxlan_gpe_device_class,static) = { - .name = "VXLAN_GPE", - .format_device_name = format_vxlan_gpe_name, - .format_tx_trace = format_vxlan_gpe_encap_trace, - .tx_function = dummy_interface_tx, - .name_renumber = vxlan_gpe_name_renumber, -}; static u8 * format_vxlan_gpe_header_with_length (u8 * s, va_list * args) { diff --git a/vnet/vnet/vxlan-gpe/vxlan_gpe.h b/vnet/vnet/vxlan-gpe/vxlan_gpe.h index 730abe70253..be420b54f6d 100644 --- a/vnet/vnet/vxlan-gpe/vxlan_gpe.h +++ b/vnet/vnet/vxlan-gpe/vxlan_gpe.h @@ -133,8 +133,8 @@ typedef struct { /* Free vlib hw_if_indices */ u32 * free_vxlan_gpe_tunnel_hw_if_indices; - /* show device instance by real device instance */ - u32 * dev_inst_by_real; + /* Mapping from sw_if_index to tunnel index */ + u32 * tunnel_index_by_sw_if_index; /* convenience */ vlib_main_t * vlib_main; |