aboutsummaryrefslogtreecommitdiffstats
path: root/src/vat/api_format.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/vat/api_format.c')
-rw-r--r--src/vat/api_format.c564
1 files changed, 13 insertions, 551 deletions
diff --git a/src/vat/api_format.c b/src/vat/api_format.c
index c296a5b58a0..86b247eb2da 100644
--- a/src/vat/api_format.c
+++ b/src/vat/api_format.c
@@ -1618,76 +1618,6 @@ static void vl_api_mpls_tunnel_add_del_reply_t_handler_json
vam->result_ready = 1;
}
-static void vl_api_create_vhost_user_if_reply_t_handler
- (vl_api_create_vhost_user_if_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;
- }
- vam->regenerate_interface_table = 1;
-}
-
-static void vl_api_create_vhost_user_if_reply_t_handler_json
- (vl_api_create_vhost_user_if_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_create_vhost_user_if_v2_reply_t_handler
- (vl_api_create_vhost_user_if_v2_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;
- }
- vam->regenerate_interface_table = 1;
-}
-
-static void vl_api_create_vhost_user_if_v2_reply_t_handler_json
- (vl_api_create_vhost_user_if_v2_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_ip_address_details_t_handler
(vl_api_ip_address_details_t * mp)
{
@@ -1965,9 +1895,6 @@ _(l2_patch_add_del_reply) \
_(l2_fib_clear_table_reply) \
_(l2_interface_efp_filter_reply) \
_(l2_interface_vlan_tag_rewrite_reply) \
-_(modify_vhost_user_if_reply) \
-_(modify_vhost_user_if_v2_reply) \
-_(delete_vhost_user_if_reply) \
_(want_l2_macs_events_reply) \
_(delete_loopback_reply) \
_(bd_ip_mac_add_del_reply) \
@@ -2079,12 +2006,6 @@ _(ADD_NODE_NEXT_REPLY, add_node_next_reply) \
_(L2_FIB_CLEAR_TABLE_REPLY, l2_fib_clear_table_reply) \
_(L2_INTERFACE_EFP_FILTER_REPLY, l2_interface_efp_filter_reply) \
_(L2_INTERFACE_VLAN_TAG_REWRITE_REPLY, l2_interface_vlan_tag_rewrite_reply) \
-_(SW_INTERFACE_VHOST_USER_DETAILS, sw_interface_vhost_user_details) \
-_(CREATE_VHOST_USER_IF_REPLY, create_vhost_user_if_reply) \
-_(MODIFY_VHOST_USER_IF_REPLY, modify_vhost_user_if_reply) \
-_(CREATE_VHOST_USER_IF_V2_REPLY, create_vhost_user_if_v2_reply) \
-_(MODIFY_VHOST_USER_IF_V2_REPLY, modify_vhost_user_if_v2_reply) \
-_(DELETE_VHOST_USER_IF_REPLY, delete_vhost_user_if_reply) \
_(SHOW_VERSION_REPLY, show_version_reply) \
_(SHOW_THREADS_REPLY, show_threads_reply) \
_(L2_FIB_TABLE_DETAILS, l2_fib_table_details) \
@@ -6668,447 +6589,7 @@ api_l2_interface_vlan_tag_rewrite (vat_main_t * vam)
}
static int
-api_create_vhost_user_if (vat_main_t * vam)
-{
- unformat_input_t *i = vam->input;
- vl_api_create_vhost_user_if_t *mp;
- u8 *file_name;
- u8 is_server = 0;
- u8 file_name_set = 0;
- u32 custom_dev_instance = ~0;
- u8 hwaddr[6];
- u8 use_custom_mac = 0;
- u8 disable_mrg_rxbuf = 0;
- u8 disable_indirect_desc = 0;
- u8 *tag = 0;
- u8 enable_gso = 0;
- u8 enable_packed = 0;
- int ret;
-
- /* Shut up coverity */
- clib_memset (hwaddr, 0, sizeof (hwaddr));
-
- while (unformat_check_input (i) != UNFORMAT_END_OF_INPUT)
- {
- if (unformat (i, "socket %s", &file_name))
- {
- file_name_set = 1;
- }
- else if (unformat (i, "renumber %" PRIu32, &custom_dev_instance))
- ;
- else if (unformat (i, "mac %U", unformat_ethernet_address, hwaddr))
- use_custom_mac = 1;
- else if (unformat (i, "server"))
- is_server = 1;
- else if (unformat (i, "disable_mrg_rxbuf"))
- disable_mrg_rxbuf = 1;
- else if (unformat (i, "disable_indirect_desc"))
- disable_indirect_desc = 1;
- else if (unformat (i, "gso"))
- enable_gso = 1;
- else if (unformat (i, "packed"))
- enable_packed = 1;
- else if (unformat (i, "tag %s", &tag))
- ;
- else
- break;
- }
-
- if (file_name_set == 0)
- {
- errmsg ("missing socket file name");
- return -99;
- }
-
- if (vec_len (file_name) > 255)
- {
- errmsg ("socket file name too long");
- return -99;
- }
- vec_add1 (file_name, 0);
-
- M (CREATE_VHOST_USER_IF, mp);
-
- mp->is_server = is_server;
- mp->disable_mrg_rxbuf = disable_mrg_rxbuf;
- mp->disable_indirect_desc = disable_indirect_desc;
- mp->enable_gso = enable_gso;
- mp->enable_packed = enable_packed;
- mp->custom_dev_instance = ntohl (custom_dev_instance);
- clib_memcpy (mp->sock_filename, file_name, vec_len (file_name));
- vec_free (file_name);
- if (custom_dev_instance != ~0)
- mp->renumber = 1;
-
- mp->use_custom_mac = use_custom_mac;
- clib_memcpy (mp->mac_address, hwaddr, 6);
- if (tag)
- strncpy ((char *) mp->tag, (char *) tag, ARRAY_LEN (mp->tag) - 1);
- vec_free (tag);
-
- S (mp);
- W (ret);
- return ret;
-}
-
-static int
-api_modify_vhost_user_if (vat_main_t * vam)
-{
- unformat_input_t *i = vam->input;
- vl_api_modify_vhost_user_if_t *mp;
- u8 *file_name;
- u8 is_server = 0;
- u8 file_name_set = 0;
- u32 custom_dev_instance = ~0;
- u8 sw_if_index_set = 0;
- u32 sw_if_index = (u32) ~ 0;
- u8 enable_gso = 0;
- u8 enable_packed = 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))
- sw_if_index_set = 1;
- else if (unformat (i, "sw_if_index %d", &sw_if_index))
- sw_if_index_set = 1;
- else if (unformat (i, "socket %s", &file_name))
- {
- file_name_set = 1;
- }
- else if (unformat (i, "renumber %" PRIu32, &custom_dev_instance))
- ;
- else if (unformat (i, "server"))
- is_server = 1;
- else if (unformat (i, "gso"))
- enable_gso = 1;
- else if (unformat (i, "packed"))
- enable_packed = 1;
- else
- break;
- }
-
- if (sw_if_index_set == 0)
- {
- errmsg ("missing sw_if_index or interface name");
- return -99;
- }
-
- if (file_name_set == 0)
- {
- errmsg ("missing socket file name");
- return -99;
- }
-
- if (vec_len (file_name) > 255)
- {
- errmsg ("socket file name too long");
- return -99;
- }
- vec_add1 (file_name, 0);
-
- M (MODIFY_VHOST_USER_IF, mp);
-
- mp->sw_if_index = ntohl (sw_if_index);
- mp->is_server = is_server;
- mp->enable_gso = enable_gso;
- mp->enable_packed = enable_packed;
- mp->custom_dev_instance = ntohl (custom_dev_instance);
- clib_memcpy (mp->sock_filename, file_name, vec_len (file_name));
- vec_free (file_name);
- if (custom_dev_instance != ~0)
- mp->renumber = 1;
-
- S (mp);
- W (ret);
- return ret;
-}
-
-static int
-api_create_vhost_user_if_v2 (vat_main_t * vam)
-{
- unformat_input_t *i = vam->input;
- vl_api_create_vhost_user_if_v2_t *mp;
- u8 *file_name;
- u8 is_server = 0;
- u8 file_name_set = 0;
- u32 custom_dev_instance = ~0;
- u8 hwaddr[6];
- u8 use_custom_mac = 0;
- u8 disable_mrg_rxbuf = 0;
- u8 disable_indirect_desc = 0;
- u8 *tag = 0;
- u8 enable_gso = 0;
- u8 enable_packed = 0;
- u8 enable_event_idx = 0;
- int ret;
-
- /* Shut up coverity */
- clib_memset (hwaddr, 0, sizeof (hwaddr));
-
- while (unformat_check_input (i) != UNFORMAT_END_OF_INPUT)
- {
- if (unformat (i, "socket %s", &file_name))
- {
- file_name_set = 1;
- }
- else if (unformat (i, "renumber %" PRIu32, &custom_dev_instance))
- ;
- else if (unformat (i, "mac %U", unformat_ethernet_address, hwaddr))
- use_custom_mac = 1;
- else if (unformat (i, "server"))
- is_server = 1;
- else if (unformat (i, "disable_mrg_rxbuf"))
- disable_mrg_rxbuf = 1;
- else if (unformat (i, "disable_indirect_desc"))
- disable_indirect_desc = 1;
- else if (unformat (i, "gso"))
- enable_gso = 1;
- else if (unformat (i, "packed"))
- enable_packed = 1;
- else if (unformat (i, "event-idx"))
- enable_event_idx = 1;
- else if (unformat (i, "tag %s", &tag))
- ;
- else
- break;
- }
-
- if (file_name_set == 0)
- {
- errmsg ("missing socket file name");
- return -99;
- }
-
- if (vec_len (file_name) > 255)
- {
- errmsg ("socket file name too long");
- return -99;
- }
- vec_add1 (file_name, 0);
-
- M (CREATE_VHOST_USER_IF_V2, mp);
-
- mp->is_server = is_server;
- mp->disable_mrg_rxbuf = disable_mrg_rxbuf;
- mp->disable_indirect_desc = disable_indirect_desc;
- mp->enable_gso = enable_gso;
- mp->enable_packed = enable_packed;
- mp->enable_event_idx = enable_event_idx;
- mp->custom_dev_instance = ntohl (custom_dev_instance);
- clib_memcpy (mp->sock_filename, file_name, vec_len (file_name));
- vec_free (file_name);
- if (custom_dev_instance != ~0)
- mp->renumber = 1;
-
- mp->use_custom_mac = use_custom_mac;
- clib_memcpy (mp->mac_address, hwaddr, 6);
- if (tag)
- strncpy ((char *) mp->tag, (char *) tag, ARRAY_LEN (mp->tag) - 1);
- vec_free (tag);
-
- S (mp);
- W (ret);
- return ret;
-}
-
-static int
-api_modify_vhost_user_if_v2 (vat_main_t * vam)
-{
- unformat_input_t *i = vam->input;
- vl_api_modify_vhost_user_if_v2_t *mp;
- u8 *file_name;
- u8 is_server = 0;
- u8 file_name_set = 0;
- u32 custom_dev_instance = ~0;
- u8 sw_if_index_set = 0;
- u32 sw_if_index = (u32) ~ 0;
- u8 enable_gso = 0;
- u8 enable_packed = 0;
- u8 enable_event_idx = 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))
- sw_if_index_set = 1;
- else if (unformat (i, "sw_if_index %d", &sw_if_index))
- sw_if_index_set = 1;
- else if (unformat (i, "socket %s", &file_name))
- {
- file_name_set = 1;
- }
- else if (unformat (i, "renumber %" PRIu32, &custom_dev_instance))
- ;
- else if (unformat (i, "server"))
- is_server = 1;
- else if (unformat (i, "gso"))
- enable_gso = 1;
- else if (unformat (i, "packed"))
- enable_packed = 1;
- else if (unformat (i, "event-idx"))
- enable_event_idx = 1;
- else
- break;
- }
-
- if (sw_if_index_set == 0)
- {
- errmsg ("missing sw_if_index or interface name");
- return -99;
- }
-
- if (file_name_set == 0)
- {
- errmsg ("missing socket file name");
- return -99;
- }
-
- if (vec_len (file_name) > 255)
- {
- errmsg ("socket file name too long");
- return -99;
- }
- vec_add1 (file_name, 0);
-
- M (MODIFY_VHOST_USER_IF_V2, mp);
-
- mp->sw_if_index = ntohl (sw_if_index);
- mp->is_server = is_server;
- mp->enable_gso = enable_gso;
- mp->enable_packed = enable_packed;
- mp->enable_event_idx = enable_event_idx;
- mp->custom_dev_instance = ntohl (custom_dev_instance);
- clib_memcpy (mp->sock_filename, file_name, vec_len (file_name));
- vec_free (file_name);
- if (custom_dev_instance != ~0)
- mp->renumber = 1;
-
- S (mp);
- W (ret);
- return ret;
-}
-
-static int
-api_delete_vhost_user_if (vat_main_t * vam)
-{
- unformat_input_t *i = vam->input;
- vl_api_delete_vhost_user_if_t *mp;
- u32 sw_if_index = ~0;
- u8 sw_if_index_set = 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))
- 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 sw_if_index or interface name");
- return -99;
- }
-
-
- M (DELETE_VHOST_USER_IF, mp);
-
- mp->sw_if_index = ntohl (sw_if_index);
-
- S (mp);
- W (ret);
- return ret;
-}
-
-static void vl_api_sw_interface_vhost_user_details_t_handler
- (vl_api_sw_interface_vhost_user_details_t * mp)
-{
- vat_main_t *vam = &vat_main;
- u64 features;
-
- features =
- clib_net_to_host_u32 (mp->features_first_32) | ((u64)
- clib_net_to_host_u32
- (mp->features_last_32) <<
- 32);
-
- print (vam->ofp, "%-25s %3" PRIu32 " %6" PRIu32 " %16llx %6d %7d %s",
- (char *) mp->interface_name, ntohl (mp->sw_if_index),
- ntohl (mp->virtio_net_hdr_sz), features, mp->is_server,
- ntohl (mp->num_regions), (char *) mp->sock_filename);
- print (vam->ofp, " Status: '%s'", strerror (ntohl (mp->sock_errno)));
-}
-
-static void vl_api_sw_interface_vhost_user_details_t_handler_json
- (vl_api_sw_interface_vhost_user_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, "virtio_net_hdr_sz",
- ntohl (mp->virtio_net_hdr_sz));
- vat_json_object_add_uint (node, "features_first_32",
- clib_net_to_host_u32 (mp->features_first_32));
- vat_json_object_add_uint (node, "features_last_32",
- clib_net_to_host_u32 (mp->features_last_32));
- vat_json_object_add_uint (node, "is_server", mp->is_server);
- vat_json_object_add_string_copy (node, "sock_filename", mp->sock_filename);
- vat_json_object_add_uint (node, "num_regions", ntohl (mp->num_regions));
- vat_json_object_add_uint (node, "sock_errno", ntohl (mp->sock_errno));
-}
-
-static int
-api_sw_interface_vhost_user_dump (vat_main_t * vam)
-{
- unformat_input_t *i = vam->input;
- vl_api_sw_interface_vhost_user_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, "Interface name idx hdr_sz features "
- "server regions filename");
-
- /* Get list of vhost-user interfaces */
- M (SW_INTERFACE_VHOST_USER_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 int
-api_show_version (vat_main_t * vam)
+api_show_version (vat_main_t *vam)
{
vl_api_show_version_t *mp;
int ret;
@@ -7120,20 +6601,19 @@ api_show_version (vat_main_t * vam)
return ret;
}
-static void vl_api_l2_fib_table_details_t_handler
- (vl_api_l2_fib_table_details_t * mp)
+static void
+vl_api_l2_fib_table_details_t_handler (vl_api_l2_fib_table_details_t *mp)
{
vat_main_t *vam = &vat_main;
- print (vam->ofp, "%3" PRIu32 " %U %3" PRIu32
- " %d %d %d",
+ print (vam->ofp,
+ "%3" PRIu32 " %U %3" PRIu32 " %d %d %d",
ntohl (mp->bd_id), format_ethernet_address, mp->mac,
- ntohl (mp->sw_if_index), mp->static_mac, mp->filter_mac,
- mp->bvi_mac);
+ ntohl (mp->sw_if_index), mp->static_mac, mp->filter_mac, mp->bvi_mac);
}
-static void vl_api_l2_fib_table_details_t_handler_json
- (vl_api_l2_fib_table_details_t * mp)
+static void
+vl_api_l2_fib_table_details_t_handler_json (vl_api_l2_fib_table_details_t *mp)
{
vat_main_t *vam = &vat_main;
vat_json_node_t *node = NULL;
@@ -7155,7 +6635,7 @@ static void vl_api_l2_fib_table_details_t_handler_json
}
static int
-api_l2_fib_table_dump (vat_main_t * vam)
+api_l2_fib_table_dump (vat_main_t *vam)
{
unformat_input_t *i = vam->input;
vl_api_l2_fib_table_dump_t *mp;
@@ -7195,9 +6675,8 @@ api_l2_fib_table_dump (vat_main_t * vam)
return ret;
}
-
static int
-api_interface_name_renumber (vat_main_t * vam)
+api_interface_name_renumber (vat_main_t *vam)
{
unformat_input_t *line_input = vam->input;
vl_api_interface_name_renumber_t *mp;
@@ -7242,7 +6721,7 @@ api_interface_name_renumber (vat_main_t * vam)
}
static int
-api_want_l2_macs_events (vat_main_t * vam)
+api_want_l2_macs_events (vat_main_t *vam)
{
unformat_input_t *line_input = vam->input;
vl_api_want_l2_macs_events_t *mp;
@@ -7278,7 +6757,7 @@ api_want_l2_macs_events (vat_main_t * vam)
}
static int
-api_ip_address_dump (vat_main_t * vam)
+api_ip_address_dump (vat_main_t *vam)
{
unformat_input_t *i = vam->input;
vl_api_ip_address_dump_t *mp;
@@ -7293,8 +6772,7 @@ api_ip_address_dump (vat_main_t * vam)
{
if (unformat (i, "sw_if_index %d", &sw_if_index))
sw_if_index_set = 1;
- else
- if (unformat (i, "%U", api_unformat_sw_if_index, vam, &sw_if_index))
+ else if (unformat (i, "%U", api_unformat_sw_if_index, vam, &sw_if_index))
sw_if_index_set = 1;
else if (unformat (i, "ipv4"))
ipv4_set = 1;
@@ -9713,22 +9191,6 @@ _(l2_interface_vlan_tag_rewrite, \
"<intfc> | sw_if_index <nn> \n" \
"[disable][push-[1|2]][pop-[1|2]][translate-1-[1|2]] \n" \
"[translate-2-[1|2]] [push_dot1q 0] tag1 <nn> tag2 <nn>") \
-_(create_vhost_user_if, \
- "socket <filename> [server] [renumber <dev_instance>] " \
- "[disable_mrg_rxbuf] [disable_indirect_desc] [gso] " \
- "[mac <mac_address>] [packed]") \
-_(modify_vhost_user_if, \
- "<intfc> | sw_if_index <nn> socket <filename>\n" \
- "[server] [renumber <dev_instance>] [gso] [packed]") \
-_(create_vhost_user_if_v2, \
- "socket <filename> [server] [renumber <dev_instance>] " \
- "[disable_mrg_rxbuf] [disable_indirect_desc] [gso] " \
- "[mac <mac_address>] [packed] [event-idx]") \
-_(modify_vhost_user_if_v2, \
- "<intfc> | sw_if_index <nn> socket <filename>\n" \
- "[server] [renumber <dev_instance>] [gso] [packed] [event-idx]")\
-_(delete_vhost_user_if, "<intfc> | sw_if_index <nn>") \
-_(sw_interface_vhost_user_dump, "<intfc> | sw_if_index <nn>") \
_(show_version, "") \
_(show_threads, "") \
_(l2_fib_table_dump, "bd_id <bridge-domain-id>") \