diff options
author | Michael Brown <mcb30@ipxe.org> | 2013-05-26 18:26:48 +0100 |
---|---|---|
committer | Michael Brown <mcb30@ipxe.org> | 2013-05-26 18:31:46 +0100 |
commit | 5d3d62d8d72bfd84122fb89e1ee5f9e4c65f46c7 (patch) | |
tree | ab9cdf819da0894d61cb022ea4d6175a4edb256d /src/drivers/net/realtek.c | |
parent | c4bce43c3c4d3c5ebb2d926b58ad16dc9642c19d (diff) | |
download | ipxe-5d3d62d8d72bfd84122fb89e1ee5f9e4c65f46c7.tar.gz |
[realtek] Fix reopening of legacy-mode 8139 NIC
realtek_destroy_ring() currently does nothing if the card is operating
in legacy (pre-RTL8139C+) mode. In particular, the producer and
consumer counters are incorrectly left holding their current values.
Virtual hardware (e.g. the emulated RTL8139 in qemu and similar VMs)
is tolerant of this behaviour, but real hardware will fail to transmit
if the descriptors are not used in the correct order.
Fix by resetting the producer and consumer counters in
realtek_destroy_ring() even if the card is operating in legacy mode.
Reported-by: Gelip <mrgelip@gmail.com>
Signed-off-by: Michael Brown <mcb30@ipxe.org>
Diffstat (limited to 'src/drivers/net/realtek.c')
-rw-r--r-- | src/drivers/net/realtek.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/src/drivers/net/realtek.c b/src/drivers/net/realtek.c index 1fd3931b6..498c233f8 100644 --- a/src/drivers/net/realtek.c +++ b/src/drivers/net/realtek.c @@ -549,7 +549,11 @@ static int realtek_create_ring ( struct realtek_nic *rtl, static void realtek_destroy_ring ( struct realtek_nic *rtl, struct realtek_ring *ring ) { - /* Do nothing in legacy mode */ + /* Reset producer and consumer counters */ + ring->prod = 0; + ring->cons = 0; + + /* Do nothing more if in legacy mode */ if ( rtl->legacy ) return; @@ -560,8 +564,6 @@ static void realtek_destroy_ring ( struct realtek_nic *rtl, /* Free descriptor ring */ free_dma ( ring->desc, ring->len ); ring->desc = NULL; - ring->prod = 0; - ring->cons = 0; } /** |