qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [RESEND Patch v1 36/37] vhost-user/msg: handling VHOST_


From: Wei Wang
Subject: Re: [Qemu-devel] [RESEND Patch v1 36/37] vhost-user/msg: handling VHOST_USER_SET_FEATURES
Date: Mon, 19 Dec 2016 16:28:10 +0800
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20131028 Thunderbird/17.0.10

On 12/19/2016 01:59 PM, Wei Wang wrote:
If the featuer bits sent by the slave are not equal to the ones that
were sent by the master, perform a reset of the master device.

Signed-off-by: Wei Wang <address@hidden>
---
  hw/net/vhost_net.c       |  2 ++
  hw/virtio/vhost-user.c   | 20 ++++++++++++++++++++
  hw/virtio/virtio-pci.c   | 20 ++++++++++++++++++++
  hw/virtio/virtio-pci.h   |  2 ++
  include/net/vhost-user.h | 14 ++++++++++++++
  net/vhost-user.c         | 14 +++++---------
  6 files changed, 63 insertions(+), 9 deletions(-)

diff --git a/hw/net/vhost_net.c b/hw/net/vhost_net.c
index 8256018..e8a2d4f 100644
--- a/hw/net/vhost_net.c
+++ b/hw/net/vhost_net.c
/* virtio-net-pci */ +void master_reset_virtio_net(VirtIODevice *vdev)
+{
+    VirtIONet *net = VIRTIO_NET(vdev);
+    VirtIONetPCI *net_pci = container_of(net, VirtIONetPCI, vdev);
+    VirtIOPCIProxy *proxy = &net_pci->parent_obj;
+    DeviceState *qdev = DEVICE(proxy);
+    DeviceState *qdev_new;
+    Error *err = NULL;
+
+    virtio_pci_reset(qdev);
+    qdev_unplug(qdev, &err);
+    qdev->realized = false;
+    qdev_new = qdev_device_add(qdev->opts, &err);
+    if (!qdev_new) {
+        qemu_opts_del(qdev->opts);
+    }
+    object_unref(OBJECT(qdev));
+}
+

I still have a problem with this patch. Looks like the virtio reset here only clears the registers and queue related things. Do we have a power reset of virtio, which has the same effect as re-plugging into the virtio device (the driver probe() are re-invoked and feature bits are re-negotiated). Thanks.

Best,
Wei



reply via email to

[Prev in Thread] Current Thread [Next in Thread]