[ipxe-devel] [PATCH] [epic100] Fix: wrong field used as rx packet length

Alexey darkover at corbina.com.ua
Thu May 24 19:41:40 UTC 2012


Problem: ifstat reports RX=RXE, packets are on wire, but not processed
by ipxe. DHCP Offer not accepted. Debugging shows wrong rx packet length
used.

Datasheet LAN83C171 pp. 41-42 defines 'rx packet length' as upper word
of 'status' dword field of the receive descriptor table. Linux kernel
driver use this field and works.

LAN83C171:
http://www.smsc.com/media/Downloads_Archive/discontinued/83c171.pdf

Tested on SMC EtherPower II.

Signed-off-by: Alexey Smazhenko <darkover at corbina.com.ua>
---
diff --git a/src/drivers/net/epic100.c b/src/drivers/net/epic100.c
index b478fab..884eb72 100644
--- a/src/drivers/net/epic100.c
+++ b/src/drivers/net/epic100.c
@@ -376,7 +376,7 @@ epic100_poll(struct nic *nic, int retrieve)
 {
     int entry;
     int retcode;
-    int status;
+    unsigned long status;
     entry = cur_rx % RX_RING_SIZE;
 
     if ((rx_ring[entry].status & cpu_to_le32(RRING_OWN)) == RRING_OWN)
@@ -401,7 +401,7 @@ epic100_poll(struct nic *nic, int retrieve)
 	retcode = 0;
     } else {
 	/* Omit the four octet CRC from the length. */
-	nic->packetlen = le32_to_cpu((rx_ring[entry].buflength))- 4;
+	nic->packetlen = (status >> 16) - 4;
 	memcpy(nic->packet, &rx_packet[entry * PKT_BUF_SZ], nic->packetlen);
 	retcode = 1;
     }






More information about the ipxe-devel mailing list