Skip to content

Commit cbcb3cf

Browse files
mohammadheibkuba-moo
authored andcommitted
ionic: fix persistent MAC address override on PF
The use of IONIC_CMD_LIF_SETATTR in the MAC address update path causes the ionic firmware to update the LIF's identity in its persistent state. Since the firmware state is maintained across host warm boots and driver reloads, any MAC change on the Physical Function (PF) becomes "sticky. This is problematic because it causes ethtool -P to report the user-configured MAC as the permanent factory address, which breaks system management tools that rely on a stable hardware identity. While Virtual Functions (VFs) need this hardware-level programming to properly handle MAC assignments in guest environments, the PF should maintain standard transient behavior. This patch gates the ionic_program_mac call using is_virtfn so that PF MAC changes remain local to the netdev filters and do not overwrite the firmware's permanent identity block. Fixes: 19058be ("ionic: VF initial random MAC address if no assigned mac") Signed-off-by: Mohammad Heib <[email protected]> Reviewed-by: Simon Horman <[email protected]> Reviewed-by: Brett Creeley <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Jakub Kicinski <[email protected]>
1 parent a1d9d8e commit cbcb3cf

1 file changed

Lines changed: 11 additions & 6 deletions

File tree

drivers/net/ethernet/pensando/ionic/ionic_lif.c

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1719,13 +1719,18 @@ static int ionic_set_mac_address(struct net_device *netdev, void *sa)
17191719
if (ether_addr_equal(netdev->dev_addr, mac))
17201720
return 0;
17211721

1722-
err = ionic_program_mac(lif, mac);
1723-
if (err < 0)
1724-
return err;
1722+
/* Only program macs for virtual functions to avoid losing the permanent
1723+
* Mac across warm reset/reboot.
1724+
*/
1725+
if (lif->ionic->pdev->is_virtfn) {
1726+
err = ionic_program_mac(lif, mac);
1727+
if (err < 0)
1728+
return err;
17251729

1726-
if (err > 0)
1727-
netdev_dbg(netdev, "%s: SET and GET ATTR Mac are not equal-due to old FW running\n",
1728-
__func__);
1730+
if (err > 0)
1731+
netdev_dbg(netdev, "%s: SET and GET ATTR Mac are not equal-due to old FW running\n",
1732+
__func__);
1733+
}
17291734

17301735
err = eth_prepare_mac_addr_change(netdev, addr);
17311736
if (err)

0 commit comments

Comments
 (0)