Skip to contentSkip to conversation

virtio-net: Update the max_tx_vq description

PATCH In review Akihiko Odaki 3 participants 13 messages Mar 21, 2025 – Apr 21, 2025

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 virtio-net: Update the max_tx_vq description

Quoted 2 lines · The previous description

A driver sets \field{max_tx_vq} to inform a device how many transmit virtqueues it may use (transmitq1\ldots transmitq \field{max_tx_vq}).

However, it also controls how many receive virtqueues a device MAY use. Copy the description of the virtqueue_pairs field of struct virtio_net_ctrl_mq_pairs_set, which also has the identical semantics, to clarify that.

---
 device-types/net/description.tex | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
device-types/net/description.tex +3 -1
index 76585b0..5178191 100644
@@ -1578,7 +1578,9 @@ \subsubsection{Control Virtqueue}\label{sec:Device Types / Network Device / Devi
 
 Field \field{indirection_table} is an array of receive virtqueues ids.
 
-A driver sets \field{max_tx_vq} to inform a device how many transmit virtqueues it may use (transmitq1\ldots transmitq \field{max_tx_vq}).
+Field \field{max_tx_vq} specifies the number of the transmit and receive queues
+to be used up to \field{max_virtqueue_pairs}; subsequently, transmitq1\ldots
+transmitqn and receiveq1\ldots receiveqn where n=\field{max_tx_vq} MAY be used.
 
 Fields \field{hash_key_length} and \field{hash_key_data} define the key to be used in hash calculation.
 

---
base-commit: b495841a8e80d12c1130f8868f4128866291142d
change-id: 20250321-tx-78e44c50a035

Best regards,

Signature · 1 line
Akihiko Odaki <[email protected]>
#1 lore raw
Quoted 6 lines · Akihiko Odaki
Quoted 2 lines · The previous description

A driver sets \field{max_tx_vq} to inform a device how many transmit virtqueues it may use (transmitq1\ldots transmitq \field{max_tx_vq}).

However, it also controls how many receive virtqueues a device MAY use.

IMO, the meaning of this field is exactly as stated in the specification, i.e. the driver informs the device how many tx vqs it is going to use.
Usage of rx vqs is defined in the indirection table and should not be somehow limited by this field.

Quoted 33 lines

Copy the description of the virtqueue_pairs field of struct virtio_net_ctrl_mq_pairs_set, which also has the identical semantics, to clarify that.

---
 device-types/net/description.tex | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
device-types/net/description.tex +3 -2
index 76585b0..5178191 100644
@@ -1578,7 +1578,9 @@ \subsubsection{Control Virtqueue}\label{sec:Device Types / Network Device / Devi
 
 Field \field{indirection_table} is an array of receive virtqueues ids.
 
-A driver sets \field{max_tx_vq} to inform a device how many transmit virtqueues it may use (transmitq1\ldots transmitq \field{max_tx_vq}).
+Field \field{max_tx_vq} specifies the number of the transmit and receive queues
+to be used up to \field{max_virtqueue_pairs}; subsequently, transmitq1\ldots
+transmitqn and receiveq1\ldots receiveqn where n=\field{max_tx_vq} MAY be used.
 
 Fields \field{hash_key_length} and \field{hash_key_data} define the key to be used in hash calculation.
 
 
---

base-commit: b495841a8e80d12c1130f8868f4128866291142d
change-id: 20250321-tx-78e44c50a035

Best regards,
--
Akihiko Odaki <[email protected]>

#2 lore raw
Quoted 6 lines · Yuri Benditovich
Quoted 5 lines · Akihiko Odaki
Quoted 2 lines · The previous description

A driver sets \field{max_tx_vq} to inform a device how many transmit virtqueues it may use (transmitq1\ldots transmitq \field{max_tx_vq}).

Quoted 7 lines
Quoted 1 line

However, it also controls how many receive virtqueues a device MAY use.

IMO, the meaning of this field is exactly as stated in the specification, i.e. the driver informs the device how many tx vqs it is going to use.
Usage of rx vqs is defined in the indirection table and should not be somehow limited by this field.

That sounds reasonable. QEMU limits the number of rx vqs, but it is more natural to change the QEMU behavior instead of the spec.

Regards,
Akihiko Odaki

Quoted 34 lines
Quoted 34 lines

Copy the description of the virtqueue_pairs field of struct virtio_net_ctrl_mq_pairs_set, which also has the identical semantics, to clarify that.

---
  device-types/net/description.tex | 4 +++-
  1 file changed, 3 insertions(+), 1 deletion(-)
device-types/net/description.tex +3 -2
index 76585b0..5178191 100644
@@ -1578,7 +1578,9 @@ \subsubsection{Control Virtqueue}\label{sec:Device Types / Network Device / Devi
 
  Field \field{indirection_table} is an array of receive virtqueues ids.
 
-A driver sets \field{max_tx_vq} to inform a device how many transmit virtqueues it may use (transmitq1\ldots transmitq \field{max_tx_vq}).
+Field \field{max_tx_vq} specifies the number of the transmit and receive queues
+to be used up to \field{max_virtqueue_pairs}; subsequently, transmitq1\ldots
+transmitqn and receiveq1\ldots receiveqn where n=\field{max_tx_vq} MAY be used.
 
  Fields \field{hash_key_length} and \field{hash_key_data} define the key to be used in hash calculation.
 
 
---

base-commit: b495841a8e80d12c1130f8868f4128866291142d
change-id: 20250321-tx-78e44c50a035

Best regards,
--
Akihiko Odaki <[email protected]>

#3 lore raw
In reply to Akihiko Odaki
Quoted 9 lines · Akihiko Odaki
Quoted 2 lines · The previous description

A driver sets \field{max_tx_vq} to inform a device how many transmit virtqueues it may use (transmitq1\ldots transmitq \field{max_tx_vq}).

However, it also controls how many receive virtqueues a device MAY use. Copy the description of the virtqueue_pairs field of struct virtio_net_ctrl_mq_pairs_set, which also has the identical semantics, to clarify that.

Thanks for doing this, I wonder if it's time to rename as "max_tx_vq" sounds like a TX only thing.

Quoted 30 lines
---
 device-types/net/description.tex | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
device-types/net/description.tex +3 -2
index 76585b0..5178191 100644
@@ -1578,7 +1578,9 @@ \subsubsection{Control Virtqueue}\label{sec:Device Types / Network Device / Devi
 
 Field \field{indirection_table} is an array of receive virtqueues ids.
 
-A driver sets \field{max_tx_vq} to inform a device how many transmit virtqueues it may use (transmitq1\ldots transmitq \field{max_tx_vq}).
+Field \field{max_tx_vq} specifies the number of the transmit and receive queues
+to be used up to \field{max_virtqueue_pairs}; subsequently, transmitq1\ldots
+transmitqn and receiveq1\ldots receiveqn where n=\field{max_tx_vq} MAY be used.
 
 Fields \field{hash_key_length} and \field{hash_key_data} define the key to be used in hash calculation.
 
 
---

base-commit: b495841a8e80d12c1130f8868f4128866291142d
change-id: 20250321-tx-78e44c50a035

Best regards,
--
Akihiko Odaki <[email protected]>

#4 lore raw
Quoted 6 lines · Jason Wang
Quoted 5 lines · Akihiko Odaki
Quoted 2 lines · The previous description

A driver sets \field{max_tx_vq} to inform a device how many transmit virtqueues it may use (transmitq1\ldots transmitq \field{max_tx_vq}).

Quoted 7 lines
Quoted 4 lines

However, it also controls how many receive virtqueues a device MAY use. Copy the description of the virtqueue_pairs field of struct virtio_net_ctrl_mq_pairs_set, which also has the identical semantics, to clarify that.

Thanks for doing this, I wonder if it's time to rename as "max_tx_vq" sounds like a TX only thing.

I'm no longer pursuing this change. Please see the discussion at:
https://lore.kernel.org/r/[email protected]

Please also review a change for QEMU based on the discussion:
https://lore.kernel.org/qemu-devel/[email protected]

Quoted 32 lines
Quoted 31 lines
---
  device-types/net/description.tex | 4 +++-
  1 file changed, 3 insertions(+), 1 deletion(-)
device-types/net/description.tex +3 -2
index 76585b0..5178191 100644
@@ -1578,7 +1578,9 @@ \subsubsection{Control Virtqueue}\label{sec:Device Types / Network Device / Devi
 
  Field \field{indirection_table} is an array of receive virtqueues ids.
 
-A driver sets \field{max_tx_vq} to inform a device how many transmit virtqueues it may use (transmitq1\ldots transmitq \field{max_tx_vq}).
+Field \field{max_tx_vq} specifies the number of the transmit and receive queues
+to be used up to \field{max_virtqueue_pairs}; subsequently, transmitq1\ldots
+transmitqn and receiveq1\ldots receiveqn where n=\field{max_tx_vq} MAY be used.
 
  Fields \field{hash_key_length} and \field{hash_key_data} define the key to be used in hash calculation.
 
 
---

base-commit: b495841a8e80d12c1130f8868f4128866291142d
change-id: 20250321-tx-78e44c50a035

Best regards,
--
Akihiko Odaki <[email protected]>

#5 lore raw
Quoted 13 lines · Akihiko Odaki
Quoted 11 lines · Jason Wang
Quoted 9 lines · Akihiko Odaki
Quoted 2 lines · The previous description

A driver sets \field{max_tx_vq} to inform a device how many transmit virtqueues it may use (transmitq1\ldots transmitq \field{max_tx_vq}).

However, it also controls how many receive virtqueues a device MAY use. Copy the description of the virtqueue_pairs field of struct virtio_net_ctrl_mq_pairs_set, which also has the identical semantics, to clarify that.

Quoted 8 lines
Quoted 2 lines

Thanks for doing this, I wonder if it's time to rename as "max_tx_vq" sounds like a TX only thing.

I'm no longer pursuing this change. Please see the discussion at:
https://lore.kernel.org/r/[email protected]

Please also review a change for QEMU based on the discussion:
https://lore.kernel.org/qemu-devel/[email protected]

Ok, so it seems that RSS implement a async RX/TX queue model instead of the MQ queue pairs:

1) rx available queue were controlled by indirection table
2) tx available queue were controlled by max_tx_vq

So it introduces more "issues" like:

1) This calls a new uAPI as I suggested in another thread instead of reusing TUN_SET_QUEUE
2) If both MQ and RSS are negotiated, what happens if the driver is using both max_tx_vq and virtqueue_pairs. This seems unclear in the spec itself.

THanks

Quoted 34 lines
Quoted 33 lines
Quoted 32 lines
---
  device-types/net/description.tex | 4 +++-
  1 file changed, 3 insertions(+), 1 deletion(-)
device-types/net/description.tex +3 -2
index 76585b0..5178191 100644
@@ -1578,7 +1578,9 @@ \subsubsection{Control Virtqueue}\label{sec:Device Types / Network Device / Devi
 
  Field \field{indirection_table} is an array of receive virtqueues ids.
 
-A driver sets \field{max_tx_vq} to inform a device how many transmit virtqueues it may use (transmitq1\ldots transmitq \field{max_tx_vq}).
+Field \field{max_tx_vq} specifies the number of the transmit and receive queues
+to be used up to \field{max_virtqueue_pairs}; subsequently, transmitq1\ldots
+transmitqn and receiveq1\ldots receiveqn where n=\field{max_tx_vq} MAY be used.
 
  Fields \field{hash_key_length} and \field{hash_key_data} define the key to be used in hash calculation.
 
 
---

base-commit: b495841a8e80d12c1130f8868f4128866291142d
change-id: 20250321-tx-78e44c50a035

Best regards,
--
Akihiko Odaki <[email protected]>

#6 lore raw
Quoted 26 lines · Jason Wang
Quoted 13 lines · Akihiko Odaki
Quoted 11 lines · Jason Wang
Quoted 9 lines · Akihiko Odaki
Quoted 2 lines · The previous description

A driver sets \field{max_tx_vq} to inform a device how many transmit virtqueues it may use (transmitq1\ldots transmitq \field{max_tx_vq}).

However, it also controls how many receive virtqueues a device MAY use. Copy the description of the virtqueue_pairs field of struct virtio_net_ctrl_mq_pairs_set, which also has the identical semantics, to clarify that.

Quoted 8 lines
Quoted 2 lines

Thanks for doing this, I wonder if it's time to rename as "max_tx_vq" sounds like a TX only thing.

I'm no longer pursuing this change. Please see the discussion at:
https://lore.kernel.org/r/[email protected]

Please also review a change for QEMU based on the discussion:
https://lore.kernel.org/qemu-devel/[email protected]

Ok, so it seems that RSS implement a async RX/TX queue model instead of the MQ queue pairs:

Quoted 7 lines

1) rx available queue were controlled by indirection table
2) tx available queue were controlled by max_tx_vq

