All of lore.kernel.org
 help / color / mirror / Atom feed
* [virtio-dev] [PATCH v5 0/4] Introducing RSS to virtio-net
@ 2018-05-07 11:24 Sameeh Jubran
  2018-05-07 11:24 ` [virtio-dev] [PATCH v5 1/4] content: net: Add VIRTIO_NET_F_CTRL_STEERING_MODE feature Sameeh Jubran
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Sameeh Jubran @ 2018-05-07 11:24 UTC (permalink / raw)
  To: virtio-dev; +Cc: Amnon Ilan, Yan Vugenfirer

From: Sameeh Jubran <sjubran@redhat.com>

Difference from v4:

* Added hash offload feature bit. This separates the hash offload from the
  steering mode feature as was suggested by Michael.

Sameeh Jubran (4):
  content: net: Add VIRTIO_NET_F_CTRL_STEERING_MODE feature
  conformance: net: Add steering mode
  content: net: Add VIRTIO_NET_F_HASH_OFFLOAD feature
  content: net: steering mode: Add RSS

 conformance.tex |   1 +
 content.tex     | 195 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 196 insertions(+)

-- 
2.13.6


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


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

* [virtio-dev] [PATCH v5 1/4] content: net: Add VIRTIO_NET_F_CTRL_STEERING_MODE feature
  2018-05-07 11:24 [virtio-dev] [PATCH v5 0/4] Introducing RSS to virtio-net Sameeh Jubran
@ 2018-05-07 11:24 ` Sameeh Jubran
  2018-05-07 11:24 ` [virtio-dev] [PATCH v5 2/4] conformance: net: Add steering mode Sameeh Jubran
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: Sameeh Jubran @ 2018-05-07 11:24 UTC (permalink / raw)
  To: virtio-dev; +Cc: Amnon Ilan, Yan Vugenfirer

From: Sameeh Jubran <sameeh.j@gmail.com>

This commit introduces steering mode into network device. Steering
mode is a general infrastructure for various steering modes that can
be implemented on top of it such as Automatic and RSS.

Signed-off-by: Sameeh Jubran <sjubran@redhat.com>
---
 content.tex | 57 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 57 insertions(+)

diff --git a/content.tex b/content.tex
index c840588..850844e 100644
--- a/content.tex
+++ b/content.tex
@@ -3115,6 +3115,9 @@ features.
 
 \item[VIRTIO_NET_F_CTRL_MAC_ADDR(23)] Set MAC address through control
     channel.
+
+\item[VIRTIO_NET_F_CTRL_STEERING_MODE(60)] Device supports configurable steering
+    mode.
 \end{description}
 
 \subsubsection{Feature bit requirements}\label{sec:Device Types / Network Device / Feature bits / Feature bit requirements}
@@ -3317,6 +3320,7 @@ struct virtio_net_hdr {
         le16 csum_start;
         le16 csum_offset;
         le16 num_buffers;
+        le64 hash;
 };
 \end{lstlisting}
 
@@ -4013,6 +4017,59 @@ MUST format \field{virtqueue_pairs}
 according to the native endian of the guest rather than
 (necessarily when not using the legacy interface) little-endian.
 
+\paragraph{Steering mode}\label{sec:Device Types / Network Device / Device Operation / Control Virtqueue / Steering mode}
+
+\begin{lstlisting}
+// steering mode flags
+#define STEERING_MODE_AUTO          0x1
+
+// Used by the devide for returning to the driver the supported steering modes
+struct virtio_net_steering_modes {
+le32 steering_modes;
+};
+
+struct virtio_net_steering_mode {
+le32 steering_mode;
+le32 command;
+
+// A union which can be used for passing structures to one of the sub modes
+    union {
+    }
+};
+
+#define VIRTIO_NET_F_CTRL_STEERING_MODE     60
+
+#define VIRTIO_NET_CTRL_STEERING_MODE                7
+#define VIRTIO_NET_CTRL_SM_GET_SUPPORTED_MODES        0
+#define VIRTIO_NET_CTRL_SM_CONTROL                    1
+\end{lstlisting}
+
+If the VIRTIO_NET_F_CTRL_STEERING_MODE is negotiated the driver can send control commands for the
+configuring the steering mode. There are multiple steering modes and they can be configured using
+the VIRTIO_NET_CTRL_SM_CONTROL command. Each mode has it's own set of commands.
+
+The auto steering mode is the default mode if nothing else has been configured by the driver
+and the VIRTIO_NET_F_CTRL_STEERING_MODE feature is acked by the driver.
+
+The class VIRTIO_NET_CTRL_STEERING_MODE has two commands:
+
+\begin{enumerate}
+
+\item VIRTIO_NET_CTRL_SM_GET_SUPPORTED_MODES is used for getting the supported steering modes by the device.
+	The command SHOULD be executed by the driver before attempting to configure the steering mode. Once the device
+	receives this command it SHOULD fill the virtio_net_steering_modes structure with the supported steering mode
+	flags.
+
+\item The command VIRTIO_NET_CTRL_SM_CONTROL is used for controlling the different steering modes. Each steering mode
+	has its own set of commands. When executing this command the structure virtio_net_steering_mode SHOULD be used as follows:
+	the \field{steering_mode} SHOULD be filled with one of the supported steering mode flags along with an appropriate command
+	from the chosen steering mode. The union of virtio_net_steering_mode SHOULD be used and filled as the mode's command suggests.
+\end{enumerate}
+
+\subparagraph{Automatic Receive Steering}{Device Types / Network Device / Device Operation / Control Virtqueue / Steering mode / Automatic Receive Steering}
+
+This is the default steering mode, please refer to the "Automatic receive steering in multiqueue mode" section.
+
 \paragraph{Offloads State Configuration}\label{sec:Device Types / Network Device / Device Operation / Control Virtqueue / Offloads State Configuration}
 
 If the VIRTIO_NET_F_CTRL_GUEST_OFFLOADS feature is negotiated, the driver can
-- 
2.13.6


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


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

* [virtio-dev] [PATCH v5 2/4] conformance: net: Add steering mode
  2018-05-07 11:24 [virtio-dev] [PATCH v5 0/4] Introducing RSS to virtio-net Sameeh Jubran
  2018-05-07 11:24 ` [virtio-dev] [PATCH v5 1/4] content: net: Add VIRTIO_NET_F_CTRL_STEERING_MODE feature Sameeh Jubran
