|
|
5544c1 |
From 154f1e30c09d261b12937c385632c05474989b02 Mon Sep 17 00:00:00 2001
|
|
|
5544c1 |
From: Bo Yang <boyang@suse.com>
|
|
|
5544c1 |
Date: Wed, 29 Aug 2012 19:26:11 +0800
|
|
|
5544c1 |
Subject: [PATCH] eepro100: Fix network hang when rx buffers run out
|
|
|
5544c1 |
|
|
|
5544c1 |
This is reported by QA. When installing os with pxe, after the initial
|
|
|
5544c1 |
kernel and initrd are loaded, the procedure tries to copy files from install
|
|
|
5544c1 |
server to local harddisk, the network becomes stall because of running out of
|
|
|
5544c1 |
receive descriptor.
|
|
|
5544c1 |
|
|
|
5544c1 |
[Whitespace fixes and removed qemu_notify_event() because Paolo's
|
|
|
5544c1 |
earlier net patches have moved it into qemu_flush_queued_packets().
|
|
|
5544c1 |
|
|
|
5544c1 |
Additional info:
|
|
|
5544c1 |
|
|
|
5544c1 |
I can reproduce the network hang with a tap device doing a iPXE HTTP
|
|
|
5544c1 |
boot as follows:
|
|
|
5544c1 |
|
|
|
5544c1 |
$ qemu -enable-kvm -m 1024 \
|
|
|
5544c1 |
-netdev tap,id=netdev0,script=no,downscript=no \
|
|
|
5544c1 |
-device i82559er,netdev=netdev0,romfile=80861209.rom \
|
|
|
5544c1 |
-drive if=virtio,cache=none,file=test.img
|
|
|
5544c1 |
iPXE> ifopen net0
|
|
|
5544c1 |
iPXE> config # set static network configuration
|
|
|
5544c1 |
iPXE> kernel http://mirror.bytemark.co.uk/fedora/linux/releases/17/Fedora/x86_64/os/images/pxeboot/vmlinuz
|
|
|
5544c1 |
|
|
|
5544c1 |
I needed a vanilla iPXE ROM to get to the iPXE prompt. I think the boot
|
|
|
5544c1 |
prompt has been disabled in the ROMs that ship with QEMU to reduce boot
|
|
|
5544c1 |
time.
|
|
|
5544c1 |
|
|
|
5544c1 |
During the vmlinuz HTTP download there is a network hang. hw/eepro100.c
|
|
|
5544c1 |
has reached the end of the rx descriptor list. When the iPXE driver
|
|
|
5544c1 |
replenishes the rx descriptor list we don't kick the QEMU net subsystem
|
|
|
5544c1 |
and event loop, thereby leaving the tap netdev without its file
|
|
|
5544c1 |
descriptor in select(2).
|
|
|
5544c1 |
|
|
|
5544c1 |
Stefan Hajnoczi <stefanha@gmail.com>]
|
|
|
5544c1 |
|
|
|
5544c1 |
Signed-off-by: Bo Yang <boyang@suse.com>
|
|
|
5544c1 |
Signed-off-by: Stefan Hajnoczi <stefanha@gmail.com>
|
|
|
5544c1 |
(cherry picked from commit 1069985fb132cd4324fc02d371f1e61492a1823f)
|
|
|
5544c1 |
|
|
|
5544c1 |
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
|
|
|
5544c1 |
---
|
|
|
5544c1 |
hw/eepro100.c | 4 +++-
|
|
|
5544c1 |
1 file changed, 3 insertions(+), 1 deletion(-)
|
|
|
5544c1 |
|
|
|
5544c1 |
diff --git a/hw/eepro100.c b/hw/eepro100.c
|
|
|
5544c1 |
index 50d117e..5b23116 100644
|
|
|
5544c1 |
--- a/hw/eepro100.c
|
|
|
5544c1 |
+++ b/hw/eepro100.c
|
|
|
5544c1 |
@@ -1036,6 +1036,7 @@ static void eepro100_ru_command(EEPRO100State * s, uint8_t val)
|
|
|
5544c1 |
}
|
|
|
5544c1 |
set_ru_state(s, ru_ready);
|
|
|
5544c1 |
s->ru_offset = e100_read_reg4(s, SCBPointer);
|
|
|
5544c1 |
+ qemu_flush_queued_packets(&s->nic->nc);
|
|
|
5544c1 |
TRACE(OTHER, logout("val=0x%02x (rx start)\n", val));
|
|
|
5544c1 |
break;
|
|
|
5544c1 |
case RX_RESUME:
|
|
|
5544c1 |
@@ -1770,7 +1771,8 @@ static ssize_t nic_receive(NetClientState *nc, const uint8_t * buf, size_t size)
|
|
|
5544c1 |
if (rfd_command & COMMAND_EL) {
|
|
|
5544c1 |
/* EL bit is set, so this was the last frame. */
|
|
|
5544c1 |
logout("receive: Running out of frames\n");
|
|
|
5544c1 |
- set_ru_state(s, ru_suspended);
|
|
|
5544c1 |
+ set_ru_state(s, ru_no_resources);
|
|
|
5544c1 |
+ eepro100_rnr_interrupt(s);
|
|
|
5544c1 |
}
|
|
|
5544c1 |
if (rfd_command & COMMAND_S) {
|
|
|
5544c1 |
/* S bit is set. */
|
|
|
5544c1 |
--
|
|
|
5544c1 |
1.7.12.1
|
|
|
5544c1 |
|