Received: from eggs.gnu.org ([2001:4830:134:3::10]:50968) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XywGK-0002hI-IM for qemu-devel@nongnu.org; Thu, 11 Dec 2014 00:26:11 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XywG6-0001Gd-4g for qemu-devel@nongnu.org; Thu, 11 Dec 2014 00:26:04 -0500 Received: from skprod2.natinst.com ([130.164.80.23]:41112 helo=ni.com) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XywG5-0001GH-Ul for qemu-devel@nongnu.org; Thu, 11 Dec 2014 00:25:50 -0500 From: Richard Tollerton Date: Wed, 10 Dec 2014 23:23:47 -0600 Message-Id: <1418275427-18921-3-git-send-email-rich.tollerton@ni.com> In-Reply-To: <1418275427-18921-1-git-send-email-rich.tollerton@ni.com> References: <1418275427-18921-1-git-send-email-rich.tollerton@ni.com> Subject: [Qemu-devel] [PATCH v2 2/2] e1000: decrement RDT if equal to RDH List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Richard Tollerton , kraxel@redhat.com, Jeff Westfahl , mst@redhat.com Some drivers set RDT=RDH. Oddly, this works on real hardware. To work around this, autodecrement RDT when this happens. Signed-off-by: Richard Tollerton Signed-off-by: Jeff Westfahl --- hw/net/e1000.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/hw/net/e1000.c b/hw/net/e1000.c index 44ae3a8..b8cbfc1 100644 --- a/hw/net/e1000.c +++ b/hw/net/e1000.c @@ -1152,6 +1152,12 @@ mac_writereg(E1000State *s, int index, uint32_t val) static void set_rdt(E1000State *s, int index, uint32_t val) { + if (val == s->mac_reg[RDH]) { /* Decrement RDT if it's too big */ + if (val == 0) { + val = s->mac_reg[RDLEN] / sizeof(struct e1000_rx_desc); + } + val--; + } s->mac_reg[index] = val & 0xffff; if (e1000_has_rxbufs(s, 1)) { qemu_flush_queued_packets(qemu_get_queue(s->nic)); -- 2.1.3