Skip to content

Commit 1e8dac7

Browse files
dtatuleamstsirkin
authored andcommitted
vdpa/mlx5: Start off rqt_size with max VQPs
Currently rqt_size is initialized during device flag configuration. That's because it is the earliest moment when device knows if MQ (multi queue) is on or off. Shift this configuration earlier to device creation time. This implies that non-MQ devices will have a larger RQT size. But the configuration will still be correct. This is done in preparation for the pre-creation of hardware virtqueues at device add time. When that change will be added, RQT will be created at device creation time so it needs to be initialized to its max size. Reviewed-by: Cosmin Ratiu <[email protected]> Acked-by: Eugenio Pérez <[email protected]> Signed-off-by: Dragos Tatulea <[email protected]> Message-Id: <[email protected]> Signed-off-by: Michael S. Tsirkin <[email protected]>
1 parent ad9758f commit 1e8dac7

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

drivers/vdpa/mlx5/net/mlx5_vnet.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2731,10 +2731,6 @@ static int mlx5_vdpa_set_driver_features(struct vdpa_device *vdev, u64 features)
27312731
return err;
27322732

27332733
ndev->mvdev.actual_features = features & ndev->mvdev.mlx_features;
2734-
if (ndev->mvdev.actual_features & BIT_ULL(VIRTIO_NET_F_MQ))
2735-
ndev->rqt_size = mlx5vdpa16_to_cpu(mvdev, ndev->config.max_virtqueue_pairs);
2736-
else
2737-
ndev->rqt_size = 1;
27382734

27392735
/* Interested in changes of vq features only. */
27402736
if (get_features(old_features) != get_features(mvdev->actual_features)) {
@@ -3718,8 +3714,12 @@ static int mlx5_vdpa_dev_add(struct vdpa_mgmt_dev *v_mdev, const char *name,
37183714
goto err_alloc;
37193715
}
37203716

3721-
if (device_features & BIT_ULL(VIRTIO_NET_F_MQ))
3717+
if (device_features & BIT_ULL(VIRTIO_NET_F_MQ)) {
37223718
config->max_virtqueue_pairs = cpu_to_mlx5vdpa16(mvdev, max_vqs / 2);
3719+
ndev->rqt_size = max_vqs / 2;
3720+
} else {
3721+
ndev->rqt_size = 1;
3722+
}
37233723

37243724
ndev->mvdev.mlx_features = device_features;
37253725
mvdev->vdev.dma_dev = &mdev->pdev->dev;

0 commit comments

Comments
 (0)