summaryrefslogtreecommitdiffstats
path: root/src/vat
diff options
context:
space:
mode:
authorFilip Tehlar <ftehlar@cisco.com>2021-06-22 12:03:55 +0000
committerOle Tr�an <otroan@employees.org>2021-06-22 14:12:29 +0000
commit3808ec06c4c6a860cab7c6293e8b1be93f002b21 (patch)
treec018d2c644898f7672402fc5105cb52101842bf3 /src/vat
parente2fc003f46f70659045e563368db73eeca9a9647 (diff)
devices: tapv2 api cleanup
Use autogenerated code. Does not change API definitions. Type: improvement Signed-off-by: Filip Tehlar <ftehlar@cisco.com> Change-Id: I0a2c1cbbe798ddf9d08da78bf0b458a0f54fa13a
Diffstat (limited to 'src/vat')
-rw-r--r--src/vat/api_format.c403
1 files changed, 0 insertions, 403 deletions
diff --git a/src/vat/api_format.c b/src/vat/api_format.c
index 8df56aee474..e92eee3bab8 100644
--- a/src/vat/api_format.c
+++ b/src/vat/api_format.c
@@ -1508,74 +1508,6 @@ static void vl_api_bridge_flags_reply_t_handler_json
}
static void
-vl_api_tap_create_v2_reply_t_handler (vl_api_tap_create_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;
- }
-
-}
-
-static void vl_api_tap_create_v2_reply_t_handler_json
- (vl_api_tap_create_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_tap_delete_v2_reply_t_handler (vl_api_tap_delete_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->result_ready = 1;
- }
-}
-
-static void vl_api_tap_delete_v2_reply_t_handler_json
- (vl_api_tap_delete_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_print (vam->ofp, &node);
- vat_json_free (&node);
-
- vam->retval = ntohl (mp->retval);
- vam->result_ready = 1;
-}
-
-static void
vl_api_virtio_pci_create_reply_t_handler (vl_api_virtio_pci_create_reply_t *
mp)
{
@@ -2152,9 +2084,6 @@ _(L2FIB_FLUSH_INT_REPLY, l2fib_flush_int_reply) \
_(L2FIB_FLUSH_BD_REPLY, l2fib_flush_bd_reply) \
_(L2_FLAGS_REPLY, l2_flags_reply) \
_(BRIDGE_FLAGS_REPLY, bridge_flags_reply) \
-_(TAP_CREATE_V2_REPLY, tap_create_v2_reply) \
-_(TAP_DELETE_V2_REPLY, tap_delete_v2_reply) \
-_(SW_INTERFACE_TAP_V2_DETAILS, sw_interface_tap_v2_details) \
_(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) \
@@ -3967,248 +3896,6 @@ api_bd_ip_mac_dump (vat_main_t * vam)
return ret;
}
-static int
-api_tap_create_v2 (vat_main_t * vam)
-{
- unformat_input_t *i = vam->input;
- vl_api_tap_create_v2_t *mp;
- u8 mac_address[6];
- u8 random_mac = 1;
- u32 id = ~0;
- u32 num_rx_queues = 0;
- u8 *host_if_name = 0;
- u8 host_if_name_set = 0;
- u8 *host_ns = 0;
- u8 host_ns_set = 0;
- u8 host_mac_addr[6];
- u8 host_mac_addr_set = 0;
- u8 *host_bridge = 0;
- u8 host_bridge_set = 0;
- u8 host_ip4_prefix_set = 0;
- u8 host_ip6_prefix_set = 0;
- ip4_address_t host_ip4_addr;
- ip4_address_t host_ip4_gw;
- u8 host_ip4_gw_set = 0;
- u32 host_ip4_prefix_len = 0;
- ip6_address_t host_ip6_addr;
- ip6_address_t host_ip6_gw;
- u8 host_ip6_gw_set = 0;
- u32 host_ip6_prefix_len = 0;
- u32 host_mtu_size = 0;
- u8 host_mtu_set = 0;
- u32 tap_flags = 0;
- int ret;
- u32 rx_ring_sz = 0, tx_ring_sz = 0;
-
- clib_memset (mac_address, 0, sizeof (mac_address));
-
- /* Parse args required to build the message */
- while (unformat_check_input (i) != UNFORMAT_END_OF_INPUT)
- {
- if (unformat (i, "id %u", &id))
- ;
- else
- if (unformat
- (i, "hw-addr %U", unformat_ethernet_address, mac_address))
- random_mac = 0;
- else if (unformat (i, "host-if-name %s", &host_if_name))
- host_if_name_set = 1;
- else if (unformat (i, "num-rx-queues %u", &num_rx_queues))
- ;
- else if (unformat (i, "host-ns %s", &host_ns))
- host_ns_set = 1;
- else if (unformat (i, "host-mac-addr %U", unformat_ethernet_address,
- host_mac_addr))
- host_mac_addr_set = 1;
- else if (unformat (i, "host-bridge %s", &host_bridge))
- host_bridge_set = 1;
- else if (unformat (i, "host-ip4-addr %U/%u", unformat_ip4_address,
- &host_ip4_addr, &host_ip4_prefix_len))
- host_ip4_prefix_set = 1;
- else if (unformat (i, "host-ip6-addr %U/%u", unformat_ip6_address,
- &host_ip6_addr, &host_ip6_prefix_len))
- host_ip6_prefix_set = 1;
- else if (unformat (i, "host-ip4-gw %U", unformat_ip4_address,
- &host_ip4_gw))
- host_ip4_gw_set = 1;
- else if (unformat (i, "host-ip6-gw %U", unformat_ip6_address,
- &host_ip6_gw))
- host_ip6_gw_set = 1;
- else if (unformat (i, "rx-ring-size %u", &rx_ring_sz))
- ;
- else if (unformat (i, "tx-ring-size %u", &tx_ring_sz))
- ;
- else if (unformat (i, "host-mtu-size %u", &host_mtu_size))
- host_mtu_set = 1;
- else if (unformat (i, "no-gso"))
- tap_flags &= ~TAP_API_FLAG_GSO;
- else if (unformat (i, "gso"))
- tap_flags |= TAP_API_FLAG_GSO;
- else if (unformat (i, "csum-offload"))
- tap_flags |= TAP_API_FLAG_CSUM_OFFLOAD;
- else if (unformat (i, "persist"))
- tap_flags |= TAP_API_FLAG_PERSIST;
- else if (unformat (i, "attach"))
- tap_flags |= TAP_API_FLAG_ATTACH;
- else if (unformat (i, "tun"))
- tap_flags |= TAP_API_FLAG_TUN;
- else if (unformat (i, "gro-coalesce"))
- tap_flags |= TAP_API_FLAG_GRO_COALESCE;
- else if (unformat (i, "packed"))
- tap_flags |= TAP_API_FLAG_PACKED;
- else if (unformat (i, "in-order"))
- tap_flags |= TAP_API_FLAG_IN_ORDER;
- else
- break;
- }
-
- if (vec_len (host_if_name) > 63)
- {
- errmsg ("tap name too long. ");
- return -99;
- }
- if (vec_len (host_ns) > 63)
- {
- errmsg ("host name space too long. ");
- return -99;
- }
- if (vec_len (host_bridge) > 63)
- {
- errmsg ("host bridge name too long. ");
- return -99;
- }
- if (host_ip4_prefix_len > 32)
- {
- errmsg ("host ip4 prefix length not valid. ");
- return -99;
- }
- if (host_ip6_prefix_len > 128)
- {
- errmsg ("host ip6 prefix length not valid. ");
- return -99;
- }
- if (!is_pow2 (rx_ring_sz))
- {
- errmsg ("rx ring size must be power of 2. ");
- return -99;
- }
- if (rx_ring_sz > 32768)
- {
- errmsg ("rx ring size must be 32768 or lower. ");
- return -99;
- }
- if (!is_pow2 (tx_ring_sz))
- {
- errmsg ("tx ring size must be power of 2. ");
- return -99;
- }
- if (tx_ring_sz > 32768)
- {
- errmsg ("tx ring size must be 32768 or lower. ");
- return -99;
- }
- if (host_mtu_set && (host_mtu_size < 64 || host_mtu_size > 65355))
- {
- errmsg ("host MTU size must be in between 64 and 65355. ");
- return -99;
- }
-
- /* Construct the API message */
- M (TAP_CREATE_V2, mp);
-
- mp->id = ntohl (id);
- mp->use_random_mac = random_mac;
- mp->num_rx_queues = (u8) num_rx_queues;
- mp->tx_ring_sz = ntohs (tx_ring_sz);
- mp->rx_ring_sz = ntohs (rx_ring_sz);
- mp->host_mtu_set = host_mtu_set;
- mp->host_mtu_size = ntohl (host_mtu_size);
- mp->host_mac_addr_set = host_mac_addr_set;
- mp->host_ip4_prefix_set = host_ip4_prefix_set;
- mp->host_ip6_prefix_set = host_ip6_prefix_set;
- mp->host_ip4_gw_set = host_ip4_gw_set;
- mp->host_ip6_gw_set = host_ip6_gw_set;
- mp->tap_flags = ntohl (tap_flags);
- mp->host_namespace_set = host_ns_set;
- mp->host_if_name_set = host_if_name_set;
- mp->host_bridge_set = host_bridge_set;
-
- if (random_mac == 0)
- clib_memcpy (mp->mac_address, mac_address, 6);
- if (host_mac_addr_set)
- clib_memcpy (mp->host_mac_addr, host_mac_addr, 6);
- if (host_if_name_set)
- clib_memcpy (mp->host_if_name, host_if_name, vec_len (host_if_name));
- if (host_ns_set)
- clib_memcpy (mp->host_namespace, host_ns, vec_len (host_ns));
- if (host_bridge_set)
- clib_memcpy (mp->host_bridge, host_bridge, vec_len (host_bridge));
- if (host_ip4_prefix_set)
- {
- clib_memcpy (mp->host_ip4_prefix.address, &host_ip4_addr, 4);
- mp->host_ip4_prefix.len = (u8) host_ip4_prefix_len;
- }
- if (host_ip6_prefix_set)
- {
- clib_memcpy (mp->host_ip6_prefix.address, &host_ip6_addr, 16);
- mp->host_ip6_prefix.len = (u8) host_ip6_prefix_len;
- }
- if (host_ip4_gw_set)
- clib_memcpy (mp->host_ip4_gw, &host_ip4_gw, 4);
- if (host_ip6_gw_set)
- clib_memcpy (mp->host_ip6_gw, &host_ip6_gw, 16);
-
- vec_free (host_ns);
- vec_free (host_if_name);
- vec_free (host_bridge);
-
- /* send it... */
- S (mp);
-
- /* Wait for a reply... */
- W (ret);
- return ret;
-}
-
-static int
-api_tap_delete_v2 (vat_main_t * vam)
-{
- unformat_input_t *i = vam->input;
- vl_api_tap_delete_v2_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 (TAP_DELETE_V2, mp);
-
- mp->sw_if_index = ntohl (sw_if_index);
-
- /* send it... */
- S (mp);
-
- /* Wait for a reply... */
- W (ret);
- return ret;
-}
-
uword
unformat_vlib_pci_addr (unformat_input_t * input, va_list * args)
{
@@ -6803,91 +6490,6 @@ api_add_node_next (vat_main_t * vam)
return ret;
}
-static void vl_api_sw_interface_tap_v2_details_t_handler
- (vl_api_sw_interface_tap_v2_details_t * mp)
-{
- vat_main_t *vam = &vat_main;
-
- u8 *ip4 =
- format (0, "%U/%d", format_ip4_address, mp->host_ip4_prefix.address,
- mp->host_ip4_prefix.len);
- u8 *ip6 =
- format (0, "%U/%d", format_ip6_address, mp->host_ip6_prefix.address,
- mp->host_ip6_prefix.len);
-
- print (vam->ofp,
- "\n%-16s %-12d %-5d %-12d %-12d %-14U %-30s %-20s %-20s %-30s 0x%-08x",
- mp->dev_name, ntohl (mp->sw_if_index), ntohl (mp->id),
- ntohs (mp->rx_ring_sz), ntohs (mp->tx_ring_sz),
- format_ethernet_address, mp->host_mac_addr, mp->host_namespace,
- mp->host_bridge, ip4, ip6, ntohl (mp->tap_flags));
-
- vec_free (ip4);
- vec_free (ip6);
-}
-
-static void vl_api_sw_interface_tap_v2_details_t_handler_json
- (vl_api_sw_interface_tap_v2_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, "id", ntohl (mp->id));
- vat_json_object_add_uint (node, "sw_if_index", ntohl (mp->sw_if_index));
- vat_json_object_add_uint (node, "tap_flags", ntohl (mp->tap_flags));
- vat_json_object_add_string_copy (node, "dev_name", mp->dev_name);
- vat_json_object_add_uint (node, "rx_ring_sz", ntohs (mp->rx_ring_sz));
- vat_json_object_add_uint (node, "tx_ring_sz", ntohs (mp->tx_ring_sz));
- vat_json_object_add_string_copy (node, "host_mac_addr",
- format (0, "%U", format_ethernet_address,
- &mp->host_mac_addr));
- vat_json_object_add_string_copy (node, "host_namespace",
- mp->host_namespace);
- vat_json_object_add_string_copy (node, "host_bridge", mp->host_bridge);
- vat_json_object_add_string_copy (node, "host_ip4_addr",
- format (0, "%U/%d", format_ip4_address,
- mp->host_ip4_prefix.address,
- mp->host_ip4_prefix.len));
- vat_json_object_add_string_copy (node, "host_ip6_prefix",
- format (0, "%U/%d", format_ip6_address,
- mp->host_ip6_prefix.address,
- mp->host_ip6_prefix.len));
-
-}
-
-static int
-api_sw_interface_tap_v2_dump (vat_main_t * vam)
-{
- vl_api_sw_interface_tap_v2_dump_t *mp;
- vl_api_control_ping_t *mp_ping;
- int ret;
-
- print (vam->ofp,
- "\n%-16s %-12s %-5s %-12s %-12s %-14s %-30s %-20s %-20s %-30s",
- "dev_name", "sw_if_index", "id", "rx_ring_sz", "tx_ring_sz",
- "host_mac_addr", "host_namespace", "host_bridge", "host_ip4_addr",
- "host_ip6_addr");
-
- /* Get list of tap interfaces */
- M (SW_INTERFACE_TAP_V2_DUMP, mp);
- 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_interface_virtio_pci_details_t_handler
(vl_api_sw_interface_virtio_pci_details_t * mp)
{
@@ -10323,11 +9925,6 @@ _(l2_flags, \
"sw_if <intfc> | sw_if_index <id> [learn] [forward] [uu-flood] [flood] [arp-term] [disable]\n") \
_(bridge_flags, \
"bd_id <bridge-domain-id> [learn] [forward] [uu-flood] [flood] [arp-term] [disable]\n") \
-_(tap_create_v2, \
- "id <num> [hw-addr <mac-addr>] [host-if-name <name>] [host-ns <name>] [num-rx-queues <num>] [rx-ring-size <num>] [tx-ring-size <num>] [host-bridge <name>] [host-mac-addr <mac-addr>] [host-ip4-addr <ip4addr/mask>] [host-ip6-addr <ip6addr/mask>] [host-mtu-size <mtu>] [gso | no-gso | csum-offload | gro-coalesce] [persist] [attach] [tun] [packed] [in-order]") \
-_(tap_delete_v2, \
- "<vpp-if-name> | sw_if_index <id>") \
-_(sw_interface_tap_v2_dump, "") \
_(virtio_pci_create_v2, \
"pci-addr <pci-address> [use_random_mac | hw-addr <mac-addr>] [features <hex-value>] [gso-enabled [gro-coalesce] | csum-offload-enabled] [packed] [in-order] [buffering]") \
_(virtio_pci_delete, \