|
@@ -732,6 +732,21 @@ static int mlx4_en_replace_mac(struct mlx4_en_priv *priv, int qpn,
|
|
|
return __mlx4_replace_mac(dev, priv->port, qpn, new_mac_u64);
|
|
|
}
|
|
|
|
|
|
+static void mlx4_en_update_user_mac(struct mlx4_en_priv *priv,
|
|
|
+ unsigned char new_mac[ETH_ALEN + 2])
|
|
|
+{
|
|
|
+ struct mlx4_en_dev *mdev = priv->mdev;
|
|
|
+ int err;
|
|
|
+
|
|
|
+ if (!(mdev->dev->caps.flags2 & MLX4_DEV_CAP_FLAG2_USER_MAC_EN))
|
|
|
+ return;
|
|
|
+
|
|
|
+ err = mlx4_SET_PORT_user_mac(mdev->dev, priv->port, new_mac);
|
|
|
+ if (err)
|
|
|
+ en_err(priv, "Failed to pass user MAC(%pM) to Firmware for port %d, with error %d\n",
|
|
|
+ new_mac, priv->port, err);
|
|
|
+}
|
|
|
+
|
|
|
static int mlx4_en_do_set_mac(struct mlx4_en_priv *priv,
|
|
|
unsigned char new_mac[ETH_ALEN + 2])
|
|
|
{
|
|
@@ -766,8 +781,12 @@ static int mlx4_en_set_mac(struct net_device *dev, void *addr)
|
|
|
mutex_lock(&mdev->state_lock);
|
|
|
memcpy(new_mac, saddr->sa_data, ETH_ALEN);
|
|
|
err = mlx4_en_do_set_mac(priv, new_mac);
|
|
|
- if (!err)
|
|
|
- memcpy(dev->dev_addr, saddr->sa_data, ETH_ALEN);
|
|
|
+ if (err)
|
|
|
+ goto out;
|
|
|
+
|
|
|
+ memcpy(dev->dev_addr, saddr->sa_data, ETH_ALEN);
|
|
|
+ mlx4_en_update_user_mac(priv, new_mac);
|
|
|
+out:
|
|
|
mutex_unlock(&mdev->state_lock);
|
|
|
|
|
|
return err;
|