27 nsh_base_header_t *nsh_base;
28 nsh_tlv_header_t *opt0;
29 nsh_tlv_header_t *limit0;
30 nsh_tlv_header_t *nsh_md2;
32 u8 old_option_size = 0;
33 u8 new_option_size = 0;
36 opt0 = (nsh_tlv_header_t *) (nsh_entry->
tlvs_data);
39 nsh_md2 = (nsh_tlv_header_t *) ((
u8 *) hdr +
40 sizeof (nsh_base_header_t));
46 old_option_size =
sizeof (nsh_tlv_header_t) + opt0->length;
48 old_option_size = ((old_option_size + 3) >> 2) << 2;
51 if (nsh_option == NULL)
64 new_option_size =
sizeof (nsh_tlv_header_t) + nsh_md2->length;
66 new_option_size = ((new_option_size + 3) >> 2) << 2;
69 nsh_md2 = (nsh_tlv_header_t *) (((
u8 *) nsh_md2) + new_option_size);
70 opt0 = (nsh_tlv_header_t *) (((
u8 *) opt0) + old_option_size);
76 opt0 = (nsh_tlv_header_t *) (((
u8 *) opt0) + old_option_size);
81 nsh_base = (nsh_base_header_t *) nsh_entry->
rewrite;
89 nsh_base_header_t * hdr,
94 nsh_base_header_t *nsh_base;
95 nsh_tlv_header_t *opt0;
96 nsh_tlv_header_t *limit0;
97 nsh_tlv_header_t *nsh_md2;
99 u8 old_option_size = 0;
100 u8 new_option_size = 0;
107 (nsh_tlv_header_t *) (nsh_entry->
rewrite + sizeof (nsh_base_header_t));
111 while (opt0 < limit0)
113 old_option_size =
sizeof (nsh_tlv_header_t) + opt0->length;
115 old_option_size = ((old_option_size + 3) >> 2) << 2;
118 if (nsh_option == NULL)
131 new_option_size =
sizeof (nsh_tlv_header_t) + nsh_md2->length;
133 new_option_size = ((new_option_size + 3) >> 2) << 2;
135 nsh_md2 = (nsh_tlv_header_t *) (((
u8 *) nsh_md2) + new_option_size);
137 opt0 = (nsh_tlv_header_t *) (((
u8 *) opt0) + old_option_size);
143 opt0 = (nsh_tlv_header_t *) (((
u8 *) opt0) + old_option_size);
148 nsh_base = (nsh_base_header_t *) nsh_entry->
rewrite;
156 nsh_base_header_t * hdr,
157 u32 * header_len,
u32 * next,
u32 drop_node_val)
170 while (opt0 < limit0)
173 if (nsh_option == NULL)
175 *next = drop_node_val;
183 *next = drop_node_val;
188 option_len = ((opt0->length + 3) >> 2) << 2;
205 u32 n_left_from, next_index, *from, *to_next;
213 while (n_left_from > 0)
219 while (n_left_from >= 4 && n_left_to_next >= 2)
223 u32 next0 = NSH_NODE_NEXT_DROP, next1 = NSH_NODE_NEXT_DROP;
224 uword *entry0, *entry1;
225 nsh_base_header_t *hdr0 = 0, *hdr1 = 0;
226 u32 header_len0 = 0, header_len1 = 0;
227 u32 nsp_nsi0, nsp_nsi1;
232 nsh_base_header_t *encap_hdr0 = 0, *encap_hdr1 = 0;
233 u32 encap_hdr_len0 = 0, encap_hdr_len1 = 0;
237 u32 sw_if_index0 = 0, sw_if_index1 = 0;
274 nsp_nsi0 = hdr0->nsp_nsi;
281 error0 = NSH_NODE_ERROR_INVALID_TTL;
289 l2_classify.opaque_index);
294 char placeholder_dst_address[6] =
295 { 0x11, 0x22, 0x33, 0x44, 0x55, 0x66 };
296 char placeholder_src_address[6] =
297 { 0x77, 0x88, 0x99, 0xaa, 0xbb, 0xcc };
299 placeholder_dst_address, 6);
301 placeholder_src_address, 6);
302 placeholder_eth0.
type = 0x0800;
320 error0 = NSH_NODE_ERROR_NO_PROXY;
327 error0 = NSH_NODE_ERROR_NO_PROXY;
336 error0 = NSH_NODE_ERROR_NO_MAPPING;
344 error0 = NSH_NODE_ERROR_NO_MAPPING;
362 error0 = NSH_NODE_ERROR_INVALID_OPTIONS;
377 error0 = NSH_NODE_ERROR_NO_ENTRY;
383 encap_hdr0 = (nsh_base_header_t *) (nsh_entry0->
rewrite);
393 &next0, NSH_NODE_NEXT_DROP);
396 error0 = NSH_NODE_ERROR_INVALID_OPTIONS;
445 nsp_nsi1 = hdr1->nsp_nsi;
452 error1 = NSH_NODE_ERROR_INVALID_TTL;
460 l2_classify.opaque_index);
465 char placeholder_dst_address[6] =
466 { 0x11, 0x22, 0x33, 0x44, 0x55, 0x66 };
467 char placeholder_src_address[6] =
468 { 0x77, 0x88, 0x99, 0xaa, 0xbb, 0xcc };
470 placeholder_dst_address, 6);
472 placeholder_src_address, 6);
473 placeholder_eth1.
type = 0x0800;
491 error1 = NSH_NODE_ERROR_NO_PROXY;
498 error1 = NSH_NODE_ERROR_NO_PROXY;
507 error1 = NSH_NODE_ERROR_NO_MAPPING;
515 error1 = NSH_NODE_ERROR_NO_MAPPING;
520 next1 = map1->next_node;
533 error1 = NSH_NODE_ERROR_INVALID_OPTIONS;
537 map1->rx_sw_if_index;
548 error1 = NSH_NODE_ERROR_NO_ENTRY;
554 encap_hdr1 = (nsh_base_header_t *) (nsh_entry1->rewrite);
556 encap_hdr_len1 = nsh_entry1->rewrite_size;
564 &next1, NSH_NODE_NEXT_DROP);
567 error1 = NSH_NODE_ERROR_INVALID_OPTIONS;
576 encap_hdr_len1 = nsh_entry1->rewrite_size;
588 encap_hdr_len1 = nsh_entry1->rewrite_size;
614 n_left_to_next, bi0, bi1, next0,
619 while (n_left_from > 0 && n_left_to_next > 0)
623 u32 next0 = NSH_NODE_NEXT_DROP;
625 nsh_base_header_t *hdr0 = 0;
632 nsh_base_header_t *encap_hdr0 = 0;
633 u32 encap_hdr_len0 = 0;
637 u32 sw_if_index0 = 0;
653 nsp_nsi0 = hdr0->nsp_nsi;
660 error0 = NSH_NODE_ERROR_INVALID_TTL;
668 l2_classify.opaque_index);
673 char placeholder_dst_address[6] =
674 { 0x11, 0x22, 0x33, 0x44, 0x55, 0x66 };
675 char placeholder_src_address[6] =
676 { 0x77, 0x88, 0x99, 0xaa, 0xbb, 0xcc };
678 placeholder_dst_address, 6);
680 placeholder_src_address, 6);
681 placeholder_eth0.
type = 0x0800;
699 error0 = NSH_NODE_ERROR_NO_PROXY;
706 error0 = NSH_NODE_ERROR_NO_PROXY;
716 error0 = NSH_NODE_ERROR_NO_MAPPING;
725 error0 = NSH_NODE_ERROR_NO_MAPPING;
744 error0 = NSH_NODE_ERROR_INVALID_OPTIONS;
759 error0 = NSH_NODE_ERROR_NO_ENTRY;
765 encap_hdr0 = (nsh_base_header_t *) (nsh_entry0->
rewrite);
775 &next0, NSH_NODE_NEXT_DROP);
778 error0 = NSH_NODE_ERROR_INVALID_OPTIONS;
812 trace00:b0->
error = error0 ? node->
errors[error0] : 0;
823 n_left_to_next, bi0, next0);
904 #define _(sym,string) string, 914 .vector_size =
sizeof (
u32),
922 #define _(s,n) [NSH_NODE_NEXT_##s] = n, 932 .vector_size =
sizeof (
u32),
940 #define _(s,n) [NSH_NODE_NEXT_##s] = n, 949 .name =
"nsh-classifier",
950 .vector_size =
sizeof (
u32),
958 #define _(s,n) [NSH_NODE_NEXT_##s] = n, 967 .name =
"nsh-aware-vnf-proxy",
968 .vector_size =
sizeof (
u32),
976 #define _(s,n) [NSH_NODE_NEXT_##s] = n,
u32 flags
buffer flags: VLIB_BUFFER_FREE_LIST_INDEX_MASK: bits used to store free list index, VLIB_BUFFER_IS_TRACED: trace this buffer.
u8 * format_nsh_node_map_trace(u8 *s, va_list *args)
static uword nsh_input_map(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *from_frame, u32 node_type)
u32 * tunnel_index_by_sw_if_index
Mapping from sw_if_index to tunnel index.
#define clib_memcpy_fast(a, b, c)
clib_memset(h->entries, 0, sizeof(h->entries[0]) *entries)
#define foreach_nsh_node_next
static char * nsh_node_error_strings[]
#define VLIB_NODE_FN(node)
vlib_error_t * errors
Vector of errors for this node.
vlib_node_registration_t nsh_proxy_node
(constructor) VLIB_REGISTER_NODE (nsh_proxy_node)
nsh_base_header_t nsh_base
nsh_proxy_session_t * nsh_proxy_sessions
vlib_node_registration_t nsh_aware_vnf_proxy_node
(constructor) VLIB_REGISTER_NODE (nsh_aware_vnf_proxy_node)
#define vlib_prefetch_buffer_header(b, type)
Prefetch buffer metadata.
nsh_entry_t * nsh_entries
vlib_node_registration_t nsh_classifier_node
(constructor) VLIB_REGISTER_NODE (nsh_classifier_node)
nsh_option_map_t * nsh_md2_lookup_option(u16 class, u8 type)
vl_api_fib_path_type_t type
vlib_error_t error
Error code for buffers to be enqueued to error handler.
#define pool_elt_at_index(p, i)
Returns pointer to element at given index.
u8 * rewrite
Rewrite string.
static void * vlib_buffer_get_current(vlib_buffer_t *b)
Get pointer to current data to process.
#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).
uword decap_v4_next_override
int(* pop_options[MAX_MD2_OPTIONS])(vlib_buffer_t *b, nsh_tlv_header_t *opt)
int(* swap_options[MAX_MD2_OPTIONS])(vlib_buffer_t *b, nsh_tlv_header_t *old_opt, nsh_tlv_header_t *new_opt)
#define VLIB_REGISTER_NODE(x,...)
#define CLIB_PREFETCH(addr, size, type)
uword * nsh_proxy_session_by_key
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.
#define foreach_nsh_node_error
vlib_main_t vlib_node_runtime_t * node
nsh_tlv_header_t nsh_md2_data_t
u32 mapped_nsp_nsi
Key for nsh_header_t entry to map to.
u16 cached_next_index
Next frame index that vector arguments were last enqueued to last time this node ran.
static void vlib_buffer_advance(vlib_buffer_t *b, word l)
Advance current data pointer by the supplied (signed!) amount.
static void nsh_md2_encap(vlib_buffer_t *b, nsh_base_header_t *hdr, nsh_entry_t *nsh_entry)
int(* options[MAX_MD2_OPTIONS])(vlib_buffer_t *b, nsh_tlv_header_t *opt)
static void nsh_md2_swap(vlib_buffer_t *b, nsh_base_header_t *hdr, u32 header_len, nsh_entry_t *nsh_entry, u32 *next, u32 drop_node_val)
VLIB buffer representation.
static void * vlib_frame_vector_args(vlib_frame_t *f)
Get pointer to frame vector data.
#define hash_get_mem(h, key)
static void nsh_md2_decap(vlib_buffer_t *b, nsh_base_header_t *hdr, u32 *header_len, u32 *next, u32 drop_node_val)
Note: rewrite and rewrite_size used to support varied nsh header.
void * vlib_add_trace(vlib_main_t *vm, vlib_node_runtime_t *r, vlib_buffer_t *b, u32 n_data_bytes)
#define CLIB_CACHE_LINE_BYTES
uword * nsh_mapping_by_key
static vlib_buffer_t * vlib_get_buffer(vlib_main_t *vm, u32 buffer_index)
Translate buffer index into buffer pointer.
vlib_node_registration_t nsh_input_node
(constructor) VLIB_REGISTER_NODE (nsh_input_node)
u8 * format_nsh_header(u8 *s, va_list *args)