aboutsummaryrefslogtreecommitdiffstats
path: root/vpp
diff options
context:
space:
mode:
authorKeith Burns (alagalah) <alagalah@gmail.com>2016-05-05 18:16:50 -0700
committerDave Barach <openvpp@barachs.net>2016-05-13 16:07:41 +0000
commit94b1442a6731bb879797c016a8febaec2f2ae7c9 (patch)
tree7c874e6fc3c102cae06133430c4b9799f073df3a /vpp
parent3e53fc56645f4b99d014031995bd00d16c051a9b (diff)
VPP43 - NSH refactoring: Added nsh-map nodes
- removed vnet/vnet/nsh-gre - removed all nsh from vnet/vnet/nsh_vxlan_gpe to vnet/vnet/nsh - moved vnet/vnet/nsh_vxlan_gpe to vnet/vnet/vxlan_gpe - added cli and binary api for VXLAN GPE tunnels - plan to move vnet/vnet/nsh to new repo (sfc_nsh) and make plugin - added cli for NSH (binary API will be done in sfc_nsh) - vnet/vnet/gre will be extended in VPP-54 Change-Id: I1d27def916532321577ccd68cb982ae0d0a07e6f Signed-off-by: Keith Burns (alagalah) <alagalah@gmail.com>
Diffstat (limited to 'vpp')
-rw-r--r--vpp/api/api.c121
-rw-r--r--vpp/api/custom_dump.c104
-rw-r--r--vpp/api/vpe.api24
3 files changed, 42 insertions, 207 deletions
diff --git a/vpp/api/api.c b/vpp/api/api.c
index 9bf4d3c957a..24f7d9c0e19 100644
--- a/vpp/api/api.c
+++ b/vpp/api/api.c
@@ -67,8 +67,7 @@
#include <vnet/vxlan/vxlan.h>
#include <vnet/gre/gre.h>
#include <vnet/l2/l2_vtr.h>
-#include <vnet/nsh-gre/nsh_gre.h>
-#include <vnet/nsh-vxlan-gpe/nsh_vxlan_gpe.h>
+#include <vnet/vxlan-gpe/vxlan_gpe.h>
#include <vnet/lisp-gpe/lisp_gpe.h>
#include <vnet/lisp-cp/control.h>
#include <vnet/map/map.h>
@@ -288,10 +287,9 @@ _(IP_ADDRESS_DUMP, ip_address_dump) \
_(IP_DUMP, ip_dump) \
_(SW_INTERFACE_VHOST_USER_DETAILS, sw_interface_vhost_user_details) \
_(SHOW_VERSION, show_version) \
-_(NSH_GRE_ADD_DEL_TUNNEL, nsh_gre_add_del_tunnel) \
_(L2_FIB_TABLE_DUMP, l2_fib_table_dump) \
_(L2_FIB_TABLE_ENTRY, l2_fib_table_entry) \
-_(NSH_VXLAN_GPE_ADD_DEL_TUNNEL, nsh_vxlan_gpe_add_del_tunnel) \
+_(VXLAN_GPE_ADD_DEL_TUNNEL, vxlan_gpe_add_del_tunnel) \
_(INTERFACE_NAME_RENUMBER, interface_name_renumber) \
_(WANT_IP4_ARP_EVENTS, want_ip4_arp_events) \
_(INPUT_ACL_SET_INTERFACE, input_acl_set_interface) \
@@ -4528,88 +4526,18 @@ vl_api_l2_patch_add_del_t_handler (vl_api_l2_patch_add_del_t *mp)
}
static void
-vl_api_nsh_gre_add_del_tunnel_t_handler
-(vl_api_nsh_gre_add_del_tunnel_t * mp)
+vl_api_vxlan_gpe_add_del_tunnel_t_handler
+(vl_api_vxlan_gpe_add_del_tunnel_t * mp)
{
- vl_api_nsh_gre_add_del_tunnel_reply_t * rmp;
+ vl_api_vxlan_gpe_add_del_tunnel_reply_t * rmp;
int rv = 0;
- vnet_nsh_gre_add_del_tunnel_args_t _a, *a = &_a;
+ vnet_vxlan_gpe_add_del_tunnel_args_t _a, *a = &_a;
u32 encap_fib_index, decap_fib_index;
- u32 decap_next_index;
+ u8 protocol;
uword * p;
ip4_main_t * im = &ip4_main;
- u32 * tlvs = 0;
u32 sw_if_index = ~0;
- int i;
-
- p = hash_get (im->fib_index_by_table_id, ntohl(mp->encap_vrf_id));
- if (! p) {
- rv = VNET_API_ERROR_NO_SUCH_FIB;
- goto out;
- }
- encap_fib_index = p[0];
-
- decap_next_index = ntohl(mp->decap_next_index);
-
- /* Interpret decap_vrf_id as an opaque if sending to other-than-ip4-input */
- if (decap_next_index == NSH_GRE_INPUT_NEXT_IP4_INPUT) {
- p = hash_get (im->fib_index_by_table_id, ntohl(mp->decap_vrf_id));
- if (! p) {
- rv = VNET_API_ERROR_NO_SUCH_INNER_FIB;
- goto out;
- }
- decap_fib_index = p[0];
- } else {
- decap_fib_index = ntohl(mp->decap_vrf_id);
- }
-
- memset (a, 0, sizeof (*a));
- a->is_add = mp->is_add;
- /* ip addresses sent in network byte order */
- a->src.as_u32 = ntohl(mp->src);
- a->dst.as_u32 = ntohl(mp->dst);
- a->encap_fib_index = encap_fib_index;
- a->decap_fib_index = decap_fib_index;
- a->decap_next_index = decap_next_index;
- a->nsh_hdr.ver_o_c = mp->ver_o_c;
- a->nsh_hdr.length = mp->length;
- a->nsh_hdr.md_type = mp->md_type;
- a->nsh_hdr.next_protocol = mp->next_protocol;
- a->nsh_hdr.spi_si = ntohl(mp->spi_si);
- a->nsh_hdr.c1 = ntohl(mp->c1);
- a->nsh_hdr.c2 = ntohl(mp->c2);
- a->nsh_hdr.c3 = ntohl(mp->c3);
- a->nsh_hdr.c4 = ntohl(mp->c4);
-
- for (i = 0; i < mp->tlv_len_in_words; i++)
- vec_add1 (tlvs, ntohl(mp->tlvs[i]));
-
- a->nsh_hdr.tlvs = tlvs;
-
- rv = vnet_nsh_gre_add_del_tunnel (a, &sw_if_index);
-
-out:
- REPLY_MACRO2(VL_API_NSH_GRE_ADD_DEL_TUNNEL_REPLY,
- ({
- rmp->sw_if_index = ntohl (sw_if_index);
- }));
-}
-
-static void
-vl_api_nsh_vxlan_gpe_add_del_tunnel_t_handler
-(vl_api_nsh_vxlan_gpe_add_del_tunnel_t * mp)
-{
- vl_api_nsh_vxlan_gpe_add_del_tunnel_reply_t * rmp;
- int rv = 0;
- vnet_nsh_vxlan_gpe_add_del_tunnel_args_t _a, *a = &_a;
- u32 encap_fib_index, decap_fib_index;
- u32 decap_next_index;
- uword * p;
- ip4_main_t * im = &ip4_main;
- u32 * tlvs = 0;
- u32 sw_if_index = ~0;
- int i;
p = hash_get (im->fib_index_by_table_id, ntohl(mp->encap_vrf_id));
if (! p) {
@@ -4618,10 +4546,10 @@ vl_api_nsh_vxlan_gpe_add_del_tunnel_t_handler
}
encap_fib_index = p[0];
- decap_next_index = ntohl(mp->decap_next_index);
+ protocol = ntohl(mp->protocol);
/* Interpret decap_vrf_id as an opaque if sending to other-than-ip4-input */
- if (decap_next_index == NSH_GRE_INPUT_NEXT_IP4_INPUT) {
+ if (protocol == VXLAN_GPE_INPUT_NEXT_IP4_INPUT) {
p = hash_get (im->fib_index_by_table_id, ntohl(mp->decap_vrf_id));
if (! p) {
rv = VNET_API_ERROR_NO_SUCH_INNER_FIB;
@@ -4636,31 +4564,16 @@ vl_api_nsh_vxlan_gpe_add_del_tunnel_t_handler
a->is_add = mp->is_add;
/* ip addresses sent in network byte order */
- a->src.as_u32 = ntohl(mp->src);
- a->dst.as_u32 = ntohl(mp->dst);
+ a->local.as_u32 = ntohl(mp->local);
+ a->remote.as_u32 = ntohl(mp->remote);
a->encap_fib_index = encap_fib_index;
a->decap_fib_index = decap_fib_index;
- a->decap_next_index = decap_next_index;
+ a->protocol = protocol;
a->vni = ntohl(mp->vni);
- a->nsh_hdr.ver_o_c = mp->ver_o_c;
- a->nsh_hdr.length = mp->length;
- a->nsh_hdr.md_type = mp->md_type;
- a->nsh_hdr.next_protocol = mp->next_protocol;
- a->nsh_hdr.spi_si = ntohl(mp->spi_si);
- a->nsh_hdr.c1 = ntohl(mp->c1);
- a->nsh_hdr.c2 = ntohl(mp->c2);
- a->nsh_hdr.c3 = ntohl(mp->c3);
- a->nsh_hdr.c4 = ntohl(mp->c4);
-
- for (i = 0; i < mp->tlv_len_in_words; i++)
- vec_add1 (tlvs, ntohl(mp->tlvs[i]));
-
- a->nsh_hdr.tlvs = tlvs;
-
- rv = vnet_nsh_vxlan_gpe_add_del_tunnel (a, &sw_if_index);
+ rv = vnet_vxlan_gpe_add_del_tunnel (a, &sw_if_index);
out:
- REPLY_MACRO2(VL_API_NSH_VXLAN_GPE_ADD_DEL_TUNNEL_REPLY,
+ REPLY_MACRO2(VL_API_VXLAN_GPE_ADD_DEL_TUNNEL_REPLY,
({
rmp->sw_if_index = ntohl (sw_if_index);
}));
@@ -6044,12 +5957,6 @@ vpe_api_hookup (vlib_main_t *vm)
am->api_trace_cfg [VL_API_VXLAN_ADD_DEL_TUNNEL].size
+= 16 * sizeof (u32);
- /*
- * trace space for 4 nsh-gre variable TLV words
- */
- am->api_trace_cfg [VL_API_NSH_GRE_ADD_DEL_TUNNEL].size
- += 4 * sizeof (u32);
-
/*
* Thread-safe API messages
*/
diff --git a/vpp/api/custom_dump.c b/vpp/api/custom_dump.c
index f77a41cc93f..ba41b1fb603 100644
--- a/vpp/api/custom_dump.c
+++ b/vpp/api/custom_dump.c
@@ -26,8 +26,9 @@
#include <vnet/l2tp/l2tp.h>
#include <vnet/l2/l2_input.h>
#include <vnet/sr/sr_packet.h>
-#include <vnet/nsh-gre/nsh_gre.h>
-#include <vnet/nsh-vxlan-gpe/nsh_vxlan_gpe.h>
+//#include <vnet/nsh-gre/nsh_gre.h> //alagalah testing nsh-gre removal
+#include <vnet/nsh/nsh.h> //alagalah testing nsh-gre removal
+#include <vnet/vxlan-gpe/vxlan_gpe.h>
#include <vlib/vlib.h>
#include <vlib/unix/unix.h>
#include <vlibapi/api.h>
@@ -1574,77 +1575,17 @@ static void *vl_api_show_version_t_print
FINISH;
}
-static void *vl_api_nsh_gre_add_del_tunnel_t_print
-(vl_api_nsh_gre_add_del_tunnel_t * mp, void *handle)
+static void *vl_api_vxlan_gpe_add_del_tunnel_t_print
+(vl_api_vxlan_gpe_add_del_tunnel_t * mp, void *handle)
{
u8 * s;
- int i;
- u32 spi_si;
-
- s = format (0, "SCRIPT: nsh_gre_add_del_tunnel ");
-
- s = format (s, "src %U dst %U ", format_ip4_address, &mp->src,
- format_ip4_address, &mp->dst);
-
- spi_si = ntohl(mp->spi_si);
-
- s = format (s, "spi %d si %d ", (spi_si>>8), (spi_si & 0xff));
-
- s = format (s, "decap-next %d ", ntohl(mp->decap_next_index));
-
- if (mp->is_add == 0)
- s = format (s, "del ");
-
- if (mp->encap_vrf_id)
- s = format (s, "encap-vrf-id %d ", ntohl(mp->encap_vrf_id));
-
- if (mp->decap_vrf_id)
- s = format (s, "decap-vrf-id %d ", ntohl(mp->decap_vrf_id));
-
- if (mp->ver_o_c & 0xc)
- s = format (s, "version %d ", mp->ver_o_c>>6);
- if (mp->ver_o_c & NSH_O_BIT)
- s = format (s, "o-bit 1 ");
- if (mp->ver_o_c & NSH_C_BIT)
- s = format (s, "c-bit 1 ");
- if (mp->md_type)
- s = format (s, "md-type %d ", mp->md_type);
- if (mp->next_protocol == 1)
- s = format (s, "next-ip4 ");
- else if (mp->next_protocol == 2)
- s = format (s, "next-ip6 ");
- else if (mp->next_protocol == 3)
- s = format (s, "next-ethernet");
-
- s = format (s, "c1 %d ", ntohl(mp->c1));
- s = format (s, "c2 %d ", ntohl(mp->c2));
- s = format (s, "c3 %d ", ntohl(mp->c3));
- s = format (s, "c4 %d ", ntohl(mp->c4));
-
- for (i = 0; i < mp->tlv_len_in_words; i++) {
- s = format (s, "tlv %x ", ntohl(mp->tlvs[i]));
- }
-
- FINISH;
-}
-static void *vl_api_nsh_vxlan_gpe_add_del_tunnel_t_print
-(vl_api_nsh_vxlan_gpe_add_del_tunnel_t * mp, void *handle)
-{
- u8 * s;
- int i;
- u32 spi_si;
+ s = format (0, "SCRIPT: vxlan_gpe_add_del_tunnel ");
- s = format (0, "SCRIPT: nsh_vxlan_gpe_add_del_tunnel ");
+ s = format (s, "local %U remote %U ", format_ip4_address, &mp->local,
+ format_ip4_address, &mp->remote);
- s = format (s, "src %U dst %U ", format_ip4_address, &mp->src,
- format_ip4_address, &mp->dst);
-
- spi_si = ntohl(mp->spi_si);
-
- s = format (s, "spi %d si %d ", (spi_si>>8), (spi_si & 0xff));
-
- s = format (s, "decap-next %d ", ntohl(mp->decap_next_index));
+ s = format (s, "protocol %d ", ntohl(mp->protocol));
s = format (s, "vni %d ", ntohl(mp->vni));
@@ -1657,30 +1598,6 @@ static void *vl_api_nsh_vxlan_gpe_add_del_tunnel_t_print
if (mp->decap_vrf_id)
s = format (s, "decap-vrf-id %d ", ntohl(mp->decap_vrf_id));
- if (mp->ver_o_c & 0xc)
- s = format (s, "version %d ", mp->ver_o_c>>6);
- if (mp->ver_o_c & NSH_O_BIT)
- s = format (s, "o-bit 1 ");
- if (mp->ver_o_c & NSH_C_BIT)
- s = format (s, "c-bit 1 ");
- if (mp->md_type)
- s = format (s, "md-type %d ", mp->md_type);
- if (mp->next_protocol == 1)
- s = format (s, "next-ip4 ");
- else if (mp->next_protocol == 2)
- s = format (s, "next-ip6 ");
- else if (mp->next_protocol == 3)
- s = format (s, "next-ethernet");
-
- s = format (s, "c1 %d ", ntohl(mp->c1));
- s = format (s, "c2 %d ", ntohl(mp->c2));
- s = format (s, "c3 %d ", ntohl(mp->c3));
- s = format (s, "c4 %d ", ntohl(mp->c4));
-
- for (i = 0; i < mp->tlv_len_in_words; i++) {
- s = format (s, "tlv %x ", ntohl(mp->tlvs[i]));
- }
-
FINISH;
}
@@ -1872,9 +1789,8 @@ _(CLI_REQUEST, cli_request) \
_(MEMCLNT_CREATE, memclnt_create) \
_(SW_INTERFACE_VHOST_USER_DUMP, sw_interface_vhost_user_dump) \
_(SHOW_VERSION, show_version) \
-_(NSH_GRE_ADD_DEL_TUNNEL, nsh_gre_add_del_tunnel) \
_(L2_FIB_TABLE_DUMP, l2_fib_table_dump) \
-_(NSH_VXLAN_GPE_ADD_DEL_TUNNEL, nsh_vxlan_gpe_add_del_tunnel) \
+_(VXLAN_GPE_ADD_DEL_TUNNEL, vxlan_gpe_add_del_tunnel) \
_(INTERFACE_NAME_RENUMBER, interface_name_renumber) \
_(WANT_IP4_ARP_EVENTS, want_ip4_arp_events) \
_(INPUT_ACL_SET_INTERFACE, input_acl_set_interface) \
diff --git a/vpp/api/vpe.api b/vpp/api/vpe.api
index 8b5b21ca02c..fadecfb1966 100644
--- a/vpp/api/vpe.api
+++ b/vpp/api/vpe.api
@@ -2139,15 +2139,27 @@ manual_java define l2_fib_table_dump {
u32 bd_id;
};
-define nsh_vxlan_gpe_add_del_tunnel {
+define vxlan_gpe_add_del_tunnel {
u32 client_index;
u32 context;
- u32 src;
- u32 dst;
+ u32 local;
+ u32 remote;
u32 encap_vrf_id;
u32 decap_vrf_id;
- u32 decap_next_index;
+ u8 protocol;
u32 vni;
+ u8 is_add;
+};
+
+define vxlan_gpe_add_del_tunnel_reply {
+ u32 context;
+ i32 retval;
+ u32 sw_if_index;
+};
+
+define nsh_add_del_entry {
+ u32 client_index;
+ u32 context;
u8 tlv_len_in_words;
u8 is_add;
u8 ver_o_c;
@@ -2155,7 +2167,7 @@ define nsh_vxlan_gpe_add_del_tunnel {
u8 md_type;
u8 next_protocol;
/* in network byte order */
- u32 spi_si;
+ u32 nsp_nsi;
u32 c1;
u32 c2;
u32 c3;
@@ -2163,7 +2175,7 @@ define nsh_vxlan_gpe_add_del_tunnel {
u32 tlvs[0];
};
-define nsh_vxlan_gpe_add_del_tunnel_reply {
+define nsh_add_del_entry_reply {
u32 context;
i32 retval;
u32 sw_if_index;