|
FD.io VPP
v21.10.1-2-g0a485f517
Vector Packet Processing
|
Go to the documentation of this file.
19 #include <sys/ioctl.h>
57 else if (
unformat (line_input,
"host-mac-addr %U",
63 else if (
unformat (line_input,
"host-ip4-addr %U/%d",
67 else if (
unformat (line_input,
"host-ip4-gw %U",
70 else if (
unformat (line_input,
"host-ip6-addr %U/%d",
74 else if (
unformat (line_input,
"host-ip6-gw %U",
77 else if (
unformat (line_input,
"num-rx-queues %d", &
tmp))
79 else if (
unformat (line_input,
"rx-ring-size %d", &
tmp))
81 else if (
unformat (line_input,
"tx-ring-size %d", &
tmp))
87 else if (
unformat (line_input,
"no-gso"))
89 else if (
unformat (line_input,
"gso"))
91 else if (
unformat (line_input,
"gro-coalesce"))
93 else if (
unformat (line_input,
"csum-offload"))
95 else if (
unformat (line_input,
"persist"))
97 else if (
unformat (line_input,
"attach"))
99 else if (
unformat (line_input,
"tun"))
101 else if (
unformat (line_input,
"packed"))
103 else if (
unformat (line_input,
"in-order"))
105 else if (
unformat (line_input,
"hw-addr %U",
138 .path =
"create tap",
139 .short_help =
"create tap {id <if-id>} [hw-addr <mac-address>] "
140 "[num-rx-queues <n>] [rx-ring-size <size>] [tx-ring-size <size>] "
141 "[host-ns <netns>] [host-bridge <bridge-name>] "
142 "[host-ip4-addr <ip4addr/mask>] [host-ip6-addr <ip6-addr>] "
143 "[host-ip4-gw <ip4-addr>] [host-ip6-gw <ip6-addr>] "
144 "[host-mac-addr <host-mac-address>] [host-if-name <name>] "
145 "[host-mtu-size <size>] [no-gso|gso [gro-coalesce]|csum-offload] "
146 "[persist] [attach] [tun] [packed] [in-order]",
179 "please specify interface name or sw_if_index");
182 if (
rv == VNET_API_ERROR_INVALID_SW_IF_INDEX)
193 .path =
"delete tap",
194 .short_help =
"delete tap {<interface> | sw_if_index <sw_idx>}",
206 int gso_enable = 0, gso_disable = 0, is_gro_coalesce = 0;
207 int csum_offload_enable = 0, csum_offload_disable = 0;
221 else if (
unformat (line_input,
"gso-enable"))
224 if (
unformat (line_input,
"gro-coalesce"))
227 else if (
unformat (line_input,
"gso-disable"))
229 else if (
unformat (line_input,
"csum-offload-enable"))
230 csum_offload_enable = 1;
231 else if (
unformat (line_input,
"csum-offload-disable"))
232 csum_offload_disable = 1;
241 "please specify interface name or sw_if_index");
245 else if (csum_offload_enable)
247 else if (gso_disable)
249 else if (csum_offload_disable)
252 if (
rv == VNET_API_ERROR_INVALID_SW_IF_INDEX)
263 .path =
"set tap offload",
264 .short_help =
"set tap offload {<interface> | sw_if_index <sw_idx>}"
265 " <gso-enable [gro-coalesce] | gso-disable | csum-offload-enable |"
266 "csum-offload-disable>",
280 u32 hw_if_index, *hw_if_indices = 0;
286 vec_add1 (hw_if_indices, hw_if_index);
287 else if (
unformat (input,
"descriptors"))
297 if (
vec_len (hw_if_indices) == 0)
305 virtio_show (
vm, hw_if_indices, show_descr, VIRTIO_IF_TYPE_TAP);
315 .short_help =
"show tap {<interface>] [descriptors]",
329 u32 hw_if_index, *hw_if_indices = 0;
335 vec_add1 (hw_if_indices, hw_if_index);
336 else if (
unformat (input,
"descriptors"))
346 if (
vec_len (hw_if_indices) == 0)
354 virtio_show (
vm, hw_if_indices, show_descr, VIRTIO_IF_TYPE_TUN);
364 .short_help =
"show tun {<interface>] [descriptors]",
static vlib_cli_command_t tap_delete__command
(constructor) VLIB_CLI_COMMAND (tap_delete__command)
ip4_address_t host_ip4_gw
uword unformat_ethernet_address(unformat_input_t *input, va_list *args)
int tap_gso_enable_disable(vlib_main_t *vm, u32 sw_if_index, int enable_disable, int is_packet_coalesce)
ip4_address_t host_ip4_addr
void tap_create_if(vlib_main_t *vm, tap_create_if_args_t *args)
void virtio_show(vlib_main_t *vm, u32 *hw_if_indices, u8 show_descr, virtio_if_type_t type)
#define clib_error_return(e, args...)
vlib_main_t * vm
X-connect all packets from the HOST to the PHY.
ip6_address_t host_ip6_gw
static vlib_cli_command_t tap_offload_command
(constructor) VLIB_CLI_COMMAND (tap_offload_command)
ip6_address_t host_ip6_addr
virtio_main_t virtio_main
#define pool_foreach(VAR, POOL)
Iterate through pool.
int tap_csum_offload_enable_disable(vlib_main_t *vm, u32 sw_if_index, int enable_disable)
#define vec_len(v)
Number of elements in vector (rvalue-only, NULL tolerant)
#define vec_add1(V, E)
Add 1 element to end of vector (unspecified alignment).
vnet_main_t * vnet_get_main(void)
clib_error_t * tap_cli_init(vlib_main_t *vm)
static clib_error_t * tap_create_command_fn(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
int tap_delete_if(vlib_main_t *vm, u32 sw_if_index)
#define VLIB_CLI_COMMAND(x,...)
unformat_function_t unformat_vnet_hw_interface
void vlib_cli_output(vlib_main_t *vm, char *fmt,...)
static vlib_cli_command_t tun_show_command
(constructor) VLIB_CLI_COMMAND (tun_show_command)
#define vec_free(V)
Free vector's memory (no header).
format_function_t format_vnet_sw_if_index_name
unformat_function_t unformat_vnet_sw_interface
#define VLIB_INIT_FUNCTION(x)
static clib_error_t * tun_show_command_fn(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
static clib_error_t * tap_delete_command_fn(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
static vlib_cli_command_t tap_create_command
(constructor) VLIB_CLI_COMMAND (tap_create_command)
static clib_error_t * tap_offload_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)
clib_error_t *() vlib_init_function_t(struct vlib_main_t *vm)
vl_api_interface_index_t sw_if_index
mac_address_t host_mac_addr
static vlib_cli_command_t tap_show_command
(constructor) VLIB_CLI_COMMAND (tap_show_command)