summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaolo Bonzini <pbonzini@redhat.com>2012-08-09 16:45:56 +0200
committerDoug Goldstein <cardoe@cardoe.com>2012-11-21 15:21:33 -0600
commit49a0e4c6970bedfaebf56fd185f3645b6e22ba9a (patch)
tree3e1e30819f4aea0963e9771415832993711b7c19
parentblockdev: preserve readonly and snapshot states across media changes (diff)
downloadqemu-kvm-49a0e4c6970bedfaebf56fd185f3645b6e22ba9a.tar.gz
qemu-kvm-49a0e4c6970bedfaebf56fd185f3645b6e22ba9a.tar.bz2
qemu-kvm-49a0e4c6970bedfaebf56fd185f3645b6e22ba9a.zip
e1000: flush queue whenever can_receive can go from false to true
When the guests replenish the receive ring buffer, the network device should flush its queue of pending packets. This is done with qemu_flush_queued_packets. e1000's can_receive can go from false to true when RCTL or RDT are modified. Reported-by: Luigi Rizzo <rizzo@iet.unipi.it> Cc: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com> Cc: Jan Kiszka <jan.kiszka@siemens.de> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Reviewed-by: Amos Kong <akong@redhat.com> Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com> (cherry picked from commit e8b4c680b41bd960ecccd9ff076b7b058e0afcd4)
-rw-r--r--hw/e1000.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/hw/e1000.c b/hw/e1000.c
index 4573f1301..43d933af4 100644
--- a/hw/e1000.c
+++ b/hw/e1000.c
@@ -295,6 +295,7 @@ set_rx_control(E1000State *s, int index, uint32_t val)
s->rxbuf_min_shift = ((val / E1000_RCTL_RDMTS_QUAT) & 3) + 1;
DBGOUT(RX, "RCTL: %d, mac_reg[RCTL] = 0x%x\n", s->mac_reg[RDT],
s->mac_reg[RCTL]);
+ qemu_flush_queued_packets(&s->nic->nc);
}
static void
@@ -926,6 +927,9 @@ set_rdt(E1000State *s, int index, uint32_t val)
{
s->check_rxov = 0;
s->mac_reg[index] = val & 0xffff;
+ if (e1000_has_rxbufs(s, 1)) {
+ qemu_flush_queued_packets(&s->nic->nc);
+ }
}
static void