mirror of
https://github.com/clearlinux/kvmtool.git
synced 2026-10-03 23:38:35 +00:00
kvm tools: Introduce trans=mmio parameter for virtio-net
To select virtio-mmio instead of virito-pci transport: lkvm run --network trans=mmio Signed-off-by: Asias He <asias.hejun@gmail.com> Signed-off-by: Pekka Enberg <penberg@kernel.org>
This commit is contained in:
@@ -244,6 +244,8 @@ static int set_net_param(struct virtio_net_params *p, const char *param,
|
||||
p->guest_ip = strdup(val);
|
||||
} else if (strcmp(param, "host_ip") == 0) {
|
||||
p->host_ip = strdup(val);
|
||||
} else if (strcmp(param, "trans") == 0) {
|
||||
p->trans = strdup(val);
|
||||
} else if (strcmp(param, "vhost") == 0) {
|
||||
p->vhost = atoi(val);
|
||||
} else if (strcmp(param, "fd") == 0) {
|
||||
|
||||
@@ -7,6 +7,7 @@ struct virtio_net_params {
|
||||
const char *guest_ip;
|
||||
const char *host_ip;
|
||||
const char *script;
|
||||
const char *trans;
|
||||
char guest_mac[6];
|
||||
char host_mac[6];
|
||||
struct kvm *kvm;
|
||||
|
||||
+6
-2
@@ -526,8 +526,12 @@ void virtio_net__init(const struct virtio_net_params *params)
|
||||
ndev->ops = &uip_ops;
|
||||
}
|
||||
|
||||
virtio_init(kvm, ndev, &ndev->vdev, &net_dev_virtio_ops,
|
||||
VIRTIO_PCI, PCI_DEVICE_ID_VIRTIO_NET, VIRTIO_ID_NET, PCI_CLASS_NET);
|
||||
if (params->trans && strcmp(params->trans, "mmio") == 0)
|
||||
virtio_init(kvm, ndev, &ndev->vdev, &net_dev_virtio_ops,
|
||||
VIRTIO_MMIO, PCI_DEVICE_ID_VIRTIO_NET, VIRTIO_ID_NET, PCI_CLASS_NET);
|
||||
else
|
||||
virtio_init(kvm, ndev, &ndev->vdev, &net_dev_virtio_ops,
|
||||
VIRTIO_PCI, PCI_DEVICE_ID_VIRTIO_NET, VIRTIO_ID_NET, PCI_CLASS_NET);
|
||||
|
||||
if (params->vhost)
|
||||
virtio_net__vhost_init(params->kvm, ndev);
|
||||
|
||||
Reference in New Issue
Block a user