From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([140.186.70.92]:35934) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RsiPX-0000C7-Nb for qemu-devel@nongnu.org; Wed, 01 Feb 2012 17:12:16 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RsiPV-00008q-IJ for qemu-devel@nongnu.org; Wed, 01 Feb 2012 17:12:15 -0500 Received: from e39.co.us.ibm.com ([32.97.110.160]:39945) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RsiPV-000087-Co for qemu-devel@nongnu.org; Wed, 01 Feb 2012 17:12:13 -0500 Received: from /spool/local by e39.co.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Wed, 1 Feb 2012 15:12:10 -0700 Received: from d03relay05.boulder.ibm.com (d03relay05.boulder.ibm.com [9.17.195.107]) by d03dlp01.boulder.ibm.com (Postfix) with ESMTP id CB6DF1FF0051 for ; Wed, 1 Feb 2012 15:12:01 -0700 (MST) Received: from d03av01.boulder.ibm.com (d03av01.boulder.ibm.com [9.17.195.167]) by d03relay05.boulder.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id q11MBe7F155764 for ; Wed, 1 Feb 2012 15:11:42 -0700 Received: from d03av01.boulder.ibm.com (loopback [127.0.0.1]) by d03av01.boulder.ibm.com (8.14.4/8.13.1/NCO v10.0 AVout) with ESMTP id q11MBdhg032458 for ; Wed, 1 Feb 2012 15:11:39 -0700 Message-ID: <4F29B89A.3010101@us.ibm.com> Date: Wed, 01 Feb 2012 16:11:38 -0600 From: Anthony Liguori MIME-Version: 1.0 References: <1327889855.3455.2.camel@nexus.oss.ntt.co.jp> In-Reply-To: <1327889855.3455.2.camel@nexus.oss.ntt.co.jp> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Subject: Re: [Qemu-devel] [PATCH] rtl8139: honor RxOverflow flag in can_receive method List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: =?UTF-8?B?RmVybmFuZG8gTHVpcyBWw6F6cXVleiBDYW8=?= Cc: Mark McLoughlin , qemu-devel@nongnu.org, "Michael S. Tsirkin" On 01/29/2012 08:17 PM, Fernando Luis Vázquez Cao wrote: > Some drivers (Linux' 8139too among them) rely on the NIC injecting an interrupt > in the event of a receive buffer overflow and, accordingly, set the RxOverflow > bit in the interrupt mask. Unfortunately rtl8139's can_receive method ignores > the RxOverflow flag, which may lead to a situation where rtl8139 stops receiving > packets (can_receive returns 0) when the receive buffer becomes full. > > If the driver eventually read from the receive buffer or reset the card the > emulator could recover from this situation. However some implementations only > do this upon receiving an interrupt with either RxOK or RxOverflow set in the > ISR; interrupt that will never come because QEMU's flow control mechanisms would > prevent rtl8139 from receiving any packet. > > Letting packets go through when the overflow interrupt is enabled makes the > QEMU emulator compliant to the spec and solves the problem. > > This patch should fix a relatively common (in our experience) network stall > observed when running enterprise distros with rtl8139 as the NIC; in some cases > the 8139too device driver gets loaded and when under heavy load the network > eventually stops working. > > Reported-by: Hayato Kakuta > Tested-by: Hayato Kakuta > Signed-off-by: Fernando Luis Vazquez Cao Applied. Thanks. Regards, Anthony Liguori > --- > > diff -urNp qemu-kvm-orig/hw/rtl8139.c qemu-kvm/hw/rtl8139.c > --- qemu-kvm-orig/hw/rtl8139.c 2012-01-12 20:55:27.000000000 +0900 > +++ qemu-kvm/hw/rtl8139.c 2012-01-18 17:20:12.000000000 +0900 > @@ -824,7 +824,7 @@ static int rtl8139_can_receive(VLANClien > } else { > avail = MOD2(s->RxBufferSize + s->RxBufPtr - s->RxBufAddr, > s->RxBufferSize); > - return (avail == 0 || avail>= 1514); > + return (avail == 0 || avail>= 1514 || (s->IntrMask& RxOverflow)); > } > } > > > > >