FD.io VPP  v21.10.1-2-g0a485f517
Vector Packet Processing
cli.c
Go to the documentation of this file.
1 /*
2  *------------------------------------------------------------------
3  * Copyright (c) 2018 Cisco and/or its affiliates.
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at:
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  *------------------------------------------------------------------
16  */
17 #include <stdint.h>
18 #include <net/if.h>
19 #include <sys/ioctl.h>
20 #include <inttypes.h>
21 
22 #include <vlib/vlib.h>
23 #include <vlib/unix/unix.h>
24 #include <vlib/pci/pci.h>
25 #include <vnet/ethernet/ethernet.h>
26 
27 #include <vmxnet3/vmxnet3.h>
28 
29 static clib_error_t *
31  vlib_cli_command_t * cmd)
32 {
33  unformat_input_t _line_input, *line_input = &_line_input;
35  u32 size;
36 
37  /* Get a line of input. */
38  if (!unformat_user (input, unformat_line_input, line_input))
39  return 0;
40 
41  clib_memset (&args, 0, sizeof (args));
42  while (unformat_check_input (line_input) != UNFORMAT_END_OF_INPUT)
43  {
44  if (unformat (line_input, "%U", unformat_vlib_pci_addr, &args.addr))
45  ;
46  else if (unformat (line_input, "gso"))
47  args.enable_gso = 1;
48  else if (unformat (line_input, "elog"))
49  args.enable_elog = 1;
50  else if (unformat (line_input, "bind"))
51  args.bind = 1;
52  else if (unformat (line_input, "rx-queue-size %u", &size))
53  args.rxq_size = size;
54  else if (unformat (line_input, "tx-queue-size %u", &size))
55  args.txq_size = size;
56  else if (unformat (line_input, "num-tx-queues %u", &size))
57  args.txq_num = size;
58  else if (unformat (line_input, "num-rx-queues %u", &size))
59  args.rxq_num = size;
60  else
61  return clib_error_return (0, "unknown input `%U'",
62  format_unformat_error, input);
63  }
64  unformat_free (line_input);
65 
66 
67  vmxnet3_create_if (vm, &args);
68  if (args.error == 0)
70  vnet_get_main (), args.sw_if_index);
71 
72  return args.error;
73 }
74 
75 /* *INDENT-OFF* */
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]"
81  " [gso]",
82  .function = vmxnet3_create_command_fn,
83 };
84 /* *INDENT-ON* */
85 
86 static clib_error_t *
88  vlib_cli_command_t * cmd)
89 {
90  unformat_input_t _line_input, *line_input = &_line_input;
91  u32 sw_if_index = ~0;
94  vmxnet3_device_t *vd;
95  vnet_main_t *vnm = vnet_get_main ();
96 
97  /* Get a line of input. */
98  if (!unformat_user (input, unformat_line_input, line_input))
99  return 0;
100 
101  while (unformat_check_input (line_input) != UNFORMAT_END_OF_INPUT)
102  {
103  if (unformat (line_input, "sw_if_index %d", &sw_if_index))
104  ;
105  else if (unformat (line_input, "%U", unformat_vnet_sw_interface,
106  vnm, &sw_if_index))
107  ;
108  else
109  return clib_error_return (0, "unknown input `%U'",
110  format_unformat_error, input);
111  }
112  unformat_free (line_input);
113 
114  if (sw_if_index == ~0)
115  return clib_error_return (0,
116  "please specify interface name or sw_if_index");
117 
119  if (hw == NULL || vmxnet3_device_class.index != hw->dev_class_index)
120  return clib_error_return (0, "not a vmxnet3 interface");
121 
122  vd = pool_elt_at_index (vmxm->devices, hw->dev_instance);
123 
124  vmxnet3_delete_if (vm, vd);
125 
126  return 0;
127 }
128 
129 /* *INDENT-OFF* */
131  .path = "delete interface vmxnet3",
132  .short_help = "delete interface vmxnet3 "
133  "{<interface> | sw_if_index <sw_idx>}",
134  .function = vmxnet3_delete_command_fn,
135 };
136 /* *INDENT-ON* */
137 
138 static clib_error_t *
140  vlib_cli_command_t * cmd)
141 {
142  unformat_input_t _line_input, *line_input = &_line_input;
143  u32 sw_if_index = ~0;
145  vmxnet3_main_t *vmxm = &vmxnet3_main;
146  vmxnet3_device_t *vd;
147  vnet_main_t *vnm = vnet_get_main ();
148  int enable_elog = 0, disable_elog = 0;
149 
150  /* Get a line of input. */
151  if (!unformat_user (input, unformat_line_input, line_input))
152  return 0;
153 
154  while (unformat_check_input (line_input) != UNFORMAT_END_OF_INPUT)
155  {
156  if (unformat (line_input, "sw_if_index %d", &sw_if_index))
157  ;
158  else if (unformat (line_input, "elog-on"))
159  enable_elog = 1;
160  else if (unformat (line_input, "elog-off"))
161  disable_elog = 1;
162  else if (unformat (line_input, "%U", unformat_vnet_sw_interface,
163  vnm, &sw_if_index))
164  ;
165  else
166  return clib_error_return (0, "unknown input `%U'",
167  format_unformat_error, input);
168  }
169  unformat_free (line_input);
170 
171  if (sw_if_index == ~0)
172  return clib_error_return (0,
173  "please specify interface name or sw_if_index");
174 
176  if (hw == NULL || vmxnet3_device_class.index != hw->dev_class_index)
177  return clib_error_return (0, "not a vmxnet3 interface");
178 
179  vd = pool_elt_at_index (vmxm->devices, hw->dev_instance);
180 
181  if (enable_elog)
182  vd->flags |= VMXNET3_DEVICE_F_ELOG;
183 
184  if (disable_elog)
185  vd->flags &= ~VMXNET3_DEVICE_F_ELOG;
186 
187  return 0;
188 }
189 
190 /* *INDENT-OFF* */
192  .path = "test vmxnet3",
193  .short_help = "test vmxnet3 <interface> | sw_if_index <sw_idx> [irq] "
194  "[elog-on] [elog-off]",
195  .function = vmxnet3_test_command_fn,
196 };
197 /* *INDENT-ON* */
198 
199 static void
200 show_vmxnet3 (vlib_main_t * vm, u32 * hw_if_indices, u8 show_descr,
201  u8 show_one_table, u32 which, u8 show_one_slot, u32 slot)
202 {
203  u32 i, desc_idx;
204  vmxnet3_device_t *vd;
205  vnet_main_t *vnm = &vnet_main;
206  vmxnet3_main_t *vmxm = &vmxnet3_main;
208  vmxnet3_rxq_t *rxq;
209  vmxnet3_rx_desc *rxd;
210  vmxnet3_rx_comp *rx_comp;
211  vmxnet3_txq_t *txq;
212  vmxnet3_tx_desc *txd;
213  vmxnet3_tx_comp *tx_comp;
214  u16 qid;
215 
216  vlib_cli_output (vm, "Global:");
217  for (u32 tid = 0; tid <= vlib_num_workers (); tid++)
218  {
220  vec_elt_at_index (vmxm->per_thread_data, tid);
221  vlib_cli_output (vm, " Thread %u: polling queue count %u", tid,
222  ptd->polling_q_count);
223  }
224 
225  if (!hw_if_indices)
226  return;
227 
228  for (i = 0; i < vec_len (hw_if_indices); i++)
229  {
230  hi = vnet_get_hw_interface (vnm, hw_if_indices[i]);
231  vd = vec_elt_at_index (vmxm->devices, hi->dev_instance);
232  vlib_cli_output (vm, "Interface: %U (ifindex %d)",
233  format_vnet_hw_if_index_name, vnm, hw_if_indices[i],
234  hw_if_indices[i]);
235  vlib_cli_output (vm, " Version: %u", vd->version);
236  vlib_cli_output (vm, " GSO enable: %u", vd->gso_enable);
237  vlib_cli_output (vm, " PCI Address: %U", format_vlib_pci_addr,
238  &vd->pci_addr);
239  vlib_cli_output (vm, " Mac Address: %U", format_ethernet_address,
240  vd->mac_addr);
241  vlib_cli_output (vm, " hw if index: %u", vd->hw_if_index);
242  vlib_cli_output (vm, " Device instance: %u", vd->dev_instance);
243  vlib_cli_output (vm, " Number of interrupts: %u", vd->num_intrs);
244 
245  vec_foreach_index (qid, vd->rxqs)
246  {
247  rxq = vec_elt_at_index (vd->rxqs, qid);
248  u16 rid;
249 
250  vlib_cli_output (vm, " Queue %u (RX)", qid);
251  vlib_cli_output (vm, " RX completion next index %u",
252  rxq->rx_comp_ring.next);
253  vlib_cli_output (vm, " RX completion generation flag 0x%x",
254  rxq->rx_comp_ring.gen);
255 
256  /* RX descriptors tables */
257  for (rid = 0; rid < VMXNET3_RX_RING_SIZE; rid++)
258  {
259  vmxnet3_rx_ring *ring = &rxq->rx_ring[rid];
260 
262  " ring %u size %u fill %u "
263  "consume %u produce %u", rid,
264  rxq->size, ring->fill, ring->consume,
265  ring->produce);
266  if (show_descr)
267  {
268  vlib_cli_output (vm, "RX descriptors table");
269  vlib_cli_output (vm, " %5s %18s %10s",
270  "slot", "address", "flags");
271  for (desc_idx = 0; desc_idx < rxq->size; desc_idx++)
272  {
273  rxd = &rxq->rx_desc[rid][desc_idx];
274  vlib_cli_output (vm, " %5u 0x%016llx 0x%08x",
275  desc_idx, rxd->address, rxd->flags);
276  }
277  }
278  else if (show_one_table)
279  {
280  if (((which == VMXNET3_SHOW_RX_DESC0) && (rid == 0)) ||
281  ((which == VMXNET3_SHOW_RX_DESC1) && (rid == 1)))
282  {
283  vlib_cli_output (vm, "RX descriptors table");
284  vlib_cli_output (vm, " %5s %18s %10s",
285  "slot", "address", "flags");
286  if (show_one_slot)
287  {
288  rxd = &rxq->rx_desc[rid][slot];
289  vlib_cli_output (vm, " %5u 0x%016llx 0x%08x",
290  slot, rxd->address, rxd->flags);
291  }
292  else
293  for (desc_idx = 0; desc_idx < rxq->size; desc_idx++)
294  {
295  rxd = &rxq->rx_desc[rid][desc_idx];
296  vlib_cli_output (vm, " %5u 0x%016llx 0x%08x",
297  desc_idx, rxd->address,
298  rxd->flags);
299  }
300  }
301  }
302  }
303 
304  /* RX completion table */
305  if (show_descr)
306  {
307  vlib_cli_output (vm, "RX completion descriptors table");
308  vlib_cli_output (vm, " %5s %10s %10s %10s %10s",
309  "slot", "index", "rss", "len", "flags");
310  for (desc_idx = 0; desc_idx < rxq->size; desc_idx++)
311  {
312  rx_comp = &rxq->rx_comp[desc_idx];
313  vlib_cli_output (vm, " %5u 0x%08x %10u %10u 0x%08x",
314  desc_idx, rx_comp->index, rx_comp->rss,
315  rx_comp->len, rx_comp->flags);
316  }
317  }
318  else if (show_one_table)
319  {
320  if (which == VMXNET3_SHOW_RX_COMP)
321  {
322  vlib_cli_output (vm, "RX completion descriptors table");
323  vlib_cli_output (vm, " %5s %10s %10s %10s %10s",
324  "slot", "index", "rss", "len", "flags");
325  if (show_one_slot)
326  {
327  rx_comp = &rxq->rx_comp[slot];
328  vlib_cli_output (vm, " %5u 0x%08x %10u %10u 0x%08x",
329  slot, rx_comp->index, rx_comp->rss,
330  rx_comp->len, rx_comp->flags);
331  }
332  else
333  for (desc_idx = 0; desc_idx < rxq->size; desc_idx++)
334  {
335  rx_comp = &rxq->rx_comp[desc_idx];
337  " %5u 0x%08x %10u %10u 0x%08x",
338  desc_idx, rx_comp->index, rx_comp->rss,
339  rx_comp->len, rx_comp->flags);
340  }
341  }
342  }
343  }
344 
345  vec_foreach_index (qid, vd->txqs)
346  {
347  txq = vec_elt_at_index (vd->txqs, qid);
348  vlib_cli_output (vm, " Queue %u (TX)", qid);
349  vlib_cli_output (vm, " TX completion next index %u",
350  txq->tx_comp_ring.next);
351  vlib_cli_output (vm, " TX completion generation flag 0x%x",
352  txq->tx_comp_ring.gen);
353  vlib_cli_output (vm, " size %u consume %u produce %u",
354  txq->size, txq->tx_ring.consume,
355  txq->tx_ring.produce);
356  if (show_descr)
357  {
358  vlib_cli_output (vm, "TX descriptors table");
359  vlib_cli_output (vm, " %5s %18s %10s %10s",
360  "slot", "address", "flags0", "flags1");
361  for (desc_idx = 0; desc_idx < txq->size; desc_idx++)
362  {
363  txd = &txq->tx_desc[desc_idx];
364  vlib_cli_output (vm, " %5u 0x%016llx 0x%08x 0x%08x",
365  desc_idx, txd->address, txd->flags[0],
366  txd->flags[1]);
367  }
368 
369  vlib_cli_output (vm, "TX completion descriptors table");
370  vlib_cli_output (vm, " %5s %10s %10s",
371  "slot", "index", "flags");
372  for (desc_idx = 0; desc_idx < txq->size; desc_idx++)
373  {
374  tx_comp = &txq->tx_comp[desc_idx];
375  vlib_cli_output (vm, " %5u 0x%08x 0x%08x",
376  desc_idx, tx_comp->index, tx_comp->flags);
377  }
378  }
379  else if (show_one_table)
380  {
381  if (which == VMXNET3_SHOW_TX_DESC)
382  {
383  vlib_cli_output (vm, "TX descriptors table");
384  vlib_cli_output (vm, " %5s %18s %10s %10s",
385  "slot", "address", "flags0", "flags1");
386  if (show_one_slot)
387  {
388  txd = &txq->tx_desc[slot];
389  vlib_cli_output (vm, " %5u 0x%016llx 0x%08x 0x%08x",
390  slot, txd->address, txd->flags[0],
391  txd->flags[1]);
392  }
393  else
394  for (desc_idx = 0; desc_idx < txq->size; desc_idx++)
395  {
396  txd = &txq->tx_desc[desc_idx];
397  vlib_cli_output (vm, " %5u 0x%016llx 0x%08x 0x%08x",
398  desc_idx, txd->address, txd->flags[0],
399  txd->flags[1]);
400  }
401  }
402  else if (which == VMXNET3_SHOW_TX_COMP)
403  {
404  vlib_cli_output (vm, "TX completion descriptors table");
405  vlib_cli_output (vm, " %5s %10s %10s",
406  "slot", "index", "flags");
407  if (show_one_slot)
408  {
409  tx_comp = &txq->tx_comp[slot];
410  vlib_cli_output (vm, " %5u 0x%08x 0x%08x",
411  slot, tx_comp->index, tx_comp->flags);
412  }
413  else
414  for (desc_idx = 0; desc_idx < txq->size; desc_idx++)
415  {
416  tx_comp = &txq->tx_comp[desc_idx];
417  vlib_cli_output (vm, " %5u 0x%08x 0x%08x",
418  desc_idx, tx_comp->index,
419  tx_comp->flags);
420  }
421  }
422  }
423  }
424  }
425 }
426 
427 static clib_error_t *
429  vlib_cli_command_t * cmd)
430 {
431  vmxnet3_main_t *vmxm = &vmxnet3_main;
432  vnet_main_t *vnm = &vnet_main;
433  vmxnet3_device_t *vd;
434  clib_error_t *error = 0;
435  u32 hw_if_index, *hw_if_indices = 0;
436  vnet_hw_interface_t *hi = 0;
437  u8 show_descr = 0, show_one_table = 0, show_one_slot = 0;
438  u32 which = ~0, slot;
439 
441  {
442  if (unformat
443  (input, "%U", unformat_vnet_hw_interface, vnm, &hw_if_index))
444  {
445  hi = vnet_get_hw_interface (vnm, hw_if_index);
446  if (vmxnet3_device_class.index != hi->dev_class_index)
447  {
448  error = clib_error_return (0, "unknown input `%U'",
449  format_unformat_error, input);
450  goto done;
451  }
452  vec_add1 (hw_if_indices, hw_if_index);
453  }
454  else if (unformat (input, "desc"))
455  show_descr = 1;
456  else if (hi)
457  {
458  vmxnet3_device_t *vd =
459  vec_elt_at_index (vmxm->devices, hi->dev_instance);
460 
461  if (unformat (input, "rx-comp"))
462  {
463  show_one_table = 1;
464  which = VMXNET3_SHOW_RX_COMP;
465  if (unformat (input, "%u", &slot))
466  {
467  vmxnet3_rxq_t *rxq = vec_elt_at_index (vd->rxqs, 0);
468 
469  if (slot >= rxq->size)
470  {
472  "slot size must be < rx queue "
473  "size %u", rxq->size);
474  goto done;
475  }
476  show_one_slot = 1;
477  }
478  }
479  else if (unformat (input, "rx-desc-0"))
480  {
481  show_one_table = 1;
482  which = VMXNET3_SHOW_RX_DESC0;
483  if (unformat (input, "%u", &slot))
484  {
485  vmxnet3_rxq_t *rxq = vec_elt_at_index (vd->rxqs, 0);
486 
487  if (slot >= rxq->size)
488  {
490  "slot size must be < rx queue "
491  "size %u", rxq->size);
492  goto done;
493  }
494  show_one_slot = 1;
495  }
496  }
497  else if (unformat (input, "rx-desc-1"))
498  {
499  show_one_table = 1;
500  which = VMXNET3_SHOW_RX_DESC1;
501  if (unformat (input, "%u", &slot))
502  {
503  vmxnet3_rxq_t *rxq = vec_elt_at_index (vd->rxqs, 0);
504 
505  if (slot >= rxq->size)
506  {
508  "slot size must be < rx queue "
509  "size %u", rxq->size);
510  goto done;
511  }
512  show_one_slot = 1;
513  }
514  }
515  else if (unformat (input, "tx-comp"))
516  {
517  show_one_table = 1;
518  which = VMXNET3_SHOW_TX_COMP;
519  if (unformat (input, "%u", &slot))
520  {
521  vmxnet3_txq_t *txq = vec_elt_at_index (vd->txqs, 0);
522 
523  if (slot >= txq->size)
524  {
526  "slot size must be < tx queue "
527  "size %u", txq->size);
528  goto done;
529  }
530  show_one_slot = 1;
531  }
532  }
533  else if (unformat (input, "tx-desc"))
534  {
535  show_one_table = 1;
536  which = VMXNET3_SHOW_TX_DESC;
537  if (unformat (input, "%u", &slot))
538  {
539  vmxnet3_txq_t *txq = vec_elt_at_index (vd->txqs, 0);
540 
541  if (slot >= txq->size)
542  {
544  "slot size must be < tx queue "
545  "size %u", txq->size);
546  goto done;
547  }
548  show_one_slot = 1;
549  }
550  }
551  else
552  {
553  error = clib_error_return (0, "unknown input `%U'",
554  format_unformat_error, input);
555  goto done;
556  }
557  }
558  else
559  {
560  error = clib_error_return (0, "unknown input `%U'",
561  format_unformat_error, input);
562  goto done;
563  }
564  }
565 
566  if (vec_len (hw_if_indices) == 0)
567  {
568  pool_foreach (vd, vmxm->devices)
569  vec_add1 (hw_if_indices, vd->hw_if_index);
570  }
571 
572  show_vmxnet3 (vm, hw_if_indices, show_descr, show_one_table, which,
573  show_one_slot, slot);
574 
575 done:
576  vec_free (hw_if_indices);
577  return error;
578 }
579 
580 /* *INDENT-OFF* */
582  .path = "show vmxnet3",
583  .short_help = "show vmxnet3 [[<interface>] ([desc] | ([rx-comp] | "
584  "[rx-desc-0] | [rx-desc-1] | [tx-comp] | [tx-desc]) [<slot>])]",
585  .function = show_vmxnet3_fn,
586 };
587 /* *INDENT-ON* */
588 
589 clib_error_t *
591 {
592  vmxnet3_main_t *vmxm = &vmxnet3_main;
594 
595  /* initialize binary API */
597 
598  vmxm->log_default = vlib_log_register_class ("vmxnet3", 0);
599 
600  vec_validate (vmxm->per_thread_data, tm->n_vlib_mains - 1);
601  return 0;
602 }
603 
605 
606 /*
607  * fd.io coding-style-patch-verification: ON
608  *
609  * Local Variables:
610  * eval: (c-set-style "gnu")
611  * End:
612  */
vmxnet3_main
vmxnet3_main_t vmxnet3_main
Definition: vmxnet3.c:29
vmxnet3_device_t::gso_enable
u8 gso_enable
Definition: vmxnet3.h:594
vmxnet3_device_t::dev_instance
u32 dev_instance
Definition: vmxnet3.h:569
vlib.h
vmxnet3_device_t::flags
u32 flags
Definition: vmxnet3.h:566
vlib_num_workers
static u32 vlib_num_workers()
Definition: threads.h:333
vmxnet3_create_if
void vmxnet3_create_if(vlib_main_t *vm, vmxnet3_create_if_args_t *args)
Definition: vmxnet3.c:616
unformat_user
uword unformat_user(unformat_input_t *input, unformat_function_t *func,...)
Definition: unformat.c:989
vmxnet3_create_if_args_t::bind
u8 bind
Definition: vmxnet3.h:617
show_vmxnet3_command
static vlib_cli_command_t show_vmxnet3_command
(constructor) VLIB_CLI_COMMAND (show_vmxnet3_command)
Definition: cli.c:581
vmxnet3_create_command_fn
static clib_error_t * vmxnet3_create_command_fn(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
Definition: cli.c:30
vmxnet3_cli_init
clib_error_t * vmxnet3_cli_init(vlib_main_t *vm)
Definition: cli.c:590
vmxnet3_rx_ring::fill
u16 fill
Definition: vmxnet3.h:500
unformat_line_input
unformat_function_t unformat_line_input
Definition: format.h:275
vmxnet3_txq_t::tx_comp
vmxnet3_tx_comp * tx_comp
Definition: vmxnet3.h:558
pool_elt_at_index
#define pool_elt_at_index(p, i)
Returns pointer to element at given index.
Definition: pool.h:549
format_ethernet_address
u8 * format_ethernet_address(u8 *s, va_list *args)
Definition: format.c:44
vlib_log_register_class
vlib_log_class_t vlib_log_register_class(char *class, char *subclass)
Definition: log.c:339
clib_error_return
#define clib_error_return(e, args...)
Definition: error.h:99
vlib_cli_command_t::path
char * path
Definition: cli.h:96
unformat_vlib_pci_addr
unformat_function_t unformat_vlib_pci_addr
Definition: pci.h:325
vmxnet3_device_t::pci_addr
vlib_pci_addr_t pci_addr
Definition: vmxnet3.h:574
vmxnet3_create_if_args_t::addr
vlib_pci_addr_t addr
Definition: vmxnet3.h:611
u16
unsigned short u16
Definition: types.h:57
vmxnet3_device_t::mac_addr
u8 mac_addr[6]
Definition: vmxnet3.h:586
vmxnet3_plugin_api_hookup
clib_error_t * vmxnet3_plugin_api_hookup(vlib_main_t *vm)
Definition: vmxnet3_api.c:236
vm
vlib_main_t * vm
X-connect all packets from the HOST to the PHY.
Definition: nat44_ei.c:3047
vmxnet3_main_t
Definition: vmxnet3.h:599
hi
vl_api_ip4_address_t hi
Definition: arp.api:37
unformat_input_t
struct _unformat_input_t unformat_input_t
vnet_hw_interface_t::dev_instance
u32 dev_instance
Definition: interface.h:660
vmxnet3_test_command
static vlib_cli_command_t vmxnet3_test_command
(constructor) VLIB_CLI_COMMAND (vmxnet3_test_command)
Definition: cli.c:191
vmxnet3_test_command_fn
static clib_error_t * vmxnet3_test_command_fn(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
Definition: cli.c:139
ethernet.h
error
Definition: cJSON.c:88
show_vmxnet3_fn
static clib_error_t * show_vmxnet3_fn(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
Definition: cli.c:428
vmxnet3_create_if_args_t::rxq_size
u16 rxq_size
Definition: vmxnet3.h:613
vmxnet3_rx_ring::produce
u16 produce
Definition: vmxnet3.h:502
vmxnet3_rxq_t::size
u16 size
Definition: vmxnet3.h:522
unformat
uword unformat(unformat_input_t *i, const char *fmt,...)
Definition: unformat.c:978
vlib_thread_main_t::n_vlib_mains
u32 n_vlib_mains
Definition: threads.h:262
pool_foreach
#define pool_foreach(VAR, POOL)
Iterate through pool.
Definition: pool.h:534
vmxnet3_rx_ring
Definition: vmxnet3.h:495
which
int which
Definition: cJSON.h:234
vmxnet3_create_command
static vlib_cli_command_t vmxnet3_create_command
(constructor) VLIB_CLI_COMMAND (vmxnet3_create_command)
Definition: cli.c:76
vec_len
#define vec_len(v)
Number of elements in vector (rvalue-only, NULL tolerant)
Definition: vec_bootstrap.h:142
unformat_free
static void unformat_free(unformat_input_t *i)
Definition: format.h:155
slot
u8 slot
Definition: pci_types.api:22
vmxnet3_create_if_args_t
Definition: vmxnet3.h:609
vec_add1
#define vec_add1(V, E)
Add 1 element to end of vector (unspecified alignment).
Definition: vec.h:606
vmxnet3_create_if_args_t::txq_num
u16 txq_num
Definition: vmxnet3.h:616
vec_elt_at_index
#define vec_elt_at_index(v, i)
Get vector value at index i checking that i is in bounds.
Definition: vec_bootstrap.h:203
vnet_get_hw_interface
static vnet_hw_interface_t * vnet_get_hw_interface(vnet_main_t *vnm, u32 hw_if_index)
Definition: interface_funcs.h:44
vnet_get_main
vnet_main_t * vnet_get_main(void)
Definition: pnat_test_stubs.h:56
unformat_check_input
static uword unformat_check_input(unformat_input_t *i)
Definition: format.h:163
vmxnet3_main_t::log_default
vlib_log_class_t log_default
Definition: vmxnet3.h:603
vnet_get_sup_hw_interface_api_visible_or_null
static vnet_hw_interface_t * vnet_get_sup_hw_interface_api_visible_or_null(vnet_main_t *vnm, u32 sw_if_index)
Definition: interface_funcs.h:101
vmxnet3_txq_t::tx_comp_ring
vmxnet3_tx_comp_ring tx_comp_ring
Definition: vmxnet3.h:560
vec_foreach_index
#define vec_foreach_index(var, v)
Iterate over vector indices.
Definition: vec_bootstrap.h:220
format_vnet_hw_if_index_name
format_function_t format_vnet_hw_if_index_name
Definition: interface_funcs.h:454
vnet_hw_interface_t::dev_class_index
u32 dev_class_index
Definition: interface.h:659
vmxnet3_delete_command_fn
static clib_error_t * vmxnet3_delete_command_fn(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
Definition: cli.c:87
vmxnet3_rxq_t::rx_comp_ring
vmxnet3_rx_comp_ring rx_comp_ring
Definition: vmxnet3.h:530
vmxnet3_tx_ring::produce
u16 produce
Definition: vmxnet3.h:538
vmxnet3_rx_ring::consume
u16 consume
Definition: vmxnet3.h:503
vmxnet3_main_t::per_thread_data
vmxnet3_per_thread_data_t * per_thread_data
Definition: vmxnet3.h:604
format_unformat_error
u8 * format_unformat_error(u8 *s, va_list *va)
Definition: unformat.c:91
vmxnet3_rx_comp_ring::gen
u32 gen
Definition: vmxnet3.h:509
vec_validate
#define vec_validate(V, I)
Make sure vector is long enough for given index (no header, unspecified alignment)
Definition: vec.h:523
VLIB_CLI_COMMAND
#define VLIB_CLI_COMMAND(x,...)
Definition: cli.h:163
show_vmxnet3
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)
Definition: cli.c:200
vmxnet3_create_if_args_t::txq_size
u16 txq_size
Definition: vmxnet3.h:615
unformat_vnet_hw_interface
unformat_function_t unformat_vnet_hw_interface
Definition: interface_funcs.h:463
vlib_cli_output
void vlib_cli_output(vlib_main_t *vm, char *fmt,...)
Definition: cli.c:716
vmxnet3_device_t::num_intrs
u16 num_intrs
Definition: vmxnet3.h:583
vmxnet3_rxq_t::rx_comp
vmxnet3_rx_comp * rx_comp
Definition: vmxnet3.h:529
vmxnet3_tx_comp_ring::gen
u32 gen
Definition: vmxnet3.h:545
VMXNET3_RX_RING_SIZE
#define VMXNET3_RX_RING_SIZE
Definition: vmxnet3.h:158
vnet_hw_interface_t
Definition: interface.h:638
vnet_main_t
Definition: vnet.h:76
vec_free
#define vec_free(V)
Free vector's memory (no header).
Definition: vec.h:395
size
u32 size
Definition: vhost_user.h:125
format_vlib_pci_addr
format_function_t format_vlib_pci_addr
Definition: pci.h:326
format_vnet_sw_if_index_name
format_function_t format_vnet_sw_if_index_name
Definition: interface_funcs.h:458
unformat_vnet_sw_interface
unformat_function_t unformat_vnet_sw_interface
Definition: interface_funcs.h:462
vmxnet3_device_t::rxqs
vmxnet3_rxq_t * rxqs
Definition: vmxnet3.h:578
vmxnet3_txq_t::tx_ring
vmxnet3_tx_ring tx_ring
Definition: vmxnet3.h:559
vmxnet3_create_if_args_t::enable_elog
u32 enable_elog
Definition: vmxnet3.h:612
vmxnet3_tx_comp_ring::next
u16 next
Definition: vmxnet3.h:546
u32
unsigned int u32
Definition: types.h:88
vmxnet3_txq_t
Definition: vmxnet3.h:549
VLIB_INIT_FUNCTION
#define VLIB_INIT_FUNCTION(x)
Definition: init.h:172
vmxnet3_create_if_args_t::sw_if_index
u32 sw_if_index
Definition: vmxnet3.h:621
vlib_thread_main_t
Definition: threads.h:243
vmxnet3_rxq_t::rx_ring
vmxnet3_rx_ring rx_ring[VMXNET3_RX_RING_SIZE]
Definition: vmxnet3.h:527
pci.h
vmxnet3_per_thread_data_t::polling_q_count
u32 polling_q_count
Definition: vmxnet3.h:516
vmxnet3_create_if_args_t::enable_gso
u8 enable_gso
Definition: vmxnet3.h:618
vnet_main
vnet_main_t vnet_main
Definition: misc.c:43
vmxnet3_device_t::txqs
vmxnet3_txq_t * txqs
Definition: vmxnet3.h:579
clib_memset
clib_memset(h->entries, 0, sizeof(h->entries[0]) *entries)
vlib_main_t
Definition: main.h:102
vmxnet3_rxq_t
Definition: vmxnet3.h:519
u8
unsigned char u8
Definition: types.h:56
clib_error_t
Definition: clib_error.h:21
unix.h
vmxnet3_create_if_args_t::error
clib_error_t * error
Definition: vmxnet3.h:622
vlib_init_function_t
clib_error_t *() vlib_init_function_t(struct vlib_main_t *vm)
Definition: init.h:51
i
int i
Definition: flowhash_template.h:376
vmxnet3_txq_t::tx_desc
vmxnet3_tx_desc * tx_desc
Definition: vmxnet3.h:557
vmxnet3_delete_command
static vlib_cli_command_t vmxnet3_delete_command
(constructor) VLIB_CLI_COMMAND (vmxnet3_delete_command)
Definition: cli.c:130
vmxnet3_delete_if
void vmxnet3_delete_if(vlib_main_t *vm, vmxnet3_device_t *vd)
Definition: vmxnet3.c:888
vmxnet3_per_thread_data_t
Definition: vmxnet3.h:513
vlib_cli_command_t
Definition: cli.h:92
vlib_get_thread_main
static vlib_thread_main_t * vlib_get_thread_main()
Definition: global_funcs.h:56
vmxnet3_device_t::version
u8 version
Definition: vmxnet3.h:585
vmxnet3_txq_t::size
u16 size
Definition: vmxnet3.h:552
sw_if_index
vl_api_interface_index_t sw_if_index
Definition: wireguard.api:34
vmxnet3_device_t
Definition: vmxnet3.h:563
vmxnet3_main_t::devices
vmxnet3_device_t * devices
Definition: vmxnet3.h:601
vmxnet3.h
vmxnet3_device_t::hw_if_index
u32 hw_if_index
Definition: vmxnet3.h:571
UNFORMAT_END_OF_INPUT
#define UNFORMAT_END_OF_INPUT
Definition: format.h:137
vmxnet3_rx_comp_ring::next
u16 next
Definition: vmxnet3.h:510
vmxnet3_create_if_args_t::rxq_num
u16 rxq_num
Definition: vmxnet3.h:614
vmxnet3_rxq_t::rx_desc
vmxnet3_rx_desc * rx_desc[VMXNET3_RX_RING_SIZE]
Definition: vmxnet3.h:528
vmxnet3_device_class
vnet_device_class_t vmxnet3_device_class
vmxnet3_tx_ring::consume
u16 consume
Definition: vmxnet3.h:539