qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [qemu-devel]question on virtqueue_get_avail_bytes
@ 2013-08-19  9:28 yinyin
  2013-08-19 14:30 ` Stefan Hajnoczi
  0 siblings, 1 reply; 8+ messages in thread
From: yinyin @ 2013-08-19  9:28 UTC (permalink / raw)
  To: qemu-devel@nongnu.org

Hi,all:
	in func virtqueue_get_avail_bytes, when found a indirect desc, we need loop over it.
            /* loop over the indirect descriptor table */
            indirect = 1;
            max = vring_desc_len(desc_pa, i) / sizeof(VRingDesc);
            num_bufs = i = 0;
            desc_pa = vring_desc_addr(desc_pa, i);
	But, It init i to 0, then use i to update desc_pa. so we will always get  :
	desc_pa = vring_desc_addr(desc_pa, 0);
	is it right?or should we update desc_pa first, then init i to 0?

diff --git a/hw/virtio/virtio.c b/hw/virtio/virtio.c
index 09f62c6..554ae6f 100644
--- a/hw/virtio/virtio.c
+++ b/hw/virtio/virtio.c
@@ -377,8 +377,8 @@ void virtqueue_get_avail_bytes(VirtQueue *vq, unsigned int *in_bytes,
             /* loop over the indirect descriptor table */
             indirect = 1;
             max = vring_desc_len(desc_pa, i) / sizeof(VRingDesc);
-            num_bufs = i = 0;
             desc_pa = vring_desc_addr(desc_pa, i);
+           num_bufs = i = 0;
         }
 
         do {

^ permalink raw reply related	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2013-09-04 12:19 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-08-19  9:28 [Qemu-devel] [qemu-devel]question on virtqueue_get_avail_bytes yinyin
2013-08-19 14:30 ` Stefan Hajnoczi
2013-08-22  6:47   ` [Qemu-devel] [PATCH]virtio: virtqueue_get_avail_bytes: fix desc_pa when loop over the indirect descriptor table yinyin
2013-08-22 11:59     ` Stefan Hajnoczi
2013-08-25  9:51     ` Michael S. Tsirkin
2013-09-03 11:10   ` [Qemu-devel] [qemu-devel]question on virtqueue_get_avail_bytes Amit Shah
2013-09-03 11:15     ` Michael S. Tsirkin
2013-09-04 12:18       ` Amit Shah

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).