From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: virtio-dev-return-6849-cohuck=redhat.com@lists.oasis-open.org Sender: List-Post: List-Help: List-Unsubscribe: List-Subscribe: Received: from lists.oasis-open.org (oasis-open.org [10.110.1.242]) by lists.oasis-open.org (Postfix) with ESMTP id 2E0B5985B2F for ; Mon, 2 Mar 2020 12:17:36 +0000 (UTC) MIME-Version: 1.0 References: <20200301143302.8556-1-yuri.benditovich@daynix.com> <20200301143302.8556-3-yuri.benditovich@daynix.com> In-Reply-To: <20200301143302.8556-3-yuri.benditovich@daynix.com> From: Rob Miller Date: Mon, 2 Mar 2020 07:17:08 -0500 Message-ID: Subject: Re: [virtio-dev] [PATCH v3 2/3] virtio-net: Introduce RSS receive steering feature Content-Type: multipart/alternative; boundary="00000000000013d168059fde2ccb" To: Virtio-Dev List-ID: --00000000000013d168059fde2ccb Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable I think it would be good to have a means to negotiate which types of RSS that a device is willing to do. Perhaps a CTRLQ command to get RSS capabilities then only set those. For example, if a device wishes not to RSS on UDPx but will RSS on TCPx, and a HASH request on TCP|USP, this would result in a failure. Also, what is the definitions of the xxx_EX options? Rob Miller rob.miller@broadcom.com (919)721-3339 On Sun, Mar 1, 2020 at 9:33 AM Yuri Benditovich wrote: > RSS (Receive-side scaling) defines hash calculation > rules and decision on receive virtqueue according to > the calculated hash, provided mask to apply and > provided indirection table containing indices of > receive virqueues. The driver sends the control > command to enable multiqueue and provide parameters > for receive steering. > > Signed-off-by: Yuri Benditovich > --- > include/uapi/linux/virtio_net.h | 42 +++++++++++++++++++++++++++++++-- > 1 file changed, 40 insertions(+), 2 deletions(-) > > diff --git a/include/uapi/linux/virtio_net.h > b/include/uapi/linux/virtio_net.h > index 19e76b3e3a64..188ad3eecdc8 100644 > --- a/include/uapi/linux/virtio_net.h > +++ b/include/uapi/linux/virtio_net.h > @@ -57,6 +57,7 @@ > * Steering */ > #define VIRTIO_NET_F_CTRL_MAC_ADDR 23 /* Set MAC address */ > > +#define VIRTIO_NET_F_RSS 60 /* Supports RSS RX steering */ > #define VIRTIO_NET_F_RSC_EXT 61 /* extended coalescing info */ > #define VIRTIO_NET_F_STANDBY 62 /* Act as standby for another > device > * with the same MAC. > @@ -70,6 +71,17 @@ > #define VIRTIO_NET_S_LINK_UP 1 /* Link is up */ > #define VIRTIO_NET_S_ANNOUNCE 2 /* Announcement is needed */ > > +/* supported/enabled hash types */ > +#define VIRTIO_NET_RSS_HASH_TYPE_IPv4 (1 << 0) > +#define VIRTIO_NET_RSS_HASH_TYPE_TCPv4 (1 << 1) > +#define VIRTIO_NET_RSS_HASH_TYPE_UDPv4 (1 << 2) > +#define VIRTIO_NET_RSS_HASH_TYPE_IPv6 (1 << 3) > +#define VIRTIO_NET_RSS_HASH_TYPE_TCPv6 (1 << 4) > +#define VIRTIO_NET_RSS_HASH_TYPE_UDPv6 (1 << 5) > +#define VIRTIO_NET_RSS_HASH_TYPE_IP_EX (1 << 6) > +#define VIRTIO_NET_RSS_HASH_TYPE_TCP_EX (1 << 7) > +#define VIRTIO_NET_RSS_HASH_TYPE_UDP_EX (1 << 8) > + > struct virtio_net_config { > /* The config defining mac address (if VIRTIO_NET_F_MAC) */ > __u8 mac[ETH_ALEN]; > @@ -93,6 +105,12 @@ struct virtio_net_config { > * Any other value stands for unknown. > */ > __u8 duplex; > + /* maximum size of RSS key */ > + __u8 rss_max_key_size; > + /* maximum number of indirection table entries */ > + __le16 rss_max_indirection_table_length; > + /* bitmask of supported VIRTIO_NET_RSS_HASH_ types */ > + __le32 supported_hash_types; > } __attribute__((packed)); > > /* > @@ -246,7 +264,9 @@ struct virtio_net_ctrl_mac { > > /* > * Control Receive Flow Steering > - * > + */ > +#define VIRTIO_NET_CTRL_MQ 4 > +/* > * The command VIRTIO_NET_CTRL_MQ_VQ_PAIRS_SET > * enables Receive Flow Steering, specifying the number of the transmit > and > * receive queues that will be used. After the command is consumed and > acked by > @@ -259,11 +279,29 @@ struct virtio_net_ctrl_mq { > __virtio16 virtqueue_pairs; > }; > > -#define VIRTIO_NET_CTRL_MQ 4 > #define VIRTIO_NET_CTRL_MQ_VQ_PAIRS_SET 0 > #define VIRTIO_NET_CTRL_MQ_VQ_PAIRS_MIN 1 > #define VIRTIO_NET_CTRL_MQ_VQ_PAIRS_MAX 0x8000 > > +/* > + * The command VIRTIO_NET_CTRL_MQ_RSS_CONFIG has the same effect as > + * VIRTIO_NET_CTRL_MQ_VQ_PAIRS_SET does and additionally configures > + * the receive steering to use a hash calculated for incoming packet > + * to decide on receive virtqueue to place the packet. The command > + * also provides parameters to calculate a hash and receive virtqueue. > + */ > +struct virtio_net_rss_config { > + __le32 hash_types; > + __le16 indirection_table_mask; > + __le16 unclassified_queue; > + __le16 indirection_table[1/* + indirection_table_mask */]; > + __le16 max_tx_vq; > + __u8 hash_key_length; > + __u8 hash_key_data[/* hash_key_length */]; > +}; > + > + #define VIRTIO_NET_CTRL_MQ_RSS_CONFIG 1 > + > /* > * Control network offloads > * > -- > 2.17.1 > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: virtio-dev-unsubscribe@lists.oasis-open.org > For additional commands, e-mail: virtio-dev-help@lists.oasis-open.org > > --00000000000013d168059fde2ccb Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
I think it would be good to have a means = to negotiate which types of RSS that a device is willing to do. Perhaps a C= TRLQ command to get RSS capabilities then only set those. For example, if a= device wishes not to RSS on UDPx but will RSS on TCPx, and a HASH request = on TCP|USP, this would result in a failure.

