diff options
author | Filip Tehlar <ftehlar@cisco.com> | 2021-06-21 13:45:44 +0000 |
---|---|---|
committer | Filip Tehlar <ftehlar@cisco.com> | 2021-06-22 10:04:33 +0000 |
commit | 41ff1eb5ddc493abdf9721640633a137ab638262 (patch) | |
tree | 59a55b534f8cdd8c4dbcfdbc6efd349535cda1ce /src/vnet/ethernet/p2p_ethernet_api.c | |
parent | 102e8a5d60728cfaa8e60733ee21c3759edabfbe (diff) |
ethernet: api cleanup
Use autogenerated code.
Does not change API definitions.
Type: improvement
Signed-off-by: Filip Tehlar <ftehlar@cisco.com>
Change-Id: Iacaefbf04834f000a14f151c4b848f280ac46d63
Diffstat (limited to 'src/vnet/ethernet/p2p_ethernet_api.c')
-rw-r--r-- | src/vnet/ethernet/p2p_ethernet_api.c | 57 |
1 files changed, 6 insertions, 51 deletions
diff --git a/src/vnet/ethernet/p2p_ethernet_api.c b/src/vnet/ethernet/p2p_ethernet_api.c index 8321f8db5d3..a9a8cc0a444 100644 --- a/src/vnet/ethernet/p2p_ethernet_api.c +++ b/src/vnet/ethernet/p2p_ethernet_api.c @@ -19,30 +19,15 @@ #include <vnet/vnet.h> #include <vlibmemory/api.h> - -#include <vnet/vnet_msg_enum.h> #include <vnet/ethernet/p2p_ethernet.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 <vnet/format_fns.h> +#include <vnet/ethernet/p2p_ethernet.api_enum.h> +#include <vnet/ethernet/p2p_ethernet.api_types.h> +#define REPLY_MSG_ID_BASE p2p_main.msg_id_base #include <vlibapi/api_helper_macros.h> -#define foreach_vpe_api_msg \ -_(P2P_ETHERNET_ADD, p2p_ethernet_add) \ -_(P2P_ETHERNET_DEL, p2p_ethernet_del) - void vl_api_p2p_ethernet_add_t_handler (vl_api_p2p_ethernet_add_t * mp) { @@ -106,44 +91,14 @@ vl_api_p2p_ethernet_del_t_handler (vl_api_p2p_ethernet_del_t * mp) REPLY_MACRO (VL_API_P2P_ETHERNET_DEL_REPLY); } -/* - * p2p_ethernet_api_hookup - * Add vpe's API message handlers to the table. - * vlib has already 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_p2p_ethernet; -#undef _ -} - +#include <vnet/ethernet/p2p_ethernet.api.c> static clib_error_t * p2p_ethernet_api_hookup (vlib_main_t * vm) { - api_main_t *am = vlibapi_get_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); + REPLY_MSG_ID_BASE = setup_message_id_table (); return 0; } |