Skip to content

Commit 6c8ad1b

Browse files
Shannon NelsonJeff Kirsher
authored andcommitted
i40e: allow user to set LAA again
Don't short-circuit the LAA assignment when the driver thinks it has already been done - it is possible that the user might want to force the address setting again. At the same time, this requires a little re-ordering of the filter management. Change-ID: Ia0d71e3bc04edd7b68cf67edecc00abe7b9f6639 Signed-off-by: Shannon Nelson <[email protected]> Signed-off-by: Jeff Kirsher <[email protected]>
1 parent cc41222 commit 6c8ad1b

File tree

1 file changed

+16
-15
lines changed

1 file changed

+16
-15
lines changed

drivers/net/ethernet/intel/i40e/i40e_main.c

Lines changed: 16 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1327,9 +1327,6 @@ static int i40e_set_mac(struct net_device *netdev, void *p)
13271327

13281328
netdev_info(netdev, "set mac address=%pM\n", addr->sa_data);
13291329

1330-
if (ether_addr_equal(netdev->dev_addr, addr->sa_data))
1331-
return 0;
1332-
13331330
if (test_bit(__I40E_DOWN, &vsi->back->state) ||
13341331
test_bit(__I40E_RESET_RECOVERY_PENDING, &vsi->back->state))
13351332
return -EADDRNOTAVAIL;
@@ -1345,22 +1342,26 @@ static int i40e_set_mac(struct net_device *netdev, void *p)
13451342
ret);
13461343
return -EADDRNOTAVAIL;
13471344
}
1348-
1349-
ether_addr_copy(vsi->back->hw.mac.addr, addr->sa_data);
13501345
}
13511346

1352-
/* In order to be sure to not drop any packets, add the new address
1353-
* then delete the old one.
1354-
*/
1355-
f = i40e_add_filter(vsi, addr->sa_data, I40E_VLAN_ANY, false, false);
1356-
if (!f)
1357-
return -ENOMEM;
1347+
if (!i40e_find_mac(vsi, addr->sa_data, false, true)) {
13581348

1359-
i40e_sync_vsi_filters(vsi);
1360-
i40e_del_filter(vsi, netdev->dev_addr, I40E_VLAN_ANY, false, false);
1361-
i40e_sync_vsi_filters(vsi);
1349+
/* In order to be sure to not drop any packets, add the
1350+
* new address first then delete the old one.
1351+
*/
1352+
f = i40e_add_filter(vsi, addr->sa_data, I40E_VLAN_ANY,
1353+
false, false);
1354+
if (!f)
1355+
return -ENOMEM;
1356+
1357+
i40e_sync_vsi_filters(vsi);
1358+
i40e_del_filter(vsi, netdev->dev_addr, I40E_VLAN_ANY,
1359+
false, false);
1360+
i40e_sync_vsi_filters(vsi);
1361+
}
13621362

1363-
ether_addr_copy(netdev->dev_addr, addr->sa_data);
1363+
if (!ether_addr_equal(netdev->dev_addr, addr->sa_data))
1364+
ether_addr_copy(netdev->dev_addr, addr->sa_data);
13641365

13651366
return 0;
13661367
}

0 commit comments

Comments
 (0)