I have download the driver 4.1.1.1. The code is a little different, but the logic is the same. When Guest OS change the MAC of a NIC, a message is sent from VF, and the message handler calls function ixgbe_set_vf_mac_addr(), which always denies MAC modification. Look at the following code in driver 4.1.1.1
staticint ixgbe_set_vf_mac_addr(struct ixgbe_adapter *adapter, u32 *msgbuf, u32 vf)
{
u8 *new_mac = ((u8 *)(&msgbuf[1]));
if (!is_valid_ether_addr(new_mac)) {
e_warn(drv, "VF %d attempted to set invalid mac\n", vf);
return -1;
}
if (memcmp(adapter->vfinfo[vf].vf_mac_addresses, new_mac, ETH_ALEN)) {
u8 *pm = adapter->vfinfo[vf].vf_mac_addresses;
e_warn(drv,
"VF %d attempted to set a new MAC address but it already has an administratively set MAC address %2.2X:%2.2X:%2.2X:%2.2X:%2.2X:%2.2X\n",
vf, pm[0], pm[1], pm[2], pm[3], pm[4], pm[5]);
e_warn(drv, "Check the VF driver and if it is not using the correct MAC address you may need to reload the VF driver\n");
return -1;
}
ixgbe_passthru_config(adapter, vf, VMK_CFG_MAC_CHANGED,
(void*)new_mac);
return0;
}