All of lore.kernel.org
 help / color / mirror / Atom feed
* [virtio-comment] [PATCH] Introduction of Virtio Network device interrupt coalescing feature
@ 2022-05-12  8:07 Alvaro Karsz
  2022-05-12 11:04 ` Xuan Zhuo
  2022-05-16  8:58 ` Stefan Hajnoczi
  0 siblings, 2 replies; 7+ messages in thread
From: Alvaro Karsz @ 2022-05-12  8:07 UTC (permalink / raw)
  To: virtio-comment; +Cc: Alvaro Karsz

Control a network device interrupt coalescing parameters using the control virtqueue.
A new control class was added: VIRTIO_NET_CTRL_INTR_COAL.

This class provides 2 commands:
- VIRTIO_NET_CTRL_INTR_COAL_USECS_SET:
  Ask the network device to change the rx-usecs and tx-usecs parameters.
  rx-usecs - Time to delay an RX interrupt after packet arrival in microseconds.
  tx-usecs - Time to delay a TX interrupt after a sending a packet in microseconds.

- VIRTIO_NET_CTRL_INTR_COAL_FRAMES_SET:
  Ask the network device to change the rx-max-frames and tx-max-frames parameters.
  rx-max-frames - Number of packets to delay an RX interrupt after packet arrival.
  tx-max-frames - Number of packets to delay a TX interrupt after sending a packet.


Signed-off-by: Alvaro Karsz <alvaro.karsz@solid-run.com>
---
 content.tex | 41 +++++++++++++++++++++++++++++++++++++++++
 1 file changed, 41 insertions(+)

diff --git a/content.tex b/content.tex
index 7508dd1..a70cb27 100644
--- a/content.tex
+++ b/content.tex
@@ -3084,6 +3084,8 @@ \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_INTR_COAL(55)] Device supports interrupt coalescing.
+
 \item[VIRTIO_NET_F_HOST_USO (56)] Device can receive USO packets. Unlike UFO
  (fragmenting the packet) the USO splits large UDP packet
  to several segments when each of these smaller packets has UDP header.
