Mohsin Kazmi | d6c15af | 2018-10-23 18:00:47 +0200 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (c) 2018 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 | |
Mohsin Kazmi | 518251b | 2020-09-01 17:17:44 +0000 | [diff] [blame] | 16 | option version = "3.0.0"; |
Jakub Grajciar | 2c504f8 | 2019-09-26 10:34:41 +0200 | [diff] [blame] | 17 | |
| 18 | import "vnet/interface_types.api"; |
| 19 | import "vnet/ethernet/ethernet_types.api"; |
Jakub Grajciar | 53f06a0 | 2020-03-30 08:12:57 +0200 | [diff] [blame] | 20 | import "vlib/pci/pci_types.api"; |
Jakub Grajciar | 2c504f8 | 2019-09-26 10:34:41 +0200 | [diff] [blame] | 21 | |
Mohsin Kazmi | d6c15af | 2018-10-23 18:00:47 +0200 | [diff] [blame] | 22 | |
Paul Vinciguerra | 97c998c | 2019-10-29 16:11:09 -0400 | [diff] [blame] | 23 | /** \brief Initialize a new virtio pci interface with the given parameters |
Mohsin Kazmi | d6c15af | 2018-10-23 18:00:47 +0200 | [diff] [blame] | 24 | @param client_index - opaque cookie to identify the sender |
| 25 | @param context - sender context, to match reply w/ request |
Jakub Grajciar | 2c504f8 | 2019-09-26 10:34:41 +0200 | [diff] [blame] | 26 | @param pci_addr - pci address |
Mohsin Kazmi | d6c15af | 2018-10-23 18:00:47 +0200 | [diff] [blame] | 27 | @param use_random_mac - let the system generate a unique mac address |
Paul Vinciguerra | 97c998c | 2019-10-29 16:11:09 -0400 | [diff] [blame] | 28 | @param mac_address - mac addr to assign to the interface if use_random not set |
Mohsin Kazmi | bbd6b74 | 2019-05-02 13:54:59 +0200 | [diff] [blame] | 29 | @param gso_enabled - enable gso feature if available, 1 to enable |
Mohsin Kazmi | 6d4af89 | 2020-01-03 15:11:53 +0000 | [diff] [blame] | 30 | @param checksum_offload_enabled - enable checksum feature if available, 1 to enable |
Mohsin Kazmi | d6c15af | 2018-10-23 18:00:47 +0200 | [diff] [blame] | 31 | @param features - the virtio features which driver should negotiate with device |
| 32 | */ |
| 33 | define virtio_pci_create |
| 34 | { |
Ole Troan | f916414 | 2020-09-15 11:37:16 +0200 | [diff] [blame^] | 35 | option deprecated; |
Mohsin Kazmi | d6c15af | 2018-10-23 18:00:47 +0200 | [diff] [blame] | 36 | u32 client_index; |
| 37 | u32 context; |
Jakub Grajciar | 2c504f8 | 2019-09-26 10:34:41 +0200 | [diff] [blame] | 38 | vl_api_pci_address_t pci_addr; |
| 39 | bool use_random_mac; |
| 40 | vl_api_mac_address_t mac_address; |
| 41 | bool gso_enabled; |
Mohsin Kazmi | 6d4af89 | 2020-01-03 15:11:53 +0000 | [diff] [blame] | 42 | bool checksum_offload_enabled; |
Mohsin Kazmi | d6c15af | 2018-10-23 18:00:47 +0200 | [diff] [blame] | 43 | u64 features; |
| 44 | }; |
| 45 | |
| 46 | /** \brief Reply for virtio pci create reply |
| 47 | @param context - returned sender context, to match reply w/ request |
| 48 | @param retval - return code |
| 49 | @param sw_if_index - software index allocated for the new virtio pci interface |
| 50 | */ |
| 51 | define virtio_pci_create_reply |
| 52 | { |
Ole Troan | f916414 | 2020-09-15 11:37:16 +0200 | [diff] [blame^] | 53 | option deprecated; |
Mohsin Kazmi | 518251b | 2020-09-01 17:17:44 +0000 | [diff] [blame] | 54 | u32 context; |
| 55 | i32 retval; |
| 56 | vl_api_interface_index_t sw_if_index; |
| 57 | }; |
| 58 | |
| 59 | enum virtio_flags { |
| 60 | VIRTIO_API_FLAG_GSO = 1, /* enable gso on the interface */ |
| 61 | VIRTIO_API_FLAG_CSUM_OFFLOAD = 2, /* enable checksum offload without gso on the interface */ |
| 62 | VIRTIO_API_FLAG_GRO_COALESCE = 4, /* enable packet coalescing on tx side, provided gso enabled */ |
| 63 | VIRTIO_API_FLAG_PACKED = 8, /* enable packed ring support, provided it is available from backend */ |
| 64 | VIRTIO_API_FLAG_IN_ORDER = 16, /* enable in order support, provided it is available from backend */ |
| 65 | }; |
| 66 | |
| 67 | /** \brief Initialize a new virtio pci interface with the given parameters |
| 68 | @param client_index - opaque cookie to identify the sender |
| 69 | @param context - sender context, to match reply w/ request |
| 70 | @param pci_addr - pci address |
| 71 | @param use_random_mac - let the system generate a unique mac address |
| 72 | @param mac_address - mac addr to assign to the interface if use_random not set |
| 73 | @param virtio_flags - feature flags to enable |
| 74 | @param features - the virtio features which driver should negotiate with device |
| 75 | */ |
| 76 | define virtio_pci_create_v2 |
| 77 | { |
| 78 | u32 client_index; |
| 79 | u32 context; |
| 80 | vl_api_pci_address_t pci_addr; |
| 81 | bool use_random_mac; |
| 82 | vl_api_mac_address_t mac_address; |
| 83 | vl_api_virtio_flags_t virtio_flags; |
| 84 | u64 features; |
| 85 | }; |
| 86 | |
| 87 | /** \brief Reply for virtio pci create reply |
| 88 | @param context - returned sender context, to match reply w/ request |
| 89 | @param retval - return code |
| 90 | @param sw_if_index - software index allocated for the new virtio pci interface |
| 91 | */ |
| 92 | define virtio_pci_create_v2_reply |
| 93 | { |
Mohsin Kazmi | d6c15af | 2018-10-23 18:00:47 +0200 | [diff] [blame] | 94 | u32 context; |
| 95 | i32 retval; |
Jakub Grajciar | 2c504f8 | 2019-09-26 10:34:41 +0200 | [diff] [blame] | 96 | vl_api_interface_index_t sw_if_index; |
Mohsin Kazmi | d6c15af | 2018-10-23 18:00:47 +0200 | [diff] [blame] | 97 | }; |
| 98 | |
| 99 | /** \brief Delete virtio pci interface |
| 100 | @param client_index - opaque cookie to identify the sender |
| 101 | @param context - sender context, to match reply w/ request |
| 102 | @param sw_if_index - interface index of existing virtio pci interface |
| 103 | */ |
| 104 | autoreply define virtio_pci_delete |
| 105 | { |
| 106 | u32 client_index; |
| 107 | u32 context; |
Jakub Grajciar | 2c504f8 | 2019-09-26 10:34:41 +0200 | [diff] [blame] | 108 | vl_api_interface_index_t sw_if_index; |
Mohsin Kazmi | d6c15af | 2018-10-23 18:00:47 +0200 | [diff] [blame] | 109 | }; |
| 110 | |
| 111 | /** \brief Dump virtio pci interfaces request */ |
| 112 | define sw_interface_virtio_pci_dump |
| 113 | { |
| 114 | u32 client_index; |
| 115 | u32 context; |
| 116 | }; |
| 117 | |
| 118 | /** \brief Reply for virtio pci interface dump request |
| 119 | @param sw_if_index - software index of virtio pci interface |
Jakub Grajciar | 2c504f8 | 2019-09-26 10:34:41 +0200 | [diff] [blame] | 120 | @param pci_addr - pci address |
Mohsin Kazmi | d6c15af | 2018-10-23 18:00:47 +0200 | [diff] [blame] | 121 | @param mac_addr - native virtio device mac address |
| 122 | @param tx_ring_sz - the number of entries of TX ring |
| 123 | @param rx_ring_sz - the number of entries of RX ring |
| 124 | @param features - the virtio features which driver have negotiated with device |
| 125 | */ |
| 126 | define sw_interface_virtio_pci_details |
| 127 | { |
| 128 | u32 context; |
Jakub Grajciar | 2c504f8 | 2019-09-26 10:34:41 +0200 | [diff] [blame] | 129 | vl_api_interface_index_t sw_if_index; |
| 130 | vl_api_pci_address_t pci_addr; |
| 131 | vl_api_mac_address_t mac_addr; |
Mohsin Kazmi | d6c15af | 2018-10-23 18:00:47 +0200 | [diff] [blame] | 132 | u16 tx_ring_sz; |
| 133 | u16 rx_ring_sz; |
| 134 | u64 features; |
| 135 | }; |
| 136 | |
| 137 | /* |
| 138 | * Local Variables: |
| 139 | * eval: (c-set-style "gnu") |
| 140 | * End: |
| 141 | */ |