qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH 2/3] net: Flush queues when runstate changes bac


From: zhanghailiang
Subject: Re: [Qemu-devel] [PATCH 2/3] net: Flush queues when runstate changes back to running
Date: Thu, 14 Aug 2014 16:24:38 +0800
User-agent: Mozilla/5.0 (Windows NT 6.1; rv:11.0) Gecko/20120327 Thunderbird/11.0.1

On 2014/8/14 15:12, Gonglei (Arei) wrote:
Hi,

Subject: [Qemu-devel] [PATCH 2/3] net: Flush queues when runstate changes
back to running

When the runstate changes back to running, we definitely need to flush
queues to get packets flowing again.

Here we implement this in the net layer:
(1) add a member 'VMChangeStateEntry *vmstate' to struct NICState,
Which will listen for VM runstate changes.

Does this change will block migration during with different QEMU versions?


No, I have tested migration between qemu-1.5.1 with new qemu which has
merged this patches, everything seems ok!

(2) Register a handler function for VMstate change.
When vm changes back to running, we flush all queues in the callback function.

Signed-off-by: zhanghailiang<address@hidden>
---
  include/net/net.h |  1 +
  net/net.c         | 26 ++++++++++++++++++++++++++
  2 files changed, 27 insertions(+)

diff --git a/include/net/net.h b/include/net/net.h
index 312f728..a294277 100644
--- a/include/net/net.h
+++ b/include/net/net.h
@@ -97,6 +97,7 @@ typedef struct NICState {
      NICConf *conf;
      void *opaque;
      bool peer_deleted;
+    VMChangeStateEntry *vmstate;
  } NICState;

  NetClientState *qemu_find_netdev(const char *id);
diff --git a/net/net.c b/net/net.c
index 5bb2821..506e58f 100644
--- a/net/net.c
+++ b/net/net.c
@@ -242,6 +242,29 @@ NetClientState *qemu_new_net_client(NetClientInfo
*info,
      return nc;
  }

+static void nic_vmstate_change_handler(void *opaque,
+                                       int running,
+                                       RunState state)
+{
+    NICState *nic = opaque;
+    NetClientState *nc;
+    int i, queues;
+
+    if (!running) {
+        return;
+    }
+
+    queues =  MAX(1, nic->conf->peers.queues);
               ^
A superfluous space.


Yes, Good catch, i will modify this. Thanks.





reply via email to

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