summaryrefslogtreecommitdiffstats
path: root/vpp
diff options
context:
space:
mode:
authorDave Barach <dave@barachs.net>2016-10-31 11:59:07 -0400
committerOle Trøan <otroan@employees.org>2016-11-30 15:06:08 +0000
commitaff7077d2031545a15efd12e7f65eac723799491 (patch)
tree3a7b1c8b964d6b9008c6313f2751fd2d9506809f /vpp
parent847944046c50cabd0d457d446d2c199a71abf049 (diff)
Start spliting vpe.api into logically related pieces
To reduce rebase / manual merge pain, among other things Change-Id: I3186df0479066916a2ca69c48759178b45ef035c Signed-off-by: Dave Barach <dave@barachs.net> Signed-off-by: Ole Troan <ot@cisco.com>
Diffstat (limited to 'vpp')
-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
5 files changed, 13 insertions, 202 deletions
diff --git a/vpp/Makefile.am b/vpp/Makefile.am
index 214cc743..1c40ed3d 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 00000000..f6098400
--- /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 73e3c0dd..bbe1963a 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 934c4d83..0e2f2292 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 f6793f77..98717eaa 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>
/*