Also, what i= s the definitions of the xxx_EX options?

Rob Miller
(919)721-3339


=
On Sun, Mar 1, 2020 at 9:33 AM Yuri B= enditovich <yuri.benditov= ich@daynix.com> wrote:
RSS (Receive-side scaling) defines hash calculation
rules and decision on receive virtqueue according to
the calculated hash, provided mask to apply and
provided indirection table containing indices of
receive virqueues. The driver sends the control
command to enable multiqueue and provide parameters
for receive steering.

Signed-off-by: Yuri Benditovich <yuri.benditovich@daynix.com>
---
=C2=A0include/uapi/linux/virtio_net.h | 42 +++++++++++++++++++++++++++++++-= -
=C2=A01 file changed, 40 insertions(+), 2 deletions(-)

diff --git a/include/uapi/linux/virtio_net.h b/include/uapi/linux/virtio_ne= t.h
index 19e76b3e3a64..188ad3eecdc8 100644
--- a/include/uapi/linux/virtio_net.h
+++ b/include/uapi/linux/virtio_net.h
@@ -57,6 +57,7 @@
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0* = Steering */
=C2=A0#define VIRTIO_NET_F_CTRL_MAC_ADDR 23=C2=A0 /* Set MAC address */

+#define VIRTIO_NET_F_RSS=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A060=C2=A0 =C2=A0 = /* Supports RSS RX steering */
=C2=A0#define VIRTIO_NET_F_RSC_EXT=C2=A0 =C2=A0 =C2=A061=C2=A0 =C2=A0 /* ex= tended coalescing info */
=C2=A0#define VIRTIO_NET_F_STANDBY=C2=A0 =C2=A0 =C2=A062=C2=A0 =C2=A0 /* Ac= t as standby for another device
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0* = with the same MAC.
@@ -70,6 +71,17 @@
=C2=A0#define VIRTIO_NET_S_LINK_UP=C2=A0 =C2=A01=C2=A0 =C2=A0 =C2=A0 =C2=A0= /* Link is up */
=C2=A0#define VIRTIO_NET_S_ANNOUNCE=C2=A0 2=C2=A0 =C2=A0 =C2=A0 =C2=A0/* An= nouncement is needed */