So it introduces more "issues" like:

1) This calls a new uAPI as I suggested in another thread instead of reusing TUN_SET_QUEUE

QEMU applies the same approach for both VIRTIO_NET_CTRL_MQ_VQ_PAIRS_SET and VIRTIO_NET_CTRL_MQ_RSS_CONFIG, which is to parse the configuration passed by the guest in QEMU and to pass the parsed configuration to TUN via TUNSETQUEUE. Please see the patch for QEMU I mentioned in the previous email for the actual implementation.

Quoted 3 lines

2) If both MQ and RSS are negotiated, what happens if the driver is using both max_tx_vq and virtqueue_pairs. This seems unclear in the spec itself.

The spec says the last one sent by the driver will be used. In version 1.2, 5.1.6.5.5 "Device operation in multiqueue mode" says:

Quoted 11 lines

The driver enables multiqueue by sending a command using class VIRTIO_NET_CTRL_MQ. The command selects the mode of multiqueue operation, as follows:
#define VIRTIO_NET_CTRL_MQ 4
#define VIRTIO_NET_CTRL_MQ_VQ_PAIRS_SET 0 (for automatic
receive steering)
#define VIRTIO_NET_CTRL_MQ_RSS_CONFIG 1 (for configurable
receive steering)
#define VIRTIO_NET_CTRL_MQ_HASH_CONFIG 2 (for configurable
hash calculation)

