32 u64 feature_mask = (
u64) ~ (0ULL);
33 u32 buffering_size = 0;
39 memset (&args, 0,
sizeof (args));
44 else if (
unformat (line_input,
"feature-mask 0x%llx", &feature_mask))
46 else if (
unformat (line_input,
"gso-enabled"))
48 else if (
unformat (line_input,
"csum-enabled"))
50 else if (
unformat (line_input,
"buffering"))
53 if (
unformat (line_input,
"size %u", &buffering_size))
56 else if (
unformat (line_input,
"packed"))
71 .path =
"create interface virtio",
72 .short_help =
"create interface virtio <pci-address> " 73 "[feature-mask <hex-mask>] [gso-enabled] [csum-enabled] " 74 "[buffering [size <buffering-szie>]] [packed]",
96 if (
unformat (line_input,
"sw_if_index %d", &sw_if_index))
107 if (sw_if_index == ~0)
109 "please specify interface name or sw_if_index");
125 .path =
"delete interface virtio",
126 .short_help =
"delete interface virtio " 127 "{<interface> | sw_if_index <sw_idx>}",
142 int gso_enabled = 0, checksum_offload_enabled = 0;
143 int offloads_disabled = 0;
151 if (
unformat (line_input,
"sw_if_index %d", &sw_if_index))
156 else if (
unformat (line_input,
"gso-enabled"))
158 else if (
unformat (line_input,
"csum-offload-enabled"))
159 checksum_offload_enabled = 1;
160 else if (
unformat (line_input,
"offloads-disabled"))
161 offloads_disabled = 1;
168 if (sw_if_index == ~0)
170 "please specify interface name or sw_if_index");
179 (vm, vif, gso_enabled, checksum_offload_enabled, offloads_disabled) < 0)
187 .path =
"set virtio pci",
188 .short_help =
"set virtio pci {<interface> | sw_if_index <sw_idx>}" 189 " [gso-enabled | csum-offload-enabled | offloads-disabled]",
202 u32 hw_if_index, *hw_if_indices = 0;
204 u8 show_descr = 0, show_device_config = 0;
218 vec_add1 (hw_if_indices, hw_if_index);
222 else if (
unformat (input,
"debug-device"))
223 show_device_config = 1;
232 if (
vec_len (hw_if_indices) == 0)
237 else if (show_device_config)
240 if (vif->
type == VIRTIO_IF_TYPE_PCI)
244 virtio_show (vm, hw_if_indices, show_descr, VIRTIO_IF_TYPE_PCI);
253 .path =
"show virtio pci",
254 .short_help =
"show virtio pci [<interface>] [descriptors | desc] [debug-device]",
unformat_function_t unformat_vnet_hw_interface
static clib_error_t * virtio_pci_delete_command_fn(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
void virtio_show(vlib_main_t *vm, u32 *hw_if_indices, u8 show_descr, u32 type)
vnet_main_t * vnet_get_main(void)
#define pool_foreach(VAR, POOL)
Iterate through pool.
const virtio_pci_func_t * virtio_pci_func
static vnet_hw_interface_t * vnet_get_hw_interface(vnet_main_t *vnm, u32 hw_if_index)
vnet_device_class_t virtio_device_class
#define vec_add1(V, E)
Add 1 element to end of vector (unspecified alignment).
unformat_function_t unformat_vnet_sw_interface
void virtio_pci_create_if(vlib_main_t *vm, virtio_pci_create_if_args_t *args)
static clib_error_t * virtio_pci_enable_command_fn(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
#define VLIB_INIT_FUNCTION(x)
#define clib_error_return(e, args...)
#define pool_elt_at_index(p, i)
Returns pointer to element at given index.
unformat_function_t unformat_vlib_pci_addr
static clib_error_t * virtio_pci_create_command_fn(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
int virtio_pci_enable_disable_offloads(vlib_main_t *vm, virtio_if_t *vif, int gso_enabled, int checksum_offload_enabled, int offloads_disabled)
u8 checksum_offload_enabled
#define vec_free(V)
Free vector's memory (no header).
static vnet_hw_interface_t * vnet_get_sup_hw_interface_api_visible_or_null(vnet_main_t *vnm, u32 sw_if_index)
static clib_error_t * show_virtio_pci_fn(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
#define VLIB_CLI_COMMAND(x,...)
int virtio_pci_delete_if(vlib_main_t *vm, virtio_if_t *vif)
virtio_main_t virtio_main
#define vec_len(v)
Number of elements in vector (rvalue-only, NULL tolerant)
clib_error_t * virtio_pci_cli_init(vlib_main_t *vm)
vl_api_interface_index_t sw_if_index