Commit ce572a5b authored by Sylwester Dziedziuch's avatar Sylwester Dziedziuch Committed by Tony Nguyen

ice: Fix replacing VF hardware MAC to existing MAC filter

VF was not able to change its hardware MAC address in case
the new address was already present in the MAC filter list.
Change the handling of VF add mac request to not return
if requested MAC address is already present on the list
and check if its hardware MAC needs to be updated in this case.

Fixes: ed4c068d ("ice: Enable ip link show on the PF to display VF unicast MAC(s)")
Signed-off-by: default avatarSylwester Dziedziuch <sylwesterx.dziedziuch@intel.com>
Tested-by: default avatarTony Brelinski <tony.brelinski@intel.com>
Signed-off-by: default avatarTony Nguyen <anthony.l.nguyen@intel.com>
parent 0299faea
...@@ -3806,6 +3806,7 @@ ice_vc_add_mac_addr(struct ice_vf *vf, struct ice_vsi *vsi, ...@@ -3806,6 +3806,7 @@ ice_vc_add_mac_addr(struct ice_vf *vf, struct ice_vsi *vsi,
struct device *dev = ice_pf_to_dev(vf->pf); struct device *dev = ice_pf_to_dev(vf->pf);
u8 *mac_addr = vc_ether_addr->addr; u8 *mac_addr = vc_ether_addr->addr;
enum ice_status status; enum ice_status status;
int ret = 0;
/* device MAC already added */ /* device MAC already added */
if (ether_addr_equal(mac_addr, vf->dev_lan_addr.addr)) if (ether_addr_equal(mac_addr, vf->dev_lan_addr.addr))
...@@ -3818,20 +3819,23 @@ ice_vc_add_mac_addr(struct ice_vf *vf, struct ice_vsi *vsi, ...@@ -3818,20 +3819,23 @@ ice_vc_add_mac_addr(struct ice_vf *vf, struct ice_vsi *vsi,
status = ice_fltr_add_mac(vsi, mac_addr, ICE_FWD_TO_VSI); status = ice_fltr_add_mac(vsi, mac_addr, ICE_FWD_TO_VSI);
if (status == ICE_ERR_ALREADY_EXISTS) { if (status == ICE_ERR_ALREADY_EXISTS) {
dev_err(dev, "MAC %pM already exists for VF %d\n", mac_addr, dev_dbg(dev, "MAC %pM already exists for VF %d\n", mac_addr,
vf->vf_id); vf->vf_id);
return -EEXIST; /* don't return since we might need to update
* the primary MAC in ice_vfhw_mac_add() below
*/
ret = -EEXIST;
} else if (status) { } else if (status) {
dev_err(dev, "Failed to add MAC %pM for VF %d\n, error %s\n", dev_err(dev, "Failed to add MAC %pM for VF %d\n, error %s\n",
mac_addr, vf->vf_id, ice_stat_str(status)); mac_addr, vf->vf_id, ice_stat_str(status));
return -EIO; return -EIO;
} else {
vf->num_mac++;
} }
ice_vfhw_mac_add(vf, vc_ether_addr); ice_vfhw_mac_add(vf, vc_ether_addr);
vf->num_mac++; return ret;
return 0;
} }
/** /**
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment