X-Git-Url: https://gerrit.fd.io/r/gitweb?a=blobdiff_plain;f=src%2Fvnet%2Fbonding%2Fdevice.c;h=550321b3763acdaaeeea89e974b63d94f33d7891;hb=cbe25aab3be72154f2c706c39eeba6a77f34450f;hp=21bbcb51f1dd1472d9d9cc7665ca298b41de1edc;hpb=de0302cabf2d67bc045e843d2d01216bf7252cf0;p=vpp.git diff --git a/src/vnet/bonding/device.c b/src/vnet/bonding/device.c index 21bbcb51f1d..550321b3763 100644 --- a/src/vnet/bonding/device.c +++ b/src/vnet/bonding/device.c @@ -24,7 +24,7 @@ #include #include #include -#include +#include #define foreach_bond_tx_error \ _(NONE, "no error") \ @@ -142,6 +142,50 @@ bond_interface_admin_up_down (vnet_main_t * vnm, u32 hw_if_index, u32 flags) 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) { @@ -755,8 +799,7 @@ bond_active_interface_switch_cb (vnet_main_t * vnm, u32 sw_if_index, { 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); } @@ -807,6 +850,7 @@ VNET_DEVICE_CLASS (bond_dev_class) = { .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* */