32 memset(mdd, 0,
sizeof(*mdd));
42 return (mdd - mpls_disp_dpo_pool);
85 u32 indent = va_arg(*args,
u32);
90 s =
format(s,
"mpls-disposition:[%d]:[%U, %U]",
149 u32 n_left_from, next_index, * from, * to_next;
175 while (n_left_from > 0)
181 while (n_left_from >= 4 && n_left_to_next >= 2)
184 u32 bi0, mddi0, bi1, mddi1;
188 bi0 = to_next[0] = from[0];
189 bi1 = to_next[1] = from[1];
252 else if (payload_is_ip6)
305 bi0, bi1, next0, next1);
308 while (n_left_from > 0 && n_left_to_next > 0)
352 else if (payload_is_ip6)
388 n_left_to_next, bi0, next0);
419 .name =
"ip4-mpls-label-disposition-pipe",
420 .vector_size =
sizeof(
u32),
423 .sibling_of =
"ip4-input",
440 .function = ip6_mpls_label_disposition_pipe,
441 .name =
"ip6-mpls-label-disposition-pipe",
442 .vector_size =
sizeof(
u32),
445 .sibling_of =
"ip6-input",
450 ip6_mpls_label_disposition_pipe)
462 .function = ip4_mpls_label_disposition_uniform,
463 .name =
"ip4-mpls-label-disposition-uniform",
464 .vector_size =
sizeof(
u32),
467 .sibling_of =
"ip4-input",
472 ip4_mpls_label_disposition_uniform)
484 .function = ip6_mpls_label_disposition_uniform,
485 .name =
"ip6-mpls-label-disposition-uniform",
486 .vector_size =
sizeof(
u32),
489 .sibling_of =
"ip6-input",
494 ip6_mpls_label_disposition_uniform)
497 mpls_disp_dpo_mem_show (
void)
509 .dv_mem_show = mpls_disp_dpo_mem_show,
514 "ip4-mpls-label-disposition-pipe",
519 "ip6-mpls-label-disposition-pipe",
530 "ip4-mpls-label-disposition-uniform",
535 "ip6-mpls-label-disposition-uniform",
dpo_lock_fn_t dv_lock
A reference counting lock function.
u16 mdd_locks
Number of locks/users of the label.
A struct to hold tracing information for the MPLS label disposition node.
void mpls_disp_dpo_create(dpo_proto_t payload_proto, fib_rpf_id_t rpf_id, fib_mpls_lsp_mode_t mode, const dpo_id_t *parent, dpo_id_t *dpo)
Create an MPLS label object.
A virtual function table regisitered for a DPO type.
static uword ip4_mpls_label_disposition_pipe(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *frame)
static void mpls_disp_dpo_lock(dpo_id_t *dpo)
u32 index_t
A Data-Path Object is an object that represents actions that are applied to packets are they are swit...
static const char *const *const mpls_label_disp_pipe_nodes[DPO_PROTO_NUM]
static const char *const mpls_label_disp_pipe_ip6_nodes[]
#define pool_len(p)
Number of elements in pool vector.
static index_t mpls_disp_dpo_get_index(mpls_disp_dpo_t *mdd)
static mpls_disp_dpo_t * mpls_disp_dpo_alloc(void)
VLIB_NODE_FUNCTION_MULTIARCH(ip4_mpls_label_disposition_pipe_node, ip4_mpls_label_disposition_pipe)
void dpo_register(dpo_type_t type, const dpo_vft_t *vft, const char *const *const *nodes)
For a given DPO type Register:
enum dpo_type_t_ dpo_type_t
Common types of data-path objects New types can be dynamically added using dpo_register_new_type() ...
u8 * format_fib_mpls_lsp_mode(u8 *s, va_list *ap)
Format an LSP mode type.
static_always_inline void ip6_set_traffic_class_network_order(ip6_header_t *ip6, u8 dscp)
#define vlib_prefetch_buffer_header(b, type)
Prefetch buffer metadata.
dpo_proto_t mdd_payload_proto
The protocol of the payload/packets that are being encapped.
vlib_node_registration_t ip6_mpls_label_disposition_uniform_node
(constructor) VLIB_REGISTER_NODE (ip6_mpls_label_disposition_uniform_node)
void fib_show_memory_usage(const char *name, u32 in_use_elts, u32 allocd_elts, size_t size_elt)
Show the memory usage for a type.
fib_rpf_id_t mdd_rpf_id
RPF-ID (if this is an mcast disposition)
enum dpo_proto_t_ dpo_proto_t
Data path protocol.
static void mpls_disp_dpo_unlock(dpo_id_t *dpo)
vlib_node_registration_t ip4_mpls_label_disposition_pipe_node
(constructor) VLIB_REGISTER_NODE (ip4_mpls_label_disposition_pipe_node)
The identity of a DPO is a combination of its type and its instance number/index of objects of that t...
static uword mpls_label_disposition_inline(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *from_frame, u8 payload_is_ip4, u8 payload_is_ip6, fib_mpls_lsp_mode_t mode)
enum fib_mpls_lsp_mode_t_ fib_mpls_lsp_mode_t
MPLS LSP mode - only valid at the head and tail.
static void * vlib_buffer_get_current(vlib_buffer_t *b)
Get pointer to current data to process.
#define pool_put(P, E)
Free an object E in pool P.
static const char *const mpls_label_disp_pipe_ip4_nodes[]
static u8 mpls_exp_to_ip_dscp(u8 exp)
When in uniform mode convert an MPLS EXP value to an IPv[46] DSCP value.
#define vlib_validate_buffer_enqueue_x2(vm, node, next_index, to_next, n_left_to_next, bi0, bi1, next0, next1)
Finish enqueueing two buffers forward in the graph.
#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).
mpls_disp_dpo_t * mpls_disp_dpo_pool
#define pool_get_aligned(P, E, A)
Allocate an object E from a pool P (general version).
#define VLIB_REGISTER_NODE(x,...)
#define CLIB_PREFETCH(addr, size, type)
static vlib_node_runtime_t * vlib_node_get_runtime(vlib_main_t *vm, u32 node_index)
Get node runtime by node index.
struct mpls_label_disposition_trace_t_ mpls_label_disposition_trace_t
A struct to hold tracing information for the MPLS label disposition node.
u8 * format_mpls_disp_dpo(u8 *s, va_list *args)
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.
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.
void mpls_disp_dpo_module_init(void)
u32 fib_rpf_id_t
An RPF-ID is numerical value that is used RPF validate.
A representation of an MPLS label for imposition in the data-path.
u16 cached_next_index
Next frame index that vector arguments were last enqueued to last time this node ran.
static const char *const mpls_label_disp_uniform_ip4_nodes[]
u8 * format_dpo_id(u8 *s, va_list *args)
Format a DPO_id_t oject
static const char *const *const mpls_label_disp_uniform_nodes[DPO_PROTO_NUM]
dpo_id_t mdd_dpo
Next DPO in the graph.
static void * vlib_add_trace(vlib_main_t *vm, vlib_node_runtime_t *r, vlib_buffer_t *b, u32 n_data_bytes)
struct _vlib_node_registration vlib_node_registration_t
static mpls_disp_dpo_t * mpls_disp_dpo_get(index_t index)
index_t dpoi_index
the index of objects of that type
fib_mpls_lsp_mode_t mdd_mode
LSP mode.
static const char *const mpls_label_disp_uniform_ip6_nodes[]
static void * vlib_frame_vector_args(vlib_frame_t *f)
Get pointer to frame vector data.
vlib_node_registration_t ip6_mpls_label_disposition_pipe_node
(constructor) VLIB_REGISTER_NODE (ip6_mpls_label_disposition_pipe_node)
u8 * format_dpo_proto(u8 *s, va_list *args)
format a DPO protocol
void dpo_reset(dpo_id_t *dpo)
reset a DPO ID The DPO will be unlocked.
u16 dpoi_next_node
The next VLIB node to follow.
vlib_node_registration_t ip4_mpls_label_disposition_uniform_node
(constructor) VLIB_REGISTER_NODE (ip4_mpls_label_disposition_uniform_node)
#define CLIB_CACHE_LINE_BYTES
u32 flags
buffer flags: VLIB_BUFFER_FREE_LIST_INDEX_MASK: bits used to store free list index, VLIB_BUFFER_IS_TRACED: trace this buffer.
static vlib_buffer_t * vlib_get_buffer(vlib_main_t *vm, u32 buffer_index)
Translate buffer index into buffer pointer.
static u16 ip4_header_checksum(ip4_header_t *i)
static u8 * format_mpls_label_disposition_trace(u8 *s, va_list *args)
void dpo_stack(dpo_type_t child_type, dpo_proto_t child_proto, dpo_id_t *dpo, const dpo_id_t *parent)
Stack one DPO object on another, and thus establish a child-parent relationship.
static uword pool_elts(void *v)
Number of active elements in a pool.