qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Lei Yang <leiyang@redhat.com>
To: Akihiko Odaki <akihiko.odaki@daynix.com>
Cc: qemu-devel@nongnu.org, "Michael S. Tsirkin" <mst@redhat.com>,
	Jason Wang <jasowang@redhat.com>,
	 Yuri Benditovich <yuri.benditovich@daynix.com>,
	devel@daynix.com
Subject: Re: [PATCH v2] virtio-net: Fix the interpretation of max_tx_vq
Date: Mon, 24 Mar 2025 22:51:49 +0800	[thread overview]
Message-ID: <CAPpAL=w6taU7WLBEAOx6ocQzQJ5HZCHd_hg5Ra-pbp3s1SbsJg@mail.gmail.com> (raw)
In-Reply-To: <20250322-vq-v2-1-cee0aafe6404@daynix.com>

QE tested this patch with virtio-net regression tests, everything works fine.

Tested-by: Lei Yang <leiyang@redhat.com>

On Sat, Mar 22, 2025 at 2:48 PM Akihiko Odaki <akihiko.odaki@daynix.com> wrote:
>
> virtio-net uses the max_tx_vq field of struct virtio_net_rss_config to
> determine the number of queue pairs and emits an error message saying
> "Can't get queue_pairs". However, the field tells only about tx.
>
> Examine unclassified_queue and indirection_table to determine the number
> of queues required for rx, and correct the name of field in the error
> message, clarifying its correct semantics.
>
> Fixes: 590790297c0d ("virtio-net: implement RSS configuration command")
> Signed-off-by: Akihiko Odaki <akihiko.odaki@daynix.com>
> ---
> Changes in v2:
> - Handled unclassified_queue too.
> - Added a Fixes: tag.
> - Link to v1: https://lore.kernel.org/qemu-devel/20250321-vq-v1-1-6d6d285e5cbc@daynix.com
> ---
>  hw/net/virtio-net.c | 26 ++++++++++++++++----------
>  1 file changed, 16 insertions(+), 10 deletions(-)
>
> diff --git a/hw/net/virtio-net.c b/hw/net/virtio-net.c
> index de87cfadffe1..afc6b82f13c9 100644
> --- a/hw/net/virtio-net.c
> +++ b/hw/net/virtio-net.c
> @@ -1450,23 +1450,29 @@ static uint16_t virtio_net_handle_rss(VirtIONet *n,
>          err_value = (uint32_t)s;
>          goto error;
>      }
> -    for (i = 0; i < n->rss_data.indirections_len; ++i) {
> -        uint16_t val = n->rss_data.indirections_table[i];
> -        n->rss_data.indirections_table[i] = virtio_lduw_p(vdev, &val);
> -    }
>      offset += size_get;
>      size_get = sizeof(temp);
>      s = iov_to_buf(iov, iov_cnt, offset, &temp, size_get);
>      if (s != size_get) {
> -        err_msg = "Can't get queue_pairs";
> +        err_msg = "Can't get max_tx_vq";
>          err_value = (uint32_t)s;
>          goto error;
>      }
> -    queue_pairs = do_rss ? virtio_lduw_p(vdev, &temp.us) : n->curr_queue_pairs;
> -    if (queue_pairs == 0 || queue_pairs > n->max_queue_pairs) {
> -        err_msg = "Invalid number of queue_pairs";
> -        err_value = queue_pairs;
> -        goto error;
> +    if (do_rss) {
> +        queue_pairs = MAX(virtio_lduw_p(vdev, &temp.us),
> +                          n->rss_data.default_queue);
> +        for (i = 0; i < n->rss_data.indirections_len; ++i) {
> +            uint16_t val = n->rss_data.indirections_table[i];
> +            n->rss_data.indirections_table[i] = virtio_lduw_p(vdev, &val);
> +            queue_pairs = MAX(queue_pairs, n->rss_data.indirections_table[i]);
> +        }
> +        if (queue_pairs == 0 || queue_pairs > n->max_queue_pairs) {
> +            err_msg = "Invalid number of queue_pairs";
> +            err_value = queue_pairs;
> +            goto error;
> +        }
> +    } else {
> +        queue_pairs = n->curr_queue_pairs;
>      }
>      if (temp.b > VIRTIO_NET_RSS_MAX_KEY_SIZE) {
>          err_msg = "Invalid key size";
>
> ---
> base-commit: 825b96dbcee23d134b691fc75618b59c5f53da32
> change-id: 20250321-vq-87aff4f531bf
>
> Best regards,
> --
> Akihiko Odaki <akihiko.odaki@daynix.com>
>
>



  reply	other threads:[~2025-03-24 14:53 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-03-22  6:47 [PATCH v2] virtio-net: Fix the interpretation of max_tx_vq Akihiko Odaki
2025-03-24 14:51 ` Lei Yang [this message]
2025-06-01 10:38 ` Michael S. Tsirkin

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='CAPpAL=w6taU7WLBEAOx6ocQzQJ5HZCHd_hg5Ra-pbp3s1SbsJg@mail.gmail.com' \
    --to=leiyang@redhat.com \
    --cc=akihiko.odaki@daynix.com \
    --cc=devel@daynix.com \
    --cc=jasowang@redhat.com \
    --cc=mst@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --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).