19 #include <sys/ioctl.h> 46 else if (
unformat (line_input,
"gso"))
48 else if (
unformat (line_input,
"elog"))
50 else if (
unformat (line_input,
"bind"))
52 else if (
unformat (line_input,
"rx-queue-size %u", &size))
54 else if (
unformat (line_input,
"tx-queue-size %u", &size))
56 else if (
unformat (line_input,
"num-tx-queues %u", &size))
58 else if (
unformat (line_input,
"num-rx-queues %u", &size))
77 .path =
"create interface vmxnet3",
78 .short_help =
"create interface vmxnet3 <pci-address>" 79 " [rx-queue-size <size>] [tx-queue-size <size>]" 80 " [num-tx-queues <number>] [num-rx-queues <number>] [bind]" 103 if (
unformat (line_input,
"sw_if_index %d", &sw_if_index))
114 if (sw_if_index == ~0)
116 "please specify interface name or sw_if_index");
131 .path =
"delete interface vmxnet3",
132 .short_help =
"delete interface vmxnet3 " 133 "{<interface> | sw_if_index <sw_idx>}",
148 int enable_elog = 0, disable_elog = 0;
156 if (
unformat (line_input,
"sw_if_index %d", &sw_if_index))
158 else if (
unformat (line_input,
"elog-on"))
160 else if (
unformat (line_input,
"elog-off"))
171 if (sw_if_index == ~0)
173 "please specify interface name or sw_if_index");
182 vd->
flags |= VMXNET3_DEVICE_F_ELOG;
185 vd->
flags &= ~VMXNET3_DEVICE_F_ELOG;
192 .path =
"test vmxnet3",
193 .short_help =
"test vmxnet3 <interface> | sw_if_index <sw_idx> [irq] " 194 "[elog-on] [elog-off]",
209 vmxnet3_rx_desc *rxd;
210 vmxnet3_rx_comp *rx_comp;
212 vmxnet3_tx_desc *txd;
213 vmxnet3_tx_comp *tx_comp;
219 for (i = 0; i <
vec_len (hw_if_indices); i++)
253 " ring %u size %u fill %u " 254 "consume %u produce %u", rid,
261 "slot",
"address",
"flags");
262 for (desc_idx = 0; desc_idx < rxq->
size; desc_idx++)
264 rxd = &rxq->
rx_desc[rid][desc_idx];
266 desc_idx, rxd->address, rxd->flags);
269 else if (show_one_table)
271 if (((which == VMXNET3_SHOW_RX_DESC0) && (rid == 0)) ||
272 ((which == VMXNET3_SHOW_RX_DESC1) && (rid == 1)))
276 "slot",
"address",
"flags");
281 slot, rxd->address, rxd->flags);
284 for (desc_idx = 0; desc_idx < rxq->
size; desc_idx++)
286 rxd = &rxq->
rx_desc[rid][desc_idx];
288 desc_idx, rxd->address,
300 "slot",
"index",
"rss",
"len",
"flags");
301 for (desc_idx = 0; desc_idx < rxq->
size; desc_idx++)
303 rx_comp = &rxq->
rx_comp[desc_idx];
305 desc_idx, rx_comp->index, rx_comp->rss,
306 rx_comp->len, rx_comp->flags);
309 else if (show_one_table)
311 if (which == VMXNET3_SHOW_RX_COMP)
315 "slot",
"index",
"rss",
"len",
"flags");
320 slot, rx_comp->index, rx_comp->rss,
321 rx_comp->len, rx_comp->flags);
324 for (desc_idx = 0; desc_idx < rxq->
size; desc_idx++)
326 rx_comp = &rxq->
rx_comp[desc_idx];
328 " %5u 0x%08x %10u %10u 0x%08x",
329 desc_idx, rx_comp->index, rx_comp->rss,
330 rx_comp->len, rx_comp->flags);
351 "slot",
"address",
"flags0",
"flags1");
352 for (desc_idx = 0; desc_idx < txq->
size; desc_idx++)
356 desc_idx, txd->address, txd->flags[0],
362 "slot",
"index",
"flags");
363 for (desc_idx = 0; desc_idx < txq->
size; desc_idx++)
365 tx_comp = &txq->
tx_comp[desc_idx];
367 desc_idx, tx_comp->index, tx_comp->flags);
370 else if (show_one_table)
372 if (which == VMXNET3_SHOW_TX_DESC)
376 "slot",
"address",
"flags0",
"flags1");
381 slot, txd->address, txd->flags[0],
385 for (desc_idx = 0; desc_idx < txq->
size; desc_idx++)
389 desc_idx, txd->address, txd->flags[0],
393 else if (which == VMXNET3_SHOW_TX_COMP)
397 "slot",
"index",
"flags");
402 slot, tx_comp->index, tx_comp->flags);
405 for (desc_idx = 0; desc_idx < txq->
size; desc_idx++)
407 tx_comp = &txq->
tx_comp[desc_idx];
409 desc_idx, tx_comp->index,
426 u32 hw_if_index, *hw_if_indices = 0;
428 u8 show_descr = 0, show_one_table = 0, show_one_slot = 0;
443 vec_add1 (hw_if_indices, hw_if_index);
455 which = VMXNET3_SHOW_RX_COMP;
463 "slot size must be < rx queue " 464 "size %u", rxq->
size);
470 else if (
unformat (input,
"rx-desc-0"))
473 which = VMXNET3_SHOW_RX_DESC0;
481 "slot size must be < rx queue " 482 "size %u", rxq->
size);
488 else if (
unformat (input,
"rx-desc-1"))
491 which = VMXNET3_SHOW_RX_DESC1;
499 "slot size must be < rx queue " 500 "size %u", rxq->
size);
506 else if (
unformat (input,
"tx-comp"))
509 which = VMXNET3_SHOW_TX_COMP;
517 "slot size must be < tx queue " 518 "size %u", txq->
size);
524 else if (
unformat (input,
"tx-desc"))
527 which = VMXNET3_SHOW_TX_DESC;
535 "slot size must be < tx queue " 536 "size %u", txq->
size);
557 if (
vec_len (hw_if_indices) == 0)
563 show_vmxnet3 (vm, hw_if_indices, show_descr, show_one_table, which,
564 show_one_slot,
slot);
573 .path =
"show vmxnet3",
574 .short_help =
"show vmxnet3 [[<interface>] ([desc] | ([rx-comp] | " 575 "[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)
#define pool_foreach(VAR, POOL)
Iterate through pool.
vmxnet3_rx_desc * rx_desc[VMXNET3_RX_RING_SIZE]
clib_memset(h->entries, 0, sizeof(h->entries[0]) *entries)
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
format_function_t format_vnet_sw_if_index_name
static clib_error_t * vmxnet3_create_command_fn(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
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)
vlib_log_class_t log_default
u8 * format_ethernet_address(u8 *s, va_list *args)
#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)
#define pool_elt_at_index(p, i)
Returns pointer to element at given index.
static clib_error_t * show_vmxnet3_fn(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
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
static clib_error_t * vmxnet3_test_command_fn(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
sll srl srl sll sra u16x4 i
#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,...)
void vlib_cli_output(vlib_main_t *vm, char *fmt,...)
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)
#define vec_len(v)
Number of elements in vector (rvalue-only, NULL tolerant)
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
format_function_t format_vlib_pci_addr
vl_api_interface_index_t sw_if_index