32 u64 feature_mask = (
u64) ~ (0ULL);
38 memset (&args, 0,
sizeof (args));
43 else if (
unformat (line_input,
"feature-mask 0x%llx", &feature_mask))
45 else if (
unformat (line_input,
"gso-enabled"))
47 else if (
unformat (line_input,
"csum-enabled"))
62 .path =
"create interface virtio",
63 .short_help =
"create interface virtio <pci-address> " 64 "[feature-mask <hex-mask>] [gso-enabled] [csum-enabled]",
86 if (
unformat (line_input,
"sw_if_index %d", &sw_if_index))
97 if (sw_if_index == ~0)
99 "please specify interface name or sw_if_index");
115 .path =
"delete interface virtio",
116 .short_help =
"delete interface virtio " 117 "{<interface> | sw_if_index <sw_idx>}",
132 int gso_enabled = 0, checksum_offload_enabled = 0;
133 int offloads_disabled = 0;
141 if (
unformat (line_input,
"sw_if_index %d", &sw_if_index))
146 else if (
unformat (line_input,
"gso-enabled"))
148 else if (
unformat (line_input,
"csum-offload-enabled"))
149 checksum_offload_enabled = 1;
150 else if (
unformat (line_input,
"offloads-disabled"))
151 offloads_disabled = 1;
158 if (sw_if_index == ~0)
160 "please specify interface name or sw_if_index");
169 (vm, vif, gso_enabled, checksum_offload_enabled, offloads_disabled) < 0)
177 .path =
"set virtio pci",
178 .short_help =
"set virtio pci {<interface> | sw_if_index <sw_idx>}" 179 " [gso-enabled | csum-offload-enabled | offloads-disabled]",
192 u32 hw_if_index, *hw_if_indices = 0;
194 u8 show_descr = 0, show_device_config = 0;
208 vec_add1 (hw_if_indices, hw_if_index);
212 else if (
unformat (input,
"debug-device"))
213 show_device_config = 1;
222 if (
vec_len (hw_if_indices) == 0)
228 else if (show_device_config)
231 if (vif->
type == VIRTIO_IF_TYPE_PCI)
235 virtio_show (vm, hw_if_indices, show_descr, VIRTIO_IF_TYPE_PCI);
244 .path =
"show virtio pci",
245 .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)
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 pool_foreach(VAR, POOL, BODY)
Iterate through pool.
#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