From e4dc9b78d7257dce5719517fc5258a0d65a8a31e Mon Sep 17 00:00:00 2001 From: Luiz Otavio O Souza Date: Fri, 17 Apr 2015 03:56:50 +0000 Subject: [PATCH] Fix the 'wrong packet header' errors for if_emac. Do not strip the ethernet CRC until we read all data from FIFO, otherwise the CRC bytes would be left in FIFO causing the failure of next packet (wrong packet header). When this error happens the receiver has to be disabled and the RX FIFO flushed, discarding valid packets. With this fix if_emac behaves a lot better. --- sys/arm/allwinner/if_emac.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/sys/arm/allwinner/if_emac.c b/sys/arm/allwinner/if_emac.c index 7828661c82a3..d43f301fa690 100644 --- a/sys/arm/allwinner/if_emac.c +++ b/sys/arm/allwinner/if_emac.c @@ -358,15 +358,13 @@ emac_rxeof(struct emac_softc *sc, int count) return; m->m_len = m->m_pkthdr.len = MCLBYTES; - len -= ETHER_CRC_LEN; - /* Copy entire frame to mbuf first. */ bus_space_read_multi_4(sc->emac_tag, sc->emac_handle, EMAC_RX_IO_DATA, mtod(m, uint32_t *), roundup2(len, 4) / 4); m->m_pkthdr.rcvif = ifp; - m->m_len = m->m_pkthdr.len = len; + m->m_len = m->m_pkthdr.len = len - ETHER_CRC_LEN; /* * Emac controller needs strict aligment, so to avoid