summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorrusty <rusty@0c8fb4dd-22a2-4bb5-bc14-6c75a5f43652>2013-08-16 03:17:32 +0000
committerrusty <rusty@0c8fb4dd-22a2-4bb5-bc14-6c75a5f43652>2013-08-16 03:17:32 +0000
commit49f2dca46e18e7dcf9c54663b6ed2b75b1803878 (patch)
treee63580833993623f1538d77fae37039b5c4abbbe
parent9d6033575f5a6129e2150e86d91cf32cbb2962ed (diff)
2.1.4 Virtqueues: Clarify vring_size() when VIRTIO_RING_F_EVENT_INDEX.
Ported from draft commit eb9fc84d0d3c46438aaab190e2401a9e5409a052. Reported-by: Stefan Fritsch <sf@sfritsch.de> Signed-off-by: Rusty Russell <rusty@au1.ibm.com> git-svn-id: https://tools.oasis-open.org/version-control/svn/virtio@3 0c8fb4dd-22a2-4bb5-bc14-6c75a5f43652
-rw-r--r--virtio-spec.txt11
1 files changed, 6 insertions, 5 deletions
diff --git a/virtio-spec.txt b/virtio-spec.txt
index 6a3860e..864c663 100644
--- a/virtio-spec.txt
+++ b/virtio-spec.txt
@@ -179,11 +179,12 @@ required for the virtqueue according to the following formula:
static inline unsigned vring_size(unsigned int qsz)
{
return ALIGN(sizeof(struct vring_desc)*qsz + sizeof(u16)*(2 + qsz))
- + ALIGN(sizeof(struct vring_used_elem)*qsz);
+ + ALIGN(sizeof(u16)*2 + sizeof(struct vring_used_elem)*qsz);
}
-This currently wastes some space with padding, but also allows
-future extensions. The virtqueue layout structure looks like this:
+This currently wastes some space with padding, but also allows future
+extensions such as the VIRTIO_RING_F_EVENT_IDX extension. The
+virtqueue layout structure looks like this:
struct vring {
// The actual descriptors (16 bytes each)
@@ -314,7 +315,7 @@ entry (modulo the queue size). This starts at 0, and increases.
u16 flags;
u16 idx;
u16 ring[ /* Queue Size */ ];
- u16 used_event;
+ u16 used_event; /* Only if VIRTIO_RING_F_EVENT_IDX */
};
2.1.4.5 The Virtqueue Used Ring
@@ -353,7 +354,7 @@ the buffer to ensure no data leakage occurs.
u16 flags;
u16 idx;
struct vring_used_elem ring[ /* Queue Size */];
- u16 avail_event;
+ u16 avail_event; /* Only if VIRTIO_RING_F_EVENT_IDX */
};
2.1.4.6 Helpers for Operating Virtqueues