Browse Source

[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>
tags/v1.20.1
Michael Brown 11 years ago
parent
commit
5d3d62d8d7
1 changed files with 5 additions and 3 deletions
  1. 5
    3
      src/drivers/net/realtek.c

+ 5
- 3
src/drivers/net/realtek.c View File

549
 static void realtek_destroy_ring ( struct realtek_nic *rtl,
549
 static void realtek_destroy_ring ( struct realtek_nic *rtl,
550
 				   struct realtek_ring *ring ) {
550
 				   struct realtek_ring *ring ) {
551
 
551
 
552
-	/* Do nothing in legacy mode */
552
+	/* Reset producer and consumer counters */
553
+	ring->prod = 0;
554
+	ring->cons = 0;
555
+
556
+	/* Do nothing more if in legacy mode */
553
 	if ( rtl->legacy )
557
 	if ( rtl->legacy )
554
 		return;
558
 		return;
555
 
559
 
560
 	/* Free descriptor ring */
564
 	/* Free descriptor ring */
561
 	free_dma ( ring->desc, ring->len );
565
 	free_dma ( ring->desc, ring->len );
562
 	ring->desc = NULL;
566
 	ring->desc = NULL;
563
-	ring->prod = 0;
564
-	ring->cons = 0;
565
 }
567
 }
566
 
568
 
567
 /**
569
 /**

Loading…
Cancel
Save