Skip to contentSkip to conversation

virtio-net: support the RSS context

PATCH Superseded Heng Qi 2 participants 6 messages Sep 1, 2023 – Oct 10, 2023

v2 of 6 Superseded Latest is v6 →

lore
Share & tools
lore

Heng Qi

author
#0 lore raw

PATCH v2 1/1 virtio-net: support the RSS context

Commit 84a1d9c48200 ("net: ethtool: extend RXNFC API to support RSS spreading of filter matches") adds support for RSS context as a destination for receive flow filters (see WIP work: https://lists.oasis-open.org/archives/virtio-comment/202308/msg00194.html).

An RSS context consists of configurable parameters specified by receive-side scaling.

Use case:
When users want some data flows to be steered to specific multiple rxqs, they can set receive flow filter rules for these data flows to an RSS context with desired rxqs.

How to set/configure an RSS context:
Assuming no RSS context has been created before.
1. ethtool -X eth0 context new start 5 equal 8

This command creates an RSS context with an id=1 for eth0, and fills in the indirection table with rxq indexes 5-8 circularly. The hash key and hash types reuse the default RSS configuration.

Then, we can use 'ethtool -x eth0 context 1' to query the above configuration.

2. ethtool -X eth0 context new start 6 equal 7 \
hkey 8f:bf:dd:11:23:58:d2:8a:00:31:d0:32:a3:b5:1f:\
1f:e4:d1:fe:47:7f:64:42:fd:d0:61:16:b8:b0:f9:71:e8:2d:36:7f:18:dd:4d:c8:f3

This command creates an RSS context with an id=2 for eth0, and fills in the indirection table with rxq indexes 6-7 circularly. The hash key is 8f:bf:dd:11:23:58:d2:8a:00:31:d0\
:32:a3:b5:1f:1f:e4:d1:fe:47:7f:64:42:fd:d0:61:16:b8:b0:f9:71:e8:2d:36:7f:18:dd:4d:c8:f3. Hash types reuse the default RSS configuration.

3. ethtool -N eth0 rx-flow-hash tcp4 sdfn context 1

This command specifies the hash types for the RSS context whose id=1 on eth0. Now this RSS context only has the hash key to reuse the default RSS configuration.

4. ethtool -N eth0 flow-type udp4 src-ip 1.1.1.1 context 1

This command configures a receive flow filter rule for eth0, and the data flow matching this rule will continue to select the final rxq according to the RSS context configuration with id=1.

---
v1->v2:
1. u8 to le16 for field rss_ctx_id.
2. Add normativation when device resetting. @Yuri Benditovich
3. Use ctrlq cmd to query rss context capability instead of reading config space. @Parav Pandit

 device-types/net/description.tex        | 85 +++++++++++++++++++++++++
 device-types/net/device-conformance.tex |  1 +
 device-types/net/driver-conformance.tex |  1 +
 3 files changed, 87 insertions(+)
device-types/net/description.tex +85 -0
index 76585b0..55cd86d 100644
@@ -88,6 +88,8 @@ \subsection{Feature bits}\label{sec:Device Types / Network Device / Feature bits
 \item[VIRTIO_NET_F_CTRL_MAC_ADDR(23)] Set MAC address through control
     channel.
 
+\item[VIRTIO_NET_F_RSS_CONTEXT(50)] Device supports multiple RSS contexts.
+
 \item[VIRTIO_NET_F_HASH_TUNNEL(51)] Device supports inner header hash for encapsulated packets.
 
 \item[VIRTIO_NET_F_VQ_NOTF_COAL(52)] Device supports virtqueue notification coalescing.
@@ -150,6 +152,7 @@ \subsubsection{Feature bit requirements}\label{sec:Device Types / Network Device
 \item[VIRTIO_NET_F_RSS] Requires VIRTIO_NET_F_CTRL_VQ.
 \item[VIRTIO_NET_F_VQ_NOTF_COAL] Requires VIRTIO_NET_F_CTRL_VQ.
 \item[VIRTIO_NET_F_HASH_TUNNEL] Requires VIRTIO_NET_F_CTRL_VQ along with VIRTIO_NET_F_RSS or VIRTIO_NET_F_HASH_REPORT.
+\item[VIRTIO_NET_F_RSS_CONTEXT] Requires VIRTIO_NET_F_CTRL_VQ and VIRTIO_NET_F_RSS.
 \end{description}
 
 \subsubsection{Legacy Interface: Feature bits}\label{sec:Device Types / Network Device / Feature bits / Legacy Interface: Feature bits}
@@ -1606,6 +1609,88 @@ \subsubsection{Control Virtqueue}\label{sec:Device Types / Network Device / Devi
 \item If the destination receive queue is being reset (See \ref{sec:Basic Facilities of a Virtio Device / Virtqueues / Virtqueue Reset}), the device MUST drop the packet.
 \end{itemize}
 
+\paragraph{RSS Context}\label{sec:Device Types / Network Device / Device Operation / Control Virtqueue / RSS Context}
+
+An RSS context consists of configurable parameters specified by \ref{sec:Device Types / Network Device
+/ Device Operation / Control Virtqueue / Receive-side scaling (RSS)}.
+
+The RSS configuration supported by VIRTIO_NET_F_RSS is considered the default RSS configuration.
+
+The device offers the feature VIRTIO_NET_F_RSS_CONTEXT if it supports one or multiple RSS contexts
+(excluding the default RSS configuration) and configurable parameters.
+
+\subparagraph{Querying RSS Context Capability}\label{sec:Device Types / Network Device / Device Operation / Control Virtqueue / RSS Context / Querying RSS Context Capability}
+
+\begin{lstlisting}
+#define VIRTNET_RSS_CTX_CTRL 8
+ #define VIRTNET_RSS_CTX_CTRL_CAP_GET  0
+ #define VIRTNET_RSS_CTX_CTRL_ADD      1
+ #define VIRTNET_RSS_CTX_CTRL_MOD      2
+ #define VIRTNET_RSS_CTX_CTRL_DEL      3
+
+struct virtnet_rss_ctx_cap {
+    le16 max_rss_contexts;
+}
+\end{lstlisting}
+
+Field \field{max_rss_contexts} specifies the maximum number of RSS contexts \ref{sec:Device Types / Network Device /
+Device Operation / Control Virtqueue / RSS Context} supported by the device.
+
+The driver queries the RSS context capability of the device by sending the command VIRTNET_RSS_CTX_CTRL_CAP_GET
+with the structure virtnet_rss_ctx_cap.
+
+For the command VIRTNET_RSS_CTX_CTRL_CAP_GET, the structure virtnet_rss_ctx_cap is write-only for the device.
+
+\subparagraph{Setting RSS Context Parameters}\label{sec:Device Types / Network Device / Device Operation / Control Virtqueue / RSS Context / Setting RSS Context Parameters}
+
+\begin{lstlisting}
+struct virtnet_rss_ctx_add_modify {
+    le16 rss_ctx_id;
+    le16 padding;
+    struct virtio_net_rss_config rss;
+};
+
+struct virtnet_rss_ctx_del {
+    le16 rss_ctx_id;
+};
+\end{lstlisting}
+
+RSS context parameters:
+\begin{itemize}
+\item  \field{rss_ctx_id}: ID of the specific RSS context.
+\item  \field{rss}: RSS context parameters of the specific RSS context whose id is \field{rss_ctx_id}.
+\end{itemize}
+
+\field{padding} is reserved and it is ignored by the device.
+
+If the feature VIRTIO_NET_F_RSS_CONTEXT has been negotiated, the driver can send the following
+VIRTNET_RSS_CTX_CTRL class commands:
+\begin{enumerate}
+\item VIRTNET_RSS_CTX_CTRL_ADD: use the structure virtnet_rss_ctx_add_modify to
+       add an RSS context configured as \field{rss} and id as \field{rss_ctx_id} for the device.
+\item VIRTNET_RSS_CTX_CTRL_MOD: use the structure virtnet_rss_ctx_add_modify to
+       configure parameters of the RSS context whose id is \field{rss_ctx_id} as \field{rss} for the device.
+\item VIRTNET_RSS_CTX_CTRL_DEL: use the structure virtnet_rss_ctx_del to delete
+       the RSS context whose id is \field{rss_ctx_id} for the device.
+\end{enumerate}
+
+For commands VIRTNET_RSS_CTX_CTRL_ADD and VIRTNET_RSS_CTX_CTRL_MOD, the structure virtnet_rss_ctx_add_modify is read-only for the device.
+For the command VIRTNET_RSS_CTX_CTRL_DEL, the structure virtnet_rss_ctx_del is read-only for the device.
+
+\devicenormative{\subparagraph}{RSS Context}{Device Types / Network Device / Device Operation / Control Virtqueue / RSS Context}
+
+The device MUST set \field{max_rss_contexts} to at least 1 if it offers VIRTIO_NET_F_RSS_CONTEXT.
+
+Upon reset, the device MUST clear all previously configured RSS contexts.
+
+\drivernormative{\subparagraph}{RSS Context}{Device Types / Network Device / Device Operation / Control Virtqueue / RSS Context}
+
+The driver MUST have negotiated the VIRTIO_NET_F_RSS_CONTEXT feature when issuing the VIRTNET_RSS_CTX_CTRL class commands.
+
+The driver MUST set \field{rss_ctx_id} to between 1 and \field{max_rss_contexts} inclusive.
+
+The driver MUST NOT send the command VIRTIO_NET_CTRL_MQ_VQ_PAIRS_SET when the device has successfully configured at least one RSS context.
+
 \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
device-types/net/device-conformance.tex +1 -0
index f88f48b..f517b00 100644
@@ -15,4 +15,5 @@
 \item \ref{devicenormative:Device Types / Network Device / Device Operation / Control Virtqueue / Receive-side scaling (RSS) / RSS processing}
 \item \ref{devicenormative:Device Types / Network Device / Device Operation / Control Virtqueue / Notifications Coalescing}
 \item \ref{devicenormative:Device Types / Network Device / Device Operation / Control Virtqueue / Inner Header Hash}
+\item \ref{devicenormative:Device Types / Network Device / Device Operation / Control Virtqueue / RSS Context}
 \end{itemize}
device-types/net/driver-conformance.tex +1 -0
index 9d853d9..22ff5c3 100644
@@ -15,4 +15,5 @@
 \item \ref{drivernormative:Device Types / Network Device / Device Operation / Control Virtqueue / Receive-side scaling (RSS) }
 \item \ref{drivernormative:Device Types / Network Device / Device Operation / Control Virtqueue / Notifications Coalescing}
 \item \ref{drivernormative:Device Types / Network Device / Device Operation / Control Virtqueue / Inner Header Hash}
+\item \ref{drivernormative:Device Types / Network Device / Device Operation / Control Virtqueue / RSS Context}
 \end{itemize}
Signature · 18 lines
2.19.1.6.gb485710b


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

In order to verify user consent to the Feedback License terms and
to minimize spam in the list archive, subscription is required
before posting.

Subscribe: [email protected]
Unsubscribe: [email protected]
List help: [email protected]
List archive: https://lists.oasis-open.org/archives/virtio-comment/
Feedback License: https://www.oasis-open.org/who/ipr/feedback_license.pdf
List Guidelines: https://www.oasis-open.org/policies-guidelines/mailing-lists
Committee: https://www.oasis-open.org/committees/virtio/
Join OASIS: https://www.oasis-open.org/join/
author
#1 lore raw

Hi all!

Do you have any comments on this?

Thanks!

Quoted 178 lines · Heng Qi

Commit 84a1d9c48200 ("net: ethtool: extend RXNFC API to support RSS spreading of filter matches") adds support for RSS context as a destination for receive flow filters (see WIP work: https://lists.oasis-open.org/archives/virtio-comment/202308/msg00194.html).

An RSS context consists of configurable parameters specified by receive-side scaling.

Use case:
When users want some data flows to be steered to specific multiple rxqs, they can set receive flow filter rules for these data flows to an RSS context with desired rxqs.

How to set/configure an RSS context:
Assuming no RSS context has been created before.
1. ethtool -X eth0 context new start 5 equal 8

This command creates an RSS context with an id=1 for eth0, and fills in the indirection table with rxq indexes 5-8 circularly. The hash key and hash types reuse the default RSS configuration.

Then, we can use 'ethtool -x eth0 context 1' to query the above configuration.

2. ethtool -X eth0 context new start 6 equal 7 \
    hkey 8f:bf:dd:11:23:58:d2:8a:00:31:d0:32:a3:b5:1f:\
    1f:e4:d1:fe:47:7f:64:42:fd:d0:61:16:b8:b0:f9:71:e8:2d:36:7f:18:dd:4d:c8:f3

This command creates an RSS context with an id=2 for eth0, and fills in the indirection table with rxq indexes 6-7 circularly. The hash key is 8f:bf:dd:11:23:58:d2:8a:00:31:d0\
:32:a3:b5:1f:1f:e4:d1:fe:47:7f:64:42:fd:d0:61:16:b8:b0:f9:71:e8:2d:36:7f:18:dd:4d:c8:f3. Hash types reuse the default RSS configuration.

3. ethtool -N eth0 rx-flow-hash tcp4 sdfn context 1

This command specifies the hash types for the RSS context whose id=1 on eth0. Now this RSS context only has the hash key to reuse the default RSS configuration.

4. ethtool -N eth0 flow-type udp4 src-ip 1.1.1.1 context 1

This command configures a receive flow filter rule for eth0, and the data flow matching this rule will continue to select the final rxq according to the RSS context configuration with id=1.

---
v1->v2:
1. u8 to le16 for field rss_ctx_id.
2. Add normativation when device resetting. @Yuri Benditovich
3. Use ctrlq cmd to query rss context capability instead of reading config space. @Parav Pandit

  device-types/net/description.tex        | 85 +++++++++++++++++++++++++
  device-types/net/device-conformance.tex |  1 +
  device-types/net/driver-conformance.tex |  1 +
  3 files changed, 87 insertions(+)
device-types/net/description.tex +85 -0
index 76585b0..55cd86d 100644
@@ -88,6 +88,8 @@ \subsection{Feature bits}\label{sec:Device Types / Network Device / Feature bits
  \item[VIRTIO_NET_F_CTRL_MAC_ADDR(23)] Set MAC address through control
      channel.
 
+\item[VIRTIO_NET_F_RSS_CONTEXT(50)] Device supports multiple RSS contexts.
+
  \item[VIRTIO_NET_F_HASH_TUNNEL(51)] Device supports inner header hash for encapsulated packets.
 
  \item[VIRTIO_NET_F_VQ_NOTF_COAL(52)] Device supports virtqueue notification coalescing.
@@ -150,6 +152,7 @@ \subsubsection{Feature bit requirements}\label{sec:Device Types / Network Device
  \item[VIRTIO_NET_F_RSS] Requires VIRTIO_NET_F_CTRL_VQ.
  \item[VIRTIO_NET_F_VQ_NOTF_COAL] Requires VIRTIO_NET_F_CTRL_VQ.
  \item[VIRTIO_NET_F_HASH_TUNNEL] Requires VIRTIO_NET_F_CTRL_VQ along with VIRTIO_NET_F_RSS or VIRTIO_NET_F_HASH_REPORT.
+\item[VIRTIO_NET_F_RSS_CONTEXT] Requires VIRTIO_NET_F_CTRL_VQ and VIRTIO_NET_F_RSS.
  \end{description}
 
  \subsubsection{Legacy Interface: Feature bits}\label{sec:Device Types / Network Device / Feature bits / Legacy Interface: Feature bits}
@@ -1606,6 +1609,88 @@ \subsubsection{Control Virtqueue}\label{sec:Device Types / Network Device / Devi
  \item If the destination receive queue is being reset (See \ref{sec:Basic Facilities of a Virtio Device / Virtqueues / Virtqueue Reset}), the device MUST drop the packet.
  \end{itemize}
 
+\paragraph{RSS Context}\label{sec:Device Types / Network Device / Device Operation / Control Virtqueue / RSS Context}
+
+An RSS context consists of configurable parameters specified by \ref{sec:Device Types / Network Device
+/ Device Operation / Control Virtqueue / Receive-side scaling (RSS)}.
+
+The RSS configuration supported by VIRTIO_NET_F_RSS is considered the default RSS configuration.
+
+The device offers the feature VIRTIO_NET_F_RSS_CONTEXT if it supports one or multiple RSS contexts
+(excluding the default RSS configuration) and configurable parameters.
+
+\subparagraph{Querying RSS Context Capability}\label{sec:Device Types / Network Device / Device Operation / Control Virtqueue / RSS Context / Querying RSS Context Capability}
+
+\begin{lstlisting}
+#define VIRTNET_RSS_CTX_CTRL 8
+ #define VIRTNET_RSS_CTX_CTRL_CAP_GET  0
+ #define VIRTNET_RSS_CTX_CTRL_ADD      1
+ #define VIRTNET_RSS_CTX_CTRL_MOD      2
+ #define VIRTNET_RSS_CTX_CTRL_DEL      3
+
+struct virtnet_rss_ctx_cap {
+    le16 max_rss_contexts;
+}
+\end{lstlisting}
+
+Field \field{max_rss_contexts} specifies the maximum number of RSS contexts \ref{sec:Device Types / Network Device /
+Device Operation / Control Virtqueue / RSS Context} supported by the device.
+
+The driver queries the RSS context capability of the device by sending the command VIRTNET_RSS_CTX_CTRL_CAP_GET
+with the structure virtnet_rss_ctx_cap.
+
+For the command VIRTNET_RSS_CTX_CTRL_CAP_GET, the structure virtnet_rss_ctx_cap is write-only for the device.
+
+\subparagraph{Setting RSS Context Parameters}\label{sec:Device Types / Network Device / Device Operation / Control Virtqueue / RSS Context / Setting RSS Context Parameters}
+
+\begin{lstlisting}
+struct virtnet_rss_ctx_add_modify {
+    le16 rss_ctx_id;
+    le16 padding;
+    struct virtio_net_rss_config rss;
+};
+
+struct virtnet_rss_ctx_del {
+    le16 rss_ctx_id;
+};
+\end{lstlisting}
+
+RSS context parameters:
+\begin{itemize}
+\item  \field{rss_ctx_id}: ID of the specific RSS context.
+\item  \field{rss}: RSS context parameters of the specific RSS context whose id is \field{rss_ctx_id}.
+\end{itemize}
+
+\field{padding} is reserved and it is ignored by the device.
+
+If the feature VIRTIO_NET_F_RSS_CONTEXT has been negotiated, the driver can send the following
+VIRTNET_RSS_CTX_CTRL class commands:
+\begin{enumerate}
+\item VIRTNET_RSS_CTX_CTRL_ADD: use the structure virtnet_rss_ctx_add_modify to
+       add an RSS context configured as \field{rss} and id as \field{rss_ctx_id} for the device.
+\item VIRTNET_RSS_CTX_CTRL_MOD: use the structure virtnet_rss_ctx_add_modify to
+       configure parameters of the RSS context whose id is \field{rss_ctx_id} as \field{rss} for the device.
+\item VIRTNET_RSS_CTX_CTRL_DEL: use the structure virtnet_rss_ctx_del to delete
+       the RSS context whose id is \field{rss_ctx_id} for the device.
+\end{enumerate}
+
+For commands VIRTNET_RSS_CTX_CTRL_ADD and VIRTNET_RSS_CTX_CTRL_MOD, the structure virtnet_rss_ctx_add_modify is read-only for the device.
+For the command VIRTNET_RSS_CTX_CTRL_DEL, the structure virtnet_rss_ctx_del is read-only for the device.
+
+\devicenormative{\subparagraph}{RSS Context}{Device Types / Network Device / Device Operation / Control Virtqueue / RSS Context}
+
+The device MUST set \field{max_rss_contexts} to at least 1 if it offers VIRTIO_NET_F_RSS_CONTEXT.
+
+Upon reset, the device MUST clear all previously configured RSS contexts.
+
+\drivernormative{\subparagraph}{RSS Context}{Device Types / Network Device / Device Operation / Control Virtqueue / RSS Context}
+
+The driver MUST have negotiated the VIRTIO_NET_F_RSS_CONTEXT feature when issuing the VIRTNET_RSS_CTX_CTRL class commands.
+
+The driver MUST set \field{rss_ctx_id} to between 1 and \field{max_rss_contexts} inclusive.
+
+The driver MUST NOT send the command VIRTIO_NET_CTRL_MQ_VQ_PAIRS_SET when the device has successfully configured at least one RSS context.
+
  \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
device-types/net/device-conformance.tex +1 -0
index f88f48b..f517b00 100644
@@ -15,4 +15,5 @@
  \item \ref{devicenormative:Device Types / Network Device / Device Operation / Control Virtqueue / Receive-side scaling (RSS) / RSS processing}
  \item \ref{devicenormative:Device Types / Network Device / Device Operation / Control Virtqueue / Notifications Coalescing}
  \item \ref{devicenormative:Device Types / Network Device / Device Operation / Control Virtqueue / Inner Header Hash}
+\item \ref{devicenormative:Device Types / Network Device / Device Operation / Control Virtqueue / RSS Context}
  \end{itemize}
device-types/net/driver-conformance.tex +0 -0
index 9d853d9..22ff5c3 100644

device-types/net/driver-conformance.tex line 19

Quoted 5 lines
device-types/net/driver-conformance.tex +1 -0
@@ -15,4 +15,5 @@
  \item \ref{drivernormative:Device Types / Network Device / Device Operation / Control Virtqueue / Receive-side scaling (RSS) }
  \item \ref{drivernormative:Device Types / Network Device / Device Operation / Control Virtqueue / Notifications Coalescing}
  \item \ref{drivernormative:Device Types / Network Device / Device Operation / Control Virtqueue / Inner Header Hash}
+\item \ref{drivernormative:Device Types / Network Device / Device Operation / Control Virtqueue / RSS Context}
  \end{itemize}

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

author
#2 lore raw

Ping!
------------------------------------------------------------------
发件人:Heng Qi <[email protected]>
发送时间:2023年9月6日(星期三) 10:05
收件人:virtio-comment <[email protected]>; virtio-dev <[email protected]>
抄 送:Michael S . Tsirkin <[email protected]>; Parav Pandit <[email protected]>; Jason Wang <[email protected]>; Xuan Zhuo <[email protected]>; Yuri Benditovich <[email protected]> 主 题:Re: [virtio-comment] [PATCH v2] virtio-net: support the RSS context
Hi all!
Do you have any comments on this?
Thanks!

Quoted 178 lines · Heng Qi

Commit 84a1d9c48200 ("net: ethtool: extend RXNFC API to support RSS spreading of filter matches") adds support for RSS context as a destination for receive flow filters (see WIP work: https://lists.oasis-open.org/archives/virtio-comment/202308/msg00194.html).

An RSS context consists of configurable parameters specified by receive-side scaling.

Use case:
When users want some data flows to be steered to specific multiple rxqs, they can set receive flow filter rules for these data flows to an RSS context with desired rxqs.

How to set/configure an RSS context:
Assuming no RSS context has been created before.
1. ethtool -X eth0 context new start 5 equal 8

This command creates an RSS context with an id=1 for eth0, and fills in the indirection table with rxq indexes 5-8 circularly. The hash key and hash types reuse the default RSS configuration.

Then, we can use 'ethtool -x eth0 context 1' to query the above configuration.

2. ethtool -X eth0 context new start 6 equal 7 \
hkey 8f:bf:dd:11:23:58:d2:8a:00:31:d0:32:a3:b5:1f:\
1f:e4:d1:fe:47:7f:64:42:fd:d0:61:16:b8:b0:f9:71:e8:2d:36:7f:18:dd:4d:c8:f3

This command creates an RSS context with an id=2 for eth0, and fills in the indirection table with rxq indexes 6-7 circularly. The hash key is 8f:bf:dd:11:23:58:d2:8a:00:31:d0\
:32:a3:b5:1f:1f:e4:d1:fe:47:7f:64:42:fd:d0:61:16:b8:b0:f9:71:e8:2d:36:7f:18:dd:4d:c8:f3. Hash types reuse the default RSS configuration.

3. ethtool -N eth0 rx-flow-hash tcp4 sdfn context 1

This command specifies the hash types for the RSS context whose id=1 on eth0. Now this RSS context only has the hash key to reuse the default RSS configuration.

4. ethtool -N eth0 flow-type udp4 src-ip 1.1.1.1 context 1

This command configures a receive flow filter rule for eth0, and the data flow matching this rule will continue to select the final rxq according to the RSS context configuration with id=1.

---
v1->v2:
1. u8 to le16 for field rss_ctx_id.
2. Add normativation when device resetting. @Yuri Benditovich
3. Use ctrlq cmd to query rss context capability instead of reading config space. @Parav Pandit

device-types/net/description.tex | 85 +++++++++++++++++++++++++ device-types/net/device-conformance.tex | 1 + device-types/net/driver-conformance.tex | 1 +

3 files changed, 87 insertions(+)
device-types/net/description.tex +0 -0
index 76585b0..55cd86d 100644
@@ -88,6 +88,8 @@ \subsection{Feature bits}\label{sec:Device Types / Network Device / Feature bits

\item[VIRTIO_NET_F_CTRL_MAC_ADDR(23)] Set MAC address through control channel.

+\item[VIRTIO_NET_F_RSS_CONTEXT(50)] Device supports multiple RSS contexts.
+
\item[VIRTIO_NET_F_HASH_TUNNEL(51)] Device supports inner header hash for encapsulated packets.

\item[VIRTIO_NET_F_VQ_NOTF_COAL(52)] Device supports virtqueue notification coalescing.

device-types/net/description.tex +0 -0
@@ -150,6 +152,7 @@ \subsubsection{Feature bit requirements}\label{sec:Device Types / Network Device

\item[VIRTIO_NET_F_RSS] Requires VIRTIO_NET_F_CTRL_VQ.
\item[VIRTIO_NET_F_VQ_NOTF_COAL] Requires VIRTIO_NET_F_CTRL_VQ.
\item[VIRTIO_NET_F_HASH_TUNNEL] Requires VIRTIO_NET_F_CTRL_VQ along with VIRTIO_NET_F_RSS or VIRTIO_NET_F_HASH_REPORT. +\item[VIRTIO_NET_F_RSS_CONTEXT] Requires VIRTIO_NET_F_CTRL_VQ and VIRTIO_NET_F_RSS. \end{description}

\subsubsection{Legacy Interface: Feature bits}\label{sec:Device Types / Network Device / Feature bits / Legacy Interface: Feature bits}

device-types/net/description.tex +0 -0
@@ -1606,6 +1609,88 @@ \subsubsection{Control Virtqueue}\label{sec:Device Types / Network Device / Devi

\item If the destination receive queue is being reset (See \ref{sec:Basic Facilities of a Virtio Device / Virtqueues / Virtqueue Reset}), the device MUST drop the packet. \end{itemize}

+\paragraph{RSS Context}\label{sec:Device Types / Network Device / Device Operation / Control Virtqueue / RSS Context}

device-types/net/description.tex +81 -0
+
+An RSS context consists of configurable parameters specified by \ref{sec:Device Types / Network Device
+/ Device Operation / Control Virtqueue / Receive-side scaling (RSS)}.
+
+The RSS configuration supported by VIRTIO_NET_F_RSS is considered the default RSS configuration.
+
+The device offers the feature VIRTIO_NET_F_RSS_CONTEXT if it supports one or multiple RSS contexts
+(excluding the default RSS configuration) and configurable parameters.
+
+\subparagraph{Querying RSS Context Capability}\label{sec:Device Types / Network Device / Device Operation / Control Virtqueue / RSS Context / Querying RSS Context Capability}
+
+\begin{lstlisting}
+#define VIRTNET_RSS_CTX_CTRL 8
+ #define VIRTNET_RSS_CTX_CTRL_CAP_GET 0
+ #define VIRTNET_RSS_CTX_CTRL_ADD 1
+ #define VIRTNET_RSS_CTX_CTRL_MOD 2
+ #define VIRTNET_RSS_CTX_CTRL_DEL 3
+
+struct virtnet_rss_ctx_cap {
+ le16 max_rss_contexts;
+}
+\end{lstlisting}
+
+Field \field{max_rss_contexts} specifies the maximum number of RSS contexts \ref{sec:Device Types / Network Device /
+Device Operation / Control Virtqueue / RSS Context} supported by the device.
+
+The driver queries the RSS context capability of the device by sending the command VIRTNET_RSS_CTX_CTRL_CAP_GET
+with the structure virtnet_rss_ctx_cap.
+
+For the command VIRTNET_RSS_CTX_CTRL_CAP_GET, the structure virtnet_rss_ctx_cap is write-only for the device.
+
+\subparagraph{Setting RSS Context Parameters}\label{sec:Device Types / Network Device / Device Operation / Control Virtqueue / RSS Context / Setting RSS Context Parameters}
+
+\begin{lstlisting}
+struct virtnet_rss_ctx_add_modify {
+ le16 rss_ctx_id;
+ le16 padding;
+ struct virtio_net_rss_config rss;
+};
+
+struct virtnet_rss_ctx_del {
+ le16 rss_ctx_id;
+};
+\end{lstlisting}
+
+RSS context parameters:
+\begin{itemize}
+\item \field{rss_ctx_id}: ID of the specific RSS context.
+\item \field{rss}: RSS context parameters of the specific RSS context whose id is \field{rss_ctx_id}.
+\end{itemize}
+
+\field{padding} is reserved and it is ignored by the device.
+
+If the feature VIRTIO_NET_F_RSS_CONTEXT has been negotiated, the driver can send the following
+VIRTNET_RSS_CTX_CTRL class commands:
+\begin{enumerate}
+\item VIRTNET_RSS_CTX_CTRL_ADD: use the structure virtnet_rss_ctx_add_modify to
+ add an RSS context configured as \field{rss} and id as \field{rss_ctx_id} for the device.
+\item VIRTNET_RSS_CTX_CTRL_MOD: use the structure virtnet_rss_ctx_add_modify to
+ configure parameters of the RSS context whose id is \field{rss_ctx_id} as \field{rss} for the device.
+\item VIRTNET_RSS_CTX_CTRL_DEL: use the structure virtnet_rss_ctx_del to delete
+ the RSS context whose id is \field{rss_ctx_id} for the device.
+\end{enumerate}
+
+For commands VIRTNET_RSS_CTX_CTRL_ADD and VIRTNET_RSS_CTX_CTRL_MOD, the structure virtnet_rss_ctx_add_modify is read-only for the device.
+For the command VIRTNET_RSS_CTX_CTRL_DEL, the structure virtnet_rss_ctx_del is read-only for the device.
+
+\devicenormative{\subparagraph}{RSS Context}{Device Types / Network Device / Device Operation / Control Virtqueue / RSS Context}
+
+The device MUST set \field{max_rss_contexts} to at least 1 if it offers VIRTIO_NET_F_RSS_CONTEXT.
+
+Upon reset, the device MUST clear all previously configured RSS contexts.
+
+\drivernormative{\subparagraph}{RSS Context}{Device Types / Network Device / Device Operation / Control Virtqueue / RSS Context}
+
+The driver MUST have negotiated the VIRTIO_NET_F_RSS_CONTEXT feature when issuing the VIRTNET_RSS_CTX_CTRL class commands.
+
+The driver MUST set \field{rss_ctx_id} to between 1 and \field{max_rss_contexts} inclusive.
+
+The driver MUST NOT send the command VIRTIO_NET_CTRL_MQ_VQ_PAIRS_SET when the device has successfully configured at least one RSS context.
+

\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

device-types/net/device-conformance.tex +1 -0
index f88f48b..f517b00 100644
@@ -15,4 +15,5 @@
 \item \ref{devicenormative:Device Types / Network Device / Device Operation / Control Virtqueue / Receive-side scaling (RSS) / RSS processing}
 \item \ref{devicenormative:Device Types / Network Device / Device Operation / Control Virtqueue / Notifications Coalescing}
 \item \ref{devicenormative:Device Types / Network Device / Device Operation / Control Virtqueue / Inner Header Hash}
+\item \ref{devicenormative:Device Types / Network Device / Device Operation / Control Virtqueue / RSS Context}
 \end{itemize}
device-types/net/driver-conformance.tex +0 -0
index 9d853d9..22ff5c3 100644

device-types/net/driver-conformance.tex line 19

Quoted 5 lines
device-types/net/driver-conformance.tex +1 -0
@@ -15,4 +15,5 @@
 \item \ref{drivernormative:Device Types / Network Device / Device Operation / Control Virtqueue / Receive-side scaling (RSS) }
 \item \ref{drivernormative:Device Types / Network Device / Device Operation / Control Virtqueue / Notifications Coalescing}
 \item \ref{drivernormative:Device Types / Network Device / Device Operation / Control Virtqueue / Inner Header Hash}
+\item \ref{drivernormative:Device Types / Network Device / Device Operation / Control Virtqueue / RSS Context}
 \end{itemize}

This publicly archived list offers a means to provide input to the OASIS Virtual I/O Device (VIRTIO) TC.
In order to verify user consent to the Feedback License terms and to minimize spam in the list archive, subscription is required before posting.
Subscribe: [email protected]
Unsubscribe: [email protected]
List help: [email protected]
List archive: https://lists.oasis-open.org/archives/virtio-comment/
Feedback License: https://www.oasis-open.org/who/ipr/feedback_license.pdf
List Guidelines: https://www.oasis-open.org/policies-guidelines/mailing-lists
Committee: https://www.oasis-open.org/committees/virtio/
Join OASIS: https://www.oasis-open.org/join/

#3 lore raw
In reply to Heng Qi
Quoted 245 lines

-----Original Message-----
From: [email protected] <[email protected]> On Behalf Of Heng Qi
Sent: Tuesday, September 5, 2023 7:04 PM
To: [email protected]; [email protected]
Cc: Michael S . Tsirkin <[email protected]>; Parav Pandit <[email protected]>; Jason Wang <[email protected]>; Xuan Zhuo <[email protected]>; Yuri Benditovich <[email protected]>
Subject: [EXT] [virtio-dev] Re: [virtio-comment] [PATCH v2] virtio-net:
support the RSS context

External Email

----------------------------------------------------------------------
Hi all!

Do you have any comments on this?

Thanks!

Quoted 1 line · Heng Qi

Commit 84a1d9c48200 ("net: ethtool: extend RXNFC API to support RSS

spreading of

Quoted 1 line

filter matches") adds support for RSS context as a destination for

receive flow filters

Quoted 1 line

(see WIP work: https://urldefense.proofpoint.com/v2/url?u=https-

3A__lists.oasis-2Dopen.org_archives_virtio- 2Dcomment_202308_msg00194.html&d=DwIDaQ&c=nKjWec2b6R0mOyPaz7xtfQ&r=NHDPs fcAYlN2z- NXHHG4WB09qqS0voo_nf6_kGS625A&m=4OCN2dGMPgHxDFGtU81zZGzzaFYjTALBtQsWL230 DoinsHzHA- RVOOoF4XqITQuy&s=8MdvZRKdXb3tdMZuldE3Ed6VGmaKPPxc8vGxVyRb_Qc&e= ).

Quoted 2 lines

An RSS context consists of configurable parameters specified by

receive-side scaling.

Quoted 3 lines

Use case:
When users want some data flows to be steered to specific multiple

rxqs, they can set

Quoted 1 line

receive flow filter rules for these data flows to an RSS context with

desired rxqs.

Quoted 6 lines

How to set/configure an RSS context:
Assuming no RSS context has been created before.
1. ethtool -X eth0 context new start 5 equal 8

This command creates an RSS context with an id=1 for eth0, and fills

in the indirection

Quoted 1 line

table with rxq indexes 5-8 circularly. The hash key and hash types

reuse the default

Quoted 3 lines

RSS configuration.

Then, we can use 'ethtool -x eth0 context 1' to query the above

configuration.

Quoted 4 lines
2. ethtool -X eth0 context new start 6 equal 7 \
    hkey 8f:bf:dd:11:23:58:d2:8a:00:31:d0:32:a3:b5:1f:\

1f:e4:d1:fe:47:7f:64:42:fd:d0:61:16:b8:b0:f9:71:e8:2d:36:7f:18:dd:4d:c8:
f3

Quoted 2 lines

This command creates an RSS context with an id=2 for eth0, and fills

in the indirection

Quoted 1 line

table with rxq indexes 6-7 circularly. The hash key is

8f:bf:dd:11:23:58:d2:8a:00:31:d0\

Quoted 1 line

:32:a3:b5:1f:1f:e4:d1:fe:47:7f:64:42:fd:d0:61:16:b8:b0:f9:71:e8:2d:36:7f :18:dd:4d:c8:f3.

Quoted 5 lines

Hash types reuse the default RSS configuration.

3. ethtool -N eth0 rx-flow-hash tcp4 sdfn context 1

This command specifies the hash types for the RSS context whose id=1

on eth0.

Quoted 1 line

Now this RSS context only has the hash key to reuse the default RSS

configuration.

Quoted 4 lines

4. ethtool -N eth0 flow-type udp4 src-ip 1.1.1.1 context 1

This command configures a receive flow filter rule for eth0, and the

data flow matching

Quoted 1 line

this rule will continue to select the final rxq according to the RSS

context configuration

Quoted 9 lines

with id=1.

---
v1->v2:
1. u8 to le16 for field rss_ctx_id.
2. Add normativation when device resetting. @Yuri Benditovich
3. Use ctrlq cmd to query rss context capability instead of

reading config space. @Parav Pandit

Quoted 2 lines
  device-types/net/description.tex        | 85

+++++++++++++++++++++++++

device-

Quoted 5 lines
  device-types/net/device-conformance.tex |  1 +
  device-types/net/driver-conformance.tex |  1 +
  3 files changed, 87 insertions(+)
device- renamed from device-types/net/description.tex +0 -0

types/net/description.tex

device-types/net/description.tex \subsection{Feature bits}\label{sec:Device Types /

Quoted 4 lines

index 76585b0..55cd86d 100644

device-types/net/description.tex +0 -0
@@ -88,6 +88,8 @@ \subsection{Feature bits}\label{sec:Device Types /

Network Device / Feature bits

device-types/net/description.tex \subsection{Feature bits}\label{sec:Device Types / · line 88

Quoted 1 line
device-types/net/description.tex +0 -0
  \item[VIRTIO_NET_F_CTRL_MAC_ADDR(23)] Set MAC address through

control

device-types/net/description.tex \subsection{Feature bits}\label{sec:Device Types / Network Device / Feature bits

Quoted 3 lines
device-types/net/description.tex +1 -0
      channel.
 
+\item[VIRTIO_NET_F_RSS_CONTEXT(50)] Device supports multiple RSS

contexts.

device-types/net/description.tex \subsection{Feature bits}\label{sec:Device Types / · line 93

Quoted 2 lines
device-types/net/description.tex +1 -0
+
  \item[VIRTIO_NET_F_HASH_TUNNEL(51)] Device supports inner header

hash for encapsulated packets.

device-types/net/description.tex \subsection{Feature bits}\label{sec:Device Types / · line 94

Quoted 2 lines
device-types/net/description.tex +0 -0
  \item[VIRTIO_NET_F_VQ_NOTF_COAL(52)] Device supports virtqueue

notification coalescing.

device-types/net/description.tex \subsubsection{Feature bit

Quoted 1 line
device-types/net/description.tex +0 -0
@@ -150,6 +152,7 @@ \subsubsection{Feature bit

requirements}\label{sec:Device Types / Network Device

device-types/net/description.tex \subsubsection{Feature bit requirements}\label{sec:Device Types / Network Device

Quoted 3 lines
device-types/net/description.tex +0 -0
  \item[VIRTIO_NET_F_RSS] Requires VIRTIO_NET_F_CTRL_VQ.
  \item[VIRTIO_NET_F_VQ_NOTF_COAL] Requires VIRTIO_NET_F_CTRL_VQ.
  \item[VIRTIO_NET_F_HASH_TUNNEL] Requires VIRTIO_NET_F_CTRL_VQ along

with VIRTIO_NET_F_RSS or VIRTIO_NET_F_HASH_REPORT.

device-types/net/description.tex \subsubsection{Feature bit · line 155

Quoted 1 line
device-types/net/description.tex +1 -0
+\item[VIRTIO_NET_F_RSS_CONTEXT] Requires VIRTIO_NET_F_CTRL_VQ and

VIRTIO_NET_F_RSS.

device-types/net/description.tex \subsubsection{Feature bit requirements}\label{sec:Device Types / Network Device

Quoted 3 lines
device-types/net/description.tex +0 -0
  \end{description}
 
  \subsubsection{Legacy Interface: Feature bits}\label{sec:Device

Types / Network Device / Feature bits / Legacy Interface: Feature bits}

device-types/net/description.tex \subsubsection{Control

Quoted 1 line
device-types/net/description.tex +0 -0
@@ -1606,6 +1609,88 @@ \subsubsection{Control

Virtqueue}\label{sec:Device Types / Network Device / Devi

device-types/net/description.tex \subsubsection{Control · line 1609

Quoted 1 line
device-types/net/description.tex +0 -0
  \item If the destination receive queue is being reset (See

\ref{sec:Basic Facilities of a Virtio Device / Virtqueues / Virtqueue Reset}), the device MUST drop the packet.

device-types/net/description.tex \subsubsection{Control Virtqueue}\label{sec:Device Types / Network Device / Devi

Quoted 3 lines
device-types/net/description.tex +1 -0
  \end{itemize}
 
+\paragraph{RSS Context}\label{sec:Device Types / Network Device /

Device Operation / Control Virtqueue / RSS Context}

device-types/net/description.tex \subsubsection{Control · line 1614

Quoted 2 lines
device-types/net/description.tex +2 -0
+
+An RSS context consists of configurable parameters specified by

\ref{sec:Device Types / Network Device

device-types/net/description.tex \subsubsection{Control Virtqueue}\label{sec:Device Types / Network Device / Devi

Quoted 3 lines
device-types/net/description.tex +3 -0
+/ Device Operation / Control Virtqueue / Receive-side scaling (RSS)}.
+
+The RSS configuration supported by VIRTIO_NET_F_RSS is considered the

default RSS configuration.

device-types/net/description.tex \subsubsection{Control · line 1619

Quoted 2 lines
device-types/net/description.tex +2 -0
+
+The device offers the feature VIRTIO_NET_F_RSS_CONTEXT if it supports

one or multiple RSS contexts

device-types/net/description.tex \subsubsection{Control · line 1620

Quoted 1 line
device-types/net/description.tex +1 -0
+(excluding the default RSS configuration) and configurable

parameters.

device-types/net/description.tex \subsubsection{Control · line 1622

Quoted 2 lines
device-types/net/description.tex +2 -0
+
+\subparagraph{Querying RSS Context Capability}\label{sec:Device Types

/ Network Device / Device Operation / Control Virtqueue / RSS Context / Querying RSS Context Capability}

Quoted 4 lines
device-types/net/description.tex +4 -0
+
+\begin{lstlisting}
+#define VIRTNET_RSS_CTX_CTRL 8
+ #define VIRTNET_RSS_CTX_CTRL_CAP_GET  0

device-types/net/description.tex \subsubsection{Control Virtqueue}\label{sec:Device Types / Network Device / Devi

Quoted 10 lines
device-types/net/description.tex +10 -0
+ #define VIRTNET_RSS_CTX_CTRL_ADD      1
+ #define VIRTNET_RSS_CTX_CTRL_MOD      2
+ #define VIRTNET_RSS_CTX_CTRL_DEL      3
+
+struct virtnet_rss_ctx_cap {
+    le16 max_rss_contexts;
+}
+\end{lstlisting}
+
+Field \field{max_rss_contexts} specifies the maximum number of RSS

contexts \ref{sec:Device Types / Network Device /

device-types/net/description.tex \subsubsection{Control · line 1637

Quoted 1 line
device-types/net/description.tex +1 -0
+Device Operation / Control Virtqueue / RSS Context} supported by the

device.

device-types/net/description.tex \subsubsection{Control · line 1639

Quoted 2 lines
device-types/net/description.tex +2 -0
+
+The driver queries the RSS context capability of the device by

sending the command VIRTNET_RSS_CTX_CTRL_CAP_GET

device-types/net/description.tex \subsubsection{Control Virtqueue}\label{sec:Device Types / Network Device / Devi

Quoted 3 lines
device-types/net/description.tex +3 -0
+with the structure virtnet_rss_ctx_cap.
+
+For the command VIRTNET_RSS_CTX_CTRL_CAP_GET, the structure

virtnet_rss_ctx_cap is write-only for the device.

device-types/net/description.tex \subsubsection{Control · line 1644

Quoted 2 lines
device-types/net/description.tex +2 -0
+
+\subparagraph{Setting RSS Context Parameters}\label{sec:Device Types

/ Network Device / Device Operation / Control Virtqueue / RSS Context / Setting RSS Context Parameters}

Quoted 7 lines
device-types/net/description.tex +7 -0
+
+\begin{lstlisting}
+struct virtnet_rss_ctx_add_modify {
+    le16 rss_ctx_id;
+    le16 padding;
+    struct virtio_net_rss_config rss;
+};

device-types/net/description.tex \subsubsection{Control Virtqueue}\label{sec:Device Types / Network Device / Devi

Quoted 10 lines
device-types/net/description.tex +10 -0
+
+struct virtnet_rss_ctx_del {
+    le16 rss_ctx_id;
+};
+\end{lstlisting}
+
+RSS context parameters:
+\begin{itemize}
+\item  \field{rss_ctx_id}: ID of the specific RSS context.
+\item  \field{rss}: RSS context parameters of the specific RSS

context whose id is \field{rss_ctx_id}.

device-types/net/description.tex \subsubsection{Control Virtqueue}\label{sec:Device Types / Network Device / Devi

Quoted 5 lines
device-types/net/description.tex +5 -0
+\end{itemize}
+
+\field{padding} is reserved and it is ignored by the device.
+
+If the feature VIRTIO_NET_F_RSS_CONTEXT has been negotiated, the

driver can send the following

device-types/net/description.tex \subsubsection{Control Virtqueue}\label{sec:Device Types / Network Device / Devi

Quoted 3 lines
device-types/net/description.tex +3 -0
+VIRTNET_RSS_CTX_CTRL class commands:
+\begin{enumerate}
+\item VIRTNET_RSS_CTX_CTRL_ADD: use the structure

virtnet_rss_ctx_add_modify to

device-types/net/description.tex \subsubsection{Control · line 1670

Quoted 1 line
device-types/net/description.tex +1 -0
+       add an RSS context configured as \field{rss} and id as

\field{rss_ctx_id} for the device.

device-types/net/description.tex \subsubsection{Control · line 1671

Quoted 1 line
device-types/net/description.tex +1 -0
+\item VIRTNET_RSS_CTX_CTRL_MOD: use the structure

virtnet_rss_ctx_add_modify to

device-types/net/description.tex \subsubsection{Control · line 1672

Quoted 1 line
device-types/net/description.tex +1 -0
+       configure parameters of the RSS context whose id is

\field{rss_ctx_id} as \field{rss} for the device.

device-types/net/description.tex \subsubsection{Control · line 1673

Quoted 1 line
device-types/net/description.tex +1 -0
+\item VIRTNET_RSS_CTX_CTRL_DEL: use the structure virtnet_rss_ctx_del

to delete

device-types/net/description.tex \subsubsection{Control Virtqueue}\label{sec:Device Types / Network Device / Devi

Quoted 4 lines
device-types/net/description.tex +4 -0
+       the RSS context whose id is \field{rss_ctx_id} for the device.
+\end{enumerate}
+
+For commands VIRTNET_RSS_CTX_CTRL_ADD and VIRTNET_RSS_CTX_CTRL_MOD,

the structure virtnet_rss_ctx_add_modify is read-only for the device.

device-types/net/description.tex \subsubsection{Control · line 1678

Quoted 1 line
device-types/net/description.tex +1 -0
+For the command VIRTNET_RSS_CTX_CTRL_DEL, the structure

virtnet_rss_ctx_del is read-only for the device.

device-types/net/description.tex \subsubsection{Control · line 1680

Quoted 2 lines
device-types/net/description.tex +2 -0
+
+\devicenormative{\subparagraph}{RSS Context}{Device Types / Network

Device / Device Operation / Control Virtqueue / RSS Context}

device-types/net/description.tex \subsubsection{Control · line 1682

Quoted 2 lines
device-types/net/description.tex +2 -0
+
+The device MUST set \field{max_rss_contexts} to at least 1 if it

offers VIRTIO_NET_F_RSS_CONTEXT.

device-types/net/description.tex \subsubsection{Control · line 1684

Quoted 2 lines
device-types/net/description.tex +2 -0
+
+Upon reset, the device MUST clear all previously configured RSS

contexts.

device-types/net/description.tex \subsubsection{Control · line 1686

Quoted 2 lines
device-types/net/description.tex +2 -0
+
+\drivernormative{\subparagraph}{RSS Context}{Device Types / Network

Device / Device Operation / Control Virtqueue / RSS Context}

device-types/net/description.tex \subsubsection{Control · line 1688

Quoted 2 lines
device-types/net/description.tex +2 -0
+
+The driver MUST have negotiated the VIRTIO_NET_F_RSS_CONTEXT feature

when issuing the VIRTNET_RSS_CTX_CTRL class commands.

Quoted 7 lines

device-types/net/description.tex \subsubsection{Control · line 1690

Quoted 2 lines
device-types/net/description.tex +2 -0
+
+The driver MUST set \field{rss_ctx_id} to between 1 and

\field{max_rss_contexts} inclusive.

device-types/net/description.tex \subsubsection{Control · line 1692

Quoted 2 lines
device-types/net/description.tex +2 -0
+
+The driver MUST NOT send the command VIRTIO_NET_CTRL_MQ_VQ_PAIRS_SET

when the device has successfully configured at least one RSS context.

Quoted 1 line
device-types/net/description.tex +1 -0
+

What happens if a rss context with flow classification rules associated with it is deleted? Are the rules are also then deleted?
Or is such a delete operation not allowed? Can we add a statement describing the behavior?
Otherwise looks good to me.

Regards
Satananda

author
#4 lore raw

Hi Satananda!

Quoted 238 lines · Satananda Burla
Quoted 238 lines

-----Original Message-----
From: [email protected] <[email protected]> On Behalf Of Heng Qi
Sent: Tuesday, September 5, 2023 7:04 PM
To: [email protected]; [email protected]
Cc: Michael S . Tsirkin <[email protected]>; Parav Pandit <[email protected]>; Jason Wang <[email protected]>; Xuan Zhuo <[email protected]>; Yuri Benditovich <[email protected]>
Subject: [EXT] [virtio-dev] Re: [virtio-comment] [PATCH v2] virtio-net:
support the RSS context

External Email

----------------------------------------------------------------------
Hi all!

Do you have any comments on this?

Thanks!

Quoted 1 line · Heng Qi

Commit 84a1d9c48200 ("net: ethtool: extend RXNFC API to support RSS

spreading of

Quoted 1 line

filter matches") adds support for RSS context as a destination for

receive flow filters

Quoted 1 line

(see WIP work: https://urldefense.proofpoint.com/v2/url?u=https-

3A__lists.oasis-2Dopen.org_archives_virtio- 2Dcomment_202308_msg00194.html&d=DwIDaQ&c=nKjWec2b6R0mOyPaz7xtfQ&r=NHDPs fcAYlN2z- NXHHG4WB09qqS0voo_nf6_kGS625A&m=4OCN2dGMPgHxDFGtU81zZGzzaFYjTALBtQsWL230 DoinsHzHA- RVOOoF4XqITQuy&s=8MdvZRKdXb3tdMZuldE3Ed6VGmaKPPxc8vGxVyRb_Qc&e= ).

Quoted 1 line

An RSS context consists of configurable parameters specified by

receive-side scaling.

Quoted 2 lines

Use case:
When users want some data flows to be steered to specific multiple

rxqs, they can set

Quoted 1 line

receive flow filter rules for these data flows to an RSS context with

desired rxqs.

Quoted 5 lines

How to set/configure an RSS context:
Assuming no RSS context has been created before.
1. ethtool -X eth0 context new start 5 equal 8

This command creates an RSS context with an id=1 for eth0, and fills

in the indirection

Quoted 1 line

table with rxq indexes 5-8 circularly. The hash key and hash types

reuse the default

Quoted 3 lines

RSS configuration.

Then, we can use 'ethtool -x eth0 context 1' to query the above

configuration.

Quoted 3 lines
2. ethtool -X eth0 context new start 6 equal 7 \
     hkey 8f:bf:dd:11:23:58:d2:8a:00:31:d0:32:a3:b5:1f:\

1f:e4:d1:fe:47:7f:64:42:fd:d0:61:16:b8:b0:f9:71:e8:2d:36:7f:18:dd:4d:c8:
f3

Quoted 1 line

This command creates an RSS context with an id=2 for eth0, and fills

in the indirection

Quoted 1 line

table with rxq indexes 6-7 circularly. The hash key is

8f:bf:dd:11:23:58:d2:8a:00:31:d0\
:32:a3:b5:1f:1f:e4:d1:fe:47:7f:64:42:fd:d0:61:16:b8:b0:f9:71:e8:2d:36:7f :18:dd:4d:c8:f3.

Quoted 5 lines

Hash types reuse the default RSS configuration.

3. ethtool -N eth0 rx-flow-hash tcp4 sdfn context 1

This command specifies the hash types for the RSS context whose id=1

on eth0.

Quoted 1 line

Now this RSS context only has the hash key to reuse the default RSS

configuration.

Quoted 3 lines

4. ethtool -N eth0 flow-type udp4 src-ip 1.1.1.1 context 1

This command configures a receive flow filter rule for eth0, and the

data flow matching

Quoted 1 line

this rule will continue to select the final rxq according to the RSS

context configuration

Quoted 9 lines

with id=1.

---
v1->v2:
1. u8 to le16 for field rss_ctx_id.
2. Add normativation when device resetting. @Yuri Benditovich
3. Use ctrlq cmd to query rss context capability instead of

reading config space. @Parav Pandit

Quoted 1 line
   device-types/net/description.tex        | 85

+++++++++++++++++++++++++

device-

Quoted 5 lines
   device-types/net/device-conformance.tex |  1 +
   device-types/net/driver-conformance.tex |  1 +
   3 files changed, 87 insertions(+)
device- renamed from device-types/net/description.tex +0 -0

types/net/description.tex

device-types/net/description.tex \subsection{Feature bits}\label{sec:Device Types /

Quoted 4 lines

index 76585b0..55cd86d 100644

device-types/net/description.tex +0 -0
@@ -88,6 +88,8 @@ \subsection{Feature bits}\label{sec:Device Types /

Network Device / Feature bits

device-types/net/description.tex \subsection{Feature bits}\label{sec:Device Types / · line 88

Quoted 1 line
device-types/net/description.tex +0 -0
   \item[VIRTIO_NET_F_CTRL_MAC_ADDR(23)] Set MAC address through

control

device-types/net/description.tex \subsection{Feature bits}\label{sec:Device Types / Network Device / Feature bits

Quoted 3 lines
device-types/net/description.tex +1 -0
       channel.
 
+\item[VIRTIO_NET_F_RSS_CONTEXT(50)] Device supports multiple RSS

contexts.

device-types/net/description.tex \subsection{Feature bits}\label{sec:Device Types / · line 93

Quoted 2 lines
device-types/net/description.tex +1 -0
+
   \item[VIRTIO_NET_F_HASH_TUNNEL(51)] Device supports inner header

hash for encapsulated packets.

device-types/net/description.tex \subsection{Feature bits}\label{sec:Device Types / · line 94

Quoted 1 line
device-types/net/description.tex +0 -0
   \item[VIRTIO_NET_F_VQ_NOTF_COAL(52)] Device supports virtqueue

notification coalescing.

device-types/net/description.tex \subsubsection{Feature bit

Quoted 1 line
device-types/net/description.tex +0 -0
@@ -150,6 +152,7 @@ \subsubsection{Feature bit

requirements}\label{sec:Device Types / Network Device

device-types/net/description.tex \subsubsection{Feature bit requirements}\label{sec:Device Types / Network Device

Quoted 3 lines
device-types/net/description.tex +0 -0
   \item[VIRTIO_NET_F_RSS] Requires VIRTIO_NET_F_CTRL_VQ.
   \item[VIRTIO_NET_F_VQ_NOTF_COAL] Requires VIRTIO_NET_F_CTRL_VQ.
   \item[VIRTIO_NET_F_HASH_TUNNEL] Requires VIRTIO_NET_F_CTRL_VQ along

with VIRTIO_NET_F_RSS or VIRTIO_NET_F_HASH_REPORT.

device-types/net/description.tex \subsubsection{Feature bit · line 155

Quoted 1 line
device-types/net/description.tex +1 -0
+\item[VIRTIO_NET_F_RSS_CONTEXT] Requires VIRTIO_NET_F_CTRL_VQ and

VIRTIO_NET_F_RSS.

device-types/net/description.tex \subsubsection{Feature bit requirements}\label{sec:Device Types / Network Device

Quoted 3 lines
device-types/net/description.tex +0 -0
   \end{description}
 
   \subsubsection{Legacy Interface: Feature bits}\label{sec:Device

Types / Network Device / Feature bits / Legacy Interface: Feature bits}

device-types/net/description.tex \subsubsection{Control

Quoted 1 line
device-types/net/description.tex +0 -0
@@ -1606,6 +1609,88 @@ \subsubsection{Control

Virtqueue}\label{sec:Device Types / Network Device / Devi

device-types/net/description.tex \subsubsection{Control · line 1609

Quoted 1 line
device-types/net/description.tex +0 -0
   \item If the destination receive queue is being reset (See

\ref{sec:Basic Facilities of a Virtio Device / Virtqueues / Virtqueue Reset}), the device MUST drop the packet.

device-types/net/description.tex \subsubsection{Control Virtqueue}\label{sec:Device Types / Network Device / Devi

Quoted 3 lines
device-types/net/description.tex +1 -0
   \end{itemize}
 
+\paragraph{RSS Context}\label{sec:Device Types / Network Device /

Device Operation / Control Virtqueue / RSS Context}

device-types/net/description.tex \subsubsection{Control · line 1614

Quoted 2 lines
device-types/net/description.tex +2 -0
+
+An RSS context consists of configurable parameters specified by

\ref{sec:Device Types / Network Device

device-types/net/description.tex \subsubsection{Control Virtqueue}\label{sec:Device Types / Network Device / Devi

Quoted 3 lines
device-types/net/description.tex +3 -0
+/ Device Operation / Control Virtqueue / Receive-side scaling (RSS)}.
+
+The RSS configuration supported by VIRTIO_NET_F_RSS is considered the

default RSS configuration.

device-types/net/description.tex \subsubsection{Control · line 1619

Quoted 2 lines
device-types/net/description.tex +2 -0
+
+The device offers the feature VIRTIO_NET_F_RSS_CONTEXT if it supports

one or multiple RSS contexts

device-types/net/description.tex \subsubsection{Control · line 1620

Quoted 1 line
device-types/net/description.tex +1 -0
+(excluding the default RSS configuration) and configurable

parameters.

device-types/net/description.tex \subsubsection{Control · line 1622

Quoted 2 lines
device-types/net/description.tex +2 -0
+
+\subparagraph{Querying RSS Context Capability}\label{sec:Device Types

/ Network Device / Device Operation / Control Virtqueue / RSS Context / Querying RSS Context Capability}

Quoted 4 lines
device-types/net/description.tex +4 -0
+
+\begin{lstlisting}
+#define VIRTNET_RSS_CTX_CTRL 8
+ #define VIRTNET_RSS_CTX_CTRL_CAP_GET  0

device-types/net/description.tex \subsubsection{Control Virtqueue}\label{sec:Device Types / Network Device / Devi

Quoted 10 lines
device-types/net/description.tex +10 -0
+ #define VIRTNET_RSS_CTX_CTRL_ADD      1
+ #define VIRTNET_RSS_CTX_CTRL_MOD      2
+ #define VIRTNET_RSS_CTX_CTRL_DEL      3
+
+struct virtnet_rss_ctx_cap {
+    le16 max_rss_contexts;
+}
+\end{lstlisting}
+
+Field \field{max_rss_contexts} specifies the maximum number of RSS

contexts \ref{sec:Device Types / Network Device /

device-types/net/description.tex \subsubsection{Control · line 1637

Quoted 1 line
device-types/net/description.tex +1 -0
+Device Operation / Control Virtqueue / RSS Context} supported by the

device.

device-types/net/description.tex \subsubsection{Control · line 1639

Quoted 2 lines
device-types/net/description.tex +2 -0
+
+The driver queries the RSS context capability of the device by

sending the command VIRTNET_RSS_CTX_CTRL_CAP_GET

device-types/net/description.tex \subsubsection{Control Virtqueue}\label{sec:Device Types / Network Device / Devi

Quoted 3 lines
device-types/net/description.tex +3 -0
+with the structure virtnet_rss_ctx_cap.
+
+For the command VIRTNET_RSS_CTX_CTRL_CAP_GET, the structure

virtnet_rss_ctx_cap is write-only for the device.

device-types/net/description.tex \subsubsection{Control · line 1644

Quoted 2 lines
device-types/net/description.tex +2 -0
+
+\subparagraph{Setting RSS Context Parameters}\label{sec:Device Types

/ Network Device / Device Operation / Control Virtqueue / RSS Context / Setting RSS Context Parameters}

Quoted 7 lines
device-types/net/description.tex +7 -0
+
+\begin{lstlisting}
+struct virtnet_rss_ctx_add_modify {
+    le16 rss_ctx_id;
+    le16 padding;
+    struct virtio_net_rss_config rss;
+};

device-types/net/description.tex \subsubsection{Control Virtqueue}\label{sec:Device Types / Network Device / Devi

Quoted 10 lines
device-types/net/description.tex +10 -0
+
+struct virtnet_rss_ctx_del {
+    le16 rss_ctx_id;
+};
+\end{lstlisting}
+
+RSS context parameters:
+\begin{itemize}
+\item  \field{rss_ctx_id}: ID of the specific RSS context.
+\item  \field{rss}: RSS context parameters of the specific RSS

context whose id is \field{rss_ctx_id}.

device-types/net/description.tex \subsubsection{Control Virtqueue}\label{sec:Device Types / Network Device / Devi

Quoted 5 lines
device-types/net/description.tex +5 -0
+\end{itemize}
+
+\field{padding} is reserved and it is ignored by the device.
+
+If the feature VIRTIO_NET_F_RSS_CONTEXT has been negotiated, the

driver can send the following

device-types/net/description.tex \subsubsection{Control Virtqueue}\label{sec:Device Types / Network Device / Devi

Quoted 3 lines
device-types/net/description.tex +3 -0
+VIRTNET_RSS_CTX_CTRL class commands:
+\begin{enumerate}
+\item VIRTNET_RSS_CTX_CTRL_ADD: use the structure

virtnet_rss_ctx_add_modify to

device-types/net/description.tex \subsubsection{Control · line 1670

Quoted 1 line
device-types/net/description.tex +1 -0
+       add an RSS context configured as \field{rss} and id as

\field{rss_ctx_id} for the device.

device-types/net/description.tex \subsubsection{Control · line 1671

Quoted 1 line
device-types/net/description.tex +1 -0
+\item VIRTNET_RSS_CTX_CTRL_MOD: use the structure

virtnet_rss_ctx_add_modify to

device-types/net/description.tex \subsubsection{Control · line 1672

Quoted 1 line
device-types/net/description.tex +1 -0
+       configure parameters of the RSS context whose id is

\field{rss_ctx_id} as \field{rss} for the device.

device-types/net/description.tex \subsubsection{Control · line 1673

Quoted 1 line
device-types/net/description.tex +1 -0
+\item VIRTNET_RSS_CTX_CTRL_DEL: use the structure virtnet_rss_ctx_del

to delete

device-types/net/description.tex \subsubsection{Control Virtqueue}\label{sec:Device Types / Network Device / Devi

Quoted 4 lines
device-types/net/description.tex +4 -0
+       the RSS context whose id is \field{rss_ctx_id} for the device.
+\end{enumerate}
+
+For commands VIRTNET_RSS_CTX_CTRL_ADD and VIRTNET_RSS_CTX_CTRL_MOD,

the structure virtnet_rss_ctx_add_modify is read-only for the device.

device-types/net/description.tex \subsubsection{Control · line 1678

Quoted 1 line
device-types/net/description.tex +1 -0
+For the command VIRTNET_RSS_CTX_CTRL_DEL, the structure

virtnet_rss_ctx_del is read-only for the device.

device-types/net/description.tex \subsubsection{Control · line 1680

Quoted 2 lines
device-types/net/description.tex +2 -0
+
+\devicenormative{\subparagraph}{RSS Context}{Device Types / Network

Device / Device Operation / Control Virtqueue / RSS Context}

device-types/net/description.tex \subsubsection{Control · line 1682

Quoted 2 lines
device-types/net/description.tex +2 -0
+
+The device MUST set \field{max_rss_contexts} to at least 1 if it

offers VIRTIO_NET_F_RSS_CONTEXT.

device-types/net/description.tex \subsubsection{Control · line 1684

Quoted 2 lines
device-types/net/description.tex +2 -0
+
+Upon reset, the device MUST clear all previously configured RSS

contexts.

device-types/net/description.tex \subsubsection{Control · line 1686

Quoted 2 lines
device-types/net/description.tex +2 -0
+
+\drivernormative{\subparagraph}{RSS Context}{Device Types / Network

Device / Device Operation / Control Virtqueue / RSS Context}

device-types/net/description.tex \subsubsection{Control · line 1688

Quoted 2 lines
device-types/net/description.tex +2 -0
+
+The driver MUST have negotiated the VIRTIO_NET_F_RSS_CONTEXT feature

when issuing the VIRTNET_RSS_CTX_CTRL class commands.

device-types/net/description.tex \subsubsection{Control · line 1690

Quoted 2 lines
device-types/net/description.tex +2 -0
+
+The driver MUST set \field{rss_ctx_id} to between 1 and

\field{max_rss_contexts} inclusive.

Quoted 7 lines
Quoted 4 lines

device-types/net/description.tex \subsubsection{Control · line 1692

Quoted 2 lines
device-types/net/description.tex +2 -0
+
+The driver MUST NOT send the command VIRTIO_NET_CTRL_MQ_VQ_PAIRS_SET

when the device has successfully configured at least one RSS context.

Quoted 1 line
device-types/net/description.tex +1 -0
+

What happens if a rss context with flow classification rules associated with it is deleted? Are the rules are also then deleted?
Or is such a delete operation not allowed? Can we add a statement describing

The RSS context cannot be deleted when it is referenced by a rule in RFF. The RSS context can then be deleted when all rules that referenced it have been removed.

Why is this not added to the requirement:
RSS context is not yet referenced by RFF (i.e. the destination of RFF is a single rxq). This is because we keep the RSS context and RFF orthogonal for the time being. So that the RSS context does not block the advancement of RFF.

Also, RFF is not merged into mainline now. When the RSS context is complete, we can update the statement in the RFF requirements; or when the RFF is complete, we can update the statement in both the RFF and RSS context.

Thanks!

Quoted 6 lines

the behavior?
Otherwise looks good to me.

Regards
Satananda

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

In order to verify user consent to the Feedback License terms and to minimize spam in the list archive, subscription is required before posting.

Subscribe: [email protected]
Unsubscribe: [email protected]
List help: [email protected]
List archive: https://lists.oasis-open.org/archives/virtio-comment/
Feedback License: https://www.oasis-open.org/who/ipr/feedback_license.pdf
List Guidelines: https://www.oasis-open.org/policies-guidelines/mailing-lists
Committee: https://www.oasis-open.org/committees/virtio/
Join OASIS: https://www.oasis-open.org/join/

#5 lore raw
Quoted 300 lines

-----Original Message-----
From: Heng Qi <[email protected]>
Sent: Monday, October 9, 2023 7:15 PM
To: Satananda Burla <[email protected]>; [email protected] open.org; [email protected]
Cc: Michael S . Tsirkin <[email protected]>; Parav Pandit <[email protected]>; Jason Wang <[email protected]>; Xuan Zhuo <[email protected]>; Yuri Benditovich <[email protected]>
Subject: Re: [virtio-dev] RE: [EXT] [virtio-dev] Re: [virtio-comment] [PATCH v2] virtio-net: support the RSS context

Hi Satananda!

Quoted 3 lines · Satananda Burla
Quoted 3 lines

-----Original Message-----
From: [email protected] <[email protected]

open.org>

Quoted 3 lines
Quoted 3 lines

On Behalf Of Heng Qi
Sent: Tuesday, September 5, 2023 7:04 PM
To: [email protected]; [email protected]

open.org

Quoted 5 lines
Quoted 5 lines

Cc: Michael S . Tsirkin <[email protected]>; Parav Pandit <[email protected]>; Jason Wang <[email protected]>; Xuan Zhuo <[email protected]>; Yuri Benditovich <[email protected]>
Subject: [EXT] [virtio-dev] Re: [virtio-comment] [PATCH v2] virtio-

net:

Quoted 5 lines
Quoted 5 lines

support the RSS context

External Email

---------------------------------------------------------------------

-

Quoted 6 lines
Quoted 6 lines

Hi all!

Do you have any comments on this?

Thanks!

Quoted 8 lines
Quoted 8 lines · Heng Qi
Quoted 1 line

Commit 84a1d9c48200 ("net: ethtool: extend RXNFC API to support RSS

spreading of

Quoted 1 line

filter matches") adds support for RSS context as a destination for

receive flow filters

Quoted 1 line

(see WIP work: https://urldefense.proofpoint.com/v2/url?u=https-

3A__lists.oasis-2Dopen.org_archives_virtio-

2Dcomment_202308_msg00194.html&d=DwIDaQ&c=nKjWec2b6R0mOyPaz7xtfQ&r=NHDPs

Quoted 2 lines
Quoted 2 lines

fcAYlN2z-

NXHHG4WB09qqS0voo_nf6_kGS625A&m=4OCN2dGMPgHxDFGtU81zZGzzaFYjTALBtQsWL230

Quoted 8 lines
Quoted 8 lines

DoinsHzHA- RVOOoF4XqITQuy&s=8MdvZRKdXb3tdMZuldE3Ed6VGmaKPPxc8vGxVyRb_Qc&e= ).

Quoted 1 line

An RSS context consists of configurable parameters specified by

receive-side scaling.

Quoted 2 lines

Use case:
When users want some data flows to be steered to specific multiple

rxqs, they can set

Quoted 1 line

receive flow filter rules for these data flows to an RSS context

with

Quoted 9 lines
Quoted 9 lines

desired rxqs.

Quoted 5 lines

How to set/configure an RSS context:
Assuming no RSS context has been created before.
1. ethtool -X eth0 context new start 5 equal 8

This command creates an RSS context with an id=1 for eth0, and fills

in the indirection

Quoted 1 line

table with rxq indexes 5-8 circularly. The hash key and hash types

reuse the default

Quoted 8 lines
Quoted 8 lines
Quoted 3 lines

RSS configuration.

Then, we can use 'ethtool -x eth0 context 1' to query the above

configuration.

Quoted 3 lines
2. ethtool -X eth0 context new start 6 equal 7 \
     hkey 8f:bf:dd:11:23:58:d2:8a:00:31:d0:32:a3:b5:1f:\

1f:e4:d1:fe:47:7f:64:42:fd:d0:61:16:b8:b0:f9:71:e8:2d:36:7f:18:dd:4d:c8:

Quoted 6 lines
Quoted 6 lines

f3

Quoted 1 line

This command creates an RSS context with an id=2 for eth0, and fills

in the indirection

Quoted 1 line

table with rxq indexes 6-7 circularly. The hash key is

8f:bf:dd:11:23:58:d2:8a:00:31:d0\

:32:a3:b5:1f:1f:e4:d1:fe:47:7f:64:42:fd:d0:61:16:b8:b0:f9:71:e8:2d:36:7f

Quoted 46 lines
Quoted 46 lines

:18:dd:4d:c8:f3.

Quoted 5 lines

Hash types reuse the default RSS configuration.

3. ethtool -N eth0 rx-flow-hash tcp4 sdfn context 1

This command specifies the hash types for the RSS context whose id=1

on eth0.

Quoted 1 line

Now this RSS context only has the hash key to reuse the default RSS

configuration.

Quoted 3 lines

4. ethtool -N eth0 flow-type udp4 src-ip 1.1.1.1 context 1

This command configures a receive flow filter rule for eth0, and the

data flow matching

Quoted 1 line

this rule will continue to select the final rxq according to the RSS

context configuration

Quoted 9 lines

with id=1.

---
v1->v2:
1. u8 to le16 for field rss_ctx_id.
2. Add normativation when device resetting. @Yuri Benditovich
3. Use ctrlq cmd to query rss context capability instead of

reading config space. @Parav Pandit

Quoted 1 line
   device-types/net/description.tex        | 85

+++++++++++++++++++++++++

device-

Quoted 5 lines
   device-types/net/device-conformance.tex |  1 +
   device-types/net/driver-conformance.tex |  1 +
   3 files changed, 87 insertions(+)
device- renamed from device-types/net/description.tex +0 -0

types/net/description.tex

device-types/net/description.tex \subsection{Feature bits}\label{sec:Device Types /

Quoted 4 lines

index 76585b0..55cd86d 100644

device-types/net/description.tex +0 -0
@@ -88,6 +88,8 @@ \subsection{Feature bits}\label{sec:Device Types /

Network Device / Feature bits

device-types/net/description.tex \subsection{Feature bits}\label{sec:Device Types / · line 88

Quoted 1 line
device-types/net/description.tex +0 -0
   \item[VIRTIO_NET_F_CTRL_MAC_ADDR(23)] Set MAC address through

control

device-types/net/description.tex \subsection{Feature bits}\label{sec:Device Types / Network Device / Feature bits

Quoted 3 lines
device-types/net/description.tex +1 -0
       channel.
 
+\item[VIRTIO_NET_F_RSS_CONTEXT(50)] Device supports multiple RSS

contexts.

Quoted 2 lines
device-types/net/description.tex +1 -0
+
   \item[VIRTIO_NET_F_HASH_TUNNEL(51)] Device supports inner header
Quoted 8 lines
Quoted 8 lines

hash for encapsulated packets.

device-types/net/description.tex \subsection{Feature bits}\label{sec:Device Types / · line 94

Quoted 1 line
device-types/net/description.tex +0 -0
   \item[VIRTIO_NET_F_VQ_NOTF_COAL(52)] Device supports virtqueue

notification coalescing.

device-types/net/description.tex \subsubsection{Feature bit

Quoted 1 line
device-types/net/description.tex +0 -0
@@ -150,6 +152,7 @@ \subsubsection{Feature bit

requirements}\label{sec:Device Types / Network Device

Quoted 3 lines
device-types/net/description.tex +0 -0
   \item[VIRTIO_NET_F_RSS] Requires VIRTIO_NET_F_CTRL_VQ.
   \item[VIRTIO_NET_F_VQ_NOTF_COAL] Requires VIRTIO_NET_F_CTRL_VQ.
   \item[VIRTIO_NET_F_HASH_TUNNEL] Requires VIRTIO_NET_F_CTRL_VQ

along

Quoted 7 lines
Quoted 7 lines

with VIRTIO_NET_F_RSS or VIRTIO_NET_F_HASH_REPORT.

device-types/net/description.tex \subsubsection{Feature bit · line 155

Quoted 1 line
device-types/net/description.tex +1 -0
+\item[VIRTIO_NET_F_RSS_CONTEXT] Requires VIRTIO_NET_F_CTRL_VQ and

VIRTIO_NET_F_RSS.

device-types/net/description.tex \subsubsection{Feature bit requirements}\label{sec:Device Types / Network Device

Quoted 3 lines
device-types/net/description.tex +0 -0
   \end{description}
 
   \subsubsection{Legacy Interface: Feature bits}\label{sec:Device

Types / Network Device / Feature bits / Legacy Interface: Feature

bits}

Quoted 5 lines
Quoted 5 lines

device-types/net/description.tex \subsubsection{Control

Quoted 1 line
device-types/net/description.tex +0 -0
@@ -1606,6 +1609,88 @@ \subsubsection{Control

Virtqueue}\label{sec:Device Types / Network Device / Devi

device-types/net/description.tex \subsubsection{Control · line 1609

Quoted 1 line
device-types/net/description.tex +0 -0
   \item If the destination receive queue is being reset (See

\ref{sec:Basic Facilities of a Virtio Device / Virtqueues / Virtqueue Reset}), the device MUST drop the packet.

Quoted 8 lines
Quoted 8 lines

device-types/net/description.tex \subsubsection{Control Virtqueue}\label{sec:Device Types / Network Device / Devi

Quoted 3 lines
device-types/net/description.tex +1 -0
   \end{itemize}
 
+\paragraph{RSS Context}\label{sec:Device Types / Network Device /

Device Operation / Control Virtqueue / RSS Context}

device-types/net/description.tex \subsubsection{Control · line 1614

Quoted 2 lines
device-types/net/description.tex +2 -0
+
+An RSS context consists of configurable parameters specified by

\ref{sec:Device Types / Network Device

Quoted 1 line
device-types/net/description.tex +1 -0
+/ Device Operation / Control Virtqueue / Receive-side scaling

(RSS)}.

Quoted 2 lines
Quoted 2 lines

device-types/net/description.tex \subsubsection{Control · line 1617

Quoted 2 lines
device-types/net/description.tex +2 -0
+
+The RSS configuration supported by VIRTIO_NET_F_RSS is considered

the

Quoted 3 lines
Quoted 3 lines

default RSS configuration.

device-types/net/description.tex \subsubsection{Control · line 1619

Quoted 2 lines
device-types/net/description.tex +2 -0
+
+The device offers the feature VIRTIO_NET_F_RSS_CONTEXT if it

supports

Quoted 5 lines
Quoted 5 lines

one or multiple RSS contexts

device-types/net/description.tex \subsubsection{Control · line 1620

Quoted 1 line
device-types/net/description.tex +1 -0
+(excluding the default RSS configuration) and configurable

parameters.

Quoted 2 lines
device-types/net/description.tex +2 -0
+
+\subparagraph{Querying RSS Context Capability}\label{sec:Device

Types

Quoted 1 line
Quoted 1 line

/ Network Device / Device Operation / Control Virtqueue / RSS Context

/

Quoted 16 lines
Quoted 16 lines

Querying RSS Context Capability}

Quoted 4 lines
device-types/net/description.tex +4 -0
+
+\begin{lstlisting}
+#define VIRTNET_RSS_CTX_CTRL 8
+ #define VIRTNET_RSS_CTX_CTRL_CAP_GET  0

device-types/net/description.tex \subsubsection{Control Virtqueue}\label{sec:Device Types / Network Device / Devi

Quoted 10 lines
device-types/net/description.tex +10 -0
+ #define VIRTNET_RSS_CTX_CTRL_ADD      1
+ #define VIRTNET_RSS_CTX_CTRL_MOD      2
+ #define VIRTNET_RSS_CTX_CTRL_DEL      3
+
+struct virtnet_rss_ctx_cap {
+    le16 max_rss_contexts;
+}
+\end{lstlisting}
+
+Field \field{max_rss_contexts} specifies the maximum number of RSS

contexts \ref{sec:Device Types / Network Device /

Quoted 1 line
Quoted 1 line

device-types/net/description.tex \subsubsection{Control · line 1637

Quoted 1 line
device-types/net/description.tex +1 -0
+Device Operation / Control Virtqueue / RSS Context} supported by

the

Quoted 10 lines
Quoted 10 lines

device.

device-types/net/description.tex \subsubsection{Control · line 1639

Quoted 2 lines
device-types/net/description.tex +2 -0
+
+The driver queries the RSS context capability of the device by

sending the command VIRTNET_RSS_CTX_CTRL_CAP_GET

device-types/net/description.tex \subsubsection{Control Virtqueue}\label{sec:Device Types / Network Device / Devi

Quoted 3 lines
device-types/net/description.tex +3 -0
+with the structure virtnet_rss_ctx_cap.
+
+For the command VIRTNET_RSS_CTX_CTRL_CAP_GET, the structure

virtnet_rss_ctx_cap is write-only for the device.

Quoted 2 lines
device-types/net/description.tex +2 -0
+
+\subparagraph{Setting RSS Context Parameters}\label{sec:Device

Types

Quoted 1 line
Quoted 1 line

/ Network Device / Device Operation / Control Virtqueue / RSS Context

/

Quoted 28 lines
Quoted 28 lines

Setting RSS Context Parameters}

Quoted 7 lines
device-types/net/description.tex +7 -0
+
+\begin{lstlisting}
+struct virtnet_rss_ctx_add_modify {
+    le16 rss_ctx_id;
+    le16 padding;
+    struct virtio_net_rss_config rss;
+};

device-types/net/description.tex \subsubsection{Control Virtqueue}\label{sec:Device Types / Network Device / Devi

Quoted 10 lines
device-types/net/description.tex +10 -0
+
+struct virtnet_rss_ctx_del {
+    le16 rss_ctx_id;
+};
+\end{lstlisting}
+
+RSS context parameters:
+\begin{itemize}
+\item  \field{rss_ctx_id}: ID of the specific RSS context.
+\item  \field{rss}: RSS context parameters of the specific RSS

context whose id is \field{rss_ctx_id}.

device-types/net/description.tex \subsubsection{Control Virtqueue}\label{sec:Device Types / Network Device / Devi

Quoted 5 lines
device-types/net/description.tex +5 -0
+\end{itemize}
+
+\field{padding} is reserved and it is ignored by the device.
+
+If the feature VIRTIO_NET_F_RSS_CONTEXT has been negotiated, the

driver can send the following

Quoted 3 lines
device-types/net/description.tex +3 -0
+VIRTNET_RSS_CTX_CTRL class commands:
+\begin{enumerate}
+\item VIRTNET_RSS_CTX_CTRL_ADD: use the structure
Quoted 8 lines
Quoted 8 lines

virtnet_rss_ctx_add_modify to

device-types/net/description.tex \subsubsection{Control · line 1670

Quoted 1 line
device-types/net/description.tex +1 -0
+       add an RSS context configured as \field{rss} and id as

\field{rss_ctx_id} for the device.

device-types/net/description.tex \subsubsection{Control · line 1671

Quoted 1 line
device-types/net/description.tex +1 -0
+\item VIRTNET_RSS_CTX_CTRL_MOD: use the structure

virtnet_rss_ctx_add_modify to

device-types/net/description.tex \subsubsection{Control · line 1672

Quoted 1 line
device-types/net/description.tex +1 -0
+       configure parameters of the RSS context whose id is

\field{rss_ctx_id} as \field{rss} for the device.

Quoted 1 line
device-types/net/description.tex +1 -0
+\item VIRTNET_RSS_CTX_CTRL_DEL: use the structure

virtnet_rss_ctx_del

Quoted 2 lines
Quoted 2 lines

to delete

Quoted 1 line
device-types/net/description.tex +1 -0
+       the RSS context whose id is \field{rss_ctx_id} for the

device.

Quoted 12 lines
Quoted 12 lines

device-types/net/description.tex \subsubsection{Control Virtqueue}\label{sec:Device Types / Network Device / Devi

Quoted 3 lines
device-types/net/description.tex +3 -0
+\end{enumerate}
+
+For commands VIRTNET_RSS_CTX_CTRL_ADD and VIRTNET_RSS_CTX_CTRL_MOD,

the structure virtnet_rss_ctx_add_modify is read-only for the device.

device-types/net/description.tex \subsubsection{Control · line 1678

Quoted 1 line
device-types/net/description.tex +1 -0
+For the command VIRTNET_RSS_CTX_CTRL_DEL, the structure

virtnet_rss_ctx_del is read-only for the device.

device-types/net/description.tex \subsubsection{Control · line 1680

Quoted 2 lines
device-types/net/description.tex +2 -0
+
+\devicenormative{\subparagraph}{RSS Context}{Device Types / Network

Device / Device Operation / Control Virtqueue / RSS Context}

device-types/net/description.tex \subsubsection{Control · line 1682

Quoted 2 lines
device-types/net/description.tex +2 -0
+
+The device MUST set \field{max_rss_contexts} to at least 1 if it

offers VIRTIO_NET_F_RSS_CONTEXT.

Quoted 8 lines
Quoted 8 lines

device-types/net/description.tex \subsubsection{Control · line 1684

Quoted 2 lines
device-types/net/description.tex +2 -0
+
+Upon reset, the device MUST clear all previously configured RSS

contexts.

device-types/net/description.tex \subsubsection{Control · line 1686

Quoted 2 lines
device-types/net/description.tex +2 -0
+
+\drivernormative{\subparagraph}{RSS Context}{Device Types / Network

Device / Device Operation / Control Virtqueue / RSS Context}

device-types/net/description.tex \subsubsection{Control · line 1688

Quoted 2 lines
device-types/net/description.tex +2 -0
+
+The driver MUST have negotiated the VIRTIO_NET_F_RSS_CONTEXT

feature

Quoted 6 lines
Quoted 6 lines

when issuing the VIRTNET_RSS_CTX_CTRL class commands.

device-types/net/description.tex \subsubsection{Control · line 1690

Quoted 2 lines
device-types/net/description.tex +2 -0
+
+The driver MUST set \field{rss_ctx_id} to between 1 and

\field{max_rss_contexts} inclusive.

device-types/net/description.tex \subsubsection{Control · line 1692

Quoted 2 lines
device-types/net/description.tex +2 -0
+
+The driver MUST NOT send the command

VIRTIO_NET_CTRL_MQ_VQ_PAIRS_SET

Quoted 3 lines
Quoted 2 lines

when the device has successfully configured at least one RSS context.

Quoted 1 line
device-types/net/description.tex +1 -0
+

What happens if a rss context with flow classification rules

associated

Quoted 2 lines

with it is deleted? Are the rules are also then deleted? Or is such a delete operation not allowed? Can we add a statement

describing

The RSS context cannot be deleted when it is referenced by a rule in RFF.
The RSS context can then be deleted when all rules that referenced it have been removed.

Why is this not added to the requirement:
RSS context is not yet referenced by RFF (i.e. the destination of RFF is a single rxq). This is because
we keep the RSS context and RFF orthogonal for the time being. So that the RSS context does
not block the advancement of RFF.

Quoted 5 lines

Also, RFF is not merged into mainline now. When the RSS context is complete, we can update
the statement in the RFF requirements; or when the RFF is complete, we can update the statement
in both the RFF and RSS context.

Ok thanks.
Acked by: Satananda Burla <[email protected]>

Quoted 9 lines

Thanks!

Quoted 6 lines

the behavior?
Otherwise looks good to me.

Regards
Satananda