diff options
author | Greg Kurz <groug@kaod.org> | 2018-02-01 21:21:28 +0100 |
---|---|---|
committer | Greg Kurz <groug@kaod.org> | 2018-02-02 11:11:55 +0100 |
commit | be3a6781605803b2c48a48135002869ed2c73cf1 (patch) | |
tree | 1836053f31ca3c79b0901fb08dff53ab12ede27a /tests/virtio-blk-test.c | |
parent | 354b86f85f516fecb60185f9c2b8e5933177b300 (diff) |
libqos/virtio: return length written into used descriptor
When a 9p request is flushed (ie, cancelled) by the guest, the device
is expected to simply mark the request as used, without sending a 9p
reply (ie, without writing anything into the used buffer).
To be able to test this, we need access to the length written by the
device into the used descriptor. This patch adds a uint32_t * argument
to qvirtqueue_get_buf() and qvirtio_wait_used_elem() for this purpose.
All existing users are updated accordingly.
Signed-off-by: Greg Kurz <groug@kaod.org>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Diffstat (limited to 'tests/virtio-blk-test.c')
-rw-r--r-- | tests/virtio-blk-test.c | 24 |
1 files changed, 13 insertions, 11 deletions
diff --git a/tests/virtio-blk-test.c b/tests/virtio-blk-test.c index 45f368dcd9..2ac64e5e25 100644 --- a/tests/virtio-blk-test.c +++ b/tests/virtio-blk-test.c @@ -193,7 +193,7 @@ static void test_basic(QVirtioDevice *dev, QGuestAllocator *alloc, qvirtqueue_kick(dev, vq, free_head); - qvirtio_wait_used_elem(dev, vq, free_head, QVIRTIO_BLK_TIMEOUT_US); + qvirtio_wait_used_elem(dev, vq, free_head, NULL, QVIRTIO_BLK_TIMEOUT_US); status = readb(req_addr + 528); g_assert_cmpint(status, ==, 0); @@ -215,7 +215,7 @@ static void test_basic(QVirtioDevice *dev, QGuestAllocator *alloc, qvirtqueue_kick(dev, vq, free_head); - qvirtio_wait_used_elem(dev, vq, free_head, QVIRTIO_BLK_TIMEOUT_US); + qvirtio_wait_used_elem(dev, vq, free_head, NULL, QVIRTIO_BLK_TIMEOUT_US); status = readb(req_addr + 528); g_assert_cmpint(status, ==, 0); @@ -243,7 +243,8 @@ static void test_basic(QVirtioDevice *dev, QGuestAllocator *alloc, qvirtqueue_add(vq, req_addr + 528, 1, true, false); qvirtqueue_kick(dev, vq, free_head); - qvirtio_wait_used_elem(dev, vq, free_head, QVIRTIO_BLK_TIMEOUT_US); + qvirtio_wait_used_elem(dev, vq, free_head, NULL, + QVIRTIO_BLK_TIMEOUT_US); status = readb(req_addr + 528); g_assert_cmpint(status, ==, 0); @@ -264,7 +265,8 @@ static void test_basic(QVirtioDevice *dev, QGuestAllocator *alloc, qvirtqueue_kick(dev, vq, free_head); - qvirtio_wait_used_elem(dev, vq, free_head, QVIRTIO_BLK_TIMEOUT_US); + qvirtio_wait_used_elem(dev, vq, free_head, NULL, + QVIRTIO_BLK_TIMEOUT_US); status = readb(req_addr + 528); g_assert_cmpint(status, ==, 0); @@ -345,7 +347,7 @@ static void pci_indirect(void) free_head = qvirtqueue_add_indirect(&vqpci->vq, indirect); qvirtqueue_kick(&dev->vdev, &vqpci->vq, free_head); - qvirtio_wait_used_elem(&dev->vdev, &vqpci->vq, free_head, + qvirtio_wait_used_elem(&dev->vdev, &vqpci->vq, free_head, NULL, QVIRTIO_BLK_TIMEOUT_US); status = readb(req_addr + 528); g_assert_cmpint(status, ==, 0); @@ -370,7 +372,7 @@ static void pci_indirect(void) free_head = qvirtqueue_add_indirect(&vqpci->vq, indirect); qvirtqueue_kick(&dev->vdev, &vqpci->vq, free_head); - qvirtio_wait_used_elem(&dev->vdev, &vqpci->vq, free_head, + qvirtio_wait_used_elem(&dev->vdev, &vqpci->vq, free_head, NULL, QVIRTIO_BLK_TIMEOUT_US); status = readb(req_addr + 528); g_assert_cmpint(status, ==, 0); @@ -481,7 +483,7 @@ static void pci_msix(void) qvirtqueue_add(&vqpci->vq, req_addr + 528, 1, true, false); qvirtqueue_kick(&dev->vdev, &vqpci->vq, free_head); - qvirtio_wait_used_elem(&dev->vdev, &vqpci->vq, free_head, + qvirtio_wait_used_elem(&dev->vdev, &vqpci->vq, free_head, NULL, QVIRTIO_BLK_TIMEOUT_US); status = readb(req_addr + 528); @@ -506,7 +508,7 @@ static void pci_msix(void) qvirtqueue_kick(&dev->vdev, &vqpci->vq, free_head); - qvirtio_wait_used_elem(&dev->vdev, &vqpci->vq, free_head, + qvirtio_wait_used_elem(&dev->vdev, &vqpci->vq, free_head, NULL, QVIRTIO_BLK_TIMEOUT_US); status = readb(req_addr + 528); @@ -580,7 +582,7 @@ static void pci_idx(void) qvirtqueue_add(&vqpci->vq, req_addr + 528, 1, true, false); qvirtqueue_kick(&dev->vdev, &vqpci->vq, free_head); - qvirtio_wait_used_elem(&dev->vdev, &vqpci->vq, free_head, + qvirtio_wait_used_elem(&dev->vdev, &vqpci->vq, free_head, NULL, QVIRTIO_BLK_TIMEOUT_US); /* Write request */ @@ -627,9 +629,9 @@ static void pci_idx(void) qvirtqueue_kick(&dev->vdev, &vqpci->vq, free_head); /* We get just one notification for both requests */ - qvirtio_wait_used_elem(&dev->vdev, &vqpci->vq, write_head, + qvirtio_wait_used_elem(&dev->vdev, &vqpci->vq, write_head, NULL, QVIRTIO_BLK_TIMEOUT_US); - g_assert(qvirtqueue_get_buf(&vqpci->vq, &desc_idx)); + g_assert(qvirtqueue_get_buf(&vqpci->vq, &desc_idx, NULL)); g_assert_cmpint(desc_idx, ==, free_head); status = readb(req_addr + 528); |