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>
27 #define foreach_bond_tx_error \
29 _(IF_DOWN, "interface down") \
30 _(NO_SLAVE, "no slave")
34 #define _(f,s) BOND_TX_ERROR_##f,
40 static char *bond_tx_error_strings[] = {
47 format_bond_tx_trace (u8 * s, va_list * args)
49 CLIB_UNUSED (vlib_main_t * vm) = va_arg (*args, vlib_main_t *);
50 CLIB_UNUSED (vlib_node_t * node) = va_arg (*args, vlib_node_t *);
51 bond_packet_trace_t *t = va_arg (*args, bond_packet_trace_t *);
52 vnet_hw_interface_t *hw, *hw1;
53 vnet_main_t *vnm = vnet_get_main ();
55 hw = vnet_get_sup_hw_interface (vnm, t->sw_if_index);
56 hw1 = vnet_get_sup_hw_interface (vnm, t->bond_sw_if_index);
57 s = format (s, "src %U, dst %U, %s -> %s",
58 format_ethernet_address, t->ethernet.src_address,
59 format_ethernet_address, t->ethernet.dst_address,
66 format_bond_interface_name (u8 * s, va_list * args)
68 u32 dev_instance = va_arg (*args, u32);
69 bond_main_t *bm = &bond_main;
70 bond_if_t *bif = pool_elt_at_index (bm->interfaces, dev_instance);
72 s = format (s, "BondEthernet%lu", bif->dev_instance);
77 static __clib_unused clib_error_t *
78 bond_set_l2_mode_function (vnet_main_t * vnm,
79 struct vnet_hw_interface_t *bif_hw,
84 struct vnet_hw_interface_t *sif_hw;
86 bif = bond_get_master_by_sw_if_index (bif_hw->sw_if_index);
90 if ((bif_hw->l2_if_count == 1) && (l2_if_adjust == 1))
92 /* Just added first L2 interface on this port */
93 vec_foreach (sw_if_index, bif->slaves)
95 sif_hw = vnet_get_sup_hw_interface (vnm, *sw_if_index);
96 ethernet_set_flags (vnm, sif_hw->hw_if_index,
97 ETHERNET_INTERFACE_FLAG_ACCEPT_ALL);
99 /* ensure all packets go to ethernet-input */
100 ethernet_set_rx_redirect (vnm, sif_hw, 1);
107 static __clib_unused clib_error_t *
108 bond_subif_add_del_function (vnet_main_t * vnm, u32 hw_if_index,
109 struct vnet_sw_interface_t *st, int is_add)
111 /* Nothing for now */
115 static clib_error_t *
116 bond_interface_admin_up_down (vnet_main_t * vnm, u32 hw_if_index, u32 flags)
118 vnet_hw_interface_t *hif = vnet_get_hw_interface (vnm, hw_if_index);
119 uword is_up = (flags & VNET_SW_INTERFACE_FLAG_ADMIN_UP) != 0;
120 bond_main_t *bm = &bond_main;
121 bond_if_t *bif = pool_elt_at_index (bm->interfaces, hif->dev_instance);
123 bif->admin_up = is_up;
124 if (is_up && vec_len (bif->active_slaves))
125 vnet_hw_interface_set_flags (vnm, bif->hw_if_index,
126 VNET_HW_INTERFACE_FLAG_LINK_UP);
130 static_always_inline u32
131 bond_load_balance_broadcast (vlib_main_t * vm, vlib_node_runtime_t * node,
132 bond_if_t * bif, vlib_buffer_t * b0,
135 vnet_main_t *vnm = vnet_get_main ();
141 u16 thread_index = vlib_get_thread_index ();
143 for (port = 1; port < slave_count; port++)
145 sw_if_index = *vec_elt_at_index (bif->active_slaves, port);
146 if (bif->per_thread_info[thread_index].frame[port] == 0)
147 bif->per_thread_info[thread_index].frame[port] =
148 vnet_get_frame_to_sw_interface (vnm, sw_if_index);
149 f = bif->per_thread_info[thread_index].frame[port];
150 to_next = vlib_frame_vector_args (f);
151 to_next += f->n_vectors;
152 c0 = vlib_buffer_copy (vm, b0);
153 if (PREDICT_TRUE (c0 != 0))
155 vnet_buffer (c0)->sw_if_index[VLIB_TX] = sw_if_index;
156 to_next[0] = vlib_get_buffer_index (vm, c0);
164 static_always_inline u32
165 bond_load_balance_l2 (vlib_main_t * vm, vlib_node_runtime_t * node,
166 bond_if_t * bif, vlib_buffer_t * b0, uword slave_count)
168 ethernet_header_t *eth = (ethernet_header_t *) vlib_buffer_get_current (b0);
170 u64 *dst = (u64 *) & eth->dst_address[0];
171 u64 a = clib_mem_unaligned (dst, u64);
172 u32 *src = (u32 *) & eth->src_address[2];
173 u32 b = clib_mem_unaligned (src, u32);
175 c = lb_hash_hash_2_tuples (a, b);
177 if (BOND_MODULO_SHORTCUT (slave_count))
178 return (c & (slave_count - 1));
180 return c % slave_count;
183 static_always_inline u16 *
184 bond_locate_ethertype (ethernet_header_t * eth)
187 ethernet_vlan_header_t *vlan;
189 if (!ethernet_frame_is_tagged (clib_net_to_host_u16 (eth->type)))
191 ethertype_p = ð->type;
195 vlan = (void *) (eth + 1);
196 ethertype_p = &vlan->type;
197 if (*ethertype_p == ntohs (ETHERNET_TYPE_VLAN))
200 ethertype_p = &vlan->type;
206 static_always_inline u32
207 bond_load_balance_l23 (vlib_main_t * vm, vlib_node_runtime_t * node,
208 bond_if_t * bif, vlib_buffer_t * b0, uword slave_count)
210 ethernet_header_t *eth = (ethernet_header_t *) vlib_buffer_get_current (b0);
213 u16 ethertype, *ethertype_p;
214 u32 *mac1, *mac2, *mac3;
216 ethertype_p = bond_locate_ethertype (eth);
217 ethertype = clib_mem_unaligned (ethertype_p, u16);
219 if ((ethertype != htons (ETHERNET_TYPE_IP4)) &&
220 (ethertype != htons (ETHERNET_TYPE_IP6)))
221 return (bond_load_balance_l2 (vm, node, bif, b0, slave_count));
223 ip4 = (ip4_header_t *) (ethertype_p + 1);
224 ip_version = (ip4->ip_version_and_header_length >> 4);
226 if (ip_version == 0x4)
230 mac1 = (u32 *) & eth->dst_address[0];
231 mac2 = (u32 *) & eth->dst_address[4];
232 mac3 = (u32 *) & eth->src_address[2];
234 a = clib_mem_unaligned (mac1, u32) ^ clib_mem_unaligned (mac2, u32) ^
235 clib_mem_unaligned (mac3, u32);
237 lb_hash_hash_2_tuples (clib_mem_unaligned (&ip4->address_pair, u64),
239 if (BOND_MODULO_SHORTCUT (slave_count))
240 return (c & (slave_count - 1));
242 return c % slave_count;
244 else if (ip_version == 0x6)
248 ip6_header_t *ip6 = (ip6_header_t *) (eth + 1);
250 mac1 = (u32 *) & eth->dst_address[0];
251 mac2 = (u32 *) & eth->dst_address[4];
252 mac3 = (u32 *) & eth->src_address[2];
254 a = clib_mem_unaligned (mac1, u32) ^ clib_mem_unaligned (mac2, u32) ^
255 clib_mem_unaligned (mac3, u32);
257 lb_hash_hash (clib_mem_unaligned
258 (&ip6->src_address.as_uword[0], uword),
259 clib_mem_unaligned (&ip6->src_address.as_uword[1],
261 clib_mem_unaligned (&ip6->dst_address.as_uword[0],
263 clib_mem_unaligned (&ip6->dst_address.as_uword[1],
265 if (BOND_MODULO_SHORTCUT (slave_count))
266 return (c & (slave_count - 1));
268 return c % slave_count;
270 return (bond_load_balance_l2 (vm, node, bif, b0, slave_count));
273 static_always_inline u32
274 bond_load_balance_l34 (vlib_main_t * vm, vlib_node_runtime_t * node,
275 bond_if_t * bif, vlib_buffer_t * b0, uword slave_count)
277 ethernet_header_t *eth = (ethernet_header_t *) vlib_buffer_get_current (b0);
281 u16 ethertype, *ethertype_p;
283 ethertype_p = bond_locate_ethertype (eth);
284 ethertype = clib_mem_unaligned (ethertype_p, u16);
286 if ((ethertype != htons (ETHERNET_TYPE_IP4)) &&
287 (ethertype != htons (ETHERNET_TYPE_IP6)))
288 return (bond_load_balance_l2 (vm, node, bif, b0, slave_count));
290 ip4 = (ip4_header_t *) (ethertype_p + 1);
291 ip_version = (ip4->ip_version_and_header_length >> 4);
293 if (ip_version == 0x4)
296 tcp_header_t *tcp = (void *) (ip4 + 1);
298 is_tcp_udp = (ip4->protocol == IP_PROTOCOL_TCP) ||
299 (ip4->protocol == IP_PROTOCOL_UDP);
300 t1 = is_tcp_udp ? clib_mem_unaligned (&tcp->src, u16) : 0;
301 t2 = is_tcp_udp ? clib_mem_unaligned (&tcp->dst, u16) : 0;
304 lb_hash_hash_2_tuples (clib_mem_unaligned (&ip4->address_pair, u64),
306 if (BOND_MODULO_SHORTCUT (slave_count))
307 return (c & (slave_count - 1));
309 return c % slave_count;
311 else if (ip_version == 0x6)
315 ip6_header_t *ip6 = (ip6_header_t *) (eth + 1);
316 tcp_header_t *tcp = (void *) (ip6 + 1);
319 if (PREDICT_TRUE ((ip6->protocol == IP_PROTOCOL_TCP) ||
320 (ip6->protocol == IP_PROTOCOL_UDP)))
323 tcp = (void *) (ip6 + 1);
325 else if (ip6->protocol == IP_PROTOCOL_IP6_HOP_BY_HOP_OPTIONS)
327 ip6_hop_by_hop_header_t *hbh =
328 (ip6_hop_by_hop_header_t *) (ip6 + 1);
329 if ((hbh->protocol == IP_PROTOCOL_TCP)
330 || (hbh->protocol == IP_PROTOCOL_UDP))
333 tcp = (tcp_header_t *) ((u8 *) hbh + ((hbh->length + 1) << 3));
336 t1 = is_tcp_udp ? clib_mem_unaligned (&tcp->src, u16) : 0;
337 t2 = is_tcp_udp ? clib_mem_unaligned (&tcp->dst, u16) : 0;
340 lb_hash_hash (clib_mem_unaligned
341 (&ip6->src_address.as_uword[0], uword),
342 clib_mem_unaligned (&ip6->src_address.as_uword[1],
344 clib_mem_unaligned (&ip6->dst_address.as_uword[0],
346 clib_mem_unaligned (&ip6->dst_address.as_uword[1],
348 if (BOND_MODULO_SHORTCUT (slave_count))
349 return (c & (slave_count - 1));
351 return c % slave_count;
354 return (bond_load_balance_l2 (vm, node, bif, b0, slave_count));
357 static_always_inline u32
358 bond_load_balance_round_robin (vlib_main_t * vm,
359 vlib_node_runtime_t * node,
360 bond_if_t * bif, vlib_buffer_t * b0,
363 bif->lb_rr_last_index++;
364 if (BOND_MODULO_SHORTCUT (slave_count))
365 bif->lb_rr_last_index &= slave_count - 1;
367 bif->lb_rr_last_index %= slave_count;
369 return bif->lb_rr_last_index;
372 static_always_inline u32
373 bond_load_balance_active_backup (vlib_main_t * vm,
374 vlib_node_runtime_t * node,
375 bond_if_t * bif, vlib_buffer_t * b0,
378 /* First interface is the active, the rest is backup */
382 static bond_load_balance_func_t bond_load_balance_table[] = {
383 #define _(v,f,s, p) { bond_load_balance_##p },
389 bond_tx_fn (vlib_main_t * vm, vlib_node_runtime_t * node,
390 vlib_frame_t * frame)
392 vnet_interface_output_runtime_t *rund = (void *) node->runtime_data;
393 bond_main_t *bm = &bond_main;
394 bond_if_t *bif = pool_elt_at_index (bm->interfaces, rund->dev_instance);
395 u32 bi0, bi1, bi2, bi3;
396 vlib_buffer_t *b0, *b1, *b2, *b3;
397 u32 *from = vlib_frame_vector_args (frame);
399 ethernet_header_t *eth;
401 u32 sw_if_index, sw_if_index1, sw_if_index2, sw_if_index3;
402 bond_packet_trace_t *t0;
403 uword n_trace = vlib_get_trace_count (vm, node);
404 u16 thread_index = vlib_get_thread_index ();
405 vnet_main_t *vnm = vnet_get_main ();
407 u32 sif_if_index, sif_if_index1, sif_if_index2, sif_if_index3;
411 if (PREDICT_FALSE (bif->admin_up == 0))
413 vlib_buffer_free (vm, vlib_frame_args (frame), frame->n_vectors);
414 vlib_increment_simple_counter (vnet_main.interface_main.sw_if_counters +
415 VNET_INTERFACE_COUNTER_DROP,
416 thread_index, bif->sw_if_index,
418 vlib_error_count (vm, node->node_index, BOND_TX_ERROR_IF_DOWN,
420 return frame->n_vectors;
423 clib_spinlock_lock_if_init (&bif->lockp);
424 slave_count = vec_len (bif->active_slaves);
425 if (PREDICT_FALSE (slave_count == 0))
428 b0 = vlib_get_buffer (vm, bi0);
429 vlib_increment_combined_counter
430 (vnet_main.interface_main.combined_sw_if_counters
431 + VNET_INTERFACE_COUNTER_TX, thread_index, bif->sw_if_index,
432 frame->n_vectors, b0->current_length);
434 vlib_buffer_free (vm, vlib_frame_args (frame), frame->n_vectors);
435 vlib_increment_simple_counter (vnet_main.interface_main.sw_if_counters +
436 VNET_INTERFACE_COUNTER_DROP,
437 thread_index, bif->sw_if_index,
439 vlib_error_count (vm, node->node_index, BOND_TX_ERROR_NO_SLAVE,
441 clib_spinlock_unlock_if_init (&bif->lockp);
442 return frame->n_vectors;
445 vec_validate_aligned (bif->per_thread_info[thread_index].frame, slave_count,
446 CLIB_CACHE_LINE_BYTES);
448 /* Number of buffers / pkts */
449 n_left_from = frame->n_vectors;
451 while (n_left_from > 0)
453 while (n_left_from >= 4)
455 u32 next0 = 0, next1 = 0, next2 = 0, next3 = 0;
456 u32 port0 = 0, port1 = 0, port2 = 0, port3 = 0;
458 // Prefetch next iteration
459 if (n_left_from >= 8)
461 vlib_buffer_t *p4, *p5, *p6, *p7;
463 p4 = vlib_get_buffer (vm, from[4]);
464 p5 = vlib_get_buffer (vm, from[5]);
465 p6 = vlib_get_buffer (vm, from[6]);
466 p7 = vlib_get_buffer (vm, from[7]);
468 vlib_prefetch_buffer_header (p4, LOAD);
469 vlib_prefetch_buffer_header (p5, LOAD);
470 vlib_prefetch_buffer_header (p6, LOAD);
471 vlib_prefetch_buffer_header (p7, LOAD);
473 CLIB_PREFETCH (p4->data, CLIB_CACHE_LINE_BYTES, LOAD);
474 CLIB_PREFETCH (p5->data, CLIB_CACHE_LINE_BYTES, LOAD);
475 CLIB_PREFETCH (p6->data, CLIB_CACHE_LINE_BYTES, LOAD);
476 CLIB_PREFETCH (p7->data, CLIB_CACHE_LINE_BYTES, LOAD);
484 b0 = vlib_get_buffer (vm, bi0);
485 b1 = vlib_get_buffer (vm, bi1);
486 b2 = vlib_get_buffer (vm, bi2);
487 b3 = vlib_get_buffer (vm, bi3);
489 VLIB_BUFFER_TRACE_TRAJECTORY_INIT (b0);
490 VLIB_BUFFER_TRACE_TRAJECTORY_INIT (b1);
491 VLIB_BUFFER_TRACE_TRAJECTORY_INIT (b2);
492 VLIB_BUFFER_TRACE_TRAJECTORY_INIT (b3);
494 sw_if_index = vnet_buffer (b0)->sw_if_index[VLIB_TX];
495 sw_if_index1 = vnet_buffer (b1)->sw_if_index[VLIB_TX];
496 sw_if_index2 = vnet_buffer (b2)->sw_if_index[VLIB_TX];
497 sw_if_index3 = vnet_buffer (b3)->sw_if_index[VLIB_TX];
499 if (PREDICT_TRUE (slave_count != 1))
502 (bond_load_balance_table[bif->lb]).load_balance (vm, node,
506 (bond_load_balance_table[bif->lb]).load_balance (vm, node,
510 (bond_load_balance_table[bif->lb]).load_balance (vm, node,
514 (bond_load_balance_table[bif->lb]).load_balance (vm, node,
519 sif_if_index = *vec_elt_at_index (bif->active_slaves, port0);
520 sif_if_index1 = *vec_elt_at_index (bif->active_slaves, port1);
521 sif_if_index2 = *vec_elt_at_index (bif->active_slaves, port2);
522 sif_if_index3 = *vec_elt_at_index (bif->active_slaves, port3);
524 vnet_buffer (b0)->sw_if_index[VLIB_TX] = sif_if_index;
525 vnet_buffer (b1)->sw_if_index[VLIB_TX] = sif_if_index1;
526 vnet_buffer (b2)->sw_if_index[VLIB_TX] = sif_if_index2;
527 vnet_buffer (b3)->sw_if_index[VLIB_TX] = sif_if_index3;
529 if (PREDICT_FALSE ((bif->per_thread_info[thread_index].frame[port0]
531 bif->per_thread_info[thread_index].frame[port0] =
532 vnet_get_frame_to_sw_interface (vnm, sif_if_index);
534 if (PREDICT_FALSE ((bif->per_thread_info[thread_index].frame[port1]
536 bif->per_thread_info[thread_index].frame[port1] =
537 vnet_get_frame_to_sw_interface (vnm, sif_if_index1);
539 if (PREDICT_FALSE ((bif->per_thread_info[thread_index].frame[port2]
541 bif->per_thread_info[thread_index].frame[port2] =
542 vnet_get_frame_to_sw_interface (vnm, sif_if_index2);
544 if (PREDICT_FALSE ((bif->per_thread_info[thread_index].frame[port3]
546 bif->per_thread_info[thread_index].frame[port3] =
547 vnet_get_frame_to_sw_interface (vnm, sif_if_index3);
549 f = bif->per_thread_info[thread_index].frame[port0];
550 to_next = vlib_frame_vector_args (f);
551 to_next += f->n_vectors;
552 to_next[0] = vlib_get_buffer_index (vm, b0);
555 f = bif->per_thread_info[thread_index].frame[port1];
556 to_next = vlib_frame_vector_args (f);
557 to_next += f->n_vectors;
558 to_next[0] = vlib_get_buffer_index (vm, b1);
561 f = bif->per_thread_info[thread_index].frame[port2];
562 to_next = vlib_frame_vector_args (f);
563 to_next += f->n_vectors;
564 to_next[0] = vlib_get_buffer_index (vm, b2);
567 f = bif->per_thread_info[thread_index].frame[port3];
568 to_next = vlib_frame_vector_args (f);
569 to_next += f->n_vectors;
570 to_next[0] = vlib_get_buffer_index (vm, b3);
573 if (PREDICT_FALSE (n_trace > 0))
575 vlib_trace_buffer (vm, node, next0, b0, 0 /* follow_chain */ );
576 vlib_set_trace_count (vm, node, --n_trace);
577 t0 = vlib_add_trace (vm, node, b0, sizeof (*t0));
578 eth = (ethernet_header_t *) vlib_buffer_get_current (b0);
580 t0->sw_if_index = sw_if_index;
581 t0->bond_sw_if_index = vnet_buffer (b0)->sw_if_index[VLIB_TX];
583 if (PREDICT_TRUE (n_trace > 0))
585 vlib_trace_buffer (vm, node, next1, b1,
586 0 /* follow_chain */ );
587 vlib_set_trace_count (vm, node, --n_trace);
588 t0 = vlib_add_trace (vm, node, b1, sizeof (*t0));
589 eth = (ethernet_header_t *) vlib_buffer_get_current (b1);
591 t0->sw_if_index = sw_if_index1;
592 t0->bond_sw_if_index =
593 vnet_buffer (b1)->sw_if_index[VLIB_TX];
595 if (PREDICT_TRUE (n_trace > 0))
597 vlib_trace_buffer (vm, node, next2, b2,
598 0 /* follow_chain */ );
599 vlib_set_trace_count (vm, node, --n_trace);
600 t0 = vlib_add_trace (vm, node, b2, sizeof (*t0));
602 (ethernet_header_t *) vlib_buffer_get_current (b2);
604 t0->sw_if_index = sw_if_index2;
605 t0->bond_sw_if_index =
606 vnet_buffer (b2)->sw_if_index[VLIB_TX];
608 if (PREDICT_TRUE (n_trace > 0))
610 vlib_trace_buffer (vm, node, next3, b3,
611 0 /* follow_chain */ );
612 vlib_set_trace_count (vm, node, --n_trace);
613 t0 = vlib_add_trace (vm, node, b3, sizeof (*t0));
615 (ethernet_header_t *)
616 vlib_buffer_get_current (b3);
618 t0->sw_if_index = sw_if_index3;
619 t0->bond_sw_if_index =
620 vnet_buffer (b3)->sw_if_index[VLIB_TX];
629 while (n_left_from > 0)
634 // Prefetch next iteration
639 p2 = vlib_get_buffer (vm, from[1]);
640 vlib_prefetch_buffer_header (p2, LOAD);
641 CLIB_PREFETCH (p2->data, CLIB_CACHE_LINE_BYTES, LOAD);
645 b0 = vlib_get_buffer (vm, bi0);
647 VLIB_BUFFER_TRACE_TRAJECTORY_INIT (b0);
649 sw_if_index = vnet_buffer (b0)->sw_if_index[VLIB_TX];
651 if (PREDICT_TRUE (slave_count != 1))
653 (bond_load_balance_table[bif->lb]).load_balance (vm, node, bif,
656 sif_if_index = *vec_elt_at_index (bif->active_slaves, port0);
657 vnet_buffer (b0)->sw_if_index[VLIB_TX] = sif_if_index;
659 ((bif->per_thread_info[thread_index].frame[port0] == 0)))
660 bif->per_thread_info[thread_index].frame[port0] =
661 vnet_get_frame_to_sw_interface (vnm, sif_if_index);
662 f = bif->per_thread_info[thread_index].frame[port0];
663 to_next = vlib_frame_vector_args (f);
664 to_next += f->n_vectors;
665 to_next[0] = vlib_get_buffer_index (vm, b0);
668 if (PREDICT_FALSE (n_trace > 0))
670 vlib_trace_buffer (vm, node, next0, b0, 0 /* follow_chain */ );
671 vlib_set_trace_count (vm, node, --n_trace);
672 t0 = vlib_add_trace (vm, node, b0, sizeof (*t0));
673 eth = (ethernet_header_t *) vlib_buffer_get_current (b0);
675 t0->sw_if_index = sw_if_index;
676 t0->bond_sw_if_index = vnet_buffer (b0)->sw_if_index[VLIB_TX];
684 for (port = 0; port < slave_count; port++)
686 f = bif->per_thread_info[thread_index].frame[port];
690 sw_if_index = *vec_elt_at_index (bif->active_slaves, port);
691 vnet_put_frame_to_sw_interface (vnm, sw_if_index, f);
692 bif->per_thread_info[thread_index].frame[port] = 0;
695 vlib_increment_simple_counter (vnet_main.interface_main.sw_if_counters
696 + VNET_INTERFACE_COUNTER_TX, thread_index,
697 bif->sw_if_index, frame->n_vectors);
699 clib_spinlock_unlock_if_init (&bif->lockp);
700 return frame->n_vectors;
704 VNET_DEVICE_CLASS (bond_dev_class) = {
706 .tx_function = bond_tx_fn,
707 .tx_function_n_errors = BOND_TX_N_ERROR,
708 .tx_function_error_strings = bond_tx_error_strings,
709 .format_device_name = format_bond_interface_name,
710 .set_l2_mode_function = bond_set_l2_mode_function,
711 .admin_up_down_function = bond_interface_admin_up_down,
712 .subif_add_del_function = bond_subif_add_del_function,
713 .format_tx_trace = format_bond_tx_trace,
716 VLIB_DEVICE_TX_FUNCTION_MULTIARCH (bond_dev_class, bond_tx_fn)
720 * fd.io coding-style-patch-verification: ON
723 * eval: (c-set-style "gnu")