diff options
Diffstat (limited to 'src/plugins/avf')
-rw-r--r-- | src/plugins/avf/CMakeLists.txt | 4 | ||||
-rw-r--r-- | src/plugins/avf/avf.api | 2 | ||||
-rw-r--r-- | src/plugins/avf/avf_all_api_h.h | 26 | ||||
-rw-r--r-- | src/plugins/avf/avf_api.c | 66 | ||||
-rw-r--r-- | src/plugins/avf/avf_msg_enum.h | 39 | ||||
-rw-r--r-- | src/plugins/avf/avf_test.c | 83 |
6 files changed, 9 insertions, 211 deletions
diff --git a/src/plugins/avf/CMakeLists.txt b/src/plugins/avf/CMakeLists.txt index 66e6904a4e5..8547fb76c9c 100644 --- a/src/plugins/avf/CMakeLists.txt +++ b/src/plugins/avf/CMakeLists.txt @@ -30,8 +30,4 @@ add_vpp_plugin(avf API_TEST_SOURCES avf_test.c - - INSTALL_HEADERS - avf_all_api_h.h - avf_msg_enum.h ) diff --git a/src/plugins/avf/avf.api b/src/plugins/avf/avf.api index 1cca17fa1af..c7c4da9d19e 100644 --- a/src/plugins/avf/avf.api +++ b/src/plugins/avf/avf.api @@ -38,6 +38,7 @@ define avf_create u16 rxq_num; u16 rxq_size; u16 txq_size; + option vat_help = "<pci-address> [rx-queue-size <size>] [tx-queue-size <size>] [num-rx-queues <size>]"; }; /** \brief @@ -65,6 +66,7 @@ autoreply define avf_delete u32 context; u32 sw_if_index; + option vat_help = "<sw_if_index>"; }; /* diff --git a/src/plugins/avf/avf_all_api_h.h b/src/plugins/avf/avf_all_api_h.h deleted file mode 100644 index 63cf826c1b5..00000000000 --- a/src/plugins/avf/avf_all_api_h.h +++ /dev/null @@ -1,26 +0,0 @@ -/* - *------------------------------------------------------------------ - * Copyright (c) 2018 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 <avf/avf.api.h> - -/* - * fd.io coding-style-patch-verification: ON - * - * Local Variables: - * eval: (c-set-style "gnu") - * End: - */ diff --git a/src/plugins/avf/avf_api.c b/src/plugins/avf/avf_api.c index e9c7f49e2e5..1ddc45f2348 100644 --- a/src/plugins/avf/avf_api.c +++ b/src/plugins/avf/avf_api.c @@ -26,35 +26,11 @@ #include <vlibmemory/api.h> /* define message IDs */ -#include <avf/avf_msg_enum.h> - -/* define message structures */ -#define vl_typedefs -#include <avf/avf_all_api_h.h> -#undef vl_typedefs - -/* define generated endian-swappers */ -#define vl_endianfun -#include <avf/avf_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 <avf/avf_all_api_h.h> -#undef vl_printfun - -/* get the API version number */ -#define vl_api_version(n,v) static u32 api_version=(v); -#include <avf/avf_all_api_h.h> -#undef vl_api_version +#include <avf/avf.api_enum.h> +#include <avf/avf.api_types.h> #include <vlibapi/api_helper_macros.h> -#define foreach_avf_plugin_api_msg \ -_(AVF_CREATE, avf_create) \ -_(AVF_DELETE, avf_delete) - static void vl_api_avf_create_t_handler (vl_api_avf_create_t * mp) { @@ -111,49 +87,15 @@ reply: REPLY_MACRO (VL_API_AVF_DELETE_REPLY + am->msg_id_base); } -#define vl_msg_name_crc_list -#include <avf/avf_all_api_h.h> -#undef vl_msg_name_crc_list - -static void -setup_message_id_table (avf_main_t * avm, api_main_t * am) -{ -#define _(id,n,crc) \ - vl_msg_api_add_msg_name_crc (am, #n "_" #crc, id + avm->msg_id_base); - foreach_vl_msg_name_crc_avf; -#undef _ -} - /* set tup the API message handling tables */ +#include <avf/avf.api.c> static clib_error_t * avf_plugin_api_hookup (vlib_main_t * vm) { avf_main_t *avm = &avf_main; - api_main_t *am = &api_main; - u8 *name; - - /* construct the API name */ - name = format (0, "avf_%08x%c", api_version, 0); /* ask for a correctly-sized block of API message decode slots */ - avm->msg_id_base = vl_msg_api_get_msg_ids - ((char *) name, VL_MSG_FIRST_AVAILABLE); - -#define _(N,n) \ - vl_msg_api_set_handlers((VL_API_##N + avm->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_avf_plugin_api_msg; -#undef _ - - /* set up the (msg_name, crc, message-id) table */ - setup_message_id_table (avm, am); - - vec_free (name); + avm->msg_id_base = setup_message_id_table (); return 0; } diff --git a/src/plugins/avf/avf_msg_enum.h b/src/plugins/avf/avf_msg_enum.h deleted file mode 100644 index 8b92629fed6..00000000000 --- a/src/plugins/avf/avf_msg_enum.h +++ /dev/null @@ -1,39 +0,0 @@ -/* - *------------------------------------------------------------------ - * Copyright (c) 2018 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 _AVF_MSG_ENUM_H_ -#define _AVF_MSG_ENUM_H_ - -#include <vppinfra/byte_order.h> - -#define vl_msg_id(n,h) n, -typedef enum -{ -#include <avf/avf_all_api_h.h> - VL_MSG_FIRST_AVAILABLE, -} vl_msg_id_t; -#undef vl_msg_id - -#endif /* AVF_MSG_ENUM_H */ - -/* - * fd.io coding-style-patch-verification: ON - * - * Local Variables: - * eval: (c-set-style "gnu") - * End: - */ diff --git a/src/plugins/avf/avf_test.c b/src/plugins/avf/avf_test.c index 17f43088b10..bd2a043ac95 100644 --- a/src/plugins/avf/avf_test.c +++ b/src/plugins/avf/avf_test.c @@ -31,28 +31,8 @@ #include <vlibapi/vat_helper_macros.h> /* declare message IDs */ -#include <avf/avf_msg_enum.h> - -/* define message structures */ -#define vl_typedefs -#include <avf/avf_all_api_h.h> -#undef vl_typedefs - -/* declare message handlers for each api */ -#define vl_endianfun -#include <avf/avf_all_api_h.h> -#undef vl_endianfun - -/* instantiate all the print functions we know about */ -#define vl_print(handle, ...) -#define vl_printfun -#include <avf/avf_all_api_h.h> -#undef vl_printfun - -/* get API version number */ -#define vl_api_version(n,v) static u32 api_version=(v); -#include <avf/avf_all_api_h.h> -#undef vp_api_version +#include <avf/avf.api_enum.h> +#include <avf/avf.api_types.h> typedef struct { @@ -63,29 +43,6 @@ typedef struct avf_test_main_t avf_test_main; -#define foreach_standard_reply_retval_handler \ -_(avf_delete_reply) - -#define _(n) \ - static void vl_api_##n##_t_handler \ - (vl_api_##n##_t * mp) \ - { \ - vat_main_t * vam = avf_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 _ - -#define foreach_vpe_api_reply_msg \ -_(AVF_CREATE_REPLY, avf_create_reply) \ -_(AVF_DELETE_REPLY, avf_delete_reply) - /* avf create API */ static int api_avf_create (vat_main_t * vam) @@ -192,41 +149,7 @@ api_avf_delete (vat_main_t * vam) return ret; } -/* - * List of messages that the api test plugin sends, - * and that the data plane plugin processes - */ -#define foreach_vpe_api_msg \ -_(avf_create, "<pci-address> [rx-queue-size <size>] " \ - "[tx-queue-size <size>] [num-rx-queues <size>]") \ -_(avf_delete, "<sw_if_index>") - -static void -avf_api_hookup (vat_main_t * vam) -{ - avf_test_main_t *avm __attribute__ ((unused)) = &avf_test_main; -#define _(N,n) \ - vl_msg_api_set_handlers((VL_API_##N + avm->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 _ - -#define _(n,h) \ - hash_set_mem (vam->function_by_name, #n, api_##n); - foreach_vpe_api_msg; -#undef _ - -#define _(n,h) hash_set_mem (vam->help_by_name, #n, h); - foreach_vpe_api_msg; -#undef _ -} - -VAT_PLUGIN_REGISTER (avf); +#include <avf/avf.api_test.c> /* * fd.io coding-style-patch-verification: ON |