Michael S. Tsirkin
2017-Aug-02 13:50 UTC
[virtio-dev] repost: af_packet vs virtio (was packed ring layout proposal v2)
On Tue, Aug 01, 2017 at 08:54:27PM -0700, Steven Luong wrote:> * Descriptor ring: > > Guest adds descriptors with unique index values and DESC_HW set in flags. > Host overwrites used descriptors with correct len, index, and DESC_HW > clear.? Flags are always set/cleared last. > > #define DESC_HW 0x0080 > > struct desc { > ? ? ? ? __le64 addr; > ? ? ? ? __le32 len; > ? ? ? ? __le16 index; > ? ? ? ? __le16 flags; > }; > > When DESC_HW is set, descriptor belongs to device. When it is clear, > it belongs to the driver. > > We can use 1 bit to set direction > /* This marks a buffer as write-only (otherwise read-only). */ > #define VRING_DESC_F_WRITE? ? ? 2 > > * Scatter/gather support > > We can use 1 bit to chain s/g entries in a request, same as virtio 1.0: > > /* This marks a buffer as continuing via the next field. */ > > > This comment here is confusing to me. In 1.0, virtq_desc has the next field. > When the flag VRING_DESC_F_NEXT is set, the next entry to continue is specified > in the next field. > > Here in 1.1, struct desc does not have the next field, only addr, len, index, > and flags. So when VRING_DESC_F_NEXT is set in struct desc's flags field, where > is the next entry to continue the current descriptor, the entry immediately > following the current entry? ie, if the current entry is at index 10 in the > descriptor table and its flags is set for VRING_DESC_F_NEXT, is the entry > continuing the current entry in index 11? > > StevenExactly, you got it right.
Reasonably Related Threads
- [virtio-dev] repost: af_packet vs virtio (was packed ring layout proposal v2)
- repost: af_packet vs virtio (was packed ring layout proposal v2)
- repost: af_packet vs virtio (was packed ring layout proposal v2)
- [virtio-dev] packed ring layout proposal v2
- packed ring layout proposal v3