From 41ff1eb5ddc493abdf9721640633a137ab638262 Mon Sep 17 00:00:00 2001 From: Filip Tehlar Date: Mon, 21 Jun 2021 13:45:44 +0000 Subject: ethernet: api cleanup Use autogenerated code. Does not change API definitions. Type: improvement Signed-off-by: Filip Tehlar Change-Id: Iacaefbf04834f000a14f151c4b848f280ac46d63 --- src/vnet/ethernet/p2p_ethernet.h | 2 ++ src/vnet/ethernet/p2p_ethernet_api.c | 57 ++++-------------------------------- src/vnet/vnet_all_api_h.h | 1 - 3 files changed, 8 insertions(+), 52 deletions(-) (limited to 'src/vnet') diff --git a/src/vnet/ethernet/p2p_ethernet.h b/src/vnet/ethernet/p2p_ethernet.h index bb1e2896bc2..78ca81a9da2 100644 --- a/src/vnet/ethernet/p2p_ethernet.h +++ b/src/vnet/ethernet/p2p_ethernet.h @@ -33,6 +33,8 @@ typedef struct { /* convenience */ vlib_main_t * vlib_main; vnet_main_t * vnet_main; + + u16 msg_id_base; } p2p_ethernet_main_t; extern p2p_ethernet_main_t p2p_main; 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 #include - -#include #include -#define vl_typedefs /* define message structures */ -#include -#undef vl_typedefs - -#define vl_endianfun /* define message structures */ -#include -#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 -#undef vl_printfun +#include +#include +#include +#define REPLY_MSG_ID_BASE p2p_main.msg_id_base #include -#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 -#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 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; } diff --git a/src/vnet/vnet_all_api_h.h b/src/vnet/vnet_all_api_h.h index 872729cc441..05b74f9e793 100644 --- a/src/vnet/vnet_all_api_h.h +++ b/src/vnet/vnet_all_api_h.h @@ -46,7 +46,6 @@ #include #include #include -#include #include #include #include -- cgit 1.2.3-korg