@@ -3129,6 +3131,7 @@ \subsubsection{Feature bit requirements}\label{sec:Device Types / Network Device
 \item[VIRTIO_NET_F_GUEST_ANNOUNCE] Requires VIRTIO_NET_F_CTRL_VQ.
 \item[VIRTIO_NET_F_MQ] Requires VIRTIO_NET_F_CTRL_VQ.
 \item[VIRTIO_NET_F_CTRL_MAC_ADDR] Requires VIRTIO_NET_F_CTRL_VQ.
+\item[VIRTIO_NET_F_INTR_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.
 \end{description}
@@ -4464,6 +4467,44 @@ \subsubsection{Control Virtqueue}\label{sec:Device Types / Network Device / Devi
 (necessarily when not using the legacy interface) little-endian.


+\paragraph{Interrupt Coalescing}\label{sec:Device Types / Network Device / Device Operation / Control Virtqueue / Interrupt Coalescing}
+
+If the VIRTIO_NET_F_INTR_COAL feature is negotiated, the driver can
+send control commands for dynamically changing the coalescing parameters.
+
+\begin{lstlisting}
+struct virtio_net_ctrl_coal_usec {
+    le32 tx_usecs;
+    le32 rx_usecs;
+};
+
+struct virtio_net_ctrl_coal_frames {
+    le32 tx_frames_max;
+    le32 rx_frames_max;
+};
+
+#define VIRTIO_NET_CTRL_INTR_COAL 6
+ #define VIRTIO_NET_CTRL_INTR_COAL_USECS_SET  0
+ #define VIRTIO_NET_CTRL_INTR_COAL_FRAMES_SET 1
+\end{lstlisting}
+
+The class VIRTIO_NET_CTRL_INTR_COAL has 2 commands:
+\begin{itemize}
+\item VIRTIO_NET_CTRL_INTR_COAL_USECS_SET: set the rx-usecs (time to delay an RX interrupt after packet arrival in microseconds) and tx-usecs (time to delay a TX interrupt after a sending a packet in microseconds) parameters.
+\item VIRTIO_NET_CTRL_INTR_COAL_FRAMES_SET: set the rx-max-frames (number of packets to delay an RX interrupt after packet arrival) and tx-max-frames (number of packets to delay a TX interrupt after sending a packet) parameters.
+\end{itemize}
+
+\drivernormative{\subparagraph}{Interrupt Coalescing}{Device Types / Network Device / Device Operation / Control Virtqueue / Interrupt Coalescing}
+
+
+A driver MUST NOT send to the device VIRTIO_NET_CTRL_INTR_COAL commands if the VIRTIO_NET_F_INTR_COAL feature
+has not been negotiated.
+
+\devicenormative{\subparagraph}{Interrupt Coalescing}{Device Types / Network Device / Device Operation / Control Virtqueue / Interrupt Coalescing}
+
+A device SHOULD respond to the VIRTIO_NET_CTRL_INTR_COAL commands with VIRTIO_NET_ERR if was not able to change the parameters.
+
+
 \subsubsection{Legacy Interface: Framing Requirements}\label{sec:Device
 Types / Network Device / Legacy Interface: Framing Requirements}

--
2.32.0

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: virtio-comment-subscribe@lists.oasis-open.org
Unsubscribe: virtio-comment-unsubscribe@lists.oasis-open.org
List help: virtio-comment-help@lists.oasis-open.org
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/


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [virtio-comment] [PATCH] Introduction of Virtio Network device interrupt coalescing feature
  2022-05-12  8:07 [virtio-comment] [PATCH] Introduction of Virtio Network device interrupt coalescing feature Alvaro Karsz
@ 2022-05-12 11:04 ` Xuan Zhuo
  2022-05-12 11:19   ` Alvaro Karsz
  2022-05-16  8:58 ` Stefan Hajnoczi
  1 sibling, 1 reply; 7+ messages in thread
From: Xuan Zhuo @ 2022-05-12 11:04 UTC (permalink / raw)
  To: Alvaro Karsz; +Cc: Alvaro Karsz, virtio-comment

On Thu, 12 May 2022 11:07:39 +0300, Alvaro Karsz <alvaro.karsz@solid-run.com> wrote:
> Control a network device interrupt coalescing parameters using the control virtqueue.
> A new control class was added: VIRTIO_NET_CTRL_INTR_COAL.
>
> This class provides 2 commands:
> - VIRTIO_NET_CTRL_INTR_COAL_USECS_SET:
>   Ask the network device to change the rx-usecs and tx-usecs parameters.
>   rx-usecs - Time to delay an RX interrupt after packet arrival in microseconds.
>   tx-usecs - Time to delay a TX interrupt after a sending a packet in microseconds.
>
> - VIRTIO_NET_CTRL_INTR_COAL_FRAMES_SET:
>   Ask the network device to change the rx-max-frames and tx-max-frames parameters.
>   rx-max-frames - Number of packets to delay an RX interrupt after packet arrival.
>   tx-max-frames - Number of packets to delay a TX interrupt after sending a packet.
>

I would like to know what scenarios this function can be used in, what problems
can be solved or what benefits can be obtained?

Thanks.

>
> Signed-off-by: Alvaro Karsz <alvaro.karsz@solid-run.com>
> ---
>  content.tex | 41 +++++++++++++++++++++++++++++++++++++++++
>  1 file changed, 41 insertions(+)
>
> diff --git a/content.tex b/content.tex
> index 7508dd1..a70cb27 100644
> --- a/content.tex
> +++ b/content.tex
> @@ -3084,6 +3084,8 @@ \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_INTR_COAL(55)] Device supports interrupt coalescing.
> +
>  \item[VIRTIO_NET_F_HOST_USO (56)] Device can receive USO packets. Unlike UFO
>   (fragmenting the packet) the USO splits large UDP packet
>   to several segments when each of these smaller packets has UDP header.
> @@ -3129,6 +3131,7 @@ \subsubsection{Feature bit requirements}\label{sec:Device Types / Network Device
>  \item[VIRTIO_NET_F_GUEST_ANNOUNCE] Requires VIRTIO_NET_F_CTRL_VQ.
>  \item[VIRTIO_NET_F_MQ] Requires VIRTIO_NET_F_CTRL_VQ.
>  \item[VIRTIO_NET_F_CTRL_MAC_ADDR] Requires VIRTIO_NET_F_CTRL_VQ.
> +\item[VIRTIO_NET_F_INTR_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.
>  \end{description}
> @@ -4464,6 +4467,44 @@ \subsubsection{Control Virtqueue}\label{sec:Device Types / Network Device / Devi
>  (necessarily when not using the legacy interface) little-endian.
>
>
> +\paragraph{Interrupt Coalescing}\label{sec:Device Types / Network Device / Device Operation / Control Virtqueue / Interrupt Coalescing}
> +
> +If the VIRTIO_NET_F_INTR_COAL feature is negotiated, the driver can
> +send control commands for dynamically changing the coalescing parameters.
> +
> +\begin{lstlisting}
> +struct virtio_net_ctrl_coal_usec {
> +    le32 tx_usecs;
> +    le32 rx_usecs;
> +};
> +
> +struct virtio_net_ctrl_coal_frames {
> +    le32 tx_frames_max;
> +    le32 rx_frames_max;
> +};
> +
> +#define VIRTIO_NET_CTRL_INTR_COAL 6
> + #define VIRTIO_NET_CTRL_INTR_COAL_USECS_SET  0
> + #define VIRTIO_NET_CTRL_INTR_COAL_FRAMES_SET 1
> +\end{lstlisting}
> +
> +The class VIRTIO_NET_CTRL_INTR_COAL has 2 commands:
> +\begin{itemize}
> +\item VIRTIO_NET_CTRL_INTR_COAL_USECS_SET: set the rx-usecs (time to delay an RX interrupt after packet arrival in microseconds) and tx-usecs (time to delay a TX interrupt after a sending a packet in microseconds) parameters.
> +\item VIRTIO_NET_CTRL_INTR_COAL_FRAMES_SET: set the rx-max-frames (number of packets to delay an RX interrupt after packet arrival) and tx-max-frames (number of packets to delay a TX interrupt after sending a packet) parameters.
> +\end{itemize}
> +
> +\drivernormative{\subparagraph}{Interrupt Coalescing}{Device Types / Network Device / Device Operation / Control Virtqueue / Interrupt Coalescing}
> +
> +
> +A driver MUST NOT send to the device VIRTIO_NET_CTRL_INTR_COAL commands if the VIRTIO_NET_F_INTR_COAL feature
> +has not been negotiated.
> +
> +\devicenormative{\subparagraph}{Interrupt Coalescing}{Device Types / Network Device / Device Operation / Control Virtqueue / Interrupt Coalescing}
> +
> +A device SHOULD respond to the VIRTIO_NET_CTRL_INTR_COAL commands with VIRTIO_NET_ERR if was not able to change the parameters.
> +
> +
>  \subsubsection{Legacy Interface: Framing Requirements}\label{sec:Device
>  Types / Network Device / Legacy Interface: Framing Requirements}
>
> --
> 2.32.0
>
> 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: virtio-comment-subscribe@lists.oasis-open.org
> Unsubscribe: virtio-comment-unsubscribe@lists.oasis-open.org
> List help: virtio-comment-help@lists.oasis-open.org
> 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: virtio-comment-subscribe@lists.oasis-open.org
Unsubscribe: virtio-comment-unsubscribe@lists.oasis-open.org
List help: virtio-comment-help@lists.oasis-open.org
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/


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [virtio-comment] [PATCH] Introduction of Virtio Network device interrupt coalescing feature
  2022-05-12 11:04 ` Xuan Zhuo
@ 2022-05-12 11:19   ` Alvaro Karsz
  2022-05-15 14:53     ` Alvaro Karsz
  0 siblings, 1 reply; 7+ messages in thread
From: Alvaro Karsz @ 2022-05-12 11:19 UTC (permalink / raw)
  To: Xuan Zhuo; +Cc: virtio-comment

[-- Attachment #1: Type: text/plain, Size: 6324 bytes --]

Hi,

I would like to know what scenarios this function can be used in, what
> problems
> can be solved or what benefits can be obtained?


One example is using ethtool command to configure these parameters on a
VirtIO network compatible device.
You could use the following command on the host to adjust the interrupt
coalescing parameters:

 $ ethtool -C <interface> tx-usecs X  rx-usecs Y  tx-frames Z  rx-frames W

I'm working on a Network compatible device which can coalesce interrupts,
but there is no interface to adjust the usecs and frames parameters.
Having this command would give an interface to change these parameters on
runtime.



On Thu, May 12, 2022 at 2:06 PM Xuan Zhuo <xuanzhuo@linux.alibaba.com>
wrote:

> On Thu, 12 May 2022 11:07:39 +0300, Alvaro Karsz <
> alvaro.karsz@solid-run.com> wrote:
> > Control a network device interrupt coalescing parameters using the
> control virtqueue.
> > A new control class was added: VIRTIO_NET_CTRL_INTR_COAL.
> >
> > This class provides 2 commands:
> > - VIRTIO_NET_CTRL_INTR_COAL_USECS_SET:
> >   Ask the network device to change the rx-usecs and tx-usecs parameters.
> >   rx-usecs - Time to delay an RX interrupt after packet arrival in
> microseconds.
> >   tx-usecs - Time to delay a TX interrupt after a sending a packet in
> microseconds.
> >
> > - VIRTIO_NET_CTRL_INTR_COAL_FRAMES_SET:
> >   Ask the network device to change the rx-max-frames and tx-max-frames
> parameters.
> >   rx-max-frames - Number of packets to delay an RX interrupt after
> packet arrival.
> >   tx-max-frames - Number of packets to delay a TX interrupt after
> sending a packet.
> >
>
> I would like to know what scenarios this function can be used in, what
> problems
> can be solved or what benefits can be obtained?
>
> Thanks.
>
> >
> > Signed-off-by: Alvaro Karsz <alvaro.karsz@solid-run.com>
> > ---
> >  content.tex | 41 +++++++++++++++++++++++++++++++++++++++++
> >  1 file changed, 41 insertions(+)
> >
> > diff --git a/content.tex b/content.tex
> > index 7508dd1..a70cb27 100644
> > --- a/content.tex
> > +++ b/content.tex
> > @@ -3084,6 +3084,8 @@ \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_INTR_COAL(55)] Device supports interrupt coalescing.
> > +
> >  \item[VIRTIO_NET_F_HOST_USO (56)] Device can receive USO packets.
> Unlike UFO
> >   (fragmenting the packet) the USO splits large UDP packet
> >   to several segments when each of these smaller packets has UDP header.
> > @@ -3129,6 +3131,7 @@ \subsubsection{Feature bit
> requirements}\label{sec:Device Types / Network Device
> >  \item[VIRTIO_NET_F_GUEST_ANNOUNCE] Requires VIRTIO_NET_F_CTRL_VQ.
> >  \item[VIRTIO_NET_F_MQ] Requires VIRTIO_NET_F_CTRL_VQ.
> >  \item[VIRTIO_NET_F_CTRL_MAC_ADDR] Requires VIRTIO_NET_F_CTRL_VQ.
> > +\item[VIRTIO_NET_F_INTR_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.
> >  \end{description}
> > @@ -4464,6 +4467,44 @@ \subsubsection{Control
> Virtqueue}\label{sec:Device Types / Network Device / Devi
> >  (necessarily when not using the legacy interface) little-endian.
> >
> >
> > +\paragraph{Interrupt Coalescing}\label{sec:Device Types / Network
> Device / Device Operation / Control Virtqueue / Interrupt Coalescing}
> > +
> > +If the VIRTIO_NET_F_INTR_COAL feature is negotiated, the driver can
> > +send control commands for dynamically changing the coalescing
> parameters.
> > +
> > +\begin{lstlisting}
> > +struct virtio_net_ctrl_coal_usec {
> > +    le32 tx_usecs;
> > +    le32 rx_usecs;
> > +};
> > +
> > +struct virtio_net_ctrl_coal_frames {
> > +    le32 tx_frames_max;
> > +    le32 rx_frames_max;
> > +};
> > +
> > +#define VIRTIO_NET_CTRL_INTR_COAL 6
> > + #define VIRTIO_NET_CTRL_INTR_COAL_USECS_SET  0
> > + #define VIRTIO_NET_CTRL_INTR_COAL_FRAMES_SET 1
> > +\end{lstlisting}
> > +
> > +The class VIRTIO_NET_CTRL_INTR_COAL has 2 commands:
> > +\begin{itemize}
> > +\item VIRTIO_NET_CTRL_INTR_COAL_USECS_SET: set the rx-usecs (time to
> delay an RX interrupt after packet arrival in microseconds) and tx-usecs
> (time to delay a TX interrupt after a sending a packet in microseconds)
> parameters.
> > +\item VIRTIO_NET_CTRL_INTR_COAL_FRAMES_SET: set the rx-max-frames
> (number of packets to delay an RX interrupt after packet arrival) and
> tx-max-frames (number of packets to delay a TX interrupt after sending a
> packet) parameters.
> > +\end{itemize}
> > +
> > +\drivernormative{\subparagraph}{Interrupt Coalescing}{Device Types /
> Network Device / Device Operation / Control Virtqueue / Interrupt
> Coalescing}
> > +
> > +
> > +A driver MUST NOT send to the device VIRTIO_NET_CTRL_INTR_COAL commands
> if the VIRTIO_NET_F_INTR_COAL feature
> > +has not been negotiated.
> > +
> > +\devicenormative{\subparagraph}{Interrupt Coalescing}{Device Types /
> Network Device / Device Operation / Control Virtqueue / Interrupt
> Coalescing}
> > +
> > +A device SHOULD respond to the VIRTIO_NET_CTRL_INTR_COAL commands with
> VIRTIO_NET_ERR if was not able to change the parameters.
> > +
> > +
> >  \subsubsection{Legacy Interface: Framing Requirements}\label{sec:Device
> >  Types / Network Device / Legacy Interface: Framing Requirements}
> >
> > --
> > 2.32.0
> >
> > 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: virtio-comment-subscribe@lists.oasis-open.org
> > Unsubscribe: virtio-comment-unsubscribe@lists.oasis-open.org
> > List help: virtio-comment-help@lists.oasis-open.org
> > 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/
> >
>


-- 


*Alvaro Karsz, *Software
+972-50-7696862| https://www.solid-run.com

[-- Attachment #2: Type: text/html, Size: 9185 bytes --]

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [virtio-comment] [PATCH] Introduction of Virtio Network device interrupt coalescing feature
  2022-05-12 11:19   ` Alvaro Karsz
@ 2022-05-15 14:53     ` Alvaro Karsz
  0 siblings, 0 replies; 7+ messages in thread
From: Alvaro Karsz @ 2022-05-15 14:53 UTC (permalink / raw)
  To: Xuan Zhuo; +Cc: virtio-comment

Hi,
Github issue was opened for this patch.
https://github.com/oasis-tcs/virtio-spec/issues/141

On Thu, May 12, 2022 at 2:19 PM Alvaro Karsz <alvaro.karsz@solid-run.com> wrote:
>
> Hi,
>
>> I would like to know what scenarios this function can be used in, what problems
>> can be solved or what benefits can be obtained?
>
>
> One example is using ethtool command to configure these parameters on a VirtIO network compatible device.
> You could use the following command on the host to adjust the interrupt coalescing parameters:
>
>  $ ethtool -C <interface> tx-usecs X  rx-usecs Y  tx-frames Z  rx-frames W
>
> I'm working on a Network compatible device which can coalesce interrupts, but there is no interface to adjust the usecs and frames parameters.
> Having this command would give an interface to change these parameters on runtime.
>
>
>
> On Thu, May 12, 2022 at 2:06 PM Xuan Zhuo <xuanzhuo@linux.alibaba.com> wrote:
>>
>> On Thu, 12 May 2022 11:07:39 +0300, Alvaro Karsz <alvaro.karsz@solid-run.com> wrote:
>> > Control a network device interrupt coalescing parameters using the control virtqueue.
>> > A new control class was added: VIRTIO_NET_CTRL_INTR_COAL.
>> >
>> > This class provides 2 commands:
>> > - VIRTIO_NET_CTRL_INTR_COAL_USECS_SET:
>> >   Ask the network device to change the rx-usecs and tx-usecs parameters.
>> >   rx-usecs - Time to delay an RX interrupt after packet arrival in microseconds.
>> >   tx-usecs - Time to delay a TX interrupt after a sending a packet in microseconds.
>> >
>> > - VIRTIO_NET_CTRL_INTR_COAL_FRAMES_SET:
>> >   Ask the network device to change the rx-max-frames and tx-max-frames parameters.
>> >   rx-max-frames - Number of packets to delay an RX interrupt after packet arrival.
>> >   tx-max-frames - Number of packets to delay a TX interrupt after sending a packet.
>> >
>>
>> I would like to know what scenarios this function can be used in, what problems
>> can be solved or what benefits can be obtained?
>>
>> Thanks.
>>
>> >
>> > Signed-off-by: Alvaro Karsz <alvaro.karsz@solid-run.com>
>> > ---
>> >  content.tex | 41 +++++++++++++++++++++++++++++++++++++++++
>> >  1 file changed, 41 insertions(+)
>> >
>> > diff --git a/content.tex b/content.tex
>> > index 7508dd1..a70cb27 100644
>> > --- a/content.tex
>> > +++ b/content.tex
>> > @@ -3084,6 +3084,8 @@ \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_INTR_COAL(55)] Device supports interrupt coalescing.
>> > +
>> >  \item[VIRTIO_NET_F_HOST_USO (56)] Device can receive USO packets. Unlike UFO
>> >   (fragmenting the packet) the USO splits large UDP packet
>> >   to several segments when each of these smaller packets has UDP header.
>> > @@ -3129,6 +3131,7 @@ \subsubsection{Feature bit requirements}\label{sec:Device Types / Network Device
>> >  \item[VIRTIO_NET_F_GUEST_ANNOUNCE] Requires VIRTIO_NET_F_CTRL_VQ.
>> >  \item[VIRTIO_NET_F_MQ] Requires VIRTIO_NET_F_CTRL_VQ.
>> >  \item[VIRTIO_NET_F_CTRL_MAC_ADDR] Requires VIRTIO_NET_F_CTRL_VQ.
>> > +\item[VIRTIO_NET_F_INTR_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.
>> >  \end{description}
>> > @@ -4464,6 +4467,44 @@ \subsubsection{Control Virtqueue}\label{sec:Device Types / Network Device / Devi
>> >  (necessarily when not using the legacy interface) little-endian.
>> >
>> >
>> > +\paragraph{Interrupt Coalescing}\label{sec:Device Types / Network Device / Device Operation / Control Virtqueue / Interrupt Coalescing}
>> > +
>> > +If the VIRTIO_NET_F_INTR_COAL feature is negotiated, the driver can
>> > +send control commands for dynamically changing the coalescing parameters.
>> > +
>> > +\begin{lstlisting}
>> > +struct virtio_net_ctrl_coal_usec {
>> > +    le32 tx_usecs;
>> > +    le32 rx_usecs;
>> > +};
>> > +
>> > +struct virtio_net_ctrl_coal_frames {
>> > +    le32 tx_frames_max;
>> > +    le32 rx_frames_max;
>> > +};
>> > +
>> > +#define VIRTIO_NET_CTRL_INTR_COAL 6
>> > + #define VIRTIO_NET_CTRL_INTR_COAL_USECS_SET  0
>> > + #define VIRTIO_NET_CTRL_INTR_COAL_FRAMES_SET 1
>> > +\end{lstlisting}
>> > +
>> > +The class VIRTIO_NET_CTRL_INTR_COAL has 2 commands:
>> > +\begin{itemize}
>> > +\item VIRTIO_NET_CTRL_INTR_COAL_USECS_SET: set the rx-usecs (time to delay an RX interrupt after packet arrival in microseconds) and tx-usecs (time to delay a TX interrupt after a sending a packet in microseconds) parameters.
>> > +\item VIRTIO_NET_CTRL_INTR_COAL_FRAMES_SET: set the rx-max-frames (number of packets to delay an RX interrupt after packet arrival) and tx-max-frames (number of packets to delay a TX interrupt after sending a packet) parameters.
>> > +\end{itemize}
>> > +
>> > +\drivernormative{\subparagraph}{Interrupt Coalescing}{Device Types / Network Device / Device Operation / Control Virtqueue / Interrupt Coalescing}
>> > +
>> > +
>> > +A driver MUST NOT send to the device VIRTIO_NET_CTRL_INTR_COAL commands if the VIRTIO_NET_F_INTR_COAL feature
>> > +has not been negotiated.
>> > +
>> > +\devicenormative{\subparagraph}{Interrupt Coalescing}{Device Types / Network Device / Device Operation / Control Virtqueue / Interrupt Coalescing}
>> > +
>> > +A device SHOULD respond to the VIRTIO_NET_CTRL_INTR_COAL commands with VIRTIO_NET_ERR if was not able to change the parameters.
>> > +
>> > +
>> >  \subsubsection{Legacy Interface: Framing Requirements}\label{sec:Device
>> >  Types / Network Device / Legacy Interface: Framing Requirements}
>> >
>> > --
>> > 2.32.0
>> >
>> > 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: virtio-comment-subscribe@lists.oasis-open.org
>> > Unsubscribe: virtio-comment-unsubscribe@lists.oasis-open.org
>> > List help: virtio-comment-help@lists.oasis-open.org
>> > 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/
>> >
>
>
>
> --
>
>
> Alvaro Karsz, Software
> +972-50-7696862| https://www.solid-run.com



--

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: virtio-comment-subscribe@lists.oasis-open.org
Unsubscribe: virtio-comment-unsubscribe@lists.oasis-open.org
List help: virtio-comment-help@lists.oasis-open.org
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/


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [virtio-comment] [PATCH] Introduction of Virtio Network device interrupt coalescing feature
  2022-05-12  8:07 [virtio-comment] [PATCH] Introduction of Virtio Network device interrupt coalescing feature Alvaro Karsz
  2022-05-12 11:04 ` Xuan Zhuo
@ 2022-05-16  8:58 ` Stefan Hajnoczi
  2022-05-16  9:01   ` Jason Wang
  1 sibling, 1 reply; 7+ messages in thread
From: Stefan Hajnoczi @ 2022-05-16  8:58 UTC (permalink / raw)
  To: Alvaro Karsz; +Cc: virtio-comment

[-- Attachment #1: Type: text/plain, Size: 1621 bytes --]

On Thu, May 12, 2022 at 11:07:39AM +0300, Alvaro Karsz wrote:
> Control a network device interrupt coalescing parameters using the control virtqueue.
> A new control class was added: VIRTIO_NET_CTRL_INTR_COAL.
> 
> This class provides 2 commands:
> - VIRTIO_NET_CTRL_INTR_COAL_USECS_SET:
>   Ask the network device to change the rx-usecs and tx-usecs parameters.
>   rx-usecs - Time to delay an RX interrupt after packet arrival in microseconds.
>   tx-usecs - Time to delay a TX interrupt after a sending a packet in microseconds.
> 
> - VIRTIO_NET_CTRL_INTR_COAL_FRAMES_SET:
>   Ask the network device to change the rx-max-frames and tx-max-frames parameters.
>   rx-max-frames - Number of packets to delay an RX interrupt after packet arrival.
>   tx-max-frames - Number of packets to delay a TX interrupt after sending a packet.
> 
> 
> Signed-off-by: Alvaro Karsz <alvaro.karsz@solid-run.com>
> ---
>  content.tex | 41 +++++++++++++++++++++++++++++++++++++++++
>  1 file changed, 41 insertions(+)

Please add a sentence about how this interacts with Used Buffer
Notification Suppression. My guess is that suppression takes effect in
addition to virtio-net-specific coalescing, so it's possible that the
notification will be suppressed even after the timer expires or frame
count is exceeded?

Also, since the VIRTIO specification usually talks about Notifications
instead of "interrupts" (see 2.3 Notifications) I think it makes sense
to use that terminology instead of "interrupts". Interrupts are more of
transport-level (e.g. PCI, MMIO) concept than a VIRTIO device model
concept.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [virtio-comment] [PATCH] Introduction of Virtio Network device interrupt coalescing feature
  2022-05-16  8:58 ` Stefan Hajnoczi
@ 2022-05-16  9:01   ` Jason Wang
  2022-05-16  9:07     ` Alvaro Karsz
  0 siblings, 1 reply; 7+ messages in thread
From: Jason Wang @ 2022-05-16  9:01 UTC (permalink / raw)
  To: Stefan Hajnoczi; +Cc: Alvaro Karsz, virtio-comment

On Mon, May 16, 2022 at 4:58 PM Stefan Hajnoczi <stefanha@redhat.com> wrote:
>
> On Thu, May 12, 2022 at 11:07:39AM +0300, Alvaro Karsz wrote:
> > Control a network device interrupt coalescing parameters using the control virtqueue.
> > A new control class was added: VIRTIO_NET_CTRL_INTR_COAL.
> >
> > This class provides 2 commands:
> > - VIRTIO_NET_CTRL_INTR_COAL_USECS_SET:
> >   Ask the network device to change the rx-usecs and tx-usecs parameters.
> >   rx-usecs - Time to delay an RX interrupt after packet arrival in microseconds.
> >   tx-usecs - Time to delay a TX interrupt after a sending a packet in microseconds.
> >
> > - VIRTIO_NET_CTRL_INTR_COAL_FRAMES_SET:
> >   Ask the network device to change the rx-max-frames and tx-max-frames parameters.
> >   rx-max-frames - Number of packets to delay an RX interrupt after packet arrival.
> >   tx-max-frames - Number of packets to delay a TX interrupt after sending a packet.
> >
> >
> > Signed-off-by: Alvaro Karsz <alvaro.karsz@solid-run.com>
> > ---
> >  content.tex | 41 +++++++++++++++++++++++++++++++++++++++++
> >  1 file changed, 41 insertions(+)
>
> Please add a sentence about how this interacts with Used Buffer
> Notification Suppression. My guess is that suppression takes effect in
> addition to virtio-net-specific coalescing, so it's possible that the
> notification will be suppressed even after the timer expires or frame
> count is exceeded?

My understanding is that, as you suggest, it's actually a coalsing of
notification. So this should work after

1) Notification Suppression: if driver doesn't want notification, the
device does not care about coalescing
2) Event idx: the notification sent for event must still be coalesced

Anyhow, I agree we need to clarify these.

Thanks

>
> Also, since the VIRTIO specification usually talks about Notifications
> instead of "interrupts" (see 2.3 Notifications) I think it makes sense
> to use that terminology instead of "interrupts". Interrupts are more of
> transport-level (e.g. PCI, MMIO) concept than a VIRTIO device model
> concept.


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: virtio-comment-subscribe@lists.oasis-open.org
Unsubscribe: virtio-comment-unsubscribe@lists.oasis-open.org
List help: virtio-comment-help@lists.oasis-open.org
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/


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [virtio-comment] [PATCH] Introduction of Virtio Network device interrupt coalescing feature
  2022-05-16  9:01   ` Jason Wang
@ 2022-05-16  9:07     ` Alvaro Karsz
  0 siblings, 0 replies; 7+ messages in thread
From: Alvaro Karsz @ 2022-05-16  9:07 UTC (permalink / raw)
  To: Jason Wang; +Cc: Stefan Hajnoczi, virtio-comment

[-- Attachment #1: Type: text/plain, Size: 2849 bytes --]

>
> so it's possible that the
> notification will be suppressed even after the timer expires or frame
> count is exceeded?


I think that the notifications should be suppressed (if drivers asked) no
matter what coalescing parameters are set.


Also, since the VIRTIO specification usually talks about Notifications
> instead of "interrupts" (see 2.3 Notifications) I think it makes sense
> to use that terminology instead of "interrupts". Interrupts are more of
> transport-level (e.g. PCI, MMIO) concept than a VIRTIO device model
> concept.


Ok.

I will create a new version of this patch.



On Mon, May 16, 2022 at 12:02 PM Jason Wang <jasowang@redhat.com> wrote:

> On Mon, May 16, 2022 at 4:58 PM Stefan Hajnoczi <stefanha@redhat.com>
> wrote:
> >
> > On Thu, May 12, 2022 at 11:07:39AM +0300, Alvaro Karsz wrote:
> > > Control a network device interrupt coalescing parameters using the
> control virtqueue.
> > > A new control class was added: VIRTIO_NET_CTRL_INTR_COAL.
> > >
> > > This class provides 2 commands:
> > > - VIRTIO_NET_CTRL_INTR_COAL_USECS_SET:
> > >   Ask the network device to change the rx-usecs and tx-usecs
> parameters.
> > >   rx-usecs - Time to delay an RX interrupt after packet arrival in
> microseconds.
> > >   tx-usecs - Time to delay a TX interrupt after a sending a packet in
> microseconds.
> > >
> > > - VIRTIO_NET_CTRL_INTR_COAL_FRAMES_SET:
> > >   Ask the network device to change the rx-max-frames and tx-max-frames
> parameters.
> > >   rx-max-frames - Number of packets to delay an RX interrupt after
> packet arrival.
> > >   tx-max-frames - Number of packets to delay a TX interrupt after
> sending a packet.
> > >
> > >
> > > Signed-off-by: Alvaro Karsz <alvaro.karsz@solid-run.com>
> > > ---
> > >  content.tex | 41 +++++++++++++++++++++++++++++++++++++++++
> > >  1 file changed, 41 insertions(+)
> >
> > Please add a sentence about how this interacts with Used Buffer
> > Notification Suppression. My guess is that suppression takes effect in
> > addition to virtio-net-specific coalescing, so it's possible that the
> > notification will be suppressed even after the timer expires or frame
> > count is exceeded?
>
> My understanding is that, as you suggest, it's actually a coalsing of
> notification. So this should work after
>
> 1) Notification Suppression: if driver doesn't want notification, the
> device does not care about coalescing
> 2) Event idx: the notification sent for event must still be coalesced
>
> Anyhow, I agree we need to clarify these.
>
> Thanks
>
> >
> > Also, since the VIRTIO specification usually talks about Notifications
> > instead of "interrupts" (see 2.3 Notifications) I think it makes sense
> > to use that terminology instead of "interrupts". Interrupts are more of
> > transport-level (e.g. PCI, MMIO) concept than a VIRTIO device model
> > concept.
>
>

--

[-- Attachment #2: Type: text/html, Size: 4206 bytes --]

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2022-05-16  9:08 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-05-12  8:07 [virtio-comment] [PATCH] Introduction of Virtio Network device interrupt coalescing feature Alvaro Karsz
2022-05-12 11:04 ` Xuan Zhuo
2022-05-12 11:19   ` Alvaro Karsz
2022-05-15 14:53     ` Alvaro Karsz
2022-05-16  8:58 ` Stefan Hajnoczi
2022-05-16  9:01   ` Jason Wang
2022-05-16  9:07     ` Alvaro Karsz

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.