From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([140.186.70.92]:45652) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Rs5DU-00044h-FN for qemu-devel@nongnu.org; Mon, 30 Jan 2012 23:21:13 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Rs5DT-0005Dx-5J for qemu-devel@nongnu.org; Mon, 30 Jan 2012 23:21:12 -0500 Received: from serv2.oss.ntt.co.jp ([222.151.198.100]:36342) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Rs5DS-0005Cu-IN for qemu-devel@nongnu.org; Mon, 30 Jan 2012 23:21:11 -0500 Message-ID: <4F276C2C.8010409@oss.ntt.co.jp> Date: Tue, 31 Jan 2012 13:21:00 +0900 From: =?UTF-8?B?RmVybmFuZG8gTHVpcyBWw6F6cXVleiBDYW8=?= MIME-Version: 1.0 References: <1327889855.3455.2.camel@nexus.oss.ntt.co.jp> In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: quoted-printable 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: Igor Kovalenko , Anthony Liguori Cc: Mark McLoughlin , =?UTF-8?B?6KeS55SwIOWLh+S6ug==?= , qemu-devel@nongnu.org, "Michael S. Tsirkin" (2012=E5=B9=B401=E6=9C=8831=E6=97=A5 13:12), Igor Kovalenko wrote: > 2012/1/30 Fernando Luis V=C3=A1zquez Cao: >> 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 Rx= Overflow >> 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 car= d the >> emulator could recover from this situation. However some implementatio= ns 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 mechan= isms would >> prevent rtl8139 from receiving any packet. >> >> Letting packets go through when the overflow interrupt is enabled make= s 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 s= ome cases >> the 8139too device driver gets loaded and when under heavy load the ne= twork >> eventually stops working. >> >> Reported-by: Hayato Kakuta >> Tested-by: Hayato Kakuta >> Signed-off-by: Fernando Luis Vazquez Cao >> --- >> >> 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 =3D MOD2(s->RxBufferSize + s->RxBufPtr - s->RxBufAddr, >> s->RxBufferSize); >> - return (avail =3D=3D 0 || avail>=3D 1514); >> + return (avail =3D=3D 0 || avail>=3D 1514 || (s->IntrMask& Rx= Overflow)); >> } >> } >> >> >> > Acked-by: Igor Kovalenko Thank you for the review and the ack, Igor. Anthony, could you pick up this patch? Regards, Fernando