FD.io VPP  v21.06-1-gbb7418cf9
Vector Packet Processing
vxlan.c File Reference

VXLAN. More...

+ Include dependency graph for vxlan.c:

Go to the source code of this file.

Macros

#define foreach_copy_field
 
#define VXLAN_HASH_NUM_BUCKETS   (2 * 1024)
 
#define VXLAN_HASH_MEMORY_SIZE   (1 << 20)
 

Functions

static u32 vxlan_eth_flag_change (vnet_main_t *vnm, vnet_hw_interface_t *hi, u32 flags)
 
static u8format_decap_next (u8 *s, va_list *args)
 
u8format_vxlan_tunnel (u8 *s, va_list *args)
 
static u8format_vxlan_name (u8 *s, va_list *args)
 
static clib_error_tvxlan_interface_admin_up_down (vnet_main_t *vnm, u32 hw_if_index, u32 flags)
 
 VNET_DEVICE_CLASS (vxlan_device_class, static)
 
static u8format_vxlan_header_with_length (u8 *s, va_list *args)
 
 VNET_HW_INTERFACE_CLASS (vxlan_hw_class)
 
static void vxlan_tunnel_restack_dpo (vxlan_tunnel_t *t)
 
static vxlan_tunnel_tvxlan_tunnel_from_fib_node (fib_node_t *node)
 
static fib_node_back_walk_rc_t vxlan_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 node. More...
 
static fib_node_tvxlan_tunnel_fib_node_get (fib_node_index_t index)
 Function definition to get a FIB node from its index. More...
 
static void vxlan_tunnel_last_lock_gone (fib_node_t *node)
 Function definition to inform the FIB node that its last lock has gone. More...
 
static void vxlan_rewrite (vxlan_tunnel_t *t, bool is_ip6)
 
static bool vxlan_decap_next_is_valid (vxlan_main_t *vxm, u32 is_ip6, u32 decap_next_index)
 
typedef CLIB_PACKED (union { struct { fib_node_index_t mfib_entry_index;adj_index_t mcast_adj_index;};u64 as_u64;})
 
static void mcast_shared_add (ip46_address_t *dst, fib_node_index_t mfei, adj_index_t ai)
 
static void mcast_shared_remove (ip46_address_t *dst)
 
int vnet_vxlan_add_del_tunnel (vnet_vxlan_add_del_tunnel_args_t *a, u32 *sw_if_indexp)
 
static uword get_decap_next_for_node (u32 node_index, u32 ipv4_set)
 
static uword unformat_decap_next (unformat_input_t *input, va_list *args)
 
