52 u32 * from, * to_next, n_left_from, n_left_to_next;
67 while (n_left_from > 0)
72 while (n_left_from >= 8 && n_left_to_next > 4)
75 const dpo_id_t *dpo0, *dpo1, *dpo2, *dpo3;
77 u32 bi0, adj_index0, next0;
78 u32 bi1, adj_index1, next1;
79 u32 bi2, adj_index2, next2;
80 u32 bi3, adj_index3, next3;
148 adj0->rewrite_header.sw_if_index,
154 adj1->rewrite_header.sw_if_index,
160 adj2->rewrite_header.sw_if_index,
166 adj3->rewrite_header.sw_if_index,
197 to_next, n_left_to_next,
199 next0, next1, next2, next3);
201 while (n_left_from > 0 && n_left_to_next > 0)
203 u32 bi0, adj_index0, next0;
229 adj0->rewrite_header.sw_if_index,
242 to_next, n_left_to_next,
259 s =
format(s,
"adj-midchain:[%d]:%U", tr->
ai,
276 .name =
"adj-midchain-tx",
277 .vector_size =
sizeof (
u32),
297 .name =
"adj-midchain-tx-no-count",
298 .vector_size =
sizeof (
u32),
309 .arc_name =
"ip4-output",
310 .node_name =
"adj-midchain-tx",
315 .arc_name =
"ip4-output",
316 .node_name =
"adj-midchain-tx-no-count",
321 .arc_name =
"ip6-output",
322 .node_name =
"adj-midchain-tx",
327 .arc_name =
"ip6-output",
328 .node_name =
"adj-midchain-tx-no-count",
333 .arc_name =
"mpls-output",
334 .node_name =
"adj-midchain-tx",
339 .arc_name =
"mpls-output",
340 .node_name =
"adj-midchain-tx-no-count",
345 .arc_name =
"ethernet-output",
346 .node_name =
"adj-midchain-tx",
351 .arc_name =
"ethernet-output",
352 .node_name =
"adj-midchain-tx-no-count",
357 .arc_name =
"nsh-output",
358 .node_name =
"adj-midchain-tx",
363 .arc_name =
"nsh-output",
364 .node_name =
"adj-midchain-tx-no-count",
469 adj->rewrite_header.sw_if_index,
485 u32 feature_index, tx_node;
503 adj->rewrite_header.sw_if_index);
508 adj->rewrite_header.sw_if_index,
534 const void *fixup_data,
582 entry_indicies = NULL;
616 entry_indicies = NULL;
699 entries = *entry_indicies;
722 u32 indent = va_arg(*ap,
u32);
727 s =
format(s,
" [features]");
733 &adj->rewrite_header, sizeof (adj->rewrite_data), indent);
734 s =
format (s,
"\n%Ustacked-on",
static uword adj_midchain_tx(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *frame)
#define vec_validate(V, I)
Make sure vector is long enough for given index (no header, unspecified alignment) ...
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.
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.
#define VNET_LINK_NUM
Number of link types.
static u32 adj_midchain_tx_no_count_feature_node[VNET_LINK_NUM]
adj_flags_t ia_flags
Flags on the adjacency 1-bytes.
Contribute an object that is to be used to forward IP6 packets.
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)
static void vlib_increment_combined_counter(vlib_combined_counter_main_t *cm, u32 thread_index, u32 index, u64 n_packets, u64 n_bytes)
Increment a combined counter.
void adj_lock(adj_index_t adj_index)
Take a reference counting lock on the adjacency.
vnet_main_t * vnet_get_main(void)
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.
const u8 * adj_get_rewrite(adj_index_t ai)
Return the rewrite string of the adjacency.
static u32 ip4_compute_flow_hash(const ip4_header_t *ip, flow_hash_config_t flow_hash_config)
void fib_entry_contribute_forwarding(fib_node_index_t fib_entry_index, fib_forward_chain_type_t fct, dpo_id_t *dpo)
flow_hash_config_t lb_hash_config
the hash config to use when selecting a bucket.
vlib_node_registration_t ip4_midchain_node
(constructor) VLIB_REGISTER_NODE (ip4_midchain_node)
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.
void dpo_copy(dpo_id_t *dst, const dpo_id_t *src)
atomic copy a data-plane object.
u32 index_t
A Data-Path Object is an object that represents actions that are applied to packets are they are swit...
#define vlib_validate_buffer_enqueue_x4(vm, node, next_index, to_next, n_left_to_next, bi0, bi1, bi2, bi3, next0, next1, next2, next3)
Finish enqueueing four buffers forward in the graph.
Contribute an object that is to be used to forward IP4 packets.
ip_lookup_main_t lookup_main
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)
adj_nbr_update_rewrite_internal
static uword vlib_buffer_length_in_chain(vlib_main_t *vm, vlib_buffer_t *b)
Get length in bytes of the buffer chain.
u32 adj_dpo_get_urpf(const dpo_id_t *dpo)
vnet_link_t ia_link
link/ether-type 1 bytes
union ip_adjacency_t_::@48 sub_type
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)
u16 lb_n_buckets_minus_1
number of buckets in the load-balance - 1.
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]
void adj_nbr_midchain_stack_on_fib_entry(adj_index_t ai, fib_node_index_t fei, fib_forward_chain_type_t fct)
[re]stack a midchain.
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)
struct ip_adjacency_t_::@48::@50 midchain
IP_LOOKUP_NEXT_MIDCHAIN.
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)
dpo_type_t dpoi_type
the type
static const dpo_id_t * load_balance_get_bucket_i(const load_balance_t *lb, u32 bucket)
Trace data for packets traversing the midchain tx node.
void adj_midchain_module_init(void)
Module initialisation.
int adj_ndr_midchain_recursive_loop_detect(adj_index_t ai, fib_node_index_t **entry_indicies)
descend the FIB graph looking for loops
adj_index_t ai
the midchain adj we are traversing
load-balancing over a choice of [un]equal cost paths
static u32 ip6_compute_flow_hash(const ip6_header_t *ip, flow_hash_config_t flow_hash_config)
This packet matches an "interface route" and packets need to be passed to ARP to find rewrite string ...
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_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).
struct ip_adjacency_t_::@48::@49 nbr
IP_LOOKUP_NEXT_ARP/IP_LOOKUP_NEXT_REWRITE.
This packet matches an "incomplete adjacency" and packets need to be passed to ARP to find rewrite st...
#define VLIB_REGISTER_NODE(x,...)
static void adj_dpo_unlock(dpo_id_t *dpo)
#define vec_free(V)
Free vector's memory (no header).
Multicast Midchain Adjacency.
static u8 * format_adj_midchain_tx_trace(u8 *s, va_list *args)
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
int fib_entry_recursive_loop_detect(fib_node_index_t entry_index, fib_node_index_t **entry_indicies)
u32 fib_node_index_t
A typedef of a node index.
void(* adj_midchain_fixup_t)(vlib_main_t *vm, struct ip_adjacency_t_ *adj, vlib_buffer_t *b0, const void *data)
A function type for post-rewrite fixups on midchain adjacency.
void adj_midchain_teardown(ip_adjacency_t *adj)
adj_midchain_setup
u32 adj_index_t
An index for adjacencies.
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.
u8 * format_adj_midchain(u8 *s, va_list *ap)
Format a midchain adjacency.
This packets follow a mid-chain adjacency.
u16 cached_next_index
Next frame index that vector arguments were last enqueued to last time this node ran.
static u32 adj_nbr_midchain_get_tx_node(ip_adjacency_t *adj)
void adj_nbr_midchain_stack(adj_index_t adj_index, const dpo_id_t *next)
adj_nbr_midchain_stack
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.
static load_balance_t * load_balance_get(index_t lbi)
enum fib_forward_chain_type_t_ fib_forward_chain_type_t
FIB output chain type.
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)
enum adj_flags_t_ adj_flags_t
Flags on an IP adjacency.
static void * vlib_add_trace(vlib_main_t *vm, vlib_node_runtime_t *r, vlib_buffer_t *b, u32 n_data_bytes)
fib_protocol_t ia_nh_proto
The protocol of the neighbor/peer.
index_t dpoi_index
the index of objects of that type
#define FIB_NODE_INDEX_INVALID
ip_lookup_next_t lookup_next_index
Next hop after ip4-lookup.
void adj_midchain_setup(adj_index_t adj_index, adj_midchain_fixup_t fixup, const void *data, adj_flags_t flags)
adj_midchain_setup
VLIB buffer representation.
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 DPO_INVALID
An initialiser for DPOs declared on the stack.
ip4_main_t ip4_main
Global ip4 main structure.
void dpo_reset(dpo_id_t *dpo)
reset a DPO ID The DPO will be unlocked.
#define vec_foreach(var, vec)
Vector iterator.
#define CLIB_MEMORY_BARRIER()
u8 * format_vnet_link(u8 *s, va_list *ap)
u16 dpoi_next_node
The next VLIB node to follow.
This adjacency/interface has output features configured.
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)
static u32 * adj_midchain_feat_count_per_sw_if_index[VNET_LINK_NUM]
static u32 adj_nbr_midchain_get_feature_node(ip_adjacency_t *adj)
static ip46_type_t adj_proto_to_46(fib_protocol_t proto)
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.