71 #define _(n,s) [GBP_VXLAN_TUN_##n] = s, 76 #define GBP_VXLAN_TUN_DBG(...) \ 77 vlib_log_debug (gt_logger, __VA_ARGS__); 110 const ip46_address_t *
src,
const ip46_address_t *
dst)
119 .mode = (GBP_VXLAN_TUN_L2 == gt->
gt_layer ?
130 if (VNET_API_ERROR_TUNNEL_EXIST == rv)
139 ASSERT (~0 != sw_if_index);
168 L2OUTPUT_FEAT_GBP_POLICY_MAC);
170 L2INPUT_FEAT_GBP_LEARN);
187 return (sw_if_index);
225 const ip46_address_t *
src,
226 const ip46_address_t *
dst)
277 pool_put (vxlan_tunnel_ref_pool, vxr);
313 #define foreach_gbp_vxlan_input_next \ 314 _(DROP, "error-drop") \ 315 _(L2_INPUT, "l2-input") \ 316 _(IP4_INPUT, "ip4-input") \ 317 _(IP6_INPUT, "ip6-input") 321 #define _(s,n) GBP_VXLAN_INPUT_NEXT_##s, 327 #define foreach_gbp_vxlan_error \ 328 _(DECAPPED, "decapped") \ 329 _(LEARNED, "learned") 333 #define _(s,n) GBP_VXLAN_ERROR_##s, 360 u32 n_left_to_next, n_left_from, next_index, *to_next, *from;
366 while (n_left_from > 0)
371 while (n_left_from > 0 && n_left_to_next > 0)
380 bi0 = to_next[0] = from[0];
385 next0 = GBP_VXLAN_INPUT_NEXT_DROP;
397 next0 = GBP_VXLAN_INPUT_NEXT_DROP;
405 if (GBP_VXLAN_TUN_L2 == gt0->
gt_layer)
409 next0 = GBP_VXLAN_INPUT_NEXT_L2_INPUT;
420 type0 = clib_net_to_host_u16 (e0->
type);
423 case ETHERNET_TYPE_IP4:
424 next0 = GBP_VXLAN_INPUT_NEXT_IP4_INPUT;
426 case ETHERNET_TYPE_IP6:
427 next0 = GBP_VXLAN_INPUT_NEXT_IP6_INPUT;
442 tr->
dropped = (next0 == GBP_VXLAN_INPUT_NEXT_DROP);
450 to_next, n_left_to_next,
467 s =
format (s,
"vni:%d dropped:%d rx:%d sclass:%d flags:%U",
485 .name =
"gbp-vxlan4",
486 .vector_size =
sizeof (
u32),
492 #define _(s,n) [GBP_VXLAN_INPUT_NEXT_##s] = n, 519 gt - gbp_vxlan_tunnel_pool);
527 u32 dev_instance = va_arg (*args,
u32);
529 return format (s,
"gbp-vxlan-%d", dev_instance);
544 u32 dev_instance = va_arg (*args,
u32);
549 s =
format (s,
"GBP VXLAN tunnel: hw:%d sw:%d vni:%d %U",
552 if (GBP_VXLAN_TUN_L2 == gt->
gt_layer)
555 s =
format (s,
" RD:%d fib-index:[%d,%d]",
560 s =
format (s,
" children:[");
582 s =
format (s,
"GBP-VXLAN: vni:%d", t->
vni);
619 clib_warning (
"you shouldn't be here, leaking buffers...");
625 .name =
"GBP VXLAN tunnel-template",
662 if (layer == GBP_VXLAN_TUN_L2)
668 return (VNET_API_ERROR_BD_NOT_MODIFIABLE);
677 return (VNET_API_ERROR_NO_SUCH_FIB);
682 pool_get (gbp_vxlan_tunnel_pool, gt);
689 gbp_vxlan_device_class.index,
691 gbp_vxlan_hw_interface_class.index,
702 if (layer == GBP_VXLAN_TUN_L2)
756 rv = VNET_API_ERROR_IF_ALREADY_EXISTS;
782 gt - gbp_vxlan_tunnel_pool);
788 if (GBP_VXLAN_TUN_L2 == gt->
gt_layer)
814 pool_put (gbp_vxlan_tunnel_pool, gt);
817 return VNET_API_ERROR_NO_SUCH_ENTRY;
840 .path =
"show gbp vxlan",
841 .short_help =
"show gbp vxlan\n",
858 VXLAN_GBP_INPUT_NEXT_NO_TUNNEL);
859 ASSERT (slot4 == VXLAN_GBP_INPUT_NEXT_NO_TUNNEL);
vlib_log_class_t vlib_log_register_class(char *class, char *subclass)
static char * gbp_vxlan_error_strings[]
#define vec_validate(V, I)
Make sure vector is long enough for given index (no header, unspecified alignment) ...
A real VXLAN-GBP tunnel (from vnet/vxlan-gbp/...)
u32 grd_table_id[FIB_PROTOCOL_IP_MAX]
VNET_DEVICE_CLASS(gbp_vxlan_device_class)
void gbp_itf_set_l2_input_feature(index_t gii, index_t useri, l2input_feat_masks_t feats)
u32 gbp_vxlan_tunnel_clone_and_lock(u32 sw_if_index, const ip46_address_t *src, const ip46_address_t *dst)
void gbp_route_domain_unlock(index_t index)
u32 grd_vni_sw_if_index
The RD's VNI interface on which packets from unkown endpoints arrive.
static vlib_cli_command_t trace
(constructor) VLIB_CLI_COMMAND (trace)
#define hash_set(h, key, value)
static walk_rc_t gbp_vxlan_tunnel_show_one(gbp_vxlan_tunnel_t *gt, void *ctx)
#define hash_unset(h, key)
#define GBP_VXLAN_TUN_DBG(...)
vnet_main_t * vnet_get_main(void)
#define pool_get_zero(P, E)
Allocate an object E from a pool P and zero it.
u8 * format_gbp_vxlan_tx_trace(u8 *s, va_list *args)
int vnet_vxlan_gbp_tunnel_add_del(vnet_vxlan_gbp_tunnel_add_del_args_t *a, u32 *sw_if_indexp)
A bridge Domain Representation.
void vxlan_gbp_unregister_udp_ports(void)
static vnet_hw_interface_t * vnet_get_hw_interface(vnet_main_t *vnm, u32 hw_if_index)
u32 index_t
A Data-Path Object is an object that represents actions that are applied to packets are they are swit...
#define vec_add1(V, E)
Add 1 element to end of vector (unspecified alignment).
vlib_node_registration_t gbp_vxlan4_input_node
(constructor) VLIB_REGISTER_NODE (gbp_vxlan4_input_node)
void gbp_vxlan_walk(gbp_vxlan_cb_t cb, void *ctx)
static clib_error_t * gbp_vxlan_show(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
static u8 * format_gbp_vxlan_tunnel_name(u8 *s, va_list *args)
static vnet_sw_interface_t * vnet_get_sw_interface(vnet_main_t *vnm, u32 sw_if_index)
u8 * format_gbp_vxlan_tunnel(u8 *s, va_list *args)
#define pool_get(P, E)
Allocate an object E from a pool P (unspecified alignment).
static gbp_bridge_domain_t * gbp_bridge_domain_get(index_t i)
format_function_t format_vnet_sw_if_index_name
gbp_vxlan_tunnel_t * gbp_vxlan_tunnel_pool
Pool of template tunnels.
static u32 gdb_vxlan_dep_add(gbp_vxlan_tunnel_t *gt, u32 vni, const ip46_address_t *src, const ip46_address_t *dst)
enum fib_protocol_t_ fib_protocol_t
Protocol Type.
void gbp_itf_unlock(index_t gii)
int ip_table_bind(fib_protocol_t fproto, u32 sw_if_index, u32 table_id, u8 is_api)
gbp_vxlan_tunnel_layer_t vxr_layer
struct gbp_vxlan_trace_t_ gbp_vxlan_trace_t
enum walk_rc_t_ walk_rc_t
Walk return code.
index_t * gt_tuns
list of child vxlan-gbp tunnels built from this template
void vxlan_gbp_tunnel_unlock(u32 sw_if_index)
vnet_flood_class_t flood_class
u8 * format_gbp_vxlan_tunnel_layer(u8 *s, va_list *args)
#define pool_foreach(VAR, POOL, BODY)
Iterate through pool.
#define VLIB_INIT_FUNCTION(x)
u8 * format_vxlan_gbp_header_gpflags(u8 *s, va_list *args)
static u8 * format_gbp_vxlan_rx_trace(u8 *s, va_list *args)
static u8 * format_vxlan_tunnel_ref(u8 *s, va_list *args)
static gbp_vxlan_tunnel_t * gbp_vxlan_tunnel_get(index_t gti)
uword vlib_node_add_next_with_slot(vlib_main_t *vm, uword node_index, uword next_node_index, uword slot)
static uword gbp_vxlan_decap(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *from_frame, u8 is_ip4)
#define vec_search(v, E)
Search a vector for the index of the entry that matches.
#define foreach_gbp_vxlan_error
u32 vnet_register_interface(vnet_main_t *vnm, u32 dev_class_index, u32 dev_instance, u32 hw_class_index, u32 hw_instance)
struct gbp_vxlan_tx_trace_t_ gbp_vxlan_tx_trace_t
static vxlan_gbp_gpflags_t vxlan_gbp_get_gpflags(vxlan_gbp_header_t *h)
#define VLIB_NODE_FUNCTION_MULTIARCH(node, fn)
#define pool_elt_at_index(p, i)
Returns pointer to element at given index.
void gbp_learn_enable(u32 sw_if_index, gbb_learn_mode_t mode)
u32 gt_bd_index
BD index (if L2)
void ip4_sw_interface_enable_disable(u32 sw_if_index, u32 is_enable)
walk_rc_t(* gbp_vxlan_cb_t)(gbp_vxlan_tunnel_t *gt, void *ctx)
static void * vlib_buffer_get_current(vlib_buffer_t *b)
Get pointer to current data to process.
#define pool_put(P, E)
Free an object E in pool P.
This is the object type deifend above.
#define vec_del1(v, i)
Delete the element at index I.
u32 gb_bd_id
Bridge-domain ID.
void gbp_itf_set_l2_output_feature(index_t gii, index_t useri, l2output_feat_masks_t feats)
#define vlib_validate_buffer_enqueue_x1(vm, node, next_index, to_next, n_left_to_next, bi0, next0)
Finish enqueueing one buffer forward in the graph.
#define vlib_get_next_frame(vm, node, next_index, vectors, n_vectors_left)
Get pointer to next frame vector data by (vlib_node_runtime_t, next_index).
#define ip46_address_is_ip4(ip46)
int gbp_vxlan_tunnel_add(u32 vni, gbp_vxlan_tunnel_layer_t layer, u32 bd_rd_id, u32 *sw_if_indexp)
vlib_node_registration_t vxlan4_gbp_input_node
(constructor) VLIB_REGISTER_NODE (vxlan4_gbp_input_node)
enum gbp_vxlan_tunnel_layer_t_ gbp_vxlan_tunnel_layer_t
#define VLIB_REGISTER_NODE(x,...)
static u16 vxlan_gbp_get_sclass(vxlan_gbp_header_t *h)
#define vec_free(V)
Free vector's memory (no header).
static u32 vxlan_gbp_get_vni(vxlan_gbp_header_t *h)
static uword gbp_vxlan4_decap(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *from_frame)
u32 grd_fib_index[FIB_PROTOCOL_IP_MAX]
#define clib_warning(format, args...)
int gbp_vxlan_tunnel_del(u32 vni)
void vlib_put_next_frame(vlib_main_t *vm, vlib_node_runtime_t *r, u32 next_index, u32 n_vectors_left)
Release pointer to next frame vector data.
index_t * gbp_vxlan_tunnel_db
DB of template interfaces by SW interface index.
index_t gbp_bridge_domain_find_and_lock(u32 bd_id)
static clib_error_t * gbp_vxlan_init(vlib_main_t *vm)
void gbp_endpoint_flush(gbp_endpoint_src_t src, u32 sw_if_index)
remove all learnt endpoints using the interface
void vxlan_gbp_register_udp_ports(void)
#define VLIB_CLI_COMMAND(x,...)
gbp_vxlan_tunnel_layer_t gt_layer
gbp_route_domain_t * gbp_route_domain_get(index_t i)
static vxlan_tunnel_ref_t * vxlan_tunnel_ref_get(index_t vxri)
#define foreach_gbp_vxlan_input_next
clib_error_t * gbp_vxlan_interface_admin_up_down(vnet_main_t *vnm, u32 hw_if_index, u32 flags)
int vnet_vxlan_gbp_tunnel_del(u32 sw_if_index)
static void vlib_buffer_advance(vlib_buffer_t *b, word l)
Advance current data pointer by the supplied (signed!) amount.
index_t gt_gbd
Reference to the GPB-BD.
void vnet_delete_hw_interface(vnet_main_t *vnm, u32 hw_if_index)
vlib_log_class_t gt_logger
Logger.
static void * vlib_add_trace(vlib_main_t *vm, vlib_node_runtime_t *r, vlib_buffer_t *b, u32 n_data_bytes)
u32 vxlan_gbp_tunnel_get_parent(u32 sw_if_index)
#define vec_len(v)
Number of elements in vector (rvalue-only, NULL tolerant)
A route Domain Representation.
static void gdb_vxlan_dep_del(index_t vxri)
enum gbp_vxlan_tunnel_type_t_ gbp_vxlan_tunnel_type_t
The different types of interfaces that endpoints are learned on.
#define INDEX_INVALID
Invalid index - used when no index is known blazoned capitals INVALID speak volumes where ~0 does not...
clib_error_t * vnet_hw_interface_set_flags(vnet_main_t *vnm, u32 hw_if_index, vnet_hw_interface_flags_t flags)
static void * vlib_frame_vector_args(vlib_frame_t *f)
Get pointer to frame vector data.
u32 gb_vni_sw_if_index
The BD's VNI interface on which packets from unkown endpoints arrive.
a point 2 point interface
gbp_vxlan_tunnel_type_t gbp_vxlan_tunnel_get_type(u32 sw_if_index)
#define FOR_EACH_FIB_IP_PROTOCOL(_item)
void gbp_learn_disable(u32 sw_if_index, gbb_learn_mode_t mode)
GBP VXLAN (template) tunnel.
index_t * vxlan_tunnel_ref_db
DB of child interfaces by SW interface index.
A reference to a VXLAN-GBP tunnel created as a child/dependent tunnel of the tempplate GBP-VXLAN tunn...
clib_error_t * vnet_sw_interface_set_flags(vnet_main_t *vnm, u32 sw_if_index, vnet_sw_interface_flags_t flags)
#define vec_foreach(var, vec)
Vector iterator.
index_t gt_itf
gbp-itf config for this interface
index_t gt_grd
References to the GBP-RD.
u32 gt_bd_rd_id
The BD or RD value (depending on the layer) that the tunnel is bound to.
#define vec_validate_init_empty(V, I, INIT)
Make sure vector is long enough for given index and initialize empty space (no header, unspecified alignment)
u32 flags
buffer flags: VLIB_BUFFER_FREE_LIST_INDEX_MASK: bits used to store free list index, VLIB_BUFFER_IS_TRACED: trace this buffer.
struct vxlan_tunnel_ref_t_ vxlan_tunnel_ref_t
A reference to a VXLAN-GBP tunnel created as a child/dependent tunnel of the tempplate GBP-VXLAN tunn...
void gbp_bridge_domain_unlock(index_t index)
index_t gbp_itf_add_and_lock(u32 sw_if_index, u32 bd_index)
uword * gv_db
DB of added tunnels.
static char * gbp_vxlan_tunnel_layer_strings[]
void vlib_cli_output(vlib_main_t *vm, char *fmt,...)
static uword gbp_vxlan_interface_tx(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *frame)
static vlib_buffer_t * vlib_get_buffer(vlib_main_t *vm, u32 buffer_index)
Translate buffer index into buffer pointer.
void ip6_sw_interface_enable_disable(u32 sw_if_index, u32 is_enable)
VNET_HW_INTERFACE_CLASS(gbp_vxlan_hw_interface_class)
vxlan_tunnel_ref_t * vxlan_tunnel_ref_pool
Pool of child tunnels.
u32 gt_fib_index[FIB_PROTOCOL_IP_MAX]
FIB inidices (if L3)
index_t gbp_route_domain_find_and_lock(u32 rd_id)
void vxlan_gbp_tunnel_lock(u32 sw_if_index)