Damjan Marion | 8389fb9 | 2017-10-13 18:29:53 +0200 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (c) 2017 Cisco and/or its affiliates. |
| 3 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 4 | * you may not use this file except in compliance with the License. |
| 5 | * You may obtain a copy of the License at: |
| 6 | * |
| 7 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 8 | * |
| 9 | * Unless required by applicable law or agreed to in writing, software |
| 10 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 12 | * See the License for the specific language governing permissions and |
| 13 | * limitations under the License. |
| 14 | */ |
| 15 | |
| 16 | /** \file |
| 17 | |
| 18 | This file defines vpe control-plane API messages for |
| 19 | the Linux kernel TAP device driver |
| 20 | */ |
| 21 | |
Mohsin Kazmi | d88fc0f | 2020-04-30 19:05:56 +0200 | [diff] [blame] | 22 | option version = "4.0.0"; |
Jakub Grajciar | 5de4fb7 | 2019-09-03 10:40:01 +0200 | [diff] [blame] | 23 | |
| 24 | import "vnet/interface_types.api"; |
| 25 | import "vnet/ethernet/ethernet_types.api"; |
| 26 | import "vnet/ip/ip_types.api"; |
| 27 | |
| 28 | enum tap_flags { |
Mohsin Kazmi | d88fc0f | 2020-04-30 19:05:56 +0200 | [diff] [blame] | 29 | TAP_API_FLAG_GSO = 1, /* enable gso on the interface */ |
| 30 | TAP_API_FLAG_CSUM_OFFLOAD = 2, /* enable checksum offload without gso on the interface */ |
| 31 | TAP_API_FLAG_PERSIST = 4, /* make the interface persistence to exist in linux even vpp crash/restart */ |
| 32 | TAP_API_FLAG_ATTACH = 8, /* attach to the existing persistence interface after vpp crash/restart */ |
| 33 | TAP_API_FLAG_TUN = 16, /* create TUN interface instead of tap */ |
| 34 | TAP_API_FLAG_GRO_COALESCE = 32, /* enable packet coalescing on tx side, provided gso enabled */ |
Jakub Grajciar | 5de4fb7 | 2019-09-03 10:40:01 +0200 | [diff] [blame] | 35 | }; |
Damjan Marion | 8389fb9 | 2017-10-13 18:29:53 +0200 | [diff] [blame] | 36 | |
Paul Vinciguerra | 97c998c | 2019-10-29 16:11:09 -0400 | [diff] [blame] | 37 | /** \brief Initialize a new tap interface with the given parameters |
Damjan Marion | 8389fb9 | 2017-10-13 18:29:53 +0200 | [diff] [blame] | 38 | @param client_index - opaque cookie to identify the sender |
| 39 | @param context - sender context, to match reply w/ request |
Ian Wells | d600ffe | 2018-06-18 13:53:17 -0700 | [diff] [blame] | 40 | @param id - interface id, 0xffffffff means auto |
Damjan Marion | 8389fb9 | 2017-10-13 18:29:53 +0200 | [diff] [blame] | 41 | @param use_random_mac - let the system generate a unique mac address |
Paul Vinciguerra | 97c998c | 2019-10-29 16:11:09 -0400 | [diff] [blame] | 42 | @param mac_address - mac addr to assign to the interface if use_random not set |
Jakub Grajciar | 5de4fb7 | 2019-09-03 10:40:01 +0200 | [diff] [blame] | 43 | @param num_rx_queues - number of rx queues |
Paul Vinciguerra | 073d74d | 2020-04-27 01:12:48 -0400 | [diff] [blame] | 44 | @param tx_ring_sz - the number of entries of TX ring, optional, default is 256 entries, must be power of 2 |
| 45 | @param rx_ring_sz - the number of entries of RX ring, optional, default is 256 entries, must be power of 2 |
Jakub Grajciar | 5de4fb7 | 2019-09-03 10:40:01 +0200 | [diff] [blame] | 46 | @param host_mtu_set - host MTU should be set |
| 47 | @param host_mtu_size - host MTU size |
Damjan Marion | 2df3909 | 2017-12-04 20:03:37 +0100 | [diff] [blame] | 48 | @param host_mac_addr_set - host side interface mac address should be set |
| 49 | @param host_mac_addr - host side interface mac address |
Jakub Grajciar | 5de4fb7 | 2019-09-03 10:40:01 +0200 | [diff] [blame] | 50 | @param host_ip4_prefix_set - host IPv4 ip address should be set |
| 51 | @param host_ip4_prefix - host IPv4 ip address |
| 52 | @param host_ip6_prefix_set - host IPv6 ip address should be set |
| 53 | @param host_ip6_prefix - host IPv6 ip address |
Damjan Marion | 7866c45 | 2018-01-18 13:35:11 +0100 | [diff] [blame] | 54 | @param host_ip4_gw_set - host IPv4 default gateway should be set |
| 55 | @param host_ip4_gw - host IPv4 default gateway |
| 56 | @param host_ip6_gw_set - host IPv6 default gateway should be set |
| 57 | @param host_ip6_gw - host IPv6 default gateway |
Andrew Yourtchenko | 754f24b | 2019-01-07 20:56:46 +0100 | [diff] [blame] | 58 | @param tap_flags - flags for the TAP interface creation |
Jakub Grajciar | 5de4fb7 | 2019-09-03 10:40:01 +0200 | [diff] [blame] | 59 | @param host_if_name_set - host side interface name should be set |
| 60 | @param host_if_name - host side interface name |
Paul Vinciguerra | 073d74d | 2020-04-27 01:12:48 -0400 | [diff] [blame] | 61 | @param host_namespace_set - host namespace should be set |
Jakub Grajciar | 5de4fb7 | 2019-09-03 10:40:01 +0200 | [diff] [blame] | 62 | @param host_namespace - host namespace to attach interface to |
| 63 | @param host_bridge_set - host bridge should be set |
| 64 | @param host_bridge - host bridge to attach interface to |
| 65 | @param tag - tag |
Damjan Marion | 8389fb9 | 2017-10-13 18:29:53 +0200 | [diff] [blame] | 66 | */ |
| 67 | define tap_create_v2 |
| 68 | { |
| 69 | u32 client_index; |
| 70 | u32 context; |
Jakub Grajciar | 5de4fb7 | 2019-09-03 10:40:01 +0200 | [diff] [blame] | 71 | u32 id [default=0xffffffff]; |
| 72 | bool use_random_mac [default=true]; |
| 73 | vl_api_mac_address_t mac_address; |
| 74 | u8 num_rx_queues [default=1]; |
Paul Vinciguerra | 073d74d | 2020-04-27 01:12:48 -0400 | [diff] [blame] | 75 | u16 tx_ring_sz [default=256]; |
| 76 | u16 rx_ring_sz [default=256]; |
Jakub Grajciar | 5de4fb7 | 2019-09-03 10:40:01 +0200 | [diff] [blame] | 77 | bool host_mtu_set; |
Mohsin Kazmi | 97d54ed | 2019-06-10 11:20:15 +0200 | [diff] [blame] | 78 | u32 host_mtu_size; |
Jakub Grajciar | 5de4fb7 | 2019-09-03 10:40:01 +0200 | [diff] [blame] | 79 | bool host_mac_addr_set; |
| 80 | vl_api_mac_address_t host_mac_addr; |
| 81 | bool host_ip4_prefix_set; |
| 82 | vl_api_ip4_address_with_prefix_t host_ip4_prefix; |
| 83 | bool host_ip6_prefix_set; |
| 84 | vl_api_ip6_address_with_prefix_t host_ip6_prefix; |
| 85 | bool host_ip4_gw_set; |
| 86 | vl_api_ip4_address_t host_ip4_gw; |
| 87 | bool host_ip6_gw_set; |
| 88 | vl_api_ip6_address_t host_ip6_gw; |
| 89 | vl_api_tap_flags_t tap_flags; |
| 90 | bool host_namespace_set; |
| 91 | string host_namespace[64]; |
| 92 | bool host_if_name_set; |
| 93 | string host_if_name[64]; |
| 94 | bool host_bridge_set; |
| 95 | string host_bridge[64]; |
| 96 | string tag[]; |
Damjan Marion | 8389fb9 | 2017-10-13 18:29:53 +0200 | [diff] [blame] | 97 | }; |
| 98 | |
| 99 | /** \brief Reply for tap create reply |
| 100 | @param context - returned sender context, to match reply w/ request |
| 101 | @param retval - return code |
| 102 | @param sw_if_index - software index allocated for the new tap interface |
| 103 | */ |
| 104 | define tap_create_v2_reply |
| 105 | { |
| 106 | u32 context; |
| 107 | i32 retval; |
Jakub Grajciar | 5de4fb7 | 2019-09-03 10:40:01 +0200 | [diff] [blame] | 108 | vl_api_interface_index_t sw_if_index; |
Damjan Marion | 8389fb9 | 2017-10-13 18:29:53 +0200 | [diff] [blame] | 109 | }; |
| 110 | |
| 111 | /** \brief Delete tap interface |
| 112 | @param client_index - opaque cookie to identify the sender |
| 113 | @param context - sender context, to match reply w/ request |
| 114 | @param sw_if_index - interface index of existing tap interface |
| 115 | */ |
| 116 | autoreply define tap_delete_v2 |
| 117 | { |
| 118 | u32 client_index; |
| 119 | u32 context; |
Jakub Grajciar | 5de4fb7 | 2019-09-03 10:40:01 +0200 | [diff] [blame] | 120 | vl_api_interface_index_t sw_if_index; |
Damjan Marion | 8389fb9 | 2017-10-13 18:29:53 +0200 | [diff] [blame] | 121 | }; |
| 122 | |
Jakub Grajciar | 5de4fb7 | 2019-09-03 10:40:01 +0200 | [diff] [blame] | 123 | /** \brief Dump tap interfaces request |
Paul Vinciguerra | 073d74d | 2020-04-27 01:12:48 -0400 | [diff] [blame] | 124 | @param sw_if_index - filter by sw_if_index |
Jakub Grajciar | 5de4fb7 | 2019-09-03 10:40:01 +0200 | [diff] [blame] | 125 | */ |
Damjan Marion | 8389fb9 | 2017-10-13 18:29:53 +0200 | [diff] [blame] | 126 | define sw_interface_tap_v2_dump |
| 127 | { |
| 128 | u32 client_index; |
| 129 | u32 context; |
Jakub Grajciar | 5de4fb7 | 2019-09-03 10:40:01 +0200 | [diff] [blame] | 130 | vl_api_interface_index_t sw_if_index [default=0xffffffff]; |
Damjan Marion | 8389fb9 | 2017-10-13 18:29:53 +0200 | [diff] [blame] | 131 | }; |
| 132 | |
| 133 | /** \brief Reply for tap dump request |
| 134 | @param sw_if_index - software index of tap interface |
Milan Lenco | 73e7f42 | 2017-12-14 10:04:25 +0100 | [diff] [blame] | 135 | @param id - interface id |
Milan Lenco | 73e7f42 | 2017-12-14 10:04:25 +0100 | [diff] [blame] | 136 | @param tx_ring_sz - the number of entries of TX ring |
| 137 | @param rx_ring_sz - the number of entries of RX ring |
Jakub Grajciar | 5de4fb7 | 2019-09-03 10:40:01 +0200 | [diff] [blame] | 138 | @param host_mtu_size - host mtu size |
Milan Lenco | 73e7f42 | 2017-12-14 10:04:25 +0100 | [diff] [blame] | 139 | @param host_mac_addr - mac address assigned to the host side of the interface |
Jakub Grajciar | 5de4fb7 | 2019-09-03 10:40:01 +0200 | [diff] [blame] | 140 | @param host_ip4_prefix - host IPv4 ip address |
| 141 | @param host_ip6_prefix - host IPv6 ip address |
| 142 | @param tap_flags - flags for the TAP interface creation |
| 143 | @param dev_name - Linux tap device name |
Milan Lenco | 73e7f42 | 2017-12-14 10:04:25 +0100 | [diff] [blame] | 144 | @param host_if_name - host side interface name |
| 145 | @param host_namespace - host namespace the interface is attached into |
| 146 | @param host_bridge - host bridge the interface is attached into |
Damjan Marion | 8389fb9 | 2017-10-13 18:29:53 +0200 | [diff] [blame] | 147 | */ |
| 148 | define sw_interface_tap_v2_details |
| 149 | { |
| 150 | u32 context; |
| 151 | u32 sw_if_index; |
Milan Lenco | 73e7f42 | 2017-12-14 10:04:25 +0100 | [diff] [blame] | 152 | u32 id; |
Milan Lenco | 73e7f42 | 2017-12-14 10:04:25 +0100 | [diff] [blame] | 153 | u16 tx_ring_sz; |
| 154 | u16 rx_ring_sz; |
Mohsin Kazmi | 97d54ed | 2019-06-10 11:20:15 +0200 | [diff] [blame] | 155 | u32 host_mtu_size; |
Jakub Grajciar | 5de4fb7 | 2019-09-03 10:40:01 +0200 | [diff] [blame] | 156 | vl_api_mac_address_t host_mac_addr; |
| 157 | vl_api_ip4_address_with_prefix_t host_ip4_prefix; |
| 158 | vl_api_ip6_address_with_prefix_t host_ip6_prefix; |
| 159 | vl_api_tap_flags_t tap_flags; |
| 160 | string dev_name[64]; |
| 161 | string host_if_name[64]; |
| 162 | string host_namespace[64]; |
| 163 | string host_bridge[64]; |
Damjan Marion | 8389fb9 | 2017-10-13 18:29:53 +0200 | [diff] [blame] | 164 | }; |
| 165 | |
| 166 | /* |
| 167 | * Local Variables: |
| 168 | * eval: (c-set-style "gnu") |
| 169 | * End: |
| 170 | */ |