Quoted 2 lines

If more than one multiqueue mode is negotiated, the resulting device configuration is defined by the last command sent by the driver.

Regards,
Akihiko Odaki

Quoted 39 lines

THanks

Quoted 34 lines
Quoted 33 lines
Quoted 32 lines
---
   device-types/net/description.tex | 4 +++-
   1 file changed, 3 insertions(+), 1 deletion(-)
device-types/net/description.tex +3 -2
index 76585b0..5178191 100644
@@ -1578,7 +1578,9 @@ \subsubsection{Control Virtqueue}\label{sec:Device Types / Network Device / Devi
 
   Field \field{indirection_table} is an array of receive virtqueues ids.
 
-A driver sets \field{max_tx_vq} to inform a device how many transmit virtqueues it may use (transmitq1\ldots transmitq \field{max_tx_vq}).
+Field \field{max_tx_vq} specifies the number of the transmit and receive queues
+to be used up to \field{max_virtqueue_pairs}; subsequently, transmitq1\ldots
+transmitqn and receiveq1\ldots receiveqn where n=\field{max_tx_vq} MAY be used.
 
   Fields \field{hash_key_length} and \field{hash_key_data} define the key to be used in hash calculation.
 
 
---

base-commit: b495841a8e80d12c1130f8868f4128866291142d
change-id: 20250321-tx-78e44c50a035

Best regards,
--
Akihiko Odaki <[email protected]>

#7 lore raw
Quoted 33 lines · Akihiko Odaki
Quoted 31 lines · Jason Wang
Quoted 13 lines · Akihiko Odaki
Quoted 11 lines · Jason Wang
Quoted 9 lines · Akihiko Odaki
Quoted 2 lines · The previous description

A driver sets \field{max_tx_vq} to inform a device how many transmit virtqueues it may use (transmitq1\ldots transmitq \field{max_tx_vq}).

However, it also controls how many receive virtqueues a device MAY use. Copy the description of the virtqueue_pairs field of struct virtio_net_ctrl_mq_pairs_set, which also has the identical semantics, to clarify that.

Quoted 8 lines
Quoted 2 lines

Thanks for doing this, I wonder if it's time to rename as "max_tx_vq" sounds like a TX only thing.

I'm no longer pursuing this change. Please see the discussion at:
https://lore.kernel.org/r/[email protected]

Please also review a change for QEMU based on the discussion:
https://lore.kernel.org/qemu-devel/[email protected]

Ok, so it seems that RSS implement a async RX/TX queue model instead of the MQ queue pairs:

1) rx available queue were controlled by indirection table
2) tx available queue were controlled by max_tx_vq

So it introduces more "issues" like:

Quoted 8 lines
Quoted 2 lines

1) This calls a new uAPI as I suggested in another thread instead of reusing TUN_SET_QUEUE

QEMU applies the same approach for both VIRTIO_NET_CTRL_MQ_VQ_PAIRS_SET and VIRTIO_NET_CTRL_MQ_RSS_CONFIG, which is to parse the configuration passed by the guest in QEMU and to pass the parsed configuration to TUN via TUNSETQUEUE. Please see the patch for QEMU I mentioned in the previous email for the actual implementation.

If this is true, even if guests want to have an async tx/rx queue number, the underlayer TAP will still choose a combined queue pair model.

Quoted 20 lines
Quoted 4 lines

2) If both MQ and RSS are negotiated, what happens if the driver is using both max_tx_vq and virtqueue_pairs. This seems unclear in the spec itself.

The spec says the last one sent by the driver will be used. In version 1.2, 5.1.6.5.5 "Device operation in multiqueue mode" says:

