/*
 * 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 = "1.0.0";

/** \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 as unsigned 32bit integer:
                      0-15 domain, 16-23 bus, 24-28 slot, 29-31 function
    @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 features - the virtio features which driver should negotiate with device
*/
define virtio_pci_create
{
  u32 client_index;
  u32 context;
  u32 pci_addr;
  u8 use_random_mac;
  u8 mac_address[6];
  u8 gso_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;
  u32 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;
  u32 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 as unsigned 32bit integer:
                      0-15 domain, 16-23 bus, 24-28 slot, 29-31 function
    @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;
  u32 sw_if_index;
  u32 pci_addr;
  u8 mac_addr[6];
  u16 tx_ring_sz;
  u16 rx_ring_sz;
  u64 features;
};

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