28 u8 packet_data[64 - 1*
sizeof(
u32)];
31 #define foreach_nsh_output_next \ 32 _(DROP, "error-drop") \ 33 _(INTERFACE, "interface-output" ) 36 #define _(s,n) NSH_OUTPUT_NEXT_##s, 50 s =
format (s,
"adj-idx %d : %U flow hash: 0x%08x",
67 u32 n_left_from, next_index, * from, * to_next, thread_index;
79 while (n_left_from > 0)
82 to_next, n_left_to_next);
84 while (n_left_from >= 4 && n_left_to_next >= 2)
87 nsh_base_header_t *hdr0;
90 u32 pi0, adj_index0, next0, error0;
93 nsh_base_header_t *hdr1;
96 u32 pi1, adj_index1, next1, error1;
97 int pkt_len0, pkt_len1;
98 word rw_len0, rw_len1;
114 pi0 = to_next[0] = from[0];
115 pi1 = to_next[1] = from[1];
138 eth_hdr0->
type = clib_host_to_net_u16(ETHERNET_TYPE_NSH);
140 eth_hdr1->
type = clib_host_to_net_u16(ETHERNET_TYPE_NSH);
143 rw_len0 = adj0[0].rewrite_header.data_bytes;
144 rw_len1 = adj1[0].rewrite_header.data_bytes;
149 if (adj_index0 == adj_index1)
152 pkt_len0 + rw_len0 + pkt_len1 + rw_len1);
163 adj0[0].rewrite_header.max_l3_packet_bytes))
168 adj0[0].rewrite_header.sw_if_index;
169 next0 = NSH_OUTPUT_NEXT_INTERFACE;
170 error0 = IP4_ERROR_NONE;
174 adj0[0].rewrite_header.sw_if_index,
179 error0 = IP4_ERROR_MTU_EXCEEDED;
180 next0 = NSH_OUTPUT_NEXT_DROP;
183 adj1[0].rewrite_header.max_l3_packet_bytes))
188 adj1[0].rewrite_header.sw_if_index;
189 next1 = NSH_OUTPUT_NEXT_INTERFACE;
190 error1 = IP4_ERROR_NONE;
194 adj1[0].rewrite_header.sw_if_index,
199 error1 = IP4_ERROR_MTU_EXCEEDED;
200 next1 = NSH_OUTPUT_NEXT_DROP;
229 to_next, n_left_to_next,
230 pi0, pi1, next0, next1);
233 while (n_left_from > 0 && n_left_to_next > 0)
236 nsh_base_header_t *hdr0;
239 u32 pi0, adj_index0, next0, error0;
243 pi0 = to_next[0] = from[0];
257 eth_hdr0->
type = clib_host_to_net_u16(ETHERNET_TYPE_NSH);
260 rw_len0 = adj0[0].rewrite_header.data_bytes;
267 if (
PREDICT_TRUE(pkt_len0 <= adj0[0].rewrite_header.max_l3_packet_bytes))
272 adj0[0].rewrite_header.sw_if_index;
273 next0 = NSH_OUTPUT_NEXT_INTERFACE;
274 error0 = IP4_ERROR_NONE;
278 adj0[0].rewrite_header.sw_if_index,
283 error0 = IP4_ERROR_MTU_EXCEEDED;
284 next0 = NSH_OUTPUT_NEXT_DROP;
308 to_next, n_left_to_next,
331 .name =
"nsh-eth-output",
333 .vector_size =
sizeof (
u32),
336 #define _(s,n) [NSH_OUTPUT_NEXT_##s] = n, 352 .name =
"nsh-midchain",
353 .vector_size =
sizeof (
u32),
363 .arc_name =
"nsh-eth-output",
364 .node_name =
"interface-output",
372 .arc_name =
"nsh-eth-output",
378 .arc_name =
"nsh-eth-output",
379 .node_name =
"error-drop",
386 #define foreach_nsh_adj_incomplete_next \ 387 _(DROP, "error-drop") \ 389 _(IP6, "ip6-discover-neighbor") 392 #define _(s,n) NSH_ADJ_INCOMPLETE_NEXT_##s, 419 u32 n_left_from, next_index, * from, * to_next;
422 n_left_from = from_frame->n_vectors;
423 next_index =
node->cached_next_index;
425 while (n_left_from > 0)
430 to_next, n_left_to_next);
432 while (n_left_from > 0 && n_left_to_next > 0)
434 u32 pi0, next0, adj_index0;
438 pi0 = to_next[0] = from[0];
451 next0 = NSH_ADJ_INCOMPLETE_NEXT_IP4;
455 next0 = NSH_ADJ_INCOMPLETE_NEXT_IP6;
466 to_next, n_left_to_next,
473 return from_frame->n_vectors;
487 s =
format (s,
"%Unext:%d",
494 .name =
"nsh-adj-incomplete",
497 .vector_size =
sizeof (
u32),
500 #define _(s,n) [NSH_ADJ_INCOMPLETE_NEXT_##s] = n,
#define vnet_rewrite_one_header(rw0, p0, most_likely_size)
u32 flags
buffer flags: VLIB_BUFFER_FREE_LIST_INDEX_MASK: bits used to store free list index, VLIB_BUFFER_IS_TRACED: trace this buffer.
enum nsh_midchain_next_t_ nsh_midchain_next_t
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.
VNET_FEATURE_ARC_INIT(nsh_eth_output, static)
vlib_node_registration_t nsh_adj_incomplete_node
(constructor) VLIB_REGISTER_NODE (nsh_adj_incomplete_node)
struct ip_adjacency_t_::@161::@163 midchain
IP_LOOKUP_NEXT_MIDCHAIN.
#define VLIB_NODE_FN(node)
vlib_error_t * errors
Vector of errors for this node.
static uword vlib_buffer_length_in_chain(vlib_main_t *vm, vlib_buffer_t *b)
Get length in bytes of the buffer chain.
u8 output_feature_arc_index
A struct to hold tracing information for the NSH label imposition node.
u8 packet_data[64 - 1 *sizeof(u32)]
VNET_FEATURE_INIT(nsh_interface_output, static)
static ip_adjacency_t * adj_get(adj_index_t adj_index)
Get a pointer to an adjacency object from its index.
vlib_node_registration_t nsh_midchain_node
(constructor) VLIB_REGISTER_NODE (nsh_midchain_node)
struct nsh_adj_incomplete_trace_t_ nsh_adj_incomplete_trace_t
A struct to hold tracing information for the NSH label imposition node.
description fragment has unexpected format
#define vlib_prefetch_buffer_header(b, type)
Prefetch buffer metadata.
vlib_node_registration_t nsh_eth_output_node
(constructor) VLIB_REGISTER_NODE (nsh_eth_output_node)
static u8 * format_nsh_output_trace(u8 *s, va_list *args)
vlib_error_t error
Error code for buffers to be enqueued to error handler.
static void * vlib_buffer_get_current(vlib_buffer_t *b)
Get pointer to current data to process.
static uword nsh_output_inline(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *from_frame, int is_midchain)
#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).
vlib_combined_counter_main_t adjacency_counters
Adjacency packet counters.
#define VLIB_REGISTER_NODE(x,...)
static_always_inline uword vlib_get_thread_index(void)
#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.
static u8 * format_nsh_adj_incomplete_trace(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.
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.
#define foreach_nsh_output_next
static void vlib_buffer_advance(vlib_buffer_t *b, word l)
Advance current data pointer by the supplied (signed!) amount.
#define VNET_FEATURES(...)
union ip_adjacency_t_::@161 sub_type
fib_protocol_t ia_nh_proto
The protocol of the neighbor/peer.
VLIB buffer representation.
static void * vlib_frame_vector_args(vlib_frame_t *f)
Get pointer to frame vector data.
#define foreach_nsh_adj_incomplete_next
Next index values from the NSH incomplete adj node.
void * vlib_add_trace(vlib_main_t *vm, vlib_node_runtime_t *r, vlib_buffer_t *b, u32 n_data_bytes)
#define vnet_rewrite_two_headers(rw0, rw1, p0, p1, most_likely_size)
This adjacency/interface has output features configured.
static vlib_buffer_t * vlib_get_buffer(vlib_main_t *vm, u32 buffer_index)
Translate buffer index into buffer pointer.
nsh_adj_incomplete_next_t
static_always_inline void vnet_feature_arc_start(u8 arc, u32 sw_if_index, u32 *next0, vlib_buffer_t *b0)