19 #include <sys/ioctl.h> 28 #include <linux/virtio_net.h> 29 #include <linux/vhost.h> 57 else if (
unformat (line_input,
"host-mac-addr %U",
62 else if (
unformat (line_input,
"host-ip4-addr %U/%d",
66 else if (
unformat (line_input,
"host-ip4-gw %U",
69 else if (
unformat (line_input,
"host-ip6-addr %U/%d",
73 else if (
unformat (line_input,
"host-ip6-gw %U",
84 else if (
unformat (line_input,
"no-gso"))
86 else if (
unformat (line_input,
"gso"))
88 else if (
unformat (line_input,
"hw-addr %U",
121 .path =
"create tap",
122 .short_help =
"create tap {id <if-id>} [hw-addr <mac-address>] " 123 "[rx-ring-size <size>] [tx-ring-size <size>] [host-ns <netns>] " 124 "[host-bridge <bridge-name>] [host-ip4-addr <ip4addr/mask>] " 125 "[host-ip6-addr <ip6-addr>] [host-ip4-gw <ip4-addr>] " 126 "[host-ip6-gw <ip6-addr>] [host-mac-addr <host-mac-address>] " 127 "[host-if-name <name>] [host-mtu-size <size>] [no-gso|gso]",
147 if (
unformat (line_input,
"sw_if_index %d", &sw_if_index))
158 if (sw_if_index == ~0)
160 "please specify interface name or sw_if_index");
163 if (rv == VNET_API_ERROR_INVALID_SW_IF_INDEX)
174 .path =
"delete tap",
175 .short_help =
"delete tap {<interface> | sw_if_index <sw_idx>}",
196 if (
unformat (line_input,
"sw_if_index %d", &sw_if_index))
201 else if (
unformat (line_input,
"enable"))
203 else if (
unformat (line_input,
"disable"))
211 if (sw_if_index == ~0)
213 "please specify interface name or sw_if_index");
216 if (rv == VNET_API_ERROR_INVALID_SW_IF_INDEX)
227 .path =
"set tap gso",
228 .short_help =
"set tap gso {<interface> | sw_if_index <sw_idx>} <enable|disable>",
242 u32 hw_if_index, *hw_if_indices = 0;
248 vec_add1 (hw_if_indices, hw_if_index);
249 else if (
unformat (input,
"descriptors"))
259 if (
vec_len (hw_if_indices) == 0)
278 .short_help =
"show tap {<interface>] [descriptors]",
unformat_function_t unformat_vnet_hw_interface
void virtio_show(vlib_main_t *vm, u32 *hw_if_indices, u8 show_descr, u32 type)
ip4_address_t host_ip4_addr
vnet_main_t * vnet_get_main(void)
int tap_gso_enable_disable(vlib_main_t *vm, u32 sw_if_index, int enable_disable)
static clib_error_t * tap_gso_command_fn(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
static clib_error_t * tap_show_command_fn(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
#define vec_add1(V, E)
Add 1 element to end of vector (unspecified alignment).
unformat_function_t unformat_vnet_sw_interface
format_function_t format_vnet_sw_if_index_name
clib_error_t * tap_cli_init(vlib_main_t *vm)
static clib_error_t * tap_delete_command_fn(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
#define pool_foreach(VAR, POOL, BODY)
Iterate through pool.
vl_api_interface_index_t sw_if_index
#define VLIB_INIT_FUNCTION(x)
int tap_delete_if(vlib_main_t *vm, u32 sw_if_index)
#define clib_error_return(e, args...)
ip4_address_t host_ip4_gw
ip6_address_t host_ip6_addr
#define vec_free(V)
Free vector's memory (no header).
static clib_error_t * tap_create_command_fn(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
#define VLIB_CLI_COMMAND(x,...)
uword unformat_ethernet_address(unformat_input_t *input, va_list *args)
ip6_address_t host_ip6_gw
virtio_main_t virtio_main
void tap_create_if(vlib_main_t *vm, tap_create_if_args_t *args)
#define vec_len(v)
Number of elements in vector (rvalue-only, NULL tolerant)
void vlib_cli_output(vlib_main_t *vm, char *fmt,...)