mirror of
https://gitlab.com/qemu-project/qemu
synced 2024-11-05 20:35:44 +00:00
virtio-net-ccw: switch to the new API.
Here the virtio-net-ccw is modified for the new API. The device virtio-net-ccw extends virtio-ccw-device as before. It creates and connects a virtio-net-device during the init. The properties are not modified. Signed-off-by: KONRAD Frederic <fred.konrad@greensocs.com> Tested-by: Cornelia Huck <cornelia.huck@de.ibm.com> Message-id: 1365690602-22729-6-git-send-email-fred.konrad@greensocs.com Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
This commit is contained in:
parent
74b4fe3d79
commit
89334c8b6b
2 changed files with 28 additions and 16 deletions
|
@ -551,23 +551,25 @@ static int virtio_ccw_exit(VirtioCcwDevice *dev)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int virtio_ccw_net_init(VirtioCcwDevice *dev)
|
static int virtio_ccw_net_init(VirtioCcwDevice *ccw_dev)
|
||||||
{
|
{
|
||||||
VirtIODevice *vdev;
|
VirtIONetCcw *dev = VIRTIO_NET_CCW(ccw_dev);
|
||||||
|
DeviceState *vdev = DEVICE(&dev->vdev);
|
||||||
|
|
||||||
vdev = virtio_net_init((DeviceState *)dev, &dev->nic, &dev->net,
|
virtio_net_set_config_size(&dev->vdev, ccw_dev->host_features[0]);
|
||||||
dev->host_features[0]);
|
qdev_set_parent_bus(vdev, BUS(&ccw_dev->bus));
|
||||||
if (!vdev) {
|
if (qdev_init(vdev) < 0) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
return virtio_ccw_device_init(dev, vdev);
|
return virtio_ccw_device_init(ccw_dev, VIRTIO_DEVICE(vdev));
|
||||||
}
|
}
|
||||||
|
|
||||||
static int virtio_ccw_net_exit(VirtioCcwDevice *dev)
|
static void virtio_ccw_net_instance_init(Object *obj)
|
||||||
{
|
{
|
||||||
virtio_net_exit(dev->vdev);
|
VirtIONetCcw *dev = VIRTIO_NET_CCW(obj);
|
||||||
return virtio_ccw_exit(dev);
|
object_initialize(OBJECT(&dev->vdev), TYPE_VIRTIO_NET);
|
||||||
|
object_property_add_child(obj, "virtio-backend", OBJECT(&dev->vdev), NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int virtio_ccw_blk_init(VirtioCcwDevice *ccw_dev)
|
static int virtio_ccw_blk_init(VirtioCcwDevice *ccw_dev)
|
||||||
|
@ -768,8 +770,8 @@ static const VirtIOBindings virtio_ccw_bindings = {
|
||||||
static Property virtio_ccw_net_properties[] = {
|
static Property virtio_ccw_net_properties[] = {
|
||||||
DEFINE_PROP_STRING("devno", VirtioCcwDevice, bus_id),
|
DEFINE_PROP_STRING("devno", VirtioCcwDevice, bus_id),
|
||||||
DEFINE_VIRTIO_NET_FEATURES(VirtioCcwDevice, host_features[0]),
|
DEFINE_VIRTIO_NET_FEATURES(VirtioCcwDevice, host_features[0]),
|
||||||
DEFINE_NIC_PROPERTIES(VirtioCcwDevice, nic),
|
DEFINE_VIRTIO_NET_PROPERTIES(VirtIONetCcw, vdev.net_conf),
|
||||||
DEFINE_VIRTIO_NET_PROPERTIES(VirtioCcwDevice, net),
|
DEFINE_NIC_PROPERTIES(VirtIONetCcw, vdev.nic_conf),
|
||||||
DEFINE_PROP_END_OF_LIST(),
|
DEFINE_PROP_END_OF_LIST(),
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -779,15 +781,16 @@ static void virtio_ccw_net_class_init(ObjectClass *klass, void *data)
|
||||||
VirtIOCCWDeviceClass *k = VIRTIO_CCW_DEVICE_CLASS(klass);
|
VirtIOCCWDeviceClass *k = VIRTIO_CCW_DEVICE_CLASS(klass);
|
||||||
|
|
||||||
k->init = virtio_ccw_net_init;
|
k->init = virtio_ccw_net_init;
|
||||||
k->exit = virtio_ccw_net_exit;
|
k->exit = virtio_ccw_exit;
|
||||||
dc->reset = virtio_ccw_reset;
|
dc->reset = virtio_ccw_reset;
|
||||||
dc->props = virtio_ccw_net_properties;
|
dc->props = virtio_ccw_net_properties;
|
||||||
}
|
}
|
||||||
|
|
||||||
static const TypeInfo virtio_ccw_net = {
|
static const TypeInfo virtio_ccw_net = {
|
||||||
.name = "virtio-net-ccw",
|
.name = TYPE_VIRTIO_NET_CCW,
|
||||||
.parent = TYPE_VIRTIO_CCW_DEVICE,
|
.parent = TYPE_VIRTIO_CCW_DEVICE,
|
||||||
.instance_size = sizeof(VirtioCcwDevice),
|
.instance_size = sizeof(VirtIONetCcw),
|
||||||
|
.instance_init = virtio_ccw_net_instance_init,
|
||||||
.class_init = virtio_ccw_net_class_init,
|
.class_init = virtio_ccw_net_class_init,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -73,9 +73,7 @@ struct VirtioCcwDevice {
|
||||||
SubchDev *sch;
|
SubchDev *sch;
|
||||||
VirtIODevice *vdev;
|
VirtIODevice *vdev;
|
||||||
char *bus_id;
|
char *bus_id;
|
||||||
NICConf nic;
|
|
||||||
uint32_t host_features[VIRTIO_CCW_FEATURE_SIZE];
|
uint32_t host_features[VIRTIO_CCW_FEATURE_SIZE];
|
||||||
virtio_net_conf net;
|
|
||||||
VirtIORNGConf rng;
|
VirtIORNGConf rng;
|
||||||
VirtioBusState bus;
|
VirtioBusState bus;
|
||||||
/* Guest provided values: */
|
/* Guest provided values: */
|
||||||
|
@ -137,6 +135,17 @@ typedef struct VirtioSerialCcw {
|
||||||
VirtIOSerial vdev;
|
VirtIOSerial vdev;
|
||||||
} VirtioSerialCcw;
|
} VirtioSerialCcw;
|
||||||
|
|
||||||
|
/* virtio-net-ccw */
|
||||||
|
|
||||||
|
#define TYPE_VIRTIO_NET_CCW "virtio-net-ccw"
|
||||||
|
#define VIRTIO_NET_CCW(obj) \
|
||||||
|
OBJECT_CHECK(VirtIONetCcw, (obj), TYPE_VIRTIO_NET_CCW)
|
||||||
|
|
||||||
|
typedef struct VirtIONetCcw {
|
||||||
|
VirtioCcwDevice parent_obj;
|
||||||
|
VirtIONet vdev;
|
||||||
|
} VirtIONetCcw;
|
||||||
|
|
||||||
VirtualCssBus *virtual_css_bus_init(void);
|
VirtualCssBus *virtual_css_bus_init(void);
|
||||||
void virtio_ccw_device_update_status(SubchDev *sch);
|
void virtio_ccw_device_update_status(SubchDev *sch);
|
||||||
VirtIODevice *virtio_ccw_get_vdev(SubchDev *sch);
|
VirtIODevice *virtio_ccw_get_vdev(SubchDev *sch);
|
||||||
|
|
Loading…
Reference in a new issue