/*
 * Copyright (c) 2018 Cisco and/or its affiliates.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at:
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

option version = "2.0.0";

import "vnet/interface_types.api";
import "vnet/ethernet/ethernet_types.api";
import "vnet/pci/pci_types.api";


/** \brief Initialize a new virtio pci interface with the given parameters
    @param client_index - opaque cookie to identify the sender
    @param context - sender context, to match reply w/ request
    @param pci_addr - pci address
    @param use_random_mac - let the system generate a unique mac address
    @param mac_address - mac addr to assign to the interface if use_random not set
    @param gso_enabled - enable gso feature if available, 1 to enable
    @param checksum_offload_enabled - enable checksum feature if available, 1 to enable
    @param features - the virtio features which driver should negotiate with device
*/
define virtio_pci_create
{
  u32 client_index;
  u32 context;
  vl_api_pci_address_t pci_addr;
  bool use_random_mac;
  vl_api_mac_address_t mac_address;
  bool gso_enabled;
  bool checksum_offload_enabled;
  u64 features;
};

/** \brief Reply for virtio pci create reply
    @param context - returned sender context, to match reply w/ request
    @param retval - return code
    @param sw_if_index - software index allocated for the new virtio pci interface
*/
define virtio_pci_create_reply
{
  u32 context;
  i32 retval;
  vl_api_interface_index_t sw_if_index;
};

/** \brief Delete virtio pci interface
    @param client_index - opaque cookie to identify the sender
    @param context - sender context, to match reply w/ request
    @param sw_if_index - interface index of existing virtio pci interface
*/
autoreply define virtio_pci_delete
{
  u32 client_index;
  u32 context;
  vl_api_interface_index_t sw_if_index;
};

/** \brief Dump virtio pci interfaces request */
define sw_interface_virtio_pci_dump
{
  u32 client_index;
  u32 context;
};

/** \brief Reply for virtio pci interface dump request
    @param sw_if_index - software index of virtio pci interface
    @param pci_addr - pci address
    @param mac_addr - native virtio device mac address
    @param tx_ring_sz - the number of entries of TX ring
    @param rx_ring_sz - the number of entries of RX ring
    @param features - the virtio features which driver have negotiated with device
*/
define sw_interface_virtio_pci_details
{
  u32 context;
  vl_api_interface_index_t sw_if_index;
  vl_api_pci_address_t pci_addr;
  vl_api_mac_address_t mac_addr;
  u16 tx_ring_sz;
  u16 rx_ring_sz;
  u64 features;
};

/*
 * Local Variables:
 * eval: (c-set-style "gnu")
 * End:
 */
