From patchwork Fri Sep 14 08:46:49 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefan Hajnoczi X-Patchwork-Id: 183841 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 5B4E92C0080 for ; Fri, 14 Sep 2012 18:47:46 +1000 (EST) Received: from localhost ([::1]:39634 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TCRYu-0004SQ-5n for incoming@patchwork.ozlabs.org; Fri, 14 Sep 2012 04:47:44 -0400 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) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references; bh=WpknASN24jmPkHId/Ed6qk3h7cKnr+JTKbEeK1a19TA=; b=pOmxHAKCcwKr3iKVeFQ/RXuryearqxqnMUdbFRnxLoDFao2f6erC9w/S6jwXMWc2oB Wu6F2WxfZb5/BjOqcI0rJJQuvkcuLSE0qUuXzUQ3FWHwNMkhVE5XhMXaUZBFwM+aamDJ CcpxzbULPPAarzYN1I9iMHSnd4ajitrXryeYewwrGGlNrdBTJuRoY5uAu1/lrnszuzlT dUeFIueVo9D3VEAdLj3vbCIz84tSYG74GhL4//XCYaUNqr9Ivc8HhdYT7wkHgaDCzwHH jGvYM7fvx0F/QXms5d5ELgVuWAn0xXTjkrGxD+Kon2wgXt1UERWbPE8OP4XVeOOmdriE UVmg== Received: by 10.180.98.200 with SMTP id ek8mr4490566wib.0.1347612440239; Fri, 14 Sep 2012 01:47:20 -0700 (PDT) Received: from localhost ([109.224.133.37]) by mx.google.com with ESMTPS id h9sm17870100wiz.1.2012.09.14.01.47.18 (version=TLSv1/SSLv3 cipher=OTHER); Fri, 14 Sep 2012 01:47:19 -0700 (PDT) From: Stefan Hajnoczi To: Anthony Liguori Date: Fri, 14 Sep 2012 09:46:49 +0100 Message-Id: <1347612420-5704-3-git-send-email-stefanha@gmail.com> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1347612420-5704-1-git-send-email-stefanha@gmail.com> References: <1347612420-5704-1-git-send-email-stefanha@gmail.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 74.125.82.173 Cc: Paolo Bonzini , Jan Kiszka , qemu-devel@nongnu.org, Stefan Hajnoczi Subject: [Qemu-devel] [PATCH 02/13] e1000: flush queue whenever can_receive can go from false to true X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org 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