48 u32 * from, * to_next, n_left_from, n_left_to_next;
63 while (n_left_from > 0)
69 while (n_left_from >= 4 && n_left_to_next > 2)
71 u32 bi0, adj_index0, next0;
75 u32 bi1, adj_index1, next1;
128 adj0->rewrite_header.sw_if_index,
134 adj1->rewrite_header.sw_if_index,
153 to_next, n_left_to_next,
157 while (n_left_from > 0 && n_left_to_next > 0)
159 u32 bi0, adj_index0, next0;
185 adj0->rewrite_header.sw_if_index,
198 to_next, n_left_to_next,
215 s =
format(s,
"adj-midchain:[%d]:%U", tr->
ai,
232 .name =
"adj-midchain-tx",
233 .vector_size =
sizeof (
u32),
253 .name =
"adj-midchain-tx-no-count",
254 .vector_size =
sizeof (
u32),
265 .arc_name =
"ip4-output",
266 .node_name =
"adj-midchain-tx",
271 .arc_name =
"ip4-output",
272 .node_name =
"adj-midchain-tx-no-count",
277 .arc_name =
"ip6-output",
278 .node_name =
"adj-midchain-tx",
283 .arc_name =
"ip6-output",
284 .node_name =
"adj-midchain-tx-no-count",
289 .arc_name =
"mpls-output",
290 .node_name =
"adj-midchain-tx",
295 .arc_name =
"mpls-output",
296 .node_name =
"adj-midchain-tx-no-count",
301 .arc_name =
"ethernet-output",
302 .node_name =
"adj-midchain-tx",
307 .arc_name =
"ethernet-output",
308 .node_name =
"adj-midchain-tx-no-count",
313 .arc_name =
"nsh-output",
314 .node_name =
"adj-midchain-tx",
319 .arc_name =
"nsh-output",
320 .node_name =
"adj-midchain-tx-no-count",
430 adj->rewrite_header.sw_if_index,
503 u32 indent = va_arg(*ap,
u32);
507 s =
format (s,
" via %U ",
511 &adj->rewrite_header, sizeof (adj->rewrite_data), indent);
512 s =
format (s,
"\n%Ustacked-on:\n%U%U",
static uword adj_midchain_tx(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *frame)
static const char *const midchain_nsh_nodes[]
static const char *const midchain_ip6_nodes[]
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.
dpo_lock_fn_t dv_lock
A reference counting lock function.
#define VNET_LINK_NUM
Number of link types.
static u32 adj_midchain_tx_no_count_feature_node[VNET_LINK_NUM]
vlib_node_registration_t ip6_midchain_node
(constructor) VLIB_REGISTER_NODE (ip6_midchain_node)
A virtual function table regisitered for a DPO type.
static vlib_node_registration_t adj_midchain_tx_node
(constructor) VLIB_REGISTER_NODE (adj_midchain_tx_node)
void adj_lock(adj_index_t adj_index)
An adjacency is a representation of an attached L3 peer.
vnet_main_t * vnet_get_main(void)
struct ip_adjacency_t_::@138::@139 nbr
IP_LOOKUP_NEXT_ARP/IP_LOOKUP_NEXT_REWRITE.
static uword adj_midchain_tx_no_count(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *frame)
vnet_interface_main_t interface_main
static const char *const midchain_ip4_nodes[]
The per-protocol VLIB graph nodes that are assigned to a midchain object.
u8 * format_vnet_link(u8 *s, va_list ap)
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.
vlib_node_registration_t ip4_midchain_node
(constructor) VLIB_REGISTER_NODE (ip4_midchain_node)
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
union ip_adjacency_t_::@138 sub_type
void adj_nbr_update_rewrite_internal(ip_adjacency_t *adj, ip_lookup_next_t adj_next_index, u32 complete_next_index, u32 next_index, u8 *rewrite)
static uword vlib_buffer_length_in_chain(vlib_main_t *vm, vlib_buffer_t *b)
Get length in bytes of the buffer chain.
void adj_nbr_midchain_update_rewrite(adj_index_t adj_index, adj_midchain_fixup_t fixup, adj_midchain_flag_t flags, u8 *rewrite)
adj_nbr_midchain_update_rewrite
const dpo_id_t * drop_dpo_get(dpo_proto_t proto)
u8 output_feature_arc_index
ethernet_main_t ethernet_main
static ip_adjacency_t * adj_get(adj_index_t adj_index)
Get a pointer to an adjacency object from its index.
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 adj_nsh_midchain_node
(constructor) VLIB_REGISTER_NODE (adj_nsh_midchain_node)
dpo_proto_t vnet_link_to_dpo_proto(vnet_link_t linkt)
vlib_combined_counter_main_t * combined_sw_if_counters
int vnet_feature_enable_disable_with_index(u8 arc_index, u32 feature_index, u32 sw_if_index, int enable_disable, void *feature_config, u32 n_feature_config_bytes)
#define vlib_prefetch_buffer_header(b, type)
Prefetch buffer metadata.
static const char *const *const midchain_nodes[DPO_PROTO_NUM]
u8 output_feature_arc_index
void adj_unlock(adj_index_t adj_index)
Release a reference counting lock on the adjacency.
vlib_node_registration_t mpls_midchain_node
(constructor) VLIB_REGISTER_NODE (mpls_midchain_node)
format_function_t format_vnet_rewrite
static uword adj_midchain_tx_inline(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *frame, int interface_count)
u8 output_feature_arc_index
vlib_node_registration_t adj_l2_midchain_node
(constructor) VLIB_REGISTER_NODE (adj_l2_midchain_node)
static const char *const midchain_mpls_nodes[]
The identity of a DPO is a combination of its type and its instance number/index of objects of that t...
#define ADJ_INDEX_INVALID
Invalid ADJ index - used when no adj is known likewise blazoned capitals INVALID speak volumes where ...
static u32 adj_get_midchain_node(vnet_link_t link)
Trace data for packets traversing the midchain tx node.
void adj_midchain_module_init(void)
Module initialisation.
adj_index_t ai
the midchain adj we are traversing
static u8 adj_midchain_get_feature_arc_index_for_link_type(const ip_adjacency_t *adj)
static vlib_node_registration_t adj_midchain_tx_no_count_node
(constructor) VLIB_REGISTER_NODE (adj_midchain_tx_no_count_node)
#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).
Packets TX through the midchain do not increment the interface counters.
#define CLIB_PREFETCH(addr, size, type)
static void adj_dpo_unlock(dpo_id_t *dpo)
static u8 * format_adj_midchain_tx_trace(u8 *s, va_list *args)
#define VLIB_BUFFER_IS_TRACED
u32 adj_index_t
An index for adjacencies.
This packet matches an "incomplete adjacency" and packets need to be passed to ARP to find rewrite st...
u8 * format_adj_midchain(u8 *s, va_list *ap)
Format a midchain adjacency.
u16 cached_next_index
Next frame index that vector arguments were last enqueued to last time this node ran.
void adj_nbr_midchain_stack(adj_index_t adj_index, const dpo_id_t *next)
adj_nbr_midchain_stack
static void vlib_increment_combined_counter(vlib_combined_counter_main_t *cm, u32 cpu_index, u32 index, u64 n_packets, u64 n_bytes)
Increment a combined counter.
ip_lookup_main_t lookup_main
enum vnet_link_t_ vnet_link_t
Link Type: A description of the protocol of packets on the link.
This packets follow a mid-chain adjacency.
struct ip_adjacency_t_::@138::@140 midchain
IP_LOOKUP_NEXT_MIDCHAIN.
void(* adj_midchain_fixup_t)(vlib_main_t *vm, struct ip_adjacency_t_ *adj, vlib_buffer_t *b0)
A function type for post-rewrite fixups on midchain adjacency.
void adj_nbr_midchain_unstack(adj_index_t adj_index)
adj_nbr_midchain_unstack
u8 * format_dpo_id(u8 *s, va_list *args)
Format a DPO_id_t oject
#define VNET_FEATURES(...)
static void adj_dpo_lock(dpo_id_t *dpo)
static void * vlib_add_trace(vlib_main_t *vm, vlib_node_runtime_t *r, vlib_buffer_t *b, u32 n_data_bytes)
enum adj_midchain_flag_t_ adj_midchain_flag_t
Midchain Adjacency sub-type.
index_t dpoi_index
the index of objects of that type
ip_lookup_next_t lookup_next_index
nsh_main_dummy_t nsh_main_dummy
struct adj_midchain_tx_trace_t_ adj_midchain_tx_trace_t
Trace data for packets traversing the midchain tx node.
static u32 adj_midchain_tx_feature_node[VNET_LINK_NUM]
The two midchain tx feature node indices.
static void * vlib_frame_vector_args(vlib_frame_t *f)
Get pointer to frame vector data.
#define VLIB_REGISTER_NODE(x,...)
ip4_main_t ip4_main
Global ip4 main structure.
#define CLIB_MEMORY_BARRIER()
u16 dpoi_next_node
The next VLIB node to follow.
#define CLIB_CACHE_LINE_BYTES
u32 flags
buffer flags: VLIB_BUFFER_IS_TRACED: trace this buffer.
static const char *const midchain_ethernet_nodes[]
static vlib_buffer_t * vlib_get_buffer(vlib_main_t *vm, u32 buffer_index)
Translate buffer index into buffer pointer.
VNET_FEATURE_INIT(adj_midchain_tx_ip4, static)
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.