From patchwork Thu Oct 18 18:59:11 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Fleytman X-Patchwork-Id: 192418 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 37DE82C0096 for ; Fri, 19 Oct 2012 06:11:40 +1100 (EST) Received: from localhost ([::1]:45023 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TOvVK-0005QW-0m for incoming@patchwork.ozlabs.org; Thu, 18 Oct 2012 15:11:38 -0400 Received: from eggs.gnu.org ([208.118.235.92]:45450) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TOvV7-0005Ho-Iq for qemu-devel@nongnu.org; Thu, 18 Oct 2012 15:11:26 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TOvV2-0002eB-Rj for qemu-devel@nongnu.org; Thu, 18 Oct 2012 15:11:25 -0400 Received: from mail-wi0-f175.google.com ([209.85.212.175]:33027) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TOvV2-0002dt-IF for qemu-devel@nongnu.org; Thu, 18 Oct 2012 15:11:20 -0400 Received: by mail-wi0-f175.google.com with SMTP id hq4so1974688wib.10 for ; Thu, 18 Oct 2012 12:11:19 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references :x-gm-message-state; bh=tfkjTYGlO0QmBIOH0X6cLm+aSf4CL0fua1WtcJCbWOo=; b=F/YdDurZx0z0733FuyKclkaszvESxmM6JHSePMp1hfELDcinNbxawZsGWoVQFoWeiL BoZ/uFhKORLbmggJcPCr28ZM2zvuJXqhf1Mw1BsFcWte5ZboQyN78yFqMWyf0sN8UU/f iprKcylhbFBgsqUORBQMh9glQfAlrOagmMka2r1rd5Rz4VDJgBvYOdUqIKpcorc3FRAl N/kjUfhcr/EGKZRzSVHV90Ib8dKuLMoE3zbay0r9/a/BV4mv3cu/I5RcG+vNwQlpURDo 5UEehj+cdIEGCJzJEUbSArejqOGRIH/hSBhKJVmiHhs3RBRVF2Oj2iOHRjqQ2ihZ70bL 19yA== Received: by 10.180.8.134 with SMTP id r6mr13328939wia.18.1350587479763; Thu, 18 Oct 2012 12:11:19 -0700 (PDT) Received: from Snarl.daynix ([91.205.155.63]) by mx.google.com with ESMTPS id dm3sm35122121wib.3.2012.10.18.12.11.17 (version=TLSv1/SSLv3 cipher=OTHER); Thu, 18 Oct 2012 12:11:19 -0700 (PDT) From: Dmitry Fleytman To: qemu-devel@nongnu.org Date: Thu, 18 Oct 2012 20:59:11 +0200 Message-Id: <1350586751-19050-2-git-send-email-dmitry@daynix.com> X-Mailer: git-send-email 1.7.11.4 In-Reply-To: <1350586751-19050-1-git-send-email-dmitry@daynix.com> References: <1350586751-19050-1-git-send-email-dmitry@daynix.com> X-Gm-Message-State: ALoCoQnYsVLm+zEN79jjrwF7shbZZ2xMUz9kfNA7lOiuBxkTWISC5wAPpU+h9Ig1WX92Dw1TC3Up X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 209.85.212.175 Cc: Yan Vugenfirer , Alexander Duyck , Dmitry Fleytman , Chris Webb , Richard Davies Subject: [Qemu-devel] [PATCH V2] Drop check_rxov, always treat RX ring with RHD == 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 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 --- hw/e1000.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/hw/e1000.c b/hw/e1000.c index 63fee10..ab39d47 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);