Skip to contentSkip to conversation

virtio-net: support the virtqueue coalescing moderation

PATCH Superseded Heng Qi 4 participants 39 messages Feb 10, 2023 – Feb 13, 2023

v2 of 14 Superseded Latest is v14 →

lore
Share & tools
lore

Heng Qi

author
#0 lore raw

PATCH v2 1/1 virtio-net: support the virtqueue coalescing moderation

Currently, the coalescing profile is directly applied to all queues. This patch supports setting or getting the parameters for a specified queue, and a typical application of this function is NetDIM.

When the traffic between queues is unbalanced, for example, one queue is busy and another queue is idle, then it will be very useful to control coalescing parameters at the queue granularity.

---
v1->v2:
1. Rename VIRTIO_NET_F_PERQUEUE_NOTF_COAL to VIRTIO_NET_F_VQ_NOTF_COAL. @Michael S. Tsirkin
2. Use the \field{vqn} instead of the qid. @Michael S. Tsirkin
3. Unify tx and rx control structres into one structure virtio_net_ctrl_coal_vq. @Michael S. Tsirkin
4. Add a new control command VIRTIO_NET_CTRL_NOTF_COAL_VQ. @Michael S. Tsirkin, @Parav Pandit, @Alvaro Karsz
5. The special value 0xFFF is removed because VIRTIO_NET_CTRL_NOTF_COAL can be used. @Alvaro Karsz
6. Clarify some special scenarios. @Michael S. Tsirkin, @Parav Pandit, @Alvaro Karsz

 content.tex | 69 ++++++++++++++++++++++++++++++++++++++++++++++++++++-
 1 file changed, 68 insertions(+), 1 deletion(-)