@ 2018-05-07 11:24 ` Sameeh Jubran
  2018-05-07 11:24 ` [virtio-dev] [PATCH v5 3/4] content: net: Add VIRTIO_NET_F_HASH_OFFLOAD feature Sameeh Jubran
  2018-05-07 11:24 ` [virtio-dev] [PATCH v5 4/4] content: net: steering mode: Add RSS Sameeh Jubran
  3 siblings, 0 replies; 5+ messages in thread
From: Sameeh Jubran @ 2018-05-07 11:24 UTC (permalink / raw)
  To: virtio-dev; +Cc: Amnon Ilan, Yan Vugenfirer

From: Sameeh Jubran <sjubran@redhat.com>

Signed-off-by: Sameeh Jubran <sjubran@redhat.com>
---
 conformance.tex | 1 +
 1 file changed, 1 insertion(+)

diff --git a/conformance.tex b/conformance.tex
index f59e360..f68911d 100644
--- a/conformance.tex
+++ b/conformance.tex
@@ -97,6 +97,7 @@ A network driver MUST conform to the following normative statements:
 \item \ref{drivernormative:Device Types / Network Device / Device Operation / Control Virtqueue / Setting MAC Address Filtering}
 \item \ref{drivernormative:Device Types / Network Device / Device Operation / Control Virtqueue / Gratuitous Packet Sending}
 \item \ref{drivernormative:Device Types / Network Device / Device Operation / Control Virtqueue / Automatic receive steering in multiqueue mode}
+\item \ref{drivernormative:Device Types / Network Device / Device Operation / Control Virtqueue / Steering mode}
 \item \ref{drivernormative:Device Types / Network Device / Device Operation / Control Virtqueue / Offloads State Configuration / Setting Offloads State}
 \end{itemize}
 
-- 
2.13.6


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


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

* [virtio-dev] [PATCH v5 3/4] content: net: Add VIRTIO_NET_F_HASH_OFFLOAD feature
  2018-05-07 11:24 [virtio-dev] [PATCH v5 0/4] Introducing RSS to virtio-net Sameeh Jubran
  2018-05-07 11:24 ` [virtio-dev] [PATCH v5 1/4] content: net: Add VIRTIO_NET_F_CTRL_STEERING_MODE feature Sameeh Jubran
  2018-05-07 11:24 ` [virtio-dev] [PATCH v5 2/4] conformance: net: Add steering mode Sameeh Jubran
@ 2018-05-07 11:24 ` Sameeh Jubran
  2018-05-07 11:24 ` [virtio-dev] [PATCH v5 4/4] content: net: steering mode: Add RSS Sameeh Jubran
  3 siblings, 0 replies; 5+ messages in thread
From: Sameeh Jubran @ 2018-05-07 11:24 UTC (permalink / raw)
  To: virtio-dev; +Cc: Amnon Ilan, Yan Vugenfirer

From: Sameeh Jubran <sjubran@redhat.com>

This commit introduces hash offload support into network device. The device
calculates hashes for packets all the time and especially when it uses
multiqueue, these hash values can be very useful for the driver and OS in some
cases.

This feature allows the delivery of the calculated hash to the driver.

Signed-off-by: Sameeh Jubran <sjubran@redhat.com>
---
 content.tex | 23 +++++++++++++++++++++++
 1 file changed, 23 insertions(+)

diff --git a/content.tex b/content.tex
index 850844e..c8add9b 100644
--- a/content.tex
+++ b/content.tex
@@ -3116,6 +3116,9 @@ features.
 \item[VIRTIO_NET_F_CTRL_MAC_ADDR(23)] Set MAC address through control
     channel.
 
+\item[VIRTIO_NET_F_HASH_OFFLOAD(61)] Device supports supplying packet's
+    hash value to the driver.
+
 \item[VIRTIO_NET_F_CTRL_STEERING_MODE(60)] Device supports configurable steering
     mode.
 \end{description}
@@ -3320,6 +3323,7 @@ struct virtio_net_hdr {
         le16 csum_start;
         le16 csum_offset;
         le16 num_buffers;
+// Only if VIRTIO_NET_F_HASH_OFFLOAD has been negotiated
         le64 hash;
 };
 \end{lstlisting}
@@ -4017,6 +4021,25 @@ MUST format \field{virtqueue_pairs}
 according to the native endian of the guest rather than
 (necessarily when not using the legacy interface) little-endian.
 
+\paragraph{Hash offload}\label{sec:Device Types / Network Device / Device Operation / Control Virtqueue / Hash offload}
+
+If the driver negotiates the feature bit VIRTIO_NET_F_HASH_OFFLOAD, the device
+MUST provide the driver with the hash values used for distributing the packets
+among the receive queues.
+
+If this feature has been negotiated, the virtio net header has an additional
+\field{hash} field attached to it.
+
+\drivernormative{\subparagraph}{Hash offload}{Device Types / Network Device / Device Operation / Control Virtqueue / Hash offload}
+
+If the VIRTIO_NET_F_HASH_OFFLOAD feature has been successfully negotiated the,
+driver can access and use the \field{hash} field in the virtio net header.
+
+\devicenormative{\subparagraph}{Hash offload}{Device Types / Network Device / Device Operation / Control Virtqueue / Hash offload}
+
+If the VIRTIO_NET_F_HASH_OFFLOAD feature has been successfully negotiated, the
+device MUST supply the hash value for each packet in the \field{hash} field.
+
 \paragraph{Steering mode}\label{sec:Device Types / Network Device / Device Operation / Control Virtqueue / Steering mode}
 
 \begin{lstlisting}
-- 
2.13.6


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


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

* [virtio-dev] [PATCH v5 4/4] content: net: steering mode: Add RSS
  2018-05-07 11:24 [virtio-dev] [PATCH v5 0/4] Introducing RSS to virtio-net Sameeh Jubran
                   ` (2 preceding siblings ...)
  2018-05-07 11:24 ` [virtio-dev] [PATCH v5 3/4] content: net: Add VIRTIO_NET_F_HASH_OFFLOAD feature Sameeh Jubran
@ 2018-05-07 11:24 ` Sameeh Jubran
  3 siblings, 0 replies; 5+ messages in thread
