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, rw_len0, adj_index0, next0, error0;
94 nsh_base_header_t *hdr1;
97 u32 pi1, rw_len1, adj_index1, next1, error1;
113 pi0 = to_next[0] = from[0];
114 pi1 = to_next[1] = from[1];
137 eth_hdr0->
type = clib_host_to_net_u16(ETHERNET_TYPE_NSH);
139 eth_hdr1->
type = clib_host_to_net_u16(ETHERNET_TYPE_NSH);
142 rw_len0 = adj0[0].rewrite_header.data_bytes;
143 rw_len1 = adj1[0].rewrite_header.data_bytes;
161 adj0[0].rewrite_header.max_l3_packet_bytes))
167 adj0[0].rewrite_header.sw_if_index;
168 next0 = NSH_OUTPUT_NEXT_INTERFACE;
169 error0 = IP4_ERROR_NONE;
173 adj0[0].rewrite_header.sw_if_index,
178 error0 = IP4_ERROR_MTU_EXCEEDED;
179 next0 = NSH_OUTPUT_NEXT_DROP;
182 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, rw_len0, adj_index0, next0, error0;
241 pi0 = to_next[0] = from[0];
255 eth_hdr0->
type = clib_host_to_net_u16(ETHERNET_TYPE_NSH);
258 rw_len0 = adj0[0].rewrite_header.data_bytes;
269 adj0[0].rewrite_header.max_l3_packet_bytes))
275 adj0[0].rewrite_header.sw_if_index;
276 next0 = NSH_OUTPUT_NEXT_INTERFACE;
277 error0 = IP4_ERROR_NONE;
281 adj0[0].rewrite_header.sw_if_index,
286 error0 = IP4_ERROR_MTU_EXCEEDED;
287 next0 = NSH_OUTPUT_NEXT_DROP;
311 to_next, n_left_to_next,
336 .name =
"nsh-eth-output",
338 .vector_size =
sizeof (
u32),
341 #define _(s,n) [NSH_OUTPUT_NEXT_##s] = n, 361 .name =
"nsh-midchain",
362 .vector_size =
sizeof (
u32),
374 .arc_name =
"nsh-eth-output",
375 .node_name =
"interface-output",
383 .arc_name =
"nsh-eth-output",
389 .arc_name =
"nsh-eth-output",
390 .node_name =
"error-drop",
397 #define foreach_nsh_adj_incomplete_next \ 398 _(DROP, "error-drop") \ 400 _(IP6, "ip6-discover-neighbor") 403 #define _(s,n) NSH_ADJ_INCOMPLETE_NEXT_##s, 431 u32 n_left_from, next_index, * from, * to_next;
437 while (n_left_from > 0)
442 to_next, n_left_to_next);
444 while (n_left_from > 0 && n_left_to_next > 0)
446 u32 pi0, next0, adj_index0;
450 pi0 = to_next[0] = from[0];
463 next0 = NSH_ADJ_INCOMPLETE_NEXT_IP4;
467 next0 = NSH_ADJ_INCOMPLETE_NEXT_IP6;
478 to_next, n_left_to_next,
499 s =
format (s,
"%Unext:%d",
507 .name =
"nsh-adj-incomplete",
510 .vector_size =
sizeof (
u32),
513 #define _(s,n) [NSH_ADJ_INCOMPLETE_NEXT_##s] = n,
#define vnet_rewrite_one_header(rw0, p0, most_likely_size)
enum nsh_midchain_next_t_ nsh_midchain_next_t
struct ip_adjacency_t_::@45::@47 midchain
IP_LOOKUP_NEXT_MIDCHAIN.
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.
union ip_adjacency_t_::@45 sub_type
VNET_FEATURE_ARC_INIT(nsh_eth_output, static)
vlib_node_registration_t nsh_adj_incomplete_node
(constructor) VLIB_REGISTER_NODE (nsh_adj_incomplete_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.
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.
i16 current_data
signed offset in data[], pre_data[] that we are currently processing.
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)
static uword nsh_eth_output(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *from_frame)
static u8 * format_nsh_output_trace(u8 *s, va_list *args)
#define VLIB_NODE_FUNCTION_MULTIARCH(node, fn)
u16 current_length
Nbytes between current data and the end of this buffer.
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.
vlib_error_t error
Error code for buffers to be enqueued to error handler.
#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.
static uword nsh_midchain(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *from_frame)
u16 cached_next_index
Next frame index that vector arguments were last enqueued to last time this node ran.
#define foreach_nsh_output_next
u8 packet_data[64-1 *sizeof(u32)]
#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)
fib_protocol_t ia_nh_proto
The protocol of the neighbor/peer.
static uword nsh_adj_incomplete(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *from_frame)
Graph node for incomplete NSH adjacency.
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.
#define vnet_rewrite_two_headers(rw0, rw1, p0, p1, 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.
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)