[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH 4/8] virtio: add detach element for packed ring(
From: |
Michael S. Tsirkin |
Subject: |
Re: [Qemu-devel] [PATCH 4/8] virtio: add detach element for packed ring(1.1) |
Date: |
Mon, 4 Jun 2018 04:54:45 +0300 |
On Mon, Jun 04, 2018 at 09:34:35AM +0800, Wei Xu wrote:
> On Tue, Apr 10, 2018 at 03:32:53PM +0800, Jason Wang wrote:
> >
> >
> > On 2018年04月04日 20:54, address@hidden wrote:
> > >From: Wei Xu <address@hidden>
> > >
> > >helper for packed ring
> >
> > It's odd and hard to review if you put detach patch first. I think this
> > patch needs to be reordered after the implementation of pop/map.
>
> This patch is not necessary after sync to tiwei's v5, so we can skip it.
>
> Wei
I suspect we will need to bring detach back eventually but yes,
it can wait.
> >
> > Thanks
> >
> > >Signed-off-by: Wei Xu <address@hidden>
> > >---
> > > hw/virtio/virtio.c | 21 +++++++++++++++++++--
> > > 1 file changed, 19 insertions(+), 2 deletions(-)
> > >
> > >diff --git a/hw/virtio/virtio.c b/hw/virtio/virtio.c
> > >index 478df3d..fdee40f 100644
> > >--- a/hw/virtio/virtio.c
> > >+++ b/hw/virtio/virtio.c
> > >@@ -561,6 +561,20 @@ static void virtqueue_unmap_sg(VirtQueue *vq, const
> > >VirtQueueElement *elem,
> > > elem->out_sg[i].iov_len);
> > > }
> > >+static void virtqueue_detach_element_split(VirtQueue *vq,
> > >+ const VirtQueueElement *elem, unsigned int
> > >len)
> > >+{
> > >+ vq->inuse--;
> > >+ virtqueue_unmap_sg(vq, elem, len);
> > >+}
> > >+
> > >+static void virtqueue_detach_element_packed(VirtQueue *vq,
> > >+ const VirtQueueElement *elem, unsigned int
> > >len)
> > >+{
> > >+ vq->inuse -= elem->count;
> > >+ virtqueue_unmap_sg(vq, elem, len);
> > >+}
> > >+
> > > /* virtqueue_detach_element:
> > > * @vq: The #VirtQueue
> > > * @elem: The #VirtQueueElement
> > >@@ -573,8 +587,11 @@ static void virtqueue_unmap_sg(VirtQueue *vq, const
> > >VirtQueueElement *elem,
> > > void virtqueue_detach_element(VirtQueue *vq, const VirtQueueElement
> > > *elem,
> > > unsigned int len)
> > > {
> > >- vq->inuse--;
> > >- virtqueue_unmap_sg(vq, elem, len);
> > >+ if (virtio_vdev_has_feature(vq->vdev, VIRTIO_F_RING_PACKED)) {
> > >+ virtqueue_detach_element_packed(vq, elem, len);
> > >+ } else {
> > >+ virtqueue_detach_element_split(vq, elem, len);
> > >+ }
> > > }
> > > /* virtqueue_unpop:
> >