28 uword max_rewrite_bytes)
40 #define MPLS_GRE_OUTPUT_NEXT_POST_REWRITE 1 50 u32 * from, * to_next, n_left_from, n_left_to_next;
61 while (n_left_from > 0)
70 while (n_left_from >= 4 && n_left_to_next >= 2)
73 u32 bi0, next0, bi1, next1;
75 u32 sw_if_index0, sw_if_index1;
167 to_next, n_left_to_next,
168 bi0, bi1, next0, next1);
171 while (n_left_from > 0 && n_left_to_next > 0)
221 to_next, n_left_to_next,
236 u32 dev_instance = va_arg (*args,
u32);
237 return format (s,
"mpls-gre%d", dev_instance);
242 u32 dev_instance = va_arg (*args,
u32);
245 s =
format (s,
"MPLS-GRE tunnel: id %d\n", dev_instance);
250 .name =
"MPLS-GRE tunnel device",
255 .no_flatten_output_chains = 1,
258 .admin_up_down_function = 0;
277 uword max_rewrite_bytes)
289 #define MPLS_ETH_OUTPUT_NEXT_OUTPUT 1 299 u32 * from, * to_next, n_left_from, n_left_to_next;
310 while (n_left_from > 0)
319 while (n_left_from >= 4 && n_left_to_next >= 2)
322 u32 bi0, next0, bi1, next1;
324 u32 sw_if_index0, sw_if_index1;
418 to_next, n_left_to_next,
419 bi0, bi1, next0, next1);
421 while (n_left_from > 0 && n_left_to_next > 0)
472 to_next, n_left_to_next,
480 MPLS_ERROR_PKTS_ENCAP, frame->
n_vectors);
487 u32 dev_instance = va_arg (*args,
u32);
488 return format (s,
"mpls-eth%d", dev_instance);
493 u32 dev_instance = va_arg (*args,
u32);
496 s =
format (s,
"MPLS-ETH tunnel: id %d\n", dev_instance);
501 .name =
"MPLS-ETH tunnel device",
506 .no_flatten_output_chains = 1,
509 .admin_up_down_function = 0;
518 .unformat_header = unformat_mpls_eth_header,
523 #define foreach_mpls_post_rewrite_next \ 524 _ (IP4_LOOKUP, "ip4-lookup") 527 #define _(s,n) MPLS_POST_REWRITE_NEXT_##s, 539 u32 n_left_from, next_index, * from, * to_next;
540 u16 old_l0 = 0, old_l1 = 0;
547 while (n_left_from > 0)
552 to_next, n_left_to_next);
554 while (n_left_from >= 4 && n_left_to_next >= 2)
559 u32 next0 = MPLS_POST_REWRITE_NEXT_IP4_LOOKUP;
560 u32 next1 = MPLS_POST_REWRITE_NEXT_IP4_LOOKUP;
615 to_next, n_left_to_next,
616 bi0, bi1, next0, next1);
619 while (n_left_from > 0 && n_left_to_next > 0)
624 u32 next0 = MPLS_POST_REWRITE_NEXT_IP4_LOOKUP;
652 to_next, n_left_to_next,
659 MPLS_ERROR_PKTS_ENCAP, from_frame->
n_vectors);
665 .name =
"mpls-post-rewrite",
667 .vector_size =
sizeof (
u32),
669 .runtime_data_bytes = 0,
673 #define _(s,n) [MPLS_POST_REWRITE_NEXT_##s] = n, 682 ip4_gre_and_mpls_header_t * h0;
683 u8 * rewrite_data = 0;
693 clib_warning (
"no label for inner fib index %d, dst %U",
701 memset (rewrite_data, 0,
sizeof (*h0));
703 h0 = (ip4_gre_and_mpls_header_t *) rewrite_data;
709 h0->gre.
protocol = clib_host_to_net_u16(GRE_PROTOCOL_mpls_unicast);
718 return (rewrite_data);
725 u32 inner_fib_id,
u32 outer_fib_id,
726 u32 * tunnel_sw_if_index,
736 int need_route_add_del = 1;
737 u32 inner_fib_index = 0;
738 u32 outer_fib_index = 0;
742 int found_tunnel = 0;
744 u32 hw_if_index = ~0;
752 if (tunnel_sw_if_index == 0)
753 tunnel_sw_if_index = &dummy;
755 *tunnel_sw_if_index = ~0;
757 if (inner_fib_id != (
u32)~0)
763 return VNET_API_ERROR_NO_SUCH_INNER_FIB;
764 inner_fib_index = p[0];
767 if (outer_fib_id != 0)
773 return VNET_API_ERROR_NO_SUCH_FIB;
774 outer_fib_index = p[0];
784 if (!memcmp (&tp->tunnel_src, src, sizeof (*src))
785 && !memcmp (&tp->tunnel_dst, dst, sizeof (*dst))
786 && !memcmp (&tp->intfc_address, intfc, sizeof (*intfc))
787 && tp->inner_fib_index == inner_fib_index)
789 ip4_fib_t * fib = vec_elt_at_index (im->fibs, inner_fib_index);
790 uword * hash = fib->adj_index_by_dst_address[mask_width];
791 uword key = intfc->as_u32 & im->fib_masks[mask_width];
792 uword *p = hash_get (hash, key);
804 e = mpls_encap_by_fib_and_dest (mm, inner_fib_index,
807 return VNET_API_ERROR_NO_SUCH_LABEL;
815 need_route_add_del = 0;
823 if (is_add == 0 && found_tunnel == 0)
824 return VNET_API_ERROR_NO_SUCH_ENTRY;
828 return VNET_API_ERROR_NO_SUCH_LABEL;
831 memset (tp, 0,
sizeof (*tp));
833 if (
vec_len (mm->free_gre_sw_if_indices) > 0)
836 mm->free_gre_sw_if_indices[
vec_len(mm->free_gre_sw_if_indices)-1];
837 _vec_len (mm->free_gre_sw_if_indices) -= 1;
839 hi->dev_instance = tp - mm->gre_tunnels;
840 hi->hw_instance = tp - mm->gre_tunnels;
847 tp - mm->gre_tunnels);
852 (vnm->vlib_main,
hi->tx_node_index,
858 *tunnel_sw_if_index =
hi->sw_if_index;
862 tp->hw_if_index = hw_if_index;
865 tp->tunnel_src.as_u32 = src->as_u32;
866 tp->tunnel_dst.as_u32 = dst->as_u32;
867 tp->intfc_address.as_u32 = intfc->as_u32;
868 tp->mask_width = mask_width;
869 tp->inner_fib_index = inner_fib_index;
870 tp->outer_fib_index = outer_fib_index;
871 tp->encap_index = e - mm->encaps;
872 tp->l2_only = l2_only;
875 memset(&adj, 0,
sizeof (adj));
876 adj.explicit_fib_index = ~0;
880 if (rewrite_data == 0)
882 if (*tunnel_sw_if_index != ~0)
887 vec_add1 (mm->free_gre_sw_if_indices, tp->hw_if_index);
890 return VNET_API_ERROR_NO_SUCH_LABEL;
896 tp->rewrite_data = rewrite_data;
904 rewrite_data,
vec_len(rewrite_data));
912 if (need_route_add_del && !l2_only)
923 tp->inner_fib_index);
927 memset (&a, 0,
sizeof (a));
941 if (is_add == 0 && found_tunnel)
946 vec_add1 (mm->free_gre_sw_if_indices, tp->hw_if_index);
965 u32 * tunnels_to_delete = 0;
972 return VNET_API_ERROR_NO_SUCH_INNER_FIB;
977 if (tp->inner_fib_index == fib_index)
978 vec_add1 (tunnels_to_delete, tp - mm->gre_tunnels);
983 for (i = 0; i <
vec_len(tunnels_to_delete); i++) {
993 memset (&a, 0,
sizeof (a));
1024 int src_set = 0, dst_set = 0, intfc_set = 0;
1026 u32 inner_fib_id = (
u32)~0;
1027 u32 outer_fib_id = 0;
1031 u32 tunnel_intfc_sw_if_index = ~0;
1039 if (
unformat (line_input,
"src %U",
1042 else if (
unformat (line_input,
"dst %U",
1045 else if (
unformat (line_input,
"intfc %U/%d",
1048 else if (
unformat (line_input,
"inner-fib-id %d", &inner_fib_id))
1050 else if (
unformat (line_input,
"outer-fib-id %d", &outer_fib_id))
1052 else if (
unformat (line_input,
"del"))
1054 else if (
unformat (line_input,
"l2-only"))
1072 inner_fib_id, outer_fib_id,
1073 &tunnel_intfc_sw_if_index,
1081 case VNET_API_ERROR_NO_SUCH_INNER_FIB:
1084 case VNET_API_ERROR_NO_SUCH_FIB:
1088 case VNET_API_ERROR_NO_SUCH_ENTRY:
1091 case VNET_API_ERROR_NO_SUCH_LABEL:
1106 .path =
"create mpls gre tunnel",
1108 "create mpls gre tunnel [del] src <addr> dst <addr> intfc <addr>/<mw>",
1115 u32 entry_index = va_arg (*args,
u32);
1136 s =
format (s,
"[%d]: src %U, dst %U, adj %U/%d, labels %U\n",
1144 s =
format (s,
" inner fib index %d, outer fib index %d",
1149 s =
format (s,
"[%d]: src %U, dst %U, key %U, labels %U\n",
1156 s =
format (s,
" l2 interface %d, outer fib index %d",
1168 s =
format (s,
"[%d]: dst %U, adj %U/%d, labels %U\n",
1176 s =
format (s,
" tx on %U, rx fib index %d",
1197 vlib_cli_output (vm,
"%U", format_mpls_gre_tunnel, gt);
1208 vlib_cli_output (vm,
"%U", format_mpls_ethernet_tunnel, et);
1218 .path =
"show mpls tunnel",
1219 .short_help =
"show mpls tunnel",
1238 u8 * rewrite_data = 0;
1249 clib_warning (
"no label for inner fib index %d, dst %U",
1264 return (rewrite_data);
1272 u32 * tunnel_sw_if_index,
1282 int need_route_add_del = 1;
1283 u32 inner_fib_index = 0;
1287 int found_tunnel = 0;
1289 u32 hw_if_index = ~0;
1296 if (tunnel_sw_if_index == 0)
1297 tunnel_sw_if_index = &dummy;
1299 *tunnel_sw_if_index = ~0;
1301 if (inner_fib_id != (
u32)~0)
1307 return VNET_API_ERROR_NO_SUCH_FIB;
1308 inner_fib_index = p[0];
1318 if (!memcmp (&tp->tunnel_dst, dst, sizeof (*dst))
1319 && !memcmp (&tp->intfc_address, intfc, sizeof (*intfc))
1320 && tp->inner_fib_index == inner_fib_index)
1322 ip4_fib_t * fib = vec_elt_at_index (im->fibs, inner_fib_index);
1323 uword * hash = fib->adj_index_by_dst_address[mask_width];
1324 uword key = intfc->as_u32 & im->fib_masks[mask_width];
1325 uword *p = hash_get (hash, key);
1335 e = mpls_encap_by_fib_and_dest (mm, inner_fib_index,
1338 return VNET_API_ERROR_NO_SUCH_LABEL;
1347 need_route_add_del = 0;
1355 if (is_add == 0 && found_tunnel == 0)
1356 return VNET_API_ERROR_NO_SUCH_ENTRY;
1360 return VNET_API_ERROR_NO_SUCH_LABEL;
1363 memset (tp, 0,
sizeof (*tp));
1365 if (
vec_len (mm->free_eth_sw_if_indices) > 0)
1368 mm->free_eth_sw_if_indices[
vec_len(mm->free_eth_sw_if_indices)-1];
1369 _vec_len (mm->free_eth_sw_if_indices) -= 1;
1371 hi->dev_instance = tp - mm->eth_tunnels;
1372 hi->hw_instance = tp - mm->eth_tunnels;
1377 (vnm, mpls_eth_device_class.index, tp - mm->eth_tunnels,
1378 mpls_eth_hw_interface_class.index,
1379 tp - mm->eth_tunnels);
1384 (vnm->vlib_main,
hi->tx_node_index,
1390 *tunnel_sw_if_index =
hi->sw_if_index;
1394 tp->hw_if_index = hw_if_index;
1397 clib_memcpy(tp->tunnel_dst, dst, sizeof (tp->tunnel_dst));
1398 tp->intfc_address.as_u32 = intfc->as_u32;
1399 tp->mask_width = mask_width;
1400 tp->inner_fib_index = inner_fib_index;
1401 tp->encap_index = e - mm->encaps;
1402 tp->tx_sw_if_index = tx_sw_if_index;
1403 tp->l2_only = l2_only;
1406 memset(&adj, 0,
sizeof (adj));
1407 adj.explicit_fib_index = ~0;
1411 if (rewrite_data == 0)
1413 if (*tunnel_sw_if_index != ~0)
1418 vec_add1 (mm->free_eth_sw_if_indices, tp->hw_if_index);
1422 return VNET_API_ERROR_NO_SUCH_LABEL;
1427 VNET_L3_PACKET_TYPE_MPLS_UNICAST,
1431 &adj.rewrite_header,
1432 sizeof (adj.rewrite_data));
1438 vec_insert (rewrite_data, adj.rewrite_header.data_bytes, 0);
1441 sizeof (adj.rewrite_data)),
1442 adj.rewrite_header.data_bytes);
1445 sizeof(adj.rewrite_data),
1451 tp->rewrite_data = rewrite_data;
1459 if (need_route_add_del && !l2_only)
1470 tp->inner_fib_index);
1474 memset (&a, 0,
sizeof (a));
1487 if (is_add == 0 && found_tunnel)
1492 vec_add1 (mm->free_eth_sw_if_indices, tp->hw_if_index);
1510 int dst_set = 0, intfc_set = 0;
1512 u32 inner_fib_id = (
u32)~0;
1524 if (
unformat (line_input,
"dst %U",
1527 else if (
unformat (line_input,
"adj %U/%d",
1530 else if (
unformat (line_input,
"tx-intfc %U",
1533 else if (
unformat (line_input,
"fib-id %d", &inner_fib_id))
1535 else if (
unformat (line_input,
"l2-only"))
1537 else if (
unformat (line_input,
"del"))
1555 inner_fib_id, tx_sw_if_index,
1561 case VNET_API_ERROR_NO_SUCH_FIB:
1565 case VNET_API_ERROR_NO_SUCH_ENTRY:
1568 case VNET_API_ERROR_NO_SUCH_LABEL:
1585 .path =
"create mpls ethernet tunnel",
1587 "create mpls ethernet tunnel [del] dst <mac-addr> intfc <addr>/<mw>",
1594 u32 policy_tunnel_index)
1598 u8 * rewrite_data = 0;
1604 return VNET_API_ERROR_NO_SUCH_ENTRY;
1608 memset (&adj, 0,
sizeof (adj));
1613 VNET_L3_PACKET_TYPE_MPLS_UNICAST,
1617 &adj.rewrite_header,
1618 sizeof (adj.rewrite_data));
1620 vec_validate (rewrite_data, adj.rewrite_header.data_bytes -1);
1624 sizeof (adj.rewrite_data)),
1625 adj.rewrite_header.data_bytes);
1648 u32 * tunnel_sw_if_index,
1649 u32 classify_table_index,
1650 u32 * new_tunnel_index,
1660 int need_route_add_del = 1;
1661 u32 inner_fib_index = 0;
1664 int found_tunnel = 0;
1666 u32 hw_if_index = ~0;
1673 if (tunnel_sw_if_index == 0)
1674 tunnel_sw_if_index = &dummy;
1676 *tunnel_sw_if_index = ~0;
1678 if (inner_fib_id != (
u32)~0)
1684 return VNET_API_ERROR_NO_SUCH_FIB;
1685 inner_fib_index = p[0];
1695 if (!memcmp (&tp->tunnel_dst, dst, sizeof (*dst))
1696 && !memcmp (&tp->intfc_address, intfc, sizeof (*intfc))
1697 && tp->inner_fib_index == inner_fib_index)
1699 ip4_fib_t * fib = vec_elt_at_index (im->fibs, inner_fib_index);
1700 uword * hash = fib->adj_index_by_dst_address[mask_width];
1701 uword key = intfc->as_u32 & im->fib_masks[mask_width];
1702 uword *p = hash_get (hash, key);
1719 need_route_add_del = 0;
1727 if (is_add == 0 && found_tunnel == 0)
1728 return VNET_API_ERROR_NO_SUCH_ENTRY;
1731 memset (tp, 0,
sizeof (*tp));
1733 if (
vec_len (mm->free_eth_sw_if_indices) > 0)
1736 mm->free_eth_sw_if_indices[
vec_len(mm->free_eth_sw_if_indices)-1];
1737 _vec_len (mm->free_eth_sw_if_indices) -= 1;
1739 hi->dev_instance = tp - mm->eth_tunnels;
1740 hi->hw_instance = tp - mm->eth_tunnels;
1745 (vnm, mpls_eth_device_class.index, tp - mm->eth_tunnels,
1746 mpls_eth_hw_interface_class.index,
1747 tp - mm->eth_tunnels);
1752 (vnm->vlib_main,
hi->tx_node_index,
1758 *tunnel_sw_if_index =
hi->sw_if_index;
1762 tp->hw_if_index = hw_if_index;
1765 clib_memcpy(tp->tunnel_dst, dst, sizeof (tp->tunnel_dst));
1766 tp->intfc_address.as_u32 = intfc->as_u32;
1767 tp->mask_width = mask_width;
1768 tp->inner_fib_index = inner_fib_index;
1769 tp->encap_index = e - mm->encaps;
1770 tp->tx_sw_if_index = tx_sw_if_index;
1771 tp->l2_only = l2_only;
1773 if (new_tunnel_index)
1774 *new_tunnel_index = tp - mm->eth_tunnels;
1777 memset(&adj, 0,
sizeof (adj));
1778 adj.explicit_fib_index = ~0;
1780 adj.classify.table_index = classify_table_index;
1788 if (need_route_add_del && !l2_only)
1799 tp->inner_fib_index);
1803 memset (&a, 0,
sizeof (a));
1816 if (is_add == 0 && found_tunnel)
1821 vec_add1 (mm->free_eth_sw_if_indices, tp->hw_if_index);
1838 int dst_set = 0, intfc_set = 0;
1840 u32 inner_fib_id = (
u32)~0;
1841 u32 classify_table_index = (
u32)~0;
1842 u32 new_tunnel_index;
1854 if (
unformat (line_input,
"dst %U",
1857 else if (
unformat (line_input,
"adj %U/%d",
1860 else if (
unformat (line_input,
"tx-intfc %U",
1863 else if (
unformat (line_input,
"classify-table-index %d",
1864 &classify_table_index))
1866 else if (
unformat (line_input,
"fib-id %d", &inner_fib_id))
1868 else if (
unformat (line_input,
"l2-only"))
1870 else if (
unformat (line_input,
"del"))
1877 if (classify_table_index == ~0)
1891 inner_fib_id, tx_sw_if_index,
1893 classify_table_index,
1898 case VNET_API_ERROR_NO_SUCH_FIB:
1902 case VNET_API_ERROR_NO_SUCH_ENTRY:
1905 case VNET_API_ERROR_NO_SUCH_LABEL:
1925 .path =
"create mpls ethernet policy tunnel",
1927 "create mpls ethernet policy tunnel [del] dst <mac-addr> intfc <addr>/<mw>\n" 1928 " classify-table-index <nn>",
#define vec_validate(V, I)
Make sure vector is long enough for given index (no header, unspecified alignment) ...
void vlib_put_next_frame(vlib_main_t *vm, vlib_node_runtime_t *r, u32 next_index, u32 n_vectors_left)
u8 * format_mpls_encap_index(u8 *s, va_list *args)
int vnet_mpls_gre_delete_fib_tunnels(u32 fib_id)
sll srl srl sll sra u16x4 i
u32 * free_gre_sw_if_indices
static u32 vnet_mpls_uc_get_label(u32 label_exp_s_ttl)
void ip4_add_del_route_next_hop(ip4_main_t *im, u32 flags, ip4_address_t *dst_address, u32 dst_address_length, ip4_address_t *next_hop, u32 next_hop_sw_if_index, u32 next_hop_weight, u32 adj_index, u32 explicit_fib_index)
always_inline void * vnet_rewrite_get_data_internal(vnet_rewrite_header_t *rw, int max_size)
format_function_t format_mpls_eth_header_with_length
ip4_address_t intfc_address
static uword mpls_gre_set_rewrite(vnet_main_t *vnm, u32 sw_if_index, u32 l3_type, void *dst_address, void *rewrite, uword max_rewrite_bytes)
int vnet_mpls_ethernet_add_del_tunnel(u8 *dst, ip4_address_t *intfc, u32 mask_width, u32 inner_fib_id, u32 tx_sw_if_index, u32 *tunnel_sw_if_index, u8 l2_only, u8 is_add)
#define vec_add1(V, E)
Add 1 element to end of vector (unspecified alignment).
ip_adjacency_t * ip_add_adjacency(ip_lookup_main_t *lm, ip_adjacency_t *copy_adj, u32 n_adj, u32 *adj_index_return)
static u8 * format_mpls_eth_tunnel_name(u8 *s, va_list *args)
static clib_error_t * mpls_policy_encap_init(vlib_main_t *vm)
#define vec_add2(V, P, N)
Add N elements to end of vector V, return pointer to new elements in P.
ip_lookup_main_t lookup_main
unformat_function_t unformat_vnet_sw_interface
void ip4_maybe_remap_adjacencies(ip4_main_t *im, u32 table_index_or_table_id, u32 flags)
format_function_t format_vnet_sw_if_index_name
always_inline void * vlib_buffer_get_current(vlib_buffer_t *b)
Get pointer to current data to process.
#define MPLS_ETH_OUTPUT_NEXT_OUTPUT
vnet_main_t * vnet_get_main(void)
u8 * format_mpls_eth_tx_trace(u8 *s, va_list *args)
u8 * format_ethernet_address(u8 *s, va_list *args)
#define pool_foreach(VAR, POOL, BODY)
#define VLIB_INIT_FUNCTION(x)
static u8 * format_mpls_gre_tunnel_name(u8 *s, va_list *args)
static uword mpls_post_rewrite(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *from_frame)
#define vec_elt_at_index(v, i)
Get vector value at index i checking that i is in bounds.
always_inline uword pool_elts(void *v)
always_inline uword vlib_buffer_length_in_chain(vlib_main_t *vm, vlib_buffer_t *b)
Get length in bytes of the buffer chain.
#define clib_warning(format, args...)
#define vlib_call_init_function(vm, x)
u32 vnet_register_interface(vnet_main_t *vnm, u32 dev_class_index, u32 dev_instance, u32 hw_class_index, u32 hw_instance)
always_inline void * vlib_frame_vector_args(vlib_frame_t *f)
mpls_gre_tunnel_t * gre_tunnels
always_inline u16 ip_csum_fold(ip_csum_t c)
ip4_address_t intfc_address
#define pool_elt_at_index(p, i)
#define vec_insert(V, N, M)
Insert N vector elements starting at element M, initialize new elements to zero (no header...
format_function_t format_mpls_gre_header_with_length
uword * fib_index_by_table_id
u16 current_length
Nbytes between current data and the end of this buffer.
vlib_node_registration_t mpls_policy_encap_node
(constructor) VLIB_REGISTER_NODE (mpls_policy_encap_node)
#define MPLS_GRE_OUTPUT_NEXT_POST_REWRITE
#define foreach_mpls_post_rewrite_next
static uword mpls_eth_set_rewrite(vnet_main_t *vnm, u32 sw_if_index, u32 l3_type, void *dst_address, void *rewrite, uword max_rewrite_bytes)
vlib_node_registration_t mpls_input_node
(constructor) VLIB_REGISTER_NODE (mpls_input_node)
static clib_error_t * show_mpls_tunnel_command_fn(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
always_inline void vlib_node_increment_counter(vlib_main_t *vm, u32 node_index, u32 counter_index, u64 increment)
#define vlib_validate_buffer_enqueue_x2(vm, node, next_index, to_next, n_left_to_next, bi0, bi1, next0, next1)
void vnet_rewrite_for_tunnel(vnet_main_t *vnm, u32 tx_sw_if_index, u32 rewrite_node_index, u32 post_rewrite_node_index, vnet_rewrite_header_t *rw, u8 *rewrite_data, u32 rewrite_length)
#define vlib_validate_buffer_enqueue_x1(vm, node, next_index, to_next, n_left_to_next, bi0, next0)
#define vlib_get_next_frame(vm, node, next_index, vectors, n_vectors_left)
vnet_device_class_t mpls_gre_device_class
void vlib_cli_output(vlib_main_t *vm, char *fmt,...)
always_inline u16 ip4_header_checksum(ip4_header_t *i)
VNET_HW_INTERFACE_CLASS(ethernet_hw_interface_class)
vlib_node_registration_t ip4_rewrite_node
(constructor) VLIB_REGISTER_NODE (ip4_rewrite_node)
int vnet_mpls_ethernet_add_del_policy_tunnel(u8 *dst, ip4_address_t *intfc, u32 mask_width, u32 inner_fib_id, u32 tx_sw_if_index, u32 *tunnel_sw_if_index, u32 classify_table_index, u32 *new_tunnel_index, u8 l2_only, u8 is_add)
#define CLIB_PREFETCH(addr, size, type)
#define vec_free(V)
Free vector's memory (no header).
void vnet_rewrite_for_sw_interface(vnet_main_t *vnm, vnet_l3_packet_type_t packet_type, u32 sw_if_index, u32 node_index, void *dst_address, vnet_rewrite_header_t *rw, u32 max_rewrite_bytes)
u8 * format_mpls_ethernet_tunnel(u8 *s, va_list *args)
#define clib_memcpy(a, b, c)
always_inline vnet_hw_interface_t * vnet_get_sup_hw_interface(vnet_main_t *vnm, u32 sw_if_index)
#define pool_is_free_index(P, I)
always_inline vnet_hw_interface_t * vnet_get_hw_interface(vnet_main_t *vnm, u32 hw_if_index)
mpls_eth_tunnel_t * eth_tunnels
#define IP4_ROUTE_FLAG_DEL
#define VLIB_CLI_COMMAND(x,...)
#define VNET_SW_INTERFACE_FLAG_ADMIN_UP
uword unformat_ethernet_address(unformat_input_t *input, va_list *args)
clib_error_t * mpls_interface_init(vlib_main_t *vm)
ip4_address_t dst_address
#define IP4_ROUTE_FLAG_ADD
int vnet_mpls_policy_tunnel_add_rewrite(mpls_main_t *mm, mpls_encap_t *e, u32 policy_tunnel_index)
mpls_encap_t * mpls_encap_by_fib_and_dest(mpls_main_t *mm, u32 rx_fib, u32 dst_address)
#define VLIB_BUFFER_IS_TRACED
vlib_node_registration_t mpls_post_rewrite_node
(constructor) VLIB_REGISTER_NODE (mpls_post_rewrite_node)
vlib_node_registration_t gre_input_node
(constructor) VLIB_REGISTER_NODE (gre_input_node)
vnet_hw_interface_class_t mpls_gre_hw_interface_class
static u8 * mpls_ethernet_rewrite(mpls_main_t *mm, mpls_eth_tunnel_t *t)
#define vec_len(v)
Number of elements in vector (rvalue-only, NULL tolerant)
always_inline void vlib_buffer_advance(vlib_buffer_t *b, word l)
Advance current data pointer by the supplied (signed!) amount.
unformat_function_t unformat_mpls_gre_header
static u8 * format_mpls_eth_device(u8 *s, va_list *args)
always_inline void vnet_rewrite_set_data_internal(vnet_rewrite_header_t *rw, int max_size, void *data, int data_bytes)
#define IP4_ROUTE_FLAG_FIB_INDEX
#define ip_csum_update(sum, old, new, type, field)
u32 table_index_or_table_id
always_inline void * vlib_add_trace(vlib_main_t *vm, vlib_node_runtime_t *r, vlib_buffer_t *b, u32 n_data_bytes)
u8 * format_mpls_gre_tx_trace(u8 *s, va_list *args)
#define vlib_prefetch_buffer_header(b, type)
Prefetch buffer metadata.
#define VLIB_REGISTER_NODE(x,...)
static uword mpls_gre_interface_tx(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *frame)
static clib_error_t * create_mpls_gre_tunnel_command_fn(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
static uword mpls_eth_interface_tx(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *frame)
static clib_error_t * create_mpls_ethernet_tunnel_command_fn(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
clib_error_t * vnet_sw_interface_set_flags(vnet_main_t *vnm, u32 sw_if_index, u32 flags)
static u8 * format_mpls_gre_device(u8 *s, va_list *args)
static u8 * mpls_gre_rewrite(mpls_main_t *mm, mpls_gre_tunnel_t *t)
uword * adj_index_by_dst_address[33]
#define clib_error_return(e, args...)
VNET_DEVICE_CLASS(ethernet_simulated_device_class)
void ip4_add_del_route(ip4_main_t *im, ip4_add_del_route_args_t *args)
uword vlib_node_add_named_next_with_slot(vlib_main_t *vm, uword node, char *name, uword slot)
#define CLIB_CACHE_LINE_BYTES
u32 flags
buffer flags: VLIB_BUFFER_IS_TRACED: trace this buffer.
int vnet_mpls_gre_add_del_tunnel(ip4_address_t *src, ip4_address_t *dst, ip4_address_t *intfc, u32 mask_width, u32 inner_fib_id, u32 outer_fib_id, u32 *tunnel_sw_if_index, u8 l2_only, u8 is_add)
always_inline vlib_buffer_t * vlib_get_buffer(vlib_main_t *vm, u32 buffer_index)
Translate buffer index into buffer pointer.
static clib_error_t * create_mpls_ethernet_policy_tunnel_command_fn(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
mpls_unicast_header_t * labels
u8 * format_mpls_gre_tunnel(u8 *s, va_list *args)