FD.io VPP  v18.10-34-gcce845e
Vector Packet Processing
interface.c
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2015 Cisco and/or its affiliates.
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at:
6  *
7  * http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  */
15 /*
16  * ethernet_interface.c: ethernet interfaces
17  *
18  * Copyright (c) 2008 Eliot Dresselhaus
19  *
20  * Permission is hereby granted, free of charge, to any person obtaining
21  * a copy of this software and associated documentation files (the
22  * "Software"), to deal in the Software without restriction, including
23  * without limitation the rights to use, copy, modify, merge, publish,
24  * distribute, sublicense, and/or sell copies of the Software, and to
25  * permit persons to whom the Software is furnished to do so, subject to
26  * the following conditions:
27  *
28  * The above copyright notice and this permission notice shall be
29  * included in all copies or substantial portions of the Software.
30  *
31  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
32  * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
33  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
34  * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
35  * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
36  * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
37  * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
38  */
39 
40 #include <vnet/vnet.h>
41 #include <vnet/ip/ip.h>
42 #include <vnet/pg/pg.h>
43 #include <vnet/ethernet/ethernet.h>
44 #include <vnet/l2/l2_input.h>
45 #include <vnet/l2/l2_bd.h>
46 #include <vnet/adj/adj.h>
47 
48 /**
49  * @file
50  * @brief Loopback Interfaces.
51  *
52  * This file contains code to manage loopback interfaces.
53  */
54 
55 const u8 *
57 {
58  const static u8 ethernet_mcast_dst_mac[] = {
59  0x1, 0x0, 0x5e, 0x0, 0x0, 0x0,
60  };
61 
62  return (ethernet_mcast_dst_mac);
63 }
64 
65 const u8 *
67 {
68  const static u8 ethernet_mcast_dst_mac[] = {
69  0x33, 0x33, 0x00, 0x0, 0x0, 0x0,
70  };
71 
72  return (ethernet_mcast_dst_mac);
73 }
74 
75 /**
76  * @brief build a rewrite string to use for sending packets of type 'link_type'
77  * to 'dst_address'
78  */
79 u8 *
82  vnet_link_t link_type, const void *dst_address)
83 {
84  vnet_sw_interface_t *sub_sw = vnet_get_sw_interface (vnm, sw_if_index);
85  vnet_sw_interface_t *sup_sw = vnet_get_sup_sw_interface (vnm, sw_if_index);
86  vnet_hw_interface_t *hw = vnet_get_sup_hw_interface (vnm, sw_if_index);
90  ethernet_type_t type;
91  uword n_bytes = sizeof (h[0]);
92  u8 *rewrite = NULL;
93  u8 is_p2p = 0;
94 
95  if ((sub_sw->type == VNET_SW_INTERFACE_TYPE_P2P) ||
96  (sub_sw->type == VNET_SW_INTERFACE_TYPE_PIPE))
97  is_p2p = 1;
98  if (sub_sw != sup_sw)
99  {
100  if (sub_sw->sub.eth.flags.one_tag)
101  {
102  n_bytes += sizeof (ethernet_vlan_header_t);
103  }
104  else if (sub_sw->sub.eth.flags.two_tags)
105  {
106  n_bytes += 2 * (sizeof (ethernet_vlan_header_t));
107  }
108  else if (PREDICT_FALSE (is_p2p))
109  {
110  n_bytes = sizeof (ethernet_header_t);
111  }
112  if (PREDICT_FALSE (!is_p2p))
113  {
114  // Check for encaps that are not supported for L3 interfaces
115  if (!(sub_sw->sub.eth.flags.exact_match) ||
116  (sub_sw->sub.eth.flags.default_sub) ||
117  (sub_sw->sub.eth.flags.outer_vlan_id_any) ||
118  (sub_sw->sub.eth.flags.inner_vlan_id_any))
119  {
120  return 0;
121  }
122  }
123  else
124  {
125  n_bytes = sizeof (ethernet_header_t);
126  }
127  }
128 
129  switch (link_type)
130  {
131 #define _(a,b) case VNET_LINK_##a: type = ETHERNET_TYPE_##b; break
132  _(IP4, IP4);
133  _(IP6, IP6);
134  _(MPLS, MPLS);
135  _(ARP, ARP);
136 #undef _
137  default:
138  return NULL;
139  }
140 
141  vec_validate (rewrite, n_bytes - 1);
142  h = (ethernet_header_t *) rewrite;
143  ei = pool_elt_at_index (em->interfaces, hw->hw_instance);
144  clib_memcpy (h->src_address, ei->address, sizeof (h->src_address));
145  if (is_p2p)
146  {
147  clib_memcpy (h->dst_address, sub_sw->p2p.client_mac,
148  sizeof (h->dst_address));
149  }
150  else
151  {
152  if (dst_address)
153  clib_memcpy (h->dst_address, dst_address, sizeof (h->dst_address));
154  else
155  memset (h->dst_address, ~0, sizeof (h->dst_address)); /* broadcast */
156  }
157 
158  if (PREDICT_FALSE (!is_p2p) && sub_sw->sub.eth.flags.one_tag)
159  {
160  ethernet_vlan_header_t *outer = (void *) (h + 1);
161 
162  h->type = sub_sw->sub.eth.flags.dot1ad ?
163  clib_host_to_net_u16 (ETHERNET_TYPE_DOT1AD) :
164  clib_host_to_net_u16 (ETHERNET_TYPE_VLAN);
165  outer->priority_cfi_and_id =
166  clib_host_to_net_u16 (sub_sw->sub.eth.outer_vlan_id);
167  outer->type = clib_host_to_net_u16 (type);
168 
169  }
170  else if (PREDICT_FALSE (!is_p2p) && sub_sw->sub.eth.flags.two_tags)
171  {
172  ethernet_vlan_header_t *outer = (void *) (h + 1);
173  ethernet_vlan_header_t *inner = (void *) (outer + 1);
174 
175  h->type = sub_sw->sub.eth.flags.dot1ad ?
176  clib_host_to_net_u16 (ETHERNET_TYPE_DOT1AD) :
177  clib_host_to_net_u16 (ETHERNET_TYPE_VLAN);
178  outer->priority_cfi_and_id =
179  clib_host_to_net_u16 (sub_sw->sub.eth.outer_vlan_id);
180  outer->type = clib_host_to_net_u16 (ETHERNET_TYPE_VLAN);
181  inner->priority_cfi_and_id =
182  clib_host_to_net_u16 (sub_sw->sub.eth.inner_vlan_id);
183  inner->type = clib_host_to_net_u16 (type);
184 
185  }
186  else
187  {
188  h->type = clib_host_to_net_u16 (type);
189  }
190 
191  return (rewrite);
192 }
193 
194 void
196 {
197  ip_adjacency_t *adj;
198 
199  adj = adj_get (ai);
200 
201  vnet_sw_interface_t *si = vnet_get_sw_interface (vnm, sw_if_index);
202  if ((si->type == VNET_SW_INTERFACE_TYPE_P2P) ||
204  {
205  default_update_adjacency (vnm, sw_if_index, ai);
206  }
207  else if (FIB_PROTOCOL_IP4 == adj->ia_nh_proto)
208  {
209  arp_update_adjacency (vnm, sw_if_index, ai);
210  }
211  else if (FIB_PROTOCOL_IP6 == adj->ia_nh_proto)
212  {
213  ip6_ethernet_update_adjacency (vnm, sw_if_index, ai);
214  }
215  else
216  {
217  ASSERT (0);
218  }
219 }
220 
221 static clib_error_t *
223  const u8 * old_address, const u8 * mac_address)
224 {
226  ethernet_main_t *em;
227 
228  em = &ethernet_main;
229  ei = pool_elt_at_index (em->interfaces, hi->hw_instance);
230 
233  clib_memcpy (hi->hw_address, mac_address, vec_len (hi->hw_address));
234 
235  clib_memcpy (ei->address, (u8 *) mac_address, sizeof (ei->address));
238 
239  return (NULL);
240 }
241 
242 /* *INDENT-OFF* */
244  .name = "Ethernet",
245  .format_address = format_ethernet_address,
246  .format_header = format_ethernet_header_with_length,
247  .unformat_hw_address = unformat_ethernet_address,
248  .unformat_header = unformat_ethernet_header,
249  .build_rewrite = ethernet_build_rewrite,
250  .update_adjacency = ethernet_update_adjacency,
251  .mac_addr_change_function = ethernet_mac_change,
252 };
253 /* *INDENT-ON* */
254 
255 uword
257 {
258  vnet_main_t *vnm = va_arg (*args, vnet_main_t *);
259  u32 *result = va_arg (*args, u32 *);
260  u32 hw_if_index;
263 
264  if (!unformat_user (input, unformat_vnet_hw_interface, vnm, &hw_if_index))
265  return 0;
266 
267  eif = ethernet_get_interface (em, hw_if_index);
268  if (eif)
269  {
270  *result = hw_if_index;
271  return 1;
272  }
273  return 0;
274 }
275 
276 clib_error_t *
278  u32 dev_class_index,
279  u32 dev_instance,
280  u8 * address,
281  u32 * hw_if_index_return,
283 {
287  clib_error_t *error = 0;
288  u32 hw_if_index;
289 
290  pool_get (em->interfaces, ei);
291  ei->flag_change = flag_change;
292 
293  hw_if_index = vnet_register_interface
294  (vnm,
295  dev_class_index, dev_instance,
296  ethernet_hw_interface_class.index, ei - em->interfaces);
297  *hw_if_index_return = hw_if_index;
298 
299  hi = vnet_get_hw_interface (vnm, hw_if_index);
300 
302 
307 
308  /* Standard default ethernet MTU. */
309  vnet_sw_interface_set_mtu (vnm, hi->sw_if_index, 9000);
310 
311  clib_memcpy (ei->address, address, sizeof (ei->address));
312  vec_add (hi->hw_address, address, sizeof (ei->address));
313 
314  if (error)
315  {
316  pool_put (em->interfaces, ei);
317  return error;
318  }
319  return error;
320 }
321 
322 void
324 {
328  main_intf_t *main_intf;
329  vlan_table_t *vlan_table;
330  u32 idx;
331 
332  hi = vnet_get_hw_interface (vnm, hw_if_index);
333  ei = pool_elt_at_index (em->interfaces, hi->hw_instance);
334 
335  /* Delete vlan mapping table for dot1q and dot1ad. */
336  main_intf = vec_elt_at_index (em->main_intfs, hi->hw_if_index);
337  if (main_intf->dot1q_vlans)
338  {
339  vlan_table = vec_elt_at_index (em->vlan_pool, main_intf->dot1q_vlans);
340  for (idx = 0; idx < ETHERNET_N_VLAN; idx++)
341  {
342  if (vlan_table->vlans[idx].qinqs)
343  {
344  pool_put_index (em->qinq_pool, vlan_table->vlans[idx].qinqs);
345  vlan_table->vlans[idx].qinqs = 0;
346  }
347  }
348  pool_put_index (em->vlan_pool, main_intf->dot1q_vlans);
349  main_intf->dot1q_vlans = 0;
350  }
351  if (main_intf->dot1ad_vlans)
352  {
353  vlan_table = vec_elt_at_index (em->vlan_pool, main_intf->dot1ad_vlans);
354  for (idx = 0; idx < ETHERNET_N_VLAN; idx++)
355  {
356  if (vlan_table->vlans[idx].qinqs)
357  {
358  pool_put_index (em->qinq_pool, vlan_table->vlans[idx].qinqs);
359  vlan_table->vlans[idx].qinqs = 0;
360  }
361  }
362  pool_put_index (em->vlan_pool, main_intf->dot1ad_vlans);
363  main_intf->dot1ad_vlans = 0;
364  }
365 
366  vnet_delete_hw_interface (vnm, hw_if_index);
367  pool_put (em->interfaces, ei);
368 }
369 
370 u32
372 {
376 
377  hi = vnet_get_hw_interface (vnm, hw_if_index);
378 
380 
381  ei = pool_elt_at_index (em->interfaces, hi->hw_instance);
382  if (ei->flag_change)
383  return ei->flag_change (vnm, hi, flags);
384  return (u32) ~ 0;
385 }
386 
387 /**
388  * Echo packets back to ethernet/l2-input.
389  */
390 static uword
393  node, vlib_frame_t * frame)
394 {
395  u32 n_left_from, *from;
396  u32 next_index = 0;
397  u32 n_bytes;
398  u32 thread_index = vm->thread_index;
399  vnet_main_t *vnm = vnet_get_main ();
401  l2_input_config_t *config;
402  vlib_buffer_t *bufs[VLIB_FRAME_SIZE], **b;
403  u16 nexts[VLIB_FRAME_SIZE], *next;
404  u32 new_rx_sw_if_index = ~0;
405  u32 new_tx_sw_if_index = ~0;
406 
407  n_left_from = frame->n_vectors;
408  from = vlib_frame_args (frame);
409 
410  vlib_get_buffers (vm, from, bufs, n_left_from);
411  b = bufs;
412  next = nexts;
413 
414  /* Ordinarily, this is the only config lookup. */
416  next_index =
419  new_tx_sw_if_index = config->bvi ? L2INPUT_BVI : ~0;
420  new_rx_sw_if_index = vnet_buffer (b[0])->sw_if_index[VLIB_TX];
421 
422  while (n_left_from >= 4)
423  {
424  u32 sw_if_index0, sw_if_index1, sw_if_index2, sw_if_index3;
425  u32 not_all_match_config;
426 
427  /* Prefetch next iteration. */
428  if (PREDICT_TRUE (n_left_from >= 8))
429  {
430  vlib_prefetch_buffer_header (b[4], STORE);
431  vlib_prefetch_buffer_header (b[5], STORE);
432  vlib_prefetch_buffer_header (b[6], STORE);
433  vlib_prefetch_buffer_header (b[7], STORE);
434  }
435 
436  /* Make sure all pkts were transmitted on the same (loop) intfc */
437  sw_if_index0 = vnet_buffer (b[0])->sw_if_index[VLIB_TX];
438  sw_if_index1 = vnet_buffer (b[1])->sw_if_index[VLIB_TX];
439  sw_if_index2 = vnet_buffer (b[2])->sw_if_index[VLIB_TX];
440  sw_if_index3 = vnet_buffer (b[3])->sw_if_index[VLIB_TX];
441 
442  not_all_match_config = (sw_if_index0 ^ sw_if_index1)
443  ^ (sw_if_index2 ^ sw_if_index3);
444  not_all_match_config += sw_if_index0 ^ new_rx_sw_if_index;
445 
446  /* Speed path / expected case: all pkts on the same intfc */
447  if (PREDICT_TRUE (not_all_match_config == 0))
448  {
449  next[0] = next_index;
450  next[1] = next_index;
451  next[2] = next_index;
452  next[3] = next_index;
453  vnet_buffer (b[0])->sw_if_index[VLIB_RX] = new_rx_sw_if_index;
454  vnet_buffer (b[1])->sw_if_index[VLIB_RX] = new_rx_sw_if_index;
455  vnet_buffer (b[2])->sw_if_index[VLIB_RX] = new_rx_sw_if_index;
456  vnet_buffer (b[3])->sw_if_index[VLIB_RX] = new_rx_sw_if_index;
457  vnet_buffer (b[0])->sw_if_index[VLIB_TX] = new_tx_sw_if_index;
458  vnet_buffer (b[1])->sw_if_index[VLIB_TX] = new_tx_sw_if_index;
459  vnet_buffer (b[2])->sw_if_index[VLIB_TX] = new_tx_sw_if_index;
460  vnet_buffer (b[3])->sw_if_index[VLIB_TX] = new_tx_sw_if_index;
461  n_bytes = vlib_buffer_length_in_chain (vm, b[0]);
462  n_bytes += vlib_buffer_length_in_chain (vm, b[1]);
463  n_bytes += vlib_buffer_length_in_chain (vm, b[2]);
464  n_bytes += vlib_buffer_length_in_chain (vm, b[3]);
465 
467  {
468  vnet_update_l2_len (b[0]);
469  vnet_update_l2_len (b[1]);
470  vnet_update_l2_len (b[2]);
471  vnet_update_l2_len (b[3]);
472  }
473 
474  /* increment TX interface stat */
477  thread_index, new_rx_sw_if_index,
478  4 /* pkts */ , n_bytes);
479  b += 4;
480  next += 4;
481  n_left_from -= 4;
482  continue;
483  }
484 
485  /*
486  * Slow path: we know that at least one of the pkts
487  * was transmitted on a different sw_if_index, so
488  * check each sw_if_index against the cached data and proceed
489  * accordingly.
490  *
491  * This shouldn't happen, but code can (and does) bypass the
492  * per-interface output node, so deal with it.
493  */
494  if (PREDICT_FALSE (vnet_buffer (b[0])->sw_if_index[VLIB_TX]
495  != new_rx_sw_if_index))
496  {
497  config = l2input_intf_config
498  (vnet_buffer (b[0])->sw_if_index[VLIB_TX]);
499  next_index =
502  new_tx_sw_if_index = config->bvi ? L2INPUT_BVI : ~0;
503  new_rx_sw_if_index = vnet_buffer (b[0])->sw_if_index[VLIB_TX];
504  }
505  next[0] = next_index;
506  vnet_buffer (b[0])->sw_if_index[VLIB_RX] = new_rx_sw_if_index;
507  vnet_buffer (b[0])->sw_if_index[VLIB_TX] = new_tx_sw_if_index;
508  n_bytes = vlib_buffer_length_in_chain (vm, b[0]);
510  vnet_update_l2_len (b[0]);
511 
514  thread_index, new_rx_sw_if_index,
515  1 /* pkts */ , n_bytes);
516 
517  if (PREDICT_FALSE (vnet_buffer (b[1])->sw_if_index[VLIB_TX]
518  != new_rx_sw_if_index))
519  {
520  config = l2input_intf_config
521  (vnet_buffer (b[1])->sw_if_index[VLIB_TX]);
522  next_index =
525  new_rx_sw_if_index = vnet_buffer (b[1])->sw_if_index[VLIB_TX];
526  new_tx_sw_if_index = config->bvi ? L2INPUT_BVI : ~0;
527  }
528  next[1] = next_index;
529  vnet_buffer (b[1])->sw_if_index[VLIB_RX] = new_rx_sw_if_index;
530  vnet_buffer (b[1])->sw_if_index[VLIB_TX] = new_tx_sw_if_index;
531  n_bytes = vlib_buffer_length_in_chain (vm, b[1]);
533  vnet_update_l2_len (b[1]);
534 
537  thread_index, new_rx_sw_if_index,
538  1 /* pkts */ , n_bytes);
539 
540  if (PREDICT_FALSE (vnet_buffer (b[2])->sw_if_index[VLIB_TX]
541  != new_rx_sw_if_index))
542  {
543  config = l2input_intf_config
544  (vnet_buffer (b[2])->sw_if_index[VLIB_TX]);
545  next_index =
548  new_rx_sw_if_index = vnet_buffer (b[2])->sw_if_index[VLIB_TX];
549  new_tx_sw_if_index = config->bvi ? L2INPUT_BVI : ~0;
550  }
551  next[2] = next_index;
552  vnet_buffer (b[2])->sw_if_index[VLIB_RX] = new_rx_sw_if_index;
553  vnet_buffer (b[2])->sw_if_index[VLIB_TX] = new_tx_sw_if_index;
554  n_bytes = vlib_buffer_length_in_chain (vm, b[2]);
556  vnet_update_l2_len (b[2]);
557 
560  thread_index, new_rx_sw_if_index,
561  1 /* pkts */ , n_bytes);
562 
563  if (PREDICT_FALSE (vnet_buffer (b[3])->sw_if_index[VLIB_TX]
564  != new_rx_sw_if_index))
565  {
566  config = l2input_intf_config
567  (vnet_buffer (b[3])->sw_if_index[VLIB_TX]);
568  next_index =
571  new_rx_sw_if_index = vnet_buffer (b[3])->sw_if_index[VLIB_TX];
572  new_tx_sw_if_index = config->bvi ? L2INPUT_BVI : ~0;
573  }
574  next[3] = next_index;
575  vnet_buffer (b[3])->sw_if_index[VLIB_RX] = new_rx_sw_if_index;
576  vnet_buffer (b[3])->sw_if_index[VLIB_TX] = new_tx_sw_if_index;
577  n_bytes = vlib_buffer_length_in_chain (vm, b[3]);
579  vnet_update_l2_len (b[3]);
580 
583  thread_index, new_rx_sw_if_index,
584  1 /* pkts */ , n_bytes);
585  b += 4;
586  next += 4;
587  n_left_from -= 4;
588  }
589  while (n_left_from > 0)
590  {
591  if (PREDICT_FALSE (vnet_buffer (b[0])->sw_if_index[VLIB_TX]
592  != new_rx_sw_if_index))
593  {
594  config = l2input_intf_config
595  (vnet_buffer (b[0])->sw_if_index[VLIB_TX]);
596  next_index =
599  new_tx_sw_if_index = config->bvi ? L2INPUT_BVI : ~0;
600  new_rx_sw_if_index = vnet_buffer (b[0])->sw_if_index[VLIB_TX];
601  }
602  next[0] = next_index;
603  vnet_buffer (b[0])->sw_if_index[VLIB_RX] = new_rx_sw_if_index;
604  vnet_buffer (b[0])->sw_if_index[VLIB_TX] = new_tx_sw_if_index;
605  n_bytes = vlib_buffer_length_in_chain (vm, b[0]);
607  vnet_update_l2_len (b[0]);
608 
611  thread_index, new_rx_sw_if_index,
612  1 /* pkts */ , n_bytes);
613  b += 1;
614  next += 1;
615  n_left_from -= 1;
616  }
617 
618  vlib_buffer_enqueue_to_next (vm, node, from, nexts, frame->n_vectors);
619 
620  return frame->n_vectors;
621 }
622 
623 static u8 *
624 format_simulated_ethernet_name (u8 * s, va_list * args)
625 {
626  u32 dev_instance = va_arg (*args, u32);
627  return format (s, "loop%d", dev_instance);
628 }
629 
630 static clib_error_t *
632  u32 flags)
633 {
634  u32 hw_flags = (flags & VNET_SW_INTERFACE_FLAG_ADMIN_UP) ?
636  vnet_hw_interface_set_flags (vnm, hw_if_index, hw_flags);
637  return 0;
638 }
639 
640 static clib_error_t *
642  const u8 * old_address, const u8 * mac_address)
643 {
644  l2input_interface_mac_change (hi->sw_if_index, old_address, mac_address);
645 
646  return (NULL);
647 }
648 
649 
650 /* *INDENT-OFF* */
651 VNET_DEVICE_CLASS (ethernet_simulated_device_class) = {
652  .name = "Loopback",
653  .format_device_name = format_simulated_ethernet_name,
654  .tx_function = simulated_ethernet_interface_tx,
655  .admin_up_down_function = simulated_ethernet_admin_up_down,
656  .mac_addr_change_function = simulated_ethernet_mac_change,
657 };
658 /* *INDENT-ON* */
659 
660 VLIB_DEVICE_TX_FUNCTION_MULTIARCH (ethernet_simulated_device_class,
662 
663 /*
664  * Maintain a bitmap of allocated loopback instance numbers.
665  */
666 #define LOOPBACK_MAX_INSTANCE (16 * 1024)
667 
668 static u32
669 loopback_instance_alloc (u8 is_specified, u32 want)
670 {
672 
673  /*
674  * Check for dynamically allocaetd instance number.
675  */
676  if (!is_specified)
677  {
678  u32 bit;
679 
681  if (bit >= LOOPBACK_MAX_INSTANCE)
682  {
683  return ~0;
684  }
686  bit, 1);
687  return bit;
688  }
689 
690  /*
691  * In range?
692  */
693  if (want >= LOOPBACK_MAX_INSTANCE)
694  {
695  return ~0;
696  }
697 
698  /*
699  * Already in use?
700  */
701  if (clib_bitmap_get (em->bm_loopback_instances, want))
702  {
703  return ~0;
704  }
705 
706  /*
707  * Grant allocation request.
708  */
710  want, 1);
711 
712  return want;
713 }
714 
715 static int
717 {
719 
720  if (instance >= LOOPBACK_MAX_INSTANCE)
721  {
722  return -1;
723  }
724 
725  if (clib_bitmap_get (em->bm_loopback_instances, instance) == 0)
726  {
727  return -1;
728  }
729 
731  instance, 0);
732  return 0;
733 }
734 
735 int
737  u8 is_specified, u32 user_instance)
738 {
739  vnet_main_t *vnm = vnet_get_main ();
741  clib_error_t *error;
742  u32 instance;
743  u8 address[6];
744  u32 hw_if_index;
745  vnet_hw_interface_t *hw_if;
746  u32 slot;
747  int rv = 0;
748 
749  ASSERT (sw_if_indexp);
750 
751  *sw_if_indexp = (u32) ~ 0;
752 
753  memset (address, 0, sizeof (address));
754 
755  /*
756  * Allocate a loopback instance. Either select on dynamically
757  * or try to use the desired user_instance number.
758  */
759  instance = loopback_instance_alloc (is_specified, user_instance);
760  if (instance == ~0)
761  {
762  return VNET_API_ERROR_INVALID_REGISTRATION;
763  }
764 
765  /*
766  * Default MAC address (dead:0000:0000 + instance) is allocated
767  * if zero mac_address is configured. Otherwise, user-configurable MAC
768  * address is programmed on the loopback interface.
769  */
770  if (memcmp (address, mac_address, sizeof (address)))
771  clib_memcpy (address, mac_address, sizeof (address));
772  else
773  {
774  address[0] = 0xde;
775  address[1] = 0xad;
776  address[5] = instance;
777  }
778 
780  (vnm,
781  ethernet_simulated_device_class.index, instance, address, &hw_if_index,
782  /* flag change */ 0);
783 
784  if (error)
785  {
786  rv = VNET_API_ERROR_INVALID_REGISTRATION;
787  clib_error_report (error);
788  return rv;
789  }
790 
791  hw_if = vnet_get_hw_interface (vnm, hw_if_index);
793  (vm, hw_if->tx_node_index,
796 
798  (vm, hw_if->tx_node_index,
801 
802  {
803  vnet_sw_interface_t *si = vnet_get_hw_sw_interface (vnm, hw_if_index);
804  *sw_if_indexp = si->sw_if_index;
805 
806  /* By default don't flood to loopbacks, as packets just keep
807  * coming back ... If this loopback becomes a BVI, we'll change it */
809  }
810 
811  return 0;
812 }
813 
814 static clib_error_t *
816  unformat_input_t * input,
817  vlib_cli_command_t * cmd)
818 {
819  int rv;
821  u8 mac_address[6];
822  u8 is_specified = 0;
823  u32 user_instance = 0;
824 
825  memset (mac_address, 0, sizeof (mac_address));
826 
828  {
829  if (unformat (input, "mac %U", unformat_ethernet_address, mac_address))
830  ;
831  if (unformat (input, "instance %d", &user_instance))
832  is_specified = 1;
833  else
834  break;
835  }
836 
837  rv = vnet_create_loopback_interface (&sw_if_index, mac_address,
838  is_specified, user_instance);
839 
840  if (rv)
841  return clib_error_return (0, "vnet_create_loopback_interface failed");
842 
844  sw_if_index);
845  return 0;
846 }
847 
848 /*?
849  * Create a loopback interface. Optionally, a MAC Address can be
850  * provided. If not provided, de:ad:00:00:00:<loopId> will be used.
851  *
852  * @cliexpar
853  * The following two command syntaxes are equivalent:
854  * @cliexcmd{loopback create-interface [mac <mac-addr>] [instance <instance>]}
855  * @cliexcmd{create loopback interface [mac <mac-addr>] [instance <instance>]}
856  * Example of how to create a loopback interface:
857  * @cliexcmd{loopback create-interface}
858 ?*/
859 /* *INDENT-OFF* */
860 VLIB_CLI_COMMAND (create_simulated_ethernet_interface_command, static) = {
861  .path = "loopback create-interface",
862  .short_help = "loopback create-interface [mac <mac-addr>] [instance <instance>]",
864 };
865 /* *INDENT-ON* */
866 
867 /*?
868  * Create a loopback interface. Optionally, a MAC Address can be
869  * provided. If not provided, de:ad:00:00:00:<loopId> will be used.
870  *
871  * @cliexpar
872  * The following two command syntaxes are equivalent:
873  * @cliexcmd{loopback create-interface [mac <mac-addr>] [instance <instance>]}
874  * @cliexcmd{create loopback interface [mac <mac-addr>] [instance <instance>]}
875  * Example of how to create a loopback interface:
876  * @cliexcmd{create loopback interface}
877 ?*/
878 /* *INDENT-OFF* */
879 VLIB_CLI_COMMAND (create_loopback_interface_command, static) = {
880  .path = "create loopback interface",
881  .short_help = "create loopback interface [mac <mac-addr>] [instance <instance>]",
883 };
884 /* *INDENT-ON* */
885 
888 {
890  vnet_get_hw_interface (vnet_get_main (), hw_if_index);
891  return (i->hw_class_index ==
893  index ? pool_elt_at_index (em->interfaces, i->hw_instance) : 0);
894 }
895 
896 int
898 {
899  vnet_main_t *vnm = vnet_get_main ();
900 
901  if (pool_is_free_index (vnm->interface_main.sw_interfaces, sw_if_index))
902  return VNET_API_ERROR_INVALID_SW_IF_INDEX;
903 
904  vnet_hw_interface_t *hw = vnet_get_sup_hw_interface (vnm, sw_if_index);
905  if (hw == 0 || hw->dev_class_index != ethernet_simulated_device_class.index)
906  return VNET_API_ERROR_INVALID_SW_IF_INDEX;
907 
908  if (loopback_instance_free (hw->dev_instance) < 0)
909  return VNET_API_ERROR_INVALID_SW_IF_INDEX;
910 
912 
913  return 0;
914 }
915 
916 int
918 {
919  vnet_main_t *vnm = vnet_get_main ();
921  int rv = 0;
922 
923  if (pool_is_free_index (vnm->interface_main.sw_interfaces, sw_if_index))
924  return VNET_API_ERROR_INVALID_SW_IF_INDEX;
925 
926  si = vnet_get_sw_interface (vnm, sw_if_index);
927  if (si->type == VNET_SW_INTERFACE_TYPE_SUB ||
930  {
932  vnet_hw_interface_t *hi = vnet_get_sup_hw_interface (vnm, sw_if_index);
933  u64 sup_and_sub_key =
934  ((u64) (si->sup_sw_if_index) << 32) | (u64) si->sub.id;
935  hash_unset_mem_free (&im->sw_if_index_by_sup_and_sub, &sup_and_sub_key);
937  vnet_delete_sw_interface (vnm, sw_if_index);
938  }
939  else
940  rv = VNET_API_ERROR_INVALID_SUB_SW_IF_INDEX;
941 
942  return rv;
943 }
944 
945 static clib_error_t *
947  unformat_input_t * input,
948  vlib_cli_command_t * cmd)
949 {
950  int rv;
951  u32 sw_if_index = ~0;
952  vnet_main_t *vnm = vnet_get_main ();
953 
955  {
956  if (unformat (input, "intfc %U",
957  unformat_vnet_sw_interface, vnm, &sw_if_index))
958  ;
959  else
960  break;
961  }
962 
963  if (sw_if_index == ~0)
964  return clib_error_return (0, "interface not specified");
965 
966  rv = vnet_delete_loopback_interface (sw_if_index);
967 
968  if (rv)
969  return clib_error_return (0, "vnet_delete_loopback_interface failed");
970 
971  return 0;
972 }
973 
974 static clib_error_t *
976  unformat_input_t * input, vlib_cli_command_t * cmd)
977 {
978  int rv = 0;
979  u32 sw_if_index = ~0;
980  vnet_main_t *vnm = vnet_get_main ();
981 
983  {
984  if (unformat
985  (input, "%U", unformat_vnet_sw_interface, vnm, &sw_if_index))
986  ;
987  else
988  break;
989  }
990  if (sw_if_index == ~0)
991  return clib_error_return (0, "interface doesn't exist");
992 
993  if (pool_is_free_index (vnm->interface_main.sw_interfaces, sw_if_index))
994  rv = VNET_API_ERROR_INVALID_SW_IF_INDEX;
995  else
996  rv = vnet_delete_sub_interface (sw_if_index);
997  if (rv)
998  return clib_error_return (0, "delete_subinterface_interface failed");
999  return 0;
1000 }
1001 
1002 /*?
1003  * Delete a loopback interface.
1004  *
1005  * @cliexpar
1006  * The following two command syntaxes are equivalent:
1007  * @cliexcmd{loopback delete-interface intfc <interface>}
1008  * @cliexcmd{delete loopback interface intfc <interface>}
1009  * Example of how to delete a loopback interface:
1010  * @cliexcmd{loopback delete-interface intfc loop0}
1011 ?*/
1012 /* *INDENT-OFF* */
1013 VLIB_CLI_COMMAND (delete_simulated_ethernet_interface_command, static) = {
1014  .path = "loopback delete-interface",
1015  .short_help = "loopback delete-interface intfc <interface>",
1017 };
1018 /* *INDENT-ON* */
1019 
1020 /*?
1021  * Delete a loopback interface.
1022  *
1023  * @cliexpar
1024  * The following two command syntaxes are equivalent:
1025  * @cliexcmd{loopback delete-interface intfc <interface>}
1026  * @cliexcmd{delete loopback interface intfc <interface>}
1027  * Example of how to delete a loopback interface:
1028  * @cliexcmd{delete loopback interface intfc loop0}
1029 ?*/
1030 /* *INDENT-OFF* */
1031 VLIB_CLI_COMMAND (delete_loopback_interface_command, static) = {
1032  .path = "delete loopback interface",
1033  .short_help = "delete loopback interface intfc <interface>",
1035 };
1036 /* *INDENT-ON* */
1037 
1038 /*?
1039  * Delete a sub-interface.
1040  *
1041  * @cliexpar
1042  * Example of how to delete a sub-interface:
1043  * @cliexcmd{delete sub-interface GigabitEthernet0/8/0.200}
1044 ?*/
1045 /* *INDENT-OFF* */
1046 VLIB_CLI_COMMAND (delete_sub_interface_command, static) = {
1047  .path = "delete sub-interface",
1048  .short_help = "delete sub-interface <interface>",
1049  .function = delete_sub_interface,
1050 };
1051 /* *INDENT-ON* */
1052 
1053 /*
1054  * fd.io coding-style-patch-verification: ON
1055  *
1056  * Local Variables:
1057  * eval: (c-set-style "gnu")
1058  * End:
1059  */
unformat_function_t unformat_vnet_hw_interface
#define vec_validate(V, I)
Make sure vector is long enough for given index (no header, unspecified alignment) ...
Definition: vec.h:437
vmrglw vmrglh hi
int vnet_delete_loopback_interface(u32 sw_if_index)
Definition: interface.c:897
typedef address
Definition: ip_types.api:35
const u8 * ethernet_ip6_mcast_dst_addr(void)
Definition: interface.c:66
#define ETHERNET_N_VLAN
Definition: packet.h:133
static clib_error_t * delete_simulated_ethernet_interfaces(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
Definition: interface.c:946
clib_error_t * vnet_hw_interface_set_flags(vnet_main_t *vnm, u32 hw_if_index, u32 flags)
Definition: interface.c:469
#define hash_unset(h, key)
Definition: hash.h:261
static void vlib_increment_combined_counter(vlib_combined_counter_main_t *cm, u32 thread_index, u32 index, u64 n_packets, u64 n_bytes)
Increment a combined counter.
Definition: counter.h:204
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)
vnet_interface_main_t interface_main
Definition: vnet.h:56
uword vlib_node_add_named_next_with_slot(vlib_main_t *vm, uword node, char *name, uword slot)
Definition: node.c:262
vnet_p2p_sub_interface_t p2p
Definition: interface.h:745
#define PREDICT_TRUE(x)
Definition: clib.h:108
unsigned long u64
Definition: types.h:89
l2_input_config_t * l2input_intf_config(u32 sw_if_index)
Get a pointer to the config for the given interface.
Definition: l2_input.c:510
#define NULL
Definition: clib.h:57
ethernet_type_t
Definition: packet.h:45
IP unicast adjacency.
Definition: adj.h:185
u8 src_address[6]
Definition: packet.h:56
static vnet_hw_interface_t * vnet_get_hw_interface(vnet_main_t *vnm, u32 hw_if_index)
u32 thread_index
Definition: main.h:179
void arp_update_adjacency(vnet_main_t *vnm, u32 sw_if_index, u32 ai)
Definition: arp.c:446
int i
int vnet_delete_sub_interface(u32 sw_if_index)
Definition: interface.c:917
static uword * clib_bitmap_set(uword *ai, uword i, uword value)
Sets the ith bit of a bitmap to new_value Removes trailing zeros from the bitmap. ...
Definition: bitmap.h:167
uword unformat_user(unformat_input_t *input, unformat_function_t *func,...)
Definition: unformat.c:983
main_intf_t * main_intfs
Definition: ethernet.h:299
static vnet_sw_interface_t * vnet_get_sw_interface(vnet_main_t *vnm, u32 sw_if_index)
uword * sub_interface_sw_if_index_by_id
Definition: interface.h:579
u8 * format(u8 *s, const char *fmt,...)
Definition: format.c:419
VLIB_DEVICE_TX_FUNCTION_MULTIARCH(ethernet_simulated_device_class, simulated_ethernet_interface_tx)
unformat_function_t unformat_vnet_sw_interface
#define VNET_HW_INTERFACE_FLAG_LINK_UP
Definition: interface.h:494
static uword vlib_buffer_length_in_chain(vlib_main_t *vm, vlib_buffer_t *b)
Get length in bytes of the buffer chain.
Definition: buffer_funcs.h:263
#define pool_get(P, E)
Allocate an object E from a pool P (unspecified alignment).
Definition: pool.h:228
format_function_t format_vnet_sw_if_index_name
unsigned char u8
Definition: types.h:56
#define VNET_SIMULATED_ETHERNET_TX_NEXT_L2_INPUT
static vnet_sw_interface_t * vnet_get_hw_sw_interface(vnet_main_t *vnm, u32 hw_if_index)
#define vec_add(V, E, N)
Add N elements to end of vector V (no header, unspecified alignment)
Definition: vec.h:600
struct vnet_sub_interface_t::@198::@199::@201 flags
ethernet_main_t ethernet_main
Definition: init.c:45
static ip_adjacency_t * adj_get(adj_index_t adj_index)
Get a pointer to an adjacency object from its index.
Definition: adj.h:380
vnet_flood_class_t flood_class
Definition: interface.h:747
void default_update_adjacency(vnet_main_t *vnm, u32 sw_if_index, u32 ai)
Default adjacency update function.
Definition: interface.c:1521
memset(h->entries, 0, sizeof(h->entries[0])*entries)
u8 * format_ethernet_address(u8 *s, va_list *args)
Definition: format.c:44
u32 sw_if_index
Definition: vxlan_gbp.api:39
void ip6_ethernet_update_adjacency(vnet_main_t *vnm, u32 sw_if_index, u32 ai)
Definition: ip6_neighbor.c:623
vlib_combined_counter_main_t * combined_sw_if_counters
Definition: interface.h:855
u8 dst_address[6]
Definition: packet.h:55
#define vlib_prefetch_buffer_header(b, type)
Prefetch buffer metadata.
Definition: buffer.h:187
#define vec_elt_at_index(v, i)
Get vector value at index i checking that i is in bounds.
static vnet_sw_interface_t * vnet_get_sup_sw_interface(vnet_main_t *vnm, u32 sw_if_index)
#define clib_error_return(e, args...)
Definition: error.h:99
ethernet_flag_change_function_t * flag_change
Definition: ethernet.h:169
static clib_error_t * simulated_ethernet_admin_up_down(vnet_main_t *vnm, u32 hw_if_index, u32 flags)
Definition: interface.c:631
unsigned int u32
Definition: types.h:88
u32 vnet_register_interface(vnet_main_t *vnm, u32 dev_class_index, u32 dev_instance, u32 hw_class_index, u32 hw_instance)
Definition: interface.c:703
#define VLIB_FRAME_SIZE
Definition: node.h:382
u32 max_supported_packet_bytes
Definition: interface.h:570
u16 dot1q_vlans
Definition: ethernet.h:233
#define pool_elt_at_index(p, i)
Returns pointer to element at given index.
Definition: pool.h:464
static clib_error_t * ethernet_mac_change(vnet_hw_interface_t *hi, const u8 *old_address, const u8 *mac_address)
Definition: interface.c:222
vnet_sub_interface_t sub
Definition: interface.h:742
vlib_main_t * vlib_main
Definition: vnet.h:80
static u32 loopback_instance_alloc(u8 is_specified, u32 want)
Definition: interface.c:669
#define LOOPBACK_MAX_INSTANCE
Definition: interface.c:666
struct _unformat_input_t unformat_input_t
unsigned short u16
Definition: types.h:57
#define pool_put(P, E)
Free an object E in pool P.
Definition: pool.h:274
uword * sw_if_index_by_sup_and_sub
Definition: interface.h:849
static int loopback_instance_free(u32 instance)
Definition: interface.c:716
#define PREDICT_FALSE(x)
Definition: clib.h:107
vl_api_address_union_t src_address
Definition: ip_types.api:49
u16 dot1ad_vlans
Definition: ethernet.h:234
#define L2INPUT_BVI
Definition: l2_input.h:96
vnet_hw_interface_class_t ethernet_hw_interface_class
u32 flags
Definition: vhost_user.h:115
uword unformat_ethernet_interface(unformat_input_t *input, va_list *args)
Definition: interface.c:256
typedef mac_address
static clib_error_t * create_simulated_ethernet_interfaces(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
Definition: interface.c:815
u8 * format_ethernet_header_with_length(u8 *s, va_list *args)
Definition: format.c:97
VNET_HW_INTERFACE_CLASS(ethernet_hw_interface_class)
#define UNFORMAT_END_OF_INPUT
Definition: format.h:144
u16 n_vectors
Definition: node.h:401
vlib_main_t * vm
Definition: buffer.c:294
static_always_inline void vlib_buffer_enqueue_to_next(vlib_main_t *vm, vlib_node_runtime_t *node, u32 *buffers, u16 *nexts, uword count)
Definition: buffer_node.h:332
struct vnet_sub_interface_t::@198 eth
#define clib_memcpy(a, b, c)
Definition: string.h:75
#define VNET_SIMULATED_ETHERNET_TX_NEXT_ETHERNET_INPUT
#define pool_is_free_index(P, I)
Use free bitmap to query whether given index is free.
Definition: pool.h:271
const u8 * ethernet_ip4_mcast_dst_addr(void)
Definition: interface.c:56
static uword clib_bitmap_get(uword *ai, uword i)
Gets the ith bit value from a bitmap.
Definition: bitmap.h:197
int vnet_create_loopback_interface(u32 *sw_if_indexp, u8 *mac_address, u8 is_specified, u32 user_instance)
Definition: interface.c:736
#define VLIB_CLI_COMMAND(x,...)
Definition: cli.h:155
static u8 * format_simulated_ethernet_name(u8 *s, va_list *args)
Definition: interface.c:624
void ethernet_delete_interface(vnet_main_t *vnm, u32 hw_if_index)
Definition: interface.c:323
static uword simulated_ethernet_interface_tx(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *frame)
Echo packets back to ethernet/l2-input.
Definition: interface.c:391
uword unformat_ethernet_address(unformat_input_t *input, va_list *args)
Definition: format.c:233
#define pool_put_index(p, i)
Free pool element with given index.
Definition: pool.h:299
vlan_table_t * vlan_pool
Definition: ethernet.h:302
#define ASSERT(truth)
void ethernet_ndp_change_mac(u32 sw_if_index)
clib_error_t * ethernet_register_interface(vnet_main_t *vnm, u32 dev_class_index, u32 dev_instance, u8 *address, u32 *hw_if_index_return, ethernet_flag_change_function_t flag_change)
Definition: interface.c:277
enum vnet_link_t_ vnet_link_t
Link Type: A description of the protocol of packets on the link.
u32( ethernet_flag_change_function_t)(vnet_main_t *vnm, struct vnet_hw_interface_t *hi, u32 flags)
Definition: ethernet.h:149
#define clib_error_report(e)
Definition: error.h:113
static void * vlib_frame_args(vlib_frame_t *f)
Get pointer to frame scalar data.
Definition: node_funcs.h:284
vlan_intf_t vlans[ETHERNET_N_VLAN]
Definition: ethernet.h:246
uword * bm_loopback_instances
Definition: ethernet.h:317
static vlib_main_t * vlib_get_main(void)
Definition: global_funcs.h:23
void vnet_delete_hw_interface(vnet_main_t *vnm, u32 hw_if_index)
Definition: interface.c:913
fib_protocol_t ia_nh_proto
The protocol of the neighbor/peer.
Definition: adj.h:213
Definition: defs.h:47
#define vec_len(v)
Number of elements in vector (rvalue-only, NULL tolerant)
static void vnet_update_l2_len(vlib_buffer_t *b)
Definition: l2_input.h:221
void l2input_interface_mac_change(u32 sw_if_index, const u8 *old_address, const u8 *new_address)
Definition: l2_input.c:543
u64 uword
Definition: types.h:112
vnet_sw_interface_t * sw_interfaces
Definition: interface.h:846
u32 ethernet_set_flags(vnet_main_t *vnm, u32 hw_if_index, u32 flags)
Definition: interface.c:371
u8 * ethernet_build_rewrite(vnet_main_t *vnm, u32 sw_if_index, vnet_link_t link_type, const void *dst_address)
build a rewrite string to use for sending packets of type &#39;link_type&#39; to &#39;dst_address&#39; ...
Definition: interface.c:80
void vnet_sw_interface_set_mtu(vnet_main_t *vnm, u32 sw_if_index, u32 mtu)
Definition: interface.c:605
Definition: lisp_types.h:37
static void hash_unset_mem_free(uword **h, void *key)
Definition: hash.h:295
#define vnet_buffer(b)
Definition: buffer.h:344
u32 min_supported_packet_bytes
Definition: interface.h:567
vnet_sw_interface_type_t type
Definition: interface.h:718
qinq_table_t * qinq_pool
Definition: ethernet.h:305
#define STRUCT_SIZE_OF(t, f)
Definition: clib.h:66
#define ETHERNET_MAX_PACKET_BYTES
Definition: ethernet.h:152
void vnet_delete_sw_interface(vnet_main_t *vnm, u32 sw_if_index)
Definition: interface.c:567
ethernet_interface_t * ethernet_get_interface(ethernet_main_t *em, u32 hw_if_index)
Definition: interface.c:887
VNET_DEVICE_CLASS(ethernet_simulated_device_class)
static_always_inline void vlib_get_buffers(vlib_main_t *vm, u32 *bi, vlib_buffer_t **b, int count)
Translate array of buffer indices into buffer pointers.
Definition: buffer_funcs.h:141
static uword clib_bitmap_first_clear(uword *ai)
Return the lowest numbered clear bit in a bitmap.
Definition: bitmap.h:445
Definition: lisp_types.h:38
ethernet_interface_t * interfaces
Definition: ethernet.h:290
#define ETHERNET_MIN_PACKET_BYTES
Definition: ethernet.h:151
void ethernet_arp_change_mac(u32 sw_if_index)
Definition: arp.c:2528
void vlib_cli_output(vlib_main_t *vm, char *fmt,...)
Definition: cli.c:725
void ethernet_update_adjacency(vnet_main_t *vnm, u32 sw_if_index, u32 ai)
Definition: interface.c:195
static clib_error_t * delete_sub_interface(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
Definition: interface.c:975
static clib_error_t * simulated_ethernet_mac_change(vnet_hw_interface_t *hi, const u8 *old_address, const u8 *mac_address)
Definition: interface.c:641
static void ethernet_setup_node(vlib_main_t *vm, u32 node_index)
Definition: ethernet.h:383
uword unformat(unformat_input_t *i, const char *fmt,...)
Definition: unformat.c:972
Definition: defs.h:46
uword unformat_ethernet_header(unformat_input_t *input, va_list *args)
Definition: format.c:290
static uword unformat_check_input(unformat_input_t *i)
Definition: format.h:170