On Mon, Jul 18, 2022 at 10:53 AM Jason Wang <jasow...@redhat.com> wrote: > > > 在 2022/7/16 19:34, Eugenio Pérez 写道: > > So we can reuse to inject state messages. > > > > Signed-off-by: Eugenio Pérez <epere...@redhat.com> > > --- > > net/vhost-vdpa.c | 89 +++++++++++++++++++++++++++--------------------- > > 1 file changed, 51 insertions(+), 38 deletions(-) > > > > diff --git a/net/vhost-vdpa.c b/net/vhost-vdpa.c > > index 211bd0468b..aaae51a778 100644 > > --- a/net/vhost-vdpa.c > > +++ b/net/vhost-vdpa.c > > @@ -334,6 +334,54 @@ static bool vhost_vdpa_net_cvq_map_elem(VhostVDPAState > > *s, > > return true; > > } > > > > +static virtio_net_ctrl_ack vhost_vdpa_net_svq_add(VhostShadowVirtqueue > > *svq, > > + const struct iovec > > *dev_buffers) > > > The name should be tweaked since it is used only for cvq. >
Right, I'll change. > > > +{ > > + /* in buffer used for device model */ > > + virtio_net_ctrl_ack status; > > + const struct iovec in = { > > + .iov_base = &status, > > + .iov_len = sizeof(status), > > + }; > > + size_t dev_written; > > + int r; > > + void *unused = (void *)1; > > + > > + r = vhost_svq_add(svq, &dev_buffers[0], 1, &dev_buffers[1], 1, unused); > > + if (unlikely(r != 0)) { > > + if (unlikely(r == -ENOSPC)) { > > + qemu_log_mask(LOG_GUEST_ERROR, "%s: No space on device > > queue\n", > > + __func__); > > + } > > + return VIRTIO_NET_ERR; > > + } > > + > > + /* > > + * We can poll here since we've had BQL from the time we sent the > > + * descriptor. Also, we need to take the answer before SVQ pulls by > > itself, > > + * when BQL is released > > + */ > > > This reminds me that, do we need a upper limit of the time on the > polling here. (Avoid taking BQL for too long time). > Sending a new version of rx filters here. But we have other parts where we can have BQL forever because we trust the device, like vring enable syscalls for example. Thanks!