[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH] e1000/rtl8139: forbid dealing with packets when VM
From: |
zhanghailiang |
Subject: |
[Qemu-devel] [PATCH] e1000/rtl8139: forbid dealing with packets when VM is paused |
Date: |
Sat, 26 Apr 2014 18:19:12 +0800 |
For e1000/rtl8139, qemu can still send/receive packets when VM is paused.
If this happened in *migration's* last PAUSE VM stage, the new dirty RAM
related to the packets will be missed.
To avoid this, do things like virtio-net, forbid sending/receiving packets when
VM is suspend.
Signed-off-by: zhanghailiang <address@hidden>
---
hw/net/e1000.c | 5 +++--
hw/net/rtl8139.c | 3 +++
2 files changed, 6 insertions(+), 2 deletions(-)
diff --git a/hw/net/e1000.c b/hw/net/e1000.c
index 8387443..94108fd 100644
--- a/hw/net/e1000.c
+++ b/hw/net/e1000.c
@@ -885,9 +885,10 @@ static int
e1000_can_receive(NetClientState *nc)
{
E1000State *s = qemu_get_nic_opaque(nc);
-
+ int vmstat = runstate_is_running();
+
return (s->mac_reg[STATUS] & E1000_STATUS_LU) &&
- (s->mac_reg[RCTL] & E1000_RCTL_EN) && e1000_has_rxbufs(s, 1);
+ (s->mac_reg[RCTL] & E1000_RCTL_EN) && e1000_has_rxbufs(s, 1) && vmstat;
}
static uint64_t rx_desc_base(E1000State *s)
diff --git a/hw/net/rtl8139.c b/hw/net/rtl8139.c
index 5329f44..3c60c84 100644
--- a/hw/net/rtl8139.c
+++ b/hw/net/rtl8139.c
@@ -799,7 +799,10 @@ static int rtl8139_can_receive(NetClientState *nc)
{
RTL8139State *s = qemu_get_nic_opaque(nc);
int avail;
+ int vmstat = runstate_is_running();
+ if (!vmstat)
+ return 0;
/* Receive (drop) packets if card is disabled. */
if (!s->clock_enabled)
return 1;
--
1.7.12.4
- [Qemu-devel] [PATCH] e1000/rtl8139: forbid dealing with packets when VM is paused,
zhanghailiang <=