Re: [virtio-dev] [PATCH] virtio_net: support low and high rate of notification coalescing sets

2022-12-21 Thread Xuan Zhuo
On Wed, 21 Dec 2022 13:48:59 +0200, Alvaro Karsz  
wrote:
> Hi,
>
> > I want to know which one is better than NetDim(Coalesce Adaptive) in driver.
> >
> > I know Heng Qi's work in this.
> >
> > Thanks
>
>
> Why choose? we can have both.
> ethtool can handle both pkt_rate_low/pkt_rate_high and
> use_adaptive_rx_coalesce/use_adaptive_tx_coalesce.
>
> The adaptive algorithm can even use this feature to set low and high
> coalescing sets.

Yes, I understand.

But if a function can be implemented on driver, we don't need to let the device
support it.

I hope that the device is simpler, if it is possible.

Thanks.

>
> Alvaro

-
To unsubscribe, e-mail: virtio-dev-unsubscr...@lists.oasis-open.org
For additional commands, e-mail: virtio-dev-h...@lists.oasis-open.org



Re: [virtio-dev] [PATCH] virtio_net: support low and high rate of notification coalescing sets

2022-12-21 Thread Heng Qi




在 2022/12/21 下午7:48, Alvaro Karsz 写道:

Hi,


I want to know which one is better than NetDim(Coalesce Adaptive) in driver.

I know Heng Qi's work in this.

Thanks


Why choose? we can have both.
ethtool can handle both pkt_rate_low/pkt_rate_high and
use_adaptive_rx_coalesce/use_adaptive_tx_coalesce.

The adaptive algorithm can even use this feature to set low and high
coalescing sets.


Hi, all.


NetDIM is currently a mature library in the kernel. It uses the number 
of bytes, PPS and interrupt rate


as samples to make an action, and it is performed independently in tx or 
rx direction. Also, There will


be an extra worker to help us send the configuration based on the 
control queue to avoid interrupting
the softirq. Although the method of pkt_rate_{low, high} params does not 
conflict with dim, I seem


to have some doubts that the colasce parameters of the rx and tx 
directions are determined at the


same time based on pkt_rate alone, will this be a problem?


Thanks.



Alvaro



-
To unsubscribe, e-mail: virtio-dev-unsubscr...@lists.oasis-open.org
For additional commands, e-mail: virtio-dev-h...@lists.oasis-open.org



Re: [virtio-dev] [PATCH] virtio_net: support low and high rate of notification coalescing sets

2022-12-21 Thread Alvaro Karsz
Hi,

> I want to know which one is better than NetDim(Coalesce Adaptive) in driver.
>
> I know Heng Qi's work in this.
>
> Thanks


Why choose? we can have both.
ethtool can handle both pkt_rate_low/pkt_rate_high and
use_adaptive_rx_coalesce/use_adaptive_tx_coalesce.

The adaptive algorithm can even use this feature to set low and high
coalescing sets.

Alvaro

-
To unsubscribe, e-mail: virtio-dev-unsubscr...@lists.oasis-open.org
For additional commands, e-mail: virtio-dev-h...@lists.oasis-open.org



Re: [virtio-dev] [PATCH] virtio_net: support low and high rate of notification coalescing sets

2022-12-21 Thread Xuan Zhuo
On Wed, 21 Dec 2022 12:17:29 +0200, Alvaro Karsz  
wrote:
> This patch adds a new feature VIRTIO_NET_F_NOTF_COAL_LOW_HIGH,
> and adds 2 new commands to VIRTIO_NET_CTRL_NOTF_COAL class:
>   * VIRTIO_NET_CTRL_NOTF_COAL_LOW_SET - create a low-rate set of
> coalescing parameters. the device should switch to this set when
> the packet rate (packets per second) reaches the pkt_rate_low 
> threshold.
>
>   * VIRTIO_NET_CTRL_NOTF_COAL_HIGH_SET - create a high-rate set of
>   coalescing parameters. the device should switch to this set when
>   the packet rate (packets per second) reaches the pkt_rate_high 
> threshold.
>
> A device may have up to 3 sets, and should switch between them based on
> the packet rate.


I want to know which one is better than NetDim(Coalesce Adaptive) in driver.

I know Heng Qi's work in this.

Thanks


