From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: virtio-comment-return-931-cohuck=redhat.com@lists.oasis-open.org Sender: List-Post: List-Help: List-Unsubscribe: List-Subscribe: Received: from lists.oasis-open.org (oasis-open.org [10.110.1.242]) by lists.oasis-open.org (Postfix) with ESMTP id E4795985EA5 for ; Fri, 22 Nov 2019 07:34:11 +0000 (UTC) Date: Fri, 22 Nov 2019 02:34:02 -0500 (EST) From: Yuri Benditovich Message-ID: <134107204.10953124.1574408042524.JavaMail.zimbra@redhat.com> In-Reply-To: <20191112020924-mutt-send-email-mst@kernel.org> References: <20191112053748.1616272-1-yuri.benditovich@daynix.com> <20191112053748.1616272-2-yuri.benditovich@daynix.com> <20191112020924-mutt-send-email-mst@kernel.org> MIME-Version: 1.0 Subject: Re: [virtio-comment] Re: [PATCH v4 1/1] virtio-net: define support for receive-side scaling Content-Type: multipart/alternative; boundary="----=_Part_10953123_2111715139.1574408042523" To: "Michael S. Tsirkin" Cc: Yuri Benditovich , virtio-comment@lists.oasis-open.org List-ID: ------=_Part_10953123_2111715139.1574408042523 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable ----- Original Message ----- > From: "Michael S. Tsirkin" > To: "Yuri Benditovich" > Cc: virtio-comment@lists.oasis-open.org > Sent: Tuesday, November 12, 2019 9:10:38 AM > Subject: [virtio-comment] Re: [PATCH v4 1/1] virtio-net: define support f= or > receive-side scaling > On Tue, Nov 12, 2019 at 07:37:48AM +0200, Yuri Benditovich wrote: > > Fixes: https://github.com/oasis-tcs/virtio-spec/issues/48 > > Added support for RSS receive steering mode. > > > > Signed-off-by: Yuri Benditovich > Looks good to me. > Big change and some people could be at DPDK conf, > so pls give it a week or so, then request voting if no more > comments. > Thanks! Please vote, if possible.=20 Thanks=20 > > --- > > conformance.tex | 2 + > > content.tex | 234 +++++++++++++++++++++++++++++++++++++++++++----- > > 2 files changed, 213 insertions(+), 23 deletions(-) > > > > diff --git a/conformance.tex b/conformance.tex > > index 0ac58aa..01449c5 100644 > > --- a/conformance.tex > > +++ b/conformance.tex > > @@ -101,6 +101,7 @@ \section{Conformance Targets}\label{sec:Conformance= / > > Conformance Targets} > > \item \ref{drivernormative:Device Types / Network Device / Device Opera= tion > > / Control Virtqueue / Gratuitous Packet Sending} > > \item \ref{drivernormative:Device Types / Network Device / Device Opera= tion > > / Control Virtqueue / Automatic receive steering in multiqueue mode} > > \item \ref{drivernormative:Device Types / Network Device / Device Opera= tion > > / Control Virtqueue / Offloads State Configuration / Setting Offloads > > State} > > +\item \ref{drivernormative:Device Types / Network Device / Device > > Operation / Control Virtqueue / Receive-side scaling (RSS) } > > \end{itemize} > > > > \conformance{\subsection}{Block Driver Conformance}\label{sec:Conforman= ce / > > Driver Conformance / Block Driver Conformance} > > @@ -257,6 +258,7 @@ \section{Conformance Targets}\label{sec:Conformance= / > > Conformance Targets} > > \item \ref{devicenormative:Device Types / Network Device / Device Opera= tion > > / Control Virtqueue / Setting MAC Address Filtering} > > \item \ref{devicenormative:Device Types / Network Device / Device Opera= tion > > / Control Virtqueue / Gratuitous Packet Sending} > > \item \ref{devicenormative:Device Types / Network Device / Device Opera= tion > > / Control Virtqueue / Automatic receive steering in multiqueue mode} > > +\item \ref{devicenormative:Device Types / Network Device / Device > > Operation / Control Virtqueue / Receive-side scaling (RSS) / RSS > > processing} > > \end{itemize} > > > > \conformance{\subsection}{Block Device Conformance}\label{sec:Conforman= ce / > > Device Conformance / Block Device Conformance} > > diff --git a/content.tex b/content.tex > > index 679391e..7a7abd2 100644 > > --- a/content.tex > > +++ b/content.tex > > @@ -2752,7 +2752,7 @@ \subsection{Virtqueues}\label{sec:Device Types / > > Network Device / Virtqueues} > > \item[2N] controlq > > \end{description} > > > > - N=3D1 if VIRTIO_NET_F_MQ is not negotiated, otherwise N is set by > > + N=3D1 if neither VIRTIO_NET_F_MQ nor VIRTIO_NET_F_RSS are negotiated, > > otherwise N is set by > > \field{max_virtqueue_pairs}. > > > > controlq only exists if VIRTIO_NET_F_CTRL_VQ set. > > @@ -2811,6 +2811,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_RSS(60)] Device supports RSS (receive-side scaling) > > + with Toeplitz hash calculation and configurable hash parameters for > > receive steering > > + > > \item[VIRTIO_NET_F_RSC_EXT(61)] Device can process duplicated ACKs > > and report number of coalesced segments and duplicated ACKs > > > > @@ -2840,6 +2843,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_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} > > > > \subsubsection{Legacy Interface: Feature bits}\label{sec:Device Types / > > Network Device / Feature bits / Legacy Interface: Feature bits} > > @@ -2854,7 +2858,7 @@ \subsubsection{Legacy Interface: Feature > > bits}\label{sec:Device Types / Network > > \subsection{Device configuration layout}\label{sec:Device Types / Netwo= rk > > Device / Device configuration layout} > > \label{sec:Device Types / Block Device / Feature bits / Device > > configuration layout} > > > > -Three driver-read-only configuration fields are currently defined. The > > \field{mac} address field > > +Device configuration fields are listed below, they are read-only for a > > driver. The \field{mac} address field > > always exists (though is only valid if VIRTIO_NET_F_MAC is set), and > > \field{status} only exists if VIRTIO_NET_F_STATUS is set. Two > > read-only bits (for the driver) are currently defined for the status fi= eld: > > @@ -2866,23 +2870,58 @@ \subsection{Device configuration > > layout}\label{sec:Device Types / Network Device > > \end{lstlisting} > > > > The following driver-read-only field, \field{max_virtqueue_pairs} only > > exists if > > -VIRTIO_NET_F_MQ is set. This field specifies the maximum number > > +VIRTIO_NET_F_MQ or VIRTIO_NET_F_RSS is set. 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 o= nce > > VIRTIO_NET_F_MQ > > +and transmitq1\ldots transmitqN respectively) that can be configured o= nce > > at least one of these features > > is negotiated. > > > > The following driver-read-only field, \field{mtu} only exists if > > VIRTIO_NET_F_MTU is set. This field specifies the maximum MTU for the > > driver to > > use. > > > > +Two following fields, \field{speed} and \field{duplex} are reserved. > > \begin{lstlisting} > > struct virtio_net_config { > > u8 mac[6]; > > le16 status; > > le16 max_virtqueue_pairs; > > le16 mtu; > > + le32 speed; > > + u8 duplex; > > + u8 rss_max_key_size; > > + le16 rss_max_indirection_table_length; > > + le32 supported_hash_types; > > }; > > \end{lstlisting} > > +\label{sec:Device Types / Network Device / Device configuration layout= / > > RSS} > > +Three following fields, \field{rss_max_key_size}, > > \field{rss_max_indirection_table_length} > > +and \field{supported_hash_types} only exist if VIRTIO_NET_F_RSS is set= . > > + > > +Field \field{rss_max_key_size} specifies maximal supported length of R= SS > > key in bytes. > > + > > +Field \field{rss_max_indirection_table_length} specifies maximal numbe= r of > > 16-bit entries in RSS indirection table. > > + > > +Field \field{supported_hash_types} contains bitmask of supported RSS h= ash > > types. > > + > > +Hash types applicable for IPv4 packets: > > +\begin{lstlisting} > > +#define VIRTIO_NET_RSS_HASH_TYPE_IPv4 (1 << 0) > > +#define VIRTIO_NET_RSS_HASH_TYPE_TCPv4 (1 << 1) > > +#define VIRTIO_NET_RSS_HASH_TYPE_UDPv4 (1 << 2) > > +\end{lstlisting} > > +Hash types applicable for IPv6 packets without extension headers > > +\begin{lstlisting} > > +#define VIRTIO_NET_RSS_HASH_TYPE_IPv6 (1 << 3) > > +#define VIRTIO_NET_RSS_HASH_TYPE_TCPv6 (1 << 4) > > +#define VIRTIO_NET_RSS_HASH_TYPE_UDPv6 (1 << 5) > > +\end{lstlisting} > > +Hash types applicable for IPv6 packets with extension headers > > +\begin{lstlisting} > > +#define VIRTIO_NET_RSS_HASH_TYPE_IP_EX (1 << 6) > > +#define VIRTIO_NET_RSS_HASH_TYPE_TCP_EX (1 << 7) > > +#define VIRTIO_NET_RSS_HASH_TYPE_UDP_EX (1 << 8) > > +\end{lstlisting} > > +For exact meaning of VIRTIO_NET_RSS_HASH_TYPE_ flags see \ref{sec:Devi= ce > > Types / Network Device / Device Operation / Control Virtqueue / > > Receive-side scaling (RSS) / RSS hash types}. > > > > \devicenormative{\subsubsection}{Device configuration layout}{Device Ty= pes > > / Network Device / Device configuration layout} > > > > @@ -2906,6 +2945,12 @@ \subsection{Device configuration > > layout}\label{sec:Device Types / Network Device > > so without fragmentation, after VIRTIO_NET_F_MTU has been successfully > > negotiated. > > > > +The device MUST set \field{rss_max_key_size} to at least 40, if it off= ers > > +VIRTIO_NET_F_RSS. > > + > > +The device MUST set \field{rss_max_indirection_table_length} to at lea= st > > 128, if it offers > > +VIRTIO_NET_F_RSS. > > + > > If the driver negotiates the VIRTIO_NET_F_STANDBY feature, the device M= AY > > act > > as a standby device for a primary device with the same MAC address. > > > > @@ -3675,33 +3720,52 @@ \subsubsection{Control Virtqueue}\label{sec:Dev= ice > > Types / Network Device / Devi > > with class VIRTIO_NET_CTRL_ANNOUNCE and command > > VIRTIO_NET_CTRL_ANNOUNCE_ACK > > before marking the buffer as used. > > > > -\paragraph{Automatic receive steering in multiqueue mode}\label{sec:De= vice > > Types / Network Device / Device Operation / Control Virtqueue / Automat= ic > > receive steering in multiqueue mode} > > +\paragraph{Device operation in multiqueue mode}\label{sec:Device Types= / > > Network Device / Device Operation / Control Virtqueue / Device operatio= n > > in multiqueue mode} > > > > -If the driver negotiates the VIRTIO_NET_F_MQ feature bit (depends > > -on VIRTIO_NET_F_CTRL_VQ), it MAY transmit outgoing packets on one > > -of the multiple transmitq1\ldots transmitqN and ask the device to > > -queue incoming packets into one of the multiple receiveq1\ldots receiv= eqN > > -depending on the packet flow. > > +This specification defines following modes that a device MAY implement= for > > operation with multiple transmit/receive virtqueues: > > +\begin{itemize} > > +\item Automatic receive steering as defined in \ref{sec:Device Types / > > Network Device / Device Operation / Control Virtqueue / Automatic recei= ve > > steering in multiqueue mode}. > > + If a device supports such mode, it offers VIRTIO_NET_F_MQ feature bit= . > > +\item Receive-side scaling as defined in \ref{devicenormative:Device T= ypes > > / Network Device / Device Operation / Control Virtqueue / Receive-side > > scaling (RSS) / RSS processing}. > > + If a device supports such mode, it offers VIRTIO_NET_F_RSS feature bi= t. > > +\end{itemize} > > > > -\begin{lstlisting} > > -struct virtio_net_ctrl_mq { > > - le16 virtqueue_pairs; > > -}; > > +A device MAY support one of these features or both. The driver MAY > > negotiate any set of these features that the device supports. > > > > +Multiqueue is disabled by default. > > + > > +The driver enables multiqueue by sending a command using \field{class} > > VIRTIO_NET_CTRL_MQ. The \field{command} selects the mode of multiqueue > > operation, as follows: > > +\begin{lstlisting} > > #define VIRTIO_NET_CTRL_MQ 4 > > - #define VIRTIO_NET_CTRL_MQ_VQ_PAIRS_SET 0 > > - #define VIRTIO_NET_CTRL_MQ_VQ_PAIRS_MIN 1 > > - #define VIRTIO_NET_CTRL_MQ_VQ_PAIRS_MAX 0x8000 > > + #define VIRTIO_NET_CTRL_MQ_VQ_PAIRS_SET 0 (for automatic receive > > steering) > > + #define VIRTIO_NET_CTRL_MQ_RSS_CONFIG 1 (for configurable receive > > steering) > > \end{lstlisting} > > > > -Multiqueue is disabled by default. The driver enables multiqueue by > > -executing the VIRTIO_NET_CTRL_MQ_VQ_PAIRS_SET command, specifying > > +If more than one multiqueue mode negotiated, the resulting device > > configuration is defined by the last command sent by the driver. > > + > > +\paragraph{Automatic receive steering in multiqueue mode}\label{sec:De= vice > > Types / Network Device / Device Operation / Control Virtqueue / Automat= ic > > receive steering in multiqueue mode} > > + > > +If the driver negotiates the VIRTIO_NET_F_MQ feature bit (depends on > > VIRTIO_NET_F_CTRL_VQ), it MAY transmit outgoing packets on one > > +of the multiple transmitq1\ldots transmitqN and ask the device to > > +queue incoming packets into one of the multiple receiveq1\ldots receiv= eqN > > +depending on the packet flow. > > + > > +The driver enables multiqueue by > > +sending the VIRTIO_NET_CTRL_MQ_VQ_PAIRS_SET command, specifying > > the number of the transmit and receive queues to be used up to > > \field{max_virtqueue_pairs}; subsequently, > > transmitq1\ldots transmitqn and receiveq1\ldots receiveqn where > > n=3D\field{virtqueue_pairs} MAY be used. > > +\begin{lstlisting} > > +struct virtio_net_ctrl_mq_pairs_set { > > + le16 virtqueue_pairs; > > +}; > > +#define VIRTIO_NET_CTRL_MQ_VQ_PAIRS_MIN 1 > > +#define VIRTIO_NET_CTRL_MQ_VQ_PAIRS_MAX 0x8000 > > > > -When multiqueue is enabled, the device MUST use automatic receive stee= ring > > +\end{lstlisting} > > + > > +When multiqueue is enabled by VIRTIO_NET_CTRL_MQ_VQ_PAIRS_SET command,= the > > device MUST use automatic receive steering > > based on packet flow. Programming of the receive steering > > classificator is implicit. After the driver transmitted a packet of a > > flow on transmitqX, the device SHOULD cause incoming packets for that f= low > > to > > @@ -3709,7 +3773,7 @@ \subsubsection{Control Virtqueue}\label{sec:Devic= e > > Types / Network Device / Devi > > no packets have been transmitted yet, the device MAY steer a packet > > to a random queue out of the specified receiveq1\ldots receiveqn. > > > > -Multiqueue is disabled by setting \field{virtqueue_pairs} to 1 (this i= s > > +Multiqueue is disabled by VIRTIO_NET_CTRL_MQ_VQ_PAIRS_SET with > > \field{virtqueue_pairs} to 1 (this is > > the default) and waiting for the device to use the command buffer. > > > > \drivernormative{\subparagraph}{Automatic receive steering in multiqueu= e > > mode}{Device Types / Network Device / Device Operation / Control Virtqu= eue > > / Automatic receive steering in multiqueue mode} > > @@ -3728,8 +3792,7 @@ \subsubsection{Control Virtqueue}\label{sec:Devic= e > > Types / Network Device / Devi > > > > \devicenormative{\subparagraph}{Automatic receive steering in multiqueu= e > > mode}{Device Types / Network Device / Device Operation / Control Virtqu= eue > > / Automatic receive steering in multiqueue mode} > > > > -The device MUST queue packets only on any receiveq1 before the > > -VIRTIO_NET_CTRL_MQ_VQ_PAIRS_SET command. > > +The device after initialization of reset MUST queue packets only on > > receiveq1. > > > > The device MUST NOT queue packets on receive queues greater than > > \field{virtqueue_pairs} once it has placed the > > @@ -3741,6 +3804,131 @@ \subsubsection{Control Virtqueue}\label{sec:Dev= ice > > Types / Network Device / Devi > > according to the native endian of the guest rather than > > (necessarily when not using the legacy interface) little-endian. > > > > +\paragraph{Receive-side scaling (RSS)}\label{sec:Device Types / Networ= k > > Device / Device Operation / Control Virtqueue / Receive-side scaling > > (RSS)} > > +A device offers feature VIRTIO_NET_F_RSS if it supports RSS receive > > steering with Toeplitz hash calculation and configurable parameters. > > + > > +A driver queries RSS capabilities of the device by reading device > > configuration as defined in \ref{sec:Device Types / Network Device / > > Device configuration layout / RSS} > > + > > +\subparagraph{Setting RSS parameters}\label{sec:Device Types / Network > > Device / Device Operation / Control Virtqueue / Receive-side scaling (R= SS) > > / Setting RSS parameters} > > + > > +Driver sends VIRTIO_NET_CTRL_MQ_RSS_CONFIG command using following for= mat > > for \field{command-specific-data}: > > +\begin{lstlisting} > > +struct virtio_net_rss_config { > > + le32 hash_types; > > + le16 indirection_table_mask; > > + le16 unclassified_queue; > > + le16 indirection_table[indirection_table_length]; > > + le16 max_tx_vq; > > + u8 hash_key_length; > > + u8 hash_key_data[hash_key_length]; > > +}; > > +\end{lstlisting} > > +Field \field{hash_types} contains a bitmask of allowed hash types as > > +defined in \ref{sec:Device Types / Network Device / Device Operation / > > Control Virtqueue / Receive-side scaling (RSS) / RSS hash types}. > > + > > +Field \field{indirection_table_mask} is a mask to be applied to calcul= ated > > hash to produce index in \field{indirection_table array}. > > +Number of entries in \field{indirection_table} is > > (\field{indirection_table_mask} + 1). > > + > > +Field \field{unclassified_queue} contains 0-based index of receive > > virtqueue to place unclassified packets in. Index 0 corresponds to > > receiveq1. > > + > > +Field \field{indirection_table} contains array of 0-based indices of > > receive virtqueus. Index 0 corresponds to receiveq1. > > + > > +A driver sets \field{max_tx_vq} to inform a device how many transmit > > virtqueues it may use (transmitq1\ldots transmitq \field{max_tx_vq}). > > + > > +\subparagraph{RSS hash types}\label{sec:Device Types / Network Device = / > > Device Operation / Control Virtqueue / Receive-side scaling (RSS) / RSS > > hash types} > > + > > +The device calculates hash on IPv4 packets according to the field > > \field{hash_types} of virtio_net_rss_config structure as follows: > > +\begin{itemize} > > +\item If VIRTIO_NET_RSS_HASH_TYPE_TCPv4 is set and the packet has TCP > > header, the hash is calculated over following fields: > > +\begin{itemize} > > +\item Source IP address > > +\item Destination IP address > > +\item Source TCP port > > +\item Destination TCP port > > +\end{itemize} > > +\item Else if VIRTIO_NET_RSS_HASH_TYPE_UDPv4 is set and the packet has= UDP > > header, the hash is calculated over following fields: > > +\begin{itemize} > > +\item Source IP address > > +\item Destination IP address > > +\item Source UDP port > > +\item Destination UDP port > > +\end{itemize} > > +\item Else if VIRTIO_NET_RSS_HASH_TYPE_IPv4 is set, the hash is calcul= ated > > over following fields: > > +\begin{itemize} > > +\item Source IP address > > +\item Destination IP address > > +\end{itemize} > > +\item Else the device does not calculate the hash > > +\end{itemize} > > + > > +The device calculates hash on IPv6 packets without extension headers > > according to the field \field{hash_types} of virtio_net_rss_config > > structure as follows: > > +\begin{itemize} > > +\item If VIRTIO_NET_RSS_HASH_TYPE_TCPv6 is set and the packet has TCPv= 6 > > header, the hash is calculated over following fields: > > +\begin{itemize} > > +\item Source IPv6 address > > +\item Destination IPv6 address > > +\item Source TCP port > > +\item Destination TCP port > > +\end{itemize} > > +\item Else if VIRTIO_NET_RSS_HASH_TYPE_UDPv6 is set and the packet has > > UDPv6 header, the hash is calculated over following fields: > > +\begin{itemize} > > +\item Source IPv6 address > > +\item Destination IPv6 address > > +\item Source UDP port > > +\item Destination UDP port > > +\end{itemize} > > +\item Else if VIRTIO_NET_RSS_HASH_TYPE_IPv6 is set, the hash is calcul= ated > > over following fields: > > +\begin{itemize} > > +\item Source IPv6 address > > +\item Destination IPv6 address > > +\end{itemize} > > +\item Else the device does not calculate the hash > > +\end{itemize} > > + > > +The device calculates hash on IPv6 packets with extension headers > > according to the field \field{hash_types} of virtio_net_rss_config > > structure as follows: > > +\begin{itemize} > > +\item If VIRTIO_NET_RSS_HASH_TYPE_TCP_EX is set and the packet has TCP= v6 > > header, the hash is calculated over following fields: > > +\begin{itemize} > > +\item Home address from the home address option in the IPv6 destinatio= n > > options header. If the extension header is not present, use the Source > > IPv6 address. > > +\item IPv6 address that is contained in the Routing-Header-Type-2 from= the > > associated extension header. If the extension header is not present, us= e > > the Destination IPv6 address. > > +\item Source TCP port > > +\item Destination TCP port > > +\end{itemize} > > +\item Else if VIRTIO_NET_RSS_HASH_TYPE_UDP_EX is set and the packet ha= s > > UDPv6 header, the hash is calculated over following fields: > > +\begin{itemize} > > +\item Home address from the home address option in the IPv6 destinatio= n > > options header. If the extension header is not present, use the Source > > IPv6 address. > > +\item IPv6 address that is contained in the Routing-Header-Type-2 from= the > > associated extension header. If the extension header is not present, us= e > > the Destination IPv6 address. > > +\item Source UDP port > > +\item Destination UDP port > > +\end{itemize} > > +\item Else if VIRTIO_NET_RSS_HASH_TYPE_IP_EX is set, the hash is > > calculated over following fields: > > +\begin{itemize} > > +\item Home address from the home address option in the IPv6 destinatio= n > > options header. If the extension header is not present, use the Source > > IPv6 address. > > +\item IPv6 address that is contained in the Routing-Header-Type-2 from= the > > associated extension header. If the extension header is not present, us= e > > the Destination IPv6 address. > > +\end{itemize} > > +\item Else skip IPv6 extension headers and calculate the hash as defin= ed > > above for IPv6 packet without extension headers > > +\end{itemize} > > + > > +\drivernormative{\subparagraph}{Setting RSS parameters}{Device Types / > > Network Device / Device Operation / Control Virtqueue / Receive-side > > scaling (RSS) } > > + > > +A driver MUST NOT send VIRTIO_NET_CTRL_MQ_RSS_CONFIG command if the > > feature VIRTIO_NET_F_RSS has not been negotiated. > > + > > +A driver MUST fill \field{indirection_table} array only with indices o= f > > enabled queues. Index 0 corresponds to receiveq1. > > + > > +Number of entries in \field{indirection_table} > > (\field{indirection_table_mask} + 1) MUST be a power of two. > > + > > +A driver MUST use \field{indirection_table_mask} values that are less = than > > \field{rss_max_indirection_table_length} reported by a device. > > + > > +A driver MUST NOT set any VIRTIO_NET_RSS_HASH_TYPE_ flags that are not > > supported by a device. > > + > > +\devicenormative{\subparagraph}{RSS processing}{Device Types / Network > > Device / Device Operation / Control Virtqueue / Receive-side scaling (R= SS) > > / RSS processing} > > +The device MUST determine destination queue for network packet as foll= ows: > > +\begin{itemize} > > +\item Calculate hash of the packet as defined in \ref{sec:Device Types= / > > Network Device / Device Operation / Control Virtqueue / Receive-side > > scaling (RSS) / RSS hash types} > > +\item If the device did not calculate the hash for specific packet, th= e > > device directs the packet to the receiveq specified by > > \field{unclassified_queue} of virtio_net_rss_config structure (value of= 0 > > corresponds to receiveq1). > > +\item Apply \field{indirection_table_mask} to the calculated hash and = use > > the result as the index in the indirection table to get 0-based number = of > > destination receiveq (value of 0 corresponds to receiveq1). > > +\end{itemize} > > + > > \paragraph{Offloads State Configuration}\label{sec:Device Types / Netwo= rk > > Device / Device Operation / Control Virtqueue / Offloads State > > Configuration} > > > > If the VIRTIO_NET_F_CTRL_GUEST_OFFLOADS feature is negotiated, the driv= er > > can > > -- > > 2.17.2 > 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-l= ists > Committee: https://www.oasis-open.org/committees/virtio/ > Join OASIS: https://www.oasis-open.org/join/ ------=_Part_10953123_2111715139.1574408042523 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable



