#include <vnet/bonding/node.h>
#include <vppinfra/lb_hash_hash.h>
#include <vnet/ip/ip.h>
-#include <vnet/ethernet/arp_packet.h>
+#include <vnet/ip-neighbor/ip_neighbor.h>
#define foreach_bond_tx_error \
_(NONE, "no error") \
return 0;
}
+static clib_error_t *
+bond_add_del_mac_address (vnet_hw_interface_t * hi, const u8 * address,
+ u8 is_add)
+{
+ vnet_main_t *vnm = vnet_get_main ();
+ bond_if_t *bif;
+ clib_error_t *error = 0;
+ vnet_hw_interface_t *s_hi;
+ int i;
+
+
+ bif = bond_get_master_by_sw_if_index (hi->sw_if_index);
+ if (!bif)
+ {
+ return clib_error_return (0, "No bond master found for sw_if_index %u",
+ hi->sw_if_index);
+ }
+
+ /* Add/del address on each slave hw intf, they control the hardware */
+ vec_foreach_index (i, bif->slaves)
+ {
+ s_hi = vnet_get_sup_hw_interface (vnm, vec_elt (bif->slaves, i));
+ error = vnet_hw_interface_add_del_mac_address (vnm, s_hi->hw_if_index,
+ address, is_add);
+
+ if (error)
+ {
+ int j;
+
+ /* undo any that were completed before the failure */
+ for (j = i - 1; j > -1; j--)
+ {
+ s_hi = vnet_get_sup_hw_interface (vnm, vec_elt (bif->slaves, j));
+ vnet_hw_interface_add_del_mac_address (vnm, s_hi->hw_if_index,
+ address, !(is_add));
+ }
+
+ return error;
+ }
+ }
+
+ return 0;
+}
+
static_always_inline void
bond_tx_add_to_queue (bond_per_thread_data_t * ptd, u32 port, u32 bi)
{
n_left -= 1;
b += 1;
+ h += 1;
}
}
goto done;
}
+ /* if have at least one slave on local numa node, only slaves on local numa
+ node will transmit pkts when bif->local_numa_only is enabled */
+ if (bif->n_numa_slaves >= 1)
+ n_slaves = bif->n_numa_slaves;
+
if (bif->lb == BOND_LB_L2)
bond_tx_inline (vm, bif, bufs, hashes, n_left, n_slaves, BOND_LB_L2);
else if (bif->lb == BOND_LB_L34)
ptd->per_port_queue[p].n_buffers = 0;
}
}
-
- vlib_increment_simple_counter (vnet_main.interface_main.sw_if_counters
- + VNET_INTERFACE_COUNTER_TX, thread_index,
- bif->sw_if_index, frame->n_vectors);
-
return frame->n_vectors;
}
{
bond_main_t *bm = &bond_main;
- send_ip4_garp (bm->vlib_main, sw_if_index);
- send_ip6_na (bm->vlib_main, sw_if_index);
+ ip_neighbor_advertise (bm->vlib_main, IP46_TYPE_BOTH, NULL, sw_if_index);
return (WALK_CONTINUE);
}
for (i = 0; i < vec_len (event_data); i++)
{
hw_if_index = event_data[i];
- /* walk hw interface to process all subinterfaces */
- vnet_hw_interface_walk_sw (vnm, hw_if_index,
- bond_active_interface_switch_cb, 0);
+ if (vnet_get_hw_interface_or_null (vnm, hw_if_index))
+ /* walk hw interface to process all subinterfaces */
+ vnet_hw_interface_walk_sw (vnm, hw_if_index,
+ bond_active_interface_switch_cb, 0);
}
vec_reset_length (event_data);
}
/* *INDENT-OFF* */
VLIB_REGISTER_NODE (bond_process_node) = {
.function = bond_process,
+ .flags = VLIB_NODE_FLAG_TRACE_SUPPORTED,
.type = VLIB_NODE_TYPE_PROCESS,
.name = "bond-process",
};
.admin_up_down_function = bond_interface_admin_up_down,
.subif_add_del_function = bond_subif_add_del_function,
.format_tx_trace = format_bond_tx_trace,
+ .mac_addr_add_del_function = bond_add_del_mac_address,
};
/* *INDENT-ON* */
+static clib_error_t *
+bond_slave_interface_add_del (vnet_main_t * vnm, u32 sw_if_index, u32 is_add)
+{
+ bond_main_t *bm = &bond_main;
+ slave_if_t *sif;
+ bond_detach_slave_args_t args = { 0 };
+
+ if (is_add)
+ return 0;
+ sif = bond_get_slave_by_sw_if_index (sw_if_index);
+ if (!sif)
+ return 0;
+ args.slave = sw_if_index;
+ bond_detach_slave (bm->vlib_main, &args);
+ return args.error;
+}
+
+VNET_SW_INTERFACE_ADD_DEL_FUNCTION (bond_slave_interface_add_del);
+
/*
* fd.io coding-style-patch-verification: ON
*