U-Boot Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] net: sun8i_emac: exclude the FCS from received packet lengths
@ 2026-11-09  8:06 James Hilliard
  2026-11-21 21:58 ` Paul Kocialkowski
  0 siblings, 1 reply; 2+ messages in thread
From: James Hilliard @ 2026-11-09  8:06 UTC (permalink / raw)
  To: u-boot
  Cc: Jerome Forissier, Tom Rini, Paul Kocialkowski, Andre Przywara,
	James Hilliard

The RX descriptor length includes the four-byte Ethernet FCS. The driver
does not enable FCS stripping, so subtract it from the length returned
to the network stack after checking the complete frame length.

Otherwise the wol command treats the FCS as an optional four-byte
password when an Ethernet magic packet has no password. A four-byte
password is instead exported as six bytes containing part of the FCS.
IPv4 protocols generally hide this error by using their own lengths.

Signed-off-by: James Hilliard <james.hilliard1@gmail.com>
---
 drivers/net/sun8i_emac.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/net/sun8i_emac.c b/drivers/net/sun8i_emac.c
index 41c52f56d7a..0199e2b5c30 100644
--- a/drivers/net/sun8i_emac.c
+++ b/drivers/net/sun8i_emac.c
@@ -518,7 +518,8 @@ static int sun8i_emac_eth_recv(struct udevice *dev, int flags, uchar **packetp)
 
 	*packetp = (uchar *)(ulong)desc_p->buf_addr;
 
-	return length;
+	/* The descriptor length includes the FCS, not part of the payload. */
+	return length - ETH_FCS_LEN;
 }
 
 static int sun8i_emac_eth_send(struct udevice *dev, void *packet, int length)

---
base-commit: 1ed1749575f28b406c241218eb6a200574574a25
change-id: 20260928-submit-sun8i-emac-fcs-v1-5b0185c991c5

Best regards,
--  
James Hilliard <james.hilliard1@gmail.com>


^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-11-21 22:35 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-09  8:06 [PATCH] net: sun8i_emac: exclude the FCS from received packet lengths James Hilliard
2026-11-21 21:58 ` Paul Kocialkowski

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox