Skip to contentSkip to conversation

virtio_net: support inner header hash for GRE-encapsulated packets

PATCH Superseded Heng Qi 3 participants 16 messages Nov 9, 2022 – Nov 18, 2022

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore

Heng Qi

author
#0 lore raw

cover virtio_net: support inner header hash for GRE-encapsulated packets

From: Heng Qi <[email protected]>

Now, whether it is a tunnel-encapsulated packet or a normal packet, it can be considered that the hash is calculated over the outer header. For the tunnel-encapsulated packet in the same flow, the hash is the same under this default behavior, and this is a point that can be optimized for multi-queue NICs.

This patch set adds a VIRTIO_NET_HASH_TYPE_GRE_INNER bitmask in \field{hash_types}, which supports inner header hash for GRE-encapsulated packets.

Heng Qi (2):
virtio_net: fix syntax errors
virtio_net: support inner header hash for GRE-encapsulated packets

 content.tex | 122 ++++++++++++++++++++++++++++++++++++++++++++++++++--
 1 file changed, 119 insertions(+), 3 deletions(-)
Signature · 6 lines
2.19.1.6.gb485710b


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
author
#1 lore raw

PATCH 1/2 virtio_net: fix syntax errors

From: Heng Qi <[email protected]>

\field{hash_types} can contain multiple bitmasks.

---
 content.tex | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
content.tex +3 -3
index e863709..6fabf1d 100644
@@ -3210,7 +3210,7 @@ \subsection{Device configuration layout}\label{sec:Device Types / Network Device
 The next field, \field{supported_hash_types} only exists 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 hash types.
+Field \field{supported_hash_types} contains the bitmasks 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}
@@ -4369,7 +4369,7 @@ \subsubsection{Control Virtqueue}\label{sec:Device Types / Network Device / Devi
     u8 hash_key_data[hash_key_length];
 };
 \end{lstlisting}
-Field \field{hash_types} contains a bitmask of allowed hash types as
+Field \field{hash_types} contains bitmasks 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.
@@ -4398,7 +4398,7 @@ \subsubsection{Control Virtqueue}\label{sec:Device Types / Network Device / Devi
     u8 hash_key_data[hash_key_length];
 };
 \end{lstlisting}
-Field \field{hash_types} contains a bitmask of allowed hash types as
+Field \field{hash_types} contains bitmasks 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}.
 
Signature · 6 lines
2.19.1.6.gb485710b


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
author
#2 lore raw

PATCH 2/2 virtio_net: support inner header hash for GRE-encapsulated packets

In reply to Heng Qi

From: Heng Qi <[email protected]>

When VIRTIO_NET_F_RSS is negotiated and the tunnel is used to encapsulate the packets, the hash calculated using the outer header of the receive packets is always fixed for the same flow packets, i.e. they will be steered to the same receive queue.

We add a VIRTIO_NET_HASH_TYPE_GRE_INNER bitmask in \field{hash_types}, which instructs the device to calculate the hash using the inner headers of GRE-encapsulated packets.

---
 content.tex | 116 ++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 116 insertions(+)
