FD.io VPP  v20.05.1-6-gf53edbc3b
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  unformat_input_t _line_input, *line_input = &_line_input;
274  u32 sw_if_index = ~0;
276  memif_main_t *mm = &memif_main;
277  memif_if_t *mif;
278  vnet_main_t *vnm = vnet_get_main ();
279 
280  /* Get a line of input. */
281  if (!unformat_user (input, unformat_line_input, line_input))
282  return 0;
283 
284  while (unformat_check_input (line_input) != UNFORMAT_END_OF_INPUT)
285  {
286  if (unformat (line_input, "sw_if_index %d", &sw_if_index))
287  ;
288  else if (unformat (line_input, "%U", unformat_vnet_sw_interface,
289  vnm, &sw_if_index))
290  ;
291  else
292  return clib_error_return (0, "unknown input `%U'",
293  format_unformat_error, input);
294  }
295  unformat_free (line_input);
296 
297  if (sw_if_index == ~0)
298  return clib_error_return (0,
299  "please specify interface name or sw_if_index");
300 
301  hw = vnet_get_sup_hw_interface_api_visible_or_null (vnm, sw_if_index);
302  if (hw == NULL || memif_device_class.index != hw->dev_class_index)
303  return clib_error_return (0, "not a memif interface");
304 
305  mif = pool_elt_at_index (mm->interfaces, hw->dev_instance);
306  memif_delete_if (vm, mif);
307 
308  return 0;
309 }
310 
311 /* *INDENT-OFF* */
312 VLIB_CLI_COMMAND (memif_delete_command, static) = {
313  .path = "delete interface memif",
314  .short_help = "delete interface memif {<interface> | sw_if_index <sw_idx>}",
315  .function = memif_delete_command_fn,
316 };
317 /* *INDENT-ON* */
318 
319 static u8 *
320 format_memif_if_flags (u8 * s, va_list * args)
321 {
322  u32 flags = va_arg (*args, u32);
323 #define _(a,b,c) if ( flags & (1 << a)) s = format (s, " %s", c);
325 #undef _
326  return s;
327 }
328 
329 static u8 *
330 format_memif_if_mode (u8 * s, va_list * args)
331 {
332  memif_if_t *mif = va_arg (*args, memif_if_t *);
334  return format (s, "ethernet");
335  if (mif->mode == MEMIF_INTERFACE_MODE_IP)
336  return format (s, "ip");
338  return format (s, "punt-inject");
339  return format (s, "unknown mode (%u)", mif->mode);;
340 }
341 
342 static u8 *
343 format_memif_queue (u8 * s, va_list * args)
344 {
345  memif_queue_t *mq = va_arg (*args, memif_queue_t *);
346  uword i = va_arg (*args, uword);
347  u32 indent = format_get_indent (s);
348 
349  s = format (s, "%U%s ring %u:\n",
350  format_white_space, indent,
351  (mq->type == MEMIF_RING_S2M) ?
352  "slave-to-master" : "master-to-slave", i);
353  s = format (s, "%Uregion %u offset %u ring-size %u int-fd %d\n",
354  format_white_space, indent + 4,
355  mq->region, mq->offset, (1 << mq->log2_ring_size), mq->int_fd);
356 
357  if (mq->ring)
358  s = format (s, "%Uhead %u tail %u flags 0x%04x interrupts %u\n",
359  format_white_space, indent + 4,
360  mq->ring->head, mq->ring->tail, mq->ring->flags,
361  mq->int_count);
362 
363  return s;
364 }
365 
366 static u8 *
367 format_memif_descriptor (u8 * s, va_list * args)
368 {
369  memif_if_t *mif = va_arg (*args, memif_if_t *);
370  memif_queue_t *mq = va_arg (*args, memif_queue_t *);
371  u32 indent = format_get_indent (s);
372  memif_ring_t *ring;
373  u16 ring_size;
374  u16 slot;
375 
376  ring_size = 1 << mq->log2_ring_size;
377  ring = mq->ring;
378  if (ring)
379  {
380  s = format (s, "%Udescriptor table:\n", format_white_space, indent);
381  s =
382  format (s,
383  "%Uid flags len address offset user address\n",
384  format_white_space, indent);
385  s =
386  format (s,
387  "%U===== ===== ======== ================== ====== ==================\n",
388  format_white_space, indent);
389  for (slot = 0; slot < ring_size; slot++)
390  {
391  s = format (s, "%U%-5d %-5d %-7d 0x%016lx %-6d 0x%016lx\n",
392  format_white_space, indent, slot,
393  ring->desc[slot].flags,
394  ring->desc[slot].length,
395  mif->regions[ring->desc[slot].region].shm,
396  ring->desc[slot].offset, memif_get_buffer (mif, ring,
397  slot));
398  }
399  s = format (s, "\n");
400  }
401 
402  return s;
403 }
404 
405 static clib_error_t *
407  vlib_cli_command_t * cmd)
408 {
409  memif_main_t *mm = &memif_main;
410  memif_if_t *mif;
411  vnet_main_t *vnm = vnet_get_main ();
412  memif_region_t *mr;
413  memif_queue_t *mq;
414  uword i;
415  int show_descr = 0;
416  clib_error_t *error = 0;
417  u32 hw_if_index, *hw_if_indices = 0;
418  u32 sock_id;
419  u32 msf_idx;
420  u8 *s = 0;
421 
423  {
424  if (unformat
425  (input, "%U", unformat_vnet_hw_interface, vnm, &hw_if_index))
426  vec_add1 (hw_if_indices, hw_if_index);
427  else if (unformat (input, "descriptors"))
428  show_descr = 1;
429  else
430  {
431  error = clib_error_return (0, "unknown input `%U'",
432  format_unformat_error, input);
433  goto done;
434  }
435  }
436 
437  vlib_cli_output (vm, "sockets\n");
438  vlib_cli_output (vm, " %-3s %-11s %s\n", "id", "listener", "filename");
439 
440  /* *INDENT-OFF* */
441  hash_foreach (sock_id, msf_idx, mm->socket_file_index_by_sock_id,
442  ({
443  memif_socket_file_t *msf;
444  u8 *filename;
445 
446  msf = pool_elt_at_index(mm->socket_files, msf_idx);
447  filename = msf->filename;
448  if (msf->is_listener)
449  s = format (s, "yes (%u)", msf->ref_cnt);
450  else
451  s = format (s, "no");
452 
453  vlib_cli_output(vm, " %-3u %-11v %s\n", sock_id, s, filename);
454  vec_reset_length (s);
455  }));
456  /* *INDENT-ON* */
457  vec_free (s);
458 
459  vlib_cli_output (vm, "\n");
460 
461  if (vec_len (hw_if_indices) == 0)
462  {
463  /* *INDENT-OFF* */
464  pool_foreach (mif, mm->interfaces,
465  vec_add1 (hw_if_indices, mif->hw_if_index);
466  );
467  /* *INDENT-ON* */
468  }
469 
470  for (hw_if_index = 0; hw_if_index < vec_len (hw_if_indices); hw_if_index++)
471  {
473  vnet_get_hw_interface (vnm, hw_if_indices[hw_if_index]);
474  mif = pool_elt_at_index (mm->interfaces, hi->dev_instance);
476  mif->socket_file_index);
477  vlib_cli_output (vm, "interface %U", format_vnet_sw_if_index_name,
478  vnm, mif->sw_if_index);
479  if (mif->remote_name)
480  vlib_cli_output (vm, " remote-name \"%s\"", mif->remote_name);
481  if (mif->remote_if_name)
482  vlib_cli_output (vm, " remote-interface \"%s\"",
483  mif->remote_if_name);
484  vlib_cli_output (vm, " socket-id %u id %u mode %U", msf->socket_id,
485  mif->id, format_memif_if_mode, mif);
486  vlib_cli_output (vm, " flags%U", format_memif_if_flags, mif->flags);
487  vlib_cli_output (vm, " listener-fd %d conn-fd %d",
488  msf->sock ? msf->sock->fd : 0,
489  mif->sock ? mif->sock->fd : 0);
490  vlib_cli_output (vm, " num-s2m-rings %u num-m2s-rings %u "
491  "buffer-size %u num-regions %u",
492  mif->run.num_s2m_rings, mif->run.num_m2s_rings,
493  mif->run.buffer_size, vec_len (mif->regions));
494 
495  if (mif->local_disc_string)
496  vlib_cli_output (vm, " local-disc-reason \"%s\"",
497  mif->local_disc_string);
498  if (mif->remote_disc_string)
499  vlib_cli_output (vm, " remote-disc-reason \"%s\"",
500  mif->remote_disc_string);
501 
502  /* *INDENT-OFF* */
503  vec_foreach_index (i, mif->regions)
504  {
505  mr = vec_elt_at_index (mif->regions, i);
506  vlib_cli_output (vm, " region %u size %u fd %d", i,
507  mr->region_size, mr->fd);
508  }
509  vec_foreach_index (i, mif->tx_queues)
510  {
511  mq = vec_elt_at_index (mif->tx_queues, i);
512  vlib_cli_output (vm, " %U", format_memif_queue, mq, i);
513  if (show_descr)
514  vlib_cli_output (vm, " %U", format_memif_descriptor, mif, mq);
515  }
516  vec_foreach_index (i, mif->rx_queues)
517  {
518  mq = vec_elt_at_index (mif->rx_queues, i);
519  vlib_cli_output (vm, " %U", format_memif_queue, mq, i);
520  if (show_descr)
521  vlib_cli_output (vm, " %U", format_memif_descriptor, mif, mq);
522  }
523  /* *INDENT-ON* */
524  }
525 done:
526  vec_free (hw_if_indices);
527  return error;
528 }
529 
530 /* *INDENT-OFF* */
531 VLIB_CLI_COMMAND (memif_show_command, static) = {
532  .path = "show memif",
533  .short_help = "show memif [<interface>] [descriptors]",
534  .function = memif_show_command_fn,
535 };
536 /* *INDENT-ON* */
537 
538 clib_error_t *
540 {
541  return 0;
542 }
543 
545 
546 /*
547  * fd.io coding-style-patch-verification: ON
548  *
549  * Local Variables:
550  * eval: (c-set-style "gnu")
551  * End:
552  */
memif_if_t * interfaces
Definition: private.h:241
unformat_function_t unformat_vnet_hw_interface
#define vec_foreach_index(var, v)
Iterate over vector indices.
vnet_main_t * vnet_get_main(void)
Definition: misc.c:46
memif_socket_file_t * socket_files
Definition: private.h:244
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:590
uword unformat_user(unformat_input_t *input, unformat_function_t *func,...)
Definition: unformat.c:989
static u32 format_get_indent(u8 *s)
Definition: format.h:72
memif_interface_mode_t mode
Definition: private.h:271
u8 * format(u8 *s, const char *fmt,...)
Definition: format.c:424
unformat_function_t unformat_vnet_sw_interface
u8 num_m2s_rings
Definition: private.h:185
format_function_t format_vnet_sw_if_index_name
unsigned char u8
Definition: types.h:56
static uword min_log2(uword x)
Definition: clib.h:159
uint32_t length
Definition: memif.h:154
clib_error_t * memif_cli_init(vlib_main_t *vm)
Definition: cli.c:539
static u8 * format_memif_descriptor(u8 *s, va_list *args)
Definition: cli.c:367
u8 * remote_name
Definition: private.h:178
#define pool_foreach(VAR, POOL, BODY)
Iterate through pool.
Definition: pool.h:513
vl_api_interface_index_t sw_if_index
Definition: gre.api:53
#define VLIB_INIT_FUNCTION(x)
Definition: init.h:173
uword socket_file_index
Definition: private.h:168
u8 * format_white_space(u8 *s, va_list *va)
Definition: std-formats.c:129
u16 buffer_size
Definition: private.h:186
memif_log2_ring_size_t log2_ring_size
Definition: private.h:272
#define hash_foreach(key_var, value_var, h, body)
Definition: hash.h:442
uint16_t flags
Definition: memif.h:151
#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:121
unsigned int u32
Definition: types.h:88
void * shm
Definition: private.h:102
unformat_function_t unformat_line_input
Definition: format.h:283
memif_region_index_t region
Definition: memif.h:153
#define pool_elt_at_index(p, i)
Returns pointer to element at given index.
Definition: pool.h:534
memif_desc_t desc[0]
Definition: memif.h:175
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
int memif_delete_if(vlib_main_t *vm, memif_if_t *mif)
Definition: memif.c:739
struct _unformat_input_t unformat_input_t
unsigned short u16
Definition: types.h:57
memif_interface_id_t id
Definition: private.h:266
int memif_create_if(vlib_main_t *vm, memif_create_if_args_t *args)
Definition: memif.c:819
#define MEMIF_DEFAULT_TX_QUEUES
Definition: private.h:24
vlib_main_t * vm
Definition: in2out_ed.c:1599
memif_queue_t * tx_queues
Definition: private.h:175
u8 slot
Definition: pci_types.api:22
static clib_error_t * memif_show_command_fn(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
Definition: cli.c:406
#define UNFORMAT_END_OF_INPUT
Definition: format.h:145
u32 flags
Definition: vhost_user.h:248
u8 * local_disc_string
Definition: private.h:198
sll srl srl sll sra u16x4 i
Definition: vector_sse42.h:317
#define vec_free(V)
Free vector&#39;s memory (no header).
Definition: vec.h:380
static vnet_hw_interface_t * vnet_get_sup_hw_interface_api_visible_or_null(vnet_main_t *vnm, u32 sw_if_index)
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
int memif_socket_filename_add_del(u8 is_add, u32 sock_id, u8 *sock_filename)
Definition: memif.c:660
static u8 * format_memif_if_flags(u8 *s, va_list *args)
Definition: cli.c:320
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
#define MEMIF_DEFAULT_BUFFER_SIZE
Definition: private.h:25
#define VLIB_CLI_COMMAND(x,...)
Definition: cli.h:152
memif_ring_type_t type
Definition: private.h:134
struct memif_if_t::@639 run
memif_region_t * regions
Definition: private.h:172
uword unformat_ethernet_address(unformat_input_t *input, va_list *args)
Definition: format.c:233
void vlib_cli_output(vlib_main_t *vm, char *fmt,...)
Definition: cli.c:689
static u8 * format_memif_if_mode(u8 *s, va_list *args)
Definition: cli.c:330
static_always_inline void * memif_get_buffer(memif_if_t *mif, memif_ring_t *ring, u16 slot)
Definition: private.h:290
u32 flags
Definition: private.h:157
memif_ring_t * ring
Definition: private.h:118
#define MEMIF_DEFAULT_RX_QUEUES
Definition: private.h:23
u32 hw_if_index
Definition: private.h:159
vl_api_ip4_address_t hi
Definition: arp.api:37
u64 int_count
Definition: private.h:131
static uword is_pow2(uword x)
Definition: clib.h:250
memif_region_offset_t offset
Definition: memif.h:155
u8 num_s2m_rings
Definition: private.h:184
#define vec_len(v)
Number of elements in vector (rvalue-only, NULL tolerant)
static clib_error_t * memif_delete_command_fn(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
Definition: cli.c:270
static u8 * format_memif_queue(u8 *s, va_list *args)
Definition: cli.c:343
u64 uword
Definition: types.h:112
static void unformat_free(unformat_input_t *i)
Definition: format.h:163
u8 * remote_if_name
Definition: private.h:179
memif_interface_id_t id
Definition: private.h:158
memif_log2_ring_size_t log2_ring_size
Definition: private.h:119
u8 * format_unformat_error(u8 *s, va_list *va)
Definition: unformat.c:91
#define MEMIF_DEFAULT_RING_SIZE
Definition: private.h:22
uint16_t flags
Definition: memif.h:169
u8 * remote_disc_string
Definition: private.h:199
volatile uint16_t head
Definition: memif.h:171
clib_socket_t * sock
Definition: private.h:167
memif_queue_t * rx_queues
Definition: private.h:174
uword * socket_file_index_by_sock_id
Definition: private.h:245
memif_main_t memif_main
Definition: memif.c:43
memif_region_index_t region
Definition: private.h:120
clib_socket_t * sock
Definition: private.h:86
u32 sw_if_index
Definition: private.h:160
volatile uint16_t tail
Definition: memif.h:173
uword unformat(unformat_input_t *i, const char *fmt,...)
Definition: unformat.c:978
memif_interface_mode_t mode
Definition: private.h:162
memif_region_size_t region_size
Definition: private.h:103
static uword unformat_check_input(unformat_input_t *i)
Definition: format.h:171