From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:44588) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SzpFx-0002yi-VW for qemu-devel@nongnu.org; Fri, 10 Aug 2012 09:28:02 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1SzpFv-0007Tk-4O for qemu-devel@nongnu.org; Fri, 10 Aug 2012 09:28:01 -0400 Received: from e06smtp10.uk.ibm.com ([195.75.94.106]:57024) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SzpFu-0007T9-Ro for qemu-devel@nongnu.org; Fri, 10 Aug 2012 09:27:59 -0400 Received: from /spool/local by e06smtp10.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Fri, 10 Aug 2012 14:27:57 +0100 Received: from d06av10.portsmouth.uk.ibm.com (d06av10.portsmouth.uk.ibm.com [9.149.37.251]) by b06cxnps4074.portsmouth.uk.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id q7ADRnBM24903680 for ; Fri, 10 Aug 2012 13:27:50 GMT Received: from d06av10.portsmouth.uk.ibm.com (loopback [127.0.0.1]) by d06av10.portsmouth.uk.ibm.com (8.14.4/8.13.1/NCO v10.0 AVout) with ESMTP id q7AD0Abv029745 for ; Fri, 10 Aug 2012 09:00:10 -0400 From: Stefan Hajnoczi Date: Fri, 10 Aug 2012 14:27:45 +0100 Message-Id: <1344605266-13644-3-git-send-email-stefanha@linux.vnet.ibm.com> In-Reply-To: <1344605266-13644-1-git-send-email-stefanha@linux.vnet.ibm.com> References: <1344605266-13644-1-git-send-email-stefanha@linux.vnet.ibm.com> Subject: [Qemu-devel] [PATCH 2/3] 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 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