Quoted 13 lines

The driver enables multiqueue by sending a command using class VIRTIO_NET_CTRL_MQ. The command selects the mode of multiqueue operation, as follows:
#define VIRTIO_NET_CTRL_MQ 4
#define VIRTIO_NET_CTRL_MQ_VQ_PAIRS_SET 0 (for automatic
receive steering)
#define VIRTIO_NET_CTRL_MQ_RSS_CONFIG 1 (for configurable
receive steering)
#define VIRTIO_NET_CTRL_MQ_HASH_CONFIG 2 (for configurable
hash calculation)

If more than one multiqueue mode is negotiated, the resulting device configuration is defined by the last command sent by the driver.

I think it doesn't clarify all the cases. Consider we:

1) configure flow A to use rx queue 4
2) set curr_queue_paris to 2

How to choose the rx queue in flow A? This needs some clarification e.g whether unclassified or automq or drop

Thanks

Quoted 44 lines

Regards,
Akihiko Odaki

Quoted 39 lines

THanks

Quoted 34 lines
Quoted 33 lines
Quoted 32 lines
---
   device-types/net/description.tex | 4 +++-
   1 file changed, 3 insertions(+), 1 deletion(-)
device-types/net/description.tex +3 -2
index 76585b0..5178191 100644
@@ -1578,7 +1578,9 @@ \subsubsection{Control Virtqueue}\label{sec:Device Types / Network Device / Devi
 
   Field \field{indirection_table} is an array of receive virtqueues ids.
 
-A driver sets \field{max_tx_vq} to inform a device how many transmit virtqueues it may use (transmitq1\ldots transmitq \field{max_tx_vq}).
+Field \field{max_tx_vq} specifies the number of the transmit and receive queues
+to be used up to \field{max_virtqueue_pairs}; subsequently, transmitq1\ldots
+transmitqn and receiveq1\ldots receiveqn where n=\field{max_tx_vq} MAY be used.
 
   Fields \field{hash_key_length} and \field{hash_key_data} define the key to be used in hash calculation.
 
 
---

base-commit: b495841a8e80d12c1130f8868f4128866291142d
change-id: 20250321-tx-78e44c50a035

Best regards,
--
Akihiko Odaki <[email protected]>

#8 lore raw
Quoted 68 lines · Jason Wang
Quoted 33 lines · Akihiko Odaki
Quoted 31 lines · Jason Wang
Quoted 13 lines · Akihiko Odaki
Quoted 11 lines · Jason Wang
Quoted 9 lines · Akihiko Odaki
Quoted 2 lines · The previous description

A driver sets \field{max_tx_vq} to inform a device how many transmit virtqueues it may use (transmitq1\ldots transmitq \field{max_tx_vq}).

However, it also controls how many receive virtqueues a device MAY use. Copy the description of the virtqueue_pairs field of struct virtio_net_ctrl_mq_pairs_set, which also has the identical semantics, to clarify that.

Quoted 8 lines
Quoted 2 lines

Thanks for doing this, I wonder if it's time to rename as "max_tx_vq" sounds like a TX only thing.

I'm no longer pursuing this change. Please see the discussion at:
https://lore.kernel.org/r/[email protected]

Please also review a change for QEMU based on the discussion:
https://lore.kernel.org/qemu-devel/[email protected]

Ok, so it seems that RSS implement a async RX/TX queue model instead of the MQ queue pairs:

1) rx available queue were controlled by indirection table
2) tx available queue were controlled by max_tx_vq

So it introduces more "issues" like:

Quoted 8 lines
Quoted 2 lines

1) This calls a new uAPI as I suggested in another thread instead of reusing TUN_SET_QUEUE

QEMU applies the same approach for both VIRTIO_NET_CTRL_MQ_VQ_PAIRS_SET and VIRTIO_NET_CTRL_MQ_RSS_CONFIG, which is to parse the configuration passed by the guest in QEMU and to pass the parsed configuration to TUN via TUNSETQUEUE. Please see the patch for QEMU I mentioned in the previous email for the actual implementation.

If this is true, even if guests want to have an async tx/rx queue number, the underlayer TAP will still choose a combined queue pair model.

Quoted 20 lines
Quoted 4 lines

2) If both MQ and RSS are negotiated, what happens if the driver is using both max_tx_vq and virtqueue_pairs. This seems unclear in the spec itself.

The spec says the last one sent by the driver will be used. In version 1.2, 5.1.6.5.5 "Device operation in multiqueue mode" says:

Quoted 13 lines

The driver enables multiqueue by sending a command using class VIRTIO_NET_CTRL_MQ. The command selects the mode of multiqueue operation, as follows:
#define VIRTIO_NET_CTRL_MQ 4
#define VIRTIO_NET_CTRL_MQ_VQ_PAIRS_SET 0 (for automatic
receive steering)
#define VIRTIO_NET_CTRL_MQ_RSS_CONFIG 1 (for configurable
receive steering)
#define VIRTIO_NET_CTRL_MQ_HASH_CONFIG 2 (for configurable
hash calculation)

If more than one multiqueue mode is negotiated, the resulting device configuration is defined by the last command sent by the driver.

Quoted 7 lines

I think it doesn't clarify all the cases. Consider we:

1) configure flow A to use rx queue 4
2) set curr_queue_paris to 2

How to choose the rx queue in flow A? This needs some clarification e.g whether unclassified or automq or drop

Such a configuration is not possible. If VIRTIO_NET_CTRL_MQ_RSS_CONFIG configures flow A to use rx queue 4, the resulting number of queue pairs will be at least 5.

Regards,
Akihiko Odaki

Quoted 48 lines

Thanks

Quoted 44 lines

Regards,
Akihiko Odaki

Quoted 39 lines

THanks

Quoted 34 lines
Quoted 33 lines
Quoted 32 lines
---
    device-types/net/description.tex | 4 +++-
    1 file changed, 3 insertions(+), 1 deletion(-)
