19 #include <sys/ioctl.h> 41 memset (&args, 0,
sizeof (args));
46 else if (
unformat (line_input,
"elog"))
48 else if (
unformat (line_input,
"rx-queue-size %u", &tmp))
50 else if (
unformat (line_input,
"tx-queue-size %u", &tmp))
66 .path =
"create interface vmxnet3",
67 .short_help =
"create interface vmxnet3 <pci-address>" 68 "[rx-queue-size <size>] [tx-queue-size <size>]",
90 if (
unformat (line_input,
"sw_if_index %d", &sw_if_index))
101 if (sw_if_index == ~0)
103 "please specify interface name or sw_if_index");
118 .path =
"delete interface vmxnet3",
119 .short_help =
"delete interface vmxnet3 " 120 "{<interface> | sw_if_index <sw_idx>}",
135 int enable_elog = 0, disable_elog = 0;
143 if (
unformat (line_input,
"sw_if_index %d", &sw_if_index))
145 else if (
unformat (line_input,
"elog-on"))
147 else if (
unformat (line_input,
"elog-off"))
158 if (sw_if_index == ~0)
160 "please specify interface name or sw_if_index");
169 vd->
flags |= VMXNET3_DEVICE_F_ELOG;
172 vd->
flags &= ~VMXNET3_DEVICE_F_ELOG;
179 .path =
"test vmxnet3",
180 .short_help =
"test vmxnet3 <interface> | sw_if_index <sw_idx> [irq] " 181 "[elog-on] [elog-off]",
188 u8 show_one_table,
u32 which,
u8 show_one_slot,
u32 slot)
196 vmxnet3_rx_desc *rxd;
197 vmxnet3_rx_comp *rx_comp;
199 vmxnet3_tx_desc *txd;
200 vmxnet3_tx_comp *tx_comp;
206 for (i = 0; i <
vec_len (hw_if_indices); i++)
239 " ring %u size %u fill %u " 240 "consume %u produce %u", rid,
247 "slot",
"address",
"flags");
248 for (desc_idx = 0; desc_idx < rxq->
size; desc_idx++)
250 rxd = &rxq->
rx_desc[rid][desc_idx];
252 desc_idx, rxd->address, rxd->flags);
255 else if (show_one_table)
257 if (((which == VMXNET3_SHOW_RX_DESC0) && (rid == 0)) ||
258 ((which == VMXNET3_SHOW_RX_DESC1) && (rid == 1)))
262 "slot",
"address",
"flags");
265 rxd = &rxq->
rx_desc[rid][slot];
267 slot, rxd->address, rxd->flags);
270 for (desc_idx = 0; desc_idx < rxq->
size; desc_idx++)
272 rxd = &rxq->
rx_desc[rid][desc_idx];
274 desc_idx, rxd->address,
286 "slot",
"index",
"rss",
"len",
"flags");
287 for (desc_idx = 0; desc_idx < rxq->
size; desc_idx++)
289 rx_comp = &rxq->
rx_comp[desc_idx];
291 desc_idx, rx_comp->index, rx_comp->rss,
292 rx_comp->len, rx_comp->flags);
295 else if (show_one_table)
297 if (which == VMXNET3_SHOW_RX_COMP)
301 "slot",
"index",
"rss",
"len",
"flags");
306 slot, rx_comp->index, rx_comp->rss,
307 rx_comp->len, rx_comp->flags);
310 for (desc_idx = 0; desc_idx < rxq->
size; desc_idx++)
312 rx_comp = &rxq->
rx_comp[desc_idx];
314 " %5u 0x%08x %10u %10u 0x%08x",
315 desc_idx, rx_comp->index, rx_comp->rss,
316 rx_comp->len, rx_comp->flags);
337 "slot",
"address",
"flags0",
"flags1");
338 for (desc_idx = 0; desc_idx < txq->
size; desc_idx++)
342 desc_idx, txd->address, txd->flags[0],
348 "slot",
"index",
"flags");
349 for (desc_idx = 0; desc_idx < txq->
size; desc_idx++)
351 tx_comp = &txq->
tx_comp[desc_idx];
353 desc_idx, tx_comp->index, tx_comp->flags);
356 else if (show_one_table)
358 if (which == VMXNET3_SHOW_TX_DESC)
362 "slot",
"address",
"flags0",
"flags1");
367 slot, txd->address, txd->flags[0],
371 for (desc_idx = 0; desc_idx < txq->
size; desc_idx++)
375 desc_idx, txd->address, txd->flags[0],
379 else if (which == VMXNET3_SHOW_TX_COMP)
383 "slot",
"index",
"flags");
388 slot, tx_comp->index, tx_comp->flags);
391 for (desc_idx = 0; desc_idx < txq->
size; desc_idx++)
393 tx_comp = &txq->
tx_comp[desc_idx];
395 desc_idx, tx_comp->index,
412 u32 hw_if_index, *hw_if_indices = 0;
414 u8 show_descr = 0, show_one_table = 0, show_one_slot = 0;
415 u32 which = ~0, slot;
429 vec_add1 (hw_if_indices, hw_if_index);
441 which = VMXNET3_SHOW_RX_COMP;
446 if (slot >= rxq->
size)
449 "slot size must be < rx queue " 450 "size %u", rxq->
size);
456 else if (
unformat (input,
"rx-desc-0"))
459 which = VMXNET3_SHOW_RX_DESC0;
464 if (slot >= rxq->
size)
467 "slot size must be < rx queue " 468 "size %u", rxq->
size);
474 else if (
unformat (input,
"rx-desc-1"))
477 which = VMXNET3_SHOW_RX_DESC1;
482 if (slot >= rxq->
size)
485 "slot size must be < rx queue " 486 "size %u", rxq->
size);
492 else if (
unformat (input,
"tx-comp"))
495 which = VMXNET3_SHOW_TX_COMP;
500 if (slot >= txq->
size)
503 "slot size must be < tx queue " 504 "size %u", txq->
size);
510 else if (
unformat (input,
"tx-desc"))
513 which = VMXNET3_SHOW_TX_DESC;
518 if (slot >= txq->
size)
521 "slot size must be < tx queue " 522 "size %u", txq->
size);
543 if (
vec_len (hw_if_indices) == 0)
550 show_vmxnet3 (vm, hw_if_indices, show_descr, show_one_table, which,
551 show_one_slot, slot);
560 .path =
"show vmxnet3",
561 .short_help =
"show vmxnet3 [[<interface>] ([desc] | ([rx-comp] | " 562 "[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)
format_function_t format_vlib_pci_addr
#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)
static vnet_hw_interface_t * vnet_get_sup_hw_interface(vnet_main_t *vnm, u32 sw_if_index)
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
void vmxnet3_create_if(vlib_main_t *vm, vmxnet3_create_if_args_t *args)
unformat_function_t unformat_vnet_sw_interface
unformat_function_t unformat_vlib_pci_addr
vlib_log_class_t log_default
memset(h->entries, 0, sizeof(h->entries[0])*entries)
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
vmxnet3_tx_comp * tx_comp
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).
#define VLIB_CLI_COMMAND(x,...)
#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,...)