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:
8 * http://www.apache.org/licenses/LICENSE-2.0
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 *------------------------------------------------------------------
19 #include <vlib/vlib.h>
20 #include <vlib/unix/unix.h>
21 #include <vnet/ethernet/ethernet.h>
22 #include <vnet/bonding/node.h>
25 bond_disable_collecting_distributing (vlib_main_t * vm, slave_if_t * sif)
27 bond_main_t *bm = &bond_main;
31 u8 switching_active = 0;
33 bif = bond_get_master_by_dev_instance (sif->bif_dev_instance);
34 clib_spinlock_lock_if_init (&bif->lockp);
35 vec_foreach_index (i, bif->active_slaves)
37 p = *vec_elt_at_index (bif->active_slaves, i);
38 if (p == sif->sw_if_index)
40 /* Are we disabling the very 1st slave? */
41 if (sif->sw_if_index == *vec_elt_at_index (bif->active_slaves, 0))
44 vec_del1 (bif->active_slaves, i);
45 hash_unset (bif->active_slave_by_sw_if_index, sif->sw_if_index);
47 /* We got a new slave just becoming active? */
48 if ((vec_len (bif->active_slaves) >= 1) &&
49 (bif->mode == BOND_MODE_ACTIVE_BACKUP) && switching_active)
50 vlib_process_signal_event (bm->vlib_main, bond_process_node.index,
51 BOND_SEND_GARP_NA, bif->hw_if_index);
55 clib_spinlock_unlock_if_init (&bif->lockp);
59 bond_enable_collecting_distributing (vlib_main_t * vm, slave_if_t * sif)
62 bond_main_t *bm = &bond_main;
64 bif = bond_get_master_by_dev_instance (sif->bif_dev_instance);
65 clib_spinlock_lock_if_init (&bif->lockp);
66 if (!hash_get (bif->active_slave_by_sw_if_index, sif->sw_if_index))
68 hash_set (bif->active_slave_by_sw_if_index, sif->sw_if_index,
70 vec_add1 (bif->active_slaves, sif->sw_if_index);
72 /* First slave becomes active? */
73 if ((vec_len (bif->active_slaves) == 1) &&
74 (bif->mode == BOND_MODE_ACTIVE_BACKUP))
75 vlib_process_signal_event (bm->vlib_main, bond_process_node.index,
76 BOND_SEND_GARP_NA, bif->hw_if_index);
78 clib_spinlock_unlock_if_init (&bif->lockp);
82 bond_dump_ifs (bond_interface_details_t ** out_bondifs)
84 vnet_main_t *vnm = vnet_get_main ();
85 bond_main_t *bm = &bond_main;
87 vnet_hw_interface_t *hi;
88 bond_interface_details_t *r_bondifs = NULL;
89 bond_interface_details_t *bondif = NULL;
92 pool_foreach (bif, bm->interfaces,
93 vec_add2(r_bondifs, bondif, 1);
94 clib_memset (bondif, 0, sizeof (*bondif));
96 bondif->sw_if_index = bif->sw_if_index;
97 hi = vnet_get_hw_interface (vnm, bif->hw_if_index);
98 clib_memcpy(bondif->interface_name, hi->name,
99 MIN (ARRAY_LEN (bondif->interface_name) - 1,
100 strlen ((const char *) hi->name)));
101 bondif->mode = bif->mode;
102 bondif->lb = bif->lb;
103 bondif->active_slaves = vec_len (bif->active_slaves);
104 bondif->slaves = vec_len (bif->slaves);
108 *out_bondifs = r_bondifs;
114 bond_dump_slave_ifs (slave_interface_details_t ** out_slaveifs,
115 u32 bond_sw_if_index)
117 vnet_main_t *vnm = vnet_get_main ();
119 vnet_hw_interface_t *hi;
120 vnet_sw_interface_t *sw;
121 slave_interface_details_t *r_slaveifs = NULL;
122 slave_interface_details_t *slaveif = NULL;
123 u32 *sw_if_index = NULL;
126 bif = bond_get_master_by_sw_if_index (bond_sw_if_index);
130 vec_foreach (sw_if_index, bif->slaves)
132 vec_add2 (r_slaveifs, slaveif, 1);
133 clib_memset (slaveif, 0, sizeof (*slaveif));
134 sif = bond_get_slave_by_sw_if_index (*sw_if_index);
137 sw = vnet_get_sw_interface (vnm, sif->sw_if_index);
138 hi = vnet_get_hw_interface (vnm, sw->hw_if_index);
139 clib_memcpy (slaveif->interface_name, hi->name,
140 MIN (ARRAY_LEN (slaveif->interface_name) - 1,
141 strlen ((const char *) hi->name)));
142 slaveif->sw_if_index = sif->sw_if_index;
143 slaveif->is_passive = sif->is_passive;
144 slaveif->is_long_timeout = sif->is_long_timeout;
147 *out_slaveifs = r_slaveifs;
153 bond_delete_neighbor (vlib_main_t * vm, bond_if_t * bif, slave_if_t * sif)
155 bond_main_t *bm = &bond_main;
156 vnet_main_t *vnm = vnet_get_main ();
158 vnet_hw_interface_t *sif_hw;
160 sif_hw = vnet_get_sup_hw_interface (vnm, sif->sw_if_index);
162 bif->port_number_bitmap =
163 clib_bitmap_set (bif->port_number_bitmap,
164 ntohs (sif->actor_admin.port_number) - 1, 0);
165 bm->slave_by_sw_if_index[sif->sw_if_index] = 0;
166 vec_free (sif->last_marker_pkt);
167 vec_free (sif->last_rx_pkt);
168 vec_foreach_index (i, bif->slaves)
170 uword p = *vec_elt_at_index (bif->slaves, i);
171 if (p == sif->sw_if_index)
173 vec_del1 (bif->slaves, i);
178 bond_disable_collecting_distributing (vm, sif);
180 vnet_feature_enable_disable ("device-input", "bond-input",
181 sif_hw->hw_if_index, 0, 0, 0);
183 /* Put back the old mac */
184 vnet_hw_interface_change_mac_address (vnm, sif_hw->hw_if_index,
185 sif->persistent_hw_address);
187 if ((bif->mode == BOND_MODE_LACP) && bm->lacp_enable_disable)
188 (*bm->lacp_enable_disable) (vm, bif, sif, 0);
190 pool_put (bm->neighbors, sif);
194 bond_delete_if (vlib_main_t * vm, u32 sw_if_index)
196 bond_main_t *bm = &bond_main;
197 vnet_main_t *vnm = vnet_get_main ();
200 vnet_hw_interface_t *hw;
201 u32 *sif_sw_if_index;
205 hw = vnet_get_sup_hw_interface (vnm, sw_if_index);
206 if (hw == NULL || bond_dev_class.index != hw->dev_class_index)
207 return VNET_API_ERROR_INVALID_SW_IF_INDEX;
209 bif = bond_get_master_by_dev_instance (hw->dev_instance);
211 vec_foreach (sif_sw_if_index, bif->slaves)
213 vec_add1 (s_list, sif_sw_if_index);
216 for (i = 0; i < vec_len (s_list); i++)
218 sif_sw_if_index = s_list[i];
219 sif = bond_get_slave_by_sw_if_index (*sif_sw_if_index);
221 bond_delete_neighbor (vm, bif, sif);
227 /* bring down the interface */
228 vnet_hw_interface_set_flags (vnm, bif->hw_if_index, 0);
229 vnet_sw_interface_set_flags (vnm, bif->sw_if_index, 0);
231 ethernet_delete_interface (vnm, bif->hw_if_index);
233 clib_bitmap_free (bif->port_number_bitmap);
234 hash_unset (bm->bond_by_sw_if_index, bif->sw_if_index);
235 hash_unset (bm->id_used, bif->id);
236 clib_memset (bif, 0, sizeof (*bif));
237 pool_put (bm->interfaces, bif);
243 bond_create_if (vlib_main_t * vm, bond_create_if_args_t * args)
245 bond_main_t *bm = &bond_main;
246 vnet_main_t *vnm = vnet_get_main ();
247 vnet_sw_interface_t *sw;
250 if ((args->mode == BOND_MODE_LACP) && bm->lacp_plugin_loaded == 0)
252 args->rv = VNET_API_ERROR_FEATURE_DISABLED;
253 args->error = clib_error_return (0, "LACP plugin is not loaded");
256 if (args->mode > BOND_MODE_LACP || args->mode < BOND_MODE_ROUND_ROBIN)
258 args->rv = VNET_API_ERROR_INVALID_ARGUMENT;
259 args->error = clib_error_return (0, "Invalid mode");
262 if (args->lb > BOND_LB_L23)
264 args->rv = VNET_API_ERROR_INVALID_ARGUMENT;
265 args->error = clib_error_return (0, "Invalid load-balance");
268 pool_get (bm->interfaces, bif);
269 clib_memset (bif, 0, sizeof (*bif));
270 bif->dev_instance = bif - bm->interfaces;
273 bif->mode = args->mode;
275 // Adjust requested interface id
277 bif->id = bif->dev_instance;
278 if (hash_get (bm->id_used, bif->id))
280 args->rv = VNET_API_ERROR_INSTANCE_IN_USE;
281 pool_put (bm->interfaces, bif);
284 hash_set (bm->id_used, bif->id, 1);
286 // Special load-balance mode used for rr and bc
287 if (bif->mode == BOND_MODE_ROUND_ROBIN)
288 bif->lb = BOND_LB_RR;
289 else if (bif->mode == BOND_MODE_BROADCAST)
290 bif->lb = BOND_LB_BC;
291 else if (bif->mode == BOND_MODE_ACTIVE_BACKUP)
292 bif->lb = BOND_LB_AB;
294 bif->use_custom_mac = args->hw_addr_set;
295 if (!args->hw_addr_set)
297 f64 now = vlib_time_now (vm);
299 rnd = (u32) (now * 1e6);
300 rnd = random_u32 (&rnd);
302 memcpy (args->hw_addr + 2, &rnd, sizeof (rnd));
303 args->hw_addr[0] = 2;
304 args->hw_addr[1] = 0xfe;
306 memcpy (bif->hw_address, args->hw_addr, 6);
307 args->error = ethernet_register_interface
308 (vnm, bond_dev_class.index, bif->dev_instance /* device instance */ ,
309 bif->hw_address /* ethernet address */ ,
310 &bif->hw_if_index, 0 /* flag change */ );
314 args->rv = VNET_API_ERROR_INVALID_REGISTRATION;
315 hash_unset (bm->id_used, bif->id);
316 pool_put (bm->interfaces, bif);
320 sw = vnet_get_hw_sw_interface (vnm, bif->hw_if_index);
321 bif->sw_if_index = sw->sw_if_index;
322 bif->group = bif->sw_if_index;
323 if (vlib_get_thread_main ()->n_vlib_mains > 1)
324 clib_spinlock_init (&bif->lockp);
326 vnet_hw_interface_set_flags (vnm, bif->hw_if_index,
327 VNET_HW_INTERFACE_FLAG_LINK_UP);
329 hash_set (bm->bond_by_sw_if_index, bif->sw_if_index, bif->dev_instance);
332 args->sw_if_index = bif->sw_if_index;
335 static clib_error_t *
336 bond_create_command_fn (vlib_main_t * vm, unformat_input_t * input,
337 vlib_cli_command_t * cmd)
339 unformat_input_t _line_input, *line_input = &_line_input;
340 bond_create_if_args_t args = { 0 };
343 /* Get a line of input. */
344 if (!unformat_user (input, unformat_line_input, line_input))
345 return clib_error_return (0, "Missing required arguments.");
349 args.lb = BOND_LB_L2;
350 while (unformat_check_input (line_input) != UNFORMAT_END_OF_INPUT)
352 if (unformat (line_input, "mode %U", unformat_bond_mode, &args.mode))
354 else if (((args.mode == BOND_MODE_LACP) || (args.mode == BOND_MODE_XOR))
355 && unformat (line_input, "load-balance %U",
356 unformat_bond_load_balance, &args.lb))
358 else if (unformat (line_input, "hw-addr %U",
359 unformat_ethernet_address, args.hw_addr))
360 args.hw_addr_set = 1;
361 else if (unformat (line_input, "id %u", &args.id))
364 return clib_error_return (0, "unknown input `%U'",
365 format_unformat_error, input);
367 unformat_free (line_input);
369 if (mode_is_set == 0)
370 return clib_error_return (0, "Missing bond mode");
372 bond_create_if (vm, &args);
378 VLIB_CLI_COMMAND (bond_create_command, static) = {
379 .path = "create bond",
380 .short_help = "create bond mode {round-robin | active-backup | broadcast | "
381 "{lacp | xor} [load-balance { l2 | l23 | l34 }]} [hw-addr <mac-address>] "
383 .function = bond_create_command_fn,
387 static clib_error_t *
388 bond_delete_command_fn (vlib_main_t * vm, unformat_input_t * input,
389 vlib_cli_command_t * cmd)
391 unformat_input_t _line_input, *line_input = &_line_input;
392 u32 sw_if_index = ~0;
393 vnet_main_t *vnm = vnet_get_main ();
396 /* Get a line of input. */
397 if (!unformat_user (input, unformat_line_input, line_input))
398 return clib_error_return (0, "Missing <interface>");
400 while (unformat_check_input (line_input) != UNFORMAT_END_OF_INPUT)
402 if (unformat (line_input, "sw_if_index %d", &sw_if_index))
404 else if (unformat (line_input, "%U", unformat_vnet_sw_interface,
408 return clib_error_return (0, "unknown input `%U'",
409 format_unformat_error, input);
411 unformat_free (line_input);
413 if (sw_if_index == ~0)
414 return clib_error_return (0,
415 "please specify interface name or sw_if_index");
417 rv = bond_delete_if (vm, sw_if_index);
418 if (rv == VNET_API_ERROR_INVALID_SW_IF_INDEX)
419 return clib_error_return (0, "not a bond interface");
421 return clib_error_return (0, "error on deleting bond interface");
427 VLIB_CLI_COMMAND (bond_delete__command, static) =
429 .path = "delete bond",
430 .short_help = "delete bond {<interface> | sw_if_index <sw_idx>}",
431 .function = bond_delete_command_fn,
436 bond_enslave (vlib_main_t * vm, bond_enslave_args_t * args)
438 bond_main_t *bm = &bond_main;
439 vnet_main_t *vnm = vnet_get_main ();
442 vnet_interface_main_t *im = &vnm->interface_main;
443 vnet_hw_interface_t *bif_hw, *sif_hw;
444 vnet_sw_interface_t *sw;
448 bif = bond_get_master_by_sw_if_index (args->group);
451 args->rv = VNET_API_ERROR_INVALID_INTERFACE;
452 args->error = clib_error_return (0, "bond interface not found");
455 // make sure the interface is not already enslaved
456 if (bond_get_slave_by_sw_if_index (args->slave))
458 args->rv = VNET_API_ERROR_VALUE_EXIST;
459 args->error = clib_error_return (0, "interface was already enslaved");
462 sif_hw = vnet_get_sup_hw_interface (vnm, args->slave);
463 if (sif_hw->dev_class_index == bond_dev_class.index)
465 args->rv = VNET_API_ERROR_INVALID_INTERFACE;
467 clib_error_return (0, "bond interface cannot be enslaved");
470 pool_get (bm->neighbors, sif);
471 clib_memset (sif, 0, sizeof (*sif));
472 sw = pool_elt_at_index (im->sw_interfaces, args->slave);
473 sif->port_enabled = sw->flags & VNET_SW_INTERFACE_FLAG_ADMIN_UP;
474 sif->sw_if_index = sw->sw_if_index;
475 sif->hw_if_index = sw->hw_if_index;
476 sif->packet_template_index = (u8) ~ 0;
477 sif->is_passive = args->is_passive;
478 sif->group = args->group;
479 sif->bif_dev_instance = bif->dev_instance;
480 sif->mode = bif->mode;
482 sif->is_long_timeout = args->is_long_timeout;
483 if (args->is_long_timeout)
484 sif->ttl_in_seconds = LACP_LONG_TIMOUT_TIME;
486 sif->ttl_in_seconds = LACP_SHORT_TIMOUT_TIME;
488 vec_validate_aligned (bm->slave_by_sw_if_index, sif->sw_if_index,
489 CLIB_CACHE_LINE_BYTES);
491 * sif - bm->neighbors may be 0
492 * Left shift it by 1 bit to distinguish the valid entry that we actually
493 * store from the null entries
495 bm->slave_by_sw_if_index[sif->sw_if_index] =
496 (uword) (((sif - bm->neighbors) << 1) | 1);
497 vec_add1 (bif->slaves, sif->sw_if_index);
499 sif_hw = vnet_get_sup_hw_interface (vnm, sif->sw_if_index);
501 /* Save the old mac */
502 memcpy (sif->persistent_hw_address, sif_hw->hw_address, 6);
503 bif_hw = vnet_get_sup_hw_interface (vnm, bif->sw_if_index);
504 if (bif->use_custom_mac)
506 vnet_hw_interface_change_mac_address (vnm, sif_hw->hw_if_index,
511 // bond interface gets the mac address from the first slave
512 if (vec_len (bif->slaves) == 1)
514 memcpy (bif->hw_address, sif_hw->hw_address, 6);
515 vnet_hw_interface_change_mac_address (vnm, bif_hw->hw_if_index,
520 // subsequent slaves gets the mac address of the bond interface
521 vnet_hw_interface_change_mac_address (vnm, sif_hw->hw_if_index,
526 if (bif_hw->l2_if_count)
528 ethernet_set_flags (vnm, sif_hw->hw_if_index,
529 ETHERNET_INTERFACE_FLAG_ACCEPT_ALL);
530 /* ensure all packets go to ethernet-input */
531 ethernet_set_rx_redirect (vnm, sif_hw, 1);
534 if (bif->mode == BOND_MODE_LACP)
536 if (bm->lacp_enable_disable)
537 (*bm->lacp_enable_disable) (vm, bif, sif, 1);
539 else if (sif->port_enabled &&
540 (sif_hw->flags & VNET_HW_INTERFACE_FLAG_LINK_UP))
542 bond_enable_collecting_distributing (vm, sif);
545 vec_foreach_index (thread_index, bm->per_thread_data)
547 bond_per_thread_data_t *ptd = vec_elt_at_index (bm->per_thread_data,
550 vec_validate_aligned (ptd->per_port_queue, vec_len (bif->slaves) - 1,
551 CLIB_CACHE_LINE_BYTES);
553 vec_foreach_index (sif_if_index, ptd->per_port_queue)
555 ptd->per_port_queue[sif_if_index].n_buffers = 0;
559 args->rv = vnet_feature_enable_disable ("device-input", "bond-input",
560 sif_hw->hw_if_index, 1, 0, 0);
565 clib_error_return (0,
566 "Error encountered on input feature arc enable");
570 static clib_error_t *
571 enslave_interface_command_fn (vlib_main_t * vm, unformat_input_t * input,
572 vlib_cli_command_t * cmd)
574 bond_enslave_args_t args = { 0 };
575 unformat_input_t _line_input, *line_input = &_line_input;
576 vnet_main_t *vnm = vnet_get_main ();
578 /* Get a line of input. */
579 if (!unformat_user (input, unformat_line_input, line_input))
580 return clib_error_return (0, "Missing required arguments.");
584 while (unformat_check_input (line_input) != UNFORMAT_END_OF_INPUT)
586 if (unformat (line_input, "%U %U",
587 unformat_vnet_sw_interface, vnm, &args.group,
588 unformat_vnet_sw_interface, vnm, &args.slave))
590 else if (unformat (line_input, "passive"))
592 else if (unformat (line_input, "long-timeout"))
593 args.is_long_timeout = 1;
596 args.error = clib_error_return (0, "unknown input `%U'",
597 format_unformat_error, input);
601 unformat_free (line_input);
605 if (args.group == ~0)
606 return clib_error_return (0, "Missing bond interface");
607 if (args.slave == ~0)
608 return clib_error_return (0, "please specify valid slave interface name");
610 bond_enslave (vm, &args);
616 VLIB_CLI_COMMAND (enslave_interface_command, static) = {
618 .short_help = "bond add <BondEthernetx> <slave-interface> "
619 "[passive] [long-timeout]",
620 .function = enslave_interface_command_fn,
625 bond_detach_slave (vlib_main_t * vm, bond_detach_slave_args_t * args)
630 sif = bond_get_slave_by_sw_if_index (args->slave);
633 args->rv = VNET_API_ERROR_INVALID_INTERFACE;
634 args->error = clib_error_return (0, "interface was not enslaved");
637 bif = bond_get_master_by_dev_instance (sif->bif_dev_instance);
638 bond_delete_neighbor (vm, bif, sif);
641 static clib_error_t *
642 detach_interface_command_fn (vlib_main_t * vm, unformat_input_t * input,
643 vlib_cli_command_t * cmd)
645 bond_detach_slave_args_t args = { 0 };
646 unformat_input_t _line_input, *line_input = &_line_input;
647 vnet_main_t *vnm = vnet_get_main ();
649 /* Get a line of input. */
650 if (!unformat_user (input, unformat_line_input, line_input))
651 return clib_error_return (0, "Missing required arguments.");
654 while (unformat_check_input (line_input) != UNFORMAT_END_OF_INPUT)
656 if (unformat (line_input, "%U",
657 unformat_vnet_sw_interface, vnm, &args.slave))
661 args.error = clib_error_return (0, "unknown input `%U'",
662 format_unformat_error, input);
666 unformat_free (line_input);
670 if (args.slave == ~0)
671 return clib_error_return (0, "please specify valid slave interface name");
673 bond_detach_slave (vm, &args);
679 VLIB_CLI_COMMAND (detach_interface_command, static) = {
681 .short_help = "bond del <slave-interface>",
682 .function = detach_interface_command_fn,
687 show_bond (vlib_main_t * vm)
689 bond_main_t *bm = &bond_main;
692 vlib_cli_output (vm, "%-16s %-12s %-13s %-13s %-14s %s",
693 "interface name", "sw_if_index", "mode",
694 "load balance", "active slaves", "slaves");
697 pool_foreach (bif, bm->interfaces,
699 vlib_cli_output (vm, "%-16U %-12d %-13U %-13U %-14u %u",
700 format_bond_interface_name, bif->dev_instance,
701 bif->sw_if_index, format_bond_mode, bif->mode,
702 format_bond_load_balance, bif->lb,
703 vec_len (bif->active_slaves), vec_len (bif->slaves));
709 show_bond_details (vlib_main_t * vm)
711 bond_main_t *bm = &bond_main;
716 pool_foreach (bif, bm->interfaces,
718 vlib_cli_output (vm, "%U", format_bond_interface_name, bif->dev_instance);
719 vlib_cli_output (vm, " mode: %U",
720 format_bond_mode, bif->mode);
721 vlib_cli_output (vm, " load balance: %U",
722 format_bond_load_balance, bif->lb);
723 if (bif->mode == BOND_MODE_ROUND_ROBIN)
724 vlib_cli_output (vm, " last xmit slave index: %u",
725 bif->lb_rr_last_index);
726 vlib_cli_output (vm, " number of active slaves: %d",
727 vec_len (bif->active_slaves));
728 vec_foreach (sw_if_index, bif->active_slaves)
730 vlib_cli_output (vm, " %U", format_vnet_sw_if_index_name,
731 vnet_get_main (), *sw_if_index);
733 vlib_cli_output (vm, " number of slaves: %d", vec_len (bif->slaves));
734 vec_foreach (sw_if_index, bif->slaves)
736 vlib_cli_output (vm, " %U", format_vnet_sw_if_index_name,
737 vnet_get_main (), *sw_if_index);
739 vlib_cli_output (vm, " device instance: %d", bif->dev_instance);
740 vlib_cli_output (vm, " interface id: %d", bif->id);
741 vlib_cli_output (vm, " sw_if_index: %d", bif->sw_if_index);
742 vlib_cli_output (vm, " hw_if_index: %d", bif->hw_if_index);
747 static clib_error_t *
748 show_bond_fn (vlib_main_t * vm, unformat_input_t * input,
749 vlib_cli_command_t * cmd)
753 while (unformat_check_input (input) != UNFORMAT_END_OF_INPUT)
755 if (unformat (input, "details"))
759 return clib_error_return (0, "unknown input `%U'",
760 format_unformat_error, input);
765 show_bond_details (vm);
773 VLIB_CLI_COMMAND (show_bond_command, static) = {
775 .short_help = "show bond [details]",
776 .function = show_bond_fn,
781 bond_cli_init (vlib_main_t * vm)
783 bond_main_t *bm = &bond_main;
786 bm->vnet_main = vnet_get_main ();
787 vec_validate_aligned (bm->slave_by_sw_if_index, 1, CLIB_CACHE_LINE_BYTES);
788 vec_validate_aligned (bm->per_thread_data,
789 vlib_get_thread_main ()->n_vlib_mains - 1,
790 CLIB_CACHE_LINE_BYTES);
795 VLIB_INIT_FUNCTION (bond_cli_init);
798 * fd.io coding-style-patch-verification: ON
801 * eval: (c-set-style "gnu")