*/
#include <vnet/vxlan-gbp/vxlan_gbp.h>
#include <vnet/ip/format.h>
+#include <vnet/ip/punt.h>
#include <vnet/fib/fib_entry.h>
#include <vnet/fib/fib_table.h>
+#include <vnet/fib/fib_entry_track.h>
#include <vnet/mfib/mfib_table.h>
#include <vnet/adj/adj_mcast.h>
#include <vnet/adj/rewrite.h>
uword *vtep = ip46_address_is_ip4 (ip) ?
hash_get (vxlan_gbp_main.vtep4, ip->ip4.as_u32) :
hash_get_mem (vxlan_gbp_main.vtep6, &ip->ip6);
- ASSERT (vtep);
+ ALWAYS_ASSERT (vtep);
if (--(*vtep) != 0)
return *vtep;
ip46_address_is_ip4 (ip) ?
{
ASSERT (ip46_address_is_multicast (ip));
uword *p = hash_get_mem (vxlan_gbp_main.mcast_shared, ip);
- ASSERT (p);
+ ALWAYS_ASSERT (p);
mcast_shared_t ret = {.as_u64 = *p };
return ret;
}
* re-stack accordingly
*/
vtep_addr_ref (&t->src);
- t->fib_entry_index = fib_table_entry_special_add
- (t->encap_fib_index, &tun_dst_pfx, FIB_SOURCE_RR,
- FIB_ENTRY_FLAG_NONE);
- t->sibling_index = fib_entry_child_add
- (t->fib_entry_index, FIB_NODE_TYPE_VXLAN_GBP_TUNNEL,
- dev_instance);
+ t->fib_entry_index = fib_entry_track (t->encap_fib_index,
+ &tun_dst_pfx,
+ FIB_NODE_TYPE_VXLAN_GBP_TUNNEL,
+ dev_instance,
+ &t->sibling_index);
vxlan_gbp_tunnel_restack_dpo (t);
}
else
.frp_fib_index = ~0,
.frp_weight = 0,
.frp_flags = FIB_ROUTE_PATH_LOCAL,
+ .frp_mitf_flags = MFIB_ITF_FLAG_FORWARD,
};
const mfib_prefix_t mpfx = {
.fp_proto = fp,
*/
mfib_table_entry_path_update (t->encap_fib_index,
&mpfx,
- MFIB_SOURCE_VXLAN_GBP,
- &path, MFIB_ITF_FLAG_FORWARD);
+ MFIB_SOURCE_VXLAN_GBP, &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_VXLAN_GBP,
- &path,
- MFIB_ITF_FLAG_ACCEPT);
+ &path);
/*
* Create the mcast adjacency to send traffic to the group
if (!ip46_address_is_multicast (&t->dst))
{
vtep_addr_unref (&t->src);
- fib_entry_child_remove (t->fib_entry_index, t->sibling_index);
- fib_table_entry_delete_index (t->fib_entry_index, FIB_SOURCE_RR);
+ fib_entry_untrack (t->fib_entry_index, t->sibling_index);
}
else if (vtep_addr_unref (&t->dst) == 0)
{
vlib_cli_output (vm, "No vxlan-gbp tunnels configured...");
/* *INDENT-OFF* */
- pool_foreach (t, vxm->tunnels,
- ({
+ pool_foreach (t, vxm->tunnels)
+ {
vlib_cli_output (vm, "%U", format_vxlan_gbp_tunnel, t);
- }));
+ }
/* *INDENT-ON* */
if (raw)
}
/*?
- * This command adds the 'ip4-vxlan-gbp-bypass' graph node for a given interface.
- * By adding the IPv4 vxlan_gbp-bypass graph node to an interface, the node checks
- * for and validate input vxlan_gbp packet and bypass ip4-lookup, ip4-local,
- * ip4-udp-lookup nodes to speedup vxlan_gbp packet forwarding. This node will
- * cause extra overhead to for non-vxlan_gbp packets which is kept at a minimum.
+ * This command adds the 'ip4-vxlan-gbp-bypass' graph node for a given
+ * interface. By adding the IPv4 vxlan_gbp-bypass graph node to an interface,
+ * the node checks for and validate input vxlan_gbp packet and bypass
+ * ip4-lookup, ip4-local, ip4-udp-lookup nodes to speedup vxlan_gbp packet
+ * forwarding. This node will cause extra overhead to for non-vxlan_gbp packets
+ * which is kept at a minimum.
*
* @cliexpar
* @parblock
*
* Example of graph node after ip4-vxlan-gbp-bypass is enabled:
* @cliexstart{show vlib graph ip4-vxlan-gbp-bypass}
- * Name Next Previous
- * ip4-vxlan-gbp-bypass error-drop [0] ip4-input
- * vxlan4-gbp-input [1] ip4-input-no-checksum
- * ip4-lookup [2]
+ * Name Next Previous
+ * ip4-vxlan-gbp-bypass error-drop [0] ip4-input
+ * vxlan4-gbp-input [1] ip4-input-no-checksum
+ * ip4-lookup [2]
* @cliexend
*
* Example of how to display the feature enabled on an interface:
}
/*?
- * This command adds the 'ip6-vxlan-gbp-bypass' graph node for a given interface.
- * By adding the IPv6 vxlan-gbp-bypass graph node to an interface, the node checks
- * for and validate input vxlan_gbp packet and bypass ip6-lookup, ip6-local,
- * ip6-udp-lookup nodes to speedup vxlan_gbp packet forwarding. This node will
- * cause extra overhead to for non-vxlan packets which is kept at a minimum.
+ * This command adds the 'ip6-vxlan-gbp-bypass' graph node for a given
+ * interface. By adding the IPv6 vxlan-gbp-bypass graph node to an interface,
+ * the node checks for and validate input vxlan_gbp packet and bypass
+ * ip6-lookup, ip6-local, ip6-udp-lookup nodes to speedup vxlan_gbp packet
+ * forwarding. This node will cause extra overhead to for non-vxlan packets
+ * which is kept at a minimum.
*
* @cliexpar
* @parblock
*
* Example of graph node after ip6-vxlan-gbp-bypass is enabled:
* @cliexstart{show vlib graph ip6-vxlan-gbp-bypass}
- * Name Next Previous
- * ip6-vxlan-gbp-bypass error-drop [0] ip6-input
- * vxlan6-gbp-input [1] ip4-input-no-checksum
- * ip6-lookup [2]
+ * Name Next Previous
+ * ip6-vxlan-gbp-bypass error-drop [0] ip6-input
+ * vxlan6-gbp-input [1] ip4-input-no-checksum
+ * ip6-lookup [2]
* @cliexend
*
* Example of how to display the feature enabled on an interface:
VLIB_CLI_COMMAND (set_interface_ip6_vxlan_gbp_bypass_command, static) = {
.path = "set interface ip6 vxlan-gbp-bypass",
.function = set_ip6_vxlan_gbp_bypass,
- .short_help = "set interface ip vxlan-gbp-bypass <interface> [del]",
+ .short_help = "set interface ip6 vxlan-gbp-bypass <interface> [del]",
};
/* *INDENT-ON* */
vxlan_gbp_init (vlib_main_t * vm)
{
vxlan_gbp_main_t *vxm = &vxlan_gbp_main;
- clib_error_t *error;
vxm->vnet_main = vnet_get_main ();
vxm->vlib_main = vm;
- if ((error = vlib_call_init_function (vm, punt_init)))
- return (error);
-
/* initialize the ip6 hash */
clib_bihash_init_16_8 (&vxm->vxlan4_gbp_tunnel_by_key, "vxlan4-gbp",
VXLAN_GBP_HASH_NUM_BUCKETS,
punt_hdl = vlib_punt_client_register ("vxlan-gbp");
- vlib_punt_reason_alloc (punt_hdl,
- "VXLAN-GBP-no-such-v4-tunnel",
- &vxm->punt_no_such_tunnel[FIB_PROTOCOL_IP4]);
- vlib_punt_reason_alloc (punt_hdl,
- "VXLAN-GBP-no-such-v6-tunnel",
- &vxm->punt_no_such_tunnel[FIB_PROTOCOL_IP6]);
+ vlib_punt_reason_alloc (punt_hdl, "VXLAN-GBP-no-such-v4-tunnel", NULL, NULL,
+ &vxm->punt_no_such_tunnel[FIB_PROTOCOL_IP4],
+ VNET_PUNT_REASON_F_IP4_PACKET,
+ format_vnet_punt_reason_flags);
+ vlib_punt_reason_alloc (punt_hdl, "VXLAN-GBP-no-such-v6-tunnel", NULL, NULL,
+ &vxm->punt_no_such_tunnel[FIB_PROTOCOL_IP6],
+ VNET_PUNT_REASON_F_IP6_PACKET,
+ format_vnet_punt_reason_flags);
- return (error);
+ return (0);
}
-VLIB_INIT_FUNCTION (vxlan_gbp_init);
+/* *INDENT-OFF* */
+VLIB_INIT_FUNCTION (vxlan_gbp_init) =
+{
+ .runs_after = VLIB_INITS("punt_init"),
+};
+/* *INDENT-ON* */
/*
* fd.io coding-style-patch-verification: ON