Skip to content

Commit 5c8e3c7

Browse files
refactormananguy11
authored andcommitted
ice: Fix VSIs unable to share unicast MAC
The driver currently does not allow two VSIs in the same PF domain to have the same unicast MAC address. This is incorrect in the sense that a policy decision is being made in the driver when it must be left to the user. This approach was causing issues when rebooting the system with VFs spawned not being able to change their MAC addresses. Such errors were present in dmesg: [ 7921.068237] ice 0000:b6:00.2 ens2f2: Unicast MAC 6a:0d:e4:70:ca:d1 already exists on this PF. Preventing setting VF 7 unicast MAC address to 6a:0d:e4:70:ca:d1 Fix that by removing this restriction. Doing this also allows us to remove some additional code that's checking if a unicast MAC filter already exists. Fixes: 47ebc7b ("ice: Check if unicast MAC exists before setting VF MAC") Signed-off-by: Anirudh Venkataramanan <[email protected]> Signed-off-by: Sylwester Dziedziuch <[email protected]> Signed-off-by: Mateusz Palczewski <[email protected]> Signed-off-by: Jedrzej Jagielski <[email protected]> Tested-by: Marek Szlosek <[email protected]> Signed-off-by: Tony Nguyen <[email protected]>
1 parent 01658ae commit 5c8e3c7

File tree

2 files changed

+2
-40
lines changed

2 files changed

+2
-40
lines changed

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4656,6 +4656,8 @@ ice_probe(struct pci_dev *pdev, const struct pci_device_id __always_unused *ent)
46564656
ice_set_safe_mode_caps(hw);
46574657
}
46584658

4659+
hw->ucast_shared = true;
4660+
46594661
err = ice_init_pf(pf);
46604662
if (err) {
46614663
dev_err(dev, "ice_init_pf failed: %d\n", err);

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

Lines changed: 0 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -1309,39 +1309,6 @@ ice_get_vf_cfg(struct net_device *netdev, int vf_id, struct ifla_vf_info *ivi)
13091309
return ret;
13101310
}
13111311

1312-
/**
1313-
* ice_unicast_mac_exists - check if the unicast MAC exists on the PF's switch
1314-
* @pf: PF used to reference the switch's rules
1315-
* @umac: unicast MAC to compare against existing switch rules
1316-
*
1317-
* Return true on the first/any match, else return false
1318-
*/
1319-
static bool ice_unicast_mac_exists(struct ice_pf *pf, u8 *umac)
1320-
{
1321-
struct ice_sw_recipe *mac_recipe_list =
1322-
&pf->hw.switch_info->recp_list[ICE_SW_LKUP_MAC];
1323-
struct ice_fltr_mgmt_list_entry *list_itr;
1324-
struct list_head *rule_head;
1325-
struct mutex *rule_lock; /* protect MAC filter list access */
1326-
1327-
rule_head = &mac_recipe_list->filt_rules;
1328-
rule_lock = &mac_recipe_list->filt_rule_lock;
1329-
1330-
mutex_lock(rule_lock);
1331-
list_for_each_entry(list_itr, rule_head, list_entry) {
1332-
u8 *existing_mac = &list_itr->fltr_info.l_data.mac.mac_addr[0];
1333-
1334-
if (ether_addr_equal(existing_mac, umac)) {
1335-
mutex_unlock(rule_lock);
1336-
return true;
1337-
}
1338-
}
1339-
1340-
mutex_unlock(rule_lock);
1341-
1342-
return false;
1343-
}
1344-
13451312
/**
13461313
* ice_set_vf_mac
13471314
* @netdev: network interface device structure
@@ -1376,13 +1343,6 @@ int ice_set_vf_mac(struct net_device *netdev, int vf_id, u8 *mac)
13761343
if (ret)
13771344
goto out_put_vf;
13781345

1379-
if (ice_unicast_mac_exists(pf, mac)) {
1380-
netdev_err(netdev, "Unicast MAC %pM already exists on this PF. Preventing setting VF %u unicast MAC address to %pM\n",
1381-
mac, vf_id, mac);
1382-
ret = -EINVAL;
1383-
goto out_put_vf;
1384-
}
1385-
13861346
mutex_lock(&vf->cfg_lock);
13871347

13881348
/* VF is notified of its new MAC via the PF's response to the

0 commit comments

Comments
 (0)