aboutsummaryrefslogtreecommitdiffstats
path: root/src/vnet
diff options
context:
space:
mode:
authorFilip Tehlar <ftehlar@cisco.com>2021-06-21 13:01:24 +0000
committerOle Tr�an <otroan@employees.org>2021-06-21 16:31:23 +0000
commit3006289a07429730ff69c2585eed6d6075be3565 (patch)
tree5dc91554acf934e090c9a8c6aefd743fbbea95be /src/vnet
parentbf8c54ad8734cc3ba366a43bcc61f83f5c8de117 (diff)
udp: api cleanup
Use autogenerated code. Does not change API definitions. Type: improvement Signed-off-by: Filip Tehlar <ftehlar@cisco.com> Change-Id: I0994241df94ad7536be323b9d7c48caf38cc4267
Diffstat (limited to 'src/vnet')
-rw-r--r--src/vnet/udp/udp.h1
-rw-r--r--src/vnet/udp/udp_api.c55
-rw-r--r--src/vnet/vnet_all_api_h.h1
3 files changed, 9 insertions, 48 deletions
diff --git a/src/vnet/udp/udp.h b/src/vnet/udp/udp.h
index d0e3bf3015d..dc3f8f5bfa1 100644
--- a/src/vnet/udp/udp.h
+++ b/src/vnet/udp/udp.h
@@ -121,6 +121,7 @@ typedef struct
udp_connection_t *listener_pool;
u16 default_mtu;
+ u16 msg_id_base;
} udp_main_t;
extern udp_main_t udp_main;
diff --git a/src/vnet/udp/udp_api.c b/src/vnet/udp/udp_api.c
index 6ba92bbf207..0f2d014946f 100644
--- a/src/vnet/udp/udp_api.c
+++ b/src/vnet/udp/udp_api.c
@@ -20,31 +20,15 @@
#include <vnet/udp/udp_encap.h>
#include <vnet/fib/fib_table.h>
#include <vnet/ip/ip_types_api.h>
+#include <vnet/udp/udp.h>
-#include <vnet/vnet_msg_enum.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/udp/udp.api_enum.h>
+#include <vnet/udp/udp.api_types.h>
+#define REPLY_MSG_ID_BASE udp_main.msg_id_base
#include <vlibapi/api_helper_macros.h>
-#define foreach_udp_api_msg \
- _ (UDP_ENCAP_DEL, udp_encap_del) \
- _ (UDP_ENCAP_ADD, udp_encap_add) \
- _ (UDP_ENCAP_DUMP, udp_encap_dump) \
- _ (UDP_DECAP_ADD_DEL, udp_decap_add_del)
-
static void
send_udp_encap_details (const udp_encap_t * ue, vl_api_registration_t * reg,
u32 context)
@@ -53,7 +37,7 @@ send_udp_encap_details (const udp_encap_t * ue, vl_api_registration_t * reg,
mp = vl_msg_api_alloc (sizeof (*mp));
clib_memset (mp, 0, sizeof (*mp));
- mp->_vl_msg_id = ntohs (VL_API_UDP_ENCAP_DETAILS);
+ mp->_vl_msg_id = ntohs (REPLY_MSG_ID_BASE + VL_API_UDP_ENCAP_DETAILS);
mp->context = context;
if (FIB_PROTOCOL_IP4 == ue->ue_ip_proto)
@@ -201,37 +185,14 @@ vl_api_udp_decap_add_del_t_handler (vl_api_udp_decap_add_del_t *mp)
REPLY_MACRO (VL_API_UDP_DECAP_ADD_DEL_REPLY);
}
-#define vl_msg_name_crc_list
-#include <vnet/udp/udp.api.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_udp;
-#undef _
-}
-
+#include <vnet/udp/udp.api.c>
static clib_error_t *
udp_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_udp_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 85604901ca2..8dee6c30adb 100644
--- a/src/vnet/vnet_all_api_h.h
+++ b/src/vnet/vnet_all_api_h.h
@@ -50,7 +50,6 @@
#include <vnet/policer/policer.api.h>
#include <vnet/ethernet/p2p_ethernet.api.h>
#include <vnet/tcp/tcp.api.h>
-#include <vnet/udp/udp.api.h>
#include <vnet/ip/punt.api.h>
#include <vnet/qos/qos.api.h>
#include <vnet/devices/pipe/pipe.api.h>