19 #include <sys/ioctl.h> 45 else if (
unformat (line_input,
"elog"))
47 else if (
unformat (line_input,
"bind"))
71 .path =
"create interface vmxnet3",
72 .short_help =
"create interface vmxnet3 <pci-address>" 73 "[rx-queue-size <size>] [tx-queue-size <size>]" 74 "[num-tx-queues <number>] [num-rx-queues <number>] [bind]",
96 if (
unformat (line_input,
"sw_if_index %d", &sw_if_index))
107 if (sw_if_index == ~0)
109 "please specify interface name or sw_if_index");
124 .path =
"delete interface vmxnet3",
125 .short_help =
"delete interface vmxnet3 " 126 "{<interface> | sw_if_index <sw_idx>}",
141 int enable_elog = 0, disable_elog = 0;
149 if (
unformat (line_input,
"sw_if_index %d", &sw_if_index))
151 else if (
unformat (line_input,
"elog-on"))
153 else if (
unformat (line_input,
"elog-off"))
164 if (sw_if_index == ~0)
166 "please specify interface name or sw_if_index");
175 vd->
flags |= VMXNET3_DEVICE_F_ELOG;
178 vd->
flags &= ~VMXNET3_DEVICE_F_ELOG;
185 .path =
"test vmxnet3",
186 .short_help =
"test vmxnet3 <interface> | sw_if_index <sw_idx> [irq] " 187 "[elog-on] [elog-off]",
194 u8 show_one_table,
u32 which,
u8 show_one_slot,
u32 slot)
202 vmxnet3_rx_desc *rxd;
203 vmxnet3_rx_comp *rx_comp;
205 vmxnet3_tx_desc *txd;
206 vmxnet3_tx_comp *tx_comp;
213 for (i = 0; i <
vec_len (hw_if_indices); i++)
247 " ring %u size %u fill %u " 248 "consume %u produce %u", rid,
255 "slot",
"address",
"flags");
256 for (desc_idx = 0; desc_idx < rxq->
size; desc_idx++)
258 rxd = &rxq->
rx_desc[rid][desc_idx];
260 desc_idx, rxd->address, rxd->flags);
263 else if (show_one_table)
265 if (((which == VMXNET3_SHOW_RX_DESC0) && (rid == 0)) ||
266 ((which == VMXNET3_SHOW_RX_DESC1) && (rid == 1)))
270 "slot",
"address",
"flags");
273 rxd = &rxq->
rx_desc[rid][slot];
275 slot, rxd->address, rxd->flags);
278 for (desc_idx = 0; desc_idx < rxq->
size; desc_idx++)
280 rxd = &rxq->
rx_desc[rid][desc_idx];
282 desc_idx, rxd->address,
294 "slot",
"index",
"rss",
"len",
"flags");
295 for (desc_idx = 0; desc_idx < rxq->
size; desc_idx++)
297 rx_comp = &rxq->
rx_comp[desc_idx];
299 desc_idx, rx_comp->index, rx_comp->rss,
300 rx_comp->len, rx_comp->flags);
303 else if (show_one_table)
305 if (which == VMXNET3_SHOW_RX_COMP)
309 "slot",
"index",
"rss",
"len",
"flags");
314 slot, rx_comp->index, rx_comp->rss,
315 rx_comp->len, rx_comp->flags);
318 for (desc_idx = 0; desc_idx < rxq->
size; desc_idx++)
320 rx_comp = &rxq->
rx_comp[desc_idx];
322 " %5u 0x%08x %10u %10u 0x%08x",
323 desc_idx, rx_comp->index, rx_comp->rss,
324 rx_comp->len, rx_comp->flags);
345 "slot",
"address",
"flags0",
"flags1");
346 for (desc_idx = 0; desc_idx < txq->
size; desc_idx++)
350 desc_idx, txd->address, txd->flags[0],
356 "slot",
"index",
"flags");
357 for (desc_idx = 0; desc_idx < txq->
size; desc_idx++)
359 tx_comp = &txq->
tx_comp[desc_idx];
361 desc_idx, tx_comp->index, tx_comp->flags);
364 else if (show_one_table)
366 if (which == VMXNET3_SHOW_TX_DESC)
370 "slot",
"address",
"flags0",
"flags1");
375 slot, txd->address, txd->flags[0],
379 for (desc_idx = 0; desc_idx < txq->
size; desc_idx++)
383 desc_idx, txd->address, txd->flags[0],
387 else if (which == VMXNET3_SHOW_TX_COMP)
391 "slot",
"index",
"flags");
396 slot, tx_comp->index, tx_comp->flags);
399 for (desc_idx = 0; desc_idx < txq->
size; desc_idx++)
401 tx_comp = &txq->
tx_comp[desc_idx];
403 desc_idx, tx_comp->index,
420 u32 hw_if_index, *hw_if_indices = 0;
422 u8 show_descr = 0, show_one_table = 0, show_one_slot = 0;
423 u32 which = ~0, slot;
437 vec_add1 (hw_if_indices, hw_if_index);
449 which = VMXNET3_SHOW_RX_COMP;
454 if (slot >= rxq->
size)
457 "slot size must be < rx queue " 458 "size %u", rxq->
size);
464 else if (
unformat (input,
"rx-desc-0"))
467 which = VMXNET3_SHOW_RX_DESC0;
472 if (slot >= rxq->
size)
475 "slot size must be < rx queue " 476 "size %u", rxq->
size);
482 else if (
unformat (input,
"rx-desc-1"))
485 which = VMXNET3_SHOW_RX_DESC1;
490 if (slot >= rxq->
size)
493 "slot size must be < rx queue " 494 "size %u", rxq->
size);
500 else if (
unformat (input,
"tx-comp"))
503 which = VMXNET3_SHOW_TX_COMP;
508 if (slot >= txq->
size)
511 "slot size must be < tx queue " 512 "size %u", txq->
size);
518 else if (
unformat (input,
"tx-desc"))
521 which = VMXNET3_SHOW_TX_DESC;
526 if (slot >= txq->
size)
529 "slot size must be < tx queue " 530 "size %u", txq->
size);
551 if (
vec_len (hw_if_indices) == 0)
558 show_vmxnet3 (vm, hw_if_indices, show_descr, show_one_table, which,
559 show_one_slot, slot);
568 .path =
"show vmxnet3",
569 .short_help =
"show vmxnet3 [[<interface>] ([desc] | ([rx-comp] | " 570 "[rx-desc-0] | [rx-desc-1] | [tx-comp] | [tx-desc]) [<slot>])]",
unformat_function_t unformat_vnet_hw_interface
vlib_log_class_t vlib_log_register_class(char *class, char *subclass)
void vmxnet3_delete_if(vlib_main_t *vm, vmxnet3_device_t *vd)
#define vec_foreach_index(var, v)
Iterate over vector indices.
format_function_t format_vnet_hw_if_index_name
vnet_main_t * vnet_get_main(void)
vmxnet3_rx_desc * rx_desc[VMXNET3_RX_RING_SIZE]
static clib_error_t * vmxnet3_create_command_fn(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
static vnet_hw_interface_t * vnet_get_hw_interface(vnet_main_t *vnm, u32 hw_if_index)
#define vec_add1(V, E)
Add 1 element to end of vector (unspecified alignment).
vmxnet3_main_t vmxnet3_main
clib_memset(h->entries, 0, sizeof(h->entries[0])*entries)
void vmxnet3_create_if(vlib_main_t *vm, vmxnet3_create_if_args_t *args)
unformat_function_t unformat_vnet_sw_interface
vlib_log_class_t log_default
u8 * format_ethernet_address(u8 *s, va_list *args)
#define pool_foreach(VAR, POOL, BODY)
Iterate through pool.
#define VLIB_INIT_FUNCTION(x)
#define vec_elt_at_index(v, i)
Get vector value at index i checking that i is in bounds.
#define clib_error_return(e, args...)
clib_error_t * vmxnet3_plugin_api_hookup(vlib_main_t *vm)
clib_error_t * vmxnet3_cli_init(vlib_main_t *vm)
static clib_error_t * vmxnet3_delete_command_fn(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
#define pool_elt_at_index(p, i)
Returns pointer to element at given index.
vmxnet3_rx_comp_ring rx_comp_ring
vmxnet3_tx_comp_ring tx_comp_ring
#define VMXNET3_RX_RING_SIZE
unformat_function_t unformat_vlib_pci_addr
vmxnet3_tx_comp * tx_comp
#define VLIB_CONFIG_FUNCTION(x, n,...)
static clib_error_t * show_vmxnet3_fn(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
#define vec_free(V)
Free vector's memory (no header).
static vnet_hw_interface_t * vnet_get_sup_hw_interface_api_visible_or_null(vnet_main_t *vnm, u32 sw_if_index)
#define VLIB_CLI_COMMAND(x,...)
static clib_error_t * vmxnet3_config(vlib_main_t *vm, unformat_input_t *input)
#define vec_len(v)
Number of elements in vector (rvalue-only, NULL tolerant)
static void show_vmxnet3(vlib_main_t *vm, u32 *hw_if_indices, u8 show_descr, u8 show_one_table, u32 which, u8 show_one_slot, u32 slot)
vmxnet3_tx_desc * tx_desc
vnet_device_class_t vmxnet3_device_class
vmxnet3_rx_comp * rx_comp
vmxnet3_rx_ring rx_ring[VMXNET3_RX_RING_SIZE]
vmxnet3_device_t * devices
static clib_error_t * vmxnet3_test_command_fn(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
void vlib_cli_output(vlib_main_t *vm, char *fmt,...)
format_function_t format_vlib_pci_addr