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"))
60 .path =
"create interface virtio",
61 .short_help =
"create interface virtio <pci-address> " 62 "[feature-mask <hex-mask>] [gso-enabled]",
84 if (
unformat (line_input,
"sw_if_index %d", &sw_if_index))
95 if (sw_if_index == ~0)
97 "please specify interface name or sw_if_index");
113 .path =
"delete interface virtio",
114 .short_help =
"delete interface virtio " 115 "{<interface> | sw_if_index <sw_idx>}",
128 u32 hw_if_index, *hw_if_indices = 0;
130 u8 show_descr = 0, show_device_config = 0;
144 vec_add1 (hw_if_indices, hw_if_index);
148 else if (
unformat (input,
"debug-device"))
149 show_device_config = 1;
158 if (
vec_len (hw_if_indices) == 0)
164 else if (show_device_config)
180 .path =
"show virtio pci",
181 .short_help =
"show virtio pci [<interface>] [descriptors | desc] [debug-device]",
unformat_function_t unformat_vnet_hw_interface
vlib_log_class_t vlib_log_register_class(char *class, char *subclass)
void virtio_show(vlib_main_t *vm, u32 *hw_if_indices, u8 show_descr, u32 type)
vnet_main_t * vnet_get_main(void)
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).
static clib_error_t * show_virtio_pci_fn(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
unformat_function_t unformat_vnet_sw_interface
void virtio_pci_create_if(vlib_main_t *vm, virtio_pci_create_if_args_t *args)
#define pool_foreach(VAR, POOL, BODY)
Iterate through pool.
vl_api_interface_index_t sw_if_index
#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_delete_command_fn(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
#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)
void debug_device_config_space(vlib_main_t *vm, virtio_if_t *vif)
vlib_log_class_t log_default
#define VLIB_CLI_COMMAND(x,...)
int virtio_pci_delete_if(vlib_main_t *vm, virtio_if_t *vif)
static clib_error_t * virtio_pci_create_command_fn(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
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)