#include "libqos/libqos-spapr.h"
#include "libqos/virtio.h"
#include "libqos/virtio-pci.h"
+#include "qapi/qmp/qdict.h"
#include "qemu/bswap.h"
#include "hw/virtio/virtio-net.h"
#include "standard-headers/linux/virtio_ids.h"
static QOSState *pci_test_start(int socket)
{
+ QOSState *qs;
const char *arch = qtest_get_arch();
const char *cmd = "-netdev socket,fd=%d,id=hs0 -device "
"virtio-net-pci,netdev=hs0";
if (strcmp(arch, "i386") == 0 || strcmp(arch, "x86_64") == 0) {
- return qtest_pc_boot(cmd, socket);
- }
- if (strcmp(arch, "ppc64") == 0) {
- return qtest_spapr_boot(cmd, socket);
+ qs = qtest_pc_boot(cmd, socket);
+ } else if (strcmp(arch, "ppc64") == 0) {
+ qs = qtest_spapr_boot(cmd, socket);
+ } else {
+ g_printerr("virtio-net tests are only available on x86 or ppc64\n");
+ exit(EXIT_FAILURE);
}
- g_printerr("virtio-net tests are only available on x86 or ppc64\n");
- exit(EXIT_FAILURE);
+ global_qtest = qs->qts;
+ return qs;
}
static void driver_init(QVirtioDevice *dev)
qvirtqueue_kick(dev, vq, free_head);
rsp = qmp("{ 'execute' : 'stop'}");
- QDECREF(rsp);
+ qobject_unref(rsp);
ret = iov_send(socket, iov, 2, 0, sizeof(len) + sizeof(test));
g_assert_cmpint(ret, ==, sizeof(test) + sizeof(len));
* ensure the packet data gets queued in QEMU, before we do 'cont'.
*/
rsp = qmp("{ 'execute' : 'query-status'}");
- QDECREF(rsp);
+ qobject_unref(rsp);
rsp = qmp("{ 'execute' : 'cont'}");
- QDECREF(rsp);
+ qobject_unref(rsp);
qvirtio_wait_used_elem(dev, vq, free_head, NULL, QVIRTIO_NET_TIMEOUT_US);
memread(req_addr + VNET_HDR_SIZE, buffer, sizeof(test));
qtest_start("-device virtio-net-pci");
- qpci_plug_device_test("virtio-net-pci", "net1", PCI_SLOT_HP, NULL);
+ qtest_qmp_device_add("virtio-net-pci", "net1",
+ "{'addr': %s}", stringify(PCI_SLOT_HP));
if (strcmp(arch, "i386") == 0 || strcmp(arch, "x86_64") == 0) {
qpci_unplug_acpi_device_test("net1", PCI_SLOT_HP);