FD.io VPP  v21.10.1-2-g0a485f517
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  * interface.c: VNET interfaces/sub-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/plugin/plugin.h>
42 #include <vnet/adj/adj.h>
43 #include <vnet/adj/adj_mcast.h>
44 #include <vnet/ip/ip.h>
47 
48 /* *INDENT-OFF* */
49 VLIB_REGISTER_LOG_CLASS (if_default_log, static) = {
50  .class_name = "interface",
51 };
52 /* *INDENT-ON* */
53 
54 #define log_debug(fmt,...) vlib_log_debug(if_default_log.class, fmt, __VA_ARGS__)
55 #define log_err(fmt,...) vlib_log_err(if_default_log.class, fmt, __VA_ARGS__)
56 
58 {
62 
64  u32 hw_if_index,
66  flags,
68  helper_flags);
69 
73  flags,
75  helper_flags);
76 
78  u32 hw_if_index,
79  u32 hw_class_index,
80  u32 redistribute);
81 
82 typedef struct
83 {
84  /* Either sw or hw interface index. */
86 
87  /* Flags. */
90 
91 static void
93 {
95  va_arg (*va, vnet_sw_hw_interface_state_t *);
96  u32 n = va_arg (*va, u32);
97  u32 i;
98  for (i = 0; i < n; i++)
99  {
100  serialize_integer (m, s[i].sw_hw_if_index,
101  sizeof (s[i].sw_hw_if_index));
102  serialize_integer (m, s[i].flags, sizeof (s[i].flags));
103  }
104 }
105 
106 static void
108  va_list * va)
109 {
111  va_arg (*va, vnet_sw_hw_interface_state_t *);
112  u32 n = va_arg (*va, u32);
113  u32 i;
114  for (i = 0; i < n; i++)
115  {
116  unserialize_integer (m, &s[i].sw_hw_if_index,
117  sizeof (s[i].sw_hw_if_index));
118  unserialize_integer (m, &s[i].flags, sizeof (s[i].flags));
119  }
120 }
121 
124 {
126 
129 
130  return (swf);
131 }
132 
133 void
135 {
136  vnet_main_t *vnm = va_arg (*va, vnet_main_t *);
137  vnet_sw_hw_interface_state_t *sts = 0, *st;
138  vnet_sw_interface_t *sif;
139  vnet_hw_interface_t *hif;
141 
142  /* Serialize hardware interface classes since they may have changed.
143  Must do this before sending up/down flags. */
144  /* *INDENT-OFF* */
145  pool_foreach (hif, im->hw_interfaces) {
147  serialize_cstring (m, hw_class->name);
148  }
149  /* *INDENT-ON* */
150 
151  /* Send sw/hw interface state when non-zero. */
152  /* *INDENT-OFF* */
153  pool_foreach (sif, im->sw_interfaces) {
154  if (sif->flags != 0)
155  {
156  vec_add2 (sts, st, 1);
157  st->sw_hw_if_index = sif->sw_if_index;
158  st->flags = sif->flags;
159  }
160  }
161  /* *INDENT-ON* */
162 
164 
165  if (sts)
166  _vec_len (sts) = 0;
167 
168  /* *INDENT-OFF* */
169  pool_foreach (hif, im->hw_interfaces) {
170  if (hif->flags != 0)
171  {
172  vec_add2 (sts, st, 1);
173  st->sw_hw_if_index = hif->hw_if_index;
174  st->flags = vnet_hw_interface_flags_to_sw(hif->flags);
175  }
176  }
177  /* *INDENT-ON* */
178 
180 
181  vec_free (sts);
182 }
183 
186 {
188 
191 
192  return (hwf);
193 }
194 
195 void
197 {
198  vnet_main_t *vnm = va_arg (*va, vnet_main_t *);
199  vnet_sw_hw_interface_state_t *sts = 0, *st;
200 
201  /* First set interface hardware class. */
202  {
204  vnet_hw_interface_t *hif;
205  char *class_name;
206  uword *p;
208 
209  /* *INDENT-OFF* */
210  pool_foreach (hif, im->hw_interfaces) {
211  unserialize_cstring (m, &class_name);
212  p = hash_get_mem (im->hw_interface_class_by_name, class_name);
213  if (p)
214  {
216  (vnm, hif->hw_if_index, p[0], /* redistribute */ 0);
217  }
218  else
219  error = clib_error_return (0, "hw class %s AWOL?", class_name);
220 
221  if (error)
223  vec_free (class_name);
224  }
225  /* *INDENT-ON* */
226  }
227 
229  vec_foreach (st, sts)
230  vnet_sw_interface_set_flags_helper (vnm, st->sw_hw_if_index, st->flags,
231  /* no distribute */ 0);
232  vec_free (sts);
233 
235  vec_foreach (st, sts)
236  {
238  (vnm, st->sw_hw_if_index, vnet_sw_interface_flags_to_hw (st->flags),
239  /* no distribute */ 0);
240  }
241  vec_free (sts);
242 }
243 
244 static clib_error_t *
246  u32 flags,
247  _vnet_interface_function_list_elt_t **
248  elts)
249 {
250  _vnet_interface_function_list_elt_t *elt;
252  clib_error_t *error = 0;
253 
254  for (prio = VNET_ITF_FUNC_PRIORITY_LOW;
255  prio <= VNET_ITF_FUNC_PRIORITY_HIGH; prio++)
256  {
257  elt = elts[prio];
258 
259  while (elt)
260  {
261  error = elt->fp (vnm, if_index, flags);
262  if (error)
263  return error;
264  elt = elt->next_interface_function;
265  }
266  }
267  return error;
268 }
269 
270 static clib_error_t *
272  u32 is_create)
273 {
274  vnet_hw_interface_t *hi = vnet_get_hw_interface (vnm, hw_if_index);
275  vnet_hw_interface_class_t *hw_class =
276  vnet_get_hw_interface_class (vnm, hi->hw_class_index);
277  vnet_device_class_t *dev_class =
278  vnet_get_device_class (vnm, hi->dev_class_index);
279  clib_error_t *error = 0;
280 
281  if (hw_class->interface_add_del_function
282  && (error =
283  hw_class->interface_add_del_function (vnm, hw_if_index, is_create)))
284  return error;
285 
286  if (dev_class->interface_add_del_function
287  && (error =
288  dev_class->interface_add_del_function (vnm, hw_if_index,
289  is_create)))
290  return error;
291 
293  (vnm, hw_if_index, is_create, vnm->hw_interface_add_del_functions);
294 
295  return error;
296 }
297 
298 static clib_error_t *
300  u32 is_create)
301 {
303  (vnm, sw_if_index, is_create, vnm->sw_interface_add_del_functions);
304 }
305 
306 static clib_error_t *
310  helper_flags)
311 {
312  vnet_hw_interface_t *hi = vnet_get_hw_interface (vnm, hw_if_index);
313  vnet_hw_interface_class_t *hw_class =
314  vnet_get_hw_interface_class (vnm, hi->hw_class_index);
315  u32 mask;
316  clib_error_t *error = 0;
317  u32 is_create =
318  (helper_flags & VNET_INTERFACE_SET_FLAGS_HELPER_IS_CREATE) != 0;
319 
320  mask =
322  flags &= mask;
323 
324  /* Call hardware interface add/del callbacks. */
325  if (is_create)
326  call_hw_interface_add_del_callbacks (vnm, hw_if_index, is_create);
327 
328  /* Already in the desired state? */
329  if (!is_create && (hi->flags & mask) == flags)
330  goto done;
331 
332  if ((hi->flags & VNET_HW_INTERFACE_FLAG_LINK_UP) !=
334  {
335  /* Do hardware class (e.g. ethernet). */
336  if (hw_class->link_up_down_function
337  && (error = hw_class->link_up_down_function (vnm, hw_if_index,
338  flags)))
339  goto done;
340 
342  (vnm, hw_if_index, flags, vnm->hw_interface_link_up_down_functions);
343 
344  if (error)
345  goto done;
346  }
347 
348  hi->flags &= ~mask;
349  hi->flags |= flags;
350 
351 done:
352  if (error)
353  log_err ("hw_set_flags_helper: %U", format_clib_error, error);
354  return error;
355 }
356 
357 static clib_error_t *
361  helper_flags)
362 {
364  u32 mask;
365  clib_error_t *error = 0;
366  u32 is_create =
367  (helper_flags & VNET_INTERFACE_SET_FLAGS_HELPER_IS_CREATE) != 0;
368  u32 old_flags;
369 
371  flags &= mask;
372 
373  if (is_create)
374  {
375  error =
377  if (error)
378  goto done;
379 
381  {
382  /* Notify everyone when the interface is created as admin up */
384  flags,
385  vnm->
386  sw_interface_admin_up_down_functions);
387  if (error)
388  goto done;
389  }
390  }
391  else
392  {
393  vnet_sw_interface_t *si_sup = si;
394 
395  /* Check that super interface is in correct state. */
397  {
398  si_sup = vnet_get_sw_interface (vnm, si->sup_sw_if_index);
399 
400  /* Check to see if we're bringing down the soft interface and if it's parent is up */
401  if ((flags != (si_sup->flags & mask)) &&
402  (!((flags == 0)
403  && ((si_sup->flags & mask) ==
405  {
406  error = clib_error_return (0, "super-interface %U must be %U",
408  si_sup,
410  flags);
411  goto done;
412  }
413  }
414 
415  /* Already in the desired state? */
416  if ((si->flags & mask) == flags)
417  goto done;
418 
419  /* Sub-interfaces of hardware interfaces that do no redistribute,
420  do not redistribute themselves. */
421  if (si_sup->type == VNET_SW_INTERFACE_TYPE_HARDWARE)
422  {
424  vnet_get_hw_interface (vnm, si_sup->hw_if_index);
425  vnet_device_class_t *dev_class =
426  vnet_get_device_class (vnm, hi->dev_class_index);
427  if (!dev_class->redistribute)
428  helper_flags &=
430  }
431 
432  /* set the flags now before invoking the registered clients
433  * so that the state they query is consistent with the state here notified */
434  old_flags = si->flags;
435  si->flags &= ~mask;
436  si->flags |= flags;
437  if ((flags | old_flags) & VNET_SW_INTERFACE_FLAG_ADMIN_UP)
439  (vnm, sw_if_index, flags,
441 
442  if (error)
443  {
444  /* restore flags on error */
445  si->flags = old_flags;
446  goto done;
447  }
448 
450  {
453  vnet_hw_interface_class_t *hw_class =
454  vnet_get_hw_interface_class (vnm, hi->hw_class_index);
455  vnet_device_class_t *dev_class =
456  vnet_get_device_class (vnm, hi->dev_class_index);
457 
460  {
461  error = clib_error_return (0, "Interface in the error state");
462  goto done;
463  }
464 
465  /* save the si admin up flag */
466  old_flags = si->flags;
467 
468  /* update si admin up flag in advance if we are going admin down */
471 
472  if (dev_class->admin_up_down_function
473  && (error = dev_class->admin_up_down_function (vnm,
474  si->hw_if_index,
475  flags)))
476  {
477  /* restore si admin up flag to it's original state on errors */
478  si->flags = old_flags;
479  goto done;
480  }
481 
482  if (hw_class->admin_up_down_function
483  && (error = hw_class->admin_up_down_function (vnm,
484  si->hw_if_index,
485  flags)))
486  {
487  /* restore si admin up flag to it's original state on errors */
488  si->flags = old_flags;
489  goto done;
490  }
491 
492  /* Admin down implies link down. */
494  && (hi->flags & VNET_HW_INTERFACE_FLAG_LINK_UP))
496  hi->flags &
498  helper_flags);
500  }
501  }
502 
503  si->flags &= ~mask;
504  si->flags |= flags;
505 
506 done:
507  if (error)
508  log_err ("sw_set_flags_helper: %U", format_clib_error, error);
509  return error;
510 }
511 
512 clib_error_t *
515 {
516  log_debug ("hw_set_flags: hw_if_index %u flags 0x%x", hw_if_index, flags);
518  (vnm, hw_if_index, flags,
520 }
521 
522 clib_error_t *
525 {
526  log_debug ("sw_set_flags: sw_if_index %u flags 0x%x", sw_if_index, flags);
528  (vnm, sw_if_index, flags,
530 }
531 
532 void
534 {
536  log_debug ("sw_admin_up: sw_if_index %u", sw_if_index);
537 
539  {
542  }
543 }
544 
545 void
547 {
549  log_debug ("sw_admin_down: sw_if_index %u", sw_if_index);
550 
552  {
555  }
556 }
557 
558 static void
560 {
563 
566  sw_if_index, ~0);
567 
568  im->hw_if_index_by_sw_if_index[sw_if_index] = hi->hw_if_index;
570  hi->if_out_arc_end_node_next_index;
571 }
572 
573 static u32
575  vnet_sw_interface_t * template)
576 {
580 
581  pool_get (im->sw_interfaces, sw);
582  sw_if_index = sw - im->sw_interfaces;
583 
584  sw[0] = template[0];
585 
586  sw->flags = 0;
587  sw->sw_if_index = sw_if_index;
589  sw->sup_sw_if_index = sw->sw_if_index;
590 
591  /* Allocate counters for this interface. */
592  {
593  u32 i;
594 
596 
597  for (i = 0; i < vec_len (im->sw_if_counters); i++)
598  {
601  }
602 
603  for (i = 0; i < vec_len (im->combined_sw_if_counters); i++)
604  {
606  sw_if_index);
608  sw_if_index);
609  }
610 
612  }
613 
615  return sw_if_index;
616 }
617 
618 clib_error_t *
620  u32 * sw_if_index)
621 {
625  vnet_device_class_t *dev_class;
626 
627  if (template->sub.eth.flags.two_tags == 1
628  && template->sub.eth.flags.exact_match == 1
629  && (template->sub.eth.flags.inner_vlan_id_any == 1
630  || template->sub.eth.flags.outer_vlan_id_any == 1))
631  {
632  char *str = "inner-dot1q any exact-match is unsupported";
633  error = clib_error_return (0, str);
634  log_err ("create_sw_interface: %s", str);
635  return error;
636  }
637 
638  hi = vnet_get_sup_hw_interface (vnm, template->sup_sw_if_index);
639  dev_class = vnet_get_device_class (vnm, hi->dev_class_index);
640 
641  if (template->type == VNET_SW_INTERFACE_TYPE_SUB &&
642  dev_class->subif_add_del_function)
643  {
644  error = dev_class->subif_add_del_function (vnm, hi->hw_if_index,
645  (struct vnet_sw_interface_t
646  *) template, 1);
647  if (error)
648  return error;
649  }
650 
653  (vnm, *sw_if_index, template->flags,
655 
656  if (error)
657  {
658  /* undo the work done by vnet_create_sw_interface_no_callbacks() */
659  log_err ("create_sw_interface: set flags failed\n %U",
661  vnet_sw_interface_t *sw =
663  pool_put (im->sw_interfaces, sw);
664  }
665  else
666  {
667  vnet_sw_interface_t *sw =
669  log_debug ("create_sw_interface: interface %U (sw_if_index %u) created",
671  }
672 
673  return error;
674 }
675 
676 void
678 {
680  vnet_sw_interface_t *sw =
682 
683  log_debug ("delete_sw_interface: sw_if_index %u, name '%U'",
685 
686  /* Check if the interface has config and is removed from L2 BD or XConnect */
688 
689  /* Bring down interface in case it is up. */
690  if (sw->flags != 0)
691  vnet_sw_interface_set_flags (vnm, sw_if_index, /* flags */ 0);
692 
693  call_sw_interface_add_del_callbacks (vnm, sw_if_index, /* is_create */ 0);
694 
695  pool_put (im->sw_interfaces, sw);
696 }
697 
698 static clib_error_t *
700 {
703 }
704 
705 void
707 {
709 
710  if (si->mtu[VNET_MTU_L3] != mtu)
711  {
712  si->mtu[VNET_MTU_L3] = mtu;
713  log_debug ("set_mtu: interface %U, new mtu %u",
715 
717  }
718 }
719 
720 void
722  u32 mtu[])
723 {
725  bool changed = false;
726  int i;
727 
728  for (i = 0; i < VNET_N_MTU; i++)
729  {
730  if (si->mtu[i] != mtu[i])
731  {
732  si->mtu[i] = mtu[i];
733  changed = true;
734  }
735  }
736  /* Notify interested parties */
737  if (changed)
738  {
739  log_debug ("set_protocol_mtu: interface %U l3 %u ip4 %u ip6 %u mpls %u",
741  mtu[VNET_MTU_L3], mtu[VNET_MTU_IP4], mtu[VNET_MTU_IP6],
742  mtu[VNET_MTU_MPLS]);
744  }
745 }
746 
747 void
749  u32 sw_if_index, u8 enable)
750 {
752 
754 
755  if (enable)
757  else
759 
761 }
762 
763 /*
764  * Reflect a change in hardware MTU on protocol MTUs
765  */
766 static walk_rc_t
768 {
769  u32 *link_mtu = ctx;
770  vnet_sw_interface_set_mtu (vnm, sw_if_index, *link_mtu);
771  return WALK_CONTINUE;
772 }
773 
774 void
775 vnet_hw_interface_set_mtu (vnet_main_t * vnm, u32 hw_if_index, u32 mtu)
776 {
777  vnet_hw_interface_t *hi = vnet_get_hw_interface (vnm, hw_if_index);
778 
779  if (hi->max_packet_bytes != mtu)
780  {
781  hi->max_packet_bytes = mtu;
784  &mtu);
785  }
786 }
787 
788 static void
790  u32 node_index, vnet_device_class_t * dev_class)
791 {
793 
794  n->format_trace = dev_class->format_tx_trace;
795 
796  vlib_register_errors (vm, node_index, dev_class->tx_function_n_errors,
797  dev_class->tx_function_error_strings,
798  dev_class->tx_function_error_counters);
799 }
800 
801 static void
804 {
806  n->format_buffer = hw_class->format_header;
807  n->unformat_buffer = hw_class->unformat_header;
808 }
809 
810 /* Register an interface instance. */
811 u32
813  u32 dev_class_index,
814  u32 dev_instance,
815  u32 hw_class_index, u32 hw_instance)
816 {
819  vnet_device_class_t *dev_class =
820  vnet_get_device_class (vnm, dev_class_index);
821  vnet_hw_interface_class_t *hw_class =
822  vnet_get_hw_interface_class (vnm, hw_class_index);
823  vlib_main_t *vm = vnm->vlib_main;
826  u32 hw_index, i;
827  char *tx_node_name = NULL, *output_node_name = NULL;
828  vlib_node_t *if_out_node =
830 
831  pool_get (im->hw_interfaces, hw);
832  clib_memset (hw, 0, sizeof (*hw));
834 
835  hw_index = hw - im->hw_interfaces;
836  hw->hw_if_index = hw_index;
838 
839  if (dev_class->format_device_name)
840  hw->name = format (0, "%U", dev_class->format_device_name, dev_instance);
841  else if (hw_class->format_interface_name)
842  hw->name = format (0, "%U", hw_class->format_interface_name,
843  dev_instance);
844  else
845  hw->name = format (0, "%s%x", hw_class->name, dev_instance);
846 
847  if (!im->hw_interface_by_name)
848  im->hw_interface_by_name = hash_create_vec ( /* size */ 0,
849  sizeof (hw->name[0]),
850  sizeof (uword));
851 
852  hash_set_mem (im->hw_interface_by_name, hw->name, hw_index);
853 
854  /* Make hardware interface point to software interface. */
855  {
856  vnet_sw_interface_t sw = {
858  .flood_class = VNET_FLOOD_CLASS_NORMAL,
859  .hw_if_index = hw_index
860  };
862  }
863 
864  hw->dev_class_index = dev_class_index;
865  hw->dev_instance = dev_instance;
866  hw->hw_class_index = hw_class_index;
867  hw->hw_instance = hw_instance;
868 
869  hw->max_rate_bits_per_sec = 0;
870  hw->min_packet_bytes = 0;
872 
873  if (dev_class->tx_function == 0 && dev_class->tx_fn_registrations == 0)
874  goto no_output_nodes; /* No output/tx nodes to create */
875 
876  tx_node_name = (char *) format (0, "%v-tx", hw->name);
877  output_node_name = (char *) format (0, "%v-output", hw->name);
878 
879  /* If we have previously deleted interface nodes, re-use them. */
881  {
883  vlib_node_t *node;
884  vlib_node_runtime_t *nrt;
885 
887 
888  hw->tx_node_index = hn->tx_node_index;
890 
891  vlib_node_rename (vm, hw->tx_node_index, "%v", tx_node_name);
892  vlib_node_rename (vm, hw->output_node_index, "%v", output_node_name);
893 
895  {
897 
898  rt =
899  vlib_node_get_runtime_data (this_vlib_main, hw->output_node_index);
900  ASSERT (rt->is_deleted == 1);
901  rt->is_deleted = 0;
902  rt->hw_if_index = hw_index;
903  rt->sw_if_index = hw->sw_if_index;
905 
906  rt = vlib_node_get_runtime_data (this_vlib_main, hw->tx_node_index);
907  rt->hw_if_index = hw_index;
908  rt->sw_if_index = hw->sw_if_index;
910  }
911 
912  /* The new class may differ from the old one.
913  * Functions have to be updated. */
916  node->node_fn_registrations = if_out_node->node_fn_registrations;
917  node->function = if_out_node->function;
918 
920  {
921  nrt = vlib_node_get_runtime (this_vlib_main, hw->output_node_index);
922  nrt->function = node->function;
923  vlib_node_runtime_perf_counter (this_vlib_main, nrt, 0, 0, 0,
925  }
926 
928  if (dev_class->tx_fn_registrations)
929  {
930  node->node_fn_registrations = dev_class->tx_fn_registrations;
932  vm, dev_class->tx_fn_registrations);
933  }
934  else
935  node->function = dev_class->tx_function;
936  node->format_trace = dev_class->format_tx_trace;
937 
939  {
940  nrt = vlib_node_get_runtime (this_vlib_main, hw->tx_node_index);
941  nrt->function = node->function;
942  vlib_node_runtime_perf_counter (this_vlib_main, nrt, 0, 0, 0,
944  }
945 
946  _vec_len (im->deleted_hw_interface_nodes) -= 1;
947  }
948  else
949  {
952  .hw_if_index = hw_index,
953  .sw_if_index = hw->sw_if_index,
954  .dev_instance = hw->dev_instance,
955  .is_deleted = 0,
956  };
957 
958  clib_memset (&r, 0, sizeof (r));
959  r.type = VLIB_NODE_TYPE_INTERNAL;
960  r.runtime_data = &rt;
961  r.runtime_data_bytes = sizeof (rt);
962  r.scalar_size = sizeof (vnet_hw_if_tx_frame_t);
963  r.vector_size = sizeof (u32);
964 
965  r.flags = VLIB_NODE_FLAG_IS_OUTPUT;
966  r.name = tx_node_name;
967  if (dev_class->tx_fn_registrations)
968  {
969  r.function = 0;
970  r.node_fn_registrations = dev_class->tx_fn_registrations;
971  }
972  else
973  r.function = dev_class->tx_function;
974 
976 
978  "error-drop",
980 
981  r.flags = 0;
982  r.name = output_node_name;
983  r.format_trace = format_vnet_interface_output_trace;
984  if (if_out_node->node_fn_registrations)
985  {
986  r.function = 0;
987  r.node_fn_registrations = if_out_node->node_fn_registrations;
988  }
989  else
990  r.function = if_out_node->function;
991 
992  {
993  static char *e[] = {
994  "interface is down",
995  "interface is deleted",
996  };
997 
998  r.n_errors = ARRAY_LEN (e);
999  r.error_strings = e;
1000  }
1002 
1004  "error-drop",
1007  hw->tx_node_index,
1009  /* add interface to the list of "output-interface" feature arc start nodes
1010  and clone nexts from 1st interface if it exists */
1012  cm = &fcm->config_main;
1013  i = vec_len (cm->start_node_indices);
1014  vec_validate (cm->start_node_indices, i);
1015  cm->start_node_indices[i] = hw->output_node_index;
1016  if (hw_index)
1017  {
1018  /* copy nexts from 1st interface */
1019  vnet_hw_interface_t *first_hw;
1020  vlib_node_t *first_node;
1021 
1022  first_hw = vnet_get_hw_interface (vnm, /* hw_if_index */ 0);
1023  first_node = vlib_get_node (vm, first_hw->output_node_index);
1024 
1025  /* 1st 2 nexts are already added above */
1026  for (i = 2; i < vec_len (first_node->next_nodes); i++)
1028  first_node->next_nodes[i], i);
1029  }
1030  }
1031 
1035  setup_output_node (vm, hw->output_node_index, hw_class);
1036  setup_tx_node (vm, hw->tx_node_index, dev_class);
1037 
1038 no_output_nodes:
1039  /* Call all up/down callbacks with zero flags when interface is created. */
1040  vnet_sw_interface_set_flags_helper (vnm, hw->sw_if_index, /* flags */ 0,
1042  vnet_hw_interface_set_flags_helper (vnm, hw_index, /* flags */ 0,
1044  vec_free (tx_node_name);
1045  vec_free (output_node_name);
1046 
1047  return hw_index;
1048 }
1049 
1050 void
1052 {
1054  vnet_hw_interface_t *hw = vnet_get_hw_interface (vnm, hw_if_index);
1055  vlib_main_t *vm = vnm->vlib_main;
1056  vnet_device_class_t *dev_class = vnet_get_device_class (vnm,
1057  hw->dev_class_index);
1058  /* If it is up, mark it down. */
1059  if (hw->flags != 0)
1060  vnet_hw_interface_set_flags (vnm, hw_if_index, /* flags */ 0);
1061 
1062  /* Call delete callbacks. */
1063  call_hw_interface_add_del_callbacks (vnm, hw_if_index, /* is_create */ 0);
1064 
1065  /* delete rx & tx queues */
1066  vnet_hw_if_unregister_all_rx_queues (vnm, hw_if_index);
1067  vnet_hw_if_unregister_all_tx_queues (vnm, hw_if_index);
1068  vnet_hw_if_update_runtime_data (vnm, hw_if_index);
1069 
1070  /* Delete any sub-interfaces. */
1071  {
1072  u32 id, sw_if_index;
1073  /* *INDENT-OFF* */
1075  ({
1076  vnet_sw_interface_t *si = vnet_get_sw_interface (vnm, sw_if_index);
1077  u64 sup_and_sub_key =
1078  ((u64) (si->sup_sw_if_index) << 32) | (u64) si->sub.id;
1079  hash_unset_mem_free (&im->sw_if_index_by_sup_and_sub, &sup_and_sub_key);
1080  vnet_delete_sw_interface (vnm, sw_if_index);
1081  }));
1083  /* *INDENT-ON* */
1084  }
1085 
1086  /* Delete software interface corresponding to hardware interface. */
1088 
1089  if (dev_class->tx_function)
1090  {
1091  /* Put output/tx nodes into recycle pool */
1093 
1095  {
1097  vlib_node_get_runtime_data (this_vlib_main, hw->output_node_index);
1098 
1099  /* Mark node runtime as deleted so output node (if called)
1100  * will drop packets. */
1101  rt->is_deleted = 1;
1102  }
1103 
1105  "interface-%d-output-deleted", hw_if_index);
1106  vlib_node_rename (vm, hw->tx_node_index, "interface-%d-tx-deleted",
1107  hw_if_index);
1109  dn->tx_node_index = hw->tx_node_index;
1111  }
1112 
1114  vec_free (hw->name);
1115  vec_free (hw->hw_address);
1117  vec_free (hw->rx_queue_indices);
1118  pool_put (im->hw_interfaces, hw);
1119 }
1120 
1121 void
1123  u32 hw_if_index,
1124  vnet_hw_sw_interface_walk_t fn, void *ctx)
1125 {
1127  u32 id, sw_if_index;
1128 
1129  hi = vnet_get_hw_interface (vnm, hw_if_index);
1130  /* the super first, then the sub interfaces */
1131  if (WALK_STOP == fn (vnm, hi->sw_if_index, ctx))
1132  return;
1133 
1134  /* *INDENT-OFF* */
1136  hi->sub_interface_sw_if_index_by_id,
1137  ({
1138  if (WALK_STOP == fn (vnm, sw_if_index, ctx))
1139  break;
1140  }));
1141  /* *INDENT-ON* */
1142 }
1143 
1144 void
1146  vnet_hw_interface_walk_t fn, void *ctx)
1147 {
1150 
1151  im = &vnm->interface_main;
1152 
1153  /* *INDENT-OFF* */
1155  {
1156  if (WALK_STOP == fn(vnm, hi->hw_if_index, ctx))
1157  break;
1158  }
1159  /* *INDENT-ON* */
1160 }
1161 
1162 void
1164  vnet_sw_interface_walk_t fn, void *ctx)
1165 {
1168 
1169  im = &vnm->interface_main;
1170 
1171  /* *INDENT-OFF* */
1173  {
1174  if (WALK_STOP == fn (vnm, si, ctx))
1175  break;
1176  }
1177  /* *INDENT-ON* */
1178 }
1179 
1180 void
1182  u32 hw_class_index, u32 hw_instance)
1183 {
1184  vnet_hw_interface_t *hi = vnet_get_hw_interface (vnm, hw_if_index);
1186  vnet_get_hw_interface_class (vnm, hw_class_index);
1187 
1188  hi->hw_class_index = hw_class_index;
1189  hi->hw_instance = hw_instance;
1190  setup_output_node (vnm->vlib_main, hi->output_node_index, hc);
1191 }
1192 
1193 static clib_error_t *
1195  u32 hw_class_index, u32 redistribute)
1196 {
1197  vnet_hw_interface_t *hi = vnet_get_hw_interface (vnm, hw_if_index);
1198  vnet_sw_interface_t *si = vnet_get_sw_interface (vnm, hi->sw_if_index);
1199  vnet_hw_interface_class_t *old_class =
1200  vnet_get_hw_interface_class (vnm, hi->hw_class_index);
1201  vnet_hw_interface_class_t *new_class =
1202  vnet_get_hw_interface_class (vnm, hw_class_index);
1203  vnet_device_class_t *dev_class =
1204  vnet_get_device_class (vnm, hi->dev_class_index);
1205  clib_error_t *error = 0;
1206 
1207  /* New class equals old class? Nothing to do. */
1208  if (hi->hw_class_index == hw_class_index)
1209  return 0;
1210 
1211  /* No need (and incorrect since admin up flag may be set) to do error checking when
1212  receiving unserialize message. */
1213  if (redistribute)
1214  {
1216  return clib_error_return (0,
1217  "%v must be admin down to change class from %s to %s",
1218  hi->name, old_class->name, new_class->name);
1219 
1220  /* Make sure interface supports given class. */
1221  if ((new_class->is_valid_class_for_interface
1222  && !new_class->is_valid_class_for_interface (vnm, hw_if_index,
1223  hw_class_index))
1224  || (dev_class->is_valid_class_for_interface
1225  && !dev_class->is_valid_class_for_interface (vnm, hw_if_index,
1226  hw_class_index)))
1227  return clib_error_return (0,
1228  "%v class cannot be changed from %s to %s",
1229  hi->name, old_class->name, new_class->name);
1230 
1231  }
1232 
1233  if (old_class->hw_class_change)
1234  old_class->hw_class_change (vnm, hw_if_index, old_class->index,
1235  new_class->index);
1236 
1237  vnet_hw_interface_init_for_class (vnm, hw_if_index, new_class->index,
1238  /* instance */ ~0);
1239 
1240  if (new_class->hw_class_change)
1241  new_class->hw_class_change (vnm, hw_if_index, old_class->index,
1242  new_class->index);
1243 
1244  if (dev_class->hw_class_change)
1245  dev_class->hw_class_change (vnm, hw_if_index, new_class->index);
1246 
1247  return error;
1248 }
1249 
1250 clib_error_t *
1252  u32 hw_class_index)
1253 {
1254  return vnet_hw_interface_set_class_helper (vnm, hw_if_index, hw_class_index,
1255  /* redistribute */ 1);
1256 }
1257 
1258 static int
1260  u32 hw_if_index,
1261  u32 node_index,
1262  u32 redistribute)
1263 {
1264  vnet_hw_interface_t *hi = vnet_get_hw_interface (vnm, hw_if_index);
1266  (vnm, hi->dev_class_index);
1267 
1268  if (dev_class->rx_redirect_to_node)
1269  {
1270  dev_class->rx_redirect_to_node (vnm, hw_if_index, node_index);
1271  return 0;
1272  }
1273 
1274  return VNET_API_ERROR_UNIMPLEMENTED;
1275 }
1276 
1277 int
1279  u32 node_index)
1280 {
1281  return vnet_hw_interface_rx_redirect_to_node_helper (vnm, hw_if_index,
1282  node_index,
1283  1 /* redistribute */ );
1284 }
1285 
1286 word
1288  uword sw_if_index0, uword sw_if_index1)
1289 {
1290  vnet_sw_interface_t *sup0 = vnet_get_sup_sw_interface (vnm, sw_if_index0);
1291  vnet_sw_interface_t *sup1 = vnet_get_sup_sw_interface (vnm, sw_if_index1);
1294 
1295  if (h0 != h1)
1296  return vec_cmp (h0->name, h1->name);
1297  return (word) h0->hw_instance - (word) h1->hw_instance;
1298 }
1299 
1300 word
1302  uword hw_if_index0, uword hw_if_index1)
1303 {
1304  vnet_hw_interface_t *h0 = vnet_get_hw_interface (vnm, hw_if_index0);
1305  vnet_hw_interface_t *h1 = vnet_get_hw_interface (vnm, hw_if_index1);
1306 
1307  if (h0 != h1)
1308  return vec_cmp (h0->name, h1->name);
1309  return (word) h0->hw_instance - (word) h1->hw_instance;
1310 }
1311 
1312 int
1314 {
1316  if ((si->type == VNET_SW_INTERFACE_TYPE_P2P) ||
1318  return 1;
1319 
1323 
1324  return (hc->flags & VNET_HW_INTERFACE_CLASS_FLAG_P2P);
1325 }
1326 
1327 int
1329 {
1333 
1334  return (hc->flags & VNET_HW_INTERFACE_CLASS_FLAG_NBMA);
1335 }
1336 
1337 clib_error_t *
1339 {
1340  if (sw_if_index == 0)
1341  {
1342  return clib_error_create (
1343  "local0 interface doesn't support IP addressing");
1344  }
1345 
1347  {
1350  if (si && si->type == VNET_SW_INTERFACE_TYPE_SUB &&
1351  si->sub.eth.flags.exact_match == 0)
1352  {
1353  return clib_error_create (
1354  "sub-interface without exact-match doesn't support IP addressing");
1355  }
1356  }
1357  return NULL;
1358 }
1359 
1360 clib_error_t *
1362 {
1363  vnet_main_t *vnm = vnet_get_main ();
1365  vlib_buffer_t *b = 0;
1366  vnet_buffer_opaque_t *o = 0;
1368 
1369  /*
1370  * Keep people from shooting themselves in the foot.
1371  */
1372  if (sizeof (b->opaque) != sizeof (vnet_buffer_opaque_t))
1373  {
1374 #define _(a) if (sizeof(o->a) > sizeof (o->unused)) \
1375  clib_warning \
1376  ("FATAL: size of opaque union subtype %s is %d (max %d)", \
1377  #a, sizeof(o->a), sizeof (o->unused));
1379 #undef _
1380 
1381  return clib_error_return
1382  (0, "FATAL: size of vlib buffer opaque %d, size of vnet opaque %d",
1383  sizeof (b->opaque), sizeof (vnet_buffer_opaque_t));
1384  }
1385 
1387  clib_spinlock_lock (&im->sw_if_counter_lock); /* should be no need */
1388 
1390 #define _(E,n,p) \
1391  im->sw_if_counters[VNET_INTERFACE_COUNTER_##E].name = #n; \
1392  im->sw_if_counters[VNET_INTERFACE_COUNTER_##E].stat_segment_name = "/" #p "/" #n;
1394 #undef _
1397 #define _(E,n,p) \
1398  im->combined_sw_if_counters[VNET_INTERFACE_COUNTER_##E].name = #n; \
1399  im->combined_sw_if_counters[VNET_INTERFACE_COUNTER_##E].stat_segment_name = "/" #p "/" #n;
1401 #undef _
1403 
1404  im->device_class_by_name = hash_create_string ( /* size */ 0,
1405  sizeof (uword));
1406  {
1408 
1410 
1411  while (c)
1412  {
1413  c->index = vec_len (im->device_classes);
1414  hash_set_mem (im->device_class_by_name, c->name, c->index);
1415 
1416  /* to avoid confusion, please remove ".tx_function" statement
1417  from VNET_DEVICE_CLASS() if using function candidates */
1418  ASSERT (c->tx_fn_registrations == 0 || c->tx_function == 0);
1419 
1420  if (c->tx_fn_registrations)
1422  vm, c->tx_fn_registrations);
1423 
1424  vec_add1 (im->device_classes, c[0]);
1425  c = c->next_class_registration;
1426  }
1427  }
1428 
1430  sizeof (uword));
1431 
1433  hash_create_mem (0, sizeof (u64), sizeof (u32));
1435  hash_create_mem (0, sizeof (u64), sizeof (u32));
1437  sizeof (uword));
1438  {
1440 
1442 
1443  while (c)
1444  {
1445  c->index = vec_len (im->hw_interface_classes);
1446  hash_set_mem (im->hw_interface_class_by_name, c->name, c->index);
1447 
1448  if (NULL == c->build_rewrite)
1449  c->build_rewrite = default_build_rewrite;
1450  if (NULL == c->update_adjacency)
1451  c->update_adjacency = default_update_adjacency;
1452 
1454  c = c->next_class_registration;
1455  }
1456  }
1457 
1458  /* init per-thread data */
1461 
1463  return error;
1464 
1465  vnm->interface_tag_by_sw_if_index = hash_create (0, sizeof (uword));
1466 
1467  return 0;
1468 }
1469 
1471 
1472 /* Kludge to renumber interface names [only!] */
1473 int
1475 {
1476  int rv;
1477  vnet_main_t *vnm = vnet_get_main ();
1480 
1482  (vnm, hi->dev_class_index);
1483 
1484  if (dev_class->name_renumber == 0 || dev_class->format_device_name == 0)
1485  return VNET_API_ERROR_UNIMPLEMENTED;
1486 
1487  rv = dev_class->name_renumber (hi, new_show_dev_instance);
1488 
1489  if (rv)
1490  return rv;
1491 
1493  vec_free (hi->name);
1494  /* Use the mapping we set up to call it Ishmael */
1495  hi->name = format (0, "%U", dev_class->format_device_name,
1496  hi->dev_instance);
1497 
1498  hash_set_mem (im->hw_interface_by_name, hi->name, hi->hw_if_index);
1499  return rv;
1500 }
1501 
1502 clib_error_t *
1503 vnet_rename_interface (vnet_main_t * vnm, u32 hw_if_index, char *new_name)
1504 {
1506  vlib_main_t *vm = vnm->vlib_main;
1507  vnet_hw_interface_t *hw;
1508  u8 *old_name;
1509  clib_error_t *error = 0;
1510 
1511  hw = vnet_get_hw_interface (vnm, hw_if_index);
1512  if (!hw)
1513  {
1514  return clib_error_return (0,
1515  "unable to find hw interface for index %u",
1516  hw_if_index);
1517  }
1518 
1519  old_name = hw->name;
1520 
1521  /* set new hw->name */
1522  hw->name = format (0, "%s", new_name);
1523 
1524  /* remove the old name to hw_if_index mapping and install the new one */
1525  hash_unset_mem (im->hw_interface_by_name, old_name);
1526  hash_set_mem (im->hw_interface_by_name, hw->name, hw_if_index);
1527 
1528  /* rename tx/output nodes */
1529  vlib_node_rename (vm, hw->tx_node_index, "%v-tx", hw->name);
1530  vlib_node_rename (vm, hw->output_node_index, "%v-output", hw->name);
1531 
1532  /* free the old name vector */
1533  vec_free (old_name);
1534 
1535  return error;
1536 }
1537 
1538 clib_error_t *
1540  u32 hw_if_index,
1541  const u8 * mac_address, u8 is_add)
1542 {
1543  clib_error_t *error = 0;
1544  vnet_hw_interface_t *hi = vnet_get_hw_interface (vnm, hw_if_index);
1545 
1546  vnet_device_class_t *dev_class =
1547  vnet_get_device_class (vnm, hi->dev_class_index);
1548 
1549  if (!hi->hw_address)
1550  {
1551  error =
1553  (0, "Secondary MAC Addresses not supported for interface index %u",
1554  hw_if_index);
1555  goto done;
1556  }
1557 
1558  if (dev_class->mac_addr_add_del_function)
1559  error = dev_class->mac_addr_add_del_function (hi, mac_address, is_add);
1560 
1561  if (!error)
1562  {
1563  vnet_hw_interface_class_t *hw_class;
1564 
1565  hw_class = vnet_get_hw_interface_class (vnm, hi->hw_class_index);
1566 
1567  if (NULL != hw_class->mac_addr_add_del_function)
1568  error = hw_class->mac_addr_add_del_function (hi, mac_address, is_add);
1569  }
1570 
1571  /* If no errors, add to the list of secondary MACs on the ethernet intf */
1572  if (!error)
1574  mac_address, is_add);
1575 
1576 done:
1577  if (error)
1578  log_err ("hw_add_del_mac_address: %U", format_clib_error, error);
1579  return error;
1580 }
1581 
1582 static clib_error_t *
1584  u32 hw_if_index,
1585  const u8 * mac_address)
1586 {
1587  clib_error_t *error = 0;
1588  vnet_hw_interface_t *hi = vnet_get_hw_interface (vnm, hw_if_index);
1589 
1590  if (hi->hw_address)
1591  {
1592  u8 *old_address = vec_dup (hi->hw_address);
1593  vnet_device_class_t *dev_class =
1594  vnet_get_device_class (vnm, hi->dev_class_index);
1595  if (dev_class->mac_addr_change_function)
1596  {
1597  error =
1598  dev_class->mac_addr_change_function (hi, old_address,
1599  mac_address);
1600  }
1601  if (!error)
1602  {
1603  vnet_hw_interface_class_t *hw_class;
1604 
1605  hw_class = vnet_get_hw_interface_class (vnm, hi->hw_class_index);
1606 
1607  if (NULL != hw_class->mac_addr_change_function)
1608  hw_class->mac_addr_change_function (hi, old_address, mac_address);
1609  }
1610  else
1611  {
1612  error =
1613  clib_error_return (0,
1614  "MAC Address Change is not supported on this interface");
1615  }
1616  vec_free (old_address);
1617  }
1618  else
1619  {
1620  error =
1621  clib_error_return (0,
1622  "mac address change is not supported for interface index %u",
1623  hw_if_index);
1624  }
1625  return error;
1626 }
1627 
1628 clib_error_t *
1630  const u8 * mac_address)
1631 {
1633  (vnm, hw_if_index, mac_address);
1634 }
1635 
1636 static int
1637 vnet_sw_interface_check_table_same (u32 unnumbered_sw_if_index,
1638  u32 ip_sw_if_index)
1639 {
1640  if (ip4_main.fib_index_by_sw_if_index[unnumbered_sw_if_index] !=
1641  ip4_main.fib_index_by_sw_if_index[ip_sw_if_index])
1642  return VNET_API_ERROR_UNEXPECTED_INTF_STATE;
1643 
1644  if (ip4_main.mfib_index_by_sw_if_index[unnumbered_sw_if_index] !=
1645  ip4_main.mfib_index_by_sw_if_index[ip_sw_if_index])
1646  return VNET_API_ERROR_UNEXPECTED_INTF_STATE;
1647 
1648  if (ip6_main.fib_index_by_sw_if_index[unnumbered_sw_if_index] !=
1649  ip6_main.fib_index_by_sw_if_index[ip_sw_if_index])
1650  return VNET_API_ERROR_UNEXPECTED_INTF_STATE;
1651 
1652  if (ip6_main.mfib_index_by_sw_if_index[unnumbered_sw_if_index] !=
1653  ip6_main.mfib_index_by_sw_if_index[ip_sw_if_index])
1654  return VNET_API_ERROR_UNEXPECTED_INTF_STATE;
1655 
1656  return 0;
1657 }
1658 
1659 /* update the unnumbered state of an interface*/
1660 int
1662  u32 ip_sw_if_index, u8 enable)
1663 {
1664  vnet_main_t *vnm = vnet_get_main ();
1666  u32 was_unnum;
1667  int rv = 0;
1668 
1669  si = vnet_get_sw_interface (vnm, unnumbered_sw_if_index);
1670  was_unnum = (si->flags & VNET_SW_INTERFACE_FLAG_UNNUMBERED);
1671 
1672  if (enable)
1673  {
1674  rv = vnet_sw_interface_check_table_same (unnumbered_sw_if_index,
1675  ip_sw_if_index);
1676  if (rv != 0)
1677  return rv;
1679  si->unnumbered_sw_if_index = ip_sw_if_index;
1680 
1682  [unnumbered_sw_if_index] =
1683  ip4_main.
1684  lookup_main.if_address_pool_index_by_sw_if_index[ip_sw_if_index];
1685  ip6_main.
1686  lookup_main.if_address_pool_index_by_sw_if_index
1687  [unnumbered_sw_if_index] =
1688  ip6_main.
1689  lookup_main.if_address_pool_index_by_sw_if_index[ip_sw_if_index];
1690  }
1691  else
1692  {
1693  /*
1694  * Unless the interface is actually unnumbered, don't
1695  * smash e.g. if_address_pool_index_by_sw_if_index
1696  */
1698  {
1700  si->unnumbered_sw_if_index = (u32) ~0;
1701 
1703  .if_address_pool_index_by_sw_if_index[unnumbered_sw_if_index] = ~0;
1705  .if_address_pool_index_by_sw_if_index[unnumbered_sw_if_index] = ~0;
1706  }
1707  }
1708 
1709  if (was_unnum != (si->flags & VNET_SW_INTERFACE_FLAG_UNNUMBERED))
1710  {
1711  ip4_sw_interface_enable_disable (unnumbered_sw_if_index, enable);
1712  ip6_sw_interface_enable_disable (unnumbered_sw_if_index, enable);
1713  }
1714 
1715  return 0;
1716 }
1717 
1720 {
1721  switch (link)
1722  {
1723  case VNET_LINK_IP4:
1724  return (VNET_L3_PACKET_TYPE_IP4);
1725  case VNET_LINK_IP6:
1726  return (VNET_L3_PACKET_TYPE_IP6);
1727  case VNET_LINK_MPLS:
1728  return (VNET_L3_PACKET_TYPE_MPLS);
1729  case VNET_LINK_ARP:
1730  return (VNET_L3_PACKET_TYPE_ARP);
1731  case VNET_LINK_ETHERNET:
1732  case VNET_LINK_NSH:
1733  ASSERT (0);
1734  break;
1735  }
1736  ASSERT (0);
1737  return (0);
1738 }
1739 
1740 vnet_mtu_t
1742 {
1743  switch (link)
1744  {
1745  case VNET_LINK_IP4:
1746  return (VNET_MTU_IP4);
1747  case VNET_LINK_IP6:
1748  return (VNET_MTU_IP6);
1749  case VNET_LINK_MPLS:
1750  return (VNET_MTU_MPLS);
1751  default:
1752  return (VNET_MTU_L3);
1753  }
1754 }
1755 
1756 u8 *
1758  u32 sw_if_index,
1759  vnet_link_t link_type, const void *dst_address)
1760 {
1761  return (NULL);
1762 }
1763 
1764 void
1766 {
1767  ip_adjacency_t *adj;
1768 
1769  adj = adj_get (ai);
1770 
1771  switch (adj->lookup_next_index)
1772  {
1773  case IP_LOOKUP_NEXT_GLEAN:
1775  break;
1776  case IP_LOOKUP_NEXT_ARP:
1777  case IP_LOOKUP_NEXT_BCAST:
1778  /*
1779  * default rewrite in neighbour adj
1780  */
1782  (ai,
1785  sw_if_index,
1786  adj_get_link_type (ai), NULL));
1787  break;
1788  case IP_LOOKUP_NEXT_MCAST:
1789  /*
1790  * mcast traffic also uses default rewrite string with no mcast
1791  * switch time updates.
1792  */
1794  (ai,
1796  sw_if_index,
1797  adj_get_link_type (ai),
1798  NULL), 0);
1799  break;
1800  case IP_LOOKUP_NEXT_DROP:
1801  case IP_LOOKUP_NEXT_PUNT:
1802  case IP_LOOKUP_NEXT_LOCAL:
1807  case IP_LOOKUP_N_NEXT:
1808  ASSERT (0);
1809  break;
1810  }
1811 }
1812 
1813 clib_error_t *
1816  clib_bitmap_t * bitmap)
1817 {
1818  clib_error_t *error = 0;
1819  vnet_device_class_t *dev_class =
1820  vnet_get_device_class (vnm, hi->dev_class_index);
1821 
1822  if (dev_class->set_rss_queues_function)
1823  {
1824  if (clib_bitmap_count_set_bits (bitmap) == 0)
1825  {
1826  error = clib_error_return (0,
1827  "must assign at least one valid rss queue");
1828  goto done;
1829  }
1830 
1831  error = dev_class->set_rss_queues_function (vnm, hi, bitmap);
1832  }
1833  else
1834  {
1835  error = clib_error_return (0,
1836  "setting rss queues is not supported on this interface");
1837  }
1838 
1839  if (!error)
1840  {
1841  clib_bitmap_free (hi->rss_queues);
1842  hi->rss_queues = clib_bitmap_dup (bitmap);
1843  }
1844 
1845 done:
1846  if (error)
1847  log_err ("hw_set_rss_queues: %U", format_clib_error, error);
1848  return error;
1849 }
1850 
1852 
1853 void
1855 {
1857 }
1858 
1859 void
1861 {
1863 }
1864 
1865 static clib_error_t *
1867  unformat_input_t * input,
1868  vlib_cli_command_t * cmd)
1869 {
1870  unformat_input_t _line_input, *line_input = &_line_input;
1871  clib_error_t *error = NULL;
1872 
1873  /* Get a line of input. */
1874  if (!unformat_user (input, unformat_line_input, line_input))
1875  return clib_error_return (0, "expected enable | disable");
1876 
1877  while (unformat_check_input (line_input) != UNFORMAT_END_OF_INPUT)
1878  {
1879  if (unformat (line_input, "enable") || unformat (line_input, "on"))
1881  else if (unformat (line_input, "disable")
1882  || unformat (line_input, "off"))
1884  else
1885  {
1886  error = clib_error_return (0, "unknown input `%U'",
1887  format_unformat_error, line_input);
1888  goto done;
1889  }
1890  }
1891 
1892 done:
1893  unformat_free (line_input);
1894  return error;
1895 }
1896 
1897 /* *INDENT-OFF* */
1899  .path = "interface collect detailed-stats",
1900  .short_help = "interface collect detailed-stats <enable|disable>",
1902 };
1903 /* *INDENT-ON* */
1904 
1905 /*
1906  * fd.io coding-style-patch-verification: ON
1907  *
1908  * Local Variables:
1909  * eval: (c-set-style "gnu")
1910  * End:
1911  */
VNET_SW_INTERFACE_FLAG_NONE
@ VNET_SW_INTERFACE_FLAG_NONE
Definition: interface.h:841
VNET_N_SIMPLE_INTERFACE_COUNTER
@ VNET_N_SIMPLE_INTERFACE_COUNTER
Definition: interface.h:913
clib_spinlock_init
static void clib_spinlock_init(clib_spinlock_t *p)
Definition: lock.h:65
vnet_hw_interface_t::min_packet_bytes
u32 min_packet_bytes
Definition: interface.h:697
vnet_feature_config_main_t_
Definition: feature.h:80
VNET_INTERFACE_SET_FLAGS_HELPER_WANT_REDISTRIBUTE
@ VNET_INTERFACE_SET_FLAGS_HELPER_WANT_REDISTRIBUTE
Definition: interface.c:60
im
vnet_interface_main_t * im
Definition: interface_output.c:415
vnet_hw_interface_t::sub_interface_sw_if_index_by_id
uword * sub_interface_sw_if_index_by_id
Definition: interface.h:703
collect_detailed_interface_stats_command
static vlib_cli_command_t collect_detailed_interface_stats_command
(constructor) VLIB_CLI_COMMAND (collect_detailed_interface_stats_command)
Definition: interface.c:1898
adj.h
vlib_num_workers
static u32 vlib_num_workers()
Definition: threads.h:333
serialize_integer
static void serialize_integer(serialize_main_t *m, u64 x, u32 n_bytes)
Definition: serialize.h:185
vnet_interface_output_arc_end_node
vlib_node_registration_t vnet_interface_output_arc_end_node
(constructor) VLIB_REGISTER_NODE (vnet_interface_output_arc_end_node)
Definition: interface_output.c:1220
vnet_sw_interface_set_flags
clib_error_t * vnet_sw_interface_set_flags(vnet_main_t *vnm, u32 sw_if_index, vnet_sw_interface_flags_t flags)
Definition: interface.c:523
vlib_register_errors
void vlib_register_errors(vlib_main_t *vm, u32 node_index, u32 n_errors, char *error_strings[], vlib_error_desc_t counters[])
Definition: error.c:117
VNET_SW_INTERFACE_FLAG_ERROR
@ VNET_SW_INTERFACE_FLAG_ERROR
Definition: interface.h:859
vnet_hw_interface_init_for_class
void vnet_hw_interface_init_for_class(vnet_main_t *vnm, u32 hw_if_index, u32 hw_class_index, u32 hw_instance)
Definition: interface.c:1181
vnet_feature_config_main_t_::config_main
vnet_config_main_t config_main
Definition: feature.h:82
vnet_sub_interface_t::eth
struct vnet_sub_interface_t::@374 eth
IP_LOOKUP_NEXT_ARP
@ IP_LOOKUP_NEXT_ARP
This packet matches an "incomplete adjacency" and packets need to be passed to ARP to find rewrite st...
Definition: adj.h:63
vnet_interface_main_t::hw_interface_class_by_name
uword * hw_interface_class_by_name
Definition: interface.h:1011
unformat_user
uword unformat_user(unformat_input_t *input, unformat_function_t *func,...)
Definition: unformat.c:989
VNET_SW_INTERFACE_TYPE_PIPE
@ VNET_SW_INTERFACE_TYPE_PIPE
Definition: interface.h:769
vnet_interface_function_priority_t
enum vnet_interface_function_priority_t_ vnet_interface_function_priority_t
vnet_sw_interface_t::type
vnet_sw_interface_type_t type
Definition: interface.h:871
vnet_hw_interface_walk_t
walk_rc_t(* vnet_hw_interface_walk_t)(vnet_main_t *vnm, u32 hw_if_index, void *ctx)
Call back walk type for walking all HW indices.
Definition: interface_funcs.h:210
vnet_hw_interface_t::if_out_arc_end_node_next_index
u32 if_out_arc_end_node_next_index
Definition: interface.h:656
vnet_hw_interface_set_mtu
void vnet_hw_interface_set_mtu(vnet_main_t *vnm, u32 hw_if_index, u32 mtu)
Definition: interface.c:775
vnet_sw_interface_set_mtu
void vnet_sw_interface_set_mtu(vnet_main_t *vnm, u32 sw_if_index, u32 mtu)
Definition: interface.c:706
vnet_sw_interface_t
Definition: interface.h:869
ip4_directed_broadcast
void ip4_directed_broadcast(u32 sw_if_index, u8 enable)
Definition: ip4_forward.c:840
vlib_node_get_runtime_data
static void * vlib_node_get_runtime_data(vlib_main_t *vm, u32 node_index)
Get node runtime private data by node index.
Definition: node_funcs.h:137
WALK_CONTINUE
@ WALK_CONTINUE
Definition: interface_funcs.h:174
vnet_device_class_t
struct _vnet_device_class vnet_device_class_t
vnet_sub_interface_t::flags
struct vnet_sub_interface_t::@374::@375::@377 flags
vnet_hw_if_unregister_all_tx_queues
void vnet_hw_if_unregister_all_tx_queues(vnet_main_t *vnm, u32 hw_if_index)
Definition: tx_queue.c:86
hash_free
#define hash_free(h)
Definition: hash.h:310
ip4_main_t::lookup_main
ip_lookup_main_t lookup_main
Definition: ip4.h:109
vnet_hw_interface_set_class
clib_error_t * vnet_hw_interface_set_class(vnet_main_t *vnm, u32 hw_if_index, u32 hw_class_index)
Definition: interface.c:1251
vlib_node_add_next
static uword vlib_node_add_next(vlib_main_t *vm, uword node, uword next_node)
Definition: node_funcs.h:1177
format_vnet_interface_output_trace
u8 * format_vnet_interface_output_trace(u8 *s, va_list *va)
Definition: interface_output.c:63
vnet_interface_helper_flags_t
enum vnet_interface_helper_flags_t_ vnet_interface_helper_flags_t
vnet_hw_interface_set_rss_queues
clib_error_t * vnet_hw_interface_set_rss_queues(vnet_main_t *vnm, vnet_hw_interface_t *hi, clib_bitmap_t *bitmap)
Definition: interface.c:1814
vnet_main_t::sw_interface_admin_up_down_functions
_vnet_interface_function_list_elt_t * sw_interface_admin_up_down_functions[VNET_ITF_FUNC_N_PRIO]
Definition: vnet.h:93
vnet_hw_interface_flags_t
enum vnet_hw_interface_flags_t_ vnet_hw_interface_flags_t
vnet_interface_name_renumber
int vnet_interface_name_renumber(u32 sw_if_index, u32 new_show_dev_instance)
Definition: interface.c:1474
ip4_main
ip4_main_t ip4_main
Global ip4 main structure.
Definition: ip4_forward.c:1104
VNET_LINK_ETHERNET
@ VNET_LINK_ETHERNET
Definition: interface.h:350
ip4_sw_interface_enable_disable
void ip4_sw_interface_enable_disable(u32 sw_if_index, u32 is_enable)
Definition: ip4_forward.c:602
unformat_line_input
unformat_function_t unformat_line_input
Definition: format.h:275
pool_elt_at_index
#define pool_elt_at_index(p, i)
Returns pointer to element at given index.
Definition: pool.h:549
vlib_node_t::format_trace
format_function_t * format_trace
Definition: node.h:352
vnet_sw_interface_flags_t
enum vnet_sw_interface_flags_t_ vnet_sw_interface_flags_t
vnet_get_sw_interface_or_null
static vnet_sw_interface_t * vnet_get_sw_interface_or_null(vnet_main_t *vnm, u32 sw_if_index)
Definition: interface_funcs.h:64
serialize_vec_vnet_sw_hw_interface_state
static void serialize_vec_vnet_sw_hw_interface_state(serialize_main_t *m, va_list *va)
Definition: interface.c:92
log_debug
#define log_debug(fmt,...)
Definition: interface.c:54
vnet_sw_interface_walk_t
walk_rc_t(* vnet_sw_interface_walk_t)(vnet_main_t *vnm, vnet_sw_interface_t *si, void *ctx)
Call back walk type for walking SW indices on a HW interface.
Definition: interface_funcs.h:195
vnet_hw_interface_t::hw_address
u8 * hw_address
Definition: interface.h:649
vnet_hw_interface_t::sw_if_index
u32 sw_if_index
Definition: interface.h:670
clib_bitmap_t
uword clib_bitmap_t
Definition: bitmap.h:50
vnet_create_sw_interface_no_callbacks
static u32 vnet_create_sw_interface_no_callbacks(vnet_main_t *vnm, vnet_sw_interface_t *template)
Definition: interface.c:574
VLIB_NODE_TYPE_INTERNAL
@ VLIB_NODE_TYPE_INTERNAL
Definition: node.h:72
vec_end
#define vec_end(v)
End (last data address) of vector.
Definition: vec_bootstrap.h:197
node
vlib_main_t vlib_node_runtime_t * node
Definition: nat44_ei.c:3047
IP_LOOKUP_NEXT_GLEAN
@ IP_LOOKUP_NEXT_GLEAN
This packet matches an "interface route" and packets need to be passed to ARP to find rewrite string ...
Definition: adj.h:68
vnet_hw_interface_t::flags
vnet_hw_interface_flags_t flags
Definition: interface.h:642
VNET_SW_INTERFACE_TYPE_SUB
@ VNET_SW_INTERFACE_TYPE_SUB
Definition: interface.h:767
adj_mcast.h
hash_create_string
#define hash_create_string(elts, value_bytes)
Definition: hash.h:689
clib_error_return
#define clib_error_return(e, args...)
Definition: error.h:99
vlib_cli_command_t::path
char * path
Definition: cli.h:96
VNET_MTU_MPLS
@ VNET_MTU_MPLS
Definition: interface.h:833
VNET_INTERFACE_OUTPUT_NEXT_TX
@ VNET_INTERFACE_OUTPUT_NEXT_TX
Definition: interface_funcs.h:492
vnet_interface_main_t
Definition: interface.h:990
vnet_interface_main_t::device_class_by_name
uword * device_class_by_name
Definition: interface.h:1012
vnet_main_t::device_class_registrations
vnet_device_class_t * device_class_registrations
Definition: vnet.h:84
hash_foreach
#define hash_foreach(key_var, value_var, h, body)
Definition: hash.h:441
VNET_FLOOD_CLASS_NORMAL
@ VNET_FLOOD_CLASS_NORMAL
Definition: interface.h:819
IP_LOOKUP_NEXT_LOCAL
@ IP_LOOKUP_NEXT_LOCAL
This packet is for one of our own IP addresses.
Definition: adj.h:58
vnet_hw_interface_t::tx_node_index
u32 tx_node_index
Definition: interface.h:653
vnet_interface_output_runtime_t::sw_if_index
u32 sw_if_index
Definition: interface_funcs.h:478
VNET_ITF_FUNC_PRIORITY_HIGH
@ VNET_ITF_FUNC_PRIORITY_HIGH
Definition: interface.h:113
vlib_node_t::node_fn_registrations
vlib_node_fn_registration_t * node_fn_registrations
Definition: node.h:362
hash_set_mem
#define hash_set_mem(h, key, value)
Definition: hash.h:275
unserialize_vnet_interface_state
void unserialize_vnet_interface_state(serialize_main_t *m, va_list *va)
Definition: interface.c:196
ADJ_NBR_REWRITE_FLAG_COMPLETE
@ ADJ_NBR_REWRITE_FLAG_COMPLETE
An indication that the rewrite is complete, i.e.
Definition: adj_nbr.h:105
vnet_main_t::sw_interface_mtu_change_functions
_vnet_interface_function_list_elt_t * sw_interface_mtu_change_functions[VNET_ITF_FUNC_N_PRIO]
Definition: vnet.h:95
vlib_call_init_function
#define vlib_call_init_function(vm, x)
Definition: init.h:259
VNET_SW_INTERFACE_FLAG_ADMIN_UP
@ VNET_SW_INTERFACE_FLAG_ADMIN_UP
Definition: interface.h:844
vlib_validate_combined_counter
void vlib_validate_combined_counter(vlib_combined_counter_main_t *cm, u32 index)
validate a combined counter
Definition: counter.c:119
pool_put
#define pool_put(P, E)
Free an object E in pool P.
Definition: pool.h:305
IP_LOOKUP_NEXT_MIDCHAIN
@ IP_LOOKUP_NEXT_MIDCHAIN
This packets follow a mid-chain adjacency.
Definition: adj.h:76
VNET_HW_IF_RX_MODE_POLLING
@ VNET_HW_IF_RX_MODE_POLLING
Definition: interface.h:56
vnet_hw_if_unregister_all_rx_queues
void vnet_hw_if_unregister_all_rx_queues(vnet_main_t *vnm, u32 hw_if_index)
Definition: rx_queue.c:122
vm
vlib_main_t * vm
X-connect all packets from the HOST to the PHY.
Definition: nat44_ei.c:3047
ethernet_interface_add_del_address
mac_address_t * ethernet_interface_add_del_address(ethernet_main_t *em, u32 hw_if_index, const u8 *address, u8 is_add)
Definition: interface.c:992
node_index
node node_index
Definition: interface_output.c:440
vnet_get_sw_interface
static vnet_sw_interface_t * vnet_get_sw_interface(vnet_main_t *vnm, u32 sw_if_index)
Definition: interface_funcs.h:58
VNET_HW_INTERFACE_FLAG_LINK_UP
@ VNET_HW_INTERFACE_FLAG_LINK_UP
Definition: interface.h:509
VNET_HW_INTERFACE_FLAG_DUPLEX_MASK
#define VNET_HW_INTERFACE_FLAG_DUPLEX_MASK
Definition: interface.h:575
vnet_hw_interface_flags_to_sw
static vnet_sw_interface_flags_t vnet_hw_interface_flags_to_sw(vnet_hw_interface_flags_t hwf)
Definition: interface.c:123
VNET_LINK_ARP
@ VNET_LINK_ARP
Definition: interface.h:351
vnet_interface_main_t::sw_if_counters
vlib_simple_counter_main_t * sw_if_counters
Definition: interface.h:1023
vec_serialize
#define vec_serialize(m, v, f)
Definition: serialize.h:371
hi
vl_api_ip4_address_t hi
Definition: arp.api:37
vnet_get_device_class
static vnet_device_class_t * vnet_get_device_class(vnet_main_t *vnm, u32 dev_class_index)
Definition: interface_funcs.h:124
vnet_interface_main_t::hw_interfaces
vnet_hw_interface_t * hw_interfaces
Definition: interface.h:993
VNET_SW_INTERFACE_FLAG_DIRECTED_BCAST
@ VNET_SW_INTERFACE_FLAG_DIRECTED_BCAST
Definition: interface.h:862
clib_error_report
#define clib_error_report(e)
Definition: error.h:113
unformat_input_t
struct _unformat_input_t unformat_input_t
adj_glean_update_rewrite
void adj_glean_update_rewrite(adj_index_t adj_index)
adj_glean_update_rewrite
Definition: adj_glean.c:163
VLIB_REGISTER_LOG_CLASS
VLIB_REGISTER_LOG_CLASS(if_default_log, static)
serialize_main_t
Definition: serialize.h:144
setup_output_node
static void setup_output_node(vlib_main_t *vm, u32 node_index, vnet_hw_interface_class_t *hw_class)
Definition: interface.c:802
vnet_hw_interface_t::dev_instance
u32 dev_instance
Definition: interface.h:660
r
vnet_hw_if_output_node_runtime_t * r
Definition: interface_output.c:1089
VLIB_NODE_RUNTIME_PERF_RESET
@ VLIB_NODE_RUNTIME_PERF_RESET
Definition: main.h:70
vlib_node_t::unformat_buffer
unformat_function_t * unformat_buffer
Definition: node.h:349
VNET_HW_INTERFACE_FLAG_NONE
@ VNET_HW_INTERFACE_FLAG_NONE
Definition: interface.h:507
vnet_hw_interface_t::max_rate_bits_per_sec
f64 max_rate_bits_per_sec
Definition: interface.h:688
vnet_interface_cli_init
static clib_error_t * vnet_interface_cli_init(vlib_main_t *vm)
Definition: interface_cli.c:1067
vnet_hw_interface_nodes_t::output_node_index
u32 output_node_index
Definition: interface.h:977
vec_cmp
#define vec_cmp(v1, v2)
Compare two vectors (only applicable to vectors of signed numbers).
Definition: vec.h:1033
error
Definition: cJSON.c:88
vnet_sw_interface_ip_directed_broadcast
void vnet_sw_interface_ip_directed_broadcast(vnet_main_t *vnm, u32 sw_if_index, u8 enable)
Definition: interface.c:748
vnet_sw_interface_compare
word vnet_sw_interface_compare(vnet_main_t *vnm, uword sw_if_index0, uword sw_if_index1)
Definition: interface.c:1287
vnet_sw_interface_check_table_same
static int vnet_sw_interface_check_table_same(u32 unnumbered_sw_if_index, u32 ip_sw_if_index)
Definition: interface.c:1637
vnet_sw_interface_t::mtu
u32 mtu[VNET_N_MTU]
Definition: interface.h:890
setup_tx_node
static void setup_tx_node(vlib_main_t *vm, u32 node_index, vnet_device_class_t *dev_class)
Definition: interface.c:789
vnet_interface_helper_flags_t_
vnet_interface_helper_flags_t_
Definition: interface.c:57
vnet_interface_main_t::sw_if_counter_lock
clib_spinlock_t sw_if_counter_lock
Definition: interface.h:1022
format_clib_error
__clib_export u8 * format_clib_error(u8 *s, va_list *va)
Definition: error.c:191
vlib_node_add_next_with_slot
uword vlib_node_add_next_with_slot(vlib_main_t *vm, uword node_index, uword next_node_index, uword slot)
Definition: node.c:173
vnet_sw_interface_t::flags
vnet_sw_interface_flags_t flags
Definition: interface.h:873
adj_mcast_update_rewrite
void adj_mcast_update_rewrite(adj_index_t adj_index, u8 *rewrite, u8 offset)
adj_mcast_update_rewrite
Definition: adj_mcast.c:105
vnet_get_hw_interface_class
static vnet_hw_interface_class_t * vnet_get_hw_interface_class(vnet_main_t *vnm, u32 hw_class_index)
Definition: interface_funcs.h:117
unformat
uword unformat(unformat_input_t *i, const char *fmt,...)
Definition: unformat.c:978
vnet_delete_sw_interface
void vnet_delete_sw_interface(vnet_main_t *vnm, u32 sw_if_index)
Definition: interface.c:677
vnet_hw_interface_nodes_t
Definition: interface.h:975
vnet_hw_interface_t::hw_class_index
u32 hw_class_index
Definition: interface.h:663
foreach_vlib_main
#define foreach_vlib_main()
Definition: threads.h:216
vnet_sw_interface_t::sw_if_index
u32 sw_if_index
Definition: interface.h:876
ip4_main_t::fib_index_by_sw_if_index
u32 * fib_index_by_sw_if_index
Table index indexed by software interface.
Definition: ip4.h:120
IP_LOOKUP_NEXT_MCAST_MIDCHAIN
@ IP_LOOKUP_NEXT_MCAST_MIDCHAIN
Multicast Midchain Adjacency.
Definition: adj.h:89
ip_lookup_main_t::if_address_pool_index_by_sw_if_index
u32 * if_address_pool_index_by_sw_if_index
Head of doubly linked list of interface addresses for each software interface.
Definition: lookup.h:131
pool_foreach
#define pool_foreach(VAR, POOL)
Iterate through pool.
Definition: pool.h:534
foreach_buffer_opaque_union_subtype
#define foreach_buffer_opaque_union_subtype
Definition: buffer.h:129
vnet_build_rewrite_for_sw_interface
u8 * vnet_build_rewrite_for_sw_interface(vnet_main_t *vnm, u32 sw_if_index, vnet_link_t link_type, const void *dst_address)
Definition: rewrite.c:180
vlib_node_t::format_buffer
format_function_t * format_buffer
Definition: node.h:348
hash_create_mem
#define hash_create_mem(elts, key_bytes, value_bytes)
Definition: hash.h:660
clib_error_create
#define clib_error_create(args...)
Definition: error.h:96
vec_len
#define vec_len(v)
Number of elements in vector (rvalue-only, NULL tolerant)
Definition: vec_bootstrap.h:142
collect_detailed_interface_stats_flag
int collect_detailed_interface_stats_flag
Definition: interface.c:1851
unformat_free
static void unformat_free(unformat_input_t *i)
Definition: format.h:155
vnet_sw_interface_admin_up
void vnet_sw_interface_admin_up(vnet_main_t *vnm, u32 sw_if_index)
Definition: interface.c:533
IP_LOOKUP_NEXT_DROP
@ IP_LOOKUP_NEXT_DROP
Adjacency to drop this packet.
Definition: adj.h:53
vnet_sw_interface_t::sub
vnet_sub_interface_t sub
Definition: interface.h:893
vnet_sw_interface_is_p2p
int vnet_sw_interface_is_p2p(vnet_main_t *vnm, u32 sw_if_index)
Definition: interface.c:1313
VNET_LINK_IP4
@ VNET_LINK_IP4
Definition: interface.h:344
vnet_interface_output_runtime_t::dev_instance
u32 dev_instance
Definition: interface_funcs.h:479
VNET_MTU_IP4
@ VNET_MTU_IP4
Definition: interface.h:831
vec_add2
#define vec_add2(V, P, N)
Add N elements to end of vector V, return pointer to new elements in P.
Definition: vec.h:644
vec_add1
#define vec_add1(V, E)
Add 1 element to end of vector (unspecified alignment).
Definition: vec.h:606
serialize_vnet_interface_state
void serialize_vnet_interface_state(serialize_main_t *m, va_list *va)
Definition: interface.c:134
vnet_sw_interface_update_unnumbered
int vnet_sw_interface_update_unnumbered(u32 unnumbered_sw_if_index, u32 ip_sw_if_index, u8 enable)
Definition: interface.c:1661
collect_detailed_interface_stats_flag_set
void collect_detailed_interface_stats_flag_set(void)
Definition: interface.c:1854
ip_adjacency_t_::lookup_next_index
ip_lookup_next_t lookup_next_index
Next hop after ip4-lookup.
Definition: adj.h:337
vnet_hw_interface_change_mac_address
clib_error_t * vnet_hw_interface_change_mac_address(vnet_main_t *vnm, u32 hw_if_index, const u8 *mac_address)
Definition: interface.c:1629
hash_unset_mem
#define hash_unset_mem(h, key)
Definition: hash.h:291
vnet_sw_interface_get_flags
static vnet_sw_interface_flags_t vnet_sw_interface_get_flags(vnet_main_t *vnm, u32 sw_if_index)
Definition: interface_funcs.h:245
vec_dup
#define vec_dup(V)
Return copy of vector (no header, no alignment)
Definition: vec.h:444
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
VNET_INTERFACE_TX_NEXT_DROP
@ VNET_INTERFACE_TX_NEXT_DROP
Definition: interface_funcs.h:497
clib_bitmap_count_set_bits
static uword clib_bitmap_count_set_bits(uword *ai)
Return the number of set bits in a bitmap.
Definition: bitmap.h:449
vnet_if_update_lookup_tables
static void vnet_if_update_lookup_tables(vnet_main_t *vnm, u32 sw_if_index)
Definition: interface.c:559
vnet_interface_main_t::hw_if_index_by_sw_if_index
u32 * hw_if_index_by_sw_if_index
Definition: interface.h:1046
vnet_l3_packet_type_t
vnet_l3_packet_type_t
Definition: l3_types.h:44
ARRAY_LEN
#define ARRAY_LEN(x)
Definition: clib.h:70
unformat_check_input
static uword unformat_check_input(unformat_input_t *i)
Definition: format.h:163
vnet_interface_output_runtime_t::hw_if_index
u32 hw_if_index
Definition: interface_funcs.h:477
rx_queue_funcs.h
vec_validate_aligned
#define vec_validate_aligned(V, I, A)
Make sure vector is long enough for given index (no header, specified alignment)
Definition: vec.h:534
vnet_interface_output_runtime_t::is_deleted
u32 is_deleted
Definition: interface_funcs.h:480
clib_spinlock_lock
static_always_inline void clib_spinlock_lock(clib_spinlock_t *p)
Definition: lock.h:82
c
svmdb_client_t * c
Definition: vpp_get_metrics.c:48
vnet_hw_interface_set_flags_helper
static clib_error_t * vnet_hw_interface_set_flags_helper(vnet_main_t *vnm, u32 hw_if_index, vnet_hw_interface_flags_t flags, vnet_interface_helper_flags_t helper_flags)
Definition: interface.c:307
vnet_create_sw_interface
clib_error_t * vnet_create_sw_interface(vnet_main_t *vnm, vnet_sw_interface_t *template, u32 *sw_if_index)
Definition: interface.c:619
log_err
#define log_err(fmt,...)
Definition: interface.c:55
unserialize_integer
static void unserialize_integer(serialize_main_t *m, void *x, u32 n_bytes)
Definition: serialize.h:201
clib_bitmap_free
#define clib_bitmap_free(v)
Free a bitmap.
Definition: bitmap.h:92
VNET_LINK_NSH
@ VNET_LINK_NSH
Definition: interface.h:352
uword
u64 uword
Definition: types.h:112
vlib_zero_combined_counter
static void vlib_zero_combined_counter(vlib_combined_counter_main_t *cm, u32 index)
Clear a combined counter Clears the set of per-thread counters.
Definition: counter.h:298
vnet_sw_interface_is_sub
static uword vnet_sw_interface_is_sub(vnet_main_t *vnm, u32 sw_if_index)
Definition: interface_funcs.h:346
vnet_delete_hw_interface
void vnet_delete_hw_interface(vnet_main_t *vnm, u32 hw_if_index)
Definition: interface.c:1051
vnet_hw_interface_t::dev_class_index
u32 dev_class_index
Definition: interface.h:659
IP_LOOKUP_NEXT_REWRITE
@ IP_LOOKUP_NEXT_REWRITE
This packet is to be rewritten and forwarded to the next processing node.
Definition: adj.h:73
vlib_node_runtime_t::function
vlib_node_function_t * function
Node function to call.
Definition: node.h:458
VNET_LINK_MPLS
@ VNET_LINK_MPLS
Definition: interface.h:349
vnet_hw_interface_t::default_rx_mode
vnet_hw_if_rx_mode default_rx_mode
Definition: interface.h:723
vnet_hw_if_update_runtime_data
void vnet_hw_if_update_runtime_data(vnet_main_t *vnm, u32 hw_if_index)
Definition: runtime.c:58
call_sw_interface_add_del_callbacks
static clib_error_t * call_sw_interface_add_del_callbacks(vnet_main_t *vnm, u32 sw_if_index, u32 is_create)
Definition: interface.c:299
vnet_interface_init
clib_error_t * vnet_interface_init(vlib_main_t *vm)
Definition: interface.c:1361
vnet_interface_main_t::hw_interface_classes
vnet_hw_interface_class_t * hw_interface_classes
Definition: interface.h:1007
vlib_get_node
static vlib_node_t * vlib_get_node(vlib_main_t *vm, u32 i)
Get vlib node by index.
Definition: node_funcs.h:86
vnet_interface_output_node
vlib_node_registration_t vnet_interface_output_node
(constructor) VLIB_REGISTER_NODE (vnet_interface_output_node)
Definition: interface_output.c:510
format_vnet_sw_interface_flags
format_function_t format_vnet_sw_interface_flags
Definition: interface_funcs.h:459
VNET_ITF_FUNC_PRIORITY_LOW
@ VNET_ITF_FUNC_PRIORITY_LOW
Definition: interface.h:112
mask
vl_api_pnat_mask_t mask
Definition: pnat.api:45
IP_LOOKUP_NEXT_PUNT
@ IP_LOOKUP_NEXT_PUNT
Adjacency to punt this packet.
Definition: adj.h:55
ETHERNET_INTERFACE_FLAG_MTU
#define ETHERNET_INTERFACE_FLAG_MTU
Definition: ethernet.h:165
cm
vnet_feature_config_main_t * cm
Definition: nat44_ei_hairpinning.c:594
format_unformat_error
u8 * format_unformat_error(u8 *s, va_list *va)
Definition: unformat.c:91
pool_get
#define pool_get(P, E)
Allocate an object E from a pool P (unspecified alignment).
Definition: pool.h:255
vnet_hw_interface_change_mac_address_helper
static clib_error_t * vnet_hw_interface_change_mac_address_helper(vnet_main_t *vnm, u32 hw_if_index, const u8 *mac_address)
Definition: interface.c:1583
vec_validate
#define vec_validate(V, I)
Make sure vector is long enough for given index (no header, unspecified alignment)
Definition: vec.h:523
ip6_main_t::fib_index_by_sw_if_index
u32 * fib_index_by_sw_if_index
Definition: ip6.h:127
vnet_main_t::vlib_main
vlib_main_t * vlib_main
Definition: vnet.h:111
VNET_SW_INTERFACE_FLAG_UNNUMBERED
@ VNET_SW_INTERFACE_FLAG_UNNUMBERED
Definition: interface.h:851
vnet_main_t::hw_interface_link_up_down_functions
_vnet_interface_function_list_elt_t * hw_interface_link_up_down_functions[VNET_ITF_FUNC_N_PRIO]
Definition: vnet.h:89
VLIB_CLI_COMMAND
#define VLIB_CLI_COMMAND(x,...)
Definition: cli.h:163
collect_detailed_interface_stats_cli
static clib_error_t * collect_detailed_interface_stats_cli(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
Definition: interface.c:1866
vnet_interface_main_t::device_classes
vnet_device_class_t * device_classes
Definition: interface.h:1008
vlib_node_rename
void vlib_node_rename(vlib_main_t *vm, u32 node_index, char *fmt,...)
Definition: node.c:76
vnet_rename_interface
clib_error_t * vnet_rename_interface(vnet_main_t *vnm, u32 hw_if_index, char *new_name)
Definition: interface.c:1503
sw_interface_walk_callback
static walk_rc_t sw_interface_walk_callback(vnet_main_t *vnm, u32 sw_if_index, void *ctx)
Definition: interface.c:767
IP_LOOKUP_NEXT_BCAST
@ IP_LOOKUP_NEXT_BCAST
Broadcast Adjacency.
Definition: adj.h:85
vec_unserialize
#define vec_unserialize(m, v, f)
Definition: serialize.h:374
ip_adjacency_t_
IP unicast adjacency.
Definition: adj.h:235
CLIB_CACHE_LINE_BYTES
#define CLIB_CACHE_LINE_BYTES
Definition: cache.h:58
serialize_cstring
__clib_export void serialize_cstring(serialize_main_t *m, char *s)
Definition: serialize.c:164
vnet_hw_interface_nodes_t::tx_node_index
u32 tx_node_index
Definition: interface.h:978
vlib_node_registration_t
struct _vlib_node_registration vlib_node_registration_t
vnet_interface_main_t::combined_sw_if_counters
vlib_combined_counter_main_t * combined_sw_if_counters
Definition: interface.h:1024
vnet_interface_main_t::sw_interfaces
vnet_sw_interface_t * sw_interfaces
Definition: interface.h:1015
vlib_node_add_named_next_with_slot
uword vlib_node_add_named_next_with_slot(vlib_main_t *vm, uword node, char *name, uword slot)
Definition: node.c:244
VNET_MTU_IP6
@ VNET_MTU_IP6
Definition: interface.h:832
ethernet_set_flags
u32 ethernet_set_flags(vnet_main_t *vnm, u32 hw_if_index, u32 flags)
Definition: interface.c:441
vnet_interface_main_t::txq_index_by_hw_if_index_and_queue_id
uword * txq_index_by_hw_if_index_and_queue_id
Definition: interface.h:1001
vnet_sw_interface_t::unnumbered_sw_if_index
u32 unnumbered_sw_if_index
Definition: interface.h:884
plugin.h
vnet_interface_main_t::if_out_arc_end_next_index_by_sw_if_index
u16 * if_out_arc_end_next_index_by_sw_if_index
Definition: interface.h:1047
IP_LOOKUP_NEXT_ICMP_ERROR
@ IP_LOOKUP_NEXT_ICMP_ERROR
This packets needs to go to ICMP error.
Definition: adj.h:79
ip6_main
ip6_main_t ip6_main
Definition: ip6_forward.c:2785
vnet_main_t::hw_interface_class_registrations
vnet_hw_interface_class_t * hw_interface_class_registrations
Definition: vnet.h:85
id
u8 id[64]
Definition: dhcp.api:160
hash_create_vec
#define hash_create_vec(elts, key_bytes, value_bytes)
Definition: hash.h:667
hash_get_mem
#define hash_get_mem(h, key)
Definition: hash.h:269
unserialize_cstring
__clib_export void unserialize_cstring(serialize_main_t *m, char **s)
Definition: serialize.c:178
vnet_main_t::hw_interface_add_del_functions
_vnet_interface_function_list_elt_t * hw_interface_add_del_functions[VNET_ITF_FUNC_N_PRIO]
Definition: vnet.h:87
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
vnet_sw_interface_supports_addressing
clib_error_t * vnet_sw_interface_supports_addressing(vnet_main_t *vnm, u32 sw_if_index)
Definition: interface.c:1338
VNET_N_MTU
@ VNET_N_MTU
Definition: interface.h:834
vnet_sw_interface_t::sup_sw_if_index
u32 sup_sw_if_index
Definition: interface.h:881
vnet_interface_counter_unlock
static void vnet_interface_counter_unlock(vnet_interface_main_t *im)
Definition: interface.h:1058
vnet_buffer_opaque_t
Definition: buffer.h:153
vnet_config_main_t
Definition: config.h:86
ip4_main_t::mfib_index_by_sw_if_index
u32 * mfib_index_by_sw_if_index
Table index indexed by software interface.
Definition: ip4.h:123
vnet_mtu_t
vnet_mtu_t
Definition: interface.h:828
ethernet_main
ethernet_main_t ethernet_main
Definition: init.c:45
default_update_adjacency
void default_update_adjacency(vnet_main_t *vnm, u32 sw_if_index, u32 ai)
Default adjacency update function.
Definition: interface.c:1765
u64
unsigned long u64
Definition: types.h:89
vnet_sw_interface_is_nbma
int vnet_sw_interface_is_nbma(vnet_main_t *vnm, u32 sw_if_index)
Definition: interface.c:1328
vnet_hw_interface_t::hw_instance
u32 hw_instance
Definition: interface.h:664
format_vnet_sw_if_index_name
format_function_t format_vnet_sw_if_index_name
Definition: interface_funcs.h:458
format
description fragment has unexpected format
Definition: map.api:433
ASSERT
#define ASSERT(truth)
Definition: error_bootstrap.h:69
vlib_zero_simple_counter
static void vlib_zero_simple_counter(vlib_simple_counter_main_t *cm, u32 index)
Clear a simple counter Clears the set of per-thread u16 counters, and the u64 counter.
Definition: counter.h:154
vnet_hw_interface_set_class_helper
static clib_error_t * vnet_hw_interface_set_class_helper(vnet_main_t *vnm, u32 hw_if_index, u32 hw_class_index, u32 redistribute)
Definition: interface.c:1194
vnet_hw_sw_interface_walk_t
walk_rc_t(* vnet_hw_sw_interface_walk_t)(vnet_main_t *vnm, u32 sw_if_index, void *ctx)
Call back walk type for walking SW indices on a HW interface.
Definition: interface_funcs.h:180
vec_validate_init_empty
#define vec_validate_init_empty(V, I, INIT)
Make sure vector is long enough for given index and initialize empty space (no header,...
Definition: vec.h:570
adj_get_link_type
vnet_link_t adj_get_link_type(adj_index_t ai)
Return the link type of the adjacency.
Definition: adj.c:530
ip.h
ip6_main_t::mfib_index_by_sw_if_index
u32 * mfib_index_by_sw_if_index
Table index indexed by software interface.
Definition: ip6.h:130
u32
unsigned int u32
Definition: types.h:88
vlib_node_t::function
vlib_node_function_t * function
Definition: node.h:250
VLIB_INIT_FUNCTION
#define VLIB_INIT_FUNCTION(x)
Definition: init.h:172
vnet_get_sup_hw_interface
static vnet_hw_interface_t * vnet_get_sup_hw_interface(vnet_main_t *vnm, u32 sw_if_index)
Definition: interface_funcs.h:92
vnet_interface_main_t::per_thread_data
vnet_interface_per_thread_data_t * per_thread_data
Definition: interface.h:1040
vnet_hw_interface_t::trace_classify_table_index
u32 trace_classify_table_index
Definition: interface.h:740
vlib_validate_simple_counter
void vlib_validate_simple_counter(vlib_simple_counter_main_t *cm, u32 index)
validate a simple counter
Definition: counter.c:79
collect_detailed_interface_stats_flag_clear
void collect_detailed_interface_stats_flag_clear(void)
Definition: interface.c:1860
vnet_clear_sw_interface_tag
static void vnet_clear_sw_interface_tag(vnet_main_t *vnm, u32 sw_if_index)
Definition: interface_funcs.h:156
vnet_interface_main_t::deleted_hw_interface_nodes
vnet_hw_interface_nodes_t * deleted_hw_interface_nodes
Definition: interface.h:1026
ctx
long ctx[MAX_CONNS]
Definition: main.c:144
VNET_INTERFACE_SET_FLAGS_HELPER_IS_CREATE
@ VNET_INTERFACE_SET_FLAGS_HELPER_IS_CREATE
Definition: interface.c:59
si
vnet_sw_interface_t * si
Definition: interface_output.c:418
foreach_simple_interface_counter_name
#define foreach_simple_interface_counter_name
Definition: interface.h:936
vec_foreach
#define vec_foreach(var, vec)
Vector iterator.
Definition: vec_bootstrap.h:213
ip6_sw_interface_enable_disable
void ip6_sw_interface_enable_disable(u32 sw_if_index, u32 is_enable)
Definition: ip6_forward.c:240
call_hw_interface_add_del_callbacks
static clib_error_t * call_hw_interface_add_del_callbacks(vnet_main_t *vnm, u32 hw_if_index, u32 is_create)
Definition: interface.c:271
call_elf_section_interface_callbacks
static clib_error_t * call_elf_section_interface_callbacks(vnet_main_t *vnm, u32 if_index, u32 flags, _vnet_interface_function_list_elt_t **elts)
Definition: interface.c:245
vnet_sw_hw_interface_state_t::sw_hw_if_index
u32 sw_hw_if_index
Definition: interface.c:85
vnet_sw_interface_flags_to_hw
static vnet_hw_interface_flags_t vnet_sw_interface_flags_to_hw(vnet_sw_interface_flags_t swf)
Definition: interface.c:185
ip6_main_t::lookup_main
ip_lookup_main_t lookup_main
Definition: ip6.h:112
VNET_SW_INTERFACE_FLAG_PUNT
@ VNET_SW_INTERFACE_FLAG_PUNT
Definition: interface.h:847
clib_spinlock_unlock
static_always_inline void clib_spinlock_unlock(clib_spinlock_t *p)
Definition: lock.h:121
vlib_node_get_runtime
static vlib_node_runtime_t * vlib_node_get_runtime(vlib_main_t *vm, u32 node_index)
Get node runtime by node index.
Definition: node_funcs.h:116
vnet_hw_interface_rx_redirect_to_node
int vnet_hw_interface_rx_redirect_to_node(vnet_main_t *vnm, u32 hw_if_index, u32 node_index)
Definition: interface.c:1278
elt
app_rx_mq_elt_t * elt
Definition: application.c:488
vnet_interface_main_t::hw_interface_by_name
uword * hw_interface_by_name
Definition: interface.h:1004
vnet_hw_interface_compare
word vnet_hw_interface_compare(vnet_main_t *vnm, uword hw_if_index0, uword hw_if_index1)
Definition: interface.c:1301
clib_memset
clib_memset(h->entries, 0, sizeof(h->entries[0]) *entries)
vnet_hw_interface_add_del_mac_address
clib_error_t * vnet_hw_interface_add_del_mac_address(vnet_main_t *vnm, u32 hw_if_index, const u8 *mac_address, u8 is_add)
Definition: interface.c:1539
vlib_main_t
Definition: main.h:102
vnet_feature_get_config_main
static_always_inline vnet_feature_config_main_t * vnet_feature_get_config_main(u16 arc)
Definition: feature.h:244
adj_nbr_update_rewrite
void adj_nbr_update_rewrite(adj_index_t adj_index, adj_nbr_rewrite_flag_t flags, u8 *rewrite)
adj_nbr_update_rewrite
Definition: adj_nbr.c:340
vnet_link_t
enum vnet_link_t_ vnet_link_t
Link Type: A description of the protocol of packets on the link.
vnet_link_to_l3_proto
vnet_l3_packet_type_t vnet_link_to_l3_proto(vnet_link_t link)
Convert a link to to an Ethertype.
Definition: interface.c:1719
vlib_node_t
Definition: node.h:247
IP_LOOKUP_N_NEXT
@ IP_LOOKUP_N_NEXT
Definition: adj.h:91
b
vlib_buffer_t ** b
Definition: nat44_ei_out2in.c:717
vnet_hw_interface_walk
void vnet_hw_interface_walk(vnet_main_t *vnm, vnet_hw_interface_walk_t fn, void *ctx)
Walk all the HW interface.
Definition: interface.c:1145
u8
unsigned char u8
Definition: types.h:56
clib_error_t
Definition: clib_error.h:21
vnet_hw_interface_set_flags
clib_error_t * vnet_hw_interface_set_flags(vnet_main_t *vnm, u32 hw_if_index, vnet_hw_interface_flags_t flags)
Definition: interface.c:513
VNET_LINK_IP6
@ VNET_LINK_IP6
Definition: interface.h:348
vnet_main_t::interface_tag_by_sw_if_index
uword * interface_tag_by_sw_if_index
Definition: vnet.h:97
rt
vnet_interface_output_runtime_t * rt
Definition: interface_output.c:419
vnet_hw_interface_t::output_node_index
u32 output_node_index
Definition: interface.h:653
vlib_init_function_t
clib_error_t *() vlib_init_function_t(struct vlib_main_t *vm)
Definition: init.h:51
vnet_interface_main_t::sw_if_index_by_sup_and_sub
uword * sw_if_index_by_sup_and_sub
Definition: interface.h:1018
vnet_sw_interface_walk
void vnet_sw_interface_walk(vnet_main_t *vnm, vnet_sw_interface_walk_t fn, void *ctx)
Walk all the SW interfaces in the system.
Definition: interface.c:1163
IP_LOOKUP_NEXT_MCAST
@ IP_LOOKUP_NEXT_MCAST
Multicast Adjacency.
Definition: adj.h:82
default_build_rewrite
u8 * default_build_rewrite(vnet_main_t *vnm, u32 sw_if_index, vnet_link_t link_type, const void *dst_address)
Return a complete, zero-length (aka placeholder) rewrite.
Definition: interface.c:1757
VNET_SW_INTERFACE_TYPE_P2P
@ VNET_SW_INTERFACE_TYPE_P2P
Definition: interface.h:768
i
int i
Definition: flowhash_template.h:376
foreach_combined_interface_counter_name
#define foreach_combined_interface_counter_name
Definition: interface.h:947
VNET_HW_INTERFACE_CLASS_FLAG_P2P
@ VNET_HW_INTERFACE_CLASS_FLAG_P2P
a point 2 point interface
Definition: interface.h:394
vnet_hw_interface_rx_redirect_to_node_helper
static int vnet_hw_interface_rx_redirect_to_node_helper(vnet_main_t *vnm, u32 hw_if_index, u32 node_index, u32 redistribute)
Definition: interface.c:1259
vnet_sw_hw_interface_state_t::flags
u32 flags
Definition: interface.c:88
word
i64 word
Definition: types.h:111
vnet_link_to_mtu
vnet_mtu_t vnet_link_to_mtu(vnet_link_t link)
Definition: interface.c:1741
vlib_node_t::next_nodes
u32 * next_nodes
Definition: node.h:325
vnet_sw_interface_t::hw_if_index
u32 hw_if_index
Definition: interface.h:887
vlib_register_node
u32 vlib_register_node(vlib_main_t *vm, vlib_node_registration_t *r)
Definition: node.c:519
VNET_N_COMBINED_INTERFACE_COUNTER
@ VNET_N_COMBINED_INTERFACE_COUNTER
Definition: interface.h:923
vnet_hw_interface_t::name
u8 * name
Definition: interface.h:678
vnet_hw_interface_t::hw_if_index
u32 hw_if_index
Definition: interface.h:667
rv
int __clib_unused rv
Definition: application.c:491
vnet_sw_hw_interface_state_t
Definition: interface.c:82
tx_queue_funcs.h
vnet_main_t::sw_interface_add_del_functions
_vnet_interface_function_list_elt_t * sw_interface_add_del_functions[VNET_ITF_FUNC_N_PRIO]
Definition: vnet.h:91
vnet_hw_interface_walk_sw
void vnet_hw_interface_walk_sw(vnet_main_t *vnm, u32 hw_if_index, vnet_hw_sw_interface_walk_t fn, void *ctx)
Walk the SW interfaces on a HW interface - this is the super interface and any sub-interfaces.
Definition: interface.c:1122
vnet_interface_main_t::rxq_index_by_hw_if_index_and_queue_id
uword * rxq_index_by_hw_if_index_and_queue_id
Definition: interface.h:997
VNET_HW_INTERFACE_CLASS_FLAG_NBMA
@ VNET_HW_INTERFACE_CLASS_FLAG_NBMA
a non-broadcast multiple access interface
Definition: interface.h:398
vnet.h
VNET_SW_INTERFACE_TYPE_HARDWARE
@ VNET_SW_INTERFACE_TYPE_HARDWARE
Definition: interface.h:764
vlib_node_runtime_t
Definition: node.h:454
call_sw_interface_mtu_change_callbacks
static clib_error_t * call_sw_interface_mtu_change_callbacks(vnet_main_t *vnm, u32 sw_if_index)
Definition: interface.c:699
vnet_get_sup_sw_interface
static vnet_sw_interface_t * vnet_get_sup_sw_interface(vnet_main_t *vnm, u32 sw_if_index)
Definition: interface_funcs.h:81
vlib_cli_command_t
Definition: cli.h:92
VLIB_NODE_FLAG_IS_OUTPUT
#define VLIB_NODE_FLAG_IS_OUTPUT
Definition: node.h:285
vnet_sw_interface_set_flags_helper
static clib_error_t * vnet_sw_interface_set_flags_helper(vnet_main_t *vnm, u32 sw_if_index, vnet_sw_interface_flags_t flags, vnet_interface_helper_flags_t helper_flags)
Definition: interface.c:358
sw_if_index
vl_api_interface_index_t sw_if_index
Definition: wireguard.api:34
unserialize_vec_vnet_sw_hw_interface_state
static void unserialize_vec_vnet_sw_hw_interface_state(serialize_main_t *m, va_list *va)
Definition: interface.c:107
hash_create
#define hash_create(elts, value_bytes)
Definition: hash.h:695
vnet_interface_main_t::output_feature_arc_index
u8 output_feature_arc_index
Definition: interface.h:1043
VNET_MTU_L3
@ VNET_MTU_L3
Definition: interface.h:830
vnet_hw_interface_t::rx_queue_indices
u32 * rx_queue_indices
Definition: interface.h:726
walk_rc_t
enum walk_rc_t_ walk_rc_t
Walk return code.
vnet_interface_counter_lock
static void vnet_interface_counter_lock(vnet_interface_main_t *im)
Definition: interface.h:1051
adj_get
static ip_adjacency_t * adj_get(adj_index_t adj_index)
Get a pointer to an adjacency object from its index.
Definition: adj.h:470
vnet_hw_interface_class_t
struct _vnet_hw_interface_class vnet_hw_interface_class_t
vnet_sw_interface_admin_down
void vnet_sw_interface_admin_down(vnet_main_t *vnm, u32 sw_if_index)
Definition: interface.c:546
WALK_STOP
@ WALK_STOP
Definition: interface_funcs.h:173
vlib_buffer_t::opaque
u32 opaque[10]
Opaque data used by sub-graphs for their own purposes.
Definition: buffer.h:162
vlib_node_get_preferred_node_fn_variant
vlib_node_function_t * vlib_node_get_preferred_node_fn_variant(vlib_main_t *vm, vlib_node_fn_registration_t *regs)
Definition: node.c:295
vnet_register_interface
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:812
vlib_node_runtime_perf_counter
static void vlib_node_runtime_perf_counter(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *frame, uword n, u64 t, vlib_node_runtime_perf_call_type_t call_type)
Definition: main.h:437
vnet_main_t::interface_main
vnet_interface_main_t interface_main
Definition: vnet.h:81
VNET_INTERFACE_OUTPUT_NEXT_DROP
@ VNET_INTERFACE_OUTPUT_NEXT_DROP
Definition: interface_funcs.h:491
vnet_hw_if_tx_frame_t
Definition: interface.h:622
UNFORMAT_END_OF_INPUT
#define UNFORMAT_END_OF_INPUT
Definition: format.h:137
vnet_sw_interface_set_protocol_mtu
void vnet_sw_interface_set_protocol_mtu(vnet_main_t *vnm, u32 sw_if_index, u32 mtu[])
Definition: interface.c:721
format_vnet_sw_interface_name
format_function_t format_vnet_sw_interface_name
Definition: interface_funcs.h:456
clib_bitmap_dup
#define clib_bitmap_dup(v)
Duplicate a bitmap.
Definition: bitmap.h:87
vlib_buffer_t
VLIB buffer representation.
Definition: buffer.h:111
vnet_interface_output_runtime_t
Definition: interface_funcs.h:475
mac_address
manual_print typedef u8 mac_address[6]
Definition: ethernet_types.api:19
vnet_hw_interface_t::input_node_thread_index_by_queue
u32 * input_node_thread_index_by_queue
Definition: interface.h:721
flags
vl_api_wireguard_peer_flags_t flags
Definition: wireguard.api:105