>
> Signed-off-by: Alvaro Karsz 
> ---
>  content.tex | 61 -
>  1 file changed, 60 insertions(+), 1 deletion(-)
>
> diff --git a/content.tex b/content.tex
> index 96f4723..969f945 100644
> --- a/content.tex
> +++ b/content.tex
> @@ -3088,6 +3088,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_NOTF_COAL_LOW_HIGH(50)] Device supports notifications 
> coalescing low rate and high rate sets.
> +
>  \item[VIRTIO_NET_F_NOTF_COAL(53)] Device supports notifications coalescing.
>
>  \item[VIRTIO_NET_F_GUEST_USO4 (54)] Driver can receive USOv4 packets.
> @@ -3142,6 +3144,7 @@ \subsubsection{Feature bit 
> requirements}\label{sec:Device Types / Network Device
>  \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_NOTF_COAL] Requires VIRTIO_NET_F_CTRL_VQ.
> +\item[VIRTIO_NET_F_NOTF_COAL_LOW_HIGH] Requires VIRTIO_NET_F_NOTF_COAL.
>  \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}
> @@ -4504,9 +4507,25 @@ \subsubsection{Control Virtqueue}\label{sec:Device 
> Types / Network Device / Devi
>  le32 tx_usecs;
>  };
>
> +//Only if VIRTIO_NET_F_NOTF_COAL_LOW_HIGH negotiated
> +struct virtio_net_ctrl_coal_low {
> +le32 pkt_rate_low;
> +struct virtio_net_ctrl_coal_tx tx;
> +struct virtio_net_ctrl_coal_rx rx;
> +};
> +
> +//Only if VIRTIO_NET_F_NOTF_COAL_LOW_HIGH negotiated
> +struct virtio_net_ctrl_coal_high {
> +le32 pkt_rate_high;
> +struct virtio_net_ctrl_coal_tx tx;
> +struct virtio_net_ctrl_coal_rx rx;
> +};
> +
>  #define VIRTIO_NET_CTRL_NOTF_COAL 6
>   #define VIRTIO_NET_CTRL_NOTF_COAL_TX_SET  0
>   #define VIRTIO_NET_CTRL_NOTF_COAL_RX_SET 1
> + #define VIRTIO_NET_CTRL_NOTF_COAL_LOW_SET 2 //Only if 
> VIRTIO_NET_F_NOTF_COAL_LOW_HIGH negotiated
> + #define VIRTIO_NET_CTRL_NOTF_COAL_HIGH_SET 3 //Only if 
> VIRTIO_NET_F_NOTF_COAL_LOW_HIGH negotiated
>  \end{lstlisting}
>
>  Coalescing parameters:
> @@ -4515,13 +4534,17 @@ \subsubsection{Control Virtqueue}\label{sec:Device 
> Types / Network Device / Devi
>  \item \field{tx_usecs}: Maximum number of usecs to delay a TX notification.
>  \item \field{rx_max_packets}: Maximum number of packets to receive before a 
> RX notification.
>  \item \field{tx_max_packets}: Maximum number of packets to send before a TX 
> notification.
> +\item \field{pkt_rate_low}: Threshold for low packet rate set (packets per 
> second).
> +\item \field{pkt_rate_high}: Threshold for high packet rate set (packets per 
> second).
>  \end{itemize}
>
>
> -The class VIRTIO_NET_CTRL_NOTF_COAL has 2 commands:
> +The class VIRTIO_NET_CTRL_NOTF_COAL has 4 commands:
>  \begin{enumerate}
>  \item VIRTIO_NET_CTRL_NOTF_COAL_TX_SET: set the \field{tx_usecs} and 
> \field{tx_max_packets} parameters.
>  \item VIRTIO_NET_CTRL_NOTF_COAL_RX_SET: set the \field{rx_usecs} and 
> \field{rx_max_packets} parameters.
> +\item VIRTIO_NET_CTRL_NOTF_COAL_LOW_SET: set the \field{rx_usecs}, 
> \field{rx_max_packets}, \field{tx_usecs} and \field{tx_max_packets} set for a 
> rate of \field{pkt_rate_low} or less packets per second.
> +\item VIRTIO_NET_CTRL_NOTF_COAL_HIGH_SET: set the \field{rx_usecs}, 
> \field{rx_max_packets}, \field{tx_usecs} and \field{tx_max_packets} set for a 
> rate of \field{pkt_rate_high} or more packets per second.
>  \end{enumerate}
>
>  \subparagraph{RX Notifications}\label{sec:Device Types / Network Device / 
> Device Operation / Control Virtqueue / Notifications Coalescing / RX 
> Notifications}
> @@ -4554,18 +4577,54 @@ \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