virtualization.lists.linux-foundation.org archive mirror
 help / color / mirror / Atom feed
From: Willem de Bruijn <willemdebruijn.kernel@gmail.com>
To: Andrew Melnichenko <andrew@daynix.com>
Cc: Willem de Bruijn <willemdebruijn.kernel@gmail.com>,
	"Michael S. Tsirkin" <mst@redhat.com>,
	Network Development <netdev@vger.kernel.org>,
	LKML <linux-kernel@vger.kernel.org>,
	virtualization <virtualization@lists.linux-foundation.org>,
	Yuri Benditovich <yuri.benditovich@daynix.com>,
	Yan Vugenfirer <yan@daynix.com>, Jakub Kicinski <kuba@kernel.org>,
	"David S. Miller" <davem@davemloft.net>
Subject: Re: [PATCH v3 2/4] drivers/net/virtio_net: Added basic RSS support.
Date: Sun, 13 Feb 2022 17:09:15 -0500	[thread overview]
Message-ID: <CA+FuTSfJS6b3ba7eW_u4TAHCq=ctpHDJUrb-Yc3iDwpJHHuBMw@mail.gmail.com> (raw)
In-Reply-To: <CABcq3pFLXUMi3ctr6WyJMaXbPjKregTzQ2fG1fwDU7tvk2uRFg@mail.gmail.com>

> > > @@ -3113,13 +3270,14 @@ static int virtnet_probe(struct virtio_device *vdev)
> > >         u16 max_queue_pairs;
> > >         int mtu;
> > >
> > > -       /* Find if host supports multiqueue virtio_net device */
> > > -       err = virtio_cread_feature(vdev, VIRTIO_NET_F_MQ,
> > > -                                  struct virtio_net_config,
> > > -                                  max_virtqueue_pairs, &max_queue_pairs);
> > > +       /* Find if host supports multiqueue/rss virtio_net device */
> > > +       max_queue_pairs = 1;
> > > +       if (virtio_has_feature(vdev, VIRTIO_NET_F_MQ) || virtio_has_feature(vdev, VIRTIO_NET_F_RSS))
> > > +               max_queue_pairs =
> > > +                    virtio_cread16(vdev, offsetof(struct virtio_net_config, max_virtqueue_pairs));
> >
> > Instead of testing either feature and treating them as somewhat equal,
> > shouldn't RSS be dependent on MQ?
>
> No, RSS is dependent on CTRL_VQ. Technically RSS and MQ are similar features.

RSS depends on having multiple queues.

What would enabling VIRTIO_NET_F_RSS without VIRTIO_NET_F_MQ do?

