From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1LkL1u-0006hz-Qt for qemu-devel@nongnu.org; Thu, 19 Mar 2009 12:23:38 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1LkL1p-0006cN-TK for qemu-devel@nongnu.org; Thu, 19 Mar 2009 12:23:38 -0400 Received: from [199.232.76.173] (port=36855 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1LkL1p-0006bw-9Z for qemu-devel@nongnu.org; Thu, 19 Mar 2009 12:23:33 -0400 Received: from g5t0008.atlanta.hp.com ([15.192.0.45]:18920) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1LkL1p-0000aa-1p for qemu-devel@nongnu.org; Thu, 19 Mar 2009 12:23:33 -0400 Received: from g5t0030.atlanta.hp.com (g5t0030.atlanta.hp.com [16.228.8.142]) by g5t0008.atlanta.hp.com (Postfix) with ESMTP id DD6B024470 for ; Thu, 19 Mar 2009 16:23:28 +0000 (UTC) From: Alex Williamson Date: Thu, 19 Mar 2009 10:19:58 -0600 Message-ID: <20090319161936.24035.95774.stgit@kvm.aw> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Subject: [Qemu-devel] [PATCH][RESEND] 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);