device-types/net/description.tex +3 -2
index 76585b0..5178191 100644
@@ -1578,7 +1578,9 @@ \subsubsection{Control Virtqueue}\label{sec:Device Types / Network Device / Devi
 
    Field \field{indirection_table} is an array of receive virtqueues ids.
 
-A driver sets \field{max_tx_vq} to inform a device how many transmit virtqueues it may use (transmitq1\ldots transmitq \field{max_tx_vq}).
+Field \field{max_tx_vq} specifies the number of the transmit and receive queues
+to be used up to \field{max_virtqueue_pairs}; subsequently, transmitq1\ldots
+transmitqn and receiveq1\ldots receiveqn where n=\field{max_tx_vq} MAY be used.
 
    Fields \field{hash_key_length} and \field{hash_key_data} define the key to be used in hash calculation.
 
 
---

base-commit: b495841a8e80d12c1130f8868f4128866291142d
change-id: 20250321-tx-78e44c50a035

Best regards,
--
Akihiko Odaki <[email protected]>

#9 lore raw
Quoted 75 lines · Akihiko Odaki
Quoted 73 lines · Jason Wang
Quoted 33 lines · Akihiko Odaki
Quoted 31 lines · Jason Wang
Quoted 13 lines · Akihiko Odaki
Quoted 11 lines · Jason Wang
Quoted 9 lines · Akihiko Odaki
Quoted 2 lines · The previous description

A driver sets \field{max_tx_vq} to inform a device how many transmit virtqueues it may use (transmitq1\ldots transmitq \field{max_tx_vq}).

However, it also controls how many receive virtqueues a device MAY use. Copy the description of the virtqueue_pairs field of struct virtio_net_ctrl_mq_pairs_set, which also has the identical semantics, to clarify that.

Quoted 8 lines
Quoted 2 lines

Thanks for doing this, I wonder if it's time to rename as "max_tx_vq" sounds like a TX only thing.

I'm no longer pursuing this change. Please see the discussion at:
https://lore.kernel.org/r/[email protected]

Please also review a change for QEMU based on the discussion:
https://lore.kernel.org/qemu-devel/[email protected]

Ok, so it seems that RSS implement a async RX/TX queue model instead of the MQ queue pairs:

1) rx available queue were controlled by indirection table
2) tx available queue were controlled by max_tx_vq

So it introduces more "issues" like:

Quoted 8 lines
Quoted 2 lines

1) This calls a new uAPI as I suggested in another thread instead of reusing TUN_SET_QUEUE

QEMU applies the same approach for both VIRTIO_NET_CTRL_MQ_VQ_PAIRS_SET and VIRTIO_NET_CTRL_MQ_RSS_CONFIG, which is to parse the configuration passed by the guest in QEMU and to pass the parsed configuration to TUN via TUNSETQUEUE. Please see the patch for QEMU I mentioned in the previous email for the actual implementation.

If this is true, even if guests want to have an async tx/rx queue number, the underlayer TAP will still choose a combined queue pair model.

Quoted 20 lines
Quoted 4 lines

2) If both MQ and RSS are negotiated, what happens if the driver is using both max_tx_vq and virtqueue_pairs. This seems unclear in the spec itself.

The spec says the last one sent by the driver will be used. In version 1.2, 5.1.6.5.5 "Device operation in multiqueue mode" says:

Quoted 13 lines

The driver enables multiqueue by sending a command using class VIRTIO_NET_CTRL_MQ. The command selects the mode of multiqueue operation, as follows:
#define VIRTIO_NET_CTRL_MQ 4
#define VIRTIO_NET_CTRL_MQ_VQ_PAIRS_SET 0 (for automatic
receive steering)
#define VIRTIO_NET_CTRL_MQ_RSS_CONFIG 1 (for configurable
receive steering)
#define VIRTIO_NET_CTRL_MQ_HASH_CONFIG 2 (for configurable
hash calculation)

If more than one multiqueue mode is negotiated, the resulting device configuration is defined by the last command sent by the driver.

I think it doesn't clarify all the cases. Consider we:

1) configure flow A to use rx queue 4
2) set curr_queue_paris to 2

Quoted 6 lines
Quoted 2 lines

How to choose the rx queue in flow A? This needs some clarification e.g whether unclassified or automq or drop

Such a configuration is not possible. If VIRTIO_NET_CTRL_MQ_RSS_CONFIG configures flow A to use rx queue 4, the resulting number of queue pairs will be at least 5.

Yes, this could be prevented by a well formed driver. But I mean from the device side, such commands could be sent from the driver that is something both spec and the implementation (e.g TAP) needs to consider.

Thanks

Quoted 53 lines

Regards,
Akihiko Odaki

Quoted 48 lines

Thanks

Quoted 44 lines

Regards,
Akihiko Odaki

Quoted 39 lines

THanks

Quoted 34 lines
Quoted 33 lines
Quoted 32 lines
---
    device-types/net/description.tex | 4 +++-
    1 file changed, 3 insertions(+), 1 deletion(-)