> >
> > >
> > >         /* We need at least 2 queue's */
> > > -       if (err || max_queue_pairs < VIRTIO_NET_CTRL_MQ_VQ_PAIRS_MIN ||
> > > +       if (max_queue_pairs < VIRTIO_NET_CTRL_MQ_VQ_PAIRS_MIN ||
> > >             max_queue_pairs > VIRTIO_NET_CTRL_MQ_VQ_PAIRS_MAX ||
> > >             !virtio_has_feature(vdev, VIRTIO_NET_F_CTRL_VQ))
> > >                 max_queue_pairs = 1;
> > > @@ -3207,6 +3365,23 @@ static int virtnet_probe(struct virtio_device *vdev)
> > >         if (virtio_has_feature(vdev, VIRTIO_NET_F_MRG_RXBUF))
> > >                 vi->mergeable_rx_bufs = true;
> > >
> > > +       if (virtio_has_feature(vdev, VIRTIO_NET_F_RSS)) {
> > > +               vi->has_rss = true;
> > > +               vi->rss_indir_table_size =
> > > +                       virtio_cread16(vdev, offsetof(struct virtio_net_config,
> > > +                               rss_max_indirection_table_length));
> > > +               vi->rss_key_size =
> > > +                       virtio_cread8(vdev, offsetof(struct virtio_net_config, rss_max_key_size));
> > > +
> > > +               vi->rss_hash_types_supported =
> > > +                   virtio_cread32(vdev, offsetof(struct virtio_net_config, supported_hash_types));
> > > +               vi->rss_hash_types_supported &=
> > > +                               ~(VIRTIO_NET_RSS_HASH_TYPE_IP_EX |
> > > +                                 VIRTIO_NET_RSS_HASH_TYPE_TCP_EX |
> > > +                                 VIRTIO_NET_RSS_HASH_TYPE_UDP_EX);
> > > +
> > > +               dev->hw_features |= NETIF_F_RXHASH;
> >
> > Only make the feature visible when the hash is actually reported in
> > the skb, patch 3.
>
> VirtioNET has two features: RSS(steering only) and hash(hash report in
> vnet header)
> Both features may be enabled/disabled separately:
> 1. rss on and hash off - packets steered to the corresponding vqs
> 2. rss off and hash on - packets steered by tap(like mq) but headers
> have properly calculated hash.
> 3. rss on and hash on - packets steered to corresponding vqs and hash
> is present in the header.
>
> RXHASH feature allows the user to enable/disable the rss/hash(any combination).

I find that confusing, but.. I see that there is prior art where some
drivers enable/disable entire RSS load balancing based on this flag.
So ok.

> I think it's a good idea to leave RXHASH in patch 2/4 to give the user
> ability to manipulate the rss only feature.
> But, if you think that it requires to move it to the 3/4, I'll do it.
>
> >
> > Also, clearly separate the feature patches (2) rss, (3) rxhash, (4)
> > rxhash config.
>
> Currently:
> Patch 2/4 - adds VirtioNet rss feature.
> Patch 3/4 - adds VirtioNet hash report feature.
> Patch 4/4 - adds the ability to manipulate supported hash types.
>
> Can you provide more detailed suggestions on how to move hunks?

I gave one in the follow-on patch, to which you responded. That's probably it.
_______________________________________________
Virtualization mailing list
Virtualization@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/virtualization

  reply	other threads:[~2022-02-13 22:09 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-02-08 18:15 [PATCH v3 0/4] RSS support for VirtioNet Andrew Melnychenko
2022-02-08 18:15 ` [PATCH v3 1/4] drivers/net/virtio_net: Fixed padded vheader to use v1 with hash Andrew Melnychenko
2022-02-08 18:15 ` [PATCH v3 2/4] drivers/net/virtio_net: Added basic RSS support Andrew Melnychenko
2022-02-08 20:36   ` Willem de Bruijn
2022-02-13 17:01     ` Andrew Melnichenko
2022-02-13 22:09       ` Willem de Bruijn [this message]
2022-02-17 19:02         ` Andrew Melnichenko
2022-02-18 15:43           ` Willem de Bruijn
2022-02-20 13:17             ` Michael S. Tsirkin
2022-02-08 18:15 ` [PATCH v3 3/4] drivers/net/virtio_net: Added RSS hash report Andrew Melnychenko
2022-02-08 20:54   ` Willem de Bruijn
2022-02-13 17:08     ` Andrew Melnichenko
2022-02-08 18:15 ` [PATCH v3 4/4] drivers/net/virtio_net: Added RSS hash report control Andrew Melnychenko
2022-02-08 20:58   ` Willem de Bruijn
2022-02-13 17:22     ` Andrew Melnichenko

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CA+FuTSfJS6b3ba7eW_u4TAHCq=ctpHDJUrb-Yc3iDwpJHHuBMw@mail.gmail.com' \
    --to=willemdebruijn.kernel@gmail.com \
    --cc=andrew@daynix.com \
    --cc=davem@davemloft.net \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mst@redhat.com \
    --cc=netdev@vger.kernel.org \
    --cc=virtualization@lists.linux-foundation.org \
    --cc=yan@daynix.com \
    --cc=yuri.benditovich@daynix.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).