|
FD.io VPP
v21.06-3-gbb25fbf28
Vector Packet Processing
|
Go to the documentation of this file.
19 #include <sys/ioctl.h>
49 if (
unformat (line_input,
"id %u", &socket_id))
51 else if (
unformat (line_input,
"filename %s", &socket_filename))
63 if (socket_id == 0 || socket_id == ~0)
69 if (!socket_filename || *socket_filename == 0)
83 case VNET_API_ERROR_INVALID_ARGUMENT:
85 case VNET_API_ERROR_SYSCALL_ERROR_1:
87 case VNET_API_ERROR_ENTRY_ALREADY_EXISTS:
89 case VNET_API_ERROR_UNEXPECTED_INTF_STATE:
101 .path =
"create memif socket",
102 .short_help =
"create memif socket [id <id>] [filename <path>]",
124 if (
unformat (line_input,
"id %u", &socket_id))
135 if (socket_id == 0 || socket_id == ~0)
146 case VNET_API_ERROR_INVALID_ARGUMENT:
148 case VNET_API_ERROR_SYSCALL_ERROR_1:
150 case VNET_API_ERROR_ENTRY_ALREADY_EXISTS:
152 case VNET_API_ERROR_UNEXPECTED_INTF_STATE:
164 .path =
"delete memif socket",
165 .short_help =
"delete memif socket [id <id>]",
196 else if (
unformat (line_input,
"ring-size %u", &ring_size))
198 else if (
unformat (line_input,
"rx-queues %u", &rx_queues))
200 else if (
unformat (line_input,
"tx-queues %u", &tx_queues))
204 else if (
unformat (line_input,
"master"))
206 else if (
unformat (line_input,
"slave"))
208 else if (
unformat (line_input,
"no-zero-copy"))
210 else if (
unformat (line_input,
"mode ip"))
212 else if (
unformat (line_input,
"hw-addr %U",
224 if (ring_size > 32768)
229 if (rx_queues > 255 || rx_queues < 1)
231 if (tx_queues > 255 || tx_queues < 1)
241 if (
r <= VNET_API_ERROR_SYSCALL_ERROR_1
242 &&
r >= VNET_API_ERROR_SYSCALL_ERROR_10)
245 if (
r == VNET_API_ERROR_INVALID_ARGUMENT)
248 if (
r == VNET_API_ERROR_INVALID_INTERFACE)
251 if (
r == VNET_API_ERROR_SUBIF_ALREADY_EXISTS)
259 .path =
"create interface memif",
260 .short_help =
"create interface memif [id <id>] [socket-id <socket-id>] "
261 "[ring-size <size>] [buffer-size <size>] "
262 "[hw-addr <mac-address>] "
263 "<master|slave> [rx-queues <number>] [tx-queues <number>] "
264 "[mode ip] [secret <string>]",
299 "please specify interface name or sw_if_index");
313 .path =
"delete interface memif",
314 .short_help =
"delete interface memif {<interface> | sw_if_index <sw_idx>}",
323 #define _(a,b,c) if ( flags & (1 << a)) s = format (s, " %s", c);
334 return format (s,
"ethernet");
338 return format (s,
"punt-inject");
339 return format (s,
"unknown mode (%u)", mif->
mode);;
349 s =
format (s,
"%U%s ring %u:\n",
352 "slave-to-master" :
"master-to-slave",
i);
353 s =
format (s,
"%Uregion %u offset %u ring-size %u int-fd %d\n",
358 s =
format (s,
"%Uhead %u tail %u flags 0x%04x interrupts %u\n",
383 "%Uid flags len address offset user address\n",
387 "%U===== ===== ======== ================== ====== ==================\n",
391 s =
format (s,
"%U%-5d %-5d %-7d 0x%016lx %-6d 0x%016lx\n",
417 u32 hw_if_index, *hw_if_indices = 0;
426 vec_add1 (hw_if_indices, hw_if_index);
427 else if (
unformat (input,
"descriptors"))
443 memif_socket_file_t *msf;
446 msf = pool_elt_at_index(mm->socket_files, msf_idx);
447 filename = msf->filename;
448 if (msf->is_listener)
449 s = format (s,
"yes (%u)", msf->ref_cnt);
451 s = format (s,
"no");
453 vlib_cli_output(vm,
" %-3u %-11v %s\n", sock_id, s, filename);
454 vec_reset_length (s);
461 if (
vec_len (hw_if_indices) == 0)
469 for (hw_if_index = 0; hw_if_index <
vec_len (hw_if_indices); hw_if_index++)
490 "buffer-size %u num-regions %u",
531 .path =
"show memif",
532 .short_help =
"show memif [<interface>] [descriptors]",
static clib_error_t * memif_show_command_fn(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
memif_interface_mode_t mode
uword unformat_ethernet_address(unformat_input_t *input, va_list *args)
static u8 * format_memif_if_mode(u8 *s, va_list *args)
int memif_socket_filename_add_del(u8 is_add, u32 sock_id, u8 *sock_filename)
static vlib_cli_command_t memif_socket_filename_delete_command
(constructor) VLIB_CLI_COMMAND (memif_socket_filename_delete_command)
static vlib_cli_command_t memif_create_command
(constructor) VLIB_CLI_COMMAND (memif_create_command)
#define pool_elt_at_index(p, i)
Returns pointer to element at given index.
memif_queue_t * tx_queues
memif_region_size_t region_size
memif_socket_file_t * socket_files
memif_log2_ring_size_t log2_ring_size
#define clib_error_return(e, args...)
static u8 * format_memif_queue(u8 *s, va_list *args)
@ MEMIF_INTERFACE_MODE_IP
vlib_main_t * vm
X-connect all packets from the HOST to the PHY.
memif_queue_t * rx_queues
static clib_error_t * memif_create_command_fn(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
vnet_hw_if_output_node_runtime_t * r
static u8 * format_memif_if_flags(u8 *s, va_list *args)
static clib_error_t * memif_socket_filename_create_command_fn(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
memif_region_index_t region
memif_log2_ring_size_t log2_ring_size
static clib_error_t * memif_delete_command_fn(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
static vlib_cli_command_t memif_socket_filename_create_command
(constructor) VLIB_CLI_COMMAND (memif_socket_filename_create_command)
#define pool_foreach(VAR, POOL)
Iterate through pool.
struct memif_if_t::@719 run
#define vec_len(v)
Number of elements in vector (rvalue-only, NULL tolerant)
@ MEMIF_INTERFACE_MODE_PUNT_INJECT
#define vec_add1(V, E)
Add 1 element to end of vector (unspecified alignment).
memif_interface_mode_t mode
static vlib_cli_command_t memif_show_command
(constructor) VLIB_CLI_COMMAND (memif_show_command)
#define vec_elt_at_index(v, i)
Get vector value at index i checking that i is in bounds.
static vnet_hw_interface_t * vnet_get_hw_interface(vnet_main_t *vnm, u32 hw_if_index)
vnet_main_t * vnet_get_main(void)
vnet_device_class_t memif_device_class
memif_region_index_t region
static vnet_hw_interface_t * vnet_get_sup_hw_interface_api_visible_or_null(vnet_main_t *vnm, u32 sw_if_index)
#define vec_foreach_index(var, v)
Iterate over vector indices.
#define hash_foreach(key_var, value_var, h, body)
sll srl srl sll sra u16x4 i
#define VLIB_CLI_COMMAND(x,...)
static_always_inline void * memif_get_buffer(memif_if_t *mif, memif_ring_t *ring, u16 slot)
unformat_function_t unformat_vnet_hw_interface
#define MEMIF_DEFAULT_RX_QUEUES
uword * socket_file_index_by_sock_id
void vlib_cli_output(vlib_main_t *vm, char *fmt,...)
#define MEMIF_DEFAULT_BUFFER_SIZE
clib_error_t * memif_cli_init(vlib_main_t *vm)
#define vec_free(V)
Free vector's memory (no header).
#define MEMIF_DEFAULT_TX_QUEUES
format_function_t format_vnet_sw_if_index_name
unformat_function_t unformat_vnet_sw_interface
description fragment has unexpected format
#define VLIB_INIT_FUNCTION(x)
memif_region_offset_t offset
#define MEMIF_DEFAULT_RING_SIZE
@ MEMIF_INTERFACE_MODE_ETHERNET
clib_error_t *() vlib_init_function_t(struct vlib_main_t *vm)
static u8 * format_memif_descriptor(u8 *s, va_list *args)
static uword min_log2(uword x)
memif_region_offset_t offset
int memif_delete_if(vlib_main_t *vm, memif_if_t *mif)
static uword is_pow2(uword x)
vl_api_interface_index_t sw_if_index
static vlib_cli_command_t memif_delete_command
(constructor) VLIB_CLI_COMMAND (memif_delete_command)
static clib_error_t * memif_socket_filename_delete_command_fn(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
int memif_create_if(vlib_main_t *vm, memif_create_if_args_t *args)
vl_api_wireguard_peer_flags_t flags