device-types/net/description.tex +3 -2
index 76585b0..5178191 100644
@@ -1578,7 +1578,9 @@ \subsubsection{Control Virtqueue}\label{sec:Device Types / Network Device / Devi
 
    Field \field{indirection_table} is an array of receive virtqueues ids.
 
-A driver sets \field{max_tx_vq} to inform a device how many transmit virtqueues it may use (transmitq1\ldots transmitq \field{max_tx_vq}).
+Field \field{max_tx_vq} specifies the number of the transmit and receive queues
+to be used up to \field{max_virtqueue_pairs}; subsequently, transmitq1\ldots
+transmitqn and receiveq1\ldots receiveqn where n=\field{max_tx_vq} MAY be used.
 
    Fields \field{hash_key_length} and \field{hash_key_data} define the key to be used in hash calculation.
 
 
---

base-commit: b495841a8e80d12c1130f8868f4128866291142d
change-id: 20250321-tx-78e44c50a035

Best regards,
--
Akihiko Odaki <[email protected]>

#10 lore raw
Quoted 79 lines · Jason Wang
Quoted 78 lines · Akihiko Odaki
Quoted 75 lines · Jason Wang
Quoted 33 lines · Akihiko Odaki
Quoted 31 lines · Jason Wang
Quoted 13 lines · Akihiko Odaki
Quoted 11 lines · Jason Wang
Quoted 9 lines · Akihiko Odaki
Quoted 2 lines · The previous description

A driver sets \field{max_tx_vq} to inform a device how many transmit virtqueues it may use (transmitq1\ldots transmitq \field{max_tx_vq}).

However, it also controls how many receive virtqueues a device MAY use. Copy the description of the virtqueue_pairs field of struct virtio_net_ctrl_mq_pairs_set, which also has the identical semantics, to clarify that.

Quoted 8 lines
Quoted 2 lines

Thanks for doing this, I wonder if it's time to rename as "max_tx_vq" sounds like a TX only thing.

I'm no longer pursuing this change. Please see the discussion at:
https://lore.kernel.org/r/[email protected]

Please also review a change for QEMU based on the discussion:
https://lore.kernel.org/qemu-devel/[email protected]

Ok, so it seems that RSS implement a async RX/TX queue model instead of the MQ queue pairs:

1) rx available queue were controlled by indirection table
2) tx available queue were controlled by max_tx_vq

So it introduces more "issues" like:

Quoted 8 lines
Quoted 2 lines

1) This calls a new uAPI as I suggested in another thread instead of reusing TUN_SET_QUEUE

QEMU applies the same approach for both VIRTIO_NET_CTRL_MQ_VQ_PAIRS_SET and VIRTIO_NET_CTRL_MQ_RSS_CONFIG, which is to parse the configuration passed by the guest in QEMU and to pass the parsed configuration to TUN via TUNSETQUEUE. Please see the patch for QEMU I mentioned in the previous email for the actual implementation.

If this is true, even if guests want to have an async tx/rx queue number, the underlayer TAP will still choose a combined queue pair model.

Quoted 20 lines
Quoted 4 lines

2) If both MQ and RSS are negotiated, what happens if the driver is using both max_tx_vq and virtqueue_pairs. This seems unclear in the spec itself.

The spec says the last one sent by the driver will be used. In version 1.2, 5.1.6.5.5 "Device operation in multiqueue mode" says:

Quoted 13 lines

The driver enables multiqueue by sending a command using class VIRTIO_NET_CTRL_MQ. The command selects the mode of multiqueue operation, as follows:
#define VIRTIO_NET_CTRL_MQ 4
#define VIRTIO_NET_CTRL_MQ_VQ_PAIRS_SET 0 (for automatic
receive steering)
#define VIRTIO_NET_CTRL_MQ_RSS_CONFIG 1 (for configurable
receive steering)
#define VIRTIO_NET_CTRL_MQ_HASH_CONFIG 2 (for configurable
hash calculation)

If more than one multiqueue mode is negotiated, the resulting device configuration is defined by the last command sent by the driver.

I think it doesn't clarify all the cases. Consider we:

1) configure flow A to use rx queue 4
2) set curr_queue_paris to 2

How to choose the rx queue in flow A? This needs some clarification e.g whether unclassified or automq or drop

Quoted 8 lines
Quoted 3 lines

Such a configuration is not possible. If VIRTIO_NET_CTRL_MQ_RSS_CONFIG configures flow A to use rx queue 4, the resulting number of queue pairs will be at least 5.

Yes, this could be prevented by a well formed driver. But I mean from the device side, such commands could be sent from the driver that is something both spec and the implementation (e.g TAP) needs to consider.

If VIRTIO_NET_CTRL_MQ_RSS_CONFIG is the last command, it must define the number of queue pairs since the spec says the resulting device configuration is defined by the last command sent by the driver. So if VIRTIO_NET_CTRL_MQ_RSS_CONFIG configures flow A to use rx queue 4, the command also define that the number of queue pairs to be at least 5. Therefore, it is not possible for a driver to define the number of queue pairs contradicting with the flow configuration.

Regards,
Akihiko Odaki

Quoted 58 lines

Thanks

Quoted 53 lines

Regards,
Akihiko Odaki

Quoted 48 lines

Thanks

Quoted 44 lines

Regards,
Akihiko Odaki

Quoted 39 lines

THanks

Quoted 34 lines
Quoted 33 lines
Quoted 32 lines
---
     device-types/net/description.tex | 4 +++-
     1 file changed, 3 insertions(+), 1 deletion(-)
device-types/net/description.tex +3 -2
index 76585b0..5178191 100644
@@ -1578,7 +1578,9 @@ \subsubsection{Control Virtqueue}\label{sec:Device Types / Network Device / Devi
 
     Field \field{indirection_table} is an array of receive virtqueues ids.
 
-A driver sets \field{max_tx_vq} to inform a device how many transmit virtqueues it may use (transmitq1\ldots transmitq \field{max_tx_vq}).
+Field \field{max_tx_vq} specifies the number of the transmit and receive queues
+to be used up to \field{max_virtqueue_pairs}; subsequently, transmitq1\ldots
+transmitqn and receiveq1\ldots receiveqn where n=\field{max_tx_vq} MAY be used.
 
     Fields \field{hash_key_length} and \field{hash_key_data} define the key to be used in hash calculation.
 
 
---

base-commit: b495841a8e80d12c1130f8868f4128866291142d
change-id: 20250321-tx-78e44c50a035

Best regards,
--
Akihiko Odaki <[email protected]>

#11 lore raw
Quoted 90 lines · Akihiko Odaki
Quoted 79 lines · Jason Wang
Quoted 78 lines · Akihiko Odaki
Quoted 75 lines · Jason Wang
Quoted 33 lines · Akihiko Odaki
Quoted 31 lines · Jason Wang
Quoted 13 lines · Akihiko Odaki
Quoted 11 lines · Jason Wang
Quoted 9 lines · Akihiko Odaki
Quoted 2 lines · The previous description

A driver sets \field{max_tx_vq} to inform a device how many transmit virtqueues it may use (transmitq1\ldots transmitq \field{max_tx_vq}).

However, it also controls how many receive virtqueues a device MAY use. Copy the description of the virtqueue_pairs field of struct virtio_net_ctrl_mq_pairs_set, which also has the identical semantics, to clarify that.

Quoted 8 lines
Quoted 2 lines

Thanks for doing this, I wonder if it's time to rename as "max_tx_vq" sounds like a TX only thing.

I'm no longer pursuing this change. Please see the discussion at:
https://lore.kernel.org/r/[email protected]

Please also review a change for QEMU based on the discussion:
https://lore.kernel.org/qemu-devel/[email protected]

Ok, so it seems that RSS implement a async RX/TX queue model instead of the MQ queue pairs:

1) rx available queue were controlled by indirection table
2) tx available queue were controlled by max_tx_vq

