qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] rtl8139: honor RxOverflow flag in can_receive method
@ 2012-01-30  2:17 Fernando Luis Vázquez Cao
  2012-01-30 17:28 ` Igor Kovalenko
                   ` (2 more replies)
  0 siblings, 3 replies; 8+ messages in thread
From: Fernando Luis Vázquez Cao @ 2012-01-30  2:17 UTC (permalink / raw)
  To: qemu-devel, Anthony Liguori, Igor V. Kovalenko
  Cc: Mark McLoughlin, Michael S. Tsirkin

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 <kakuta.hayato@oss.ntt.co.jp>
Tested-by: Hayato Kakuta <kakuta.hayato@oss.ntt.co.jp>
Signed-off-by: Fernando Luis Vazquez Cao<fernando@oss.ntt.co.jp>
--- 

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));
     }
 }
 

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2012-02-14  7:33 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-01-30  2:17 [Qemu-devel] [PATCH] rtl8139: honor RxOverflow flag in can_receive method Fernando Luis Vázquez Cao
2012-01-30 17:28 ` Igor Kovalenko
2012-01-31  1:25   ` Fernando Luis Vázquez Cao
2012-01-31  4:12 ` Igor Kovalenko
2012-01-31  4:21   ` Fernando Luis Vázquez Cao
2012-02-01 22:11 ` Anthony Liguori
2012-02-03  2:16   ` Fernando Luis Vázquez Cao
2012-02-14  7:33     ` Fernando Luis Vázquez Cao

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).