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))
74 .path =
"create interface vmxnet3",
75 .short_help =
"create interface vmxnet3 <pci-address>" 76 " [rx-queue-size <size>] [tx-queue-size <size>]" 77 " [num-tx-queues <number>] [num-rx-queues <number>] [bind]" 100 if (
unformat (line_input,
"sw_if_index %d", &sw_if_index))
111 if (sw_if_index == ~0)
113 "please specify interface name or sw_if_index");
128 .path =
"delete interface vmxnet3",
129 .short_help =
"delete interface vmxnet3 " 130 "{<interface> | sw_if_index <sw_idx>}",
145 int enable_elog = 0, disable_elog = 0;
153 if (
unformat (line_input,
"sw_if_index %d", &sw_if_index))
155 else if (
unformat (line_input,
"elog-on"))
157 else if (
unformat (line_input,
"elog-off"))
168 if (sw_if_index == ~0)
170 "please specify interface name or sw_if_index");
179 vd->
flags |= VMXNET3_DEVICE_F_ELOG;
182 vd->
flags &= ~VMXNET3_DEVICE_F_ELOG;
189 .path =
"test vmxnet3",
190 .short_help =
"test vmxnet3 <interface> | sw_if_index <sw_idx> [irq] " 191 "[elog-on] [elog-off]",
206 vmxnet3_rx_desc *rxd;
207 vmxnet3_rx_comp *rx_comp;
209 vmxnet3_tx_desc *txd;
210 vmxnet3_tx_comp *tx_comp;
216 for (i = 0; i <
vec_len (hw_if_indices); i++)
250 " ring %u size %u fill %u " 251 "consume %u produce %u", rid,
258 "slot",
"address",
"flags");
259 for (desc_idx = 0; desc_idx < rxq->
size; desc_idx++)
261 rxd = &rxq->
rx_desc[rid][desc_idx];
263 desc_idx, rxd->address, rxd->flags);
266 else if (show_one_table)
268 if (((which == VMXNET3_SHOW_RX_DESC0) && (rid == 0)) ||
269 ((which == VMXNET3_SHOW_RX_DESC1) && (rid == 1)))
273 "slot",
"address",
"flags");
278 slot, rxd->address, rxd->flags);
281 for (desc_idx = 0; desc_idx < rxq->
size; desc_idx++)
283 rxd = &rxq->
rx_desc[rid][desc_idx];
285 desc_idx, rxd->address,
297 "slot",
"index",
"rss",
"len",
"flags");
298 for (desc_idx = 0; desc_idx < rxq->
size; desc_idx++)
300 rx_comp = &rxq->
rx_comp[desc_idx];
302 desc_idx, rx_comp->index, rx_comp->rss,
303 rx_comp->len, rx_comp->flags);
306 else if (show_one_table)
308 if (which == VMXNET3_SHOW_RX_COMP)
312 "slot",
"index",
"rss",
"len",
"flags");
317 slot, rx_comp->index, rx_comp->rss,
318 rx_comp->len, rx_comp->flags);
321 for (desc_idx = 0; desc_idx < rxq->
size; desc_idx++)
323 rx_comp = &rxq->
rx_comp[desc_idx];
325 " %5u 0x%08x %10u %10u 0x%08x",
326 desc_idx, rx_comp->index, rx_comp->rss,
327 rx_comp->len, rx_comp->flags);
348 "slot",
"address",
"flags0",
"flags1");
349 for (desc_idx = 0; desc_idx < txq->
size; desc_idx++)
353 desc_idx, txd->address, txd->flags[0],
359 "slot",
"index",
"flags");
360 for (desc_idx = 0; desc_idx < txq->
size; desc_idx++)
362 tx_comp = &txq->
tx_comp[desc_idx];
364 desc_idx, tx_comp->index, tx_comp->flags);
367 else if (show_one_table)
369 if (which == VMXNET3_SHOW_TX_DESC)
373 "slot",
"address",
"flags0",
"flags1");
378 slot, txd->address, txd->flags[0],
382 for (desc_idx = 0; desc_idx < txq->
size; desc_idx++)
386 desc_idx, txd->address, txd->flags[0],
390 else if (which == VMXNET3_SHOW_TX_COMP)
394 "slot",
"index",
"flags");
399 slot, tx_comp->index, tx_comp->flags);
402 for (desc_idx = 0; desc_idx < txq->
size; desc_idx++)
404 tx_comp = &txq->
tx_comp[desc_idx];
406 desc_idx, tx_comp->index,
423 u32 hw_if_index, *hw_if_indices = 0;
425 u8 show_descr = 0, show_one_table = 0, show_one_slot = 0;
440 vec_add1 (hw_if_indices, hw_if_index);
452 which = VMXNET3_SHOW_RX_COMP;
460 "slot size must be < rx queue " 461 "size %u", rxq->
size);
467 else if (
unformat (input,
"rx-desc-0"))
470 which = VMXNET3_SHOW_RX_DESC0;
478 "slot size must be < rx queue " 479 "size %u", rxq->
size);
485 else if (
unformat (input,
"rx-desc-1"))
488 which = VMXNET3_SHOW_RX_DESC1;
496 "slot size must be < rx queue " 497 "size %u", rxq->
size);
503 else if (
unformat (input,
"tx-comp"))
506 which = VMXNET3_SHOW_TX_COMP;
514 "slot size must be < tx queue " 515 "size %u", txq->
size);
521 else if (
unformat (input,
"tx-desc"))
524 which = VMXNET3_SHOW_TX_DESC;
532 "slot size must be < tx queue " 533 "size %u", txq->
size);
554 if (
vec_len (hw_if_indices) == 0)
561 show_vmxnet3 (vm, hw_if_indices, show_descr, show_one_table, which,
562 show_one_slot,
slot);
571 .path =
"show vmxnet3",
572 .short_help =
"show vmxnet3 [[<interface>] ([desc] | ([rx-comp] | " 573 "[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]
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
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 pool_foreach(VAR, POOL, BODY)
Iterate through pool.
vl_api_interface_index_t sw_if_index
#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