Jason Wang
2021-Oct-25 07:05 UTC
[PATCH linux-next v4 6/8] vdpa/mlx5: Fix clearing of VIRTIO_NET_F_MAC feature bit
? 2021/10/22 ??12:35, Parav Pandit ??:> Cited patch in the fixes tag clears the features bit during reset. > mlx5 vdpa device feature bits are static decided by device capabilities.This is not what I read at least from mlx5_vdpa_get_features: static u64 mlx5_vdpa_get_features(struct vdpa_device *vdev) { ??????? struct mlx5_vdpa_dev *mvdev = to_mvdev(vdev); ??????? struct mlx5_vdpa_net *ndev = to_mlx5_vdpa_ndev(mvdev); ??????? u16 dev_features; ??????? dev_features = MLX5_CAP_DEV_VDPA_EMULATION(mvdev->mdev, device_features_bits_mask); ??????? ndev->mvdev.mlx_features |= mlx_to_vritio_features(dev_features); ??????? if (MLX5_CAP_DEV_VDPA_EMULATION(mvdev->mdev, virtio_version_1_0)) ??????????????? ndev->mvdev.mlx_features |= BIT_ULL(VIRTIO_F_VERSION_1); ??????? ndev->mvdev.mlx_features |= BIT_ULL(VIRTIO_F_ACCESS_PLATFORM); ??????? ndev->mvdev.mlx_features |= BIT_ULL(VIRTIO_NET_F_CTRL_VQ); ??????? ndev->mvdev.mlx_features |= BIT_ULL(VIRTIO_NET_F_CTRL_MAC_ADDR); ??????? ndev->mvdev.mlx_features |= BIT_ULL(VIRTIO_NET_F_MQ); ??????? print_features(mvdev, ndev->mvdev.mlx_features, false); ??????? return ndev->mvdev.mlx_features; } Thanks> > Clearing features bit cleared the VIRTIO_NET_F_MAC. Due to this MAC address > provided by the device is not honored. > > Fix it by not clearing the static feature bits during reset. > > Fixes: 0686082dbf7a ("vdpa: Add reset callback in vdpa_config_ops") > Signed-off-by: Parav Pandit <parav at nvidia.com> > Reviewed-by: Eli Cohen <elic at nvidia.com> > --- > drivers/vdpa/mlx5/net/mlx5_vnet.c | 1 - > 1 file changed, 1 deletion(-) > > diff --git a/drivers/vdpa/mlx5/net/mlx5_vnet.c b/drivers/vdpa/mlx5/net/mlx5_vnet.c > index ca05f69054b6..0a2b79887085 100644 > --- a/drivers/vdpa/mlx5/net/mlx5_vnet.c > +++ b/drivers/vdpa/mlx5/net/mlx5_vnet.c > @@ -2192,7 +2192,6 @@ static int mlx5_vdpa_reset(struct vdpa_device *vdev) > clear_vqs_ready(ndev); > mlx5_vdpa_destroy_mr(&ndev->mvdev); > ndev->mvdev.status = 0; > - ndev->mvdev.mlx_features = 0; > memset(ndev->event_cbs, 0, sizeof(ndev->event_cbs)); > ndev->mvdev.actual_features = 0; > ++mvdev->generation;
Parav Pandit
2021-Oct-25 07:08 UTC
[PATCH linux-next v4 6/8] vdpa/mlx5: Fix clearing of VIRTIO_NET_F_MAC feature bit
> From: Jason Wang <jasowang at redhat.com> > Sent: Monday, October 25, 2021 12:35 PM > > ? 2021/10/22 ??12:35, Parav Pandit ??: > > Cited patch in the fixes tag clears the features bit during reset. > > mlx5 vdpa device feature bits are static decided by device capabilities. > > > This is not what I read at least from mlx5_vdpa_get_features: > > static u64 mlx5_vdpa_get_features(struct vdpa_device *vdev) { > ??????? struct mlx5_vdpa_dev *mvdev = to_mvdev(vdev); > ??????? struct mlx5_vdpa_net *ndev = to_mlx5_vdpa_ndev(mvdev); > ??????? u16 dev_features; > > ??????? dev_features = MLX5_CAP_DEV_VDPA_EMULATION(mvdev->mdev, > device_features_bits_mask);Not sure I follow. Feature bits are decided by the device capabilities exposed by the MLX5_CAP_DEV_VDPA_EMULATION. Other fields below are pretty much static.> ??????? ndev->mvdev.mlx_features |= mlx_to_vritio_features(dev_features); > ??????? if (MLX5_CAP_DEV_VDPA_EMULATION(mvdev->mdev, > virtio_version_1_0)) > ??????????????? ndev->mvdev.mlx_features |= BIT_ULL(VIRTIO_F_VERSION_1); > ??????? ndev->mvdev.mlx_features |= BIT_ULL(VIRTIO_F_ACCESS_PLATFORM); > ??????? ndev->mvdev.mlx_features |= BIT_ULL(VIRTIO_NET_F_CTRL_VQ); > ??????? ndev->mvdev.mlx_features |> BIT_ULL(VIRTIO_NET_F_CTRL_MAC_ADDR); > ??????? ndev->mvdev.mlx_features |= BIT_ULL(VIRTIO_NET_F_MQ); > > ??????? print_features(mvdev, ndev->mvdev.mlx_features, false); > ??????? return ndev->mvdev.mlx_features; } > > > Thanks > > > > > > Clearing features bit cleared the VIRTIO_NET_F_MAC. Due to this MAC > > address provided by the device is not honored. > > > > Fix it by not clearing the static feature bits during reset. > > > > Fixes: 0686082dbf7a ("vdpa: Add reset callback in vdpa_config_ops") > > Signed-off-by: Parav Pandit <parav at nvidia.com> > > Reviewed-by: Eli Cohen <elic at nvidia.com> > > --- > > drivers/vdpa/mlx5/net/mlx5_vnet.c | 1 - > > 1 file changed, 1 deletion(-) > > > > diff --git a/drivers/vdpa/mlx5/net/mlx5_vnet.c > > b/drivers/vdpa/mlx5/net/mlx5_vnet.c > > index ca05f69054b6..0a2b79887085 100644 > > --- a/drivers/vdpa/mlx5/net/mlx5_vnet.c > > +++ b/drivers/vdpa/mlx5/net/mlx5_vnet.c > > @@ -2192,7 +2192,6 @@ static int mlx5_vdpa_reset(struct vdpa_device > *vdev) > > clear_vqs_ready(ndev); > > mlx5_vdpa_destroy_mr(&ndev->mvdev); > > ndev->mvdev.status = 0; > > - ndev->mvdev.mlx_features = 0; > > memset(ndev->event_cbs, 0, sizeof(ndev->event_cbs)); > > ndev->mvdev.actual_features = 0; > > ++mvdev->generation;