74 #define _(n,s) [GBP_VXLAN_TUN_##n] = s, 79 #define GBP_VXLAN_TUN_DBG(...) \ 80 vlib_log_debug (gt_logger, __VA_ARGS__); 130 pool_put (vxlan_tunnel_ref_pool, vxr);
135 const ip46_address_t *
src,
const ip46_address_t *
dst)
144 .mode = (GBP_VXLAN_TUN_L2 == gt->
gt_layer ?
155 if (VNET_API_ERROR_TUNNEL_EXIST == rv)
164 ASSERT (~0 != sw_if_index);
196 ofeat = L2OUTPUT_FEAT_GBP_POLICY_MAC;
200 ifeat |= L2INPUT_FEAT_GBP_LEARN;
272 const ip46_address_t *
src,
273 const ip46_address_t *
dst)
321 gt - gbp_vxlan_tunnel_pool);
329 u32 dev_instance = va_arg (*args,
u32);
331 return format (s,
"gbp-vxlan-%d", dev_instance);
346 u32 dev_instance = va_arg (*args,
u32);
351 s =
format (s,
" [%d] gbp-vxlan-tunnel: hw:%d sw:%d vni:%d %U",
355 if (GBP_VXLAN_TUN_L2 == gt->
gt_layer)
360 s =
format (s,
" dependents:");
381 s =
format (s,
"GBP-VXLAN: vni:%d", t->
vni);
418 clib_warning (
"you shouldn't be here, leaking buffers...");
424 .name =
"GBP VXLAN tunnel-template",
462 if (layer == GBP_VXLAN_TUN_L2)
468 return (VNET_API_ERROR_BD_NOT_MODIFIABLE);
477 return (VNET_API_ERROR_NO_SUCH_FIB);
482 pool_get (gbp_vxlan_tunnel_pool, gt);
490 gbp_vxlan_device_class.index,
492 gbp_vxlan_hw_interface_class.index,
503 if (layer == GBP_VXLAN_TUN_L2)
541 rv = VNET_API_ERROR_IF_ALREADY_EXISTS;
567 gt - gbp_vxlan_tunnel_pool);
575 if (GBP_VXLAN_TUN_L2 == gt->
gt_layer)
590 pool_put (gbp_vxlan_tunnel_pool, gt);
593 return VNET_API_ERROR_NO_SUCH_ENTRY;
619 .path =
"show gbp vxlan",
620 .short_help =
"show gbp vxlan\n",
644 .runs_after =
VLIB_INITS(
"punt_init",
"vxlan_gbp_init"),
vlib_log_class_t vlib_log_register_class(char *class, char *subclass)
A real VXLAN-GBP tunnel (from vnet/vxlan-gbp/...)
VNET_DEVICE_CLASS(gbp_vxlan_device_class)
static vlib_punt_hdl_t punt_hdl
handle registered with the ;unt infra
void gbp_route_domain_unlock(index_t index)
#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)
vl_api_wireguard_peer_flags_t flags
clib_error_t * vnet_sw_interface_set_flags(vnet_main_t *vnm, u32 sw_if_index, vnet_sw_interface_flags_t flags)
#define GBP_VXLAN_TUN_DBG(...)
vnet_main_t * vnet_get_main(void)
gbp_itf_hdl_t gbp_itf_l3_add_and_lock(u32 sw_if_index, index_t gri)
#define pool_get_zero(P, E)
Allocate an object E from a pool P and zero it.
#define pool_foreach(VAR, POOL)
Iterate through pool.
u32 gb_vni
The index of the BD's VNI interface on which packets from unkown endpoints arrive.
void gbp_itf_l2_set_output_feature(gbp_itf_hdl_t gh, l2output_feat_masks_t feats)
u8 * format_gbp_vxlan_tx_trace(u8 *s, va_list *args)
ip46_address_t gt_src
The source address to use for child tunnels.
void gbp_itf_unlock(gbp_itf_hdl_t *gh)
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)
int gbp_vxlan_tunnel_add(u32 vni, gbp_vxlan_tunnel_layer_t layer, u32 bd_rd_id, const ip4_address_t *src, u32 *sw_if_indexp)
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).
int vlib_punt_hdl_t
Typedef for a client handle.
void gbp_vxlan_walk(gbp_vxlan_cb_t cb, void *ctx)
vxlan_gbp_main_t vxlan_gbp_main
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)
u32 vnet_register_interface(vnet_main_t *vnm, u32 dev_class_index, u32 dev_instance, u32 hw_class_index, u32 hw_instance)
u8 * format_gbp_vxlan_tunnel(u8 *s, va_list *args)
clib_error_t * vnet_hw_interface_set_flags(vnet_main_t *vnm, u32 hw_if_index, vnet_hw_interface_flags_t flags)
static u8 ip46_address_is_ip4(const ip46_address_t *ip46)
#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
static gbp_vxlan_tunnel_t * gbp_vxlan_tunnel_pool
Pool of template tunnels.
gbp_vxlan_tunnel_layer_t vxr_layer
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 gbp_bridge_domain_unlock(index_t gbdi)
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 VLIB_INIT_FUNCTION(x)
static u8 * format_vxlan_tunnel_ref(u8 *s, va_list *args)
description fragment has unexpected format
#define vec_search(v, E)
Search a vector for the index of the entry that matches.
vlib_punt_hdl_t vlib_punt_client_register(const char *who)
Register a new clinet.
struct gbp_vxlan_tx_trace_t_ gbp_vxlan_tx_trace_t
#define pool_elt_at_index(p, i)
Returns pointer to element at given index.
vlib_punt_reason_t punt_no_such_tunnel[FIB_PROTOCOL_IP_MAX]
Punt reasons for no such tunnel.
walk_rc_t(* gbp_vxlan_cb_t)(gbp_vxlan_tunnel_t *gt, void *ctx)
gbp_itf_hdl_t gbp_itf_l2_add_and_lock_w_free(u32 sw_if_index, index_t gbi, gbp_itf_free_fn_t ff)
#define pool_put(P, E)
Free an object E in pool P.
gbp_itf_hdl_t gt_itf
gbp-itf config for this interface
#define GBP_ITF_L3_FEAT_LEARN
This is the object type deifend above.
#define vec_del1(v, i)
Delete the element at index I.
gbp_itf_hdl_t gbp_vxlan_tunnel_clone_and_lock(u32 sw_if_index, const ip46_address_t *src, const ip46_address_t *dst)
gbp_itf_hdl_t vxlan_gbp_tunnel_lock_itf(u32 sw_if_index)
gbp_bridge_domain_flags_t gb_flags
Flags conttrolling behaviour.
format_function_t format_ip46_address
enum gbp_vxlan_tunnel_layer_t_ gbp_vxlan_tunnel_layer_t
gbp_itf_hdl_t gbp_itf_l3_add_and_lock_w_free(u32 sw_if_index, index_t gri, gbp_itf_free_fn_t ff)
gbp_itf_hdl_t gbp_itf_l2_add_and_lock(u32 sw_if_index, index_t gbi)
#define vec_free(V)
Free vector's memory (no header).
#define clib_warning(format, args...)
int gbp_vxlan_tunnel_del(u32 vni)
static index_t * gbp_vxlan_tunnel_db
DB of template interfaces by SW interface index.
vlib_main_t vlib_node_runtime_t * node
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
void vlib_cli_output(vlib_main_t *vm, char *fmt,...)
void gbp_itf_lock(gbp_itf_hdl_t gh)
u8 * format_gbp_itf_hdl(u8 *s, va_list *args)
static vxlan_tunnel_ref_t * vxlan_tunnel_ref_get(index_t vxri)
void vnet_delete_hw_interface(vnet_main_t *vnm, u32 hw_if_index)
static void gdb_vxlan_dep_del(u32 sw_if_index)
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)
index_t gt_gbd
Reference to the GPB-BD.
static vlib_log_class_t gt_logger
Logger.
void gbp_itf_l3_set_input_feature(gbp_itf_hdl_t gh, gbp_itf_l3_feat_t feats)
int vlib_punt_register(vlib_punt_hdl_t client, vlib_punt_reason_t reason, const char *node_name)
Register a node to receive particular punted buffers.
gbp_vxlan_tunnel_t * gbp_vxlan_tunnel_get(index_t gti)
void gbp_itf_l2_set_input_feature(gbp_itf_hdl_t gh, l2input_feat_masks_t feats)
u32 vxlan_gbp_tunnel_get_parent(u32 sw_if_index)
#define vec_len(v)
Number of elements in vector (rvalue-only, NULL tolerant)
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...
vlib_main_t vlib_node_runtime_t vlib_frame_t * frame
static gbp_itf_hdl_t gdb_vxlan_dep_add(gbp_vxlan_tunnel_t *gt, const ip46_address_t *src, const ip46_address_t *dst)
a point 2 point interface
gbp_vxlan_tunnel_type_t gbp_vxlan_tunnel_get_type(u32 sw_if_index)
GBP VXLAN (template) tunnel.
static const gbp_itf_hdl_t GBP_ITF_HDL_INVALID
static 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...
#define vec_foreach(var, vec)
Vector iterator.
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)
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...
uword * gv_db
DB of added tunnels.
static char * gbp_vxlan_tunnel_layer_strings[]
static uword gbp_vxlan_interface_tx(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *frame)
VNET_HW_INTERFACE_CLASS(gbp_vxlan_hw_interface_class)
vl_api_interface_index_t sw_if_index
static vxlan_tunnel_ref_t * vxlan_tunnel_ref_pool
Pool of child tunnels.
index_t gbp_route_domain_find_and_lock(u32 rd_id)