summaryrefslogtreecommitdiffstats
path: root/vpp
diff options
context:
space:
mode:
authorNeale Ranns <nranns@cisco.com>2016-11-02 14:20:04 +0000
committerDamjan Marion <dmarion.lists@gmail.com>2016-12-02 11:09:36 +0000
commitad422ed7eaafe993d5b530395cb11a708f2ed922 (patch)
tree6122391863894f619d13037581f8365ca3796f8f /vpp
parentcaffe0980adc852e6f6afaa2723bd5dd14658de3 (diff)
MPLS infrastructure improvments
- deprecate MPLSoEth and MPLSoGRE; replace with generic MPLS tunnel. - deprecates CLI 'mpls encap ..'; replace with addition of MPLS out label to a route/tunnel. - support for MPLS 'routes', e.g. MPLS x-connects. - deprecates CLI 'mpls decap ..'; replace with 'mpls route .. ' Change-Id: Ibda46544912f880d0200f22bf9ff9b52828fcc2f Signed-off-by: Neale Ranns <nranns@cisco.com>
Diffstat (limited to 'vpp')
-rw-r--r--vpp/app/vpe_cli.c2
-rw-r--r--vpp/vpp-api/api.c699
-rw-r--r--vpp/vpp-api/custom_dump.c100
-rw-r--r--vpp/vpp-api/test_client.c11
-rw-r--r--vpp/vpp-api/vpe.api312
5 files changed, 274 insertions, 850 deletions
diff --git a/vpp/app/vpe_cli.c b/vpp/app/vpe_cli.c
index 70fe3a77..a26bf71f 100644
--- a/vpp/app/vpe_cli.c
+++ b/vpp/app/vpe_cli.c
@@ -93,7 +93,7 @@ virtual_ip_cmd_fn_command_fn (vlib_main_t * vm,
rpath->frp_sw_if_index = sw_if_index;
rpath->frp_fib_index = ~0;
rpath->frp_weight = 1;
- rpath->frp_label = MPLS_LABEL_INVALID;
+ rpath->frp_label_stack = NULL;
}
fib_table_entry_path_add2 (0, // default FIB table
diff --git a/vpp/vpp-api/api.c b/vpp/vpp-api/api.c
index b5253726..77cc89f4 100644
--- a/vpp/vpp-api/api.c
+++ b/vpp/vpp-api/api.c
@@ -55,6 +55,7 @@
#include <vnet/unix/tuntap.h>
#include <vnet/unix/tapcli.h>
#include <vnet/mpls/mpls.h>
+#include <vnet/mpls/mpls_tunnel.h>
#include <vnet/dhcp/proxy.h>
#include <vnet/dhcp/client.h>
#if IPV6SR > 0
@@ -174,9 +175,7 @@ _(TAP_DELETE, tap_delete) \
_(SW_INTERFACE_TAP_DUMP, sw_interface_tap_dump) \
_(CREATE_VLAN_SUBIF, create_vlan_subif) \
_(CREATE_SUBIF, create_subif) \
-_(MPLS_ETHERNET_ADD_DEL_TUNNEL, mpls_ethernet_add_del_tunnel) \
-_(MPLS_ETHERNET_ADD_DEL_TUNNEL_2, mpls_ethernet_add_del_tunnel_2) \
-_(MPLS_ADD_DEL_ENCAP, mpls_add_del_encap) \
+_(MPLS_TUNNEL_ADD_DEL, mpls_tunnel_add_del) \
_(PROXY_ARP_ADD_DEL, proxy_arp_add_del) \
_(PROXY_ARP_INTFC_ENABLE_DISABLE, proxy_arp_intfc_enable_disable) \
_(IP_NEIGHBOR_ADD_DEL, ip_neighbor_add_del) \
@@ -293,10 +292,8 @@ _(POLICER_CLASSIFY_SET_INTERFACE, policer_classify_set_interface) \
_(POLICER_CLASSIFY_DUMP, policer_classify_dump) \
_(NETMAP_CREATE, netmap_create) \
_(NETMAP_DELETE, netmap_delete) \
-_(MPLS_ETH_TUNNEL_DUMP, mpls_eth_tunnel_dump) \
-_(MPLS_ETH_TUNNEL_DETAILS, mpls_eth_tunnel_details) \
-_(MPLS_FIB_ENCAP_DUMP, mpls_fib_encap_dump) \
-_(MPLS_FIB_ENCAP_DETAILS, mpls_fib_encap_details) \
+_(MPLS_TUNNEL_DUMP, mpls_tunnel_dump) \
+_(MPLS_TUNNEL_DETAILS, mpls_tunnel_details) \
_(MPLS_FIB_DUMP, mpls_fib_dump) \
_(MPLS_FIB_DETAILS, mpls_fib_details) \
_(CLASSIFY_TABLE_IDS,classify_table_ids) \
@@ -350,21 +347,10 @@ typedef enum
{
RESOLVE_IP4_ADD_DEL_ROUTE = 1,
RESOLVE_IP6_ADD_DEL_ROUTE,
- RESOLVE_MPLS_ETHERNET_ADD_DEL,
} resolve_t;
typedef struct
{
- u8 resolve_type;
- union
- {
- vl_api_ip_add_del_route_t r;
- vl_api_mpls_ethernet_add_del_tunnel_2_t t;
- };
-} pending_route_t;
-
-typedef struct
-{
#define _(a) uword *a##_registration_hash; \
vpe_client_registration_t * a##_registrations;
@@ -373,9 +359,6 @@ typedef struct
/* notifications happen really early in the game */
u8 link_state_process_up;
- /* ip4 and ip6 pending route adds */
- pending_route_t *pending_routes;
-
/* ip4 arp event registration pool */
vl_api_ip4_arp_event_t *arp_events;
@@ -595,9 +578,6 @@ static int ip4_add_del_route_t_handler (vl_api_ip_add_del_route_t * mp);
static int ip6_add_del_route_t_handler (vl_api_ip_add_del_route_t * mp);
-static int mpls_ethernet_add_del_tunnel_2_t_handler
- (vl_api_mpls_ethernet_add_del_tunnel_2_t * mp);
-
void
handle_ip4_arp_event (u32 pool_index)
{
@@ -703,13 +683,7 @@ resolver_process (vlib_main_t * vm,
uword event_type;
uword *event_data = 0;
f64 timeout = 100.0;
- vpe_api_main_t *vam = &vpe_api_main;
- pending_route_t *pr;
- vl_api_ip_add_del_route_t *adr;
- vl_api_mpls_ethernet_add_del_tunnel_2_t *pme;
- u32 *resolution_failures = 0;
- int i, rv;
- clib_error_t *e;
+ int i;
while (1)
{
@@ -724,58 +698,7 @@ resolver_process (vlib_main_t * vm,
break;
case RESOLUTION_EVENT:
- for (i = 0; i < vec_len (event_data); i++)
- {
- /*
- * Resolution events can occur long after the
- * original request has timed out. $$$ add a cancel
- * mechanism..
- */
- if (pool_is_free_index (vam->pending_routes, event_data[i]))
- continue;
-
- pr = pool_elt_at_index (vam->pending_routes, event_data[i]);
- adr = &pr->r;
- pme = &pr->t;
-
- switch (pr->resolve_type)
- {
- case RESOLVE_IP4_ADD_DEL_ROUTE:
- rv = ip4_add_del_route_t_handler (adr);
- clib_warning ("resolver: add %U/%d via %U %s",
- format_ip4_address,
- (ip4_address_t *) & (adr->dst_address),
- adr->dst_address_length,
- format_ip4_address,
- (ip4_address_t *) & (adr->next_hop_address),
- (rv >= 0) ? "succeeded" : "failed");
- break;
-
- case RESOLVE_IP6_ADD_DEL_ROUTE:
- rv = ip6_add_del_route_t_handler (adr);
- clib_warning ("resolver: add %U/%d via %U %s",
- format_ip6_address,
- (ip6_address_t *) & (adr->dst_address),
- adr->dst_address_length,
- format_ip6_address,
- (ip6_address_t *) & (adr->next_hop_address),
- (rv >= 0) ? "succeeded" : "failed");
- break;
-
- case RESOLVE_MPLS_ETHERNET_ADD_DEL:
- rv = mpls_ethernet_add_del_tunnel_2_t_handler (pme);
- clib_warning ("resolver: add mpls-o-e via %U %s",
- format_ip4_address,
- (ip4_address_t *) &
- (pme->next_hop_ip4_address_in_outer_vrf),
- (rv >= 0) ? "succeeded" : "failed");
- break;
-
- default:
- clib_warning ("resolver: BOGUS TYPE %d", pr->resolve_type);
- }
- pool_put (vam->pending_routes, pr);
- }
+ clib_warning ("resolver: BOGUS TYPE");
break;
case IP4_ARP_EVENT:
@@ -788,109 +711,10 @@ resolver_process (vlib_main_t * vm,
handle_ip6_nd_event (event_data[i]);
break;
- case ~0: /* timeout, retry pending resolutions */
- /* *INDENT-OFF* */
- pool_foreach (pr, vam->pending_routes,
- ({
- int is_adr = 1;
- adr = &pr->r;
- pme = &pr->t;
-
- /* May fail, e.g. due to interface down */
- switch (pr->resolve_type)
- {
- case RESOLVE_IP4_ADD_DEL_ROUTE:
- e = ip4_probe_neighbor
- (vm, (ip4_address_t *)&(adr->next_hop_address),
- ntohl(adr->next_hop_sw_if_index));
- break;
-
- case RESOLVE_IP6_ADD_DEL_ROUTE:
- e = ip6_probe_neighbor
- (vm, (ip6_address_t *)&(adr->next_hop_address),
- ntohl(adr->next_hop_sw_if_index));
- break;
-
- case RESOLVE_MPLS_ETHERNET_ADD_DEL:
- is_adr = 0;
- e = ip4_probe_neighbor
- (vm,
- (ip4_address_t *)&(pme->next_hop_ip4_address_in_outer_vrf),
- pme->resolve_opaque);
- break;
-
- default:
- e = clib_error_return (0, "resolver: BOGUS TYPE %d",
- pr->resolve_type);
- }
- if (e)
- {
- clib_error_report (e);
- if (is_adr)
- adr->resolve_attempts = 1;
- else
- pme->resolve_attempts = 1;
- }
- if (is_adr)
- {
- adr->resolve_attempts -= 1;
- if (adr->resolve_attempts == 0)
- vec_add1 (resolution_failures,
- pr - vam->pending_routes);
- }
- else
- {
- pme->resolve_attempts -= 1;
- if (pme->resolve_attempts == 0)
- vec_add1 (resolution_failures,
- pr - vam->pending_routes);
- }
- }));
- /* *INDENT-ON* */
- for (i = 0; i < vec_len (resolution_failures); i++)
- {
- pr = pool_elt_at_index (vam->pending_routes,
- resolution_failures[i]);
- adr = &pr->r;
- pme = &pr->t;
-
- switch (pr->resolve_type)
- {
- case RESOLVE_IP4_ADD_DEL_ROUTE:
- clib_warning ("resolver: add %U/%d via %U retry failure",
- format_ip4_address,
- (ip4_address_t *) & (adr->dst_address),
- adr->dst_address_length,
- format_ip4_address,
- (ip4_address_t *) & (adr->next_hop_address));
- break;
-
- case RESOLVE_IP6_ADD_DEL_ROUTE:
- clib_warning ("resolver: add %U/%d via %U retry failure",
- format_ip6_address,
- (ip6_address_t *) & (adr->dst_address),
- adr->dst_address_length,
- format_ip6_address,
- (ip6_address_t *) & (adr->next_hop_address));
- break;
-
- case RESOLVE_MPLS_ETHERNET_ADD_DEL:
- clib_warning ("resolver: add mpls-o-e via %U retry failure",
- format_ip4_address,
- (ip4_address_t *) &
- (pme->next_hop_ip4_address_in_outer_vrf));
- break;
-
- default:
- clib_warning ("BUG");
- }
- pool_put (vam->pending_routes, pr);
- }
- vec_reset_length (resolution_failures);
+ case ~0: /* timeout */
break;
}
- if (pool_elts (vam->pending_routes) == 0)
- timeout = 100.0;
+
vec_reset_length (event_data);
}
return 0; /* or not */
@@ -921,47 +745,53 @@ add_del_route_t_handler (u8 is_multipath,
const ip46_address_t * next_hop,
u32 next_hop_sw_if_index,
u8 next_hop_fib_index,
- u32 next_hop_weight, u32 next_hop_out_label)
+ u32 next_hop_weight,
+ mpls_label_t next_hop_via_label,
+ mpls_label_t * next_hop_out_label_stack)
{
vnet_classify_main_t *cm = &vnet_classify_main;
stats_main_t *sm = &stats_main;
+ fib_route_path_flags_t path_flags = FIB_ROUTE_PATH_FLAG_NONE;
+ fib_route_path_t path = {
+ .frp_proto = (next_hop_proto_is_ip4 ?
+ FIB_PROTOCOL_IP4 : FIB_PROTOCOL_IP6),
+ .frp_addr = (NULL == next_hop ? zero_addr : *next_hop),
+ .frp_sw_if_index = next_hop_sw_if_index,
+ .frp_fib_index = next_hop_fib_index,
+ .frp_weight = next_hop_weight,
+ .frp_label_stack = next_hop_out_label_stack,
+ };
+ fib_route_path_t *paths = NULL;
- if (is_multipath)
+ if (MPLS_LABEL_INVALID != next_hop_via_label)
{
- fib_route_path_flags_t path_flags = FIB_ROUTE_PATH_FLAG_NONE;
+ path.frp_proto = FIB_PROTOCOL_MPLS;
+ path.frp_local_label = next_hop_via_label;
+ }
+ if (is_resolve_host)
+ path_flags |= FIB_ROUTE_PATH_RESOLVE_VIA_HOST;
+ if (is_resolve_attached)
+ path_flags |= FIB_ROUTE_PATH_RESOLVE_VIA_ATTACHED;
+
+ path.frp_flags = path_flags;
+ if (is_multipath)
+ {
dslock (sm, 1 /* release hint */ , 10 /* tag */ );
- if (is_resolve_host)
- path_flags |= FIB_ROUTE_PATH_RESOLVE_VIA_HOST;
- if (is_resolve_attached)
- path_flags |= FIB_ROUTE_PATH_RESOLVE_VIA_ATTACHED;
+
+ vec_add1 (paths, path);
if (is_add)
- fib_table_entry_path_add (fib_index,
- prefix,
- FIB_SOURCE_API,
- FIB_ENTRY_FLAG_NONE,
- (next_hop_proto_is_ip4 ?
- FIB_PROTOCOL_IP4 :
- FIB_PROTOCOL_IP6),
- next_hop,
- next_hop_sw_if_index,
- next_hop_fib_index,
- next_hop_weight,
- next_hop_out_label, path_flags);
+ fib_table_entry_path_add2 (fib_index,
+ prefix,
+ FIB_SOURCE_API,
+ FIB_ENTRY_FLAG_NONE, paths);
else
- fib_table_entry_path_remove (fib_index,
- prefix,
- FIB_SOURCE_API,
- (next_hop_proto_is_ip4 ?
- FIB_PROTOCOL_IP4 :
- FIB_PROTOCOL_IP6),
- next_hop,
- next_hop_sw_if_index,
- next_hop_fib_index,
- next_hop_weight, path_flags);
+ fib_table_entry_path_remove2 (fib_index,
+ prefix, FIB_SOURCE_API, paths);
+ vec_free (paths);
dsunlock (sm);
return 0;
}
@@ -1025,25 +855,11 @@ add_del_route_t_handler (u8 is_multipath,
{
if (is_add)
{
- fib_route_path_flags_t path_flags = FIB_ROUTE_PATH_FLAG_NONE;
-
- if (is_resolve_host)
- path_flags |= FIB_ROUTE_PATH_RESOLVE_VIA_HOST;
- if (is_resolve_attached)
- path_flags |= FIB_ROUTE_PATH_RESOLVE_VIA_ATTACHED;
-
- fib_table_entry_update_one_path (fib_index,
- prefix,
- FIB_SOURCE_API,
- FIB_ENTRY_FLAG_NONE,
- (next_hop_proto_is_ip4 ?
- FIB_PROTOCOL_IP4 :
- FIB_PROTOCOL_IP6),
- next_hop,
- next_hop_sw_if_index,
- next_hop_fib_index,
- next_hop_weight,
- next_hop_out_label, path_flags);
+ vec_add1 (paths, path);
+ fib_table_entry_update (fib_index,
+ prefix,
+ FIB_SOURCE_API, FIB_ENTRY_FLAG_NONE, paths);
+ vec_free (paths);
}
else
{
@@ -1117,7 +933,8 @@ static int
ip4_add_del_route_t_handler (vl_api_ip_add_del_route_t * mp)
{
u32 fib_index, next_hop_fib_index;
- int rv;
+ mpls_label_t *label_stack = NULL;
+ int rv, ii, n_labels;;
rv = add_del_route_check (FIB_PROTOCOL_IP4,
mp->table_id,
@@ -1140,6 +957,18 @@ ip4_add_del_route_t_handler (vl_api_ip_add_del_route_t * mp)
memset (&nh, 0, sizeof (nh));
memcpy (&nh.ip4, mp->next_hop_address, sizeof (nh.ip4));
+ n_labels = mp->next_hop_n_out_labels;
+ if (n_labels == 0)
+ ;
+ else if (1 == n_labels)
+ vec_add1 (label_stack, ntohl (mp->next_hop_out_label_stack[0]));
+ else
+ {
+ vec_validate (label_stack, n_labels - 1);
+ for (ii = 0; ii < n_labels; ii++)
+ label_stack[ii] = ntohl (mp->next_hop_out_label_stack[ii]);
+ }
+
return (add_del_route_t_handler (mp->is_multipath,
mp->is_add,
mp->is_drop,
@@ -1155,14 +984,16 @@ ip4_add_del_route_t_handler (vl_api_ip_add_del_route_t * mp)
ntohl (mp->next_hop_sw_if_index),
next_hop_fib_index,
mp->next_hop_weight,
- ntohl (mp->next_hop_out_label)));
+ ntohl (mp->next_hop_via_label),
+ label_stack));
}
static int
ip6_add_del_route_t_handler (vl_api_ip_add_del_route_t * mp)
{
u32 fib_index, next_hop_fib_index;
- int rv;
+ mpls_label_t *label_stack = NULL;
+ int rv, ii, n_labels;;
rv = add_del_route_check (FIB_PROTOCOL_IP6,
mp->table_id,
@@ -1185,6 +1016,18 @@ ip6_add_del_route_t_handler (vl_api_ip_add_del_route_t * mp)
memset (&nh, 0, sizeof (nh));
memcpy (&nh.ip6, mp->next_hop_address, sizeof (nh.ip6));
+ n_labels = mp->next_hop_n_out_labels;
+ if (n_labels == 0)
+ ;
+ else if (1 == n_labels)
+ vec_add1 (label_stack, ntohl (mp->next_hop_out_label_stack[0]));
+ else
+ {
+ vec_validate (label_stack, n_labels - 1);
+ for (ii = 0; ii < n_labels; ii++)
+ label_stack[ii] = ntohl (mp->next_hop_out_label_stack[ii]);
+ }
+
return (add_del_route_t_handler (mp->is_multipath,
mp->is_add,
mp->is_drop,
@@ -1199,7 +1042,8 @@ ip6_add_del_route_t_handler (vl_api_ip_add_del_route_t * mp)
&nh, ntohl (mp->next_hop_sw_if_index),
next_hop_fib_index,
mp->next_hop_weight,
- ntohl (mp->next_hop_out_label)));
+ ntohl (mp->next_hop_via_label),
+ label_stack));
}
static int
@@ -1207,8 +1051,8 @@ mpls_route_add_del_t_handler (vnet_main_t * vnm,
vl_api_mpls_route_add_del_t * mp)
{
u32 fib_index, next_hop_fib_index;
-
- int rv;
+ mpls_label_t *label_stack = NULL;
+ int rv, ii, n_labels;;
fib_prefix_t pfx = {
.fp_len = 21,
@@ -1251,6 +1095,18 @@ mpls_route_add_del_t_handler (vnet_main_t * vnm,
else
memcpy (&nh.ip6, mp->mr_next_hop, sizeof (nh.ip6));
+ n_labels = mp->mr_next_hop_n_out_labels;
+ if (n_labels == 0)
+ ;
+ else if (1 == n_labels)
+ vec_add1 (label_stack, ntohl (mp->mr_next_hop_out_label_stack[0]));
+ else
+ {
+ vec_validate (label_stack, n_labels - 1);
+ for (ii = 0; ii < n_labels; ii++)
+ label_stack[ii] = ntohl (mp->mr_next_hop_out_label_stack[ii]);
+ }
+
return (add_del_route_t_handler (mp->mr_is_multipath, mp->mr_is_add, 0, // mp->is_drop,
0, // mp->is_unreach,
0, // mp->is_prohibit,
@@ -1264,7 +1120,8 @@ mpls_route_add_del_t_handler (vnet_main_t * vnm,
&nh, ntohl (mp->mr_next_hop_sw_if_index),
next_hop_fib_index,
mp->mr_next_hop_weight,
- ntohl (mp->mr_next_hop_out_label)));
+ ntohl (mp->mr_next_hop_via_label),
+ label_stack));
}
void
@@ -2246,169 +2103,60 @@ out:
}
static void
- vl_api_mpls_ethernet_add_del_tunnel_t_handler
- (vl_api_mpls_ethernet_add_del_tunnel_t * mp)
+vl_api_mpls_tunnel_add_del_t_handler (vl_api_mpls_tunnel_add_del_t * mp)
{
- vl_api_mpls_ethernet_add_del_tunnel_reply_t *rmp;
+ vl_api_mpls_tunnel_add_del_reply_t *rmp;
int rv = 0;
stats_main_t *sm = &stats_main;
u32 tunnel_sw_if_index;
+ int ii;
dslock (sm, 1 /* release hint */ , 5 /* tag */ );
- rv = vnet_mpls_ethernet_add_del_tunnel
- (mp->dst_mac_address, (ip4_address_t *) (mp->adj_address),
- (u32) (mp->adj_address_length), ntohl (mp->vrf_id),
- ntohl (mp->tx_sw_if_index),
- &tunnel_sw_if_index, mp->l2_only, mp->is_add);
-
- dsunlock (sm);
+ if (mp->mt_is_add)
+ {
+ fib_route_path_t rpath, *rpaths = NULL;
+ mpls_label_t *label_stack = NULL;
- /* *INDENT-OFF* */
- REPLY_MACRO2(VL_API_MPLS_ETHERNET_ADD_DEL_TUNNEL_REPLY,
- ({
- rmp->tunnel_sw_if_index = ntohl(tunnel_sw_if_index);
- }));
- /* *INDENT-ON* */
-}
+ memset (&rpath, 0, sizeof (rpath));
-/*
- * This piece of misery brought to you because the control-plane
- * can't figure out the tx interface + dst-mac address all by itself
- */
-static int mpls_ethernet_add_del_tunnel_2_t_handler
- (vl_api_mpls_ethernet_add_del_tunnel_2_t * mp)
-{
- pending_route_t *pr;
- vl_api_mpls_ethernet_add_del_tunnel_2_t *pme;
- vnet_main_t *vnm = vnet_get_main ();
- vlib_main_t *vm = vlib_get_main ();
- stats_main_t *sm = &stats_main;
- vpe_api_main_t *vam = &vpe_api_main;
- u32 inner_fib_index, outer_fib_index;
- ip4_main_t *im = &ip4_main;
- ip_lookup_main_t *lm = &im->lookup_main;
- ip_adjacency_t *adj = 0;
- u32 lookup_result;
- u32 tx_sw_if_index;
- u8 *dst_mac_address;
- clib_error_t *e;
- uword *p;
- int rv;
- u32 tunnel_sw_if_index;
+ if (mp->mt_next_hop_proto_is_ip4)
+ {
+ rpath.frp_proto = FIB_PROTOCOL_IP4;
+ clib_memcpy (&rpath.frp_addr.ip4,
+ mp->mt_next_hop, sizeof (rpath.frp_addr.ip4));
+ }
+ else
+ {
+ rpath.frp_proto = FIB_PROTOCOL_IP6;
+ clib_memcpy (&rpath.frp_addr.ip6,
+ mp->mt_next_hop, sizeof (rpath.frp_addr.ip6));
+ }
+ rpath.frp_sw_if_index = ntohl (mp->mt_next_hop_sw_if_index);
- p = hash_get (im->fib_index_by_table_id, ntohl (mp->outer_vrf_id));
- if (!p)
- return VNET_API_ERROR_NO_SUCH_FIB;
- else
- outer_fib_index = p[0];
+ for (ii = 0; ii < mp->mt_next_hop_n_out_labels; ii++)
+ vec_add1 (label_stack, ntohl (mp->mt_next_hop_out_label_stack[ii]));
+ vec_add1 (rpaths, rpath);
- p = hash_get (im->fib_index_by_table_id, ntohl (mp->inner_vrf_id));
- if (!p)
- return VNET_API_ERROR_NO_SUCH_INNER_FIB;
+ vnet_mpls_tunnel_add (rpaths, label_stack,
+ mp->mt_l2_only, &tunnel_sw_if_index);
+ vec_free (rpaths);
+ vec_free (label_stack);
+ }
else
- inner_fib_index = p[0];
-
- if (inner_fib_index == outer_fib_index)
- return VNET_API_ERROR_INVALID_VALUE;
-
- // FIXME not an ADJ
- lookup_result = ip4_fib_table_lookup_lb (ip4_fib_get (outer_fib_index),
- (ip4_address_t *)
- mp->next_hop_ip4_address_in_outer_vrf);
-
- adj = ip_get_adjacency (lm, lookup_result);
- tx_sw_if_index = adj->rewrite_header.sw_if_index;
-
- if (mp->is_add && mp->resolve_if_needed)
{
- if (adj->lookup_next_index == IP_LOOKUP_NEXT_ARP)
- {
- pool_get (vam->pending_routes, pr);
- pr->resolve_type = RESOLVE_MPLS_ETHERNET_ADD_DEL;
- pme = &pr->t;
- clib_memcpy (pme, mp, sizeof (*pme));
- /* recursion block, "just in case" */
- pme->resolve_if_needed = 0;
- pme->resolve_attempts = ntohl (mp->resolve_attempts);
- pme->resolve_opaque = tx_sw_if_index;
- vnet_register_ip4_arp_resolution_event
- (vnm,
- (ip4_address_t *) & (pme->next_hop_ip4_address_in_outer_vrf),
- vpe_resolver_process_node.index,
- RESOLUTION_EVENT, pr - vam->pending_routes);
-
- vlib_process_signal_event
- (vm, vpe_resolver_process_node.index,
- RESOLUTION_PENDING_EVENT, 0 /* data */ );
-
- /* The interface may be down, etc. */
- e = ip4_probe_neighbor
- (vm, (ip4_address_t *) & (mp->next_hop_ip4_address_in_outer_vrf),
- tx_sw_if_index);
-
- if (e)
- clib_error_report (e);
-
- return VNET_API_ERROR_IN_PROGRESS;
- }
+ vnet_mpls_tunnel_del (ntohl (mp->mt_sw_if_index));
}
- if (adj->lookup_next_index != IP_LOOKUP_NEXT_REWRITE)
- return VNET_API_ERROR_NEXT_HOP_NOT_IN_FIB;
-
- dst_mac_address =
- vnet_rewrite_get_data_internal
- (&adj->rewrite_header, sizeof (adj->rewrite_data));
-
- dslock (sm, 1 /* release hint */ , 10 /* tag */ );
-
- rv = vnet_mpls_ethernet_add_del_tunnel
- (dst_mac_address, (ip4_address_t *) (mp->adj_address),
- (u32) (mp->adj_address_length), ntohl (mp->inner_vrf_id),
- tx_sw_if_index, &tunnel_sw_if_index, mp->l2_only, mp->is_add);
-
dsunlock (sm);
- return rv;
-}
-
-static void
- vl_api_mpls_ethernet_add_del_tunnel_2_t_handler
- (vl_api_mpls_ethernet_add_del_tunnel_2_t * mp)
-{
- vl_api_mpls_ethernet_add_del_tunnel_reply_t *rmp;
- int rv = 0;
-
- rv = mpls_ethernet_add_del_tunnel_2_t_handler (mp);
-
- REPLY_MACRO (VL_API_MPLS_ETHERNET_ADD_DEL_TUNNEL_2_REPLY);
-}
-
-
-static void
-vl_api_mpls_add_del_encap_t_handler (vl_api_mpls_add_del_encap_t * mp)
-{
- vl_api_mpls_add_del_encap_reply_t *rmp;
- int rv;
- static u32 *labels;
- int i;
-
- vec_reset_length (labels);
-
- for (i = 0; i < mp->nlabels; i++)
- vec_add1 (labels, ntohl (mp->labels[i]));
-
- /* $$$$ fixme */
- rv = vnet_mpls_add_del_encap ((ip4_address_t *) mp->dst_address,
- ntohl (mp->vrf_id), labels,
- ~0 /* policy_tunnel_index */ ,
- 0 /* no_dst_hash */ ,
- 0 /* indexp */ ,
- mp->is_add);
-
- REPLY_MACRO (VL_API_MPLS_ADD_DEL_ENCAP_REPLY);
+ /* *INDENT-OFF* */
+ REPLY_MACRO2(VL_API_MPLS_TUNNEL_ADD_DEL_REPLY,
+ ({
+ rmp->sw_if_index = ntohl(tunnel_sw_if_index);
+ }));
+ /* *INDENT-ON* */
}
static void
@@ -4084,6 +3832,7 @@ vl_api_modify_vhost_user_if_t_handler (vl_api_modify_vhost_user_if_t * mp)
rv = vhost_user_modify_if (vnm, vm, (char *) mp->sock_filename,
mp->is_server, sw_if_index, (u64) ~ 0,
mp->renumber, ntohl (mp->custom_dev_instance));
+
REPLY_MACRO (VL_API_MODIFY_VHOST_USER_IF_REPLY);
}
@@ -7433,84 +7182,63 @@ vl_api_netmap_delete_t_handler (vl_api_netmap_delete_t * mp)
}
static void
-vl_api_mpls_eth_tunnel_details_t_handler (vl_api_mpls_eth_tunnel_details_t *
- mp)
+vl_api_mpls_tunnel_details_t_handler (vl_api_mpls_fib_details_t * mp)
{
clib_warning ("BUG");
}
+typedef struct mpls_tunnel_send_walk_ctx_t_
+{
+ unix_shared_memory_queue_t *q;
+ u32 index;
+ u32 context;
+} mpls_tunnel_send_walk_ctx_t;
+
static void
-send_mpls_eth_tunnel_entry (vpe_api_main_t * am,
- unix_shared_memory_queue_t * q,
- mpls_eth_tunnel_t * et, u32 index, u32 context)
+send_mpls_tunnel_entry (u32 mti, void *arg)
{
- mpls_main_t *mm = &mpls_main;
- mpls_encap_t *e;
- int i;
+ mpls_tunnel_send_walk_ctx_t *ctx;
+ vl_api_mpls_tunnel_details_t *mp;
+ const mpls_tunnel_t *mt;
u32 nlabels;
- vl_api_mpls_eth_tunnel_details_t *mp;
- e = pool_elt_at_index (mm->encaps, et->encap_index);
- nlabels = vec_len (e->labels);
+ ctx = arg;
+
+ if (~0 != ctx->index && mti != ctx->index)
+ return;
+
+ mt = mpls_tunnel_get (mti);
+ nlabels = vec_len (mt->mt_label_stack);
mp = vl_msg_api_alloc (sizeof (*mp) + nlabels * sizeof (u32));
memset (mp, 0, sizeof (*mp));
- mp->_vl_msg_id = ntohs (VL_API_MPLS_ETH_TUNNEL_DETAILS);
- mp->context = context;
+ mp->_vl_msg_id = ntohs (VL_API_MPLS_TUNNEL_DETAILS);
+ mp->context = ctx->context;
- mp->tunnel_index = htonl (index);
- memcpy (mp->tunnel_dst_mac, et->tunnel_dst, 6);
- mp->intfc_address = et->intfc_address.as_u32;
- mp->tx_sw_if_index = htonl (et->tx_sw_if_index);
- mp->inner_fib_index = htonl (et->inner_fib_index);
- mp->mask_width = htonl (et->mask_width);
- mp->encap_index = htonl (et->encap_index);
- mp->hw_if_index = htonl (et->hw_if_index);
- mp->l2_only = htonl (et->l2_only);
- mp->nlabels = htonl (nlabels);
+ mp->tunnel_index = ntohl (mti);
+ memcpy (mp->mt_next_hop_out_labels,
+ mt->mt_label_stack, nlabels * sizeof (u32));
- for (i = 0; i < nlabels; i++)
- {
- mp->labels[i] =
- htonl (vnet_mpls_uc_get_label
- (clib_host_to_net_u32 (e->labels[i].label_exp_s_ttl)));
- }
+ // FIXME
- vl_msg_api_send_shmem (q, (u8 *) & mp);
+ vl_msg_api_send_shmem (ctx->q, (u8 *) & mp);
}
static void
-vl_api_mpls_eth_tunnel_dump_t_handler (vl_api_mpls_eth_tunnel_dump_t * mp)
+vl_api_mpls_tunnel_dump_t_handler (vl_api_mpls_tunnel_dump_t * mp)
{
- vpe_api_main_t *am = &vpe_api_main;
unix_shared_memory_queue_t *q;
- mpls_main_t *mm = &mpls_main;
- mpls_eth_tunnel_t *et;
- u32 index = ntohl (mp->tunnel_index);
q = vl_api_client_index_to_input_queue (mp->client_index);
if (q == 0)
return;
- if (index != ~0)
- {
- if (!pool_is_free_index (mm->eth_tunnels, index))
- {
- et = pool_elt_at_index (mm->eth_tunnels, index);
- send_mpls_eth_tunnel_entry (am, q, et, et - mm->eth_tunnels,
- mp->context);
- }
- }
- else
- {
- /* *INDENT-OFF* */
- pool_foreach (et, mm->eth_tunnels,
- ({
- send_mpls_eth_tunnel_entry (am, q, et, et - mm->eth_tunnels,
- mp->context);
- }));
- /* *INDENT-ON* */
- }
+ mpls_tunnel_send_walk_ctx_t ctx = {
+ .q = q,
+ .index = ntohl (mp->tunnel_index),
+ .context = mp->context,
+ };
+ mpls_tunnel_walk (send_mpls_tunnel_entry, &ctx);
}
static void
@@ -7930,99 +7658,6 @@ vl_api_ip6_fib_dump_t_handler (vl_api_ip6_fib_dump_t * mp)
}
static void
-vl_api_mpls_fib_encap_details_t_handler (vl_api_mpls_fib_encap_details_t * mp)
-{
- clib_warning ("BUG");
-}
-
-static void
-send_mpls_fib_encap_details (vpe_api_main_t * am,
- unix_shared_memory_queue_t * q,
- show_mpls_fib_t * s, u32 context)
-{
- vl_api_mpls_fib_encap_details_t *mp;
- mpls_main_t *mm = &mpls_main;
- mpls_encap_t *e;
- int i;
- u32 nlabels;
-
- e = pool_elt_at_index (mm->encaps, s->entry_index);
- nlabels = vec_len (e->labels);
-
- mp = vl_msg_api_alloc (sizeof (*mp) + nlabels * sizeof (u32));
- memset (mp, 0, sizeof (*mp));
- mp->_vl_msg_id = ntohs (VL_API_MPLS_FIB_ENCAP_DETAILS);
- mp->context = context;
-
- mp->fib_index = htonl (s->fib_index);
- mp->entry_index = htonl (s->entry_index);
- mp->dest = s->dest;
- mp->s_bit = htonl (s->s_bit);
-
- mp->nlabels = htonl (nlabels);
-
- for (i = 0; i < nlabels; i++)
- {
- mp->labels[i] =
- htonl (vnet_mpls_uc_get_label
- (clib_host_to_net_u32 (e->labels[i].label_exp_s_ttl)));
- }
-
- vl_msg_api_send_shmem (q, (u8 *) & mp);
-}
-
-static void
-vl_api_mpls_fib_encap_dump_t_handler (vl_api_mpls_fib_encap_dump_t * mp)
-{
- vpe_api_main_t *am = &vpe_api_main;
- unix_shared_memory_queue_t *q;
- vlib_main_t *vm = &vlib_global_main;
- u64 key;
- u32 value;
- show_mpls_fib_t *records = 0;
- show_mpls_fib_t *s;
- mpls_main_t *mm = &mpls_main;
- ip4_fib_t *rx_fib;
-
- q = vl_api_client_index_to_input_queue (mp->client_index);
- if (q == 0)
- return;
-
- /* *INDENT-OFF* */
- hash_foreach (key, value, mm->mpls_encap_by_fib_and_dest,
- ({
- vec_add2 (records, s, 1);
- s->fib_index = (u32)(key>>32);
- s->dest = (u32)(key & 0xFFFFFFFF);
- s->entry_index = (u32) value;
- }));
- /* *INDENT-ON* */
-
- if (0 == vec_len (records))
- {
- vlib_cli_output (vm, "MPLS encap table empty");
- goto out;
- }
-
- /* sort output by dst address within fib */
- vec_sort_with_function (records, mpls_dest_cmp);
- vec_sort_with_function (records, mpls_fib_index_cmp);
- vlib_cli_output (vm, "MPLS encap table");
- vlib_cli_output (vm, "%=6s%=16s%=16s", "Table", "Dest address", "Labels");
- vec_foreach (s, records)
- {
- rx_fib = ip4_fib_get (s->fib_index);
- vlib_cli_output (vm, "%=6d%=16U%=16U", rx_fib->table_id,
- format_ip4_address, &s->dest, format_mpls_encap_index,
- mm, s->entry_index);
- send_mpls_fib_encap_details (am, q, s, mp->context);
- }
-
-out:
- vec_free (records);
-}
-
-static void
vl_api_classify_table_ids_t_handler (vl_api_classify_table_ids_t * mp)
{
unix_shared_memory_queue_t *q;
@@ -9259,7 +8894,7 @@ vpe_api_hookup (vlib_main_t * vm)
/*
* Trace space for 8 MPLS encap labels, classifier mask+match
*/
- am->api_trace_cfg[VL_API_MPLS_ADD_DEL_ENCAP].size += 8 * sizeof (u32);
+ am->api_trace_cfg[VL_API_MPLS_TUNNEL_ADD_DEL].size += 8 * sizeof (u32);
am->api_trace_cfg[VL_API_CLASSIFY_ADD_DEL_TABLE].size += 5 * sizeof (u32x4);
am->api_trace_cfg[VL_API_CLASSIFY_ADD_DEL_SESSION].size
+= 5 * sizeof (u32x4);
diff --git a/vpp/vpp-api/custom_dump.c b/vpp/vpp-api/custom_dump.c
index a36a8a43..691defaa 100644
--- a/vpp/vpp-api/custom_dump.c
+++ b/vpp/vpp-api/custom_dump.c
@@ -519,9 +519,6 @@ static void *vl_api_ip_add_del_route_t_print
if (mp->create_vrf_if_needed)
s = format (s, "create-vrf ");
- if (mp->resolve_attempts != 0)
- s = format (s, "resolve-attempts %d ", ntohl (mp->resolve_attempts));
-
if (mp->next_hop_weight != 1)
s = format (s, "weight %d ", mp->next_hop_weight);
@@ -573,77 +570,25 @@ static void *vl_api_proxy_arp_intfc_enable_disable_t_print
FINISH;
}
-static void *vl_api_mpls_add_del_encap_t_print
- (vl_api_mpls_add_del_encap_t * mp, void *handle)
-{
- u8 *s;
- int i;
-
- s = format (0, "SCRIPT: mpls_add_del_encap ");
-
- s = format (s, "vrf_id %d ", ntohl (mp->vrf_id));
-
- s = format (s, "dst %U ", format_ip4_address, mp->dst_address);
-
- for (i = 0; i < mp->nlabels; i++)
- s = format (s, "label %d ", ntohl (mp->labels[i]));
-
- if (mp->is_add == 0)
- s = format (s, "del ");
-
- FINISH;
-}
-
-static void *vl_api_mpls_ethernet_add_del_tunnel_t_print
- (vl_api_mpls_ethernet_add_del_tunnel_t * mp, void *handle)
-{
- u8 *s;
-
- s = format (0, "SCRIPT: mpls_ethernet_add_del_tunnel ");
-
- s = format (s, "tx_sw_if_index %d ", ntohl (mp->tx_sw_if_index));
-
- s = format (s, "dst %U", format_ethernet_address, mp->dst_mac_address);
-
- s = format (s, "adj %U/%d ", format_ip4_address,
- (ip4_address_t *) mp->adj_address, mp->adj_address_length);
-
- s = format (s, "vrf_id %d ", ntohl (mp->vrf_id));
-
- if (mp->l2_only)
- s = format (s, "l2-only ");
-
- if (mp->is_add == 0)
- s = format (s, "del ");
-
- FINISH;
-}
-
-static void *vl_api_mpls_ethernet_add_del_tunnel_2_t_print
- (vl_api_mpls_ethernet_add_del_tunnel_2_t * mp, void *handle)
+static void *vl_api_mpls_tunnel_add_del_t_print
+ (vl_api_mpls_tunnel_add_del_t * mp, void *handle)
{
u8 *s;
- s = format (0, "SCRIPT: mpls_ethernet_add_del_tunnel_2 ");
-
- s = format (s, "adj %U/%d ", format_ip4_address,
- (ip4_address_t *) mp->adj_address, mp->adj_address_length);
+ s = format (0, "SCRIPT: mpls_tunnel_add_del ");
- s = format (s, "next-hop %U ", format_ip4_address,
- (ip4_address_t *) mp->next_hop_ip4_address_in_outer_vrf);
+ if (mp->mt_next_hop_sw_if_index)
+ s = format (s, "sw_if_index %d ", ntohl (mp->mt_next_hop_sw_if_index));
- s = format (s, "inner_vrf_id %d ", ntohl (mp->inner_vrf_id));
-
- s = format (s, "outer_vrf_id %d ", ntohl (mp->outer_vrf_id));
-
- s = format (s, "resolve-if-needed %d ", mp->resolve_if_needed);
-
- s = format (s, "resolve-attempts %d ", ntohl (mp->resolve_attempts));
+ if (mp->mt_next_hop_proto_is_ip4)
+ s = format (s, "%U ", format_ip4_address, mp->mt_next_hop);
+ else
+ s = format (s, "%U ", format_ip6_address, mp->mt_next_hop);
- if (mp->l2_only)
+ if (mp->mt_l2_only)
s = format (s, "l2-only ");
- if (mp->is_add == 0)
+ if (mp->mt_is_add == 0)
s = format (s, "del ");
FINISH;
@@ -2053,28 +1998,18 @@ static void *vl_api_sw_interface_clear_stats_t_print
FINISH;
}
-static void *vl_api_mpls_eth_tunnel_dump_t_print
- (vl_api_mpls_eth_tunnel_dump_t * mp, void *handle)
+static void *vl_api_mpls_tunnel_dump_t_print
+ (vl_api_mpls_tunnel_dump_t * mp, void *handle)
{
u8 *s;
- s = format (0, "SCRIPT: mpls_eth_tunnel_dump ");
+ s = format (0, "SCRIPT: mpls_tunnel_dump ");
s = format (s, "tunnel_index %d ", ntohl (mp->tunnel_index));
FINISH;
}
-static void *vl_api_mpls_fib_encap_dump_t_print
- (vl_api_mpls_fib_encap_dump_t * mp, void *handle)
-{
- u8 *s;
-
- s = format (0, "SCRIPT: mpls_fib_encap_dump ");
-
- FINISH;
-}
-
static void *vl_api_mpls_fib_dump_t_print
(vl_api_mpls_fib_dump_t * mp, void *handle)
{
@@ -2975,9 +2910,7 @@ _(SW_INTERFACE_TAP_DUMP, sw_interface_tap_dump) \
_(IP_ADD_DEL_ROUTE, ip_add_del_route) \
_(PROXY_ARP_ADD_DEL, proxy_arp_add_del) \
_(PROXY_ARP_INTFC_ENABLE_DISABLE, proxy_arp_intfc_enable_disable) \
-_(MPLS_ADD_DEL_ENCAP, mpls_add_del_encap) \
-_(MPLS_ETHERNET_ADD_DEL_TUNNEL, mpls_ethernet_add_del_tunnel) \
-_(MPLS_ETHERNET_ADD_DEL_TUNNEL_2, mpls_ethernet_add_del_tunnel_2) \
+_(MPLS_TUNNEL_ADD_DEL, mpls_tunnel_add_del) \
_(SW_INTERFACE_SET_UNNUMBERED, sw_interface_set_unnumbered) \
_(IP_NEIGHBOR_ADD_DEL, ip_neighbor_add_del) \
_(RESET_VRF, reset_vrf) \
@@ -3053,9 +2986,8 @@ _(COP_WHITELIST_ENABLE_DISABLE, cop_whitelist_enable_disable) \
_(AF_PACKET_CREATE, af_packet_create) \
_(AF_PACKET_DELETE, af_packet_delete) \
_(SW_INTERFACE_CLEAR_STATS, sw_interface_clear_stats) \
-_(MPLS_ETH_TUNNEL_DUMP, mpls_eth_tunnel_dump) \
-_(MPLS_FIB_ENCAP_DUMP, mpls_fib_encap_dump) \
_(MPLS_FIB_DUMP, mpls_fib_dump) \
+_(MPLS_TUNNEL_DUMP, mpls_tunnel_dump) \
_(CLASSIFY_TABLE_IDS,classify_table_ids) \
_(CLASSIFY_TABLE_BY_INTERFACE, classify_table_by_interface) \
_(CLASSIFY_TABLE_INFO,classify_table_info) \
diff --git a/vpp/vpp-api/test_client.c b/vpp/vpp-api/test_client.c
index cb265ee5..df608d4f 100644
--- a/vpp/vpp-api/test_client.c
+++ b/vpp/vpp-api/test_client.c
@@ -224,13 +224,6 @@ vl_api_create_vlan_subif_reply_t_handler (vl_api_create_vlan_subif_reply_t *
ntohl (mp->retval), ntohl (mp->sw_if_index));
}
-static void
-vl_api_mpls_add_del_encap_reply_t_handler (vl_api_mpls_add_del_encap_reply_t *
- mp)
-{
- fformat (stdout, "add del mpls label reply %d\n", ntohl (mp->retval));
-}
-
static void vl_api_proxy_arp_add_del_reply_t_handler
(vl_api_proxy_arp_add_del_reply_t * mp)
{
@@ -590,7 +583,6 @@ _(SW_INTERFACE_ADD_DEL_ADDRESS_REPLY, sw_interface_add_del_address_reply) \
_(SW_INTERFACE_SET_TABLE_REPLY, sw_interface_set_table_reply) \
_(TAP_CONNECT_REPLY, tap_connect_reply) \
_(CREATE_VLAN_SUBIF_REPLY, create_vlan_subif_reply) \
-_(MPLS_ADD_DEL_ENCAP_REPLY, mpls_add_del_encap_reply) \
_(PROXY_ARP_ADD_DEL_REPLY, proxy_arp_add_del_reply) \
_(PROXY_ARP_INTFC_ENABLE_DISABLE_REPLY, proxy_arp_intfc_enable_disable_reply) \
_(IP_NEIGHBOR_ADD_DEL_REPLY, ip_neighbor_add_del_reply) \
@@ -737,9 +729,6 @@ add_del_ip4_route (test_main_t * tm, int enable_disable)
mp->context = 0xdeadbeef;
mp->table_id = ntohl (0);
mp->create_vrf_if_needed = 1;
- /* Arp, please, if needed */
- mp->resolve_if_needed = 1;
- mp->resolve_attempts = ntohl (10);
mp->next_hop_sw_if_index = ntohl (5);
mp->is_add = enable_disable;
diff --git a/vpp/vpp-api/vpe.api b/vpp/vpp-api/vpe.api
index bcc3f4ec..2da94215 100644
--- a/vpp/vpp-api/vpe.api
+++ b/vpp/vpp-api/vpe.api
@@ -361,7 +361,9 @@ define create_vlan_subif_reply
@param mr_next_hop[16] - the nextop address
@param mr_next_hop_sw_if_index - the next-hop SW interface
@param mr_next_hop_table_id - the next-hop table-id (if appropriate)
- @param mr_next_hop_out_label - the next-hop output label
+ @param mr_next_hop_n_out_labels - the number of labels in the label stack
+ @param mr_next_hop_out_label_stack - the next-hop output label stack, outer most first
+ @param next_hop_via_label - The next-hop is a resolved via a local label
*/
define mpls_route_add_del
{
@@ -380,9 +382,11 @@ define mpls_route_add_del
u8 mr_next_hop_proto_is_ip4;
u8 mr_next_hop_weight;
u8 mr_next_hop[16];
+ u8 mr_next_hop_n_out_labels;
u32 mr_next_hop_sw_if_index;
u32 mr_next_hop_table_id;
- u32 mr_next_hop_out_label;
+ u32 mr_next_hop_via_label;
+ u32 mr_next_hop_out_label_stack[mr_next_hop_n_out_labels];
};
/** \brief Reply for MPLS route add / del request
@@ -532,16 +536,92 @@ define mpls_ip_bind_unbind_reply
i32 retval;
};
+/** \brief MPLS tunnel Add / del route
+ @param client_index - opaque cookie to identify the sender
+ @param context - sender context, to match reply w/ request
+ @param mt_is_add - Is this a route add or delete
+ @param mt_sw_if_index - The SW interface index of the tunnel to delete
+ @param mt_next_hop_proto_is_ip4 - The next-hop is IPV4
+ @param mt_next_hop_weight - The weight, for UCMP
+ @param mt_next_hop[16] - the nextop address
+ @param mt_next_hop_sw_if_index - the next-hop SW interface
+ @param mt_next_hop_table_id - the next-hop table-id (if appropriate)
+ @param mt_next_hop_n_out_labels - the number of next-hop output labels
+ @param mt_next_hop_out_label_stack - the next-hop output label stack, outer most first
+*/
+define mpls_tunnel_add_del
+{
+ u32 client_index;
+ u32 context;
+ u32 mt_sw_if_index;
+ u8 mt_is_add;
+ u8 mt_l2_only;
+ u8 mt_next_hop_proto_is_ip4;
+ u8 mt_next_hop_weight;
+ u8 mt_next_hop[16];
+ u8 mt_next_hop_n_out_labels;
+ u32 mt_next_hop_sw_if_index;
+ u32 mt_next_hop_table_id;
+ u32 mt_next_hop_out_label_stack[mt_next_hop_n_out_labels];
+};
+
+/** \brief Reply for MPLS tunnel add / del request
+ @param context - returned sender context, to match reply w/ request
+ @param retval - return code
+ @param sw_if_index - SW interface index of the tunnel created
+*/
+define mpls_tunnel_add_del_reply
+{
+ u32 context;
+ i32 retval;
+ u32 sw_if_index;
+};
+
+/** \brief Dump mpls eth tunnel table
+ @param client_index - opaque cookie to identify the sender
+ @param tunnel_index - eth tunnel identifier or -1 in case of all tunnels
+*/
+define mpls_tunnel_dump
+{
+ u32 client_index;
+ u32 context;
+ i32 tunnel_index;
+};
+
+/** \brief mpls eth tunnel operational state response
+ @param tunnel_index - eth tunnel identifier
+ @param intfc_address - interface ipv4 addr
+ @param mask_width - interface ipv4 addr mask
+ @param hw_if_index - interface id
+ @param l2_only -
+ @param tunnel_dst_mac -
+ @param tx_sw_if_index -
+ @param encap_index - reference to mpls label table
+ @param nlabels - number of resolved labels
+ @param labels - resolved labels
+*/
+define mpls_tunnel_details
+{
+ u32 context;
+ u32 tunnel_index;
+ u8 mt_l2_only;
+ u8 mt_sw_if_index;
+ u8 mt_next_hop_proto_is_ip4;
+ u8 mt_next_hop[16];
+ u32 mt_next_hop_sw_if_index;
+ u32 mt_next_hop_table_id;
+ u32 mt_next_hop_n_labels;
+ u32 mt_next_hop_out_labels[mt_next_hop_n_labels];
+};
+
/** \brief Add / del route request
@param client_index - opaque cookie to identify the sender
@param context - sender context, to match reply w/ request
@param sw_if_index - software index of the new vlan's parent interface
@param vrf_id - fib table /vrf associated with the route
@param lookup_in_vrf -
- @param resolve_attempts -
@param classify_table_index -
@param create_vrf_if_needed -
- @param resolve_if_needed -
@param is_add - 1 if adding the route, 0 if deleting
@param is_drop - Drop the packet
@param is_unreach - Drop the packet and rate limit send ICMP unreachable
@@ -555,6 +635,9 @@ define mpls_ip_bind_unbind_reply
@param dst_address_length -
@param dst_address[16] -
@param next_hop_address[16] -
+ @param next_hop_n_out_labels - the number of labels in the label stack
+ @param next_hop_out_label_stack - the next-hop output label stack, outer most first
+ @param next_hop_via_label - The next-hop is a resolved via a local label
*/
define ip_add_del_route
{
@@ -562,12 +645,9 @@ define ip_add_del_route
u32 context;
u32 next_hop_sw_if_index;
u32 table_id;
- u32 resolve_attempts;
u32 classify_table_index;
- u32 next_hop_out_label;
u32 next_hop_table_id;
u8 create_vrf_if_needed;
- u8 resolve_if_needed;
u8 is_add;
u8 is_drop;
u8 is_unreach;
@@ -584,6 +664,9 @@ define ip_add_del_route
u8 dst_address_length;
u8 dst_address[16];
u8 next_hop_address[16];
+ u8 next_hop_n_out_labels;
+ u32 next_hop_via_label;
+ u32 next_hop_out_label_stack[next_hop_n_out_labels];
};
/** \brief Reply for add / del route request
@@ -596,37 +679,6 @@ define ip_add_del_route_reply
i32 retval;
};
-/** \brief Add / del MPLS encapsulation request
- @param client_index - opaque cookie to identify the sender
- @param context - sender context, to match reply w/ request
- @param vrf_id - vrf id
- @param dst_address[4] -
- @param is_add - 1 if adding the encap, 0 if deleting
- @param nlabels - number of labels
- @param labels - array of labels
-*/
-define mpls_add_del_encap
-{
- u32 client_index;
- u32 context;
- u32 vrf_id;
- u8 dst_address[4];
- /* 1 = add, 0 = delete */
- u8 is_add;
- u8 nlabels;
- u32 labels[0];
-};
-
-/** \brief Reply for add / del encapsulation request
- @param context - returned sender context, to match reply w/ request
- @param retval - return code
-*/
-define mpls_add_del_encap_reply
-{
- u32 context;
- i32 retval;
-};
-
/** \brief Proxy ARP add / del request
@param client_index - opaque cookie to identify the sender
@param context - sender context, to match reply w/ request
@@ -1508,78 +1560,6 @@ define sw_interface_set_vxlan_bypass_reply
i32 retval;
};
-/** \brief MPLS Ethernet add / del tunnel request
- @param client_index - opaque cookie to identify the sender
- @param context - sender context, to match reply w/ request
- @param vrf_id - vrf_id, only for IP4
- @param sw_if_index - interface used to reach neighbor
- @param is_add - add if set, tunnel delete if 0
- @param dst_mac_address -
- @param adj_address -
- @param adj_address_length -
-*/
-define mpls_ethernet_add_del_tunnel
-{
- u32 client_index;
- u32 context;
- u32 vrf_id;
- u32 tx_sw_if_index;
- u8 is_add;
- u8 l2_only;
- u8 dst_mac_address[6];
- u8 adj_address[4];
- u8 adj_address_length;
-};
-
-/** \brief Reply for MPLS Ethernet add / delete tunnel request
- @param context - sender context, to match reply w/ request
- @param retval - return code for the request
-*/
-define mpls_ethernet_add_del_tunnel_reply
-{
- u32 context;
- i32 retval;
- u32 tunnel_sw_if_index;
-};
-/** \brief MPLS Ethernet add/ del tunnel 2
- @param client_index - opaque cookie to identify the sender
- @param context - sender context, to match reply w/ request
- @param inner_vrf_id -
- @param outer_vrf_id -
- @param resolve_attempts -
- @param resolve_opaque -
- @param resolve_if_needed -
- @param is_add -
- @param adj_address -
- @param adj_address_length -
- @param next_hop_ip4_address_in_outer_vrf -
-*/
-define mpls_ethernet_add_del_tunnel_2
-{
- u32 client_index;
- u32 context;
- u32 inner_vrf_id;
- u32 outer_vrf_id;
- u32 resolve_attempts;
- u32 resolve_opaque; /* no need to set this */
- u8 resolve_if_needed;
- u8 is_add;
- u8 l2_only;
- u8 adj_address[4];
- u8 adj_address_length;
- u8 next_hop_ip4_address_in_outer_vrf[4];
-};
-
-/** \brief MPLS Ethernet add/ del tunnel 2
- @param context - sender context, to match reply w/ request
- @param retval - return code for add /del request
-*/
-define mpls_ethernet_add_del_tunnel_2_reply
-{
- u32 context;
- i32 retval;
-};
-
/** \brief Set L2 XConnect between two interfaces request
@param client_index - opaque cookie to identify the sender
@param context - sender context, to match reply w/ request
@@ -4567,118 +4547,6 @@ define netmap_delete_reply
i32 retval;
};
-/** \brief Dump mpls gre tunnel table
- @param client_index - opaque cookie to identify the sender
- @param tunnel_index - gre tunnel identifier or -1 in case of all tunnels
-*/
-define mpls_gre_tunnel_dump
-{
- u32 client_index;
- u32 context;
- i32 tunnel_index;
-};
-
-/** \brief mpls gre tunnel operational state response
- @param tunnel_index - gre tunnel identifier
- @param intfc_address - interface ipv4 addr
- @param mask_width - interface ipv4 addr mask
- @param hw_if_index - interface id
- @param l2_only -
- @param tunnel_src - tunnel source ipv4 addr
- @param tunnel_dst - tunnel destination ipv4 addr
- @param outer_fib_index - gre tunnel identifier
- @param encap_index - reference to mpls label table
- @param nlabels - number of resolved labels
- @param labels - resolved labels
-*/
-define mpls_gre_tunnel_details
-{
- u32 context;
- u32 tunnel_index;
-
- u32 intfc_address;
- u32 inner_fib_index;
- u32 mask_width;
- u32 encap_index;
- u32 hw_if_index;
- u8 l2_only;
- u32 tunnel_src;
- u32 tunnel_dst;
- u32 outer_fib_index;
- u32 nlabels;
- u32 labels[nlabels];
-};
-
-/** \brief Dump mpls eth tunnel table
- @param client_index - opaque cookie to identify the sender
- @param tunnel_index - eth tunnel identifier or -1 in case of all tunnels
-*/
-define mpls_eth_tunnel_dump
-{
- u32 client_index;
- u32 context;
- i32 tunnel_index;
-};
-
-/** \brief mpls eth tunnel operational state response
- @param tunnel_index - eth tunnel identifier
- @param intfc_address - interface ipv4 addr
- @param mask_width - interface ipv4 addr mask
- @param hw_if_index - interface id
- @param l2_only -
- @param tunnel_dst_mac -
- @param tx_sw_if_index -
- @param encap_index - reference to mpls label table
- @param nlabels - number of resolved labels
- @param labels - resolved labels
-*/
-define mpls_eth_tunnel_details
-{
- u32 context;
- u32 tunnel_index;
-
- u32 intfc_address;
- u32 inner_fib_index;
- u32 mask_width;
- u32 encap_index;
- u32 hw_if_index;
- u8 l2_only;
- u8 tunnel_dst_mac[6];
- u32 tx_sw_if_index;
- u32 nlabels;
- u32 labels[nlabels];
-};
-
-/** \brief Dump mpls fib table
- @param client_index - opaque cookie to identify the sender
- @param fib_index - mpls fib entry identifier or -1 in case of all entries
-*/
-define mpls_fib_encap_dump
-{
- u32 client_index;
- u32 context;
-};
-
-/** \brief mpls fib encap table response
- @param fib_index - fib table id
- @param dest - destination ipv4 addr
- @param s_bit -
- @param entry_index - reference to mpls label table
- @param nlabels - number of resolved labels
- @param labels - resolved labels
-*/
-define mpls_fib_encap_details
-{
- u32 context;
-
- u32 fib_index;
- u32 entry_index;
- u32 dest;
- u32 s_bit;
- u32 nlabels;
- u32 labels[nlabels];
-};
-
/** \brief Classify get table IDs request
@param client_index - opaque cookie to identify the sender
@param context - sender context, to match reply w/ request