qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [virtio] virtqueue_add_sgs


From: Stefan Hajnoczi
Subject: Re: [Qemu-devel] [virtio] virtqueue_add_sgs
Date: Wed, 3 Jun 2015 14:50:04 +0100
User-agent: Mutt/1.5.23 (2014-03-12)

On Wed, Jun 03, 2015 at 01:15:34PM +0300, Catalin Vasile wrote:
> If I send to the backend out buffers using multiple sgs, what should I
> expect when the user sends me back the result? What should I expect to
> get when I do a virtqueue_get_buf()?
> Do I need to make multiple calls to virtqueue_get_buf() in order to
> get all my out buffers? Or it returns with the first buffer and then I
> somehow have to guess the other buffers from the data received in the
> first buffer?

virtqueue_add_sgs() only adds one "buffer" to the virtqueue.  I'm using
"buffer" in the virtio spec sense here, don't confuse a buffer with
scatterlist descriptors.  So exactly one virtqueue_get_buf() must be
used to harvest the completed buffer.

One buffer may consist of multiple descriptors (i.e. struct scatterlist
elements), some of them read-only ("in") and/or some of them write-only
("out").

The way to correlate a submitted buffer with the completed buffer from
virtqueue_get_buf() is the virtqueue_add_sgs(..., void *data, ...)
argument.  You get the data value back as the return value from
virtqueue_get_buf().  Typically some sort of request pointer is passed
as the data value which identifies the network packet, disk I/O request,
etc.

Stefan

Attachment: pgppWH0OCESgm.pgp
Description: PGP signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]