Browse Source

[rtl8139] Check for oversized packets when transmitting

An attempt to transmit a packet of 8192 bytes or larger will collide
with the status bits in the TX descriptor.  This gives the appearance
of the network card's transmit data path having just suddenly stopped
responding; iPXE is waiting for the card to report a TX completion
but, because of the status bit collision, the card thinks that the
descriptor has not yet been written.

Fix by explicitly checking for oversized packets in rtl_transmit().

Discovered during Fibre Channel over Ethernet testing, and debugged by
using gdb to examine the state of the emulated rtl8139 card in qemu.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
tags/v1.20.1
Michael Brown 14 years ago
parent
commit
e9efbcd84c
1 changed files with 8 additions and 0 deletions
  1. 8
    0
      src/drivers/net/rtl8139.c

+ 8
- 0
src/drivers/net/rtl8139.c View File

86
 #include <ipxe/nvo.h>
86
 #include <ipxe/nvo.h>
87
 
87
 
88
 #define TX_RING_SIZE 4
88
 #define TX_RING_SIZE 4
89
+#define TX_MAX_LEN 8192
89
 
90
 
90
 struct rtl8139_tx {
91
 struct rtl8139_tx {
91
 	unsigned int next;
92
 	unsigned int next;
383
 		return -ENOBUFS;
384
 		return -ENOBUFS;
384
 	}
385
 	}
385
 
386
 
387
+	/* Check for oversized packets */
388
+	if ( iob_len ( iobuf ) >= TX_MAX_LEN ) {
389
+		DBGC ( rtl, "rtl8139 %p TX too large (%zd bytes)\n",
390
+		       rtl, iob_len ( iobuf ) );
391
+		return -ERANGE;
392
+	}
393
+
386
 	/* Pad and align packet */
394
 	/* Pad and align packet */
387
 	iob_pad ( iobuf, ETH_ZLEN );
395
 	iob_pad ( iobuf, ETH_ZLEN );
388
 
396
 

Loading…
Cancel
Save