= From: "Michael S. Tsirkin" <mst@redhat.com>
To: "Yur= i Benditovich" <yuri.benditovich@daynix.com>
Cc: virtio-com= ment@lists.oasis-open.org
Sent: Tuesday, November 12, 2019 9:10:3= 8 AM
Subject: [virtio-comment] Re: [PATCH v4 1/1] virtio-net: def= ine support for receive-side scaling

On Tue, Nov 12, 2019= at 07:37:48AM +0200, Yuri Benditovich wrote:
> Fixes: https://github= .com/oasis-tcs/virtio-spec/issues/48
> Added support for RSS receive = steering mode.
>
> Signed-off-by: Yuri Benditovich <yuri.be= nditovich@daynix.com>


Looks good to me.
Big cha= nge and some people could be at DPDK conf,
so pls give it a week or so, = then request voting if no more
comments.
Thanks!
Please vote, if possible.
Thanks


> -= --
>  conformance.tex |   2 +
>  content.tex &nb= sp;   | 234 +++++++++++++++++++++++++++++++++++++++++++-----
> &= nbsp;2 files changed, 213 insertions(+), 23 deletions(-)
>
> d= iff --git a/conformance.tex b/conformance.tex
> index 0ac58aa..01449c= 5 100644
> --- a/conformance.tex
> +++ b/conformance.tex
>= ; @@ -101,6 +101,7 @@ \section{Conformance Targets}\label{sec:Conformance /= Conformance Targets}
>  \item \ref{drivernormative:Device Types= / Network Device / Device Operation / Control Virtqueue / Gratuitous Packe= t Sending}
>  \item \ref{drivernormative:Device Types / Network = Device / Device Operation / Control Virtqueue / Automatic receive steering = in multiqueue mode}
>  \item \ref{drivernormative:Device Types /= Network Device / Device Operation / Control Virtqueue / Offloads State Con= figuration / Setting Offloads State}
> +\item \ref{drivernormative:De= vice Types / Network Device / Device Operation / Control Virtqueue / Receiv= e-side scaling (RSS) }
>  \end{itemize}
>  
> &= nbsp;\conformance{\subsection}{Block Driver Conformance}\label{sec:Conforma= nce / Driver Conformance / Block Driver Conformance}
> @@ -257,6 +258= ,7 @@ \section{Conformance Targets}\label{sec:Conformance / Conformance Tar= gets}
>  \item \ref{devicenormative:Device Types / Network Devic= e / Device Operation / Control Virtqueue / Setting MAC Address Filtering}>  \item \ref{devicenormative:Device Types / Network Device / Dev= ice Operation / Control Virtqueue / Gratuitous Packet Sending}
> &nbs= p;\item \ref{devicenormative:Device Types / Network Device / Device Operati= on / Control Virtqueue / Automatic receive steering in multiqueue mode}
= > +\item \ref{devicenormative:Device Types / Network Device / Device Ope= ration / Control Virtqueue / Receive-side scaling (RSS) / RSS processing}>  \end{itemize}
>  
>  \conformance{\subse= ction}{Block Device Conformance}\label{sec:Conformance / Device Conformance= / Block Device Conformance}
> diff --git a/content.tex b/content.tex=
> index 679391e..7a7abd2 100644
> --- a/content.tex
> ++= + b/content.tex
> @@ -2752,7 +2752,7 @@ \subsection{Virtqueues}\label= {sec:Device Types / Network Device / Virtqueues}
>  \item[2N] co= ntrolq
>  \end{description}
>  
> - N=3D1 if VI= RTIO_NET_F_MQ is not negotiated, otherwise N is set by
> + N=3D1 if n= either VIRTIO_NET_F_MQ nor VIRTIO_NET_F_RSS are negotiated, otherwise N is = set by
>   \field{max_virtqueue_pairs}.
>  
> &= nbsp; controlq only exists if VIRTIO_NET_F_CTRL_VQ set.
> @@ -2811,6 = +2811,9 @@ \subsection{Feature bits}\label{sec:Device Types / Network Devic= e / Feature bits
>  \item[VIRTIO_NET_F_CTRL_MAC_ADDR(23)] Set MA= C address through control
>      channel.
> &nbs= p;
> +\item[VIRTIO_NET_F_RSS(60)] Device supports RSS (receive-side s= caling)
> +    with Toeplitz hash calculation and configura= ble hash parameters for receive steering
> +
>  \item[VIRT= IO_NET_F_RSC_EXT(61)] Device can process duplicated ACKs
>   &nb= sp;  and report number of coalesced segments and duplicated ACKs
&g= t;  
> @@ -2840,6 +2843,7 @@ \subsubsection{Feature bit requirem= ents}\label{sec:Device Types / Network Device
>  \item[VIRTIO_NE= T_F_MQ] Requires VIRTIO_NET_F_CTRL_VQ.
>  \item[VIRTIO_NET_F_CTR= L_MAC_ADDR] 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.
>  \en= d{description}
>  
>  \subsubsection{Legacy Interface= : Feature bits}\label{sec:Device Types / Network Device / Feature bits / Le= gacy Interface: Feature bits}
> @@ -2854,7 +2858,7 @@ \subsubsection{= Legacy Interface: Feature bits}\label{sec:Device Types / Network
> &n= bsp;\subsection{Device configuration layout}\label{sec:Device Types / Netwo= rk Device / Device configuration layout}
>  \label{sec:Device Ty= pes / Block Device / Feature bits / Device configuration layout}
> &n= bsp;
> -Three driver-read-only configuration fields are currently def= ined. The \field{mac} address field
> +Device configuration fields ar= e listed below, they are read-only for a driver. The \field{mac} address fi= eld
>  always exists (though is only valid if VIRTIO_NET_F_MAC i= s set), and
>  \field{status} only exists if VIRTIO_NET_F_STATUS= is set. Two
>  read-only bits (for the driver) are currently de= fined for the status field:
> @@ -2866,23 +2870,58 @@ \subsection{Dev= ice configuration layout}\label{sec:Device Types / Network Device
> &= nbsp;\end{lstlisting}
>  
>  The following driver-rea= d-only field, \field{max_virtqueue_pairs} only exists if
> -VIRTIO_NE= T_F_MQ is set. This field specifies the maximum number
> +VIRTIO_NET_= F_MQ or VIRTIO_NET_F_RSS is set. This field specifies the maximum number>  of each of transmit and receive virtqueues (receiveq1\ldots rec= eiveqN
> -and transmitq1\ldots transmitqN respectively) that can be c= onfigured once VIRTIO_NET_F_MQ
> +and transmitq1\ldots transmitqN res= pectively) that can be configured once at least one of these features
&g= t;  is negotiated.
>  
>  The following driver-r= ead-only field, \field{mtu} only exists if
>  VIRTIO_NET_F_MTU i= s set. This field specifies the maximum MTU for the driver to
>  = ;use.
>  
> +Two following fields, \field{speed} and \fiel= d{duplex} are reserved.
>  \begin{lstlisting}
>  stru= ct virtio_net_config {
>          u8 mac[6];=
>          le16 status;
>   &nbs= p;      le16 max_virtqueue_pairs;
>     &nbs= p;    le16 mtu;
> +        le32 speed;<= br>> +        u8 duplex;
> +     &nb= sp;  u8 rss_max_key_size;
> +        le16 rs= s_max_indirection_table_length;
> +        le32 s= upported_hash_types;
>  };
>  \end{lstlisting}
>= ; +\label{sec:Device Types / Network Device / Device configuration layout /= RSS}
> +Three following fields, \field{rss_max_key_size}, \field{rss= _max_indirection_table_length}
> +and \field{supported_hash_types} on= ly exist if VIRTIO_NET_F_RSS is set.
> +
> +Field \field{rss_ma= x_key_size} specifies maximal supported length of RSS key in bytes.
>= +
> +Field \field{rss_max_indirection_table_length} specifies maxima= l number of 16-bit entries in RSS indirection table.
> +
> +Fie= ld \field{supported_hash_types} contains bitmask of supported RSS hash type= s.
> +
> +Hash types applicable for IPv4 packets:
> +\beg= in{lstlisting}
> +#define VIRTIO_NET_RSS_HASH_TYPE_IPv4    =          (1 << 0)
> +#define VIRTIO_N= ET_RSS_HASH_TYPE_TCPv4             (1 <<= ; 1)
> +#define VIRTIO_NET_RSS_HASH_TYPE_UDPv4       &= nbsp;     (1 << 2)
> +\end{lstlisting}
> +Hash = types applicable for IPv6 packets without extension headers
> +\begin= {lstlisting}
> +#define VIRTIO_NET_RSS_HASH_TYPE_IPv6     &= nbsp;        (1 << 3)
> +#define VIRTIO_NET= _RSS_HASH_TYPE_TCPv6             (1 << = 4)
> +#define VIRTIO_NET_RSS_HASH_TYPE_UDPv6       &nb= sp;     (1 << 5)
> +\end{lstlisting}
> +Hash ty= pes applicable for IPv6 packets with extension headers
> +\begin{lstl= isting}
> +#define VIRTIO_NET_RSS_HASH_TYPE_IP_EX      = ;       (1 << 6)
> +#define VIRTIO_NET_RSS_HASH_= TYPE_TCP_EX            (1 << 7)
>= +#define VIRTIO_NET_RSS_HASH_TYPE_UDP_EX          = ;  (1 << 8)
> +\end{lstlisting}
> +For exact meaning= of VIRTIO_NET_RSS_HASH_TYPE_ flags see \ref{sec:Device Types / Network Dev= ice / Device Operation / Control Virtqueue / Receive-side scaling (RSS) / R= SS hash types}.
>  
>  \devicenormative{\subsubsectio= n}{Device configuration layout}{Device Types / Network Device / Device conf= iguration layout}
>  
> @@ -2906,6 +2945,12 @@ \subsection= {Device configuration layout}\label{sec:Device Types / Network Device
&g= t;  so without fragmentation, after VIRTIO_NET_F_MTU has been successf= ully
>  negotiated.
>  
> +The device MUST set = \field{rss_max_key_size} to at least 40, if it offers
> +VIRTIO_NET_F= _RSS.
> +
> +The device MUST set \field{rss_max_indirection_tab= le_length} to at least 128, if it offers
> +VIRTIO_NET_F_RSS.
>= +
>  If the driver negotiates the VIRTIO_NET_F_STANDBY feature,= the device MAY act
>  as a standby device for a primary device = with the same MAC address.
>  
> @@ -3675,33 +3720,52 @@ \= subsubsection{Control Virtqueue}\label{sec:Device Types / Network Device / = Devi
>  with class VIRTIO_NET_CTRL_ANNOUNCE and command VIRTIO_N= ET_CTRL_ANNOUNCE_ACK
>  before marking the buffer as used.
&g= t;  
> -\paragraph{Automatic receive steering in multiqueue mode= }\label{sec:Device Types / Network Device / Device Operation / Control Virt= queue / Automatic receive steering in multiqueue mode}
> +\paragraph{= Device operation in multiqueue mode}\label{sec:Device Types / Network Devic= e / Device Operation / Control Virtqueue / Device operation in multiqueue m= ode}
>  
> -If the driver negotiates the VIRTIO_NET_F_MQ f= eature bit (depends
> -on VIRTIO_NET_F_CTRL_VQ), it MAY transmit outg= oing packets on one
> -of the multiple transmitq1\ldots transmitqN an= d ask the device to
> -queue incoming packets into one of the multipl= e receiveq1\ldots receiveqN
> -depending on the packet flow.
> = +This specification defines following modes that a device MAY implement for= operation with multiple transmit/receive virtqueues:
> +\begin{itemi= ze}
> +\item Automatic receive steering as defined in \ref{sec:Device= Types / Network Device / Device Operation / Control Virtqueue / Automatic = receive steering in multiqueue mode}.
> + If a device supports such m= ode, it offers VIRTIO_NET_F_MQ feature bit.
> +\item Receive-side sca= ling as defined in \ref{devicenormative:Device Types / Network Device / Dev= ice Operation / Control Virtqueue / Receive-side scaling (RSS) / RSS proces= sing}.
> + If a device supports such mode, it offers VIRTIO_NET_F_RSS= feature bit.
> +\end{itemize}
>  
> -\begin{lstlist= ing}
> -struct virtio_net_ctrl_mq {
> -       &n= bsp;le16 virtqueue_pairs;
> -};
> +A device MAY support one of = these features or both. The driver MAY negotiate any set of these features = that the device supports.
>  
> +Multiqueue is disabled by= default.
> +
> +The driver enables multiqueue by sending a com= mand using \field{class} VIRTIO_NET_CTRL_MQ. The \field{command} selects th= e mode of multiqueue operation, as follows:
> +\begin{lstlisting}
= >  #define VIRTIO_NET_CTRL_MQ    4
> - #define VIRT= IO_NET_CTRL_MQ_VQ_PAIRS_SET        0
> - #define = VIRTIO_NET_CTRL_MQ_VQ_PAIRS_MIN        1
> - #def= ine VIRTIO_NET_CTRL_MQ_VQ_PAIRS_MAX        0x8000
&g= t; + #define VIRTIO_NET_CTRL_MQ_VQ_PAIRS_SET        0 (= for automatic receive steering)
> + #define VIRTIO_NET_CTRL_MQ_RSS_CO= NFIG          1 (for configurable receive steering= )
>  \end{lstlisting}
>  
> -Multiqueue is disa= bled by default. The driver enables multiqueue by
> -executing the VI= RTIO_NET_CTRL_MQ_VQ_PAIRS_SET command, specifying
> +If more than one= multiqueue mode negotiated, the resulting device configuration is defined = by the last command sent by the driver.
> +
> +\paragraph{Autom= atic receive steering in multiqueue mode}\label{sec:Device Types / Network = Device / Device Operation / Control Virtqueue / Automatic receive steering = in multiqueue mode}
> +
> +If the driver negotiates the VIRTIO_= NET_F_MQ feature bit (depends on VIRTIO_NET_F_CTRL_VQ), it MAY transmit out= going packets on one
> +of the multiple transmitq1\ldots transmitqN a= nd ask the device to
> +queue incoming packets into one of the multip= le receiveq1\ldots receiveqN
> +depending on the packet flow.
>= +
> +The driver enables multiqueue by
> +sending the VIRTIO_NE= T_CTRL_MQ_VQ_PAIRS_SET command, specifying
>  the number of the = transmit and receive queues to be used up to
>  \field{max_virtq= ueue_pairs}; subsequently,
>  transmitq1\ldots transmitqn and re= ceiveq1\ldots receiveqn where
>  n=3D\field{virtqueue_pairs} MAY= be used.
> +\begin{lstlisting}
> +struct virtio_net_ctrl_mq_pa= irs_set {
> +       le16 virtqueue_pairs;
> +};<= br>> +#define VIRTIO_NET_CTRL_MQ_VQ_PAIRS_MIN        = ;1
> +#define VIRTIO_NET_CTRL_MQ_VQ_PAIRS_MAX       &n= bsp;0x8000
>  
> -When multiqueue is enabled, the device M= UST use automatic receive steering
> +\end{lstlisting}
> +
&= gt; +When multiqueue is enabled by VIRTIO_NET_CTRL_MQ_VQ_PAIRS_SET command,= the device MUST use automatic receive steering
>  based on pack= et flow. Programming of the receive steering
>  classificator is= implicit. After the driver transmitted a packet of a
>  flow on= transmitqX, the device SHOULD cause incoming packets for that flow to
&= gt; @@ -3709,7 +3773,7 @@ \subsubsection{Control Virtqueue}\label{sec:Devic= e Types / Network Device / Devi
>  no packets have been transmit= ted yet, the device MAY steer a packet
>  to a random queue out = of the specified receiveq1\ldots receiveqn.
>  
> -Multiqu= eue is disabled by setting \field{virtqueue_pairs} to 1 (this is
> +M= ultiqueue is disabled by VIRTIO_NET_CTRL_MQ_VQ_PAIRS_SET with \field{virtqu= eue_pairs} to 1 (this is
>  the default) and waiting for the dev= ice to use the command buffer.
>  
>  \drivernormativ= e{\subparagraph}{Automatic receive steering in multiqueue mode}{Device Type= s / Network Device / Device Operation / Control Virtqueue / Automatic recei= ve steering in multiqueue mode}
> @@ -3728,8 +3792,7 @@ \subsubsectio= n{Control Virtqueue}\label{sec:Device Types / Network Device / Devi
>=  
>  \devicenormative{\subparagraph}{Automatic receive ste= ering in multiqueue mode}{Device Types / Network Device / Device Operation = / Control Virtqueue / Automatic receive steering in multiqueue mode}
>= ;  
> -The device MUST queue packets only on any receiveq1 befor= e the
> -VIRTIO_NET_CTRL_MQ_VQ_PAIRS_SET command.
> +The devic= e after initialization of reset MUST queue packets only on receiveq1.
&g= t;  
>  The device MUST NOT queue packets on receive queues= greater than
>  \field{virtqueue_pairs} once it has placed the<= br>> @@ -3741,6 +3804,131 @@ \subsubsection{Control Virtqueue}\label{sec= :Device Types / Network Device / Devi
>  according to the native= endian of the guest rather than
>  (necessarily when not using = the legacy interface) little-endian.
>  
> +\paragraph{Rec= eive-side scaling (RSS)}\label{sec:Device Types / Network Device / Device O= peration / Control Virtqueue / Receive-side scaling (RSS)}
> +A devic= e offers feature VIRTIO_NET_F_RSS if it supports RSS receive steering with = Toeplitz hash calculation and configurable parameters.
> +
> +A= driver queries RSS capabilities of the device by reading device configurat= ion as defined in \ref{sec:Device Types / Network Device / Device configura= tion layout / RSS}
> +
> +\subparagraph{Setting RSS parameters}= \label{sec:Device Types / Network Device / Device Operation / Control Virtq= ueue / Receive-side scaling (RSS) / Setting RSS parameters}
> +
&g= t; +Driver sends VIRTIO_NET_CTRL_MQ_RSS_CONFIG command using following form= at for \field{command-specific-data}:
> +\begin{lstlisting}
> += struct virtio_net_rss_config {
> +    le32 hash_types;
&= gt; +    le16 indirection_table_mask;
> +    le16= unclassified_queue;
> +    le16 indirection_table[indirect= ion_table_length];
> +    le16 max_tx_vq;
> +   =  u8 hash_key_length;
> +    u8 hash_key_data[hash_key_= length];
> +};
> +\end{lstlisting}
> +Field \field{hash_t= ypes} contains a bitmask of allowed hash types as
> +defined in \ref{= sec:Device Types / Network Device / Device Operation / Control Virtqueue / = Receive-side scaling (RSS) / RSS hash types}.
> +
> +Field \fie= ld{indirection_table_mask} is a mask to be applied to calculated hash to pr= oduce index in \field{indirection_table array}.
> +Number of entries = in \field{indirection_table} is (\field{indirection_table_mask} + 1).
&g= t; +
> +Field \field{unclassified_queue} contains 0-based index of re= ceive virtqueue to place unclassified packets in. Index 0 corresponds to re= ceiveq1.
> +
> +Field \field{indirection_table} contains array = of 0-based indices of receive virtqueus. Index 0 corresponds to receiveq1.<= br>> +
> +A driver sets \field{max_tx_vq} to inform a device how m= any transmit virtqueues it may use (transmitq1\ldots transmitq \field{max_t= x_vq}).
> +
> +\subparagraph{RSS hash types}\label{sec:Device T= ypes / Network Device / Device Operation / Control Virtqueue / Receive-side= scaling (RSS) / RSS hash types}
> +
> +The device calculates h= ash on IPv4 packets according to the field \field{hash_types} of virtio_net= _rss_config structure as follows:
> +\begin{itemize}
> +\item I= f VIRTIO_NET_RSS_HASH_TYPE_TCPv4 is set and the packet has TCP header, the = hash is calculated over following fields:
> +\begin{itemize}
> = +\item Source IP address
> +\item Destination IP address
> +\it= em Source TCP port
> +\item Destination TCP port
> +\end{itemiz= e}
> +\item Else if VIRTIO_NET_RSS_HASH_TYPE_UDPv4 is set and the pac= ket has UDP header, the hash is calculated over following fields:
> += \begin{itemize}
> +\item Source IP address
> +\item Destination= IP address
> +\item Source UDP port
> +\item Destination UDP p= ort
> +\end{itemize}
> +\item Else if VIRTIO_NET_RSS_HASH_TYPE_= IPv4 is set, the hash is calculated over following fields:
> +\begin{= itemize}
> +\item Source IP address
> +\item Destination IP add= ress
> +\end{itemize}
> +\item Else the device does not calcula= te the hash
> +\end{itemize}
> +
> +The device calculates= hash on IPv6 packets without extension headers according to the field \fie= ld{hash_types} of virtio_net_rss_config structure as follows:
> +\beg= in{itemize}
> +\item If VIRTIO_NET_RSS_HASH_TYPE_TCPv6 is set and the= packet has TCPv6 header, the hash is calculated over following fields:
= > +\begin{itemize}
> +\item Source IPv6 address
> +\item Des= tination IPv6 address
> +\item Source TCP port
> +\item Destina= tion TCP port
> +\end{itemize}
> +\item Else if VIRTIO_NET_RSS_= HASH_TYPE_UDPv6 is set and the packet has UDPv6 header, the hash is calcula= ted over following fields:
> +\begin{itemize}
> +\item Source I= Pv6 address
> +\item Destination IPv6 address
> +\item Source U= DP port
> +\item Destination UDP port
> +\end{itemize}
> = +\item Else if VIRTIO_NET_RSS_HASH_TYPE_IPv6 is set, the hash is calculated= over following fields:
> +\begin{itemize}
> +\item Source IPv6= address
> +\item Destination IPv6 address
> +\end{itemize}
= > +\item Else the device does not calculate the hash
> +\end{itemi= ze}
> +
> +The device calculates hash on IPv6 packets with exte= nsion headers according to the field \field{hash_types} of virtio_net_rss_c= onfig structure as follows:
> +\begin{itemize}
> +\item If VIRT= IO_NET_RSS_HASH_TYPE_TCP_EX is set and the packet has TCPv6 header, the has= h is calculated over following fields:
> +\begin{itemize}
> +\i= tem Home address from the home address option in the IPv6 destination optio= ns header. If the extension header is not present, use the Source IPv6 addr= ess.
> +\item IPv6 address that is contained in the Routing-Header-Ty= pe-2 from the associated extension header. If the extension header is not p= resent, use the Destination IPv6 address.
> +\item Source TCP port> +\item Destination TCP port
> +\end{itemize}
> +\item Els= e if VIRTIO_NET_RSS_HASH_TYPE_UDP_EX is set and the packet has UDPv6 header= , the hash is calculated over following fields:
> +\begin{itemize}> +\item Home address from the home address option in the IPv6 destinat= ion options header. If the extension header is not present, use the Source = IPv6 address.
> +\item IPv6 address that is contained in the Routing-= Header-Type-2 from the associated extension header. If the extension header= is not present, use the Destination IPv6 address.
> +\item Source UD= P port
> +\item Destination UDP port
> +\end{itemize}
> += \item Else if VIRTIO_NET_RSS_HASH_TYPE_IP_EX is set, the hash is calculated= over following fields:
> +\begin{itemize}
> +\item Home addres= s from the home address option in the IPv6 destination options header. If t= he extension header is not present, use the Source IPv6 address.
> +\= item IPv6 address that is contained in the Routing-Header-Type-2 from the a= ssociated extension header. If the extension header is not present, use the= Destination IPv6 address.
> +\end{itemize}
> +\item Else skip = IPv6 extension headers and calculate the hash as defined above for IPv6 pac= ket without extension headers
> +\end{itemize}
> +
> +\dr= ivernormative{\subparagraph}{Setting RSS parameters}{Device Types / Network= Device / Device Operation / Control Virtqueue / Receive-side scaling (RSS)= }
> +
> +A driver MUST NOT send VIRTIO_NET_CTRL_MQ_RSS_CONFIG = command if the feature VIRTIO_NET_F_RSS has not been negotiated.
> +<= br>> +A driver MUST fill \field{indirection_table} array only with indic= es of enabled queues. Index 0 corresponds to receiveq1.
> +
> += Number of entries in \field{indirection_table} (\field{indirection_table_ma= sk} + 1) MUST be a power of two.
> +
> +A driver MUST use \fiel= d{indirection_table_mask} values that are less than \field{rss_max_indirect= ion_table_length} reported by a device.
> +
> +A driver MUST NO= T set any VIRTIO_NET_RSS_HASH_TYPE_ flags that are not supported by a devic= e.
> +
> +\devicenormative{\subparagraph}{RSS processing}{Devic= e Types / Network Device / Device Operation / Control Virtqueue / Receive-s= ide scaling (RSS) / RSS processing}
> +The device MUST determine dest= ination queue for network packet as follows:
> +\begin{itemize}
&g= t; +\item Calculate hash of the packet as defined in \ref{sec:Device Types = / Network Device / Device Operation / Control Virtqueue / Receive-side scal= ing (RSS) / RSS hash types}
> +\item If the device did not calculate = the hash for specific packet, the device directs the packet to the receiveq= specified by \field{unclassified_queue} of virtio_net_rss_config structure= (value of 0 corresponds to receiveq1).
> +\item Apply \field{indirec= tion_table_mask} to the calculated hash and use the result as the index in = the indirection table to get 0-based number of destination receiveq (value = of 0 corresponds to receiveq1).
> +\end{itemize}
> +
> &n= bsp;\paragraph{Offloads State Configuration}\label{sec:Device Types / Netwo= rk Device / Device Operation / Control Virtqueue / Offloads State Configura= tion}
>  
>  If the VIRTIO_NET_F_CTRL_GUEST_OFFLOADS = feature is negotiated, the driver can
> --
> 2.17.2

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

In order to verify us= er consent to the Feedback License terms and
to minimize spam in the li= st archive, subscription is required
before posting.

Subscribe:= virtio-comment-subscribe@lists.oasis-open.org
Unsubscribe: virtio-comm= ent-unsubscribe@lists.oasis-open.org
List help: virtio-comment-help@lis= ts.oasis-open.org
List archive: https://lists.oasis-open.org/archives/v= irtio-comment/
Feedback License: https://www.oasis-open.org/who/ipr/fee= dback_license.pdf
List Guidelines: https://www.oasis-open.org/policies-= guidelines/mailing-lists
Committee: https://www.oasis-open.org/committe= es/virtio/
Join OASIS: https://www.oasis-open.org/join/


------=_Part_10953123_2111715139.1574408042523--