From: Sameeh Jubran @ 2018-05-07 11:24 UTC (permalink / raw)
  To: virtio-dev; +Cc: Amnon Ilan, Yan Vugenfirer

From: Sameeh Jubran <sjubran@redhat.com>

This commit introduces the RSS feature into virtio-net. It is introduced
as a sub mode for a general command which configures the steering mode.

Most modern high end network devices today support configurable hash functions,
this commit introduces RSS - Receive Side Scaling - [1] to virtio net device.

The RSS is a technology from Microsoft that boosts network device performance
by efficiently distributing the traffic among the CPUs in a multiprocessor
system.

This feature is supported in most of the modern network cards as well as most
modern OSes including Linux and Windows. It is worth mentioning that both DPDK
and Hyper-v support RSS too.

[1] https://docs.microsoft.com/en-us/windows-hardware/drivers/network/ndis-receive-side-scaling2

Signed-off-by: Sameeh Jubran <sjubran@redhat.com>
---
 content.tex | 115 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 115 insertions(+)

diff --git a/content.tex b/content.tex
index c8add9b..cd97196 100644
--- a/content.tex
+++ b/content.tex
@@ -4045,6 +4045,7 @@ device MUST supply the hash value for each packet in the \field{hash} field.
 \begin{lstlisting}
 // steering mode flags
 #define STEERING_MODE_AUTO          0x1
