|
FD.io VPP
v21.06-3-gbb25fbf28
Vector Packet Processing
|
Go to the documentation of this file.
44 #define vl_print(handle, ...) vlib_cli_output (handle, __VA_ARGS__)
51 #define foreach_vpe_api_msg \
52 _(MPLS_IP_BIND_UNBIND, mpls_ip_bind_unbind) \
53 _(MPLS_ROUTE_ADD_DEL, mpls_route_add_del) \
54 _(MPLS_TABLE_ADD_DEL, mpls_table_add_del) \
55 _(MPLS_TUNNEL_ADD_DEL, mpls_tunnel_add_del) \
56 _(MPLS_TUNNEL_DUMP, mpls_tunnel_dump) \
57 _(SW_INTERFACE_SET_MPLS_ENABLE, sw_interface_set_mpls_enable) \
58 _(MPLS_TABLE_DUMP, mpls_table_dump) \
59 _(MPLS_ROUTE_DUMP, mpls_route_dump)
87 vl_api_mpls_table_add_del_reply_t *rmp;
109 u32 mpls_fib_index, ip_fib_index;
115 if (~0 == mpls_fib_index)
117 return VNET_API_ERROR_NO_SUCH_FIB;
123 if (~0 == ip_fib_index)
124 return VNET_API_ERROR_NO_SUCH_FIB;
139 vl_api_mpls_ip_bind_unbind_reply_t *rmp;
158 vl_api_fib_path_t *apath;
166 .fp_label = ntohl (mp->
mr_route.mr_label),
178 ntohl (mp->
mr_route.mr_table_id), &fib_index);
184 for (ii = 0; ii < mp->
mr_route.mr_n_paths; ii++)
261 u32 tunnel_sw_if_index = ~0, tunnel_index = ~0;
268 for (ii = 0; ii < mp->
mt_tunnel.mt_n_paths; ii++)
277 tunnel_sw_if_index = ntohl (mp->
mt_tunnel.mt_sw_if_index);
281 if (~0 == tunnel_sw_if_index)
293 tunnel_sw_if_index = ntohl (mp->
mt_tunnel.mt_sw_if_index);
314 vl_api_sw_interface_set_mpls_enable_reply_t *rmp;
324 REPLY_MACRO (VL_API_SW_INTERFACE_SET_MPLS_ENABLE_REPLY);
344 vl_api_fib_path_t *fp;
357 clib_memset (mp, 0,
sizeof (*mp) + n *
sizeof (vl_api_fib_path_t));
359 mp->_vl_msg_id =
ntohs (VL_API_MPLS_TUNNEL_DETAILS);
364 mp->
mt_tunnel.mt_tunnel_index = ntohl (mti);
409 memset (mp, 0,
sizeof (*mp));
410 mp->_vl_msg_id =
ntohs (VL_API_MPLS_TABLE_DETAILS);
449 vl_api_fib_path_t *fp;
460 mp->_vl_msg_id =
ntohs (VL_API_MPLS_ROUTE_DETAILS);
470 mp->
mr_route.mr_n_paths = path_count;
513 ntohl (mp->
table.mt_table_id));
538 #define vl_msg_name_crc_list
540 #undef vl_msg_name_crc_list
545 #define _(id,n,crc) vl_msg_api_add_msg_name_crc (am, #n "_" #crc, id);
546 foreach_vl_msg_name_crc_mpls;
556 vl_msg_api_set_handlers(VL_API_##N, #n, \
557 vl_api_##n##_t_handler, \
559 vl_api_##n##_t_endian, \
560 vl_api_##n##_t_print, \
561 sizeof(vl_api_##n##_t), 1);
568 am->api_trace_cfg[VL_API_MPLS_TUNNEL_ADD_DEL].size += 8 *
sizeof (
u32);
MPLS Route Add / del route.
void mpls_table_delete(u32 table_id, u8 is_api)
static void vl_api_mpls_tunnel_dump_t_handler(vl_api_mpls_tunnel_dump_t *mp)
VLIB_API_INIT_FUNCTION(mpls_api_hookup)
#define VALIDATE_SW_IF_INDEX(mp)
static vl_api_registration_t * vl_api_client_index_to_registration(u32 index)
static void vl_api_mpls_route_dump_t_handler(vl_api_mpls_route_dump_t *mp)
fib_node_index_t mt_path_list
The path-list over which the tunnel's destination is reachable.
const fib_prefix_t * fib_entry_get_prefix(fib_node_index_t fib_entry_index)
#define REPLY_MACRO2(t, body)
u32 fib_table_get_table_id(u32 fib_index, fib_protocol_t proto)
Get the Table-ID of the FIB from protocol and index.
Path encode context to use when walking a path-list to encode paths.
vl_api_interface_index_t sw_if_index[default=0xffffffff]
static void vl_api_send_msg(vl_api_registration_t *rp, u8 *elem)
u32 fib_table_find_or_create_and_lock_w_name(fib_protocol_t proto, u32 table_id, fib_source_t src, const u8 *name)
Get the index of the FIB for a Table-ID.
int fib_entry_cmp_for_sort(void *i1, void *i2)
vl_api_mpls_route_t mr_route
vl_api_mpls_table_t mt_table
u16 fp_len
The mask length.
vlib_main_t * vm
X-connect all packets from the HOST to the PHY.
void fib_table_walk(u32 fib_index, fib_protocol_t proto, fib_table_walk_fn_t fn, void *ctx)
Walk all entries in a FIB table N.B: This is NOT safe to deletes.
void mpls_table_create(u32 table_id, u8 is_api, const u8 *name)
void fib_api_path_encode(const fib_route_path_t *rpath, vl_api_fib_path_t *out)
Encode and decode functions from the API types to internal types.
u32 fib_path_list_get_n_paths(fib_node_index_t path_list_index)
bool mt_is_add[default=true]
fib_route_path_t * rpaths
int vnet_mpls_tunnel_path_remove(u32 sw_if_index, fib_route_path_t *rpaths)
remove a path from a tunnel.
Bind/Unbind an MPLS local label to an IP prefix.
Enable or Disable MPLS on and interface.
void vnet_mpls_tunnel_path_add(u32 sw_if_index, fib_route_path_t *rpaths)
Add a path to an MPLS tunnel.
A protocol Independent FIB table.
#define pool_foreach(VAR, POOL)
Iterate through pool.
void mpls_tunnel_walk(mpls_tunnel_walk_cb_t cb, void *ctx)
Walk all the MPLS tunnels.
#define vec_len(v)
Number of elements in vector (rvalue-only, NULL tolerant)
@ FIB_ENTRY_FLAG_MULTICAST
const mpls_tunnel_t * mpls_tunnel_get(u32 mti)
#define vec_add1(V, E)
Add 1 element to end of vector (unspecified alignment).
vnet_main_t * vnet_get_main(void)
vl_api_registration_t * reg
u32 ft_table_id
Table ID (hash key) for this FIB.
An API client registration, only in vpp/vlib.
u8 * ft_desc
Table description.
void ip_prefix_decode(const vl_api_prefix_t *in, fib_prefix_t *out)
u32 fib_node_index_t
A typedef of a node index.
int fib_api_route_add_del(u8 is_add, u8 is_multipath, u32 fib_index, const fib_prefix_t *prefix, fib_source_t src, fib_entry_flag_t entry_flags, fib_route_path_t *rpaths)
Adding routes from the API.
vl_api_interface_index_t sw_if_index
static api_main_t * vlibapi_get_main(void)
static void send_mpls_route_details(vpe_api_main_t *am, vl_api_registration_t *reg, u32 context, fib_node_index_t fib_entry_index)
struct vl_api_mpls_route_dump_table_walk_ctx_t_ vl_api_mpls_route_dump_table_walk_ctx_t
#define vec_validate(V, I)
Make sure vector is long enough for given index (no header, unspecified alignment)
dpo_proto_t fp_payload_proto
This protocol determines the payload protocol of packets that will be forwarded by this entry once th...
u32 vnet_mpls_tunnel_create(u8 l2_only, u8 is_multicast, u8 *tag)
Create a new MPLS tunnel.
fib_path_ext_list_t mt_path_exts
A vector of path extensions o hold the label stack for each path.
struct mpls_tunnel_send_walk_ctx_t_ mpls_tunnel_send_walk_ctx_t
void vnet_mpls_tunnel_del(u32 sw_if_index)
Delete an MPLS tunnel.
int fib_api_table_id_decode(fib_protocol_t fproto, u32 table_id, u32 *fib_index)
static void vl_api_mpls_tunnel_add_del_t_handler(vl_api_mpls_tunnel_add_del_t *mp)
void fib_table_entry_local_label_remove(u32 fib_index, const fib_prefix_t *prefix, mpls_label_t label)
remove a MPLS local label for the prefix/route.
#define BAD_SW_IF_INDEX_LABEL
vl_api_mpls_tunnel_t mt_tunnel
vnet_api_error_t api_errno
void fib_path_list_walk_w_ext(fib_node_index_t path_list_index, const fib_path_ext_list_t *ext_list, fib_path_list_walk_w_ext_fn_t func, void *ctx)
API main structure, used by both vpp and binary API clients.
static int mpls_ip_bind_unbind_handler(vnet_main_t *vnm, vl_api_mpls_ip_bind_unbind_t *mp)
bool enable[default=true]
A uni-directional MPLS tunnel.
#define vec_free(V)
Free vector's memory (no header).
vl_api_prefix_t mb_prefix
static clib_error_t * mpls_api_hookup(vlib_main_t *vm)
Reply for MPLS tunnel add / del request.
Dump mpls eth tunnel table.
#define foreach_vpe_api_msg
enum fib_table_walk_rc_t_ fib_table_walk_rc_t
return code controlling how a table walk proceeds
int mpls_sw_interface_enable_disable(mpls_main_t *mm, u32 sw_if_index, u8 is_enable, u8 is_api)
static void send_mpls_tunnel_entry(u32 mti, void *arg)
A representation of a path as described by a route producer.
void vl_api_mpls_ip_bind_unbind_t_handler(vl_api_mpls_ip_bind_unbind_t *mp)
vl_api_mpls_route_t mr_route
fib_path_list_walk_rc_t fib_path_encode(fib_node_index_t path_list_index, fib_node_index_t path_index, const fib_path_ext_t *path_ext, void *args)
#define vec_foreach(var, vec)
Vector iterator.
@ FIB_SOURCE_CLI
From the CLI.
static int mpls_route_add_del_t_handler(vnet_main_t *vnm, vl_api_mpls_route_add_del_t *mp, u32 *stats_index)
@ FIB_SOURCE_API
From the control plane API.
fib_protocol_t fp_proto
protocol type
u32 fib_entry_get_fib_index(fib_node_index_t fib_entry_index)
#define vec_sort_with_function(vec, f)
Sort a vector using the supplied element comparison function.
static fib_table_walk_rc_t vl_api_mpls_route_dump_table_walk(fib_node_index_t fei, void *arg)
fib_route_path_t * fib_entry_encode(fib_node_index_t fib_entry_index)
@ FIB_TABLE_WALK_CONTINUE
Continue on to the next entry.
clib_memset(h->entries, 0, sizeof(h->entries[0]) *entries)
mpls_tunnel_flags_t mt_flags
Tunnel flags.
void fib_table_unlock(u32 fib_index, fib_protocol_t proto, fib_source_t source)
Take a reference counting lock on the table.
vl_api_mpls_table_t table
u8 mt_tag[64]
User defined name tag for this MPLS Tunnel.
vl_api_mpls_tunnel_t mt_tunnel
struct fib_table_t_ * fibs
A pool of all the MPLS FIBs.
void vl_api_mpls_route_add_del_t_handler(vl_api_mpls_route_add_del_t *mp)
fib_node_index_t fib_table_entry_local_label_add(u32 fib_index, const fib_prefix_t *prefix, mpls_label_t label)
Add a MPLS local label for the prefix/route.
static void vl_api_sw_interface_set_mpls_enable_t_handler(vl_api_sw_interface_set_mpls_enable_t *mp)
u32 fib_table_entry_get_stats_index(u32 fib_index, const fib_prefix_t *prefix)
Return the stats index for a FIB entry.
#define INDEX_INVALID
Invalid index - used when no index is known blazoned capitals INVALID speak volumes where ~0 does not...
int fib_api_path_decode(vl_api_fib_path_t *in, fib_route_path_t *out)
u32 fib_table_find(fib_protocol_t proto, u32 table_id)
Get the index of the FIB for a Table-ID.
static void vl_api_mpls_table_dump_t_handler(vl_api_mpls_table_dump_t *mp)
static void setup_message_id_table(api_main_t *am)
u32 mt_sw_if_index
The SW interface index of the tunnel interfaces.
vl_api_interface_index_t sw_if_index
Aggregate type for a prefix.
static void send_mpls_table_details(vpe_api_main_t *am, vl_api_registration_t *reg, u32 context, const fib_table_t *table)
int vnet_mpls_tunnel_get_index(u32 sw_if_index)
return the tunnel index from the sw_if_index
bool mt_is_add[default=true]
void vl_api_mpls_table_add_del_t_handler(vl_api_mpls_table_add_del_t *mp)
vpe_api_main_t vpe_api_main
void * vl_msg_api_alloc(int nbytes)
vl_api_mpls_table_t mt_table