Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1LhXOs-0004OH-6b for qemu-devel@nongnu.org; Wed, 11 Mar 2009 18:59:46 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1LhXOn-0004N8-Mk for qemu-devel@nongnu.org; Wed, 11 Mar 2009 18:59:45 -0400 Received: from [199.232.76.173] (port=40212 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1LhXOn-0004N5-H3 for qemu-devel@nongnu.org; Wed, 11 Mar 2009 18:59:41 -0400 Received: from g4t0014.houston.hp.com ([15.201.24.17]:7768) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1LhXOn-0002Pb-4i for qemu-devel@nongnu.org; Wed, 11 Mar 2009 18:59:41 -0400 Received: from g4t0009.houston.hp.com (g4t0009.houston.hp.com [16.234.32.26]) by g4t0014.houston.hp.com (Postfix) with ESMTP id 01A6924300 for ; Wed, 11 Mar 2009 22:59:39 +0000 (UTC) From: Alex Williamson Date: Wed, 11 Mar 2009 16:56:38 -0600 Message-ID: <20090311225557.12188.72757.stgit@kvm.aw> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Subject: [Qemu-devel] [PATCH] qemu:e1000: Fix RX descriptor low threshold interrupt logic Reply-To: qemu-devel@nongnu.org List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: alex.williamson@hp.com The RXDMT0 interrupt is supposed to fire when the number of free RX descriptors drops to some fraction of the total descriptors. However in practice, it seems like we're adding this interrupt cause on every RX. Fix the logic to treat (tail - head) as the number of free entries rather than the number of used entries. Signed-off-by: Alex Williamson --- hw/e1000.c | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diff --git a/hw/e1000.c b/hw/e1000.c index e6155d6..1644201 100644 --- a/hw/e1000.c +++ b/hw/e1000.c @@ -666,8 +666,8 @@ e1000_receive(void *opaque, const uint8_t *buf, int size) n = E1000_ICS_RXT0; if ((rdt = s->mac_reg[RDT]) < s->mac_reg[RDH]) rdt += s->mac_reg[RDLEN] / sizeof(desc); - if (((rdt - s->mac_reg[RDH]) * sizeof(desc)) << s->rxbuf_min_shift >= - s->mac_reg[RDLEN]) + if (((rdt - s->mac_reg[RDH]) * sizeof(desc)) <= s->mac_reg[RDLEN] >> + s->rxbuf_min_shift) n |= E1000_ICS_RXDMT0; set_ics(s, 0, n);