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;
248 while (n_left_from > 0)
254 while (n_left_from > 0 && n_left_to_next > 0)
297 u32 dev_instance = va_arg (*args,
u32);
298 return format (s,
"l2_lisp_gpe%d", dev_instance);
303 .name =
"L2_LISP_GPE",
342 u32 n_left_from, next_index, *from, *to_next;
350 while (n_left_from > 0)
356 while (n_left_from > 0 && n_left_to_next > 0)
389 n_left_to_next, bi0, next0);
401 u32 dev_instance = va_arg (*args,
u32);
402 return format (s,
"nsh_lisp_gpe%d", dev_instance);
407 .name =
"NSH_LISP_GPE",
420 u32 hw_if_index = ~0;
435 new_name =
format (0,
"%U", dev_class->format_device_name, vni);
582 clib_warning (
"vrf %d already mapped to a vni", table_id);
590 clib_warning (
"Interface for vni %d already exists", vni);
595 &lisp_gpe_device_class, l3_ifaces);
622 clib_warning (
"The interface for vrf %d doesn't exist", table_id);
658 clib_warning (
"bridge domain ID %d exceed 16M limit", bd_id);
667 clib_warning (
"bridge domain %d already mapped to a vni", bd_id);
674 clib_warning (
"Interface for vni %d already exists", vni);
680 &l2_lisp_gpe_device_class, &lgm->
l2_ifaces);
722 clib_warning (
"The interface for bridge domain %d doesn't exist",
769 &nsh_lisp_gpe_device_class, &lgm->
nsh_ifaces);
806 u32 table_id, vni, bd_id;
807 u8 vni_is_set = 0, vrf_is_set = 0, bd_index_is_set = 0;
824 else if (
unformat (line_input,
"del"))
826 else if (
unformat (line_input,
"vrf %d", &table_id))
830 else if (
unformat (line_input,
"vni %d", &vni))
834 else if (
unformat (line_input,
"bd %d", &bd_id))
838 else if (
unformat (line_input,
"nsh"))
867 if (vrf_is_set && bd_index_is_set)
870 (0,
"Cannot set both vrf and brdige domain index!");
880 if (!vrf_is_set && !bd_index_is_set)
923 .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.
#define hash_set(h, key, value)
clib_error_t * vnet_hw_interface_set_flags(vnet_main_t *vnm, u32 hw_if_index, u32 flags)
#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)
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.
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.
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.
union ip_adjacency_t_::@37 sub_type
#define VNET_HW_INTERFACE_FLAG_LINK_UP
struct _vnet_device_class vnet_device_class_t
uword * vni_by_sw_if_index
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.
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...)
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 fib_table_unlock(u32 fib_index, fib_protocol_t proto)
Take a reference counting lock on the table.
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)
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
struct ip_adjacency_t_::@37::@39 midchain
IP_LOOKUP_NEXT_MIDCHAIN.
#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).
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...)
#define VLIB_BUFFER_IS_TRACED
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.
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.
#define VNET_SW_INTERFACE_FLAG_ADMIN_UP
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)
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
static void * vlib_frame_vector_args(vlib_frame_t *f)
Get pointer to frame vector data.
#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, u32 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_IS_TRACED: trace this buffer.
tunnel_lookup_t nsh_ifaces
u32 * fib_index_by_sw_if_index
u32 lisp_gpe_tenant_l3_iface_add_or_lock(u32 vni, u32 table_id)
Add/create and lock a new or find and lock the existing L3 interface for the tenant.
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)
u32 lisp_gpe_add_l3_iface(lisp_gpe_main_t *lgm, u32 vni, u32 table_id)
Add/del LISP-GPE L3 interface.