+/* supported/enabled hash types */
+#define VIRTIO_NET_RSS_HASH_TYPE_IPv4=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (1= << 0)
+#define VIRTIO_NET_RSS_HASH_TYPE_TCPv4=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(1= << 1)
+#define VIRTIO_NET_RSS_HASH_TYPE_UDPv4=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(1= << 2)
+#define VIRTIO_NET_RSS_HASH_TYPE_IPv6=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (1= << 3)
+#define VIRTIO_NET_RSS_HASH_TYPE_TCPv6=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(1= << 4)
+#define VIRTIO_NET_RSS_HASH_TYPE_UDPv6=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(1= << 5)
+#define VIRTIO_NET_RSS_HASH_TYPE_IP_EX=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(1= << 6)
+#define VIRTIO_NET_RSS_HASH_TYPE_TCP_EX=C2=A0 =C2=A0 =C2=A0 =C2=A0 (1 <= < 7)
+#define VIRTIO_NET_RSS_HASH_TYPE_UDP_EX=C2=A0 =C2=A0 =C2=A0 =C2=A0 (1 <= < 8)
+
=C2=A0struct virtio_net_config {
=C2=A0 =C2=A0 =C2=A0 =C2=A0 /* The config defining mac address (if VIRTIO_N= ET_F_MAC) */
=C2=A0 =C2=A0 =C2=A0 =C2=A0 __u8 mac[ETH_ALEN];
@@ -93,6 +105,12 @@ struct virtio_net_config {
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0* Any other value stands for unknown.
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0*/
=C2=A0 =C2=A0 =C2=A0 =C2=A0 __u8 duplex;
+=C2=A0 =C2=A0 =C2=A0 =C2=A0/* maximum size of RSS key */
+=C2=A0 =C2=A0 =C2=A0 =C2=A0__u8 rss_max_key_size;
+=C2=A0 =C2=A0 =C2=A0 =C2=A0/* maximum number of indirection table entries = */
+=C2=A0 =C2=A0 =C2=A0 =C2=A0__le16 rss_max_indirection_table_length;
+=C2=A0 =C2=A0 =C2=A0 =C2=A0/* bitmask of supported VIRTIO_NET_RSS_HASH_ ty= pes */
+=C2=A0 =C2=A0 =C2=A0 =C2=A0__le32 supported_hash_types;
=C2=A0} __attribute__((packed));

=C2=A0/*
@@ -246,7 +264,9 @@ struct virtio_net_ctrl_mac {

=C2=A0/*
=C2=A0 * Control Receive Flow Steering
- *
+ */
+#define VIRTIO_NET_CTRL_MQ=C2=A0 =C2=A04
+/*
=C2=A0 * The command VIRTIO_NET_CTRL_MQ_VQ_PAIRS_SET
=C2=A0 * enables Receive Flow Steering, specifying the number of the transm= it and
=C2=A0 * receive queues that will be used. After the command is consumed an= d acked by
@@ -259,11 +279,29 @@ struct virtio_net_ctrl_mq {
=C2=A0 =C2=A0 =C2=A0 =C2=A0 __virtio16 virtqueue_pairs;
=C2=A0};

-#define VIRTIO_NET_CTRL_MQ=C2=A0 =C2=A04
=C2=A0 #define VIRTIO_NET_CTRL_MQ_VQ_PAIRS_SET=C2=A0 =C2=A0 =C2=A0 =C2=A0 0=
=C2=A0 #define VIRTIO_NET_CTRL_MQ_VQ_PAIRS_MIN=C2=A0 =C2=A0 =C2=A0 =C2=A0 1=
=C2=A0 #define VIRTIO_NET_CTRL_MQ_VQ_PAIRS_MAX=C2=A0 =C2=A0 =C2=A0 =C2=A0 0= x8000

+/*
+ * The command VIRTIO_NET_CTRL_MQ_RSS_CONFIG has the same effect as
+ * VIRTIO_NET_CTRL_MQ_VQ_PAIRS_SET does and additionally configures
+ * the receive steering to use a hash calculated for incoming packet
+ * to decide on receive virtqueue to place the packet. The command
+ * also provides parameters to calculate a hash and receive virtqueue.
+ */
+struct virtio_net_rss_config {
+=C2=A0 =C2=A0 =C2=A0 =C2=A0__le32 hash_types;
+=C2=A0 =C2=A0 =C2=A0 =C2=A0__le16 indirection_table_mask;
+=C2=A0 =C2=A0 =C2=A0 =C2=A0__le16 unclassified_queue;
+=C2=A0 =C2=A0 =C2=A0 =C2=A0__le16 indirection_table[1/* + indirection_tabl= e_mask */];
+=C2=A0 =C2=A0 =C2=A0 =C2=A0__le16 max_tx_vq;
+=C2=A0 =C2=A0 =C2=A0 =C2=A0__u8 hash_key_length;
+=C2=A0 =C2=A0 =C2=A0 =C2=A0__u8 hash_key_data[/* hash_key_length */];
+};
+
+ #define VIRTIO_NET_CTRL_MQ_RSS_CONFIG=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 1=
+
=C2=A0/*
=C2=A0 * Control network offloads
=C2=A0 *
--
2.17.1


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