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 dummy_dst_address[6] =
295 { 0x11, 0x22, 0x33, 0x44, 0x55, 0x66 };
296 char dummy_src_address[6] =
297 { 0x77, 0x88, 0x99, 0xaa, 0xbb, 0xcc };
300 dummy_eth0.
type = 0x0800;
318 error0 = NSH_NODE_ERROR_NO_PROXY;
325 error0 = NSH_NODE_ERROR_NO_PROXY;
334 error0 = NSH_NODE_ERROR_NO_MAPPING;
342 error0 = NSH_NODE_ERROR_NO_MAPPING;
360 error0 = NSH_NODE_ERROR_INVALID_OPTIONS;
375 error0 = NSH_NODE_ERROR_NO_ENTRY;
381 encap_hdr0 = (nsh_base_header_t *) (nsh_entry0->
rewrite);
391 &next0, NSH_NODE_NEXT_DROP);
394 error0 = NSH_NODE_ERROR_INVALID_OPTIONS;
443 nsp_nsi1 = hdr1->nsp_nsi;
450 error1 = NSH_NODE_ERROR_INVALID_TTL;
458 l2_classify.opaque_index);
463 char dummy_dst_address[6] =
464 { 0x11, 0x22, 0x33, 0x44, 0x55, 0x66 };
465 char dummy_src_address[6] =
466 { 0x77, 0x88, 0x99, 0xaa, 0xbb, 0xcc };
469 dummy_eth1.
type = 0x0800;
487 error1 = NSH_NODE_ERROR_NO_PROXY;
494 error1 = NSH_NODE_ERROR_NO_PROXY;
503 error1 = NSH_NODE_ERROR_NO_MAPPING;
511 error1 = NSH_NODE_ERROR_NO_MAPPING;
516 next1 = map1->next_node;
529 error1 = NSH_NODE_ERROR_INVALID_OPTIONS;
533 map1->rx_sw_if_index;
544 error1 = NSH_NODE_ERROR_NO_ENTRY;
550 encap_hdr1 = (nsh_base_header_t *) (nsh_entry1->rewrite);
552 encap_hdr_len1 = nsh_entry1->rewrite_size;
560 &next1, NSH_NODE_NEXT_DROP);
563 error1 = NSH_NODE_ERROR_INVALID_OPTIONS;
572 encap_hdr_len1 = nsh_entry1->rewrite_size;
584 encap_hdr_len1 = nsh_entry1->rewrite_size;
610 n_left_to_next, bi0, bi1, next0,
615 while (n_left_from > 0 && n_left_to_next > 0)
619 u32 next0 = NSH_NODE_NEXT_DROP;
621 nsh_base_header_t *hdr0 = 0;
628 nsh_base_header_t *encap_hdr0 = 0;
629 u32 encap_hdr_len0 = 0;
633 u32 sw_if_index0 = 0;
649 nsp_nsi0 = hdr0->nsp_nsi;
656 error0 = NSH_NODE_ERROR_INVALID_TTL;
664 l2_classify.opaque_index);
669 char dummy_dst_address[6] =
670 { 0x11, 0x22, 0x33, 0x44, 0x55, 0x66 };
671 char dummy_src_address[6] =
672 { 0x77, 0x88, 0x99, 0xaa, 0xbb, 0xcc };
675 dummy_eth0.
type = 0x0800;
693 error0 = NSH_NODE_ERROR_NO_PROXY;
700 error0 = NSH_NODE_ERROR_NO_PROXY;
710 error0 = NSH_NODE_ERROR_NO_MAPPING;
719 error0 = NSH_NODE_ERROR_NO_MAPPING;
738 error0 = NSH_NODE_ERROR_INVALID_OPTIONS;
753 error0 = NSH_NODE_ERROR_NO_ENTRY;
759 encap_hdr0 = (nsh_base_header_t *) (nsh_entry0->
rewrite);
769 &next0, NSH_NODE_NEXT_DROP);
772 error0 = NSH_NODE_ERROR_INVALID_OPTIONS;
806 trace00:b0->
error = error0 ? node->
errors[error0] : 0;
817 n_left_to_next, bi0, next0);
898 #define _(sym,string) string, 908 .vector_size =
sizeof (
u32),
916 #define _(s,n) [NSH_NODE_NEXT_##s] = n, 926 .vector_size =
sizeof (
u32),
934 #define _(s,n) [NSH_NODE_NEXT_##s] = n, 943 .name =
"nsh-classifier",
944 .vector_size =
sizeof (
u32),
952 #define _(s,n) [NSH_NODE_NEXT_##s] = n, 961 .name =
"nsh-aware-vnf-proxy",
962 .vector_size =
sizeof (
u32),
970 #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
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)
static void * vlib_add_trace(vlib_main_t *vm, vlib_node_runtime_t *r, vlib_buffer_t *b, u32 n_data_bytes)
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.
#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)