Skip to content

Commit ce572a5

Browse files
sylwesterdziedziuchanguy11
authored andcommitted
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: ed4c068 ("ice: Enable ip link show on the PF to display VF unicast MAC(s)") Signed-off-by: Sylwester Dziedziuch <[email protected]> Tested-by: Tony Brelinski <[email protected]> Signed-off-by: Tony Nguyen <[email protected]>
1 parent 0299fae commit ce572a5

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

drivers/net/ethernet/intel/ice/ice_virtchnl_pf.c

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3806,6 +3806,7 @@ ice_vc_add_mac_addr(struct ice_vf *vf, struct ice_vsi *vsi,
38063806
struct device *dev = ice_pf_to_dev(vf->pf);
38073807
u8 *mac_addr = vc_ether_addr->addr;
38083808
enum ice_status status;
3809+
int ret = 0;
38093810

38103811
/* device MAC already added */
38113812
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,
38183819

38193820
status = ice_fltr_add_mac(vsi, mac_addr, ICE_FWD_TO_VSI);
38203821
if (status == ICE_ERR_ALREADY_EXISTS) {
3821-
dev_err(dev, "MAC %pM already exists for VF %d\n", mac_addr,
3822+
dev_dbg(dev, "MAC %pM already exists for VF %d\n", mac_addr,
38223823
vf->vf_id);
3823-
return -EEXIST;
3824+
/* don't return since we might need to update
3825+
* the primary MAC in ice_vfhw_mac_add() below
3826+
*/
3827+
ret = -EEXIST;
38243828
} else if (status) {
38253829
dev_err(dev, "Failed to add MAC %pM for VF %d\n, error %s\n",
38263830
mac_addr, vf->vf_id, ice_stat_str(status));
38273831
return -EIO;
3832+
} else {
3833+
vf->num_mac++;
38283834
}
38293835

38303836
ice_vfhw_mac_add(vf, vc_ether_addr);
38313837

3832-
vf->num_mac++;
3833-
3834-
return 0;
3838+
return ret;
38353839
}
38363840

38373841
/**

0 commit comments

Comments
 (0)