We will check vm-running state in the generic net layer.

Also we have to flush queues in nic_vmstate_change_handler() when vm state
changes to run. The check here will prevent the flushing process, because
we will check the return value of virtio_net_can_receive in
nic_vmstate_change_handler, When the vdev->vm_running is still false.
Actually it depends on the register sequence of callback functions.
Here nic_vmstate_change_handler will called before virtio_vmstate_change.

So remove the unnecessarily checking.

Signed-off-by: zhanghailiang <zhang.zhanghaili...@huawei.com>
---
 hw/net/virtio-net.c | 4 ----
 1 file changed, 4 deletions(-)

diff --git a/hw/net/virtio-net.c b/hw/net/virtio-net.c
index 268eff9..287d762 100644
--- a/hw/net/virtio-net.c
+++ b/hw/net/virtio-net.c
@@ -839,10 +839,6 @@ static int virtio_net_can_receive(NetClientState *nc)
     VirtIODevice *vdev = VIRTIO_DEVICE(n);
     VirtIONetQueue *q = virtio_net_get_subqueue(nc);
 
-    if (!vdev->vm_running) {
-        return 0;
-    }
-
     if (nc->queue_index >= n->curr_queues) {
         return 0;
     }
-- 
1.7.12.4



Reply via email to