aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--build-data/suffix-rules.mk23
-rw-r--r--vlib-api/Makefile.am12
l---------vlib-api/suffix-rules.mk1
-rw-r--r--vlib-api/vlibapi/api_helper_macros.h163
-rw-r--r--vlib-api/vlibmemory/vl_memory_api_h.h1
-rw-r--r--vnet/Makefile.am21
l---------vnet/suffix-rules.mk1
-rw-r--r--vnet/vnet/interface.api31
-rw-r--r--vnet/vnet/interface_api.c122
-rw-r--r--vnet/vnet/vnet_all_api_h.h40
-rw-r--r--vnet/vnet/vnet_msg_enum.h37
-rw-r--r--vpp-api-test/vat/api_format.c28
-rw-r--r--vpp-api/java/Makefile.am3
-rw-r--r--vpp/Makefile.am9
l---------vpp/suffix-rules.mk1
-rw-r--r--vpp/vpp-api/api.c167
-rw-r--r--vpp/vpp-api/vpe.api29
-rw-r--r--vpp/vpp-api/vpe_all_api_h.h9
18 files changed, 483 insertions, 215 deletions
diff --git a/build-data/suffix-rules.mk b/build-data/suffix-rules.mk
new file mode 100644
index 00000000000..95069297fa5
--- /dev/null
+++ b/build-data/suffix-rules.mk
@@ -0,0 +1,23 @@
+# Copyright (c) 2016 Cisco and/or its affiliates.
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at:
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+# Shared suffix rules
+# Please do not set "SUFFIXES = .api.h .api" here
+
+%.api.h: %.api
+ @echo " APIGEN " $@ ; \
+ mkdir -p `dirname $@` ; \
+ $(CC) $(CPPFLAGS) -E -P -C -x c $^ \
+ | vppapigen --input - --output $@ --show-name $@
+
+
diff --git a/vlib-api/Makefile.am b/vlib-api/Makefile.am
index 5bc00e7479b..087d56eec3a 100644
--- a/vlib-api/Makefile.am
+++ b/vlib-api/Makefile.am
@@ -20,10 +20,11 @@ lib_LTLIBRARIES = libvlibapi.la libvlibmemory.la libvlibmemoryclient.la \
libvlibapi_la_SOURCES = \
vlibapi/api.h \
+ vlibapi/api_helper_macros.h \
vlibapi/api_shared.c \
vlibapi/node_serialize.c
-nobase_include_HEADERS = vlibapi/api.h
+nobase_include_HEADERS = vlibapi/api.h vlibapi/api_helper_macros.h
libvlibmemory_la_SOURCES = \
vlibmemory/api.h \
@@ -70,11 +71,10 @@ BUILT_SOURCES = vlibsocket/sockclnt.api.h vlibmemory/memclnt.api.h
SUFFIXES = .api.h .api
-%.api.h: %.api
- @echo " APIGEN " $@ ; \
- mkdir -p `dirname $@` ; \
- $(CC) $(CPPFLAGS) -E -P -C -x c $^ \
- | vppapigen --input - --output $@ --show-name $@
+# The actual %.api.h rule is in .../build-data/packages/suffix-rules.mk
+# and requires a symbolic link at the top of the vnet source tree
+
+include $(top_srcdir)/suffix-rules.mk
# install the API definition, so we can produce java bindings, etc.
apidir = $(prefix)/vlibmemory
diff --git a/vlib-api/suffix-rules.mk b/vlib-api/suffix-rules.mk
new file mode 120000
index 00000000000..f609840001f
--- /dev/null
+++ b/vlib-api/suffix-rules.mk
@@ -0,0 +1 @@
+../build-data/suffix-rules.mk \ No newline at end of file
diff --git a/vlib-api/vlibapi/api_helper_macros.h b/vlib-api/vlibapi/api_helper_macros.h
new file mode 100644
index 00000000000..9ccdf961970
--- /dev/null
+++ b/vlib-api/vlibapi/api_helper_macros.h
@@ -0,0 +1,163 @@
+/*
+ *------------------------------------------------------------------
+ * api_helper_macros.h - message handler helper macros
+ *
+ * Copyright (c) 2016 Cisco and/or its affiliates.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at:
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *------------------------------------------------------------------
+ */
+
+
+#ifndef __api_helper_macros_h__
+#define __api_helper_macros_h__
+
+#define f64_endian(a)
+#define f64_print(a,b)
+
+#define REPLY_MACRO(t) \
+do { \
+ unix_shared_memory_queue_t * q; \
+ rv = vl_msg_api_pd_handler (mp, rv); \
+ q = vl_api_client_index_to_input_queue (mp->client_index); \
+ if (!q) \
+ return; \
+ \
+ rmp = vl_msg_api_alloc (sizeof (*rmp)); \
+ rmp->_vl_msg_id = ntohs((t)); \
+ rmp->context = mp->context; \
+ rmp->retval = ntohl(rv); \
+ \
+ vl_msg_api_send_shmem (q, (u8 *)&rmp); \
+} while(0);
+
+#define REPLY_MACRO2(t, body) \
+do { \
+ unix_shared_memory_queue_t * q; \
+ rv = vl_msg_api_pd_handler (mp, rv); \
+ q = vl_api_client_index_to_input_queue (mp->client_index); \
+ if (!q) \
+ return; \
+ \
+ rmp = vl_msg_api_alloc (sizeof (*rmp)); \
+ rmp->_vl_msg_id = ntohs((t)); \
+ rmp->context = mp->context; \
+ rmp->retval = ntohl(rv); \
+ do {body;} while (0); \
+ vl_msg_api_send_shmem (q, (u8 *)&rmp); \
+} while(0);
+
+#define REPLY_MACRO3(t, n, body) \
+do { \
+ unix_shared_memory_queue_t * q; \
+ rv = vl_msg_api_pd_handler (mp, rv); \
+ q = vl_api_client_index_to_input_queue (mp->client_index); \
+ if (!q) \
+ return; \
+ \
+ rmp = vl_msg_api_alloc (sizeof (*rmp) + n); \
+ rmp->_vl_msg_id = ntohs((t)); \
+ rmp->context = mp->context; \
+ rmp->retval = ntohl(rv); \
+ do {body;} while (0); \
+ vl_msg_api_send_shmem (q, (u8 *)&rmp); \
+} while(0);
+
+#define REPLY_MACRO4(t, n, body) \
+do { \
+ unix_shared_memory_queue_t * q; \
+ u8 is_error = 0; \
+ rv = vl_msg_api_pd_handler (mp, rv); \
+ q = vl_api_client_index_to_input_queue (mp->client_index); \
+ if (!q) \
+ return; \
+ \
+ rmp = vl_msg_api_alloc_or_null (sizeof (*rmp) + n); \
+ if (!rmp) \
+ { \
+ /* if there isn't enough memory, try to allocate */ \
+ /* some at least for returning an error */ \
+ rmp = vl_msg_api_alloc (sizeof (*rmp)); \
+ if (!rmp) \
+ return; \
+ \
+ memset (rmp, 0, sizeof (*rmp)); \
+ rv = VNET_API_ERROR_TABLE_TOO_BIG; \
+ is_error = 1; \
+ } \
+ rmp->_vl_msg_id = ntohs((t)); \
+ rmp->context = mp->context; \
+ rmp->retval = ntohl(rv); \
+ if (!is_error) \
+ do {body;} while (0); \
+ vl_msg_api_send_shmem (q, (u8 *)&rmp); \
+} while(0);
+
+/* "trust, but verify" */
+
+#define VALIDATE_SW_IF_INDEX(mp) \
+ do { u32 __sw_if_index = ntohl(mp->sw_if_index); \
+ vnet_main_t *__vnm = vnet_get_main(); \
+ if (pool_is_free_index(__vnm->interface_main.sw_interfaces, \
+ __sw_if_index)) { \
+ rv = VNET_API_ERROR_INVALID_SW_IF_INDEX; \
+ goto bad_sw_if_index; \
+ } \
+} while(0);
+
+#define BAD_SW_IF_INDEX_LABEL \
+do { \
+bad_sw_if_index: \
+ ; \
+} while (0);
+
+#define VALIDATE_RX_SW_IF_INDEX(mp) \
+ do { u32 __rx_sw_if_index = ntohl(mp->rx_sw_if_index); \
+ vnet_main_t *__vnm = vnet_get_main(); \
+ if (pool_is_free_index(__vnm->interface_main.sw_interfaces, \
+ __rx_sw_if_index)) { \
+ rv = VNET_API_ERROR_INVALID_SW_IF_INDEX; \
+ goto bad_rx_sw_if_index; \
+ } \
+} while(0);
+
+#define BAD_RX_SW_IF_INDEX_LABEL \
+do { \
+bad_rx_sw_if_index: \
+ ; \
+} while (0);
+
+#define VALIDATE_TX_SW_IF_INDEX(mp) \
+ do { u32 __tx_sw_if_index = ntohl(mp->tx_sw_if_index); \
+ vnet_main_t *__vnm = vnet_get_main(); \
+ if (pool_is_free_index(__vnm->interface_main.sw_interfaces, \
+ __tx_sw_if_index)) { \
+ rv = VNET_API_ERROR_INVALID_SW_IF_INDEX; \
+ goto bad_tx_sw_if_index; \
+ } \
+} while(0);
+
+#define BAD_TX_SW_IF_INDEX_LABEL \
+do { \
+bad_tx_sw_if_index: \
+ ; \
+} while (0);
+
+#endif /* __api_helper_macros_h__ */
+
+/*
+ * fd.io coding-style-patch-verification: ON
+ *
+ * Local Variables:
+ * eval: (c-set-style "gnu")
+ * End:
+ */
diff --git a/vlib-api/vlibmemory/vl_memory_api_h.h b/vlib-api/vlibmemory/vl_memory_api_h.h
index 63d9a395629..c1ae79b1737 100644
--- a/vlib-api/vlibmemory/vl_memory_api_h.h
+++ b/vlib-api/vlibmemory/vl_memory_api_h.h
@@ -23,7 +23,6 @@
*/
#include <vlibmemory/memclnt.api.h>
-
/*
* fd.io coding-style-patch-verification: ON
*
diff --git a/vnet/Makefile.am b/vnet/Makefile.am
index d806785f6d7..a9481d11dc2 100644
--- a/vnet/Makefile.am
+++ b/vnet/Makefile.am
@@ -15,6 +15,8 @@ AUTOMAKE_OPTIONS = foreign subdir-objects
AM_CFLAGS = -Wall -Werror @DPDK@ @DPDK_CRYPTO@ @IPSEC@ @IPV6SR@
+BUILT_SOURCES = vnet/interface.api.h
+
libvnet_la_SOURCES =
libvnetplugin_la_SOURCES =
nobase_include_HEADERS =
@@ -34,6 +36,7 @@ libvnet_la_SOURCES += \
vnet/devices/devices.c \
vnet/handoff.c \
vnet/interface.c \
+ vnet/interface_api.c \
vnet/interface_cli.c \
vnet/interface_format.c \
vnet/interface_output.c \
@@ -49,12 +52,15 @@ nobase_include_HEADERS += \
vnet/global_funcs.h \
vnet/handoff.h \
vnet/interface.h \
+ vnet/interface.api.h \
vnet/interface_funcs.h \
vnet/l3_types.h \
vnet/pipeline.h \
vnet/replication.h \
vnet/rewrite.h \
- vnet/vnet.h
+ vnet/vnet.h \
+ vnet/vnet_all_api_h.h \
+ vnet/vnet_msg_enum.h
########################################
# Policer infra
@@ -876,3 +882,16 @@ pcap2pg_LDFLAGS = -static
pcap2pg_LDADD = libvnet.la -l:libvppinfra.a -lpthread -lm -ldl
noinst_PROGRAMS += pcap2pg
+
+# Set the suffix list
+SUFFIXES = .api.h .api
+
+# install the API definition, so we can produce java bindings, etc.
+
+apidir = $(prefix)/vpp-api
+api_DATA = vnet/interface.api
+
+# The actual %.api.h rule is in .../build-data/packages/suffix-rules.mk
+# and requires a symbolic link at the top of the vnet source tree
+
+include $(top_srcdir)/suffix-rules.mk
diff --git a/vnet/suffix-rules.mk b/vnet/suffix-rules.mk
new file mode 120000
index 00000000000..f609840001f
--- /dev/null
+++ b/vnet/suffix-rules.mk
@@ -0,0 +1 @@
+../build-data/suffix-rules.mk \ No newline at end of file
diff --git a/vnet/vnet/interface.api b/vnet/vnet/interface.api
new file mode 100644
index 00000000000..acc52a81724
--- /dev/null
+++ b/vnet/vnet/interface.api
@@ -0,0 +1,31 @@
+/* Hey Emacs use -*- mode: C -*- */
+
+/** \brief Set flags on the interface
+ @param client_index - opaque cookie to identify the sender
+ @param context - sender context, to match reply w/ request
+ @param sw_if_index - index of the interface to set flags on
+ @param admin_up_down - set the admin state, 1 = up, 0 = down
+ @param link_up_down - Oper state sent on change event, not used in config.
+ @param deleted - interface was deleted
+*/
+define sw_interface_set_flags
+{
+ u32 client_index;
+ u32 context;
+ u32 sw_if_index;
+ /* 1 = up, 0 = down */
+ u8 admin_up_down;
+ u8 link_up_down;
+ u8 deleted;
+};
+
+/** \brief Reply to sw_interface_set_flags
+ @param context - sender context which was passed in the request
+ @param retval - return code of the set flags request
+*/
+define sw_interface_set_flags_reply
+{
+ u32 context;
+ i32 retval;
+};
+
diff --git a/vnet/vnet/interface_api.c b/vnet/vnet/interface_api.c
new file mode 100644
index 00000000000..eeb1d81d4d0
--- /dev/null
+++ b/vnet/vnet/interface_api.c
@@ -0,0 +1,122 @@
+/*
+ *------------------------------------------------------------------
+ * interface_api.c - vnet interface api
+ *
+ * Copyright (c) 2016 Cisco and/or its affiliates.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at:
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *------------------------------------------------------------------
+ */
+
+#include <vnet/vnet.h>
+#include <vlibmemory/api.h>
+
+#include <vnet/interface.h>
+#include <vnet/api_errno.h>
+
+#include <vnet/vnet_msg_enum.h>
+
+#define vl_typedefs /* define message structures */
+#include <vnet/vnet_all_api_h.h>
+#undef vl_typedefs
+
+#define vl_endianfun /* define message structures */
+#include <vnet/vnet_all_api_h.h>
+#undef vl_endianfun
+
+/* instantiate all the print functions we know about */
+#define vl_print(handle, ...) vlib_cli_output (handle, __VA_ARGS__)
+#define vl_printfun
+#include <vnet/vnet_all_api_h.h>
+#undef vl_printfun
+
+#include <vlibapi/api_helper_macros.h>
+
+#define foreach_vpe_api_msg \
+_(SW_INTERFACE_SET_FLAGS, sw_interface_set_flags)
+
+static void
+vl_api_sw_interface_set_flags_t_handler (vl_api_sw_interface_set_flags_t * mp)
+{
+ vl_api_sw_interface_set_flags_reply_t *rmp;
+ vnet_main_t *vnm = vnet_get_main ();
+ int rv = 0;
+ clib_error_t *error;
+ u16 flags;
+
+ VALIDATE_SW_IF_INDEX (mp);
+
+ flags = mp->admin_up_down ? VNET_SW_INTERFACE_FLAG_ADMIN_UP : 0;
+
+ error = vnet_sw_interface_set_flags (vnm, ntohl (mp->sw_if_index), flags);
+ if (error)
+ {
+ rv = -1;
+ clib_error_report (error);
+ }
+
+ BAD_SW_IF_INDEX_LABEL;
+ REPLY_MACRO (VL_API_SW_INTERFACE_SET_FLAGS_REPLY);
+}
+
+
+/*
+ * vpe_api_hookup
+ * Add vpe's API message handlers to the table.
+ * vlib has alread mapped shared memory and
+ * added the client registration handlers.
+ * See .../vlib-api/vlibmemory/memclnt_vlib.c:memclnt_process()
+ */
+#define vl_msg_name_crc_list
+#include <vnet/vnet_all_api_h.h>
+#undef vl_msg_name_crc_list
+
+static void
+setup_message_id_table (api_main_t * am)
+{
+#define _(id,n,crc) vl_msg_api_add_msg_name_crc (am, #n "_" #crc, id);
+ foreach_vl_msg_name_crc_interface;
+#undef _
+}
+
+static clib_error_t *
+interface_api_hookup (vlib_main_t * vm)
+{
+ api_main_t *am = &api_main;
+
+#define _(N,n) \
+ vl_msg_api_set_handlers(VL_API_##N, #n, \
+ vl_api_##n##_t_handler, \
+ vl_noop_handler, \
+ vl_api_##n##_t_endian, \
+ vl_api_##n##_t_print, \
+ sizeof(vl_api_##n##_t), 1);
+ foreach_vpe_api_msg;
+#undef _
+
+ /*
+ * Set up the (msg_name, crc, message-id) table
+ */
+ setup_message_id_table (am);
+
+ return 0;
+}
+
+VLIB_API_INIT_FUNCTION (interface_api_hookup);
+
+/*
+ * fd.io coding-style-patch-verification: ON
+ *
+ * Local Variables:
+ * eval: (c-set-style "gnu")
+ * End:
+ */
diff --git a/vnet/vnet/vnet_all_api_h.h b/vnet/vnet/vnet_all_api_h.h
new file mode 100644
index 00000000000..0dacdc1f543
--- /dev/null
+++ b/vnet/vnet/vnet_all_api_h.h
@@ -0,0 +1,40 @@
+/*
+ *------------------------------------------------------------------
+ * vl_memory_api_h.h - memory API headers, in a specific order.
+ *
+ * Copyright (c) 2009-2010 Cisco and/or its affiliates.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at:
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *------------------------------------------------------------------
+ */
+
+/*
+ * Add to the bottom of the #include list, or elves will steal your
+ * keyboard in the middle of the night!
+ *
+ * Include current layer (2) last, or an artistic disagreement
+ * about message numbering will occur
+ */
+
+#ifndef included_from_layer_3
+#include <vlibmemory/vl_memory_api_h.h>
+#endif /* included_from_layer_3 */
+
+#include <vnet/interface.api.h>
+
+/*
+ * fd.io coding-style-patch-verification: ON
+ *
+ * Local Variables:
+ * eval: (c-set-style "gnu")
+ * End:
+ */
diff --git a/vnet/vnet/vnet_msg_enum.h b/vnet/vnet/vnet_msg_enum.h
new file mode 100644
index 00000000000..9899471ecd3
--- /dev/null
+++ b/vnet/vnet/vnet_msg_enum.h
@@ -0,0 +1,37 @@
+/*
+ * Copyright (c) 2016 Cisco and/or its affiliates.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at:
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+#ifndef included_vnet_msg_enum_h
+#define included_vnet_msg_enum_h
+
+#include <vppinfra/byte_order.h>
+
+#define vl_msg_id(n,h) n,
+typedef enum
+{
+ VL_ILLEGAL_MESSAGE_ID = 0,
+#include <vnet/vnet_all_api_h.h>
+ VL_MSG_FIRST_AVAILABLE,
+} vl_msg_id_t;
+#undef vl_msg_id
+
+#endif /* included_vnet_msg_enum_h */
+
+/*
+ * fd.io coding-style-patch-verification: ON
+ *
+ * Local Variables:
+ * eval: (c-set-style "gnu")
+ * End:
+ */
diff --git a/vpp-api-test/vat/api_format.c b/vpp-api-test/vat/api_format.c
index aac7d892b6c..9b02f1e4873 100644
--- a/vpp-api-test/vat/api_format.c
+++ b/vpp-api-test/vat/api_format.c
@@ -17022,18 +17022,40 @@ vat_api_hookup (vat_main_t * vam)
}
#undef vl_api_version
-#define vl_api_version(n,v) static u32 vpe_api_version = v;
+#define vl_api_version(n,v) static u32 memory_api_version = v;
+#include <vlibmemory/vl_memory_api_h.h>
+#undef vl_api_version
+
+#undef vl_api_version
+#define vl_api_version(n,v) static u32 vnet_interface_api_version = v;
+#include <vnet/interface.api.h>
+#undef vl_api_version
+
+#undef vl_api_version
+#define vl_api_version(n,v) static u32 vpp_api_version = v;
#include <vpp-api/vpe.api.h>
#undef vl_api_version
+static u32 *api_versions[] = {
+ &memory_api_version,
+ &vnet_interface_api_version,
+ &vpp_api_version,
+};
+
void
vl_client_add_api_signatures (vl_api_memclnt_create_t * mp)
{
+ int i;
+
+ ASSERT (ARRAY_LEN (mp->api_versions) >= ARRAY_LEN (api_versions));
+
/*
- * Send the main API signature in slot 0. This bit of code must
+ * Send the API signatures. This bit of code must
* match the checks in ../vpe/api/api.c: vl_msg_api_version_check().
*/
- mp->api_versions[0] = clib_host_to_net_u32 (vpe_api_version);
+
+ for (i = 0; i < ARRAY_LEN (api_versions); i++)
+ mp->api_versions[i] = clib_host_to_net_u32 (*api_versions[i]);
}
/*
diff --git a/vpp-api/java/Makefile.am b/vpp-api/java/Makefile.am
index 390562b4d2a..b95c1fe4709 100644
--- a/vpp-api/java/Makefile.am
+++ b/vpp-api/java/Makefile.am
@@ -104,10 +104,9 @@ jvpp-core/io_fd_vpp_jvpp_core_JVppCoreImpl.h: jvpp-registry/io_fd_vpp_jvpp_VppJN
jvpp-core/$(packagedir_jvpp_core)/notification/*.java \
jvpp-core/$(packagedir_jvpp_core)/future/*.java \
jvpp-core/$(packagedir_jvpp_core)/callfacade/*.java \
- jvpp-core/$(packagedir_jvpp_core)/test/*.java \
|| (echo "jvpp-core compilation failed: $$?"; exit 1)
$(JAVAH) -force -classpath jvpp-registry/target:jvpp-core/target -d jvpp-core io.fd.vpp.jvpp.core.JVppCoreImpl
-
+
$(jarfile_jvpp_core): libjvpp_core.la
cp .libs/libjvpp_core.so.0.0.0 jvpp-core/target
$(JAR) cf $(JARFLAGS) $@ -C jvpp-core/target .
diff --git a/vpp/Makefile.am b/vpp/Makefile.am
index 214cc743093..1c40ed3d57e 100644
--- a/vpp/Makefile.am
+++ b/vpp/Makefile.am
@@ -121,14 +121,13 @@ if WITH_IPV6SR
vpp_LDADD += -lcrypto
endif
+# Set the suffix list
SUFFIXES = .api.h .api
-%.api.h: %.api
- @echo " APIGEN " $@ ; \
- mkdir -p `dirname $@` ; \
- $(CC) $(CPPFLAGS) -E -P -C -x c $^ \
- | vppapigen --input - --output $@ --show-name $@
+# The actual %.api.h rule is in .../build-data/packages/suffix-rules.mk
+# and requires a symbolic link at the top of the vpp source tree
+include $(top_srcdir)/suffix-rules.mk
noinst_PROGRAMS += test_client
diff --git a/vpp/suffix-rules.mk b/vpp/suffix-rules.mk
new file mode 120000
index 00000000000..f609840001f
--- /dev/null
+++ b/vpp/suffix-rules.mk
@@ -0,0 +1 @@
+../build-data/suffix-rules.mk \ No newline at end of file
diff --git a/vpp/vpp-api/api.c b/vpp/vpp-api/api.c
index 73e3c0ddaa5..bbe1963a0cc 100644
--- a/vpp/vpp-api/api.c
+++ b/vpp/vpp-api/api.c
@@ -125,9 +125,6 @@
#include <vnet/dpo/classify_dpo.h>
#include <vnet/dpo/ip_null_dpo.h>
-#define f64_endian(a)
-#define f64_print(a,b)
-
#define vl_typedefs /* define message structures */
#include <vpp-api/vpe_all_api_h.h>
#undef vl_typedefs
@@ -142,144 +139,7 @@
#include <vpp-api/vpe_all_api_h.h>
#undef vl_printfun
-#define REPLY_MACRO(t) \
-do { \
- unix_shared_memory_queue_t * q; \
- rv = vl_msg_api_pd_handler (mp, rv); \
- q = vl_api_client_index_to_input_queue (mp->client_index); \
- if (!q) \
- return; \
- \
- rmp = vl_msg_api_alloc (sizeof (*rmp)); \
- rmp->_vl_msg_id = ntohs((t)); \
- rmp->context = mp->context; \
- rmp->retval = ntohl(rv); \
- \
- vl_msg_api_send_shmem (q, (u8 *)&rmp); \
-} while(0);
-
-#define REPLY_MACRO2(t, body) \
-do { \
- unix_shared_memory_queue_t * q; \
- rv = vl_msg_api_pd_handler (mp, rv); \
- q = vl_api_client_index_to_input_queue (mp->client_index); \
- if (!q) \
- return; \
- \
- rmp = vl_msg_api_alloc (sizeof (*rmp)); \
- rmp->_vl_msg_id = ntohs((t)); \
- rmp->context = mp->context; \
- rmp->retval = ntohl(rv); \
- do {body;} while (0); \
- vl_msg_api_send_shmem (q, (u8 *)&rmp); \
-} while(0);
-
-#define REPLY_MACRO3(t, n, body) \
-do { \
- unix_shared_memory_queue_t * q; \
- rv = vl_msg_api_pd_handler (mp, rv); \
- q = vl_api_client_index_to_input_queue (mp->client_index); \
- if (!q) \
- return; \
- \
- rmp = vl_msg_api_alloc (sizeof (*rmp) + n); \
- rmp->_vl_msg_id = ntohs((t)); \
- rmp->context = mp->context; \
- rmp->retval = ntohl(rv); \
- do {body;} while (0); \
- vl_msg_api_send_shmem (q, (u8 *)&rmp); \
-} while(0);
-
-#define REPLY_MACRO4(t, n, body) \
-do { \
- unix_shared_memory_queue_t * q; \
- u8 is_error = 0; \
- rv = vl_msg_api_pd_handler (mp, rv); \
- q = vl_api_client_index_to_input_queue (mp->client_index); \
- if (!q) \
- return; \
- \
- rmp = vl_msg_api_alloc_or_null (sizeof (*rmp) + n); \
- if (!rmp) \
- { \
- /* if there isn't enough memory, try to allocate */ \
- /* some at least for returning an error */ \
- rmp = vl_msg_api_alloc (sizeof (*rmp)); \
- if (!rmp) \
- return; \
- \
- memset (rmp, 0, sizeof (*rmp)); \
- rv = VNET_API_ERROR_TABLE_TOO_BIG; \
- is_error = 1; \
- } \
- rmp->_vl_msg_id = ntohs((t)); \
- rmp->context = mp->context; \
- rmp->retval = ntohl(rv); \
- if (!is_error) \
- do {body;} while (0); \
- vl_msg_api_send_shmem (q, (u8 *)&rmp); \
-} while(0);
-
-#if (1 || CLIB_DEBUG > 0) /* "trust, but verify" */
-
-#define VALIDATE_SW_IF_INDEX(mp) \
- do { u32 __sw_if_index = ntohl(mp->sw_if_index); \
- vnet_main_t *__vnm = vnet_get_main(); \
- if (pool_is_free_index(__vnm->interface_main.sw_interfaces, \
- __sw_if_index)) { \
- rv = VNET_API_ERROR_INVALID_SW_IF_INDEX; \
- goto bad_sw_if_index; \
- } \
-} while(0);
-
-#define BAD_SW_IF_INDEX_LABEL \
-do { \
-bad_sw_if_index: \
- ; \
-} while (0);
-
-#define VALIDATE_RX_SW_IF_INDEX(mp) \
- do { u32 __rx_sw_if_index = ntohl(mp->rx_sw_if_index); \
- vnet_main_t *__vnm = vnet_get_main(); \
- if (pool_is_free_index(__vnm->interface_main.sw_interfaces, \
- __rx_sw_if_index)) { \
- rv = VNET_API_ERROR_INVALID_SW_IF_INDEX; \
- goto bad_rx_sw_if_index; \
- } \
-} while(0);
-
-#define BAD_RX_SW_IF_INDEX_LABEL \
-do { \
-bad_rx_sw_if_index: \
- ; \
-} while (0);
-
-#define VALIDATE_TX_SW_IF_INDEX(mp) \
- do { u32 __tx_sw_if_index = ntohl(mp->tx_sw_if_index); \
- vnet_main_t *__vnm = vnet_get_main(); \
- if (pool_is_free_index(__vnm->interface_main.sw_interfaces, \
- __tx_sw_if_index)) { \
- rv = VNET_API_ERROR_INVALID_SW_IF_INDEX; \
- goto bad_tx_sw_if_index; \
- } \
-} while(0);
-
-#define BAD_TX_SW_IF_INDEX_LABEL \
-do { \
-bad_tx_sw_if_index: \
- ; \
-} while (0);
-
-#else
-
-#define VALIDATE_SW_IF_INDEX(mp)
-#define BAD_SW_IF_INDEX_LABEL
-#define VALIDATE_RX_SW_IF_INDEX(mp)
-#define BAD_RX_SW_IF_INDEX_LABEL
-#define VALIDATE_TX_SW_IF_INDEX(mp)
-#define BAD_TX_SW_IF_INDEX_LABEL
-
-#endif /* CLIB_DEBUG > 0 */
+#include <vlibapi/api_helper_macros.h>
#define foreach_vpe_api_msg \
_(WANT_INTERFACE_EVENTS, want_interface_events) \
@@ -287,7 +147,6 @@ _(WANT_OAM_EVENTS, want_oam_events) \
_(OAM_ADD_DEL, oam_add_del) \
_(SW_INTERFACE_DUMP, sw_interface_dump) \
_(SW_INTERFACE_DETAILS, sw_interface_details) \
-_(SW_INTERFACE_SET_FLAGS, sw_interface_set_flags) \
_(IP_ADD_DEL_ROUTE, ip_add_del_route) \
_(MPLS_ROUTE_ADD_DEL, mpls_route_add_del) \
_(MPLS_IP_BIND_UNBIND, mpls_ip_bind_unbind) \
@@ -2716,30 +2575,6 @@ vl_api_sw_interface_details_t_handler (vl_api_sw_interface_details_t * mp)
}
static void
-vl_api_sw_interface_set_flags_t_handler (vl_api_sw_interface_set_flags_t * mp)
-{
- vl_api_sw_interface_set_flags_reply_t *rmp;
- vnet_main_t *vnm = vnet_get_main ();
- int rv = 0;
- clib_error_t *error;
- u16 flags;
-
- VALIDATE_SW_IF_INDEX (mp);
-
- flags = mp->admin_up_down ? VNET_SW_INTERFACE_FLAG_ADMIN_UP : 0;
-
- error = vnet_sw_interface_set_flags (vnm, ntohl (mp->sw_if_index), flags);
- if (error)
- {
- rv = -1;
- clib_error_report (error);
- }
-
- BAD_SW_IF_INDEX_LABEL;
- REPLY_MACRO (VL_API_SW_INTERFACE_SET_FLAGS_REPLY);
-}
-
-static void
vl_api_sw_interface_set_mpls_enable_t_handler
(vl_api_sw_interface_set_mpls_enable_t * mp)
{
diff --git a/vpp/vpp-api/vpe.api b/vpp/vpp-api/vpe.api
index 934c4d830d4..0e2f2292879 100644
--- a/vpp/vpp-api/vpe.api
+++ b/vpp/vpp-api/vpe.api
@@ -119,35 +119,6 @@ define sw_interface_details
u32 vtr_tag2; // second pushed tag
};
-/** \brief Set flags on the interface
- @param client_index - opaque cookie to identify the sender
- @param context - sender context, to match reply w/ request
- @param sw_if_index - index of the interface to set flags on
- @param admin_up_down - set the admin state, 1 = up, 0 = down
- @param link_up_down - Oper state sent on change event, not used in config.
- @param deleted - interface was deleted
-*/
-define sw_interface_set_flags
-{
- u32 client_index;
- u32 context;
- u32 sw_if_index;
- /* 1 = up, 0 = down */
- u8 admin_up_down;
- u8 link_up_down;
- u8 deleted;
-};
-
-/** \brief Reply to sw_interface_set_flags
- @param context - sender context which was passed in the request
- @param retval - return code of the set flags request
-*/
-define sw_interface_set_flags_reply
-{
- u32 context;
- i32 retval;
-};
-
/* works */
define sw_interface_dump
{
diff --git a/vpp/vpp-api/vpe_all_api_h.h b/vpp/vpp-api/vpe_all_api_h.h
index f6793f77788..98717eaaa24 100644
--- a/vpp/vpp-api/vpe_all_api_h.h
+++ b/vpp/vpp-api/vpe_all_api_h.h
@@ -17,10 +17,15 @@
* keyboard in the middle of the night!
*/
-/* Inherited from vlib */
+/* Include the (first) vlib-api API definition layer */
#include <vlibmemory/vl_memory_api_h.h>
-/* Here are the vpe forwarder specific API definitions */
+/* Include the (second) vnet API definition layer */
+#define included_from_layer_3
+#include <vnet/vnet_all_api_h.h>
+#undef included_from_layer_3
+
+/* Include the current layer (third) vpp API definition layer */
#include <vpp-api/vpe.api.h>
/*