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 95 u32 n_left_from, next_index, *from, *to_next;
103 while (n_left_from > 0)
109 while (n_left_from > 0 && n_left_to_next > 0)
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)",
188 clib_net_to_host_u32 (h->
iid << 8),
189 clib_net_to_host_u32 (h->
iid << 8));
240 u32 n_left_from, next_index, *from, *to_next;
250 while (n_left_from > 0)
256 while (n_left_from > 0 && n_left_to_next > 0)
301 u32 dev_instance = va_arg (*args,
u32);
302 return format (s,
"l2_lisp_gpe%d", dev_instance);
307 .name =
"L2_LISP_GPE",
346 u32 n_left_from, next_index, *from, *to_next;
354 while (n_left_from > 0)
360 while (n_left_from > 0 && n_left_to_next > 0)
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);
579 u8 with_default_routes)
590 clib_warning (
"vrf %d already mapped to a vni", table_id);
598 clib_warning (
"Interface for vni %d already exists", vni);
603 &lisp_gpe_device_class, l3_ifaces);
607 if (with_default_routes)
631 clib_warning (
"The interface for vrf %d doesn't exist", table_id);
667 clib_warning (
"bridge domain ID %d exceed 16M limit", bd_id);
676 clib_warning (
"bridge domain %d already mapped to a vni", bd_id);
683 clib_warning (
"Interface for vni %d already exists", vni);
689 &l2_lisp_gpe_device_class, &lgm->
l2_ifaces);
731 clib_warning (
"The interface for bridge domain %d doesn't exist",
778 &nsh_lisp_gpe_device_class, &lgm->
nsh_ifaces);
816 u8 vni_is_set = 0, vrf_is_set = 0, bd_index_is_set = 0;
833 else if (
unformat (line_input,
"del"))
835 else if (
unformat (line_input,
"vrf %d", &table_id))
839 else if (
unformat (line_input,
"vni %d", &vni))
843 else if (
unformat (line_input,
"bd %d", &bd_id))
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>",
void lisp_gpe_tenant_l2_iface_unlock(u32 vni)
Release the lock held on the tenant's L3 interface.
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.
#define vec_validate(V, I)
Make sure vector is long enough for given index (no header, unspecified alignment) ...
fib_protocol_t fp_proto
protocol type
u32 * free_tunnel_hw_if_indices
Free vlib hw_if_indices.
vlib_combined_counter_main_t lbm_to_counters
#define hash_set(h, key, value)
#define hash_unset(h, key)
u32 lisp_gpe_add_l2_iface(lisp_gpe_main_t *lgm, u32 vni, u32 bd_id)
Add/del LISP-GPE L2 interface.
const dpo_id_t * lisp_cp_dpo_get(dpo_proto_t proto)
static void vlib_increment_combined_counter(vlib_combined_counter_main_t *cm, u32 thread_index, u32 index, u64 n_packets, u64 n_bytes)
Increment a combined counter.
u8 vnet_lisp_gpe_enable_disable_status(void)
Check if LISP-GPE is enabled.
static u8 * format_l2_lisp_gpe_tx_trace(u8 *s, va_list *args)
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.
#define foreach_lisp_gpe_tx_next
static u8 * format_nsh_lisp_gpe_name(u8 *s, va_list *args)
static uword l2_arc_to_lb
The VLIB node arc/edge from the interface's TX node, to the L2 load-balanceing node.
vnet_interface_main_t interface_main
void lisp_gpe_tenant_l3_iface_unlock(u32 vni)
Release the lock held on the tenant's L3 interface.
static uword vlib_node_add_named_next(vlib_main_t *vm, uword node, char *name)
u32 vnet_lisp_gpe_add_nsh_iface(lisp_gpe_main_t *lgm)
Add LISP-GPE NSH interface.
static vnet_hw_interface_t * vnet_get_hw_interface(vnet_main_t *vnm, u32 hw_if_index)
static clib_error_t * lisp_gpe_add_del_iface_command_fn(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
#define vec_add1(V, E)
Add 1 element to end of vector (unspecified alignment).
static u8 * format_lisp_gpe_name(u8 *s, va_list *args)
vnet_hw_interface_class_t lisp_gpe_hw_class
u32 * fib_index_by_sw_if_index
Table index indexed by software interface.
struct _vnet_device_class vnet_device_class_t
uword * vni_by_sw_if_index
static uword vlib_buffer_length_in_chain(vlib_main_t *vm, vlib_buffer_t *b)
Get length in bytes of the buffer chain.
enum fib_protocol_t_ fib_protocol_t
Protocol Type.
u8 * format_lisp_gpe_tx_trace(u8 *s, va_list *args)
vlib_main_t * vlib_main
convenience
void lisp_gpe_del_l3_iface(lisp_gpe_main_t *lgm, u32 vni, u32 table_id)
static ip_adjacency_t * adj_get(adj_index_t adj_index)
Get a pointer to an adjacency object from its index.
union ip_adjacency_t_::@42 sub_type
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.
vlib_combined_counter_main_t * combined_sw_if_counters
Aggregrate type for a prefix.
#define clib_error_return(e, args...)
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.
u8 * lisp_gpe_build_rewrite(vnet_main_t *vnm, u32 sw_if_index, vnet_link_t link_type, const void *dst_address)
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.
u32 fib_table_find(fib_protocol_t proto, u32 table_id)
Get the index of the FIB for a Table-ID.
u32 vnet_register_interface(vnet_main_t *vnm, u32 dev_class_index, u32 dev_instance, u32 hw_class_index, u32 hw_instance)
u8 * format_lisp_gpe_header_with_length(u8 *s, va_list *args)
Common utility functions for IPv4, IPv6 and L2 LISP-GPE adjacencys.
The identity of a DPO is a combination of its type and its instance number/index of objects of that t...
void vnet_lisp_gpe_del_nsh_iface(lisp_gpe_main_t *lgm)
Del LISP-GPE NSH interface.
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 ip4_sw_interface_enable_disable(u32 sw_if_index, u32 is_enable)
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.
static void * vlib_buffer_get_current(vlib_buffer_t *b)
Get pointer to current data to process.
static void lisp_gpe_tenant_add_default_routes(u32 table_id)
vlib_simple_counter_main_t * sw_if_counters
load_balance_main_t load_balance_main
The one instance of load-balance main.
#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).
void fib_table_unlock(u32 fib_index, fib_protocol_t proto, fib_source_t source)
Take a reference counting lock on the table.
uword * sw_if_index_by_vni
lookup decap tunnel termination sw_if_index by vni and vice versa
clib_error_t * vnet_rename_interface(vnet_main_t *vnm, u32 hw_if_index, char *new_name)
VNET_HW_INTERFACE_CLASS(ethernet_hw_interface_class)
static void ip_udp_fixup_one(vlib_main_t *vm, vlib_buffer_t *b0, u8 is_ip4)
#define vec_free(V)
Free vector's memory (no header).
tunnel_lookup_t l2_ifaces
#define clib_warning(format, args...)
void lisp_gpe_del_l2_iface(lisp_gpe_main_t *lgm, u32 vni, u32 bd_id)
Add/del LISP-GPE L2 interface.
static void vnet_interface_counter_unlock(vnet_interface_main_t *im)
static void lisp_gpe_remove_iface(lisp_gpe_main_t *lgm, u32 hi_index, u32 dp_table, tunnel_lookup_t *tuns)
u32 fib_node_index_t
A typedef of a node index.
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.
lisp_gpe_main_t lisp_gpe_main
LISP-GPE global state.
#define VLIB_CLI_COMMAND(x,...)
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...
static void vnet_interface_counter_lock(vnet_interface_main_t *im)
static void lisp_gpe_iface_set_table(u32 sw_if_index, u32 table_id)
u16 cached_next_index
Next frame index that vector arguments were last enqueued to last time this node ran.
static u32 bd_find_or_add_bd_index(bd_main_t *bdm, u32 bd_id)
Get or create a bridge domain.
uword * hw_if_index_by_dp_table
Lookup lisp-gpe interfaces by dp table (eg.
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.
u8 * format_nsh_lisp_gpe_tx_trace(u8 *s, va_list *args)
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.
dpo_proto_t fib_proto_to_dpo(fib_protocol_t fib_proto)
static vlib_main_t * vlib_get_main(void)
static void * vlib_add_trace(vlib_main_t *vm, vlib_node_runtime_t *r, vlib_buffer_t *b, u32 n_data_bytes)
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.
index_t dpoi_index
the index of objects of that type
#define vec_len(v)
Number of elements in vector (rvalue-only, NULL tolerant)
tunnel_lookup_t l3_ifaces
struct ip_adjacency_t_::@42::@44 midchain
IP_LOOKUP_NEXT_MIDCHAIN.
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.
A collection of combined counters.
#define FOR_EACH_FIB_IP_PROTOCOL(_item)
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.
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.
ip4_main_t ip4_main
Global ip4 main structure.
clib_error_t * vnet_sw_interface_set_flags(vnet_main_t *vnm, u32 sw_if_index, vnet_sw_interface_flags_t flags)
static u8 * format_l2_lisp_gpe_name(u8 *s, va_list *args)
u32 bd_find_index(bd_main_t *bdm, u32 bd_id)
Get a bridge domain.
u16 dpoi_next_node
The next VLIB node to follow.
VNET_DEVICE_CLASS(ethernet_simulated_device_class)
u32 flags
buffer flags: VLIB_BUFFER_FREE_LIST_INDEX_MASK: bits used to store free list index, VLIB_BUFFER_IS_TRACED: trace this buffer.
tunnel_lookup_t nsh_ifaces
u32 * fib_index_by_sw_if_index
static vlib_buffer_t * vlib_get_buffer(vlib_main_t *vm, u32 buffer_index)
Translate buffer index into buffer pointer.
const dpo_id_t * lisp_nsh_fib_lookup(lisp_gpe_main_t *lgm, u32 spi_si_net_order)
Lookup NSH SD FIB entry.
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)
static void lisp_gpe_tenant_del_default_routes(u32 table_id)
void ip6_sw_interface_enable_disable(u32 sw_if_index, u32 is_enable)