19 #include <sys/ioctl.h> 28 #include <linux/virtio_net.h> 29 #include <linux/vhost.h> 56 else if (
unformat (line_input,
"host-mac-addr %U",
61 else if (
unformat (line_input,
"host-ip4-addr %U/%d",
65 else if (
unformat (line_input,
"host-ip4-gw %U",
68 else if (
unformat (line_input,
"host-ip6-addr %U/%d",
72 else if (
unformat (line_input,
"host-ip6-gw %U",
79 else if (
unformat (line_input,
"no-gso"))
81 else if (
unformat (line_input,
"gso"))
83 else if (
unformat (line_input,
"hw-addr %U",
112 .path =
"create tap",
113 .short_help =
"create tap {id <if-id>} [hw-addr <mac-address>] " 114 "[rx-ring-size <size>] [tx-ring-size <size>] [host-ns <netns>] " 115 "[host-bridge <bridge-name>] [host-ip4-addr <ip4addr/mask>] " 116 "[host-ip6-addr <ip6-addr>] [host-ip4-gw <ip4-addr>] " 117 "[host-ip6-gw <ip6-addr>] [host-if-name <name>] [no-gso|gso]",
137 if (
unformat (line_input,
"sw_if_index %d", &sw_if_index))
148 if (sw_if_index == ~0)
150 "please specify interface name or sw_if_index");
153 if (rv == VNET_API_ERROR_INVALID_SW_IF_INDEX)
164 .path =
"delete tap",
165 .short_help =
"delete tap {<interface> | sw_if_index <sw_idx>}",
186 if (
unformat (line_input,
"sw_if_index %d", &sw_if_index))
191 else if (
unformat (line_input,
"enable"))
193 else if (
unformat (line_input,
"disable"))
201 if (sw_if_index == ~0)
203 "please specify interface name or sw_if_index");
206 if (rv == VNET_API_ERROR_INVALID_SW_IF_INDEX)
217 .path =
"set tap gso",
218 .short_help =
"set tap gso {<interface> | sw_if_index <sw_idx>} <enable|disable>",
232 u32 hw_if_index, *hw_if_indices = 0;
238 vec_add1 (hw_if_indices, hw_if_index);
239 else if (
unformat (input,
"descriptors"))
249 if (
vec_len (hw_if_indices) == 0)
268 .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
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.
#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)