On Mon, Nov 01, 2021 at 10:03:19AM +0100, Eugenio Perez Martin wrote: > On Sun, Oct 31, 2021 at 10:47 PM Michael S. Tsirkin <m...@redhat.com> wrote: > > > > 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 <epere...@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? > > > > I can expand both for sure, but do you mean clearer because the > operation is obscure (to remove the last bit to make last_index even) > or because the need of that operation is not clear enough? > > Thanks!
I'm not sure ... both? > > > -- > > > 2.27.0 > >