content.tex +116 -0
index 6fabf1d..319d401 100644
@@ -3883,6 +3883,10 @@ \subsubsection{Processing of Incoming Packets}\label{sec:Device Types / Network
 #define VIRTIO_NET_HASH_TYPE_TCP_EX            (1 << 7)
 #define VIRTIO_NET_HASH_TYPE_UDP_EX            (1 << 8)
 \end{lstlisting}
+Hash types applicable to inner payloads of GRE-encapsulated packets
+\begin{lstlisting}
+#define VIRTIO_NET_HASH_TYPE_GRE_INNER         (1 << 9)
+\end{lstlisting}
 
 \subparagraph{IPv4 packets}
 \label{sec:Device Types / Network Device / Device Operation / Processing of Incoming Packets / Hash calculation for incoming packets / IPv4 packets}
@@ -3975,6 +3979,114 @@ \subsubsection{Processing of Incoming Packets}\label{sec:Device Types / Network
 (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}
 
+\subparagraph{Inner payloads of GRE-encapsulated packets}
+\label{sec:Device Types / Network Device / Device Operation / Processing of Incoming Packets / Hash calculation for incoming packets / Inner payloads of GRE-encapsulated packets}}
+VIRTIO_NET_HASH_TYPE_GRE_INNER bit MUST be set at the same time as one of
+the bits between VIRTIO_NET_HASH_TYPE_IPv4 and VIRTIO_NET_HASH_TYPE_UDP_EX.
+
+The device calculates the hash on GRE-encapsulated packets whose inner payloads
+are IPv4 packets according to 'Enabled hash types' bitmasks as follows:
+\begin{itemize}
+  \item If both VIRTIO_NET_HASH_TYPE_GRE_INNER and VIRTIO_NET_HASH_TYPE_TCPv4 bits
+      are set, and the GRE-encapsulated packet has an inner TCPv4 header in its
+      payload, the hash is calculated over the following fields:
+    \begin{itemsize}
+      \item Inner source IP address
+      \item Inner destination IP address
+      \item Inner source TCP port
+      \item Inner destination TCP port
+    \end{itemsize}
+  \item Else if both VIRTIO_NET_HASH_TYPE_GRE_INNER and VIRTIO_NET_HASH_TYPE_UDPv4
+      bits are set, and the GRE-encapsulated packet has an inner UDPv4 header in
+      its payload, the hash is calculated over the following fields:
+    \begin{itemsize}
+      \item Inner source IP address
+      \item Inner destination IP address
+      \item Inner source UDP port
+      \item Inner destination UDP port
+    \end{itemize}
+  \item Else if both VIRTIO_NET_HASH_TYPE_GRE_INNER and VIRTIO_NET_HASH_TYPE_IPv4
+      bits are set, the hash is calculated over the following fields:
+    \begin{itemsize}
+      \item Inner source IP address
+      \item Inner destination IP address
+    \end{itemsize}
+  \item Else the device does not calculate the hash
+\end{itemize}
+
+The device calculates the hash on GRE-encapsulated packets whose inner payloads
+are IPv6 packets without extension headers according to 'Enabled hash types'
+bitmasks as follows:
+\begin{itemsize}
+  \item If both VIRTIO_NET_HASH_TYPE_GRE_INNER and VIRTIO_NET_HASH_TYPE_TCPv6
+      bits are set, and the GRE-encapsulated packet has an inner TCPv6 header in
+      its payload, the hash is calculated over the following fields:
+    \begin{itemsize}
+      \item Inner source IPv6 address
+      \item Inner destination IPv6 address
+      \item Inner source TCP port
+      \item Inner destination TCP port
+    \end{itemsize}
+  \item Else if both VIRTIO_NET_HASH_TYPE_GRE_INNER and VIRTIO_NET_HASH_TYPE_UDPv6
+      bits are set, and the GRE-encapsulated packet has an inner UDPv6 header in
+      its payload, the hash is calculated over the following fields:
+    \begin{itemsize}
+      \item Inner source IPv6 address
+      \item Inner destination IPv6 address
+      \item Inner source UDP port
+      \item Inner destination UDP port
+    \end{itemize}
+  \item Else if both VIRTIO_NET_HASH_TYPE_GRE_INNER and VIRTIO_NET_HASH_TYPE_IPv6
+      bits are set, the hash is calculated over the following fields:
+    \begin{itemsize}
+      \item Inner source IPv6 address
+      \item Inner destination IPv6 address
+    \end{itemsize}
+  \item Else the device does not calculate the hash
+\end{itemize}
+
+The device calculates the hash on GRE-encapsulated packets whose inner payloads
+are IPv6 packets with extension headers according to 'Enabled hash types'
+bitmasks as follows:
+\begin{itemsize}
+  \item If both VIRTIO_NET_HASH_TYPE_GRE_INNER and VIRTIO_NET_HASH_TYPE_TCP_EX
+      bits are set, and the GRE-encapsulated packet has an inner TCPv6 header in
+      its payload, 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 both VIRTIO_NET_HASH_TYPE_GRE_INNER and VIRTIO_NET_HASH_TYPE_UDP_EX
+  bits are set, and the GRE-encapsulated packet has an inner UDPv6 header in its
+  payload, the hash is calculated over the following fields:
+    \begin{itemsize}
+      \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 both VIRTIO_NET_HASH_TYPE_GRE_INNER and VIRTIO_NET_HASH_TYPE_IP_EX
+      bits are set, the hash is calculated over the following fields:
+    \begin{itemsize}
+      \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
+      a GRE-encapsulated packet whose inner payload is an IPv6 packet without
+      extension headers
+\end{itemsize}
+
 \paragraph{Hash reporting for incoming packets}
 \label{sec:Device Types / Network Device / Device Operation / Processing of Incoming Packets / Hash reporting for incoming packets}
 
@@ -4005,6 +4117,10 @@ \subsubsection{Processing of Incoming Packets}\label{sec:Device Types / Network
 #define VIRTIO_NET_HASH_REPORT_UDPv6_EX        9
 \end{lstlisting}
 
+VIRTIO_NET_HASH_TYPE_GRE_INNER bit is not included in \field{hash_report},
+it just indicates that the hash is calculated using the inner header inside
+the GRE-encapsulated packet.
+
 \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
Signature · 6 lines
2.19.1.6.gb485710b


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
#3 lore raw
Quoted 34 lines · Heng Qi

From: Heng Qi <[email protected]>

When VIRTIO_NET_F_RSS is negotiated and the tunnel is used to encapsulate the packets, the hash calculated using the outer header of the receive packets is always fixed for the same flow packets, i.e. they will be steered to the same receive queue.

We add a VIRTIO_NET_HASH_TYPE_GRE_INNER bitmask in \field{hash_types}, which instructs the device to calculate the hash using the inner headers of GRE-encapsulated packets.

---
 content.tex | 116 ++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 116 insertions(+)
content.tex +4 -0
index 6fabf1d..319d401 100644
@@ -3883,6 +3883,10 @@ \subsubsection{Processing of Incoming Packets}\label{sec:Device Types / Network
 #define VIRTIO_NET_HASH_TYPE_TCP_EX            (1 << 7)
 #define VIRTIO_NET_HASH_TYPE_UDP_EX            (1 << 8)
 \end{lstlisting}
+Hash types applicable to inner payloads of GRE-encapsulated packets
+\begin{lstlisting}
+#define VIRTIO_NET_HASH_TYPE_GRE_INNER         (1 << 9)
+\end{lstlisting}
 
 \subparagraph{IPv4 packets}
 \label{sec:Device Types / Network Device / Device Operation / Processing of Incoming Packets / Hash calculation for incoming packets / IPv4 packets}

content.tex \subsubsection{Processing of Incoming Packets}\label{sec:Device Types / Network · line 3985

Quoted 7 lines
content.tex +4 -0
@@ -3975,6 +3979,114 @@ \subsubsection{Processing of Incoming Packets}\label{sec:Device Types / Network
 (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}
 
+\subparagraph{Inner payloads of GRE-encapsulated packets}
+\label{sec:Device Types / Network Device / Device Operation / Processing of Incoming Packets / Hash calculation for incoming packets / Inner payloads of GRE-encapsulated packets}}
+VIRTIO_NET_HASH_TYPE_GRE_INNER bit MUST be set at the same time as one of
+the bits between VIRTIO_NET_HASH_TYPE_IPv4 and VIRTIO_NET_HASH_TYPE_UDP_EX.

"MUST" keyword must belong to the normative section.

Quoted 61 lines
content.tex +61 -0
+
+The device calculates the hash on GRE-encapsulated packets whose inner payloads
+are IPv4 packets according to 'Enabled hash types' bitmasks as follows:
+\begin{itemize}
+  \item If both VIRTIO_NET_HASH_TYPE_GRE_INNER and VIRTIO_NET_HASH_TYPE_TCPv4 bits
+      are set, and the GRE-encapsulated packet has an inner TCPv4 header in its
+      payload, the hash is calculated over the following fields:
+    \begin{itemsize}
+      \item Inner source IP address
+      \item Inner destination IP address
+      \item Inner source TCP port
+      \item Inner destination TCP port
+    \end{itemsize}
+  \item Else if both VIRTIO_NET_HASH_TYPE_GRE_INNER and VIRTIO_NET_HASH_TYPE_UDPv4
+      bits are set, and the GRE-encapsulated packet has an inner UDPv4 header in
+      its payload, the hash is calculated over the following fields:
+    \begin{itemsize}
+      \item Inner source IP address
+      \item Inner destination IP address
+      \item Inner source UDP port
+      \item Inner destination UDP port
+    \end{itemize}
+  \item Else if both VIRTIO_NET_HASH_TYPE_GRE_INNER and VIRTIO_NET_HASH_TYPE_IPv4
+      bits are set, the hash is calculated over the following fields:
+    \begin{itemsize}
+      \item Inner source IP address
+      \item Inner destination IP address
+    \end{itemsize}
+  \item Else the device does not calculate the hash
+\end{itemize}
+
+The device calculates the hash on GRE-encapsulated packets whose inner payloads
+are IPv6 packets without extension headers according to 'Enabled hash types'
+bitmasks as follows:
+\begin{itemsize}
+  \item If both VIRTIO_NET_HASH_TYPE_GRE_INNER and VIRTIO_NET_HASH_TYPE_TCPv6
+      bits are set, and the GRE-encapsulated packet has an inner TCPv6 header in
+      its payload, the hash is calculated over the following fields:
+    \begin{itemsize}
+      \item Inner source IPv6 address
+      \item Inner destination IPv6 address
+      \item Inner source TCP port
+      \item Inner destination TCP port
+    \end{itemsize}
+  \item Else if both VIRTIO_NET_HASH_TYPE_GRE_INNER and VIRTIO_NET_HASH_TYPE_UDPv6
+      bits are set, and the GRE-encapsulated packet has an inner UDPv6 header in
+      its payload, the hash is calculated over the following fields:
+    \begin{itemsize}
+      \item Inner source IPv6 address
+      \item Inner destination IPv6 address
+      \item Inner source UDP port
+      \item Inner destination UDP port
+    \end{itemize}
+  \item Else if both VIRTIO_NET_HASH_TYPE_GRE_INNER and VIRTIO_NET_HASH_TYPE_IPv6
+      bits are set, the hash is calculated over the following fields:
+    \begin{itemsize}
+      \item Inner source IPv6 address
+      \item Inner destination IPv6 address
+    \end{itemsize}
+  \item Else the device does not calculate the hash
+\end{itemize}

content.tex \subsubsection{Processing of Incoming Packets}\label{sec:Device Types / Network · line 4056

Quoted 10 lines
content.tex +10 -0
+
+The device calculates the hash on GRE-encapsulated packets whose inner payloads
+are IPv6 packets with extension headers according to 'Enabled hash types'
+bitmasks as follows:
+\begin{itemsize}
+  \item If both VIRTIO_NET_HASH_TYPE_GRE_INNER and VIRTIO_NET_HASH_TYPE_TCP_EX
+      bits are set, and the GRE-encapsulated packet has an inner TCPv6 header in
+      its payload, the hash is calculated over the following fields:
+    \begin{itemize}
+      \item Home address from the home address option in the IPv6 destination options

Is this inner or outer?

Thanks

Quoted 48 lines
content.tex +37 -1
+          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 both VIRTIO_NET_HASH_TYPE_GRE_INNER and VIRTIO_NET_HASH_TYPE_UDP_EX
+  bits are set, and the GRE-encapsulated packet has an inner UDPv6 header in its
+  payload, the hash is calculated over the following fields:
+    \begin{itemsize}
+      \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 both VIRTIO_NET_HASH_TYPE_GRE_INNER and VIRTIO_NET_HASH_TYPE_IP_EX
+      bits are set, the hash is calculated over the following fields:
+    \begin{itemsize}
+      \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
+      a GRE-encapsulated packet whose inner payload is an IPv6 packet without
+      extension headers
+\end{itemsize}
+
 \paragraph{Hash reporting for incoming packets}
 \label{sec:Device Types / Network Device / Device Operation / Processing of Incoming Packets / Hash reporting for incoming packets}
 
@@ -4005,6 +4117,10 @@ \subsubsection{Processing of Incoming Packets}\label{sec:Device Types / Network
 #define VIRTIO_NET_HASH_REPORT_UDPv6_EX        9
 \end{lstlisting}
 
+VIRTIO_NET_HASH_TYPE_GRE_INNER bit is not included in \field{hash_report},
+it just indicates that the hash is calculated using the inner header inside
+the GRE-encapsulated packet.
+
 \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
--
Quoted 2 lines

2.19.1.6.gb485710b

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

author
#4 lore raw
Quoted 107 lines · Jason Wang
Quoted 33 lines · Heng Qi

From: Heng Qi <[email protected]>

When VIRTIO_NET_F_RSS is negotiated and the tunnel is used to encapsulate the packets, the hash calculated using the outer header of the receive packets is always fixed for the same flow packets, i.e. they will be steered to the same receive queue.

We add a VIRTIO_NET_HASH_TYPE_GRE_INNER bitmask in \field{hash_types}, which instructs the device to calculate the hash using the inner headers of GRE-encapsulated packets.

---
  content.tex | 116 ++++++++++++++++++++++++++++++++++++++++++++++++++++
  1 file changed, 116 insertions(+)
content.tex +4 -0
index 6fabf1d..319d401 100644
@@ -3883,6 +3883,10 @@ \subsubsection{Processing of Incoming Packets}\label{sec:Device Types / Network
  #define VIRTIO_NET_HASH_TYPE_TCP_EX            (1 << 7)
  #define VIRTIO_NET_HASH_TYPE_UDP_EX            (1 << 8)
  \end{lstlisting}
+Hash types applicable to inner payloads of GRE-encapsulated packets
+\begin{lstlisting}
+#define VIRTIO_NET_HASH_TYPE_GRE_INNER         (1 << 9)
+\end{lstlisting}
 
  \subparagraph{IPv4 packets}
  \label{sec:Device Types / Network Device / Device Operation / Processing of Incoming Packets / Hash calculation for incoming packets / IPv4 packets}

content.tex \subsubsection{Processing of Incoming Packets}\label{sec:Device Types / Network · line 3985

Quoted 7 lines
content.tex +4 -0
@@ -3975,6 +3979,114 @@ \subsubsection{Processing of Incoming Packets}\label{sec:Device Types / Network
  (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}
 
+\subparagraph{Inner payloads of GRE-encapsulated packets}
+\label{sec:Device Types / Network Device / Device Operation / Processing of Incoming Packets / Hash calculation for incoming packets / Inner payloads of GRE-encapsulated packets}}
+VIRTIO_NET_HASH_TYPE_GRE_INNER bit MUST be set at the same time as one of
+the bits between VIRTIO_NET_HASH_TYPE_IPv4 and VIRTIO_NET_HASH_TYPE_UDP_EX.

"MUST" keyword must belong to the normative section.

Quoted 64 lines
content.tex +64 -0
+
+The device calculates the hash on GRE-encapsulated packets whose inner payloads
+are IPv4 packets according to 'Enabled hash types' bitmasks as follows:
+\begin{itemize}
+  \item If both VIRTIO_NET_HASH_TYPE_GRE_INNER and VIRTIO_NET_HASH_TYPE_TCPv4 bits
+      are set, and the GRE-encapsulated packet has an inner TCPv4 header in its
+      payload, the hash is calculated over the following fields:
+    \begin{itemsize}
+      \item Inner source IP address
+      \item Inner destination IP address
+      \item Inner source TCP port
+      \item Inner destination TCP port
+    \end{itemsize}
+  \item Else if both VIRTIO_NET_HASH_TYPE_GRE_INNER and VIRTIO_NET_HASH_TYPE_UDPv4
+      bits are set, and the GRE-encapsulated packet has an inner UDPv4 header in
+      its payload, the hash is calculated over the following fields:
+    \begin{itemsize}
+      \item Inner source IP address
+      \item Inner destination IP address
+      \item Inner source UDP port
+      \item Inner destination UDP port
+    \end{itemize}
+  \item Else if both VIRTIO_NET_HASH_TYPE_GRE_INNER and VIRTIO_NET_HASH_TYPE_IPv4
+      bits are set, the hash is calculated over the following fields:
+    \begin{itemsize}
+      \item Inner source IP address
+      \item Inner destination IP address
+    \end{itemsize}
+  \item Else the device does not calculate the hash
+\end{itemize}
+
+The device calculates the hash on GRE-encapsulated packets whose inner payloads
+are IPv6 packets without extension headers according to 'Enabled hash types'
+bitmasks as follows:
+\begin{itemsize}
+  \item If both VIRTIO_NET_HASH_TYPE_GRE_INNER and VIRTIO_NET_HASH_TYPE_TCPv6
+      bits are set, and the GRE-encapsulated packet has an inner TCPv6 header in
+      its payload, the hash is calculated over the following fields:
+    \begin{itemsize}
+      \item Inner source IPv6 address
+      \item Inner destination IPv6 address
+      \item Inner source TCP port
+      \item Inner destination TCP port
+    \end{itemsize}
+  \item Else if both VIRTIO_NET_HASH_TYPE_GRE_INNER and VIRTIO_NET_HASH_TYPE_UDPv6
+      bits are set, and the GRE-encapsulated packet has an inner UDPv6 header in
+      its payload, the hash is calculated over the following fields:
+    \begin{itemsize}
+      \item Inner source IPv6 address
+      \item Inner destination IPv6 address
+      \item Inner source UDP port
+      \item Inner destination UDP port
+    \end{itemize}
+  \item Else if both VIRTIO_NET_HASH_TYPE_GRE_INNER and VIRTIO_NET_HASH_TYPE_IPv6
+      bits are set, the hash is calculated over the following fields:
+    \begin{itemsize}
+      \item Inner source IPv6 address
+      \item Inner destination IPv6 address
+    \end{itemsize}
+  \item Else the device does not calculate the hash
+\end{itemize}
+
+The device calculates the hash on GRE-encapsulated packets whose inner payloads
+are IPv6 packets with extension headers according to 'Enabled hash types'
Quoted 8 lines

content.tex \subsubsection{Processing of Incoming Packets}\label{sec:Device Types / Network · line 4056

Quoted 7 lines
content.tex +7 -0
+bitmasks as follows:
+\begin{itemsize}
+  \item If both VIRTIO_NET_HASH_TYPE_GRE_INNER and VIRTIO_NET_HASH_TYPE_TCP_EX
+      bits are set, and the GRE-encapsulated packet has an inner TCPv6 header in
+      its payload, the hash is calculated over the following fields:
+    \begin{itemize}
+      \item Home address from the home address option in the IPv6 destination options

Is this inner or outer?

It's the inner header.  I'll make this statement clear.

Thanks.

Quoted 49 lines

Thanks

Quoted 46 lines
content.tex +37 -0
+          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 both VIRTIO_NET_HASH_TYPE_GRE_INNER and VIRTIO_NET_HASH_TYPE_UDP_EX
+  bits are set, and the GRE-encapsulated packet has an inner UDPv6 header in its
+  payload, the hash is calculated over the following fields:
+    \begin{itemsize}
+      \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 both VIRTIO_NET_HASH_TYPE_GRE_INNER and VIRTIO_NET_HASH_TYPE_IP_EX
+      bits are set, the hash is calculated over the following fields:
+    \begin{itemsize}
+      \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
+      a GRE-encapsulated packet whose inner payload is an IPv6 packet without
+      extension headers
+\end{itemsize}
+
  \paragraph{Hash reporting for incoming packets}
  \label{sec:Device Types / Network Device / Device Operation / Processing of Incoming Packets / Hash reporting for incoming packets}
 
@@ -4005,6 +4117,10 @@ \subsubsection{Processing of Incoming Packets}\label{sec:Device Types / Network
  #define VIRTIO_NET_HASH_REPORT_UDPv6_EX        9
  \end{lstlisting}
 
+VIRTIO_NET_HASH_TYPE_GRE_INNER bit is not included in \field{hash_report},
+it just indicates that the hash is calculated using the inner header inside
+the GRE-encapsulated packet.
+
  \subsubsection{Control Virtqueue}\label{sec:Device Types / Network Device / Device Operation / Control Virtqueue}
 
Quoted 4 lines
Quoted 4 lines
content.tex +0 -1
  The driver uses the control virtqueue (if VIRTIO_NET_F_CTRL_VQ is
--

2.19.1.6.gb485710b

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

author
#5 lore raw
In reply to Jason Wang
Quoted 37 lines · Jason Wang
Quoted 36 lines · Heng Qi

From: Heng Qi <[email protected]>

When VIRTIO_NET_F_RSS is negotiated and the tunnel is used to encapsulate the packets, the hash calculated using the outer header of the receive packets is always fixed for the same flow packets, i.e. they will be steered to the same receive queue.

We add a VIRTIO_NET_HASH_TYPE_GRE_INNER bitmask in \field{hash_types}, which instructs the device to calculate the hash using the inner headers of GRE-encapsulated packets.

---
  content.tex | 116 ++++++++++++++++++++++++++++++++++++++++++++++++++++
  1 file changed, 116 insertions(+)
content.tex +4 -0
index 6fabf1d..319d401 100644
@@ -3883,6 +3883,10 @@ \subsubsection{Processing of Incoming Packets}\label{sec:Device Types / Network
  #define VIRTIO_NET_HASH_TYPE_TCP_EX            (1 << 7)
  #define VIRTIO_NET_HASH_TYPE_UDP_EX            (1 << 8)
  \end{lstlisting}
+Hash types applicable to inner payloads of GRE-encapsulated packets
+\begin{lstlisting}
+#define VIRTIO_NET_HASH_TYPE_GRE_INNER         (1 << 9)
+\end{lstlisting}
 
  \subparagraph{IPv4 packets}
  \label{sec:Device Types / Network Device / Device Operation / Processing of Incoming Packets / Hash calculation for incoming packets / IPv4 packets}
@@ -3975,6 +3979,114 @@ \subsubsection{Processing of Incoming Packets}\label{sec:Device Types / Network
  (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}
 
Quoted 5 lines

content.tex \subsubsection{Processing of Incoming Packets}\label{sec:Device Types / Network · line 3985

Quoted 4 lines
content.tex +4 -0
+\subparagraph{Inner payloads of GRE-encapsulated packets}
+\label{sec:Device Types / Network Device / Device Operation / Processing of Incoming Packets / Hash calculation for incoming packets / Inner payloads of GRE-encapsulated packets}}
+VIRTIO_NET_HASH_TYPE_GRE_INNER bit MUST be set at the same time as one of
+the bits between VIRTIO_NET_HASH_TYPE_IPv4 and VIRTIO_NET_HASH_TYPE_UDP_EX.

"MUST" keyword must belong to the normative section.

Okay. Thanks for pointing out.

Quoted 122 lines
Quoted 62 lines
content.tex +61 -0
+
+The device calculates the hash on GRE-encapsulated packets whose inner payloads
+are IPv4 packets according to 'Enabled hash types' bitmasks as follows:
+\begin{itemize}
+  \item If both VIRTIO_NET_HASH_TYPE_GRE_INNER and VIRTIO_NET_HASH_TYPE_TCPv4 bits
+      are set, and the GRE-encapsulated packet has an inner TCPv4 header in its
+      payload, the hash is calculated over the following fields:
+    \begin{itemsize}
+      \item Inner source IP address
+      \item Inner destination IP address
+      \item Inner source TCP port
+      \item Inner destination TCP port
+    \end{itemsize}
+  \item Else if both VIRTIO_NET_HASH_TYPE_GRE_INNER and VIRTIO_NET_HASH_TYPE_UDPv4
+      bits are set, and the GRE-encapsulated packet has an inner UDPv4 header in
+      its payload, the hash is calculated over the following fields:
+    \begin{itemsize}
+      \item Inner source IP address
+      \item Inner destination IP address
+      \item Inner source UDP port
+      \item Inner destination UDP port
+    \end{itemize}
+  \item Else if both VIRTIO_NET_HASH_TYPE_GRE_INNER and VIRTIO_NET_HASH_TYPE_IPv4
+      bits are set, the hash is calculated over the following fields:
+    \begin{itemsize}
+      \item Inner source IP address
+      \item Inner destination IP address
+    \end{itemsize}
+  \item Else the device does not calculate the hash
+\end{itemize}
+
+The device calculates the hash on GRE-encapsulated packets whose inner payloads
+are IPv6 packets without extension headers according to 'Enabled hash types'
+bitmasks as follows:
+\begin{itemsize}
+  \item If both VIRTIO_NET_HASH_TYPE_GRE_INNER and VIRTIO_NET_HASH_TYPE_TCPv6
+      bits are set, and the GRE-encapsulated packet has an inner TCPv6 header in
+      its payload, the hash is calculated over the following fields:
+    \begin{itemsize}
+      \item Inner source IPv6 address
+      \item Inner destination IPv6 address
+      \item Inner source TCP port
+      \item Inner destination TCP port
+    \end{itemsize}
+  \item Else if both VIRTIO_NET_HASH_TYPE_GRE_INNER and VIRTIO_NET_HASH_TYPE_UDPv6
+      bits are set, and the GRE-encapsulated packet has an inner UDPv6 header in
+      its payload, the hash is calculated over the following fields:
+    \begin{itemsize}
+      \item Inner source IPv6 address
+      \item Inner destination IPv6 address
+      \item Inner source UDP port
+      \item Inner destination UDP port
+    \end{itemize}
+  \item Else if both VIRTIO_NET_HASH_TYPE_GRE_INNER and VIRTIO_NET_HASH_TYPE_IPv6
+      bits are set, the hash is calculated over the following fields:
+    \begin{itemsize}
+      \item Inner source IPv6 address
+      \item Inner destination IPv6 address
+    \end{itemsize}
+  \item Else the device does not calculate the hash
+\end{itemize}

content.tex \subsubsection{Processing of Incoming Packets}\label{sec:Device Types / Network · line 4056

Quoted 10 lines
content.tex +10 -0
+
+The device calculates the hash on GRE-encapsulated packets whose inner payloads
+are IPv6 packets with extension headers according to 'Enabled hash types'
+bitmasks as follows:
+\begin{itemsize}
+  \item If both VIRTIO_NET_HASH_TYPE_GRE_INNER and VIRTIO_NET_HASH_TYPE_TCP_EX
+      bits are set, and the GRE-encapsulated packet has an inner TCPv6 header in
+      its payload, the hash is calculated over the following fields:
+    \begin{itemize}
+      \item Home address from the home address option in the IPv6 destination options

Is this inner or outer?

Thanks

Quoted 46 lines
content.tex +37 -0
+          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 both VIRTIO_NET_HASH_TYPE_GRE_INNER and VIRTIO_NET_HASH_TYPE_UDP_EX
+  bits are set, and the GRE-encapsulated packet has an inner UDPv6 header in its
+  payload, the hash is calculated over the following fields:
+    \begin{itemsize}
+      \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 both VIRTIO_NET_HASH_TYPE_GRE_INNER and VIRTIO_NET_HASH_TYPE_IP_EX
+      bits are set, the hash is calculated over the following fields:
+    \begin{itemsize}
+      \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
+      a GRE-encapsulated packet whose inner payload is an IPv6 packet without
+      extension headers
+\end{itemsize}
+
  \paragraph{Hash reporting for incoming packets}
  \label{sec:Device Types / Network Device / Device Operation / Processing of Incoming Packets / Hash reporting for incoming packets}
 
@@ -4005,6 +4117,10 @@ \subsubsection{Processing of Incoming Packets}\label{sec:Device Types / Network
  #define VIRTIO_NET_HASH_REPORT_UDPv6_EX        9
  \end{lstlisting}
 
+VIRTIO_NET_HASH_TYPE_GRE_INNER bit is not included in \field{hash_report},
+it just indicates that the hash is calculated using the inner header inside
+the GRE-encapsulated packet.
+
  \subsubsection{Control Virtqueue}\label{sec:Device Types / Network Device / Device Operation / Control Virtqueue}
 
Quoted 4 lines
Quoted 4 lines
content.tex +0 -1
  The driver uses the control virtqueue (if VIRTIO_NET_F_CTRL_VQ is
--

2.19.1.6.gb485710b

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

#6 lore raw

I would suggest to specify also the hash type the device should report in case the hash reporting feature is enabled. For example, should the device specify somehow in the report that the hash was calculated on the inner header or on the regular header?

Quoted 171 lines · Heng Qi
Quoted 37 lines · Jason Wang
Quoted 36 lines · Heng Qi

From: Heng Qi <[email protected]>

When VIRTIO_NET_F_RSS is negotiated and the tunnel is used to encapsulate the packets, the hash calculated using the outer header of the receive packets is always fixed for the same flow packets, i.e. they will be steered to the same receive queue.

We add a VIRTIO_NET_HASH_TYPE_GRE_INNER bitmask in \field{hash_types}, which instructs the device to calculate the hash using the inner headers of GRE-encapsulated packets.

---
  content.tex | 116 ++++++++++++++++++++++++++++++++++++++++++++++++++++
  1 file changed, 116 insertions(+)
content.tex +4 -0
index 6fabf1d..319d401 100644
@@ -3883,6 +3883,10 @@ \subsubsection{Processing of Incoming Packets}\label{sec:Device Types / Network
  #define VIRTIO_NET_HASH_TYPE_TCP_EX            (1 << 7)
  #define VIRTIO_NET_HASH_TYPE_UDP_EX            (1 << 8)
  \end{lstlisting}
+Hash types applicable to inner payloads of GRE-encapsulated packets
+\begin{lstlisting}
+#define VIRTIO_NET_HASH_TYPE_GRE_INNER         (1 << 9)
+\end{lstlisting}
 
  \subparagraph{IPv4 packets}
  \label{sec:Device Types / Network Device / Device Operation / Processing of Incoming Packets / Hash calculation for incoming packets / IPv4 packets}
@@ -3975,6 +3979,114 @@ \subsubsection{Processing of Incoming Packets}\label{sec:Device Types / Network
  (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}
 
Quoted 5 lines

content.tex \subsubsection{Processing of Incoming Packets}\label{sec:Device Types / Network · line 3985

Quoted 4 lines
content.tex +4 -0
+\subparagraph{Inner payloads of GRE-encapsulated packets}
+\label{sec:Device Types / Network Device / Device Operation / Processing of Incoming Packets / Hash calculation for incoming packets / Inner payloads of GRE-encapsulated packets}}
+VIRTIO_NET_HASH_TYPE_GRE_INNER bit MUST be set at the same time as one of
+the bits between VIRTIO_NET_HASH_TYPE_IPv4 and VIRTIO_NET_HASH_TYPE_UDP_EX.

"MUST" keyword must belong to the normative section.

Okay. Thanks for pointing out.

Quoted 122 lines
Quoted 62 lines
content.tex +61 -0
+
+The device calculates the hash on GRE-encapsulated packets whose inner payloads
+are IPv4 packets according to 'Enabled hash types' bitmasks as follows:
+\begin{itemize}
+  \item If both VIRTIO_NET_HASH_TYPE_GRE_INNER and VIRTIO_NET_HASH_TYPE_TCPv4 bits
+      are set, and the GRE-encapsulated packet has an inner TCPv4 header in its
+      payload, the hash is calculated over the following fields:
+    \begin{itemsize}
+      \item Inner source IP address
+      \item Inner destination IP address
+      \item Inner source TCP port
+      \item Inner destination TCP port
+    \end{itemsize}
+  \item Else if both VIRTIO_NET_HASH_TYPE_GRE_INNER and VIRTIO_NET_HASH_TYPE_UDPv4
+      bits are set, and the GRE-encapsulated packet has an inner UDPv4 header in
+      its payload, the hash is calculated over the following fields:
+    \begin{itemsize}
+      \item Inner source IP address
+      \item Inner destination IP address
+      \item Inner source UDP port
+      \item Inner destination UDP port
+    \end{itemize}
+  \item Else if both VIRTIO_NET_HASH_TYPE_GRE_INNER and VIRTIO_NET_HASH_TYPE_IPv4
+      bits are set, the hash is calculated over the following fields:
+    \begin{itemsize}
+      \item Inner source IP address
+      \item Inner destination IP address
+    \end{itemsize}
+  \item Else the device does not calculate the hash
+\end{itemize}
+
+The device calculates the hash on GRE-encapsulated packets whose inner payloads
+are IPv6 packets without extension headers according to 'Enabled hash types'
+bitmasks as follows:
+\begin{itemsize}
+  \item If both VIRTIO_NET_HASH_TYPE_GRE_INNER and VIRTIO_NET_HASH_TYPE_TCPv6
+      bits are set, and the GRE-encapsulated packet has an inner TCPv6 header in
+      its payload, the hash is calculated over the following fields:
+    \begin{itemsize}
+      \item Inner source IPv6 address
+      \item Inner destination IPv6 address
+      \item Inner source TCP port
+      \item Inner destination TCP port
+    \end{itemsize}
+  \item Else if both VIRTIO_NET_HASH_TYPE_GRE_INNER and VIRTIO_NET_HASH_TYPE_UDPv6
+      bits are set, and the GRE-encapsulated packet has an inner UDPv6 header in
+      its payload, the hash is calculated over the following fields:
+    \begin{itemsize}
+      \item Inner source IPv6 address
+      \item Inner destination IPv6 address
+      \item Inner source UDP port
+      \item Inner destination UDP port
+    \end{itemize}
+  \item Else if both VIRTIO_NET_HASH_TYPE_GRE_INNER and VIRTIO_NET_HASH_TYPE_IPv6
+      bits are set, the hash is calculated over the following fields:
+    \begin{itemsize}
+      \item Inner source IPv6 address
+      \item Inner destination IPv6 address
+    \end{itemsize}
+  \item Else the device does not calculate the hash
+\end{itemize}

content.tex \subsubsection{Processing of Incoming Packets}\label{sec:Device Types / Network · line 4056

Quoted 10 lines
content.tex +10 -0
+
+The device calculates the hash on GRE-encapsulated packets whose inner payloads
+are IPv6 packets with extension headers according to 'Enabled hash types'
+bitmasks as follows:
+\begin{itemsize}
+  \item If both VIRTIO_NET_HASH_TYPE_GRE_INNER and VIRTIO_NET_HASH_TYPE_TCP_EX
+      bits are set, and the GRE-encapsulated packet has an inner TCPv6 header in
+      its payload, the hash is calculated over the following fields:
+    \begin{itemize}
+      \item Home address from the home address option in the IPv6 destination options

Is this inner or outer?

Thanks

Quoted 46 lines
content.tex +37 -0
+          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 both VIRTIO_NET_HASH_TYPE_GRE_INNER and VIRTIO_NET_HASH_TYPE_UDP_EX
+  bits are set, and the GRE-encapsulated packet has an inner UDPv6 header in its
+  payload, the hash is calculated over the following fields:
+    \begin{itemsize}
+      \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 both VIRTIO_NET_HASH_TYPE_GRE_INNER and VIRTIO_NET_HASH_TYPE_IP_EX
+      bits are set, the hash is calculated over the following fields:
+    \begin{itemsize}
+      \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
+      a GRE-encapsulated packet whose inner payload is an IPv6 packet without
+      extension headers
+\end{itemsize}
+
  \paragraph{Hash reporting for incoming packets}
  \label{sec:Device Types / Network Device / Device Operation / Processing of Incoming Packets / Hash reporting for incoming packets}
 
@@ -4005,6 +4117,10 @@ \subsubsection{Processing of Incoming Packets}\label{sec:Device Types / Network
  #define VIRTIO_NET_HASH_REPORT_UDPv6_EX        9
  \end{lstlisting}
 
+VIRTIO_NET_HASH_TYPE_GRE_INNER bit is not included in \field{hash_report},
+it just indicates that the hash is calculated using the inner header inside
+the GRE-encapsulated packet.
+
  \subsubsection{Control Virtqueue}\label{sec:Device Types / Network Device / Device Operation / Control Virtqueue}
 
Quoted 10 lines
Quoted 4 lines
Quoted 4 lines
content.tex +0 -1
  The driver uses the control virtqueue (if VIRTIO_NET_F_CTRL_VQ is
--

2.19.1.6.gb485710b

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

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

author
#7 lore raw
Quoted 4 lines · Yuri Benditovich

I would suggest to specify also the hash type the device should report in case the hash reporting feature is enabled. For example, should the device specify somehow in the report that the hash was calculated on the inner header or on the regular header?

It seems unnecessary. The calculation of RSS hash using the regular or inner header is actually transparent to the driver, and after the hash value and hash type calculated by the device, the feedback on skb is that skb only has L4 or L3 hash boolean type.

Thanks.

Quoted 170 lines · Heng Qi
Quoted 168 lines · Jason Wang
Quoted 37 lines · Heng Qi
Quoted 36 lines

From: Heng Qi <[email protected]>

When VIRTIO_NET_F_RSS is negotiated and the tunnel is used to encapsulate the packets, the hash calculated using the outer header of the receive packets is always fixed for the same flow packets, i.e. they will be steered to the same receive queue.

We add a VIRTIO_NET_HASH_TYPE_GRE_INNER bitmask in \field{hash_types}, which instructs the device to calculate the hash using the inner headers of GRE-encapsulated packets.

---
   content.tex | 116 ++++++++++++++++++++++++++++++++++++++++++++++++++++
   1 file changed, 116 insertions(+)
content.tex +4 -0
index 6fabf1d..319d401 100644
@@ -3883,6 +3883,10 @@ \subsubsection{Processing of Incoming Packets}\label{sec:Device Types / Network
   #define VIRTIO_NET_HASH_TYPE_TCP_EX            (1 << 7)
   #define VIRTIO_NET_HASH_TYPE_UDP_EX            (1 << 8)
   \end{lstlisting}
+Hash types applicable to inner payloads of GRE-encapsulated packets
+\begin{lstlisting}
+#define VIRTIO_NET_HASH_TYPE_GRE_INNER         (1 << 9)
+\end{lstlisting}
 
   \subparagraph{IPv4 packets}
   \label{sec:Device Types / Network Device / Device Operation / Processing of Incoming Packets / Hash calculation for incoming packets / IPv4 packets}
@@ -3975,6 +3979,114 @@ \subsubsection{Processing of Incoming Packets}\label{sec:Device Types / Network
   (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}
 
Quoted 5 lines

content.tex \subsubsection{Processing of Incoming Packets}\label{sec:Device Types / Network · line 3985

Quoted 4 lines
content.tex +4 -0
+\subparagraph{Inner payloads of GRE-encapsulated packets}
+\label{sec:Device Types / Network Device / Device Operation / Processing of Incoming Packets / Hash calculation for incoming packets / Inner payloads of GRE-encapsulated packets}}
+VIRTIO_NET_HASH_TYPE_GRE_INNER bit MUST be set at the same time as one of
+the bits between VIRTIO_NET_HASH_TYPE_IPv4 and VIRTIO_NET_HASH_TYPE_UDP_EX.

"MUST" keyword must belong to the normative section.

Okay. Thanks for pointing out.

Quoted 121 lines
Quoted 61 lines
content.tex +61 -0
+
+The device calculates the hash on GRE-encapsulated packets whose inner payloads
+are IPv4 packets according to 'Enabled hash types' bitmasks as follows:
+\begin{itemize}
+  \item If both VIRTIO_NET_HASH_TYPE_GRE_INNER and VIRTIO_NET_HASH_TYPE_TCPv4 bits
+      are set, and the GRE-encapsulated packet has an inner TCPv4 header in its
+      payload, the hash is calculated over the following fields:
+    \begin{itemsize}
+      \item Inner source IP address
+      \item Inner destination IP address
+      \item Inner source TCP port
+      \item Inner destination TCP port
+    \end{itemsize}
+  \item Else if both VIRTIO_NET_HASH_TYPE_GRE_INNER and VIRTIO_NET_HASH_TYPE_UDPv4
+      bits are set, and the GRE-encapsulated packet has an inner UDPv4 header in
+      its payload, the hash is calculated over the following fields:
+    \begin{itemsize}
+      \item Inner source IP address
+      \item Inner destination IP address
+      \item Inner source UDP port
+      \item Inner destination UDP port
+    \end{itemize}
+  \item Else if both VIRTIO_NET_HASH_TYPE_GRE_INNER and VIRTIO_NET_HASH_TYPE_IPv4
+      bits are set, the hash is calculated over the following fields:
+    \begin{itemsize}
+      \item Inner source IP address
+      \item Inner destination IP address
+    \end{itemsize}
+  \item Else the device does not calculate the hash
+\end{itemize}
+
+The device calculates the hash on GRE-encapsulated packets whose inner payloads
+are IPv6 packets without extension headers according to 'Enabled hash types'
+bitmasks as follows:
+\begin{itemsize}
+  \item If both VIRTIO_NET_HASH_TYPE_GRE_INNER and VIRTIO_NET_HASH_TYPE_TCPv6
+      bits are set, and the GRE-encapsulated packet has an inner TCPv6 header in
+      its payload, the hash is calculated over the following fields:
+    \begin{itemsize}
+      \item Inner source IPv6 address
+      \item Inner destination IPv6 address
+      \item Inner source TCP port
+      \item Inner destination TCP port
+    \end{itemsize}
+  \item Else if both VIRTIO_NET_HASH_TYPE_GRE_INNER and VIRTIO_NET_HASH_TYPE_UDPv6
+      bits are set, and the GRE-encapsulated packet has an inner UDPv6 header in
+      its payload, the hash is calculated over the following fields:
+    \begin{itemsize}
+      \item Inner source IPv6 address
+      \item Inner destination IPv6 address
+      \item Inner source UDP port
+      \item Inner destination UDP port
+    \end{itemize}
+  \item Else if both VIRTIO_NET_HASH_TYPE_GRE_INNER and VIRTIO_NET_HASH_TYPE_IPv6
+      bits are set, the hash is calculated over the following fields:
+    \begin{itemsize}
+      \item Inner source IPv6 address
+      \item Inner destination IPv6 address
+    \end{itemsize}
+  \item Else the device does not calculate the hash
+\end{itemize}

content.tex \subsubsection{Processing of Incoming Packets}\label{sec:Device Types / Network · line 4056

Quoted 10 lines
content.tex +10 -0
+
+The device calculates the hash on GRE-encapsulated packets whose inner payloads
+are IPv6 packets with extension headers according to 'Enabled hash types'
+bitmasks as follows:
+\begin{itemsize}
+  \item If both VIRTIO_NET_HASH_TYPE_GRE_INNER and VIRTIO_NET_HASH_TYPE_TCP_EX
+      bits are set, and the GRE-encapsulated packet has an inner TCPv6 header in
+      its payload, the hash is calculated over the following fields:
+    \begin{itemize}
+      \item Home address from the home address option in the IPv6 destination options

Is this inner or outer?

Thanks

Quoted 46 lines
content.tex +37 -0
+          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 both VIRTIO_NET_HASH_TYPE_GRE_INNER and VIRTIO_NET_HASH_TYPE_UDP_EX
+  bits are set, and the GRE-encapsulated packet has an inner UDPv6 header in its
+  payload, the hash is calculated over the following fields:
+    \begin{itemsize}
+      \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 both VIRTIO_NET_HASH_TYPE_GRE_INNER and VIRTIO_NET_HASH_TYPE_IP_EX
+      bits are set, the hash is calculated over the following fields:
+    \begin{itemsize}
+      \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
+      a GRE-encapsulated packet whose inner payload is an IPv6 packet without
+      extension headers
+\end{itemsize}
+
   \paragraph{Hash reporting for incoming packets}
   \label{sec:Device Types / Network Device / Device Operation / Processing of Incoming Packets / Hash reporting for incoming packets}
 
@@ -4005,6 +4117,10 @@ \subsubsection{Processing of Incoming Packets}\label{sec:Device Types / Network
   #define VIRTIO_NET_HASH_REPORT_UDPv6_EX        9
   \end{lstlisting}
 
+VIRTIO_NET_HASH_TYPE_GRE_INNER bit is not included in \field{hash_report},
+it just indicates that the hash is calculated using the inner header inside
+the GRE-encapsulated packet.
+
   \subsubsection{Control Virtqueue}\label{sec:Device Types / Network Device / Device Operation / Control Virtqueue}
 
Quoted 9 lines
Quoted 9 lines
Quoted 4 lines
Quoted 4 lines
content.tex +0 -1
   The driver uses the control virtqueue (if VIRTIO_NET_F_CTRL_VQ is
--

2.19.1.6.gb485710b

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

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

#8 lore raw
Quoted 9 lines · Heng Qi
Quoted 4 lines · Yuri Benditovich

I would suggest to specify also the hash type the device should report in case the hash reporting feature is enabled. For example, should the device specify somehow in the report that the hash was calculated on the inner header or on the regular header?

Quoted 5 lines

It seems unnecessary. The calculation of RSS hash using the regular or inner header is actually
transparent to the driver, and after the hash value and hash type calculated by the device,
the feedback on skb is that skb only has L4 or L3 hash boolean type.

I think what Yuri meant is what if the user wants to calculate hash based on the inner header? Do we need VIRTIO_NET_HASH_TYPE_GRE_XXX?

Thanks

Quoted 184 lines

Thanks.

Quoted 170 lines · Heng Qi
Quoted 168 lines · Jason Wang
Quoted 37 lines · Heng Qi
Quoted 36 lines

From: Heng Qi <[email protected]>

When VIRTIO_NET_F_RSS is negotiated and the tunnel is used to encapsulate the packets, the hash calculated using the outer header of the receive packets is always fixed for the same flow packets, i.e. they will be steered to the same receive queue.

We add a VIRTIO_NET_HASH_TYPE_GRE_INNER bitmask in \field{hash_types}, which instructs the device to calculate the hash using the inner headers of GRE-encapsulated packets.

---
   content.tex | 116 ++++++++++++++++++++++++++++++++++++++++++++++++++++
   1 file changed, 116 insertions(+)
content.tex +4 -0
index 6fabf1d..319d401 100644
@@ -3883,6 +3883,10 @@ \subsubsection{Processing of Incoming Packets}\label{sec:Device Types / Network
   #define VIRTIO_NET_HASH_TYPE_TCP_EX            (1 << 7)
   #define VIRTIO_NET_HASH_TYPE_UDP_EX            (1 << 8)
   \end{lstlisting}
+Hash types applicable to inner payloads of GRE-encapsulated packets
+\begin{lstlisting}
+#define VIRTIO_NET_HASH_TYPE_GRE_INNER         (1 << 9)
+\end{lstlisting}
 
   \subparagraph{IPv4 packets}
   \label{sec:Device Types / Network Device / Device Operation / Processing of Incoming Packets / Hash calculation for incoming packets / IPv4 packets}
@@ -3975,6 +3979,114 @@ \subsubsection{Processing of Incoming Packets}\label{sec:Device Types / Network
   (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}
 
Quoted 5 lines

content.tex \subsubsection{Processing of Incoming Packets}\label{sec:Device Types / Network · line 3985

Quoted 4 lines
content.tex +4 -0
+\subparagraph{Inner payloads of GRE-encapsulated packets}
+\label{sec:Device Types / Network Device / Device Operation / Processing of Incoming Packets / Hash calculation for incoming packets / Inner payloads of GRE-encapsulated packets}}
+VIRTIO_NET_HASH_TYPE_GRE_INNER bit MUST be set at the same time as one of
+the bits between VIRTIO_NET_HASH_TYPE_IPv4 and VIRTIO_NET_HASH_TYPE_UDP_EX.

"MUST" keyword must belong to the normative section.

Okay. Thanks for pointing out.

Quoted 121 lines
Quoted 61 lines
content.tex +61 -0
+
+The device calculates the hash on GRE-encapsulated packets whose inner payloads
+are IPv4 packets according to 'Enabled hash types' bitmasks as follows:
+\begin{itemize}
+  \item If both VIRTIO_NET_HASH_TYPE_GRE_INNER and VIRTIO_NET_HASH_TYPE_TCPv4 bits
+      are set, and the GRE-encapsulated packet has an inner TCPv4 header in its
+      payload, the hash is calculated over the following fields:
+    \begin{itemsize}
+      \item Inner source IP address
+      \item Inner destination IP address
+      \item Inner source TCP port
+      \item Inner destination TCP port
+    \end{itemsize}
+  \item Else if both VIRTIO_NET_HASH_TYPE_GRE_INNER and VIRTIO_NET_HASH_TYPE_UDPv4
+      bits are set, and the GRE-encapsulated packet has an inner UDPv4 header in
+      its payload, the hash is calculated over the following fields:
+    \begin{itemsize}
+      \item Inner source IP address
+      \item Inner destination IP address
+      \item Inner source UDP port
+      \item Inner destination UDP port
+    \end{itemize}
+  \item Else if both VIRTIO_NET_HASH_TYPE_GRE_INNER and VIRTIO_NET_HASH_TYPE_IPv4
+      bits are set, the hash is calculated over the following fields:
+    \begin{itemsize}
+      \item Inner source IP address
+      \item Inner destination IP address
+    \end{itemsize}
+  \item Else the device does not calculate the hash
+\end{itemize}
+
+The device calculates the hash on GRE-encapsulated packets whose inner payloads
+are IPv6 packets without extension headers according to 'Enabled hash types'
+bitmasks as follows:
+\begin{itemsize}
+  \item If both VIRTIO_NET_HASH_TYPE_GRE_INNER and VIRTIO_NET_HASH_TYPE_TCPv6
+      bits are set, and the GRE-encapsulated packet has an inner TCPv6 header in
+      its payload, the hash is calculated over the following fields:
+    \begin{itemsize}
+      \item Inner source IPv6 address
+      \item Inner destination IPv6 address
+      \item Inner source TCP port
+      \item Inner destination TCP port
+    \end{itemsize}
+  \item Else if both VIRTIO_NET_HASH_TYPE_GRE_INNER and VIRTIO_NET_HASH_TYPE_UDPv6
+      bits are set, and the GRE-encapsulated packet has an inner UDPv6 header in
+      its payload, the hash is calculated over the following fields:
+    \begin{itemsize}
+      \item Inner source IPv6 address
+      \item Inner destination IPv6 address
+      \item Inner source UDP port
+      \item Inner destination UDP port
+    \end{itemize}
+  \item Else if both VIRTIO_NET_HASH_TYPE_GRE_INNER and VIRTIO_NET_HASH_TYPE_IPv6
+      bits are set, the hash is calculated over the following fields:
+    \begin{itemsize}
+      \item Inner source IPv6 address
+      \item Inner destination IPv6 address
+    \end{itemsize}
+  \item Else the device does not calculate the hash
+\end{itemize}

content.tex \subsubsection{Processing of Incoming Packets}\label{sec:Device Types / Network · line 4056

Quoted 10 lines
content.tex +10 -0
+
+The device calculates the hash on GRE-encapsulated packets whose inner payloads
+are IPv6 packets with extension headers according to 'Enabled hash types'
+bitmasks as follows:
+\begin{itemsize}
+  \item If both VIRTIO_NET_HASH_TYPE_GRE_INNER and VIRTIO_NET_HASH_TYPE_TCP_EX
+      bits are set, and the GRE-encapsulated packet has an inner TCPv6 header in
+      its payload, the hash is calculated over the following fields:
+    \begin{itemize}
+      \item Home address from the home address option in the IPv6 destination options

Is this inner or outer?

Thanks

Quoted 46 lines
content.tex +37 -0
+          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 both VIRTIO_NET_HASH_TYPE_GRE_INNER and VIRTIO_NET_HASH_TYPE_UDP_EX
+  bits are set, and the GRE-encapsulated packet has an inner UDPv6 header in its
+  payload, the hash is calculated over the following fields:
+    \begin{itemsize}
+      \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 both VIRTIO_NET_HASH_TYPE_GRE_INNER and VIRTIO_NET_HASH_TYPE_IP_EX
+      bits are set, the hash is calculated over the following fields:
+    \begin{itemsize}
+      \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
+      a GRE-encapsulated packet whose inner payload is an IPv6 packet without
+      extension headers
+\end{itemsize}
+
   \paragraph{Hash reporting for incoming packets}
   \label{sec:Device Types / Network Device / Device Operation / Processing of Incoming Packets / Hash reporting for incoming packets}
 
@@ -4005,6 +4117,10 @@ \subsubsection{Processing of Incoming Packets}\label{sec:Device Types / Network
   #define VIRTIO_NET_HASH_REPORT_UDPv6_EX        9
   \end{lstlisting}
 
+VIRTIO_NET_HASH_TYPE_GRE_INNER bit is not included in \field{hash_report},
+it just indicates that the hash is calculated using the inner header inside
+the GRE-encapsulated packet.
+
   \subsubsection{Control Virtqueue}\label{sec:Device Types / Network Device / Device Operation / Control Virtqueue}
 
Quoted 9 lines
Quoted 9 lines
Quoted 4 lines
Quoted 4 lines
content.tex +0 -1
   The driver uses the control virtqueue (if VIRTIO_NET_F_CTRL_VQ is
--

2.19.1.6.gb485710b

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

Quoted 4 lines

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

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

author
#9 lore raw
Quoted 8 lines · Jason Wang
Quoted 7 lines · Heng Qi
Quoted 4 lines · Yuri Benditovich

I would suggest to specify also the hash type the device should report in case the hash reporting feature is enabled. For example, should the device specify somehow in the report that the hash was calculated on the inner header or on the regular header?

Quoted 7 lines
Quoted 5 lines

It seems unnecessary. The calculation of RSS hash using the regular or inner header is actually
transparent to the driver, and after the hash value and hash type calculated by the device,
the feedback on skb is that skb only has L4 or L3 hash boolean type.

I think what Yuri meant is what if the user wants to calculate hash based on the inner header? Do we need VIRTIO_NET_HASH_TYPE_GRE_XXX?

Yes, if the user wants to calculate the hash on the inner header, then we need VIRTIO_NET_HASH_TYPE_GRE_INNER, if the user wants to calculate the hash on the outer header, then we don’t need to use VIRTIO_NET_HASH_TYPE_GRE_INNER, just keep the previous default behavior.

This is a configurable hash specification.

Thanks.

Quoted 186 lines

Thanks

Quoted 183 lines

Thanks.

Quoted 168 lines · Heng Qi
Quoted 167 lines · Jason Wang
Quoted 37 lines · Heng Qi
Quoted 36 lines

From: Heng Qi <[email protected]>

When VIRTIO_NET_F_RSS is negotiated and the tunnel is used to encapsulate the packets, the hash calculated using the outer header of the receive packets is always fixed for the same flow packets, i.e. they will be steered to the same receive queue.

We add a VIRTIO_NET_HASH_TYPE_GRE_INNER bitmask in \field{hash_types}, which instructs the device to calculate the hash using the inner headers of GRE-encapsulated packets.

---
    content.tex | 116 ++++++++++++++++++++++++++++++++++++++++++++++++++++
    1 file changed, 116 insertions(+)
content.tex +4 -0
index 6fabf1d..319d401 100644
@@ -3883,6 +3883,10 @@ \subsubsection{Processing of Incoming Packets}\label{sec:Device Types / Network
    #define VIRTIO_NET_HASH_TYPE_TCP_EX            (1 << 7)
    #define VIRTIO_NET_HASH_TYPE_UDP_EX            (1 << 8)
    \end{lstlisting}
+Hash types applicable to inner payloads of GRE-encapsulated packets
+\begin{lstlisting}
+#define VIRTIO_NET_HASH_TYPE_GRE_INNER         (1 << 9)
+\end{lstlisting}
 
    \subparagraph{IPv4 packets}
    \label{sec:Device Types / Network Device / Device Operation / Processing of Incoming Packets / Hash calculation for incoming packets / IPv4 packets}
@@ -3975,6 +3979,114 @@ \subsubsection{Processing of Incoming Packets}\label{sec:Device Types / Network
    (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}
 
Quoted 5 lines

content.tex \subsubsection{Processing of Incoming Packets}\label{sec:Device Types / Network · line 3985

Quoted 4 lines
content.tex +4 -0
+\subparagraph{Inner payloads of GRE-encapsulated packets}
+\label{sec:Device Types / Network Device / Device Operation / Processing of Incoming Packets / Hash calculation for incoming packets / Inner payloads of GRE-encapsulated packets}}
+VIRTIO_NET_HASH_TYPE_GRE_INNER bit MUST be set at the same time as one of
+the bits between VIRTIO_NET_HASH_TYPE_IPv4 and VIRTIO_NET_HASH_TYPE_UDP_EX.

"MUST" keyword must belong to the normative section.

Okay. Thanks for pointing out.

Quoted 121 lines
Quoted 61 lines
content.tex +61 -0
+
+The device calculates the hash on GRE-encapsulated packets whose inner payloads
+are IPv4 packets according to 'Enabled hash types' bitmasks as follows:
+\begin{itemize}
+  \item If both VIRTIO_NET_HASH_TYPE_GRE_INNER and VIRTIO_NET_HASH_TYPE_TCPv4 bits
+      are set, and the GRE-encapsulated packet has an inner TCPv4 header in its
+      payload, the hash is calculated over the following fields:
+    \begin{itemsize}
+      \item Inner source IP address
+      \item Inner destination IP address
+      \item Inner source TCP port
+      \item Inner destination TCP port
+    \end{itemsize}
+  \item Else if both VIRTIO_NET_HASH_TYPE_GRE_INNER and VIRTIO_NET_HASH_TYPE_UDPv4
+      bits are set, and the GRE-encapsulated packet has an inner UDPv4 header in
+      its payload, the hash is calculated over the following fields:
+    \begin{itemsize}
+      \item Inner source IP address
+      \item Inner destination IP address
+      \item Inner source UDP port
+      \item Inner destination UDP port
+    \end{itemize}
+  \item Else if both VIRTIO_NET_HASH_TYPE_GRE_INNER and VIRTIO_NET_HASH_TYPE_IPv4
+      bits are set, the hash is calculated over the following fields:
+    \begin{itemsize}
+      \item Inner source IP address
+      \item Inner destination IP address
+    \end{itemsize}
+  \item Else the device does not calculate the hash
+\end{itemize}
+
+The device calculates the hash on GRE-encapsulated packets whose inner payloads
+are IPv6 packets without extension headers according to 'Enabled hash types'
+bitmasks as follows:
+\begin{itemsize}
+  \item If both VIRTIO_NET_HASH_TYPE_GRE_INNER and VIRTIO_NET_HASH_TYPE_TCPv6
+      bits are set, and the GRE-encapsulated packet has an inner TCPv6 header in
+      its payload, the hash is calculated over the following fields:
+    \begin{itemsize}
+      \item Inner source IPv6 address
+      \item Inner destination IPv6 address
+      \item Inner source TCP port
+      \item Inner destination TCP port
+    \end{itemsize}
+  \item Else if both VIRTIO_NET_HASH_TYPE_GRE_INNER and VIRTIO_NET_HASH_TYPE_UDPv6
+      bits are set, and the GRE-encapsulated packet has an inner UDPv6 header in
+      its payload, the hash is calculated over the following fields:
+    \begin{itemsize}
+      \item Inner source IPv6 address
+      \item Inner destination IPv6 address
+      \item Inner source UDP port
+      \item Inner destination UDP port
+    \end{itemize}
+  \item Else if both VIRTIO_NET_HASH_TYPE_GRE_INNER and VIRTIO_NET_HASH_TYPE_IPv6
+      bits are set, the hash is calculated over the following fields:
+    \begin{itemsize}
+      \item Inner source IPv6 address
+      \item Inner destination IPv6 address
+    \end{itemsize}
+  \item Else the device does not calculate the hash
+\end{itemize}

content.tex \subsubsection{Processing of Incoming Packets}\label{sec:Device Types / Network · line 4056

Quoted 10 lines
content.tex +10 -0
+
+The device calculates the hash on GRE-encapsulated packets whose inner payloads
+are IPv6 packets with extension headers according to 'Enabled hash types'
+bitmasks as follows:
+\begin{itemsize}
+  \item If both VIRTIO_NET_HASH_TYPE_GRE_INNER and VIRTIO_NET_HASH_TYPE_TCP_EX
+      bits are set, and the GRE-encapsulated packet has an inner TCPv6 header in
+      its payload, the hash is calculated over the following fields:
+    \begin{itemize}
+      \item Home address from the home address option in the IPv6 destination options

Is this inner or outer?

Thanks

Quoted 46 lines
content.tex +37 -0
+          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 both VIRTIO_NET_HASH_TYPE_GRE_INNER and VIRTIO_NET_HASH_TYPE_UDP_EX
+  bits are set, and the GRE-encapsulated packet has an inner UDPv6 header in its
+  payload, the hash is calculated over the following fields:
+    \begin{itemsize}
+      \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 both VIRTIO_NET_HASH_TYPE_GRE_INNER and VIRTIO_NET_HASH_TYPE_IP_EX
+      bits are set, the hash is calculated over the following fields:
+    \begin{itemsize}
+      \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
+      a GRE-encapsulated packet whose inner payload is an IPv6 packet without
+      extension headers
+\end{itemsize}
+
    \paragraph{Hash reporting for incoming packets}
    \label{sec:Device Types / Network Device / Device Operation / Processing of Incoming Packets / Hash reporting for incoming packets}
 
@@ -4005,6 +4117,10 @@ \subsubsection{Processing of Incoming Packets}\label{sec:Device Types / Network
    #define VIRTIO_NET_HASH_REPORT_UDPv6_EX        9
    \end{lstlisting}
 
+VIRTIO_NET_HASH_TYPE_GRE_INNER bit is not included in \field{hash_report},
+it just indicates that the hash is calculated using the inner header inside
+the GRE-encapsulated packet.
+
    \subsubsection{Control Virtqueue}\label{sec:Device Types / Network Device / Device Operation / Control Virtqueue}
 
Quoted 8 lines
Quoted 8 lines
Quoted 4 lines
Quoted 4 lines
content.tex +0 -1
    The driver uses the control virtqueue (if VIRTIO_NET_F_CTRL_VQ is
--

2.19.1.6.gb485710b

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

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

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

#10 lore raw
Quoted 17 lines · Heng Qi
Quoted 13 lines · Jason Wang
Quoted 12 lines · Heng Qi
Quoted 4 lines · Yuri Benditovich

I would suggest to specify also the hash type the device should report in case the hash reporting feature is enabled. For example, should the device specify somehow in the report that the hash was calculated on the inner header or on the regular header?

It seems unnecessary. The calculation of RSS hash using the regular or inner header is actually
transparent to the driver, and after the hash value and hash type calculated by the device,
the feedback on skb is that skb only has L4 or L3 hash boolean type.

Quoted 8 lines
Quoted 2 lines

I think what Yuri meant is what if the user wants to calculate hash based on the inner header? Do we need VIRTIO_NET_HASH_TYPE_GRE_XXX?

Yes, if the user wants to calculate the hash on the inner header, then we need VIRTIO_NET_HASH_TYPE_GRE_INNER,
if the user wants to calculate the hash on the outer header, then we don’t need to use VIRTIO_NET_HASH_TYPE_GRE_INNER,
just keep the previous default behavior.

I actually meant should we add VIRTIO_NET_HASH_REPORT_GRE_XXX?

Thanks

Quoted 192 lines

This is a configurable hash specification.

Thanks.

Quoted 186 lines

Thanks

Quoted 183 lines

Thanks.

Quoted 168 lines · Heng Qi
Quoted 167 lines · Jason Wang
Quoted 37 lines · Heng Qi
Quoted 36 lines

From: Heng Qi <[email protected]>

When VIRTIO_NET_F_RSS is negotiated and the tunnel is used to encapsulate the packets, the hash calculated using the outer header of the receive packets is always fixed for the same flow packets, i.e. they will be steered to the same receive queue.

We add a VIRTIO_NET_HASH_TYPE_GRE_INNER bitmask in \field{hash_types}, which instructs the device to calculate the hash using the inner headers of GRE-encapsulated packets.

---
    content.tex | 116 ++++++++++++++++++++++++++++++++++++++++++++++++++++
    1 file changed, 116 insertions(+)
content.tex +4 -0
index 6fabf1d..319d401 100644
@@ -3883,6 +3883,10 @@ \subsubsection{Processing of Incoming Packets}\label{sec:Device Types / Network
    #define VIRTIO_NET_HASH_TYPE_TCP_EX            (1 << 7)
    #define VIRTIO_NET_HASH_TYPE_UDP_EX            (1 << 8)
    \end{lstlisting}
+Hash types applicable to inner payloads of GRE-encapsulated packets
+\begin{lstlisting}
+#define VIRTIO_NET_HASH_TYPE_GRE_INNER         (1 << 9)
+\end{lstlisting}
 
    \subparagraph{IPv4 packets}
    \label{sec:Device Types / Network Device / Device Operation / Processing of Incoming Packets / Hash calculation for incoming packets / IPv4 packets}
@@ -3975,6 +3979,114 @@ \subsubsection{Processing of Incoming Packets}\label{sec:Device Types / Network
    (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}
 
Quoted 5 lines

content.tex \subsubsection{Processing of Incoming Packets}\label{sec:Device Types / Network · line 3985

Quoted 4 lines
content.tex +4 -0
+\subparagraph{Inner payloads of GRE-encapsulated packets}
+\label{sec:Device Types / Network Device / Device Operation / Processing of Incoming Packets / Hash calculation for incoming packets / Inner payloads of GRE-encapsulated packets}}
+VIRTIO_NET_HASH_TYPE_GRE_INNER bit MUST be set at the same time as one of
+the bits between VIRTIO_NET_HASH_TYPE_IPv4 and VIRTIO_NET_HASH_TYPE_UDP_EX.

"MUST" keyword must belong to the normative section.

Okay. Thanks for pointing out.

Quoted 121 lines
Quoted 61 lines
content.tex +61 -0
+
+The device calculates the hash on GRE-encapsulated packets whose inner payloads
+are IPv4 packets according to 'Enabled hash types' bitmasks as follows:
+\begin{itemize}
+  \item If both VIRTIO_NET_HASH_TYPE_GRE_INNER and VIRTIO_NET_HASH_TYPE_TCPv4 bits
+      are set, and the GRE-encapsulated packet has an inner TCPv4 header in its
+      payload, the hash is calculated over the following fields:
+    \begin{itemsize}
+      \item Inner source IP address
+      \item Inner destination IP address
+      \item Inner source TCP port
+      \item Inner destination TCP port
+    \end{itemsize}
+  \item Else if both VIRTIO_NET_HASH_TYPE_GRE_INNER and VIRTIO_NET_HASH_TYPE_UDPv4
+      bits are set, and the GRE-encapsulated packet has an inner UDPv4 header in
+      its payload, the hash is calculated over the following fields:
+    \begin{itemsize}
+      \item Inner source IP address
+      \item Inner destination IP address
+      \item Inner source UDP port
+      \item Inner destination UDP port
+    \end{itemize}
+  \item Else if both VIRTIO_NET_HASH_TYPE_GRE_INNER and VIRTIO_NET_HASH_TYPE_IPv4
+      bits are set, the hash is calculated over the following fields:
+    \begin{itemsize}
+      \item Inner source IP address
+      \item Inner destination IP address
+    \end{itemsize}
+  \item Else the device does not calculate the hash
+\end{itemize}
+
+The device calculates the hash on GRE-encapsulated packets whose inner payloads
+are IPv6 packets without extension headers according to 'Enabled hash types'
+bitmasks as follows:
+\begin{itemsize}
+  \item If both VIRTIO_NET_HASH_TYPE_GRE_INNER and VIRTIO_NET_HASH_TYPE_TCPv6
+      bits are set, and the GRE-encapsulated packet has an inner TCPv6 header in
+      its payload, the hash is calculated over the following fields:
+    \begin{itemsize}
+      \item Inner source IPv6 address
+      \item Inner destination IPv6 address
+      \item Inner source TCP port
+      \item Inner destination TCP port
+    \end{itemsize}
+  \item Else if both VIRTIO_NET_HASH_TYPE_GRE_INNER and VIRTIO_NET_HASH_TYPE_UDPv6
+      bits are set, and the GRE-encapsulated packet has an inner UDPv6 header in
+      its payload, the hash is calculated over the following fields:
+    \begin{itemsize}
+      \item Inner source IPv6 address
+      \item Inner destination IPv6 address
+      \item Inner source UDP port
+      \item Inner destination UDP port
+    \end{itemize}
+  \item Else if both VIRTIO_NET_HASH_TYPE_GRE_INNER and VIRTIO_NET_HASH_TYPE_IPv6
+      bits are set, the hash is calculated over the following fields:
+    \begin{itemsize}
+      \item Inner source IPv6 address
+      \item Inner destination IPv6 address
+    \end{itemsize}
+  \item Else the device does not calculate the hash
+\end{itemize}

content.tex \subsubsection{Processing of Incoming Packets}\label{sec:Device Types / Network · line 4056

Quoted 10 lines
content.tex +10 -0
+
+The device calculates the hash on GRE-encapsulated packets whose inner payloads
+are IPv6 packets with extension headers according to 'Enabled hash types'
+bitmasks as follows:
+\begin{itemsize}
+  \item If both VIRTIO_NET_HASH_TYPE_GRE_INNER and VIRTIO_NET_HASH_TYPE_TCP_EX
+      bits are set, and the GRE-encapsulated packet has an inner TCPv6 header in
+      its payload, the hash is calculated over the following fields:
+    \begin{itemize}
+      \item Home address from the home address option in the IPv6 destination options

Is this inner or outer?

Thanks

Quoted 46 lines
content.tex +37 -0
+          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 both VIRTIO_NET_HASH_TYPE_GRE_INNER and VIRTIO_NET_HASH_TYPE_UDP_EX
+  bits are set, and the GRE-encapsulated packet has an inner UDPv6 header in its
+  payload, the hash is calculated over the following fields:
+    \begin{itemsize}
+      \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 both VIRTIO_NET_HASH_TYPE_GRE_INNER and VIRTIO_NET_HASH_TYPE_IP_EX
+      bits are set, the hash is calculated over the following fields:
+    \begin{itemsize}
+      \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
+      a GRE-encapsulated packet whose inner payload is an IPv6 packet without
+      extension headers
+\end{itemsize}
+
    \paragraph{Hash reporting for incoming packets}
    \label{sec:Device Types / Network Device / Device Operation / Processing of Incoming Packets / Hash reporting for incoming packets}
 
@@ -4005,6 +4117,10 @@ \subsubsection{Processing of Incoming Packets}\label{sec:Device Types / Network
    #define VIRTIO_NET_HASH_REPORT_UDPv6_EX        9
    \end{lstlisting}
 
+VIRTIO_NET_HASH_TYPE_GRE_INNER bit is not included in \field{hash_report},
+it just indicates that the hash is calculated using the inner header inside
+the GRE-encapsulated packet.
+
    \subsubsection{Control Virtqueue}\label{sec:Device Types / Network Device / Device Operation / Control Virtqueue}
 
Quoted 8 lines
Quoted 8 lines
Quoted 4 lines
Quoted 4 lines
content.tex +0 -1
    The driver uses the control virtqueue (if VIRTIO_NET_F_CTRL_VQ is
--

2.19.1.6.gb485710b

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

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

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

author
#11 lore raw
Quoted 16 lines · Jason Wang
Quoted 15 lines · Heng Qi
Quoted 12 lines · Jason Wang
Quoted 11 lines · Heng Qi
Quoted 4 lines · Yuri Benditovich

I would suggest to specify also the hash type the device should report in case the hash reporting feature is enabled. For example, should the device specify somehow in the report that the hash was calculated on the inner header or on the regular header?

It seems unnecessary. The calculation of RSS hash using the regular or inner header is actually
transparent to the driver, and after the hash value and hash type calculated by the device,
the feedback on skb is that skb only has L4 or L3 hash boolean type.

Quoted 8 lines
Quoted 7 lines
Quoted 2 lines

I think what Yuri meant is what if the user wants to calculate hash based on the inner header? Do we need VIRTIO_NET_HASH_TYPE_GRE_XXX?

Yes, if the user wants to calculate the hash on the inner header, then we need VIRTIO_NET_HASH_TYPE_GRE_INNER,
if the user wants to calculate the hash on the outer header, then we don’t need to use VIRTIO_NET_HASH_TYPE_GRE_INNER,
just keep the previous default behavior.

I actually meant should we add VIRTIO_NET_HASH_REPORT_GRE_XXX?

VIRTIO_NET_HASH_REPORT_GRE_XXX does not seem to need to be added.

_HASH_TYPE_GRE_INNER is a special hash type, which is used in combination with other hash types, indicating that the sd, sdfn, etc. of the inner or outer header are used to calculate the hash. The device can report the following true types to the driver to meet the subsequent requirements of driver.

\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}

As for whether the device uses the outer or inner header to calculate the hash information, the driver does not seem to need to know?

Thanks.

Quoted 190 lines

Thanks

Quoted 187 lines

This is a configurable hash specification.

Thanks.

Quoted 183 lines

Thanks

Quoted 181 lines

Thanks.

Quoted 167 lines · Heng Qi
Quoted 166 lines · Jason Wang
Quoted 37 lines · Heng Qi
Quoted 36 lines

From: Heng Qi <[email protected]>

When VIRTIO_NET_F_RSS is negotiated and the tunnel is used to encapsulate the packets, the hash calculated using the outer header of the receive packets is always fixed for the same flow packets, i.e. they will be steered to the same receive queue.

We add a VIRTIO_NET_HASH_TYPE_GRE_INNER bitmask in \field{hash_types}, which instructs the device to calculate the hash using the inner headers of GRE-encapsulated packets.

---
     content.tex | 116 ++++++++++++++++++++++++++++++++++++++++++++++++++++
     1 file changed, 116 insertions(+)
content.tex +4 -0
index 6fabf1d..319d401 100644
@@ -3883,6 +3883,10 @@ \subsubsection{Processing of Incoming Packets}\label{sec:Device Types / Network
     #define VIRTIO_NET_HASH_TYPE_TCP_EX            (1 << 7)
     #define VIRTIO_NET_HASH_TYPE_UDP_EX            (1 << 8)
     \end{lstlisting}
+Hash types applicable to inner payloads of GRE-encapsulated packets
+\begin{lstlisting}
+#define VIRTIO_NET_HASH_TYPE_GRE_INNER         (1 << 9)
+\end{lstlisting}
 
     \subparagraph{IPv4 packets}
     \label{sec:Device Types / Network Device / Device Operation / Processing of Incoming Packets / Hash calculation for incoming packets / IPv4 packets}
@@ -3975,6 +3979,114 @@ \subsubsection{Processing of Incoming Packets}\label{sec:Device Types / Network
     (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}
 
Quoted 5 lines

content.tex \subsubsection{Processing of Incoming Packets}\label{sec:Device Types / Network · line 3985

Quoted 4 lines
content.tex +4 -0
+\subparagraph{Inner payloads of GRE-encapsulated packets}
+\label{sec:Device Types / Network Device / Device Operation / Processing of Incoming Packets / Hash calculation for incoming packets / Inner payloads of GRE-encapsulated packets}}
+VIRTIO_NET_HASH_TYPE_GRE_INNER bit MUST be set at the same time as one of
+the bits between VIRTIO_NET_HASH_TYPE_IPv4 and VIRTIO_NET_HASH_TYPE_UDP_EX.

"MUST" keyword must belong to the normative section.

Okay. Thanks for pointing out.

Quoted 121 lines
Quoted 61 lines
content.tex +61 -0
+
+The device calculates the hash on GRE-encapsulated packets whose inner payloads
+are IPv4 packets according to 'Enabled hash types' bitmasks as follows:
+\begin{itemize}
+  \item If both VIRTIO_NET_HASH_TYPE_GRE_INNER and VIRTIO_NET_HASH_TYPE_TCPv4 bits
+      are set, and the GRE-encapsulated packet has an inner TCPv4 header in its
+      payload, the hash is calculated over the following fields:
+    \begin{itemsize}
+      \item Inner source IP address
+      \item Inner destination IP address
+      \item Inner source TCP port
+      \item Inner destination TCP port
+    \end{itemsize}
+  \item Else if both VIRTIO_NET_HASH_TYPE_GRE_INNER and VIRTIO_NET_HASH_TYPE_UDPv4
+      bits are set, and the GRE-encapsulated packet has an inner UDPv4 header in
+      its payload, the hash is calculated over the following fields:
+    \begin{itemsize}
+      \item Inner source IP address
+      \item Inner destination IP address
+      \item Inner source UDP port
+      \item Inner destination UDP port
+    \end{itemize}
+  \item Else if both VIRTIO_NET_HASH_TYPE_GRE_INNER and VIRTIO_NET_HASH_TYPE_IPv4
+      bits are set, the hash is calculated over the following fields:
+    \begin{itemsize}
+      \item Inner source IP address
+      \item Inner destination IP address
+    \end{itemsize}
+  \item Else the device does not calculate the hash
+\end{itemize}
+
+The device calculates the hash on GRE-encapsulated packets whose inner payloads
+are IPv6 packets without extension headers according to 'Enabled hash types'
+bitmasks as follows:
+\begin{itemsize}
+  \item If both VIRTIO_NET_HASH_TYPE_GRE_INNER and VIRTIO_NET_HASH_TYPE_TCPv6
+      bits are set, and the GRE-encapsulated packet has an inner TCPv6 header in
+      its payload, the hash is calculated over the following fields:
+    \begin{itemsize}
+      \item Inner source IPv6 address
+      \item Inner destination IPv6 address
+      \item Inner source TCP port
+      \item Inner destination TCP port
+    \end{itemsize}
+  \item Else if both VIRTIO_NET_HASH_TYPE_GRE_INNER and VIRTIO_NET_HASH_TYPE_UDPv6
+      bits are set, and the GRE-encapsulated packet has an inner UDPv6 header in
+      its payload, the hash is calculated over the following fields:
+    \begin{itemsize}
+      \item Inner source IPv6 address
+      \item Inner destination IPv6 address
+      \item Inner source UDP port
+      \item Inner destination UDP port
+    \end{itemize}
+  \item Else if both VIRTIO_NET_HASH_TYPE_GRE_INNER and VIRTIO_NET_HASH_TYPE_IPv6
+      bits are set, the hash is calculated over the following fields:
+    \begin{itemsize}
+      \item Inner source IPv6 address
+      \item Inner destination IPv6 address
+    \end{itemsize}
+  \item Else the device does not calculate the hash
+\end{itemize}

content.tex \subsubsection{Processing of Incoming Packets}\label{sec:Device Types / Network · line 4056

Quoted 10 lines
content.tex +10 -0
+
+The device calculates the hash on GRE-encapsulated packets whose inner payloads
+are IPv6 packets with extension headers according to 'Enabled hash types'
+bitmasks as follows:
+\begin{itemsize}
+  \item If both VIRTIO_NET_HASH_TYPE_GRE_INNER and VIRTIO_NET_HASH_TYPE_TCP_EX
+      bits are set, and the GRE-encapsulated packet has an inner TCPv6 header in
+      its payload, the hash is calculated over the following fields:
+    \begin{itemize}
+      \item Home address from the home address option in the IPv6 destination options

Is this inner or outer?

Thanks

Quoted 46 lines
content.tex +37 -0
+          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 both VIRTIO_NET_HASH_TYPE_GRE_INNER and VIRTIO_NET_HASH_TYPE_UDP_EX
+  bits are set, and the GRE-encapsulated packet has an inner UDPv6 header in its
+  payload, the hash is calculated over the following fields:
+    \begin{itemsize}
+      \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 both VIRTIO_NET_HASH_TYPE_GRE_INNER and VIRTIO_NET_HASH_TYPE_IP_EX
+      bits are set, the hash is calculated over the following fields:
+    \begin{itemsize}
+      \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
+      a GRE-encapsulated packet whose inner payload is an IPv6 packet without
+      extension headers
+\end{itemsize}
+
     \paragraph{Hash reporting for incoming packets}
     \label{sec:Device Types / Network Device / Device Operation / Processing of Incoming Packets / Hash reporting for incoming packets}
 
@@ -4005,6 +4117,10 @@ \subsubsection{Processing of Incoming Packets}\label{sec:Device Types / Network
     #define VIRTIO_NET_HASH_REPORT_UDPv6_EX        9
     \end{lstlisting}
 
+VIRTIO_NET_HASH_TYPE_GRE_INNER bit is not included in \field{hash_report},
+it just indicates that the hash is calculated using the inner header inside
+the GRE-encapsulated packet.
+
     \subsubsection{Control Virtqueue}\label{sec:Device Types / Network Device / Device Operation / Control Virtqueue}
 
Quoted 8 lines
Quoted 8 lines
Quoted 4 lines
Quoted 4 lines
content.tex +0 -1
     The driver uses the control virtqueue (if VIRTIO_NET_F_CTRL_VQ is
--

2.19.1.6.gb485710b

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

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

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

#12 lore raw
Quoted 49 lines · Heng Qi
Quoted 16 lines · Jason Wang
Quoted 15 lines · Heng Qi
Quoted 12 lines · Jason Wang
Quoted 11 lines · Heng Qi
Quoted 4 lines · Yuri Benditovich

I would suggest to specify also the hash type the device should report in case the hash reporting feature is enabled. For example, should the device specify somehow in the report that the hash was calculated on the inner header or on the regular header?

It seems unnecessary. The calculation of RSS hash using the regular or inner header is actually
transparent to the driver, and after the hash value and hash type calculated by the device,
the feedback on skb is that skb only has L4 or L3 hash boolean type.

Quoted 8 lines
Quoted 7 lines
Quoted 2 lines

I think what Yuri meant is what if the user wants to calculate hash based on the inner header? Do we need VIRTIO_NET_HASH_TYPE_GRE_XXX?

Yes, if the user wants to calculate the hash on the inner header, then we need VIRTIO_NET_HASH_TYPE_GRE_INNER,
if the user wants to calculate the hash on the outer header, then we don’t need to use VIRTIO_NET_HASH_TYPE_GRE_INNER,
just keep the previous default behavior.

I actually meant should we add VIRTIO_NET_HASH_REPORT_GRE_XXX?

VIRTIO_NET_HASH_REPORT_GRE_XXX does not seem to need to be added.

_HASH_TYPE_GRE_INNER is a special hash type, which is used in combination with other hash types,
indicating that the sd, sdfn, etc. of the inner or outer header are used to calculate the hash.
The device can report the following true types to the driver to meet the subsequent requirements of driver.

\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
Quoted 5 lines

\end{lstlisting}

As for whether the device uses the outer or inner header to calculate the hash information,
the driver does not seem to need to know?

We can't assume the behaviour of the driver actually. E.g driver may try to do rx classification based on the rxhash.

Thanks

Quoted 194 lines

Thanks.

Quoted 190 lines

Thanks

Quoted 187 lines

This is a configurable hash specification.

Thanks.

Quoted 183 lines

Thanks

Quoted 181 lines

Thanks.

Quoted 167 lines · Heng Qi
Quoted 166 lines · Jason Wang
Quoted 37 lines · Heng Qi
Quoted 36 lines

From: Heng Qi <[email protected]>

When VIRTIO_NET_F_RSS is negotiated and the tunnel is used to encapsulate the packets, the hash calculated using the outer header of the receive packets is always fixed for the same flow packets, i.e. they will be steered to the same receive queue.

We add a VIRTIO_NET_HASH_TYPE_GRE_INNER bitmask in \field{hash_types}, which instructs the device to calculate the hash using the inner headers of GRE-encapsulated packets.

---
     content.tex | 116 ++++++++++++++++++++++++++++++++++++++++++++++++++++
     1 file changed, 116 insertions(+)
content.tex +4 -0
index 6fabf1d..319d401 100644
@@ -3883,6 +3883,10 @@ \subsubsection{Processing of Incoming Packets}\label{sec:Device Types / Network
     #define VIRTIO_NET_HASH_TYPE_TCP_EX            (1 << 7)
     #define VIRTIO_NET_HASH_TYPE_UDP_EX            (1 << 8)
     \end{lstlisting}
+Hash types applicable to inner payloads of GRE-encapsulated packets
+\begin{lstlisting}
+#define VIRTIO_NET_HASH_TYPE_GRE_INNER         (1 << 9)
+\end{lstlisting}
 
     \subparagraph{IPv4 packets}
     \label{sec:Device Types / Network Device / Device Operation / Processing of Incoming Packets / Hash calculation for incoming packets / IPv4 packets}
@@ -3975,6 +3979,114 @@ \subsubsection{Processing of Incoming Packets}\label{sec:Device Types / Network
     (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}
 
Quoted 5 lines

content.tex \subsubsection{Processing of Incoming Packets}\label{sec:Device Types / Network · line 3985

Quoted 4 lines
content.tex +4 -0
+\subparagraph{Inner payloads of GRE-encapsulated packets}
+\label{sec:Device Types / Network Device / Device Operation / Processing of Incoming Packets / Hash calculation for incoming packets / Inner payloads of GRE-encapsulated packets}}
+VIRTIO_NET_HASH_TYPE_GRE_INNER bit MUST be set at the same time as one of
+the bits between VIRTIO_NET_HASH_TYPE_IPv4 and VIRTIO_NET_HASH_TYPE_UDP_EX.

"MUST" keyword must belong to the normative section.

Okay. Thanks for pointing out.

Quoted 121 lines
Quoted 61 lines
content.tex +61 -0
+
+The device calculates the hash on GRE-encapsulated packets whose inner payloads
+are IPv4 packets according to 'Enabled hash types' bitmasks as follows:
+\begin{itemize}
+  \item If both VIRTIO_NET_HASH_TYPE_GRE_INNER and VIRTIO_NET_HASH_TYPE_TCPv4 bits
+      are set, and the GRE-encapsulated packet has an inner TCPv4 header in its
+      payload, the hash is calculated over the following fields:
+    \begin{itemsize}
+      \item Inner source IP address
+      \item Inner destination IP address
+      \item Inner source TCP port
+      \item Inner destination TCP port
+    \end{itemsize}
+  \item Else if both VIRTIO_NET_HASH_TYPE_GRE_INNER and VIRTIO_NET_HASH_TYPE_UDPv4
+      bits are set, and the GRE-encapsulated packet has an inner UDPv4 header in
+      its payload, the hash is calculated over the following fields:
+    \begin{itemsize}
+      \item Inner source IP address
+      \item Inner destination IP address
+      \item Inner source UDP port
+      \item Inner destination UDP port
+    \end{itemize}
+  \item Else if both VIRTIO_NET_HASH_TYPE_GRE_INNER and VIRTIO_NET_HASH_TYPE_IPv4
+      bits are set, the hash is calculated over the following fields:
+    \begin{itemsize}
+      \item Inner source IP address
+      \item Inner destination IP address
+    \end{itemsize}
+  \item Else the device does not calculate the hash
+\end{itemize}
+
+The device calculates the hash on GRE-encapsulated packets whose inner payloads
+are IPv6 packets without extension headers according to 'Enabled hash types'
+bitmasks as follows:
+\begin{itemsize}
+  \item If both VIRTIO_NET_HASH_TYPE_GRE_INNER and VIRTIO_NET_HASH_TYPE_TCPv6
+      bits are set, and the GRE-encapsulated packet has an inner TCPv6 header in
+      its payload, the hash is calculated over the following fields:
+    \begin{itemsize}
+      \item Inner source IPv6 address
+      \item Inner destination IPv6 address
+      \item Inner source TCP port
+      \item Inner destination TCP port
+    \end{itemsize}
+  \item Else if both VIRTIO_NET_HASH_TYPE_GRE_INNER and VIRTIO_NET_HASH_TYPE_UDPv6
+      bits are set, and the GRE-encapsulated packet has an inner UDPv6 header in
+      its payload, the hash is calculated over the following fields:
+    \begin{itemsize}
+      \item Inner source IPv6 address
+      \item Inner destination IPv6 address
+      \item Inner source UDP port
+      \item Inner destination UDP port
+    \end{itemize}
+  \item Else if both VIRTIO_NET_HASH_TYPE_GRE_INNER and VIRTIO_NET_HASH_TYPE_IPv6
+      bits are set, the hash is calculated over the following fields:
+    \begin{itemsize}
+      \item Inner source IPv6 address
+      \item Inner destination IPv6 address
+    \end{itemsize}
+  \item Else the device does not calculate the hash
+\end{itemize}

content.tex \subsubsection{Processing of Incoming Packets}\label{sec:Device Types / Network · line 4056

Quoted 10 lines
content.tex +10 -0
+
+The device calculates the hash on GRE-encapsulated packets whose inner payloads
+are IPv6 packets with extension headers according to 'Enabled hash types'
+bitmasks as follows:
+\begin{itemsize}
+  \item If both VIRTIO_NET_HASH_TYPE_GRE_INNER and VIRTIO_NET_HASH_TYPE_TCP_EX
+      bits are set, and the GRE-encapsulated packet has an inner TCPv6 header in
+      its payload, the hash is calculated over the following fields:
+    \begin{itemize}
+      \item Home address from the home address option in the IPv6 destination options

Is this inner or outer?

Thanks

Quoted 46 lines
content.tex +37 -0
+          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 both VIRTIO_NET_HASH_TYPE_GRE_INNER and VIRTIO_NET_HASH_TYPE_UDP_EX
+  bits are set, and the GRE-encapsulated packet has an inner UDPv6 header in its
+  payload, the hash is calculated over the following fields:
+    \begin{itemsize}
+      \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 both VIRTIO_NET_HASH_TYPE_GRE_INNER and VIRTIO_NET_HASH_TYPE_IP_EX
+      bits are set, the hash is calculated over the following fields:
+    \begin{itemsize}
+      \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
+      a GRE-encapsulated packet whose inner payload is an IPv6 packet without
+      extension headers
+\end{itemsize}
+
     \paragraph{Hash reporting for incoming packets}
     \label{sec:Device Types / Network Device / Device Operation / Processing of Incoming Packets / Hash reporting for incoming packets}
 
@@ -4005,6 +4117,10 @@ \subsubsection{Processing of Incoming Packets}\label{sec:Device Types / Network
     #define VIRTIO_NET_HASH_REPORT_UDPv6_EX        9
     \end{lstlisting}
 
+VIRTIO_NET_HASH_TYPE_GRE_INNER bit is not included in \field{hash_report},
+it just indicates that the hash is calculated using the inner header inside
+the GRE-encapsulated packet.
+
     \subsubsection{Control Virtqueue}\label{sec:Device Types / Network Device / Device Operation / Control Virtqueue}
 
Quoted 8 lines
Quoted 8 lines
Quoted 4 lines
Quoted 4 lines
content.tex +0 -1
     The driver uses the control virtqueue (if VIRTIO_NET_F_CTRL_VQ is
--

2.19.1.6.gb485710b

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

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

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

author
#13 lore raw
Quoted 48 lines · Jason Wang
Quoted 47 lines · Heng Qi
Quoted 14 lines · Jason Wang
Quoted 13 lines · Heng Qi
Quoted 11 lines · Jason Wang
Quoted 10 lines · Heng Qi
Quoted 4 lines · Yuri Benditovich

I would suggest to specify also the hash type the device should report in case the hash reporting feature is enabled. For example, should the device specify somehow in the report that the hash was calculated on the inner header or on the regular header?

It seems unnecessary. The calculation of RSS hash using the regular or inner header is actually
transparent to the driver, and after the hash value and hash type calculated by the device,
the feedback on skb is that skb only has L4 or L3 hash boolean type.

Quoted 8 lines
Quoted 7 lines
Quoted 2 lines

I think what Yuri meant is what if the user wants to calculate hash based on the inner header? Do we need VIRTIO_NET_HASH_TYPE_GRE_XXX?

Yes, if the user wants to calculate the hash on the inner header, then we need VIRTIO_NET_HASH_TYPE_GRE_INNER,
if the user wants to calculate the hash on the outer header, then we don’t need to use VIRTIO_NET_HASH_TYPE_GRE_INNER,
just keep the previous default behavior.

I actually meant should we add VIRTIO_NET_HASH_REPORT_GRE_XXX?

VIRTIO_NET_HASH_REPORT_GRE_XXX does not seem to need to be added.

_HASH_TYPE_GRE_INNER is a special hash type, which is used in combination with other hash types,
indicating that the sd, sdfn, etc. of the inner or outer header are used to calculate the hash.
The device can report the following true types to the driver to meet the subsequent requirements of driver.

\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}

Quoted 5 lines
Quoted 3 lines

As for whether the device uses the outer or inner header to calculate the hash information,
the driver does not seem to need to know?

We can't assume the behaviour of the driver actually. E.g driver may try to do rx classification based on the rxhash.

Ok, I think this is reasonable and we shouldn't hide certain information.

Then I'll add VIRTIO_NET_HASH_REPORT_GRE_INNER, considering that \field{hash_types} is a 32-bit bitmap, and \field{hash_report} is a 16-bit integer, in order to be compatible with existing hash computing devices, we can use the first 8 bits of \field{hash_report} as a tunnel-related flag, and the last 8 bits of \field{hash_report} represent the hash five-tuple, e.g. VIRTIO_NET_HASH_TYPE_TCPv4.

That is, if the value of the obtained \field{hash_report} is greater than 256, it means that the driver wants the device to calculate the hash for the inner header of the tunnel-encapsulated packet . And if the value is less than 256, the default outer header hashing will be performed.

Do you think this proposal is feasible?😁

Thanks.

Quoted 194 lines

Thanks

Quoted 191 lines

Thanks.

Quoted 189 lines

Thanks

Quoted 187 lines

This is a configurable hash specification.

Thanks.

Quoted 183 lines

Thanks

Quoted 181 lines

Thanks.

Quoted 167 lines · Heng Qi
Quoted 166 lines · Jason Wang
Quoted 37 lines · Heng Qi
Quoted 36 lines

From: Heng Qi <[email protected]>

When VIRTIO_NET_F_RSS is negotiated and the tunnel is used to encapsulate the packets, the hash calculated using the outer header of the receive packets is always fixed for the same flow packets, i.e. they will be steered to the same receive queue.

We add a VIRTIO_NET_HASH_TYPE_GRE_INNER bitmask in \field{hash_types}, which instructs the device to calculate the hash using the inner headers of GRE-encapsulated packets.

---
      content.tex | 116 ++++++++++++++++++++++++++++++++++++++++++++++++++++
      1 file changed, 116 insertions(+)
content.tex +4 -0
index 6fabf1d..319d401 100644
@@ -3883,6 +3883,10 @@ \subsubsection{Processing of Incoming Packets}\label{sec:Device Types / Network
      #define VIRTIO_NET_HASH_TYPE_TCP_EX            (1 << 7)
      #define VIRTIO_NET_HASH_TYPE_UDP_EX            (1 << 8)
      \end{lstlisting}
+Hash types applicable to inner payloads of GRE-encapsulated packets
+\begin{lstlisting}
+#define VIRTIO_NET_HASH_TYPE_GRE_INNER         (1 << 9)
+\end{lstlisting}
 
      \subparagraph{IPv4 packets}
      \label{sec:Device Types / Network Device / Device Operation / Processing of Incoming Packets / Hash calculation for incoming packets / IPv4 packets}
@@ -3975,6 +3979,114 @@ \subsubsection{Processing of Incoming Packets}\label{sec:Device Types / Network
      (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}
 
Quoted 5 lines

content.tex \subsubsection{Processing of Incoming Packets}\label{sec:Device Types / Network · line 3985

Quoted 4 lines
content.tex +4 -0
+\subparagraph{Inner payloads of GRE-encapsulated packets}
+\label{sec:Device Types / Network Device / Device Operation / Processing of Incoming Packets / Hash calculation for incoming packets / Inner payloads of GRE-encapsulated packets}}
+VIRTIO_NET_HASH_TYPE_GRE_INNER bit MUST be set at the same time as one of
+the bits between VIRTIO_NET_HASH_TYPE_IPv4 and VIRTIO_NET_HASH_TYPE_UDP_EX.

"MUST" keyword must belong to the normative section.

Okay. Thanks for pointing out.

Quoted 121 lines
Quoted 61 lines
content.tex +61 -0
+
+The device calculates the hash on GRE-encapsulated packets whose inner payloads
+are IPv4 packets according to 'Enabled hash types' bitmasks as follows:
+\begin{itemize}
+  \item If both VIRTIO_NET_HASH_TYPE_GRE_INNER and VIRTIO_NET_HASH_TYPE_TCPv4 bits
+      are set, and the GRE-encapsulated packet has an inner TCPv4 header in its
+      payload, the hash is calculated over the following fields:
+    \begin{itemsize}
+      \item Inner source IP address
+      \item Inner destination IP address
+      \item Inner source TCP port
+      \item Inner destination TCP port
+    \end{itemsize}
+  \item Else if both VIRTIO_NET_HASH_TYPE_GRE_INNER and VIRTIO_NET_HASH_TYPE_UDPv4
+      bits are set, and the GRE-encapsulated packet has an inner UDPv4 header in
+      its payload, the hash is calculated over the following fields:
+    \begin{itemsize}
+      \item Inner source IP address
+      \item Inner destination IP address
+      \item Inner source UDP port
+      \item Inner destination UDP port
+    \end{itemize}
+  \item Else if both VIRTIO_NET_HASH_TYPE_GRE_INNER and VIRTIO_NET_HASH_TYPE_IPv4
+      bits are set, the hash is calculated over the following fields:
+    \begin{itemsize}
+      \item Inner source IP address
+      \item Inner destination IP address
+    \end{itemsize}
+  \item Else the device does not calculate the hash
+\end{itemize}
+
+The device calculates the hash on GRE-encapsulated packets whose inner payloads
+are IPv6 packets without extension headers according to 'Enabled hash types'
+bitmasks as follows:
+\begin{itemsize}
+  \item If both VIRTIO_NET_HASH_TYPE_GRE_INNER and VIRTIO_NET_HASH_TYPE_TCPv6
+      bits are set, and the GRE-encapsulated packet has an inner TCPv6 header in
+      its payload, the hash is calculated over the following fields:
+    \begin{itemsize}
+      \item Inner source IPv6 address
+      \item Inner destination IPv6 address
+      \item Inner source TCP port
+      \item Inner destination TCP port
+    \end{itemsize}
+  \item Else if both VIRTIO_NET_HASH_TYPE_GRE_INNER and VIRTIO_NET_HASH_TYPE_UDPv6
+      bits are set, and the GRE-encapsulated packet has an inner UDPv6 header in
+      its payload, the hash is calculated over the following fields:
+    \begin{itemsize}
+      \item Inner source IPv6 address
+      \item Inner destination IPv6 address
+      \item Inner source UDP port
+      \item Inner destination UDP port
+    \end{itemize}
+  \item Else if both VIRTIO_NET_HASH_TYPE_GRE_INNER and VIRTIO_NET_HASH_TYPE_IPv6
+      bits are set, the hash is calculated over the following fields:
+    \begin{itemsize}
+      \item Inner source IPv6 address
+      \item Inner destination IPv6 address
+    \end{itemsize}
+  \item Else the device does not calculate the hash
+\end{itemize}

content.tex \subsubsection{Processing of Incoming Packets}\label{sec:Device Types / Network · line 4056

Quoted 10 lines
content.tex +10 -0
+
+The device calculates the hash on GRE-encapsulated packets whose inner payloads
+are IPv6 packets with extension headers according to 'Enabled hash types'
+bitmasks as follows:
+\begin{itemsize}
+  \item If both VIRTIO_NET_HASH_TYPE_GRE_INNER and VIRTIO_NET_HASH_TYPE_TCP_EX
+      bits are set, and the GRE-encapsulated packet has an inner TCPv6 header in
+      its payload, the hash is calculated over the following fields:
+    \begin{itemize}
+      \item Home address from the home address option in the IPv6 destination options

Is this inner or outer?

Thanks

Quoted 46 lines
content.tex +37 -0
+          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 both VIRTIO_NET_HASH_TYPE_GRE_INNER and VIRTIO_NET_HASH_TYPE_UDP_EX
+  bits are set, and the GRE-encapsulated packet has an inner UDPv6 header in its
+  payload, the hash is calculated over the following fields:
+    \begin{itemsize}
+      \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 both VIRTIO_NET_HASH_TYPE_GRE_INNER and VIRTIO_NET_HASH_TYPE_IP_EX
+      bits are set, the hash is calculated over the following fields:
+    \begin{itemsize}
+      \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
+      a GRE-encapsulated packet whose inner payload is an IPv6 packet without
+      extension headers
+\end{itemsize}
+
      \paragraph{Hash reporting for incoming packets}
      \label{sec:Device Types / Network Device / Device Operation / Processing of Incoming Packets / Hash reporting for incoming packets}
 
@@ -4005,6 +4117,10 @@ \subsubsection{Processing of Incoming Packets}\label{sec:Device Types / Network
      #define VIRTIO_NET_HASH_REPORT_UDPv6_EX        9
      \end{lstlisting}
 
+VIRTIO_NET_HASH_TYPE_GRE_INNER bit is not included in \field{hash_report},
+it just indicates that the hash is calculated using the inner header inside
+the GRE-encapsulated packet.
+
      \subsubsection{Control Virtqueue}\label{sec:Device Types / Network Device / Device Operation / Control Virtqueue}
 
Quoted 8 lines
Quoted 8 lines
Quoted 4 lines
Quoted 4 lines
content.tex +0 -1
      The driver uses the control virtqueue (if VIRTIO_NET_F_CTRL_VQ is
--

2.19.1.6.gb485710b

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

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

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

#14 lore raw
Quoted 68 lines · Heng Qi
Quoted 48 lines · Jason Wang
Quoted 47 lines · Heng Qi
Quoted 14 lines · Jason Wang
Quoted 13 lines · Heng Qi
Quoted 11 lines · Jason Wang
Quoted 10 lines · Heng Qi
Quoted 4 lines · Yuri Benditovich

I would suggest to specify also the hash type the device should report in case the hash reporting feature is enabled. For example, should the device specify somehow in the report that the hash was calculated on the inner header or on the regular header?

It seems unnecessary. The calculation of RSS hash using the regular or inner header is actually
transparent to the driver, and after the hash value and hash type calculated by the device,
the feedback on skb is that skb only has L4 or L3 hash boolean type.

Quoted 8 lines
Quoted 7 lines
Quoted 2 lines

I think what Yuri meant is what if the user wants to calculate hash based on the inner header? Do we need VIRTIO_NET_HASH_TYPE_GRE_XXX?

Yes, if the user wants to calculate the hash on the inner header, then we need VIRTIO_NET_HASH_TYPE_GRE_INNER,
if the user wants to calculate the hash on the outer header, then we don’t need to use VIRTIO_NET_HASH_TYPE_GRE_INNER,
just keep the previous default behavior.

I actually meant should we add VIRTIO_NET_HASH_REPORT_GRE_XXX?

VIRTIO_NET_HASH_REPORT_GRE_XXX does not seem to need to be added.

_HASH_TYPE_GRE_INNER is a special hash type, which is used in combination with other hash types,
indicating that the sd, sdfn, etc. of the inner or outer header are used to calculate the hash.
The device can report the following true types to the driver to meet the subsequent requirements of driver.

\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}

Quoted 5 lines
Quoted 3 lines

As for whether the device uses the outer or inner header to calculate the hash information,
the driver does not seem to need to know?

We can't assume the behaviour of the driver actually. E.g driver may try to do rx classification based on the rxhash.

Ok, I think this is reasonable and we shouldn't hide certain information.

Then I'll add VIRTIO_NET_HASH_REPORT_GRE_INNER, considering that \field{hash_types} is a 32-bit bitmap,
and \field{hash_report} is a 16-bit integer, in order to be compatible with existing hash computing devices,
we can use the first 8 bits of \field{hash_report} as a tunnel-related flag, and the last 8 bits of \field{hash_report}
represent the hash five-tuple, e.g. VIRTIO_NET_HASH_TYPE_TCPv4.

Quoted 7 lines

That is, if the value of the obtained \field{hash_report} is greater than 256, it means that the driver wants
the device to calculate the hash for the inner header of the tunnel-encapsulated packet . And if the value is less than 256, the default outer header hashing will be performed.

Do you think this proposal is feasible?😁

Any advantages of this over simply making padding_reserved a part of the hash report?

Thanks

Quoted 198 lines

Thanks.

Quoted 194 lines

Thanks

Quoted 191 lines

Thanks.

Quoted 189 lines

Thanks

Quoted 187 lines

This is a configurable hash specification.

Thanks.

Quoted 183 lines

Thanks

Quoted 181 lines

Thanks.

Quoted 167 lines · Heng Qi
Quoted 166 lines · Jason Wang
Quoted 37 lines · Heng Qi
Quoted 36 lines

From: Heng Qi <[email protected]>

When VIRTIO_NET_F_RSS is negotiated and the tunnel is used to encapsulate the packets, the hash calculated using the outer header of the receive packets is always fixed for the same flow packets, i.e. they will be steered to the same receive queue.

We add a VIRTIO_NET_HASH_TYPE_GRE_INNER bitmask in \field{hash_types}, which instructs the device to calculate the hash using the inner headers of GRE-encapsulated packets.

---
      content.tex | 116 ++++++++++++++++++++++++++++++++++++++++++++++++++++
      1 file changed, 116 insertions(+)
content.tex +4 -0
index 6fabf1d..319d401 100644
@@ -3883,6 +3883,10 @@ \subsubsection{Processing of Incoming Packets}\label{sec:Device Types / Network
      #define VIRTIO_NET_HASH_TYPE_TCP_EX            (1 << 7)
      #define VIRTIO_NET_HASH_TYPE_UDP_EX            (1 << 8)
      \end{lstlisting}
+Hash types applicable to inner payloads of GRE-encapsulated packets
+\begin{lstlisting}
+#define VIRTIO_NET_HASH_TYPE_GRE_INNER         (1 << 9)
+\end{lstlisting}
 
      \subparagraph{IPv4 packets}
      \label{sec:Device Types / Network Device / Device Operation / Processing of Incoming Packets / Hash calculation for incoming packets / IPv4 packets}
@@ -3975,6 +3979,114 @@ \subsubsection{Processing of Incoming Packets}\label{sec:Device Types / Network
      (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}
 
Quoted 5 lines

content.tex \subsubsection{Processing of Incoming Packets}\label{sec:Device Types / Network · line 3985

Quoted 4 lines
content.tex +4 -0
+\subparagraph{Inner payloads of GRE-encapsulated packets}
+\label{sec:Device Types / Network Device / Device Operation / Processing of Incoming Packets / Hash calculation for incoming packets / Inner payloads of GRE-encapsulated packets}}
+VIRTIO_NET_HASH_TYPE_GRE_INNER bit MUST be set at the same time as one of
+the bits between VIRTIO_NET_HASH_TYPE_IPv4 and VIRTIO_NET_HASH_TYPE_UDP_EX.

"MUST" keyword must belong to the normative section.

Okay. Thanks for pointing out.

Quoted 121 lines
Quoted 61 lines
content.tex +61 -0
+
+The device calculates the hash on GRE-encapsulated packets whose inner payloads
+are IPv4 packets according to 'Enabled hash types' bitmasks as follows:
+\begin{itemize}
+  \item If both VIRTIO_NET_HASH_TYPE_GRE_INNER and VIRTIO_NET_HASH_TYPE_TCPv4 bits
+      are set, and the GRE-encapsulated packet has an inner TCPv4 header in its
+      payload, the hash is calculated over the following fields:
+    \begin{itemsize}
+      \item Inner source IP address
+      \item Inner destination IP address
+      \item Inner source TCP port
+      \item Inner destination TCP port
+    \end{itemsize}
+  \item Else if both VIRTIO_NET_HASH_TYPE_GRE_INNER and VIRTIO_NET_HASH_TYPE_UDPv4
+      bits are set, and the GRE-encapsulated packet has an inner UDPv4 header in
+      its payload, the hash is calculated over the following fields:
+    \begin{itemsize}
+      \item Inner source IP address
+      \item Inner destination IP address
+      \item Inner source UDP port
+      \item Inner destination UDP port
+    \end{itemize}
+  \item Else if both VIRTIO_NET_HASH_TYPE_GRE_INNER and VIRTIO_NET_HASH_TYPE_IPv4
+      bits are set, the hash is calculated over the following fields:
+    \begin{itemsize}
+      \item Inner source IP address
+      \item Inner destination IP address
+    \end{itemsize}
+  \item Else the device does not calculate the hash
+\end{itemize}
+
+The device calculates the hash on GRE-encapsulated packets whose inner payloads
+are IPv6 packets without extension headers according to 'Enabled hash types'
+bitmasks as follows:
+\begin{itemsize}
+  \item If both VIRTIO_NET_HASH_TYPE_GRE_INNER and VIRTIO_NET_HASH_TYPE_TCPv6
+      bits are set, and the GRE-encapsulated packet has an inner TCPv6 header in
+      its payload, the hash is calculated over the following fields:
+    \begin{itemsize}
+      \item Inner source IPv6 address
+      \item Inner destination IPv6 address
+      \item Inner source TCP port
+      \item Inner destination TCP port
+    \end{itemsize}
+  \item Else if both VIRTIO_NET_HASH_TYPE_GRE_INNER and VIRTIO_NET_HASH_TYPE_UDPv6
+      bits are set, and the GRE-encapsulated packet has an inner UDPv6 header in
+      its payload, the hash is calculated over the following fields:
+    \begin{itemsize}
+      \item Inner source IPv6 address
+      \item Inner destination IPv6 address
+      \item Inner source UDP port
+      \item Inner destination UDP port
+    \end{itemize}
+  \item Else if both VIRTIO_NET_HASH_TYPE_GRE_INNER and VIRTIO_NET_HASH_TYPE_IPv6
+      bits are set, the hash is calculated over the following fields:
+    \begin{itemsize}
+      \item Inner source IPv6 address
+      \item Inner destination IPv6 address
+    \end{itemsize}
+  \item Else the device does not calculate the hash
+\end{itemize}

content.tex \subsubsection{Processing of Incoming Packets}\label{sec:Device Types / Network · line 4056

Quoted 10 lines
content.tex +10 -0
+
+The device calculates the hash on GRE-encapsulated packets whose inner payloads
+are IPv6 packets with extension headers according to 'Enabled hash types'
+bitmasks as follows:
+\begin{itemsize}
+  \item If both VIRTIO_NET_HASH_TYPE_GRE_INNER and VIRTIO_NET_HASH_TYPE_TCP_EX
+      bits are set, and the GRE-encapsulated packet has an inner TCPv6 header in
+      its payload, the hash is calculated over the following fields:
+    \begin{itemize}
+      \item Home address from the home address option in the IPv6 destination options

Is this inner or outer?

Thanks

Quoted 46 lines
content.tex +37 -0
+          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 both VIRTIO_NET_HASH_TYPE_GRE_INNER and VIRTIO_NET_HASH_TYPE_UDP_EX
+  bits are set, and the GRE-encapsulated packet has an inner UDPv6 header in its
+  payload, the hash is calculated over the following fields:
+    \begin{itemsize}
+      \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 both VIRTIO_NET_HASH_TYPE_GRE_INNER and VIRTIO_NET_HASH_TYPE_IP_EX
+      bits are set, the hash is calculated over the following fields:
+    \begin{itemsize}
+      \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
+      a GRE-encapsulated packet whose inner payload is an IPv6 packet without
+      extension headers
+\end{itemsize}
+
      \paragraph{Hash reporting for incoming packets}
      \label{sec:Device Types / Network Device / Device Operation / Processing of Incoming Packets / Hash reporting for incoming packets}
 
@@ -4005,6 +4117,10 @@ \subsubsection{Processing of Incoming Packets}\label{sec:Device Types / Network
      #define VIRTIO_NET_HASH_REPORT_UDPv6_EX        9
      \end{lstlisting}
 
+VIRTIO_NET_HASH_TYPE_GRE_INNER bit is not included in \field{hash_report},
+it just indicates that the hash is calculated using the inner header inside
+the GRE-encapsulated packet.
+
      \subsubsection{Control Virtqueue}\label{sec:Device Types / Network Device / Device Operation / Control Virtqueue}
 
Quoted 8 lines
Quoted 8 lines
Quoted 4 lines
Quoted 4 lines
content.tex +0 -1
      The driver uses the control virtqueue (if VIRTIO_NET_F_CTRL_VQ is
--

2.19.1.6.gb485710b

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

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

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

author
#15 lore raw
Quoted 71 lines · Jason Wang
Quoted 70 lines · Heng Qi
Quoted 46 lines · Jason Wang
Quoted 45 lines · Heng Qi
Quoted 13 lines · Jason Wang
Quoted 12 lines · Heng Qi
Quoted 11 lines · Jason Wang
Quoted 10 lines · Heng Qi
Quoted 4 lines · Yuri Benditovich

I would suggest to specify also the hash type the device should report in case the hash reporting feature is enabled. For example, should the device specify somehow in the report that the hash was calculated on the inner header or on the regular header?

It seems unnecessary. The calculation of RSS hash using the regular or inner header is actually
transparent to the driver, and after the hash value and hash type calculated by the device,
the feedback on skb is that skb only has L4 or L3 hash boolean type.

Quoted 8 lines
Quoted 7 lines
Quoted 2 lines

I think what Yuri meant is what if the user wants to calculate hash based on the inner header? Do we need VIRTIO_NET_HASH_TYPE_GRE_XXX?

Yes, if the user wants to calculate the hash on the inner header, then we need VIRTIO_NET_HASH_TYPE_GRE_INNER,
if the user wants to calculate the hash on the outer header, then we don’t need to use VIRTIO_NET_HASH_TYPE_GRE_INNER,
just keep the previous default behavior.

I actually meant should we add VIRTIO_NET_HASH_REPORT_GRE_XXX?

VIRTIO_NET_HASH_REPORT_GRE_XXX does not seem to need to be added.

_HASH_TYPE_GRE_INNER is a special hash type, which is used in combination with other hash types,
indicating that the sd, sdfn, etc. of the inner or outer header are used to calculate the hash.
The device can report the following true types to the driver to meet the subsequent requirements of driver.

\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}

Quoted 5 lines
Quoted 3 lines

As for whether the device uses the outer or inner header to calculate the hash information,
the driver does not seem to need to know?

We can't assume the behaviour of the driver actually. E.g driver may try to do rx classification based on the rxhash.

Ok, I think this is reasonable and we shouldn't hide certain information.

Then I'll add VIRTIO_NET_HASH_REPORT_GRE_INNER, considering that \field{hash_types} is a 32-bit bitmap,
and \field{hash_report} is a 16-bit integer, in order to be compatible with existing hash computing devices,
we can use the first 8 bits of \field{hash_report} as a tunnel-related flag, and the last 8 bits of \field{hash_report}
represent the hash five-tuple, e.g. VIRTIO_NET_HASH_TYPE_TCPv4.

That is, if the value of the obtained \field{hash_report} is greater than 256, it means that the driver wants
the device to calculate the hash for the inner header of the tunnel-encapsulated packet . And if the value is less than 256, the default outer header hashing will be performed.

Quoted 3 lines
Quoted 1 line

Do you think this proposal is feasible?😁

Any advantages of this over simply making padding_reserved a part of the hash report?

Thanks for the reminder, using padding_reserved seems cleaner.

Quoted 197 lines

Thanks

Quoted 195 lines

Thanks.

Quoted 193 lines

Thanks

Quoted 191 lines

Thanks.

Quoted 189 lines

Thanks

Quoted 187 lines

This is a configurable hash specification.

Thanks.

Quoted 183 lines

Thanks

Quoted 181 lines

Thanks.

Quoted 167 lines · Heng Qi
Quoted 166 lines · Jason Wang
Quoted 37 lines · Heng Qi
Quoted 36 lines

From: Heng Qi <[email protected]>

When VIRTIO_NET_F_RSS is negotiated and the tunnel is used to encapsulate the packets, the hash calculated using the outer header of the receive packets is always fixed for the same flow packets, i.e. they will be steered to the same receive queue.

We add a VIRTIO_NET_HASH_TYPE_GRE_INNER bitmask in \field{hash_types}, which instructs the device to calculate the hash using the inner headers of GRE-encapsulated packets.

---
       content.tex | 116 ++++++++++++++++++++++++++++++++++++++++++++++++++++
       1 file changed, 116 insertions(+)
content.tex +4 -0
index 6fabf1d..319d401 100644
@@ -3883,6 +3883,10 @@ \subsubsection{Processing of Incoming Packets}\label{sec:Device Types / Network
       #define VIRTIO_NET_HASH_TYPE_TCP_EX            (1 << 7)
       #define VIRTIO_NET_HASH_TYPE_UDP_EX            (1 << 8)
       \end{lstlisting}
+Hash types applicable to inner payloads of GRE-encapsulated packets
+\begin{lstlisting}
+#define VIRTIO_NET_HASH_TYPE_GRE_INNER         (1 << 9)
+\end{lstlisting}
 
       \subparagraph{IPv4 packets}
       \label{sec:Device Types / Network Device / Device Operation / Processing of Incoming Packets / Hash calculation for incoming packets / IPv4 packets}
@@ -3975,6 +3979,114 @@ \subsubsection{Processing of Incoming Packets}\label{sec:Device Types / Network
       (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}
 
Quoted 5 lines

content.tex \subsubsection{Processing of Incoming Packets}\label{sec:Device Types / Network · line 3985

Quoted 4 lines
content.tex +4 -0
+\subparagraph{Inner payloads of GRE-encapsulated packets}
+\label{sec:Device Types / Network Device / Device Operation / Processing of Incoming Packets / Hash calculation for incoming packets / Inner payloads of GRE-encapsulated packets}}
+VIRTIO_NET_HASH_TYPE_GRE_INNER bit MUST be set at the same time as one of
+the bits between VIRTIO_NET_HASH_TYPE_IPv4 and VIRTIO_NET_HASH_TYPE_UDP_EX.

"MUST" keyword must belong to the normative section.

Okay. Thanks for pointing out.

Quoted 121 lines
Quoted 61 lines
content.tex +61 -0
+
+The device calculates the hash on GRE-encapsulated packets whose inner payloads
+are IPv4 packets according to 'Enabled hash types' bitmasks as follows:
+\begin{itemize}
+  \item If both VIRTIO_NET_HASH_TYPE_GRE_INNER and VIRTIO_NET_HASH_TYPE_TCPv4 bits
+      are set, and the GRE-encapsulated packet has an inner TCPv4 header in its
+      payload, the hash is calculated over the following fields:
+    \begin{itemsize}
+      \item Inner source IP address
+      \item Inner destination IP address
+      \item Inner source TCP port
+      \item Inner destination TCP port
+    \end{itemsize}
+  \item Else if both VIRTIO_NET_HASH_TYPE_GRE_INNER and VIRTIO_NET_HASH_TYPE_UDPv4
+      bits are set, and the GRE-encapsulated packet has an inner UDPv4 header in
+      its payload, the hash is calculated over the following fields:
+    \begin{itemsize}
+      \item Inner source IP address
+      \item Inner destination IP address
+      \item Inner source UDP port
+      \item Inner destination UDP port
+    \end{itemize}
+  \item Else if both VIRTIO_NET_HASH_TYPE_GRE_INNER and VIRTIO_NET_HASH_TYPE_IPv4
+      bits are set, the hash is calculated over the following fields:
+    \begin{itemsize}
+      \item Inner source IP address
+      \item Inner destination IP address
+    \end{itemsize}
+  \item Else the device does not calculate the hash
+\end{itemize}
+
+The device calculates the hash on GRE-encapsulated packets whose inner payloads
+are IPv6 packets without extension headers according to 'Enabled hash types'
+bitmasks as follows:
+\begin{itemsize}
+  \item If both VIRTIO_NET_HASH_TYPE_GRE_INNER and VIRTIO_NET_HASH_TYPE_TCPv6
+      bits are set, and the GRE-encapsulated packet has an inner TCPv6 header in
+      its payload, the hash is calculated over the following fields:
+    \begin{itemsize}
+      \item Inner source IPv6 address
+      \item Inner destination IPv6 address
+      \item Inner source TCP port
+      \item Inner destination TCP port
+    \end{itemsize}
+  \item Else if both VIRTIO_NET_HASH_TYPE_GRE_INNER and VIRTIO_NET_HASH_TYPE_UDPv6
+      bits are set, and the GRE-encapsulated packet has an inner UDPv6 header in
+      its payload, the hash is calculated over the following fields:
+    \begin{itemsize}
+      \item Inner source IPv6 address
+      \item Inner destination IPv6 address
+      \item Inner source UDP port
+      \item Inner destination UDP port
+    \end{itemize}
+  \item Else if both VIRTIO_NET_HASH_TYPE_GRE_INNER and VIRTIO_NET_HASH_TYPE_IPv6
+      bits are set, the hash is calculated over the following fields:
+    \begin{itemsize}
+      \item Inner source IPv6 address
+      \item Inner destination IPv6 address
+    \end{itemsize}
+  \item Else the device does not calculate the hash
+\end{itemize}

content.tex \subsubsection{Processing of Incoming Packets}\label{sec:Device Types / Network · line 4056

Quoted 10 lines
content.tex +10 -0
+
+The device calculates the hash on GRE-encapsulated packets whose inner payloads
+are IPv6 packets with extension headers according to 'Enabled hash types'
+bitmasks as follows:
+\begin{itemsize}
+  \item If both VIRTIO_NET_HASH_TYPE_GRE_INNER and VIRTIO_NET_HASH_TYPE_TCP_EX
+      bits are set, and the GRE-encapsulated packet has an inner TCPv6 header in
+      its payload, the hash is calculated over the following fields:
+    \begin{itemize}
+      \item Home address from the home address option in the IPv6 destination options

Is this inner or outer?

Thanks

Quoted 46 lines
content.tex +37 -0
+          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 both VIRTIO_NET_HASH_TYPE_GRE_INNER and VIRTIO_NET_HASH_TYPE_UDP_EX
+  bits are set, and the GRE-encapsulated packet has an inner UDPv6 header in its
+  payload, the hash is calculated over the following fields:
+    \begin{itemsize}
+      \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 both VIRTIO_NET_HASH_TYPE_GRE_INNER and VIRTIO_NET_HASH_TYPE_IP_EX
+      bits are set, the hash is calculated over the following fields:
+    \begin{itemsize}
+      \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
+      a GRE-encapsulated packet whose inner payload is an IPv6 packet without
+      extension headers
+\end{itemsize}
+
       \paragraph{Hash reporting for incoming packets}
       \label{sec:Device Types / Network Device / Device Operation / Processing of Incoming Packets / Hash reporting for incoming packets}
 
@@ -4005,6 +4117,10 @@ \subsubsection{Processing of Incoming Packets}\label{sec:Device Types / Network
       #define VIRTIO_NET_HASH_REPORT_UDPv6_EX        9
       \end{lstlisting}
 
+VIRTIO_NET_HASH_TYPE_GRE_INNER bit is not included in \field{hash_report},
+it just indicates that the hash is calculated using the inner header inside
+the GRE-encapsulated packet.
+
       \subsubsection{Control Virtqueue}\label{sec:Device Types / Network Device / Device Operation / Control Virtqueue}
 
Quoted 8 lines
Quoted 8 lines
Quoted 4 lines
Quoted 4 lines
content.tex +0 -1
       The driver uses the control virtqueue (if VIRTIO_NET_F_CTRL_VQ is
--

2.19.1.6.gb485710b

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

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

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