29 #include <vpp/app/version.h> 32 #define vl_msg_id(n,h) n, 35 #include <nsh/nsh.api.h> 43 #include <nsh/nsh.api.h> 48 #include <nsh/nsh.api.h> 52 #define vl_print(handle, ...) vlib_cli_output (handle, __VA_ARGS__) 54 #include <nsh/nsh.api.h> 58 #define vl_api_version(n,v) static u32 api_version=(v); 59 #include <nsh/nsh.api.h> 62 #define vl_msg_name_crc_list 63 #include <nsh/nsh.api.h> 64 #undef vl_msg_name_crc_list 78 #define REPLY_MACRO(t) \ 80 unix_shared_memory_queue_t * q = \ 81 vl_api_client_index_to_input_queue (mp->client_index); \ 85 rmp = vl_msg_api_alloc (sizeof (*rmp)); \ 86 rmp->_vl_msg_id = ntohs((t)+nm->msg_id_base); \ 87 rmp->context = mp->context; \ 88 rmp->retval = ntohl(rv); \ 90 vl_msg_api_send_shmem (q, (u8 *)&rmp); \ 93 #define REPLY_MACRO2(t, body) \ 95 unix_shared_memory_queue_t * q; \ 96 rv = vl_msg_api_pd_handler (mp, rv); \ 97 q = vl_api_client_index_to_input_queue (mp->client_index); \ 101 rmp = vl_msg_api_alloc (sizeof (*rmp)); \ 102 rmp->_vl_msg_id = ntohs((t)+nm->msg_id_base); \ 103 rmp->context = mp->context; \ 104 rmp->retval = ntohl(rv); \ 105 do {body;} while (0); \ 106 vl_msg_api_send_shmem (q, (u8 *)&rmp); \ 111 vl_print (handle, (char *)s); \ 117 #define foreach_nsh_plugin_api_msg \ 118 _(NSH_ADD_DEL_ENTRY, nsh_add_del_entry) \ 119 _(NSH_ENTRY_DUMP, nsh_entry_dump) \ 120 _(NSH_ADD_DEL_MAP, nsh_add_del_map) \ 121 _(NSH_MAP_DUMP, nsh_map_dump) 128 int add_options (
u8 * opt,
131 nsh_tlv_header_t * opt),
133 nsh_tlv_header_t * old_opt,
134 nsh_tlv_header_t * new_opt),
136 nsh_tlv_header_t * opt),
137 u8 *
trace (
u8 * s, nsh_tlv_header_t * opt))
207 nsh_tlv_header_t * opt),
208 u8 *
trace (
u8 * s, nsh_tlv_header_t * opt))
234 key_copy = (
void *) (hp->
key);
253 u8 *header = va_arg (*args,
u8 *);
254 nsh_base_header_t *nsh_base = (nsh_base_header_t *) header;
255 nsh_md1_data_t *nsh_md1 = (nsh_md1_data_t *) (nsh_base + 1);
260 -
sizeof (nsh_base_header_t)));
262 s =
format (s,
"nsh ver %d ", (nsh_base->ver_o_c >> 6));
272 s =
format (s,
"len %d (%d bytes) md_type %d next_protocol %d\n",
275 nsh_base->md_type, nsh_base->next_protocol);
277 s =
format (s,
" service path %d service index %d\n",
278 (clib_net_to_host_u32 (nsh_base->nsp_nsi) >>
NSH_NSP_SHIFT) &
280 clib_net_to_host_u32 (nsh_base->nsp_nsi) &
NSH_NSI_MASK);
282 if (nsh_base->md_type == 1)
284 s =
format (s,
" c1 %d c2 %d c3 %d c4 %d\n",
285 clib_net_to_host_u32 (nsh_md1->c1),
286 clib_net_to_host_u32 (nsh_md1->c2),
287 clib_net_to_host_u32 (nsh_md1->c3),
288 clib_net_to_host_u32 (nsh_md1->c4));
290 else if (nsh_base->md_type == 2)
292 s =
format (s,
" Supported TLVs: \n");
295 while (opt0 < limit0)
298 if (nsh_option !=
NULL)
307 format (s,
"\n untraced option %d length %d",
308 opt0->type, opt0->length);
314 format (s,
"\n unrecognized option %d length %d",
315 opt0->type, opt0->length);
319 option_len = ((opt0->length + 3) >> 2) << 2;
332 u32 nsh_action = va_arg (*args,
u32);
337 return format (s,
"swap");
339 return format (s,
"push");
343 return format (s,
"unknown %d", nsh_action);
353 s =
format (s,
"nsh entry nsp: %d nsi: %d ",
356 s =
format (s,
"maps to nsp: %d nsi: %d ",
364 case NSH_NODE_NEXT_ENCAP_GRE4:
369 case NSH_NODE_NEXT_ENCAP_GRE6:
374 case NSH_NODE_NEXT_ENCAP_VXLANGPE:
379 case NSH_NODE_NEXT_ENCAP_VXLAN4:
384 case NSH_NODE_NEXT_ENCAP_VXLAN6:
389 case NSH_NODE_NEXT_DECAP_ETH_INPUT:
391 s =
format (s,
"encap-none");
394 case NSH_NODE_NEXT_ENCAP_LISP_GPE:
399 case NSH_NODE_NEXT_ENCAP_ETHERNET:
405 s =
format (s,
"only GRE and VXLANGPE support in this rev");
435 u32 dev_instance = va_arg (*args,
u32);
436 return format (s,
"nsh_tunnel%d", dev_instance);
465 clib_warning (
"you shouldn't be here, leaking buffers...");
487 u32 dev_instance = va_arg (*args,
u32);
488 s =
format (s,
"unimplemented dev %u", dev_instance);
494 .name =
"NSH",.format_header =
561 (vnm, nsh_device_class.index, map_index, nsh_hw_class.index,
589 key_copy = (
void *) (hp->
key);
597 *map_indexp = map_index;
615 u32 nsp = 0, nsi = 0;
655 key_copy = (
void *) (hp->
key);
672 u32 *result = va_arg (*args,
u32 *);
681 else if (
unformat (input,
"%d", &tmp))
714 u32 nsp, nsi, mapped_nsp, mapped_nsi, nsh_action;
715 int nsp_set = 0, nsi_set = 0, mapped_nsp_set = 0, mapped_nsi_set = 0;
716 int nsh_action_set = 0;
720 u32 rx_sw_if_index = ~0;
733 else if (
unformat (line_input,
"nsp %d", &nsp))
735 else if (
unformat (line_input,
"nsi %d", &nsi))
737 else if (
unformat (line_input,
"mapped-nsp %d", &mapped_nsp))
739 else if (
unformat (line_input,
"mapped-nsi %d", &mapped_nsi))
744 else if (
unformat (line_input,
"encap-gre4-intf %d", &sw_if_index))
745 next_node = NSH_NODE_NEXT_ENCAP_GRE4;
746 else if (
unformat (line_input,
"encap-gre6-intf %d", &sw_if_index))
747 next_node = NSH_NODE_NEXT_ENCAP_GRE6;
748 else if (
unformat (line_input,
"encap-vxlan-gpe-intf %d", &sw_if_index))
749 next_node = NSH_NODE_NEXT_ENCAP_VXLANGPE;
750 else if (
unformat (line_input,
"encap-lisp-gpe-intf %d", &sw_if_index))
751 next_node = NSH_NODE_NEXT_ENCAP_LISP_GPE;
752 else if (
unformat (line_input,
"encap-vxlan4-intf %d", &sw_if_index))
753 next_node = NSH_NODE_NEXT_ENCAP_VXLAN4;
754 else if (
unformat (line_input,
"encap-vxlan6-intf %d", &sw_if_index))
755 next_node = NSH_NODE_NEXT_ENCAP_VXLAN6;
756 else if (
unformat (line_input,
"encap-eth-intf %d", &sw_if_index))
758 next_node = NSH_NODE_NEXT_ENCAP_ETHERNET;
763 (line_input,
"encap-none %d %d", &sw_if_index, &rx_sw_if_index))
764 next_node = NSH_NODE_NEXT_DECAP_ETH_INPUT;
772 if (nsp_set == 0 || nsi_set == 0)
775 if (mapped_nsp_set == 0 || mapped_nsi_set == 0)
777 "mapped-nsp mapped-nsi pair required. Key: for NSH entry");
779 if (nsh_action_set == 0)
784 "must specific action: [encap-gre-intf <nn> | encap-vxlan-gpe-intf <nn> | encap-lisp-gpe-intf <nn> | encap-none <tx_sw_if_index> <rx_sw_if_index>]");
806 "mapping already exists. Remove it first.");
826 "nsh-proxy-session already exists. Remove it first.");
833 (0,
"nsh_add_del_proxy_session() returned %d", rv);
842 .path =
"create nsh map",.short_help =
843 "create nsh map nsp <nn> nsi <nn> [del] mapped-nsp <nn> mapped-nsi <nn> nsh_action [swap|push|pop] " 844 "[encap-gre4-intf <nn> | encap-gre4-intf <nn> | encap-vxlan-gpe-intf <nn> | encap-lisp-gpe-intf <nn> " 845 " encap-vxlan4-intf <nn> | encap-vxlan6-intf <nn>| encap-eth-intf <nn> | encap-none]\n",.function
897 vlib_cli_output (vm,
"%U",
915 nsh_base_header_t *nsh_base;
916 nsh_md1_data_t *nsh_md1;
922 u8 old_option_size = 0;
923 u8 new_option_size = 0;
926 if (nsh_entry->
nsh_base.md_type == 1)
928 len =
sizeof (nsh_base_header_t) +
sizeof (nsh_md1_data_t);
930 else if (nsh_entry->
nsh_base.md_type == 2)
938 nsh_base = (nsh_base_header_t *) rw;
939 nsh_base->ver_o_c = nsh_entry->
nsh_base.ver_o_c;
940 nsh_base->length = nsh_entry->
nsh_base.length;
941 nsh_base->md_type = nsh_entry->
nsh_base.md_type;
942 nsh_base->next_protocol = nsh_entry->
nsh_base.next_protocol;
943 nsh_base->nsp_nsi = clib_host_to_net_u32 (nsh_entry->
nsh_base.nsp_nsi);
945 if (nsh_base->md_type == 1)
947 nsh_md1 = (nsh_md1_data_t *) (rw +
sizeof (nsh_base_header_t));
948 nsh_md1->c1 = clib_host_to_net_u32 (nsh_entry->
md.
md1_data.c1);
949 nsh_md1->c2 = clib_host_to_net_u32 (nsh_entry->
md.
md1_data.c2);
950 nsh_md1->c3 = clib_host_to_net_u32 (nsh_entry->
md.
md1_data.c3);
951 nsh_md1->c4 = clib_host_to_net_u32 (nsh_entry->
md.
md1_data.c4);
954 else if (nsh_base->md_type == 2)
962 while (opt0 < limit0)
966 old_option_size = ((old_option_size + 3) >> 2) << 2;
969 if (nsh_option ==
NULL)
983 new_option_size = ((new_option_size + 3) >> 2) << 2;
1020 u32 entry_index = ~0;
1039 #define _(x) nsh_entry->nsh_base.x = a->nsh_entry.nsh_base.x; 1078 key_copy = (
void *) (hp->
key);
1088 *entry_indexp = entry_index;
1109 u8 next_protocol = 1;
1120 nsh_tlv_header_t tlv_header;
1121 u8 cur_len = 0, tlvs_len = 0;
1130 u8 has_ioam_trace_option = 0;
1140 else if (
unformat (line_input,
"version %d", &tmp))
1141 ver_o_c |= (tmp & 3) << 6;
1142 else if (
unformat (line_input,
"o-bit %d", &tmp))
1143 ver_o_c |= (tmp & 1) << 5;
1144 else if (
unformat (line_input,
"c-bit %d", &tmp))
1145 ver_o_c |= (tmp & 1) << 4;
1146 else if (
unformat (line_input,
"ttl %d", &ttl))
1148 else if (
unformat (line_input,
"md-type %d", &tmp))
1150 else if (
unformat (line_input,
"next-ip4"))
1152 else if (
unformat (line_input,
"next-ip6"))
1154 else if (
unformat (line_input,
"next-ethernet"))
1156 else if (
unformat (line_input,
"c1 %d", &c1))
1158 else if (
unformat (line_input,
"c2 %d", &c2))
1160 else if (
unformat (line_input,
"c3 %d", &c3))
1162 else if (
unformat (line_input,
"c4 %d", &c4))
1164 else if (
unformat (line_input,
"nsp %d", &nsp))
1166 else if (
unformat (line_input,
"nsi %d", &nsi))
1168 else if (
unformat (line_input,
"tlv-ioam-trace"))
1169 has_ioam_trace_option = 1;
1183 if (md_type == 1 && has_ioam_trace_option == 1)
1186 nsp_nsi = (nsp << 8) | nsi;
1197 length = (
sizeof (nsh_base_header_t) +
sizeof (nsh_md1_data_t)) >> 2;
1199 else if (md_type == 2)
1201 length =
sizeof (nsh_base_header_t) >> 2;
1209 if (has_ioam_trace_option)
1216 if (nsh_option ==
NULL)
1230 option_size = (((option_size + 3) >> 2) << 2);
1232 cur_len += option_size;
1233 current = data + option_size;
1239 length += (cur_len >> 2);
1243 #define _(x) a->nsh_entry.nsh_base.x = x; 1262 .path =
"create nsh entry",.short_help =
1263 "create nsh entry {nsp <nn> nsi <nn>} [ttl <nn>] [md-type <nn>]" 1264 " [c1 <nn> c2 <nn> c3 <nn> c4 <nn>] [tlv-ioam-trace] [del]\n",.function
1275 u32 entry_index = ~0;
1309 htonl (entry_index);
1323 rmp->_vl_msg_id = ntohs ((VL_API_NSH_ENTRY_DETAILS) + nm->
msg_id_base);
1367 if (~0 == entry_index)
1371 send_nsh_entry_details (t, q,
1396 rmp->_vl_msg_id = ntohs ((VL_API_NSH_MAP_DETAILS) + nm->
msg_id_base);
1425 if (~0 == map_index)
1429 send_nsh_map_details (t, q,
1457 vlib_cli_output (vm,
"%U",
1459 nsh_entry->rewrite);
1460 vlib_cli_output (vm,
1461 " rewrite_size: %d bytes",
1462 nsh_entry->rewrite_size);
1480 vl_msg_api_set_handlers((VL_API_##N + nm->msg_id_base), \ 1482 vl_api_##n##_t_handler, \ 1484 vl_api_##n##_t_endian, \ 1485 vl_api_##n##_t_print, \ 1486 sizeof(vl_api_##n##_t), 1); 1496 #define _(id,n,crc) \ 1497 vl_msg_api_add_msg_name_crc (am, #n "_" #crc, id + nm->msg_id_base); 1498 foreach_vl_msg_name_crc_nsh;
1507 nsh_base_header_t *nsh_base;
1508 nsh_tlv_header_t *opt0;
1509 nsh_tlv_header_t *limit0;
1510 nsh_tlv_header_t *nsh_md2;
1512 u8 old_option_size = 0;
1513 u8 new_option_size = 0;
1516 opt0 = (nsh_tlv_header_t *) (nsh_entry->
tlvs_data);
1519 nsh_md2 = (nsh_tlv_header_t *) ((
u8 *) hdr +
1520 sizeof (nsh_base_header_t));
1524 while (opt0 < limit0)
1526 old_option_size =
sizeof (nsh_tlv_header_t) + opt0->length;
1528 old_option_size = ((old_option_size + 3) >> 2) << 2;
1531 if (nsh_option ==
NULL)
1544 new_option_size =
sizeof (nsh_tlv_header_t) + nsh_md2->length;
1546 new_option_size = ((new_option_size + 3) >> 2) << 2;
1549 nsh_md2 = (nsh_tlv_header_t *) (((
u8 *) nsh_md2) + new_option_size);
1550 opt0 = (nsh_tlv_header_t *) (((
u8 *) opt0) + old_option_size);
1556 opt0 = (nsh_tlv_header_t *) (((
u8 *) opt0) + old_option_size);
1561 nsh_base = (nsh_base_header_t *) nsh_entry->
rewrite;
1569 nsh_base_header_t * hdr,
1574 nsh_base_header_t *nsh_base;
1575 nsh_tlv_header_t *opt0;
1576 nsh_tlv_header_t *limit0;
1577 nsh_tlv_header_t *nsh_md2;
1579 u8 old_option_size = 0;
1580 u8 new_option_size = 0;
1587 (nsh_tlv_header_t *) (nsh_entry->
rewrite + sizeof (nsh_base_header_t));
1591 while (opt0 < limit0)
1593 old_option_size =
sizeof (nsh_tlv_header_t) + opt0->length;
1595 old_option_size = ((old_option_size + 3) >> 2) << 2;
1598 if (nsh_option ==
NULL)
1611 new_option_size =
sizeof (nsh_tlv_header_t) + nsh_md2->length;
1613 new_option_size = ((new_option_size + 3) >> 2) << 2;
1615 nsh_md2 = (nsh_tlv_header_t *) (((
u8 *) nsh_md2) + new_option_size);
1617 opt0 = (nsh_tlv_header_t *) (((
u8 *) opt0) + old_option_size);
1623 opt0 = (nsh_tlv_header_t *) (((
u8 *) opt0) + old_option_size);
1628 nsh_base = (nsh_base_header_t *) nsh_entry->
rewrite;
1636 nsh_base_header_t * hdr,
1637 u32 * header_len,
u32 * next,
u32 drop_node_val)
1650 while (opt0 < limit0)
1653 if (nsh_option ==
NULL)
1655 *next = drop_node_val;
1663 *next = drop_node_val;
1668 option_len = ((opt0->length + 3) >> 2) << 2;
1685 u32 n_left_from, next_index, *from, *to_next;
1693 while (n_left_from > 0)
1699 while (n_left_from >= 4 && n_left_to_next >= 2)
1703 u32 next0 = NSH_NODE_NEXT_DROP, next1 = NSH_NODE_NEXT_DROP;
1704 uword *entry0, *entry1;
1705 nsh_base_header_t *hdr0 = 0, *hdr1 = 0;
1706 u32 header_len0 = 0, header_len1 = 0;
1707 u32 nsp_nsi0, nsp_nsi1;
1712 nsh_base_header_t *encap_hdr0 = 0, *encap_hdr1 = 0;
1713 u32 encap_hdr_len0 = 0, encap_hdr_len1 = 0;
1717 u32 sw_if_index0 = 0, sw_if_index1 = 0;
1741 n_left_to_next -= 2;
1754 nsp_nsi0 = hdr0->nsp_nsi;
1761 error0 = NSH_NODE_ERROR_INVALID_TTL;
1769 l2_classify.opaque_index);
1776 dummy_eth0.
type = 0x0800;
1794 error0 = NSH_NODE_ERROR_NO_PROXY;
1801 error0 = NSH_NODE_ERROR_NO_PROXY;
1810 error0 = NSH_NODE_ERROR_NO_MAPPING;
1818 error0 = NSH_NODE_ERROR_NO_MAPPING;
1833 NSH_NODE_NEXT_DROP);
1836 error0 = NSH_NODE_ERROR_INVALID_OPTIONS;
1851 error0 = NSH_NODE_ERROR_NO_ENTRY;
1857 encap_hdr0 = (nsh_base_header_t *) (nsh_entry0->
rewrite);
1867 &next0, NSH_NODE_NEXT_DROP);
1870 error0 = NSH_NODE_ERROR_INVALID_OPTIONS;
1919 nsp_nsi1 = hdr1->nsp_nsi;
1926 error1 = NSH_NODE_ERROR_INVALID_TTL;
1934 l2_classify.opaque_index);
1941 dummy_eth1.
type = 0x0800;
1959 error1 = NSH_NODE_ERROR_NO_PROXY;
1966 error1 = NSH_NODE_ERROR_NO_PROXY;
1975 error1 = NSH_NODE_ERROR_NO_MAPPING;
1983 error1 = NSH_NODE_ERROR_NO_MAPPING;
1988 next1 = map1->next_node;
1998 NSH_NODE_NEXT_DROP);
2001 error1 = NSH_NODE_ERROR_INVALID_OPTIONS;
2005 map1->rx_sw_if_index;
2016 error1 = NSH_NODE_ERROR_NO_ENTRY;
2022 encap_hdr1 = (nsh_base_header_t *) (nsh_entry1->rewrite);
2024 encap_hdr_len1 = nsh_entry1->rewrite_size;
2032 &next1, NSH_NODE_NEXT_DROP);
2035 error1 = NSH_NODE_ERROR_INVALID_OPTIONS;
2044 encap_hdr_len1 = nsh_entry1->rewrite_size;
2056 encap_hdr_len1 = nsh_entry1->rewrite_size;
2082 n_left_to_next, bi0, bi1, next0,
2087 while (n_left_from > 0 && n_left_to_next > 0)
2091 u32 next0 = NSH_NODE_NEXT_DROP;
2093 nsh_base_header_t *hdr0 = 0;
2094 u32 header_len0 = 0;
2100 nsh_base_header_t *encap_hdr0 = 0;
2101 u32 encap_hdr_len0 = 0;
2105 u32 sw_if_index0 = 0;
2113 n_left_to_next -= 1;
2121 nsp_nsi0 = hdr0->nsp_nsi;
2128 error0 = NSH_NODE_ERROR_INVALID_TTL;
2136 l2_classify.opaque_index);
2143 dummy_eth0.
type = 0x0800;
2161 error0 = NSH_NODE_ERROR_NO_PROXY;
2168 error0 = NSH_NODE_ERROR_NO_PROXY;
2178 error0 = NSH_NODE_ERROR_NO_MAPPING;
2187 error0 = NSH_NODE_ERROR_NO_MAPPING;
2203 NSH_NODE_NEXT_DROP);
2206 error0 = NSH_NODE_ERROR_INVALID_OPTIONS;
2221 error0 = NSH_NODE_ERROR_NO_ENTRY;
2227 encap_hdr0 = (nsh_base_header_t *) (nsh_entry0->
rewrite);
2237 &next0, NSH_NODE_NEXT_DROP);
2240 error0 = NSH_NODE_ERROR_INVALID_OPTIONS;
2274 trace00:b0->
error = error0 ? node->
errors[error0] : 0;
2285 n_left_to_next, bi0, next0);
2367 static char *nsh_node_error_strings[] = {
2368 #define _(sym,string) string, 2376 .function =
nsh_input,.name =
"nsh-input",.vector_size =
2379 ARRAY_LEN (nsh_node_error_strings),.error_strings =
2382 #define _(s,n) [NSH_NODE_NEXT_##s] = n, 2393 .function =
nsh_proxy,.name =
"nsh-proxy",.vector_size =
2396 ARRAY_LEN (nsh_node_error_strings),.error_strings =
2399 #define _(s,n) [NSH_NODE_NEXT_##s] = n, 2410 .function =
nsh_classifier,.name =
"nsh-classifier",.vector_size =
2413 ARRAY_LEN (nsh_node_error_strings),.error_strings =
2416 #define _(s,n) [NSH_NODE_NEXT_##s] = n, 2430 ARRAY_LEN (nsh_node_error_strings),.error_strings =
2433 #define _(s,n) [NSH_NODE_NEXT_##s] = n, 2477 name =
format (0,
"nsh_%08x%c", api_version, 0);
2492 nsh_input_node.index);
2495 nsh_aware_vnf_proxy_node.index);
2501 nsh_aware_vnf_proxy_node.index);
2506 nsh_aware_vnf_proxy_node.index);
2511 nsh_aware_vnf_proxy_node.index);
2521 nsh_classifier_node.index);
2535 .version = VPP_BUILD_VER,
2536 .description =
"Network Service Header (NSH)",
#define VNET_SW_INTERFACE_FLAG_ADMIN_DOWN
static clib_error_t * show_nsh_map_command_fn(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
CLI command for showing the mapping between NSH entries.
#define NSH_MD2_IOAM_CLASS
vlib_node_registration_t gre4_input_node
(constructor) VLIB_REGISTER_NODE (gre4_input_node)
static vlib_cli_command_t trace
(constructor) VLIB_CLI_COMMAND (trace)
Reply from adding NSH entry (nsh_add_del_entry)
static u8 * format_nsh_tunnel_with_length(u8 *s, va_list *args)
Formatting function for tracing VXLAN GPE with length.
ip_adjacency_t * adj_pool
The global adjacnecy pool.
int nsh_add_del_map(nsh_add_del_map_args_t *a, u32 *map_indexp)
Action function to add or del an nsh map.
u32 * tunnel_index_by_sw_if_index
Mapping from sw_if_index to tunnel index.
static clib_error_t * nsh_add_del_map_command_fn(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
vnet_main_t * vnet_get_main(void)
static char * nsh_node_error_strings[]
vlib_node_registration_t vxlan4_gpe_input_node
(constructor) VLIB_REGISTER_NODE (vxlan4_gpe_input_node)
vlib_node_registration_t vxlan4_input_node
(constructor) VLIB_REGISTER_NODE (vxlan4_input_node)
#define clib_memcpy_fast(a, b, c)
u8 *(* trace[MAX_MD2_OPTIONS])(u8 *s, nsh_tlv_header_t *opt)
clib_memset(h->entries, 0, sizeof(h->entries[0]) *entries)
#define foreach_nsh_node_next
static vnet_hw_interface_t * vnet_get_hw_interface(vnet_main_t *vnm, u32 hw_if_index)
#define vec_add1(V, E)
Add 1 element to end of vector (unspecified alignment).
vlib_node_registration_t vxlan6_gpe_input_node
(constructor) VLIB_REGISTER_NODE (vxlan6_gpe_input_node)
#define hash_set_mem(h, key, value)
static u8 * format_nsh_name(u8 *s, va_list *args)
Naming for NSH tunnel.
#define vec_validate_aligned(V, I, A)
Make sure vector is long enough for given index (no header, specified alignment)
static clib_error_t * nsh_interface_admin_up_down(vnet_main_t *vnm, u32 nsh_hw_if, u32 flags)
CLI function for NSH admin up/down.
vlib_error_t * errors
Vector of errors for this node.
u8 * format_nsh_node_map_trace(u8 *s, va_list *args)
int nsh_add_del_entry(nsh_add_del_entry_args_t *a, u32 *entry_indexp)
Action function for adding an NSH entry nsh_add_del_entry_args_t *a: host order.
const char dummy_dst_address[6]
void * vl_msg_api_alloc(int nbytes)
#define foreach_nsh_plugin_api_msg
static uword vlib_node_add_next(vlib_main_t *vm, uword node, uword next_node)
static adj_index_t nsh_get_adj_by_sw_if_index(u32 sw_if_index)
nsh_base_header_t nsh_base
vlib_node_registration_t ip4_classify_node
(constructor) VLIB_REGISTER_NODE (ip4_classify_node)
nsh_proxy_session_t * nsh_proxy_sessions
#define clib_memcpy(d, s, n)
u8 options_size[MAX_MD2_OPTIONS]
static void nsh_md2_decap(vlib_buffer_t *b, nsh_base_header_t *hdr, u32 *header_len, u32 *next, u32 drop_node_val)
vlib_node_registration_t l2_input_classify_node
(constructor) VLIB_REGISTER_NODE (l2_input_classify_node)
#define pool_foreach(VAR, POOL, BODY)
Iterate through pool.
int(* add_options[MAX_MD2_OPTIONS])(u8 *opt, u8 *opt_size)
#define VLIB_INIT_FUNCTION(x)
svm_queue_t unix_shared_memory_queue_t
#define vlib_prefetch_buffer_header(b, type)
Prefetch buffer metadata.
#define clib_error_return(e, args...)
#define foreach_copy_nsh_base_hdr_field
nsh_entry_t * nsh_entries
#define hash_get_pair(h, key)
u32 * free_nsh_tunnel_hw_if_indices
Free vlib hw_if_indices.
void vxlan_gpe_register_decap_protocol(u8 protocol_id, uword next_node_index)
u32 vnet_register_interface(vnet_main_t *vnm, u32 dev_class_index, u32 dev_instance, u32 hw_class_index, u32 hw_instance)
static uword nsh_aware_vnf_proxy(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *from_frame)
Graph processing dispatch function for NSH-AWARE-VNF-PROXY.
static u8 * format_nsh_action(u8 *s, va_list *args)
VLIB_NODE_FUNCTION_MULTIARCH(nsh_input_node, nsh_input)
static uword nsh_proxy(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *from_frame)
Graph processing dispatch function for NSH-Proxy.
static uword unformat_nsh_action(unformat_input_t *input, va_list *args)
CLI command for NSH map.
static uword nsh_classifier(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *from_frame)
Graph processing dispatch function for NSH Classifier.
#define hash_create_mem(elts, key_bytes, value_bytes)
#define pool_elt_at_index(p, i)
Returns pointer to element at given index.
#define hash_unset_mem(h, key)
u32 adj_get_sw_if_index(adj_index_t ai)
Return the sw interface index of the adjacency.
u8 * rewrite
Rewrite string.
static void vl_api_nsh_add_del_entry_t_handler(vl_api_nsh_add_del_entry_t *mp)
API message handler.
static void * vlib_buffer_get_current(vlib_buffer_t *b)
Get pointer to current data to process.
int nsh_md2_unregister_option(u16 class, u8 type, int options(vlib_buffer_t *b, nsh_tlv_header_t *opt), u8 *trace(u8 *s, nsh_tlv_header_t *opt))
#define pool_put(P, E)
Free an object E in pool P.
static void send_nsh_map_details(nsh_map_t *t, unix_shared_memory_queue_t *q, u32 context)
nsh_option_map_t * nsh_option_mappings
vlib_node_registration_t vxlan6_input_node
(constructor) VLIB_REGISTER_NODE (vxlan6_input_node)
#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
vlib_error_t error
Error code for buffers to be enqueued to error handler.
static uword dummy_interface_tx(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *frame)
int(* pop_options[MAX_MD2_OPTIONS])(vlib_buffer_t *b, nsh_tlv_header_t *opt)
API main structure, used by both vpp and binary API clients.
#define pool_get_aligned(P, E, A)
Allocate an object E from a pool P with alignment A.
int(* swap_options[MAX_MD2_OPTIONS])(vlib_buffer_t *b, nsh_tlv_header_t *old_opt, nsh_tlv_header_t *new_opt)
clib_error_t * nsh_init(vlib_main_t *vm)
void vl_msg_api_send_shmem(svm_queue_t *q, u8 *elem)
#define VLIB_REGISTER_NODE(x,...)
#define CLIB_PREFETCH(addr, size, type)
VNET_HW_INTERFACE_CLASS(nsh_hw_class)
static void send_nsh_entry_details(nsh_entry_t *t, unix_shared_memory_queue_t *q, u32 context)
svm_queue_t * vl_api_client_index_to_input_queue(u32 index)
nsh_option_map_t * nsh_md2_lookup_option(u16 class, u8 type)
#define vec_free(V)
Free vector's memory (no header).
static clib_error_t * nsh_plugin_api_hookup(vlib_main_t *vm)
#define MAX_NSH_HEADER_LEN
#define clib_warning(format, args...)
uword * nsh_proxy_session_by_key
u32 nsp_nsi
Key for nsh_header_t entry: 24bit NSP 8bit NSI.
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)
int nsh_add_del_proxy_session(nsh_add_del_map_args_t *a)
Action function to add or del an nsh-proxy-session.
u32 nsh_hw_if
vnet intfc hw_if_index
u32 adj_index_t
An index for adjacencies.
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.
VNET_DEVICE_CLASS(nsh_device_class, static)
void nsh_md2_set_next_ioam_export_override(uword next)
#define foreach_nsh_node_error
#define MAX_NSH_OPTION_LEN
u8 * default_build_rewrite(vnet_main_t *vnm, u32 sw_if_index, vnet_link_t link_type, const void *dst_address)
Return a complete, zero-length (aka dummy) rewrite.
nsh_tlv_header_t nsh_md2_data_t
#define VLIB_CLI_COMMAND(x,...)
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 uword nsh_input_map(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *from_frame, u32 node_type)
static void clib_mem_free(void *p)
Set or delete a mapping from one NSH header to another and its egress (decap to inner packet...
static void vlib_buffer_advance(vlib_buffer_t *b, word l)
Advance current data pointer by the supplied (signed!) amount.
static clib_error_t * show_nsh_entry_command_fn(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
static void setup_message_id_table(nsh_main_t *nm, api_main_t *am)
static void * clib_mem_alloc(uword size)
void ethernet_register_input_type(vlib_main_t *vm, ethernet_type_t type, u32 node_index)
static clib_error_t * nsh_add_del_entry_command_fn(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
CLI command for adding 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)
#define vec_len(v)
Number of elements in vector (rvalue-only, NULL tolerant)
static void vl_api_nsh_add_del_map_t_handler(vl_api_nsh_add_del_map_t *mp)
API message handler.
clib_error_t * vnet_hw_interface_set_flags(vnet_main_t *vnm, u32 hw_if_index, vnet_hw_interface_flags_t flags)
static void * vlib_frame_vector_args(vlib_frame_t *f)
Get pointer to frame vector data.
uword * nsh_option_map_by_key
a point 2 point interface
#define hash_get_mem(h, key)
int nsh_header_rewrite(nsh_entry_t *nsh_entry)
Reply from adding NSH map (nsh_add_del_map)
static void vl_api_nsh_entry_dump_t_handler(vl_api_nsh_entry_dump_t *mp)
clib_error_t * vnet_sw_interface_set_flags(vnet_main_t *vnm, u32 sw_if_index, vnet_sw_interface_flags_t flags)
int nsh_md2_register_option(u16 class, u8 type, u8 option_size, int add_options(u8 *opt, u8 *opt_size), int options(vlib_buffer_t *b, nsh_tlv_header_t *opt), int swap_options(vlib_buffer_t *b, nsh_tlv_header_t *old_opt, nsh_tlv_header_t *new_opt), int pop_options(vlib_buffer_t *b, nsh_tlv_header_t *opt), u8 *trace(u8 *s, nsh_tlv_header_t *opt))
static void nsh_md2_encap(vlib_buffer_t *b, nsh_base_header_t *hdr, nsh_entry_t *nsh_entry)
static void vl_api_nsh_map_dump_t_handler(vl_api_nsh_map_dump_t *mp)
vlib_node_registration_t gre6_input_node
(constructor) VLIB_REGISTER_NODE (gre6_input_node)
static uword nsh_input(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *from_frame)
Graph processing dispatch function for NSH Input.
uword * nsh_mapping_by_mapped_key
Note: rewrite and rewrite_size used to support varied nsh header.
u8 * format_nsh_header(u8 *s, va_list *args)
vlib_node_registration_t ip6_classify_node
(constructor) VLIB_REGISTER_NODE (ip6_classify_node)
#define pool_foreach_index(i, v, body)
Iterate pool by index.
#define vec_validate_init_empty(V, I, INIT)
Make sure vector is long enough for given index and initialize empty space (no header, unspecified alignment)
#define CLIB_CACHE_LINE_BYTES
u32 flags
buffer flags: VLIB_BUFFER_FREE_LIST_INDEX_MASK: bits used to store free list index, VLIB_BUFFER_IS_TRACED: trace this buffer.
void vlib_cli_output(vlib_main_t *vm, char *fmt,...)
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.
#define REPLY_MACRO2(t, body)
u8 * format_nsh_map(u8 *s, va_list *args)
const char dummy_src_address[6]
u16 vl_msg_api_get_msg_ids(const char *name, int n)
union nsh_entry_t::@545 md
#define NSH_MD2_IOAM_OPTION_TYPE_TRACE
static uword pool_elts(void *v)
Number of active elements in a pool.