|
FD.io VPP
v21.06-3-gbb25fbf28
Vector Packet Processing
|
Go to the documentation of this file.
93 u32 sw_if_index0, sw_if_index1;
164 return frame->n_vectors;
169 .name =
"mpls-tunnel-tx",
170 .vector_size =
sizeof (
u32),
222 const void *dst_address)
577 u32 dev_instance = va_arg (*args,
u32);
578 return format (s,
"mpls-tunnel%d", dev_instance);
584 u32 dev_instance = va_arg (*args,
u32);
587 return (
format (s,
"MPLS-tunnel: id %d\n", dev_instance));
591 .name =
"MPLS tunnel device",
599 .name =
"MPLS-Tunnel",
679 mpls_tunnel_class.index,
681 mpls_tunnel_hw_interface_class.index,
848 u8 is_del = 0, l2_only = 0, is_multicast =0;
866 else if (
unformat (line_input,
"add %U",
870 else if (
unformat (line_input,
"add"))
872 else if (
unformat (line_input,
"l2-only"))
874 else if (
unformat (line_input,
"multicast"))
876 else if (
unformat (line_input,
"via %U",
878 &rpath, &payload_proto))
931 .path =
"mpls tunnel",
933 "mpls tunnel [multicast] [l2-only] via [next-hop-address] [next-hop-interface] [next-hop-table <value>] [weight <value>] [preference <value>] [udp-encap-id <value>] [ip4-lookup-in-table <value>] [ip6-lookup-in-table <value>] [mpls-lookup-in-table <value>] [resolve-via-host] [resolve-via-connected] [rx-ip4 <interface>] [out-labels <value value value>]",
943 s =
format(s,
"mpls-tunnel%d: sw_if_index:%d hw_if_index:%d",
948 s =
format(s,
" \n flags:");
955 s =
format(s,
"\n via:\n");
962 s =
format(s,
" forwarding: %U\n",
1030 .path =
"show mpls tunnel",
#define vec_reset_length(v)
Reset vector length to zero NULL-pointer tolerant.
static mpls_tunnel_t * mpls_tunnel_pool
pool of tunnel instances
u32 mt_sibling_index
sibling index on the path-list so notifications are received.
static mpls_tunnel_t * mpls_tunnel_get_from_sw_if_index(u32 sw_if_index)
Get a tunnel object from a SW interface index.
u16 dpoi_next_node
The next VLIB node to follow.
fib_path_ext_mpls_flags_t fpe_mpls_flags
For an MPLS type extension.
index_t dpoi_index
the index of objects of that type
#define DPO_INVALID
An initialiser for DPOs declared on the stack.
@ IP_LOOKUP_NEXT_ARP
This packet matches an "incomplete adjacency" and packets need to be passed to ARP to find rewrite st...
u32 tunnel_id
Tunnel-id / index in tunnel vector.
vlib_buffer_t * bufs[VLIB_FRAME_SIZE]
static clib_error_t * vnet_create_mpls_tunnel_command_fn(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
void vnet_sw_interface_set_mtu(vnet_main_t *vnm, u32 sw_if_index, u32 mtu)
vlib_main_t vlib_node_runtime_t vlib_frame_t * frame
fib_node_index_t mt_path_list
The path-list over which the tunnel's destination is reachable.
VNET_HW_INTERFACE_CLASS(mpls_tunnel_hw_interface_class)
static fib_node_t * mpls_tunnel_fib_node_get(fib_node_index_t index)
Function definition to get a FIB node from its index.
enum fib_node_back_walk_rc_t_ fib_node_back_walk_rc_t
Return code from a back walk function.
static u8 * format_mpls_tunnel_device(u8 *s, va_list *args)
load_balance_path_t * next_hops
#define FOR_EACH_FIB_IP_PROTOCOL(_item)
enum dpo_proto_t_ dpo_proto_t
Data path protocol.
u8 * format_fib_path_ext_list(u8 *s, va_list *args)
u8 * format_fib_forw_chain_type(u8 *s, va_list *args)
const static fib_node_vft_t mpls_vft
#define ADJ_INDEX_INVALID
Invalid ADJ index - used when no adj is known likewise blazoned capitals INVALID speak volumes where ...
#define pool_elt_at_index(p, i)
Returns pointer to element at given index.
struct mpls_tunnel_collect_forwarding_ctx_t_ mpls_tunnel_collect_forwarding_ctx_t
u8 * fib_path_list_format(fib_node_index_t path_list_index, u8 *s)
vlib_get_buffers(vm, from, b, n_left_from)
load_balance_path_t * fib_path_ext_stack(fib_path_ext_t *path_ext, fib_forward_chain_type_t child_fct, fib_forward_chain_type_t imp_null_fct, load_balance_path_t *nhs)
@ VLIB_NODE_TYPE_INTERNAL
vlib_main_t vlib_node_runtime_t * node
fib_forward_chain_type_t fct
enum adj_walk_rc_t_ adj_walk_rc_t
return codes from a adjacency walker callback function
@ IP_LOOKUP_NEXT_GLEAN
This packet matches an "interface route" and packets need to be passed to ARP to find rewrite string ...
A FIB graph nodes virtual function table.
#define clib_error_return(e, args...)
index_t load_balance_create(u32 n_buckets, dpo_proto_t lb_proto, flow_hash_config_t fhc)
#define FIB_NODE_INDEX_INVALID
enum fib_path_list_walk_rc_t_ fib_path_list_walk_rc_t
return code to control pat-hlist walk
@ IP_LOOKUP_NEXT_LOCAL
This packet is for one of our own IP addresses.
@ FIB_FORW_CHAIN_TYPE_ETHERNET
Contribute an object that is to be used to forward Ethernet packets.
@ VNET_SW_INTERFACE_FLAG_ADMIN_UP
static u8 * format_mpls_tunnel(u8 *s, va_list *args)
#define pool_put(P, E)
Free an object E in pool P.
#define MPLS_TUNNEL_ATTRIBUTES
VNET_DEVICE_CLASS(mpls_tunnel_class)
@ IP_LOOKUP_NEXT_MIDCHAIN
This packets follow a mid-chain adjacency.
vlib_main_t * vm
X-connect all packets from the HOST to the PHY.
static void mpls_tunnel_restack(mpls_tunnel_t *mt)
struct mpls_tunnel_trace_t_ mpls_tunnel_trace_t
Packet trace structure.
@ VNET_HW_INTERFACE_FLAG_LINK_UP
vlib_buffer_enqueue_to_next(vm, node, from,(u16 *) nexts, frame->n_vectors)
void adj_mcast_midchain_update_rewrite(adj_index_t adj_index, adj_midchain_fixup_t fixup, const void *fixup_data, adj_flags_t flags, u8 *rewrite, u8 offset, u32 mask)
adj_mcast_midchain_update_rewrite
vnet_link_t ia_link
link/ether-type 1 bytes
static clib_error_t * mpls_tunnel_init(vlib_main_t *vm)
u32 fib_path_list_get_n_paths(fib_node_index_t path_list_index)
void load_balance_multipath_update(const dpo_id_t *dpo, const load_balance_path_t *raw_nhs, load_balance_flags_t flags)
int vnet_mpls_tunnel_path_remove(u32 sw_if_index, fib_route_path_t *rpaths)
remove a path from a tunnel.
fib_mpls_label_t * frp_label_stack
The outgoing MPLS label Stack.
#define MPLS_FLOW_HASH_DEFAULT
There are no options for controlling the MPLS flow hash, but since it mostly entails using IP data to...
#define pool_is_free_index(P, I)
Use free bitmap to query whether given index is free.
void fib_path_list_unlock(fib_node_index_t path_list_index)
void vnet_mpls_tunnel_path_add(u32 sw_if_index, fib_route_path_t *rpaths)
Add a path to an MPLS tunnel.
void vnet_set_interface_output_node(vnet_main_t *vnm, u32 hw_if_index, u32 node_index)
Set interface output node - for interface registered without its output/tx nodes created because its ...
@ FIB_NODE_TYPE_MPLS_TUNNEL
@ IP_LOOKUP_NEXT_MCAST_MIDCHAIN
Multicast Midchain Adjacency.
#define STRUCT_OFFSET_OF(t, f)
#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)
@ IP_LOOKUP_NEXT_DROP
Adjacency to drop this packet.
const mpls_tunnel_t * mpls_tunnel_get(u32 mti)
#define VLIB_NODE_FN(node)
#define vec_add1(V, E)
Add 1 element to end of vector (unspecified alignment).
ip_lookup_next_t lookup_next_index
Next hop after ip4-lookup.
void fib_path_ext_list_remove(fib_path_ext_list_t *list, fib_path_ext_type_t ext_type, const fib_route_path_t *rpath)
enum fib_forward_chain_type_t_ fib_forward_chain_type_t
FIB output chain type.
void(* mpls_tunnel_walk_cb_t)(u32 index, void *ctx)
Callback function invoked while walking MPLS tunnels.
static vnet_hw_interface_t * vnet_get_hw_interface(vnet_main_t *vnm, u32 hw_if_index)
dpo_proto_t fib_forw_chain_type_to_dpo_proto(fib_forward_chain_type_t fct)
Convert from a chain type to the DPO proto it will install.
vnet_main_t * vnet_get_main(void)
@ FIB_PATH_LIST_FLAG_SHARED
static void * vlib_frame_vector_args(vlib_frame_t *f)
Get pointer to frame vector data.
enum flow_hash_config_t_ flow_hash_config_t
A flow hash configuration is a mask of the flow hash options.
#define IP_FLOW_HASH_DEFAULT
Default: 5-tuple + flowlabel without the "reverse" bit.
u32 fib_node_index_t
A typedef of a node index.
void vnet_delete_hw_interface(vnet_main_t *vnm, u32 hw_if_index)
static u8 * format_mpls_tunnel_tx_trace(u8 *s, va_list *args)
@ IP_LOOKUP_NEXT_REWRITE
This packet is to be rewritten and forwarded to the next processing node.
#define FOR_EACH_MPLS_TUNNEL_ATTRIBUTE(_item)
vlib_node_registration_t mpls_tunnel_tx
(constructor) VLIB_REGISTER_NODE (mpls_tunnel_tx)
fib_node_t mt_node
The tunnel hooks into the FIB control plane graph.
static int dpo_id_is_valid(const dpo_id_t *dpoi)
Return true if the DPO object is valid, i.e.
index_t replicate_create(u32 n_buckets, dpo_proto_t rep_proto)
@ IP_LOOKUP_NEXT_PUNT
Adjacency to punt this packet.
#define pool_get(P, E)
Allocate an object E from a pool P (unspecified alignment).
#define vec_validate(V, I)
Make sure vector is long enough for given index (no header, unspecified alignment)
u32 vnet_mpls_tunnel_create(u8 l2_only, u8 is_multicast, u8 *tag)
Create a new MPLS tunnel.
#define VLIB_CLI_COMMAND(x,...)
@ MPLS_TUNNEL_ENCAP_NEXT_L2_MIDCHAIN
void dpo_stack_from_node(u32 child_node_index, dpo_id_t *dpo, const dpo_id_t *parent)
Stack one DPO object on another, and thus establish a child parent relationship.
fib_path_ext_t * fib_path_ext_list_find_by_path_index(const fib_path_ext_list_t *list, fib_node_index_t path_index)
enum fib_protocol_t_ fib_protocol_t
Protocol Type.
dpo_id_t mt_l2_lb
If the tunnel is an L2 tunnel, this is the link type ETHERNET load-balance.
@ IP_LOOKUP_NEXT_BCAST
Broadcast Adjacency.
u32 fib_path_list_child_add(fib_node_index_t path_list_index, fib_node_type_t child_type, fib_node_index_t child_index)
void fib_node_register_type(fib_node_type_t type, const fib_node_vft_t *vft)
fib_node_register_type
struct _vlib_node_registration vlib_node_registration_t
@ FIB_NODE_BACK_WALK_CONTINUE
void vlib_cli_output(vlib_main_t *vm, char *fmt,...)
static void mpls_tunnel_last_lock_gone(fib_node_t *node)
Function definition to inform the FIB node that its last lock has gone.
fib_path_ext_list_t mt_path_exts
A vector of path extensions o hold the label stack for each path.
u8 * format_dpo_id(u8 *s, va_list *args)
Format a DPO_id_t oject.
static u8 * mpls_tunnel_build_rewrite(vnet_main_t *vnm, u32 sw_if_index, vnet_link_t link_type, const void *dst_address)
Build a rewrite string for the MPLS tunnel.
void vnet_mpls_tunnel_del(u32 sw_if_index)
Delete an MPLS tunnel.
@ FIB_PATH_LIST_WALK_CONTINUE
static const char * mpls_tunnel_attribute_names[]
MPLS tunnel flags strings.
void fib_path_ext_list_resolve(fib_path_ext_list_t *list, fib_node_index_t path_list_index)
@ IP_LOOKUP_NEXT_ICMP_ERROR
This packets needs to go to ICMP error.
@ DPO_LOAD_BALANCE
load-balancing over a choice of [un]equal cost paths
void adj_nbr_midchain_stack(adj_index_t adj_index, const dpo_id_t *next)
adj_nbr_midchain_stack
static clib_error_t * mpls_tunnel_admin_up_down(vnet_main_t *vnm, u32 hw_if_index, u32 flags)
A uni-directional MPLS tunnel.
#define vec_free(V)
Free vector's memory (no header).
@ FIB_PATH_EXT_MPLS
An MPLS extension that maintains the path's outgoing labels,.
enum mpls_tunnel_attribute_t_ mpls_tunnel_attribute_t
@ FIB_PATH_EXT_MPLS_FLAG_NO_IP_TTL_DECR
void adj_nbr_midchain_update_rewrite(adj_index_t adj_index, adj_midchain_fixup_t fixup, const void *fixup_data, adj_flags_t flags, u8 *rewrite)
adj_nbr_midchain_update_rewrite
fib_forward_chain_type_t fib_forw_chain_type_from_link_type(vnet_link_t link_type)
Convert from a adjacency's link type to chain type.
fib_node_index_t fib_path_list_copy_and_path_remove(fib_node_index_t orig_path_list_index, fib_path_list_flags_t flags, const fib_route_path_t *rpaths)
#define pool_foreach_index(i, v)
@ MPLS_TUNNEL_ENCAP_N_NEXT
unformat_function_t unformat_vnet_sw_interface
description fragment has unexpected format
void fib_path_list_walk(fib_node_index_t path_list_index, fib_path_list_walk_fn_t func, void *ctx)
#define vec_validate_init_empty(V, I, INIT)
Make sure vector is long enough for given index and initialize empty space (no header,...
vnet_link_t adj_get_link_type(adj_index_t ai)
Return the link type of the adjacency.
#define VLIB_INIT_FUNCTION(x)
A representation of a path as described by a route producer.
static u8 * mpls_tunnel_build_rewrite_i(void)
Build a rewrite string for the MPLS tunnel.
static vlib_cli_command_t show_mpls_tunnel_command
(constructor) VLIB_CLI_COMMAND (show_mpls_tunnel_command)
static clib_error_t * show_mpls_tunnel_command_fn(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
#define vec_foreach(var, vec)
Vector iterator.
static void mpls_tunnel_mk_lb(mpls_tunnel_t *mt, vnet_link_t linkt, fib_forward_chain_type_t fct, dpo_id_t *dpo_lb)
int fib_path_is_resolved(fib_node_index_t path_index)
static void mpls_tunnel_update_adj(vnet_main_t *vnm, u32 sw_if_index, adj_index_t ai)
static mpls_tunnel_t * mpls_tunnel_from_fib_node(fib_node_t *node)
static uword pool_elts(void *v)
Number of active elements in a pool.
void fib_path_list_child_remove(fib_node_index_t path_list_index, u32 si)
static u32 * mpls_tunnel_db
DB of SW index to tunnel index.
An node in the FIB graph.
void adj_nbr_midchain_unstack(adj_index_t adj_index)
adj_nbr_midchain_unstack
u32 adj_index_t
An index for adjacencies.
void fib_path_list_lock(fib_node_index_t path_list_index)
clib_memset(h->entries, 0, sizeof(h->entries[0]) *entries)
enum vnet_link_t_ vnet_link_t
Link Type: A description of the protocol of packets on the link.
void fib_node_init(fib_node_t *node, fib_node_type_t type)
static void mpls_tunnel_fixup(vlib_main_t *vm, const ip_adjacency_t *adj, vlib_buffer_t *b0, const void *data)
Fixup the adj rewrite post encap.
void * vlib_add_trace(vlib_main_t *vm, vlib_node_runtime_t *r, vlib_buffer_t *b, u32 n_data_bytes)
clib_error_t * vnet_hw_interface_set_flags(vnet_main_t *vnm, u32 hw_if_index, vnet_hw_interface_flags_t flags)
mpls_tunnel_flags_t mt_flags
Tunnel flags.
clib_error_t *() vlib_init_function_t(struct vlib_main_t *vm)
A path extension is a per-entry addition to the forwarding information when packets are sent for that...
@ IP_LOOKUP_NEXT_MCAST
Multicast Adjacency.
fib_path_ext_t * fib_path_ext_list_insert(fib_path_ext_list_t *list, fib_node_index_t path_list_index, fib_path_ext_type_t ext_type, const fib_route_path_t *rpath)
Context passed between object during a back walk.
u8 mt_tag[64]
User defined name tag for this MPLS Tunnel.
@ VNET_HW_INTERFACE_CLASS_FLAG_P2P
a point 2 point interface
void adj_nbr_walk(u32 sw_if_index, fib_protocol_t adj_nh_proto, adj_walk_cb_t cb, void *ctx)
Walk all adjacencies on a link for a given next-hop protocol.
u32 mt_hw_if_index
The HW interface index of the tunnel interfaces.
The identity of a DPO is a combination of its type and its instance number/index of objects of that t...
u16 nexts[VLIB_FRAME_SIZE]
static u8 * format_mpls_tunnel_name(u8 *s, va_list *args)
static uword vnet_hw_interface_get_flags(vnet_main_t *vnm, u32 hw_if_index)
void dpo_set(dpo_id_t *dpo, dpo_type_t type, dpo_proto_t proto, index_t index)
Set/create a DPO ID The DPO will be locked.
static fib_path_list_walk_rc_t mpls_tunnel_collect_forwarding(fib_node_index_t pl_index, fib_node_index_t path_index, void *arg)
fib_node_index_t fib_path_list_copy_and_path_add(fib_node_index_t orig_path_list_index, fib_path_list_flags_t flags, const fib_route_path_t *rpaths)
vl_api_interface_index_t sw_if_index
fib_node_index_t fib_path_list_create(fib_path_list_flags_t flags, const fib_route_path_t *rpaths)
One path from an [EU]CMP set that the client wants to add to a load-balance object.
void replicate_multipath_update(const dpo_id_t *dpo, load_balance_path_t *next_hops)
u32 mt_sw_if_index
The SW interface index of the tunnel interfaces.
void dpo_reset(dpo_id_t *dpo)
reset a DPO ID The DPO will be unlocked.
static ip_adjacency_t * adj_get(adj_index_t adj_index)
Get a pointer to an adjacency object from its index.
uword unformat_fib_route_path(unformat_input_t *input, va_list *args)
Unformat a fib_route_path_t from CLI input.
static vlib_cli_command_t create_mpls_tunnel_command
(constructor) VLIB_CLI_COMMAND (create_mpls_tunnel_command)
vl_api_fib_path_type_t type
u32 vnet_register_interface(vnet_main_t *vnm, u32 dev_class_index, u32 dev_instance, u32 hw_class_index, u32 hw_instance)
int vnet_mpls_tunnel_get_index(u32 sw_if_index)
return the tunnel index from the sw_if_index
static void mpls_tunnel_stack(adj_index_t ai)
mpls_tunnel_stack
static fib_node_back_walk_rc_t mpls_tunnel_back_walk(fib_node_t *node, fib_node_back_walk_ctx_t *ctx)
Function definition to backwalk a FIB node.
VLIB buffer representation.
static adj_walk_rc_t mpls_adj_walk_cb(adj_index_t ai, void *ctx)
Call back when restacking all adjacencies on a MPLS interface.
#define VLIB_REGISTER_NODE(x,...)
vl_api_wireguard_peer_flags_t flags