diff options
Diffstat (limited to 'src/plugins/geneve/geneve.c')
-rw-r--r-- | src/plugins/geneve/geneve.c | 67 |
1 files changed, 26 insertions, 41 deletions
diff --git a/src/plugins/geneve/geneve.c b/src/plugins/geneve/geneve.c index 62502ef3fde..37b83d01761 100644 --- a/src/plugins/geneve/geneve.c +++ b/src/plugins/geneve/geneve.c @@ -114,7 +114,6 @@ geneve_mac_change (vnet_hw_interface_t * hi, return (NULL); } -/* *INDENT-OFF* */ VNET_DEVICE_CLASS (geneve_device_class, static) = { .name = "GENEVE", .format_device_name = format_geneve_name, @@ -122,7 +121,6 @@ VNET_DEVICE_CLASS (geneve_device_class, static) = { .admin_up_down_function = geneve_interface_admin_up_down, .mac_addr_change_function = geneve_mac_change, }; -/* *INDENT-ON* */ static u8 * format_geneve_header_with_length (u8 * s, va_list * args) @@ -132,13 +130,11 @@ format_geneve_header_with_length (u8 * s, va_list * args) return s; } -/* *INDENT-OFF* */ VNET_HW_INTERFACE_CLASS (geneve_hw_class) = { .name = "GENEVE", .format_header = format_geneve_header_with_length, .build_rewrite = default_build_rewrite, }; -/* *INDENT-ON* */ static void geneve_tunnel_restack_dpo (geneve_tunnel_t * t) @@ -425,18 +421,15 @@ int vnet_geneve_add_del_tunnel vnet_hw_interface_t *hi; if (a->l3_mode) { + vnet_eth_interface_registration_t eir = {}; u32 t_idx = t - vxm->tunnels; u8 address[6] = { 0xd0, 0x0b, 0xee, 0xd0, (u8) (t_idx >> 8), (u8) t_idx }; - clib_error_t *error = - ethernet_register_interface (vnm, geneve_device_class.index, - t_idx, - address, &hw_if_index, 0); - if (error) - { - clib_error_report (error); - return VNET_API_ERROR_INVALID_REGISTRATION; - } + + eir.dev_class_index = geneve_device_class.index; + eir.dev_instance = t_idx; + eir.address = address; + hw_if_index = vnet_eth_register_interface (vnm, &eir); } else { @@ -473,7 +466,8 @@ int vnet_geneve_add_del_tunnel fib_prefix_t tun_remote_pfx; vnet_flood_class_t flood_class = VNET_FLOOD_CLASS_TUNNEL_NORMAL; - fib_prefix_from_ip46_addr (&t->remote, &tun_remote_pfx); + fib_protocol_t fp = fib_ip_proto (is_ip6); + fib_prefix_from_ip46_addr (fp, &t->remote, &tun_remote_pfx); if (!ip46_address_is_multicast (&t->remote)) { /* Unicast tunnel - @@ -497,8 +491,6 @@ int vnet_geneve_add_del_tunnel * with different VNIs, create the output fib adjecency only if * it does not already exist */ - fib_protocol_t fp = fib_ip_proto (is_ip6); - if (vtep_addr_ref (&vxm->vtep_table, t->encap_fib_index, &t->remote) == 1) { @@ -524,15 +516,16 @@ int vnet_geneve_add_del_tunnel * - the forwarding interface is for-us * - the accepting interface is that from the API */ - mfib_table_entry_path_update (t->encap_fib_index, - &mpfx, MFIB_SOURCE_GENEVE, &path); + mfib_table_entry_path_update (t->encap_fib_index, &mpfx, + MFIB_SOURCE_GENEVE, + MFIB_ENTRY_FLAG_NONE, &path); path.frp_sw_if_index = a->mcast_sw_if_index; path.frp_flags = FIB_ROUTE_PATH_FLAG_NONE; path.frp_mitf_flags = MFIB_ITF_FLAG_ACCEPT; - mfei = mfib_table_entry_path_update (t->encap_fib_index, - &mpfx, - MFIB_SOURCE_GENEVE, &path); + mfei = mfib_table_entry_path_update ( + t->encap_fib_index, &mpfx, MFIB_SOURCE_GENEVE, + MFIB_ENTRY_FLAG_NONE, &path); /* * Create the mcast adjacency to send traffic to the group @@ -881,7 +874,6 @@ done: * Example of how to delete a GENEVE Tunnel: * @cliexcmd{create geneve tunnel local 10.0.3.1 remote 10.0.3.3 vni 13 del} ?*/ -/* *INDENT-OFF* */ VLIB_CLI_COMMAND (create_geneve_tunnel_command, static) = { .path = "create geneve tunnel", .short_help = @@ -890,7 +882,6 @@ VLIB_CLI_COMMAND (create_geneve_tunnel_command, static) = { " [encap-vrf-id <nn>] [decap-next [l2|node <name>]] [l3-mode] [del]", .function = geneve_add_del_tunnel_command_fn, }; -/* *INDENT-ON* */ static clib_error_t * show_geneve_tunnel_command_fn (vlib_main_t * vm, @@ -920,13 +911,11 @@ show_geneve_tunnel_command_fn (vlib_main_t * vm, * [0] local 10.0.3.1 remote 10.0.3.3 vni 13 encap_fib_index 0 sw_if_index 5 decap_next l2 * @cliexend ?*/ -/* *INDENT-OFF* */ VLIB_CLI_COMMAND (show_geneve_tunnel_command, static) = { .path = "show geneve tunnel", .short_help = "show geneve tunnel", .function = show_geneve_tunnel_command_fn, }; -/* *INDENT-ON* */ void @@ -995,7 +984,7 @@ set_ip4_geneve_bypass (vlib_main_t * vm, /*? * This command adds the 'ip4-geneve-bypass' graph node for a given interface. * By adding the IPv4 geneve-bypass graph node to an interface, the node checks - * for and validate input geneve packet and bypass ip4-lookup, ip4-local, + * for and validate input geneve packet and bypass ip4-lookup, ip4-local, * ip4-udp-lookup nodes to speedup geneve packet forwarding. This node will * cause extra overhead to for non-geneve packets which is kept at a minimum. * @@ -1014,13 +1003,13 @@ set_ip4_geneve_bypass (vlib_main_t * vm, * * Example of graph node after ip4-geneve-bypass is enabled: * @cliexstart{show vlib graph ip4-geneve-bypass} - * Name Next Previous - * ip4-geneve-bypass error-drop [0] ip4-input - * geneve4-input [1] ip4-input-no-checksum - * ip4-lookup [2] + * Name Next Previous + * ip4-geneve-bypass error-drop [0] ip4-input + * geneve4-input [1] ip4-input-no-checksum + * ip4-lookup [2] * @cliexend * - * Example of how to display the feature enabed on an interface: + * Example of how to display the feature enabled on an interface: * @cliexstart{show ip interface features GigabitEthernet2/0/0} * IP feature paths configured on GigabitEthernet2/0/0... * ... @@ -1034,13 +1023,11 @@ set_ip4_geneve_bypass (vlib_main_t * vm, * @cliexcmd{set interface ip geneve-bypass GigabitEthernet2/0/0 del} * @endparblock ?*/ -/* *INDENT-OFF* */ VLIB_CLI_COMMAND (set_interface_ip_geneve_bypass_command, static) = { .path = "set interface ip geneve-bypass", .function = set_ip4_geneve_bypass, .short_help = "set interface ip geneve-bypass <interface> [del]", }; -/* *INDENT-ON* */ static clib_error_t * set_ip6_geneve_bypass (vlib_main_t * vm, @@ -1052,7 +1039,7 @@ set_ip6_geneve_bypass (vlib_main_t * vm, /*? * This command adds the 'ip6-geneve-bypass' graph node for a given interface. * By adding the IPv6 geneve-bypass graph node to an interface, the node checks - * for and validate input geneve packet and bypass ip6-lookup, ip6-local, + * for and validate input geneve packet and bypass ip6-lookup, ip6-local, * ip6-udp-lookup nodes to speedup geneve packet forwarding. This node will * cause extra overhead to for non-geneve packets which is kept at a minimum. * @@ -1071,13 +1058,13 @@ set_ip6_geneve_bypass (vlib_main_t * vm, * * Example of graph node after ip6-geneve-bypass is enabled: * @cliexstart{show vlib graph ip6-geneve-bypass} - * Name Next Previous - * ip6-geneve-bypass error-drop [0] ip6-input - * geneve6-input [1] ip4-input-no-checksum - * ip6-lookup [2] + * Name Next Previous + * ip6-geneve-bypass error-drop [0] ip6-input + * geneve6-input [1] ip4-input-no-checksum + * ip6-lookup [2] * @cliexend * - * Example of how to display the feature enabed on an interface: + * Example of how to display the feature enabled on an interface: * @cliexstart{show ip interface features GigabitEthernet2/0/0} * IP feature paths configured on GigabitEthernet2/0/0... * ... @@ -1091,13 +1078,11 @@ set_ip6_geneve_bypass (vlib_main_t * vm, * @cliexcmd{set interface ip6 geneve-bypass GigabitEthernet2/0/0 del} * @endparblock ?*/ -/* *INDENT-OFF* */ VLIB_CLI_COMMAND (set_interface_ip6_geneve_bypass_command, static) = { .path = "set interface ip6 geneve-bypass", .function = set_ip6_geneve_bypass, .short_help = "set interface ip6 geneve-bypass <interface> [del]", }; -/* *INDENT-ON* */ clib_error_t * geneve_init (vlib_main_t * vm) |