From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: virtio-comment-return-1072-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 4FBED985EF2 for ; Thu, 20 Feb 2020 05:09:14 +0000 (UTC) Date: Thu, 20 Feb 2020 00:09:01 -0500 (EST) From: Yuri Benditovich Message-ID: <575584881.7345661.1582175341197.JavaMail.zimbra@redhat.com> In-Reply-To: <20200219095236-mutt-send-email-mst@kernel.org> References: <20200219075337.23191-1-yuri.benditovich@daynix.com> <20200219075337.23191-2-yuri.benditovich@daynix.com> <20200219040122-mutt-send-email-mst@kernel.org> <1841911156.7222325.1582110433680.JavaMail.zimbra@redhat.com> <20200219092917-mutt-send-email-mst@kernel.org> <1785864968.7261240.1582123777151.JavaMail.zimbra@redhat.com> <20200219095236-mutt-send-email-mst@kernel.org> MIME-Version: 1.0 Subject: Re: [virtio-comment] Re: [PATCH v4 1/1] virtio-net: Define per-packet hash reporting feature Content-Type: multipart/alternative; boundary="----=_Part_7345660_715052899.1582175341195" To: "Michael S. Tsirkin" Cc: Yuri Benditovich , virtio-comment@lists.oasis-open.org List-ID: ------=_Part_7345660_715052899.1582175341195 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable ----- Original Message ----- > From: "Michael S. Tsirkin" > To: "Yuri Benditovich" > Cc: "Yuri Benditovich" , > virtio-comment@lists.oasis-open.org > Sent: Wednesday, February 19, 2020 4:56:04 PM > Subject: Re: [virtio-comment] Re: [PATCH v4 1/1] virtio-net: Define > per-packet hash reporting feature > On Wed, Feb 19, 2020 at 09:49:37AM -0500, Yuri Benditovich wrote: > > > > > > =E2=94=81=E2=94=81=E2=94=81=E2=94=81=E2=94=81=E2=94=81=E2=94=81=E2=94= =81=E2=94=81=E2=94=81=E2=94=81=E2=94=81=E2=94=81=E2=94=81=E2=94=81=E2=94=81= =E2=94=81=E2=94=81=E2=94=81=E2=94=81=E2=94=81=E2=94=81=E2=94=81=E2=94=81=E2= =94=81=E2=94=81=E2=94=81=E2=94=81=E2=94=81=E2=94=81=E2=94=81=E2=94=81=E2=94= =81=E2=94=81=E2=94=81=E2=94=81=E2=94=81=E2=94=81=E2=94=81=E2=94=81=E2=94=81= =E2=94=81=E2=94=81=E2=94=81=E2=94=81=E2=94=81=E2=94=81=E2=94=81=E2=94=81=E2= =94=81=E2=94=81=E2=94=81=E2=94=81=E2=94=81=E2=94=81=E2=94=81=E2=94=81=E2=94= =81=E2=94=81=E2=94=81=E2=94=81=E2=94=81=E2=94=81=E2=94=81=E2=94=81=E2=94=81= =E2=94=81=E2=94=81=E2=94=81=E2=94=81=E2=94=81=E2=94=81=E2=94=81=E2=94=81=E2= =94=81=E2=94=81=E2=94=81=E2=94=81=E2=94=81 > > > > From: "Michael S. Tsirkin" > > To: "Yuri Benditovich" > > Cc: "Yuri Benditovich" , > > virtio-comment@lists.oasis-open.org > > Sent: Wednesday, February 19, 2020 4:35:49 PM > > Subject: Re: [virtio-comment] Re: [PATCH v4 1/1] virtio-net: Define > > per-packet hash reporting feature > > > > On Wed, Feb 19, 2020 at 06:07:13AM -0500, Yuri Benditovich wrote: > > > > > > > > > > > =E2=94=81=E2=94=81=E2=94=81=E2=94=81=E2=94=81=E2=94=81=E2=94=81=E2=94= =81=E2=94=81=E2=94=81=E2=94=81=E2=94=81=E2=94=81=E2=94=81=E2=94=81=E2=94=81= =E2=94=81=E2=94=81=E2=94=81=E2=94=81=E2=94=81=E2=94=81=E2=94=81=E2=94=81=E2= =94=81=E2=94=81=E2=94=81=E2=94=81=E2=94=81=E2=94=81=E2=94=81=E2=94=81=E2=94= =81=E2=94=81=E2=94=81=E2=94=81=E2=94=81=E2=94=81=E2=94=81=E2=94=81=E2=94=81= =E2=94=81=E2=94=81=E2=94=81=E2=94=81=E2=94=81=E2=94=81=E2=94=81=E2=94=81=E2= =94=81=E2=94=81=E2=94=81=E2=94=81=E2=94=81=E2=94=81=E2=94=81=E2=94=81=E2=94= =81=E2=94=81=E2=94=81=E2=94=81=E2=94=81=E2=94=81=E2=94=81=E2=94=81=E2=94=81= =E2=94=81=E2=94=81=E2=94=81=E2=94=81=E2=94=81=E2=94=81=E2=94=81=E2=94=81=E2= =94=81=E2=94=81=E2=94=81=E2=94=81=E2=94=81 > > > > > > From: "Michael S. Tsirkin" > > > To: "Yuri Benditovich" > > > Cc: virtio-comment@lists.oasis-open.org > > > Sent: Wednesday, February 19, 2020 11:12:40 AM > > > Subject: [virtio-comment] Re: [PATCH v4 1/1] virtio-net: Define > > per-packet > > > hash reporting feature > > > > > > On Wed, Feb 19, 2020 at 09:53:37AM +0200, Yuri Benditovich wrote: > > > > Fixes: https://github.com/oasis-tcs/virtio-spec/issues/66 > > > > Define respective feature bit for virtio-net. > > > > Extend packet layout to populate hash value and type. > > > > Move the definition of IP/TCP/UDP header fields to > > > > calculate the hash out of RSS section to common network > > > > device section. > > > > > > > > Signed-off-by: Yuri Benditovich > > > > --- > > > > content.tex | 347 > > ++++++++++++++++++++++++++++++++++------------------ > > > > 1 file changed, 229 insertions(+), 118 deletions(-) > > > > > > > > diff --git a/content.tex b/content.tex > > > > index b91a132..d7d4e42 100644 > > > > --- a/content.tex > > > > +++ b/content.tex > > > > @@ -2895,6 +2895,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_HASH_REPORT(57)] Device can report per-packet > > hash > > > > + value and a type of calculated hash. > > > > + > > > > \item[VIRTIO_NET_F_GUEST_HDRLEN(59)] Driver can provide the exact > > \field > > > {hdr_len} > > > > value. Device benefits from knowing the exact header length. > > > > > > > > @@ -2995,35 +2998,17 @@ \subsection{Device configuration layout}\ > > label > > > {sec:Device Types / Network Device > > > > 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. > > > > +The following field, \field{rss_max_key_size} only exist if > > > VIRTIO_NET_F_RSS or VIRTIO_NET_F_HASH_REPORT is set. > > > > +It specifies the maximal supported length of RSS key in bytes. > > > > > > > > -Field \field{rss_max_key_size} specifies the maximal supported > > length of > > > RSS key in bytes. > > > > +The following field, \field{rss_max_indirection_table_length} only > > exist > > > if VIRTIO_NET_F_RSS is set. > > > > +It specifies the maximal number of 16-bit entries in RSS > > indirection > > > table. > > > > > > > > -Field \field{rss_max_indirection_table_length} specifies the > > maximal > > > number of 16-bit entries in RSS indirection table. > > > > +The next field, \field{supported_hash_types} exists only if the > > device > > > supports hash calculation, > > > > +i.e. if VIRTIO_NET_F_RSS or VIRTIO_NET_F_HASH_REPORT is set. > > > > > > > > -Field \field{supported_hash_types} contains the bitmask of > > supported RSS > > > hash 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 the exact meaning of VIRTIO_NET_RSS_HASH_TYPE_ flags see \ref > > > {sec:Device Types / Network Device / Device Operation / Control > > Virtqueue / > > > Receive-side scaling (RSS) / RSS hash types}. > > > > +Field \field{supported_hash_types} contains the bitmask of > > supported > > > hash types. > > > > +See \ref{sec:Device Types / Network Device / Device Operation / > > > Processing of Incoming Packets / Hash calculation for incoming > > packets / > > > Supported/enabled hash types} for details of supported hash types. > > > > > > > > \devicenormative{\subsubsection}{Device configuration layout} > > {Device > > > Types / Network Device / Device configuration layout} > > > > > > > > @@ -3048,7 +3033,7 @@ \subsection{Device configuration layout}\ > > label > > > {sec:Device Types / Network Device > > > > negotiated. > > > > > > > > The device MUST set \field{rss_max_key_size} to at least 40, if it > > > offers > > > > -VIRTIO_NET_F_RSS. > > > > +VIRTIO_NET_F_RSS or VIRTIO_NET_F_HASH_REPORT. > > > > > > > > The device MUST set \field{rss_max_indirection_table_length} to at > > least > > > 128, if it offers > > > > VIRTIO_NET_F_RSS. > > > > @@ -3195,6 +3180,8 @@ \subsection{Device Operation}\label > > {sec:Device > > > Types / Network Device / Device O > > > > le16 csum_start; > > > > le16 csum_offset; > > > > le16 num_buffers; > > > > + le32 hash_value; (Only if VIRTIO_NET_F_HASH_REPORT > > negotiated) > > > > + le16 hash_type; (Only if VIRTIO_NET_F_HASH_REPORT > > negotiated) > > > > }; > > > > > > Just noticed this - it's a bit problematic as it might force > > > compilers to add 2 bytes of padding at the end. Let's add extra 2 > > bytes > > > of padding explicitly? > > > > > > OK, no problem > > > > > > > > > > > > > > > > \end{lstlisting} > > > > > > > > @@ -3517,6 +3504,12 @@ \subsubsection{Processing of Incoming > > Packets}\ > > > label{sec:Device Types / Network > > > > > > > > \end{enumerate} > > > > > > > > +If applicable, the device calculates per-packet hash for incoming > > > packets as > > > > +defined in \ref{sec:Device Types / Network Device / Device > > Operation / > > > Processing of Incoming Packets / Hash calculation for incoming > > packets}. > > > > + > > > > +If applicable, the device reports hash information for incoming > > packets > > > as > > > > +defined in \ref{sec:Device Types / Network Device / Device > > Operation / > > > Processing of Incoming Packets / Hash reporting for incoming > > packets}. > > > > + > > > > \devicenormative{\paragraph}{Processing of Incoming Packets} > > {Device > > > Types / Network Device / Device Operation / Processing of Incoming > > Packets} > > > > \label{devicenormative:Device Types / Network Device / Device > > Operation > > > / Processing of Packets}%old label for latexdiff > > > > > > > > @@ -3619,6 +3612,181 @@ \subsubsection{Processing of Incoming > > Packets}\ > > > label{sec:Device Types / Network > > > > If neither VIRTIO_NET_HDR_F_NEEDS_CSUM nor > > > > VIRTIO_NET_HDR_F_DATA_VALID is set, the driver MUST NOT > > > > rely on the packet checksum being correct. > > > > + > > > > +\paragraph{Hash calculation for incoming packets} > > > > +\label{sec:Device Types / Network Device / Device Operation / > > Processing > > > of Incoming Packets / Hash calculation for incoming packets} > > > > + > > > > +A device attempts to calculate a per-packet hash in the following > > cases: > > > > +\begin{itemize} > > > > +\item The feature VIRTIO_NET_F_RSS was negotiated. The device uses > > the > > > hash to determine the receive virtqueue to place incoming packets. > > > > +\item The feature VIRTIO_NET_F_HASH_REPORT was negotiated. The > > device > > > reports the hash value and the hash type with the packet. > > > > +\end{itemize} > > > > + > > > > +If the feature VIRTIO_NET_F_RSS was negotiated: > > > > +\begin{itemize} > > > > +\item The device uses \field{hash_types} of the > > virtio_net_rss_config > > > structure as 'Enabled hash types' bitmask. > > > > +\item The device uses a key as defined in \field{hash_key_data} > > and \ > > > field{hash_key_length} of the virtio_net_rss_config structure (see > > > > +\ref{sec:Device Types / Network Device / Device Operation / > > Control > > > Virtqueue / Receive-side scaling (RSS) / Setting RSS parameters}). > > > > +\end{itemize} > > > > + > > > > +If the feature VIRTIO_NET_F_RSS was not negotiated: > > > > +\begin{itemize} > > > > +\item The device uses \field{hash_types} of the > > virtio_net_hash_config > > > structure as 'Enabled hash types' bitmask. > > > > +\item The device uses a key as defined in \field{hash_key_data} > > and \ > > > field{hash_key_length} of the virtio_net_hash_config structure (see > > > > +\ref{sec:Device Types / Network Device / Device Operation / > > Control > > > Virtqueue / Automatic receive steering in multiqueue mode / Hash > > > calculation}). > > > > +\end{itemize} > > > > + > > > > +Note that if the device offers VIRTIO_NET_F_HASH_REPORT, even if > > it > > > supports only one pair of virtqueues, it MUST support > > > > +at least one of commands of VIRTIO_NET_CTRL_MQ class to configure > > > reported hash parameters: > > > > +\begin{itemize} > > > > +\item If the device offers VIRTIO_NET_F_RSS, it MUST support > > > VIRTIO_NET_CTRL_MQ_RSS_CONFIG command per > > > > + \ref{sec:Device Types / Network Device / Device Operation / > > Control > > > Virtqueue / Receive-side scaling (RSS) / Setting RSS parameters}. > > > > +\item Otherwise the device MUST support > > VIRTIO_NET_CTRL_MQ_HASH_CONFIG > > > command per > > > > + \ref{sec:Device Types / Network Device / Device Operation / > > Control > > > Virtqueue / Automatic receive steering in multiqueue mode / Hash > > > calculation}. > > > > +\end{itemize} > > > > + > > > > +\subparagraph{Supported/enabled hash types} > > > > +\label{sec:Device Types / Network Device / Device Operation / > > Processing > > > of Incoming Packets / Hash calculation for incoming packets / > > Supported/ > > > enabled hash types} > > > > +Hash types applicable for IPv4 packets: > > > > +\begin{lstlisting} > > > > +#define VIRTIO_NET_HASH_TYPE_IPv4 (1 << 0) > > > > +#define VIRTIO_NET_HASH_TYPE_TCPv4 (1 << 1) > > > > +#define VIRTIO_NET_HASH_TYPE_UDPv4 (1 << 2) > > > > +\end{lstlisting} > > > > +Hash types applicable for IPv6 packets without extension headers > > > > +\begin{lstlisting} > > > > +#define VIRTIO_NET_HASH_TYPE_IPv6 (1 << 3) > > > > +#define VIRTIO_NET_HASH_TYPE_TCPv6 (1 << 4) > > > > +#define VIRTIO_NET_HASH_TYPE_UDPv6 (1 << 5) > > > > +\end{lstlisting} > > > > +Hash types applicable for IPv6 packets with extension headers > > > > +\begin{lstlisting} > > > > +#define VIRTIO_NET_HASH_TYPE_IP_EX (1 << 6) > > > > +#define VIRTIO_NET_HASH_TYPE_TCP_EX (1 << 7) > > > > +#define VIRTIO_NET_HASH_TYPE_UDP_EX (1 << 8) > > > > +\end{lstlisting} > > > > + > > > > +\subparagraph{IPv4 packets} > > > > +\label{sec:Device Types / Network Device / Device Operation / > > Processing > > > of Incoming Packets / Hash calculation for incoming packets / IPv4 > > packets} > > > > +The device calculates the hash on IPv4 packets according to > > 'Enabled > > > hash types' bitmask as follows: > > > > +\begin{itemize} > > > > +\item If VIRTIO_NET_HASH_TYPE_TCPv4 is set and the packet has > > > > +a TCP header, the hash is calculated over the 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_HASH_TYPE_UDPv4 is set and the > > > > +packet has a UDP header, the hash is calculated over the 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_HASH_TYPE_IPv4 is set, the hash is > > > > +calculated over the 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} > > > > + > > > > +\subparagraph{IPv6 packets without extension header} > > > > +\label{sec:Device Types / Network Device / Device Operation / > > Processing > > > of Incoming Packets / Hash calculation for incoming packets / IPv6 > > packets > > > without extension header} > > > > +The device calculates the hash on IPv6 packets without extension > > > > +headers according to 'Enabled hash types' bitmask as follows: > > > > +\begin{itemize} > > > > +\item If VIRTIO_NET_HASH_TYPE_TCPv6 is set and the packet has > > > > +a TCPv6 header, the hash is calculated over the 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_HASH_TYPE_UDPv6 is set and the > > > > +packet has a UDPv6 header, the hash is calculated over the > > 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_HASH_TYPE_IPv6 is set, the hash is > > > > +calculated over the 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} > > > > + > > > > +\subparagraph{IPv6 packets with extension header} > > > > +\label{sec:Device Types / Network Device / Device Operation / > > Processing > > > of Incoming Packets / Hash calculation for incoming packets / IPv6 > > packets > > > with extension header} > > > > +The device calculates the hash on IPv6 packets with extension > > > > +headers according to 'Enabled hash types' bitmask as follows: > > > > +\begin{itemize} > > > > +\item If VIRTIO_NET_HASH_TYPE_TCP_EX is set and the packet > > > > +has a TCPv6 header, the hash is calculated over the following > > fields: > > > > +\begin{itemize} > > > > +\item Home address from the home address option in the IPv6 > > destination > > > 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 TCP port > > > > +\item Destination TCP port > > > > +\end{itemize} > > > > +\item Else if VIRTIO_NET_HASH_TYPE_UDP_EX is set and the > > > > +packet has a UDPv6 header, the hash is calculated over the > > following > > > fields: > > > > +\begin{itemize} > > > > +\item Home address from the home address option in the IPv6 > > destination > > > 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 UDP port > > > > +\item Destination UDP port > > > > +\end{itemize} > > > > +\item Else if VIRTIO_NET_HASH_TYPE_IP_EX is set, the hash is > > > > +calculated over the following fields: > > > > +\begin{itemize} > > > > +\item Home address from the home address option in the IPv6 > > destination > > > 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. > > > > +\end{itemize} > > > > +\item Else skip IPv6 extension headers and calculate the hash as > > > > +defined for an IPv6 packet without extension headers > > > > +(see \ref{sec:Device Types / Network Device / Device Operation / > > > Processing of Incoming Packets / Hash calculation for incoming > > packets / > > > IPv6 packets without extension header}). > > > > +\end{itemize} > > > > + > > > > +\paragraph{Hash reporting for incoming packets} > > > > +\label{sec:Device Types / Network Device / Device Operation / > > Processing > > > of Incoming Packets / Hash reporting for incoming packets} > > > > + > > > > +If VIRTIO_NET_F_HASH_REPORT was negotiated and > > > > + the device has calculated the hash for the packet, the device > > fills \ > > > field{hash_type} with the type of calculated hash > > > > +and \field{hash_value} with the value of calculated hash. > > > > + > > > > +If VIRTIO_NET_F_HASH_REPORT was negotiated but due to any reason > > the > > > > +hash was not calculated, the device sets \field{hash_type} to > > > VIRTIO_NET_HASH_REPORT_NONE. > > > > + > > > > +Possible values that the device can report in \field{hash_type} > > are > > > defined below. > > > > +They correspond to supported hash types defined in > > > > +\ref{sec:Device Types / Network Device / Device Operation / > > Processing > > > of Incoming Packets / Hash calculation for incoming packets / > > Supported/ > > > enabled hash types} > > > > +as follows: > > > > + > > > > +VIRTIO_NET_HASH_TYPE_XXX =3D 1 << (VIRTIO_NET_HASH_REPORT_XXX - 1) > > > > > > > > > So hash_type is the HASH_REPORT value then? That's quite confusing. > > > Let's rename to hash_report? > > > > > > No problem to rename anything, but I'd like to do it one time. > > > Currently meaningful hash report values are (1..9), 0 for none > > > They correspond to bitmask of 9 bits for enabled/supported. > > > It was possible to use the same definitions for enable/support/report > > > but then reported kind of hash should be 4 bytes. > > > As you anyway suggests padding at the end of the packet, we can do th= at, > > > i.e. add (32 bit hash + 32 bit type) > > > > We can but it seems like a waste, does it not? padding can be used for > > something later ... > > > > > Or if we stay with the values as they are now: > > > values 0..9 - VIRTIO_NET_WHAT? > > > > I thought that's VIRTIO_NET_HASH_REPORT_XXX > > > > OK, this is exactly what is defined > > > > > > > bits from 0 to 8 - VIRTIO_NET_WHAT? > > > > > > and this one VIRTIO_NET_HASH_TYPE_XXX? > > > > OK, this is also exactly what is defined > > > Right I'm saying what's defined is fine, just call the fields > consistently. > > > > > > Generally what you did here is a bit unusual. Mostly we just define > > bit numbers > > #define VIRTIO_SCSI_F_INOUT 0 > > #define VIRTIO_SCSI_F_HOTPLUG 1 > > #define VIRTIO_SCSI_F_CHANGE 2 > > #define VIRTIO_SCSI_F_T10_PI 3 > > > > > > Value 0 of hash_report is "no hash calculated" and it does not > > participate in support/enable mask. I did not want to > > use value other than zero for "no hash". > Oh right. > > So you want bit 0 to be reserved (not used) in enable/support mask > > and then to have all the VIRTIO_NET_HASH_TYPE_XXX to be > > exactly 1 << VIRTIO_NET_HASH_REPORT_XXX? Just say... > > > We can do that too but it's up to you really. > So fixing the below you would say > bit 0 curresponding to value 1, > bit 1 corresponding to value 2 etc. > No bit corresponds to value 0 > ? Currently defined:=20 Reports:=20 VIRTIO_NET_HASH_REPORT_NONE 0=20 VIRTIO_NET_HASH_REPORT_IPv4 1=20 VIRTIO_NET_HASH_REPORT_UDPv4 3=20 VIRTIO_NET_HASH_REPORT_UDPv6_EX 9=20 Bitmask (VIRTIO_NET_HASH_TYPE_XXX =3D 1 << (VIRTIO_NET_HASH_REPORT_XXX - 1)= ):=20 VIRTIO_NET_HASH_TYPE_IPv4 =3D (1 << 0)=20 VIRTIO_NET_HASH_TYPE_UDPv4 =3D (1 << 2)=20 VIRTIO_NET_HASH_TYPE_UDP_EX =3D (1 << 8)=20 How you want it to be changed?=20 Can you please write here in the same format?=20 > > > > and just say that bit numbers are from this table, with bit > > 0 corresponding to the value 0, bit 1 to value 1 etc. > > > > > > maybe that would have been easier on the eyes - I didn't try, > > I'm not even sure. > > > > But what you have is correct enough, we can always try to > > improve the wording later. > > > > > > > > > > > > > > + > > > > +\begin{lstlisting} > > > > +#define VIRTIO_NET_HASH_REPORT_NONE 0 > > > > +#define VIRTIO_NET_HASH_REPORT_IPv4 1 > > > > +#define VIRTIO_NET_HASH_REPORT_TCPv4 2 > > > > +#define VIRTIO_NET_HASH_REPORT_UDPv4 3 > > > > +#define VIRTIO_NET_HASH_REPORT_IPv6 4 > > > > +#define VIRTIO_NET_HASH_REPORT_TCPv6 5 > > > > +#define VIRTIO_NET_HASH_REPORT_UDPv6 6 > > > > +#define VIRTIO_NET_HASH_REPORT_IPv6_EX 7 > > > > +#define VIRTIO_NET_HASH_REPORT_TCPv6_EX 8 > > > > +#define VIRTIO_NET_HASH_REPORT_UDPv6_EX 9 > > > > +\end{lstlisting} > > > > + > > > > \subsubsection{Control Virtqueue}\label{sec:Device Types / Network > > > Device / Device Operation / Control Virtqueue} > > > > > > > > The driver uses the control virtqueue (if VIRTIO_NET_F_CTRL_VQ is > > > > @@ -3896,6 +4064,7 @@ \subsubsection{Control Virtqueue}\label > > {sec:Device > > > Types / Network Device / Devi > > > > #define VIRTIO_NET_CTRL_MQ 4 > > > > #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) > > > > + #define VIRTIO_NET_CTRL_MQ_HASH_CONFIG 2 (for > > configurable hash > > > calculation) > > > > \end{lstlisting} > > > > > > > > If more than one multiqueue mode is negotiated, the resulting > > device > > > configuration is defined by the last command sent by the driver. > > > > @@ -3961,10 +4130,37 @@ \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. > > > > > > > > +\subparagraph{Hash calculation}\label{sec:Device Types / Network > > Device > > > / Device Operation / Control Virtqueue / Automatic receive steering > > in > > > multiqueue mode / Hash calculation} > > > > +If VIRTIO_NET_F_HASH_REPORT was negotiated and the device uses > > automatic > > > receive steering, > > > > +the device MUST support a command to configure hash calculation > > > parameters. > > > > + > > > > +The driver provides parameters for hash calculation as follows: > > > > + > > > > +\field{class} VIRTIO_NET_CTRL_MQ, \field{command} > > > VIRTIO_NET_CTRL_MQ_HASH_CONFIG. > > > > + > > > > +The \field{command-specific-data} has following format: > > > > +\begin{lstlisting} > > > > +struct virtio_net_hash_config { > > > > + le32 hash_types; > > > > + le16 reserved[4]; > > > > + 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 / > > Processing > > > of Incoming Packets / Hash calculation for incoming packets / > > Supported/ > > > enabled hash types}. > > > > +Initially the device has all hash types disabled and reports only > > > VIRTIO_NET_HASH_REPORT_NONE. > > > > + > > > > +Field \field{reserved} MUST contain zeroes. It is defined to make > > the > > > structure to match the layout of virtio_net_rss_config structure, > > > > +defined in \ref{sec:Device Types / Network Device / Device > > Operation / > > > Control Virtqueue / Receive-side scaling (RSS)}. > > > > + > > > > +Fields \field{hash_key_length} and \field{hash_key_data} define > > the key > > > to be used in hash calculation. > > > > + > > > > \paragraph{Receive-side scaling (RSS)}\label{sec:Device Types / > > Network > > > Device / Device Operation / Control Virtqueue / Receive-side scaling > > (RSS)} > > > > A device offers the 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} > > > > +A driver queries RSS capabilities of the device by reading device > > > configuration as defined in \ref{sec:Device Types / Network Device / > > Device > > > configuration layout} > > > > > > > > \subparagraph{Setting RSS parameters}\label{sec:Device Types / > > Network > > > Device / Device Operation / Control Virtqueue / Receive-side scaling > > (RSS) > > > / Setting RSS parameters} > > > > > > > > @@ -3981,7 +4177,8 @@ \subsubsection{Control Virtqueue}\label > > {sec:Device > > > Types / Network Device / Devi > > > > }; > > > > \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}. > > > > +defined in > > > > +\ref{sec:Device Types / Network Device / Device Operation / > > Processing > > > of Incoming Packets / Hash calculation for incoming packets / > > Supported/ > > > enabled hash types}. > > > > > > > > Field \field{indirection_table_mask} is a mask to be applied to > > > > the calculated hash to produce an index in the > > > > @@ -3995,93 +4192,7 @@ \subsubsection{Control Virtqueue}\label > > {sec:Device > > > Types / Network Device / Devi > > > > > > > > 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 the hash on IPv4 packets according to the > > > > -field \field{hash_types} of the virtio_net_rss_config structure as > > > follows: > > > > -\begin{itemize} > > > > -\item If VIRTIO_NET_RSS_HASH_TYPE_TCPv4 is set and the packet has > > > > -a TCP header, the hash is calculated over the 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 a UDP header, the hash is calculated over the 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 > > > > -calculated over the 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} > > > > - > > > > -\label{itm:Device Types / Network Device / Device Operation / > > Control > > > Virtqueue / Receive-side scaling (RSS) / RSS hash types/hash on IPv6 > > > packets without extension headers} > > > > -The device calculates the hash on IPv6 packets without extension > > > > -headers according to the field \field{hash_types} of the > > > virtio_net_rss_config structure as follows: > > > > -\begin{itemize} > > > > -\item If VIRTIO_NET_RSS_HASH_TYPE_TCPv6 is set and the packet has > > > > -a TCPv6 header, the hash is calculated over the 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 a UDPv6 header, the hash is calculated over the > > 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 > > > > -calculated over the 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 the hash on IPv6 packets with extension > > > > -headers according to the field \field{hash_types} of the > > > virtio_net_rss_config structure as follows: > > > > -\begin{itemize} > > > > -\item If VIRTIO_NET_RSS_HASH_TYPE_TCP_EX is set and the packet > > > > -has a TCPv6 header, the hash is calculated over the following > > fields: > > > > -\begin{itemize} > > > > -\item Home address from the home address option in the IPv6 > > destination > > > 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 TCP port > > > > -\item Destination TCP port > > > > -\end{itemize} > > > > -\item Else if VIRTIO_NET_RSS_HASH_TYPE_UDP_EX is set and the > > > > -packet has a UDPv6 header, the hash is calculated over the > > following > > > fields: > > > > -\begin{itemize} > > > > -\item Home address from the home address option in the IPv6 > > destination > > > 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 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 the following fields: > > > > -\begin{itemize} > > > > -\item Home address from the home address option in the IPv6 > > destination > > > 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. > > > > -\end{itemize} > > > > -\item Else skip IPv6 extension headers and calculate the hash as > > > > -defined for an IPv6 packet without extension headers (see \ref > > > {itm:Device Types / Network Device / Device Operation / Control > > Virtqueue / > > > Receive-side scaling (RSS) / RSS hash types/hash on IPv6 packets > > without > > > extension headers}). > > > > -\end{itemize} > > > > +Fields \field{hash_key_length} and \field{hash_key_data} define > > the key > > > to be used in hash calculation. > > > > > > > > \drivernormative{\subparagraph}{Setting RSS parameters}{Device > > Types / > > > Network Device / Device Operation / Control Virtqueue / Receive-side > > > scaling (RSS) } > > > > > > > > @@ -4093,12 +4204,12 @@ \subsubsection{Control Virtqueue}\label > > > {sec:Device Types / Network Device / Devi > > > > > > > > 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. > > > > +A driver MUST NOT set any VIRTIO_NET_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 > > (RSS) > > > / RSS processing} > > > > The device MUST determine the destination queue for a network > > packet as > > > follows: > > > > \begin{itemize} > > > > -\item Calculate the 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 Calculate the hash of the packet as defined in \ref > > {sec:Device > > > Types / Network Device / Device Operation / Processing of Incoming > > Packets > > > / Hash calculation for incoming packets}. > > > > \item If the device did not calculate the hash for the 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{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} > > > > -- > > > > 2.17.1 > > > > > > > > > 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-l= ists > Committee: https://www.oasis-open.org/committees/virtio/ > Join OASIS: https://www.oasis-open.org/join/ ------=_Part_7345660_715052899.1582175341195 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable



