From patchwork Mon Dec 3 22:08:35 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Roth X-Patchwork-Id: 203492 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 686FB2C008D for ; Tue, 4 Dec 2012 10:44:23 +1100 (EST) Received: from localhost ([::1]:48243 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TfeJL-0008Qw-VK for incoming@patchwork.ozlabs.org; Mon, 03 Dec 2012 17:16:23 -0500 Received: from eggs.gnu.org ([208.118.235.92]:49856) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TfeIR-0006kl-Lm for qemu-devel@nongnu.org; Mon, 03 Dec 2012 17:15:30 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TfeIO-00030I-Pv for qemu-devel@nongnu.org; Mon, 03 Dec 2012 17:15:27 -0500 Received: from mail-ie0-f180.google.com ([209.85.223.180]:34436) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TfeIL-0002zD-M9; Mon, 03 Dec 2012 17:15:21 -0500 Received: by mail-ie0-f180.google.com with SMTP id c10so6452708ieb.39 for ; Mon, 03 Dec 2012 14:15:20 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:from:to:cc:subject:date:message-id:x-mailer:in-reply-to :references; bh=iDTQYxwksTANA27L3IrBziAMLjrvgJUMkXAs4Romocc=; b=zeGlXHfR9WLTzlfSHF5Fctn764zH7nW+Dip8IXJsKvA8qn40t/o27bnWjwTMbO1Wvv bC8FB326U9ck3Oocb7eNvY/oeI6aQRckAllbRtZnY/xH69IQNOricaZ5Ongoi3EWk/B4 BQFlQwxOPSpR/jI7n1qDd5tsb/v3skZwUQnIPgKlkeZNolqTm8o9CfSTT15+nPKq2BLo U7G0qf0ppM+QI0KNPeYwwbmS3nQCsU5fJ+VeqknDKcylPqbvcnUKV/cN3BciiItuubsq 6c+o5SJMDJjVIzz1u5D2WE0sMTvK25/YrBrMZIFRLgqXXD6qmJOmyE8a6kmIV0jdEcXM CaIQ== Received: by 10.50.187.165 with SMTP id ft5mr649377igc.12.1354572920579; Mon, 03 Dec 2012 14:15:20 -0800 (PST) Received: from localhost ([32.97.110.59]) by mx.google.com with ESMTPS id em3sm8166331igc.7.2012.12.03.14.15.19 (version=TLSv1/SSLv3 cipher=OTHER); Mon, 03 Dec 2012 14:15:20 -0800 (PST) From: Michael Roth To: qemu-stable@nongnu.org Date: Mon, 3 Dec 2012 16:08:35 -0600 Message-Id: <1354572547-21271-12-git-send-email-mdroth@linux.vnet.ibm.com> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1354572547-21271-1-git-send-email-mdroth@linux.vnet.ibm.com> References: <1354572547-21271-1-git-send-email-mdroth@linux.vnet.ibm.com> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [fuzzy] X-Received-From: 209.85.223.180 Cc: aliguori@us.ibm.com, qemu-devel@nongnu.org Subject: [Qemu-devel] [PATCH 11/43] e1000: drop check_rxov, always treat RX ring with RDH == RDT as empty 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: Dmitry Fleytman Real HW always treats RX ring with RDH == RDT as empty. Emulation is supposed to behave the same. Reported-by: Chris Webb Reported-by: Richard Davies Signed-off-by: Dmitry Fleytman Signed-off-by: Stefan Hajnoczi (cherry picked from commit e5b8b0d4ba29fe1268ba049519a1b0cf8552a21a) Signed-off-by: Michael Roth --- hw/e1000.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/hw/e1000.c b/hw/e1000.c index ec3a7c4..4d4ac32 100644 --- a/hw/e1000.c +++ b/hw/e1000.c @@ -92,7 +92,6 @@ typedef struct E1000State_st { uint32_t rxbuf_size; uint32_t rxbuf_min_shift; - int check_rxov; struct e1000_tx { unsigned char header[256]; unsigned char vlan_header[4]; @@ -741,11 +740,11 @@ static bool e1000_has_rxbufs(E1000State *s, size_t total_size) int bufs; /* Fast-path short packets */ if (total_size <= s->rxbuf_size) { - return s->mac_reg[RDH] != s->mac_reg[RDT] || !s->check_rxov; + return s->mac_reg[RDH] != s->mac_reg[RDT]; } if (s->mac_reg[RDH] < s->mac_reg[RDT]) { bufs = s->mac_reg[RDT] - s->mac_reg[RDH]; - } else if (s->mac_reg[RDH] > s->mac_reg[RDT] || !s->check_rxov) { + } else if (s->mac_reg[RDH] > s->mac_reg[RDT]) { bufs = s->mac_reg[RDLEN] / sizeof(struct e1000_rx_desc) + s->mac_reg[RDT] - s->mac_reg[RDH]; } else { @@ -848,7 +847,6 @@ e1000_receive(NetClientState *nc, const uint8_t *buf, size_t size) if (++s->mac_reg[RDH] * sizeof(desc) >= s->mac_reg[RDLEN]) s->mac_reg[RDH] = 0; - s->check_rxov = 1; /* see comment in start_xmit; same here */ if (s->mac_reg[RDH] == rdh_start) { DBGOUT(RXERR, "RDH wraparound @%x, RDT %x, RDLEN %x\n", @@ -925,7 +923,6 @@ mac_writereg(E1000State *s, int index, uint32_t val) static void 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);