Message ID | 1701970793-6865-12-git-send-email-si-wei.liu@oracle.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | vdpa-net: improve migration downtime through descriptor ASID and persistent IOTLB | expand |
On Thu, Dec 7, 2023 at 7:50 PM Si-Wei Liu <si-wei.liu@oracle.com> wrote: > > Generalize duplicated condition check for the last vq of vdpa > device to a common function. > > Signed-off-by: Si-Wei Liu <si-wei.liu@oracle.com> We can also send this separately, Reviewed-by: Eugenio Pérez <eperezma@redhat.com> > --- > hw/virtio/vhost-vdpa.c | 9 +++++++-- > 1 file changed, 7 insertions(+), 2 deletions(-) > > diff --git a/hw/virtio/vhost-vdpa.c b/hw/virtio/vhost-vdpa.c > index 30dff95..2b1cc14 100644 > --- a/hw/virtio/vhost-vdpa.c > +++ b/hw/virtio/vhost-vdpa.c > @@ -593,6 +593,11 @@ static bool vhost_vdpa_first_dev(struct vhost_dev *dev) > return v->index == 0; > } > > +static bool vhost_vdpa_last_dev(struct vhost_dev *dev) > +{ > + return dev->vq_index + dev->nvqs == dev->vq_index_end; > +} > + > static int vhost_vdpa_get_dev_features(struct vhost_dev *dev, > uint64_t *features) > { > @@ -1432,7 +1437,7 @@ static int vhost_vdpa_dev_start(struct vhost_dev *dev, bool started) > goto out_stop; > } > > - if (dev->vq_index + dev->nvqs != dev->vq_index_end) { > + if (!vhost_vdpa_last_dev(dev)) { > return 0; > } > > @@ -1467,7 +1472,7 @@ static void vhost_vdpa_reset_status(struct vhost_dev *dev) > { > struct vhost_vdpa *v = dev->opaque; > > - if (dev->vq_index + dev->nvqs != dev->vq_index_end) { > + if (!vhost_vdpa_last_dev(dev)) { > return; > } > > -- > 1.8.3.1 >
On Fri, Dec 8, 2023 at 2:50 AM Si-Wei Liu <si-wei.liu@oracle.com> wrote: > > Generalize duplicated condition check for the last vq of vdpa > device to a common function. > > Signed-off-by: Si-Wei Liu <si-wei.liu@oracle.com> Acked-by: Jason Wang <jasowang@redhat.com> Thanks > --- > hw/virtio/vhost-vdpa.c | 9 +++++++-- > 1 file changed, 7 insertions(+), 2 deletions(-) > > diff --git a/hw/virtio/vhost-vdpa.c b/hw/virtio/vhost-vdpa.c > index 30dff95..2b1cc14 100644 > --- a/hw/virtio/vhost-vdpa.c > +++ b/hw/virtio/vhost-vdpa.c > @@ -593,6 +593,11 @@ static bool vhost_vdpa_first_dev(struct vhost_dev *dev) > return v->index == 0; > } > > +static bool vhost_vdpa_last_dev(struct vhost_dev *dev) > +{ > + return dev->vq_index + dev->nvqs == dev->vq_index_end; > +} > + > static int vhost_vdpa_get_dev_features(struct vhost_dev *dev, > uint64_t *features) > { > @@ -1432,7 +1437,7 @@ static int vhost_vdpa_dev_start(struct vhost_dev *dev, bool started) > goto out_stop; > } > > - if (dev->vq_index + dev->nvqs != dev->vq_index_end) { > + if (!vhost_vdpa_last_dev(dev)) { > return 0; > } > > @@ -1467,7 +1472,7 @@ static void vhost_vdpa_reset_status(struct vhost_dev *dev) > { > struct vhost_vdpa *v = dev->opaque; > > - if (dev->vq_index + dev->nvqs != dev->vq_index_end) { > + if (!vhost_vdpa_last_dev(dev)) { > return; > } > > -- > 1.8.3.1 >
diff --git a/hw/virtio/vhost-vdpa.c b/hw/virtio/vhost-vdpa.c index 30dff95..2b1cc14 100644 --- a/hw/virtio/vhost-vdpa.c +++ b/hw/virtio/vhost-vdpa.c @@ -593,6 +593,11 @@ static bool vhost_vdpa_first_dev(struct vhost_dev *dev) return v->index == 0; } +static bool vhost_vdpa_last_dev(struct vhost_dev *dev) +{ + return dev->vq_index + dev->nvqs == dev->vq_index_end; +} + static int vhost_vdpa_get_dev_features(struct vhost_dev *dev, uint64_t *features) { @@ -1432,7 +1437,7 @@ static int vhost_vdpa_dev_start(struct vhost_dev *dev, bool started) goto out_stop; } - if (dev->vq_index + dev->nvqs != dev->vq_index_end) { + if (!vhost_vdpa_last_dev(dev)) { return 0; } @@ -1467,7 +1472,7 @@ static void vhost_vdpa_reset_status(struct vhost_dev *dev) { struct vhost_vdpa *v = dev->opaque; - if (dev->vq_index + dev->nvqs != dev->vq_index_end) { + if (!vhost_vdpa_last_dev(dev)) { return; }
Generalize duplicated condition check for the last vq of vdpa device to a common function. Signed-off-by: Si-Wei Liu <si-wei.liu@oracle.com> --- hw/virtio/vhost-vdpa.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-)