]> git.proxmox.com Git - qemu.git/commit
rtl8139: honor RxOverflow flag in can_receive method
authorFernando Luis Vazquez Cao <fernando@oss.ntt.co.jp>
Mon, 4 Jun 2012 14:35:11 +0000 (17:35 +0300)
committerMichael S. Tsirkin <mst@redhat.com>
Thu, 7 Jun 2012 14:18:58 +0000 (17:18 +0300)
commitfee9d348ffc5c9f80068086799a948996f633f7e
tree711ab7d8e8d0d4a66bea6f6aa7281e8d4b1eaa94
parente9adf2605da1827b223807b4a2efafe97d7568e6
rtl8139: honor RxOverflow flag in can_receive method

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>
Acked-by: Igor Kovalenko <igor.v.kovalenko@gmail.com>
Signed-off-by: Fernando Luis Vazquez Cao <fernando@oss.ntt.co.jp>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
hw/rtl8139.c