static clib_error_tvxlan_add_del_tunnel_command_fn (vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
 
static clib_error_tshow_vxlan_tunnel_command_fn (vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
 
void vnet_int_vxlan_bypass_mode (u32 sw_if_index, u8 is_ip6, u8 is_enable)
 
static clib_error_tset_ip_vxlan_bypass (u32 is_ip6, unformat_input_t *input, vlib_cli_command_t *cmd)
 
static clib_error_tset_ip4_vxlan_bypass (vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
 
static clib_error_tset_ip6_vxlan_bypass (vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
 
int vnet_vxlan_add_del_rx_flow (u32 hw_if_index, u32 t_index, int is_add)
 
u32 vnet_vxlan_get_tunnel_index (u32 sw_if_index)
 
static clib_error_tvxlan_offload_command_fn (vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
 
clib_error_tvxlan_init (vlib_main_t *vm)
 

Variables

vxlan_main_t vxlan_main
 
static const fib_node_vft_t vxlan_vft
 
static vlib_cli_command_t create_vxlan_tunnel_command
 (constructor) VLIB_CLI_COMMAND (create_vxlan_tunnel_command) More...
 
static vlib_cli_command_t show_vxlan_tunnel_command
 (constructor) VLIB_CLI_COMMAND (show_vxlan_tunnel_command) More...
 
static vlib_cli_command_t set_interface_ip_vxlan_bypass_command
 (constructor) VLIB_CLI_COMMAND (set_interface_ip_vxlan_bypass_command) More...
 
static vlib_cli_command_t set_interface_ip6_vxlan_bypass_command
 (constructor) VLIB_CLI_COMMAND (set_interface_ip6_vxlan_bypass_command) More...
 
static vlib_cli_command_t vxlan_offload_command
 (constructor) VLIB_CLI_COMMAND (vxlan_offload_command) More...
 

Detailed Description

VXLAN.

VXLAN provides the features needed to allow L2 bridge domains (BDs) to span multiple servers. This is done by building an L2 overlay on top of an L3 network underlay using VXLAN tunnels.

This makes it possible for servers to be co-located in the same data center or be separated geographically as long as they are reachable through the underlay L3 network.

You can refer to this kind of L2 overlay bridge domain as a VXLAN (Virtual eXtensible VLAN) segment.

Definition in file vxlan.c.

Macro Definition Documentation

◆ foreach_copy_field

#define foreach_copy_field
Value:
_ (vni) \
_ (encap_fib_index) \
_ (decap_next_index) \
_ (src) \
_ (dst) \
_ (src_port) \
u32 vni
Definition: flow_types.api:160
vl_api_ip_port_and_mask_t dst_port
Definition: flow_types.api:92
vl_api_address_t src
Definition: gre.api:54
vl_api_interface_index_t mcast_sw_if_index
Definition: vxlan_gbp.api:41
vl_api_ip_port_and_mask_t src_port
Definition: flow_types.api:91
vl_api_ip4_address_t dst
Definition: pnat.api:41

Definition at line 240 of file vxlan.c.

◆ VXLAN_HASH_MEMORY_SIZE

#define VXLAN_HASH_MEMORY_SIZE   (1 << 20)

Definition at line 1303 of file vxlan.c.

◆ VXLAN_HASH_NUM_BUCKETS

#define VXLAN_HASH_NUM_BUCKETS   (2 * 1024)

Definition at line 1302 of file vxlan.c.

Function Documentation

◆ CLIB_PACKED()

typedef CLIB_PACKED ( union { struct { fib_node_index_t mfib_entry_index;adj_index_t mcast_adj_index;};u64 as_u64;}  )

Definition at line 314 of file vxlan.c.

+ Here is the call graph for this function:

◆ format_decap_next()

static u8* format_decap_next ( u8 s,
va_list *  args 
)
static

Definition at line 56 of file vxlan.c.

+ Here is the caller graph for this function:

◆ format_vxlan_header_with_length()

static u8* format_vxlan_header_with_length ( u8 s,
va_list *  args 
)
static

Definition at line 133 of file vxlan.c.

+ Here is the call graph for this function:

◆ format_vxlan_name()

static u8* format_vxlan_name ( u8 s,
va_list *  args 
)
static

Definition at line 96 of file vxlan.c.

+ Here is the caller graph for this function:

◆ format_vxlan_tunnel()

u8* format_vxlan_tunnel ( u8 s,
va_list *  args 
)

Definition at line 68 of file vxlan.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ get_decap_next_for_node()

static uword get_decap_next_for_node ( u32  node_index,
u32  ipv4_set 
)
static

Definition at line 687 of file vxlan.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ mcast_shared_add()

static void mcast_shared_add ( ip46_address_t *  dst,
fib_node_index_t  mfei,
adj_index_t  ai 
)
inlinestatic

Definition at line 336 of file vxlan.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ mcast_shared_remove()

static void mcast_shared_remove ( ip46_address_t *  dst)
inlinestatic

Definition at line 347 of file vxlan.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ set_ip4_vxlan_bypass()

static clib_error_t* set_ip4_vxlan_bypass ( vlib_main_t vm,
unformat_input_t input,
vlib_cli_command_t cmd 
)
static

Definition at line 1067 of file vxlan.c.

+ Here is the call graph for this function:

◆ set_ip6_vxlan_bypass()

static clib_error_t* set_ip6_vxlan_bypass ( vlib_main_t vm,
unformat_input_t input,
vlib_cli_command_t cmd 
)
static

Definition at line 1124 of file vxlan.c.

+ Here is the call graph for this function:

◆ set_ip_vxlan_bypass()

static clib_error_t* set_ip_vxlan_bypass ( u32  is_ip6,
unformat_input_t input,
vlib_cli_command_t cmd 
)
static

Definition at line 1023 of file vxlan.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ show_vxlan_tunnel_command_fn()

static clib_error_t* show_vxlan_tunnel_command_fn ( vlib_main_t vm,
unformat_input_t input,
vlib_cli_command_t cmd 
)
static

Definition at line 925 of file vxlan.c.

+ Here is the call graph for this function:

◆ unformat_decap_next()

static uword unformat_decap_next ( unformat_input_t input,
va_list *  args 
)
static

Definition at line 698 of file vxlan.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ VNET_DEVICE_CLASS()

VNET_DEVICE_CLASS ( vxlan_device_class  ,
static   
)
+ Here is the caller graph for this function:

◆ VNET_HW_INTERFACE_CLASS()

VNET_HW_INTERFACE_CLASS ( vxlan_hw_class  )
+ Here is the caller graph for this function:

◆ vnet_int_vxlan_bypass_mode()

void vnet_int_vxlan_bypass_mode ( u32  sw_if_index,
u8  is_ip6,
u8  is_enable 
)

Definition at line 985 of file vxlan.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ vnet_vxlan_add_del_rx_flow()

int vnet_vxlan_add_del_rx_flow ( u32  hw_if_index,
u32  t_index,
int  is_add 
)

Definition at line 1181 of file vxlan.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ vnet_vxlan_add_del_tunnel()

int vnet_vxlan_add_del_tunnel ( vnet_vxlan_add_del_tunnel_args_t a,
u32 sw_if_indexp 
)

Definition at line 358 of file vxlan.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ vnet_vxlan_get_tunnel_index()

u32 vnet_vxlan_get_tunnel_index ( u32  sw_if_index)

Definition at line 1220 of file vxlan.c.

+ Here is the caller graph for this function:

◆ vxlan_add_del_tunnel_command_fn()

static clib_error_t* vxlan_add_del_tunnel_command_fn ( vlib_main_t vm,
unformat_input_t input,
vlib_cli_command_t cmd 
)
static

Definition at line 719 of file vxlan.c.

+ Here is the call graph for this function:

◆ vxlan_decap_next_is_valid()

static bool vxlan_decap_next_is_valid ( vxlan_main_t vxm,
u32  is_ip6,
u32  decap_next_index 
)
static

Definition at line 302 of file vxlan.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ vxlan_eth_flag_change()

static u32 vxlan_eth_flag_change ( vnet_main_t vnm,
vnet_hw_interface_t hi,
u32  flags 
)
static

Definition at line 49 of file vxlan.c.

+ Here is the caller graph for this function:

◆ vxlan_init()

clib_error_t* vxlan_init ( vlib_main_t vm)

Definition at line 1306 of file vxlan.c.

+ Here is the call graph for this function:

◆ vxlan_interface_admin_up_down()

static clib_error_t* vxlan_interface_admin_up_down ( vnet_main_t vnm,
u32  hw_if_index,
u32  flags 
)
static

Definition at line 114 of file vxlan.c.

+ Here is the call graph for this function:

◆ vxlan_offload_command_fn()

static clib_error_t* vxlan_offload_command_fn ( vlib_main_t vm,
unformat_input_t input,
vlib_cli_command_t cmd 
)
static

Definition at line 1230 of file vxlan.c.

+ Here is the call graph for this function:

◆ vxlan_rewrite()

static void vxlan_rewrite ( vxlan_tunnel_t t,
bool  is_ip6 
)
static

Definition at line 251 of file vxlan.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ vxlan_tunnel_back_walk()

static fib_node_back_walk_rc_t vxlan_tunnel_back_walk ( fib_node_t node,
fib_node_back_walk_ctx_t ctx 
)
static

Function definition to backwalk a FIB node - Here we will restack the new dpo of VXLAN DIP to encap node.

Definition at line 197 of file vxlan.c.

+ Here is the call graph for this function:

◆ vxlan_tunnel_fib_node_get()

static fib_node_t* vxlan_tunnel_fib_node_get ( fib_node_index_t  index)
static

Function definition to get a FIB node from its index.

Definition at line 207 of file vxlan.c.

◆ vxlan_tunnel_from_fib_node()

static vxlan_tunnel_t* vxlan_tunnel_from_fib_node ( fib_node_t node)
static

Definition at line 185 of file vxlan.c.

+ Here is the caller graph for this function:

◆ vxlan_tunnel_last_lock_gone()

static void vxlan_tunnel_last_lock_gone ( fib_node_t node)
static

Function definition to inform the FIB node that its last lock has gone.

Definition at line 221 of file vxlan.c.

◆ vxlan_tunnel_restack_dpo()

static void vxlan_tunnel_restack_dpo ( vxlan_tunnel_t t)
static

Definition at line 149 of file vxlan.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Variable Documentation

◆ create_vxlan_tunnel_command

vlib_cli_command_t create_vxlan_tunnel_command
static
Initial value:
= {
.path = "create vxlan tunnel",
.short_help =
"create vxlan tunnel src <local-vtep-addr>"
" {dst <remote-vtep-addr>|group <mcast-vtep-addr> <intf-name>} vni <nn>"
" [instance <id>]"
" [encap-vrf-id <nn>] [decap-next [l2|node <name>]] [del] [l3]"
" [src_port <local-vtep-udp-port>] [dst_port <remote-vtep-udp-port>]",
}
static clib_error_t * vxlan_add_del_tunnel_command_fn(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
Definition: vxlan.c:719

(constructor) VLIB_CLI_COMMAND (create_vxlan_tunnel_command)

Definition at line 912 of file vxlan.c.

◆ set_interface_ip6_vxlan_bypass_command

vlib_cli_command_t set_interface_ip6_vxlan_bypass_command
static
Initial value:
= {
.path = "set interface ip6 vxlan-bypass",
.function = set_ip6_vxlan_bypass,
.short_help = "set interface ip6 vxlan-bypass <interface> [del]",
}
static clib_error_t * set_ip6_vxlan_bypass(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
Definition: vxlan.c:1124

(constructor) VLIB_CLI_COMMAND (set_interface_ip6_vxlan_bypass_command)

Definition at line 1173 of file vxlan.c.

◆ set_interface_ip_vxlan_bypass_command

vlib_cli_command_t set_interface_ip_vxlan_bypass_command
static
Initial value:
= {
.path = "set interface ip vxlan-bypass",
.function = set_ip4_vxlan_bypass,
.short_help = "set interface ip vxlan-bypass <interface> [del]",
}
static clib_error_t * set_ip4_vxlan_bypass(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
Definition: vxlan.c:1067

(constructor) VLIB_CLI_COMMAND (set_interface_ip_vxlan_bypass_command)

Definition at line 1116 of file vxlan.c.

◆ show_vxlan_tunnel_command

vlib_cli_command_t show_vxlan_tunnel_command
static
Initial value:
= {
.path = "show vxlan tunnel",
.short_help = "show vxlan tunnel [raw]",
}
static clib_error_t * show_vxlan_tunnel_command_fn(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
Definition: vxlan.c:925

(constructor) VLIB_CLI_COMMAND (show_vxlan_tunnel_command)

Definition at line 976 of file vxlan.c.

◆ vxlan_main

vxlan_main_t vxlan_main

Definition at line 46 of file vxlan.c.

◆ vxlan_offload_command

vlib_cli_command_t vxlan_offload_command
static
Initial value:
= {
.path = "set flow-offload vxlan",
.short_help =
"set flow-offload vxlan hw <interface-name> rx <tunnel-name> [del]",
}
static clib_error_t * vxlan_offload_command_fn(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
Definition: vxlan.c:1230

(constructor) VLIB_CLI_COMMAND (vxlan_offload_command)

Definition at line 1294 of file vxlan.c.

◆ vxlan_vft

const fib_node_vft_t vxlan_vft
static
Initial value:
= {
.fnv_last_lock = vxlan_tunnel_last_lock_gone,
.fnv_back_walk = vxlan_tunnel_back_walk,
}
static fib_node_back_walk_rc_t vxlan_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...
Definition: vxlan.c:197
static void vxlan_tunnel_last_lock_gone(fib_node_t *node)
Function definition to inform the FIB node that its last lock has gone.
Definition: vxlan.c:221
static fib_node_t * vxlan_tunnel_fib_node_get(fib_node_index_t index)
Function definition to get a FIB node from its index.
Definition: vxlan.c:207

Definition at line 234 of file vxlan.c.