mirror of https://gitee.com/openkylin/qemu.git
virtio-net: Wrap in vmstate
Forcibly convert it to a vmstate wrapper; proper conversion comes later. Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com> Reviewed-by: Cornelia Huck <cornelia.huck@de.ibm.com> Reviewed-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
This commit is contained in:
parent
7f1ca9b23b
commit
290c242845
|
@ -1492,7 +1492,7 @@ static void virtio_net_set_multiqueue(VirtIONet *n, int multiqueue)
|
|||
virtio_net_set_queues(n);
|
||||
}
|
||||
|
||||
static void virtio_net_save(QEMUFile *f, void *opaque)
|
||||
static void virtio_net_save(QEMUFile *f, void *opaque, size_t size)
|
||||
{
|
||||
VirtIONet *n = opaque;
|
||||
VirtIODevice *vdev = VIRTIO_DEVICE(n);
|
||||
|
@ -1538,15 +1538,12 @@ static void virtio_net_save_device(VirtIODevice *vdev, QEMUFile *f)
|
|||
}
|
||||
}
|
||||
|
||||
static int virtio_net_load(QEMUFile *f, void *opaque, int version_id)
|
||||
static int virtio_net_load(QEMUFile *f, void *opaque, size_t size)
|
||||
{
|
||||
VirtIONet *n = opaque;
|
||||
VirtIODevice *vdev = VIRTIO_DEVICE(n);
|
||||
|
||||
if (version_id != VIRTIO_NET_VM_VERSION)
|
||||
return -EINVAL;
|
||||
|
||||
return virtio_load(vdev, f, version_id);
|
||||
return virtio_load(vdev, f, VIRTIO_NET_VM_VERSION);
|
||||
}
|
||||
|
||||
static int virtio_net_load_device(VirtIODevice *vdev, QEMUFile *f,
|
||||
|
@ -1790,8 +1787,6 @@ static void virtio_net_device_realize(DeviceState *dev, Error **errp)
|
|||
nc->rxfilter_notify_enabled = 1;
|
||||
|
||||
n->qdev = dev;
|
||||
register_savevm(dev, "virtio-net", -1, VIRTIO_NET_VM_VERSION,
|
||||
virtio_net_save, virtio_net_load, n);
|
||||
}
|
||||
|
||||
static void virtio_net_device_unrealize(DeviceState *dev, Error **errp)
|
||||
|
@ -1803,8 +1798,6 @@ static void virtio_net_device_unrealize(DeviceState *dev, Error **errp)
|
|||
/* This will stop vhost backend if appropriate. */
|
||||
virtio_net_set_status(vdev, 0);
|
||||
|
||||
unregister_savevm(dev, "virtio-net", n);
|
||||
|
||||
g_free(n->netclient_name);
|
||||
n->netclient_name = NULL;
|
||||
g_free(n->netclient_type);
|
||||
|
@ -1839,6 +1832,9 @@ static void virtio_net_instance_init(Object *obj)
|
|||
DEVICE(n), NULL);
|
||||
}
|
||||
|
||||
VMSTATE_VIRTIO_DEVICE(net, VIRTIO_NET_VM_VERSION, virtio_net_load,
|
||||
virtio_net_save);
|
||||
|
||||
static Property virtio_net_properties[] = {
|
||||
DEFINE_PROP_BIT("csum", VirtIONet, host_features, VIRTIO_NET_F_CSUM, true),
|
||||
DEFINE_PROP_BIT("guest_csum", VirtIONet, host_features,
|
||||
|
@ -1893,6 +1889,7 @@ static void virtio_net_class_init(ObjectClass *klass, void *data)
|
|||
VirtioDeviceClass *vdc = VIRTIO_DEVICE_CLASS(klass);
|
||||
|
||||
dc->props = virtio_net_properties;
|
||||
dc->vmsd = &vmstate_virtio_net;
|
||||
set_bit(DEVICE_CATEGORY_NETWORK, dc->categories);
|
||||
vdc->realize = virtio_net_device_realize;
|
||||
vdc->unrealize = virtio_net_device_unrealize;
|
||||
|
|
Loading…
Reference in New Issue