X-Git-Url: https://gerrit.fd.io/r/gitweb?p=vpp.git;a=blobdiff_plain;f=src%2Fvnet%2Finterface.c;h=0b4d78afbdec0c51bd950cfc04fe26fdacb32034;hp=0f6b8aeab07776da4d6205838bccb8411b9359d9;hb=e0792fdff;hpb=6a6af6ea1a77b5818e717047b5d01251ef6d024a diff --git a/src/vnet/interface.c b/src/vnet/interface.c index 0f6b8aeab07..0b4d78afbde 100644 --- a/src/vnet/interface.c +++ b/src/vnet/interface.c @@ -1427,6 +1427,48 @@ vnet_rename_interface (vnet_main_t * vnm, u32 hw_if_index, char *new_name) return error; } +clib_error_t * +vnet_hw_interface_add_del_mac_address (vnet_main_t * vnm, + u32 hw_if_index, + const u8 * mac_address, u8 is_add) +{ + clib_error_t *error = 0; + vnet_hw_interface_t *hi = vnet_get_hw_interface (vnm, hw_if_index); + + vnet_device_class_t *dev_class = + vnet_get_device_class (vnm, hi->dev_class_index); + + if (!hi->hw_address) + { + error = + clib_error_return + (0, "Secondary MAC Addresses not supported for interface index %u", + hw_if_index); + goto done; + } + + if (dev_class->mac_addr_add_del_function) + error = dev_class->mac_addr_add_del_function (hi, mac_address, is_add); + + if (!error) + { + vnet_hw_interface_class_t *hw_class; + + hw_class = vnet_get_hw_interface_class (vnm, hi->hw_class_index); + + if (NULL != hw_class->mac_addr_add_del_function) + error = hw_class->mac_addr_add_del_function (hi, mac_address, is_add); + } + + /* If no errors, add to the list of secondary MACs on the ethernet intf */ + if (!error) + ethernet_interface_add_del_address (ðernet_main, hw_if_index, + mac_address, is_add); + +done: + return error; +} + static clib_error_t * vnet_hw_interface_change_mac_address_helper (vnet_main_t * vnm, u32 hw_if_index,