So it introduces more "issues" like:

Quoted 8 lines
Quoted 2 lines

1) This calls a new uAPI as I suggested in another thread instead of reusing TUN_SET_QUEUE

QEMU applies the same approach for both VIRTIO_NET_CTRL_MQ_VQ_PAIRS_SET and VIRTIO_NET_CTRL_MQ_RSS_CONFIG, which is to parse the configuration passed by the guest in QEMU and to pass the parsed configuration to TUN via TUNSETQUEUE. Please see the patch for QEMU I mentioned in the previous email for the actual implementation.

If this is true, even if guests want to have an async tx/rx queue number, the underlayer TAP will still choose a combined queue pair model.

Quoted 20 lines
Quoted 4 lines

2) If both MQ and RSS are negotiated, what happens if the driver is using both max_tx_vq and virtqueue_pairs. This seems unclear in the spec itself.

The spec says the last one sent by the driver will be used. In version 1.2, 5.1.6.5.5 "Device operation in multiqueue mode" says:

Quoted 13 lines

The driver enables multiqueue by sending a command using class VIRTIO_NET_CTRL_MQ. The command selects the mode of multiqueue operation, as follows:
#define VIRTIO_NET_CTRL_MQ 4
#define VIRTIO_NET_CTRL_MQ_VQ_PAIRS_SET 0 (for automatic
receive steering)
#define VIRTIO_NET_CTRL_MQ_RSS_CONFIG 1 (for configurable
receive steering)
#define VIRTIO_NET_CTRL_MQ_HASH_CONFIG 2 (for configurable
hash calculation)

If more than one multiqueue mode is negotiated, the resulting device configuration is defined by the last command sent by the driver.

I think it doesn't clarify all the cases. Consider we:

1) configure flow A to use rx queue 4
2) set curr_queue_paris to 2

How to choose the rx queue in flow A? This needs some clarification e.g whether unclassified or automq or drop

Quoted 8 lines
Quoted 3 lines

Such a configuration is not possible. If VIRTIO_NET_CTRL_MQ_RSS_CONFIG configures flow A to use rx queue 4, the resulting number of queue pairs will be at least 5.

Yes, this could be prevented by a well formed driver. But I mean from the device side, such commands could be sent from the driver that is something both spec and the implementation (e.g TAP) needs to consider.

Quoted 7 lines

If VIRTIO_NET_CTRL_MQ_RSS_CONFIG is the last command, it must define the number of queue pairs since the spec says the resulting device configuration is defined by the last command sent by the driver. So if VIRTIO_NET_CTRL_MQ_RSS_CONFIG configures flow A to use rx queue 4, the command also define that the number of queue pairs to be at least 5. Therefore, it is not possible for a driver to define the number of queue pairs contradicting with the flow configuration.

Yes, but I meant what happens if there's a VIRTIO_NET_CTRL_MQ_VQ_PAIRS_SET afterwards that sets queue pairs to 2. In this case, should the flow go with which queue?

Thanks

Quoted 63 lines

Regards,
Akihiko Odaki

Quoted 58 lines

Thanks

Quoted 53 lines

Regards,
Akihiko Odaki

Quoted 48 lines

Thanks

Quoted 44 lines

Regards,
Akihiko Odaki

Quoted 39 lines

THanks

Quoted 34 lines
Quoted 33 lines
Quoted 32 lines
---
     device-types/net/description.tex | 4 +++-
     1 file changed, 3 insertions(+), 1 deletion(-)
device-types/net/description.tex +3 -2
index 76585b0..5178191 100644
@@ -1578,7 +1578,9 @@ \subsubsection{Control Virtqueue}\label{sec:Device Types / Network Device / Devi
 
     Field \field{indirection_table} is an array of receive virtqueues ids.
 
-A driver sets \field{max_tx_vq} to inform a device how many transmit virtqueues it may use (transmitq1\ldots transmitq \field{max_tx_vq}).
+Field \field{max_tx_vq} specifies the number of the transmit and receive queues
+to be used up to \field{max_virtqueue_pairs}; subsequently, transmitq1\ldots
+transmitqn and receiveq1\ldots receiveqn where n=\field{max_tx_vq} MAY be used.
 
     Fields \field{hash_key_length} and \field{hash_key_data} define the key to be used in hash calculation.
 
 
---

base-commit: b495841a8e80d12c1130f8868f4128866291142d
change-id: 20250321-tx-78e44c50a035

Best regards,
--
Akihiko Odaki <[email protected]>

#12 lore raw
Quoted 99 lines · Jason Wang
Quoted 90 lines · Akihiko Odaki
Quoted 79 lines · Jason Wang
Quoted 78 lines · Akihiko Odaki
Quoted 75 lines · Jason Wang
Quoted 33 lines · Akihiko Odaki
Quoted 31 lines · Jason Wang
Quoted 13 lines · Akihiko Odaki
Quoted 11 lines · Jason Wang
Quoted 9 lines · Akihiko Odaki
Quoted 2 lines · The previous description

A driver sets \field{max_tx_vq} to inform a device how many transmit virtqueues it may use (transmitq1\ldots transmitq \field{max_tx_vq}).

However, it also controls how many receive virtqueues a device MAY use. Copy the description of the virtqueue_pairs field of struct virtio_net_ctrl_mq_pairs_set, which also has the identical semantics, to clarify that.

Quoted 8 lines
Quoted 2 lines

Thanks for doing this, I wonder if it's time to rename as "max_tx_vq" sounds like a TX only thing.

I'm no longer pursuing this change. Please see the discussion at:
https://lore.kernel.org/r/[email protected]

Please also review a change for QEMU based on the discussion:
https://lore.kernel.org/qemu-devel/[email protected]

Ok, so it seems that RSS implement a async RX/TX queue model instead of the MQ queue pairs:

1) rx available queue were controlled by indirection table
2) tx available queue were controlled by max_tx_vq

