Skip to contentSkip to conversation

virtio-net: clarify coalescing parameters settings

PATCH Superseded Heng Qi 3 participants 4 messages May 23, 2024 – May 27, 2024

v4 of 5 Superseded Latest is v5 →

lore
Share & tools
lore

Heng Qi

author
#0 lore raw

PATCH v4 1/1 virtio-net: clarify coalescing parameters settings

The device can set any initial coalescing parameters (0 or non-zero) for the receive/send queue before the setting command is executed, not just 0, enhancing device performance even without DIM enabled.

So we need to clarify descriptions that don't fit the behavior.

---
v3->v4:
- Doesn't force the device to remember more stuff. @Parav

v2->v3:
- Clarify description to be more generic. @Parav

v1->v2:
- Update description. @Jason

 device-types/net/description.tex | 14 +++++++++++---
 1 file changed, 11 insertions(+), 3 deletions(-)
device-types/net/description.tex +11 -3
index 61cce1f..2764e04 100644
@@ -1803,6 +1803,14 @@ \subsubsection{Control Virtqueue}\label{sec:Device Types / Network Device / Devi
                                         for an enabled transmit/receive virtqueue whose index is \field{vq_index}.
 \end{enumerate}
 
+If the VIRTIO_NET_F_NOTF_COAL or VIRTIO_NET_F_VQ_NOTF_COAL feature is negotiated,
+the device may apply any coalescing parameters to each transmit/receive virtqueue
+before the driver successfully performs one of the VIRTIO_NET_CTRL_NOTF_COAL set commands.
+
+The driver can query the current coalescing parameters of any enabled transmit/receive
+virtqueue using the VIRTIO_NET_CTRL_NOTF_COAL_VQ_GET command, before or after any
+VIRTIO_NET_CTRL_NOTF_COAL set command is done.
+
 The device may generate notifications more or less frequently than specified by set commands of the VIRTIO_NET_CTRL_NOTF_COAL class.
 
 If coalescing parameters are being set, the device applies the last coalescing parameters set for a
@@ -1885,17 +1893,17 @@ \subsubsection{Control Virtqueue}\label{sec:Device Types / Network Device / Devi
 VIRTIO_NET_ERR if the designated virtqueue is not an enabled transmit or receive virtqueue.
 
 Upon disabling and re-enabling a transmit virtqueue, the device MUST set the coalescing parameters of the virtqueue
-to those configured through the VIRTIO_NET_CTRL_NOTF_COAL_TX_SET command, or, if the driver did not set any TX coalescing parameters, to 0.
+to those configured through the VIRTIO_NET_CTRL_NOTF_COAL_TX_SET command, or, if the driver did not set any TX coalescing parameters, the device MAY initialize them to any values.
 
 Upon disabling and re-enabling a receive virtqueue, the device MUST set the coalescing parameters of the virtqueue
-to those configured through the VIRTIO_NET_CTRL_NOTF_COAL_RX_SET command, or, if the driver did not set any RX coalescing parameters, to 0.
+to those configured through the VIRTIO_NET_CTRL_NOTF_COAL_RX_SET command, or, if the driver did not set any RX coalescing parameters, the device MAY initialize them to any values.
 
 The behavior of the device in response to set commands of the VIRTIO_NET_CTRL_NOTF_COAL class is best-effort:
 the device MAY generate notifications more or less frequently than specified.
 
 A device SHOULD NOT send used buffer notifications to the driver if the notifications are suppressed, even if the notification conditions are met.
 
-Upon reset, a device MUST initialize all coalescing parameters to 0.
+Upon reset, a device MAY set any coalescing parameters for all transmit and receive virtqueues.
 
 \paragraph{Device Statistics}\label{sec:Device Types / Network Device / Device Operation / Control Virtqueue / Device Statistics}
 
Signature · 1 line
2.32.0.3.g01195cf9f
Reviewed-by on v4 1/1
#1 lore raw
Quoted 44 lines

From: Heng Qi <[email protected]>
Sent: Thursday, May 23, 2024 3:28 PM

The device can set any initial coalescing parameters (0 or non-zero) for the receive/send queue before the setting command is executed, not just 0, enhancing device performance even without DIM enabled.

So we need to clarify descriptions that don't fit the behavior.

---
v3->v4:
- Doesn't force the device to remember more stuff. @Parav

v2->v3:
- Clarify description to be more generic. @Parav

v1->v2:
- Update description. @Jason

 device-types/net/description.tex | 14 +++++++++++---
 1 file changed, 11 insertions(+), 3 deletions(-)
device- renamed from device-types/net/description.tex +0 -0

types/net/description.tex
index 61cce1f..2764e04 100644

device-types/net/description.tex +0 -0
@@ -1803,6 +1803,14 @@ \subsubsection{Control

Virtqueue}\label{sec:Device Types / Network Device / Devi
for an enabled transmit/receive virtqueue whose index is
\field{vq_index}.
\end{enumerate}

+If the VIRTIO_NET_F_NOTF_COAL or VIRTIO_NET_F_VQ_NOTF_COAL feature is

device-types/net/description.tex +2 -0
+negotiated, the device may apply any coalescing parameters to each
+transmit/receive virtqueue before the driver successfully performs one of the

VIRTIO_NET_CTRL_NOTF_COAL set commands.

device-types/net/description.tex +3 -0
+
+The driver can query the current coalescing parameters of any enabled
+transmit/receive virtqueue using the
Quoted 4 lines

VIRTIO_NET_CTRL_NOTF_COAL_VQ_GET
+command, before or after any VIRTIO_NET_CTRL_NOTF_COAL set command is done.
+

The word "current" is not necessary here, but it fine.

Quoted 35 lines

The device may generate notifications more or less frequently than specified
by set commands of the VIRTIO_NET_CTRL_NOTF_COAL class.

If coalescing parameters are being set, the device applies the last coalescing
parameters set for a @@ -1885,17 +1893,17 @@ \subsubsection{Control Virtqueue}\label{sec:Device Types / Network Device / Devi VIRTIO_NET_ERR if the designated virtqueue is not an enabled transmit or receive virtqueue.

Upon disabling and re-enabling a transmit virtqueue, the device MUST set the
coalescing parameters of the virtqueue -to those configured through the VIRTIO_NET_CTRL_NOTF_COAL_TX_SET command, or, if the driver did not set any TX coalescing parameters, to 0.
+to those configured through the VIRTIO_NET_CTRL_NOTF_COAL_TX_SET command, or, if the driver did not set any TX coalescing parameters, the device MAY initialize them to any values.

Upon disabling and re-enabling a receive virtqueue, the device MUST set the
coalescing parameters of the virtqueue -to those configured through the VIRTIO_NET_CTRL_NOTF_COAL_RX_SET command, or, if the driver did not set any RX coalescing parameters, to 0.
+to those configured through the VIRTIO_NET_CTRL_NOTF_COAL_RX_SET command, or, if the driver did not set any RX coalescing parameters, the device MAY initialize them to any values.

The behavior of the device in response to set commands of the
VIRTIO_NET_CTRL_NOTF_COAL class is best-effort:
the device MAY generate notifications more or less frequently than specified.

A device SHOULD NOT send used buffer notifications to the driver if the
notifications are suppressed, even if the notification conditions are met.

device-types/net/description.tex +1 -1
-Upon reset, a device MUST initialize all coalescing parameters to 0.
+Upon reset, a device MAY set any coalescing parameters for all transmit and

receive virtqueues.

Quoted 5 lines

\paragraph{Device Statistics}\label{sec:Device Types / Network Device /
Device Operation / Control Virtqueue / Device Statistics}

--
2.32.0.3.g01195cf9f

author
#2 lore raw
Quoted 36 lines · Parav Pandit
Quoted 36 lines

From: Heng Qi <[email protected]>
Sent: Thursday, May 23, 2024 3:28 PM

The device can set any initial coalescing parameters (0 or non-zero) for the receive/send queue before the setting command is executed, not just 0, enhancing device performance even without DIM enabled.

So we need to clarify descriptions that don't fit the behavior.

---
v3->v4:
- Doesn't force the device to remember more stuff. @Parav

v2->v3:
- Clarify description to be more generic. @Parav

v1->v2:
- Update description. @Jason

 device-types/net/description.tex | 14 +++++++++++---
 1 file changed, 11 insertions(+), 3 deletions(-)
device- renamed from device-types/net/description.tex +0 -0

types/net/description.tex
index 61cce1f..2764e04 100644

device-types/net/description.tex +0 -0
@@ -1803,6 +1803,14 @@ \subsubsection{Control

Virtqueue}\label{sec:Device Types / Network Device / Devi
for an enabled transmit/receive virtqueue whose index is
\field{vq_index}.
\end{enumerate}

Quoted 13 lines
Quoted 8 lines

+If the VIRTIO_NET_F_NOTF_COAL or VIRTIO_NET_F_VQ_NOTF_COAL feature is

device-types/net/description.tex +2 -0
+negotiated, the device may apply any coalescing parameters to each
+transmit/receive virtqueue before the driver successfully performs one of the

VIRTIO_NET_CTRL_NOTF_COAL set commands.

device-types/net/description.tex +3 -0
+
+The driver can query the current coalescing parameters of any enabled
+transmit/receive virtqueue using the
Quoted 4 lines

VIRTIO_NET_CTRL_NOTF_COAL_VQ_GET
+command, before or after any VIRTIO_NET_CTRL_NOTF_COAL set command is done.
+

The word "current" is not necessary here, but it fine.

Ok.

Quoted 36 lines
Quoted 36 lines

The device may generate notifications more or less frequently than specified
by set commands of the VIRTIO_NET_CTRL_NOTF_COAL class.

If coalescing parameters are being set, the device applies the last coalescing
parameters set for a @@ -1885,17 +1893,17 @@ \subsubsection{Control Virtqueue}\label{sec:Device Types / Network Device / Devi VIRTIO_NET_ERR if the designated virtqueue is not an enabled transmit or receive virtqueue.

Upon disabling and re-enabling a transmit virtqueue, the device MUST set the
coalescing parameters of the virtqueue -to those configured through the VIRTIO_NET_CTRL_NOTF_COAL_TX_SET command, or, if the driver did not set any TX coalescing parameters, to 0.
+to those configured through the VIRTIO_NET_CTRL_NOTF_COAL_TX_SET command, or, if the driver did not set any TX coalescing parameters, the device MAY initialize them to any values.

Upon disabling and re-enabling a receive virtqueue, the device MUST set the
coalescing parameters of the virtqueue -to those configured through the VIRTIO_NET_CTRL_NOTF_COAL_RX_SET command, or, if the driver did not set any RX coalescing parameters, to 0.
+to those configured through the VIRTIO_NET_CTRL_NOTF_COAL_RX_SET command, or, if the driver did not set any RX coalescing parameters, the device MAY initialize them to any values.

The behavior of the device in response to set commands of the
VIRTIO_NET_CTRL_NOTF_COAL class is best-effort:
the device MAY generate notifications more or less frequently than specified.

A device SHOULD NOT send used buffer notifications to the driver if the
notifications are suppressed, even if the notification conditions are met.

device-types/net/description.tex +1 -1
-Upon reset, a device MUST initialize all coalescing parameters to 0.
+Upon reset, a device MAY set any coalescing parameters for all transmit and

receive virtqueues.

Quoted 8 lines
Quoted 5 lines

\paragraph{Device Statistics}\label{sec:Device Types / Network Device /
Device Operation / Control Virtqueue / Device Statistics}

--
2.32.0.3.g01195cf9f

Thanks!

Reviewed-by on v4 1/1
#3 lore raw
In reply to Heng Qi
Quoted 9 lines · Heng Qi

The device can set any initial coalescing parameters (0 or non-zero) for the receive/send queue before the setting command is executed, not just 0, enhancing device performance even without DIM enabled.

So we need to clarify descriptions that don't fit the behavior.

Thanks

Quoted 56 lines

---
v3->v4:
- Doesn't force the device to remember more stuff. @Parav

v2->v3:
- Clarify description to be more generic. @Parav

v1->v2:
- Update description. @Jason

 device-types/net/description.tex | 14 +++++++++++---
 1 file changed, 11 insertions(+), 3 deletions(-)
device-types/net/description.tex +11 -4
index 61cce1f..2764e04 100644
@@ -1803,6 +1803,14 @@ \subsubsection{Control Virtqueue}\label{sec:Device Types / Network Device / Devi
                                         for an enabled transmit/receive virtqueue whose index is \field{vq_index}.
 \end{enumerate}
 
+If the VIRTIO_NET_F_NOTF_COAL or VIRTIO_NET_F_VQ_NOTF_COAL feature is negotiated,
+the device may apply any coalescing parameters to each transmit/receive virtqueue
+before the driver successfully performs one of the VIRTIO_NET_CTRL_NOTF_COAL set commands.
+
+The driver can query the current coalescing parameters of any enabled transmit/receive
+virtqueue using the VIRTIO_NET_CTRL_NOTF_COAL_VQ_GET command, before or after any
+VIRTIO_NET_CTRL_NOTF_COAL set command is done.
+
 The device may generate notifications more or less frequently than specified by set commands of the VIRTIO_NET_CTRL_NOTF_COAL class.
 
 If coalescing parameters are being set, the device applies the last coalescing parameters set for a
@@ -1885,17 +1893,17 @@ \subsubsection{Control Virtqueue}\label{sec:Device Types / Network Device / Devi
 VIRTIO_NET_ERR if the designated virtqueue is not an enabled transmit or receive virtqueue.
 
 Upon disabling and re-enabling a transmit virtqueue, the device MUST set the coalescing parameters of the virtqueue
-to those configured through the VIRTIO_NET_CTRL_NOTF_COAL_TX_SET command, or, if the driver did not set any TX coalescing parameters, to 0.
+to those configured through the VIRTIO_NET_CTRL_NOTF_COAL_TX_SET command, or, if the driver did not set any TX coalescing parameters, the device MAY initialize them to any values.
 
 Upon disabling and re-enabling a receive virtqueue, the device MUST set the coalescing parameters of the virtqueue
-to those configured through the VIRTIO_NET_CTRL_NOTF_COAL_RX_SET command, or, if the driver did not set any RX coalescing parameters, to 0.
+to those configured through the VIRTIO_NET_CTRL_NOTF_COAL_RX_SET command, or, if the driver did not set any RX coalescing parameters, the device MAY initialize them to any values.
 
 The behavior of the device in response to set commands of the VIRTIO_NET_CTRL_NOTF_COAL class is best-effort:
 the device MAY generate notifications more or less frequently than specified.
 
 A device SHOULD NOT send used buffer notifications to the driver if the notifications are suppressed, even if the notification conditions are met.
 
-Upon reset, a device MUST initialize all coalescing parameters to 0.
+Upon reset, a device MAY set any coalescing parameters for all transmit and receive virtqueues.
 
 \paragraph{Device Statistics}\label{sec:Device Types / Network Device / Device Operation / Control Virtqueue / Device Statistics}
 
--

2.32.0.3.g01195cf9f