diff options
author | Jay Zhou | 2018-03-02 10:04:44 +0100 |
---|---|---|
committer | Jason Wang | 2018-03-05 03:30:16 +0100 |
commit | 46d4d36d0bf2b24b205f2f604f0905db80264eef (patch) | |
tree | 0b165bbdc0a9ba3f24fe13243aab59f47a230271 /include/net/vhost_net.h | |
parent | hw/net: Remove unnecessary header includes (diff) | |
download | qemu-46d4d36d0bf2b24b205f2f604f0905db80264eef.tar.gz qemu-46d4d36d0bf2b24b205f2f604f0905db80264eef.tar.xz qemu-46d4d36d0bf2b24b205f2f604f0905db80264eef.zip |
tap: setting error appropriately when calling net_init_tap_one()
If netdev_add tap,id=net0,...,vhost=on failed in net_init_tap_one(),
the followed up device_add virtio-net-pci,netdev=net0 will fail
too, prints:
TUNSETOFFLOAD ioctl() failed: Bad file descriptor TUNSETOFFLOAD
ioctl() failed: Bad file descriptor
The reason is that the fd of tap is closed when error occured after
calling net_init_tap_one().
The fd should be closed when calling net_init_tap_one failed:
- if tap_set_sndbuf() failed
- if tap_set_sndbuf() succeeded but vhost failed to open or
initialize with vhostforce flag on
- with wrong vhost command line parameter
The fd should not be closed just because vhost failed to open or
initialize but without vhostforce flag. So the followed up
device_add can fall back to userspace virtio successfully.
Suggested-by: Michael S. Tsirkin <mst@redhat.com>
Suggested-by: Igor Mammedov <imammedo@redhat.com>
Suggested-by: Jason Wang <jasowang@redhat.com>
Signed-off-by: Jay Zhou <jianjay.zhou@huawei.com>
Signed-off-by: Jason Wang <jasowang@redhat.com>
Diffstat (limited to 'include/net/vhost_net.h')
-rw-r--r-- | include/net/vhost_net.h | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/include/net/vhost_net.h b/include/net/vhost_net.h index afc1499eb9..77e47398c4 100644 --- a/include/net/vhost_net.h +++ b/include/net/vhost_net.h @@ -4,6 +4,9 @@ #include "net/net.h" #include "hw/virtio/vhost-backend.h" +#define VHOST_NET_INIT_FAILED \ + "vhost-net requested but could not be initialized" + struct vhost_net; typedef struct vhost_net VHostNetState; |