FD.io VPP  v20.01-48-g3e0dafb74
Vector Packet Processing
cli.c
Go to the documentation of this file.
1 /*
2  *------------------------------------------------------------------
3  * Copyright (c) 2017 Cisco and/or its affiliates.
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at:
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  *------------------------------------------------------------------
16  */
17 
18 #include <stdint.h>
19 #include <vlib/vlib.h>
20 #include <vlib/unix/unix.h>
21 #include <vnet/ethernet/ethernet.h>
22 #include <vnet/bonding/node.h>
23 #include <vpp/stats/stat_segment.h>
24 
25 void
27 {
28  bond_main_t *bm = &bond_main;
29  bond_if_t *bif;
30  int i;
31  uword p;
32  u8 switching_active = 0;
33 
37  {
38  p = *vec_elt_at_index (bif->active_slaves, i);
39  if (p == sif->sw_if_index)
40  {
41  if ((bif->mode == BOND_MODE_ACTIVE_BACKUP) && (i == 0) &&
42  (vec_len (bif->active_slaves) > 1))
43  /* deleting the active slave for active-backup */
44  switching_active = 1;
45  vec_del1 (bif->active_slaves, i);
46  if (sif->lacp_enabled && bif->numa_only)
47  {
48  /* For lacp mode, if we check it is a slave on local numa node,
49  bif->n_numa_slaves should be decreased by 1 becasue the first
50  bif->n_numa_slaves are all slaves on local numa node */
51  if (i < bif->n_numa_slaves)
52  {
53  bif->n_numa_slaves--;
54  ASSERT (bif->n_numa_slaves >= 0);
55  }
56  }
57  break;
58  }
59  }
60 
61  /* We get a new slave just becoming active */
62  if (switching_active)
66 }
67 
68 /*
69  * return 1 if s2 is preferred.
70  * return -1 if s1 is preferred.
71  */
72 static int
73 bond_slave_sort (void *a1, void *a2)
74 {
75  u32 *s1 = a1;
76  u32 *s2 = a2;
79  bond_if_t *bif;
80 
81  ASSERT (sif1);
82  ASSERT (sif2);
83  /*
84  * sort entries according to preference rules:
85  * 1. biggest weight
86  * 2. numa-node
87  * 3. current active slave (to prevent churning)
88  * 4. lowest sw_if_index (for deterministic behavior)
89  *
90  */
91  if (sif2->weight > sif1->weight)
92  return 1;
93  if (sif2->weight < sif1->weight)
94  return -1;
95  else
96  {
97  if (sif2->is_local_numa > sif1->is_local_numa)
98  return 1;
99  if (sif2->is_local_numa < sif1->is_local_numa)
100  return -1;
101  else
102  {
104  /* Favor the current active slave to avoid churning */
105  if (bif->active_slaves[0] == sif2->sw_if_index)
106  return 1;
107  if (bif->active_slaves[0] == sif1->sw_if_index)
108  return -1;
109  /* go for the tiebreaker as the last resort */
110  if (sif1->sw_if_index > sif2->sw_if_index)
111  return 1;
112  if (sif1->sw_if_index < sif2->sw_if_index)
113  return -1;
114  else
115  ASSERT (0);
116  }
117  }
118  return 0;
119 }
120 
121 static void
123 {
124  bond_main_t *bm = &bond_main;
125  u32 old_active = bif->active_slaves[0];
126 
128  if (old_active != bif->active_slaves[0])
131 }
132 
133 void
135 {
136  bond_if_t *bif;
137  bond_main_t *bm = &bond_main;
138  vnet_main_t *vnm = vnet_get_main ();
140  int i;
141  uword p;
142 
146  {
147  p = *vec_elt_at_index (bif->active_slaves, i);
148  if (p == sif->sw_if_index)
149  goto done;
150  }
151 
152  if (sif->lacp_enabled && bif->numa_only && (vm->numa_node == hw->numa_node))
153  {
154  vec_insert_elts (bif->active_slaves, &sif->sw_if_index, 1,
155  bif->n_numa_slaves);
156  bif->n_numa_slaves++;
157  }
158  else
159  vec_add1 (bif->active_slaves, sif->sw_if_index);
160 
161  sif->is_local_numa = (vm->numa_node == hw->numa_node) ? 1 : 0;
162  if (bif->mode == BOND_MODE_ACTIVE_BACKUP)
163  {
164  if (vec_len (bif->active_slaves) == 1)
165  /* First slave becomes active? */
168  else
169  bond_sort_slaves (bif);
170  }
171 
172 done:
174 }
175 
176 int
178 {
179  vnet_main_t *vnm = vnet_get_main ();
180  bond_main_t *bm = &bond_main;
181  bond_if_t *bif;
183  bond_interface_details_t *r_bondifs = NULL;
184  bond_interface_details_t *bondif = NULL;
185 
186  /* *INDENT-OFF* */
187  pool_foreach (bif, bm->interfaces,
188  vec_add2(r_bondifs, bondif, 1);
189  clib_memset (bondif, 0, sizeof (*bondif));
190  bondif->id = bif->id;
191  bondif->sw_if_index = bif->sw_if_index;
192  hi = vnet_get_hw_interface (vnm, bif->hw_if_index);
193  clib_memcpy(bondif->interface_name, hi->name,
194  MIN (ARRAY_LEN (bondif->interface_name) - 1,
195  vec_len ((const char *) hi->name)));
196  /* enforce by memset() above */
197  ASSERT(0 == bondif->interface_name[ARRAY_LEN (bondif->interface_name) - 1]);
198  bondif->mode = bif->mode;
199  bondif->lb = bif->lb;
200  bondif->numa_only = bif->numa_only;
201  bondif->active_slaves = vec_len (bif->active_slaves);
202  bondif->slaves = vec_len (bif->slaves);
203  );
204  /* *INDENT-ON* */
205 
206  *out_bondifs = r_bondifs;
207 
208  return 0;
209 }
210 
211 int
213  u32 bond_sw_if_index)
214 {
215  vnet_main_t *vnm = vnet_get_main ();
216  bond_if_t *bif;
219  slave_interface_details_t *r_slaveifs = NULL;
220  slave_interface_details_t *slaveif = NULL;
221  u32 *sw_if_index = NULL;
222  slave_if_t *sif;
223 
224  bif = bond_get_master_by_sw_if_index (bond_sw_if_index);
225  if (!bif)
226  return 1;
227 
228  vec_foreach (sw_if_index, bif->slaves)
229  {
230  vec_add2 (r_slaveifs, slaveif, 1);
231  clib_memset (slaveif, 0, sizeof (*slaveif));
232  sif = bond_get_slave_by_sw_if_index (*sw_if_index);
233  if (sif)
234  {
235  sw = vnet_get_sw_interface (vnm, sif->sw_if_index);
236  hi = vnet_get_hw_interface (vnm, sw->hw_if_index);
237  clib_memcpy (slaveif->interface_name, hi->name,
238  MIN (ARRAY_LEN (slaveif->interface_name) - 1,
239  vec_len ((const char *) hi->name)));
240  /* enforce by memset() above */
241  ASSERT (0 ==
242  slaveif->interface_name[ARRAY_LEN (slaveif->interface_name) -
243  1]);
244  slaveif->sw_if_index = sif->sw_if_index;
245  slaveif->is_passive = sif->is_passive;
246  slaveif->is_long_timeout = sif->is_long_timeout;
247  slaveif->is_local_numa = sif->is_local_numa;
248  slaveif->weight = sif->weight;
249  }
250  }
251  *out_slaveifs = r_slaveifs;
252 
253  return 0;
254 }
255 
256 /*
257  * Manage secondary mac addresses when attaching/detaching a slave.
258  * If adding, copies any secondary addresses from master to slave
259  * If deleting, deletes the master's secondary addresses from the slave
260  *
261  */
262 static void
263 bond_slave_add_del_mac_addrs (bond_if_t * bif, u32 sif_sw_if_index, u8 is_add)
264 {
265  vnet_main_t *vnm = vnet_get_main ();
266  ethernet_interface_t *b_ei;
267  mac_address_t *sec_mac;
268  vnet_hw_interface_t *s_hwif;
269 
271  if (!b_ei || !b_ei->secondary_addrs)
272  return;
273 
274  s_hwif = vnet_get_sup_hw_interface (vnm, sif_sw_if_index);
275 
276  vec_foreach (sec_mac, b_ei->secondary_addrs)
278  sec_mac->bytes, is_add);
279 }
280 
281 static void
283 {
284  bond_main_t *bm = &bond_main;
285  vnet_main_t *vnm = vnet_get_main ();
286  int i;
287  vnet_hw_interface_t *sif_hw;
288 
289  sif_hw = vnet_get_sup_hw_interface (vnm, sif->sw_if_index);
290 
291  bif->port_number_bitmap =
293  ntohs (sif->actor_admin.port_number) - 1, 0);
294  bm->slave_by_sw_if_index[sif->sw_if_index] = 0;
295  vec_free (sif->last_marker_pkt);
296  vec_free (sif->last_rx_pkt);
297  vec_foreach_index (i, bif->slaves)
298  {
299  uword p = *vec_elt_at_index (bif->slaves, i);
300  if (p == sif->sw_if_index)
301  {
302  vec_del1 (bif->slaves, i);
303  break;
304  }
305  }
306 
308 
309  vnet_feature_enable_disable ("device-input", "bond-input",
310  sif->sw_if_index, 0, 0, 0);
311 
312  /* Put back the old mac */
314  sif->persistent_hw_address);
315 
316  /* delete the bond's secondary/virtual mac addrs from the slave */
317  bond_slave_add_del_mac_addrs (bif, sif->sw_if_index, 0 /* is_add */ );
318 
319 
320  if ((bif->mode == BOND_MODE_LACP) && bm->lacp_enable_disable)
321  (*bm->lacp_enable_disable) (vm, bif, sif, 0);
322 
323  if (bif->mode == BOND_MODE_LACP)
324  {
326  (bm->stats[bif->sw_if_index][sif->sw_if_index].actor_state);
328  (bm->stats[bif->sw_if_index][sif->sw_if_index].partner_state);
329  }
330 
331  pool_put (bm->neighbors, sif);
332 }
333 
334 int
336 {
337  bond_main_t *bm = &bond_main;
338  vnet_main_t *vnm = vnet_get_main ();
339  bond_if_t *bif;
340  slave_if_t *sif;
342  u32 *sif_sw_if_index;
343  u32 *s_list = 0;
344 
345  hw = vnet_get_sup_hw_interface (vnm, sw_if_index);
346  if (hw == NULL || bond_dev_class.index != hw->dev_class_index)
347  return VNET_API_ERROR_INVALID_SW_IF_INDEX;
348 
350 
351  vec_append (s_list, bif->slaves);
352  vec_foreach (sif_sw_if_index, s_list)
353  {
354  sif = bond_get_slave_by_sw_if_index (*sif_sw_if_index);
355  if (sif)
356  bond_delete_neighbor (vm, bif, sif);
357  }
358  vec_free (s_list);
359 
360  /* bring down the interface */
363 
365 
368  hash_unset (bm->id_used, bif->id);
369  clib_memset (bif, 0, sizeof (*bif));
370  pool_put (bm->interfaces, bif);
371 
372  return 0;
373 }
374 
375 void
377 {
378  bond_main_t *bm = &bond_main;
379  vnet_main_t *vnm = vnet_get_main ();
381  bond_if_t *bif;
382 
383  if ((args->mode == BOND_MODE_LACP) && bm->lacp_plugin_loaded == 0)
384  {
385  args->rv = VNET_API_ERROR_FEATURE_DISABLED;
386  args->error = clib_error_return (0, "LACP plugin is not loaded");
387  return;
388  }
389  if (args->mode > BOND_MODE_LACP || args->mode < BOND_MODE_ROUND_ROBIN)
390  {
391  args->rv = VNET_API_ERROR_INVALID_ARGUMENT;
392  args->error = clib_error_return (0, "Invalid mode");
393  return;
394  }
395  if (args->lb > BOND_LB_L23)
396  {
397  args->rv = VNET_API_ERROR_INVALID_ARGUMENT;
398  args->error = clib_error_return (0, "Invalid load-balance");
399  return;
400  }
401  pool_get (bm->interfaces, bif);
402  clib_memset (bif, 0, sizeof (*bif));
403  bif->dev_instance = bif - bm->interfaces;
404  bif->id = args->id;
405  bif->lb = args->lb;
406  bif->mode = args->mode;
407  bif->gso = args->gso;
408 
409  // Adjust requested interface id
410  if (bif->id == ~0)
411  bif->id = bif->dev_instance;
412  if (hash_get (bm->id_used, bif->id))
413  {
414  args->rv = VNET_API_ERROR_INSTANCE_IN_USE;
415  pool_put (bm->interfaces, bif);
416  return;
417  }
418  hash_set (bm->id_used, bif->id, 1);
419 
420  // Special load-balance mode used for rr and bc
421  if (bif->mode == BOND_MODE_ROUND_ROBIN)
422  bif->lb = BOND_LB_RR;
423  else if (bif->mode == BOND_MODE_BROADCAST)
424  bif->lb = BOND_LB_BC;
425  else if (bif->mode == BOND_MODE_ACTIVE_BACKUP)
426  bif->lb = BOND_LB_AB;
427 
428  bif->use_custom_mac = args->hw_addr_set;
429  if (!args->hw_addr_set)
430  {
431  f64 now = vlib_time_now (vm);
432  u32 rnd;
433  rnd = (u32) (now * 1e6);
434  rnd = random_u32 (&rnd);
435 
436  memcpy (args->hw_addr + 2, &rnd, sizeof (rnd));
437  args->hw_addr[0] = 2;
438  args->hw_addr[1] = 0xfe;
439  }
440  memcpy (bif->hw_address, args->hw_addr, 6);
442  (vnm, bond_dev_class.index, bif->dev_instance /* device instance */ ,
443  bif->hw_address /* ethernet address */ ,
444  &bif->hw_if_index, 0 /* flag change */ );
445 
446  if (args->error)
447  {
448  args->rv = VNET_API_ERROR_INVALID_REGISTRATION;
449  hash_unset (bm->id_used, bif->id);
450  pool_put (bm->interfaces, bif);
451  return;
452  }
453 
454  sw = vnet_get_hw_sw_interface (vnm, bif->hw_if_index);
455  bif->sw_if_index = sw->sw_if_index;
456  bif->group = bif->sw_if_index;
457  bif->numa_only = args->numa_only;
458 
459  /*
460  * Add GSO and Checksum offload flags if GSO is enabled on Bond
461  */
462  if (args->gso)
463  {
465 
468  }
470  clib_spinlock_init (&bif->lockp);
471 
474 
476 
477  // for return
478  args->sw_if_index = bif->sw_if_index;
479  args->rv = 0;
480 }
481 
482 static clib_error_t *
484  vlib_cli_command_t * cmd)
485 {
486  unformat_input_t _line_input, *line_input = &_line_input;
487  bond_create_if_args_t args = { 0 };
488  u8 mode_is_set = 0;
489 
490  /* Get a line of input. */
491  if (!unformat_user (input, unformat_line_input, line_input))
492  return clib_error_return (0, "Missing required arguments.");
493 
494  args.id = ~0;
495  args.mode = -1;
496  args.lb = BOND_LB_L2;
497  args.rv = -1;
498  while (unformat_check_input (line_input) != UNFORMAT_END_OF_INPUT)
499  {
500  if (unformat (line_input, "mode %U", unformat_bond_mode, &args.mode))
501  mode_is_set = 1;
502  else if (((args.mode == BOND_MODE_LACP) || (args.mode == BOND_MODE_XOR))
503  && unformat (line_input, "load-balance %U",
505  ;
506  else if (unformat (line_input, "hw-addr %U",
508  args.hw_addr_set = 1;
509  else if (unformat (line_input, "id %u", &args.id))
510  ;
511  else if (unformat (line_input, "gso"))
512  args.gso = 1;
513  else if (unformat (line_input, "numa-only"))
514  {
515  if (args.mode == BOND_MODE_LACP)
516  args.numa_only = 1;
517  else
518  return clib_error_return (0,
519  "Only lacp mode supports numa-only so far!");
520  }
521  else
522  return clib_error_return (0, "unknown input `%U'",
523  format_unformat_error, input);
524  }
525  unformat_free (line_input);
526 
527  if (mode_is_set == 0)
528  return clib_error_return (0, "Missing bond mode");
529 
530  bond_create_if (vm, &args);
531 
532  if (!args.rv)
534  vnet_get_main (), args.sw_if_index);
535 
536  return args.error;
537 }
538 
539 /* *INDENT-OFF* */
540 VLIB_CLI_COMMAND (bond_create_command, static) = {
541  .path = "create bond",
542  .short_help = "create bond mode {round-robin | active-backup | broadcast | "
543  "{lacp | xor} [load-balance { l2 | l23 | l34 } [numa-only]]} "
544  "[hw-addr <mac-address>] [id <if-id>] [gso]",
545  .function = bond_create_command_fn,
546 };
547 /* *INDENT-ON* */
548 
549 static clib_error_t *
551  vlib_cli_command_t * cmd)
552 {
553  unformat_input_t _line_input, *line_input = &_line_input;
554  u32 sw_if_index = ~0;
555  vnet_main_t *vnm = vnet_get_main ();
556  int rv;
557 
558  /* Get a line of input. */
559  if (!unformat_user (input, unformat_line_input, line_input))
560  return clib_error_return (0, "Missing <interface>");
561 
562  while (unformat_check_input (line_input) != UNFORMAT_END_OF_INPUT)
563  {
564  if (unformat (line_input, "sw_if_index %d", &sw_if_index))
565  ;
566  else if (unformat (line_input, "%U", unformat_vnet_sw_interface,
567  vnm, &sw_if_index))
568  ;
569  else
570  return clib_error_return (0, "unknown input `%U'",
571  format_unformat_error, input);
572  }
573  unformat_free (line_input);
574 
575  if (sw_if_index == ~0)
576  return clib_error_return (0,
577  "please specify interface name or sw_if_index");
578 
579  rv = bond_delete_if (vm, sw_if_index);
580  if (rv == VNET_API_ERROR_INVALID_SW_IF_INDEX)
581  return clib_error_return (0, "not a bond interface");
582  else if (rv != 0)
583  return clib_error_return (0, "error on deleting bond interface");
584 
585  return 0;
586 }
587 
588 /* *INDENT-OFF* */
589 VLIB_CLI_COMMAND (bond_delete__command, static) =
590 {
591  .path = "delete bond",
592  .short_help = "delete bond {<interface> | sw_if_index <sw_idx>}",
593  .function = bond_delete_command_fn,
594 };
595 /* *INDENT-ON* */
596 
597 void
599 {
600  bond_main_t *bm = &bond_main;
601  vnet_main_t *vnm = vnet_get_main ();
602  bond_if_t *bif;
603  slave_if_t *sif;
605  vnet_hw_interface_t *bif_hw, *sif_hw;
607  u32 thread_index;
608  u32 sif_if_index;
609 
611  if (!bif)
612  {
613  args->rv = VNET_API_ERROR_INVALID_INTERFACE;
614  args->error = clib_error_return (0, "bond interface not found");
615  return;
616  }
617  // make sure the interface is not already enslaved
619  {
620  args->rv = VNET_API_ERROR_VALUE_EXIST;
621  args->error = clib_error_return (0, "interface was already enslaved");
622  return;
623  }
624  sif_hw = vnet_get_sup_hw_interface (vnm, args->slave);
625  if (sif_hw->dev_class_index == bond_dev_class.index)
626  {
627  args->rv = VNET_API_ERROR_INVALID_INTERFACE;
628  args->error =
629  clib_error_return (0, "bond interface cannot be enslaved");
630  return;
631  }
632  if (bif->gso && !(sif_hw->flags & VNET_HW_INTERFACE_FLAG_SUPPORTS_GSO))
633  {
634  args->rv = VNET_API_ERROR_INVALID_INTERFACE;
635  args->error =
636  clib_error_return (0, "slave interface is not gso capable");
637  return;
638  }
639  if (bif->mode == BOND_MODE_LACP)
640  {
641  u8 *name = format (0, "/if/lacp/%u/%u/state%c", bif->sw_if_index,
642  args->slave, 0);
643 
644  vec_validate (bm->stats, bif->sw_if_index);
645  vec_validate (bm->stats[bif->sw_if_index], args->slave);
646 
648  (name, &bm->stats[bif->sw_if_index][args->slave].actor_state);
649  if (args->error != 0)
650  {
651  args->rv = VNET_API_ERROR_INVALID_INTERFACE;
652  vec_free (name);
653  return;
654  }
655 
656  vec_reset_length (name);
657  name = format (0, "/if/lacp/%u/%u/partner-state%c", bif->sw_if_index,
658  args->slave, 0);
660  (name, &bm->stats[bif->sw_if_index][args->slave].partner_state);
661  vec_free (name);
662  if (args->error != 0)
663  {
664  args->rv = VNET_API_ERROR_INVALID_INTERFACE;
665  return;
666  }
667  }
668 
669  pool_get (bm->neighbors, sif);
670  clib_memset (sif, 0, sizeof (*sif));
671  sw = pool_elt_at_index (im->sw_interfaces, args->slave);
672  /* port_enabled is both admin up and hw link up */
674  sif->sw_if_index = sw->sw_if_index;
675  sif->hw_if_index = sw->hw_if_index;
676  sif->packet_template_index = (u8) ~ 0;
677  sif->is_passive = args->is_passive;
678  sif->group = args->group;
679  sif->bif_dev_instance = bif->dev_instance;
680  sif->mode = bif->mode;
681 
682  sif->is_long_timeout = args->is_long_timeout;
683  if (args->is_long_timeout)
685  else
687 
690  /*
691  * sif - bm->neighbors may be 0
692  * Left shift it by 1 bit to distinguish the valid entry that we actually
693  * store from the null entries
694  */
696  (uword) (((sif - bm->neighbors) << 1) | 1);
697  vec_add1 (bif->slaves, sif->sw_if_index);
698 
699  sif_hw = vnet_get_sup_hw_interface (vnm, sif->sw_if_index);
700 
701  /* Save the old mac */
702  memcpy (sif->persistent_hw_address, sif_hw->hw_address, 6);
703  bif_hw = vnet_get_sup_hw_interface (vnm, bif->sw_if_index);
704  if (bif->use_custom_mac)
705  {
707  bif->hw_address);
708  }
709  else
710  {
711  // bond interface gets the mac address from the first slave
712  if (vec_len (bif->slaves) == 1)
713  {
714  memcpy (bif->hw_address, sif_hw->hw_address, 6);
716  sif_hw->hw_address);
717  }
718  else
719  {
720  // subsequent slaves gets the mac address of the bond interface
722  bif->hw_address);
723  }
724  }
725 
726  /* if there are secondary/virtual mac addrs, propagate to the slave */
727  bond_slave_add_del_mac_addrs (bif, sif->sw_if_index, 1 /* is_add */ );
728 
729  if (bif_hw->l2_if_count)
730  {
731  ethernet_set_flags (vnm, sif_hw->hw_if_index,
733  /* ensure all packets go to ethernet-input */
734  ethernet_set_rx_redirect (vnm, sif_hw, 1);
735  }
736 
737  if (bif->mode == BOND_MODE_LACP)
738  {
739  if (bm->lacp_enable_disable)
740  (*bm->lacp_enable_disable) (vm, bif, sif, 1);
741  }
742  else if (sif->port_enabled)
743  {
745  }
746 
747  vec_foreach_index (thread_index, bm->per_thread_data)
748  {
750  thread_index);
751 
754 
755  vec_foreach_index (sif_if_index, ptd->per_port_queue)
756  {
757  ptd->per_port_queue[sif_if_index].n_buffers = 0;
758  }
759  }
760 
761  args->rv = vnet_feature_enable_disable ("device-input", "bond-input",
762  sif->sw_if_index, 1, 0, 0);
763 
764  if (args->rv)
765  {
766  args->error =
768  "Error encountered on input feature arc enable");
769  }
770 }
771 
772 static clib_error_t *
774  vlib_cli_command_t * cmd)
775 {
776  bond_enslave_args_t args = { 0 };
777  unformat_input_t _line_input, *line_input = &_line_input;
778  vnet_main_t *vnm = vnet_get_main ();
779 
780  /* Get a line of input. */
781  if (!unformat_user (input, unformat_line_input, line_input))
782  return clib_error_return (0, "Missing required arguments.");
783 
784  args.slave = ~0;
785  args.group = ~0;
786  while (unformat_check_input (line_input) != UNFORMAT_END_OF_INPUT)
787  {
788  if (unformat (line_input, "%U %U",
789  unformat_vnet_sw_interface, vnm, &args.group,
790  unformat_vnet_sw_interface, vnm, &args.slave))
791  ;
792  else if (unformat (line_input, "passive"))
793  args.is_passive = 1;
794  else if (unformat (line_input, "long-timeout"))
795  args.is_long_timeout = 1;
796  else
797  {
798  args.error = clib_error_return (0, "unknown input `%U'",
799  format_unformat_error, input);
800  break;
801  }
802  }
803  unformat_free (line_input);
804 
805  if (args.error)
806  return args.error;
807  if (args.group == ~0)
808  return clib_error_return (0, "Missing bond interface");
809  if (args.slave == ~0)
810  return clib_error_return (0, "please specify valid slave interface name");
811 
812  bond_enslave (vm, &args);
813 
814  return args.error;
815 }
816 
817 /* *INDENT-OFF* */
818 VLIB_CLI_COMMAND (enslave_interface_command, static) = {
819  .path = "bond add",
820  .short_help = "bond add <BondEthernetx> <slave-interface> "
821  "[passive] [long-timeout]",
822  .function = enslave_interface_command_fn,
823 };
824 /* *INDENT-ON* */
825 
826 void
828 {
829  bond_if_t *bif;
830  slave_if_t *sif;
831 
832  sif = bond_get_slave_by_sw_if_index (args->slave);
833  if (!sif)
834  {
835  args->rv = VNET_API_ERROR_INVALID_INTERFACE;
836  args->error = clib_error_return (0, "interface was not enslaved");
837  return;
838  }
840  bond_delete_neighbor (vm, bif, sif);
841 }
842 
843 static clib_error_t *
845  vlib_cli_command_t * cmd)
846 {
847  bond_detach_slave_args_t args = { 0 };
848  unformat_input_t _line_input, *line_input = &_line_input;
849  vnet_main_t *vnm = vnet_get_main ();
850 
851  /* Get a line of input. */
852  if (!unformat_user (input, unformat_line_input, line_input))
853  return clib_error_return (0, "Missing required arguments.");
854 
855  args.slave = ~0;
856  while (unformat_check_input (line_input) != UNFORMAT_END_OF_INPUT)
857  {
858  if (unformat (line_input, "%U",
859  unformat_vnet_sw_interface, vnm, &args.slave))
860  ;
861  else
862  {
863  args.error = clib_error_return (0, "unknown input `%U'",
864  format_unformat_error, input);
865  break;
866  }
867  }
868  unformat_free (line_input);
869 
870  if (args.error)
871  return args.error;
872  if (args.slave == ~0)
873  return clib_error_return (0, "please specify valid slave interface name");
874 
875  bond_detach_slave (vm, &args);
876 
877  return args.error;
878 }
879 
880 /* *INDENT-OFF* */
881 VLIB_CLI_COMMAND (detach_interface_command, static) = {
882  .path = "bond del",
883  .short_help = "bond del <slave-interface>",
884  .function = detach_interface_command_fn,
885 };
886 /* *INDENT-ON* */
887 
888 static void
890 {
891  bond_main_t *bm = &bond_main;
892  bond_if_t *bif;
893 
894  vlib_cli_output (vm, "%-16s %-12s %-13s %-13s %-14s %s",
895  "interface name", "sw_if_index", "mode",
896  "load balance", "active slaves", "slaves");
897 
898  /* *INDENT-OFF* */
899  pool_foreach (bif, bm->interfaces,
900  ({
901  vlib_cli_output (vm, "%-16U %-12d %-13U %-13U %-14u %u",
902  format_bond_interface_name, bif->dev_instance,
903  bif->sw_if_index, format_bond_mode, bif->mode,
904  format_bond_load_balance, bif->lb,
905  vec_len (bif->active_slaves), vec_len (bif->slaves));
906  }));
907  /* *INDENT-ON* */
908 }
909 
910 static void
912 {
913  bond_main_t *bm = &bond_main;
914  bond_if_t *bif;
915  u32 *sw_if_index;
916 
917  /* *INDENT-OFF* */
918  pool_foreach (bif, bm->interfaces,
919  ({
920  vlib_cli_output (vm, "%U", format_bond_interface_name, bif->dev_instance);
921  vlib_cli_output (vm, " mode: %U",
922  format_bond_mode, bif->mode);
923  vlib_cli_output (vm, " load balance: %U",
924  format_bond_load_balance, bif->lb);
925  if (bif->gso)
926  vlib_cli_output (vm, " gso enable");
927  if (bif->mode == BOND_MODE_ROUND_ROBIN)
928  vlib_cli_output (vm, " last xmit slave index: %u",
929  bif->lb_rr_last_index);
930  vlib_cli_output (vm, " number of active slaves: %d",
931  vec_len (bif->active_slaves));
932  vec_foreach (sw_if_index, bif->active_slaves)
933  {
934  vlib_cli_output (vm, " %U", format_vnet_sw_if_index_name,
935  vnet_get_main (), *sw_if_index);
936  if (bif->mode == BOND_MODE_ACTIVE_BACKUP)
937  {
938  slave_if_t *sif = bond_get_slave_by_sw_if_index (*sw_if_index);
939  if (sif)
940  vlib_cli_output (vm, " weight: %u, is_local_numa: %u, "
941  "sw_if_index: %u", sif->weight,
942  sif->is_local_numa, sif->sw_if_index);
943  }
944  }
945  vlib_cli_output (vm, " number of slaves: %d", vec_len (bif->slaves));
946  vec_foreach (sw_if_index, bif->slaves)
947  {
948  vlib_cli_output (vm, " %U", format_vnet_sw_if_index_name,
949  vnet_get_main (), *sw_if_index);
950  }
951  vlib_cli_output (vm, " device instance: %d", bif->dev_instance);
952  vlib_cli_output (vm, " interface id: %d", bif->id);
953  vlib_cli_output (vm, " sw_if_index: %d", bif->sw_if_index);
954  vlib_cli_output (vm, " hw_if_index: %d", bif->hw_if_index);
955  }));
956  /* *INDENT-ON* */
957 }
958 
959 static clib_error_t *
961  vlib_cli_command_t * cmd)
962 {
963  u8 details = 0;
964 
966  {
967  if (unformat (input, "details"))
968  details = 1;
969  else
970  {
971  return clib_error_return (0, "unknown input `%U'",
972  format_unformat_error, input);
973  }
974  }
975 
976  if (details)
977  show_bond_details (vm);
978  else
979  show_bond (vm);
980 
981  return 0;
982 }
983 
984 /* *INDENT-OFF* */
985 VLIB_CLI_COMMAND (show_bond_command, static) = {
986  .path = "show bond",
987  .short_help = "show bond [details]",
988  .function = show_bond_fn,
989 };
990 /* *INDENT-ON* */
991 
992 void
994 {
995  slave_if_t *sif;
996  bond_if_t *bif;
997  vnet_main_t *vnm;
998  u32 old_weight;
999 
1001  if (!sif)
1002  {
1003  args->rv = VNET_API_ERROR_INVALID_INTERFACE;
1004  args->error = clib_error_return (0, "Interface not enslaved");
1005  return;
1006  }
1008  if (!bif)
1009  {
1010  args->rv = VNET_API_ERROR_INVALID_INTERFACE;
1011  args->error = clib_error_return (0, "bond interface not found");
1012  return;
1013  }
1014  if (bif->mode != BOND_MODE_ACTIVE_BACKUP)
1015  {
1016  args->rv = VNET_API_ERROR_INVALID_ARGUMENT;
1017  args->error =
1018  clib_error_return (0, "Weight valid for active-backup only");
1019  return;
1020  }
1021 
1022  old_weight = sif->weight;
1023  sif->weight = args->weight;
1024  vnm = vnet_get_main ();
1025  /*
1026  * No need to sort the list if the affected slave is not up (not in active
1027  * slave set), active slave count is 1, or the current slave is already the
1028  * primary slave and new weight > old weight.
1029  */
1030  if (!vnet_sw_interface_is_up (vnm, sif->sw_if_index) ||
1031  (vec_len (bif->active_slaves) == 1) ||
1032  ((bif->active_slaves[0] == sif->sw_if_index) &&
1033  (sif->weight >= old_weight)))
1034  return;
1035 
1036  bond_sort_slaves (bif);
1037 }
1038 
1039 static clib_error_t *
1041  vlib_cli_command_t * cmd)
1042 {
1043  bond_set_intf_weight_args_t args = { 0 };
1044  u32 sw_if_index = (u32) ~ 0;
1045  unformat_input_t _line_input, *line_input = &_line_input;
1046  vnet_main_t *vnm = vnet_get_main ();
1047  u8 weight_enter = 0;
1048  u32 weight = 0;
1049 
1050  /* Get a line of input. */
1051  if (!unformat_user (input, unformat_line_input, line_input))
1052  return clib_error_return (0, "Missing required arguments.");
1053 
1054  while (unformat_check_input (line_input) != UNFORMAT_END_OF_INPUT)
1055  {
1056  if (unformat (line_input, "sw_if_index %d", &sw_if_index))
1057  ;
1058  else if (unformat (line_input, "%U", unformat_vnet_sw_interface, vnm,
1059  &sw_if_index))
1060  ;
1061  else if (unformat (line_input, "weight %u", &weight))
1062  weight_enter = 1;
1063  else
1064  {
1065  clib_error_return (0, "unknown input `%U'", format_unformat_error,
1066  input);
1067  break;
1068  }
1069  }
1070 
1071  unformat_free (line_input);
1072  if (sw_if_index == (u32) ~ 0)
1073  {
1074  args.rv = VNET_API_ERROR_INVALID_INTERFACE;
1075  clib_error_return (0, "Interface name is invalid!");
1076  }
1077  if (weight_enter == 0)
1078  {
1079  args.rv = VNET_API_ERROR_INVALID_ARGUMENT;
1080  clib_error_return (0, "weight missing");
1081  }
1082 
1083  args.sw_if_index = sw_if_index;
1084  args.weight = weight;
1085  bond_set_intf_weight (vm, &args);
1086 
1087  return args.error;
1088 }
1089 
1090 /* *INDENT-OFF* */
1091 VLIB_CLI_COMMAND(set_interface_bond_cmd, static) = {
1092  .path = "set interface bond",
1093  .short_help = "set interface bond <interface> | sw_if_index <idx>"
1094  " weight <value>",
1095  .function = bond_set_intf_cmd,
1096 };
1097 /* *INDENT-ON* */
1098 
1099 clib_error_t *
1101 {
1102  bond_main_t *bm = &bond_main;
1103 
1104  bm->vlib_main = vm;
1105  bm->vnet_main = vnet_get_main ();
1108  vlib_get_thread_main ()->n_vlib_mains - 1,
1110 
1111  return 0;
1112 }
1113 
1115 
1116 /*
1117  * fd.io coding-style-patch-verification: ON
1118  *
1119  * Local Variables:
1120  * eval: (c-set-style "gnu")
1121  * End:
1122  */
u32 weight
Definition: node.h:248
#define vec_validate(V, I)
Make sure vector is long enough for given index (no header, unspecified alignment) ...
Definition: vec.h:440
vnet_main_t * vnet_main
Definition: node.h:377
static uword vnet_sw_interface_is_up(vnet_main_t *vnm, u32 sw_if_index)
u8 gso
Definition: node.h:200
u32 dev_instance
Definition: node.h:178
u32 group
Definition: node.h:205
#define vec_foreach_index(var, v)
Iterate over vector indices.
u32 hw_if_index
Definition: node.h:183
static uword unformat_bond_mode(unformat_input_t *input, va_list *args)
Definition: node.h:429
#define hash_set(h, key, value)
Definition: hash.h:255
static void bond_delete_neighbor(vlib_main_t *vm, bond_if_t *bif, slave_if_t *sif)
Definition: cli.c:282
static void show_bond_details(vlib_main_t *vm)
Definition: cli.c:911
vlib_node_registration_t bond_process_node
(constructor) VLIB_REGISTER_NODE (bond_process_node)
Definition: device.c:835
lacp_stats_t ** stats
Definition: node.h:388
int bond_delete_if(vlib_main_t *vm, u32 sw_if_index)
Definition: cli.c:335
#define hash_unset(h, key)
Definition: hash.h:261
void ethernet_delete_interface(vnet_main_t *vnm, u32 hw_if_index)
Definition: interface.c:378
mac_address_t * secondary_addrs
Definition: ethernet.h:159
vnet_main_t * vnet_get_main(void)
Definition: misc.c:46
static vnet_hw_interface_t * vnet_get_sup_hw_interface(vnet_main_t *vnm, u32 sw_if_index)
u8 lb
Definition: node.h:172
static clib_error_t * detach_interface_command_fn(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
Definition: cli.c:844
vnet_interface_main_t interface_main
Definition: vnet.h:56
clib_error_t * error
Definition: node.h:90
uword * id_used
Definition: node.h:367
int bond_dump_ifs(bond_interface_details_t **out_bondifs)
Definition: cli.c:177
static bond_if_t * bond_get_master_by_sw_if_index(u32 sw_if_index)
Definition: node.h:502
#define NULL
Definition: clib.h:58
clib_memset(h->entries, 0, sizeof(h->entries[0]) *entries)
clib_error_t * error
Definition: node.h:120
static f64 vlib_time_now(vlib_main_t *vm)
Definition: main.h:279
static_always_inline void clib_spinlock_unlock_if_init(clib_spinlock_t *p)
Definition: lock.h:110
u8 * last_marker_pkt
Definition: node.h:242
static vnet_hw_interface_t * vnet_get_hw_interface(vnet_main_t *vnm, u32 hw_if_index)
#define vec_add1(V, E)
Add 1 element to end of vector (unspecified alignment).
Definition: vec.h:523
#define vec_add2(V, P, N)
Add N elements to end of vector V, return pointer to new elements in P.
Definition: vec.h:561
int i
bond_main_t bond_main
Definition: node.c:25
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:989
static vnet_sw_interface_t * vnet_get_sw_interface(vnet_main_t *vnm, u32 sw_if_index)
u8 * format(u8 *s, const char *fmt,...)
Definition: format.c:424
lacp_enable_disable_func lacp_enable_disable
Definition: node.h:382
unformat_function_t unformat_vnet_sw_interface
u32 numa_node
Definition: main.h:220
static clib_error_t * enslave_interface_command_fn(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
Definition: cli.c:773
#define vec_validate_aligned(V, I, A)
Make sure vector is long enough for given index (no header, specified alignment)
Definition: vec.h:451
u32 id
Definition: node.h:181
#define pool_get(P, E)
Allocate an object E from a pool P (unspecified alignment).
Definition: pool.h:237
u8 mode
Definition: node.h:328
void bond_enable_collecting_distributing(vlib_main_t *vm, slave_if_t *sif)
Definition: cli.c:134
format_function_t format_vnet_sw_if_index_name
unsigned char u8
Definition: types.h:56
bond_per_thread_data_t * per_thread_data
Definition: node.h:386
#define vec_reset_length(v)
Reset vector length to zero NULL-pointer tolerant.
double f64
Definition: types.h:142
static vnet_sw_interface_t * vnet_get_hw_sw_interface(vnet_main_t *vnm, u32 hw_if_index)
#define clib_memcpy(d, s, n)
Definition: string.h:180
ethernet_main_t ethernet_main
Definition: init.c:45
static clib_error_t * show_bond_fn(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
Definition: cli.c:960
f32 ttl_in_seconds
Definition: node.h:221
u8 numa_only
Definition: node.h:199
#define pool_foreach(VAR, POOL, BODY)
Iterate through pool.
Definition: pool.h:498
vl_api_interface_index_t sw_if_index
Definition: gre.api:59
#define VLIB_INIT_FUNCTION(x)
Definition: init.h:173
u8 use_custom_mac
Definition: node.h:207
u32 sw_if_index
Definition: node.h:184
vnet_hw_interface_flags_t flags
Definition: interface.h:523
void bond_enslave(vlib_main_t *vm, bond_enslave_args_t *args)
Definition: cli.c:598
#define vec_elt_at_index(v, i)
Get vector value at index i checking that i is in bounds.
#define clib_error_return(e, args...)
Definition: error.h:99
vlib_main_t * vlib_main
Definition: node.h:376
unsigned int u32
Definition: types.h:88
#define MIN(x, y)
Definition: node.h:31
unformat_function_t unformat_line_input
Definition: format.h:283
static void clib_spinlock_init(clib_spinlock_t *p)
Definition: lock.h:63
u8 * last_rx_pkt
Definition: node.h:239
void ethernet_set_rx_redirect(vnet_main_t *vnm, vnet_hw_interface_t *hi, u32 enable)
Definition: node.c:2153
static clib_error_t * bond_create_command_fn(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
Definition: cli.c:483
#define LACP_LONG_TIMOUT_TIME
Definition: node.h:28
#define hash_get(h, key)
Definition: hash.h:249
vnet_device_class_t bond_dev_class
#define pool_elt_at_index(p, i)
Returns pointer to element at given index.
Definition: pool.h:519
static void bond_sort_slaves(bond_if_t *bif)
Definition: cli.c:122
static int bond_slave_sort(void *a1, void *a2)
Definition: cli.c:73
static void vlib_process_signal_event(vlib_main_t *vm, uword node_index, uword type_opaque, uword data)
Definition: node_funcs.h:934
struct _unformat_input_t unformat_input_t
static uword unformat_bond_load_balance(unformat_input_t *input, va_list *args)
Definition: node.h:461
u8 persistent_hw_address[6]
Definition: node.h:215
#define pool_put(P, E)
Free an object E in pool P.
Definition: pool.h:287
u8 weight
Definition: fib_types.api:120
#define vec_del1(v, i)
Delete the element at index I.
Definition: vec.h:806
#define LACP_SHORT_TIMOUT_TIME
Definition: node.h:26
static clib_error_t * bond_delete_command_fn(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
Definition: cli.c:550
bond_if_t * interfaces
Definition: node.h:364
vlib_main_t * vm
Definition: in2out_ed.c:1810
static void bond_slave_add_del_mac_addrs(bond_if_t *bif, u32 sif_sw_if_index, u8 is_add)
Definition: cli.c:263
u8 is_long_timeout
Definition: node.h:224
static clib_error_t * bond_set_intf_cmd(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
Definition: cli.c:1040
void bond_detach_slave(vlib_main_t *vm, bond_detach_slave_args_t *args)
Definition: cli.c:827
u32 partner_state
Definition: node.h:357
#define UNFORMAT_END_OF_INPUT
Definition: format.h:145
u32 * slaves
Definition: node.h:187
u8 is_passive
Definition: node.h:251
u8 mode
Definition: node.h:171
word n_numa_slaves
Definition: node.h:203
u32 sw_if_index
Definition: node.h:218
#define vec_free(V)
Free vector&#39;s memory (no header).
Definition: vec.h:342
uword * bond_by_sw_if_index
Definition: node.h:373
u32 group
Definition: node.h:319
void bond_disable_collecting_distributing(vlib_main_t *vm, slave_if_t *sif)
Definition: cli.c:26
clib_spinlock_t lockp
Definition: node.h:210
#define ETHERNET_INTERFACE_FLAG_ACCEPT_ALL
Definition: ethernet.h:141
void bond_set_intf_weight(vlib_main_t *vm, bond_set_intf_weight_args_t *args)
Definition: cli.c:993
#define ARRAY_LEN(x)
Definition: clib.h:62
static void show_bond(vlib_main_t *vm)
Definition: cli.c:889
string name[64]
Definition: ip.api:44
BOND interface details struct.
Definition: node.h:124
#define VLIB_CLI_COMMAND(x,...)
Definition: cli.h:152
uword * slave_by_sw_if_index
Definition: node.h:384
clib_error_t * stat_segment_deregister_state_counter(u32 index)
Definition: stat_segment.c:833
uword unformat_ethernet_address(unformat_input_t *input, va_list *args)
Definition: format.c:233
u8 is_local_numa
Definition: node.h:349
#define ASSERT(truth)
void bond_create_if(vlib_main_t *vm, bond_create_if_args_t *args)
Definition: cli.c:376
u8 lacp_plugin_loaded
Definition: node.h:380
static bond_if_t * bond_get_master_by_dev_instance(u32 dev_instance)
Definition: node.h:516
#define vec_insert_elts(V, E, N, M)
Insert N vector elements starting at element M, insert given elements (no header, unspecified alignme...
Definition: vec.h:764
u32 bif_dev_instance
Definition: node.h:323
#define vec_append(v1, v2)
Append v2 after v1.
Definition: vec.h:821
#define clib_bitmap_free(v)
Free a bitmap.
Definition: bitmap.h:92
u32 * active_slaves
Definition: node.h:190
vl_api_ip4_address_t hi
Definition: arp.api:37
clib_error_t * error
Definition: node.h:103
clib_error_t * error
Definition: node.h:111
u8 lacp_enabled
Definition: node.h:271
ethernet_interface_t * ethernet_get_interface(ethernet_main_t *em, u32 hw_if_index)
Definition: interface.c:940
#define vec_len(v)
Number of elements in vector (rvalue-only, NULL tolerant)
clib_error_t * ethernet_register_interface(vnet_main_t *vnm, u32 dev_class_index, u32 dev_instance, const u8 *address, u32 *hw_if_index_return, ethernet_flag_change_function_t flag_change)
Definition: interface.c:331
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:492
uword * port_number_bitmap
Definition: node.h:206
u64 uword
Definition: types.h:112
#define vec_sort_with_function(vec, f)
Sort a vector using the supplied element comparison function.
Definition: vec.h:983
static void unformat_free(unformat_input_t *i)
Definition: format.h:163
vnet_sw_interface_t * sw_interfaces
Definition: interface.h:854
int bond_dump_slave_ifs(slave_interface_details_t **out_slaveifs, u32 bond_sw_if_index)
Definition: cli.c:212
slave interface details struct
Definition: node.h:137
static u32 random_u32(u32 *seed)
32-bit random number generator
Definition: random.h:69
u8 * format_unformat_error(u8 *s, va_list *va)
Definition: unformat.c:91
slave_if_t * neighbors
Definition: node.h:370
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:501
static vlib_thread_main_t * vlib_get_thread_main()
Definition: global_funcs.h:32
#define vec_foreach(var, vec)
Vector iterator.
u32 actor_state
Definition: node.h:358
u8 hw_address[6]
Definition: node.h:208
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:1450
clib_error_t * vnet_hw_interface_change_mac_address(vnet_main_t *vnm, u32 hw_if_index, const u8 *mac_address)
Definition: interface.c:1538
u8 port_enabled
Definition: node.h:265
static slave_if_t * bond_get_slave_by_sw_if_index(u32 sw_if_index)
Definition: node.h:524
lacp_port_info_t actor_admin
Definition: node.h:259
clib_error_t * bond_cli_init(vlib_main_t *vm)
Definition: cli.c:1100
#define CLIB_CACHE_LINE_BYTES
Definition: cache.h:59
u8 packet_template_index
Definition: node.h:230
void vlib_cli_output(vlib_main_t *vm, char *fmt,...)
Definition: cli.c:689
static_always_inline void clib_spinlock_lock_if_init(clib_spinlock_t *p)
Definition: lock.h:95
u32 hw_if_index
Definition: node.h:245
clib_error_t * stat_segment_register_state_counter(u8 *name, u32 *index)
Definition: stat_segment.c:796
uword unformat(unformat_input_t *i, const char *fmt,...)
Definition: unformat.c:978
int vnet_feature_enable_disable(const char *arc_name, const char *node_name, u32 sw_if_index, int enable_disable, void *feature_config, u32 n_feature_config_bytes)
Definition: feature.c:304
static uword unformat_check_input(unformat_input_t *i)
Definition: format.h:171
bond_per_port_queue_t * per_port_queue
Definition: node.h:165
u32 ethernet_set_flags(vnet_main_t *vnm, u32 hw_if_index, u32 flags)
Definition: interface.c:426