34 #include <vnet/lisp-gpe/lisp_types_api.h> 36 #define vl_api_gpe_locator_pair_t_endian vl_noop_handler 37 #define vl_api_gpe_locator_pair_t_print vl_noop_handler 38 #define vl_api_gpe_add_del_fwd_entry_t_endian vl_noop_handler 39 #define vl_api_gpe_add_del_fwd_entry_t_print vl_noop_handler 50 #define vl_print(handle, ...) vlib_cli_output (handle, __VA_ARGS__) 57 #define foreach_vpe_api_msg \ 58 _(GPE_ADD_DEL_FWD_ENTRY, gpe_add_del_fwd_entry) \ 59 _(GPE_FWD_ENTRIES_GET, gpe_fwd_entries_get) \ 60 _(GPE_FWD_ENTRY_PATH_DUMP, gpe_fwd_entry_path_dump) \ 61 _(GPE_ENABLE_DISABLE, gpe_enable_disable) \ 62 _(GPE_ADD_DEL_IFACE, gpe_add_del_iface) \ 63 _(GPE_FWD_ENTRY_VNIS_GET, gpe_fwd_entry_vnis_get) \ 64 _(GPE_SET_ENCAP_MODE, gpe_set_encap_mode) \ 65 _(GPE_GET_ENCAP_MODE, gpe_get_encap_mode) \ 66 _(GPE_ADD_DEL_NATIVE_FWD_RPATH, gpe_add_del_native_fwd_rpath) \ 67 _(GPE_NATIVE_FWD_RPATHS_GET, gpe_native_fwd_rpaths_get) 74 vl_api_gpe_locator_t *r;
76 for (i = 0; i < rloc_num; i++)
79 r = &((vl_api_gpe_locator_t *) locs)[
i];
83 pair.weight = r->weight;
87 for (i = rloc_num; i < rloc_num * 2; i++)
90 r = &((vl_api_gpe_locator_t *) locs)[
i];
91 p = &pairs[i - rloc_num];
143 clib_host_to_net_u16 (VL_API_GPE_FWD_ENTRY_PATH_DETAILS);
176 &dst[i].leid.address.prefix);
178 &dst[i].reid.address.prefix);
182 dst[i].leid.address.mac);
184 dst[i].reid.address.mac);
199 mp->
vni = clib_net_to_host_u32 (mp->
vni);
205 e->fwd_entry_index = clib_host_to_net_u32 (e->fwd_entry_index);
206 e->dp_table = clib_host_to_net_u32 (e->dp_table);
207 e->vni = clib_host_to_net_u32 (e->vni);
215 vl_api_gpe_fwd_entry_t *e;
217 for (i = 0; i < mp->
count; i++)
237 REPLY_MACRO4 (VL_API_GPE_FWD_ENTRY_VNIS_GET_REPLY, size,
242 rmp->
vnis[i++] = clib_host_to_net_u32 (p->
key);
261 size =
vec_len (e) *
sizeof (vl_api_gpe_fwd_entry_t);
278 mp->
vni = clib_net_to_host_u32 (mp->
vni);
329 vl_api_gpe_enable_disable_reply_t *rmp;
342 vl_api_gpe_add_del_iface_reply_t *rmp;
346 vni = clib_net_to_host_u32 (mp->
vni);
347 dp_table = clib_net_to_host_u32 (mp->
dp_table);
376 vl_api_gpe_set_encap_mode_reply_t *rmp;
401 vl_api_gpe_add_del_native_fwd_rpath_reply_t *rmp;
409 sizeof (ip6_address_t));
418 clib_net_to_host_u32 (mp->
table_id));
421 rv = VNET_API_ERROR_INVALID_VALUE;
430 REPLY_MACRO (VL_API_GPE_ADD_DEL_NATIVE_FWD_RPATH_REPLY);
455 e->fib_index = clib_host_to_net_u32 (e->fib_index);
456 e->nh_sw_if_index = clib_host_to_net_u32 (e->nh_sw_if_index);
464 vl_api_gpe_native_fwd_rpath_t *e;
466 for (i = 0; i < mp->
count; i++)
483 u8 rpath_index = mp->
is_ip4 ? 1 : 0;
486 *
sizeof (vl_api_gpe_native_fwd_rpath_t);
489 REPLY_MACRO4 (VL_API_GPE_NATIVE_FWD_RPATHS_GET_REPLY, size,
506 #define vl_msg_name_crc_list 508 #undef vl_msg_name_crc_list 513 #define _(id,n,crc) vl_msg_api_add_msg_name_crc (am, #n "_" #crc, id); 514 foreach_vl_msg_name_crc_lisp_gpe;
524 vl_msg_api_set_handlers(VL_API_##N, #n, \ 525 vl_api_##n##_t_handler, \ 527 vl_api_##n##_t_endian, \ 528 vl_api_##n##_t_print, \ 529 sizeof(vl_api_##n##_t), 1);
void lisp_gpe_tenant_l2_iface_unlock(u32 vni)
Release the lock held on the tenant's L3 interface.
vl_api_gpe_locator_t lcl_loc
const lisp_gpe_tunnel_t * lisp_gpe_tunnel_get(index_t lgti)
ip46_address_t frp_addr
The next-hop address.
Set GPE encapsulation mode.
static void vl_api_gpe_add_del_native_fwd_rpath_t_handler(vl_api_gpe_add_del_native_fwd_rpath_t *mp)
void ip_address_encode2(const ip_address_t *in, vl_api_address_t *out)
A representation of a path as described by a route producer.
u32 * vnet_lisp_gpe_get_fwd_entry_vnis(void)
void mac_address_encode(const mac_address_t *in, u8 *out)
#define REPLY_MACRO4(t, n, body)
static void gpe_fwd_entry_path_dump_t_net_to_host(vl_api_gpe_fwd_entry_path_dump_t *mp)
void lisp_gpe_tenant_l3_iface_unlock(u32 vni)
Release the lock held on the tenant's L3 interface.
#define REPLY_MACRO2(t, body)
clib_error_t * vnet_lisp_gpe_enable_disable(vnet_lisp_gpe_enable_disable_args_t *a)
Enable/disable LISP-GPE.
clib_memset(h->entries, 0, sizeof(h->entries[0]) *entries)
static void vl_api_send_msg(vl_api_registration_t *rp, u8 *elem)
#define vec_add1(V, E)
Add 1 element to end of vector (unspecified alignment).
static void vl_api_gpe_add_del_iface_t_handler(vl_api_gpe_add_del_iface_t *mp)
void ip_prefix_encode2(const ip_prefix_t *in, vl_api_prefix_t *out)
dpo_proto_t frp_proto
The protocol of the address below.
vl_api_gpe_fwd_entry_t entries[count]
void * vl_msg_api_alloc(int nbytes)
static void gpe_native_fwd_rpaths_get_reply_t_host_to_net(vl_api_gpe_native_fwd_rpaths_get_reply_t *mp)
#define clib_memcpy(d, s, n)
static lisp_gpe_main_t * vnet_lisp_gpe_get_main()
static void setup_message_id_table(api_main_t *am)
u32 frp_sw_if_index
The interface.
vl_api_gpe_native_fwd_rpath_t entries[count]
static void vl_api_gpe_add_del_fwd_entry_t_handler(vl_api_gpe_add_del_fwd_entry_t *mp)
bool is_enable[default=true]
lisp_gpe_fwd_entry_type_t type
The forwarding entry type.
static void vl_api_gpe_get_encap_mode_t_handler(vl_api_gpe_get_encap_mode_t *mp)
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.
fib_protocol_t dpo_proto_to_fib(dpo_proto_t dpo_proto)
bool is_add[default=true]
Common utility functions for IPv4, IPv6 and L2 LISP-GPE adjacencys.
#define pool_elt_at_index(p, i)
Returns pointer to element at given index.
Common utility functions for IPv4, IPv6 and L2 LISP-GPE tunnels.
lisp_api_gpe_fwd_entry_t * vnet_lisp_gpe_fwd_entries_get_by_vni(u32 vni)
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.
Reply for set_encap_mode.
vl_api_gpe_locator_t locs[loc_num]
static void vl_api_gpe_set_encap_mode_t_handler(vl_api_gpe_set_encap_mode_t *mp)
const lisp_gpe_adjacency_t * lisp_gpe_adjacency_get(index_t lai)
int vnet_gpe_add_del_native_fwd_rpath(vnet_gpe_native_fwd_rpath_args_t *a)
API main structure, used by both vpp and binary API clients.
u8 is_negative
type of mapping
vl_api_gpe_locator_t rmt_loc
get GPE encapsulation mode
static void lisp_api_set_locator(vl_api_gpe_locator_t *loc, const ip_address_t *addr, u8 weight)
vl_api_interface_index_t nh_sw_if_index
static void gpe_fwd_entries_copy(vl_api_gpe_fwd_entry_t *dst, lisp_api_gpe_fwd_entry_t *src)
void ip_address_decode2(const vl_api_address_t *in, ip_address_t *out)
An API client registration, only in vpp/vlib.
u32 vni
VNI/tenant id in HOST byte order.
bool is_add[default=true]
u32 fwd_entry_index
forwarding entry index of
u32 ft_table_id
Table ID (hash key) for this FIB.
sll srl srl sll sra u16x4 i
#define vec_free(V)
Free vector's memory (no header).
static void vl_api_gpe_fwd_entry_vnis_get_t_handler(vl_api_gpe_fwd_entry_vnis_get_t *mp)
#define clib_warning(format, args...)
#define pool_is_free_index(P, I)
Use free bitmap to query whether given index is free.
static vl_api_registration_t * vl_api_client_index_to_registration(u32 index)
lisp_gpe_main_t lisp_gpe_main
LISP-GPE global state.
lisp_gpe_tunnel_key_t * key
RLOC pair and rloc fib_index.
#define fid_addr_ippref(_a)
int vnet_lisp_gpe_add_del_fwd_entry(vnet_lisp_gpe_add_del_fwd_entry_args_t *a, u32 *hw_if_indexp)
Forwarding entry create/remove dispatcher.
gpe_encap_mode_t vnet_gpe_get_encap_mode(void)
static uword hash_elts(void *v)
#define fid_addr_type(_a)
A path on which to forward lisp traffic.
u8 weight
[UE]CMP weigt for the path
static void gpe_entry_t_host_to_net(vl_api_gpe_fwd_entry_t *e)
static clib_error_t * gpe_api_hookup(vlib_main_t *vm)
int vnet_gpe_set_encap_mode(gpe_encap_mode_t mode)
Set GPE encapsulation mode.
gid_address_t rmt_eid
remote eid
static void vl_api_gpe_fwd_entry_path_dump_t_handler(vl_api_gpe_fwd_entry_path_dump_t *mp)
static void vl_api_gpe_native_fwd_rpaths_get_t_handler(vl_api_gpe_native_fwd_rpaths_get_t *mp)
static void gpe_native_fwd_rpath_t_host_to_net(vl_api_gpe_native_fwd_rpath_t *e)
#define foreach_vpe_api_msg
negative_fwd_actions_e action
action for negative mappings
bool is_add[default=true]
struct lisp_gpe_fwd_entry_t_ * lisp_fwd_entry_pool
A Pool of all LISP forwarding entries.
#define vec_len(v)
Number of elements in vector (rvalue-only, NULL tolerant)
#define hash_foreach_pair(p, v, body)
Iterate over hash pairs.
u32 tunnel_index
The index of the LISP GPE tunnel that provides the transport in the underlay.
u32 dp_table
generic access
static void gpe_fwd_entries_get_t_net_to_host(vl_api_gpe_fwd_entries_get_t *mp)
locator_pair_t * locator_pairs
vector of locator pairs
fib_table_t * fib_table_get(fib_node_index_t index, fib_protocol_t proto)
Get a pointer to a FIB table.
lisp_fwd_path_t * paths
When the type is 'normal' The RLOC pair that form the route's paths.
void ip_address_encode(const ip46_address_t *in, ip46_type_t type, vl_api_address_t *out)
static api_main_t * vlibapi_get_main(void)
fib_route_path_t * native_fwd_rpath[2]
Native fwd data structures.
#define vec_foreach(var, vec)
Vector iterator.
static void vl_api_gpe_fwd_entries_get_t_handler(vl_api_gpe_fwd_entries_get_t *mp)
static void gpe_native_fwd_rpaths_copy(vl_api_gpe_native_fwd_rpath_t *dst, fib_route_path_t *src)
static void vl_api_gpe_enable_disable_t_handler(vl_api_gpe_enable_disable_t *mp)
VLIB_API_INIT_FUNCTION(gpe_api_hookup)
u8 frp_weight
[un]equal cost path weight
gid_address_t lcl_eid
local eid
u32 frp_fib_index
The FIB index to lookup the nexthop Only valid for recursive paths.
static locator_pair_t * unformat_gpe_loc_pairs(void *locs, u32 rloc_num)
int unformat_lisp_eid_api(gid_address_t *dst, u32 vni, const vl_api_eid_t *eid)
ip_address_t remote_rloc
remote RLOC.
static void gpe_add_del_fwd_entry_t_net_to_host(vl_api_gpe_add_del_fwd_entry_t *mp)
enable or disable gpe protocol
static void gpe_fwd_entries_get_reply_t_host_to_net(vl_api_gpe_fwd_entries_get_reply_t *mp)
A protocol Independent FIB table.
index_t lisp_adj
The adjacency constructed for the locator pair.