Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

vdpa/mlx5: Initialize and reset device with one queue pair

The virtio spec says that a vdpa device should start off with one queue
pair. The driver is already compliant.

This patch moves the initialization to device add and reset times. This
is done in preparation for the pre-creation of hardware virtqueues at
device add time.

Signed-off-by: Dragos Tatulea <dtatulea@nvidia.com>
Reviewed-by: Cosmin Ratiu <cratiu@nvidia.com>
Message-Id: <20240626-stage-vdpa-vq-precreate-v2-7-560c491078df@nvidia.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Acked-by: Eugenio Pérez <eperezma@redhat.com>

authored by

Dragos Tatulea and committed by
Michael S. Tsirkin
1835ed4a a366465b

+12 -11
+12 -11
drivers/vdpa/mlx5/net/mlx5_vnet.c
··· 48 48 49 49 #define MLX5V_UNTAGGED 0x1000 50 50 51 + /* Device must start with 1 queue pair, as per VIRTIO v1.2 spec, section 52 + * 5.1.6.5.5 "Device operation in multiqueue mode": 53 + * 54 + * Multiqueue is disabled by default. 55 + * The driver enables multiqueue by sending a command using class 56 + * VIRTIO_NET_CTRL_MQ. The command selects the mode of multiqueue 57 + * operation, as follows: ... 58 + */ 59 + #define MLX5V_DEFAULT_VQ_COUNT 2 60 + 51 61 struct mlx5_vdpa_cq_buf { 52 62 struct mlx5_frag_buf_ctrl fbc; 53 63 struct mlx5_frag_buf frag_buf; ··· 2723 2713 else 2724 2714 ndev->rqt_size = 1; 2725 2715 2726 - /* Device must start with 1 queue pair, as per VIRTIO v1.2 spec, section 2727 - * 5.1.6.5.5 "Device operation in multiqueue mode": 2728 - * 2729 - * Multiqueue is disabled by default. 2730 - * The driver enables multiqueue by sending a command using class 2731 - * VIRTIO_NET_CTRL_MQ. The command selects the mode of multiqueue 2732 - * operation, as follows: ... 2733 - */ 2734 - ndev->cur_num_vqs = 2; 2735 - 2736 2716 update_cvq_info(mvdev); 2737 2717 return err; 2738 2718 } ··· 3040 3040 mlx5_vdpa_destroy_mr_resources(&ndev->mvdev); 3041 3041 ndev->mvdev.status = 0; 3042 3042 ndev->mvdev.suspended = false; 3043 - ndev->cur_num_vqs = 0; 3043 + ndev->cur_num_vqs = MLX5V_DEFAULT_VQ_COUNT; 3044 3044 ndev->mvdev.cvq.received_desc = 0; 3045 3045 ndev->mvdev.cvq.completed_desc = 0; 3046 3046 memset(ndev->event_cbs, 0, sizeof(*ndev->event_cbs) * (mvdev->max_vqs + 1)); ··· 3643 3643 err = -ENOMEM; 3644 3644 goto err_alloc; 3645 3645 } 3646 + ndev->cur_num_vqs = MLX5V_DEFAULT_VQ_COUNT; 3646 3647 3647 3648 init_mvqs(ndev); 3648 3649 allocate_irqs(ndev);