Skip to content

Commit 480b3e7

Browse files
Steve Sistaremstsirkin
authored andcommitted
vdpa/mlx5: preserve CVQ vringh index
mlx5_vdpa does not preserve userland's view of vring base for the control queue in the following sequence: ioctl VHOST_SET_VRING_BASE ioctl VHOST_VDPA_SET_STATUS VIRTIO_CONFIG_S_DRIVER_OK mlx5_vdpa_set_status() setup_cvq_vring() vringh_init_iotlb() vringh_init_kern() vrh->last_avail_idx = 0; ioctl VHOST_GET_VRING_BASE To fix, restore the value of cvq->vring.last_avail_idx after calling vringh_init_iotlb. Fixes: 5262912 ("vdpa/mlx5: Add support for control VQ and MAC setting") Signed-off-by: Steve Sistare <steven.sistare@oracle.com> Acked-by: Eugenio Pérez <eperezma@redhat.com> Acked-by: Jason Wang <jasowang@redhat.com> Message-Id: <1699014387-194368-1-git-send-email-steven.sistare@oracle.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
1 parent 2cc14f5 commit 480b3e7

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

drivers/vdpa/mlx5/net/mlx5_vnet.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2815,13 +2815,18 @@ static int setup_cvq_vring(struct mlx5_vdpa_dev *mvdev)
28152815
struct mlx5_control_vq *cvq = &mvdev->cvq;
28162816
int err = 0;
28172817

2818-
if (mvdev->actual_features & BIT_ULL(VIRTIO_NET_F_CTRL_VQ))
2818+
if (mvdev->actual_features & BIT_ULL(VIRTIO_NET_F_CTRL_VQ)) {
2819+
u16 idx = cvq->vring.last_avail_idx;
2820+
28192821
err = vringh_init_iotlb(&cvq->vring, mvdev->actual_features,
28202822
MLX5_CVQ_MAX_ENT, false,
28212823
(struct vring_desc *)(uintptr_t)cvq->desc_addr,
28222824
(struct vring_avail *)(uintptr_t)cvq->driver_addr,
28232825
(struct vring_used *)(uintptr_t)cvq->device_addr);
28242826

2827+
if (!err)
2828+
cvq->vring.last_avail_idx = cvq->vring.last_used_idx = idx;
2829+
}
28252830
return err;
28262831
}
28272832

0 commit comments

Comments
 (0)