29 u8 packet_data[64 - 1*
sizeof(
u32)];
32 #define foreach_nsh_output_next \ 33 _(DROP, "error-drop") \ 34 _(INTERFACE, "interface-output" ) 37 #define _(s,n) NSH_OUTPUT_NEXT_##s, 51 s =
format (s,
"adj-idx %d : %U flow hash: 0x%08x",
68 u32 n_left_from, next_index, * from, * to_next, thread_index;
80 while (n_left_from > 0)
83 to_next, n_left_to_next);
85 while (n_left_from >= 4 && n_left_to_next >= 2)
88 nsh_base_header_t *hdr0;
91 u32 pi0, adj_index0, next0, error0;
94 nsh_base_header_t *hdr1;
97 u32 pi1, adj_index1, next1, error1;
98 int pkt_len0, pkt_len1;
99 word rw_len0, rw_len1;
115 pi0 = to_next[0] = from[0];
116 pi1 = to_next[1] = from[1];
139 eth_hdr0->
type = clib_host_to_net_u16(ETHERNET_TYPE_NSH);
141 eth_hdr1->
type = clib_host_to_net_u16(ETHERNET_TYPE_NSH);
144 rw_len0 = adj0[0].rewrite_header.data_bytes;
145 rw_len1 = adj1[0].rewrite_header.data_bytes;
150 if (adj_index0 == adj_index1)
153 pkt_len0 + rw_len0 + pkt_len1 + rw_len1);
164 adj0[0].rewrite_header.max_l3_packet_bytes))
169 adj0[0].rewrite_header.sw_if_index;
170 next0 = NSH_OUTPUT_NEXT_INTERFACE;
171 error0 = IP4_ERROR_NONE;
175 adj0[0].rewrite_header.sw_if_index,
180 error0 = IP4_ERROR_MTU_EXCEEDED;
181 next0 = NSH_OUTPUT_NEXT_DROP;
184 adj1[0].rewrite_header.max_l3_packet_bytes))
189 adj1[0].rewrite_header.sw_if_index;
190 next1 = NSH_OUTPUT_NEXT_INTERFACE;
191 error1 = IP4_ERROR_NONE;
195 adj1[0].rewrite_header.sw_if_index,
200 error1 = IP4_ERROR_MTU_EXCEEDED;
201 next1 = NSH_OUTPUT_NEXT_DROP;
230 to_next, n_left_to_next,
231 pi0, pi1, next0, next1);
234 while (n_left_from > 0 && n_left_to_next > 0)
237 nsh_base_header_t *hdr0;
240 u32 pi0, adj_index0, next0, error0;
244 pi0 = to_next[0] = from[0];
258 eth_hdr0->
type = clib_host_to_net_u16(ETHERNET_TYPE_NSH);
261 rw_len0 = adj0[0].rewrite_header.data_bytes;
268 if (
PREDICT_TRUE(pkt_len0 <= adj0[0].rewrite_header.max_l3_packet_bytes))
273 adj0[0].rewrite_header.sw_if_index;
274 next0 = NSH_OUTPUT_NEXT_INTERFACE;
275 error0 = IP4_ERROR_NONE;
279 adj0[0].rewrite_header.sw_if_index,
284 error0 = IP4_ERROR_MTU_EXCEEDED;
285 next0 = NSH_OUTPUT_NEXT_DROP;
309 to_next, n_left_to_next,
332 .name =
"nsh-eth-output",
334 .vector_size =
sizeof (
u32),
337 #define _(s,n) [NSH_OUTPUT_NEXT_##s] = n, 353 .name =
"nsh-midchain",
354 .vector_size =
sizeof (
u32),
364 .arc_name =
"nsh-eth-output",
365 .node_name =
"interface-output",
373 .arc_name =
"nsh-eth-output",
379 .arc_name =
"nsh-eth-output",
380 .node_name =
"error-drop",
387 #define foreach_nsh_adj_incomplete_next \ 388 _(DROP, "error-drop") \ 390 _(IP6, "ip6-discover-neighbor") 393 #define _(s,n) NSH_ADJ_INCOMPLETE_NEXT_##s, 420 u32 n_left_from, next_index, * from, * to_next;
423 n_left_from = from_frame->n_vectors;
424 next_index =
node->cached_next_index;
426 while (n_left_from > 0)
431 to_next, n_left_to_next);
433 while (n_left_from > 0 && n_left_to_next > 0)
435 u32 pi0, next0, adj_index0;
439 pi0 = to_next[0] = from[0];
452 next0 = NSH_ADJ_INCOMPLETE_NEXT_IP4;
456 next0 = NSH_ADJ_INCOMPLETE_NEXT_IP6;
467 to_next, n_left_to_next,
474 return from_frame->n_vectors;
488 s =
format (s,
"%Unext:%d",
495 .name =
"nsh-adj-incomplete",
498 .vector_size =
sizeof (
u32),
501 #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)
#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.
#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)
struct ip_adjacency_t_::@149::@151 midchain
IP_LOOKUP_NEXT_MIDCHAIN.
union ip_adjacency_t_::@149 sub_type
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(...)
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)