content.tex +68 -1
index e863709..2c497e1 100644
@@ -3084,6 +3084,9 @@ \subsection{Feature bits}\label{sec:Device Types / Network Device / Feature bits
 \item[VIRTIO_NET_F_CTRL_MAC_ADDR(23)] Set MAC address through control
     channel.
 
+\item[VIRTIO_NET_F_VQ_NOTF_COAL(52)] Device supports the virtqueue
+    notifications coalescing.
+
 \item[VIRTIO_NET_F_NOTF_COAL(53)] Device supports notifications coalescing.
 
 \item[VIRTIO_NET_F_GUEST_USO4 (54)] Driver can receive USOv4 packets.
@@ -3140,6 +3143,7 @@ \subsubsection{Feature bit requirements}\label{sec:Device Types / Network Device
 \item[VIRTIO_NET_F_NOTF_COAL] Requires VIRTIO_NET_F_CTRL_VQ.
 \item[VIRTIO_NET_F_RSC_EXT] Requires VIRTIO_NET_F_HOST_TSO4 or VIRTIO_NET_F_HOST_TSO6.
 \item[VIRTIO_NET_F_RSS] Requires VIRTIO_NET_F_CTRL_VQ.
+\item[VIRTIO_NET_F_VQ_NOTF_COAL] Requires VIRTIO_NET_F_CTRL_VQ and VIRTIO_NET_F_NOTF_COAL.
 \end{description}
 
 \subsubsection{Legacy Interface: Feature bits}\label{sec:Device Types / Network Device / Feature bits / Legacy Interface: Feature bits}
@@ -4520,6 +4524,49 @@ \subsubsection{Control Virtqueue}\label{sec:Device Types / Network Device / Devi
 \item VIRTIO_NET_CTRL_NOTF_COAL_RX_SET: set the \field{rx_usecs} and \field{rx_max_packets} parameters.
 \end{enumerate}
 
+If additionally VIRTIO_NET_F_VQ_NOTF_COAL is negotiated, the driver can send
+control commands to set or get the coalescing parameters of a specified
+virtqueue (excluding the control virtqueue).
+
+\begin{lstlisting}
+struct virtio_net_ctrl_coal_vq {
+    le32 max_packets;
+    le32 usecs;
+    le16 vqn;
+};
+
+#define VIRTIO_NET_CTRL_NOTF_COAL_VQ 7
+ #define VIRTIO_NET_CTRL_NOTF_COAL_VQ_SET 0
+ #define VIRTIO_NET_CTRL_NOTF_COAL_VQ_GET 1
+\end{lstlisting}
+
+Virtqueue coalescing parameters:
+\begin{itemize}
+\item \field{max_packets}: The maximum number of packets sent/received by the
+    specified virtqueue before a TX/RX notification.
+\item \field{usecs}: The maximum number of TX/RX usecs that the specified
+    virtqueue delays a TX/RX notification.
+\item \field{vqn}: The virtqueue number of the specified virtqueue.
+\end{itemize}
+
+The range of \filed{vqn} is between 0 and 0xFFFF inclusive, $ \lfloor vqn / 2 \rfloor $
+is the index of the corresponding receiveq, and $\lfloor (vqn / 2) + 1 \rfloor $ is
+the corresponding tranmitq.
+
+The VIRTIO_NET_CTRL_NOTF_COAL_RX_SET command is the same as calling VIRTIO_NET_CTRL_NOTF_COAL_VQ
+for virtqueues corresponding to all receiveqs.
+
+The VIRTIO_NET_CTRL_NOTF_COAL_TX_SET command is the same as calling VIRTIO_NET_CTRL_NOTF_COAL_VQ
+for virtqueues corresponding to all transmitqs.
+
+Virtqueue coalescing will be disabled if all parameters are set to 0.
+
+The class VIRTIO_NET_CTRL_NOTF_COAL_VQ has 2 commands:
+\begin{enumerate}
+\item VIRTIO_NET_CTRL_NOTF_COAL_VQ_SET: set the \field{max_packets}, \field{usecs} and \filed{vqn} parameters.
+\item VIRTIO_NET_CTRL_NOTF_COAL_VQ_GET: get the \field{max_packets}, \field{usecs} and \field{vqn} parameters.
+\end{enumerate}
+
 \subparagraph{RX Notifications}\label{sec:Device Types / Network Device / Device Operation / Control Virtqueue / Notifications Coalescing / RX Notifications}
 
 If, for example:
@@ -4535,6 +4582,15 @@ \subsubsection{Control Virtqueue}\label{sec:Device Types / Network Device / Devi
 \item If the notifications are not suppressed by the driver, the device will send an used buffer notification, otherwise, the device will not send an used buffer notification as long as the notifications are suppressed.
 \end{itemize}
 
+If, example of setting coalescing parameters for a receive virtqueue:
+\begin{itemize}
+\item \field{max_packets} = 15.
+\item \field{usecs} = 10.
+\item \field{vqn} = 0;
+\end{itemize}
+
+The device will only operate on recieveq1 as VIRTIO_NET_CTRL_NOTF_COAL_RX_SET.
+
 \subparagraph{TX Notifications}\label{sec:Device Types / Network Device / Device Operation / Control Virtqueue / Notifications Coalescing / TX Notifications}
 
 If, for example:
@@ -4550,13 +4606,24 @@ \subsubsection{Control Virtqueue}\label{sec:Device Types / Network Device / Devi
 \item If the notifications are not suppressed by the driver, the device will send an used buffer notification, otherwise, the device will not send an used buffer notification as long as the notifications are suppressed.
 \end{itemize}
 
+If, example of setting coalescing parameters for a transmit virtqueue:
+\begin{itemize}
+\item \field{max_packets} = 15.
+\item \field{usecs} = 10.
+\item \field{vqn} = 1;
+\end{itemize}
+
+The device will only operate on transmitq1 as VIRTIO_NET_CTRL_NOTF_COAL_TX_SET.
+
 \drivernormative{\subparagraph}{Notifications Coalescing}{Device Types / Network Device / Device Operation / Control Virtqueue / Notifications Coalescing}
 
 If the VIRTIO_NET_F_NOTF_COAL feature has not been negotiated, the driver MUST NOT issue VIRTIO_NET_CTRL_NOTF_COAL commands.
+If the VIRTIO_NET_F_VQ_NOTF_COAL feature has not been negotiated, the driver MUST NOT issue VIRTIO_NET_CTRL_NOFT_COAL_VQ commands.
 
 \devicenormative{\subparagraph}{Notifications Coalescing}{Device Types / Network Device / Device Operation / Control Virtqueue / Notifications Coalescing}
 
-A device SHOULD respond to the VIRTIO_NET_CTRL_NOTF_COAL commands with VIRTIO_NET_ERR if it was not able to change the parameters.
+A device SHOULD respond to the VIRTIO_NET_CTRL_NOTF_COAL commands with VIRTIO_NET_ERR if it was not able to change the parameters or
+was not able to find a virtqueue using the \field{vqn}.
 
 A device SHOULD NOT send used buffer notifications to the driver, if the notifications are suppressed as explained in \ref{sec:Basic Facilities of a Virtio Device / Virtqueues / Used Buffer Notification Suppression}, even if the coalescing counters expired.
 
Signature · 18 lines
2.19.1.6.gb485710b


This publicly archived list offers a means to provide input to the
OASIS Virtual I/O Device (VIRTIO) TC.

In order to verify user consent to the Feedback License terms and
to minimize spam in the list archive, subscription is required
before posting.

Subscribe: [email protected]
Unsubscribe: [email protected]
List help: [email protected]
List archive: https://lists.oasis-open.org/archives/virtio-comment/
Feedback License: https://www.oasis-open.org/who/ipr/feedback_license.pdf
List Guidelines: https://www.oasis-open.org/policies-guidelines/mailing-lists
Committee: https://www.oasis-open.org/committees/virtio/
Join OASIS: https://www.oasis-open.org/join/
#1 lore raw
Quoted 10 lines · Heng Qi

Currently, the coalescing profile is directly applied to all queues. This patch supports setting or getting the parameters for a specified queue, and a typical application of this function is NetDIM.

When the traffic between queues is unbalanced, for example, one queue is busy and another queue is idle, then it will be very useful to control coalescing parameters at the queue granularity.

I like this generally, thanks! Language needs to be tightened a bit.

Quoted 37 lines

---
v1->v2:
1. Rename VIRTIO_NET_F_PERQUEUE_NOTF_COAL to VIRTIO_NET_F_VQ_NOTF_COAL. @Michael S. Tsirkin
2. Use the \field{vqn} instead of the qid. @Michael S. Tsirkin
3. Unify tx and rx control structres into one structure virtio_net_ctrl_coal_vq. @Michael S. Tsirkin
4. Add a new control command VIRTIO_NET_CTRL_NOTF_COAL_VQ. @Michael S. Tsirkin, @Parav Pandit, @Alvaro Karsz
5. The special value 0xFFF is removed because VIRTIO_NET_CTRL_NOTF_COAL can be used. @Alvaro Karsz
6. Clarify some special scenarios. @Michael S. Tsirkin, @Parav Pandit, @Alvaro Karsz

 content.tex | 69 ++++++++++++++++++++++++++++++++++++++++++++++++++++-
 1 file changed, 68 insertions(+), 1 deletion(-)
content.tex +4 -0
index e863709..2c497e1 100644
@@ -3084,6 +3084,9 @@ \subsection{Feature bits}\label{sec:Device Types / Network Device / Feature bits
 \item[VIRTIO_NET_F_CTRL_MAC_ADDR(23)] Set MAC address through control
     channel.
 
+\item[VIRTIO_NET_F_VQ_NOTF_COAL(52)] Device supports the virtqueue
+    notifications coalescing.
+
 \item[VIRTIO_NET_F_NOTF_COAL(53)] Device supports notifications coalescing.
 
 \item[VIRTIO_NET_F_GUEST_USO4 (54)] Driver can receive USOv4 packets.
@@ -3140,6 +3143,7 @@ \subsubsection{Feature bit requirements}\label{sec:Device Types / Network Device
 \item[VIRTIO_NET_F_NOTF_COAL] Requires VIRTIO_NET_F_CTRL_VQ.
 \item[VIRTIO_NET_F_RSC_EXT] Requires VIRTIO_NET_F_HOST_TSO4 or VIRTIO_NET_F_HOST_TSO6.
 \item[VIRTIO_NET_F_RSS] Requires VIRTIO_NET_F_CTRL_VQ.
+\item[VIRTIO_NET_F_VQ_NOTF_COAL] Requires VIRTIO_NET_F_CTRL_VQ and VIRTIO_NET_F_NOTF_COAL.
 \end{description}
 
 \subsubsection{Legacy Interface: Feature bits}\label{sec:Device Types / Network Device / Feature bits / Legacy Interface: Feature bits}
@@ -4520,6 +4524,49 @@ \subsubsection{Control Virtqueue}\label{sec:Device Types / Network Device / Devi
 \item VIRTIO_NET_CTRL_NOTF_COAL_RX_SET: set the \field{rx_usecs} and \field{rx_max_packets} parameters.
 \end{enumerate}

content.tex \subsubsection{Control Virtqueue}\label{sec:Device Types / Network Device / Devi · line 4535

Quoted 10 lines
content.tex +9 -0
 
+If additionally VIRTIO_NET_F_VQ_NOTF_COAL is negotiated, the driver can send
+control commands to set or get the coalescing parameters of a specified
+virtqueue (excluding the control virtqueue).
+
+\begin{lstlisting}
+struct virtio_net_ctrl_coal_vq {
+    le32 max_packets;
+    le32 usecs;
+    le16 vqn;

Add le16 reserved here, so keep things aligned naturally. In fact if you want to support GET you need to re-order things since write buffers come before read buffers:

+ le16 vqn;
+ le16 reserved;

+ le32 max_packets;
+ le32 usecs;

see below for more explanation.

Quoted 7 lines
content.tex +7 -0
+};
+
+#define VIRTIO_NET_CTRL_NOTF_COAL_VQ 7
+ #define VIRTIO_NET_CTRL_NOTF_COAL_VQ_SET 0
+ #define VIRTIO_NET_CTRL_NOTF_COAL_VQ_GET 1
+\end{lstlisting}
+

content.tex \subsubsection{Control Virtqueue}\label{sec:Device Types / Network Device / Devi

Quoted 10 lines
content.tex +10 -0
+Virtqueue coalescing parameters:
+\begin{itemize}
+\item \field{max_packets}: The maximum number of packets sent/received by the
+    specified virtqueue before a TX/RX notification.
+\item \field{usecs}: The maximum number of TX/RX usecs that the specified
+    virtqueue delays a TX/RX notification.
+\item \field{vqn}: The virtqueue number of the specified virtqueue.
+\end{itemize}
+
+The range of \filed{vqn} is between 0 and 0xFFFF inclusive,

No really because last vq is a cvq. Maybe just drop this?

content.tex \subsubsection{Control Virtqueue}\label{sec:Device Types / Network Device / Devi · line 4556

Quoted 5 lines
$ \lfloor vqn / 2 \rfloor $
content.tex +4 -0
+is the index of the corresponding receiveq, and $\lfloor (vqn / 2) + 1 \rfloor $ is
+the corresponding tranmitq.
+
+The VIRTIO_NET_CTRL_NOTF_COAL_RX_SET command is the same as calling VIRTIO_NET_CTRL_NOTF_COAL_VQ

you don't "call" commands. driver sends them, device receives them. But here you are talking about a command abstracty so I'd just drop a verb, or maybe "repeating".
And "same" is inexact in that it's not the same - takes more time - it just has the same effect, or is equivalent to.

Quoted 1 line

+for virtqueues corresponding to all receiveqs.

receiveqs is confusing.

Also elsewhere we use the language receiveq1\ldots receiveqn which seems clearer. Also you can not call VIRTIO_NET_CTRL_NOTF_COAL_VQ for all vqs - it applies to one vq only. You mean each.
And virtqueues do not correspond to receiveqs - they
are receiveqs. If you like vqn corresponds to them.
Or better just "same as VIRTIO_NET_CTRL_NOTF_COAL_VQ repeated for each of receiveq1\ldots receiveqn"

content.tex \subsubsection{Control Virtqueue}\label{sec:Device Types / Network Device / Devi · line 4562

Quoted 5 lines
content.tex +5 -0
+
+The VIRTIO_NET_CTRL_NOTF_COAL_TX_SET command is the same as calling VIRTIO_NET_CTRL_NOTF_COAL_VQ
+for virtqueues corresponding to all transmitqs.
+
+Virtqueue coalescing will be disabled if all parameters are set to 0.

In fact, either usecs 0 or max_packets disables coalescing, no?

content.tex \subsubsection{Control Virtqueue}\label{sec:Device Types / Network Device / Devi · line 4567

Quoted 5 lines
content.tex +5 -0
+
+The class VIRTIO_NET_CTRL_NOTF_COAL_VQ has 2 commands:
+\begin{enumerate}
+\item VIRTIO_NET_CTRL_NOTF_COAL_VQ_SET: set the \field{max_packets}, \field{usecs} and \filed{vqn} parameters.
+\item VIRTIO_NET_CTRL_NOTF_COAL_VQ_GET: get the \field{max_packets}, \field{usecs} and \field{vqn} parameters.

How does VIRTIO_NET_CTRL_NOTF_COAL_VQ_GET work then? For which vq? I think you mean vqn is specified and you get back max_packets and usecs. All this needs to be documented fully for each command.

I would also think it's a good idea to mention that VQ_GET does not have to return exactly the same parameters - since it's best effort anyway, it's ok for device to round down and store a smaller value for either max_packets or usecs, e.g. to save space.

This kind of formalizes the best effort thing we discussed previously.

Maybe make VIRTIO_NET_CTRL_NOTF_COAL_VQ_GET a separate patch - in the series,
at this point you did not make any effort to document it, it needs more work.

content.tex \subsubsection{Control Virtqueue}\label{sec:Device Types / Network Device / Devi · line 4585

Quoted 10 lines

+\end{enumerate}

content.tex +2 -0
+
 \subparagraph{RX Notifications}\label{sec:Device Types / Network Device / Device Operation / Control Virtqueue / Notifications Coalescing / RX Notifications}
 
 If, for example:
@@ -4535,6 +4582,15 @@ \subsubsection{Control Virtqueue}\label{sec:Device Types / Network Device / Devi
 \item If the notifications are not suppressed by the driver, the device will send an used buffer notification, otherwise, the device will not send an used buffer notification as long as the notifications are suppressed.
 \end{itemize}
 
+If, example of setting coalescing parameters for a receive virtqueue:

"If" without "then" is confusing. I'd just start with "Example".

content.tex \subsubsection{Control Virtqueue}\label{sec:Device Types / Network Device / Devi · line 4589

Quoted 4 lines
content.tex +4 -0
+\begin{itemize}
+\item \field{max_packets} = 15.
+\item \field{usecs} = 10.
+\item \field{vqn} = 0;

why . above and ; here? I would just drop punctuation.

content.tex \subsubsection{Control Virtqueue}\label{sec:Device Types / Network Device / Devi · line 4592

Quoted 3 lines
content.tex +3 -0
+\end{itemize}
+
+The device will only operate on recieveq1 as VIRTIO_NET_CTRL_NOTF_COAL_RX_SET.

This really does not explain anything. Please just document exactly what it does and does not do.

Quoted 7 lines
content.tex +1 -0
+
 \subparagraph{TX Notifications}\label{sec:Device Types / Network Device / Device Operation / Control Virtqueue / Notifications Coalescing / TX Notifications}
 
 If, for example:
@@ -4550,13 +4606,24 @@ \subsubsection{Control Virtqueue}\label{sec:Device Types / Network Device / Devi
 \item If the notifications are not suppressed by the driver, the device will send an used buffer notification, otherwise, the device will not send an used buffer notification as long as the notifications are suppressed.
 \end{itemize}

content.tex \subsubsection{Control Virtqueue}\label{sec:Device Types / Network Device / Devi · line 4617

Quoted 10 lines
content.tex +9 -0
 
+If, example of setting coalescing parameters for a transmit virtqueue:
+\begin{itemize}
+\item \field{max_packets} = 15.
+\item \field{usecs} = 10.
+\item \field{vqn} = 1;
+\end{itemize}
+
+The device will only operate on transmitq1 as VIRTIO_NET_CTRL_NOTF_COAL_TX_SET.
+

I feel it's the other way around. Document

content.tex \subsubsection{Control Virtqueue}\label{sec:Device Types / Network Device / Devi · line 4622

Quoted 5 lines
content.tex +1 -0
 \drivernormative{\subparagraph}{Notifications Coalescing}{Device Types / Network Device / Device Operation / Control Virtqueue / Notifications Coalescing}
 
 If the VIRTIO_NET_F_NOTF_COAL feature has not been negotiated, the driver MUST NOT issue VIRTIO_NET_CTRL_NOTF_COAL commands.
+If the VIRTIO_NET_F_VQ_NOTF_COAL feature has not been negotiated, the driver MUST NOT issue VIRTIO_NET_CTRL_NOFT_COAL_VQ commands.
 

Don't we want to limit driver to legal values of vqn?

content.tex \subsubsection{Control Virtqueue}\label{sec:Device Types / Network Device / Devi · line 4626

Quoted 5 lines
content.tex +2 -1
 \devicenormative{\subparagraph}{Notifications Coalescing}{Device Types / Network Device / Device Operation / Control Virtqueue / Notifications Coalescing}
 
-A device SHOULD respond to the VIRTIO_NET_CTRL_NOTF_COAL commands with VIRTIO_NET_ERR if it was not able to change the parameters.
+A device SHOULD respond to the VIRTIO_NET_CTRL_NOTF_COAL commands with VIRTIO_NET_ERR if it was not able to change the parameters or
+was not able to find a virtqueue using the \field{vqn}.

First please create multiple statements not a single long one. Second vqn only exists for per vq commands so create a statement just for that.
Also more explicit please. What does this mean? I suspect that vq was not enabled?
Also, we MUST have vqn < max_virtqueue_pairs.

Quoted 5 lines
content.tex +0 -0
 A device SHOULD NOT send used buffer notifications to the driver, if the notifications are suppressed as explained in \ref{sec:Basic Facilities of a Virtio Device / Virtqueues / Used Buffer Notification Suppression}, even if the coalescing counters expired.
 
Signature · 1 line
2.19.1.6.gb485710b

This publicly archived list offers a means to provide input to the OASIS Virtual I/O Device (VIRTIO) TC.

In order to verify user consent to the Feedback License terms and to minimize spam in the list archive, subscription is required before posting.

Subscribe: [email protected]
Unsubscribe: [email protected]
List help: [email protected]
List archive: https://lists.oasis-open.org/archives/virtio-comment/
Feedback License: https://www.oasis-open.org/who/ipr/feedback_license.pdf
List Guidelines: https://www.oasis-open.org/policies-guidelines/mailing-lists
Committee: https://www.oasis-open.org/committees/virtio/
Join OASIS: https://www.oasis-open.org/join/

#2 lore raw
Quoted 216 lines · Heng Qi
Quoted 10 lines

Currently, the coalescing profile is directly applied to all queues. This patch supports setting or getting the parameters for a specified queue, and a typical application of this function is NetDIM.

When the traffic between queues is unbalanced, for example, one queue is busy and another queue is idle, then it will be very useful to control coalescing parameters at the queue granularity.

I like this generally, thanks! Language needs to be tightened a bit.

Quoted 37 lines

---
v1->v2:
1. Rename VIRTIO_NET_F_PERQUEUE_NOTF_COAL to VIRTIO_NET_F_VQ_NOTF_COAL. @Michael S. Tsirkin
2. Use the \field{vqn} instead of the qid. @Michael S. Tsirkin
3. Unify tx and rx control structres into one structure virtio_net_ctrl_coal_vq. @Michael S. Tsirkin
4. Add a new control command VIRTIO_NET_CTRL_NOTF_COAL_VQ. @Michael S. Tsirkin, @Parav Pandit, @Alvaro Karsz
5. The special value 0xFFF is removed because VIRTIO_NET_CTRL_NOTF_COAL can be used. @Alvaro Karsz
6. Clarify some special scenarios. @Michael S. Tsirkin, @Parav Pandit, @Alvaro Karsz

 content.tex | 69 ++++++++++++++++++++++++++++++++++++++++++++++++++++-
 1 file changed, 68 insertions(+), 1 deletion(-)
content.tex +4 -0
index e863709..2c497e1 100644
@@ -3084,6 +3084,9 @@ \subsection{Feature bits}\label{sec:Device Types / Network Device / Feature bits
 \item[VIRTIO_NET_F_CTRL_MAC_ADDR(23)] Set MAC address through control
     channel.
 
+\item[VIRTIO_NET_F_VQ_NOTF_COAL(52)] Device supports the virtqueue
+    notifications coalescing.
+
 \item[VIRTIO_NET_F_NOTF_COAL(53)] Device supports notifications coalescing.
 
 \item[VIRTIO_NET_F_GUEST_USO4 (54)] Driver can receive USOv4 packets.
@@ -3140,6 +3143,7 @@ \subsubsection{Feature bit requirements}\label{sec:Device Types / Network Device
 \item[VIRTIO_NET_F_NOTF_COAL] Requires VIRTIO_NET_F_CTRL_VQ.
 \item[VIRTIO_NET_F_RSC_EXT] Requires VIRTIO_NET_F_HOST_TSO4 or VIRTIO_NET_F_HOST_TSO6.
 \item[VIRTIO_NET_F_RSS] Requires VIRTIO_NET_F_CTRL_VQ.
+\item[VIRTIO_NET_F_VQ_NOTF_COAL] Requires VIRTIO_NET_F_CTRL_VQ and VIRTIO_NET_F_NOTF_COAL.
 \end{description}
 
 \subsubsection{Legacy Interface: Feature bits}\label{sec:Device Types / Network Device / Feature bits / Legacy Interface: Feature bits}
@@ -4520,6 +4524,49 @@ \subsubsection{Control Virtqueue}\label{sec:Device Types / Network Device / Devi
 \item VIRTIO_NET_CTRL_NOTF_COAL_RX_SET: set the \field{rx_usecs} and \field{rx_max_packets} parameters.
 \end{enumerate}

content.tex \subsubsection{Control Virtqueue}\label{sec:Device Types / Network Device / Devi · line 4535

Quoted 10 lines
content.tex +9 -0
 
+If additionally VIRTIO_NET_F_VQ_NOTF_COAL is negotiated, the driver can send
+control commands to set or get the coalescing parameters of a specified
+virtqueue (excluding the control virtqueue).
+
+\begin{lstlisting}
+struct virtio_net_ctrl_coal_vq {
+    le32 max_packets;
+    le32 usecs;
+    le16 vqn;

Add le16 reserved here, so keep things aligned naturally. In fact if you want to support GET you need to re-order things since write buffers come before read buffers:

+ le16 vqn;
+ le16 reserved;

+ le32 max_packets;
+ le32 usecs;

see below for more explanation.

Quoted 7 lines
content.tex +7 -0
+};
+
+#define VIRTIO_NET_CTRL_NOTF_COAL_VQ 7
+ #define VIRTIO_NET_CTRL_NOTF_COAL_VQ_SET 0
+ #define VIRTIO_NET_CTRL_NOTF_COAL_VQ_GET 1
+\end{lstlisting}
+

content.tex \subsubsection{Control Virtqueue}\label{sec:Device Types / Network Device / Devi

Quoted 10 lines
content.tex +10 -0
+Virtqueue coalescing parameters:
+\begin{itemize}
+\item \field{max_packets}: The maximum number of packets sent/received by the
+    specified virtqueue before a TX/RX notification.
+\item \field{usecs}: The maximum number of TX/RX usecs that the specified
+    virtqueue delays a TX/RX notification.
+\item \field{vqn}: The virtqueue number of the specified virtqueue.
+\end{itemize}
+
+The range of \filed{vqn} is between 0 and 0xFFFF inclusive,

No really because last vq is a cvq. Maybe just drop this?

content.tex \subsubsection{Control Virtqueue}\label{sec:Device Types / Network Device / Devi · line 4556

Quoted 5 lines
$ \lfloor vqn / 2 \rfloor $
content.tex +4 -0
+is the index of the corresponding receiveq, and $\lfloor (vqn / 2) + 1 \rfloor $ is
+the corresponding tranmitq.
+
+The VIRTIO_NET_CTRL_NOTF_COAL_RX_SET command is the same as calling VIRTIO_NET_CTRL_NOTF_COAL_VQ

you don't "call" commands. driver sends them, device receives them. But here you are talking about a command abstracty so I'd just drop a verb, or maybe "repeating".
And "same" is inexact in that it's not the same - takes more time - it just has the same effect, or is equivalent to.

Quoted 1 line

+for virtqueues corresponding to all receiveqs.

receiveqs is confusing.

Also elsewhere we use the language receiveq1\ldots receiveqn which seems clearer. Also you can not call VIRTIO_NET_CTRL_NOTF_COAL_VQ for all vqs - it applies to one vq only. You mean each.
And virtqueues do not correspond to receiveqs - they
are receiveqs. If you like vqn corresponds to them.
Or better just "same as VIRTIO_NET_CTRL_NOTF_COAL_VQ repeated for each of receiveq1\ldots receiveqn"

content.tex \subsubsection{Control Virtqueue}\label{sec:Device Types / Network Device / Devi · line 4562

Quoted 5 lines
content.tex +5 -0
+
+The VIRTIO_NET_CTRL_NOTF_COAL_TX_SET command is the same as calling VIRTIO_NET_CTRL_NOTF_COAL_VQ
+for virtqueues corresponding to all transmitqs.
+
+Virtqueue coalescing will be disabled if all parameters are set to 0.

In fact, either usecs 0 or max_packets disables coalescing, no?

content.tex \subsubsection{Control Virtqueue}\label{sec:Device Types / Network Device / Devi · line 4567

Quoted 5 lines
content.tex +5 -0
+
+The class VIRTIO_NET_CTRL_NOTF_COAL_VQ has 2 commands:
+\begin{enumerate}
+\item VIRTIO_NET_CTRL_NOTF_COAL_VQ_SET: set the \field{max_packets}, \field{usecs} and \filed{vqn} parameters.
+\item VIRTIO_NET_CTRL_NOTF_COAL_VQ_GET: get the \field{max_packets}, \field{usecs} and \field{vqn} parameters.

How does VIRTIO_NET_CTRL_NOTF_COAL_VQ_GET work then? For which vq? I think you mean vqn is specified and you get back max_packets and usecs. All this needs to be documented fully for each command.

I would also think it's a good idea to mention that VQ_GET does not have to return exactly the same parameters - since it's best effort anyway, it's ok for device to round down and store a smaller value for either max_packets or usecs, e.g. to save space.

This kind of formalizes the best effort thing we discussed previously.

Maybe make VIRTIO_NET_CTRL_NOTF_COAL_VQ_GET a separate patch - in the series,
at this point you did not make any effort to document it, it needs more work.

content.tex \subsubsection{Control Virtqueue}\label{sec:Device Types / Network Device / Devi · line 4585

Quoted 10 lines

+\end{enumerate}

content.tex +2 -0
+
 \subparagraph{RX Notifications}\label{sec:Device Types / Network Device / Device Operation / Control Virtqueue / Notifications Coalescing / RX Notifications}
 
 If, for example:
@@ -4535,6 +4582,15 @@ \subsubsection{Control Virtqueue}\label{sec:Device Types / Network Device / Devi
 \item If the notifications are not suppressed by the driver, the device will send an used buffer notification, otherwise, the device will not send an used buffer notification as long as the notifications are suppressed.
 \end{itemize}
 
+If, example of setting coalescing parameters for a receive virtqueue:

"If" without "then" is confusing. I'd just start with "Example".

content.tex \subsubsection{Control Virtqueue}\label{sec:Device Types / Network Device / Devi · line 4589

Quoted 4 lines
content.tex +4 -0
+\begin{itemize}
+\item \field{max_packets} = 15.
+\item \field{usecs} = 10.
+\item \field{vqn} = 0;

why . above and ; here? I would just drop punctuation.

content.tex \subsubsection{Control Virtqueue}\label{sec:Device Types / Network Device / Devi · line 4592

Quoted 3 lines
content.tex +3 -0
+\end{itemize}
+
+The device will only operate on recieveq1 as VIRTIO_NET_CTRL_NOTF_COAL_RX_SET.

This really does not explain anything. Please just document exactly what it does and does not do.

Quoted 7 lines
content.tex +1 -0
+
 \subparagraph{TX Notifications}\label{sec:Device Types / Network Device / Device Operation / Control Virtqueue / Notifications Coalescing / TX Notifications}
 
 If, for example:
@@ -4550,13 +4606,24 @@ \subsubsection{Control Virtqueue}\label{sec:Device Types / Network Device / Devi
 \item If the notifications are not suppressed by the driver, the device will send an used buffer notification, otherwise, the device will not send an used buffer notification as long as the notifications are suppressed.
 \end{itemize}

content.tex \subsubsection{Control Virtqueue}\label{sec:Device Types / Network Device / Devi · line 4617

Quoted 10 lines
content.tex +9 -0
 
+If, example of setting coalescing parameters for a transmit virtqueue:
+\begin{itemize}
+\item \field{max_packets} = 15.
+\item \field{usecs} = 10.
+\item \field{vqn} = 1;
+\end{itemize}
+
+The device will only operate on transmitq1 as VIRTIO_NET_CTRL_NOTF_COAL_TX_SET.
+

I feel it's the other way around. Document

content.tex \subsubsection{Control Virtqueue}\label{sec:Device Types / Network Device / Devi · line 4622

Quoted 5 lines
content.tex +1 -0
 \drivernormative{\subparagraph}{Notifications Coalescing}{Device Types / Network Device / Device Operation / Control Virtqueue / Notifications Coalescing}
 
 If the VIRTIO_NET_F_NOTF_COAL feature has not been negotiated, the driver MUST NOT issue VIRTIO_NET_CTRL_NOTF_COAL commands.
+If the VIRTIO_NET_F_VQ_NOTF_COAL feature has not been negotiated, the driver MUST NOT issue VIRTIO_NET_CTRL_NOFT_COAL_VQ commands.
 

Don't we want to limit driver to legal values of vqn?

Quoted 2 lines
content.tex +0 -0
 \devicenormative{\subparagraph}{Notifications Coalescing}{Device Types / Network Device / Device Operation / Control Virtqueue / Notifications Coalescing}
 
Quoted 11 lines

content.tex \subsubsection{Control Virtqueue}\label{sec:Device Types / Network Device / Devi · line 4626

Quoted 3 lines
content.tex +2 -1
-A device SHOULD respond to the VIRTIO_NET_CTRL_NOTF_COAL commands with VIRTIO_NET_ERR if it was not able to change the parameters.
+A device SHOULD respond to the VIRTIO_NET_CTRL_NOTF_COAL commands with VIRTIO_NET_ERR if it was not able to change the parameters or
+was not able to find a virtqueue using the \field{vqn}.

First please create multiple statements not a single long one. Second vqn only exists for per vq commands so create a statement just for that.
Also more explicit please. What does this mean? I suspect that vq was not enabled?
Also, we MUST have vqn < max_virtqueue_pairs.

I believe that you meant vqn < max_virtqueue_pairs * 2

Quoted 7 lines
Quoted 6 lines
content.tex +0 -1
 A device SHOULD NOT send used buffer notifications to the driver, if the notifications are suppressed as explained in \ref{sec:Basic Facilities of a Virtio Device / Virtqueues / Used Buffer Notification Suppression}, even if the coalescing counters expired.
 
--

2.19.1.6.gb485710b

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]

#3 lore raw
Quoted 14 lines · Alvaro Karsz
Quoted 13 lines

content.tex \subsubsection{Control Virtqueue}\label{sec:Device Types / Network Device / Devi · line 4626

Quoted 5 lines

\devicenormative{\subparagraph}{Notifications Coalescing}{Device Types / Network Device / Device Operation / Control Virtqueue / Notifications Coalescing}

content.tex +2 -1
-A device SHOULD respond to the VIRTIO_NET_CTRL_NOTF_COAL commands with VIRTIO_NET_ERR if it was not able to change the parameters.
+A device SHOULD respond to the VIRTIO_NET_CTRL_NOTF_COAL commands with VIRTIO_NET_ERR if it was not able to change the parameters or
+was not able to find a virtqueue using the \field{vqn}.

First please create multiple statements not a single long one. Second vqn only exists for per vq commands so create a statement just for that.
Also more explicit please. What does this mean? I suspect that vq was not enabled?
Also, we MUST have vqn < max_virtqueue_pairs.

Quoted 1 line

I believe that you meant vqn < max_virtqueue_pairs * 2

Yes thanks!
Just pls snip to just the text you qoute to just relevant parts - I had to scroll like 300 lines to get to the relevant one :)

Signature · 18 lines
MST


This publicly archived list offers a means to provide input to the
OASIS Virtual I/O Device (VIRTIO) TC.

In order to verify user consent to the Feedback License terms and
to minimize spam in the list archive, subscription is required
before posting.

Subscribe: [email protected]
Unsubscribe: [email protected]
List help: [email protected]
List archive: https://lists.oasis-open.org/archives/virtio-comment/
Feedback License: https://www.oasis-open.org/who/ipr/feedback_license.pdf
List Guidelines: https://www.oasis-open.org/policies-guidelines/mailing-lists
Committee: https://www.oasis-open.org/committees/virtio/
Join OASIS: https://www.oasis-open.org/join/
author
#4 lore raw
In reply to Michael S. Tsirkin
Quoted 51 lines · Michael S. Tsirkin
Quoted 10 lines · Heng Qi

Currently, the coalescing profile is directly applied to all queues. This patch supports setting or getting the parameters for a specified queue, and a typical application of this function is NetDIM.

When the traffic between queues is unbalanced, for example, one queue is busy and another queue is idle, then it will be very useful to control coalescing parameters at the queue granularity.

I like this generally, thanks! Language needs to be tightened a bit.

Quoted 38 lines

---
v1->v2:
1. Rename VIRTIO_NET_F_PERQUEUE_NOTF_COAL to VIRTIO_NET_F_VQ_NOTF_COAL. @Michael S. Tsirkin
2. Use the \field{vqn} instead of the qid. @Michael S. Tsirkin
3. Unify tx and rx control structres into one structure virtio_net_ctrl_coal_vq. @Michael S. Tsirkin
4. Add a new control command VIRTIO_NET_CTRL_NOTF_COAL_VQ. @Michael S. Tsirkin, @Parav Pandit, @Alvaro Karsz
5. The special value 0xFFF is removed because VIRTIO_NET_CTRL_NOTF_COAL can be used. @Alvaro Karsz
6. Clarify some special scenarios. @Michael S. Tsirkin, @Parav Pandit, @Alvaro Karsz

  content.tex | 69 ++++++++++++++++++++++++++++++++++++++++++++++++++++-
  1 file changed, 68 insertions(+), 1 deletion(-)
content.tex +4 -0
index e863709..2c497e1 100644
@@ -3084,6 +3084,9 @@ \subsection{Feature bits}\label{sec:Device Types / Network Device / Feature bits
  \item[VIRTIO_NET_F_CTRL_MAC_ADDR(23)] Set MAC address through control
      channel.
 
+\item[VIRTIO_NET_F_VQ_NOTF_COAL(52)] Device supports the virtqueue
+    notifications coalescing.
+
  \item[VIRTIO_NET_F_NOTF_COAL(53)] Device supports notifications coalescing.
 
  \item[VIRTIO_NET_F_GUEST_USO4 (54)] Driver can receive USOv4 packets.
@@ -3140,6 +3143,7 @@ \subsubsection{Feature bit requirements}\label{sec:Device Types / Network Device
  \item[VIRTIO_NET_F_NOTF_COAL] Requires VIRTIO_NET_F_CTRL_VQ.
  \item[VIRTIO_NET_F_RSC_EXT] Requires VIRTIO_NET_F_HOST_TSO4 or VIRTIO_NET_F_HOST_TSO6.
  \item[VIRTIO_NET_F_RSS] Requires VIRTIO_NET_F_CTRL_VQ.
+\item[VIRTIO_NET_F_VQ_NOTF_COAL] Requires VIRTIO_NET_F_CTRL_VQ and VIRTIO_NET_F_NOTF_COAL.
  \end{description}
 
  \subsubsection{Legacy Interface: Feature bits}\label{sec:Device Types / Network Device / Feature bits / Legacy Interface: Feature bits}
@@ -4520,6 +4524,49 @@ \subsubsection{Control Virtqueue}\label{sec:Device Types / Network Device / Devi
  \item VIRTIO_NET_CTRL_NOTF_COAL_RX_SET: set the \field{rx_usecs} and \field{rx_max_packets} parameters.
  \end{enumerate}
 
Quoted 12 lines

content.tex \subsubsection{Control Virtqueue}\label{sec:Device Types / Network Device / Devi · line 4535

Quoted 9 lines
content.tex +9 -0
+If additionally VIRTIO_NET_F_VQ_NOTF_COAL is negotiated, the driver can send
+control commands to set or get the coalescing parameters of a specified
+virtqueue (excluding the control virtqueue).
+
+\begin{lstlisting}
+struct virtio_net_ctrl_coal_vq {
+    le32 max_packets;
+    le32 usecs;
+    le16 vqn;

Add le16 reserved here, so keep things aligned naturally. In fact if you want to support GET you need to re-order things since write buffers come before read buffers:

I see, thanks for pointing it out.

Quoted 21 lines

+ le16 vqn;
+ le16 reserved;

+ le32 max_packets;
+ le32 usecs;

see below for more explanation.

Quoted 11 lines
content.tex +11 -0
+};
+
+#define VIRTIO_NET_CTRL_NOTF_COAL_VQ 7
+ #define VIRTIO_NET_CTRL_NOTF_COAL_VQ_SET 0
+ #define VIRTIO_NET_CTRL_NOTF_COAL_VQ_GET 1
+\end{lstlisting}
+
+Virtqueue coalescing parameters:
+\begin{itemize}
+\item \field{max_packets}: The maximum number of packets sent/received by the
+    specified virtqueue before a TX/RX notification.
Quoted 8 lines

content.tex \subsubsection{Control Virtqueue}\label{sec:Device Types / Network Device / Devi

Quoted 6 lines
content.tex +6 -0
+\item \field{usecs}: The maximum number of TX/RX usecs that the specified
+    virtqueue delays a TX/RX notification.
+\item \field{vqn}: The virtqueue number of the specified virtqueue.
+\end{itemize}
+
+The range of \filed{vqn} is between 0 and 0xFFFF inclusive,

No really because last vq is a cvq. Maybe just drop this?

In fact I have ruled out the control virtqueue.

Its virtqueue number should be 0x10000.

Quoted 11 lines

content.tex \subsubsection{Control Virtqueue}\label{sec:Device Types / Network Device / Devi · line 4556

Quoted 6 lines
$ \lfloor vqn / 2 \rfloor $
content.tex +4 -0
+is the index of the corresponding receiveq, and $\lfloor (vqn / 2) + 1 \rfloor $ is
+the corresponding tranmitq.
+
+The VIRTIO_NET_CTRL_NOTF_COAL_RX_SET command is the same as calling VIRTIO_NET_CTRL_NOTF_COAL_VQ

you don't "call" commands. driver sends them, device receives them. But here you are talking about a command abstracty so I'd just drop a verb, or maybe "repeating".
And "same" is inexact in that it's not the same - takes more time - it just has the same effect, or is equivalent to.

There is indeed a gerund match here, I'll fix that.

Quoted 8 lines
Quoted 3 lines

+for virtqueues corresponding to all receiveqs.

receiveqs is confusing.

Also elsewhere we use the language receiveq1\ldots receiveqn which seems clearer. Also you can not call VIRTIO_NET_CTRL_NOTF_COAL_VQ for all vqs - it applies to one vq only. You mean each.

I express something wrong, but what I mean is to send for each virtqueue.

Quoted 2 lines

And virtqueues do not correspond to receiveqs - they are receiveqs. If you like vqn corresponds to them.

This is ambiguous, the number of virtqueues is 2*N+1, the number of receive queues and transmit queues is N, and there is also a control queue. Is this a problem?
But I know what you mean it's better to use "same as VIRTIO_NET_CTRL_NOTF_COAL_VQ repeated for each of receiveq1\ldots receiveqn"

Quoted 2 lines

Or better just "same as VIRTIO_NET_CTRL_NOTF_COAL_VQ repeated for each of receiveq1\ldots receiveqn"

Sure.

Quoted 6 lines

content.tex \subsubsection{Control Virtqueue}\label{sec:Device Types / Network Device / Devi · line 4562

Quoted 5 lines
content.tex +5 -0
+
+The VIRTIO_NET_CTRL_NOTF_COAL_TX_SET command is the same as calling VIRTIO_NET_CTRL_NOTF_COAL_VQ
+for virtqueues corresponding to all transmitqs.
+
+Virtqueue coalescing will be disabled if all parameters are set to 0.

In fact, either usecs 0 or max_packets disables coalescing, no?

Yes. I'll fix this.

Quoted 9 lines

content.tex \subsubsection{Control Virtqueue}\label{sec:Device Types / Network Device / Devi · line 4567

Quoted 6 lines
content.tex +5 -0
+
+The class VIRTIO_NET_CTRL_NOTF_COAL_VQ has 2 commands:
+\begin{enumerate}
+\item VIRTIO_NET_CTRL_NOTF_COAL_VQ_SET: set the \field{max_packets}, \field{usecs} and \filed{vqn} parameters.
+\item VIRTIO_NET_CTRL_NOTF_COAL_VQ_GET: get the \field{max_packets}, \field{usecs} and \field{vqn} parameters.

How does VIRTIO_NET_CTRL_NOTF_COAL_VQ_GET work then? For which vq? I think you mean vqn is specified and you get back max_packets and usecs. All this needs to be documented fully for each command.

Yes, VIRTIO_NET_CTRL_NOTF_COAL_VQ_GET gets the parameters of the virtqueue corresponding to vqn each time.

Quoted 3 lines

I would also think it's a good idea to mention that VQ_GET does not have to return exactly the same parameters - since it's best effort anyway,

This is confusing, I think the device does not have to set the same parameters for VQ_SET, but for VQ_GET, the device should return to the driver every time.

Quoted 9 lines

it's ok for device to round down and store a smaller value for either max_packets or usecs, e.g. to save space.

This kind of formalizes the best effort thing we discussed previously.

Maybe make VIRTIO_NET_CTRL_NOTF_COAL_VQ_GET a separate patch - in the series,

No problem, I'll try to describe it as best I can.

Quoted 8 lines

at this point you did not make any effort to document it, it needs more work.

Quoted 4 lines

+\end{enumerate}
+
\subparagraph{RX Notifications}\label{sec:Device Types / Network Device / Device Operation / Control Virtqueue / Notifications Coalescing / RX Notifications}

Quoted 7 lines

content.tex \subsubsection{Control Virtqueue}\label{sec:Device Types / Network Device / Devi · line 4585

Quoted 6 lines

If, for example:

content.tex +1 -0
@@ -4535,6 +4582,15 @@ \subsubsection{Control Virtqueue}\label{sec:Device Types / Network Device / Devi
  \item If the notifications are not suppressed by the driver, the device will send an used buffer notification, otherwise, the device will not send an used buffer notification as long as the notifications are suppressed.
  \end{itemize}
 
+If, example of setting coalescing parameters for a receive virtqueue:

"If" without "then" is confusing. I'd just start with "Example".

Ok.

Quoted 6 lines

content.tex \subsubsection{Control Virtqueue}\label{sec:Device Types / Network Device / Devi · line 4589

Quoted 5 lines
content.tex +4 -0
+\begin{itemize}
+\item \field{max_packets} = 15.
+\item \field{usecs} = 10.
+\item \field{vqn} = 0;

why . above and ; here? I would just drop punctuation.

It's a typo and I'll fix it.

Quoted 6 lines

content.tex \subsubsection{Control Virtqueue}\label{sec:Device Types / Network Device / Devi · line 4592

Quoted 4 lines
content.tex +3 -0
+\end{itemize}
+
+The device will only operate on recieveq1 as VIRTIO_NET_CTRL_NOTF_COAL_RX_SET.

This really does not explain anything. Please just document exactly what it does and does not do.

Ok.

Quoted 10 lines
Quoted 10 lines
content.tex +1 -0
+
  \subparagraph{TX Notifications}\label{sec:Device Types / Network Device / Device Operation / Control Virtqueue / Notifications Coalescing / TX Notifications}
 
  If, for example:
@@ -4550,13 +4606,24 @@ \subsubsection{Control Virtqueue}\label{sec:Device Types / Network Device / Devi
  \item If the notifications are not suppressed by the driver, the device will send an used buffer notification, otherwise, the device will not send an used buffer notification as long as the notifications are suppressed.
  \end{itemize}
 
Quoted 11 lines

content.tex \subsubsection{Control Virtqueue}\label{sec:Device Types / Network Device / Devi · line 4617

Quoted 9 lines
content.tex +9 -0
+If, example of setting coalescing parameters for a transmit virtqueue:
+\begin{itemize}
+\item \field{max_packets} = 15.
+\item \field{usecs} = 10.
+\item \field{vqn} = 1;
+\end{itemize}
+
+The device will only operate on transmitq1 as VIRTIO_NET_CTRL_NOTF_COAL_TX_SET.
+

I feel it's the other way around. Document

Why? I'll add documentation, but read on below.

Quoted 8 lines

content.tex \subsubsection{Control Virtqueue}\label{sec:Device Types / Network Device / Devi · line 4622

Quoted 6 lines
content.tex +1 -0
  \drivernormative{\subparagraph}{Notifications Coalescing}{Device Types / Network Device / Device Operation / Control Virtqueue / Notifications Coalescing}
 
  If the VIRTIO_NET_F_NOTF_COAL feature has not been negotiated, the driver MUST NOT issue VIRTIO_NET_CTRL_NOTF_COAL commands.
+If the VIRTIO_NET_F_VQ_NOTF_COAL feature has not been negotiated, the driver MUST NOT issue VIRTIO_NET_CTRL_NOFT_COAL_VQ commands.
 

Don't we want to limit driver to legal values of vqn?

Yes, I will add.

Quoted 8 lines

content.tex \subsubsection{Control Virtqueue}\label{sec:Device Types / Network Device / Devi · line 4626

Quoted 5 lines
content.tex +2 -1
  \devicenormative{\subparagraph}{Notifications Coalescing}{Device Types / Network Device / Device Operation / Control Virtqueue / Notifications Coalescing}
 
-A device SHOULD respond to the VIRTIO_NET_CTRL_NOTF_COAL commands with VIRTIO_NET_ERR if it was not able to change the parameters.
+A device SHOULD respond to the VIRTIO_NET_CTRL_NOTF_COAL commands with VIRTIO_NET_ERR if it was not able to change the parameters or
+was not able to find a virtqueue using the \field{vqn}.

First please create multiple statements not a single long one. Second vqn only exists for per vq commands so create a statement just for that.

Ok, reasonable.

Quoted 2 lines

Also more explicit please. What does this mean? I suspect that vq was not enabled?

Indicates that a vqn cannot be mapped to the corresponding virtqueue.

Quoted 1 line

Also, we MUST have vqn < max_virtqueue_pairs.

Here should be vq < max_virtqueue_pairs * 2?

Thanks.

Quoted 15 lines
Quoted 7 lines
content.tex +0 -0
  A device SHOULD NOT send used buffer notifications to the driver, if the notifications are suppressed as explained in \ref{sec:Basic Facilities of a Virtio Device / Virtqueues / Used Buffer Notification Suppression}, even if the coalescing counters expired.
 
Signature · 1 line
2.19.1.6.gb485710b

This publicly archived list offers a means to provide input to the OASIS Virtual I/O Device (VIRTIO) TC.

In order to verify user consent to the Feedback License terms and to minimize spam in the list archive, subscription is required before posting.

Quoted 8 lines

Subscribe: [email protected]
Unsubscribe: [email protected]
List help: [email protected]
List archive: https://lists.oasis-open.org/archives/virtio-comment/
Feedback License: https://www.oasis-open.org/who/ipr/feedback_license.pdf
List Guidelines: https://www.oasis-open.org/policies-guidelines/mailing-lists
Committee: https://www.oasis-open.org/committees/virtio/
Join OASIS: https://www.oasis-open.org/join/

This publicly archived list offers a means to provide input to the OASIS Virtual I/O Device (VIRTIO) TC.

In order to verify user consent to the Feedback License terms and to minimize spam in the list archive, subscription is required before posting.

Subscribe: [email protected]
Unsubscribe: [email protected]
List help: [email protected]
List archive: https://lists.oasis-open.org/archives/virtio-comment/
Feedback License: https://www.oasis-open.org/who/ipr/feedback_license.pdf
List Guidelines: https://www.oasis-open.org/policies-guidelines/mailing-lists
Committee: https://www.oasis-open.org/committees/virtio/
Join OASIS: https://www.oasis-open.org/join/

#5 lore raw
Quoted 95 lines · Heng Qi
Quoted 51 lines · Michael S. Tsirkin
Quoted 10 lines · Heng Qi

Currently, the coalescing profile is directly applied to all queues. This patch supports setting or getting the parameters for a specified queue, and a typical application of this function is NetDIM.

When the traffic between queues is unbalanced, for example, one queue is busy and another queue is idle, then it will be very useful to control coalescing parameters at the queue granularity.

I like this generally, thanks! Language needs to be tightened a bit.

Quoted 38 lines

---
v1->v2:
1. Rename VIRTIO_NET_F_PERQUEUE_NOTF_COAL to VIRTIO_NET_F_VQ_NOTF_COAL. @Michael S. Tsirkin
2. Use the \field{vqn} instead of the qid. @Michael S. Tsirkin
3. Unify tx and rx control structres into one structure virtio_net_ctrl_coal_vq. @Michael S. Tsirkin
4. Add a new control command VIRTIO_NET_CTRL_NOTF_COAL_VQ. @Michael S. Tsirkin, @Parav Pandit, @Alvaro Karsz
5. The special value 0xFFF is removed because VIRTIO_NET_CTRL_NOTF_COAL can be used. @Alvaro Karsz
6. Clarify some special scenarios. @Michael S. Tsirkin, @Parav Pandit, @Alvaro Karsz

  content.tex | 69 ++++++++++++++++++++++++++++++++++++++++++++++++++++-
  1 file changed, 68 insertions(+), 1 deletion(-)
content.tex +8 -0
index e863709..2c497e1 100644
@@ -3084,6 +3084,9 @@ \subsection{Feature bits}\label{sec:Device Types / Network Device / Feature bits
  \item[VIRTIO_NET_F_CTRL_MAC_ADDR(23)] Set MAC address through control
      channel.
+\item[VIRTIO_NET_F_VQ_NOTF_COAL(52)] Device supports the virtqueue
+    notifications coalescing.
+
  \item[VIRTIO_NET_F_NOTF_COAL(53)] Device supports notifications coalescing.
  \item[VIRTIO_NET_F_GUEST_USO4 (54)] Driver can receive USOv4 packets.
@@ -3140,6 +3143,7 @@ \subsubsection{Feature bit requirements}\label{sec:Device Types / Network Device
  \item[VIRTIO_NET_F_NOTF_COAL] Requires VIRTIO_NET_F_CTRL_VQ.
  \item[VIRTIO_NET_F_RSC_EXT] Requires VIRTIO_NET_F_HOST_TSO4 or VIRTIO_NET_F_HOST_TSO6.
  \item[VIRTIO_NET_F_RSS] Requires VIRTIO_NET_F_CTRL_VQ.
+\item[VIRTIO_NET_F_VQ_NOTF_COAL] Requires VIRTIO_NET_F_CTRL_VQ and VIRTIO_NET_F_NOTF_COAL.
  \end{description}
  \subsubsection{Legacy Interface: Feature bits}\label{sec:Device Types / Network Device / Feature bits / Legacy Interface: Feature bits}
@@ -4520,6 +4524,49 @@ \subsubsection{Control Virtqueue}\label{sec:Device Types / Network Device / Devi
  \item VIRTIO_NET_CTRL_NOTF_COAL_RX_SET: set the \field{rx_usecs} and \field{rx_max_packets} parameters.
  \end{enumerate}
+If additionally VIRTIO_NET_F_VQ_NOTF_COAL is negotiated, the driver can send
+control commands to set or get the coalescing parameters of a specified
+virtqueue (excluding the control virtqueue).
+
Quoted 8 lines

content.tex \subsubsection{Control Virtqueue}\label{sec:Device Types / Network Device / Devi · line 4535

Quoted 5 lines
content.tex +5 -0
+\begin{lstlisting}
+struct virtio_net_ctrl_coal_vq {
+    le32 max_packets;
+    le32 usecs;
+    le16 vqn;

Add le16 reserved here, so keep things aligned naturally. In fact if you want to support GET you need to re-order things since write buffers come before read buffers:

I see, thanks for pointing it out.

Quoted 21 lines

+ le16 vqn;
+ le16 reserved;

+ le32 max_packets;
+ le32 usecs;

see below for more explanation.

Quoted 11 lines
content.tex +11 -0
+};
+
+#define VIRTIO_NET_CTRL_NOTF_COAL_VQ 7
+ #define VIRTIO_NET_CTRL_NOTF_COAL_VQ_SET 0
+ #define VIRTIO_NET_CTRL_NOTF_COAL_VQ_GET 1
+\end{lstlisting}
+
+Virtqueue coalescing parameters:
+\begin{itemize}
+\item \field{max_packets}: The maximum number of packets sent/received by the
+    specified virtqueue before a TX/RX notification.
Quoted 8 lines

content.tex \subsubsection{Control Virtqueue}\label{sec:Device Types / Network Device / Devi

Quoted 6 lines
content.tex +6 -0
+\item \field{usecs}: The maximum number of TX/RX usecs that the specified
+    virtqueue delays a TX/RX notification.
+\item \field{vqn}: The virtqueue number of the specified virtqueue.
+\end{itemize}
+
+The range of \filed{vqn} is between 0 and 0xFFFF inclusive,

No really because last vq is a cvq. Maybe just drop this?

Quoted 3 lines

In fact I have ruled out the control virtqueue.

Its virtqueue number should be 0x10000.

Nope, vq numberes are 16 bit.

Quoted 62 lines
Quoted 11 lines

content.tex \subsubsection{Control Virtqueue}\label{sec:Device Types / Network Device / Devi · line 4556

Quoted 6 lines
$ \lfloor vqn / 2 \rfloor $
content.tex +4 -0
+is the index of the corresponding receiveq, and $\lfloor (vqn / 2) + 1 \rfloor $ is
+the corresponding tranmitq.
+
+The VIRTIO_NET_CTRL_NOTF_COAL_RX_SET command is the same as calling VIRTIO_NET_CTRL_NOTF_COAL_VQ

you don't "call" commands. driver sends them, device receives them. But here you are talking about a command abstracty so I'd just drop a verb, or maybe "repeating".
And "same" is inexact in that it's not the same - takes more time - it just has the same effect, or is equivalent to.

There is indeed a gerund match here, I'll fix that.

Quoted 8 lines
Quoted 3 lines

+for virtqueues corresponding to all receiveqs.

receiveqs is confusing.

Also elsewhere we use the language receiveq1\ldots receiveqn which seems clearer. Also you can not call VIRTIO_NET_CTRL_NOTF_COAL_VQ for all vqs - it applies to one vq only. You mean each.

I express something wrong, but what I mean is to send for each virtqueue.

Quoted 2 lines

And virtqueues do not correspond to receiveqs - they are receiveqs. If you like vqn corresponds to them.

This is ambiguous, the number of virtqueues is 2*N+1, the number of receive queues and transmit queues is N,
and there is also a control queue. Is this a problem?
But I know what you mean it's better to use "same as VIRTIO_NET_CTRL_NOTF_COAL_VQ repeated for each of receiveq1\ldots receiveqn"

Quoted 2 lines

Or better just "same as VIRTIO_NET_CTRL_NOTF_COAL_VQ repeated for each of receiveq1\ldots receiveqn"

Sure.

Quoted 6 lines

content.tex \subsubsection{Control Virtqueue}\label{sec:Device Types / Network Device / Devi · line 4562

Quoted 5 lines
content.tex +5 -0
+
+The VIRTIO_NET_CTRL_NOTF_COAL_TX_SET command is the same as calling VIRTIO_NET_CTRL_NOTF_COAL_VQ
+for virtqueues corresponding to all transmitqs.
+
+Virtqueue coalescing will be disabled if all parameters are set to 0.

In fact, either usecs 0 or max_packets disables coalescing, no?

Yes. I'll fix this.

Quoted 9 lines

content.tex \subsubsection{Control Virtqueue}\label{sec:Device Types / Network Device / Devi · line 4567

Quoted 6 lines
content.tex +5 -0
+
+The class VIRTIO_NET_CTRL_NOTF_COAL_VQ has 2 commands:
+\begin{enumerate}
+\item VIRTIO_NET_CTRL_NOTF_COAL_VQ_SET: set the \field{max_packets}, \field{usecs} and \filed{vqn} parameters.
+\item VIRTIO_NET_CTRL_NOTF_COAL_VQ_GET: get the \field{max_packets}, \field{usecs} and \field{vqn} parameters.

How does VIRTIO_NET_CTRL_NOTF_COAL_VQ_GET work then? For which vq? I think you mean vqn is specified and you get back max_packets and usecs. All this needs to be documented fully for each command.

Yes, VIRTIO_NET_CTRL_NOTF_COAL_VQ_GET gets the parameters of the virtqueue corresponding to vqn each time.

Quoted 1 line
Quoted 6 lines
Quoted 2 lines

I would also think it's a good idea to mention that VQ_GET does not have to return exactly the same parameters - since it's best effort anyway,

This is confusing, I think the device does not have to set the same parameters for VQ_SET, but for VQ_GET, the device should return to the driver every time.

What I mean is that if you call VQ_SET with a value of 17, device might decide to e.g. store just the power of 2

Quoted 85 lines
Quoted 9 lines

it's ok for device to round down and store a smaller value for either max_packets or usecs, e.g. to save space.

This kind of formalizes the best effort thing we discussed previously.

Maybe make VIRTIO_NET_CTRL_NOTF_COAL_VQ_GET a separate patch - in the series,

No problem, I'll try to describe it as best I can.

Quoted 4 lines

at this point you did not make any effort to document it, it needs more work.

Quoted 9 lines

content.tex \subsubsection{Control Virtqueue}\label{sec:Device Types / Network Device / Devi · line 4584

Quoted 8 lines

+\end{enumerate}

content.tex +2 -0
+
  \subparagraph{RX Notifications}\label{sec:Device Types / Network Device / Device Operation / Control Virtqueue / Notifications Coalescing / RX Notifications}
  If, for example:
@@ -4535,6 +4582,15 @@ \subsubsection{Control Virtqueue}\label{sec:Device Types / Network Device / Devi
  \item If the notifications are not suppressed by the driver, the device will send an used buffer notification, otherwise, the device will not send an used buffer notification as long as the notifications are suppressed.
  \end{itemize}
+If, example of setting coalescing parameters for a receive virtqueue:

"If" without "then" is confusing. I'd just start with "Example".

Ok.

Quoted 6 lines

content.tex \subsubsection{Control Virtqueue}\label{sec:Device Types / Network Device / Devi · line 4589

Quoted 5 lines
content.tex +4 -0
+\begin{itemize}
+\item \field{max_packets} = 15.
+\item \field{usecs} = 10.
+\item \field{vqn} = 0;

why . above and ; here? I would just drop punctuation.

It's a typo and I'll fix it.

Quoted 6 lines

content.tex \subsubsection{Control Virtqueue}\label{sec:Device Types / Network Device / Devi · line 4592

Quoted 4 lines
content.tex +3 -0
+\end{itemize}
+
+The device will only operate on recieveq1 as VIRTIO_NET_CTRL_NOTF_COAL_RX_SET.

This really does not explain anything. Please just document exactly what it does and does not do.

Ok.

Quoted 19 lines
Quoted 7 lines
content.tex +1 -0
+
  \subparagraph{TX Notifications}\label{sec:Device Types / Network Device / Device Operation / Control Virtqueue / Notifications Coalescing / TX Notifications}
  If, for example:
@@ -4550,13 +4606,24 @@ \subsubsection{Control Virtqueue}\label{sec:Device Types / Network Device / Devi
  \item If the notifications are not suppressed by the driver, the device will send an used buffer notification, otherwise, the device will not send an used buffer notification as long as the notifications are suppressed.

content.tex \subsubsection{Control Virtqueue}\label{sec:Device Types / Network Device / Devi · line 4616

Quoted 10 lines
content.tex +9 -0
  \end{itemize}
+If, example of setting coalescing parameters for a transmit virtqueue:
+\begin{itemize}
+\item \field{max_packets} = 15.
+\item \field{usecs} = 10.
+\item \field{vqn} = 1;
+\end{itemize}
+
+The device will only operate on transmitq1 as VIRTIO_NET_CTRL_NOTF_COAL_TX_SET.
+

I feel it's the other way around. Document

Why? I'll add documentation, but read on below.

Quoted 6 lines

content.tex \subsubsection{Control Virtqueue}\label{sec:Device Types / Network Device / Devi · line 4621

Quoted 4 lines
content.tex +1 -0
  \drivernormative{\subparagraph}{Notifications Coalescing}{Device Types / Network Device / Device Operation / Control Virtqueue / Notifications Coalescing}
  If the VIRTIO_NET_F_NOTF_COAL feature has not been negotiated, the driver MUST NOT issue VIRTIO_NET_CTRL_NOTF_COAL commands.
+If the VIRTIO_NET_F_VQ_NOTF_COAL feature has not been negotiated, the driver MUST NOT issue VIRTIO_NET_CTRL_NOFT_COAL_VQ commands.

Don't we want to limit driver to legal values of vqn?

Yes, I will add.

Quoted 7 lines

content.tex \subsubsection{Control Virtqueue}\label{sec:Device Types / Network Device / Devi · line 4626

Quoted 4 lines
content.tex +2 -1
  \devicenormative{\subparagraph}{Notifications Coalescing}{Device Types / Network Device / Device Operation / Control Virtqueue / Notifications Coalescing}
-A device SHOULD respond to the VIRTIO_NET_CTRL_NOTF_COAL commands with VIRTIO_NET_ERR if it was not able to change the parameters.
+A device SHOULD respond to the VIRTIO_NET_CTRL_NOTF_COAL commands with VIRTIO_NET_ERR if it was not able to change the parameters or
+was not able to find a virtqueue using the \field{vqn}.

First please create multiple statements not a single long one. Second vqn only exists for per vq commands so create a statement just for that.

Quoted 6 lines

Ok, reasonable.

Quoted 2 lines

Also more explicit please. What does this mean? I suspect that vq was not enabled?

Indicates that a vqn cannot be mapped to the corresponding virtqueue.

Still no idea. what is this mapping you are talking about. Why can't it be mapped? what is corresponding to what?

vq with this number is not enabled or vqn >= 2max_virtqueue_pairs are the only reasons i could come up with. if that's it just say so. if not list the actual reasons.

Quoted 5 lines
Quoted 1 line

Also, we MUST have vqn < max_virtqueue_pairs.

Here should be vq < max_virtqueue_pairs * 2?

Thanks.

yea.

Quoted 13 lines
Quoted 13 lines
Quoted 5 lines
content.tex +0 -0
  A device SHOULD NOT send used buffer notifications to the driver, if the notifications are suppressed as explained in \ref{sec:Basic Facilities of a Virtio Device / Virtqueues / Used Buffer Notification Suppression}, even if the coalescing counters expired.
Signature · 1 line
2.19.1.6.gb485710b

This publicly archived list offers a means to provide input to the OASIS Virtual I/O Device (VIRTIO) TC.

In order to verify user consent to the Feedback License terms and to minimize spam in the list archive, subscription is required before posting.

Quoted 8 lines
Quoted 8 lines

Subscribe: [email protected]
Unsubscribe: [email protected]
List help: [email protected]
List archive: https://lists.oasis-open.org/archives/virtio-comment/
Feedback License: https://www.oasis-open.org/who/ipr/feedback_license.pdf
List Guidelines: https://www.oasis-open.org/policies-guidelines/mailing-lists
Committee: https://www.oasis-open.org/committees/virtio/
Join OASIS: https://www.oasis-open.org/join/

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]

author
#6 lore raw
Quoted 91 lines · Michael S. Tsirkin
Quoted 90 lines · Heng Qi
Quoted 50 lines · Michael S. Tsirkin
Quoted 10 lines · Heng Qi

Currently, the coalescing profile is directly applied to all queues. This patch supports setting or getting the parameters for a specified queue, and a typical application of this function is NetDIM.

When the traffic between queues is unbalanced, for example, one queue is busy and another queue is idle, then it will be very useful to control coalescing parameters at the queue granularity.

I like this generally, thanks! Language needs to be tightened a bit.

Quoted 38 lines

---
v1->v2:
1. Rename VIRTIO_NET_F_PERQUEUE_NOTF_COAL to VIRTIO_NET_F_VQ_NOTF_COAL. @Michael S. Tsirkin
2. Use the \field{vqn} instead of the qid. @Michael S. Tsirkin
3. Unify tx and rx control structres into one structure virtio_net_ctrl_coal_vq. @Michael S. Tsirkin
4. Add a new control command VIRTIO_NET_CTRL_NOTF_COAL_VQ. @Michael S. Tsirkin, @Parav Pandit, @Alvaro Karsz
5. The special value 0xFFF is removed because VIRTIO_NET_CTRL_NOTF_COAL can be used. @Alvaro Karsz
6. Clarify some special scenarios. @Michael S. Tsirkin, @Parav Pandit, @Alvaro Karsz

   content.tex | 69 ++++++++++++++++++++++++++++++++++++++++++++++++++++-
   1 file changed, 68 insertions(+), 1 deletion(-)
content.tex +8 -0
index e863709..2c497e1 100644
@@ -3084,6 +3084,9 @@ \subsection{Feature bits}\label{sec:Device Types / Network Device / Feature bits
   \item[VIRTIO_NET_F_CTRL_MAC_ADDR(23)] Set MAC address through control
       channel.
+\item[VIRTIO_NET_F_VQ_NOTF_COAL(52)] Device supports the virtqueue
+    notifications coalescing.
+
   \item[VIRTIO_NET_F_NOTF_COAL(53)] Device supports notifications coalescing.
   \item[VIRTIO_NET_F_GUEST_USO4 (54)] Driver can receive USOv4 packets.
@@ -3140,6 +3143,7 @@ \subsubsection{Feature bit requirements}\label{sec:Device Types / Network Device
   \item[VIRTIO_NET_F_NOTF_COAL] Requires VIRTIO_NET_F_CTRL_VQ.
   \item[VIRTIO_NET_F_RSC_EXT] Requires VIRTIO_NET_F_HOST_TSO4 or VIRTIO_NET_F_HOST_TSO6.
   \item[VIRTIO_NET_F_RSS] Requires VIRTIO_NET_F_CTRL_VQ.
+\item[VIRTIO_NET_F_VQ_NOTF_COAL] Requires VIRTIO_NET_F_CTRL_VQ and VIRTIO_NET_F_NOTF_COAL.
   \end{description}
   \subsubsection{Legacy Interface: Feature bits}\label{sec:Device Types / Network Device / Feature bits / Legacy Interface: Feature bits}
@@ -4520,6 +4524,49 @@ \subsubsection{Control Virtqueue}\label{sec:Device Types / Network Device / Devi
   \item VIRTIO_NET_CTRL_NOTF_COAL_RX_SET: set the \field{rx_usecs} and \field{rx_max_packets} parameters.
   \end{enumerate}
+If additionally VIRTIO_NET_F_VQ_NOTF_COAL is negotiated, the driver can send
+control commands to set or get the coalescing parameters of a specified
+virtqueue (excluding the control virtqueue).
+
Quoted 8 lines

content.tex \subsubsection{Control Virtqueue}\label{sec:Device Types / Network Device / Devi · line 4535

Quoted 5 lines
content.tex +5 -0
+\begin{lstlisting}
+struct virtio_net_ctrl_coal_vq {
+    le32 max_packets;
+    le32 usecs;
+    le16 vqn;

Add le16 reserved here, so keep things aligned naturally. In fact if you want to support GET you need to re-order things since write buffers come before read buffers:

I see, thanks for pointing it out.

Quoted 28 lines

+ le16 vqn;
+ le16 reserved;

+ le32 max_packets;
+ le32 usecs;

see below for more explanation.

Quoted 7 lines
content.tex +7 -0
+};
+
+#define VIRTIO_NET_CTRL_NOTF_COAL_VQ 7
+ #define VIRTIO_NET_CTRL_NOTF_COAL_VQ_SET 0
+ #define VIRTIO_NET_CTRL_NOTF_COAL_VQ_GET 1
+\end{lstlisting}
+

content.tex \subsubsection{Control Virtqueue}\label{sec:Device Types / Network Device / Devi

Quoted 10 lines
content.tex +10 -0
+Virtqueue coalescing parameters:
+\begin{itemize}
+\item \field{max_packets}: The maximum number of packets sent/received by the
+    specified virtqueue before a TX/RX notification.
+\item \field{usecs}: The maximum number of TX/RX usecs that the specified
+    virtqueue delays a TX/RX notification.
+\item \field{vqn}: The virtqueue number of the specified virtqueue.
+\end{itemize}
+
+The range of \filed{vqn} is between 0 and 0xFFFF inclusive,

No really because last vq is a cvq. Maybe just drop this?

Quoted 4 lines
Quoted 3 lines

In fact I have ruled out the control virtqueue.

Its virtqueue number should be 0x10000.

Nope, vq numberes are 16 bit.

Yes I know. The [0, 0xFFFF] listed in v2 is the maximum range of virtqueue numbers (including all receiveqs and all transmitqs) that can be set by the driver, because the current spec says
"The device MUST set \field{max_virtqueue_pairs} to between 1 and 0x8000 inclusive, if it offers VIRTIO_NET_F_MQ.". So assuming that the maximum number of receiveqs and transmitqs are 0x8000 respectively,
then the total is 0x10000 (the queue number to the control queue is 0x10001), that is, the vqn indexed from 0 is [0,0x10000-1]=[0,0xFFFF ], which already excludes controlq.

But I know that you mean to emphasize in the specification that no contro queue is included.

Quoted 53 lines
Quoted 53 lines
Quoted 11 lines

content.tex \subsubsection{Control Virtqueue}\label{sec:Device Types / Network Device / Devi · line 4556

Quoted 6 lines
$ \lfloor vqn / 2 \rfloor $
content.tex +4 -0
+is the index of the corresponding receiveq, and $\lfloor (vqn / 2) + 1 \rfloor $ is
+the corresponding tranmitq.
+
+The VIRTIO_NET_CTRL_NOTF_COAL_RX_SET command is the same as calling VIRTIO_NET_CTRL_NOTF_COAL_VQ

you don't "call" commands. driver sends them, device receives them. But here you are talking about a command abstracty so I'd just drop a verb, or maybe "repeating".
And "same" is inexact in that it's not the same - takes more time - it just has the same effect, or is equivalent to.

There is indeed a gerund match here, I'll fix that.

Quoted 7 lines
Quoted 2 lines

+for virtqueues corresponding to all receiveqs.

receiveqs is confusing.

Also elsewhere we use the language receiveq1\ldots receiveqn which seems clearer. Also you can not call VIRTIO_NET_CTRL_NOTF_COAL_VQ for all vqs - it applies to one vq only. You mean each.

I express something wrong, but what I mean is to send for each virtqueue.

Quoted 2 lines

And virtqueues do not correspond to receiveqs - they are receiveqs. If you like vqn corresponds to them.

This is ambiguous, the number of virtqueues is 2*N+1, the number of receive queues and transmit queues is N,
and there is also a control queue. Is this a problem?
But I know what you mean it's better to use "same as VIRTIO_NET_CTRL_NOTF_COAL_VQ repeated for each of receiveq1\ldots receiveqn"

Quoted 2 lines

Or better just "same as VIRTIO_NET_CTRL_NOTF_COAL_VQ repeated for each of receiveq1\ldots receiveqn"

Sure.

Quoted 6 lines

content.tex \subsubsection{Control Virtqueue}\label{sec:Device Types / Network Device / Devi · line 4562

Quoted 5 lines
content.tex +5 -0
+
+The VIRTIO_NET_CTRL_NOTF_COAL_TX_SET command is the same as calling VIRTIO_NET_CTRL_NOTF_COAL_VQ
+for virtqueues corresponding to all transmitqs.
+
+Virtqueue coalescing will be disabled if all parameters are set to 0.

In fact, either usecs 0 or max_packets disables coalescing, no?

Yes. I'll fix this.

Quoted 8 lines

content.tex \subsubsection{Control Virtqueue}\label{sec:Device Types / Network Device / Devi · line 4567

Quoted 5 lines
content.tex +5 -0
+
+The class VIRTIO_NET_CTRL_NOTF_COAL_VQ has 2 commands:
+\begin{enumerate}
+\item VIRTIO_NET_CTRL_NOTF_COAL_VQ_SET: set the \field{max_packets}, \field{usecs} and \filed{vqn} parameters.
+\item VIRTIO_NET_CTRL_NOTF_COAL_VQ_GET: get the \field{max_packets}, \field{usecs} and \field{vqn} parameters.

How does VIRTIO_NET_CTRL_NOTF_COAL_VQ_GET work then? For which vq? I think you mean vqn is specified and you get back max_packets and usecs. All this needs to be documented fully for each command.

Yes, VIRTIO_NET_CTRL_NOTF_COAL_VQ_GET gets the parameters of the virtqueue corresponding to vqn each time.

Quoted 7 lines
Quoted 5 lines
Quoted 2 lines

I would also think it's a good idea to mention that VQ_GET does not have to return exactly the same parameters - since it's best effort anyway,

This is confusing, I think the device does not have to set the same parameters for VQ_SET, but for VQ_GET, the device should return to the driver every time.

What I mean is that if you call VQ_SET with a value of 17, device might decide to e.g. store just the power of 2

Oh! I misunderstood what you meant before, I will add an appropriate reminder!

Quoted 78 lines
Quoted 78 lines
Quoted 11 lines

it's ok for device to round down and store a smaller value for either max_packets or usecs, e.g. to save space.

This kind of formalizes the best effort thing we discussed previously.

Maybe make VIRTIO_NET_CTRL_NOTF_COAL_VQ_GET a separate patch - in the series,

No problem, I'll try to describe it as best I can.

Quoted 4 lines

at this point you did not make any effort to document it, it needs more work.

Quoted 9 lines

content.tex \subsubsection{Control Virtqueue}\label{sec:Device Types / Network Device / Devi · line 4584

Quoted 8 lines

+\end{enumerate}

content.tex +2 -0
+
   \subparagraph{RX Notifications}\label{sec:Device Types / Network Device / Device Operation / Control Virtqueue / Notifications Coalescing / RX Notifications}
   If, for example:
@@ -4535,6 +4582,15 @@ \subsubsection{Control Virtqueue}\label{sec:Device Types / Network Device / Devi
   \item If the notifications are not suppressed by the driver, the device will send an used buffer notification, otherwise, the device will not send an used buffer notification as long as the notifications are suppressed.
   \end{itemize}
+If, example of setting coalescing parameters for a receive virtqueue:

"If" without "then" is confusing. I'd just start with "Example".

Ok.

Quoted 5 lines

content.tex \subsubsection{Control Virtqueue}\label{sec:Device Types / Network Device / Devi · line 4589

Quoted 4 lines
content.tex +4 -0
+\begin{itemize}
+\item \field{max_packets} = 15.
+\item \field{usecs} = 10.
+\item \field{vqn} = 0;

why . above and ; here? I would just drop punctuation.

It's a typo and I'll fix it.

Quoted 5 lines

content.tex \subsubsection{Control Virtqueue}\label{sec:Device Types / Network Device / Devi · line 4592

Quoted 3 lines
content.tex +3 -0
+\end{itemize}
+
+The device will only operate on recieveq1 as VIRTIO_NET_CTRL_NOTF_COAL_RX_SET.

This really does not explain anything. Please just document exactly what it does and does not do.

Ok.

Quoted 18 lines
Quoted 6 lines
content.tex +1 -0
+
   \subparagraph{TX Notifications}\label{sec:Device Types / Network Device / Device Operation / Control Virtqueue / Notifications Coalescing / TX Notifications}
   If, for example:
@@ -4550,13 +4606,24 @@ \subsubsection{Control Virtqueue}\label{sec:Device Types / Network Device / Devi
   \item If the notifications are not suppressed by the driver, the device will send an used buffer notification, otherwise, the device will not send an used buffer notification as long as the notifications are suppressed.

content.tex \subsubsection{Control Virtqueue}\label{sec:Device Types / Network Device / Devi · line 4616

Quoted 10 lines
content.tex +9 -0
   \end{itemize}
+If, example of setting coalescing parameters for a transmit virtqueue:
+\begin{itemize}
+\item \field{max_packets} = 15.
+\item \field{usecs} = 10.
+\item \field{vqn} = 1;
+\end{itemize}
+
+The device will only operate on transmitq1 as VIRTIO_NET_CTRL_NOTF_COAL_TX_SET.
+

I feel it's the other way around. Document

Why? I'll add documentation, but read on below.

Quoted 5 lines

content.tex \subsubsection{Control Virtqueue}\label{sec:Device Types / Network Device / Devi · line 4621

Quoted 3 lines
content.tex +1 -0
   \drivernormative{\subparagraph}{Notifications Coalescing}{Device Types / Network Device / Device Operation / Control Virtqueue / Notifications Coalescing}
   If the VIRTIO_NET_F_NOTF_COAL feature has not been negotiated, the driver MUST NOT issue VIRTIO_NET_CTRL_NOTF_COAL commands.
+If the VIRTIO_NET_F_VQ_NOTF_COAL feature has not been negotiated, the driver MUST NOT issue VIRTIO_NET_CTRL_NOFT_COAL_VQ commands.

Don't we want to limit driver to legal values of vqn?

Yes, I will add.

Quoted 7 lines

content.tex \subsubsection{Control Virtqueue}\label{sec:Device Types / Network Device / Devi · line 4626

Quoted 4 lines
content.tex +2 -1
   \devicenormative{\subparagraph}{Notifications Coalescing}{Device Types / Network Device / Device Operation / Control Virtqueue / Notifications Coalescing}
-A device SHOULD respond to the VIRTIO_NET_CTRL_NOTF_COAL commands with VIRTIO_NET_ERR if it was not able to change the parameters.
+A device SHOULD respond to the VIRTIO_NET_CTRL_NOTF_COAL commands with VIRTIO_NET_ERR if it was not able to change the parameters or
+was not able to find a virtqueue using the \field{vqn}.

First please create multiple statements not a single long one. Second vqn only exists for per vq commands so create a statement just for that.

Ok, reasonable.

Quoted 7 lines
Quoted 3 lines
Quoted 2 lines

Also more explicit please. What does this mean? I suspect that vq was not enabled?

Indicates that a vqn cannot be mapped to the corresponding virtqueue.

Still no idea. what is this mapping you are talking about. Why can't it be mapped? what is corresponding to what?

vq with this number is not enabled or vqn >= 2max_virtqueue_pairs are

I am referring to the former.

Quoted 2 lines

the only reasons i could come up with. if that's it just say so. if not list the actual reasons.

Sorry, I will explain more clearly later.

Thanks.

Quoted 27 lines
Quoted 5 lines
Quoted 2 lines

Also, we MUST have vqn < max_virtqueue_pairs.

Here should be vq < max_virtqueue_pairs * 2?

Thanks.

yea.

Quoted 11 lines
Quoted 11 lines
Quoted 4 lines
content.tex +0 -0
   A device SHOULD NOT send used buffer notifications to the driver, if the notifications are suppressed as explained in \ref{sec:Basic Facilities of a Virtio Device / Virtqueues / Used Buffer Notification Suppression}, even if the coalescing counters expired.
Signature · 1 line
2.19.1.6.gb485710b

This publicly archived list offers a means to provide input to the OASIS Virtual I/O Device (VIRTIO) TC.

In order to verify user consent to the Feedback License terms and to minimize spam in the list archive, subscription is required before posting.

Quoted 8 lines
Quoted 8 lines

Subscribe: [email protected]
Unsubscribe: [email protected]
List help: [email protected]
List archive: https://lists.oasis-open.org/archives/virtio-comment/
Feedback License: https://www.oasis-open.org/who/ipr/feedback_license.pdf
List Guidelines: https://www.oasis-open.org/policies-guidelines/mailing-lists
Committee: https://www.oasis-open.org/committees/virtio/
Join OASIS: https://www.oasis-open.org/join/

Quoted 3 lines

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]

This publicly archived list offers a means to provide input to the OASIS Virtual I/O Device (VIRTIO) TC.

In order to verify user consent to the Feedback License terms and to minimize spam in the list archive, subscription is required before posting.

Subscribe: [email protected]
Unsubscribe: [email protected]
List help: [email protected]
List archive: https://lists.oasis-open.org/archives/virtio-comment/
Feedback License: https://www.oasis-open.org/who/ipr/feedback_license.pdf
List Guidelines: https://www.oasis-open.org/policies-guidelines/mailing-lists
Committee: https://www.oasis-open.org/committees/virtio/
Join OASIS: https://www.oasis-open.org/join/

#7 lore raw
Quoted 96 lines · Heng Qi
Quoted 93 lines · Michael S. Tsirkin
Quoted 92 lines · Heng Qi
Quoted 50 lines · Michael S. Tsirkin
Quoted 10 lines · Heng Qi

Currently, the coalescing profile is directly applied to all queues. This patch supports setting or getting the parameters for a specified queue, and a typical application of this function is NetDIM.

When the traffic between queues is unbalanced, for example, one queue is busy and another queue is idle, then it will be very useful to control coalescing parameters at the queue granularity.

I like this generally, thanks! Language needs to be tightened a bit.

Quoted 38 lines

---
v1->v2:
1. Rename VIRTIO_NET_F_PERQUEUE_NOTF_COAL to VIRTIO_NET_F_VQ_NOTF_COAL. @Michael S. Tsirkin
2. Use the \field{vqn} instead of the qid. @Michael S. Tsirkin
3. Unify tx and rx control structres into one structure virtio_net_ctrl_coal_vq. @Michael S. Tsirkin
4. Add a new control command VIRTIO_NET_CTRL_NOTF_COAL_VQ. @Michael S. Tsirkin, @Parav Pandit, @Alvaro Karsz
5. The special value 0xFFF is removed because VIRTIO_NET_CTRL_NOTF_COAL can be used. @Alvaro Karsz
6. Clarify some special scenarios. @Michael S. Tsirkin, @Parav Pandit, @Alvaro Karsz

   content.tex | 69 ++++++++++++++++++++++++++++++++++++++++++++++++++++-
   1 file changed, 68 insertions(+), 1 deletion(-)
content.tex +8 -0
index e863709..2c497e1 100644
@@ -3084,6 +3084,9 @@ \subsection{Feature bits}\label{sec:Device Types / Network Device / Feature bits
   \item[VIRTIO_NET_F_CTRL_MAC_ADDR(23)] Set MAC address through control
       channel.
+\item[VIRTIO_NET_F_VQ_NOTF_COAL(52)] Device supports the virtqueue
+    notifications coalescing.
+
   \item[VIRTIO_NET_F_NOTF_COAL(53)] Device supports notifications coalescing.
   \item[VIRTIO_NET_F_GUEST_USO4 (54)] Driver can receive USOv4 packets.
@@ -3140,6 +3143,7 @@ \subsubsection{Feature bit requirements}\label{sec:Device Types / Network Device
   \item[VIRTIO_NET_F_NOTF_COAL] Requires VIRTIO_NET_F_CTRL_VQ.
   \item[VIRTIO_NET_F_RSC_EXT] Requires VIRTIO_NET_F_HOST_TSO4 or VIRTIO_NET_F_HOST_TSO6.
   \item[VIRTIO_NET_F_RSS] Requires VIRTIO_NET_F_CTRL_VQ.
+\item[VIRTIO_NET_F_VQ_NOTF_COAL] Requires VIRTIO_NET_F_CTRL_VQ and VIRTIO_NET_F_NOTF_COAL.
   \end{description}
   \subsubsection{Legacy Interface: Feature bits}\label{sec:Device Types / Network Device / Feature bits / Legacy Interface: Feature bits}
@@ -4520,6 +4524,49 @@ \subsubsection{Control Virtqueue}\label{sec:Device Types / Network Device / Devi
   \item VIRTIO_NET_CTRL_NOTF_COAL_RX_SET: set the \field{rx_usecs} and \field{rx_max_packets} parameters.
   \end{enumerate}
+If additionally VIRTIO_NET_F_VQ_NOTF_COAL is negotiated, the driver can send
+control commands to set or get the coalescing parameters of a specified
+virtqueue (excluding the control virtqueue).
+
Quoted 8 lines

content.tex \subsubsection{Control Virtqueue}\label{sec:Device Types / Network Device / Devi · line 4535

Quoted 5 lines
content.tex +5 -0
+\begin{lstlisting}
+struct virtio_net_ctrl_coal_vq {
+    le32 max_packets;
+    le32 usecs;
+    le16 vqn;

Add le16 reserved here, so keep things aligned naturally. In fact if you want to support GET you need to re-order things since write buffers come before read buffers:

I see, thanks for pointing it out.

Quoted 20 lines

+ le16 vqn;
+ le16 reserved;

+ le32 max_packets;
+ le32 usecs;

see below for more explanation.

Quoted 10 lines
content.tex +10 -0
+};
+
+#define VIRTIO_NET_CTRL_NOTF_COAL_VQ 7
+ #define VIRTIO_NET_CTRL_NOTF_COAL_VQ_SET 0
+ #define VIRTIO_NET_CTRL_NOTF_COAL_VQ_GET 1
+\end{lstlisting}
+
+Virtqueue coalescing parameters:
+\begin{itemize}
+\item \field{max_packets}: The maximum number of packets sent/received by the
Quoted 8 lines

content.tex \subsubsection{Control Virtqueue}\label{sec:Device Types / Network Device / Devi

Quoted 7 lines
content.tex +7 -0
+    specified virtqueue before a TX/RX notification.
+\item \field{usecs}: The maximum number of TX/RX usecs that the specified
+    virtqueue delays a TX/RX notification.
+\item \field{vqn}: The virtqueue number of the specified virtqueue.
+\end{itemize}
+
+The range of \filed{vqn} is between 0 and 0xFFFF inclusive,

No really because last vq is a cvq. Maybe just drop this?

In fact I have ruled out the control virtqueue.

Quoted 8 lines
Quoted 2 lines
Quoted 1 line

Its virtqueue number should be 0x10000.

Nope, vq numberes are 16 bit.

Yes I know. The [0, 0xFFFF] listed in v2 is the maximum range of virtqueue numbers (including all receiveqs and all transmitqs)
that can be set by the driver, because the current spec says "The device MUST set \field{max_virtqueue_pairs} to between 1 and 0x8000 inclusive, if it offers VIRTIO_NET_F_MQ.".

Oh that looks like a bug since

\item[VIRTIO_NET_F_MQ] Requires VIRTIO_NET_F_CTRL_VQ.

so max_virtqueue_pairs 0x8000 is not legal.

Quoted 8 lines

So assuming that the maximum number of receiveqs and transmitqs are 0x8000 respectively,
then the total is 0x10000 (the queue number to the control queue is 0x10001), that is, the vqn indexed from 0 is [0,0x10000-1]=[0,0xFFFF ], which already excludes controlq.

But I know that you mean to emphasize in the specification that no contro queue is included.

I would just drop The range of \filed{vqn} is between 0 and 0xFFFF inclusive - it is a 16 bit value there is really no point to say any more.

Quoted 150 lines
Quoted 53 lines
Quoted 53 lines
Quoted 11 lines

content.tex \subsubsection{Control Virtqueue}\label{sec:Device Types / Network Device / Devi · line 4556

Quoted 6 lines
$ \lfloor vqn / 2 \rfloor $
content.tex +4 -0
+is the index of the corresponding receiveq, and $\lfloor (vqn / 2) + 1 \rfloor $ is
+the corresponding tranmitq.
+
+The VIRTIO_NET_CTRL_NOTF_COAL_RX_SET command is the same as calling VIRTIO_NET_CTRL_NOTF_COAL_VQ

you don't "call" commands. driver sends them, device receives them. But here you are talking about a command abstracty so I'd just drop a verb, or maybe "repeating".
And "same" is inexact in that it's not the same - takes more time - it just has the same effect, or is equivalent to.

There is indeed a gerund match here, I'll fix that.

Quoted 7 lines
Quoted 2 lines

+for virtqueues corresponding to all receiveqs.

receiveqs is confusing.

Also elsewhere we use the language receiveq1\ldots receiveqn which seems clearer. Also you can not call VIRTIO_NET_CTRL_NOTF_COAL_VQ for all vqs - it applies to one vq only. You mean each.

I express something wrong, but what I mean is to send for each virtqueue.

Quoted 2 lines

And virtqueues do not correspond to receiveqs - they are receiveqs. If you like vqn corresponds to them.

This is ambiguous, the number of virtqueues is 2*N+1, the number of receive queues and transmit queues is N,
and there is also a control queue. Is this a problem?
But I know what you mean it's better to use "same as VIRTIO_NET_CTRL_NOTF_COAL_VQ repeated for each of receiveq1\ldots receiveqn"

Quoted 2 lines

Or better just "same as VIRTIO_NET_CTRL_NOTF_COAL_VQ repeated for each of receiveq1\ldots receiveqn"

Sure.

Quoted 6 lines

content.tex \subsubsection{Control Virtqueue}\label{sec:Device Types / Network Device / Devi · line 4562

Quoted 5 lines
content.tex +5 -0
+
+The VIRTIO_NET_CTRL_NOTF_COAL_TX_SET command is the same as calling VIRTIO_NET_CTRL_NOTF_COAL_VQ
+for virtqueues corresponding to all transmitqs.
+
+Virtqueue coalescing will be disabled if all parameters are set to 0.

In fact, either usecs 0 or max_packets disables coalescing, no?

Yes. I'll fix this.

Quoted 8 lines

content.tex \subsubsection{Control Virtqueue}\label{sec:Device Types / Network Device / Devi · line 4567

Quoted 5 lines
content.tex +5 -0
+
+The class VIRTIO_NET_CTRL_NOTF_COAL_VQ has 2 commands:
+\begin{enumerate}
+\item VIRTIO_NET_CTRL_NOTF_COAL_VQ_SET: set the \field{max_packets}, \field{usecs} and \filed{vqn} parameters.
+\item VIRTIO_NET_CTRL_NOTF_COAL_VQ_GET: get the \field{max_packets}, \field{usecs} and \field{vqn} parameters.

How does VIRTIO_NET_CTRL_NOTF_COAL_VQ_GET work then? For which vq? I think you mean vqn is specified and you get back max_packets and usecs. All this needs to be documented fully for each command.

Yes, VIRTIO_NET_CTRL_NOTF_COAL_VQ_GET gets the parameters of the virtqueue corresponding to vqn each time.

Quoted 7 lines
Quoted 5 lines
Quoted 2 lines

I would also think it's a good idea to mention that VQ_GET does not have to return exactly the same parameters - since it's best effort anyway,

This is confusing, I think the device does not have to set the same parameters for VQ_SET, but for VQ_GET, the device should return to the driver every time.

What I mean is that if you call VQ_SET with a value of 17, device might decide to e.g. store just the power of 2

Oh! I misunderstood what you meant before, I will add an appropriate reminder!

Quoted 78 lines
Quoted 78 lines
Quoted 11 lines

it's ok for device to round down and store a smaller value for either max_packets or usecs, e.g. to save space.

This kind of formalizes the best effort thing we discussed previously.

Maybe make VIRTIO_NET_CTRL_NOTF_COAL_VQ_GET a separate patch - in the series,

No problem, I'll try to describe it as best I can.

Quoted 4 lines

at this point you did not make any effort to document it, it needs more work.

Quoted 9 lines

content.tex \subsubsection{Control Virtqueue}\label{sec:Device Types / Network Device / Devi · line 4584

Quoted 8 lines

+\end{enumerate}

content.tex +2 -0
+
   \subparagraph{RX Notifications}\label{sec:Device Types / Network Device / Device Operation / Control Virtqueue / Notifications Coalescing / RX Notifications}
   If, for example:
@@ -4535,6 +4582,15 @@ \subsubsection{Control Virtqueue}\label{sec:Device Types / Network Device / Devi
   \item If the notifications are not suppressed by the driver, the device will send an used buffer notification, otherwise, the device will not send an used buffer notification as long as the notifications are suppressed.
   \end{itemize}
+If, example of setting coalescing parameters for a receive virtqueue:

"If" without "then" is confusing. I'd just start with "Example".

Ok.

Quoted 5 lines

content.tex \subsubsection{Control Virtqueue}\label{sec:Device Types / Network Device / Devi · line 4589

Quoted 4 lines
content.tex +4 -0
+\begin{itemize}
+\item \field{max_packets} = 15.
+\item \field{usecs} = 10.
+\item \field{vqn} = 0;

why . above and ; here? I would just drop punctuation.

It's a typo and I'll fix it.

Quoted 5 lines

content.tex \subsubsection{Control Virtqueue}\label{sec:Device Types / Network Device / Devi · line 4592

Quoted 3 lines
content.tex +3 -0
+\end{itemize}
+
+The device will only operate on recieveq1 as VIRTIO_NET_CTRL_NOTF_COAL_RX_SET.

This really does not explain anything. Please just document exactly what it does and does not do.

Ok.

Quoted 18 lines
Quoted 6 lines
content.tex +1 -0
+
   \subparagraph{TX Notifications}\label{sec:Device Types / Network Device / Device Operation / Control Virtqueue / Notifications Coalescing / TX Notifications}
   If, for example:
@@ -4550,13 +4606,24 @@ \subsubsection{Control Virtqueue}\label{sec:Device Types / Network Device / Devi
   \item If the notifications are not suppressed by the driver, the device will send an used buffer notification, otherwise, the device will not send an used buffer notification as long as the notifications are suppressed.

content.tex \subsubsection{Control Virtqueue}\label{sec:Device Types / Network Device / Devi · line 4616

Quoted 10 lines
content.tex +9 -0
   \end{itemize}
+If, example of setting coalescing parameters for a transmit virtqueue:
+\begin{itemize}
+\item \field{max_packets} = 15.
+\item \field{usecs} = 10.
+\item \field{vqn} = 1;
+\end{itemize}
+
+The device will only operate on transmitq1 as VIRTIO_NET_CTRL_NOTF_COAL_TX_SET.
+

I feel it's the other way around. Document

Why? I'll add documentation, but read on below.

Quoted 5 lines

content.tex \subsubsection{Control Virtqueue}\label{sec:Device Types / Network Device / Devi · line 4621

Quoted 3 lines
content.tex +1 -0
   \drivernormative{\subparagraph}{Notifications Coalescing}{Device Types / Network Device / Device Operation / Control Virtqueue / Notifications Coalescing}
   If the VIRTIO_NET_F_NOTF_COAL feature has not been negotiated, the driver MUST NOT issue VIRTIO_NET_CTRL_NOTF_COAL commands.
+If the VIRTIO_NET_F_VQ_NOTF_COAL feature has not been negotiated, the driver MUST NOT issue VIRTIO_NET_CTRL_NOFT_COAL_VQ commands.

Don't we want to limit driver to legal values of vqn?

Yes, I will add.

Quoted 7 lines

content.tex \subsubsection{Control Virtqueue}\label{sec:Device Types / Network Device / Devi · line 4626

Quoted 4 lines
content.tex +2 -1
   \devicenormative{\subparagraph}{Notifications Coalescing}{Device Types / Network Device / Device Operation / Control Virtqueue / Notifications Coalescing}
-A device SHOULD respond to the VIRTIO_NET_CTRL_NOTF_COAL commands with VIRTIO_NET_ERR if it was not able to change the parameters.
+A device SHOULD respond to the VIRTIO_NET_CTRL_NOTF_COAL commands with VIRTIO_NET_ERR if it was not able to change the parameters or
+was not able to find a virtqueue using the \field{vqn}.

First please create multiple statements not a single long one. Second vqn only exists for per vq commands so create a statement just for that.

Ok, reasonable.

Quoted 7 lines
Quoted 3 lines
Quoted 2 lines

Also more explicit please. What does this mean? I suspect that vq was not enabled?

Indicates that a vqn cannot be mapped to the corresponding virtqueue.

Still no idea. what is this mapping you are talking about. Why can't it be mapped? what is corresponding to what?

vq with this number is not enabled or vqn >= 2max_virtqueue_pairs are

Quoted 39 lines

I am referring to the former.

Quoted 2 lines

the only reasons i could come up with. if that's it just say so. if not list the actual reasons.

Sorry, I will explain more clearly later.

Thanks.

Quoted 30 lines
Quoted 5 lines
Quoted 2 lines

Also, we MUST have vqn < max_virtqueue_pairs.

Here should be vq < max_virtqueue_pairs * 2?

Thanks.

yea.

Quoted 11 lines
Quoted 11 lines
Quoted 4 lines
content.tex +0 -0
   A device SHOULD NOT send used buffer notifications to the driver, if the notifications are suppressed as explained in \ref{sec:Basic Facilities of a Virtio Device / Virtqueues / Used Buffer Notification Suppression}, even if the coalescing counters expired.
Signature · 1 line
2.19.1.6.gb485710b

This publicly archived list offers a means to provide input to the OASIS Virtual I/O Device (VIRTIO) TC.

In order to verify user consent to the Feedback License terms and to minimize spam in the list archive, subscription is required before posting.

Quoted 8 lines
Quoted 8 lines

Subscribe: [email protected]
Unsubscribe: [email protected]
List help: [email protected]
List archive: https://lists.oasis-open.org/archives/virtio-comment/
Feedback License: https://www.oasis-open.org/who/ipr/feedback_license.pdf
List Guidelines: https://www.oasis-open.org/policies-guidelines/mailing-lists
Committee: https://www.oasis-open.org/committees/virtio/
Join OASIS: https://www.oasis-open.org/join/

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]

This publicly archived list offers a means to provide input to the OASIS Virtual I/O Device (VIRTIO) TC.

In order to verify user consent to the Feedback License terms and to minimize spam in the list archive, subscription is required before posting.

Subscribe: [email protected]
Unsubscribe: [email protected]
List help: [email protected]
List archive: https://lists.oasis-open.org/archives/virtio-comment/
Feedback License: https://www.oasis-open.org/who/ipr/feedback_license.pdf
List Guidelines: https://www.oasis-open.org/policies-guidelines/mailing-lists
Committee: https://www.oasis-open.org/committees/virtio/
Join OASIS: https://www.oasis-open.org/join/

author
#8 lore raw
Quoted 102 lines · Michael S. Tsirkin
Quoted 94 lines · Heng Qi
Quoted 92 lines · Michael S. Tsirkin
Quoted 91 lines · Heng Qi
Quoted 50 lines · Michael S. Tsirkin
Quoted 10 lines · Heng Qi

Currently, the coalescing profile is directly applied to all queues. This patch supports setting or getting the parameters for a specified queue, and a typical application of this function is NetDIM.

When the traffic between queues is unbalanced, for example, one queue is busy and another queue is idle, then it will be very useful to control coalescing parameters at the queue granularity.

I like this generally, thanks! Language needs to be tightened a bit.

Quoted 38 lines

---
v1->v2:
1. Rename VIRTIO_NET_F_PERQUEUE_NOTF_COAL to VIRTIO_NET_F_VQ_NOTF_COAL. @Michael S. Tsirkin
2. Use the \field{vqn} instead of the qid. @Michael S. Tsirkin
3. Unify tx and rx control structres into one structure virtio_net_ctrl_coal_vq. @Michael S. Tsirkin
4. Add a new control command VIRTIO_NET_CTRL_NOTF_COAL_VQ. @Michael S. Tsirkin, @Parav Pandit, @Alvaro Karsz
5. The special value 0xFFF is removed because VIRTIO_NET_CTRL_NOTF_COAL can be used. @Alvaro Karsz
6. Clarify some special scenarios. @Michael S. Tsirkin, @Parav Pandit, @Alvaro Karsz

content.tex | 69 ++++++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 68 insertions(+), 1 deletion(-)

content.tex +8 -0
index e863709..2c497e1 100644
@@ -3084,6 +3084,9 @@ \subsection{Feature bits}\label{sec:Device Types / Network Device / Feature bits
    \item[VIRTIO_NET_F_CTRL_MAC_ADDR(23)] Set MAC address through control
        channel.
+\item[VIRTIO_NET_F_VQ_NOTF_COAL(52)] Device supports the virtqueue
+    notifications coalescing.
+
    \item[VIRTIO_NET_F_NOTF_COAL(53)] Device supports notifications coalescing.
    \item[VIRTIO_NET_F_GUEST_USO4 (54)] Driver can receive USOv4 packets.
@@ -3140,6 +3143,7 @@ \subsubsection{Feature bit requirements}\label{sec:Device Types / Network Device
    \item[VIRTIO_NET_F_NOTF_COAL] Requires VIRTIO_NET_F_CTRL_VQ.
    \item[VIRTIO_NET_F_RSC_EXT] Requires VIRTIO_NET_F_HOST_TSO4 or VIRTIO_NET_F_HOST_TSO6.
    \item[VIRTIO_NET_F_RSS] Requires VIRTIO_NET_F_CTRL_VQ.
+\item[VIRTIO_NET_F_VQ_NOTF_COAL] Requires VIRTIO_NET_F_CTRL_VQ and VIRTIO_NET_F_NOTF_COAL.
    \end{description}
    \subsubsection{Legacy Interface: Feature bits}\label{sec:Device Types / Network Device / Feature bits / Legacy Interface: Feature bits}
@@ -4520,6 +4524,49 @@ \subsubsection{Control Virtqueue}\label{sec:Device Types / Network Device / Devi
    \item VIRTIO_NET_CTRL_NOTF_COAL_RX_SET: set the \field{rx_usecs} and \field{rx_max_packets} parameters.
    \end{enumerate}
+If additionally VIRTIO_NET_F_VQ_NOTF_COAL is negotiated, the driver can send
+control commands to set or get the coalescing parameters of a specified
+virtqueue (excluding the control virtqueue).
+
Quoted 8 lines

content.tex \subsubsection{Control Virtqueue}\label{sec:Device Types / Network Device / Devi · line 4535

Quoted 5 lines
content.tex +5 -0
+\begin{lstlisting}
+struct virtio_net_ctrl_coal_vq {
+    le32 max_packets;
+    le32 usecs;
+    le16 vqn;

Add le16 reserved here, so keep things aligned naturally. In fact if you want to support GET you need to re-order things since write buffers come before read buffers:

I see, thanks for pointing it out.

Quoted 20 lines

+ le16 vqn;
+ le16 reserved;

+ le32 max_packets;
+ le32 usecs;

see below for more explanation.

Quoted 10 lines
content.tex +10 -0
+};
+
+#define VIRTIO_NET_CTRL_NOTF_COAL_VQ 7
+ #define VIRTIO_NET_CTRL_NOTF_COAL_VQ_SET 0
+ #define VIRTIO_NET_CTRL_NOTF_COAL_VQ_GET 1
+\end{lstlisting}
+
+Virtqueue coalescing parameters:
+\begin{itemize}
+\item \field{max_packets}: The maximum number of packets sent/received by the
Quoted 8 lines

content.tex \subsubsection{Control Virtqueue}\label{sec:Device Types / Network Device / Devi

Quoted 7 lines
content.tex +7 -0
+    specified virtqueue before a TX/RX notification.
+\item \field{usecs}: The maximum number of TX/RX usecs that the specified
+    virtqueue delays a TX/RX notification.
+\item \field{vqn}: The virtqueue number of the specified virtqueue.
+\end{itemize}
+
+The range of \filed{vqn} is between 0 and 0xFFFF inclusive,

No really because last vq is a cvq. Maybe just drop this?

In fact I have ruled out the control virtqueue.

Quoted 7 lines
Quoted 2 lines
Quoted 1 line

Its virtqueue number should be 0x10000.

Nope, vq numberes are 16 bit.

Yes I know. The [0, 0xFFFF] listed in v2 is the maximum range of virtqueue numbers (including all receiveqs and all transmitqs)
that can be set by the driver, because the current spec says "The device MUST set \field{max_virtqueue_pairs} to between 1 and 0x8000 inclusive, if it offers VIRTIO_NET_F_MQ.".

Quoted 5 lines

Oh that looks like a bug since

\item[VIRTIO_NET_F_MQ] Requires VIRTIO_NET_F_CTRL_VQ.

so max_virtqueue_pairs 0x8000 is not legal.

No, it's not a bug.
As described in the specification:
"This field specifies the maximum number of each of transmit and receive virtqueues (receiveq1\ldots receiveqN and transmitq1\ldots transmitqN respectively) that can be configured once at least one of these features is negotiated."
\field{max_virtqueue_pairs} does not include control queue.

Quoted 8 lines
Quoted 8 lines

So assuming that the maximum number of receiveqs and transmitqs are 0x8000 respectively,
then the total is 0x10000 (the queue number to the control queue is 0x10001), that is, the vqn indexed from 0 is [0,0x10000-1]=[0,0xFFFF ], which already excludes controlq.

Quoted 5 lines
Quoted 2 lines

But I know that you mean to emphasize in the specification that no contro queue is included.

I would just drop The range of \filed{vqn} is between 0 and 0xFFFF inclusive - it is a 16 bit value there is really no point to say any more.

Sure. :)

Thanks.

Quoted 177 lines
Quoted 177 lines
Quoted 52 lines
Quoted 52 lines
Quoted 11 lines

content.tex \subsubsection{Control Virtqueue}\label{sec:Device Types / Network Device / Devi · line 4556

Quoted 6 lines
$ \lfloor vqn / 2 \rfloor $
content.tex +4 -0
+is the index of the corresponding receiveq, and $\lfloor (vqn / 2) + 1 \rfloor $ is
+the corresponding tranmitq.
+
+The VIRTIO_NET_CTRL_NOTF_COAL_RX_SET command is the same as calling VIRTIO_NET_CTRL_NOTF_COAL_VQ

you don't "call" commands. driver sends them, device receives them. But here you are talking about a command abstracty so I'd just drop a verb, or maybe "repeating".
And "same" is inexact in that it's not the same - takes more time - it just has the same effect, or is equivalent to.

There is indeed a gerund match here, I'll fix that.

Quoted 6 lines
Quoted 1 line

+for virtqueues corresponding to all receiveqs.

receiveqs is confusing.

Also elsewhere we use the language receiveq1\ldots receiveqn which seems clearer. Also you can not call VIRTIO_NET_CTRL_NOTF_COAL_VQ for all vqs - it applies to one vq only. You mean each.

I express something wrong, but what I mean is to send for each virtqueue.

Quoted 2 lines

And virtqueues do not correspond to receiveqs - they are receiveqs. If you like vqn corresponds to them.

This is ambiguous, the number of virtqueues is 2*N+1, the number of receive queues and transmit queues is N,
and there is also a control queue. Is this a problem?
But I know what you mean it's better to use "same as VIRTIO_NET_CTRL_NOTF_COAL_VQ repeated for each of receiveq1\ldots receiveqn"

Quoted 2 lines

Or better just "same as VIRTIO_NET_CTRL_NOTF_COAL_VQ repeated for each of receiveq1\ldots receiveqn"

Sure.

Quoted 6 lines

content.tex \subsubsection{Control Virtqueue}\label{sec:Device Types / Network Device / Devi · line 4562

Quoted 5 lines
content.tex +5 -0
+
+The VIRTIO_NET_CTRL_NOTF_COAL_TX_SET command is the same as calling VIRTIO_NET_CTRL_NOTF_COAL_VQ
+for virtqueues corresponding to all transmitqs.
+
+Virtqueue coalescing will be disabled if all parameters are set to 0.

In fact, either usecs 0 or max_packets disables coalescing, no?

Yes. I'll fix this.

Quoted 8 lines

content.tex \subsubsection{Control Virtqueue}\label{sec:Device Types / Network Device / Devi · line 4567

Quoted 5 lines
content.tex +5 -0
+
+The class VIRTIO_NET_CTRL_NOTF_COAL_VQ has 2 commands:
+\begin{enumerate}
+\item VIRTIO_NET_CTRL_NOTF_COAL_VQ_SET: set the \field{max_packets}, \field{usecs} and \filed{vqn} parameters.
+\item VIRTIO_NET_CTRL_NOTF_COAL_VQ_GET: get the \field{max_packets}, \field{usecs} and \field{vqn} parameters.

How does VIRTIO_NET_CTRL_NOTF_COAL_VQ_GET work then? For which vq? I think you mean vqn is specified and you get back max_packets and usecs. All this needs to be documented fully for each command.

Yes, VIRTIO_NET_CTRL_NOTF_COAL_VQ_GET gets the parameters of the virtqueue corresponding to vqn each time.

Quoted 7 lines
Quoted 5 lines
Quoted 2 lines

I would also think it's a good idea to mention that VQ_GET does not have to return exactly the same parameters - since it's best effort anyway,

This is confusing, I think the device does not have to set the same parameters for VQ_SET, but for VQ_GET, the device should return to the driver every time.

What I mean is that if you call VQ_SET with a value of 17, device might decide to e.g. store just the power of 2

Oh! I misunderstood what you meant before, I will add an appropriate reminder!

Quoted 76 lines
Quoted 76 lines
Quoted 10 lines

it's ok for device to round down and store a smaller value for either max_packets or usecs, e.g. to save space.

This kind of formalizes the best effort thing we discussed previously.

Maybe make VIRTIO_NET_CTRL_NOTF_COAL_VQ_GET a separate patch - in the series,

No problem, I'll try to describe it as best I can.

Quoted 4 lines

at this point you did not make any effort to document it, it needs more work.

Quoted 9 lines

content.tex \subsubsection{Control Virtqueue}\label{sec:Device Types / Network Device / Devi · line 4584

Quoted 8 lines

+\end{enumerate}

content.tex +2 -0
+
    \subparagraph{RX Notifications}\label{sec:Device Types / Network Device / Device Operation / Control Virtqueue / Notifications Coalescing / RX Notifications}
    If, for example:
@@ -4535,6 +4582,15 @@ \subsubsection{Control Virtqueue}\label{sec:Device Types / Network Device / Devi
    \item If the notifications are not suppressed by the driver, the device will send an used buffer notification, otherwise, the device will not send an used buffer notification as long as the notifications are suppressed.
    \end{itemize}
+If, example of setting coalescing parameters for a receive virtqueue:

"If" without "then" is confusing. I'd just start with "Example".

Ok.

Quoted 5 lines

content.tex \subsubsection{Control Virtqueue}\label{sec:Device Types / Network Device / Devi · line 4589

Quoted 4 lines
content.tex +4 -0
+\begin{itemize}
+\item \field{max_packets} = 15.
+\item \field{usecs} = 10.
+\item \field{vqn} = 0;

why . above and ; here? I would just drop punctuation.

It's a typo and I'll fix it.

Quoted 5 lines

content.tex \subsubsection{Control Virtqueue}\label{sec:Device Types / Network Device / Devi · line 4592

Quoted 3 lines
content.tex +3 -0
+\end{itemize}
+
+The device will only operate on recieveq1 as VIRTIO_NET_CTRL_NOTF_COAL_RX_SET.

This really does not explain anything. Please just document exactly what it does and does not do.

Ok.

Quoted 8 lines
Quoted 8 lines
content.tex +3 -0
+
    \subparagraph{TX Notifications}\label{sec:Device Types / Network Device / Device Operation / Control Virtqueue / Notifications Coalescing / TX Notifications}
    If, for example:
@@ -4550,13 +4606,24 @@ \subsubsection{Control Virtqueue}\label{sec:Device Types / Network Device / Devi
    \item If the notifications are not suppressed by the driver, the device will send an used buffer notification, otherwise, the device will not send an used buffer notification as long as the notifications are suppressed.
    \end{itemize}
+If, example of setting coalescing parameters for a transmit virtqueue:
+\begin{itemize}
Quoted 9 lines

content.tex \subsubsection{Control Virtqueue}\label{sec:Device Types / Network Device / Devi · line 4617

Quoted 7 lines
content.tex +7 -0
+\item \field{max_packets} = 15.
+\item \field{usecs} = 10.
+\item \field{vqn} = 1;
+\end{itemize}
+
+The device will only operate on transmitq1 as VIRTIO_NET_CTRL_NOTF_COAL_TX_SET.
+

I feel it's the other way around. Document

Why? I'll add documentation, but read on below.

Quoted 5 lines

content.tex \subsubsection{Control Virtqueue}\label{sec:Device Types / Network Device / Devi · line 4621

Quoted 3 lines
content.tex +1 -0
    \drivernormative{\subparagraph}{Notifications Coalescing}{Device Types / Network Device / Device Operation / Control Virtqueue / Notifications Coalescing}
    If the VIRTIO_NET_F_NOTF_COAL feature has not been negotiated, the driver MUST NOT issue VIRTIO_NET_CTRL_NOTF_COAL commands.
+If the VIRTIO_NET_F_VQ_NOTF_COAL feature has not been negotiated, the driver MUST NOT issue VIRTIO_NET_CTRL_NOFT_COAL_VQ commands.

Don't we want to limit driver to legal values of vqn?

Yes, I will add.

Quoted 7 lines

content.tex \subsubsection{Control Virtqueue}\label{sec:Device Types / Network Device / Devi · line 4626

Quoted 4 lines
content.tex +2 -1
    \devicenormative{\subparagraph}{Notifications Coalescing}{Device Types / Network Device / Device Operation / Control Virtqueue / Notifications Coalescing}
-A device SHOULD respond to the VIRTIO_NET_CTRL_NOTF_COAL commands with VIRTIO_NET_ERR if it was not able to change the parameters.
+A device SHOULD respond to the VIRTIO_NET_CTRL_NOTF_COAL commands with VIRTIO_NET_ERR if it was not able to change the parameters or
+was not able to find a virtqueue using the \field{vqn}.

First please create multiple statements not a single long one. Second vqn only exists for per vq commands so create a statement just for that.

Ok, reasonable.

Quoted 7 lines
Quoted 3 lines
Quoted 2 lines

Also more explicit please. What does this mean? I suspect that vq was not enabled?

Indicates that a vqn cannot be mapped to the corresponding virtqueue.

Still no idea. what is this mapping you are talking about. Why can't it be mapped? what is corresponding to what?

vq with this number is not enabled or vqn >= 2max_virtqueue_pairs are

I am referring to the former.

Quoted 2 lines

the only reasons i could come up with. if that's it just say so. if not list the actual reasons.

Sorry, I will explain more clearly later.

Thanks.

Quoted 24 lines
Quoted 4 lines
Quoted 1 line

Also, we MUST have vqn < max_virtqueue_pairs.

Here should be vq < max_virtqueue_pairs * 2?

Thanks.

yea.

Quoted 18 lines
Quoted 18 lines
Quoted 3 lines
content.tex +0 -0
    A device SHOULD NOT send used buffer notifications to the driver, if the notifications are suppressed as explained in \ref{sec:Basic Facilities of a Virtio Device / Virtqueues / Used Buffer Notification Suppression}, even if the coalescing counters expired.
Signature · 1 line
2.19.1.6.gb485710b

This publicly archived list offers a means to provide input to the OASIS Virtual I/O Device (VIRTIO) TC.

In order to verify user consent to the Feedback License terms and to minimize spam in the list archive, subscription is required before posting.

Subscribe: [email protected]
Unsubscribe: [email protected]
List help: [email protected]
List archive: https://lists.oasis-open.org/archives/virtio-comment/
Feedback License: https://www.oasis-open.org/who/ipr/feedback_license.pdf
List Guidelines: https://www.oasis-open.org/policies-guidelines/mailing-lists
Committee: https://www.oasis-open.org/committees/virtio/
Join OASIS: https://www.oasis-open.org/join/

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]

This publicly archived list offers a means to provide input to the OASIS Virtual I/O Device (VIRTIO) TC.

In order to verify user consent to the Feedback License terms and to minimize spam in the list archive, subscription is required before posting.

Subscribe: [email protected]
Unsubscribe: [email protected]
List help: [email protected]
List archive: https://lists.oasis-open.org/archives/virtio-comment/
Feedback License: https://www.oasis-open.org/who/ipr/feedback_license.pdf
List Guidelines: https://www.oasis-open.org/policies-guidelines/mailing-lists
Committee: https://www.oasis-open.org/committees/virtio/
Join OASIS: https://www.oasis-open.org/join/

#9 lore raw
Quoted 111 lines · Heng Qi
Quoted 102 lines · Michael S. Tsirkin
Quoted 94 lines · Heng Qi
Quoted 92 lines · Michael S. Tsirkin
Quoted 91 lines · Heng Qi
Quoted 50 lines · Michael S. Tsirkin
Quoted 10 lines · Heng Qi

Currently, the coalescing profile is directly applied to all queues. This patch supports setting or getting the parameters for a specified queue, and a typical application of this function is NetDIM.

When the traffic between queues is unbalanced, for example, one queue is busy and another queue is idle, then it will be very useful to control coalescing parameters at the queue granularity.

I like this generally, thanks! Language needs to be tightened a bit.

Quoted 38 lines

---
v1->v2:
1. Rename VIRTIO_NET_F_PERQUEUE_NOTF_COAL to VIRTIO_NET_F_VQ_NOTF_COAL. @Michael S. Tsirkin
2. Use the \field{vqn} instead of the qid. @Michael S. Tsirkin
3. Unify tx and rx control structres into one structure virtio_net_ctrl_coal_vq. @Michael S. Tsirkin
4. Add a new control command VIRTIO_NET_CTRL_NOTF_COAL_VQ. @Michael S. Tsirkin, @Parav Pandit, @Alvaro Karsz
5. The special value 0xFFF is removed because VIRTIO_NET_CTRL_NOTF_COAL can be used. @Alvaro Karsz
6. Clarify some special scenarios. @Michael S. Tsirkin, @Parav Pandit, @Alvaro Karsz

content.tex | 69 ++++++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 68 insertions(+), 1 deletion(-)

content.tex +8 -0
index e863709..2c497e1 100644
@@ -3084,6 +3084,9 @@ \subsection{Feature bits}\label{sec:Device Types / Network Device / Feature bits
    \item[VIRTIO_NET_F_CTRL_MAC_ADDR(23)] Set MAC address through control
        channel.
+\item[VIRTIO_NET_F_VQ_NOTF_COAL(52)] Device supports the virtqueue
+    notifications coalescing.
+
    \item[VIRTIO_NET_F_NOTF_COAL(53)] Device supports notifications coalescing.
    \item[VIRTIO_NET_F_GUEST_USO4 (54)] Driver can receive USOv4 packets.
@@ -3140,6 +3143,7 @@ \subsubsection{Feature bit requirements}\label{sec:Device Types / Network Device
    \item[VIRTIO_NET_F_NOTF_COAL] Requires VIRTIO_NET_F_CTRL_VQ.
    \item[VIRTIO_NET_F_RSC_EXT] Requires VIRTIO_NET_F_HOST_TSO4 or VIRTIO_NET_F_HOST_TSO6.
    \item[VIRTIO_NET_F_RSS] Requires VIRTIO_NET_F_CTRL_VQ.
+\item[VIRTIO_NET_F_VQ_NOTF_COAL] Requires VIRTIO_NET_F_CTRL_VQ and VIRTIO_NET_F_NOTF_COAL.
    \end{description}
    \subsubsection{Legacy Interface: Feature bits}\label{sec:Device Types / Network Device / Feature bits / Legacy Interface: Feature bits}
@@ -4520,6 +4524,49 @@ \subsubsection{Control Virtqueue}\label{sec:Device Types / Network Device / Devi
    \item VIRTIO_NET_CTRL_NOTF_COAL_RX_SET: set the \field{rx_usecs} and \field{rx_max_packets} parameters.
    \end{enumerate}
+If additionally VIRTIO_NET_F_VQ_NOTF_COAL is negotiated, the driver can send
+control commands to set or get the coalescing parameters of a specified
+virtqueue (excluding the control virtqueue).
+
Quoted 8 lines

content.tex \subsubsection{Control Virtqueue}\label{sec:Device Types / Network Device / Devi · line 4534

Quoted 5 lines
content.tex +5 -0
+\begin{lstlisting}
+struct virtio_net_ctrl_coal_vq {
+    le32 max_packets;
+    le32 usecs;
+    le16 vqn;

Add le16 reserved here, so keep things aligned naturally. In fact if you want to support GET you need to re-order things since write buffers come before read buffers:

I see, thanks for pointing it out.

Quoted 20 lines

+ le16 vqn;
+ le16 reserved;

+ le32 max_packets;
+ le32 usecs;

see below for more explanation.

Quoted 10 lines
content.tex +10 -0
+};
+
+#define VIRTIO_NET_CTRL_NOTF_COAL_VQ 7
+ #define VIRTIO_NET_CTRL_NOTF_COAL_VQ_SET 0
+ #define VIRTIO_NET_CTRL_NOTF_COAL_VQ_GET 1
+\end{lstlisting}
+
+Virtqueue coalescing parameters:
+\begin{itemize}
+\item \field{max_packets}: The maximum number of packets sent/received by the
Quoted 8 lines

content.tex \subsubsection{Control Virtqueue}\label{sec:Device Types / Network Device / Devi · line 4551

Quoted 7 lines
content.tex +7 -0
+    specified virtqueue before a TX/RX notification.
+\item \field{usecs}: The maximum number of TX/RX usecs that the specified
+    virtqueue delays a TX/RX notification.
+\item \field{vqn}: The virtqueue number of the specified virtqueue.
+\end{itemize}
+
+The range of \filed{vqn} is between 0 and 0xFFFF inclusive,

No really because last vq is a cvq. Maybe just drop this?

In fact I have ruled out the control virtqueue.

Quoted 7 lines
Quoted 2 lines
Quoted 1 line

Its virtqueue number should be 0x10000.

Nope, vq numberes are 16 bit.

Yes I know. The [0, 0xFFFF] listed in v2 is the maximum range of virtqueue numbers (including all receiveqs and all transmitqs)
that can be set by the driver, because the current spec says "The device MUST set \field{max_virtqueue_pairs} to between 1 and 0x8000 inclusive, if it offers VIRTIO_NET_F_MQ.".

Quoted 5 lines

Oh that looks like a bug since

\item[VIRTIO_NET_F_MQ] Requires VIRTIO_NET_F_CTRL_VQ.

so max_virtqueue_pairs 0x8000 is not legal.

Quoted 7 lines

No, it's not a bug.
As described in the specification:
"This field specifies the maximum number of each of transmit and receive virtqueues (receiveq1\ldots receiveqN and transmitq1\ldots transmitqN respectively)
that can be configured once at least one of these features is negotiated." \field{max_virtqueue_pairs} does not include control queue.

there is no way to have 0x8000 of these pairs though.

Quoted 10 lines
Quoted 10 lines
Quoted 10 lines

So assuming that the maximum number of receiveqs and transmitqs are 0x8000 respectively,
then the total is 0x10000 (the queue number to the control queue is 0x10001), that is, the vqn indexed from 0 is [0,0x10000-1]=[0,0xFFFF ], which already excludes controlq.

But I know that you mean to emphasize in the specification that no contro queue is included.

Quoted 188 lines
Quoted 3 lines

I would just drop The range of \filed{vqn} is between 0 and 0xFFFF inclusive - it is a 16 bit value there is really no point to say any more.

Sure. :)

Thanks.

Quoted 180 lines
Quoted 180 lines
Quoted 52 lines
Quoted 52 lines
Quoted 11 lines

content.tex

Quoted 6 lines
$ \lfloor vqn / 2 \rfloor $
content.tex +4 -0
+is the index of the corresponding receiveq, and $\lfloor (vqn / 2) + 1 \rfloor $ is
+the corresponding tranmitq.
+
+The VIRTIO_NET_CTRL_NOTF_COAL_RX_SET command is the same as calling VIRTIO_NET_CTRL_NOTF_COAL_VQ

you don't "call" commands. driver sends them, device receives them. But here you are talking about a command abstracty so I'd just drop a verb, or maybe "repeating".
And "same" is inexact in that it's not the same - takes more time - it just has the same effect, or is equivalent to.

There is indeed a gerund match here, I'll fix that.

Quoted 6 lines
Quoted 1 line

+for virtqueues corresponding to all receiveqs.

receiveqs is confusing.

Also elsewhere we use the language receiveq1\ldots receiveqn which seems clearer. Also you can not call VIRTIO_NET_CTRL_NOTF_COAL_VQ for all vqs - it applies to one vq only. You mean each.

I express something wrong, but what I mean is to send for each virtqueue.

Quoted 2 lines

And virtqueues do not correspond to receiveqs - they are receiveqs. If you like vqn corresponds to them.

This is ambiguous, the number of virtqueues is 2*N+1, the number of receive queues and transmit queues is N,
and there is also a control queue. Is this a problem?
But I know what you mean it's better to use "same as VIRTIO_NET_CTRL_NOTF_COAL_VQ repeated for each of receiveq1\ldots receiveqn"

Quoted 2 lines

Or better just "same as VIRTIO_NET_CTRL_NOTF_COAL_VQ repeated for each of receiveq1\ldots receiveqn"

Sure.

Quoted 6 lines

content.tex

Quoted 5 lines
content.tex +5 -0
+
+The VIRTIO_NET_CTRL_NOTF_COAL_TX_SET command is the same as calling VIRTIO_NET_CTRL_NOTF_COAL_VQ
+for virtqueues corresponding to all transmitqs.
+
+Virtqueue coalescing will be disabled if all parameters are set to 0.

In fact, either usecs 0 or max_packets disables coalescing, no?

Yes. I'll fix this.

Quoted 8 lines

content.tex

Quoted 5 lines
content.tex +5 -0
+
+The class VIRTIO_NET_CTRL_NOTF_COAL_VQ has 2 commands:
+\begin{enumerate}
+\item VIRTIO_NET_CTRL_NOTF_COAL_VQ_SET: set the \field{max_packets}, \field{usecs} and \filed{vqn} parameters.
+\item VIRTIO_NET_CTRL_NOTF_COAL_VQ_GET: get the \field{max_packets}, \field{usecs} and \field{vqn} parameters.

How does VIRTIO_NET_CTRL_NOTF_COAL_VQ_GET work then? For which vq? I think you mean vqn is specified and you get back max_packets and usecs. All this needs to be documented fully for each command.

Yes, VIRTIO_NET_CTRL_NOTF_COAL_VQ_GET gets the parameters of the virtqueue corresponding to vqn each time.

Quoted 7 lines
Quoted 5 lines
Quoted 2 lines

I would also think it's a good idea to mention that VQ_GET does not have to return exactly the same parameters - since it's best effort anyway,

This is confusing, I think the device does not have to set the same parameters for VQ_SET, but for VQ_GET, the device should return to the driver every time.

What I mean is that if you call VQ_SET with a value of 17, device might decide to e.g. store just the power of 2

Oh! I misunderstood what you meant before, I will add an appropriate reminder!

Quoted 76 lines
Quoted 76 lines
Quoted 10 lines

it's ok for device to round down and store a smaller value for either max_packets or usecs, e.g. to save space.

This kind of formalizes the best effort thing we discussed previously.

Maybe make VIRTIO_NET_CTRL_NOTF_COAL_VQ_GET a separate patch - in the series,

No problem, I'll try to describe it as best I can.

Quoted 4 lines

at this point you did not make any effort to document it, it needs more work.

Quoted 9 lines

content.tex \subsubsection{Control Virtqueue}\label{sec:Device Types / Network Device / Devi · line 4584

Quoted 8 lines

+\end{enumerate}

content.tex +2 -0
+
    \subparagraph{RX Notifications}\label{sec:Device Types / Network Device / Device Operation / Control Virtqueue / Notifications Coalescing / RX Notifications}
    If, for example:
@@ -4535,6 +4582,15 @@ \subsubsection{Control Virtqueue}\label{sec:Device Types / Network Device / Devi
    \item If the notifications are not suppressed by the driver, the device will send an used buffer notification, otherwise, the device will not send an used buffer notification as long as the notifications are suppressed.
    \end{itemize}
+If, example of setting coalescing parameters for a receive virtqueue:

"If" without "then" is confusing. I'd just start with "Example".

Ok.

Quoted 5 lines

content.tex \subsubsection{Control Virtqueue}\label{sec:Device Types / Network Device / Devi · line 4588

Quoted 4 lines
content.tex +4 -0
+\begin{itemize}
+\item \field{max_packets} = 15.
+\item \field{usecs} = 10.
+\item \field{vqn} = 0;

why . above and ; here? I would just drop punctuation.

It's a typo and I'll fix it.

Quoted 5 lines

content.tex \subsubsection{Control Virtqueue}\label{sec:Device Types / Network Device / Devi · line 4591

Quoted 3 lines
content.tex +3 -0
+\end{itemize}
+
+The device will only operate on recieveq1 as VIRTIO_NET_CTRL_NOTF_COAL_RX_SET.

This really does not explain anything. Please just document exactly what it does and does not do.

Ok.

Quoted 8 lines
Quoted 8 lines
content.tex +3 -0
+
    \subparagraph{TX Notifications}\label{sec:Device Types / Network Device / Device Operation / Control Virtqueue / Notifications Coalescing / TX Notifications}
    If, for example:
@@ -4550,13 +4606,24 @@ \subsubsection{Control Virtqueue}\label{sec:Device Types / Network Device / Devi
    \item If the notifications are not suppressed by the driver, the device will send an used buffer notification, otherwise, the device will not send an used buffer notification as long as the notifications are suppressed.
    \end{itemize}
+If, example of setting coalescing parameters for a transmit virtqueue:
+\begin{itemize}
Quoted 9 lines

content.tex \subsubsection{Control Virtqueue}\label{sec:Device Types / Network Device / Devi · line 4616

Quoted 7 lines
content.tex +7 -0
+\item \field{max_packets} = 15.
+\item \field{usecs} = 10.
+\item \field{vqn} = 1;
+\end{itemize}
+
+The device will only operate on transmitq1 as VIRTIO_NET_CTRL_NOTF_COAL_TX_SET.
+

I feel it's the other way around. Document

Why? I'll add documentation, but read on below.

Quoted 5 lines

content.tex \subsubsection{Control Virtqueue}\label{sec:Device Types / Network Device / Devi · line 4619

Quoted 3 lines
content.tex +1 -0
    \drivernormative{\subparagraph}{Notifications Coalescing}{Device Types / Network Device / Device Operation / Control Virtqueue / Notifications Coalescing}
    If the VIRTIO_NET_F_NOTF_COAL feature has not been negotiated, the driver MUST NOT issue VIRTIO_NET_CTRL_NOTF_COAL commands.
+If the VIRTIO_NET_F_VQ_NOTF_COAL feature has not been negotiated, the driver MUST NOT issue VIRTIO_NET_CTRL_NOFT_COAL_VQ commands.

Don't we want to limit driver to legal values of vqn?

Yes, I will add.

Quoted 7 lines

content.tex \subsubsection{Control Virtqueue}\label{sec:Device Types / Network Device / Devi · line 4622

Quoted 4 lines
content.tex +2 -1
    \devicenormative{\subparagraph}{Notifications Coalescing}{Device Types / Network Device / Device Operation / Control Virtqueue / Notifications Coalescing}
-A device SHOULD respond to the VIRTIO_NET_CTRL_NOTF_COAL commands with VIRTIO_NET_ERR if it was not able to change the parameters.
+A device SHOULD respond to the VIRTIO_NET_CTRL_NOTF_COAL commands with VIRTIO_NET_ERR if it was not able to change the parameters or
+was not able to find a virtqueue using the \field{vqn}.

First please create multiple statements not a single long one. Second vqn only exists for per vq commands so create a statement just for that.

Ok, reasonable.

Quoted 7 lines
Quoted 3 lines
Quoted 2 lines

Also more explicit please. What does this mean? I suspect that vq was not enabled?

Indicates that a vqn cannot be mapped to the corresponding virtqueue.

Still no idea. what is this mapping you are talking about. Why can't it be mapped? what is corresponding to what?

vq with this number is not enabled or vqn >= 2max_virtqueue_pairs are

I am referring to the former.

Quoted 2 lines

the only reasons i could come up with. if that's it just say so. if not list the actual reasons.

Sorry, I will explain more clearly later.

Thanks.

Quoted 27 lines
Quoted 4 lines
Quoted 1 line

Also, we MUST have vqn < max_virtqueue_pairs.

Here should be vq < max_virtqueue_pairs * 2?

Thanks.

yea.

Quoted 10 lines
Quoted 10 lines
Quoted 3 lines
content.tex +0 -0
    A device SHOULD NOT send used buffer notifications to the driver, if the notifications are suppressed as explained in \ref{sec:Basic Facilities of a Virtio Device / Virtqueues / Used Buffer Notification Suppression}, even if the coalescing counters expired.
Signature · 1 line
2.19.1.6.gb485710b

This publicly archived list offers a means to provide input to the OASIS Virtual I/O Device (VIRTIO) TC.

In order to verify user consent to the Feedback License terms and to minimize spam in the list archive, subscription is required before posting.

Quoted 8 lines
Quoted 8 lines

Subscribe: [email protected]
Unsubscribe: [email protected]
List help: [email protected]
List archive: https://lists.oasis-open.org/archives/virtio-comment/
Feedback License: https://www.oasis-open.org/who/ipr/feedback_license.pdf
List Guidelines: https://www.oasis-open.org/policies-guidelines/mailing-lists
Committee: https://www.oasis-open.org/committees/virtio/
Join OASIS: https://www.oasis-open.org/join/

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]

This publicly archived list offers a means to provide input to the OASIS Virtual I/O Device (VIRTIO) TC.

In order to verify user consent to the Feedback License terms and to minimize spam in the list archive, subscription is required before posting.

Subscribe: [email protected]
Unsubscribe: [email protected]
List help: [email protected]
List archive: https://lists.oasis-open.org/archives/virtio-comment/
Feedback License: https://www.oasis-open.org/who/ipr/feedback_license.pdf
List Guidelines: https://www.oasis-open.org/policies-guidelines/mailing-lists
Committee: https://www.oasis-open.org/committees/virtio/
Join OASIS: https://www.oasis-open.org/join/

#10 lore raw
In reply to Heng Qi

Thanks Heng.

Quoted 37 lines

Currently, the coalescing profile is directly applied to all queues. This patch supports setting or getting the parameters for a specified queue, and a typical application of this function is NetDIM.

When the traffic between queues is unbalanced, for example, one queue is busy and another queue is idle, then it will be very useful to control coalescing parameters at the queue granularity.

---
v1->v2:
1. Rename VIRTIO_NET_F_PERQUEUE_NOTF_COAL to VIRTIO_NET_F_VQ_NOTF_COAL. @Michael S. Tsirkin
2. Use the \field{vqn} instead of the qid. @Michael S. Tsirkin
3. Unify tx and rx control structres into one structure virtio_net_ctrl_coal_vq. @Michael S. Tsirkin
4. Add a new control command VIRTIO_NET_CTRL_NOTF_COAL_VQ. @Michael S. Tsirkin, @Parav Pandit, @Alvaro Karsz
5. The special value 0xFFF is removed because VIRTIO_NET_CTRL_NOTF_COAL can be used. @Alvaro Karsz
6. Clarify some special scenarios. @Michael S. Tsirkin, @Parav Pandit, @Alvaro Karsz

 content.tex | 69 ++++++++++++++++++++++++++++++++++++++++++++++++++++-
 1 file changed, 68 insertions(+), 1 deletion(-)
content.tex +3 -0
index e863709..2c497e1 100644
@@ -3084,6 +3084,9 @@ \subsection{Feature bits}\label{sec:Device Types / Network Device / Feature bits
 \item[VIRTIO_NET_F_CTRL_MAC_ADDR(23)] Set MAC address through control
     channel.
 
+\item[VIRTIO_NET_F_VQ_NOTF_COAL(52)] Device supports the virtqueue
+    notifications coalescing.
+
 \item[VIRTIO_NET_F_NOTF_COAL(53)] Device supports notifications coalescing.
 
 \item[VIRTIO_NET_F_GUEST_USO4 (54)] Driver can receive USOv4 packets.

content.tex \subsubsection{Feature bit requirements}\label{sec:Device Types / Network Device · line 3148

Quoted 6 lines
content.tex +1 -0
@@ -3140,6 +3143,7 @@ \subsubsection{Feature bit requirements}\label{sec:Device Types / Network Device
 \item[VIRTIO_NET_F_NOTF_COAL] Requires VIRTIO_NET_F_CTRL_VQ.
 \item[VIRTIO_NET_F_RSC_EXT] Requires VIRTIO_NET_F_HOST_TSO4 or VIRTIO_NET_F_HOST_TSO6.
 \item[VIRTIO_NET_F_RSS] Requires VIRTIO_NET_F_CTRL_VQ.
+\item[VIRTIO_NET_F_VQ_NOTF_COAL] Requires VIRTIO_NET_F_CTRL_VQ and VIRTIO_NET_F_NOTF_COAL.
 \end{description}
 

Do we need VIRTIO_NET_F_CTRL_VQ in this case? VIRTIO_NET_F_VQ_NOTF_COAL requires VIRTIO_NET_F_NOTF_COAL, which requires VIRTIO_NET_F_CTRL_VQ, so it's implied.

We have a similar example with VIRTIO_NET_F_HOST_ECN, which requires VIRTIO_NET_F_HOST_TSO4 or VIRTIO_NET_F_HOST_TSO6. VIRTIO_NET_F_CSUM is not mentioned here, although required.

So, should we remove VIRTIO_NET_F_CTRL_VQ here, or fix VIRTIO_NET_F_HOST_ECN?

Quoted 11 lines
content.tex +6 -0
 \subsubsection{Legacy Interface: Feature bits}\label{sec:Device Types / Network Device / Feature bits / Legacy Interface: Feature bits}
@@ -4520,6 +4524,49 @@ \subsubsection{Control Virtqueue}\label{sec:Device Types / Network Device / Devi
 \item VIRTIO_NET_CTRL_NOTF_COAL_RX_SET: set the \field{rx_usecs} and \field{rx_max_packets} parameters.
 \end{enumerate}
 
+If additionally VIRTIO_NET_F_VQ_NOTF_COAL is negotiated, the driver can send
+control commands to set or get the coalescing parameters of a specified
+virtqueue (excluding the control virtqueue).
+
+\begin{lstlisting}
+struct virtio_net_ctrl_coal_vq {

content.tex \subsubsection{Control Virtqueue}\label{sec:Device Types / Network Device / Devi · line 4542

Quoted 10 lines
content.tex +10 -0
+    le32 max_packets;
+    le32 usecs;
+    le16 vqn;
+};
+
+#define VIRTIO_NET_CTRL_NOTF_COAL_VQ 7
+ #define VIRTIO_NET_CTRL_NOTF_COAL_VQ_SET 0
+ #define VIRTIO_NET_CTRL_NOTF_COAL_VQ_GET 1
+\end{lstlisting}
+

We already have a notifications coalescing class, why not group all coalescing commands under a single class?

Quoted 83 lines
content.tex +48 -2
+Virtqueue coalescing parameters:
+\begin{itemize}
+\item \field{max_packets}: The maximum number of packets sent/received by the
+    specified virtqueue before a TX/RX notification.
+\item \field{usecs}: The maximum number of TX/RX usecs that the specified
+    virtqueue delays a TX/RX notification.
+\item \field{vqn}: The virtqueue number of the specified virtqueue.
+\end{itemize}
+
+The range of \filed{vqn} is between 0 and 0xFFFF inclusive, $ \lfloor vqn / 2 \rfloor $
+is the index of the corresponding receiveq, and $\lfloor (vqn / 2) + 1 \rfloor $ is
+the corresponding tranmitq.
+
+The VIRTIO_NET_CTRL_NOTF_COAL_RX_SET command is the same as calling VIRTIO_NET_CTRL_NOTF_COAL_VQ
+for virtqueues corresponding to all receiveqs.
+
+The VIRTIO_NET_CTRL_NOTF_COAL_TX_SET command is the same as calling VIRTIO_NET_CTRL_NOTF_COAL_VQ
+for virtqueues corresponding to all transmitqs.
+
+Virtqueue coalescing will be disabled if all parameters are set to 0.
+
+The class VIRTIO_NET_CTRL_NOTF_COAL_VQ has 2 commands:
+\begin{enumerate}
+\item VIRTIO_NET_CTRL_NOTF_COAL_VQ_SET: set the \field{max_packets}, \field{usecs} and \filed{vqn} parameters.
+\item VIRTIO_NET_CTRL_NOTF_COAL_VQ_GET: get the \field{max_packets}, \field{usecs} and \field{vqn} parameters.
+\end{enumerate}
+
 \subparagraph{RX Notifications}\label{sec:Device Types / Network Device / Device Operation / Control Virtqueue / Notifications Coalescing / RX Notifications}
 
 If, for example:
@@ -4535,6 +4582,15 @@ \subsubsection{Control Virtqueue}\label{sec:Device Types / Network Device / Devi
 \item If the notifications are not suppressed by the driver, the device will send an used buffer notification, otherwise, the device will not send an used buffer notification as long as the notifications are suppressed.
 \end{itemize}
 
+If, example of setting coalescing parameters for a receive virtqueue:
+\begin{itemize}
+\item \field{max_packets} = 15.
+\item \field{usecs} = 10.
+\item \field{vqn} = 0;
+\end{itemize}
+
+The device will only operate on recieveq1 as VIRTIO_NET_CTRL_NOTF_COAL_RX_SET.
+
 \subparagraph{TX Notifications}\label{sec:Device Types / Network Device / Device Operation / Control Virtqueue / Notifications Coalescing / TX Notifications}
 
 If, for example:
@@ -4550,13 +4606,24 @@ \subsubsection{Control Virtqueue}\label{sec:Device Types / Network Device / Devi
 \item If the notifications are not suppressed by the driver, the device will send an used buffer notification, otherwise, the device will not send an used buffer notification as long as the notifications are suppressed.
 \end{itemize}
 
+If, example of setting coalescing parameters for a transmit virtqueue:
+\begin{itemize}
+\item \field{max_packets} = 15.
+\item \field{usecs} = 10.
+\item \field{vqn} = 1;
+\end{itemize}
+
+The device will only operate on transmitq1 as VIRTIO_NET_CTRL_NOTF_COAL_TX_SET.
+
 \drivernormative{\subparagraph}{Notifications Coalescing}{Device Types / Network Device / Device Operation / Control Virtqueue / Notifications Coalescing}
 
 If the VIRTIO_NET_F_NOTF_COAL feature has not been negotiated, the driver MUST NOT issue VIRTIO_NET_CTRL_NOTF_COAL commands.
+If the VIRTIO_NET_F_VQ_NOTF_COAL feature has not been negotiated, the driver MUST NOT issue VIRTIO_NET_CTRL_NOFT_COAL_VQ commands.
 
 \devicenormative{\subparagraph}{Notifications Coalescing}{Device Types / Network Device / Device Operation / Control Virtqueue / Notifications Coalescing}
 
-A device SHOULD respond to the VIRTIO_NET_CTRL_NOTF_COAL commands with VIRTIO_NET_ERR if it was not able to change the parameters.
+A device SHOULD respond to the VIRTIO_NET_CTRL_NOTF_COAL commands with VIRTIO_NET_ERR if it was not able to change the parameters or
+was not able to find a virtqueue using the \field{vqn}.
 
 A device SHOULD NOT send used buffer notifications to the driver, if the notifications are suppressed as explained in \ref{sec:Basic Facilities of a Virtio Device / Virtqueues / Used Buffer Notification Suppression}, even if the coalescing counters expired.
 
--

2.19.1.6.gb485710b

This publicly archived list offers a means to provide input to the OASIS Virtual I/O Device (VIRTIO) TC.

In order to verify user consent to the Feedback License terms and to minimize spam in the list archive, subscription is required before posting.

Quoted 9 lines

Subscribe: [email protected]
Unsubscribe: [email protected]
List help: [email protected]
List archive: https://lists.oasis-open.org/archives/virtio-comment/
Feedback License: https://www.oasis-open.org/who/ipr/feedback_license.pdf
List Guidelines: https://www.oasis-open.org/policies-guidelines/mailing-lists
Committee: https://www.oasis-open.org/committees/virtio/
Join OASIS: https://www.oasis-open.org/join/

This publicly archived list offers a means to provide input to the OASIS Virtual I/O Device (VIRTIO) TC.

In order to verify user consent to the Feedback License terms and to minimize spam in the list archive, subscription is required before posting.

Subscribe: [email protected]
Unsubscribe: [email protected]
List help: [email protected]
List archive: https://lists.oasis-open.org/archives/virtio-comment/
Feedback License: https://www.oasis-open.org/who/ipr/feedback_license.pdf
List Guidelines: https://www.oasis-open.org/policies-guidelines/mailing-lists
Committee: https://www.oasis-open.org/committees/virtio/
Join OASIS: https://www.oasis-open.org/join/

#11 lore raw
Quoted 50 lines · Alvaro Karsz

Thanks Heng.

Quoted 37 lines

Currently, the coalescing profile is directly applied to all queues. This patch supports setting or getting the parameters for a specified queue, and a typical application of this function is NetDIM.

When the traffic between queues is unbalanced, for example, one queue is busy and another queue is idle, then it will be very useful to control coalescing parameters at the queue granularity.

---
v1->v2:
1. Rename VIRTIO_NET_F_PERQUEUE_NOTF_COAL to VIRTIO_NET_F_VQ_NOTF_COAL. @Michael S. Tsirkin
2. Use the \field{vqn} instead of the qid. @Michael S. Tsirkin
3. Unify tx and rx control structres into one structure virtio_net_ctrl_coal_vq. @Michael S. Tsirkin
4. Add a new control command VIRTIO_NET_CTRL_NOTF_COAL_VQ. @Michael S. Tsirkin, @Parav Pandit, @Alvaro Karsz
5. The special value 0xFFF is removed because VIRTIO_NET_CTRL_NOTF_COAL can be used. @Alvaro Karsz
6. Clarify some special scenarios. @Michael S. Tsirkin, @Parav Pandit, @Alvaro Karsz

 content.tex | 69 ++++++++++++++++++++++++++++++++++++++++++++++++++++-
 1 file changed, 68 insertions(+), 1 deletion(-)
content.tex +3 -0
index e863709..2c497e1 100644
@@ -3084,6 +3084,9 @@ \subsection{Feature bits}\label{sec:Device Types / Network Device / Feature bits
 \item[VIRTIO_NET_F_CTRL_MAC_ADDR(23)] Set MAC address through control
     channel.
 
+\item[VIRTIO_NET_F_VQ_NOTF_COAL(52)] Device supports the virtqueue
+    notifications coalescing.
+
 \item[VIRTIO_NET_F_NOTF_COAL(53)] Device supports notifications coalescing.
 
 \item[VIRTIO_NET_F_GUEST_USO4 (54)] Driver can receive USOv4 packets.

content.tex \subsubsection{Feature bit requirements}\label{sec:Device Types / Network Device · line 3148

Quoted 6 lines
content.tex +1 -0
@@ -3140,6 +3143,7 @@ \subsubsection{Feature bit requirements}\label{sec:Device Types / Network Device
 \item[VIRTIO_NET_F_NOTF_COAL] Requires VIRTIO_NET_F_CTRL_VQ.
 \item[VIRTIO_NET_F_RSC_EXT] Requires VIRTIO_NET_F_HOST_TSO4 or VIRTIO_NET_F_HOST_TSO6.
 \item[VIRTIO_NET_F_RSS] Requires VIRTIO_NET_F_CTRL_VQ.
+\item[VIRTIO_NET_F_VQ_NOTF_COAL] Requires VIRTIO_NET_F_CTRL_VQ and VIRTIO_NET_F_NOTF_COAL.
 \end{description}
 

Do we need VIRTIO_NET_F_CTRL_VQ in this case? VIRTIO_NET_F_VQ_NOTF_COAL requires VIRTIO_NET_F_NOTF_COAL, which requires VIRTIO_NET_F_CTRL_VQ, so it's implied.

Quoted 5 lines

We have a similar example with VIRTIO_NET_F_HOST_ECN, which requires VIRTIO_NET_F_HOST_TSO4 or VIRTIO_NET_F_HOST_TSO6. VIRTIO_NET_F_CSUM is not mentioned here, although required.

So, should we remove VIRTIO_NET_F_CTRL_VQ here, or fix VIRTIO_NET_F_HOST_ECN?

Ah good point.
But I think VIRTIO_NET_F_VQ_NOTF_COAL should not depend on VIRTIO_NET_F_NOTF_COAL. This way devices can drop the all-rx/all-tx commands if they want to.

Quoted 16 lines
Quoted 16 lines
content.tex +11 -0
 \subsubsection{Legacy Interface: Feature bits}\label{sec:Device Types / Network Device / Feature bits / Legacy Interface: Feature bits}
@@ -4520,6 +4524,49 @@ \subsubsection{Control Virtqueue}\label{sec:Device Types / Network Device / Devi
 \item VIRTIO_NET_CTRL_NOTF_COAL_RX_SET: set the \field{rx_usecs} and \field{rx_max_packets} parameters.
 \end{enumerate}
 
+If additionally VIRTIO_NET_F_VQ_NOTF_COAL is negotiated, the driver can send
+control commands to set or get the coalescing parameters of a specified
+virtqueue (excluding the control virtqueue).
+
+\begin{lstlisting}
+struct virtio_net_ctrl_coal_vq {
+    le32 max_packets;
+    le32 usecs;
+    le16 vqn;
+};
+
Quoted 8 lines

content.tex \subsubsection{Control Virtqueue}\label{sec:Device Types / Network Device / Devi · line 4542

Quoted 5 lines
content.tex +5 -0
+#define VIRTIO_NET_CTRL_NOTF_COAL_VQ 7
+ #define VIRTIO_NET_CTRL_NOTF_COAL_VQ_SET 0
+ #define VIRTIO_NET_CTRL_NOTF_COAL_VQ_GET 1
+\end{lstlisting}
+

We already have a notifications coalescing class, why not group all coalescing commands under a single class?

Agree here.

Quoted 84 lines
Quoted 84 lines
content.tex +48 -2
+Virtqueue coalescing parameters:
+\begin{itemize}
+\item \field{max_packets}: The maximum number of packets sent/received by the
+    specified virtqueue before a TX/RX notification.
+\item \field{usecs}: The maximum number of TX/RX usecs that the specified
+    virtqueue delays a TX/RX notification.
+\item \field{vqn}: The virtqueue number of the specified virtqueue.
+\end{itemize}
+
+The range of \filed{vqn} is between 0 and 0xFFFF inclusive, $ \lfloor vqn / 2 \rfloor $
+is the index of the corresponding receiveq, and $\lfloor (vqn / 2) + 1 \rfloor $ is
+the corresponding tranmitq.
+
+The VIRTIO_NET_CTRL_NOTF_COAL_RX_SET command is the same as calling VIRTIO_NET_CTRL_NOTF_COAL_VQ
+for virtqueues corresponding to all receiveqs.
+
+The VIRTIO_NET_CTRL_NOTF_COAL_TX_SET command is the same as calling VIRTIO_NET_CTRL_NOTF_COAL_VQ
+for virtqueues corresponding to all transmitqs.
+
+Virtqueue coalescing will be disabled if all parameters are set to 0.
+
+The class VIRTIO_NET_CTRL_NOTF_COAL_VQ has 2 commands:
+\begin{enumerate}
+\item VIRTIO_NET_CTRL_NOTF_COAL_VQ_SET: set the \field{max_packets}, \field{usecs} and \filed{vqn} parameters.
+\item VIRTIO_NET_CTRL_NOTF_COAL_VQ_GET: get the \field{max_packets}, \field{usecs} and \field{vqn} parameters.
+\end{enumerate}
+
 \subparagraph{RX Notifications}\label{sec:Device Types / Network Device / Device Operation / Control Virtqueue / Notifications Coalescing / RX Notifications}
 
 If, for example:
@@ -4535,6 +4582,15 @@ \subsubsection{Control Virtqueue}\label{sec:Device Types / Network Device / Devi
 \item If the notifications are not suppressed by the driver, the device will send an used buffer notification, otherwise, the device will not send an used buffer notification as long as the notifications are suppressed.
 \end{itemize}
 
+If, example of setting coalescing parameters for a receive virtqueue:
+\begin{itemize}
+\item \field{max_packets} = 15.
+\item \field{usecs} = 10.
+\item \field{vqn} = 0;
+\end{itemize}
+
+The device will only operate on recieveq1 as VIRTIO_NET_CTRL_NOTF_COAL_RX_SET.
+
 \subparagraph{TX Notifications}\label{sec:Device Types / Network Device / Device Operation / Control Virtqueue / Notifications Coalescing / TX Notifications}
 
 If, for example:
@@ -4550,13 +4606,24 @@ \subsubsection{Control Virtqueue}\label{sec:Device Types / Network Device / Devi
 \item If the notifications are not suppressed by the driver, the device will send an used buffer notification, otherwise, the device will not send an used buffer notification as long as the notifications are suppressed.
 \end{itemize}
 
+If, example of setting coalescing parameters for a transmit virtqueue:
+\begin{itemize}
+\item \field{max_packets} = 15.
+\item \field{usecs} = 10.
+\item \field{vqn} = 1;
+\end{itemize}
+
+The device will only operate on transmitq1 as VIRTIO_NET_CTRL_NOTF_COAL_TX_SET.
+
 \drivernormative{\subparagraph}{Notifications Coalescing}{Device Types / Network Device / Device Operation / Control Virtqueue / Notifications Coalescing}
 
 If the VIRTIO_NET_F_NOTF_COAL feature has not been negotiated, the driver MUST NOT issue VIRTIO_NET_CTRL_NOTF_COAL commands.
+If the VIRTIO_NET_F_VQ_NOTF_COAL feature has not been negotiated, the driver MUST NOT issue VIRTIO_NET_CTRL_NOFT_COAL_VQ commands.
 
 \devicenormative{\subparagraph}{Notifications Coalescing}{Device Types / Network Device / Device Operation / Control Virtqueue / Notifications Coalescing}
 
-A device SHOULD respond to the VIRTIO_NET_CTRL_NOTF_COAL commands with VIRTIO_NET_ERR if it was not able to change the parameters.
+A device SHOULD respond to the VIRTIO_NET_CTRL_NOTF_COAL commands with VIRTIO_NET_ERR if it was not able to change the parameters or
+was not able to find a virtqueue using the \field{vqn}.
 
 A device SHOULD NOT send used buffer notifications to the driver, if the notifications are suppressed as explained in \ref{sec:Basic Facilities of a Virtio Device / Virtqueues / Used Buffer Notification Suppression}, even if the coalescing counters expired.
 
--

2.19.1.6.gb485710b

This publicly archived list offers a means to provide input to the OASIS Virtual I/O Device (VIRTIO) TC.

In order to verify user consent to the Feedback License terms and to minimize spam in the list archive, subscription is required before posting.

Quoted 9 lines
Quoted 9 lines

Subscribe: [email protected]
Unsubscribe: [email protected]
List help: [email protected]
List archive: https://lists.oasis-open.org/archives/virtio-comment/
Feedback License: https://www.oasis-open.org/who/ipr/feedback_license.pdf
List Guidelines: https://www.oasis-open.org/policies-guidelines/mailing-lists
Committee: https://www.oasis-open.org/committees/virtio/
Join OASIS: https://www.oasis-open.org/join/

This publicly archived list offers a means to provide input to the OASIS Virtual I/O Device (VIRTIO) TC.

In order to verify user consent to the Feedback License terms and to minimize spam in the list archive, subscription is required before posting.

Subscribe: [email protected]
Unsubscribe: [email protected]
List help: [email protected]
List archive: https://lists.oasis-open.org/archives/virtio-comment/
Feedback License: https://www.oasis-open.org/who/ipr/feedback_license.pdf
List Guidelines: https://www.oasis-open.org/policies-guidelines/mailing-lists
Committee: https://www.oasis-open.org/committees/virtio/
Join OASIS: https://www.oasis-open.org/join/

author
#12 lore raw
Quoted 50 lines · Michael S. Tsirkin
Quoted 49 lines · Alvaro Karsz

Thanks Heng.

Quoted 37 lines

Currently, the coalescing profile is directly applied to all queues. This patch supports setting or getting the parameters for a specified queue, and a typical application of this function is NetDIM.

When the traffic between queues is unbalanced, for example, one queue is busy and another queue is idle, then it will be very useful to control coalescing parameters at the queue granularity.

---
v1->v2:
1. Rename VIRTIO_NET_F_PERQUEUE_NOTF_COAL to VIRTIO_NET_F_VQ_NOTF_COAL. @Michael S. Tsirkin
2. Use the \field{vqn} instead of the qid. @Michael S. Tsirkin
3. Unify tx and rx control structres into one structure virtio_net_ctrl_coal_vq. @Michael S. Tsirkin
4. Add a new control command VIRTIO_NET_CTRL_NOTF_COAL_VQ. @Michael S. Tsirkin, @Parav Pandit, @Alvaro Karsz
5. The special value 0xFFF is removed because VIRTIO_NET_CTRL_NOTF_COAL can be used. @Alvaro Karsz
6. Clarify some special scenarios. @Michael S. Tsirkin, @Parav Pandit, @Alvaro Karsz

  content.tex | 69 ++++++++++++++++++++++++++++++++++++++++++++++++++++-
  1 file changed, 68 insertions(+), 1 deletion(-)
content.tex +3 -0
index e863709..2c497e1 100644
@@ -3084,6 +3084,9 @@ \subsection{Feature bits}\label{sec:Device Types / Network Device / Feature bits
  \item[VIRTIO_NET_F_CTRL_MAC_ADDR(23)] Set MAC address through control
      channel.
 
+\item[VIRTIO_NET_F_VQ_NOTF_COAL(52)] Device supports the virtqueue
+    notifications coalescing.
+
  \item[VIRTIO_NET_F_NOTF_COAL(53)] Device supports notifications coalescing.
 
  \item[VIRTIO_NET_F_GUEST_USO4 (54)] Driver can receive USOv4 packets.

content.tex \subsubsection{Feature bit requirements}\label{sec:Device Types / Network Device · line 3148

Quoted 6 lines
content.tex +1 -0
@@ -3140,6 +3143,7 @@ \subsubsection{Feature bit requirements}\label{sec:Device Types / Network Device
  \item[VIRTIO_NET_F_NOTF_COAL] Requires VIRTIO_NET_F_CTRL_VQ.
  \item[VIRTIO_NET_F_RSC_EXT] Requires VIRTIO_NET_F_HOST_TSO4 or VIRTIO_NET_F_HOST_TSO6.
  \item[VIRTIO_NET_F_RSS] Requires VIRTIO_NET_F_CTRL_VQ.
+\item[VIRTIO_NET_F_VQ_NOTF_COAL] Requires VIRTIO_NET_F_CTRL_VQ and VIRTIO_NET_F_NOTF_COAL.
  \end{description}
 

Do we need VIRTIO_NET_F_CTRL_VQ in this case? VIRTIO_NET_F_VQ_NOTF_COAL requires VIRTIO_NET_F_NOTF_COAL, which requires VIRTIO_NET_F_CTRL_VQ, so it's implied.

Quoted 8 lines
Quoted 5 lines

We have a similar example with VIRTIO_NET_F_HOST_ECN, which requires VIRTIO_NET_F_HOST_TSO4 or VIRTIO_NET_F_HOST_TSO6. VIRTIO_NET_F_CSUM is not mentioned here, although required.

So, should we remove VIRTIO_NET_F_CTRL_VQ here, or fix VIRTIO_NET_F_HOST_ECN?

Ah good point.
But I think VIRTIO_NET_F_VQ_NOTF_COAL should not depend on VIRTIO_NET_F_NOTF_COAL. This way devices can drop the all-rx/all-tx commands if they want to.

We need to confirm this. If we make VIRTIO_NET_F_VQ_NOTF_COAL independent of VIRTIO_NET_F_NOTF_COAL,
do we need to give vqn a special value so that the driver can also have the fast path of sending all queues with global settings via VIRTIO_NET_F_VQ_NOTF_COAL?

Thanks.

Quoted 110 lines
Quoted 17 lines
Quoted 17 lines
content.tex +10 -0
  \subsubsection{Legacy Interface: Feature bits}\label{sec:Device Types / Network Device / Feature bits / Legacy Interface: Feature bits}
@@ -4520,6 +4524,49 @@ \subsubsection{Control Virtqueue}\label{sec:Device Types / Network Device / Devi
  \item VIRTIO_NET_CTRL_NOTF_COAL_RX_SET: set the \field{rx_usecs} and \field{rx_max_packets} parameters.
  \end{enumerate}
 
+If additionally VIRTIO_NET_F_VQ_NOTF_COAL is negotiated, the driver can send
+control commands to set or get the coalescing parameters of a specified
+virtqueue (excluding the control virtqueue).
+
+\begin{lstlisting}
+struct virtio_net_ctrl_coal_vq {
+    le32 max_packets;
+    le32 usecs;
+    le16 vqn;
+};
Quoted 8 lines

content.tex \subsubsection{Control Virtqueue}\label{sec:Device Types / Network Device / Devi · line 4542

Quoted 6 lines
content.tex +6 -0
+
+#define VIRTIO_NET_CTRL_NOTF_COAL_VQ 7
+ #define VIRTIO_NET_CTRL_NOTF_COAL_VQ_SET 0
+ #define VIRTIO_NET_CTRL_NOTF_COAL_VQ_GET 1
+\end{lstlisting}
+

We already have a notifications coalescing class, why not group all coalescing commands under a single class?

Agree here.

Quoted 83 lines
Quoted 83 lines
content.tex +48 -2
+Virtqueue coalescing parameters:
+\begin{itemize}
+\item \field{max_packets}: The maximum number of packets sent/received by the
+    specified virtqueue before a TX/RX notification.
+\item \field{usecs}: The maximum number of TX/RX usecs that the specified
+    virtqueue delays a TX/RX notification.
+\item \field{vqn}: The virtqueue number of the specified virtqueue.
+\end{itemize}
+
+The range of \filed{vqn} is between 0 and 0xFFFF inclusive, $ \lfloor vqn / 2 \rfloor $
+is the index of the corresponding receiveq, and $\lfloor (vqn / 2) + 1 \rfloor $ is
+the corresponding tranmitq.
+
+The VIRTIO_NET_CTRL_NOTF_COAL_RX_SET command is the same as calling VIRTIO_NET_CTRL_NOTF_COAL_VQ
+for virtqueues corresponding to all receiveqs.
+
+The VIRTIO_NET_CTRL_NOTF_COAL_TX_SET command is the same as calling VIRTIO_NET_CTRL_NOTF_COAL_VQ
+for virtqueues corresponding to all transmitqs.
+
+Virtqueue coalescing will be disabled if all parameters are set to 0.
+
+The class VIRTIO_NET_CTRL_NOTF_COAL_VQ has 2 commands:
+\begin{enumerate}
+\item VIRTIO_NET_CTRL_NOTF_COAL_VQ_SET: set the \field{max_packets}, \field{usecs} and \filed{vqn} parameters.
+\item VIRTIO_NET_CTRL_NOTF_COAL_VQ_GET: get the \field{max_packets}, \field{usecs} and \field{vqn} parameters.
+\end{enumerate}
+
  \subparagraph{RX Notifications}\label{sec:Device Types / Network Device / Device Operation / Control Virtqueue / Notifications Coalescing / RX Notifications}
 
  If, for example:
@@ -4535,6 +4582,15 @@ \subsubsection{Control Virtqueue}\label{sec:Device Types / Network Device / Devi
  \item If the notifications are not suppressed by the driver, the device will send an used buffer notification, otherwise, the device will not send an used buffer notification as long as the notifications are suppressed.
  \end{itemize}
 
+If, example of setting coalescing parameters for a receive virtqueue:
+\begin{itemize}
+\item \field{max_packets} = 15.
+\item \field{usecs} = 10.
+\item \field{vqn} = 0;
+\end{itemize}
+
+The device will only operate on recieveq1 as VIRTIO_NET_CTRL_NOTF_COAL_RX_SET.
+
  \subparagraph{TX Notifications}\label{sec:Device Types / Network Device / Device Operation / Control Virtqueue / Notifications Coalescing / TX Notifications}
 
  If, for example:
@@ -4550,13 +4606,24 @@ \subsubsection{Control Virtqueue}\label{sec:Device Types / Network Device / Devi
  \item If the notifications are not suppressed by the driver, the device will send an used buffer notification, otherwise, the device will not send an used buffer notification as long as the notifications are suppressed.
  \end{itemize}
 
+If, example of setting coalescing parameters for a transmit virtqueue:
+\begin{itemize}
+\item \field{max_packets} = 15.
+\item \field{usecs} = 10.
+\item \field{vqn} = 1;
+\end{itemize}
+
+The device will only operate on transmitq1 as VIRTIO_NET_CTRL_NOTF_COAL_TX_SET.
+
  \drivernormative{\subparagraph}{Notifications Coalescing}{Device Types / Network Device / Device Operation / Control Virtqueue / Notifications Coalescing}
 
  If the VIRTIO_NET_F_NOTF_COAL feature has not been negotiated, the driver MUST NOT issue VIRTIO_NET_CTRL_NOTF_COAL commands.
+If the VIRTIO_NET_F_VQ_NOTF_COAL feature has not been negotiated, the driver MUST NOT issue VIRTIO_NET_CTRL_NOFT_COAL_VQ commands.
 
  \devicenormative{\subparagraph}{Notifications Coalescing}{Device Types / Network Device / Device Operation / Control Virtqueue / Notifications Coalescing}
 
-A device SHOULD respond to the VIRTIO_NET_CTRL_NOTF_COAL commands with VIRTIO_NET_ERR if it was not able to change the parameters.
+A device SHOULD respond to the VIRTIO_NET_CTRL_NOTF_COAL commands with VIRTIO_NET_ERR if it was not able to change the parameters or
+was not able to find a virtqueue using the \field{vqn}.
 
  A device SHOULD NOT send used buffer notifications to the driver, if the notifications are suppressed as explained in \ref{sec:Basic Facilities of a Virtio Device / Virtqueues / Used Buffer Notification Suppression}, even if the coalescing counters expired.
 
--

2.19.1.6.gb485710b

This publicly archived list offers a means to provide input to the OASIS Virtual I/O Device (VIRTIO) TC.

In order to verify user consent to the Feedback License terms and to minimize spam in the list archive, subscription is required before posting.

Quoted 9 lines
Quoted 9 lines
Quoted 9 lines

Subscribe: [email protected]
Unsubscribe: [email protected]
List help: [email protected]
List archive: https://lists.oasis-open.org/archives/virtio-comment/
Feedback License: https://www.oasis-open.org/who/ipr/feedback_license.pdf
List Guidelines: https://www.oasis-open.org/policies-guidelines/mailing-lists
Committee: https://www.oasis-open.org/committees/virtio/
Join OASIS: https://www.oasis-open.org/join/

This publicly archived list offers a means to provide input to the OASIS Virtual I/O Device (VIRTIO) TC.

In order to verify user consent to the Feedback License terms and to minimize spam in the list archive, subscription is required before posting.

Subscribe: [email protected]
Unsubscribe: [email protected]
List help: [email protected]
List archive: https://lists.oasis-open.org/archives/virtio-comment/
Feedback License: https://www.oasis-open.org/who/ipr/feedback_license.pdf
List Guidelines: https://www.oasis-open.org/policies-guidelines/mailing-lists
Committee: https://www.oasis-open.org/committees/virtio/
Join OASIS: https://www.oasis-open.org/join/

#13 lore raw
Quoted 10 lines
Quoted 4 lines
Quoted 1 line

So, should we remove VIRTIO_NET_F_CTRL_VQ here, or fix VIRTIO_NET_F_HOST_ECN?

Ah good point.
But I think VIRTIO_NET_F_VQ_NOTF_COAL should not depend on VIRTIO_NET_F_NOTF_COAL. This way devices can drop the all-rx/all-tx commands if they want to.

We need to confirm this. If we make VIRTIO_NET_F_VQ_NOTF_COAL independent of VIRTIO_NET_F_NOTF_COAL,
do we need to give vqn a special value so that the driver can also have the fast path of sending all queues with global settings via VIRTIO_NET_F_VQ_NOTF_COAL?

IMO we don't need a special vqn value.
A device that can modify all the vqs should offer VIRTIO_NET_F_NOTF_COAL.

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]

author
#14 lore raw
Quoted 11 lines · Alvaro Karsz
Quoted 9 lines
Quoted 4 lines
Quoted 1 line

So, should we remove VIRTIO_NET_F_CTRL_VQ here, or fix VIRTIO_NET_F_HOST_ECN?

Ah good point.
But I think VIRTIO_NET_F_VQ_NOTF_COAL should not depend on VIRTIO_NET_F_NOTF_COAL. This way devices can drop the all-rx/all-tx commands if they want to.

We need to confirm this. If we make VIRTIO_NET_F_VQ_NOTF_COAL independent of VIRTIO_NET_F_NOTF_COAL,
do we need to give vqn a special value so that the driver can also have the fast path of sending all queues with global settings via VIRTIO_NET_F_VQ_NOTF_COAL?

IMO we don't need a special vqn value.
A device that can modify all the vqs should offer VIRTIO_NET_F_NOTF_COAL.

That's clear, thanks for the quick reply.
Have a great weekend!

This publicly archived list offers a means to provide input to the OASIS Virtual I/O Device (VIRTIO) TC.

In order to verify user consent to the Feedback License terms and to minimize spam in the list archive, subscription is required before posting.

Subscribe: [email protected]
Unsubscribe: [email protected]
List help: [email protected]
List archive: https://lists.oasis-open.org/archives/virtio-comment/
Feedback License: https://www.oasis-open.org/who/ipr/feedback_license.pdf
List Guidelines: https://www.oasis-open.org/policies-guidelines/mailing-lists
Committee: https://www.oasis-open.org/committees/virtio/
Join OASIS: https://www.oasis-open.org/join/

#15 lore raw
In reply to Heng Qi
Quoted 62 lines · Heng Qi
Quoted 50 lines · Michael S. Tsirkin
Quoted 49 lines · Alvaro Karsz

Thanks Heng.

Quoted 37 lines

Currently, the coalescing profile is directly applied to all queues. This patch supports setting or getting the parameters for a specified queue, and a typical application of this function is NetDIM.

When the traffic between queues is unbalanced, for example, one queue is busy and another queue is idle, then it will be very useful to control coalescing parameters at the queue granularity.

---
v1->v2:
1. Rename VIRTIO_NET_F_PERQUEUE_NOTF_COAL to VIRTIO_NET_F_VQ_NOTF_COAL. @Michael S. Tsirkin
2. Use the \field{vqn} instead of the qid. @Michael S. Tsirkin
3. Unify tx and rx control structres into one structure virtio_net_ctrl_coal_vq. @Michael S. Tsirkin
4. Add a new control command VIRTIO_NET_CTRL_NOTF_COAL_VQ. @Michael S. Tsirkin, @Parav Pandit, @Alvaro Karsz
5. The special value 0xFFF is removed because VIRTIO_NET_CTRL_NOTF_COAL can be used. @Alvaro Karsz
6. Clarify some special scenarios. @Michael S. Tsirkin, @Parav Pandit, @Alvaro Karsz

  content.tex | 69 ++++++++++++++++++++++++++++++++++++++++++++++++++++-
  1 file changed, 68 insertions(+), 1 deletion(-)
content.tex +3 -0
index e863709..2c497e1 100644
@@ -3084,6 +3084,9 @@ \subsection{Feature bits}\label{sec:Device Types / Network Device / Feature bits
  \item[VIRTIO_NET_F_CTRL_MAC_ADDR(23)] Set MAC address through control
      channel.
 
+\item[VIRTIO_NET_F_VQ_NOTF_COAL(52)] Device supports the virtqueue
+    notifications coalescing.
+
  \item[VIRTIO_NET_F_NOTF_COAL(53)] Device supports notifications coalescing.
 
  \item[VIRTIO_NET_F_GUEST_USO4 (54)] Driver can receive USOv4 packets.

content.tex \subsubsection{Feature bit requirements}\label{sec:Device Types / Network Device · line 3148

Quoted 6 lines
content.tex +1 -0
@@ -3140,6 +3143,7 @@ \subsubsection{Feature bit requirements}\label{sec:Device Types / Network Device
  \item[VIRTIO_NET_F_NOTF_COAL] Requires VIRTIO_NET_F_CTRL_VQ.
  \item[VIRTIO_NET_F_RSC_EXT] Requires VIRTIO_NET_F_HOST_TSO4 or VIRTIO_NET_F_HOST_TSO6.
  \item[VIRTIO_NET_F_RSS] Requires VIRTIO_NET_F_CTRL_VQ.
+\item[VIRTIO_NET_F_VQ_NOTF_COAL] Requires VIRTIO_NET_F_CTRL_VQ and VIRTIO_NET_F_NOTF_COAL.
  \end{description}
 

Do we need VIRTIO_NET_F_CTRL_VQ in this case? VIRTIO_NET_F_VQ_NOTF_COAL requires VIRTIO_NET_F_NOTF_COAL, which requires VIRTIO_NET_F_CTRL_VQ, so it's implied.

Quoted 8 lines
Quoted 5 lines

We have a similar example with VIRTIO_NET_F_HOST_ECN, which requires VIRTIO_NET_F_HOST_TSO4 or VIRTIO_NET_F_HOST_TSO6. VIRTIO_NET_F_CSUM is not mentioned here, although required.

So, should we remove VIRTIO_NET_F_CTRL_VQ here, or fix VIRTIO_NET_F_HOST_ECN?

Ah good point.
But I think VIRTIO_NET_F_VQ_NOTF_COAL should not depend on VIRTIO_NET_F_NOTF_COAL. This way devices can drop the all-rx/all-tx commands if they want to.

Quoted 7 lines

We need to confirm this. If we make VIRTIO_NET_F_VQ_NOTF_COAL independent of VIRTIO_NET_F_NOTF_COAL,
do we need to give vqn a special value so that the driver can also have the fast path of sending all queues with global settings via VIRTIO_NET_F_VQ_NOTF_COAL?

Thanks.

No - without VIRTIO_NET_F_NOTF_COAL driver has to iterate over all vqs if it wants to do something with all of them.

Quoted 110 lines
Quoted 110 lines
Quoted 17 lines
Quoted 17 lines
content.tex +10 -0
  \subsubsection{Legacy Interface: Feature bits}\label{sec:Device Types / Network Device / Feature bits / Legacy Interface: Feature bits}
@@ -4520,6 +4524,49 @@ \subsubsection{Control Virtqueue}\label{sec:Device Types / Network Device / Devi
  \item VIRTIO_NET_CTRL_NOTF_COAL_RX_SET: set the \field{rx_usecs} and \field{rx_max_packets} parameters.
  \end{enumerate}
 
+If additionally VIRTIO_NET_F_VQ_NOTF_COAL is negotiated, the driver can send
+control commands to set or get the coalescing parameters of a specified
+virtqueue (excluding the control virtqueue).
+
+\begin{lstlisting}
+struct virtio_net_ctrl_coal_vq {
+    le32 max_packets;
+    le32 usecs;
+    le16 vqn;
+};
Quoted 8 lines

content.tex \subsubsection{Control Virtqueue}\label{sec:Device Types / Network Device / Devi · line 4542

Quoted 6 lines
content.tex +6 -0
+
+#define VIRTIO_NET_CTRL_NOTF_COAL_VQ 7
+ #define VIRTIO_NET_CTRL_NOTF_COAL_VQ_SET 0
+ #define VIRTIO_NET_CTRL_NOTF_COAL_VQ_GET 1
+\end{lstlisting}
+

We already have a notifications coalescing class, why not group all coalescing commands under a single class?

Agree here.

Quoted 83 lines
Quoted 83 lines
content.tex +48 -2
+Virtqueue coalescing parameters:
+\begin{itemize}
+\item \field{max_packets}: The maximum number of packets sent/received by the
+    specified virtqueue before a TX/RX notification.
+\item \field{usecs}: The maximum number of TX/RX usecs that the specified
+    virtqueue delays a TX/RX notification.
+\item \field{vqn}: The virtqueue number of the specified virtqueue.
+\end{itemize}
+
+The range of \filed{vqn} is between 0 and 0xFFFF inclusive, $ \lfloor vqn / 2 \rfloor $
+is the index of the corresponding receiveq, and $\lfloor (vqn / 2) + 1 \rfloor $ is
+the corresponding tranmitq.
+
+The VIRTIO_NET_CTRL_NOTF_COAL_RX_SET command is the same as calling VIRTIO_NET_CTRL_NOTF_COAL_VQ
+for virtqueues corresponding to all receiveqs.
+
+The VIRTIO_NET_CTRL_NOTF_COAL_TX_SET command is the same as calling VIRTIO_NET_CTRL_NOTF_COAL_VQ
+for virtqueues corresponding to all transmitqs.
+
+Virtqueue coalescing will be disabled if all parameters are set to 0.
+
+The class VIRTIO_NET_CTRL_NOTF_COAL_VQ has 2 commands:
+\begin{enumerate}
+\item VIRTIO_NET_CTRL_NOTF_COAL_VQ_SET: set the \field{max_packets}, \field{usecs} and \filed{vqn} parameters.
+\item VIRTIO_NET_CTRL_NOTF_COAL_VQ_GET: get the \field{max_packets}, \field{usecs} and \field{vqn} parameters.
+\end{enumerate}
+
  \subparagraph{RX Notifications}\label{sec:Device Types / Network Device / Device Operation / Control Virtqueue / Notifications Coalescing / RX Notifications}
 
  If, for example:
@@ -4535,6 +4582,15 @@ \subsubsection{Control Virtqueue}\label{sec:Device Types / Network Device / Devi
  \item If the notifications are not suppressed by the driver, the device will send an used buffer notification, otherwise, the device will not send an used buffer notification as long as the notifications are suppressed.
  \end{itemize}
 
+If, example of setting coalescing parameters for a receive virtqueue:
+\begin{itemize}
+\item \field{max_packets} = 15.
+\item \field{usecs} = 10.
+\item \field{vqn} = 0;
+\end{itemize}
+
+The device will only operate on recieveq1 as VIRTIO_NET_CTRL_NOTF_COAL_RX_SET.
+
  \subparagraph{TX Notifications}\label{sec:Device Types / Network Device / Device Operation / Control Virtqueue / Notifications Coalescing / TX Notifications}
 
  If, for example:
@@ -4550,13 +4606,24 @@ \subsubsection{Control Virtqueue}\label{sec:Device Types / Network Device / Devi
  \item If the notifications are not suppressed by the driver, the device will send an used buffer notification, otherwise, the device will not send an used buffer notification as long as the notifications are suppressed.
  \end{itemize}
 
+If, example of setting coalescing parameters for a transmit virtqueue:
+\begin{itemize}
+\item \field{max_packets} = 15.
+\item \field{usecs} = 10.
+\item \field{vqn} = 1;
+\end{itemize}
+
+The device will only operate on transmitq1 as VIRTIO_NET_CTRL_NOTF_COAL_TX_SET.
+
  \drivernormative{\subparagraph}{Notifications Coalescing}{Device Types / Network Device / Device Operation / Control Virtqueue / Notifications Coalescing}
 
  If the VIRTIO_NET_F_NOTF_COAL feature has not been negotiated, the driver MUST NOT issue VIRTIO_NET_CTRL_NOTF_COAL commands.
+If the VIRTIO_NET_F_VQ_NOTF_COAL feature has not been negotiated, the driver MUST NOT issue VIRTIO_NET_CTRL_NOFT_COAL_VQ commands.
 
  \devicenormative{\subparagraph}{Notifications Coalescing}{Device Types / Network Device / Device Operation / Control Virtqueue / Notifications Coalescing}
 
-A device SHOULD respond to the VIRTIO_NET_CTRL_NOTF_COAL commands with VIRTIO_NET_ERR if it was not able to change the parameters.
+A device SHOULD respond to the VIRTIO_NET_CTRL_NOTF_COAL commands with VIRTIO_NET_ERR if it was not able to change the parameters or
+was not able to find a virtqueue using the \field{vqn}.
 
  A device SHOULD NOT send used buffer notifications to the driver, if the notifications are suppressed as explained in \ref{sec:Basic Facilities of a Virtio Device / Virtqueues / Used Buffer Notification Suppression}, even if the coalescing counters expired.
 
--

2.19.1.6.gb485710b

This publicly archived list offers a means to provide input to the OASIS Virtual I/O Device (VIRTIO) TC.

In order to verify user consent to the Feedback License terms and to minimize spam in the list archive, subscription is required before posting.

Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines

Subscribe: [email protected]
Unsubscribe: [email protected]
List help: [email protected]
List archive: https://lists.oasis-open.org/archives/virtio-comment/
Feedback License: https://www.oasis-open.org/who/ipr/feedback_license.pdf
List Guidelines: https://www.oasis-open.org/policies-guidelines/mailing-lists
Committee: https://www.oasis-open.org/committees/virtio/
Join OASIS: https://www.oasis-open.org/join/

This publicly archived list offers a means to provide input to the OASIS Virtual I/O Device (VIRTIO) TC.

In order to verify user consent to the Feedback License terms and to minimize spam in the list archive, subscription is required before posting.

Subscribe: [email protected]
Unsubscribe: [email protected]
List help: [email protected]
List archive: https://lists.oasis-open.org/archives/virtio-comment/
Feedback License: https://www.oasis-open.org/who/ipr/feedback_license.pdf
List Guidelines: https://www.oasis-open.org/policies-guidelines/mailing-lists
Committee: https://www.oasis-open.org/committees/virtio/
Join OASIS: https://www.oasis-open.org/join/

author
#16 lore raw
Quoted 67 lines · Michael S. Tsirkin
Quoted 66 lines · Heng Qi
Quoted 50 lines · Michael S. Tsirkin
Quoted 49 lines · Alvaro Karsz

Thanks Heng.

Quoted 37 lines

Currently, the coalescing profile is directly applied to all queues. This patch supports setting or getting the parameters for a specified queue, and a typical application of this function is NetDIM.

When the traffic between queues is unbalanced, for example, one queue is busy and another queue is idle, then it will be very useful to control coalescing parameters at the queue granularity.

---
v1->v2:
1. Rename VIRTIO_NET_F_PERQUEUE_NOTF_COAL to VIRTIO_NET_F_VQ_NOTF_COAL. @Michael S. Tsirkin
2. Use the \field{vqn} instead of the qid. @Michael S. Tsirkin
3. Unify tx and rx control structres into one structure virtio_net_ctrl_coal_vq. @Michael S. Tsirkin
4. Add a new control command VIRTIO_NET_CTRL_NOTF_COAL_VQ. @Michael S. Tsirkin, @Parav Pandit, @Alvaro Karsz
5. The special value 0xFFF is removed because VIRTIO_NET_CTRL_NOTF_COAL can be used. @Alvaro Karsz
6. Clarify some special scenarios. @Michael S. Tsirkin, @Parav Pandit, @Alvaro Karsz

   content.tex | 69 ++++++++++++++++++++++++++++++++++++++++++++++++++++-
   1 file changed, 68 insertions(+), 1 deletion(-)
content.tex +3 -0
index e863709..2c497e1 100644
@@ -3084,6 +3084,9 @@ \subsection{Feature bits}\label{sec:Device Types / Network Device / Feature bits
   \item[VIRTIO_NET_F_CTRL_MAC_ADDR(23)] Set MAC address through control
       channel.
 
+\item[VIRTIO_NET_F_VQ_NOTF_COAL(52)] Device supports the virtqueue
+    notifications coalescing.
+
   \item[VIRTIO_NET_F_NOTF_COAL(53)] Device supports notifications coalescing.
 
   \item[VIRTIO_NET_F_GUEST_USO4 (54)] Driver can receive USOv4 packets.

content.tex \subsubsection{Feature bit requirements}\label{sec:Device Types / Network Device · line 3148

Quoted 6 lines
content.tex +1 -0
@@ -3140,6 +3143,7 @@ \subsubsection{Feature bit requirements}\label{sec:Device Types / Network Device
   \item[VIRTIO_NET_F_NOTF_COAL] Requires VIRTIO_NET_F_CTRL_VQ.
   \item[VIRTIO_NET_F_RSC_EXT] Requires VIRTIO_NET_F_HOST_TSO4 or VIRTIO_NET_F_HOST_TSO6.
   \item[VIRTIO_NET_F_RSS] Requires VIRTIO_NET_F_CTRL_VQ.
+\item[VIRTIO_NET_F_VQ_NOTF_COAL] Requires VIRTIO_NET_F_CTRL_VQ and VIRTIO_NET_F_NOTF_COAL.
   \end{description}
 

Do we need VIRTIO_NET_F_CTRL_VQ in this case? VIRTIO_NET_F_VQ_NOTF_COAL requires VIRTIO_NET_F_NOTF_COAL, which requires VIRTIO_NET_F_CTRL_VQ, so it's implied.

Quoted 8 lines
Quoted 5 lines

We have a similar example with VIRTIO_NET_F_HOST_ECN, which requires VIRTIO_NET_F_HOST_TSO4 or VIRTIO_NET_F_HOST_TSO6. VIRTIO_NET_F_CSUM is not mentioned here, although required.

So, should we remove VIRTIO_NET_F_CTRL_VQ here, or fix VIRTIO_NET_F_HOST_ECN?

Ah good point.
But I think VIRTIO_NET_F_VQ_NOTF_COAL should not depend on VIRTIO_NET_F_NOTF_COAL. This way devices can drop the all-rx/all-tx commands if they want to.

We need to confirm this. If we make VIRTIO_NET_F_VQ_NOTF_COAL independent of VIRTIO_NET_F_NOTF_COAL,
do we need to give vqn a special value so that the driver can also have the fast path of sending all queues with global settings via VIRTIO_NET_F_VQ_NOTF_COAL?

Quoted 3 lines
Quoted 1 line

Thanks.

No - without VIRTIO_NET_F_NOTF_COAL driver has to iterate over all vqs if it wants to do something with all of them.

Ok, this allows the driver to use both features more explicitly. Thanks for the quick reply. 😁

Quoted 111 lines
Quoted 111 lines
Quoted 111 lines
Quoted 18 lines
Quoted 18 lines
content.tex +10 -0
   \subsubsection{Legacy Interface: Feature bits}\label{sec:Device Types / Network Device / Feature bits / Legacy Interface: Feature bits}
@@ -4520,6 +4524,49 @@ \subsubsection{Control Virtqueue}\label{sec:Device Types / Network Device / Devi
   \item VIRTIO_NET_CTRL_NOTF_COAL_RX_SET: set the \field{rx_usecs} and \field{rx_max_packets} parameters.
   \end{enumerate}
 
+If additionally VIRTIO_NET_F_VQ_NOTF_COAL is negotiated, the driver can send
+control commands to set or get the coalescing parameters of a specified
+virtqueue (excluding the control virtqueue).
+
+\begin{lstlisting}
+struct virtio_net_ctrl_coal_vq {
+    le32 max_packets;
+    le32 usecs;
+    le16 vqn;
+};
Quoted 8 lines

content.tex \subsubsection{Control Virtqueue}\label{sec:Device Types / Network Device / Devi · line 4542

Quoted 6 lines
content.tex +6 -0
+
+#define VIRTIO_NET_CTRL_NOTF_COAL_VQ 7
+ #define VIRTIO_NET_CTRL_NOTF_COAL_VQ_SET 0
+ #define VIRTIO_NET_CTRL_NOTF_COAL_VQ_GET 1
+\end{lstlisting}
+

We already have a notifications coalescing class, why not group all coalescing commands under a single class?

Agree here.

Quoted 83 lines
Quoted 83 lines
content.tex +48 -2
+Virtqueue coalescing parameters:
+\begin{itemize}
+\item \field{max_packets}: The maximum number of packets sent/received by the
+    specified virtqueue before a TX/RX notification.
+\item \field{usecs}: The maximum number of TX/RX usecs that the specified
+    virtqueue delays a TX/RX notification.
+\item \field{vqn}: The virtqueue number of the specified virtqueue.
+\end{itemize}
+
+The range of \filed{vqn} is between 0 and 0xFFFF inclusive, $ \lfloor vqn / 2 \rfloor $
+is the index of the corresponding receiveq, and $\lfloor (vqn / 2) + 1 \rfloor $ is
+the corresponding tranmitq.
+
+The VIRTIO_NET_CTRL_NOTF_COAL_RX_SET command is the same as calling VIRTIO_NET_CTRL_NOTF_COAL_VQ
+for virtqueues corresponding to all receiveqs.
+
+The VIRTIO_NET_CTRL_NOTF_COAL_TX_SET command is the same as calling VIRTIO_NET_CTRL_NOTF_COAL_VQ
+for virtqueues corresponding to all transmitqs.
+
+Virtqueue coalescing will be disabled if all parameters are set to 0.
+
+The class VIRTIO_NET_CTRL_NOTF_COAL_VQ has 2 commands:
+\begin{enumerate}
+\item VIRTIO_NET_CTRL_NOTF_COAL_VQ_SET: set the \field{max_packets}, \field{usecs} and \filed{vqn} parameters.
+\item VIRTIO_NET_CTRL_NOTF_COAL_VQ_GET: get the \field{max_packets}, \field{usecs} and \field{vqn} parameters.
+\end{enumerate}
+
   \subparagraph{RX Notifications}\label{sec:Device Types / Network Device / Device Operation / Control Virtqueue / Notifications Coalescing / RX Notifications}
 
   If, for example:
@@ -4535,6 +4582,15 @@ \subsubsection{Control Virtqueue}\label{sec:Device Types / Network Device / Devi
   \item If the notifications are not suppressed by the driver, the device will send an used buffer notification, otherwise, the device will not send an used buffer notification as long as the notifications are suppressed.
   \end{itemize}
 
+If, example of setting coalescing parameters for a receive virtqueue:
+\begin{itemize}
+\item \field{max_packets} = 15.
+\item \field{usecs} = 10.
+\item \field{vqn} = 0;
+\end{itemize}
+
+The device will only operate on recieveq1 as VIRTIO_NET_CTRL_NOTF_COAL_RX_SET.
+
   \subparagraph{TX Notifications}\label{sec:Device Types / Network Device / Device Operation / Control Virtqueue / Notifications Coalescing / TX Notifications}
 
   If, for example:
@@ -4550,13 +4606,24 @@ \subsubsection{Control Virtqueue}\label{sec:Device Types / Network Device / Devi
   \item If the notifications are not suppressed by the driver, the device will send an used buffer notification, otherwise, the device will not send an used buffer notification as long as the notifications are suppressed.
   \end{itemize}
 
+If, example of setting coalescing parameters for a transmit virtqueue:
+\begin{itemize}
+\item \field{max_packets} = 15.
+\item \field{usecs} = 10.
+\item \field{vqn} = 1;
+\end{itemize}
+
+The device will only operate on transmitq1 as VIRTIO_NET_CTRL_NOTF_COAL_TX_SET.
+
   \drivernormative{\subparagraph}{Notifications Coalescing}{Device Types / Network Device / Device Operation / Control Virtqueue / Notifications Coalescing}
 
   If the VIRTIO_NET_F_NOTF_COAL feature has not been negotiated, the driver MUST NOT issue VIRTIO_NET_CTRL_NOTF_COAL commands.
+If the VIRTIO_NET_F_VQ_NOTF_COAL feature has not been negotiated, the driver MUST NOT issue VIRTIO_NET_CTRL_NOFT_COAL_VQ commands.
 
   \devicenormative{\subparagraph}{Notifications Coalescing}{Device Types / Network Device / Device Operation / Control Virtqueue / Notifications Coalescing}
 
-A device SHOULD respond to the VIRTIO_NET_CTRL_NOTF_COAL commands with VIRTIO_NET_ERR if it was not able to change the parameters.
+A device SHOULD respond to the VIRTIO_NET_CTRL_NOTF_COAL commands with VIRTIO_NET_ERR if it was not able to change the parameters or
+was not able to find a virtqueue using the \field{vqn}.
 
   A device SHOULD NOT send used buffer notifications to the driver, if the notifications are suppressed as explained in \ref{sec:Basic Facilities of a Virtio Device / Virtqueues / Used Buffer Notification Suppression}, even if the coalescing counters expired.
 
--

2.19.1.6.gb485710b

This publicly archived list offers a means to provide input to the OASIS Virtual I/O Device (VIRTIO) TC.

In order to verify user consent to the Feedback License terms and to minimize spam in the list archive, subscription is required before posting.

Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines

Subscribe: [email protected]
Unsubscribe: [email protected]
List help: [email protected]
List archive: https://lists.oasis-open.org/archives/virtio-comment/
Feedback License: https://www.oasis-open.org/who/ipr/feedback_license.pdf
List Guidelines: https://www.oasis-open.org/policies-guidelines/mailing-lists
Committee: https://www.oasis-open.org/committees/virtio/
Join OASIS: https://www.oasis-open.org/join/

This publicly archived list offers a means to provide input to the OASIS Virtual I/O Device (VIRTIO) TC.

In order to verify user consent to the Feedback License terms and to minimize spam in the list archive, subscription is required before posting.

Subscribe: [email protected]
Unsubscribe: [email protected]
List help: [email protected]
List archive: https://lists.oasis-open.org/archives/virtio-comment/
Feedback License: https://www.oasis-open.org/who/ipr/feedback_license.pdf
List Guidelines: https://www.oasis-open.org/policies-guidelines/mailing-lists
Committee: https://www.oasis-open.org/committees/virtio/
Join OASIS: https://www.oasis-open.org/join/

author
#17 lore raw
In reply to Alvaro Karsz
Quoted 49 lines · Alvaro Karsz

Thanks Heng.

Quoted 37 lines

Currently, the coalescing profile is directly applied to all queues. This patch supports setting or getting the parameters for a specified queue, and a typical application of this function is NetDIM.

When the traffic between queues is unbalanced, for example, one queue is busy and another queue is idle, then it will be very useful to control coalescing parameters at the queue granularity.

---
v1->v2:
1. Rename VIRTIO_NET_F_PERQUEUE_NOTF_COAL to VIRTIO_NET_F_VQ_NOTF_COAL. @Michael S. Tsirkin
2. Use the \field{vqn} instead of the qid. @Michael S. Tsirkin
3. Unify tx and rx control structres into one structure virtio_net_ctrl_coal_vq. @Michael S. Tsirkin
4. Add a new control command VIRTIO_NET_CTRL_NOTF_COAL_VQ. @Michael S. Tsirkin, @Parav Pandit, @Alvaro Karsz
5. The special value 0xFFF is removed because VIRTIO_NET_CTRL_NOTF_COAL can be used. @Alvaro Karsz
6. Clarify some special scenarios. @Michael S. Tsirkin, @Parav Pandit, @Alvaro Karsz

  content.tex | 69 ++++++++++++++++++++++++++++++++++++++++++++++++++++-
  1 file changed, 68 insertions(+), 1 deletion(-)
content.tex +3 -0
index e863709..2c497e1 100644
@@ -3084,6 +3084,9 @@ \subsection{Feature bits}\label{sec:Device Types / Network Device / Feature bits
  \item[VIRTIO_NET_F_CTRL_MAC_ADDR(23)] Set MAC address through control
      channel.
 
+\item[VIRTIO_NET_F_VQ_NOTF_COAL(52)] Device supports the virtqueue
+    notifications coalescing.
+
  \item[VIRTIO_NET_F_NOTF_COAL(53)] Device supports notifications coalescing.
 
  \item[VIRTIO_NET_F_GUEST_USO4 (54)] Driver can receive USOv4 packets.

content.tex \subsubsection{Feature bit requirements}\label{sec:Device Types / Network Device · line 3148

Quoted 6 lines
content.tex +1 -0
@@ -3140,6 +3143,7 @@ \subsubsection{Feature bit requirements}\label{sec:Device Types / Network Device
  \item[VIRTIO_NET_F_NOTF_COAL] Requires VIRTIO_NET_F_CTRL_VQ.
  \item[VIRTIO_NET_F_RSC_EXT] Requires VIRTIO_NET_F_HOST_TSO4 or VIRTIO_NET_F_HOST_TSO6.
  \item[VIRTIO_NET_F_RSS] Requires VIRTIO_NET_F_CTRL_VQ.
+\item[VIRTIO_NET_F_VQ_NOTF_COAL] Requires VIRTIO_NET_F_CTRL_VQ and VIRTIO_NET_F_NOTF_COAL.
  \end{description}
 

Do we need VIRTIO_NET_F_CTRL_VQ in this case? VIRTIO_NET_F_VQ_NOTF_COAL requires VIRTIO_NET_F_NOTF_COAL, which requires VIRTIO_NET_F_CTRL_VQ, so it's implied.

Quoted 5 lines

We have a similar example with VIRTIO_NET_F_HOST_ECN, which requires VIRTIO_NET_F_HOST_TSO4 or VIRTIO_NET_F_HOST_TSO6. VIRTIO_NET_F_CSUM is not mentioned here, although required.

So, should we remove VIRTIO_NET_F_CTRL_VQ here, or fix VIRTIO_NET_F_HOST_ECN?

Thanks for pointing out, I think following the previous for consistency, I will remove VIRTIO_NET_F_CTRL_VQ.

Quoted 16 lines
Quoted 16 lines
content.tex +10 -0
  \subsubsection{Legacy Interface: Feature bits}\label{sec:Device Types / Network Device / Feature bits / Legacy Interface: Feature bits}
@@ -4520,6 +4524,49 @@ \subsubsection{Control Virtqueue}\label{sec:Device Types / Network Device / Devi
  \item VIRTIO_NET_CTRL_NOTF_COAL_RX_SET: set the \field{rx_usecs} and \field{rx_max_packets} parameters.
  \end{enumerate}
 
+If additionally VIRTIO_NET_F_VQ_NOTF_COAL is negotiated, the driver can send
+control commands to set or get the coalescing parameters of a specified
+virtqueue (excluding the control virtqueue).
+
+\begin{lstlisting}
+struct virtio_net_ctrl_coal_vq {
+    le32 max_packets;
+    le32 usecs;
+    le16 vqn;
+};
Quoted 8 lines

content.tex \subsubsection{Control Virtqueue}\label{sec:Device Types / Network Device / Devi · line 4542

Quoted 6 lines
content.tex +6 -0
+
+#define VIRTIO_NET_CTRL_NOTF_COAL_VQ 7
+ #define VIRTIO_NET_CTRL_NOTF_COAL_VQ_SET 0
+ #define VIRTIO_NET_CTRL_NOTF_COAL_VQ_GET 1
+\end{lstlisting}
+

We already have a notifications coalescing class, why not group all coalescing commands under a single class?

Good idea, I overlooked this.

Thanks!

Quoted 85 lines
Quoted 85 lines
content.tex +48 -2
+Virtqueue coalescing parameters:
+\begin{itemize}
+\item \field{max_packets}: The maximum number of packets sent/received by the
+    specified virtqueue before a TX/RX notification.
+\item \field{usecs}: The maximum number of TX/RX usecs that the specified
+    virtqueue delays a TX/RX notification.
+\item \field{vqn}: The virtqueue number of the specified virtqueue.
+\end{itemize}
+
+The range of \filed{vqn} is between 0 and 0xFFFF inclusive, $ \lfloor vqn / 2 \rfloor $
+is the index of the corresponding receiveq, and $\lfloor (vqn / 2) + 1 \rfloor $ is
+the corresponding tranmitq.
+
+The VIRTIO_NET_CTRL_NOTF_COAL_RX_SET command is the same as calling VIRTIO_NET_CTRL_NOTF_COAL_VQ
+for virtqueues corresponding to all receiveqs.
+
+The VIRTIO_NET_CTRL_NOTF_COAL_TX_SET command is the same as calling VIRTIO_NET_CTRL_NOTF_COAL_VQ
+for virtqueues corresponding to all transmitqs.
+
+Virtqueue coalescing will be disabled if all parameters are set to 0.
+
+The class VIRTIO_NET_CTRL_NOTF_COAL_VQ has 2 commands:
+\begin{enumerate}
+\item VIRTIO_NET_CTRL_NOTF_COAL_VQ_SET: set the \field{max_packets}, \field{usecs} and \filed{vqn} parameters.
+\item VIRTIO_NET_CTRL_NOTF_COAL_VQ_GET: get the \field{max_packets}, \field{usecs} and \field{vqn} parameters.
+\end{enumerate}
+
  \subparagraph{RX Notifications}\label{sec:Device Types / Network Device / Device Operation / Control Virtqueue / Notifications Coalescing / RX Notifications}
 
  If, for example:
@@ -4535,6 +4582,15 @@ \subsubsection{Control Virtqueue}\label{sec:Device Types / Network Device / Devi
  \item If the notifications are not suppressed by the driver, the device will send an used buffer notification, otherwise, the device will not send an used buffer notification as long as the notifications are suppressed.
  \end{itemize}
 
+If, example of setting coalescing parameters for a receive virtqueue:
+\begin{itemize}
+\item \field{max_packets} = 15.
+\item \field{usecs} = 10.
+\item \field{vqn} = 0;
+\end{itemize}
+
+The device will only operate on recieveq1 as VIRTIO_NET_CTRL_NOTF_COAL_RX_SET.
+
  \subparagraph{TX Notifications}\label{sec:Device Types / Network Device / Device Operation / Control Virtqueue / Notifications Coalescing / TX Notifications}
 
  If, for example:
@@ -4550,13 +4606,24 @@ \subsubsection{Control Virtqueue}\label{sec:Device Types / Network Device / Devi
  \item If the notifications are not suppressed by the driver, the device will send an used buffer notification, otherwise, the device will not send an used buffer notification as long as the notifications are suppressed.
  \end{itemize}
 
+If, example of setting coalescing parameters for a transmit virtqueue:
+\begin{itemize}
+\item \field{max_packets} = 15.
+\item \field{usecs} = 10.
+\item \field{vqn} = 1;
+\end{itemize}
+
+The device will only operate on transmitq1 as VIRTIO_NET_CTRL_NOTF_COAL_TX_SET.
+
  \drivernormative{\subparagraph}{Notifications Coalescing}{Device Types / Network Device / Device Operation / Control Virtqueue / Notifications Coalescing}
 
  If the VIRTIO_NET_F_NOTF_COAL feature has not been negotiated, the driver MUST NOT issue VIRTIO_NET_CTRL_NOTF_COAL commands.
+If the VIRTIO_NET_F_VQ_NOTF_COAL feature has not been negotiated, the driver MUST NOT issue VIRTIO_NET_CTRL_NOFT_COAL_VQ commands.
 
  \devicenormative{\subparagraph}{Notifications Coalescing}{Device Types / Network Device / Device Operation / Control Virtqueue / Notifications Coalescing}
 
-A device SHOULD respond to the VIRTIO_NET_CTRL_NOTF_COAL commands with VIRTIO_NET_ERR if it was not able to change the parameters.
+A device SHOULD respond to the VIRTIO_NET_CTRL_NOTF_COAL commands with VIRTIO_NET_ERR if it was not able to change the parameters or
+was not able to find a virtqueue using the \field{vqn}.
 
  A device SHOULD NOT send used buffer notifications to the driver, if the notifications are suppressed as explained in \ref{sec:Basic Facilities of a Virtio Device / Virtqueues / Used Buffer Notification Suppression}, even if the coalescing counters expired.
 
--

2.19.1.6.gb485710b

This publicly archived list offers a means to provide input to the OASIS Virtual I/O Device (VIRTIO) TC.

In order to verify user consent to the Feedback License terms and to minimize spam in the list archive, subscription is required before posting.

Quoted 12 lines
Quoted 9 lines

Subscribe: [email protected]
Unsubscribe: [email protected]
List help: [email protected]
List archive: https://lists.oasis-open.org/archives/virtio-comment/
Feedback License: https://www.oasis-open.org/who/ipr/feedback_license.pdf
List Guidelines: https://www.oasis-open.org/policies-guidelines/mailing-lists
Committee: https://www.oasis-open.org/committees/virtio/
Join OASIS: https://www.oasis-open.org/join/

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]

This publicly archived list offers a means to provide input to the OASIS Virtual I/O Device (VIRTIO) TC.

In order to verify user consent to the Feedback License terms and to minimize spam in the list archive, subscription is required before posting.

Subscribe: [email protected]
Unsubscribe: [email protected]
List help: [email protected]
List archive: https://lists.oasis-open.org/archives/virtio-comment/
Feedback License: https://www.oasis-open.org/who/ipr/feedback_license.pdf
List Guidelines: https://www.oasis-open.org/policies-guidelines/mailing-lists
Committee: https://www.oasis-open.org/committees/virtio/
Join OASIS: https://www.oasis-open.org/join/

#18 lore raw
In reply to Heng Qi
Quoted 6 lines

From: Heng Qi <[email protected]>
Sent: Friday, February 10, 2023 2:02 AM

Currently, the coalescing profile is directly applied to all queues.

Say it,
Currently coalescing parameters are grouped for all transmit and receive virtqueues.

Quoted 2 lines

This patch supports setting or getting the parameters for a specified queue, and a typical application of this function is NetDIM.

Many of us know the net dim.
But if you prefer to mention it here, better to have the link for it.

Please add pointer to it.
[1] https://docs.kernel.org/networking/net_dim.html

Review

Quoted 8 lines

When the traffic between queues is unbalanced, for example, one queue is busy and another queue is idle, then it will be very useful to control coalescing parameters at the queue granularity.

(quoted diff) +2 -0
+If additionally VIRTIO_NET_F_VQ_NOTF_COAL is negotiated, the driver can
+send control commands to set or get the coalescing parameters of a

Control command singular?

content.tex \subsubsection{Control Virtqueue}\label{sec:Device Types / Network Device / Devi · line 4537

Quoted 9 lines
content.tex +9 -0
+specified virtqueue (excluding the control virtqueue).
+
+\begin{lstlisting}
+struct virtio_net_ctrl_coal_vq {
+    le32 max_packets;
+    le32 usecs;
+    le16 vqn;
+};
+

Change that Michael suggest restructuring and under same class looks good to me.

Quoted 8 lines
content.tex +7 -0
+#define VIRTIO_NET_CTRL_NOTF_COAL_VQ 7
+ #define VIRTIO_NET_CTRL_NOTF_COAL_VQ_SET 0  #define
+VIRTIO_NET_CTRL_NOTF_COAL_VQ_GET 1 \end{lstlisting}
+
+Virtqueue coalescing parameters:
+\begin{itemize}
+\item \field{max_packets}: The maximum number of packets sent/received by

the

content.tex \subsubsection{Control Virtqueue}\label{sec:Device Types / Network Device / Devi · line 4551

Quoted 6 lines
content.tex +6 -0
+    specified virtqueue before a TX/RX notification.
+\item \field{usecs}: The maximum number of TX/RX usecs that the specified
+    virtqueue delays a TX/RX notification.
+\item \field{vqn}: The virtqueue number of the specified virtqueue.
+\end{itemize}
+

The virtqueue number of the enabled transmit or receive virtuqueue. This will simplify below description.

Review

Quoted 4 lines
(quoted diff) +4 -0
+The range of \filed{vqn} is between 0 and 0xFFFF inclusive, $ \lfloor
+vqn / 2 \rfloor $ is the index of the corresponding receiveq, and
+$\lfloor (vqn / 2) + 1 \rfloor $ is the corresponding tranmitq.
+

Please add short description something like,

When the driver prefers to use per virtqueue notifications coalescing, and if queue group (transmit or receive) level notification coalescing is enabled, driver SHOULD first disable device level notification coalescing. Or it should be,

Virtqueue level notifications coalescing, and device level notifications can be enabled together. When both of them are enabled, per virtqueue notifications coalescing take priority over queue group level.

With rests of the comments from Michael and Alvaro in progress, looks good.

This publicly archived list offers a means to provide input to the OASIS Virtual I/O Device (VIRTIO) TC.

In order to verify user consent to the Feedback License terms and to minimize spam in the list archive, subscription is required before posting.

Subscribe: [email protected]
Unsubscribe: [email protected]
List help: [email protected]
List archive: https://lists.oasis-open.org/archives/virtio-comment/
Feedback License: https://www.oasis-open.org/who/ipr/feedback_license.pdf
List Guidelines: https://www.oasis-open.org/policies-guidelines/mailing-lists
Committee: https://www.oasis-open.org/committees/virtio/
Join OASIS: https://www.oasis-open.org/join/

author
#19 lore raw
Quoted 7 lines · Parav Pandit
Quoted 5 lines

From: Heng Qi <[email protected]>
Sent: Friday, February 10, 2023 2:02 AM

Currently, the coalescing profile is directly applied to all queues.

Say it,
Currently coalescing parameters are grouped for all transmit and receive virtqueues.

Sure.

Quoted 5 lines
Quoted 3 lines

This patch supports setting or getting the parameters for a specified queue, and a typical application of this function is NetDIM.

Many of us know the net dim.
But if you prefer to mention it here, better to have the link for it.

Yes, but this sentence is just a reminder for those who may not know the current usage scenarios of it.

Quoted 3 lines

Please add pointer to it.
[1] https://docs.kernel.org/networking/net_dim.html

Good opinion.

Quoted 9 lines

Review

Quoted 8 lines

When the traffic between queues is unbalanced, for example, one queue is busy and another queue is idle, then it will be very useful to control coalescing parameters at the queue granularity.

(quoted diff) +2 -0
+If additionally VIRTIO_NET_F_VQ_NOTF_COAL is negotiated, the driver can
+send control commands to set or get the coalescing parameters of a

Control command singular?

Yes.

Quoted 11 lines

content.tex \subsubsection{Control Virtqueue}\label{sec:Device Types / Network Device / Devi · line 4537

Quoted 9 lines
content.tex +9 -0
+specified virtqueue (excluding the control virtqueue).
+
+\begin{lstlisting}
+struct virtio_net_ctrl_coal_vq {
+    le32 max_packets;
+    le32 usecs;
+    le16 vqn;
+};
+

Change that Michael suggest restructuring and under same class looks good to me.

Quoted 16 lines
Quoted 8 lines
content.tex +7 -0
+#define VIRTIO_NET_CTRL_NOTF_COAL_VQ 7
+ #define VIRTIO_NET_CTRL_NOTF_COAL_VQ_SET 0  #define
+VIRTIO_NET_CTRL_NOTF_COAL_VQ_GET 1 \end{lstlisting}
+
+Virtqueue coalescing parameters:
+\begin{itemize}
+\item \field{max_packets}: The maximum number of packets sent/received by

the

content.tex \subsubsection{Control Virtqueue}\label{sec:Device Types / Network Device / Devi · line 4551

Quoted 6 lines
content.tex +6 -0
+    specified virtqueue before a TX/RX notification.
+\item \field{usecs}: The maximum number of TX/RX usecs that the specified
+    virtqueue delays a TX/RX notification.
+\item \field{vqn}: The virtqueue number of the specified virtqueue.
+\end{itemize}
+

The virtqueue number of the enabled transmit or receive virtuqueue. This will simplify below description.

Good opinion, I like this better.

Quoted 7 lines

Review

Quoted 4 lines
(quoted diff) +4 -0
+The range of \filed{vqn} is between 0 and 0xFFFF inclusive, $ \lfloor
+vqn / 2 \rfloor $ is the index of the corresponding receiveq, and
+$\lfloor (vqn / 2) + 1 \rfloor $ is the corresponding tranmitq.
+

Please add short description something like,

When the driver prefers to use per virtqueue notifications coalescing, and if queue group (transmit or receive) level notification coalescing is enabled, driver SHOULD first disable device level notification coalescing.

I think this is more in line with what netdim does, I'll add this.

Thanks.

Quoted 10 lines

Or it should be,

Virtqueue level notifications coalescing, and device level notifications can be enabled together. When both of them are enabled, per virtqueue notifications coalescing take priority over queue group level.

With rests of the comments from Michael and Alvaro in progress, looks good.

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]

This publicly archived list offers a means to provide input to the OASIS Virtual I/O Device (VIRTIO) TC.

In order to verify user consent to the Feedback License terms and to minimize spam in the list archive, subscription is required before posting.

Subscribe: [email protected]
Unsubscribe: [email protected]
List help: [email protected]
List archive: https://lists.oasis-open.org/archives/virtio-comment/
Feedback License: https://www.oasis-open.org/who/ipr/feedback_license.pdf
List Guidelines: https://www.oasis-open.org/policies-guidelines/mailing-lists
Committee: https://www.oasis-open.org/committees/virtio/
Join OASIS: https://www.oasis-open.org/join/

#20 lore raw
In reply to Parav Pandit
Quoted 5 lines

Please add short description something like,

When the driver prefers to use per virtqueue notifications coalescing, and if queue group (transmit or receive) level notification coalescing is enabled, driver SHOULD first disable device level notification coalescing. Or it should be,

I disagree here.
IMO "queue group level notification coalescing" is not something to enable or disable, but a shortcut to set all TX/RX queues at once. Why should the spec force a driver to "disable device level notification coalescing" (I assume you mean send a VIRTIO_NET_CTRL_NOTF_COAL_[T/R]X_SET command with zeros)? What if the driver sends a VIRTIO_NET_CTRL_NOTF_COAL_[T/R]X_SET command, and then a single queue traffic increases? why should it zero the parameters to all other queues?
I think that this should be discussed in the driver implementation stage, not in the spec.

Quoted 2 lines

Virtqueue level notifications coalescing, and device level notifications can be enabled together. When both of them are enabled, per virtqueue notifications coalescing take priority over queue group level.

How do you enable Virtqueue level notifications coalescing? Why are they different entities?
I don't think that we should have priorities, but the last command should be the one that dictates the coalescing parameters.

For example, let's look at vq0 (RX):
Device receives VIRTIO_NET_CTRL_NOTF_COAL_RX_SET, vq0 should change the parameters accordingly (all RX vqs should do the same). Then device receives VIRTIO_NET_CTRL_NOTF_COAL_VQ_SET with vqn = 0, vq0 changes the parameters accordingly (all RX vqs are still using the "old" parameters)
Then device receives VIRTIO_NET_CTRL_NOTF_COAL_RX_SET, vq0 changes the parameters accordingly (all RX vqs should do the same).

This publicly archived list offers a means to provide input to the OASIS Virtual I/O Device (VIRTIO) TC.

In order to verify user consent to the Feedback License terms and to minimize spam in the list archive, subscription is required before posting.

Subscribe: [email protected]
Unsubscribe: [email protected]
List help: [email protected]
List archive: https://lists.oasis-open.org/archives/virtio-comment/
Feedback License: https://www.oasis-open.org/who/ipr/feedback_license.pdf
List Guidelines: https://www.oasis-open.org/policies-guidelines/mailing-lists
Committee: https://www.oasis-open.org/committees/virtio/
Join OASIS: https://www.oasis-open.org/join/

#21 lore raw
Quoted 26 lines
Quoted 5 lines

Please add short description something like,

When the driver prefers to use per virtqueue notifications coalescing, and if queue group (transmit or receive) level notification coalescing is enabled, driver SHOULD first disable device level notification coalescing. Or it should be,

I disagree here.
IMO "queue group level notification coalescing" is not something to enable or disable, but a shortcut to set all TX/RX queues at once. Why should the spec force a driver to "disable device level notification coalescing" (I assume you mean send a VIRTIO_NET_CTRL_NOTF_COAL_[T/R]X_SET command with zeros)? What if the driver sends a VIRTIO_NET_CTRL_NOTF_COAL_[T/R]X_SET command, and then a single queue traffic increases? why should it zero the parameters to all other queues?
I think that this should be discussed in the driver implementation stage, not in the spec.

Quoted 2 lines

Virtqueue level notifications coalescing, and device level notifications can be enabled together. When both of them are enabled, per virtqueue notifications coalescing take priority over queue group level.

How do you enable Virtqueue level notifications coalescing? Why are they different entities?
I don't think that we should have priorities, but the last command should be the one that dictates the coalescing parameters.

Quoted 6 lines

For example, let's look at vq0 (RX):
Device receives VIRTIO_NET_CTRL_NOTF_COAL_RX_SET, vq0 should change the parameters accordingly (all RX vqs should do the same). Then device receives VIRTIO_NET_CTRL_NOTF_COAL_VQ_SET with vqn = 0, vq0 changes the parameters accordingly (all RX vqs are still using the "old" parameters)

Opps, I missed a word in here, it should have been:
Then device receives VIRTIO_NET_CTRL_NOTF_COAL_VQ_SET with vqn = 0, vq0 changes the parameters accordingly (all RX vqs EXCEPT FOR vq0 still use the previous parameters)

This publicly archived list offers a means to provide input to the OASIS Virtual I/O Device (VIRTIO) TC.

In order to verify user consent to the Feedback License terms and to minimize spam in the list archive, subscription is required before posting.

Subscribe: [email protected]
Unsubscribe: [email protected]
List help: [email protected]
List archive: https://lists.oasis-open.org/archives/virtio-comment/
Feedback License: https://www.oasis-open.org/who/ipr/feedback_license.pdf
List Guidelines: https://www.oasis-open.org/policies-guidelines/mailing-lists
Committee: https://www.oasis-open.org/committees/virtio/
Join OASIS: https://www.oasis-open.org/join/

author
#22 lore raw
In reply to Alvaro Karsz
Quoted 5 lines · Alvaro Karsz
Quoted 5 lines

Please add short description something like,

When the driver prefers to use per virtqueue notifications coalescing, and if queue group (transmit or receive) level notification coalescing is enabled, driver SHOULD first disable device level notification coalescing. Or it should be,

Quoted 9 lines

I disagree here.
IMO "queue group level notification coalescing" is not something to enable or disable, but a shortcut to set all TX/RX queues at once. Why should the spec force a driver to "disable device level notification coalescing" (I assume you mean send a VIRTIO_NET_CTRL_NOTF_COAL_[T/R]X_SET command with zeros)? What if the driver sends a VIRTIO_NET_CTRL_NOTF_COAL_[T/R]X_SET command, and then a single queue traffic increases? why should it zero the parameters to all other queues?

Hi, Alvaro! Thanks for your reply!

I think Parav refers more to the scene where ethool sets parameters at the queue group level and
the scene where netdim sets parameters for a single queue. In this scenario, netdim should really
determine the coalescing parameters of the device, and the parameters at the queue group level set
by ethtool should be ignored (many drivers are designed this way, such as mlx), that is, we need to give netdim the right, because it It has the ability to dynamically adjust parameters. (However, I think this friendly constraint is also possible in driver implementation.)

Of course, if we consider setting coalescing parameters at the queue group level and single queue level separately through ethtool, then as you said, we should not set any priority for them.

Back to reality, I think the function of ethtool to set single queue parameters may come later, which is thankless for users because of netdim.

Therefore, if our specification tends to be practical, we can add Parav's proposal, and if our specification tends to be more general, then hand over the constraints to the driver implementation. what do you think?

Quoted 10 lines

I think that this should be discussed in the driver implementation stage, not in the spec.

Quoted 2 lines

Virtqueue level notifications coalescing, and device level notifications can be enabled together. When both of them are enabled, per virtqueue notifications coalescing take priority over queue group level.

How do you enable Virtqueue level notifications coalescing? Why are they different entities?
I don't think that we should have priorities, but the last command should be the one that dictates the coalescing parameters.

Quoted 8 lines

For example, let's look at vq0 (RX):
Device receives VIRTIO_NET_CTRL_NOTF_COAL_RX_SET, vq0 should change the parameters accordingly (all RX vqs should do the same). Then device receives VIRTIO_NET_CTRL_NOTF_COAL_VQ_SET with vqn = 0, vq0 changes the parameters accordingly (all RX vqs are still using the "old" parameters)
Then device receives VIRTIO_NET_CTRL_NOTF_COAL_RX_SET, vq0 changes the parameters accordingly (all RX vqs should do the same).

Yes I see what you mean, thanks for the clear example. This should be the second scenario I described above, let's discuss how to solve it in the above reply.

Thanks! :)

Quoted 8 lines

This publicly archived list offers a means to provide input to the OASIS Virtual I/O Device (VIRTIO) TC.

In order to verify user consent to the Feedback License terms and to minimize spam in the list archive, subscription is required before posting.

Quoted 8 lines

Subscribe: [email protected]
Unsubscribe: [email protected]
List help: [email protected]
List archive: https://lists.oasis-open.org/archives/virtio-comment/
Feedback License: https://www.oasis-open.org/who/ipr/feedback_license.pdf
List Guidelines: https://www.oasis-open.org/policies-guidelines/mailing-lists
Committee: https://www.oasis-open.org/committees/virtio/
Join OASIS: https://www.oasis-open.org/join/

This publicly archived list offers a means to provide input to the OASIS Virtual I/O Device (VIRTIO) TC.

In order to verify user consent to the Feedback License terms and to minimize spam in the list archive, subscription is required before posting.

Subscribe: [email protected]
Unsubscribe: [email protected]
List help: [email protected]
List archive: https://lists.oasis-open.org/archives/virtio-comment/
Feedback License: https://www.oasis-open.org/who/ipr/feedback_license.pdf
List Guidelines: https://www.oasis-open.org/policies-guidelines/mailing-lists
Committee: https://www.oasis-open.org/committees/virtio/
Join OASIS: https://www.oasis-open.org/join/

#23 lore raw
Quoted 33 lines
Quoted 5 lines
Quoted 5 lines

Please add short description something like,

When the driver prefers to use per virtqueue notifications coalescing, and if queue group (transmit or receive) level notification coalescing is enabled, driver SHOULD first disable device level notification coalescing. Or it should be,

Quoted 9 lines

I disagree here.
IMO "queue group level notification coalescing" is not something to enable or disable, but a shortcut to set all TX/RX queues at once. Why should the spec force a driver to "disable device level notification coalescing" (I assume you mean send a VIRTIO_NET_CTRL_NOTF_COAL_[T/R]X_SET command with zeros)? What if the driver sends a VIRTIO_NET_CTRL_NOTF_COAL_[T/R]X_SET command, and then a single queue traffic increases? why should it zero the parameters to all other queues?

Hi, Alvaro! Thanks for your reply!

I think Parav refers more to the scene where ethool sets parameters at the queue group level and
the scene where netdim sets parameters for a single queue. In this scenario, netdim should really
determine the coalescing parameters of the device, and the parameters at the queue group level set
by ethtool should be ignored (many drivers are designed this way, such as mlx), that is, we need to give netdim the right,
because it It has the ability to dynamically adjust parameters. (However, I think this friendly constraint is also possible in driver implementation.)

Of course, if we consider setting coalescing parameters at the queue group level and single queue level separately through ethtool, then as you said, we should not set any priority for them.

Quoted 7 lines

Back to reality, I think the function of ethtool to set single queue parameters may come later, which is thankless for users because of netdim.

Therefore, if our specification tends to be practical, we can add Parav's proposal, and if our specification tends to be more general, then hand over
the constraints to the driver implementation. what do you think?

Hi,
I understand your and Parav's point, and that this is needed for netdim. I just think that the spec should not dictate this, and this should be implementation specific.
What if a OS with a different adaptive functionality wants to support these features?

This is just my opinion though.

This publicly archived list offers a means to provide input to the OASIS Virtual I/O Device (VIRTIO) TC.

In order to verify user consent to the Feedback License terms and to minimize spam in the list archive, subscription is required before posting.

Subscribe: [email protected]
Unsubscribe: [email protected]
List help: [email protected]
List archive: https://lists.oasis-open.org/archives/virtio-comment/
Feedback License: https://www.oasis-open.org/who/ipr/feedback_license.pdf
List Guidelines: https://www.oasis-open.org/policies-guidelines/mailing-lists
Committee: https://www.oasis-open.org/committees/virtio/
Join OASIS: https://www.oasis-open.org/join/

#24 lore raw
Quoted 9 lines

From: Alvaro Karsz <[email protected]>
Sent: Saturday, February 11, 2023 5:19 AM

Quoted 4 lines

Therefore, if our specification tends to be practical, we can add Parav's proposal, and if our specification tends to be more general, then hand over the constraints to the driver implementation. what do you think?

Quoted 8 lines

Hi,
I understand your and Parav's point, and that this is needed for netdim. I just think that the spec should not dictate this, and this should be implementation specific.
What if a OS with a different adaptive functionality wants to support these features?

This is just my opinion though.

We don’t dictate it in the spec. in the spec just defines
a. the behavior for device should do when both are configured
One way to say, it doesn’t try to configure both.
Driver should disable one and switch to other.
Simple for driver, device implementation and spec as this is more common scenario.

Other way to say, spec wants the door to remain open for mixed mode here.
b. In this case the priority is defined as (last configured for a given object). So device is clear how to implement mixed mode.

#a is well known case. #b is more flexible.
Both spec definitions look good to me, we just got to describe it.

#25 lore raw

You write "both are configured", "try to configure both", "disable one and switch to other" "mixed mode" etc..

But no modes/levels are mentioned in the patch, not once.

I totally agree that *if* we define 2 modes, we should have strict rules on how to switch between modes and how to operate with both modes.

But if we decide to have modes, your suggestion is not enough IMO, we should explicitly define the modes.

In my POV, we should have no modes at all, everything is per queue, and VIRTIO_NET_CTRL_NOTF_COAL_RX_SET is exactly the same as iterating through the RX queues and issuing a VIRTIO_NET_CTRL_NOTF_COAL_VQ_SET command.

Every queue will use the last coalescing parameters it received from the driver, regardless to the command used to deliver the parameters.

No modes at all.

I really don't see what we gain from having different operation modes.

I thought that we agreed not to have operation modes in v1.

This publicly archived list offers a means to provide input to the OASIS Virtual I/O Device (VIRTIO) TC.

In order to verify user consent to the Feedback License terms and to minimize spam in the list archive, subscription is required before posting.

Subscribe: [email protected]
Unsubscribe: [email protected]
List help: [email protected]
List archive: https://lists.oasis-open.org/archives/virtio-comment/
Feedback License: https://www.oasis-open.org/who/ipr/feedback_license.pdf
List Guidelines: https://www.oasis-open.org/policies-guidelines/mailing-lists
Committee: https://www.oasis-open.org/committees/virtio/
Join OASIS: https://www.oasis-open.org/join/

#26 lore raw
Quoted 7 lines

From: Alvaro Karsz <[email protected]>
Sent: Saturday, February 11, 2023 10:47 AM

You write "both are configured", "try to configure both", "disable one and switch to other" "mixed mode" etc..

But no modes/levels are mentioned in the patch, not once.

using RX_SET and VQ_SET simultaneously implies "both, mixed mode, configured both". Spec cannot be silent about it.
Did I miss the requirements section that describes the behavior of above two commands in combination?

Quoted 4 lines

I totally agree that *if* we define 2 modes, we should have strict rules on how to switch between modes and how to operate with both modes.

Even without any explicit mode, we need to define behavior of two commands invoked one after the other.

Quoted 11 lines

But if we decide to have modes, your suggestion is not enough IMO, we should explicitly define the modes.

In my POV, we should have no modes at all, everything is per queue, and VIRTIO_NET_CTRL_NOTF_COAL_RX_SET is exactly the same as iterating through the RX queues and issuing a VIRTIO_NET_CTRL_NOTF_COAL_VQ_SET command.

Every queue will use the last coalescing parameters it received from the driver, regardless to the command used to deliver the parameters.

This to be part of the spec. I don’t see it or I missed it?

Quoted 5 lines

No modes at all.

I really don't see what we gain from having different operation modes.

I thought that we agreed not to have operation modes in v1.

We agreed to not have explicit mode, at condition to define the clear behavior on what should happen when both commands are used one after other.

#27 lore raw

I think that I wasn't clear enough.

I'm not saying that we should not define in the spec how to handle a situation when a device receives both RX_SET and VQ_SET (or a driver sends both).
I'm saying that I don't think that the driver should handle the situation the way you described it:

Quoted 5 lines

When the driver prefers to use per virtqueue notifications coalescing, and if queue group (transmit or receive) level notification coalescing is enabled, driver SHOULD first disable device level notification coalescing. Or it should be,

Virtqueue level notifications coalescing, and device level notifications can be enabled together. When both of them are enabled, per virtqueue notifications coalescing take priority over queue group level.

This implies that we have 2 modes and have priorities.

I think that if we want to refer to this situation in the spec, it should be something like:
"A Device should use the last coalescing parameters received for a virtqueue, regardless of the command used to deliver the parameters." (just an example to make the point).

This publicly archived list offers a means to provide input to the OASIS Virtual I/O Device (VIRTIO) TC.

In order to verify user consent to the Feedback License terms and to minimize spam in the list archive, subscription is required before posting.

Subscribe: [email protected]
Unsubscribe: [email protected]
List help: [email protected]
List archive: https://lists.oasis-open.org/archives/virtio-comment/
Feedback License: https://www.oasis-open.org/who/ipr/feedback_license.pdf
List Guidelines: https://www.oasis-open.org/policies-guidelines/mailing-lists
Committee: https://www.oasis-open.org/committees/virtio/
Join OASIS: https://www.oasis-open.org/join/

#28 lore raw
Quoted 13 lines

From: Alvaro Karsz <[email protected]>
Sent: Saturday, February 11, 2023 11:14 AM

I think that I wasn't clear enough.

I'm not saying that we should not define in the spec how to handle a situation when a device receives both RX_SET and VQ_SET (or a driver sends both). I'm saying that I don't think that the driver should handle the situation the way you described it:

Quoted 1 line

When the driver prefers to use per virtqueue notifications coalescing, and if

Quoted 9 lines

queue group (transmit or receive) level notification coalescing is enabled, driver SHOULD first disable device level notification coalescing.

Quoted 3 lines

Or it should be,

Virtqueue level notifications coalescing, and device level notifications can be

enabled together.

Quoted 1 line

When both of them are enabled, per virtqueue notifications coalescing take

priority over queue group level.

These are the two options I proposed.
In second option missed the case of per vq followed by group level. Which I further acked in [1] to have it as last configured.

Quoted 5 lines

I think that if we want to refer to this situation in the spec, it should be something like:
"A Device should use the last coalescing parameters received for a virtqueue, regardless of the command used to deliver the parameters."
(just an example to make the point).

Yes, as acked in [1]. :)
We both agree on #b which you described in above example.

So things looks good. Lets wait for Heng to generate v3 covering above case.

[1] https://lists.oasis-open.org/archives/virtio-dev/202302/msg00227.html

author
#29 lore raw
In reply to Alvaro Karsz
Quoted 14 lines · Alvaro Karsz

I think that I wasn't clear enough.

I'm not saying that we should not define in the spec how to handle a situation when a device receives both RX_SET and VQ_SET (or a driver sends both).
I'm saying that I don't think that the driver should handle the situation the way you described it:

Quoted 5 lines

When the driver prefers to use per virtqueue notifications coalescing, and if queue group (transmit or receive) level notification coalescing is enabled, driver SHOULD first disable device level notification coalescing. Or it should be,

Virtqueue level notifications coalescing, and device level notifications can be enabled together. When both of them are enabled, per virtqueue notifications coalescing take priority over queue group level.

Quoted 6 lines

This implies that we have 2 modes and have priorities.

I think that if we want to refer to this situation in the spec, it should be something like:
"A Device should use the last coalescing parameters received for a virtqueue, regardless of the command used to deliver the parameters."

Your suggestion is good, the per-device command and the per-queue command need some examples and behavior definitions, I will add them to avoid some misunderstandings.

Thanks.

Quoted 1 line

(just an example to make the point).

This publicly archived list offers a means to provide input to the OASIS Virtual I/O Device (VIRTIO) TC.

In order to verify user consent to the Feedback License terms and to minimize spam in the list archive, subscription is required before posting.

Subscribe: [email protected]
Unsubscribe: [email protected]
List help: [email protected]
List archive: https://lists.oasis-open.org/archives/virtio-comment/
Feedback License: https://www.oasis-open.org/who/ipr/feedback_license.pdf
List Guidelines: https://www.oasis-open.org/policies-guidelines/mailing-lists
Committee: https://www.oasis-open.org/committees/virtio/
Join OASIS: https://www.oasis-open.org/join/

#30 lore raw
In reply to Alvaro Karsz
Quoted 41 lines · Alvaro Karsz
Quoted 33 lines
Quoted 5 lines
Quoted 5 lines

Please add short description something like,

When the driver prefers to use per virtqueue notifications coalescing, and if queue group (transmit or receive) level notification coalescing is enabled, driver SHOULD first disable device level notification coalescing. Or it should be,

Quoted 9 lines

I disagree here.
IMO "queue group level notification coalescing" is not something to enable or disable, but a shortcut to set all TX/RX queues at once. Why should the spec force a driver to "disable device level notification coalescing" (I assume you mean send a VIRTIO_NET_CTRL_NOTF_COAL_[T/R]X_SET command with zeros)? What if the driver sends a VIRTIO_NET_CTRL_NOTF_COAL_[T/R]X_SET command, and then a single queue traffic increases? why should it zero the parameters to all other queues?

Hi, Alvaro! Thanks for your reply!

I think Parav refers more to the scene where ethool sets parameters at the queue group level and
the scene where netdim sets parameters for a single queue. In this scenario, netdim should really
determine the coalescing parameters of the device, and the parameters at the queue group level set
by ethtool should be ignored (many drivers are designed this way, such as mlx), that is, we need to give netdim the right,
because it It has the ability to dynamically adjust parameters. (However, I think this friendly constraint is also possible in driver implementation.)

Of course, if we consider setting coalescing parameters at the queue group level and single queue level separately through ethtool, then as you said, we should not set any priority for them.

Quoted 7 lines

Back to reality, I think the function of ethtool to set single queue parameters may come later, which is thankless for users because of netdim.

Therefore, if our specification tends to be practical, we can add Parav's proposal, and if our specification tends to be more general, then hand over
the constraints to the driver implementation. what do you think?

Quoted 8 lines

Hi,
I understand your and Parav's point, and that this is needed for netdim. I just think that the spec should not dictate this, and this should be implementation specific.
What if a OS with a different adaptive functionality wants to support these features?

This is just my opinion though.

I'm not sure the specific property is even a feature and not a bug. One can argue e.g. that ethtool should fail with EBUSY rather than being silently overwritten.
Thats why I feel this kind of policy is best set by driver.

Signature · 6 lines
MST


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
#31 lore raw
Quoted 4 lines

I'm not sure the specific property is even a feature and not a bug. One can argue e.g. that ethtool should fail with EBUSY rather than being silently overwritten.
Thats why I feel this kind of policy is best set by driver.

When you write "set by driver", you mean that [X] the spec needs to define the driver behavior in this case, or that [Y] every driver should decide what's best?

I'll answer to [X], if you meant [Y] the following part is not relevant.

If we talk implementation here, I would probably implement it like that:

net_dim_start_tx:
set_ethtool_blocking_bool
save_current_coalescing_params # Maybe?
clear_all_tx_coalescing_params # NOTF_COAL_TX_SET 0
do_net_dim

net_dim_stop_tx:
restore_prev_ethtool_coalesing_params
clear_ethtool_blocking_bool

It's reasonable to assume that sending a ethtool set coalesce when netdim is operating will affect the performance.

But, windows' virtio_net driver may want to use _CTRL_NOTF_COAL_TX_SET in its adaptive algorithm, and may have no userspace tool to configure these parameters.
If we force the driver to clear/block some commands while using others, we may do more harm than good in windows' case.

This is just my personal perspective.

I think that this is an important feature either way.

This publicly archived list offers a means to provide input to the OASIS Virtual I/O Device (VIRTIO) TC.

In order to verify user consent to the Feedback License terms and to minimize spam in the list archive, subscription is required before posting.

Subscribe: [email protected]
Unsubscribe: [email protected]
List help: [email protected]
List archive: https://lists.oasis-open.org/archives/virtio-comment/
Feedback License: https://www.oasis-open.org/who/ipr/feedback_license.pdf
List Guidelines: https://www.oasis-open.org/policies-guidelines/mailing-lists
Committee: https://www.oasis-open.org/committees/virtio/
Join OASIS: https://www.oasis-open.org/join/

#32 lore raw
Quoted 9 lines · Alvaro Karsz
Quoted 4 lines

I'm not sure the specific property is even a feature and not a bug. One can argue e.g. that ethtool should fail with EBUSY rather than being silently overwritten.
Thats why I feel this kind of policy is best set by driver.

When you write "set by driver", you mean that [X] the spec needs to define the driver behavior in this case, or that [Y] every driver should decide what's best?
I'll answer to [X], if you meant [Y] the following part is not relevant.

Y.

Quoted 21 lines

If we talk implementation here, I would probably implement it like that:

net_dim_start_tx:
set_ethtool_blocking_bool
save_current_coalescing_params # Maybe?
clear_all_tx_coalescing_params # NOTF_COAL_TX_SET 0
do_net_dim

net_dim_stop_tx:
restore_prev_ethtool_coalesing_params
clear_ethtool_blocking_bool

It's reasonable to assume that sending a ethtool set coalesce when netdim is operating will affect the performance.

But, windows' virtio_net driver may want to use _CTRL_NOTF_COAL_TX_SET in its adaptive algorithm, and may have no userspace tool to configure these parameters.
If we force the driver to clear/block some commands while using others, we may do more harm than good in windows' case.

Quoted 3 lines

This is just my personal perspective.

I think that this is an important feature either way.

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]

#33 lore raw
In reply to Alvaro Karsz
Quoted 8 lines

From: Alvaro Karsz <[email protected]>
Sent: Saturday, February 11, 2023 3:45 AM

Quoted 3 lines

Please add short description something like,

When the driver prefers to use per virtqueue notifications coalescing, and if

Quoted 8 lines

queue group (transmit or receive) level notification coalescing is enabled, driver SHOULD first disable device level notification coalescing.

Quoted 2 lines

Or it should be,

I disagree here.
IMO "queue group level notification coalescing" is not something to enable or disable, but a shortcut to set all TX/RX queues at once.

That short cut is the enable/disablement.

Quoted 3 lines

Why should the spec force a driver to "disable device level notification coalescing" (I assume you mean send a VIRTIO_NET_CTRL_NOTF_COAL_[T/R]X_SET command with zeros)?

Yes. Because to have well defined behavior when sw configured both one after the another.

Quoted 3 lines

What if the driver sends a VIRTIO_NET_CTRL_NOTF_COAL_[T/R]X_SET command, and then a single queue traffic increases? why should it zero the parameters to all other queues?

That is short transition when driver is switching over to per queue mode. This is fine to have short glitch.

Quoted 3 lines

I think that this should be discussed in the driver implementation stage, not in the spec.

There should be a clear guidance on how device should behave when both per q and per device are configured.

Quoted 7 lines
Quoted 1 line

Virtqueue level notifications coalescing, and device level notifications can be

enabled together.

Quoted 1 line

When both of them are enabled, per virtqueue notifications coalescing take

priority over queue group level.

How do you enable Virtqueue level notifications coalescing? Why are they different entities?

Using the new command that has vqn in it.

Quoted 3 lines

I don't think that we should have priorities, but the last command should be the one that dictates the coalescing parameters.

Priority is applicable when driver has issued both the commands. Per tx/rx, and per vqn.

Quoted 7 lines

For example, let's look at vq0 (RX):
Device receives VIRTIO_NET_CTRL_NOTF_COAL_RX_SET, vq0 should change the parameters accordingly (all RX vqs should do the same).
Then device receives VIRTIO_NET_CTRL_NOTF_COAL_VQ_SET with vqn = 0, vq0 changes the parameters accordingly (all RX vqs are still using the "old" parameters) Then device receives VIRTIO_NET_CTRL_NOTF_COAL_RX_SET, vq0 changes the parameters accordingly (all RX vqs should do the same).

In this example, per VQ were overridden with per device. Yes, so the last one is applicable, so priority of last one applies.

We continue to refuse to add the mode, and hence need to supply these description of both the sequence on how device should behave.

Sequence_1:
1. tx/rx group level
2. per vqn level
When #2 is done, VQ's whose per vq level is configured, follows vqn, rest of the VQs follow #1.

Sequence_2:
1. per vqn
2. tx/rx group level
When #2 is done, group level overrides the per vqn parameters.

#34 lore raw
Quoted 65 lines · Parav Pandit
Quoted 8 lines

From: Alvaro Karsz <[email protected]>
Sent: Saturday, February 11, 2023 3:45 AM

Quoted 3 lines

Please add short description something like,

When the driver prefers to use per virtqueue notifications coalescing, and if

Quoted 8 lines

queue group (transmit or receive) level notification coalescing is enabled, driver SHOULD first disable device level notification coalescing.

Quoted 2 lines

Or it should be,

I disagree here.
IMO "queue group level notification coalescing" is not something to enable or disable, but a shortcut to set all TX/RX queues at once.

That short cut is the enable/disablement.

Quoted 3 lines

Why should the spec force a driver to "disable device level notification coalescing" (I assume you mean send a VIRTIO_NET_CTRL_NOTF_COAL_[T/R]X_SET command with zeros)?

Yes. Because to have well defined behavior when sw configured both one after the another.

Quoted 3 lines

What if the driver sends a VIRTIO_NET_CTRL_NOTF_COAL_[T/R]X_SET command, and then a single queue traffic increases? why should it zero the parameters to all other queues?

That is short transition when driver is switching over to per queue mode. This is fine to have short glitch.

Quoted 3 lines

I think that this should be discussed in the driver implementation stage, not in the spec.

There should be a clear guidance on how device should behave when both per q and per device are configured.

Quoted 7 lines
Quoted 1 line

Virtqueue level notifications coalescing, and device level notifications can be

enabled together.

Quoted 1 line

When both of them are enabled, per virtqueue notifications coalescing take

priority over queue group level.

How do you enable Virtqueue level notifications coalescing? Why are they different entities?

Using the new command that has vqn in it.

Quoted 3 lines

I don't think that we should have priorities, but the last command should be the one that dictates the coalescing parameters.

Priority is applicable when driver has issued both the commands. Per tx/rx, and per vqn.

Quoted 7 lines

For example, let's look at vq0 (RX):
Device receives VIRTIO_NET_CTRL_NOTF_COAL_RX_SET, vq0 should change the parameters accordingly (all RX vqs should do the same).
Then device receives VIRTIO_NET_CTRL_NOTF_COAL_VQ_SET with vqn = 0, vq0 changes the parameters accordingly (all RX vqs are still using the "old" parameters) Then device receives VIRTIO_NET_CTRL_NOTF_COAL_RX_SET, vq0 changes the parameters accordingly (all RX vqs should do the same).

In this example, per VQ were overridden with per device. Yes, so the last one is applicable, so priority of last one applies.

We continue to refuse to add the mode, and hence need to supply these description of both the sequence on how device should behave.

Sequence_1:
1. tx/rx group level
2. per vqn level
When #2 is done, VQ's whose per vq level is configured, follows vqn, rest of the VQs follow #1.

Quoted 4 lines

Sequence_2:
1. per vqn
2. tx/rx group level
When #2 is done, group level overrides the per vqn parameters.

Since there's apparently some room for misunderstanding, I think adding these examples can't hurt. I would also be more specific and just use specific numbers in the
example, to avoid any ambiguity.

Signature · 18 lines
MST


This publicly archived list offers a means to provide input to the
OASIS Virtual I/O Device (VIRTIO) TC.

In order to verify user consent to the Feedback License terms and
to minimize spam in the list archive, subscription is required
before posting.

Subscribe: [email protected]
Unsubscribe: [email protected]
List help: [email protected]
List archive: https://lists.oasis-open.org/archives/virtio-comment/
Feedback License: https://www.oasis-open.org/who/ipr/feedback_license.pdf
List Guidelines: https://www.oasis-open.org/policies-guidelines/mailing-lists
Committee: https://www.oasis-open.org/committees/virtio/
Join OASIS: https://www.oasis-open.org/join/
author
#35 lore raw
Quoted 66 lines · Michael S. Tsirkin
Quoted 65 lines · Parav Pandit
Quoted 8 lines

From: Alvaro Karsz <[email protected]>
Sent: Saturday, February 11, 2023 3:45 AM

Quoted 3 lines

Please add short description something like,

When the driver prefers to use per virtqueue notifications coalescing, and if

Quoted 8 lines

queue group (transmit or receive) level notification coalescing is enabled, driver SHOULD first disable device level notification coalescing.

Quoted 2 lines

Or it should be,

I disagree here.
IMO "queue group level notification coalescing" is not something to enable or disable, but a shortcut to set all TX/RX queues at once.

That short cut is the enable/disablement.

Quoted 3 lines

Why should the spec force a driver to "disable device level notification coalescing" (I assume you mean send a VIRTIO_NET_CTRL_NOTF_COAL_[T/R]X_SET command with zeros)?

Yes. Because to have well defined behavior when sw configured both one after the another.

Quoted 3 lines

What if the driver sends a VIRTIO_NET_CTRL_NOTF_COAL_[T/R]X_SET command, and then a single queue traffic increases? why should it zero the parameters to all other queues?

That is short transition when driver is switching over to per queue mode. This is fine to have short glitch.

Quoted 3 lines

I think that this should be discussed in the driver implementation stage, not in the spec.

There should be a clear guidance on how device should behave when both per q and per device are configured.

Quoted 7 lines
Quoted 1 line

Virtqueue level notifications coalescing, and device level notifications can be

enabled together.

Quoted 1 line

When both of them are enabled, per virtqueue notifications coalescing take

priority over queue group level.

How do you enable Virtqueue level notifications coalescing? Why are they different entities?

Using the new command that has vqn in it.

Quoted 3 lines

I don't think that we should have priorities, but the last command should be the one that dictates the coalescing parameters.

Priority is applicable when driver has issued both the commands. Per tx/rx, and per vqn.

Quoted 7 lines

For example, let's look at vq0 (RX):
Device receives VIRTIO_NET_CTRL_NOTF_COAL_RX_SET, vq0 should change the parameters accordingly (all RX vqs should do the same).
Then device receives VIRTIO_NET_CTRL_NOTF_COAL_VQ_SET with vqn = 0, vq0 changes the parameters accordingly (all RX vqs are still using the "old" parameters) Then device receives VIRTIO_NET_CTRL_NOTF_COAL_RX_SET, vq0 changes the parameters accordingly (all RX vqs should do the same).

In this example, per VQ were overridden with per device. Yes, so the last one is applicable, so priority of last one applies.

We continue to refuse to add the mode, and hence need to supply these description of both the sequence on how device should behave.

Sequence_1:
1. tx/rx group level
2. per vqn level
When #2 is done, VQ's whose per vq level is configured, follows vqn, rest of the VQs follow #1.

Quoted 6 lines
Quoted 4 lines

Sequence_2:
1. per vqn
2. tx/rx group level
When #2 is done, group level overrides the per vqn parameters.

Since there's apparently some room for misunderstanding, I think adding these examples can't hurt.

Ok, I'll handle this.

Quoted 2 lines

I would also be more specific and just use specific numbers in the example, to avoid any ambiguity.

Agree.

Thanks.

Quoted 3 lines
Signature · 2 lines
-- 
MST

This publicly archived list offers a means to provide input to the OASIS Virtual I/O Device (VIRTIO) TC.

In order to verify user consent to the Feedback License terms and to minimize spam in the list archive, subscription is required before posting.

Subscribe: [email protected]
Unsubscribe: [email protected]
List help: [email protected]
List archive: https://lists.oasis-open.org/archives/virtio-comment/
Feedback License: https://www.oasis-open.org/who/ipr/feedback_license.pdf
List Guidelines: https://www.oasis-open.org/policies-guidelines/mailing-lists
Committee: https://www.oasis-open.org/committees/virtio/
Join OASIS: https://www.oasis-open.org/join/

author
#36 lore raw
In reply to Parav Pandit
Quoted 65 lines · Parav Pandit
Quoted 8 lines

From: Alvaro Karsz <[email protected]>
Sent: Saturday, February 11, 2023 3:45 AM

Quoted 3 lines

Please add short description something like,

When the driver prefers to use per virtqueue notifications coalescing, and if

Quoted 8 lines

queue group (transmit or receive) level notification coalescing is enabled, driver SHOULD first disable device level notification coalescing.

Quoted 2 lines

Or it should be,

I disagree here.
IMO "queue group level notification coalescing" is not something to enable or disable, but a shortcut to set all TX/RX queues at once.

That short cut is the enable/disablement.

Quoted 3 lines

Why should the spec force a driver to "disable device level notification coalescing" (I assume you mean send a VIRTIO_NET_CTRL_NOTF_COAL_[T/R]X_SET command with zeros)?

Yes. Because to have well defined behavior when sw configured both one after the another.

Quoted 3 lines

What if the driver sends a VIRTIO_NET_CTRL_NOTF_COAL_[T/R]X_SET command, and then a single queue traffic increases? why should it zero the parameters to all other queues?

That is short transition when driver is switching over to per queue mode. This is fine to have short glitch.

Quoted 3 lines

I think that this should be discussed in the driver implementation stage, not in the spec.

There should be a clear guidance on how device should behave when both per q and per device are configured.

Quoted 7 lines
Quoted 1 line

Virtqueue level notifications coalescing, and device level notifications can be

enabled together.

Quoted 1 line

When both of them are enabled, per virtqueue notifications coalescing take

priority over queue group level.

How do you enable Virtqueue level notifications coalescing? Why are they different entities?

Using the new command that has vqn in it.

Quoted 3 lines

I don't think that we should have priorities, but the last command should be the one that dictates the coalescing parameters.

Priority is applicable when driver has issued both the commands. Per tx/rx, and per vqn.

Quoted 7 lines

For example, let's look at vq0 (RX):
Device receives VIRTIO_NET_CTRL_NOTF_COAL_RX_SET, vq0 should change the parameters accordingly (all RX vqs should do the same).
Then device receives VIRTIO_NET_CTRL_NOTF_COAL_VQ_SET with vqn = 0, vq0 changes the parameters accordingly (all RX vqs are still using the "old" parameters) Then device receives VIRTIO_NET_CTRL_NOTF_COAL_RX_SET, vq0 changes the parameters accordingly (all RX vqs should do the same).

In this example, per VQ were overridden with per device. Yes, so the last one is applicable, so priority of last one applies.

We continue to refuse to add the mode, and hence need to supply these description of both the sequence on how device should behave.

Sequence_1:
1. tx/rx group level
2. per vqn level
When #2 is done, VQ's whose per vq level is configured, follows vqn, rest of the VQs follow #1.

Quoted 4 lines

Sequence_2:
1. per vqn
2. tx/rx group level
When #2 is done, group level overrides the per vqn parameters.

Adding examples of the two command sequences is due, I will do so in the next release. :)

Thanks.

This publicly archived list offers a means to provide input to the OASIS Virtual I/O Device (VIRTIO) TC.

In order to verify user consent to the Feedback License terms and to minimize spam in the list archive, subscription is required before posting.

Subscribe: [email protected]
Unsubscribe: [email protected]
List help: [email protected]
List archive: https://lists.oasis-open.org/archives/virtio-comment/
Feedback License: https://www.oasis-open.org/who/ipr/feedback_license.pdf
List Guidelines: https://www.oasis-open.org/policies-guidelines/mailing-lists
Committee: https://www.oasis-open.org/committees/virtio/
Join OASIS: https://www.oasis-open.org/join/

#37 lore raw
In reply to Parav Pandit
Quoted 19 lines · Parav Pandit
Quoted 6 lines

From: Heng Qi <[email protected]>
Sent: Friday, February 10, 2023 2:02 AM

Currently, the coalescing profile is directly applied to all queues.

Say it,
Currently coalescing parameters are grouped for all transmit and receive virtqueues.

Quoted 2 lines

This patch supports setting or getting the parameters for a specified queue, and a typical application of this function is NetDIM.

Many of us know the net dim.
But if you prefer to mention it here, better to have the link for it.

Please add pointer to it.
[1] https://docs.kernel.org/networking/net_dim.html

Quoted 1 line
Quoted 8 lines

Review

Quoted 7 lines

When the traffic between queues is unbalanced, for example, one queue is busy and another queue is idle, then it will be very useful to control coalescing parameters at the queue granularity.

(quoted diff) +2 -0
+If additionally VIRTIO_NET_F_VQ_NOTF_COAL is negotiated, the driver can
+send control commands to set or get the coalescing parameters of a

Control command singular?

why? driver can send any number of commands e.g. to different vqs.

Quoted 35 lines

content.tex \subsubsection{Control Virtqueue}\label{sec:Device Types / Network Device / Devi · line 4537

Quoted 9 lines
content.tex +9 -0
+specified virtqueue (excluding the control virtqueue).
+
+\begin{lstlisting}
+struct virtio_net_ctrl_coal_vq {
+    le32 max_packets;
+    le32 usecs;
+    le16 vqn;
+};
+

Change that Michael suggest restructuring and under same class looks good to me.

Quoted 8 lines
content.tex +7 -0
+#define VIRTIO_NET_CTRL_NOTF_COAL_VQ 7
+ #define VIRTIO_NET_CTRL_NOTF_COAL_VQ_SET 0  #define
+VIRTIO_NET_CTRL_NOTF_COAL_VQ_GET 1 \end{lstlisting}
+
+Virtqueue coalescing parameters:
+\begin{itemize}
+\item \field{max_packets}: The maximum number of packets sent/received by

the

content.tex \subsubsection{Control Virtqueue}\label{sec:Device Types / Network Device / Devi · line 4551

Quoted 6 lines
content.tex +6 -0
+    specified virtqueue before a TX/RX notification.
+\item \field{usecs}: The maximum number of TX/RX usecs that the specified
+    virtqueue delays a TX/RX notification.
+\item \field{vqn}: The virtqueue number of the specified virtqueue.
+\end{itemize}
+

The virtqueue number of the enabled transmit or receive virtuqueue. This will simplify below description.

Review

Quoted 4 lines
(quoted diff) +4 -0
+The range of \filed{vqn} is between 0 and 0xFFFF inclusive, $ \lfloor
+vqn / 2 \rfloor $ is the index of the corresponding receiveq, and
+$\lfloor (vqn / 2) + 1 \rfloor $ is the corresponding tranmitq.
+

Please add short description something like,

Quoted 5 lines

When the driver prefers to use per virtqueue notifications coalescing, and if queue group (transmit or receive) level notification coalescing is enabled, driver SHOULD first disable device level notification coalescing. Or it should be,

Virtqueue level notifications coalescing, and device level notifications can be enabled together. When both of them are enabled, per virtqueue notifications coalescing take priority over queue group level.

Note that neither of these reflects what I proposed.
I proposed explaining that VIRTIO_NET_CTRL_NOTF_COAL_TX_SET and VIRTIO_NET_CTRL_NOTF_COAL_RX_SET have the same effect as repeatedly calling VIRTIO_NET_CTRL_NOTF_COAL_VQ_SET for all TX/RX vqs.

Quoted 1 line

With rests of the comments from Michael and Alvaro in progress, looks good.

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]

author
#38 lore raw
Quoted 25 lines · Michael S. Tsirkin
Quoted 24 lines · Parav Pandit
Quoted 6 lines

From: Heng Qi <[email protected]>
Sent: Friday, February 10, 2023 2:02 AM

Currently, the coalescing profile is directly applied to all queues.

Say it,
Currently coalescing parameters are grouped for all transmit and receive virtqueues.

Quoted 2 lines

This patch supports setting or getting the parameters for a specified queue, and a typical application of this function is NetDIM.

Many of us know the net dim.
But if you prefer to mention it here, better to have the link for it.

Please add pointer to it.
[1] https://docs.kernel.org/networking/net_dim.html

Quoted 6 lines

When the traffic between queues is unbalanced, for example, one queue is busy and another queue is idle, then it will be very useful to control coalescing parameters at the queue granularity.

Quoted 5 lines
Quoted 3 lines

Review

Quoted 2 lines
(quoted diff) +2 -0
+If additionally VIRTIO_NET_F_VQ_NOTF_COAL is negotiated, the driver can
+send control commands to set or get the coalescing parameters of a

Control command singular?

why? driver can send any number of commands e.g. to different vqs.

I think Parav pointed out a syntax error on my part.

a singular command --> a specified virtqueue.

Thanks.

Quoted 57 lines
Quoted 36 lines

content.tex \subsubsection{Control Virtqueue}\label{sec:Device Types / Network Device / Devi · line 4537

Quoted 10 lines
content.tex +9 -0
+specified virtqueue (excluding the control virtqueue).
+
+\begin{lstlisting}
+struct virtio_net_ctrl_coal_vq {
+    le32 max_packets;
+    le32 usecs;
+    le16 vqn;
+};
+

Change that Michael suggest restructuring and under same class looks good to me.

Quoted 8 lines
content.tex +7 -0
+#define VIRTIO_NET_CTRL_NOTF_COAL_VQ 7
+ #define VIRTIO_NET_CTRL_NOTF_COAL_VQ_SET 0  #define
+VIRTIO_NET_CTRL_NOTF_COAL_VQ_GET 1 \end{lstlisting}
+
+Virtqueue coalescing parameters:
+\begin{itemize}
+\item \field{max_packets}: The maximum number of packets sent/received by

the

content.tex \subsubsection{Control Virtqueue}\label{sec:Device Types / Network Device / Devi · line 4551

Quoted 6 lines
content.tex +6 -0
+    specified virtqueue before a TX/RX notification.
+\item \field{usecs}: The maximum number of TX/RX usecs that the specified
+    virtqueue delays a TX/RX notification.
+\item \field{vqn}: The virtqueue number of the specified virtqueue.
+\end{itemize}
+

The virtqueue number of the enabled transmit or receive virtuqueue. This will simplify below description.

Review

Quoted 4 lines
(quoted diff) +4 -0
+The range of \filed{vqn} is between 0 and 0xFFFF inclusive, $ \lfloor
+vqn / 2 \rfloor $ is the index of the corresponding receiveq, and
+$\lfloor (vqn / 2) + 1 \rfloor $ is the corresponding tranmitq.
+

Please add short description something like,

Quoted 5 lines

When the driver prefers to use per virtqueue notifications coalescing, and if queue group (transmit or receive) level notification coalescing is enabled, driver SHOULD first disable device level notification coalescing. Or it should be,

Virtqueue level notifications coalescing, and device level notifications can be enabled together. When both of them are enabled, per virtqueue notifications coalescing take priority over queue group level.

Note that neither of these reflects what I proposed.
I proposed explaining that VIRTIO_NET_CTRL_NOTF_COAL_TX_SET and VIRTIO_NET_CTRL_NOTF_COAL_RX_SET have the same effect as repeatedly calling VIRTIO_NET_CTRL_NOTF_COAL_VQ_SET for all TX/RX vqs.

Quoted 1 line

With rests of the comments from Michael and Alvaro in progress, looks good.

This publicly archived list offers a means to provide input to the OASIS Virtual I/O Device (VIRTIO) TC.

In order to verify user consent to the Feedback License terms and to minimize spam in the list archive, subscription is required before posting.

Quoted 8 lines

Subscribe: [email protected]
Unsubscribe: [email protected]
List help: [email protected]
List archive: https://lists.oasis-open.org/archives/virtio-comment/
Feedback License: https://www.oasis-open.org/who/ipr/feedback_license.pdf
List Guidelines: https://www.oasis-open.org/policies-guidelines/mailing-lists
Committee: https://www.oasis-open.org/committees/virtio/
Join OASIS: https://www.oasis-open.org/join/

This publicly archived list offers a means to provide input to the OASIS Virtual I/O Device (VIRTIO) TC.

In order to verify user consent to the Feedback License terms and to minimize spam in the list archive, subscription is required before posting.

Subscribe: [email protected]
Unsubscribe: [email protected]
List help: [email protected]
List archive: https://lists.oasis-open.org/archives/virtio-comment/
Feedback License: https://www.oasis-open.org/who/ipr/feedback_license.pdf
List Guidelines: https://www.oasis-open.org/policies-guidelines/mailing-lists
Committee: https://www.oasis-open.org/committees/virtio/
Join OASIS: https://www.oasis-open.org/join/