From patchwork Thu Aug 9 14:45:56 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: [2/3] e1000: flush queue whenever can_receive can go from false to true Date: Thu, 09 Aug 2012 04:45:56 -0000 From: Paolo Bonzini X-Patchwork-Id: 176136 Message-Id: <1344523557-28266-3-git-send-email-pbonzini@redhat.com> To: qemu-devel@nongnu.org Cc: Jan Kiszka , Luigi Rizzo , Stefan Hajnoczi , Stefano Stabellini 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 Cc: Stefan Hajnoczi Cc: Jan Kiszka Signed-off-by: Paolo Bonzini --- hw/e1000.c | 4 ++++ 1 file modificati, 4 inserzioni(+) diff --git a/hw/e1000.c b/hw/e1000.c index ae8a6c5..ec3a7c4 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