22 #ifndef CLIB_MARCH_VARIANT 52 return (dd - dvr_dpo_pool);
182 #ifndef CLIB_MARCH_VARIANT 208 return (
format(s,
"%U-dvr-%U-dpo %U",
280 u32 n_left_from, next_index, * from, * to_next;
290 while (n_left_from > 0)
296 while (n_left_from >= 4 && n_left_to_next > 2)
299 u32 bi0, ddi0, bi1, ddi1;
336 b0->
flags |= VNET_BUFFER_F_IS_DVR;
337 b1->
flags |= VNET_BUFFER_F_IS_DVR;
363 n_left_to_next, bi0, bi1,
367 while (n_left_from > 0 && n_left_to_next > 0)
398 b0->
flags |= VNET_BUFFER_F_IS_DVR;
431 s =
format (s,
"%U sw_if_index:%d",
452 .name =
"ip4-dvr-dpo",
453 .vector_size =
sizeof (
u32),
455 .sibling_of =
"ip4-rewrite",
458 .name =
"ip6-dvr-dpo",
459 .vector_size =
sizeof (
u32),
461 .sibling_of =
"ip6-rewrite",
475 u32 n_left_from, next_index, * from, * to_next;
482 while (n_left_from > 0)
488 while (n_left_from >= 4 && n_left_to_next > 2)
492 u32 bi0, bi1, ddi0, ddi1;
507 if (b0->
flags & VNET_BUFFER_F_IS_DVR)
518 if (b1->
flags & VNET_BUFFER_F_IS_DVR)
545 n_left_to_next, bi0, bi1,
549 while (n_left_from > 0 && n_left_to_next > 0)
565 if (b0->
flags & VNET_BUFFER_F_IS_DVR)
585 n_left_to_next, bi0, next0);
607 .name =
"ip4-dvr-reinject",
608 .vector_size =
sizeof (
u32),
619 .name =
"ip6-dvr-reinject",
620 .vector_size =
sizeof (
u32),
632 .arc_name =
"ip4-output",
633 .node_name =
"ip4-dvr-reinject",
635 "acl-plugin-out-ip4-fa"),
639 .arc_name =
"ip6-output",
640 .node_name =
"ip6-dvr-reinject",
static clib_error_t * dvr_dpo_interface_delete(vnet_main_t *vnm, u32 sw_if_index, u32 is_add)
u32 flags
buffer flags: VLIB_BUFFER_FREE_LIST_INDEX_MASK: bits used to store free list index, VLIB_BUFFER_IS_TRACED: trace this buffer.
dpo_lock_fn_t dv_lock
A reference counting lock function.
vlib_node_registration_t ip6_dvr_dpo_node
(constructor) VLIB_REGISTER_NODE (ip6_dvr_dpo_node)
static clib_error_t * dvr_dpo_hw_interface_state_change(vnet_main_t *vnm, u32 hw_if_index, u32 flags)
Registered callback for HW interface state changes.
A virtual function table regisitered for a DPO type.
static uword dvr_reinject_inline(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *from_frame)
static u8 * format_dvr_dpo_trace(u8 *s, va_list *args)
vnet_main_t * vnet_get_main(void)
Interface DPO trace data.
u32 index_t
A Data-Path Object is an object that represents actions that are applied to packets are they are swit...
ip_lookup_main_t lookup_main
static vnet_sw_interface_t * vnet_get_sw_interface(vnet_main_t *vnm, u32 sw_if_index)
VNET_SW_INTERFACE_ADD_DEL_FUNCTION(dvr_dpo_interface_delete)
#define VLIB_NODE_FN(node)
static dvr_dpo_t * dvr_dpo_get(index_t index)
#define pool_get(P, E)
Allocate an object E from a pool P (unspecified alignment).
u16 dd_locks
number of locks.
#define pool_len(p)
Number of elements in pool vector.
static clib_error_t * dvr_dpo_interface_state_change(vnet_main_t *vnm, u32 sw_if_index, u32 flags)
VNET_HW_INTERFACE_LINK_UP_DOWN_FUNCTION(dvr_dpo_hw_interface_state_change)
u8 output_feature_arc_index
static index_t * dvr_dpo_db[DPO_PROTO_NUM]
The 'DB' of DVR DPOs.
void dpo_register(dpo_type_t type, const dpo_vft_t *vft, const char *const *const *nodes)
For a given DPO type Register:
vlib_node_registration_t ip6_dvr_reinject_node
(constructor) VLIB_REGISTER_NODE (ip6_dvr_reinject_node)
enum dvr_dpo_reinject_t_ dvr_dpo_reinject_t
Control how the reinject is performed.
vl_api_interface_index_t sw_if_index
enum dvr_reinject_next_t_ dvr_reinject_next_t
static index_t dvr_dpo_get_index(dvr_dpo_t *dd)
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.
enum dpo_proto_t_ dpo_proto_t
Data path protocol.
VNET_SW_INTERFACE_ADMIN_UP_DOWN_FUNCTION(dvr_dpo_interface_state_change)
The identity of a DPO is a combination of its type and its instance number/index of objects of that t...
format_function_t format_vnet_sw_interface_name
static ethernet_header_t * ethernet_buffer_get_header(vlib_buffer_t *b)
dpo_type_t dpoi_type
the type
struct dvr_dpo_trace_t_ dvr_dpo_trace_t
Interface DPO trace data.
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.
VNET_FEATURE_INIT(ip4_dvr_reinject_feat_node, static)
void dvr_dpo_module_init(void)
#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).
void dvr_dpo_add_or_lock(u32 sw_if_index, dpo_proto_t dproto, dpo_id_t *dpo)
static void dvr_dpo_lock(dpo_id_t *dpo)
dpo_proto_t dd_proto
The protocol of packets using this DPO.
static void dvr_dpo_unlock(dpo_id_t *dpo)
#define VLIB_REGISTER_NODE(x,...)
u32 dd_sw_if_index
The Software interface index that the packets will output on.
static_always_inline void vnet_feature_next(u32 *next0, vlib_buffer_t *b0)
static const char *const dvr_dpo_ip6_nodes[]
static dvr_dpo_t * dvr_dpo_get_from_dpo(const dpo_id_t *dpo)
vlib_node_registration_t ip4_dvr_reinject_node
(constructor) VLIB_REGISTER_NODE (ip4_dvr_reinject_node)
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.
vlib_main_t vlib_node_runtime_t * node
u16 cached_next_index
Next frame index that vector arguments were last enqueued to last time this node ran.
ip_lookup_main_t lookup_main
static const char *const dvr_dpo_ip4_nodes[]
The per-protocol VLIB graph nodes that are assigned to a glean object.
static u8 * format_dvr_dpo(u8 *s, va_list *ap)
static void vlib_buffer_advance(vlib_buffer_t *b, word l)
Advance current data pointer by the supplied (signed!) amount.
dvr_dpo_reinject_t dd_reinject
Control for how the re-inject is performed.
#define VNET_FEATURES(...)
static void * vlib_add_trace(vlib_main_t *vm, vlib_node_runtime_t *r, vlib_buffer_t *b, u32 n_data_bytes)
static u8 * format_dvr_reinject(u8 *s, va_list *ap)
index_t dpoi_index
the index of objects of that type
#define INDEX_INVALID
Invalid index - used when no index is known blazoned capitals INVALID speak volumes where ~0 does not...
VLIB buffer representation.
static void * vlib_frame_vector_args(vlib_frame_t *f)
Get pointer to frame vector data.
u8 * format_dpo_proto(u8 *s, va_list *args)
format a DPO protocol
vlib_node_registration_t ip4_dvr_dpo_node
(constructor) VLIB_REGISTER_NODE (ip4_dvr_dpo_node)
static const char *const *const dvr_dpo_nodes[DPO_PROTO_NUM]
ip4_main_t ip4_main
Global ip4 main structure.
dvr_dpo_t * dvr_dpo_pool
pool of all interface DPOs
static void dvr_dpo_mem_show(void)
static uword dvr_dpo_inline(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *from_frame, u8 is_ip6)
#define vec_validate_init_empty(V, I, INIT)
Make sure vector is long enough for given index and initialize empty space (no header, unspecified alignment)
static dvr_dpo_t * dvr_dpo_alloc(void)
static vlib_buffer_t * vlib_get_buffer(vlib_main_t *vm, u32 buffer_index)
Translate buffer index into buffer pointer.
int vnet_feature_enable_disable(const char *arc_name, const char *node_name, u32 sw_if_index, int enable_disable, void *feature_config, u32 n_feature_config_bytes)
static_always_inline void vnet_feature_arc_start(u8 arc, u32 sw_if_index, u32 *next0, vlib_buffer_t *b0)
static uword pool_elts(void *v)
Number of active elements in a pool.