From: "Michael S. Tsirkin" <mst@redhat.com>
To: "Eugenio Pérez" <eperezma@redhat.com>
Cc: Jason Wang <jasowang@redhat.com>, qemu-devel@nongnu.org
Subject: Re: [PATCH] vhost: Fix last queue index of devices with no cvq
Date: Sun, 31 Oct 2021 17:47:22 -0400 [thread overview]
Message-ID: <20211031174635-mutt-send-email-mst@kernel.org> (raw)
In-Reply-To: <20211029141608.1728855-1-eperezma@redhat.com>
On Fri, Oct 29, 2021 at 04:16:08PM +0200, Eugenio Pérez wrote:
> The -1 assumes that all devices with no cvq have an spare vq allocated
> for them, but with no offer of VIRTIO_NET_F_CTRL_VQ. This may not be the
> case, and the device may have a pair number of queues.
>
> To fix this, just resort to the lower even number of queues.
>
> Fixes: 049eb15b5fc9 ("vhost: record the last virtqueue index for the virtio device")
> Signed-off-by: Eugenio Pérez <eperezma@redhat.com>
> ---
> hw/net/vhost_net.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/hw/net/vhost_net.c b/hw/net/vhost_net.c
> index 0d888f29a6..edf56a597f 100644
> --- a/hw/net/vhost_net.c
> +++ b/hw/net/vhost_net.c
> @@ -330,7 +330,7 @@ int vhost_net_start(VirtIODevice *dev, NetClientState *ncs,
> NetClientState *peer;
>
> if (!cvq) {
> - last_index -= 1;
> + last_index &= ~1ULL;
> }
>
> if (!k->set_guest_notifiers) {
could this code be made clearer?
> --
> 2.27.0
next prev parent reply other threads:[~2021-10-31 21:48 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-10-29 14:16 [PATCH] vhost: Fix last queue index of devices with no cvq Eugenio Pérez
2021-10-31 21:47 ` Michael S. Tsirkin [this message]
2021-11-01 9:03 ` Eugenio Perez Martin
2021-11-01 9:12 ` Michael S. Tsirkin
2021-11-01 3:33 ` Jason Wang
2021-11-01 8:58 ` Eugenio Perez Martin
2021-11-01 15:42 ` Eugenio Perez Martin
2021-11-01 20:48 ` Michael S. Tsirkin
2021-11-02 6:54 ` Eugenio Perez Martin
2021-11-02 4:08 ` Jason Wang
2021-11-02 6:58 ` Eugenio Perez Martin
2021-11-02 7:04 ` Jason Wang
2021-11-02 10:23 ` Eugenio Perez Martin
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=20211031174635-mutt-send-email-mst@kernel.org \
--to=mst@redhat.com \
--cc=eperezma@redhat.com \
--cc=jasowang@redhat.com \
--cc=qemu-devel@nongnu.org \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.