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-net-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-net-test.c')
-rw-r--r-- | tests/virtio-net-test.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/tests/virtio-net-test.c b/tests/virtio-net-test.c index 635b942c36..ea634dc05a 100644 --- a/tests/virtio-net-test.c +++ b/tests/virtio-net-test.c @@ -108,7 +108,7 @@ static void rx_test(QVirtioDevice *dev, ret = iov_send(socket, iov, 2, 0, sizeof(len) + sizeof(test)); g_assert_cmpint(ret, ==, sizeof(test) + sizeof(len)); - qvirtio_wait_used_elem(dev, vq, free_head, QVIRTIO_NET_TIMEOUT_US); + qvirtio_wait_used_elem(dev, vq, free_head, NULL, QVIRTIO_NET_TIMEOUT_US); memread(req_addr + VNET_HDR_SIZE, buffer, sizeof(test)); g_assert_cmpstr(buffer, ==, "TEST"); @@ -131,7 +131,7 @@ static void tx_test(QVirtioDevice *dev, free_head = qvirtqueue_add(vq, req_addr, 64, false, false); qvirtqueue_kick(dev, vq, free_head); - qvirtio_wait_used_elem(dev, vq, free_head, QVIRTIO_NET_TIMEOUT_US); + qvirtio_wait_used_elem(dev, vq, free_head, NULL, QVIRTIO_NET_TIMEOUT_US); guest_free(alloc, req_addr); ret = qemu_recv(socket, &len, sizeof(len), 0); @@ -182,7 +182,7 @@ static void rx_stop_cont_test(QVirtioDevice *dev, rsp = qmp("{ 'execute' : 'cont'}"); QDECREF(rsp); - qvirtio_wait_used_elem(dev, vq, free_head, QVIRTIO_NET_TIMEOUT_US); + qvirtio_wait_used_elem(dev, vq, free_head, NULL, QVIRTIO_NET_TIMEOUT_US); memread(req_addr + VNET_HDR_SIZE, buffer, sizeof(test)); g_assert_cmpstr(buffer, ==, "TEST"); |