tests: fix virtio-net-test ISR dependence

Use the new used ring APIs instead of assuming ISR being set means the
request has completed.

Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Reviewed-by: Fam Zheng <famz@redhat.com>
Tested-by: Eric Blake <eblake@redhat.com>
Tested-by: Kevin Wolf <kwolf@redhat.com>
Message-id: 20170628184724.21378-6-stefanha@redhat.com
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
This commit is contained in:
Stefan Hajnoczi 2017-06-28 19:47:23 +01:00
parent 12dfbdcabf
commit 8e11c9d365

View File

@ -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_queue_isr(dev, vq, QVIRTIO_NET_TIMEOUT_US);
qvirtio_wait_used_elem(dev, vq, free_head, 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_queue_isr(dev, vq, QVIRTIO_NET_TIMEOUT_US);
qvirtio_wait_used_elem(dev, vq, free_head, 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_queue_isr(dev, vq, QVIRTIO_NET_TIMEOUT_US);
qvirtio_wait_used_elem(dev, vq, free_head, QVIRTIO_NET_TIMEOUT_US);
memread(req_addr + VNET_HDR_SIZE, buffer, sizeof(test));
g_assert_cmpstr(buffer, ==, "TEST");