+#define STEERING_MODE_RSS           0x2
 
 // Used by the devide for returning to the driver the supported steering modes
 struct virtio_net_steering_modes {
@@ -4057,6 +4058,7 @@ le32 command;
 
 // A union which can be used for passing structures to one of the sub modes
     union {
+    struct virtio_net_rss rss_conf;
     }
 };
 
@@ -4093,6 +4095,119 @@ The class VIRTIO_NET_CTRL_STEERING_MODE has two commands:
 
 This is the default steering mode, please refer to the "Automatic receive steering in multiqueue mode" section.
 
+\subparagraph{Receive Side Scaling}{Device Types / Network Device / Device Operation / Control Virtqueue / Steering mode / Receive Side Scaling}
+
+\begin{lstlisting}
+#define RSS_HASH_FUNCTION_TOEPLITZ  0x1
+#define RSS_HASH_FUNCTION_SYMMETRIC 0x2
+
+// Hash function fields
+#define RSS_HASH_FIELDS_IPV4          0x00000100
+#define RSS_HASH_FIELDS_TCP_IPV4      0x00000200
+#define RSS_HASH_FIELDS_IPV6          0x00000400
+#define RSS_HASH_FIELDS_IPV6_EX       0x00000800
+#define RSS_HASH_FIELDS_TCP_IPV6      0x00001000
+#define RSS_HASH_FIELDS_TCP_IPV6_EX   0x00002000
+
+struct virtio_net_rss_supported_hash{
+le32 hash_function;
+}
+
+struct virtio_net_rss {
+le32 hash_function;
+le32 hash_function_flags;
+le32 hash_key_length;
+le32 indirection_table_length;
+	struct {
+		le32 hash_key[hash_key_length];
+		le32 indirection_table[indirection_table_length];
+	}
+};
+
+#define VIRTIO_NET_SM_CTRL_RSS_GET_SUPPORTED_FUNCTIONS   0
+#define VIRTIO_NET_SM_CTRL_RSS_SET                       1
+\end{lstlisting}
+
+If the VIRTIO_NET_F_CTRL_STEERING_MODE feature bit is negotiated, the driver
+can send steering mode control command, VIRTIO_NET_CTRL_SM_CONTROL, with the
+STEERING_MODE_RSS flag for configuring RSS provided it is one of the supported
+modes. The supported steering modes returned by the device in responce to
+VIRTIO_NET_CTRL_SM_GET_SUPPORTED_MODES command issued by the driver. The
+virtio_net_steering_mode SHOULD be filled. For configuring particulars of RSS
+steering mode, the various fields of virtio_net_steering_mode should be filled
+by the driver.  This includes \field{steering_mode} with  STEERING_MODE_RSS
+flag along with one of the VIRTIO_NET_SM_CTRL_RSS commands in the
+\field{command} field in addition to union \field{rss_conf} field members.
+
+The class VIRTIO_NET_CTRL_RSS has two commands:
+
+\begin{enumerate}
+\item VIRTIO_NET_SM_CTRL_RSS_GET_SUPPORTED_FUNCTIONS returns the hash functions
+	supported by the device to the driver.
+\item VIRTIO_NET_SM_CTRL_RSS_SET applies the new RSS configuration. The command is
+	used by the driver for setting RSS hash function, hash key and
+	indirection table in the device.
+\end{enumerate}
+
+\devicenormative{\subparagraph}{Receive Side Scaling}{Device Types / Network Device / Device Operation / Control Virtqueue / Steering mode / Receive Side Scaling}
+
+The device MUST fill the virtio_net_rss_supported_hash structure with the hash
+functions it supports and return the structure to the driver. One or more
+flags of the RSS_HASH_FUNCTION flags MUST be used to fill the \field{hash_function}
+field.
+
+The device MUST drop all previous RSS configuration upon receiving
+VIRTIO_NET_SM_CTRL_RSS_SET command.
+
+The device MUST set the RSS configuration according to the settings provided as
+follows, once the configuration process is completed the device SHOULD apply
+the hash function to each of the incoming packets with regards to the flags in
+the \field{hash_function_flags} fields and distribute the packets through the
+virqueues using the calculated hash and the indirection table that were earlier
+provided by the driver.
+
+Setting RSS configuration
+\begin{enumerate}
+\item The driver fills all of the fields and passes them through the control
+	queue to the device.
+
+\item The device sets the RSS configuration as provided by the driver.
+
+\item If the device successfully applied the configuration, on each packet
+	received the device MUST calculate the hash for the packet using
+	the fields specified in \field{hash_function_flags}.
+	If the feature VIRTIO_NET_F_HASH_OFFLOAD has been negotiated, the
+	device MUST store the hash value in the virtio-net header in the
+	\field{hash} field.
+\end{enumerate}
+
+\drivernormative{\subparagraph}{Receive Side Scaling}{Device Types / Network Device / Device Operation / Control Virtqueue / Steering mode / Receive Side Scaling}
+
+If the driver wants to set RSS hash it SHOULD fill the RSS structure fields
+as follows:
+
+\begin{itemize}
+\item The driver SHOULD choose the hash function that SHOULD be used and fill
+	it in the \field{hash_function} field along with the appropriate flags
+	in the \field{hash_function_flags} field. These flags indicate to the
+	device which packet fields MUST be used in the calculation process of
+	the hash.
+\item Once the hash function has been chosen a hash key SHOULD also be set by
+	the driver in the \field{hash_key} field, the length of the key SHOULD
+	be stored in the \field{hash_key_length} field.
+\item Lastly the driver SHOULD fill the indirection table array in the
+	\field{indirection_table} field while setting the array length in
+	\field{indirection_table_length}. This structure is used by the device
+	for determining in which RX virt queue the packet SHOULD be placed.
+\end{itemize}
+Once the configuration phase is over successfully and if the feature
+VIRTIO_NET_F_HASH_OFFLOAD has been negotiated, the packets SHOULD have the
+\field{hash} field with the hash value that was calculated by the device.
+
+Whenever the driver wants to stop performing RSS, it can switch back to
+Automatic Steering Mode using the VIRTIO_NET_CTRL_SM_CONTROL command along with
+the STEERING_MODE_AUTO flag.
+
 \paragraph{Offloads State Configuration}\label{sec:Device Types / Network Device / Device Operation / Control Virtqueue / Offloads State Configuration}
 
 If the VIRTIO_NET_F_CTRL_GUEST_OFFLOADS feature is negotiated, the driver can
-- 
2.13.6


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


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

end of thread, other threads:[~2018-05-07 11:25 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-05-07 11:24 [virtio-dev] [PATCH v5 0/4] Introducing RSS to virtio-net Sameeh Jubran
2018-05-07 11:24 ` [virtio-dev] [PATCH v5 1/4] content: net: Add VIRTIO_NET_F_CTRL_STEERING_MODE feature Sameeh Jubran
2018-05-07 11:24 ` [virtio-dev] [PATCH v5 2/4] conformance: net: Add steering mode Sameeh Jubran
2018-05-07 11:24 ` [virtio-dev] [PATCH v5 3/4] content: net: Add VIRTIO_NET_F_HASH_OFFLOAD feature Sameeh Jubran
2018-05-07 11:24 ` [virtio-dev] [PATCH v5 4/4] content: net: steering mode: Add RSS Sameeh Jubran

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