diff options
author | Neale Ranns <nranns@cisco.com> | 2018-09-28 15:16:14 +0000 |
---|---|---|
committer | Damjan Marion <dmarion@me.com> | 2019-03-28 20:51:32 +0000 |
commit | 76b5649d074ab198cbf5737ac76d21649a61bffd (patch) | |
tree | bb856c9638cb63ead6c00837daad01373551b4e1 /src/plugins/gbp/gbp_vxlan.c | |
parent | 1f4e1cbf576fc6ab4e871ba0603028112074b43b (diff) |
Punt Infra
A punt/exception path that provides:
1) clients that use the infra
2) clients can create punt reasons
3) clients can register to recieve packets that are punted
for a given reason to be sent to the desired node.
4) nodes which punt packets fill in the {reason,protocol} of the
buffere (in the meta-data) and send to the new node "punt-dispatch"
5) punt-dispatch sends packets to the registered nodes or drops
Change-Id: Ia4f144337f1387cbe585b4f375d0842aefffcde5
Signed-off-by: Neale Ranns <nranns@cisco.com>
Diffstat (limited to 'src/plugins/gbp/gbp_vxlan.c')
-rw-r--r-- | src/plugins/gbp/gbp_vxlan.c | 38 |
1 files changed, 19 insertions, 19 deletions
diff --git a/src/plugins/gbp/gbp_vxlan.c b/src/plugins/gbp/gbp_vxlan.c index 286345ed8fa..49dae7e9f4c 100644 --- a/src/plugins/gbp/gbp_vxlan.c +++ b/src/plugins/gbp/gbp_vxlan.c @@ -22,6 +22,7 @@ #include <vnet/vxlan-gbp/vxlan_gbp.h> #include <vlibmemory/api.h> #include <vnet/fib/fib_table.h> +#include <vlib/punt.h> /** * A reference to a VXLAN-GBP tunnel created as a child/dependent tunnel @@ -66,6 +67,10 @@ index_t *gbp_vxlan_tunnel_db; */ index_t *vxlan_tunnel_ref_db; +/** + * handle registered with the ;unt infra + */ +static vlib_punt_hdl_t punt_hdl; static char *gbp_vxlan_tunnel_layer_strings[] = { #define _(n,s) [GBP_VXLAN_TUN_##n] = s, @@ -672,28 +677,23 @@ VLIB_CLI_COMMAND (gbp_vxlan_show_node, static) = { static clib_error_t * gbp_vxlan_init (vlib_main_t * vm) { - u32 slot4; - vlib_node_t *node = vlib_get_node_by_name (vm, (u8 *) "gbp-vxlan4"); - - /* - * insert ourselves into the VXLAN-GBP arc to collect the no-tunnel - * packets. - */ - slot4 = vlib_node_add_next_with_slot (vm, - vxlan4_gbp_input_node.index, - node->index, - VXLAN_GBP_INPUT_NEXT_NO_TUNNEL); - ASSERT (slot4 == VXLAN_GBP_INPUT_NEXT_NO_TUNNEL); - - /* slot6 = vlib_node_add_next_with_slot (vm, */ - /* vxlan6_gbp_input_node.index, */ - /* gbp_vxlan6_input_node.index, */ - /* VXLAN_GBP_INPUT_NEXT_NO_TUNNEL); */ - /* ASSERT (slot6 == VXLAN_GBP_INPUT_NEXT_NO_TUNNEL); */ + vxlan_gbp_main_t *vxm = &vxlan_gbp_main; + clib_error_t *error; gt_logger = vlib_log_register_class ("gbp", "tun"); - return (NULL); + if ((error = vlib_call_init_function (vm, punt_init))) + return error; + if ((error = vlib_call_init_function (vm, vxlan_gbp_init))) + return error; + + punt_hdl = vlib_punt_client_register ("gbp-vxlan"); + + vlib_punt_register (punt_hdl, + vxm->punt_no_such_tunnel[FIB_PROTOCOL_IP4], + "gbp-vxlan4"); + + return (error); } VLIB_INIT_FUNCTION (gbp_vxlan_init); |