Skip to content

Commit 503ef41

Browse files
Cindy Lumstsirkin
authored andcommitted
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>
1 parent 2f61e6e commit 503ef41

1 file changed

Lines changed: 3 additions & 6 deletions

File tree

drivers/vdpa/mlx5/net/mlx5_vnet.c

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4052,17 +4052,15 @@ static void mlx5_vdpa_dev_del(struct vdpa_mgmt_dev *v_mdev, struct vdpa_device *
40524052
static int mlx5_vdpa_set_attr(struct vdpa_mgmt_dev *v_mdev, struct vdpa_device *dev,
40534053
const struct vdpa_dev_set_config *add_config)
40544054
{
4055-
struct virtio_net_config *config;
40564055
struct mlx5_core_dev *pfmdev;
40574056
struct mlx5_vdpa_dev *mvdev;
40584057
struct mlx5_vdpa_net *ndev;
40594058
struct mlx5_core_dev *mdev;
4060-
int err = 0;
4059+
int err = -EOPNOTSUPP;
40614060

40624061
mvdev = to_mvdev(dev);
40634062
ndev = to_mlx5_vdpa_ndev(mvdev);
40644063
mdev = mvdev->mdev;
4065-
config = &ndev->config;
40664064

40674065
down_write(&ndev->reslock);
40684066

@@ -4075,9 +4073,8 @@ static int mlx5_vdpa_set_attr(struct vdpa_mgmt_dev *v_mdev, struct vdpa_device *
40754073
goto out;
40764074
}
40774075
pfmdev = pci_get_drvdata(pci_physfn(mdev->pdev));
4078-
err = mlx5_mpfs_add_mac(pfmdev, config->mac);
4079-
if (!err)
4080-
ether_addr_copy(config->mac, add_config->net.mac);
4076+
err = mlx5_vdpa_change_mac(ndev, pfmdev,
4077+
(u8 *)add_config->net.mac);
40814078
}
40824079

40834080
out:

0 commit comments

Comments
 (0)