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

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@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));

Hi Lian,
2016-01-06 16:41 GMT+08:00 Minghuan Lian Minghuan.Lian@nxp.com:
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.
This is a duplication of
https://patchwork.ozlabs.org/patch/559472/
Signed-off-by: Minghuan Lian Minghuan.Lian@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
U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
participants (2)
-
Miao Yan
-
Minghuan Lian