From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:50190) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TCRYd-0004RH-Mf for qemu-devel@nongnu.org; Fri, 14 Sep 2012 04:47:28 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TCRYX-0000sU-6U for qemu-devel@nongnu.org; Fri, 14 Sep 2012 04:47:27 -0400 Received: from mail-we0-f173.google.com ([74.125.82.173]:47609) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TCRYW-0000sO-Vn for qemu-devel@nongnu.org; Fri, 14 Sep 2012 04:47:21 -0400 Received: by weyz53 with SMTP id z53so2182085wey.4 for ; Fri, 14 Sep 2012 01:47:20 -0700 (PDT) From: Stefan Hajnoczi Date: Fri, 14 Sep 2012 09:46:49 +0100 Message-Id: <1347612420-5704-3-git-send-email-stefanha@gmail.com> In-Reply-To: <1347612420-5704-1-git-send-email-stefanha@gmail.com> References: <1347612420-5704-1-git-send-email-stefanha@gmail.com> Subject: [Qemu-devel] [PATCH 02/13] e1000: flush queue whenever can_receive can go from false to true List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Anthony Liguori Cc: Paolo Bonzini , Jan Kiszka , qemu-devel@nongnu.org, Stefan Hajnoczi From: Paolo Bonzini 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 Reviewed-by: Amos Kong Signed-off-by: Stefan Hajnoczi --- hw/e1000.c | 4 ++++ 1 file changed, 4 insertions(+) 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 -- 1.7.10.4