aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/dpdk/api
diff options
context:
space:
mode:
Diffstat (limited to 'src/plugins/dpdk/api')
-rw-r--r--src/plugins/dpdk/api/dpdk.api3
-rw-r--r--src/plugins/dpdk/api/dpdk_all_api_h.h19
-rwxr-xr-xsrc/plugins/dpdk/api/dpdk_api.c93
-rw-r--r--src/plugins/dpdk/api/dpdk_msg_enum.h31
-rw-r--r--src/plugins/dpdk/api/dpdk_test.c100
5 files changed, 11 insertions, 235 deletions
diff --git a/src/plugins/dpdk/api/dpdk.api b/src/plugins/dpdk/api/dpdk.api
index 2c20ef4ea8a..6bce2d07a39 100644
--- a/src/plugins/dpdk/api/dpdk.api
+++ b/src/plugins/dpdk/api/dpdk.api
@@ -30,6 +30,7 @@ autoreply define sw_interface_set_dpdk_hqos_pipe {
u32 subport;
u32 pipe;
u32 profile;
+ option vat_help = "rx sw_if_index <id> subport <subport-id> pipe <pipe-id> profile <profile-id>";
};
/** \brief DPDK interface HQoS subport parameters set request
@@ -51,6 +52,7 @@ autoreply define sw_interface_set_dpdk_hqos_subport {
u32 tb_size;
u32 tc_rate[4];
u32 tc_period;
+ option vat_help = "rx sw_if_index <id> subport <subport-id> [rate <n>] [bktsize <n>] [tc0 <n>] [tc1 <n>] [tc2 <n>] [tc3 <n>] [period <n>]\n";
};
/** \brief DPDK interface HQoS tctbl entry set request
@@ -68,6 +70,7 @@ autoreply define sw_interface_set_dpdk_hqos_tctbl {
u32 entry;
u32 tc;
u32 queue;
+ option vat_help = "rx sw_if_index <id> entry <n> tc <n> queue <n>";
};
/*
diff --git a/src/plugins/dpdk/api/dpdk_all_api_h.h b/src/plugins/dpdk/api/dpdk_all_api_h.h
deleted file mode 100644
index 15eb98d6aab..00000000000
--- a/src/plugins/dpdk/api/dpdk_all_api_h.h
+++ /dev/null
@@ -1,19 +0,0 @@
-
-/*
- * dpdk_all_api_h.h - skeleton vpp engine plug-in api #include file
- *
- * Copyright (c) <current-year> <your-organization>
- * 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 the generated file, see BUILT_SOURCES in Makefile.am */
-#include <dpdk/api/dpdk.api.h>
diff --git a/src/plugins/dpdk/api/dpdk_api.c b/src/plugins/dpdk/api/dpdk_api.c
index 5ff8d5f2f41..8b22c650c82 100755
--- a/src/plugins/dpdk/api/dpdk_api.c
+++ b/src/plugins/dpdk/api/dpdk_api.c
@@ -36,29 +36,8 @@
#include <vlibmemory/api.h>
/* define message IDs */
-#include <dpdk/api/dpdk_msg_enum.h>
-
-#define vl_typedefs /* define message structures */
-#include <dpdk/api/dpdk_all_api_h.h>
-#undef vl_typedefs
-
-#define vl_endianfun /* define message structures */
-#include <dpdk/api/dpdk_all_api_h.h>
-#undef vl_endianfun
-
-#define vl_print(handle, ...) vlib_cli_output (handle, __VA_ARGS__)
-
-/* Get the API version number. */
-#define vl_api_version(n,v) static u32 api_version=(v);
-#include <dpdk/api/dpdk_all_api_h.h>
-#undef vl_api_version
-
-/* Macro to finish up custom dump fns */
-#define FINISH \
- vec_add1 (s, 0); \
- vl_print (handle, (char *)s); \
- vec_free (s); \
- return handle;
+#include <dpdk/api/dpdk.api_enum.h>
+#include <dpdk/api/dpdk.api_types.h>
#include <vlibapi/api_helper_macros.h>
@@ -242,78 +221,16 @@ static void *vl_api_sw_interface_set_dpdk_hqos_tctbl_t_print
FINISH;
}
-#define foreach_dpdk_plugin_api_msg \
-_(SW_INTERFACE_SET_DPDK_HQOS_PIPE, sw_interface_set_dpdk_hqos_pipe) \
-_(SW_INTERFACE_SET_DPDK_HQOS_SUBPORT, sw_interface_set_dpdk_hqos_subport) \
-_(SW_INTERFACE_SET_DPDK_HQOS_TCTBL, sw_interface_set_dpdk_hqos_tctbl)
-
-/* Set up the API message handling tables */
-static clib_error_t *
-dpdk_plugin_api_hookup (vlib_main_t * vm)
-{
- dpdk_main_t *dm __attribute__ ((unused)) = &dpdk_main;
-#define _(N,n) \
- vl_msg_api_set_handlers((VL_API_##N + dm->msg_id_base), \
- #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_dpdk_plugin_api_msg;
-#undef _
- return 0;
-}
-
-#define vl_msg_name_crc_list
-#include <dpdk/api/dpdk_all_api_h.h>
-#undef vl_msg_name_crc_list
-
-static void
-setup_message_id_table (dpdk_main_t * dm, api_main_t * am)
-{
-#define _(id,n,crc) \
- vl_msg_api_add_msg_name_crc (am, #n "_" #crc, id + dm->msg_id_base);
- foreach_vl_msg_name_crc_dpdk;
-#undef _
-}
-
-// TODO
-/*
-static void plugin_custom_dump_configure (dpdk_main_t * dm)
-{
-#define _(n,f) dm->api_main->msg_print_handlers \
- [VL_API_##n + dm->msg_id_base] \
- = (void *) vl_api_##f##_t_print;
- foreach_dpdk_plugin_api_msg;
-#undef _
-}
-*/
-/* force linker to link functions used by vlib and declared weak */
-
+#include <dpdk/api/dpdk.api.c>
static clib_error_t *
dpdk_api_init (vlib_main_t * vm)
{
dpdk_main_t *dm = &dpdk_main;
- clib_error_t *error = 0;
-
- u8 *name;
- name = format (0, "dpdk_%08x%c", api_version, 0);
/* Ask for a correctly-sized block of API message decode slots */
- dm->msg_id_base = vl_msg_api_get_msg_ids
- ((char *) name, VL_MSG_FIRST_AVAILABLE);
- vec_free (name);
-
- error = dpdk_plugin_api_hookup (vm);
+ dm->msg_id_base = setup_message_id_table ();
- /* Add our API messages to the global name_crc hash table */
- setup_message_id_table (dm, &api_main);
-
-// TODO
-// plugin_custom_dump_configure (dm);
-
- return error;
+ return 0;
}
/* *INDENT-OFF* */
diff --git a/src/plugins/dpdk/api/dpdk_msg_enum.h b/src/plugins/dpdk/api/dpdk_msg_enum.h
deleted file mode 100644
index 952ce6ad5f8..00000000000
--- a/src/plugins/dpdk/api/dpdk_msg_enum.h
+++ /dev/null
@@ -1,31 +0,0 @@
-
-/*
- * dpdk_msg_enum.h - skeleton vpp engine plug-in message enumeration
- *
- * Copyright (c) <current-year> <your-organization>
- * 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_dpdk_msg_enum_h
-#define included_dpdk_msg_enum_h
-
-#include <vppinfra/byte_order.h>
-
-#define vl_msg_id(n,h) n,
-typedef enum {
-#include <dpdk/api/dpdk_all_api_h.h>
- /* We'll want to know how many messages IDs we need... */
- VL_MSG_FIRST_AVAILABLE,
-} vl_msg_id_t;
-#undef vl_msg_id
-
-#endif /* included_dpdk_msg_enum_h */
diff --git a/src/plugins/dpdk/api/dpdk_test.c b/src/plugins/dpdk/api/dpdk_test.c
index 4594a9d3b81..951082faaf9 100644
--- a/src/plugins/dpdk/api/dpdk_test.c
+++ b/src/plugins/dpdk/api/dpdk_test.c
@@ -24,29 +24,8 @@
uword unformat_sw_if_index (unformat_input_t * input, va_list * args);
/* Declare message IDs */
-#include <dpdk/api/dpdk_msg_enum.h>
-
-/* define message structures */
-#define vl_typedefs
-#include <dpdk/api/dpdk.api.h>
-#undef vl_typedefs
-
-/* declare message handlers for each api */
-
-#define vl_endianfun /* define message structures */
-#include <dpdk/api/dpdk.api.h>
-#undef vl_endianfun
-
-/* instantiate all the print functions we know about */
-#define vl_print(handle, ...)
-#define vl_printfun
-#include <dpdk/api/dpdk.api.h>
-#undef vl_printfun
-
-/* Get the API version number. */
-#define vl_api_version(n,v) static u32 api_version=(v);
-#include <dpdk/api/dpdk.api.h>
-#undef vl_api_version
+#include <dpdk/api/dpdk.api_enum.h>
+#include <dpdk/api/dpdk.api_types.h>
typedef struct {
/* API message ID base */
@@ -56,39 +35,6 @@ typedef struct {
dpdk_test_main_t dpdk_test_main;
-#define foreach_standard_reply_retval_handler \
-_(sw_interface_set_dpdk_hqos_pipe_reply) \
-_(sw_interface_set_dpdk_hqos_subport_reply) \
-_(sw_interface_set_dpdk_hqos_tctbl_reply)
-
-#define _(n) \
- static void vl_api_##n##_t_handler \
- (vl_api_##n##_t * mp) \
- { \
- vat_main_t * vam = dpdk_test_main.vat_main; \
- i32 retval = ntohl(mp->retval); \
- if (vam->async_mode) { \
- vam->async_errors += (retval < 0); \
- } else { \
- vam->retval = retval; \
- vam->result_ready = 1; \
- } \
- }
-foreach_standard_reply_retval_handler;
-#undef _
-
-/*
- * Table of message reply handlers, must include boilerplate handlers
- * we just generated
- */
-#define foreach_vpe_api_reply_msg \
-_(SW_INTERFACE_SET_DPDK_HQOS_PIPE_REPLY, \
- sw_interface_set_dpdk_hqos_pipe_reply) \
-_(SW_INTERFACE_SET_DPDK_HQOS_SUBPORT_REPLY, \
- sw_interface_set_dpdk_hqos_subport_reply) \
-_(SW_INTERFACE_SET_DPDK_HQOS_TCTBL_REPLY, \
- sw_interface_set_dpdk_hqos_tctbl_reply)
-
/* M: construct, but don't yet send a message */
#define M(T,t) \
do { \
@@ -336,44 +282,4 @@ api_sw_interface_set_dpdk_hqos_tctbl (vat_main_t * vam)
return 0;
}
-/*
- * List of messages that the api test plugin sends,
- * and that the data plane plugin processes
- */
-#define foreach_vpe_api_msg \
-_(sw_interface_set_dpdk_hqos_pipe, \
- "rx sw_if_index <id> subport <subport-id> pipe <pipe-id>\n" \
- "profile <profile-id>\n") \
-_(sw_interface_set_dpdk_hqos_subport, \
- "rx sw_if_index <id> subport <subport-id> [rate <n>]\n" \
- "[bktsize <n>] [tc0 <n>] [tc1 <n>] [tc2 <n>] [tc3 <n>] [period <n>]\n") \
-_(sw_interface_set_dpdk_hqos_tctbl, \
- "rx sw_if_index <id> entry <n> tc <n> queue <n>\n")
-
-static void dpdk_api_hookup (vat_main_t *vam)
-{
- dpdk_test_main_t * dm __attribute__((unused)) = &dpdk_test_main;
- /* Hook up handlers for replies from the data plane plug-in */
-#define _(N,n) \
- vl_msg_api_set_handlers((VL_API_##N + dm->msg_id_base), \
- #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_reply_msg;
-#undef _
-
- /* API messages we can send */
-#define _(n,h) hash_set_mem (vam->function_by_name, #n, api_##n);
- foreach_vpe_api_msg;
-#undef _
-
- /* Help strings */
-#define _(n,h) hash_set_mem (vam->help_by_name, #n, h);
- foreach_vpe_api_msg;
-#undef _
-}
-
-VAT_PLUGIN_REGISTER(dpdk);
+#include <dpdk/api/dpdk.api_test.c>