So it introduces more "issues" like:

Quoted 8 lines
Quoted 2 lines

1) This calls a new uAPI as I suggested in another thread instead of reusing TUN_SET_QUEUE

QEMU applies the same approach for both VIRTIO_NET_CTRL_MQ_VQ_PAIRS_SET and VIRTIO_NET_CTRL_MQ_RSS_CONFIG, which is to parse the configuration passed by the guest in QEMU and to pass the parsed configuration to TUN via TUNSETQUEUE. Please see the patch for QEMU I mentioned in the previous email for the actual implementation.

If this is true, even if guests want to have an async tx/rx queue number, the underlayer TAP will still choose a combined queue pair model.

Quoted 20 lines
Quoted 4 lines

2) If both MQ and RSS are negotiated, what happens if the driver is using both max_tx_vq and virtqueue_pairs. This seems unclear in the spec itself.

The spec says the last one sent by the driver will be used. In version 1.2, 5.1.6.5.5 "Device operation in multiqueue mode" says:

Quoted 13 lines

The driver enables multiqueue by sending a command using class VIRTIO_NET_CTRL_MQ. The command selects the mode of multiqueue operation, as follows:
#define VIRTIO_NET_CTRL_MQ 4
#define VIRTIO_NET_CTRL_MQ_VQ_PAIRS_SET 0 (for automatic
receive steering)
#define VIRTIO_NET_CTRL_MQ_RSS_CONFIG 1 (for configurable
receive steering)
#define VIRTIO_NET_CTRL_MQ_HASH_CONFIG 2 (for configurable
hash calculation)

If more than one multiqueue mode is negotiated, the resulting device configuration is defined by the last command sent by the driver.

I think it doesn't clarify all the cases. Consider we:

1) configure flow A to use rx queue 4
2) set curr_queue_paris to 2

How to choose the rx queue in flow A? This needs some clarification e.g whether unclassified or automq or drop

Quoted 8 lines
Quoted 3 lines

Such a configuration is not possible. If VIRTIO_NET_CTRL_MQ_RSS_CONFIG configures flow A to use rx queue 4, the resulting number of queue pairs will be at least 5.

Yes, this could be prevented by a well formed driver. But I mean from the device side, such commands could be sent from the driver that is something both spec and the implementation (e.g TAP) needs to consider.

Quoted 7 lines

If VIRTIO_NET_CTRL_MQ_RSS_CONFIG is the last command, it must define the number of queue pairs since the spec says the resulting device configuration is defined by the last command sent by the driver. So if VIRTIO_NET_CTRL_MQ_RSS_CONFIG configures flow A to use rx queue 4, the command also define that the number of queue pairs to be at least 5. Therefore, it is not possible for a driver to define the number of queue pairs contradicting with the flow configuration.

Quoted 3 lines

Yes, but I meant what happens if there's a VIRTIO_NET_CTRL_MQ_VQ_PAIRS_SET afterwards that sets queue pairs to 2. In this case, should the flow go with which queue?

The past configuration made by VIRTIO_NET_CTRL_MQ_RSS_CONFIG will be ignored since the last command defines the configuration according to 5.1.6.5.5 "Device operation in multiqueue mode". Instead, the device will steer packets according to 5.1.6.5.6 "Automatic receive steering in multiqueue mode":

Quoted 8 lines

When multiqueue is enabled by VIRTIO_NET_CTRL_MQ_VQ_PAIRS_SET command, the device MUST use automatic receive steering based on packet flow. Programming of the receive steering classificator is implicit. After the driver transmitted a packet of a flow on transmitqX, the device SHOULD cause incoming packets for that flow to be steered to receiveqX. For uni-directional protocols, or where no packets have been transmitted yet, the device MAY steer a packet to a random queue out of the specified receiveq1…receiveqn.

Regards,
Akihiko Odaki

Quoted 67 lines

Thanks

Quoted 63 lines

Regards,
Akihiko Odaki

Quoted 58 lines

Thanks

Quoted 53 lines

Regards,
Akihiko Odaki

Quoted 48 lines

Thanks

Quoted 44 lines

Regards,
Akihiko Odaki

Quoted 39 lines

THanks

Quoted 34 lines
Quoted 33 lines
Quoted 32 lines
---
      device-types/net/description.tex | 4 +++-
      1 file changed, 3 insertions(+), 1 deletion(-)
device-types/net/description.tex +3 -2
index 76585b0..5178191 100644
@@ -1578,7 +1578,9 @@ \subsubsection{Control Virtqueue}\label{sec:Device Types / Network Device / Devi
 
      Field \field{indirection_table} is an array of receive virtqueues ids.
 
-A driver sets \field{max_tx_vq} to inform a device how many transmit virtqueues it may use (transmitq1\ldots transmitq \field{max_tx_vq}).
+Field \field{max_tx_vq} specifies the number of the transmit and receive queues
+to be used up to \field{max_virtqueue_pairs}; subsequently, transmitq1\ldots
+transmitqn and receiveq1\ldots receiveqn where n=\field{max_tx_vq} MAY be used.
 
      Fields \field{hash_key_length} and \field{hash_key_data} define the key to be used in hash calculation.
 
 
---

base-commit: b495841a8e80d12c1130f8868f4128866291142d
change-id: 20250321-tx-78e44c50a035

Best regards,
--
Akihiko Odaki <[email protected]>