FD.io VPP  v18.04-17-g3a0d853
Vector Packet Processing
cli.c
Go to the documentation of this file.
1 /*
2  *------------------------------------------------------------------
3  * Copyright (c) 2016 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 <vnet/ethernet/ethernet.h>
25 
26 #include <memif/memif.h>
27 #include <memif/private.h>
28 
29 
30 static clib_error_t *
32  unformat_input_t * input,
33  vlib_cli_command_t * cmd)
34 {
35  unformat_input_t _line_input, *line_input = &_line_input;
36  int r;
37  u32 socket_id;
38  u8 *socket_filename;
39 
40  /* Get a line of input. */
41  if (!unformat_user (input, unformat_line_input, line_input))
42  return 0;
43 
44  socket_id = ~0;
45  socket_filename = 0;
46 
47  while (unformat_check_input (line_input) != UNFORMAT_END_OF_INPUT)
48  {
49  if (unformat (line_input, "id %u", &socket_id))
50  ;
51  else if (unformat (line_input, "filename %s", &socket_filename))
52  ;
53  else
54  {
55  vec_free (socket_filename);
56  return clib_error_return (0, "unknown input `%U'",
57  format_unformat_error, input);
58  }
59  }
60 
61  unformat_free (line_input);
62 
63  if (socket_id == 0 || socket_id == ~0)
64  {
65  vec_free (socket_filename);
66  return clib_error_return (0, "Invalid socket id");
67  }
68 
69  if (!socket_filename || *socket_filename == 0)
70  {
71  vec_free (socket_filename);
72  return clib_error_return (0, "Invalid socket filename");
73  }
74 
75  r = memif_socket_filename_add_del (1, socket_id, socket_filename);
76 
77  vec_free (socket_filename);
78 
79  if (r < 0)
80  {
81  switch (r)
82  {
83  case VNET_API_ERROR_INVALID_ARGUMENT:
84  return clib_error_return (0, "Invalid argument");
85  case VNET_API_ERROR_SYSCALL_ERROR_1:
86  return clib_error_return (0, "Syscall error 1");
87  case VNET_API_ERROR_ENTRY_ALREADY_EXISTS:
88  return clib_error_return (0, "Already exists");
89  case VNET_API_ERROR_UNEXPECTED_INTF_STATE:
90  return clib_error_return (0, "Interface still in use");
91  default:
92  return clib_error_return (0, "Unknown error");
93  }
94  }
95 
96  return 0;
97 }
98 
99 /* *INDENT-OFF* */
100 VLIB_CLI_COMMAND (memif_socket_filename_create_command, static) = {
101  .path = "create memif socket",
102  .short_help = "create memif socket [id <id>] [filename <path>]",
104 };
105 /* *INDENT-ON* */
106 
107 static clib_error_t *
109  unformat_input_t * input,
110  vlib_cli_command_t * cmd)
111 {
112  unformat_input_t _line_input, *line_input = &_line_input;
113  int r;
114  u32 socket_id;
115 
116  /* Get a line of input. */
117  if (!unformat_user (input, unformat_line_input, line_input))
118  return 0;
119 
120  socket_id = ~0;
121 
122  while (unformat_check_input (line_input) != UNFORMAT_END_OF_INPUT)
123  {
124  if (unformat (line_input, "id %u", &socket_id))
125  ;
126  else
127  {
128  return clib_error_return (0, "unknown input `%U'",
129  format_unformat_error, input);
130  }
131  }
132 
133  unformat_free (line_input);
134 
135  if (socket_id == 0 || socket_id == ~0)
136  {
137  return clib_error_return (0, "Invalid socket id");
138  }
139 
140  r = memif_socket_filename_add_del (0, socket_id, 0);
141 
142  if (r < 0)
143  {
144  switch (r)
145  {
146  case VNET_API_ERROR_INVALID_ARGUMENT:
147  return clib_error_return (0, "Invalid argument");
148  case VNET_API_ERROR_SYSCALL_ERROR_1:
149  return clib_error_return (0, "Syscall error 1");
150  case VNET_API_ERROR_ENTRY_ALREADY_EXISTS:
151  return clib_error_return (0, "Already exists");
152  case VNET_API_ERROR_UNEXPECTED_INTF_STATE:
153  return clib_error_return (0, "Interface still in use");
154  default:
155  return clib_error_return (0, "Unknown error");
156  }
157  }
158 
159  return 0;
160 }
161 
162 /* *INDENT-OFF* */
163 VLIB_CLI_COMMAND (memif_socket_filename_delete_command, static) = {
164  .path = "delete memif socket",
165  .short_help = "delete memif socket [id <id>]",
167 };
168 /* *INDENT-ON* */
169 
170 static clib_error_t *
172  vlib_cli_command_t * cmd)
173 {
174  unformat_input_t _line_input, *line_input = &_line_input;
175  int r;
176  u32 ring_size = MEMIF_DEFAULT_RING_SIZE;
177  memif_create_if_args_t args = { 0 };
179  u32 rx_queues = MEMIF_DEFAULT_RX_QUEUES;
180  u32 tx_queues = MEMIF_DEFAULT_TX_QUEUES;
181 
182  /* Get a line of input. */
183  if (!unformat_user (input, unformat_line_input, line_input))
184  return 0;
185 
186  args.is_zero_copy = 1;
187 
188  while (unformat_check_input (line_input) != UNFORMAT_END_OF_INPUT)
189  {
190  if (unformat (line_input, "id %u", &args.id))
191  ;
192  else if (unformat (line_input, "socket-id %u", &args.socket_id))
193  ;
194  else if (unformat (line_input, "secret %s", &args.secret))
195  ;
196  else if (unformat (line_input, "ring-size %u", &ring_size))
197  ;
198  else if (unformat (line_input, "rx-queues %u", &rx_queues))
199  ;
200  else if (unformat (line_input, "tx-queues %u", &tx_queues))
201  ;
202  else if (unformat (line_input, "buffer-size %u", &args.buffer_size))
203  ;
204  else if (unformat (line_input, "master"))
205  args.is_master = 1;
206  else if (unformat (line_input, "slave"))
207  args.is_master = 0;
208  else if (unformat (line_input, "no-zero-copy"))
209  args.is_zero_copy = 0;
210  else if (unformat (line_input, "mode ip"))
212  else if (unformat (line_input, "hw-addr %U",
214  args.hw_addr_set = 1;
215  else
216  return clib_error_return (0, "unknown input `%U'",
217  format_unformat_error, input);
218  }
219  unformat_free (line_input);
220 
221  if (!is_pow2 (ring_size))
222  return clib_error_return (0, "ring size must be power of 2");
223 
224  if (ring_size > 32768)
225  return clib_error_return (0, "maximum ring size is 32768");
226 
227  args.log2_ring_size = min_log2 (ring_size);
228 
229  if (rx_queues > 255 || rx_queues < 1)
230  return clib_error_return (0, "rx queue must be between 1 - 255");
231  if (tx_queues > 255 || tx_queues < 1)
232  return clib_error_return (0, "tx queue must be between 1 - 255");
233 
234  args.rx_queues = rx_queues;
235  args.tx_queues = tx_queues;
236 
237  r = memif_create_if (vm, &args);
238 
239  vec_free (args.secret);
240 
241  if (r <= VNET_API_ERROR_SYSCALL_ERROR_1
242  && r >= VNET_API_ERROR_SYSCALL_ERROR_10)
243  return clib_error_return (0, "%s (errno %d)", strerror (errno), errno);
244 
245  if (r == VNET_API_ERROR_INVALID_ARGUMENT)
246  return clib_error_return (0, "Invalid argument");
247 
248  if (r == VNET_API_ERROR_INVALID_INTERFACE)
249  return clib_error_return (0, "Invalid interface name");
250 
251  if (r == VNET_API_ERROR_SUBIF_ALREADY_EXISTS)
252  return clib_error_return (0, "Interface with same id already exists");
253 
254  return 0;
255 }
256 
257 /* *INDENT-OFF* */
258 VLIB_CLI_COMMAND (memif_create_command, static) = {
259  .path = "create interface memif",
260  .short_help = "create interface memif [id <id>] [socket-id <socket-id>] "
261  "[ring-size <size>] [buffer-size <size>] "
262  "[hw-addr <mac-address>] "
263  "<master|slave> [rx-queues <number>] [tx-queues <number>] "
264  "[mode ip] [secret <string>]",
265  .function = memif_create_command_fn,
266 };
267 /* *INDENT-ON* */
268 
269 static clib_error_t *
271  vlib_cli_command_t * cmd)
272 {
273  vlib_cli_output (vm, "command deprecated. Please use "
274  "'create interface memif' instead.\n");
275  return 0;
276 }
277 
278 /* *INDENT-OFF* */
279 VLIB_CLI_COMMAND (create_memif_command, static) = {
280  .path = "create memif",
281  .function = create_memif_command_fn,
282 };
283 /* *INDENT-ON* */
284 
285 static clib_error_t *
287  vlib_cli_command_t * cmd)
288 {
289  unformat_input_t _line_input, *line_input = &_line_input;
290  u32 sw_if_index = ~0;
292  memif_main_t *mm = &memif_main;
293  memif_if_t *mif;
294  vnet_main_t *vnm = vnet_get_main ();
295 
296  /* Get a line of input. */
297  if (!unformat_user (input, unformat_line_input, line_input))
298  return 0;
299 
300  while (unformat_check_input (line_input) != UNFORMAT_END_OF_INPUT)
301  {
302  if (unformat (line_input, "sw_if_index %d", &sw_if_index))
303  ;
304  else if (unformat (line_input, "%U", unformat_vnet_sw_interface,
305  vnm, &sw_if_index))
306  ;
307  else
308  return clib_error_return (0, "unknown input `%U'",
309  format_unformat_error, input);
310  }
311  unformat_free (line_input);
312 
313  if (sw_if_index == ~0)
314  return clib_error_return (0,
315  "please specify interface name or sw_if_index");
316 
317  hw = vnet_get_sup_hw_interface (vnm, sw_if_index);
318  if (hw == NULL || memif_device_class.index != hw->dev_class_index)
319  return clib_error_return (0, "not a memif interface");
320 
321  mif = pool_elt_at_index (mm->interfaces, hw->dev_instance);
322  memif_delete_if (vm, mif);
323 
324  return 0;
325 }
326 
327 /* *INDENT-OFF* */
328 VLIB_CLI_COMMAND (memif_delete_command, static) = {
329  .path = "delete interface memif",
330  .short_help = "delete interface memif {<interface> | sw_if_index <sw_idx>}",
331  .function = memif_delete_command_fn,
332 };
333 /* *INDENT-ON* */
334 
335 static u8 *
336 format_memif_if_flags (u8 * s, va_list * args)
337 {
338  u32 flags = va_arg (*args, u32);
339 #define _(a,b,c) if ( flags & (1 << a)) s = format (s, " %s", c);
341 #undef _
342  return s;
343 }
344 
345 static u8 *
346 format_memif_if_mode (u8 * s, va_list * args)
347 {
348  memif_if_t *mif = va_arg (*args, memif_if_t *);
350  return format (s, "ethernet");
351  if (mif->mode == MEMIF_INTERFACE_MODE_IP)
352  return format (s, "ip");
354  return format (s, "punt-inject");
355  return format (s, "unknown mode (%u)", mif->mode);;
356 }
357 
358 static u8 *
359 format_memif_queue (u8 * s, va_list * args)
360 {
361  memif_queue_t *mq = va_arg (*args, memif_queue_t *);
362  uword i = va_arg (*args, uword);
363  u32 indent = format_get_indent (s);
364 
365  s = format (s, "%U%s ring %u:\n",
366  format_white_space, indent,
367  (mq->type == MEMIF_RING_S2M) ?
368  "slave-to-master" : "master-to-slave", i);
369  s = format (s, "%Uregion %u offset %u ring-size %u int-fd %d\n",
370  format_white_space, indent + 4,
371  mq->region, mq->offset, (1 << mq->log2_ring_size), mq->int_fd);
372 
373  if (mq->ring)
374  s = format (s, "%Uhead %u tail %u flags 0x%04x interrupts %u\n",
375  format_white_space, indent + 4,
376  mq->ring->head, mq->ring->tail, mq->ring->flags,
377  mq->int_count);
378 
379  return s;
380 }
381 
382 static u8 *
383 format_memif_descriptor (u8 * s, va_list * args)
384 {
385  memif_if_t *mif = va_arg (*args, memif_if_t *);
386  memif_queue_t *mq = va_arg (*args, memif_queue_t *);
387  u32 indent = format_get_indent (s);
388  memif_ring_t *ring;
389  u16 ring_size;
390  u16 slot;
391 
392  ring_size = 1 << mq->log2_ring_size;
393  ring = mq->ring;
394  if (ring)
395  {
396  s = format (s, "%Udescriptor table:\n", format_white_space, indent);
397  s =
398  format (s,
399  "%Uid flags len address offset user address\n",
400  format_white_space, indent);
401  s =
402  format (s,
403  "%U===== ===== ======== ================== ====== ==================\n",
404  format_white_space, indent);
405  for (slot = 0; slot < ring_size; slot++)
406  {
407  s = format (s, "%U%-5d %-5d %-7d 0x%016lx %-6d 0x%016lx\n",
408  format_white_space, indent, slot,
409  ring->desc[slot].flags,
410  ring->desc[slot].length,
411  mif->regions[ring->desc[slot].region].shm,
412  ring->desc[slot].offset, memif_get_buffer (mif, ring,
413  slot));
414  }
415  s = format (s, "\n");
416  }
417 
418  return s;
419 }
420 
421 static clib_error_t *
423  vlib_cli_command_t * cmd)
424 {
425  memif_main_t *mm = &memif_main;
426  memif_if_t *mif;
427  vnet_main_t *vnm = vnet_get_main ();
428  memif_region_t *mr;
429  memif_queue_t *mq;
430  uword i;
431  int show_descr = 0;
432  clib_error_t *error = 0;
433  u32 hw_if_index, *hw_if_indices = 0;
434  u32 sock_id;
435  u32 msf_idx;
436  u8 *s = 0;
437 
439  {
440  if (unformat
441  (input, "%U", unformat_vnet_hw_interface, vnm, &hw_if_index))
442  vec_add1 (hw_if_indices, hw_if_index);
443  else if (unformat (input, "descriptors"))
444  show_descr = 1;
445  else
446  {
447  error = clib_error_return (0, "unknown input `%U'",
448  format_unformat_error, input);
449  goto done;
450  }
451  }
452 
453  vlib_cli_output (vm, "sockets\n");
454  vlib_cli_output (vm, " %-3s %-11s %s\n", "id", "listener", "filename");
455 
456  /* *INDENT-OFF* */
457  hash_foreach (sock_id, msf_idx, mm->socket_file_index_by_sock_id,
458  ({
459  memif_socket_file_t *msf;
460  u8 *filename;
461 
462  msf = pool_elt_at_index(mm->socket_files, msf_idx);
463  filename = msf->filename;
464  if (msf->is_listener)
465  s = format (s, "yes (%u)", msf->ref_cnt);
466  else
467  s = format (s, "no");
468 
469  vlib_cli_output(vm, " %-3u %-11v %s\n", sock_id, s, filename);
470  vec_reset_length (s);
471  }));
472  /* *INDENT-ON* */
473  vec_free (s);
474 
475  vlib_cli_output (vm, "\n");
476 
477  if (vec_len (hw_if_indices) == 0)
478  {
479  /* *INDENT-OFF* */
480  pool_foreach (mif, mm->interfaces,
481  vec_add1 (hw_if_indices, mif->hw_if_index);
482  );
483  /* *INDENT-ON* */
484  }
485 
486  for (hw_if_index = 0; hw_if_index < vec_len (hw_if_indices); hw_if_index++)
487  {
489  vnet_get_hw_interface (vnm, hw_if_indices[hw_if_index]);
490  mif = pool_elt_at_index (mm->interfaces, hi->dev_instance);
492  mif->socket_file_index);
493  vlib_cli_output (vm, "interface %U", format_vnet_sw_if_index_name,
494  vnm, mif->sw_if_index);
495  if (mif->remote_name)
496  vlib_cli_output (vm, " remote-name \"%s\"", mif->remote_name);
497  if (mif->remote_if_name)
498  vlib_cli_output (vm, " remote-interface \"%s\"",
499  mif->remote_if_name);
500  vlib_cli_output (vm, " socket-id %u id %u mode %U", msf->socket_id,
501  mif->id, format_memif_if_mode, mif);
502  vlib_cli_output (vm, " flags%U", format_memif_if_flags, mif->flags);
503  vlib_cli_output (vm, " listener-fd %d conn-fd %d",
504  msf->sock ? msf->sock->fd : 0,
505  mif->sock ? mif->sock->fd : 0);
506  vlib_cli_output (vm, " num-s2m-rings %u num-m2s-rings %u "
507  "buffer-size %u num-regions %u",
508  mif->run.num_s2m_rings, mif->run.num_m2s_rings,
509  mif->run.buffer_size, vec_len (mif->regions));
510 
511  if (mif->local_disc_string)
512  vlib_cli_output (vm, " local-disc-reason \"%s\"",
513  mif->local_disc_string);
514  if (mif->remote_disc_string)
515  vlib_cli_output (vm, " remote-disc-reason \"%s\"",
516  mif->remote_disc_string);
517 
518  /* *INDENT-OFF* */
519  vec_foreach_index (i, mif->regions)
520  {
521  mr = vec_elt_at_index (mif->regions, i);
522  vlib_cli_output (vm, " region %u size %u fd %d", i,
523  mr->region_size, mr->fd);
524  }
525  vec_foreach_index (i, mif->tx_queues)
526  {
527  mq = vec_elt_at_index (mif->tx_queues, i);
528  vlib_cli_output (vm, " %U", format_memif_queue, mq, i);
529  if (show_descr)
530  vlib_cli_output (vm, " %U", format_memif_descriptor, mif, mq);
531  }
532  vec_foreach_index (i, mif->rx_queues)
533  {
534  mq = vec_elt_at_index (mif->rx_queues, i);
535  vlib_cli_output (vm, " %U", format_memif_queue, mq, i);
536  if (show_descr)
537  vlib_cli_output (vm, " %U", format_memif_descriptor, mif, mq);
538  }
539  /* *INDENT-ON* */
540  }
541 done:
542  vec_free (hw_if_indices);
543  return error;
544 }
545 
546 /* *INDENT-OFF* */
547 VLIB_CLI_COMMAND (memif_show_command, static) = {
548  .path = "show memif",
549  .short_help = "show memif [<interface>] [descriptors]",
550  .function = memif_show_command_fn,
551 };
552 /* *INDENT-ON* */
553 
554 clib_error_t *
556 {
557  return 0;
558 }
559 
561 
562 /*
563  * fd.io coding-style-patch-verification: ON
564  *
565  * Local Variables:
566  * eval: (c-set-style "gnu")
567  * End:
568  */
memif_if_t * interfaces
Definition: private.h:221
unformat_function_t unformat_vnet_hw_interface
vmrglw vmrglh hi
#define vec_foreach_index(var, v)
Iterate over vector indices.
vnet_main_t * vnet_get_main(void)
Definition: misc.c:47
static vnet_hw_interface_t * vnet_get_sup_hw_interface(vnet_main_t *vnm, u32 sw_if_index)
struct memif_if_t::@424 run
memif_socket_file_t * socket_files
Definition: private.h:224
#define NULL
Definition: clib.h:55
static clib_error_t * memif_socket_filename_create_command_fn(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
Definition: cli.c:31
static clib_error_t * memif_create_command_fn(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
Definition: cli.c:171
static u8 * format_memif_if_flags(u8 *s, va_list *args)
Definition: cli.c:336
static clib_error_t * memif_socket_filename_delete_command_fn(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
Definition: cli.c:108
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).
Definition: vec.h:520
int i
uword unformat_user(unformat_input_t *input, unformat_function_t *func,...)
Definition: unformat.c:983
static u32 format_get_indent(u8 *s)
Definition: format.h:72
memif_interface_mode_t mode
Definition: private.h:249
u8 * format(u8 *s, const char *fmt,...)
Definition: format.c:419
unformat_function_t unformat_vnet_sw_interface
u8 num_m2s_rings
Definition: private.h:166
format_function_t format_vnet_sw_if_index_name
static uword min_log2(uword x)
Definition: clib.h:197
uint32_t length
Definition: memif.h:152
u8 * remote_name
Definition: private.h:159
#define pool_foreach(VAR, POOL, BODY)
Iterate through pool.
Definition: pool.h:440
#define VLIB_INIT_FUNCTION(x)
Definition: init.h:111
uword socket_file_index
Definition: private.h:149
u8 * format_white_space(u8 *s, va_list *va)
Definition: std-formats.c:113
u16 buffer_size
Definition: private.h:167
memif_log2_ring_size_t log2_ring_size
Definition: private.h:250
#define hash_foreach(key_var, value_var, h, body)
Definition: hash.h:441
uint16_t flags
Definition: memif.h:149
#define vec_elt_at_index(v, i)
Get vector value at index i checking that i is in bounds.
vnet_device_class_t memif_device_class
#define clib_error_return(e, args...)
Definition: error.h:99
memif_region_offset_t offset
Definition: private.h:103
unformat_function_t unformat_line_input
Definition: format.h:281
memif_region_index_t region
Definition: memif.h:151
static clib_error_t * memif_delete_command_fn(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
Definition: cli.c:286
#define pool_elt_at_index(p, i)
Returns pointer to element at given index.
Definition: pool.h:461
memif_desc_t desc[0]
Definition: memif.h:173
static clib_error_t * memif_show_command_fn(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
Definition: cli.c:422
int memif_delete_if(vlib_main_t *vm, memif_if_t *mif)
Definition: memif.c:629
struct _unformat_input_t unformat_input_t
memif_interface_id_t id
Definition: private.h:244
int memif_create_if(vlib_main_t *vm, memif_create_if_args_t *args)
Definition: memif.c:706
#define MEMIF_DEFAULT_TX_QUEUES
Definition: private.h:23
memif_queue_t * tx_queues
Definition: private.h:156
#define UNFORMAT_END_OF_INPUT
Definition: format.h:143
vlib_main_t * vm
Definition: buffer.c:294
u8 * local_disc_string
Definition: private.h:179
#define vec_free(V)
Free vector&#39;s memory (no header).
Definition: vec.h:336
int memif_socket_filename_add_del(u8 is_add, u32 sock_id, u8 *sock_filename)
Definition: memif.c:590
static u8 * format_memif_if_mode(u8 *s, va_list *args)
Definition: cli.c:346
#define MEMIF_DEFAULT_BUFFER_SIZE
Definition: private.h:24
#define VLIB_CLI_COMMAND(x,...)
Definition: cli.h:154
memif_ring_type_t type
Definition: private.h:115
memif_region_t * regions
Definition: private.h:153
uword unformat_ethernet_address(unformat_input_t *input, va_list *args)
Definition: format.c:227
unsigned int u32
Definition: types.h:88
static_always_inline void * memif_get_buffer(memif_if_t *mif, memif_ring_t *ring, u16 slot)
Definition: private.h:268
u32 flags
Definition: private.h:138
memif_ring_t * ring
Definition: private.h:100
#define MEMIF_DEFAULT_RX_QUEUES
Definition: private.h:22
u32 hw_if_index
Definition: private.h:140
static clib_error_t * create_memif_command_fn(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
Definition: cli.c:270
u64 int_count
Definition: private.h:112
static uword is_pow2(uword x)
Definition: clib.h:280
u64 uword
Definition: types.h:112
memif_region_offset_t offset
Definition: memif.h:153
u8 num_s2m_rings
Definition: private.h:165
unsigned short u16
Definition: types.h:57
#define vec_len(v)
Number of elements in vector (rvalue-only, NULL tolerant)
unsigned char u8
Definition: types.h:56
clib_error_t * memif_cli_init(vlib_main_t *vm)
Definition: cli.c:555
static void unformat_free(unformat_input_t *i)
Definition: format.h:161
void * shm
Definition: private.h:85
u8 * remote_if_name
Definition: private.h:160
memif_interface_id_t id
Definition: private.h:139
memif_log2_ring_size_t log2_ring_size
Definition: private.h:101
static u8 * format_memif_descriptor(u8 *s, va_list *args)
Definition: cli.c:383
u8 * format_unformat_error(u8 *s, va_list *va)
Definition: unformat.c:91
#define MEMIF_DEFAULT_RING_SIZE
Definition: private.h:21
uint16_t flags
Definition: memif.h:167
u8 * remote_disc_string
Definition: private.h:180
volatile uint16_t head
Definition: memif.h:169
clib_socket_t * sock
Definition: private.h:148
memif_queue_t * rx_queues
Definition: private.h:155
uword * socket_file_index_by_sock_id
Definition: private.h:225
static u8 * format_memif_queue(u8 *s, va_list *args)
Definition: cli.c:359
u32 flags
Definition: vhost-user.h:77
memif_main_t memif_main
Definition: memif.c:43
memif_region_index_t region
Definition: private.h:102
void vlib_cli_output(vlib_main_t *vm, char *fmt,...)
Definition: cli.c:680
clib_socket_t * sock
Definition: private.h:69
u32 sw_if_index
Definition: private.h:141
volatile uint16_t tail
Definition: memif.h:171
uword unformat(unformat_input_t *i, const char *fmt,...)
Definition: unformat.c:972
memif_interface_mode_t mode
Definition: private.h:143
memif_region_size_t region_size
Definition: private.h:86
static uword unformat_check_input(unformat_input_t *i)
Definition: format.h:169