Skip to contentSkip to conversation

vdpa/mlx5: Correct default number of queues when MQ is on

PATCH In review Dragos Tatulea 3 participants 3 messages Jul 27, 2023 – Aug 2, 2023

Subsystems (2)
lore
Share & tools
lore

Dragos Tatulea

author maintainer
#0 lore raw

PATCH 1/1 vdpa/mlx5: Correct default number of queues when MQ is on

The standard specifies that the initial number of queues is the default, which is 1 (1 tx, 1 rx).

---
 drivers/vdpa/mlx5/net/mlx5_vnet.c | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)
drivers/vdpa/mlx5/net/mlx5_vnet.c +9 -1
index 9138ef2fb2c8..6b6eb69a8a90 100644
@@ -2517,7 +2517,15 @@ static int mlx5_vdpa_set_driver_features(struct vdpa_device *vdev, u64 features)
 	else
 		ndev->rqt_size = 1;
 
-	ndev->cur_num_vqs = 2 * ndev->rqt_size;
+	/* Device must start with 1 queue pair, as per VIRTIO v1.2 spec, section
+	 * 5.1.6.5.5 "Device operation in multiqueue mode":
+	 *
+	 * Multiqueue is disabled by default.
+	 * The driver enables multiqueue by sending a command using class
+	 * VIRTIO_NET_CTRL_MQ. The command selects the mode of multiqueue
+	 * operation, as follows: ...
+	 */
+	ndev->cur_num_vqs = 2;
 
 	update_cvq_info(mvdev);
 	return err;
Signature · 1 line
2.41.0
Acked-by on v1 1/1
#1 lore raw
Quoted 6 lines · Dragos Tatulea

The standard specifies that the initial number of queues is the default, which is 1 (1 tx, 1 rx).

Thanks

Quoted 26 lines
---
 drivers/vdpa/mlx5/net/mlx5_vnet.c | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)
drivers/vdpa/mlx5/net/mlx5_vnet.c +9 -2
index 9138ef2fb2c8..6b6eb69a8a90 100644
@@ -2517,7 +2517,15 @@ static int mlx5_vdpa_set_driver_features(struct vdpa_device *vdev, u64 features)
        else
                ndev->rqt_size = 1;
 
-       ndev->cur_num_vqs = 2 * ndev->rqt_size;
+       /* Device must start with 1 queue pair, as per VIRTIO v1.2 spec, section
+        * 5.1.6.5.5 "Device operation in multiqueue mode":
+        *
+        * Multiqueue is disabled by default.
+        * The driver enables multiqueue by sending a command using class
+        * VIRTIO_NET_CTRL_MQ. The command selects the mode of multiqueue
+        * operation, as follows: ...
+        */
+       ndev->cur_num_vqs = 2;
 
        update_cvq_info(mvdev);
        return err;
--
Quoted 2 lines

2.41.0

_______________________________________________
Virtualization mailing list
[email protected]
https://lists.linuxfoundation.org/mailman/listinfo/virtualization

Tested-by
#2 lore raw

QE performed sanity testing on this patch using a real nic's vhost_vdpa device with multi queues, everything works fine.

Quoted 42 lines · Jason Wang
Quoted 6 lines · Dragos Tatulea

The standard specifies that the initial number of queues is the default, which is 1 (1 tx, 1 rx).

Thanks

Quoted 28 lines
---
 drivers/vdpa/mlx5/net/mlx5_vnet.c | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)
drivers/vdpa/mlx5/net/mlx5_vnet.c +9 -2
index 9138ef2fb2c8..6b6eb69a8a90 100644
@@ -2517,7 +2517,15 @@ static int mlx5_vdpa_set_driver_features(struct vdpa_device *vdev, u64 features)
        else
                ndev->rqt_size = 1;
 
-       ndev->cur_num_vqs = 2 * ndev->rqt_size;
+       /* Device must start with 1 queue pair, as per VIRTIO v1.2 spec, section
+        * 5.1.6.5.5 "Device operation in multiqueue mode":
+        *
+        * Multiqueue is disabled by default.
+        * The driver enables multiqueue by sending a command using class
+        * VIRTIO_NET_CTRL_MQ. The command selects the mode of multiqueue
+        * operation, as follows: ...
+        */
+       ndev->cur_num_vqs = 2;
 
        update_cvq_info(mvdev);
        return err;
--

2.41.0