aboutsummaryrefslogtreecommitdiffstats
path: root/src/vnet/bonding
diff options
context:
space:
mode:
authorFilip Tehlar <ftehlar@cisco.com>2021-06-22 09:24:06 +0000
committerOle Tr�an <otroan@employees.org>2021-06-22 13:53:56 +0000
commit116a1e52772c3a2dba61f8f2ac9c919f0623153c (patch)
treee52441f740c6b5bc5c8cabf6dd7219bdeed91051 /src/vnet/bonding
parent79699b00c155f9f5b776451a55e151befa3ba33b (diff)
bonding: api cleanup
Use autogenerated code. Does not change API definitions. Type: improvement Signed-off-by: Filip Tehlar <ftehlar@cisco.com> Change-Id: I1de45c4db57444d2d2c9fb91b8a66a4f01be699b
Diffstat (limited to 'src/vnet/bonding')
-rw-r--r--src/vnet/bonding/bond_api.c74
1 files changed, 16 insertions, 58 deletions
diff --git a/src/vnet/bonding/bond_api.c b/src/vnet/bonding/bond_api.c
index 8b8385d8205..3fd73d7995f 100644
--- a/src/vnet/bonding/bond_api.c
+++ b/src/vnet/bonding/bond_api.c
@@ -24,39 +24,16 @@
#include <vnet/api_errno.h>
#include <vnet/ethernet/ethernet.h>
#include <vnet/ethernet/ethernet_types_api.h>
+#include <vnet/bonding/node.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/bonding/bond.api_enum.h>
+#include <vnet/bonding/bond.api_types.h>
+#define REPLY_MSG_ID_BASE msg_id_base
#include <vlibapi/api_helper_macros.h>
-#include <vnet/bonding/node.h>
-#define foreach_bond_api_msg \
-_(BOND_CREATE, bond_create) \
-_(BOND_CREATE2, bond_create2) \
-_(BOND_DELETE, bond_delete) \
-_(BOND_ENSLAVE, bond_enslave) \
-_(BOND_ADD_MEMBER, bond_add_member) \
-_(SW_INTERFACE_SET_BOND_WEIGHT, sw_interface_set_bond_weight) \
-_(BOND_DETACH_SLAVE, bond_detach_slave) \
-_(BOND_DETACH_MEMBER, bond_detach_member) \
-_(SW_INTERFACE_BOND_DUMP, sw_interface_bond_dump) \
-_(SW_BOND_INTERFACE_DUMP, sw_bond_interface_dump) \
-_(SW_INTERFACE_SLAVE_DUMP, sw_interface_slave_dump) \
-_(SW_MEMBER_INTERFACE_DUMP, sw_member_interface_dump)
+static u16 msg_id_base;
static void
vl_api_bond_delete_t_handler (vl_api_bond_delete_t * mp)
@@ -246,7 +223,8 @@ bond_send_sw_interface_details (vpe_api_main_t * am,
mp = vl_msg_api_alloc (sizeof (*mp));
clib_memset (mp, 0, sizeof (*mp));
- mp->_vl_msg_id = htons (VL_API_SW_INTERFACE_BOND_DETAILS);
+ mp->_vl_msg_id =
+ htons (REPLY_MSG_ID_BASE + VL_API_SW_INTERFACE_BOND_DETAILS);
mp->sw_if_index = htonl (bond_if->sw_if_index);
mp->id = htonl (bond_if->id);
clib_memcpy (mp->interface_name, bond_if->interface_name,
@@ -297,7 +275,8 @@ bond_send_sw_bond_interface_details (vpe_api_main_t * am,
mp = vl_msg_api_alloc (sizeof (*mp));
clib_memset (mp, 0, sizeof (*mp));
- mp->_vl_msg_id = htons (VL_API_SW_BOND_INTERFACE_DETAILS);
+ mp->_vl_msg_id =
+ htons (REPLY_MSG_ID_BASE + VL_API_SW_BOND_INTERFACE_DETAILS);
mp->sw_if_index = htonl (bond_if->sw_if_index);
mp->id = htonl (bond_if->id);
clib_memcpy (mp->interface_name, bond_if->interface_name,
@@ -356,7 +335,8 @@ bond_send_sw_member_interface_details (vpe_api_main_t * am,
mp = vl_msg_api_alloc (sizeof (*mp));
clib_memset (mp, 0, sizeof (*mp));
- mp->_vl_msg_id = htons (VL_API_SW_INTERFACE_SLAVE_DETAILS);
+ mp->_vl_msg_id =
+ htons (REPLY_MSG_ID_BASE + VL_API_SW_INTERFACE_SLAVE_DETAILS);
mp->sw_if_index = htonl (member_if->sw_if_index);
clib_memcpy (mp->interface_name, member_if->interface_name,
MIN (ARRAY_LEN (mp->interface_name) - 1,
@@ -406,7 +386,8 @@ bond_send_member_interface_details (vpe_api_main_t * am,
mp = vl_msg_api_alloc (sizeof (*mp));
clib_memset (mp, 0, sizeof (*mp));
- mp->_vl_msg_id = htons (VL_API_SW_MEMBER_INTERFACE_DETAILS);
+ mp->_vl_msg_id =
+ htons (REPLY_MSG_ID_BASE + VL_API_SW_MEMBER_INTERFACE_DETAILS);
mp->sw_if_index = htonl (member_if->sw_if_index);
clib_memcpy (mp->interface_name, member_if->interface_name,
MIN (ARRAY_LEN (mp->interface_name) - 1,
@@ -446,37 +427,14 @@ vl_api_sw_member_interface_dump_t_handler (vl_api_sw_member_interface_dump_t *
vec_free (memberifs);
}
-#define vl_msg_name_crc_list
-#include <vnet/vnet_all_api_h.h>
-#undef vl_msg_name_crc_list
-
-static void
-bond_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_bond;
-#undef _
-}
-
+#include <vnet/bonding/bond.api.c>
static clib_error_t *
bond_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_bond_api_msg;
-#undef _
-
/*
* Set up the (msg_name, crc, message-id) table
*/
- bond_setup_message_id_table (am);
+ REPLY_MSG_ID_BASE = setup_message_id_table ();
return 0;
}