[U-Boot] [PATCH] net: e1000: Fix packet length conversion

Minghuan Lian Minghuan.Lian at nxp.com
Wed Jan 6 11:53:10 CET 2016


The length of the receiving packet descriptor is a 16bit integer
not 32bit. le32_to_cpu should be replaced by le16_to_cpu to
make the correct conversion. Otherwise, e1000 cannot work on
some kinds of big-endian platform.

Signed-off-by: Minghuan Lian <Minghuan.Lian at nxp.com>
---
 drivers/net/e1000.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/e1000.c b/drivers/net/e1000.c
index 2ba03ed..e3c6916 100644
--- a/drivers/net/e1000.c
+++ b/drivers/net/e1000.c
@@ -5169,7 +5169,7 @@ _e1000_poll(struct e1000_hw *hw)
 		return 0;
 	/* DEBUGOUT("recv: packet len=%d\n", rd->length); */
 	/* Packet received, make sure the data are re-loaded from RAM. */
-	len = le32_to_cpu(rd->length);
+	len = le16_to_cpu(rd->length);
 	invalidate_dcache_range((unsigned long)packet,
 				(unsigned long)packet +
 				roundup(len, ARCH_DMA_MINALIGN));
-- 
1.9.1



More information about the U-Boot mailing list