= From: "Michael S. Tsirkin" <mst@redhat.com>
To: "Yur= i Benditovich" <ybendito@redhat.com>
Cc: "Yuri Benditovich"= <yuri.benditovich@daynix.com>, virtio-comment@lists.oasis-open.orgSent: Wednesday, February 19, 2020 4:56:04 PM
Subject: R= e: [virtio-comment] Re: [PATCH v4 1/1] virtio-net: Define per-packet hash r= eporting feature

On Wed, Feb 19, 2020 at 09:49:37AM -0500= , Yuri Benditovich wrote:
>
>
> =E2=94=81=E2=94=81=E2= =94=81=E2=94=81=E2=94=81=E2=94=81=E2=94=81=E2=94=81=E2=94=81=E2=94=81=E2=94= =81=E2=94=81=E2=94=81=E2=94=81=E2=94=81=E2=94=81=E2=94=81=E2=94=81=E2=94=81= =E2=94=81=E2=94=81=E2=94=81=E2=94=81=E2=94=81=E2=94=81=E2=94=81=E2=94=81=E2= =94=81=E2=94=81=E2=94=81=E2=94=81=E2=94=81=E2=94=81=E2=94=81=E2=94=81=E2=94= =81=E2=94=81=E2=94=81=E2=94=81=E2=94=81=E2=94=81=E2=94=81=E2=94=81=E2=94=81= =E2=94=81=E2=94=81=E2=94=81=E2=94=81=E2=94=81=E2=94=81=E2=94=81=E2=94=81=E2= =94=81=E2=94=81=E2=94=81=E2=94=81=E2=94=81=E2=94=81=E2=94=81=E2=94=81=E2=94= =81=E2=94=81=E2=94=81=E2=94=81=E2=94=81=E2=94=81=E2=94=81=E2=94=81=E2=94=81= =E2=94=81=E2=94=81=E2=94=81=E2=94=81=E2=94=81=E2=94=81=E2=94=81=E2=94=81=E2= =94=81=E2=94=81
>
>     From: "Michael S. Tsirkin" &= lt;mst@redhat.com>
>     To: "Yuri Benditovich" <yben= dito@redhat.com>
>     Cc: "Yuri Benditovich" <yuri.b= enditovich@daynix.com>,
>     virtio-comment@lists.oasis= -open.org
>     Sent: Wednesday, February 19, 2020 4:35:49 = PM
>     Subject: Re: [virtio-comment] Re: [PATCH v4 1/1] v= irtio-net: Define
>     per-packet hash reporting feature>
>     On Wed, Feb 19, 2020 at 06:07:13AM -0500, Yur= i Benditovich wrote:
>     >
>     ><= br>>     >
>     =E2=94=81=E2=94=81=E2=94= =81=E2=94=81=E2=94=81=E2=94=81=E2=94=81=E2=94=81=E2=94=81=E2=94=81=E2=94=81= =E2=94=81=E2=94=81=E2=94=81=E2=94=81=E2=94=81=E2=94=81=E2=94=81=E2=94=81=E2= =94=81=E2=94=81=E2=94=81=E2=94=81=E2=94=81=E2=94=81=E2=94=81=E2=94=81=E2=94= =81=E2=94=81=E2=94=81=E2=94=81=E2=94=81=E2=94=81=E2=94=81=E2=94=81=E2=94=81= =E2=94=81=E2=94=81=E2=94=81=E2=94=81=E2=94=81=E2=94=81=E2=94=81=E2=94=81=E2= =94=81=E2=94=81=E2=94=81=E2=94=81=E2=94=81=E2=94=81=E2=94=81=E2=94=81=E2=94= =81=E2=94=81=E2=94=81=E2=94=81=E2=94=81=E2=94=81=E2=94=81=E2=94=81=E2=94=81= =E2=94=81=E2=94=81=E2=94=81=E2=94=81=E2=94=81=E2=94=81=E2=94=81=E2=94=81=E2= =94=81=E2=94=81=E2=94=81=E2=94=81=E2=94=81=E2=94=81=E2=94=81=E2=94=81=E2=94= =81=E2=94=81
>     >
>     >   &= nbsp; From: "Michael S. Tsirkin" <mst@redhat.com>
>   &nbs= p; >     To: "Yuri Benditovich" <yuri.benditovich@daynix.co= m>
>     >     Cc: virtio-comment@lists.oas= is-open.org
>     >     Sent: Wednesday, Febru= ary 19, 2020 11:12:40 AM
>     >     Subject: = [virtio-comment] Re: [PATCH v4 1/1] virtio-net: Define
>    = ; per-packet
>     >     hash reporting featur= e
>     >
>     >     On We= d, Feb 19, 2020 at 09:53:37AM +0200, Yuri Benditovich wrote:
>  =   >     > Fixes: https://github.com/oasis-tcs/virtio-= spec/issues/66
>     >     > Define respect= ive feature bit for virtio-net.
>     >     &g= t; Extend packet layout to populate hash value and type.
>   &nb= sp; >     > Move the definition of IP/TCP/UDP header fields= to
>     >     > calculate the hash out of= RSS section to common network
>     >     >= ; device section.
>     >     >
> &nb= sp;   >     > Signed-off-by: Yuri Benditovich <yuri= .benditovich@daynix.com>
>     >     > -= --
>     >     >  content.tex | 347>     ++++++++++++++++++++++++++++++++++------------------>     >     >  1 file changed, 229 inser= tions(+), 118 deletions(-)
>     >     >>     >     > diff --git a/content.tex b/cont= ent.tex
>     >     > index b91a132..d7d4e4= 2 100644
>     >     > --- a/content.tex>     >     > +++ b/content.tex
>  = ;   >     > @@ -2895,6 +2895,9 @@ \subsection{Feature = bits}\label{sec:Device
>     Types /
>     = >     Network Device / Feature bits
>     >=     >  \item[VIRTIO_NET_F_CTRL_MAC_ADDR(23)] Set MAC add= ress through
>     control
>     >  = ;   >      channel.
>     >  = ;   >  
>     >     > +\item[V= IRTIO_NET_F_HASH_REPORT(57)] Device can report per-packet
>   &n= bsp; hash
>     >     > +    valu= e and a type of calculated hash.
>     >     &= gt; +
>     >     >  \item[VIRTIO_NET_= F_GUEST_HDRLEN(59)] Driver can provide the exact
>     \fie= ld
>     >     {hdr_len}
>    = >     >      value. Device benefits from kn= owing the exact header length.
>     >     >= ;  
>     >     > @@ -2995,35 +2998,17= @@ \subsection{Device configuration layout}\
>     label>     >     {sec:Device Types / Network Device<= br>>     >     >         &= nbsp;le32 supported_hash_types;
>     >     &g= t;  };
>     >     >  \end{lstlis= ting}
>     >     > -\label{sec:Device Type= s / Network Device / Device configuration
>     layout />     >     RSS}
>     > &nbs= p;   > -Three following fields, \field{rss_max_key_size}, \field>     >     {rss_max_indirection_table_length}>     >     > -and \field{supported_hash_typ= es} only exist if VIRTIO_NET_F_RSS is
>     set.
> &n= bsp;   >     > +The following field, \field{rss_max_ke= y_size} only exist if
>     >     VIRTIO_NET_F= _RSS or VIRTIO_NET_F_HASH_REPORT is set.
>     >   =   > +It specifies the maximal supported length of RSS key in bytes.=
>     >     >  
>    = >     > -Field \field{rss_max_key_size} specifies the maxi= mal supported
>     length of
>     > &n= bsp;   RSS key in bytes.
>     >     >= +The following field, \field{rss_max_indirection_table_length} only
>= ;     exist
>     >     if VIRTIO_NE= T_F_RSS is set.
>     >     > +It specifies= the maximal number of 16-bit entries in RSS
>     indirect= ion
>     >     table.
>     &= gt;     >  
>     >     >= -Field \field{rss_max_indirection_table_length} specifies the
> &nbs= p;   maximal
>     >     number of 16-bit= entries in RSS indirection table.
>     >    = > +The next field, \field{supported_hash_types} exists only if the
&= gt;     device
>     >     supports = hash calculation,
>     >     > +i.e. if VI= RTIO_NET_F_RSS or VIRTIO_NET_F_HASH_REPORT is set.
>     &g= t;     >  
>     >     > = -Field \field{supported_hash_types} contains the bitmask of
>   =   supported RSS
>     >     hash types.>     >     > -
>     > &= nbsp;   > -Hash types applicable for IPv4 packets:
>   &= nbsp; >     > -\begin{lstlisting}
>     >= ;     > -#define VIRTIO_NET_RSS_HASH_TYPE_IPv4     &= nbsp;        (1 << 0)
>     > =     > -#define VIRTIO_NET_RSS_HASH_TYPE_TCPv4     &n= bsp;       (1 << 1)
>     >   =   > -#define VIRTIO_NET_RSS_HASH_TYPE_UDPv4       &n= bsp;     (1 << 2)
>     >     = > -\end{lstlisting}
>     >     > -Hash = types applicable for IPv6 packets without extension headers
>   =   >     > -\begin{lstlisting}
>     &g= t;     > -#define VIRTIO_NET_RSS_HASH_TYPE_IPv6     =          (1 << 3)
>     >=     > -#define VIRTIO_NET_RSS_HASH_TYPE_TCPv6     &= nbsp;       (1 << 4)
>     >  =   > -#define VIRTIO_NET_RSS_HASH_TYPE_UDPv6       &= nbsp;     (1 << 5)
>     >    = > -\end{lstlisting}
>     >     > -Hash= types applicable for IPv6 packets with extension headers
>   &n= bsp; >     > -\begin{lstlisting}
>     >=     > -#define VIRTIO_NET_RSS_HASH_TYPE_IP_EX     &= nbsp;       (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 the exa= ct meaning of VIRTIO_NET_RSS_HASH_TYPE_ flags see \ref
>    = ; >     {sec:Device Types / Network Device / Device Operation = / Control
>     Virtqueue /
>     > &nbs= p;   Receive-side scaling (RSS) / RSS hash types}.
>   &nbs= p; >     > +Field \field{supported_hash_types} contains the= bitmask of
>     supported
>     > &nbs= p;   hash types.
>     >     > +See \r= ef{sec:Device Types / Network Device / Device Operation /
>   &n= bsp; >     Processing of Incoming Packets / Hash calculation f= or incoming
>     packets /
>     > &nbs= p;   Supported/enabled hash types} for details of supported hash types= .
>     >     >  
>    = ; >     >  \devicenormative{\subsubsection}{Device con= figuration layout}
>     {Device
>     >=     Types / Network Device / Device configuration layout}
>= ;     >     >  
>     > &= nbsp;   > @@ -3048,7 +3033,7 @@ \subsection{Device configuration la= yout}\
>     label
>     >    = {sec:Device Types / Network Device
>     >    = ; >  negotiated.
>     >     > &nbs= p;
>     >     >  The device MUST set = \field{rss_max_key_size} to at least 40, if it
>     > &= nbsp;   offers
>     >     > -VIRTIO_N= ET_F_RSS.
>     >     > +VIRTIO_NET_F_RSS o= r VIRTIO_NET_F_HASH_REPORT.
>     >     > &= nbsp;
>     >     >  The device MUST s= et \field{rss_max_indirection_table_length} to at
>     lea= st
>     >     128, if it offers
>  = ;   >     >  VIRTIO_NET_F_RSS.
>   &nb= sp; >     > @@ -3195,6 +3180,8 @@ \subsection{Device Operat= ion}\label
>     {sec:Device
>     > &nb= sp;   Types / Network Device / Device O
>     > &nb= sp;   >          le16 csum_start;
> =     >     >          le1= 6 csum_offset;
>     >     >     =      le16 num_buffers;
>     >   &nb= sp; > +        le32 hash_value; (Only if VIRTIO_NET_= F_HASH_REPORT
>     negotiated)
>     > =     > +        le16 hash_type;  (Only= if VIRTIO_NET_F_HASH_REPORT
>     negotiated)
> &nbs= p;   >     >  };
>     >
&g= t;     >     Just noticed this - it's a bit problema= tic as it might force
>     >     compilers to= add 2 bytes of padding at the end. Let's add extra 2
>    = bytes
>     >     of padding explicitly?
&= gt;     >
>     > OK, no problem
> &n= bsp;   >
>     >
>     >
&= gt;     >
>     >     >  = \end{lstlisting}
>     >     >  
&g= t;     >     > @@ -3517,6 +3504,12 @@ \subsubsect= ion{Processing of Incoming
>     Packets}\
>   &= nbsp; >     label{sec:Device Types / Network
>   &n= bsp; >     >  
>     >    = ; >  \end{enumerate}
>     >     > =  
>     >     > +If applicable, the de= vice calculates per-packet hash for incoming
>     > &nb= sp;   packets as
>     >     > +define= d in \ref{sec:Device Types / Network Device / Device
>     = Operation /
>     >     Processing of Incoming= Packets / Hash calculation for incoming
>     packets}.>     >     > +
>     > &n= bsp;   > +If applicable, the device reports hash information for in= coming
>     packets
>     >   &nbs= p; as
>     >     > +defined in \ref{sec:De= vice Types / Network Device / Device
>     Operation /
&= gt;     >     Processing of Incoming Packets / Hash = reporting for incoming
>     packets}.
>    = ; >     > +
>     >     > &= nbsp;\devicenormative{\paragraph}{Processing of Incoming Packets}
> &= nbsp;   {Device
>     >     Types / Netwo= rk Device / Device Operation / Processing of Incoming
>    = Packets}
>     >     >  \label{device= normative:Device Types / Network Device / Device
>     Oper= ation
>     >     / Processing of Packets}%old= label for latexdiff
>     >     >  >     >     > @@ -3619,6 +3612,181 @@ \subsu= bsection{Processing of Incoming
>     Packets}\
> &nb= sp;   >     label{sec:Device Types / Network
> &nbs= p;   >     >  If neither VIRTIO_NET_HDR_F_NEEDS_C= SUM nor
>     >     >  VIRTIO_NET_HDR_= F_DATA_VALID is set, the driver MUST NOT
>     >   =   >  rely on the packet checksum being correct.
>  =   >     > +
>     >     = > +\paragraph{Hash calculation for incoming packets}
>   &nbs= p; >     > +\label{sec:Device Types / Network Device / Devi= ce Operation /
>     Processing
>     > =     of Incoming Packets / Hash calculation for incoming packets}<= br>>     >     > +
>     > =     > +A device attempts to calculate a per-packet hash in the= following
>     cases:
>     >   &= nbsp; > +\begin{itemize}
>     >     > += \item The feature VIRTIO_NET_F_RSS was negotiated. The device uses
> =     the
>     >     hash to determin= e the receive virtqueue to place incoming packets.
>     &g= t;     > +\item The feature VIRTIO_NET_F_HASH_REPORT was negot= iated. The
>     device
>     >   &= nbsp; reports the hash value and the hash type with the packet.
> &nb= sp;   >     > +\end{itemize}
>     >= ;     > +
>     >     > +If th= e feature VIRTIO_NET_F_RSS was negotiated:
>     >  = ;   > +\begin{itemize}
>     >     >= ; +\item The device uses \field{hash_types} of the
>     vi= rtio_net_rss_config
>     >     structure as '= Enabled hash types' bitmask.
>     >     > = +\item The device uses a key as defined in \field{hash_key_data}
> &n= bsp;   and \
>     >     field{hash_key_l= ength} of the virtio_net_rss_config structure (see
>     &g= t;     > +\ref{sec:Device Types / Network Device / Device Oper= ation /
>     Control
>     >   &nb= sp; Virtqueue / Receive-side scaling (RSS) / Setting RSS parameters}).
&= gt;     >     > +\end{itemize}
>   &nb= sp; >     > +
>     >     >= +If the feature VIRTIO_NET_F_RSS was not negotiated:
>    = >     > +\begin{itemize}
>     >  =   > +\item The device uses \field{hash_types} of the
>  = ;   virtio_net_hash_config
>     >     st= ructure as 'Enabled hash types' bitmask.
>     >   =   > +\item The device uses a key as defined in \field{hash_key_data= }
>     and \
>     >     fiel= d{hash_key_length} of the virtio_net_hash_config structure (see
> &nb= sp;   >     > +\ref{sec:Device Types / Network Device = / Device Operation /
>     Control
>     &g= t;     Virtqueue / Automatic receive steering in multiqueue mode = / Hash
>     >     calculation}).
> &nbs= p;   >     > +\end{itemize}
>     >=     > +
>     >     > +Note t= hat if the device offers VIRTIO_NET_F_HASH_REPORT, even if
>   &= nbsp; it
>     >     supports only one pair of= virtqueues, it MUST support
>     >     > = +at least one of commands of VIRTIO_NET_CTRL_MQ class to configure
> =     >     reported hash parameters:
>   &= nbsp; >     > +\begin{itemize}
>     > &= nbsp;   > +\item If the device offers VIRTIO_NET_F_RSS, it MUST sup= port
>     >     VIRTIO_NET_CTRL_MQ_RSS_CONFIG= command per
>     >     > + \ref{sec:Devic= e Types / Network Device / Device Operation /
>     Control=
>     >     Virtqueue / Receive-side scaling = (RSS) / Setting RSS parameters}.
>     >     &= gt; +\item Otherwise the device MUST support
>     VIRTIO_N= ET_CTRL_MQ_HASH_CONFIG
>     >     command per=
>     >     > + \ref{sec:Device Types / Ne= twork Device / Device Operation /
>     Control
> &nb= sp;   >     Virtqueue / Automatic receive steering in mul= tiqueue mode / Hash
>     >     calculation}.<= br>>     >     > +\end{itemize}
>  =   >     > +
>     >     = > +\subparagraph{Supported/enabled hash types}
>     >= ;     > +\label{sec:Device Types / Network Device / Device Ope= ration /
>     Processing
>     >  =   of Incoming Packets / Hash calculation for incoming packets /
&g= t;     Supported/
>     >     enable= d hash types}
>     >     > +Hash types app= licable for IPv4 packets:
>     >     > +\b= egin{lstlisting}
>     >     > +#define VIR= TIO_NET_HASH_TYPE_IPv4              (1 &= lt;< 0)
>     >     > +#define VIRTIO_NE= T_HASH_TYPE_TCPv4             (1 << 1)<= br>>     >     > +#define VIRTIO_NET_HASH_TYPE= _UDPv4             (1 << 2)
> &nb= sp;   >     > +\end{lstlisting}
>     = >     > +Hash types applicable for IPv6 packets without ext= ension headers
>     >     > +\begin{lstlis= ting}
>     >     > +#define VIRTIO_NET_HAS= H_TYPE_IPv6              (1 << 3)<= br>>     >     > +#define VIRTIO_NET_HASH_TYPE= _TCPv6             (1 << 4)
> &nb= sp;   >     > +#define VIRTIO_NET_HASH_TYPE_UDPv6 &nbs= p;           (1 << 5)
>     = >     > +\end{lstlisting}
>     >  =   > +Hash types applicable for IPv6 packets with extension headers=
>     >     > +\begin{lstlisting}
> =     >     > +#define VIRTIO_NET_HASH_TYPE_IP_EX &= nbsp;           (1 << 6)
>   &nbs= p; >     > +#define VIRTIO_NET_HASH_TYPE_TCP_EX   &nbs= p;        (1 << 7)
>     > &nb= sp;   > +#define VIRTIO_NET_HASH_TYPE_UDP_EX       &= nbsp;    (1 << 8)
>     >     = > +\end{lstlisting}
>     >     > +
&= gt;     >     > +\subparagraph{IPv4 packets}
&= gt;     >     > +\label{sec:Device Types / Networ= k Device / Device Operation /
>     Processing
> &nbs= p;   >     of Incoming Packets / Hash calculation for inc= oming packets / IPv4
>     packets}
>     &= gt;     > +The device calculates the hash on IPv4 packets acco= rding to
>     'Enabled
>     >   &= nbsp; hash types' bitmask as follows:
>     >   &nb= sp; > +\begin{itemize}
>     >     > +\i= tem If VIRTIO_NET_HASH_TYPE_TCPv4 is set and the packet has
>   =   >     > +a TCP header, the hash is calculated over t= he following fields:
>     >     > +\begin{= itemize}
>     >     > +\item Source IP add= ress
>     >     > +\item Destination IP ad= dress
>     >     > +\item Source TCP port<= br>>     >     > +\item Destination TCP port>     >     > +\end{itemize}
>   =   >     > +\item Else if VIRTIO_NET_HASH_TYPE_UDPv4 is= set and the
>     >     > +packet has a UD= P header, the hash is calculated over the following
>     &= gt;     fields:
>     >     > +\b= egin{itemize}
>     >     > +\item Source I= P address
>     >     > +\item Destination = IP address
>     >     > +\item Source UDP = port
>     >     > +\item Destination UDP p= ort
>     >     > +\end{itemize}
> &n= bsp;   >     > +\item Else if VIRTIO_NET_HASH_TYPE_IPv= 4 is set, the hash is
>     >     > +calcul= ated over the following fields:
>     >     &g= t; +\begin{itemize}
>     >     > +\item So= urce IP address
>     >     > +\item Destin= ation IP address
>     >     > +\end{itemiz= e}
>     >     > +\item Else the device doe= s not calculate the hash
>     >     > +\en= d{itemize}
>     >     > +
>   &= nbsp; >     > +\subparagraph{IPv6 packets without extension= header}
>     >     > +\label{sec:Device T= ypes / Network Device / Device Operation /
>     Processing=
>     >     of Incoming Packets / Hash calcul= ation for incoming packets / IPv6
>     packets
> &nb= sp;   >     without extension header}
>   &nbs= p; >     > +The device calculates the hash on IPv6 packets = without extension
>     >     > +headers ac= cording to 'Enabled hash types' bitmask as follows:
>     &= gt;     > +\begin{itemize}
>     >   &= nbsp; > +\item If VIRTIO_NET_HASH_TYPE_TCPv6 is set and the packet has>     >     > +a TCPv6 header, the hash is c= alculated over the following fields:
>     >   &nbs= p; > +\begin{itemize}
>     >     > +\it= em Source IPv6 address
>     >     > +\item= Destination IPv6 address
>     >     > +\i= tem Source TCP port
>     >     > +\item De= stination TCP port
>     >     > +\end{item= ize}
>     >     > +\item Else if VIRTIO_NE= T_HASH_TYPE_UDPv6 is set and the
>     >     &= gt; +packet has a UDPv6 header, the hash is calculated over the
> &nb= sp;   following
>     >     fields:
&g= t;     >     > +\begin{itemize}
>   &n= bsp; >     > +\item Source IPv6 address
>   &nbs= p; >     > +\item Destination IPv6 address
>   &= nbsp; >     > +\item Source UDP port
>     = >     > +\item Destination UDP port
>     &= gt;     > +\end{itemize}
>     >   &nb= sp; > +\item Else if VIRTIO_NET_HASH_TYPE_IPv6 is set, the hash is
&g= t;     >     > +calculated over the following fie= lds:
>     >     > +\begin{itemize}
>=     >     > +\item Source IPv6 address
> &= nbsp;   >     > +\item Destination IPv6 address
>= ;     >     > +\end{itemize}
>    = ; >     > +\item Else the device does not calculate the has= h
>     >     > +\end{itemize}
> &nbs= p;   >     > +
>     >    = ; > +\subparagraph{IPv6 packets with extension header}
>   &n= bsp; >     > +\label{sec:Device Types / Network Device / De= vice Operation /
>     Processing
>     >= ;     of Incoming Packets / Hash calculation for incoming packets= / IPv6
>     packets
>     >   &nb= sp; with extension header}
>     >     > +T= he device calculates the hash on IPv6 packets with extension
>  =   >     > +headers according to 'Enabled hash types' = bitmask as follows:
>     >     > +\begin{i= temize}
>     >     > +\item If VIRTIO_NET_= HASH_TYPE_TCP_EX is set and the packet
>     >   &n= bsp; > +has a TCPv6 header, the hash is calculated over the following>     fields:
>     >     > += \begin{itemize}
>     >     > +\item Home a= ddress from the home address option in the IPv6
>     desti= nation
>     >     options header. If the exte= nsion header is not present, use the
>     Source IPv6
&= gt;     >     address.
>     > &n= bsp;   > +\item IPv6 address that is contained in the Routing-Heade= r-Type-2
>     from
>     >    = ; the associated extension header. If the extension header is not
> &= nbsp;   present,
>     >     use the Dest= ination IPv6 address.
>     >     > +\item = Source TCP port
>     >     > +\item Destin= ation TCP port
>     >     > +\end{itemize}=
>     >     > +\item Else if VIRTIO_NET_HA= SH_TYPE_UDP_EX is set and the
>     >     >= +packet has a UDPv6 header, the hash is calculated over the
>  =   following
>     >     fields:
> =     >     > +\begin{itemize}
>    = ; >     > +\item Home address from the home address option = in the IPv6
>     destination
>     > &n= bsp;   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<= br>>     >     the associated extension header. I= f the extension header is not
>     present,
>  =   >     use the Destination IPv6 address.
>  =   >     > +\item Source UDP port
>    = ; >     > +\item Destination UDP port
>    = >     > +\end{itemize}
>     >   &= nbsp; > +\item Else if VIRTIO_NET_HASH_TYPE_IP_EX is set, the hash is>     >     > +calculated over the following = fields:
>     >     > +\begin{itemize}
&= gt;     >     > +\item Home address from the home= address option in the IPv6
>     destination
>  = ;   >     options header. If the extension header is not = present, use the
>     Source IPv6
>     &g= t;     address.
>     >     > +\i= tem IPv6 address that is contained in the Routing-Header-Type-2
> &nb= sp;   from
>     >     the associated ext= ension header. If the extension header is not
>     present= ,
>     >     use the Destination IPv6 address= .
>     >     > +\end{itemize}
> &nbs= p;   >     > +\item Else skip IPv6 extension headers a= nd calculate the hash as
>     >     > +def= ined for an IPv6 packet without extension headers
>     >= ;     > +(see \ref{sec:Device Types / Network Device / Device = Operation /
>     >     Processing of Incoming= Packets / Hash calculation for incoming
>     packets />     >     IPv6 packets without extension heade= r}).
>     >     > +\end{itemize}
> &= nbsp;   >     > +
>     >   &n= bsp; > +\paragraph{Hash reporting for incoming packets}
>   &= nbsp; >     > +\label{sec:Device Types / Network Device / D= evice Operation /
>     Processing
>     &g= t;     of Incoming Packets / Hash reporting for incoming packets}=
>     >     > +
>     >=     > +If VIRTIO_NET_F_HASH_REPORT was negotiated and
>=     >     > + the device has calculated the hash= for the packet, the device
>     fills \
>   &n= bsp; >     field{hash_type} with the type of calculated hash>     >     > +and \field{hash_value} with t= he value of calculated hash.
>     >     > = +
>     >     > +If VIRTIO_NET_F_HASH_REPOR= T was negotiated but due to any reason
>     the
> &n= bsp;   >     > +hash was not calculated, the device se= ts \field{hash_type} to
>     >     VIRTIO_NET= _HASH_REPORT_NONE.
>     >     > +
> =     >     > +Possible values that the device can = report in \field{hash_type}
>     are
>    = >     defined below.
>     >    = > +They correspond to supported hash types defined in
>   &n= bsp; >     > +\ref{sec:Device Types / Network Device / Devi= ce Operation /
>     Processing
>     > =     of Incoming Packets / Hash calculation for incoming packets /=
>     Supported/
>     >     = enabled hash types}
>     >     > +as follo= ws:
>     >     > +
>     &= gt;     > +VIRTIO_NET_HASH_TYPE_XXX =3D 1 << (VIRTIO_NET= _HASH_REPORT_XXX - 1)
>     >
>     >=
>     >     So hash_type is the HASH_REPORT v= alue then? That's quite confusing.
>     >    = Let's rename to hash_report?
>     >
>   &nb= sp; > No problem to rename anything, but I'd like to do it one time.
= >     > Currently meaningful hash report values are (1..9),= 0 for none
>     > They correspond to bitmask of 9 bits= for enabled/supported.
>     > It was possible to use t= he same definitions for enable/support/report
>     > bu= t then reported kind of hash should be 4 bytes.
>     > = As you anyway suggests padding at the end of the packet, we can do that,>     > i.e. add (32 bit hash + 32 bit type)
>
&= gt;     We can but it seems like a waste, does it not? padding ca= n be used for
>     something later ...
>
> &n= bsp;   > Or if we stay with the values as they are now:
> &nb= sp;   > values 0..9 - VIRTIO_NET_WHAT?
>
>   &nbs= p; I thought that's VIRTIO_NET_HASH_REPORT_XXX
>
> OK, this is= exactly what is defined
>
>
>     > bits = from 0 to 8 - VIRTIO_NET_WHAT?
>
>
>     and = this one VIRTIO_NET_HASH_TYPE_XXX?
>
> OK, this is also exactl= y what is defined
>


Right I'm saying what's de= fined is fine, just call the fields
consistently.

>=
>
>     Generally what you did here is a bit unusu= al. Mostly we just define
>     bit numbers
>   =           #define VIRTIO_SCSI_F_INOUT    = ;                0
>   &= nbsp;         #define VIRTIO_SCSI_F_HOTPLUG   &nbs= p;              1
>     =         #define VIRTIO_SCSI_F_CHANGE     &nbs= p;             2
>      =       #define VIRTIO_SCSI_F_T10_PI       &nb= sp;           3
>
>
> Value 0 = of hash_report is "no hash calculated" and it does not
> participate = in support/enable mask. I did not want to
> use value other than zero= for "no hash".

Oh right.

> So you w= ant bit 0 to be reserved (not used) in enable/support mask
> and then= to have all the VIRTIO_NET_HASH_TYPE_XXX to be
> exactly 1 << = VIRTIO_NET_HASH_REPORT_XXX? Just say...
>

We can d= o that too but it's up to you really.

So fixing the below= you would say
         bit 0 cu= rresponding to value 1,
        = bit 1 corresponding to value 2 etc.
      = ;   No bit corresponds to value 0
?
= Currently defined:

Reports:
VIRTIO_NET_HA= SH_REPORT_NONE          &= nbsp; 0
VIRTIO_NET_HASH_REPORT_IPv4      &= nbsp;     1
VIRTIO_NET_HASH_REPORT_UDPv4  =          3
VIRTIO_NET= _HASH_REPORT_UDPv6_EX        9

Bitmask (VIRTIO_NET_HASH_TYPE_XXX =3D 1 << (VIRTIO_NET_HASH_= REPORT_XXX - 1)):
VIRTIO_NET_HASH_TYPE_IPv4 =3D (1 << 0)
VIRTIO_NET_HASH_TYPE_UDPv4 =3D (1 << 2)
VIRTIO_= NET_HASH_TYPE_UDP_EX =3D (1 << 8)


=
How you want it to be changed?
Can you please write here= in the same format?


>
>     and j= ust say that bit numbers are from this table, with bit
>    = ; 0 corresponding to the value 0, bit 1 to value 1 etc.
>
> >     maybe that would have been easier on the eyes - I didn= 't try,
>     I'm not even sure.
>
>   &n= bsp; But what you have is correct enough, we can always try to
> &nbs= p;   improve the wording later.
>
>
>    = ; >
>     >
>     >     = > +
>     >     > +\begin{lstlisting}>     >     > +#define VIRTIO_NET_HASH_REPORT= _NONE            0
>     >=     > +#define VIRTIO_NET_HASH_REPORT_IPv4     &nbs= p;      1
>     >     > +#de= fine VIRTIO_NET_HASH_REPORT_TCPv4           2
&= gt;     >     > +#define VIRTIO_NET_HASH_REPORT_U= DPv4           3
>     >  =   > +#define VIRTIO_NET_HASH_REPORT_IPv6       &nbs= p;    4
>     >     > +#define VI= RTIO_NET_HASH_REPORT_TCPv6           5
> &nb= sp;   >     > +#define VIRTIO_NET_HASH_REPORT_UDPv6 &n= bsp;         6
>     >    = > +#define VIRTIO_NET_HASH_REPORT_IPv6_EX         7=
>     >     > +#define VIRTIO_NET_HASH_REP= ORT_TCPv6_EX        8
>     >  =   > +#define VIRTIO_NET_HASH_REPORT_UDPv6_EX       =  9
>     >     > +\end{lstlisting}
= >     >     > +
>     > &nb= sp;   >  \subsubsection{Control Virtqueue}\label{sec:Device Ty= pes / Network
>     >     Device / Device Oper= ation / Control Virtqueue}
>     >     > &n= bsp;
>     >     >  The driver uses th= e control virtqueue (if VIRTIO_NET_F_CTRL_VQ is
>     > =     > @@ -3896,6 +4064,7 @@ \subsubsection{Control Virtqueue}\= label
>     {sec:Device
>     >   &= nbsp; Types / Network Device / Devi
>     >    = ; >  #define VIRTIO_NET_CTRL_MQ    4
>    = ; >     >   #define VIRTIO_NET_CTRL_MQ_VQ_PAIRS_SET &n= bsp;      0 (for automatic
>     receive
= >     >     steering)
>     > =     >   #define VIRTIO_NET_CTRL_MQ_RSS_CONFIG   &nbs= p;      1 (for
>     configurable
> &n= bsp;   >     receive steering)
>     >=     > + #define VIRTIO_NET_CTRL_MQ_HASH_CONFIG     =     2 (for
>     configurable hash
>  =   >     calculation)
>     >   &= nbsp; >  \end{lstlisting}
>     >     = >  
>     >     >  If more tha= n one multiqueue mode is negotiated, the resulting
>     de= vice
>     >     configuration is defined by t= he last command sent by the driver.
>     >    = ; > @@ -3961,10 +4130,37 @@ \subsubsection{Control Virtqueue}\label
&= gt;     >     {sec:Device Types / Network Device / D= evi
>     >     >  according to the na= tive endian of the guest rather than
>     >   &nbs= p; >  (necessarily when not using the legacy interface) little-endi= an.
>     >     >  
>   &nb= sp; >     > +\subparagraph{Hash calculation}\label{sec:Devi= ce Types / Network
>     Device
>     > =     / Device Operation / Control Virtqueue / Automatic receive st= eering
>     in
>     >     mu= ltiqueue mode / Hash calculation}
>     >     = > +If VIRTIO_NET_F_HASH_REPORT was negotiated and the device uses
>= ;     automatic
>     >     receive = steering,
>     >     > +the device MUST su= pport a command to configure hash calculation
>     > &n= bsp;   parameters.
>     >     > +
= >     >     > +The driver provides parameters = for hash calculation as follows:
>     >     &= gt; +
>     >     > +\field{class} VIRTIO_N= ET_CTRL_MQ, \field{command}
>     >     VIRTIO= _NET_CTRL_MQ_HASH_CONFIG.
>     >     > +>     >     > +The \field{command-specific-d= ata} has following format:
>     >     > +\= begin{lstlisting}
>     >     > +struct vir= tio_net_hash_config {
>     >     > +  = ;  le32 hash_types;
>     >     > + &n= bsp;  le16 reserved[4];
>     >     > = +    u8 hash_key_length;
>     >    = > +    u8 hash_key_data[hash_key_length];
>   &nbs= p; >     > +};
>     >     >= ; +\end{lstlisting}
>     >     > +Field \f= ield{hash_types} contains a bitmask of allowed hash types
>   &n= bsp; as
>     >     > +defined in
> &= nbsp;   >     > +\ref{sec:Device Types / Network Devic= e / Device Operation /
>     Processing
>   &nbs= p; >     of Incoming Packets / Hash calculation for incoming p= ackets /
>     Supported/
>     >  =   enabled hash types}.
>     >     > = +Initially the device has all hash types disabled and reports only
> =     >     VIRTIO_NET_HASH_REPORT_NONE.
>  = ;   >     > +
>     >    = > +Field \field{reserved} MUST contain zeroes. It is defined to make>     the
>     >     structure = to match the layout of virtio_net_rss_config structure,
>   &nbs= p; >     > +defined in \ref{sec:Device Types / Network Devi= ce / Device
>     Operation /
>     > &n= bsp;   Control Virtqueue / Receive-side scaling (RSS)}.
>  =   >     > +
>     >     = > +Fields \field{hash_key_length} and \field{hash_key_data} define
&g= t;     the key
>     >     to be use= d in hash calculation.
>     >     > +
&= gt;     >     >  \paragraph{Receive-side sca= ling (RSS)}\label{sec:Device Types /
>     Network
> =     >     Device / Device Operation / Control Virtqu= eue / Receive-side scaling
>     (RSS)}
>   &nbs= p; >     >  A device offers the feature VIRTIO_NET_F_R= SS if it supports RSS
>     receive
>     &= gt;     steering with Toeplitz hash calculation and configurable = parameters.
>     >     >  
> &n= bsp;   >     > -A driver queries RSS capabilities of t= he device by reading device
>     >     config= uration as defined in \ref{sec:Device Types / Network Device /
> &nbs= p;   Device
>     >     configuration lay= out / RSS}
>     >     > +A driver queries = RSS capabilities of the device by reading device
>     >=     configuration as defined in \ref{sec:Device Types / Network = Device /
>     Device
>     >   &nb= sp; configuration layout}
>     >     > &nb= sp;
>     >     >  \subparagraph{Setti= ng RSS parameters}\label{sec:Device Types /
>     Network>     >     Device / Device Operation / Control= Virtqueue / Receive-side scaling
>     (RSS)
>  = ;   >     / Setting RSS parameters}
>    = >     >  
>     >     &g= t; @@ -3981,7 +4177,8 @@ \subsubsection{Control Virtqueue}\label
> &n= bsp;   {sec:Device
>     >     Types / Ne= twork Device / Devi
>     >     >  };<= br>>     >     >  \end{lstlisting}
>= ;     >     >  Field \field{hash_types} cont= ains a bitmask of allowed hash types
>     as
>  = ;   >     > -defined in \ref{sec:Device Types / Networ= k Device / Device
>     Operation /
>     &= gt;     Control Virtqueue / Receive-side scaling (RSS) / RSS hash= types}.
>     >     > +defined in
> =     >     > +\ref{sec:Device Types / Network Devi= ce / Device Operation /
>     Processing
>   &nb= sp; >     of Incoming Packets / Hash calculation for incoming = packets /
>     Supported/
>     >  = ;   enabled hash types}.
>     >     >=  
>     >     >  Field \field{in= direction_table_mask} is a mask to be applied to
>     >=     >  the calculated hash to produce an index in the>     >     > @@ -3995,93 +4192,7 @@ \subsubs= ection{Control Virtqueue}\label
>     {sec:Device
> &= nbsp;   >     Types / Network Device / Devi
>  = ;   >     >  
>     >   &= nbsp; >  A driver sets \field{max_tx_vq} to inform a device how man= y
>     transmit
>     >     v= irtqueues it may use (transmitq1\ldots transmitq \field{max_tx_vq}).
>= ;     >     >  
>     > &= nbsp;   > -\subparagraph{RSS hash types}\label{sec:Device Types / N= etwork
>     Device /
>     >   &nb= sp; Device Operation / Control Virtqueue / Receive-side scaling (RSS) /
= >     RSS
>     >     hash types}=
>     >     > -
>     >=     > -The device calculates the hash on IPv4 packets accordi= ng to the
>     >     > -field \field{hash_= types} of the virtio_net_rss_config structure as
>     >=     follows:
>     >     > -\beg= in{itemize}
>     >     > -\item If VIRTIO_= NET_RSS_HASH_TYPE_TCPv4 is set and the packet has
>     >= ;     > -a TCP header, the hash is calculated over the followi= ng fields:
>     >     > -\begin{itemize}>     >     > -\item Source IP address
&g= t;     >     > -\item Destination IP address
&= gt;     >     > -\item Source TCP port
> &n= bsp;   >     > -\item Destination TCP port
> &nb= sp;   >     > -\end{itemize}
>     >= ;     > -\item Else if VIRTIO_NET_RSS_HASH_TYPE_UDPv4 is set a= nd the
>     >     > -packet has a UDP head= er, the hash is calculated over the following
>     > &n= bsp;   fields:
>     >     > -\begin{i= temize}
>     >     > -\item Source IP addr= ess
>     >     > -\item Destination IP add= ress
>     >     > -\item Source UDP port>     >     > -\item Destination UDP port>     >     > -\end{itemize}
>   &= nbsp; >     > -\item Else if VIRTIO_NET_RSS_HASH_TYPE_IPv4 = is set, the hash is
>     >     > -calculat= ed over the following fields:
>     >     >= -\begin{itemize}
>     >     > -\item Sour= ce IP address
>     >     > -\item Destinat= ion IP address
>     >     > -\end{itemize}=
>     >     > -\item Else the device does = not calculate the hash
>     >     > -\end{= itemize}
>     >     > -
>   &nb= sp; >     > -\label{itm:Device Types / Network Device / Dev= ice Operation /
>     Control
>     > &n= bsp;   Virtqueue / Receive-side scaling (RSS) / RSS hash types/hash on= IPv6
>     >     packets without extension he= aders}
>     >     > -The device calculates= the hash on IPv6 packets without extension
>     > &nbs= p;   > -headers according to the field \field{hash_types} of the>     >     virtio_net_rss_config structure as f= ollows:
>     >     > -\begin{itemize}
&= gt;     >     > -\item If VIRTIO_NET_RSS_HASH_TYP= E_TCPv6 is set and the packet has
>     >     = > -a TCPv6 header, the hash is calculated over the following fields:
= >     >     > -\begin{itemize}
>   =   >     > -\item Source IPv6 address
>   &n= bsp; >     > -\item Destination IPv6 address
>  =   >     > -\item Source TCP port
>    = ; >     > -\item Destination TCP port
>    = >     > -\end{itemize}
>     >   &= nbsp; > -\item Else if VIRTIO_NET_RSS_HASH_TYPE_UDPv6 is set and the
= >     >     > -packet has a UDPv6 header, the = hash is calculated over the
>     following
>   =   >     fields:
>     >     = > -\begin{itemize}
>     >     > -\item = Source IPv6 address
>     >     > -\item De= stination IPv6 address
>     >     > -\item= Source UDP port
>     >     > -\item Desti= nation UDP port
>     >     > -\end{itemize= }
>     >     > -\item Else if VIRTIO_NET_R= SS_HASH_TYPE_IPv6 is set, the hash is
>     >   &nb= sp; > -calculated over the following fields:
>     > =     > -\begin{itemize}
>     >    = ; > -\item Source IPv6 address
>     >     = > -\item Destination IPv6 address
>     >   &nbs= p; > -\end{itemize}
>     >     > -\item= Else the device does not calculate the hash
>     > &nb= sp;   > -\end{itemize}
>     >     >= ; -
>     >     > -The device calculates th= e hash on IPv6 packets with extension
>     >   &nb= sp; > -headers according to the field \field{hash_types} of the
> =     >     virtio_net_rss_config structure as follows= :
>     >     > -\begin{itemize}
> &n= bsp;   >     > -\item If VIRTIO_NET_RSS_HASH_TYPE_TCP_= EX is set and the packet
>     >     > -has= a TCPv6 header, the hash is calculated over the following
>   &= nbsp; fields:
>     >     > -\begin{itemize= }
>     >     > -\item Home address from th= e home address option in the IPv6
>     destination
>=     >     options header. If the extension header i= s not present, use the
>     Source IPv6
>   &nb= sp; >     address.
>     >     &g= t; -\item IPv6 address that is contained in the Routing-Header-Type-2
&g= t;     from
>     >     the associat= ed extension header. If the extension header is not
>     p= resent,
>     >     use the Destination IPv6 a= ddress.
>     >     > -\item Source TCP por= t
>     >     > -\item Destination TCP port=
>     >     > -\end{itemize}
>  = ;   >     > -\item Else if VIRTIO_NET_RSS_HASH_TYPE_UD= P_EX is set and the
>     >     > -packet h= as a UDPv6 header, the hash is calculated over the
>     fo= llowing
>     >     fields:
>   &nb= sp; >     > -\begin{itemize}
>     > &nb= sp;   > -\item Home address from the home address option in the IPv= 6
>     destination
>     >    = ; options header. If the extension header is not present, use the
> &= nbsp;   Source IPv6
>     >     address.<= br>>     >     > -\item IPv6 address that is c= ontained in the Routing-Header-Type-2
>     from
> &n= bsp;   >     the associated extension header. If the exte= nsion header is not
>     present,
>     &g= t;     use the Destination IPv6 address.
>     &g= t;     > -\item Source UDP port
>     > &nb= sp;   > -\item Destination UDP port
>     > &nbs= p;   > -\end{itemize}
>     >     >= -\item Else if VIRTIO_NET_RSS_HASH_TYPE_IP_EX is set, the hash is
> =     >     > -calculated over the following fields= :
>     >     > -\begin{itemize}
> &n= bsp;   >     > -\item Home address from the home addre= ss option in the IPv6
>     destination
>   &nbs= p; >     options header. If the extension header is not presen= t, use the
>     Source IPv6
>     > &nb= sp;   address.
>     >     > -\item IP= v6 address that is contained in the Routing-Header-Type-2
>   &n= bsp; from
>     >     the associated extension= header. If the extension header is not
>     present,
&= gt;     >     use the Destination IPv6 address.
&= gt;     >     > -\end{itemize}
>   &nb= sp; >     > -\item Else skip IPv6 extension headers and cal= culate the hash as
>     >     > -defined f= or an IPv6 packet without extension headers (see \ref
>    = >     {itm:Device Types / Network Device / Device Operation /= Control
>     Virtqueue /
>     >  = ;   Receive-side scaling (RSS) / RSS hash types/hash on IPv6 packets>     without
>     >     exten= sion headers}).
>     >     > -\end{itemize= }
>     >     > +Fields \field{hash_key_len= gth} and \field{hash_key_data} define
>     the key
>=     >     to be used in hash calculation.
> &= nbsp;   >     >  
>     > &nbs= p;   >  \drivernormative{\subparagraph}{Setting RSS parameters= }{Device
>     Types /
>     >   &n= bsp; Network Device / Device Operation / Control Virtqueue / Receive-side>     >     scaling (RSS) }
>   &nbs= p; >     >  
>     >     = > @@ -4093,12 +4204,12 @@ \subsubsection{Control Virtqueue}\label
>= ;     >     {sec:Device Types / Network Device / Dev= i
>     >     >  
>    = ; >     >  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_H= ASH_TYPE_ flags that are
>     not
>     &g= t;     supported by a device.
>     >   &= nbsp; > +A driver MUST NOT set any VIRTIO_NET_HASH_TYPE_ flags that are = not
>     >     supported by a device.
>=     >     >  
>     > &n= bsp;   >  \devicenormative{\subparagraph}{RSS processing}{Devi= ce Types /
>     Network
>     >   =   Device / Device Operation / Control Virtqueue / Receive-side scaling=
>     (RSS)
>     >     / RSS= processing}
>     >     >  The device= MUST determine the destination queue for a network
>     p= acket as
>     >     follows:
>   &= nbsp; >     >  \begin{itemize}
>     &= gt;     > -\item Calculate the hash of the packet as defined i= n \ref
>     {sec:Device
>     >   =   Types / Network Device / Device Operation / Control Virtqueue /
&= gt;     >     Receive-side scaling (RSS) / RSS hash = types}
>     >     > +\item Calculate the h= ash of the packet as defined in \ref
>     {sec:Device
&= gt;     >     Types / Network Device / Device Operat= ion / Processing of Incoming
>     Packets
>   &= nbsp; >     / Hash calculation for incoming packets}.
> =     >     >  \item If the device did not cal= culate the hash for the specific
>     packet,
> &nbs= p;   >     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).
>     > &= nbsp;   >  \item Apply \field{indirection_table_mask} to the c= alculated hash
>     and
>     >   =   use the result as the index in the indirection table to get 0-based<= br>>     number
>     >     of de= stination receiveq (value of 0 corresponds to receiveq1).
>   &n= bsp; >     >  \end{itemize}
>     >=     > --
>     >     > 2.17.1=
>     >
>     >
>    = ; >     This publicly archived list offers a means to provide = input to the
>     >     OASIS Virtual I/O Dev= ice (VIRTIO) TC.
>     >
>     > &nbs= p;   In order to verify user consent to the Feedback License terms and=
>     >     to minimize spam in the list arch= ive, subscription is required
>     >     befo= re posting.
>     >
>     >   &n= bsp; Subscribe: virtio-comment-subscribe@lists.oasis-open.org
>  = ;   >     Unsubscribe: virtio-comment-unsubscribe@lists.o= asis-open.org
>     >     List help: virtio-co= mment-help@lists.oasis-open.org
>     >     Li= st archive: https://lists.oasis-open.org/archives/virtio-comment/
> &= nbsp;   >     Feedback License: https://www.oasis-open.or= g/who/ipr/
>     feedback_license.pdf
>    = >     List Guidelines: https://www.oasis-open.org/policies-gu= idelines/
>     >     mailing-lists
> &n= bsp;   >     Committee: https://www.oasis-open.org/commit= tees/virtio/
>     >     Join OASIS: https://w= ww.oasis-open.org/join/
>     >
>     &g= t;
>     >
>
>
>

=

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

In = order to verify user consent to the Feedback License terms and
to minim= ize 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://li= sts.oasis-open.org/archives/virtio-comment/
Feedback License: https://w= ww.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-o= pen.org/join/


------=_Part_7345660_715052899.1582175341195--