2 * Copyright (c) 2015 Cisco and/or its affiliates.
3 * Licensed under the Apache License, Version 2.0 (the "License");
4 * you may not use this file except in compliance with the License.
5 * You may obtain a copy of the License at:
7 * http://www.apache.org/licenses/LICENSE-2.0
9 * Unless required by applicable law or agreed to in writing, software
10 * distributed under the License is distributed on an "AS IS" BASIS,
11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 * See the License for the specific language governing permissions and
13 * limitations under the License.
15 #ifndef __included_vxlan_gpe_ioam_h__
16 #define __included_vxlan_gpe_ioam_h__
18 #include <vnet/vxlan-gpe/vxlan_gpe.h>
19 #include <vnet/vxlan-gpe/vxlan_gpe_packet.h>
20 #include <ioam/lib-vxlan-gpe/vxlan_gpe_ioam_packet.h>
21 #include <vnet/ip/ip.h>
24 typedef struct vxlan_gpe_sw_interface_
27 } vxlan_gpe_ioam_sw_interface_t;
29 typedef struct vxlan_gpe_dest_tunnels_
31 ip46_address_t dst_addr;
34 fib_node_index_t fib_entry_index;
36 } vxlan_gpe_ioam_dest_tunnels_t;
38 typedef struct vxlan_gpe_ioam_main_
41 * Linkage into the FIB object graph
45 /* time scale transform. Joy. */
62 #define TSP_MILLISECONDS 1
63 #define TSP_MICROSECONDS 2
64 #define TSP_NANOSECONDS 3
66 /* Array of function pointers to ADD and POP VxLAN-GPE iOAM option handling routines */
68 int (*add_options[256]) (u8 * rewrite_string, u8 * rewrite_size);
69 int (*pop_options[256]) (ip4_header_t * ip, vxlan_gpe_ioam_option_t * opt);
71 /* Array of function pointers to iOAM option handling routines */
72 int (*options[256]) (vlib_buffer_t * b, vxlan_gpe_ioam_option_t * opt,
73 u8 is_ipv4, u8 use_adj);
74 u8 *(*trace[256]) (u8 * s, vxlan_gpe_ioam_option_t * opt);
76 /* API message ID base */
79 /* Override to export for iOAM */
80 uword decap_v4_next_override;
81 uword decap_v6_next_override;
83 /* sequence of node graph for encap */
84 uword encap_v4_next_node;
85 uword encap_v6_next_node;
87 /* Software interfaces. */
88 vxlan_gpe_ioam_sw_interface_t *sw_interfaces;
90 /* hash ip4/ip6 -> list of destinations for doing transit iOAM operation */
91 vxlan_gpe_ioam_dest_tunnels_t *dst_tunnels;
95 /** per sw_if_index, to maintain bitmap */
96 u8 *bool_ref_by_sw_if_index;
97 fib_node_type_t fib_entry_type;
99 /** State convenience vlib_main_t */
100 vlib_main_t *vlib_main;
101 /** State convenience vnet_main_t */
102 vnet_main_t *vnet_main;
105 } vxlan_gpe_ioam_main_t;
106 extern vxlan_gpe_ioam_main_t vxlan_gpe_ioam_main;
109 * Primary h-b-h handler trace support
119 extern vlib_node_registration_t vxlan_gpe_encap_ioam_v4_node;
120 extern vlib_node_registration_t vxlan_gpe_decap_ioam_v4_node;
121 extern vlib_node_registration_t vxlan_gpe_transit_ioam_v4_node;
123 clib_error_t *vxlan_gpe_ioam_enable (int has_trace_option, int has_pot_option,
126 clib_error_t *vxlan_gpe_ioam_disable (int has_trace_option,
127 int has_pot_option, int has_ppc_option);
129 clib_error_t *vxlan_gpe_ioam_set (vxlan_gpe_tunnel_t * t,
130 int has_trace_option,
132 int has_ppc_option, u8 ipv6_set);
133 clib_error_t *vxlan_gpe_ioam_clear (vxlan_gpe_tunnel_t * t,
134 int has_trace_option, int has_pot_option,
135 int has_ppc_option, u8 ipv6_set);
137 int vxlan_gpe_ioam_add_register_option (u8 option,
139 int rewrite_options (u8 *
144 int vxlan_gpe_add_unregister_option (u8 option);
146 int vxlan_gpe_ioam_register_option (u8 option,
147 int options (vlib_buffer_t * b,
148 vxlan_gpe_ioam_option_t *
149 opt, u8 is_ipv4, u8 use_adj),
151 vxlan_gpe_ioam_option_t *
153 int vxlan_gpe_ioam_unregister_option (u8 option);
155 int vxlan_gpe_trace_profile_setup (void);
157 int vxlan_gpe_trace_profile_cleanup (void);
158 extern void vxlan_gpe_ioam_interface_init (void);
160 vxlan_gpe_enable_disable_ioam_for_dest (vlib_main_t * vm,
161 ip46_address_t dst_addr,
163 u8 is_ipv4, u8 is_add);
164 int vxlan_gpe_ioam_disable_for_dest
165 (vlib_main_t * vm, ip46_address_t dst_addr, u32 outer_fib_index,
170 VXLAN_GPE_DECAP_IOAM_V4_NEXT_POP,
171 VXLAN_GPE_DECAP_IOAM_V4_NEXT_DROP,
172 VXLAN_GPE_DECAP_IOAM_V4_N_NEXT
173 } vxlan_gpe_decap_ioam_v4_next_t;
178 * fd.io coding-style-patch-verification: ON
181 * eval: (c-set-style "gnu")