aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCindy Lu <lulu@redhat.com>2026-01-26 17:45:38 +0800
committerMichael S. Tsirkin <mst@redhat.com>2026-02-04 14:13:43 -0500
commit503ef41e88080fb2d2399173e34d26e59567fb5e (patch)
treee3c4c53ddcd47288e80b492d2ebf045682277073
parent2f61e6eda7a793bca4df6efea95815375e122f3a (diff)
vdpa/mlx5: update MAC address handling in mlx5_vdpa_set_attr()
Improve MAC address handling in mlx5_vdpa_set_attr() to ensure that old MAC entries are properly removed from the MPFS table before adding a new one. The new MAC address is then added to both the MPFS and VLAN tables. This change fixes an issue where the updated MAC address would not take effect until QEMU was rebooted. Signed-off-by: Cindy Lu <lulu@redhat.com> Reviewed-by: Dragos Tatulea <dtatulea@nvidia.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com> Message-Id: <20260126094848.9601-4-lulu@redhat.com>
-rw-r--r--drivers/vdpa/mlx5/net/mlx5_vnet.c9
1 files changed, 3 insertions, 6 deletions
diff --git a/drivers/vdpa/mlx5/net/mlx5_vnet.c b/drivers/vdpa/mlx5/net/mlx5_vnet.c
index b7974f451e62..b7e46338815f 100644
--- a/drivers/vdpa/mlx5/net/mlx5_vnet.c
+++ b/drivers/vdpa/mlx5/net/mlx5_vnet.c
@@ -4052,17 +4052,15 @@ static void mlx5_vdpa_dev_del(struct vdpa_mgmt_dev *v_mdev, struct vdpa_device *
static int mlx5_vdpa_set_attr(struct vdpa_mgmt_dev *v_mdev, struct vdpa_device *dev,
const struct vdpa_dev_set_config *add_config)
{
- struct virtio_net_config *config;
struct mlx5_core_dev *pfmdev;
struct mlx5_vdpa_dev *mvdev;
struct mlx5_vdpa_net *ndev;
struct mlx5_core_dev *mdev;
- int err = 0;
+ int err = -EOPNOTSUPP;
mvdev = to_mvdev(dev);
ndev = to_mlx5_vdpa_ndev(mvdev);
mdev = mvdev->mdev;
- config = &ndev->config;
down_write(&ndev->reslock);
@@ -4075,9 +4073,8 @@ static int mlx5_vdpa_set_attr(struct vdpa_mgmt_dev *v_mdev, struct vdpa_device *
goto out;
}
pfmdev = pci_get_drvdata(pci_physfn(mdev->pdev));
- err = mlx5_mpfs_add_mac(pfmdev, config->mac);
- if (!err)
- ether_addr_copy(config->mac, add_config->net.mac);
+ err = mlx5_vdpa_change_mac(ndev, pfmdev,
+ (u8 *)add_config->net.mac);
}
out: