aboutsummaryrefslogtreecommitdiff
path: root/net
diff options
context:
space:
mode:
authorPeter Maydell <peter.maydell@linaro.org>2016-10-10 16:23:40 +0100
committerPeter Maydell <peter.maydell@linaro.org>2016-10-10 16:23:40 +0100
commit627eae7d729277c84f8e0ac07a8caab39c92c38d (patch)
treefe42de6f2cbeb5a5f2ab64f16eff5da7b3993ae9 /net
parent0f183e679d85fec74fc83f35f973cf8e56d97861 (diff)
parentdea651a95af6dad0997b840241a0bf6059d9a776 (diff)
downloadqemu-627eae7d729277c84f8e0ac07a8caab39c92c38d.zip
qemu-627eae7d729277c84f8e0ac07a8caab39c92c38d.tar.gz
qemu-627eae7d729277c84f8e0ac07a8caab39c92c38d.tar.bz2
Merge remote-tracking branch 'remotes/mst/tags/for_upstream' into staging
virtio, pc: fixes and features more guest error handling for virtio devices virtio migration rework pc fixes Signed-off-by: Michael S. Tsirkin <mst@redhat.com> # gpg: Signature made Mon 10 Oct 2016 00:39:11 BST # gpg: using RSA key 0x281F0DB8D28D5469 # gpg: Good signature from "Michael S. Tsirkin <mst@kernel.org>" # gpg: aka "Michael S. Tsirkin <mst@redhat.com>" # Primary key fingerprint: 0270 606B 6F3C DF3D 0B17 0970 C350 3912 AFBE 8E67 # Subkey fingerprint: 5D09 FD08 71C8 F85B 94CA 8A0D 281F 0DB8 D28D 5469 * remotes/mst/tags/for_upstream: (33 commits) intel-iommu: Check IOAPIC's Trigger Mode against the one in IRTE virtio: cleanup VMSTATE_VIRTIO_DEVICE vhost-vsock: convert VMSTATE_VIRTIO_DEVICE virtio-rng: convert VMSTATE_VIRTIO_DEVICE virtio-balloon: convert VMSTATE_VIRTIO_DEVICE virtio-scsi: convert VMSTATE_VIRTIO_DEVICE virtio-input: convert VMSTATE_VIRTIO_DEVICE virtio-gpu: convert VMSTATE_VIRTIO_DEVICE virtio-serial: convert VMSTATE_VIRTIO_DEVICE virtio-9p: convert VMSTATE_VIRTIO_DEVICE virtio-net: convert VMSTATE_VIRTIO_DEVICE virtio-blk: convert VMSTATE_VIRTIO_DEVICE virtio: prepare change VMSTATE_VIRTIO_DEVICE macro net: don't poke at chardev internal QemuOpts virtio-scsi: handle virtio_scsi_set_config() error virtio-scsi: convert virtio_scsi_bad_req() to use virtio_error() virtio-net: handle virtio_net_flush_tx() errors virtio-net: handle virtio_net_receive() errors virtio-net: handle virtio_net_handle_ctrl() error virtio-blk: handle virtio_blk_handle_request() errors ... Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Diffstat (limited to 'net')
-rw-r--r--net/colo-compare.c30
-rw-r--r--net/vhost-user.c41
2 files changed, 9 insertions, 62 deletions
diff --git a/net/colo-compare.c b/net/colo-compare.c
index 22b1da1..47703c5 100644
--- a/net/colo-compare.c
+++ b/net/colo-compare.c
@@ -564,29 +564,6 @@ static void compare_sec_rs_finalize(SocketReadState *sec_rs)
}
}
-static int compare_chardev_opts(void *opaque,
- const char *name, const char *value,
- Error **errp)
-{
- CompareChardevProps *props = opaque;
-
- if (strcmp(name, "backend") == 0 &&
- strcmp(value, "socket") == 0) {
- props->is_socket = true;
- return 0;
- } else if (strcmp(name, "host") == 0 ||
- (strcmp(name, "port") == 0) ||
- (strcmp(name, "server") == 0) ||
- (strcmp(name, "wait") == 0) ||
- (strcmp(name, "path") == 0)) {
- return 0;
- } else {
- error_setg(errp,
- "COLO-compare does not support a chardev with option %s=%s",
- name, value);
- return -1;
- }
-}
/*
* Return 0 is success.
@@ -606,12 +583,9 @@ static int find_and_check_chardev(CharDriverState **chr,
}
memset(&props, 0, sizeof(props));
- if (qemu_opt_foreach((*chr)->opts, compare_chardev_opts, &props, errp)) {
- return 1;
- }
- if (!props.is_socket) {
- error_setg(errp, "chardev \"%s\" is not a tcp socket",
+ if (!qemu_chr_has_feature(*chr, QEMU_CHAR_FEATURE_RECONNECTABLE)) {
+ error_setg(errp, "chardev \"%s\" is not reconnectable",
chr_name);
return 1;
}
diff --git a/net/vhost-user.c b/net/vhost-user.c
index b0595f8..5b94c84 100644
--- a/net/vhost-user.c
+++ b/net/vhost-user.c
@@ -27,11 +27,6 @@ typedef struct VhostUserState {
bool started;
} VhostUserState;
-typedef struct VhostUserChardevProps {
- bool is_socket;
- bool is_unix;
-} VhostUserChardevProps;
-
VHostNetState *vhost_user_get_vhost_net(NetClientState *nc)
{
VhostUserState *s = DO_UPCAST(VhostUserState, nc, nc);
@@ -278,45 +273,23 @@ static int net_vhost_user_init(NetClientState *peer, const char *device,
return 0;
}
-static int net_vhost_chardev_opts(void *opaque,
- const char *name, const char *value,
- Error **errp)
-{
- VhostUserChardevProps *props = opaque;
-
- if (strcmp(name, "backend") == 0 && strcmp(value, "socket") == 0) {
- props->is_socket = true;
- } else if (strcmp(name, "path") == 0) {
- props->is_unix = true;
- } else if (strcmp(name, "server") == 0) {
- } else {
- error_setg(errp,
- "vhost-user does not support a chardev with option %s=%s",
- name, value);
- return -1;
- }
- return 0;
-}
-
-static CharDriverState *net_vhost_parse_chardev(
+static CharDriverState *net_vhost_claim_chardev(
const NetdevVhostUserOptions *opts, Error **errp)
{
CharDriverState *chr = qemu_chr_find(opts->chardev);
- VhostUserChardevProps props;
if (chr == NULL) {
error_setg(errp, "chardev \"%s\" not found", opts->chardev);
return NULL;
}
- /* inspect chardev opts */
- memset(&props, 0, sizeof(props));
- if (qemu_opt_foreach(chr->opts, net_vhost_chardev_opts, &props, errp)) {
+ if (!qemu_chr_has_feature(chr, QEMU_CHAR_FEATURE_RECONNECTABLE)) {
+ error_setg(errp, "chardev \"%s\" is not reconnectable",
+ opts->chardev);
return NULL;
}
-
- if (!props.is_socket || !props.is_unix) {
- error_setg(errp, "chardev \"%s\" is not a unix socket",
+ if (!qemu_chr_has_feature(chr, QEMU_CHAR_FEATURE_FD_PASS)) {
+ error_setg(errp, "chardev \"%s\" does not support FD passing",
opts->chardev);
return NULL;
}
@@ -357,7 +330,7 @@ int net_init_vhost_user(const Netdev *netdev, const char *name,
assert(netdev->type == NET_CLIENT_DRIVER_VHOST_USER);
vhost_user_opts = &netdev->u.vhost_user;
- chr = net_vhost_parse_chardev(vhost_user_opts, errp);
+ chr = net_vhost_claim_chardev(vhost_user_opts, errp);
if (!chr) {
return -1;
}