19 #include <sys/ioctl.h> 44 if (
unformat (line_input,
"key 0x%" PRIx64, &args.
key))
48 else if (
unformat (line_input,
"ring-size %u", &ring_size))
52 else if (
unformat (line_input,
"master"))
54 else if (
unformat (line_input,
"slave"))
56 else if (
unformat (line_input,
"hw-addr %U",
72 if (r <= VNET_API_ERROR_SYSCALL_ERROR_1
73 && r >= VNET_API_ERROR_SYSCALL_ERROR_10)
76 if (r == VNET_API_ERROR_INVALID_INTERFACE)
79 if (r == VNET_API_ERROR_SUBIF_ALREADY_EXISTS)
87 .path =
"create memif",
88 .short_help =
"create memif [key <key>] [socket <path>] " 89 "[ring-size <size>] [buffer-size <size>] [hw-addr <mac-address>] " 109 if (
unformat (line_input,
"key 0x%" PRIx64, &key))
127 .path =
"delete memif",
128 .short_help =
"delete memif key <key-value>",
145 vlib_cli_output (vm,
"interface %U", format_vnet_sw_if_index_name,
146 vnm, mif->sw_if_index);
147 vlib_cli_output (vm,
" key 0x%" PRIx64
" file %s", mif->key,
148 mif->socket_filename);
149 vlib_cli_output (vm,
" listener %d conn-fd %d int-fd %d", mif->listener_index,
150 mif->connection.fd, mif->interrupt_line.fd);
151 vlib_cli_output (vm,
" ring-size %u num-c2s-rings %u num-s2c-rings %u buffer_size %u",
152 (1 << mif->log2_ring_size),
156 for (i=0; i < mif->num_s2m_rings; i++)
158 memif_ring_t * ring = memif_get_ring (mif, MEMIF_RING_S2M, i);
161 vlib_cli_output (vm,
" slave-to-master ring %u:", i);
162 vlib_cli_output (vm,
" head %u tail %u", ring->head, ring->tail);
182 .path =
"show memif",
183 .short_help =
"show memif",
sll srl srl sll sra u16x4 i
vnet_main_t * vnet_get_main(void)
static clib_error_t * memif_create_command_fn(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
static uword min_log2(uword x)
int memif_delete_if(vlib_main_t *vm, u64 key)
#define pool_foreach(VAR, POOL, BODY)
Iterate through pool.
#define VLIB_INIT_FUNCTION(x)
#define clib_error_return(e, args...)
#define MEMIF_DEFAULT_RING_SIZE
static clib_error_t * memif_delete_command_fn(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
static clib_error_t * memif_show_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)
#define VLIB_CLI_COMMAND(x,...)
uword unformat_ethernet_address(unformat_input_t *input, va_list *args)
static uword is_pow2(uword x)
clib_error_t * memif_cli_init(vlib_main_t *vm)
static_always_inline memif_ring_t * memif_get_ring(memif_if_t *mif, memif_ring_type_t type, u16 ring_num)
void vlib_cli_output(vlib_main_t *vm, char *fmt,...)
#define MEMIF_DEFAULT_BUFFER_SIZE