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 *------------------------------------------------------------------
20 #include <vnet/ethernet/ethernet.h>
21 #include <vnet/ip/ip4_packet.h>
22 #include <vnet/ip/ip6_packet.h>
23 #include <vnet/ip/ip6_hop_by_hop_packet.h>
24 #include <vnet/bonding/node.h>
25 #include <vppinfra/lb_hash_hash.h>
26 #include <vnet/ip/ip.h>
27 #include <vnet/ethernet/arp_packet.h>
29 #define foreach_bond_tx_error \
31 _(IF_DOWN, "interface down") \
32 _(NO_SLAVE, "no slave")
36 #define _(f,s) BOND_TX_ERROR_##f,
42 static char *bond_tx_error_strings[] = {
49 format_bond_tx_trace (u8 * s, va_list * args)
51 CLIB_UNUSED (vlib_main_t * vm) = va_arg (*args, vlib_main_t *);
52 CLIB_UNUSED (vlib_node_t * node) = va_arg (*args, vlib_node_t *);
53 bond_packet_trace_t *t = va_arg (*args, bond_packet_trace_t *);
54 vnet_hw_interface_t *hw, *hw1;
55 vnet_main_t *vnm = vnet_get_main ();
57 hw = vnet_get_sup_hw_interface (vnm, t->sw_if_index);
58 hw1 = vnet_get_sup_hw_interface (vnm, t->bond_sw_if_index);
59 s = format (s, "src %U, dst %U, %s -> %s",
60 format_ethernet_address, t->ethernet.src_address,
61 format_ethernet_address, t->ethernet.dst_address,
67 #ifndef CLIB_MARCH_VARIANT
69 format_bond_interface_name (u8 * s, va_list * args)
71 u32 dev_instance = va_arg (*args, u32);
72 bond_main_t *bm = &bond_main;
73 bond_if_t *bif = pool_elt_at_index (bm->interfaces, dev_instance);
75 s = format (s, "BondEthernet%lu", bif->dev_instance);
81 static __clib_unused clib_error_t *
82 bond_set_l2_mode_function (vnet_main_t * vnm,
83 struct vnet_hw_interface_t *bif_hw,
88 struct vnet_hw_interface_t *sif_hw;
90 bif = bond_get_master_by_sw_if_index (bif_hw->sw_if_index);
94 if ((bif_hw->l2_if_count == 1) && (l2_if_adjust == 1))
96 /* Just added first L2 interface on this port */
97 vec_foreach (sw_if_index, bif->slaves)
99 sif_hw = vnet_get_sup_hw_interface (vnm, *sw_if_index);
100 ethernet_set_flags (vnm, sif_hw->hw_if_index,
101 ETHERNET_INTERFACE_FLAG_ACCEPT_ALL);
103 /* ensure all packets go to ethernet-input */
104 ethernet_set_rx_redirect (vnm, sif_hw, 1);
111 static __clib_unused clib_error_t *
112 bond_subif_add_del_function (vnet_main_t * vnm, u32 hw_if_index,
113 struct vnet_sw_interface_t *st, int is_add)
115 /* Nothing for now */
119 static clib_error_t *
120 bond_interface_admin_up_down (vnet_main_t * vnm, u32 hw_if_index, u32 flags)
122 vnet_hw_interface_t *hif = vnet_get_hw_interface (vnm, hw_if_index);
123 uword is_up = (flags & VNET_SW_INTERFACE_FLAG_ADMIN_UP) != 0;
124 bond_main_t *bm = &bond_main;
125 bond_if_t *bif = pool_elt_at_index (bm->interfaces, hif->dev_instance);
127 bif->admin_up = is_up;
128 if (is_up && vec_len (bif->active_slaves))
129 vnet_hw_interface_set_flags (vnm, bif->hw_if_index,
130 VNET_HW_INTERFACE_FLAG_LINK_UP);
134 static_always_inline u32
135 bond_load_balance_broadcast (vlib_main_t * vm, vlib_node_runtime_t * node,
136 bond_if_t * bif, vlib_buffer_t * b0,
139 vnet_main_t *vnm = vnet_get_main ();
145 u16 thread_index = vm->thread_index;
147 for (port = 1; port < slave_count; port++)
149 sw_if_index = *vec_elt_at_index (bif->active_slaves, port);
150 if (bif->per_thread_info[thread_index].frame[port] == 0)
151 bif->per_thread_info[thread_index].frame[port] =
152 vnet_get_frame_to_sw_interface (vnm, sw_if_index);
153 f = bif->per_thread_info[thread_index].frame[port];
154 to_next = vlib_frame_vector_args (f);
155 to_next += f->n_vectors;
156 c0 = vlib_buffer_copy (vm, b0);
157 if (PREDICT_TRUE (c0 != 0))
159 vnet_buffer (c0)->sw_if_index[VLIB_TX] = sw_if_index;
160 to_next[0] = vlib_get_buffer_index (vm, c0);
168 static_always_inline u32
169 bond_load_balance_l2 (vlib_main_t * vm, vlib_node_runtime_t * node,
170 bond_if_t * bif, vlib_buffer_t * b0, uword slave_count)
172 ethernet_header_t *eth = (ethernet_header_t *) vlib_buffer_get_current (b0);
174 u64 *dst = (u64 *) & eth->dst_address[0];
175 u64 a = clib_mem_unaligned (dst, u64);
176 u32 *src = (u32 *) & eth->src_address[2];
177 u32 b = clib_mem_unaligned (src, u32);
179 c = lb_hash_hash_2_tuples (a, b);
181 if (BOND_MODULO_SHORTCUT (slave_count))
182 return (c & (slave_count - 1));
184 return c % slave_count;
187 static_always_inline u16 *
188 bond_locate_ethertype (ethernet_header_t * eth)
191 ethernet_vlan_header_t *vlan;
193 if (!ethernet_frame_is_tagged (clib_net_to_host_u16 (eth->type)))
195 ethertype_p = ð->type;
199 vlan = (void *) (eth + 1);
200 ethertype_p = &vlan->type;
201 if (*ethertype_p == ntohs (ETHERNET_TYPE_VLAN))
204 ethertype_p = &vlan->type;
210 static_always_inline u32
211 bond_load_balance_l23 (vlib_main_t * vm, vlib_node_runtime_t * node,
212 bond_if_t * bif, vlib_buffer_t * b0, uword slave_count)
214 ethernet_header_t *eth = (ethernet_header_t *) vlib_buffer_get_current (b0);
217 u16 ethertype, *ethertype_p;
218 u32 *mac1, *mac2, *mac3;
220 ethertype_p = bond_locate_ethertype (eth);
221 ethertype = clib_mem_unaligned (ethertype_p, u16);
223 if ((ethertype != htons (ETHERNET_TYPE_IP4)) &&
224 (ethertype != htons (ETHERNET_TYPE_IP6)))
225 return (bond_load_balance_l2 (vm, node, bif, b0, slave_count));
227 ip4 = (ip4_header_t *) (ethertype_p + 1);
228 ip_version = (ip4->ip_version_and_header_length >> 4);
230 if (ip_version == 0x4)
234 mac1 = (u32 *) & eth->dst_address[0];
235 mac2 = (u32 *) & eth->dst_address[4];
236 mac3 = (u32 *) & eth->src_address[2];
238 a = clib_mem_unaligned (mac1, u32) ^ clib_mem_unaligned (mac2, u32) ^
239 clib_mem_unaligned (mac3, u32);
241 lb_hash_hash_2_tuples (clib_mem_unaligned (&ip4->address_pair, u64),
243 if (BOND_MODULO_SHORTCUT (slave_count))
244 return (c & (slave_count - 1));
246 return c % slave_count;
248 else if (ip_version == 0x6)
252 ip6_header_t *ip6 = (ip6_header_t *) (eth + 1);
254 mac1 = (u32 *) & eth->dst_address[0];
255 mac2 = (u32 *) & eth->dst_address[4];
256 mac3 = (u32 *) & eth->src_address[2];
258 a = clib_mem_unaligned (mac1, u32) ^ clib_mem_unaligned (mac2, u32) ^
259 clib_mem_unaligned (mac3, u32);
261 lb_hash_hash (clib_mem_unaligned
262 (&ip6->src_address.as_uword[0], uword),
263 clib_mem_unaligned (&ip6->src_address.as_uword[1],
265 clib_mem_unaligned (&ip6->dst_address.as_uword[0],
267 clib_mem_unaligned (&ip6->dst_address.as_uword[1],
269 if (BOND_MODULO_SHORTCUT (slave_count))
270 return (c & (slave_count - 1));
272 return c % slave_count;
274 return (bond_load_balance_l2 (vm, node, bif, b0, slave_count));
277 static_always_inline u32
278 bond_load_balance_l34 (vlib_main_t * vm, vlib_node_runtime_t * node,
279 bond_if_t * bif, vlib_buffer_t * b0, uword slave_count)
281 ethernet_header_t *eth = (ethernet_header_t *) vlib_buffer_get_current (b0);
285 u16 ethertype, *ethertype_p;
287 ethertype_p = bond_locate_ethertype (eth);
288 ethertype = clib_mem_unaligned (ethertype_p, u16);
290 if ((ethertype != htons (ETHERNET_TYPE_IP4)) &&
291 (ethertype != htons (ETHERNET_TYPE_IP6)))
292 return (bond_load_balance_l2 (vm, node, bif, b0, slave_count));
294 ip4 = (ip4_header_t *) (ethertype_p + 1);
295 ip_version = (ip4->ip_version_and_header_length >> 4);
297 if (ip_version == 0x4)
300 tcp_header_t *tcp = (void *) (ip4 + 1);
302 is_tcp_udp = (ip4->protocol == IP_PROTOCOL_TCP) ||
303 (ip4->protocol == IP_PROTOCOL_UDP);
304 t1 = is_tcp_udp ? clib_mem_unaligned (&tcp->src, u16) : 0;
305 t2 = is_tcp_udp ? clib_mem_unaligned (&tcp->dst, u16) : 0;
308 lb_hash_hash_2_tuples (clib_mem_unaligned (&ip4->address_pair, u64),
310 if (BOND_MODULO_SHORTCUT (slave_count))
311 return (c & (slave_count - 1));
313 return c % slave_count;
315 else if (ip_version == 0x6)
319 ip6_header_t *ip6 = (ip6_header_t *) (eth + 1);
320 tcp_header_t *tcp = (void *) (ip6 + 1);
323 if (PREDICT_TRUE ((ip6->protocol == IP_PROTOCOL_TCP) ||
324 (ip6->protocol == IP_PROTOCOL_UDP)))
327 tcp = (void *) (ip6 + 1);
329 else if (ip6->protocol == IP_PROTOCOL_IP6_HOP_BY_HOP_OPTIONS)
331 ip6_hop_by_hop_header_t *hbh =
332 (ip6_hop_by_hop_header_t *) (ip6 + 1);
333 if ((hbh->protocol == IP_PROTOCOL_TCP)
334 || (hbh->protocol == IP_PROTOCOL_UDP))
337 tcp = (tcp_header_t *) ((u8 *) hbh + ((hbh->length + 1) << 3));
340 t1 = is_tcp_udp ? clib_mem_unaligned (&tcp->src, u16) : 0;
341 t2 = is_tcp_udp ? clib_mem_unaligned (&tcp->dst, u16) : 0;
344 lb_hash_hash (clib_mem_unaligned
345 (&ip6->src_address.as_uword[0], uword),
346 clib_mem_unaligned (&ip6->src_address.as_uword[1],
348 clib_mem_unaligned (&ip6->dst_address.as_uword[0],
350 clib_mem_unaligned (&ip6->dst_address.as_uword[1],
352 if (BOND_MODULO_SHORTCUT (slave_count))
353 return (c & (slave_count - 1));
355 return c % slave_count;
358 return (bond_load_balance_l2 (vm, node, bif, b0, slave_count));
361 static_always_inline u32
362 bond_load_balance_round_robin (vlib_main_t * vm,
363 vlib_node_runtime_t * node,
364 bond_if_t * bif, vlib_buffer_t * b0,
367 bif->lb_rr_last_index++;
368 if (BOND_MODULO_SHORTCUT (slave_count))
369 bif->lb_rr_last_index &= slave_count - 1;
371 bif->lb_rr_last_index %= slave_count;
373 return bif->lb_rr_last_index;
376 static_always_inline u32
377 bond_load_balance_active_backup (vlib_main_t * vm,
378 vlib_node_runtime_t * node,
379 bond_if_t * bif, vlib_buffer_t * b0,
382 /* First interface is the active, the rest is backup */
386 static bond_load_balance_func_t bond_load_balance_table[] = {
387 #define _(v,f,s, p) { bond_load_balance_##p },
392 VNET_DEVICE_CLASS_TX_FN (bond_dev_class) (vlib_main_t * vm,
393 vlib_node_runtime_t * node,
394 vlib_frame_t * frame)
396 vnet_interface_output_runtime_t *rund = (void *) node->runtime_data;
397 bond_main_t *bm = &bond_main;
398 bond_if_t *bif = pool_elt_at_index (bm->interfaces, rund->dev_instance);
399 vlib_buffer_t *bufs[VLIB_FRAME_SIZE], **b;
400 u32 *from = vlib_frame_vector_args (frame);
401 ethernet_header_t *eth;
403 u32 sw_if_index, sw_if_index1, sw_if_index2, sw_if_index3;
404 bond_packet_trace_t *t0;
405 uword n_trace = vlib_get_trace_count (vm, node);
406 u16 thread_index = vm->thread_index;
407 vnet_main_t *vnm = vnet_get_main ();
409 u32 sif_if_index, sif_if_index1, sif_if_index2, sif_if_index3;
413 if (PREDICT_FALSE (bif->admin_up == 0))
415 vlib_buffer_free (vm, vlib_frame_args (frame), frame->n_vectors);
416 vlib_increment_simple_counter (vnet_main.interface_main.sw_if_counters +
417 VNET_INTERFACE_COUNTER_DROP,
418 thread_index, bif->sw_if_index,
420 vlib_error_count (vm, node->node_index, BOND_TX_ERROR_IF_DOWN,
422 return frame->n_vectors;
425 n_left = frame->n_vectors;
426 vlib_get_buffers (vm, from, bufs, n_left);
428 slave_count = vec_len (bif->active_slaves);
429 if (PREDICT_FALSE (slave_count == 0))
431 vlib_buffer_free (vm, vlib_frame_args (frame), frame->n_vectors);
432 vlib_increment_simple_counter (vnet_main.interface_main.sw_if_counters +
433 VNET_INTERFACE_COUNTER_DROP,
434 thread_index, bif->sw_if_index,
436 vlib_error_count (vm, node->node_index, BOND_TX_ERROR_NO_SLAVE,
438 return frame->n_vectors;
441 vec_validate_aligned (bif->per_thread_info[thread_index].frame, slave_count,
442 CLIB_CACHE_LINE_BYTES);
447 u32 next0 = 0, next1 = 0, next2 = 0, next3 = 0;
448 u32 port0 = 0, port1 = 0, port2 = 0, port3 = 0;
450 // Prefetch next iteration
453 vlib_buffer_t **pb = b + 4;
455 vlib_prefetch_buffer_header (pb[0], LOAD);
456 vlib_prefetch_buffer_header (pb[1], LOAD);
457 vlib_prefetch_buffer_header (pb[2], LOAD);
458 vlib_prefetch_buffer_header (pb[3], LOAD);
460 CLIB_PREFETCH (pb[0]->data, CLIB_CACHE_LINE_BYTES, LOAD);
461 CLIB_PREFETCH (pb[1]->data, CLIB_CACHE_LINE_BYTES, LOAD);
462 CLIB_PREFETCH (pb[2]->data, CLIB_CACHE_LINE_BYTES, LOAD);
463 CLIB_PREFETCH (pb[3]->data, CLIB_CACHE_LINE_BYTES, LOAD);
466 VLIB_BUFFER_TRACE_TRAJECTORY_INIT (b[0]);
467 VLIB_BUFFER_TRACE_TRAJECTORY_INIT (b[1]);
468 VLIB_BUFFER_TRACE_TRAJECTORY_INIT (b[2]);
469 VLIB_BUFFER_TRACE_TRAJECTORY_INIT (b[3]);
471 sw_if_index = vnet_buffer (b[0])->sw_if_index[VLIB_TX];
472 sw_if_index1 = vnet_buffer (b[1])->sw_if_index[VLIB_TX];
473 sw_if_index2 = vnet_buffer (b[2])->sw_if_index[VLIB_TX];
474 sw_if_index3 = vnet_buffer (b[3])->sw_if_index[VLIB_TX];
476 if (PREDICT_TRUE (slave_count > 1))
479 (bond_load_balance_table[bif->lb]).load_balance (vm, node,
483 (bond_load_balance_table[bif->lb]).load_balance (vm, node,
487 (bond_load_balance_table[bif->lb]).load_balance (vm, node,
491 (bond_load_balance_table[bif->lb]).load_balance (vm, node,
496 sif_if_index = *vec_elt_at_index (bif->active_slaves, port0);
497 sif_if_index1 = *vec_elt_at_index (bif->active_slaves, port1);
498 sif_if_index2 = *vec_elt_at_index (bif->active_slaves, port2);
499 sif_if_index3 = *vec_elt_at_index (bif->active_slaves, port3);
501 vnet_buffer (b[0])->sw_if_index[VLIB_TX] = sif_if_index;
502 vnet_buffer (b[1])->sw_if_index[VLIB_TX] = sif_if_index1;
503 vnet_buffer (b[2])->sw_if_index[VLIB_TX] = sif_if_index2;
504 vnet_buffer (b[3])->sw_if_index[VLIB_TX] = sif_if_index3;
506 if (PREDICT_FALSE ((bif->per_thread_info[thread_index].frame[port0]
508 bif->per_thread_info[thread_index].frame[port0] =
509 vnet_get_frame_to_sw_interface (vnm, sif_if_index);
511 if (PREDICT_FALSE ((bif->per_thread_info[thread_index].frame[port1]
513 bif->per_thread_info[thread_index].frame[port1] =
514 vnet_get_frame_to_sw_interface (vnm, sif_if_index1);
516 if (PREDICT_FALSE ((bif->per_thread_info[thread_index].frame[port2]
518 bif->per_thread_info[thread_index].frame[port2] =
519 vnet_get_frame_to_sw_interface (vnm, sif_if_index2);
521 if (PREDICT_FALSE ((bif->per_thread_info[thread_index].frame[port3]
523 bif->per_thread_info[thread_index].frame[port3] =
524 vnet_get_frame_to_sw_interface (vnm, sif_if_index3);
526 f = bif->per_thread_info[thread_index].frame[port0];
527 to_next = vlib_frame_vector_args (f);
528 to_next += f->n_vectors;
529 to_next[0] = vlib_get_buffer_index (vm, b[0]);
532 f = bif->per_thread_info[thread_index].frame[port1];
533 to_next = vlib_frame_vector_args (f);
534 to_next += f->n_vectors;
535 to_next[0] = vlib_get_buffer_index (vm, b[1]);
538 f = bif->per_thread_info[thread_index].frame[port2];
539 to_next = vlib_frame_vector_args (f);
540 to_next += f->n_vectors;
541 to_next[0] = vlib_get_buffer_index (vm, b[2]);
544 f = bif->per_thread_info[thread_index].frame[port3];
545 to_next = vlib_frame_vector_args (f);
546 to_next += f->n_vectors;
547 to_next[0] = vlib_get_buffer_index (vm, b[3]);
550 if (PREDICT_FALSE (n_trace > 0))
552 vlib_trace_buffer (vm, node, next0, b[0], 0 /* follow_chain */ );
553 vlib_set_trace_count (vm, node, --n_trace);
554 t0 = vlib_add_trace (vm, node, b[0], sizeof (*t0));
555 eth = (ethernet_header_t *) vlib_buffer_get_current (b[0]);
557 t0->sw_if_index = sw_if_index;
558 t0->bond_sw_if_index = vnet_buffer (b[0])->sw_if_index[VLIB_TX];
560 if (PREDICT_TRUE (n_trace > 0))
562 vlib_trace_buffer (vm, node, next1, b[1],
563 0 /* follow_chain */ );
564 vlib_set_trace_count (vm, node, --n_trace);
565 t0 = vlib_add_trace (vm, node, b[1], sizeof (*t0));
566 eth = (ethernet_header_t *) vlib_buffer_get_current (b[1]);
568 t0->sw_if_index = sw_if_index1;
569 t0->bond_sw_if_index = vnet_buffer (b[1])->sw_if_index[VLIB_TX];
571 if (PREDICT_TRUE (n_trace > 0))
573 vlib_trace_buffer (vm, node, next2, b[2],
574 0 /* follow_chain */ );
575 vlib_set_trace_count (vm, node, --n_trace);
576 t0 = vlib_add_trace (vm, node, b[2], sizeof (*t0));
577 eth = (ethernet_header_t *) vlib_buffer_get_current (b[2]);
579 t0->sw_if_index = sw_if_index2;
580 t0->bond_sw_if_index =
581 vnet_buffer (b[2])->sw_if_index[VLIB_TX];
583 if (PREDICT_TRUE (n_trace > 0))
585 vlib_trace_buffer (vm, node, next3, b[3],
586 0 /* follow_chain */ );
587 vlib_set_trace_count (vm, node, --n_trace);
588 t0 = vlib_add_trace (vm, node, b[3], sizeof (*t0));
590 (ethernet_header_t *) vlib_buffer_get_current (b[3]);
592 t0->sw_if_index = sw_if_index3;
593 t0->bond_sw_if_index =
594 vnet_buffer (b[3])->sw_if_index[VLIB_TX];
609 VLIB_BUFFER_TRACE_TRAJECTORY_INIT (b[0]);
611 sw_if_index = vnet_buffer (b[0])->sw_if_index[VLIB_TX];
613 if (PREDICT_TRUE (slave_count > 1))
615 (bond_load_balance_table[bif->lb]).load_balance (vm, node, bif,
617 sif_if_index = *vec_elt_at_index (bif->active_slaves, port0);
618 vnet_buffer (b[0])->sw_if_index[VLIB_TX] = sif_if_index;
620 ((bif->per_thread_info[thread_index].frame[port0] == 0)))
621 bif->per_thread_info[thread_index].frame[port0] =
622 vnet_get_frame_to_sw_interface (vnm, sif_if_index);
623 f = bif->per_thread_info[thread_index].frame[port0];
624 to_next = vlib_frame_vector_args (f);
625 to_next += f->n_vectors;
626 to_next[0] = vlib_get_buffer_index (vm, b[0]);
629 if (PREDICT_FALSE (n_trace > 0))
631 vlib_trace_buffer (vm, node, next0, b[0], 0 /* follow_chain */ );
632 vlib_set_trace_count (vm, node, --n_trace);
633 t0 = vlib_add_trace (vm, node, b[0], sizeof (*t0));
634 eth = (ethernet_header_t *) vlib_buffer_get_current (b[0]);
636 t0->sw_if_index = sw_if_index;
637 t0->bond_sw_if_index = vnet_buffer (b[0])->sw_if_index[VLIB_TX];
645 for (port = 0; port < slave_count; port++)
647 f = bif->per_thread_info[thread_index].frame[port];
651 sw_if_index = *vec_elt_at_index (bif->active_slaves, port);
652 vnet_put_frame_to_sw_interface (vnm, sw_if_index, f);
653 bif->per_thread_info[thread_index].frame[port] = 0;
656 vlib_increment_simple_counter (vnet_main.interface_main.sw_if_counters
657 + VNET_INTERFACE_COUNTER_TX, thread_index,
658 bif->sw_if_index, frame->n_vectors);
660 return frame->n_vectors;
664 bond_active_interface_switch_cb (vnet_main_t * vnm, u32 sw_if_index,
667 bond_main_t *bm = &bond_main;
669 send_ip4_garp (bm->vlib_main, sw_if_index);
670 send_ip6_na (bm->vlib_main, sw_if_index);
672 return (WALK_CONTINUE);
676 bond_process (vlib_main_t * vm, vlib_node_runtime_t * rt, vlib_frame_t * f)
678 vnet_main_t *vnm = vnet_get_main ();
679 uword event_type, *event_data = 0;
686 vlib_process_wait_for_event (vm);
687 event_type = vlib_process_get_events (vm, &event_data);
688 ASSERT (event_type == BOND_SEND_GARP_NA);
689 for (i = 0; i < vec_len (event_data); i++)
691 hw_if_index = event_data[i];
692 /* walk hw interface to process all subinterfaces */
693 vnet_hw_interface_walk_sw (vnm, hw_if_index,
694 bond_active_interface_switch_cb, 0);
696 vec_reset_length (event_data);
702 VLIB_REGISTER_NODE (bond_process_node) = {
703 .function = bond_process,
704 .type = VLIB_NODE_TYPE_PROCESS,
705 .name = "bond-process",
710 VNET_DEVICE_CLASS (bond_dev_class) = {
712 .tx_function_n_errors = BOND_TX_N_ERROR,
713 .tx_function_error_strings = bond_tx_error_strings,
714 .format_device_name = format_bond_interface_name,
715 .set_l2_mode_function = bond_set_l2_mode_function,
716 .admin_up_down_function = bond_interface_admin_up_down,
717 .subif_add_del_function = bond_subif_add_del_function,
718 .format_tx_trace = format_bond_tx_trace,
724 * fd.io coding-style-patch-verification: ON
727 * eval: (c-set-style "gnu")