diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/vat/api_format.c | 655 | ||||
-rw-r--r-- | src/vnet/bonding/bond_api.c | 74 | ||||
-rw-r--r-- | src/vnet/vnet_all_api_h.h | 1 |
3 files changed, 16 insertions, 714 deletions
diff --git a/src/vat/api_format.c b/src/vat/api_format.c index 3a93bdfa790..0457a3cac7a 100644 --- a/src/vat/api_format.c +++ b/src/vat/api_format.c @@ -1679,371 +1679,6 @@ static void vl_api_virtio_pci_delete_reply_t_handler_json vam->result_ready = 1; } -static void -vl_api_bond_create_reply_t_handler (vl_api_bond_create_reply_t * mp) -{ - vat_main_t *vam = &vat_main; - i32 retval = ntohl (mp->retval); - - if (vam->async_mode) - { - vam->async_errors += (retval < 0); - } - else - { - vam->retval = retval; - vam->sw_if_index = ntohl (mp->sw_if_index); - vam->result_ready = 1; - } -} - -static void vl_api_bond_create_reply_t_handler_json - (vl_api_bond_create_reply_t * mp) -{ - vat_main_t *vam = &vat_main; - vat_json_node_t node; - - vat_json_init_object (&node); - vat_json_object_add_int (&node, "retval", ntohl (mp->retval)); - vat_json_object_add_uint (&node, "sw_if_index", ntohl (mp->sw_if_index)); - - vat_json_print (vam->ofp, &node); - vat_json_free (&node); - - vam->retval = ntohl (mp->retval); - vam->result_ready = 1; -} - -static void -vl_api_bond_create2_reply_t_handler (vl_api_bond_create2_reply_t * mp) -{ - vat_main_t *vam = &vat_main; - i32 retval = ntohl (mp->retval); - - if (vam->async_mode) - { - vam->async_errors += (retval < 0); - } - else - { - vam->retval = retval; - vam->sw_if_index = ntohl (mp->sw_if_index); - vam->result_ready = 1; - } -} - -static void vl_api_bond_create2_reply_t_handler_json - (vl_api_bond_create2_reply_t * mp) -{ - vat_main_t *vam = &vat_main; - vat_json_node_t node; - - vat_json_init_object (&node); - vat_json_object_add_int (&node, "retval", ntohl (mp->retval)); - vat_json_object_add_uint (&node, "sw_if_index", ntohl (mp->sw_if_index)); - - vat_json_print (vam->ofp, &node); - vat_json_free (&node); - - vam->retval = ntohl (mp->retval); - vam->result_ready = 1; -} - -static void -vl_api_bond_delete_reply_t_handler (vl_api_bond_delete_reply_t * mp) -{ - vat_main_t *vam = &vat_main; - i32 retval = ntohl (mp->retval); - - if (vam->async_mode) - { - vam->async_errors += (retval < 0); - } - else - { - vam->retval = retval; - vam->result_ready = 1; - } -} - -static void vl_api_bond_delete_reply_t_handler_json - (vl_api_bond_delete_reply_t * mp) -{ - vat_main_t *vam = &vat_main; - vat_json_node_t node; - - vat_json_init_object (&node); - vat_json_object_add_int (&node, "retval", ntohl (mp->retval)); - - vat_json_print (vam->ofp, &node); - vat_json_free (&node); - - vam->retval = ntohl (mp->retval); - vam->result_ready = 1; -} - -static void -vl_api_bond_add_member_reply_t_handler (vl_api_bond_add_member_reply_t * mp) -{ - vat_main_t *vam = &vat_main; - i32 retval = ntohl (mp->retval); - - if (vam->async_mode) - { - vam->async_errors += (retval < 0); - } - else - { - vam->retval = retval; - vam->result_ready = 1; - } -} - -static void vl_api_bond_add_member_reply_t_handler_json - (vl_api_bond_add_member_reply_t * mp) -{ - vat_main_t *vam = &vat_main; - vat_json_node_t node; - - vat_json_init_object (&node); - vat_json_object_add_int (&node, "retval", ntohl (mp->retval)); - - vat_json_print (vam->ofp, &node); - vat_json_free (&node); - - vam->retval = ntohl (mp->retval); - vam->result_ready = 1; -} - -static void -vl_api_bond_detach_member_reply_t_handler (vl_api_bond_detach_member_reply_t * - mp) -{ - vat_main_t *vam = &vat_main; - i32 retval = ntohl (mp->retval); - - if (vam->async_mode) - { - vam->async_errors += (retval < 0); - } - else - { - vam->retval = retval; - vam->result_ready = 1; - } -} - -static void vl_api_bond_detach_member_reply_t_handler_json - (vl_api_bond_detach_member_reply_t * mp) -{ - vat_main_t *vam = &vat_main; - vat_json_node_t node; - - vat_json_init_object (&node); - vat_json_object_add_int (&node, "retval", ntohl (mp->retval)); - - vat_json_print (vam->ofp, &node); - vat_json_free (&node); - - vam->retval = ntohl (mp->retval); - vam->result_ready = 1; -} - -static int -api_sw_interface_set_bond_weight (vat_main_t * vam) -{ - unformat_input_t *i = vam->input; - vl_api_sw_interface_set_bond_weight_t *mp; - u32 sw_if_index = ~0; - u32 weight = 0; - u8 weight_enter = 0; - int ret; - - while (unformat_check_input (i) != UNFORMAT_END_OF_INPUT) - { - if (unformat (i, "%U", api_unformat_sw_if_index, vam, &sw_if_index)) - ; - else if (unformat (i, "sw_if_index %d", &sw_if_index)) - ; - else if (unformat (i, "weight %u", &weight)) - weight_enter = 1; - else - break; - } - - if (sw_if_index == ~0) - { - errmsg ("missing interface name or sw_if_index"); - return -99; - } - if (weight_enter == 0) - { - errmsg ("missing valid weight"); - return -99; - } - - /* Construct the API message */ - M (SW_INTERFACE_SET_BOND_WEIGHT, mp); - mp->sw_if_index = ntohl (sw_if_index); - mp->weight = ntohl (weight); - - S (mp); - W (ret); - return ret; -} - -static void vl_api_sw_bond_interface_details_t_handler - (vl_api_sw_bond_interface_details_t * mp) -{ - vat_main_t *vam = &vat_main; - - print (vam->ofp, - "%-16s %-12d %-12U %-13U %-14u %-14u", - mp->interface_name, ntohl (mp->sw_if_index), - format_bond_mode, ntohl (mp->mode), format_bond_load_balance, - ntohl (mp->lb), ntohl (mp->active_members), ntohl (mp->members)); -} - -static void vl_api_sw_bond_interface_details_t_handler_json - (vl_api_sw_bond_interface_details_t * mp) -{ - vat_main_t *vam = &vat_main; - vat_json_node_t *node = NULL; - - if (VAT_JSON_ARRAY != vam->json_tree.type) - { - ASSERT (VAT_JSON_NONE == vam->json_tree.type); - vat_json_init_array (&vam->json_tree); - } - node = vat_json_array_add (&vam->json_tree); - - vat_json_init_object (node); - vat_json_object_add_uint (node, "sw_if_index", ntohl (mp->sw_if_index)); - vat_json_object_add_string_copy (node, "interface_name", - mp->interface_name); - vat_json_object_add_uint (node, "mode", ntohl (mp->mode)); - vat_json_object_add_uint (node, "load_balance", ntohl (mp->lb)); - vat_json_object_add_uint (node, "active_members", - ntohl (mp->active_members)); - vat_json_object_add_uint (node, "members", ntohl (mp->members)); -} - -static int -api_sw_bond_interface_dump (vat_main_t * vam) -{ - unformat_input_t *i = vam->input; - vl_api_sw_bond_interface_dump_t *mp; - vl_api_control_ping_t *mp_ping; - int ret; - u32 sw_if_index = ~0; - - while (unformat_check_input (i) != UNFORMAT_END_OF_INPUT) - { - if (unformat (i, "%U", api_unformat_sw_if_index, vam, &sw_if_index)) - ; - else if (unformat (i, "sw_if_index %d", &sw_if_index)) - ; - else - break; - } - - print (vam->ofp, - "\n%-16s %-12s %-12s %-13s %-14s %-14s", - "interface name", "sw_if_index", "mode", "load balance", - "active members", "members"); - - /* Get list of bond interfaces */ - M (SW_BOND_INTERFACE_DUMP, mp); - mp->sw_if_index = ntohl (sw_if_index); - S (mp); - - /* Use a control ping for synchronization */ - MPING (CONTROL_PING, mp_ping); - S (mp_ping); - - W (ret); - return ret; -} - -static void vl_api_sw_member_interface_details_t_handler - (vl_api_sw_member_interface_details_t * mp) -{ - vat_main_t *vam = &vat_main; - - print (vam->ofp, - "%-25s %-12d %-7d %-12d %-10d %-10d", mp->interface_name, - ntohl (mp->sw_if_index), mp->is_passive, mp->is_long_timeout, - ntohl (mp->weight), mp->is_local_numa); -} - -static void vl_api_sw_member_interface_details_t_handler_json - (vl_api_sw_member_interface_details_t * mp) -{ - vat_main_t *vam = &vat_main; - vat_json_node_t *node = NULL; - - if (VAT_JSON_ARRAY != vam->json_tree.type) - { - ASSERT (VAT_JSON_NONE == vam->json_tree.type); - vat_json_init_array (&vam->json_tree); - } - node = vat_json_array_add (&vam->json_tree); - - vat_json_init_object (node); - vat_json_object_add_uint (node, "sw_if_index", ntohl (mp->sw_if_index)); - vat_json_object_add_string_copy (node, "interface_name", - mp->interface_name); - vat_json_object_add_uint (node, "passive", mp->is_passive); - vat_json_object_add_uint (node, "long_timeout", mp->is_long_timeout); - vat_json_object_add_uint (node, "weight", ntohl (mp->weight)); - vat_json_object_add_uint (node, "is_local_numa", mp->is_local_numa); -} - -static int -api_sw_member_interface_dump (vat_main_t * vam) -{ - unformat_input_t *i = vam->input; - vl_api_sw_member_interface_dump_t *mp; - vl_api_control_ping_t *mp_ping; - u32 sw_if_index = ~0; - u8 sw_if_index_set = 0; - int ret; - - /* Parse args required to build the message */ - while (unformat_check_input (i) != UNFORMAT_END_OF_INPUT) - { - if (unformat (i, "%U", api_unformat_sw_if_index, vam, &sw_if_index)) - sw_if_index_set = 1; - else if (unformat (i, "sw_if_index %d", &sw_if_index)) - sw_if_index_set = 1; - else - break; - } - - if (sw_if_index_set == 0) - { - errmsg ("missing vpp interface name. "); - return -99; - } - - print (vam->ofp, - "\n%-25s %-12s %-7s %-12s %-10s %-10s", - "member interface name", "sw_if_index", "passive", "long_timeout", - "weight", "local numa"); - - /* Get list of bond interfaces */ - M (SW_MEMBER_INTERFACE_DUMP, mp); - mp->sw_if_index = ntohl (sw_if_index); - S (mp); - - /* Use a control ping for synchronization */ - MPING (CONTROL_PING, mp_ping); - S (mp_ping); - - W (ret); - return ret; -} - static void vl_api_mpls_tunnel_add_del_reply_t_handler (vl_api_mpls_tunnel_add_del_reply_t * mp) { @@ -2406,7 +2041,6 @@ _(sw_interface_set_table_reply) \ _(sw_interface_set_mpls_enable_reply) \ _(sw_interface_set_vpath_reply) \ _(sw_interface_set_l2_bridge_reply) \ -_(sw_interface_set_bond_weight_reply) \ _(bridge_domain_add_del_reply) \ _(sw_interface_set_l2_xconnect_reply) \ _(l2fib_add_del_reply) \ @@ -2533,14 +2167,6 @@ _(VIRTIO_PCI_CREATE_REPLY, virtio_pci_create_reply) \ _(VIRTIO_PCI_CREATE_V2_REPLY, virtio_pci_create_v2_reply) \ _(VIRTIO_PCI_DELETE_REPLY, virtio_pci_delete_reply) \ _(SW_INTERFACE_VIRTIO_PCI_DETAILS, sw_interface_virtio_pci_details) \ -_(BOND_CREATE_REPLY, bond_create_reply) \ -_(BOND_CREATE2_REPLY, bond_create2_reply) \ -_(BOND_DELETE_REPLY, bond_delete_reply) \ -_(BOND_ADD_MEMBER_REPLY, bond_add_member_reply) \ -_(BOND_DETACH_MEMBER_REPLY, bond_detach_member_reply) \ -_(SW_INTERFACE_SET_BOND_WEIGHT_REPLY, sw_interface_set_bond_weight_reply) \ -_(SW_BOND_INTERFACE_DETAILS, sw_bond_interface_details) \ -_(SW_MEMBER_INTERFACE_DETAILS, sw_member_interface_details) \ _(IP_ROUTE_ADD_DEL_REPLY, ip_route_add_del_reply) \ _(IP_TABLE_ADD_DEL_REPLY, ip_table_add_del_reply) \ _(IP_TABLE_REPLACE_BEGIN_REPLY, ip_table_replace_begin_reply) \ @@ -4727,269 +4353,6 @@ api_virtio_pci_delete (vat_main_t * vam) } static int -api_bond_create (vat_main_t * vam) -{ - unformat_input_t *i = vam->input; - vl_api_bond_create_t *mp; - u8 mac_address[6]; - u8 custom_mac = 0; - int ret; - u8 mode; - u8 lb; - u8 mode_is_set = 0; - u32 id = ~0; - u8 numa_only = 0; - - clib_memset (mac_address, 0, sizeof (mac_address)); - lb = BOND_LB_L2; - - /* Parse args required to build the message */ - while (unformat_check_input (i) != UNFORMAT_END_OF_INPUT) - { - if (unformat (i, "mode %U", unformat_bond_mode, &mode)) - mode_is_set = 1; - else if (((mode == BOND_MODE_LACP) || (mode == BOND_MODE_XOR)) - && unformat (i, "lb %U", unformat_bond_load_balance, &lb)) - ; - else if (unformat (i, "hw-addr %U", unformat_ethernet_address, - mac_address)) - custom_mac = 1; - else if (unformat (i, "numa-only")) - numa_only = 1; - else if (unformat (i, "id %u", &id)) - ; - else - break; - } - - if (mode_is_set == 0) - { - errmsg ("Missing bond mode. "); - return -99; - } - - /* Construct the API message */ - M (BOND_CREATE, mp); - - mp->use_custom_mac = custom_mac; - - mp->mode = htonl (mode); - mp->lb = htonl (lb); - mp->id = htonl (id); - mp->numa_only = numa_only; - - if (custom_mac) - clib_memcpy (mp->mac_address, mac_address, 6); - - /* send it... */ - S (mp); - - /* Wait for a reply... */ - W (ret); - return ret; -} - -static int -api_bond_create2 (vat_main_t * vam) -{ - unformat_input_t *i = vam->input; - vl_api_bond_create2_t *mp; - u8 mac_address[6]; - u8 custom_mac = 0; - int ret; - u8 mode; - u8 lb; - u8 mode_is_set = 0; - u32 id = ~0; - u8 numa_only = 0; - u8 gso = 0; - - clib_memset (mac_address, 0, sizeof (mac_address)); - lb = BOND_LB_L2; - - /* Parse args required to build the message */ - while (unformat_check_input (i) != UNFORMAT_END_OF_INPUT) - { - if (unformat (i, "mode %U", unformat_bond_mode, &mode)) - mode_is_set = 1; - else if (((mode == BOND_MODE_LACP) || (mode == BOND_MODE_XOR)) - && unformat (i, "lb %U", unformat_bond_load_balance, &lb)) - ; - else if (unformat (i, "hw-addr %U", unformat_ethernet_address, - mac_address)) - custom_mac = 1; - else if (unformat (i, "numa-only")) - numa_only = 1; - else if (unformat (i, "gso")) - gso = 1; - else if (unformat (i, "id %u", &id)) - ; - else - break; - } - - if (mode_is_set == 0) - { - errmsg ("Missing bond mode. "); - return -99; - } - - /* Construct the API message */ - M (BOND_CREATE2, mp); - - mp->use_custom_mac = custom_mac; - - mp->mode = htonl (mode); - mp->lb = htonl (lb); - mp->id = htonl (id); - mp->numa_only = numa_only; - mp->enable_gso = gso; - - if (custom_mac) - clib_memcpy (mp->mac_address, mac_address, 6); - - /* send it... */ - S (mp); - - /* Wait for a reply... */ - W (ret); - return ret; -} - -static int -api_bond_delete (vat_main_t * vam) -{ - unformat_input_t *i = vam->input; - vl_api_bond_delete_t *mp; - u32 sw_if_index = ~0; - u8 sw_if_index_set = 0; - int ret; - - /* Parse args required to build the message */ - while (unformat_check_input (i) != UNFORMAT_END_OF_INPUT) - { - if (unformat (i, "%U", api_unformat_sw_if_index, vam, &sw_if_index)) - sw_if_index_set = 1; - else if (unformat (i, "sw_if_index %d", &sw_if_index)) - sw_if_index_set = 1; - else - break; - } - - if (sw_if_index_set == 0) - { - errmsg ("missing vpp interface name. "); - return -99; - } - - /* Construct the API message */ - M (BOND_DELETE, mp); - - mp->sw_if_index = ntohl (sw_if_index); - - /* send it... */ - S (mp); - - /* Wait for a reply... */ - W (ret); - return ret; -} - -static int -api_bond_add_member (vat_main_t * vam) -{ - unformat_input_t *i = vam->input; - vl_api_bond_add_member_t *mp; - u32 bond_sw_if_index; - int ret; - u8 is_passive; - u8 is_long_timeout; - u32 bond_sw_if_index_is_set = 0; - u32 sw_if_index; - u8 sw_if_index_is_set = 0; - - /* Parse args required to build the message */ - while (unformat_check_input (i) != UNFORMAT_END_OF_INPUT) - { - if (unformat (i, "sw_if_index %d", &sw_if_index)) - sw_if_index_is_set = 1; - else if (unformat (i, "bond %u", &bond_sw_if_index)) - bond_sw_if_index_is_set = 1; - else if (unformat (i, "passive %d", &is_passive)) - ; - else if (unformat (i, "long-timeout %d", &is_long_timeout)) - ; - else - break; - } - - if (bond_sw_if_index_is_set == 0) - { - errmsg ("Missing bond sw_if_index. "); - return -99; - } - if (sw_if_index_is_set == 0) - { - errmsg ("Missing member sw_if_index. "); - return -99; - } - - /* Construct the API message */ - M (BOND_ADD_MEMBER, mp); - - mp->bond_sw_if_index = ntohl (bond_sw_if_index); - mp->sw_if_index = ntohl (sw_if_index); - mp->is_long_timeout = is_long_timeout; - mp->is_passive = is_passive; - - /* send it... */ - S (mp); - - /* Wait for a reply... */ - W (ret); - return ret; -} - -static int -api_bond_detach_member (vat_main_t * vam) -{ - unformat_input_t *i = vam->input; - vl_api_bond_detach_member_t *mp; - u32 sw_if_index = ~0; - u8 sw_if_index_set = 0; - int ret; - - /* Parse args required to build the message */ - while (unformat_check_input (i) != UNFORMAT_END_OF_INPUT) - { - if (unformat (i, "%U", api_unformat_sw_if_index, vam, &sw_if_index)) - sw_if_index_set = 1; - else if (unformat (i, "sw_if_index %d", &sw_if_index)) - sw_if_index_set = 1; - else - break; - } - - if (sw_if_index_set == 0) - { - errmsg ("missing vpp interface name. "); - return -99; - } - - /* Construct the API message */ - M (BOND_DETACH_MEMBER, mp); - - mp->sw_if_index = ntohl (sw_if_index); - - /* send it... */ - S (mp); - - /* Wait for a reply... */ - W (ret); - return ret; -} - -static int api_ip_table_add_del (vat_main_t * vam) { unformat_input_t *i = vam->input; @@ -11142,24 +10505,6 @@ _(virtio_pci_create_v2, \ _(virtio_pci_delete, \ "<vpp-if-name> | sw_if_index <id>") \ _(sw_interface_virtio_pci_dump, "") \ -_(bond_create, \ - "[hw-addr <mac-addr>] {round-robin | active-backup | " \ - "broadcast | {lacp | xor} [load-balance { l2 | l23 | l34 }]} " \ - "[id <if-id>]") \ -_(bond_create2, \ - "[hw-addr <mac-addr>] {mode round-robin | active-backup | " \ - "broadcast | {lacp | xor} [load-balance { l2 | l23 | l34 }]} " \ - "[id <if-id>] [gso]") \ -_(bond_delete, \ - "<vpp-if-name> | sw_if_index <id>") \ -_(bond_add_member, \ - "sw_if_index <n> bond <sw_if_index> [is_passive] [is_long_timeout]") \ -_(bond_detach_member, \ - "sw_if_index <n>") \ - _(sw_interface_set_bond_weight, "<intfc> | sw_if_index <nn> weight <value>") \ - _(sw_bond_interface_dump, "<intfc> | sw_if_index <nn>") \ - _(sw_member_interface_dump, \ - "<vpp-if-name> | sw_if_index <id>") \ _(ip_table_add_del, \ "table <n> [ipv6] [add | del]\n") \ _(ip_route_add_del, \ 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; } diff --git a/src/vnet/vnet_all_api_h.h b/src/vnet/vnet_all_api_h.h index 5ae5e7ecf7f..fd9147b44d0 100644 --- a/src/vnet/vnet_all_api_h.h +++ b/src/vnet/vnet_all_api_h.h @@ -33,7 +33,6 @@ #include <vnet/format_fns.h> #endif -#include <vnet/bonding/bond.api.h> #include <vnet/devices/af_packet/af_packet.api.h> #include <vnet/devices/virtio/vhost_user.api.h> #include <vnet/devices/tap/tapv2.api.h> |