qemu-devel
[Top][All Lists]
Advanced

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

[Qemu-devel] [PATCH v1 35/37] vhost-pci-net: start the vhost-pci-net dev


From: Wei Wang
Subject: [Qemu-devel] [PATCH v1 35/37] vhost-pci-net: start the vhost-pci-net device
Date: Sat, 17 Dec 2016 18:43:45 +0800

If the peer device on the other side doesn't need to be reset, then
start the device when DRIVER_OK is received.

Signed-off-by: Wei Wang <address@hidden>
---
 hw/net/vhost-pci-net.c | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

diff --git a/hw/net/vhost-pci-net.c b/hw/net/vhost-pci-net.c
index 6d4db6c..75ee72c 100644
--- a/hw/net/vhost-pci-net.c
+++ b/hw/net/vhost-pci-net.c
@@ -22,6 +22,16 @@
 #define VPNET_CQ_SIZE 32
 #define VPNET_RQ_SIZE 256
 
+static void vpnet_set_link_up(VhostPCINet *vpnet)
+{
+    VirtIODevice *vdev = VIRTIO_DEVICE(vpnet);
+    uint16_t old_status = vpnet->status;
+
+    vpnet->status |= VPNET_S_LINK_UP;
+    if (vpnet->status != old_status)
+        virtio_notify_config(vdev);
+}
+
 void vpnet_set_peer_vq_num(VhostPCINet *vpnet, uint16_t num)
 {
     vpnet->peer_vq_num = num;
@@ -125,6 +135,11 @@ static void vpnet_set_status(struct VirtIODevice *vdev, 
uint8_t status)
     if (status & VIRTIO_CONFIG_S_DRIVER_OK) {
         vpnet_send_peer_mem_msg(vpnet);
         vpnet_send_peer_vq_msg(vpnet);
+        /* If the peer device is not reset, start the device now */
+        if (!vp_slave->peer_reset) {
+            vdev->status = status;
+            vpnet_set_link_up(vpnet);
+        }
     }
 }
 
-- 
2.7.4




reply via email to

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