|
FD.io VPP
v21.06-3-gbb25fbf28
Vector Packet Processing
|
Go to the documentation of this file.
60 "[%d] instance %d src %U dst %U vni %d fib-idx %d"
61 " sw-if-idx %d mode %U ",
79 u32 dev_instance = va_arg (*args,
u32);
83 if (dev_instance == ~0)
84 return format (s,
"<cached-unused>");
87 return format (s,
"<improperly-referenced>");
117 u32 dev_instance = va_arg (*args,
u32);
118 s =
format (s,
"unimplemented dev %u", dev_instance);
152 u32 encap_index = is_ip4 ?
216 #define foreach_copy_field \
219 _(mcast_sw_if_index) \
229 ip4_vxlan_gbp_header_t h4;
230 ip6_vxlan_gbp_header_t h6;
242 udp = &
h.h4.udp, vxlan_gbp = &
h.h4.vxlan_gbp;
243 ip->ip_version_and_header_length = 0x45;
245 ip->protocol = IP_PROTOCOL_UDP;
247 ip->src_address = t->
src.ip4;
248 ip->dst_address = t->
dst.ip4;
256 udp = &
h.h6.udp, vxlan_gbp = &
h.h6.vxlan_gbp;
257 ip->ip_version_traffic_class_and_flow_label =
258 clib_host_to_net_u32 (6 << 28);
260 ip->protocol = IP_PROTOCOL_UDP;
262 ip->src_address = t->
src.ip6;
263 ip->dst_address = t->
dst.ip6;
267 udp->
src_port = clib_host_to_net_u16 (47789);
268 udp->
dst_port = clib_host_to_net_u16 (UDP_DST_PORT_vxlan_gbp);
316 static inline mcast_shared_t
322 mcast_shared_t ret = {.as_u64 = *p };
329 mcast_shared_t new_ep = {
330 .mcast_adj_index = ai,
331 .mfib_entry_index = mfei,
401 a->dst.ip4.as_u32 | (((
u64)
a->src.ip4.as_u32) << 32);
402 key4.
key[1] = (((
u64)
a->encap_fib_index) << 32)
403 | clib_host_to_net_u32 (
a->vni << 8);
411 key6.
key[0] =
a->dst.ip6.as_u64[0];
412 key6.
key[1] =
a->dst.ip6.as_u64[1];
413 key6.
key[2] = (((
u64)
a->encap_fib_index) << 32)
414 | clib_host_to_net_u32 (
a->vni << 8);
435 return VNET_API_ERROR_TUNNEL_EXIST;
439 dev_instance = t - vxm->
tunnels;
442 #define _(x) t->x = a->x;
450 user_instance =
a->instance;
451 if (user_instance == ~0)
452 user_instance = dev_instance;
456 return VNET_API_ERROR_INSTANCE_IN_USE;
483 return VNET_API_ERROR_INVALID_REGISTRATION;
489 (vnm, vxlan_gbp_device_class.index, dev_instance,
490 vxlan_gbp_hw_class.index, dev_instance);
557 .frp_sw_if_index = 0xffffffff,
565 .fp_len = (
is_ip6 ? 128 : 32),
566 .fp_grp_addr = tun_dst_pfx.
fp_addr,
578 path.frp_sw_if_index =
a->mcast_sw_if_index;
591 a->mcast_sw_if_index);
618 return VNET_API_ERROR_NO_SUCH_ENTRY;
673 return VNET_API_ERROR_NO_SUCH_ENTRY;
692 return VNET_API_ERROR_NO_SUCH_ENTRY;
709 u32 *result = va_arg (*args,
u32 *);
710 u32 ipv4_set = va_arg (*args,
int);
717 *result = VXLAN_GBP_INPUT_NEXT_L2_INPUT;
743 u32 encap_fib_index = 0;
745 u32 decap_next_index = VXLAN_GBP_INPUT_NEXT_L2_INPUT;
762 else if (
unformat (line_input,
"src %U",
768 else if (
unformat (line_input,
"dst %U",
774 else if (
unformat (line_input,
"group %U %U",
779 grp_set = dst_set = 1;
788 &decap_next_index, ipv4_set))
805 if (encap_fib_index == ~0)
823 if (ipv4_set && ipv6_set)
829 if (decap_next_index == ~0)
847 u32 tunnel_sw_if_index;
858 case VNET_API_ERROR_TUNNEL_EXIST:
861 case VNET_API_ERROR_NO_SUCH_ENTRY:
864 case VNET_API_ERROR_INSTANCE_IN_USE:
869 (0,
"vnet_vxlan_gbp_tunnel_add_del returned %d",
rv);
901 .path =
"create vxlan-gbp tunnel",
903 "create vxlan-gbp tunnel src <local-vtep-addr>"
904 " {dst <remote-vtep-addr>|group <mcast-vtep-addr> <intf-name>} vni <nn>"
906 " [encap-vrf-id <nn>] [decap-next [l2|node <name>]] [del]",
963 .path =
"show vxlan-gbp tunnel",
964 .short_help =
"show vxlan-gbp tunnel [raw]",
1002 else if (
unformat (line_input,
"del"))
1077 .path =
"set interface ip vxlan-gbp-bypass",
1079 .short_help =
"set interface ip vxlan-gbp-bypass <interface> [del]",
1134 .path =
"set interface ip6 vxlan-gbp-bypass",
1136 .short_help =
"set interface ip6 vxlan-gbp-bypass <interface> [del]",
1140 #define VXLAN_GBP_HASH_NUM_BUCKETS (2 * 1024)
1141 #define VXLAN_GBP_HASH_MEMORY_SIZE (1 << 20)
1160 sizeof (ip46_address_t),
1161 sizeof (mcast_shared_t));
1169 VNET_PUNT_REASON_F_IP4_PACKET,
1173 VNET_PUNT_REASON_F_IP6_PACKET,
void vnet_int_vxlan_gbp_bypass_mode(u32 sw_if_index, u8 is_ip6, u8 is_enable)
static vxlan_gbp_tunnel_t * vxlan_gbp_tunnel_from_fib_node(fib_node_t *node)
u32 sibling_index
The tunnel is a child of the FIB entry for its destination.
static fib_node_back_walk_rc_t vxlan_gbp_tunnel_back_walk(fib_node_t *node, fib_node_back_walk_ctx_t *ctx)
Function definition to backwalk a FIB node - Here we will restack the new dpo of VXLAN DIP to encap n...
#define vnet_rewrite_set_data(rw, data, data_bytes)
u16 lb_n_buckets
number of buckets in the load-balance.
clib_error_t * vnet_sw_interface_set_flags(vnet_main_t *vnm, u32 sw_if_index, vnet_sw_interface_flags_t flags)
index_t dpoi_index
the index of objects of that type
#define DPO_INVALID
An initialiser for DPOs declared on the stack.
u8 * format_vxlan_gbp_encap_trace(u8 *s, va_list *args)
const char *const const char *const raw
const static fib_node_vft_t vxlan_gbp_vft
static fib_protocol_t fib_ip_proto(bool is_ip6)
Convert from boolean is_ip6 to FIB protocol.
enum fib_node_back_walk_rc_t_ fib_node_back_walk_rc_t
Return code from a back walk function.
static uword vlib_node_add_next(vlib_main_t *vm, uword node, uword next_node)
static void vxlan_gbp_rewrite(vxlan_gbp_tunnel_t *t, bool is_ip6)
u8 * format_vnet_punt_reason_flags(u8 *s, va_list *args)
const ip46_address_t zero_addr
#include <vnet/feature/feature.h>
static uword ip46_address_is_multicast(const ip46_address_t *a)
vxlan_gbp_tunnel_t * tunnels
dpo_type_t dpoi_type
the type
VNET_DEVICE_CLASS(vxlan_gbp_device_class, static)
void ip4_sw_interface_enable_disable(u32 sw_if_index, u32 is_enable)
#define ip46_address_initializer
#define pool_elt_at_index(p, i)
Returns pointer to element at given index.
void fib_entry_untrack(fib_node_index_t fei, u32 sibling)
Stop tracking a FIB entry.
@ VXLAN_GBP_TUNNEL_MODE_L2
#define pool_get_aligned(P, E, A)
Allocate an object E from a pool P with alignment A.
Aggregate type for a prefix.
fib_node_index_t fib_entry_index
adj_index_t adj_mcast_add_or_lock(fib_protocol_t proto, vnet_link_t link_type, u32 sw_if_index)
Mcast Adjacency.
static clib_error_t * set_ip4_vxlan_gbp_bypass(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
vlib_main_t vlib_node_runtime_t * node
static int ip46_address_cmp(const ip46_address_t *ip46_1, const ip46_address_t *ip46_2)
A FIB graph nodes virtual function table.
void mfib_table_entry_delete_index(fib_node_index_t mfib_entry_index, mfib_source_t source)
Delete a FIB entry.
static u8 ip46_address_is_ip4(const ip46_address_t *ip46)
#define clib_error_return(e, args...)
static clib_error_t * set_ip_vxlan_gbp_bypass(u32 is_ip6, unformat_input_t *input, vlib_cli_command_t *cmd)
static void mcast_shared_remove(ip46_address_t *dst)
static clib_error_t * show_vxlan_gbp_tunnel_command_fn(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
static void mcast_shared_add(ip46_address_t *dst, fib_node_index_t mfei, adj_index_t ai)
void adj_unlock(adj_index_t adj_index)
Release a reference counting lock on the adjacency.
vl_api_tunnel_mode_t mode
int vnet_vxlan_gbp_tunnel_del(u32 sw_if_index)
u8 * format_vxlan_gbp_tunnel_mode(u8 *s, va_list *args)
@ VNET_SW_INTERFACE_FLAG_ADMIN_UP
#define pool_put(P, E)
Free an object E in pool P.
static vlib_punt_hdl_t punt_hdl
vlib_main_t * vm
X-connect all packets from the HOST to the PHY.
static vnet_sw_interface_t * vnet_get_sw_interface(vnet_main_t *vnm, u32 sw_if_index)
@ VNET_HW_INTERFACE_FLAG_LINK_UP
void fib_prefix_from_ip46_addr(const ip46_address_t *addr, fib_prefix_t *pfx)
Host prefix from ip.
enum vxlan_gbp_tunnel_mode_t_ vxlan_gbp_tunnel_mode_t
@ VXLAN_GBP_TUNNEL_MODE_L3
void fib_entry_contribute_forwarding(fib_node_index_t fib_entry_index, fib_forward_chain_type_t fct, dpo_id_t *dpo)
vnet_sw_interface_flags_t flags
@ VNET_FLOOD_CLASS_TUNNEL_NORMAL
static clib_error_t * vxlan_gbp_tunnel_add_del_command_fn(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
#define hash_set(h, key, value)
@ FIB_FORW_CHAIN_TYPE_UNICAST_IP4
Contribute an object that is to be used to forward IP4 packets.
void vnet_set_interface_output_node(vnet_main_t *vnm, u32 hw_if_index, u32 node_index)
Set interface output node - for interface registered without its output/tx nodes created because its ...
fib_node_index_t fib_entry_track(u32 fib_index, const fib_prefix_t *prefix, fib_node_type_t child_type, index_t child_index, u32 *sibling)
Trackers are used on FIB entries by objects that which to track the changing state of the entry.
#define STRUCT_OFFSET_OF(t, f)
#define pool_foreach(VAR, POOL)
Iterate through pool.
#define vec_len(v)
Number of elements in vector (rvalue-only, NULL tolerant)
static mcast_shared_t mcast_shared_get(ip46_address_t *ip)
static u8 * format_vxlan_gbp_name(u8 *s, va_list *args)
vxlan_gbp_tunnel_mode_t mode
Tunnel mode.
clib_error_t * vxlan_gbp_init(vlib_main_t *vm)
enum fib_forward_chain_type_t_ fib_forward_chain_type_t
FIB output chain type.
static clib_error_t * set_ip6_vxlan_gbp_bypass(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
#define foreach_copy_field
static vnet_hw_interface_t * vnet_get_hw_interface(vnet_main_t *vnm, u32 hw_if_index)
vnet_main_t * vnet_get_main(void)
vlib_node_registration_t vxlan6_gbp_encap_node
(constructor) VLIB_REGISTER_NODE (vxlan6_gbp_encap_node)
unformat_function_t unformat_vlib_node
static void vxlan_gbp_tunnel_last_lock_gone(fib_node_t *node)
Function definition to inform the FIB node that its last lock has gone.
void vxlan_gbp_unregister_udp_ports(void)
static uword vtep_addr_unref(ip46_address_t *ip)
clib_bihash_24_8_t vxlan6_gbp_tunnel_by_key
vnet_flood_class_t flood_class
u32 fib_node_index_t
A typedef of a node index.
void vnet_delete_hw_interface(vnet_main_t *vnm, u32 hw_if_index)
static void hash_unset_mem_free(uword **h, const void *key)
#define hash_create_mem(elts, key_bytes, value_bytes)
void udp_register_dst_port(vlib_main_t *vm, udp_dst_port_t dst_port, u32 node_index, u8 is_ip4)
static const dpo_id_t * load_balance_get_bucket_i(const load_balance_t *lb, u32 bucket)
vnet_link_t fib_proto_to_link(fib_protocol_t proto)
Convert from a protocol to a link type.
vlib_node_registration_t vxlan4_gbp_input_node
(constructor) VLIB_REGISTER_NODE (vxlan4_gbp_input_node)
void udp_unregister_dst_port(vlib_main_t *vm, udp_dst_port_t dst_port, u8 is_ip4)
static void hash_set_mem_alloc(uword **h, const void *key, uword v)
#define vec_validate(V, I)
Make sure vector is long enough for given index (no header, unspecified alignment)
#define VLIB_CLI_COMMAND(x,...)
void dpo_stack_from_node(u32 child_node_index, dpo_id_t *dpo, const dpo_id_t *parent)
Stack one DPO object on another, and thus establish a child parent relationship.
enum fib_protocol_t_ fib_protocol_t
Protocol Type.
u8 * format_vxlan_gbp_tunnel(u8 *s, va_list *args)
#define ALWAYS_ASSERT(truth)
void fib_node_register_type(fib_node_type_t type, const fib_node_vft_t *vft)
fib_node_register_type
#define VXLAN_GBP_HASH_NUM_BUCKETS
#define CLIB_CACHE_LINE_BYTES
fib_protocol_t fp_proto
protocol type
@ FIB_NODE_BACK_WALK_CONTINUE
void vlib_cli_output(vlib_main_t *vm, char *fmt,...)
dpo_proto_t fib_proto_to_dpo(fib_protocol_t fib_proto)
ip46_address_t fp_addr
The address type is not deriveable from the fp_addr member.
fib_node_t node
Linkage into the FIB object graph.
static fib_node_t * vxlan_gbp_tunnel_fib_node_get(fib_node_index_t index)
Function definition to get a FIB node from its index.
static vlib_cli_command_t show_vxlan_gbp_tunnel_command
(constructor) VLIB_CLI_COMMAND (show_vxlan_gbp_tunnel_command)
vl_api_interface_index_t mcast_sw_if_index
static void vxlan_gbp_set_header(vxlan_gbp_header_t *h, u32 vni)
static vlib_cli_command_t create_vxlan_gbp_tunnel_command
(constructor) VLIB_CLI_COMMAND (create_vxlan_gbp_tunnel_command)
void vxlan_gbp_register_udp_ports(void)
@ DPO_LOAD_BALANCE
load-balancing over a choice of [un]equal cost paths
int vlib_punt_reason_alloc(vlib_punt_hdl_t client, const char *reason_name, punt_interested_listener_t fn, void *data, vlib_punt_reason_t *reason, u32 flags, format_function_t *flags_format)
Allocate a new punt reason.
static vlib_cli_command_t set_interface_ip6_vxlan_gbp_bypass_command
(constructor) VLIB_CLI_COMMAND (set_interface_ip6_vxlan_gbp_bypass_command)
void dpo_copy(dpo_id_t *dst, const dpo_id_t *src)
atomic copy a data-plane object.
Definitions for punt infrastructure.
#define hash_get_mem(h, key)
format_function_t format_vnet_sw_if_index_name
unformat_function_t unformat_vnet_sw_interface
description fragment has unexpected format
vlib_node_registration_t vxlan6_gbp_input_node
(constructor) VLIB_REGISTER_NODE (vxlan6_gbp_input_node)
static vlib_cli_command_t set_interface_ip_vxlan_gbp_bypass_command
(constructor) VLIB_CLI_COMMAND (set_interface_ip_vxlan_gbp_bypass_command)
#define vec_validate_init_empty(V, I, INIT)
Make sure vector is long enough for given index and initialize empty space (no header,...
format_function_t format_ip46_address
@ FIB_ROUTE_PATH_FLAG_NONE
#define VLIB_INIT_FUNCTION(x)
u32 * tunnel_index_by_sw_if_index
@ FIB_NODE_TYPE_VXLAN_GBP_TUNNEL
clib_bihash_16_8_t vxlan4_gbp_tunnel_by_key
A representation of a path as described by a route producer.
static load_balance_t * load_balance_get(index_t lbi)
void ip6_sw_interface_enable_disable(u32 sw_if_index, u32 is_enable)
static uword pool_elts(void *v)
Number of active elements in a pool.
int vlib_punt_hdl_t
Typedef for a client handle.
int vnet_vxlan_gbp_tunnel_add_del(vnet_vxlan_gbp_tunnel_add_del_args_t *a, u32 *sw_if_indexp)
vlib_node_registration_t vxlan4_gbp_encap_node
(constructor) VLIB_REGISTER_NODE (vxlan4_gbp_encap_node)
static uword get_decap_next_for_node(u32 node_index, u32 ipv4_set)
int vnet_feature_enable_disable(const char *arc_name, const char *node_name, u32 sw_if_index, int enable_disable, void *feature_config, u32 n_feature_config_bytes)
An node in the FIB graph.
#define hash_unset(h, key)
vlib_punt_reason_t punt_no_such_tunnel[FIB_PROTOCOL_IP_MAX]
Punt reasons for no such tunnel.
#define VXLAN_GBP_HASH_MEMORY_SIZE
u32 adj_index_t
An index for adjacencies.
static uword unformat_decap_next(unformat_input_t *input, va_list *args)
clib_memset(h->entries, 0, sizeof(h->entries[0]) *entries)
@ VNET_SW_INTERFACE_FLAG_HIDDEN
void fib_node_init(fib_node_t *node, fib_node_type_t type)
static u8 * format_vxlan_gbp_header_with_length(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 u16 ip4_header_checksum(ip4_header_t *i)
clib_error_t *() vlib_init_function_t(struct vlib_main_t *vm)
fib_node_index_t mfib_table_entry_path_update(u32 fib_index, const mfib_prefix_t *prefix, mfib_source_t source, const fib_route_path_t *rpath)
Add n paths to an entry (aka route) in the FIB.
static uword vtep_addr_ref(ip46_address_t *ip)
u8 * default_build_rewrite(vnet_main_t *vnm, u32 sw_if_index, vnet_link_t link_type, const void *dst_address)
Return a complete, zero-length (aka placeholder) rewrite.
Context passed between object during a back walk.
@ VNET_FLOOD_CLASS_TUNNEL_MASTER
The identity of a DPO is a combination of its type and its instance number/index of objects of that t...
void fib_node_deinit(fib_node_t *node)
VNET_HW_INTERFACE_CLASS(vxlan_gbp_hw_class)
@ FIB_FORW_CHAIN_TYPE_UNICAST_IP6
Contribute an object that is to be used to forward IP6 packets.
void dpo_set(dpo_id_t *dpo, dpo_type_t type, dpo_proto_t proto, index_t index)
Set/create a DPO ID The DPO will be locked.
l2_input_config_t * configs
vlib_punt_hdl_t vlib_punt_client_register(const char *who)
Register a new clinet.
u32 fib_table_find(fib_protocol_t proto, u32 table_id)
Get the index of the FIB for a Table-ID.
vl_api_interface_index_t sw_if_index
static clib_error_t * vxlan_gbp_interface_admin_up_down(vnet_main_t *vnm, u32 hw_if_index, u32 flags)
void dpo_reset(dpo_id_t *dpo)
reset a DPO ID The DPO will be unlocked.
vxlan_gbp_main_t vxlan_gbp_main
Aggregate type for a prefix.
typedef CLIB_PACKED(union { struct { fib_node_index_t mfib_entry_index;adj_index_t mcast_adj_index;};u64 as_u64;})
@ FIB_ROUTE_PATH_LOCAL
A for-us/local path.
u32 vnet_register_interface(vnet_main_t *vnm, u32 dev_class_index, u32 dev_instance, u32 hw_class_index, u32 hw_instance)
static void vxlan_gbp_tunnel_restack_dpo(vxlan_gbp_tunnel_t *t)
vl_api_wireguard_peer_flags_t flags