|
FD.io VPP
v21.06-3-gbb25fbf28
Vector Packet Processing
|
Go to the documentation of this file.
44 #define foreach_lisp_gpe_tx_next \
45 _(DROP, "error-drop") \
46 _(IP4_LOOKUP, "ip4-lookup") \
47 _(IP6_LOOKUP, "ip6-lookup")
51 #define _(sym,str) LISP_GPE_TX_NEXT_##sym,
73 #define is_v4_packet(_h) ((*(u8*) _h) & 0xF0) == 0x40
111 u32 bi0, adj_index0, next0;
145 n_left_to_next, bi0, next0);
157 u32 dev_instance = va_arg (*args,
u32);
158 return format (s,
"lisp_gpe%d", dev_instance);
174 u32 max_header_bytes = va_arg (*args,
u32);
177 header_bytes =
sizeof (
h[0]);
178 if (max_header_bytes != 0 && header_bytes > max_header_bytes)
179 return format (s,
"lisp-gpe header truncated");
181 s =
format (s,
"flags: ");
182 #define _(n,v) if (h->flags & v) s = format (s, "%s ", #n);
186 s =
format (s,
"\n ver_res %d res %d next_protocol %d iid %d(%x)",
187 h->ver_res,
h->res,
h->next_protocol,
188 clib_net_to_host_u32 (
h->iid << 8),
189 clib_net_to_host_u32 (
h->iid << 8));
301 u32 dev_instance = va_arg (*args,
u32);
302 return format (s,
"l2_lisp_gpe%d", dev_instance);
307 .name =
"L2_LISP_GPE",
393 n_left_to_next, bi0, next0);
405 u32 dev_instance = va_arg (*args,
u32);
406 return format (s,
"nsh_lisp_gpe%d", dev_instance);
411 .name =
"NSH_LISP_GPE",
424 u32 hw_if_index = ~0;
439 new_name =
format (0,
"%U", dev_class->format_device_name,
vni);
496 clib_warning (
"No vni associated to interface %d",
hi->sw_if_index);
579 u8 with_default_routes)
603 &lisp_gpe_device_class, l3_ifaces);
607 if (with_default_routes)
616 return (
hi->sw_if_index);
689 &l2_lisp_gpe_device_class, &lgm->
l2_ifaces);
705 return (
hi->sw_if_index);
731 clib_warning (
"The interface for bridge domain %d doesn't exist",
778 &nsh_lisp_gpe_device_class, &lgm->
nsh_ifaces);
786 return (
hi->sw_if_index);
816 u8 vni_is_set = 0, vrf_is_set = 0, bd_index_is_set = 0;
833 else if (
unformat (line_input,
"del"))
847 else if (
unformat (line_input,
"nsh"))
876 if (vrf_is_set && bd_index_is_set)
879 (0,
"Cannot set both vrf and brdige domain index!");
889 if (!vrf_is_set && !bd_index_is_set)
934 .short_help =
"gpe iface add/del vni <vni> vrf <vrf>",
static clib_error_t * lisp_gpe_add_del_iface_command_fn(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
u16 dpoi_next_node
The next VLIB node to follow.
static vnet_hw_interface_t * lisp_gpe_create_iface(lisp_gpe_main_t *lgm, u32 vni, u32 dp_table, vnet_device_class_t *dev_class, tunnel_lookup_t *tuns)
vnet_interface_main_t * im
uword * vni_by_sw_if_index
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
fib_node_index_t fib_table_entry_special_dpo_add(u32 fib_index, const fib_prefix_t *prefix, fib_source_t source, fib_entry_flag_t flags, const dpo_id_t *dpo)
Add a 'special' entry to the FIB that links to the DPO passed A special entry is an entry that the FI...
u8 * format_lisp_gpe_header_with_length(u8 *s, va_list *args)
struct _vnet_device_class vnet_device_class_t
static uword lisp_gpe_interface_tx(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *from_frame)
LISP-GPE interface TX (encap) function.
VNET_DEVICE_CLASS(ethernet_simulated_device_class)
void lisp_gpe_update_adjacency(vnet_main_t *vnm, u32 sw_if_index, adj_index_t ai)
The LISP-GPE interface registered function to update, i.e.
@ VNET_INTERFACE_COUNTER_TX
nat44_ei_hairpin_src_next_t next_index
#define FOR_EACH_FIB_IP_PROTOCOL(_item)
ip4_main_t ip4_main
Global ip4 main structure.
static void lisp_gpe_tenant_del_default_routes(u32 table_id)
static vlib_buffer_t * vlib_get_buffer(vlib_main_t *vm, u32 buffer_index)
Translate buffer index into buffer pointer.
index_t lisp_l2_fib_lookup(lisp_gpe_main_t *lgm, u16 bd_index, u8 src_mac[6], u8 dst_mac[6])
Lookup L2 SD FIB entry.
void ip4_sw_interface_enable_disable(u32 sw_if_index, u32 is_enable)
vlib_main_t vlib_node_runtime_t * node
#define clib_error_return(e, args...)
u32 vnet_lisp_gpe_add_nsh_iface(lisp_gpe_main_t *lgm)
Add LISP-GPE NSH interface.
@ VNET_SW_INTERFACE_FLAG_ADMIN_UP
vlib_main_t * vm
X-connect all packets from the HOST to the PHY.
vnet_hw_interface_class_t lisp_gpe_hw_class
u8 * format_nsh_lisp_gpe_tx_trace(u8 *s, va_list *args)
@ VNET_HW_INTERFACE_FLAG_LINK_UP
static void lisp_gpe_tenant_add_default_routes(u32 table_id)
const dpo_id_t * lisp_cp_dpo_get(dpo_proto_t proto)
vlib_simple_counter_main_t * sw_if_counters
vlib_main_t vlib_node_runtime_t vlib_frame_t * from_frame
@ FIB_ENTRY_FLAG_EXCLUSIVE
void lisp_gpe_del_l3_iface(lisp_gpe_main_t *lgm, u32 vni, u32 table_id)
u32 lisp_gpe_add_l2_iface(lisp_gpe_main_t *lgm, u32 vni, u32 bd_id)
Add/del LISP-GPE L2 interface.
static uword vlib_buffer_length_in_chain(vlib_main_t *vm, vlib_buffer_t *b)
Get length in bytes of the buffer chain.
static uword l2_arc_to_lb
The VLIB node arc/edge from the interface's TX node, to the L2 load-balanceing node.
tunnel_lookup_t nsh_ifaces
#define hash_set(h, key, value)
u32 * fib_index_by_sw_if_index
Table index indexed by software interface.
void fib_table_entry_special_remove(u32 fib_index, const fib_prefix_t *prefix, fib_source_t source)
Remove a 'special' entry from the FIB.
static u8 * format_lisp_gpe_name(u8 *s, va_list *args)
load_balance_main_t load_balance_main
The one instance of load-balance main.
tunnel_lookup_t l3_ifaces
static u8 * format_l2_lisp_gpe_name(u8 *s, va_list *args)
#define vec_len(v)
Number of elements in vector (rvalue-only, NULL tolerant)
#define vec_add1(V, E)
Add 1 element to end of vector (unspecified alignment).
#define foreach_lisp_gpe_tx_next
static vnet_hw_interface_t * vnet_get_hw_interface(vnet_main_t *vnm, u32 hw_if_index)
u32 fib_table_find_or_create_and_lock(fib_protocol_t proto, u32 table_id, fib_source_t src)
Get the index of the FIB for a Table-ID.
static void * vlib_frame_vector_args(vlib_frame_t *f)
Get pointer to frame vector data.
u32 fib_node_index_t
A typedef of a node index.
@ foreach_lisp_gpe_flag_bit
u32 * free_tunnel_hw_if_indices
Free vlib hw_if_indices.
static void vlib_zero_combined_counter(vlib_combined_counter_main_t *cm, u32 index)
Clear a combined counter Clears the set of per-thread counters.
void lisp_gpe_tenant_l2_iface_unlock(u32 vni)
Release the lock held on the tenant's L3 interface.
void lisp_gpe_tenant_l3_iface_unlock(u32 vni)
Release the lock held on the tenant's L3 interface.
lisp_gpe_main_t lisp_gpe_main
LISP-GPE global state.
u8 * lisp_gpe_build_rewrite(vnet_main_t *vnm, u32 sw_if_index, vnet_link_t link_type, const void *dst_address)
vnet_feature_config_main_t * cm
#define vec_validate(V, I)
Make sure vector is long enough for given index (no header, unspecified alignment)
u32 * fib_index_by_sw_if_index
#define VLIB_CLI_COMMAND(x,...)
enum fib_protocol_t_ fib_protocol_t
Protocol Type.
static u32 bd_find_or_add_bd_index(bd_main_t *bdm, u32 bd_id)
Get or create a bridge domain.
clib_error_t * vnet_rename_interface(vnet_main_t *vnm, u32 hw_if_index, char *new_name)
u32 lisp_gpe_add_l3_iface(lisp_gpe_main_t *lgm, u32 vni, u32 table_id, u8 with_default_routes)
Add/del LISP-GPE L3 interface.
@ VNET_INTERFACE_COUNTER_RX
vlib_combined_counter_main_t * combined_sw_if_counters
dpo_proto_t fib_proto_to_dpo(fib_protocol_t fib_proto)
static uword nsh_lisp_gpe_interface_tx(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *from_frame)
LISP-GPE interface TX for NSH overlays.
u8 vnet_lisp_gpe_enable_disable_status(void)
Check if LISP-GPE is enabled.
static vlib_cli_command_t add_del_lisp_gpe_iface_command
(constructor) VLIB_CLI_COMMAND (add_del_lisp_gpe_iface_command)
static uword l2_lisp_gpe_interface_tx(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *from_frame)
LISP-GPE interface TX (encap) function for L2 overlays.
#define vec_free(V)
Free vector's memory (no header).
union ip_adjacency_t_::@144 sub_type
#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.
VNET_HW_INTERFACE_CLASS(ethernet_hw_interface_class)
vlib_combined_counter_main_t lbm_to_counters
static void vnet_interface_counter_unlock(vnet_interface_main_t *im)
u32 bd_find_index(bd_main_t *bdm, u32 bd_id)
Get a bridge domain.
description fragment has unexpected format
A collection of combined counters.
static void vlib_zero_simple_counter(vlib_simple_counter_main_t *cm, u32 index)
Clear a simple counter Clears the set of per-thread u16 counters, and the u64 counter.
vlib_put_next_frame(vm, node, next_index, 0)
static void ip_udp_fixup_one(vlib_main_t *vm, vlib_buffer_t *b0, u8 is_ip4)
static uword vlib_node_add_named_next(vlib_main_t *vm, uword node, char *name)
void ip6_sw_interface_enable_disable(u32 sw_if_index, u32 is_enable)
void lisp_gpe_del_l2_iface(lisp_gpe_main_t *lgm, u32 vni, u32 bd_id)
Add/del LISP-GPE L2 interface.
#define hash_unset(h, key)
u8 * format_lisp_gpe_tx_trace(u8 *s, va_list *args)
vlib_main_t * vlib_main
convenience
static void lisp_gpe_remove_iface(lisp_gpe_main_t *lgm, u32 hi_index, u32 dp_table, tunnel_lookup_t *tuns)
void * vlib_add_trace(vlib_main_t *vm, vlib_node_runtime_t *r, vlib_buffer_t *b, u32 n_data_bytes)
static vlib_main_t * vlib_get_main(void)
Common utility functions for IPv4, IPv6 and L2 LISP-GPE adjacencys.
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_buffer_get_current(vlib_buffer_t *b)
Get pointer to current data to process.
const dpo_id_t * lisp_nsh_fib_lookup(lisp_gpe_main_t *lgm, u32 spi_si_net_order)
Lookup NSH SD FIB entry.
u32 lisp_gpe_tenant_l3_iface_add_or_lock(u32 vni, u32 table_id, u8 with_default_route)
Add/create and lock a new or find and lock the existing L3 interface for the tenant.
void fib_table_unlock(u32 fib_index, fib_protocol_t proto, fib_source_t source)
Take a reference counting lock on the table.
#define clib_warning(format, args...)
u32 lisp_gpe_tenant_l2_iface_add_or_lock(u32 vni, u32 bd_id)
Add/create and lock a new or find and lock the existing L2 interface for the tenant.
The identity of a DPO is a combination of its type and its instance number/index of objects of that t...
uword * sw_if_index_by_vni
lookup decap tunnel termination sw_if_index by vni and vice versa
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 u8 * format_nsh_lisp_gpe_name(u8 *s, va_list *args)
#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).
static void vnet_interface_counter_lock(vnet_interface_main_t *im)
static ip_adjacency_t * adj_get(adj_index_t adj_index)
Get a pointer to an adjacency object from its index.
tunnel_lookup_t l2_ifaces
uword * hw_if_index_by_dp_table
Lookup lisp-gpe interfaces by dp table (eg.
Aggregate type for a prefix.
static u8 * format_l2_lisp_gpe_tx_trace(u8 *s, va_list *args)
@ VNET_INTERFACE_COUNTER_DROP
u32 vnet_register_interface(vnet_main_t *vnm, u32 dev_class_index, u32 dev_instance, u32 hw_class_index, u32 hw_instance)
vnet_interface_main_t interface_main
vlib_increment_combined_counter(ccm, ti, sw_if_index, n_buffers, n_bytes)
u32 flags
buffer flags: VLIB_BUFFER_FREE_LIST_INDEX_MASK: bits used to store free list index,...
void vnet_lisp_gpe_del_nsh_iface(lisp_gpe_main_t *lgm)
Del LISP-GPE NSH interface.
VLIB buffer representation.
struct ip_adjacency_t_::@144::@146 midchain
IP_LOOKUP_NEXT_MIDCHAIN.
static void lisp_gpe_iface_set_table(u32 sw_if_index, u32 table_id)